Sunday, September 25, 2011

Getting Up While It's Still Dark

Now that fall is upon us, Scott and I have noticed that it's become much more difficult to get up in the mornings because the sun hasn't risen yet.  My alarm goes off at the same time, but I find myself hitting snooze much more than I used to.  We've also noticed that it's much harder to stay awake with the shorter days and longer periods of darkness.

Scott grew up in a household that had a light box.  No, not the kind for growing illegal plants in your garage.  The kind for fighting off Seasonal Affective Disorder.  A quick search for such products on Amazon revealed that we could get a Phillips Wake Up Light that would slowly light up prior to alarm time, and then at alarm time would play a radio station or soothing sounds of our choice.

After a couple days of use, I honestly can't believe that I've survived this long without this product.  I really, really needed this when I was teaching.  How many groggy mornings could I have avoided with this simple machine?

We've now got two of these light boxes, one in the bedroom for waking up, and one in the kitchen that we use while we eat breakfast.  Both of us can already tell a difference.

Friday, September 9, 2011

Send an Email When a Google Form is Submitted

I'm building a new website to save my department from the terror that is Drupal.  I've used RapidWeaver, which I highly recommend for all you Mac users out there.

We need to have web forms that can be submitted for various things- being added to our mailing list, reserving a meeting space, inquiries about applications, etc.

Being married to a Google software engineer, I think to myself, "Easy!  I'll create Google Forms and embed them into my webpage.  No PHP, no database, cloud storage, easy to edit, it will be great!"

The creation of the forms and embedding them into the web page was easy.  An unforeseen issue, however, was the fact that each form on the website corresponded to a different staff member's job.  There's currently no easy way through the Forms interface to set up an automatic email to an outside email address when a user submits the form.

Today, though, I did manage to find a way to duct tape a solution together.

(Full Disclosure: I am NOT a software engineer and I did NOT write this code myself.)

First, I found a help page that described the code to insert in the script editor of the spreadsheet where the form's data gets stored:

Use Tools>Script Editor in the new Forms interface to pop up this screen.
Here is the code:


function emailAlert() {
  var Spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var SS = Spreadsheet.getSheets()[0];
  var submittedData = SS.getRange(SS.getLastRow(), 2, 1, SS.getLastColumn()-1).getValues();
  var headerData = SS.getRange(1, 2, 1, SS.getLastColumn()-1).getValues();
 
  var yourEmail = 'email';//Change it to yours
  var emailSubject = 'Form Submission';//Change as per your requirement
  var htmlBody ='<table><tbody>';
  for(var i=0; i < SS.getLastColumn()-1; i++){
    htmlBody += '<tr><td>'+headerData[0][i]+'</td><td>'+submittedData[0][i]+'</td></tr>';
  }
  htmlBody += '</tbody></table>';
  MailApp.sendEmail(yourEmail, emailSubject, 'body', {htmlBody : htmlBody});
}



I was super proud of myself that I even got the script to run at all.  But then I was like, "Wait, it needs to run automatically when the form is submitted!  Crap!"

So Scott pointed me to another help page that describes setting up triggers for a specific event.  You can have the script run automatically whenever the form is submitted:

Select "Current script's triggers..." to add a new trigger to this script.

The last pull-down menu allows you to select "On Form Submit."


On testing, this combo has worked beautifully!  I am certain that I'm not the only person in the world who needs this kind of functionality, and I find it interesting that Google doesn't have all of this information in one easy-to-find place!

Saturday, September 3, 2011

Cooking? Meh.

I've recently come to a pretty big realization, one that took a long time for me to admit to myself.  I've tried to fight it for a long time, because I've felt like the opposite should be true.  But it isn't.  And it's time that I be true to myself.

::Deep breath::

It turns out that I just really don't like cooking.  A lot of my friends enjoy cooking as a hobby.  I mean, a lot of them.  You'd think that through the many years of dinner parties, where we all get together and spend the evening cooking a big, adventurous, elaborate meal, that I would have picked up the Joy of Cooking through osmosis.

Unfortunately, though, it seems that it's not that easy.  It's not that I'm unwilling to cook.  I understand on an intellectual level that I must know how to apply heat to food in order to sustain my body.  But I simply don't enjoy the process of doing so.

You have to get all the food out of the refrigerator.  Boring.  You have to get the cutting board and knife out of the cabinet.  Boring.  You have to wash the veggies.  Boring.  Then you have to actually cut the veggies.  Super boring.

By the time I've accomplished my part of the process, Scott's already nearly finished with his.  He's much faster than I am.  It doesn't seem to matter which part of cooking I do, Scott is always faster at his part.  By the time I'm finished chopping up the stupid vegetables, I'm already so frustrated with the whole process that if it were up to me, we would just eat nuts for dinner.

Next comes the negotiation with Scott.  "If you sautee these vegetables for me, I'll clean the kitchen myself."  We both know it's a farce.  We will both clean the kitchen together after we eat and watch an episode of Eureka on Netflix.  But really, I can't stand to put the stupid veggies in the stupid pan which I will inevitably make too hot and then the dumb things will burn.  So Scott, forced into a corner of either cooking the veggies himself or not having veggies at all, cooks the veggies.


Like I said, for a while, I felt bad about this horrible secret.  But then I realized that it's ok.  Lots of people have to do things every day that they don't like.  And I understand that just because I don't like cooking doesn't exempt me from doing it.  At least, part of it.  I do, after all, manage to successfully chop up those veggies.  Sometimes I do even apply heat to them, much as I dislike it.  But I really can't see having cooking be a hobby.  To me, it's thinly-veiled work.

So the next time we have a dinner party, don't be surprised if I'm not jumping for joy at the prospect of chopping up those onions.  Cooking just isn't my thing.