RIP My Forester

Driving home from work today my Subaru Forester caught fire. As I was heading north on 146 I heard a bang and black smoke came out the back of my Forester. That’s about when I realized my engine had died and I’d lost power steering. I coasted over to the side of the road and came to a stop. That’s when I smelled burning plastic and saw all the smoke coming out from under my hood. Things didn’t get any better when I opened the hood. The engine was on fire!

IMG_20190222_140007981_HDR

I quickly pulled all my stuff out of the car and then dialed 911. I was in such a panic I dropped the phone twice before I was able to use the phone. The operator connected me to the North Smithfield Rhode Island police department. They said that the fire department was on their way to put out the fire.

I stood on the embankment a safe distance from the car as the fire grew bigger. Bits of molten flaming plastic were dripping on to the ground below my car. The car had almost 200 thousand miles on it. I had already put a down payment on a new car and was going to trade the Forester in on Saturday. Not any more.

The flames grew higher. Probably five minutes had passed since I called 911, but it felt like forever. Was my car going to turn into a giant fireball? That sounded dangerous. I decided to start throwing handfuls of snow onto the fire to keep it contained.  Eventually I was scooping up giant armfuls of snow and dumping it into the engine compartment. I put out the fire.

A police officer showed up. Then three police officers. Then the fire department. Everyone peered into the engine compartment. The fire department confirmed that the fire was indeed out. I got a tow to the nearest garage. Everyone was very nice.

Now I really need to buy that new car.

IMG_20190222_142207446

 

Update: New (to me) car!

IMG_20190223_115904544

Advertisements

Symfony 4 get all POST data

“How do get all the submitted form data?” When I was learning Symfony this was something I couldn’t find a noob-level answer to. All the tutorials want to introduce you to the Symfony form module right away. But if you’re like me and want to understand how things fit together before using some overly complicated object to build a simple form then the below information may be useful.

How to get all values from a form submit in Symfony 4.

/**
* @Route("/", name="form_submit",methods={"POST"})
*/
public function my_form_action(Request $request)
$everything = $request->request->all()
;

How I tumbled down a river – The 2014 Quinebaug River Race

I didn’t know what I was getting into…

 

blue_canoe_damage

My brother-in-law said “hey you want to enter a canoe race?”  An excuse to paddle down river in early spring sounded like a great idea. He recruited my father-in-law and I recruited my brother and the four of us entered the All-American Quinebaug River Race. They were #30 in a 14 foot green Old Town canoe, and we were #31 in a battered blue 12 foot Lincoln canoe.

I was unaware that this canoe race had class II rapids.
Continue reading “How I tumbled down a river – The 2014 Quinebaug River Race”

Best practices – a poem

I.T. took away my remote server access today
Now I can only code local-ly
Though I don’t blame them, I’d just like to say
If my code hygiene needs washing
These bugs that I’m squashing
Weren’t found in Q.A.

‘Best practice’ was my first and my middle name
I agiled my scrums, I sprinted my days
Test-driven delivered a build to throw away
But the users don’t understand it
And they simply demanded it
Be fixed right away

Pear's mail_mine not working with Outlook

In a WordPress plugin I am developing, I am using Pear’s mail_mime to generate an HTML email and send it with an attachment. This worked fine for me during testing with my gmail account. However once I started using the plugin to send emails to others, Outlook users were getting a garbled mess. Outlook could not properly understand the generated multipart/mixed message and was showing the raw text. It took a bit of digging to discover the solution, but the root of the issue goes back to an age-old C.S. problem.

Windows uses ‘rn’ to define a line break, while Unix-like systems use ‘n’ to define a line break. Gmail doesn’t care which kind of line break you use, but Outlook requires line breaks to be in the ‘rn’ format.

Mail_mime allows you to pass the default for line breaks as a constructor argument. However, this didn’t work correctly for me. The Mail_mime code uses the End-Of-Line constant (PHP_EOL) and passing the EOL value in was not enough to change the value in all places.

What I had to do to finally get Outlook emails to display correctly was to first define the PHP_EOL constant and then pass it in as well.

// define the PHP_EOL constant
if (!defined('PHP_EOL')) define ('PHP_EOL',"rn");
// pass in the value on create
$mime = new Mail_mime(PHP_EOL);

I had to define the constant AND pass in the value to catch all the places the linebreak characters were used. This seems like a bug in Mail_mime.

I used the comments on this bug report to solve this issue. Unfortunately since this work-around was discovered, the maintainers don’t seem willing to fix this issue.