Remembrance Day: Armistice + 100 years

Today is the 100th anniversary of the armistice that ended World War I.  A day to pay respects and honour to the millions that served and died in The Great War and the wars that followed.

Lest We Forget
Lest We Forget

In Flander’s Fields
In Flanders fields the poppies blow
Between the crosses, row on row
That mark our place; and in the sky
The larks, still bravely singing, fly
Scarce heard amid the guns below.

We are the Dead. Short days ago
We lived, felt dawn, saw sunset glow,
Loved and were loved, and now we lie
In Flanders fields.

Take up our quarrel with the foe:
To you from failing hands we throw
The torch; be yours to hold it high.
If ye break faith with us who die
We shall not sleep, though poppies grow
In Flanders fields.

Lt. Col. John McRae (1872-1918)

At 11AM, bells will ring in remembrance across the US.  When you hear them, stop a moment and remember their sacrifice.

US WW I Centennial Commission: Bells of Peace
Bells of Peace

Validation in Laravel Artisan commands

One of the things I like most about using Laravel is that most everything I’ve needed to do so far is pretty intuitive.  If I try to code up something the way I think it’s supposed to work, usually it does.

I’ve been working on adding some new Artisan commands to my equipment database to handle some of the back-end administrative tasks that I’d normally have to fire up a browser for.

Naturally I want to validate the input.  Laravel’s got some really nice validation rules that would be nice to use in my new artisan commands.  The documentation covers doing validation on incoming HTTP requests, but isn’t clear on whether the Validator can be used more generically.

Looking at the documentation for manually creating validators, a Validator instance takes two arrays: an array with the data to be validated, and an array containing the validation rules.

It seemed like I could use the Validator facade pretty much anywhere as long as I had arrays of data and validation rules.  In my artisan commands, I added a use statement for the Validator facade,

use Illuminate\Support\Facades\Validator;

and the rest mostly followed the manual validator creation docs.

$validator = Validator::make($model->toArray(), [
  // validation rules
]);

if ($validator->fails()) {
  // show validation errors and exit
}
else {
  // do stuff with validated data
}

Much happiness ensued when I tested things out and saw that the validations were working just like I thought they should.

Dipping my toes into org-mode

I’ve taken one of the older but still very capable laptops in my collection and put it to use as my “school” computer.  The goal is to have something I can lug around and use for research, number crunching, and my research notebook.  Then I don’t have to worry about trying to keep all that stuff in sync if I were to use my work and home desktop computers.

My handwriting can get pretty messy, and even I have a hard time reading my own handwriting sometimes.  I decided I wanted to do some kind of electronic lab notebook to keep my research notes, data, bibliography, and whatnot. 

I’ve been making an effort to spend more time in Emacs, and I have a few developer friends who rave about org-mode, so it seemed like a promising choice.

A quick Google search returned a few blog posts by people who are already using org-mode for research lab notes and writing papers and other research related tasks.  Plenty of prior work out there to learn from as I develop my own workflow.

Back on the PhD wagon

Learned earlier this week that my application to be readmitted to the Clemson-MUSC Bioengineering PhD program was approved, so I’ll be a student again starting with the Spring 2019 semester.

Fortunately, I won’t have to take anymore courses. Just need to figure out the research project(s), do the research, and then write everything up.

Easy peasy, right?

The semester starts January 9, so I get to be a student for my birthday.

“It seemed like a good idea at the time…”

– Me, 2009.  Me again, 2018
PhD Comics: Raiders of the Lost Dissertation  by Jorge Cham
PhD Comics: Raiders of the Lost Dissertation