Teaching the dog about Santa

For the last month or two, Quinn and I have been going out for walks after the kids are in bed. Its quiet, the dog has a great time, and we get to talk for an hour (tonight it was iPad woes and trying to remember this story about the SR-71 and a Navy Hornet). I’ve been feeling better, and am a little smaller, so its a win all the way around!

It is now bunny season. They are everywhere, and they are not smart. They will sit very still, even after Butter sees them. They will sit very still until she’s almost convinced herself that they aren’t really there. That’s when they bolt, and Butter tries to take our arms off bolting after them. The worst part is that they never seem to run into cover, they run along it, so she can see them for the longest possible time.


So, tonight there was a real winner. He sat, still as a stone, until Butter was about 6 feet away from him. Then he ran, along the road, for about 20 feet (if you’ve ever seen Butter run, you know that’s not nearly far enough) to the corner of a fence. And sat there staring at the dog, who was on high alert and at the very end of her leash. It would be worrying, but her ears flop into her eyes, so she just looks ridiculous.

Quinn says, “I wonder what she would do if I ran after the bunny, and pretended to catch it.” I can see the wheels turning in his head, even in the dark.

“Don’t you dare.”

But the bunny isn’t moving, even as we keep walking toward it (he was between us and home; I don’t torture bunnies for fun). Quinn keeps giggling to himself, thinking about chasing the bunny, and the dog’s reaction. And the bunny still isn’t moving and we’re back to a 6 foot lead.

I sighed. No way around it. “Please chase the bunny.”

So he does. He runs towards the bunny, who is completely confused, and takes a second to start running, too. Butter tried to take off with him, but I was ready for it and she didn’t get anywhere. The bunny high-tailed it towards the back of a house, and Quinn went after it, just into a shadow.

This is where the fun starts, you see. He made growly, eating noises. Butter could not believe it. Quinn caught the bunny and ate it. She spent the rest of the walk looking for her own bunny to catch and eat. (He did not really catch the bunny, but Butter was firmly convinced her dad was a mighty predator tonight.)

Quinn wants to get a toy bunny (safe for dogs) and carry it with him on our walks. He’s going to chase another bunny out of harm’s way, and bring back the toy to give to Butter. She will firmly believe that he’s sharing his kill with her. He says, “It will be like teaching her about Santa Clause!” because she will be firmly convinced that is was bunnies taste like.

I’m not sure if this is going to be hysterical, or the start of many bad times for the local bunnies.

Good thing there’s lots of them.

NiFi HTTP Service

I’m attempting to set up an HTTP server in NiFi to accept uploads and process them on-demand.  This gets tricky because I want to submit the files using an existing web application that will not be served from NiFi, which leads to trouble with XSS (Cross-Site Scripting) and setting up CORS (Cross Origin Resource Sharing [1]).

The trouble starts with just trying to PUT or POST a simple file.  The error in Firefox reads:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource (Reason: CORS header 'Access-Control-Allow-Origin' missing).

You can serve up the Javascript that actually performs the upload from NiFi and side-step XSS, but you may still run into trouble with CORS.  You’ll have trouble even if NiFi and your other web server live on the same host (using different ports, of course), as they’re considered different hosts for the purposes of XSS prevention.

handlehttpresponse screen shot
HandleHttpResponse processor config

To make this work, you’ll need to enable specific headers in the HandleHttpResponse processor.  Neither the need to set some headers, nor the headers that need to be set, are documented by NiFi at this time (so far as I can tell).

  1. Open the configuration of the HandleHttpResponse processor
  2. Add the following headers and values as properties and values, but see below for notes regarding the values
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS
    Access-Control-Allow-Headers: Accept, Accept-Encoding, Accept-Language, Connection, Content-Length, Content-Type, DNT, Host, Referer, User-Agent, Origin, X-Forwarded-For

You may want to review the value for Access-Control-Allow-Origin, as the wildcard may allow access to unexpected hosts.  If your server is public-facing (why would you do that with NiFi?) then you certainly don’t want a wildcard here.  The wildcard makes configuration much simpler if NiFi is strictly interior-facing, though.

The specific values to set for Access-Control-Allow-Methods depend on what you’re doing.  You’ll probably need OPTIONS for most cases.  I’m serving up static files so I need GET, and I’m receiving uploads that may or may not be chunked, so I need POST and PUT.

The actual headers needed for Access-Control-Allow-Headers is a bit variable.  A wildcard is not an acceptable value here, so you’ll have to list every header you need separately — and there are a bunch of possible headers.  See [3] for an explanation and a fairly comprehensive list of possible headers.  Our list contains a small subset that covers our basic test cases; your mileage may vary.

You may also want to set up a RouteOnAttribute processor to ignore OPTIONS requests (${http.method:equals('OPTIONS')}), otherwise you might see a bunch of zero-byte files in your flow.


[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

[2] http://stackoverflow.com/questions/24371734/firefox-cors-request-giving-cross-origin-request-blocked-despite-headers

[3] http://stackoverflow.com/questions/13146892/cors-access-control-allow-headers-wildcard-being-ignored

Weird Al Yankovic, In Concert

Weird Al Yankovic, promotional photoWeird Al Yankovic was a big part of Meghan’s and my childhood, and pretty much anyone in our generation.  You could say he’s a hero of sorts.  When I found out, quite by accident, that his latest tour had dates near us I bought tickets the same day.  The only decision was which venue.

I chose the Lowell Summer Music Series; as Meghan said, if it rains we would be able to say that not only have we seen Weird Al live, but we saw him in a high school gymnasium.  (The high school next door is the rain location.)  It’s outdoors and BYOBlanket; so long as it didn’t rain and move indoors the kids are free.

So, on the appointed date and earliest possible time after work (which was earlier today, as I write this) we packed up the kids and a blanket and headed to the park to stake out a spot.

Mandatory Fun stage background
The stage, shortly before the show started. They waited for dark so they could recreate the roaming camera scene from the ‘Tacky’ video (which was the opening number)

The show was flawless.  It was small enough to be fun, large enough to let the crowd’s energy really flow, and turned-down enough that I wasn’t deaf at the end.  Alpha and Beta spent most of the show in a corner of the park with some other kids, but they enjoyed the show immensely as well.  Their view was better than ours, despite the distance — they could see over the crowd, while we had to contend with the sound booth/tent.

weird al in a fat suit
Weird Al in the fat suit singing ‘Fat’. My childhood has been redeemed. Apologies for the potato quality, all I had was my cell phone and the stage lighting was particularly bright and direct during this song.

There was a good mix of old and new songs over a couple of hours, interspersed with video clips while the band changed costumes.  Among other songs (in no particular order), there was Tacky (the opening number), Dare to Be Stupid, the aforementioned Fat, Amish Paradise, White and Nerdy, an awesome arrangement of Like A Surgeon set to the “unplugged” arrangement of Eric Clapton’s Layla (really), a couple of polkas interspersed throughout (of course), and closing with Yoda.

Mandatory Fun
Cover of Weird Al’s latest album and tour

The girls were buzzing as we left the park, and wide awake despite a) being 10 pm, b) after a regular day of school, and c) on the first week of school.  They can sleep in tomorrow, there’s no school, and Meghan and I aren’t setting an alarm — our jobs are flexible enough that we can afford to be a little late.