Monday, December 08, 2014

The Geek House

We have some small children learning their math facts and I was trying to encourage them.  So the other night at the dinner table I asked, "Who can count by fours?"

Owen immediately started, "4, 8, 12, 16, ..."

When Connor interrupted with, "Who can count by fibonacci?"

And Ellery started in counting, "0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ..."

The rest of the evening was spent discussing the marvels of fibonacci numbers and the golden ratio.

Friday, May 09, 2014

Subaru Tune-Up

I just wanted to share a tidbit I learned while tuning up the Subaru this week.  This information is specifically for a 1999 Subaru Legacy Outback, but I am sure it applies to other similar models and years.

Our Subaru has been running a little sluggish lately so I decided to replace the the spark plugs and wires.  After all the car is 15 years old and it has over 100k miles so it couldn't hurt.

I started with the left side of the engine and quickly discovered there is not a lot of room to work.  There is only about 3 inches of clearance between the side of the engine and the frame rails on the car.  In order to get the tools on the plug I had to put the socket on the plug first, then attached the extension rod (of just the right length, not too long or not too short), and then attach the ratchet.  After all was hooked up it then became apparent that I would not be able to swing the rachet. The air filter and other cable runs are in the way.  I ended up removing the air filter housing.  It made it a difficult, time consuming job, but I eventually conquered.

On the right side of the engine there are so many other obstacles like the battery and washer fluid reservoir that I decided to scope out the access from the bottom of the car.  Bingo!  That's where you need to do the work.  There is nothing in the way when working from underneath the car.  There is still very little clearance on the sides, but you are able to get a full swing on your rachet.

TIL: When doing a tune-up on your Subaru, start from underneath the car.

Wednesday, May 29, 2013

Someone Gets It!

I just wanted to share some great customer service that I witnessed today.  I was changing the oil on the Subaru when I noticed the small gasket on the drain plug was missing.  That's when I remembered it went missing the last time the oil was changed.  So I drove down to the local Subaru dealer to get a new plug.  (I drove to the dealer because I had other questions that I wanted to ask.)

I asked the parts department for a new drain plug and he came back with the plug and a gasket in case I needed the gasket too.  Actually, all I needed was the gasket and I said so.  He said I could have it.  He had plenty, and to fill out an invoice would actually cost more than the part.

Finally, someone gets it!  It was such a small thing, but by small and simple things are great things brought to pass.

Thanks Byers Subaru Dublin!

Tuesday, April 09, 2013

Practice Makes Perfect - NOT!


​How many times have you heard practice makes perfect?

When I was younger I took piano lessons.  My mother would make me sit down at the piano and practice.  I would go through the lessons, trying my best. I never stopped to work on the trouble spots.  I would just plod through the songs to get to the end.  Then I could proclaim to my mother that I had practiced.  After all, I played the songs.  When it came time for my lesson the songs sounded pretty much like they had all week during practice, not very good.

Later in High School I was in the marching band.  We spent hours upon hours practicing our half time shows.  Instead of going from beginning to end.  We would line up and try 8 bars.  Then back up and do it again, and again, and again.  It seemed to be never ending.  All the while our teacher would say things like "if you have never done it right during practice you won't magically be better on Friday night."

Later in life I was lamenting that I never got any good at the piano so I started taking lessons again.  This time I had a better sense of what it was going to take to get any good.  I knew that I needed to take practice seriously.  I knew that it was going to take time.  Even though I knew, I still hadn't learned.

I found myself making mistakes and moving on without fixing them. Even though I was putting in lots of time, I wasn't making much progress. During my lessons, the mistakes would surface and my teacher would stop me and have me play the phrase 3 times perfectly in a row before I could go on.  In doing this, I began to learn that by just going through the songs without fixing the mistakes I was essentially practicing the mistakes. If I continued to practice the mistakes, I would always play the mistakes.  I had to practice playing the song correctly or I would never play it correctly.

This morning as I was listening to an audio book I heard the author explain: "Practice does not make perfect.  Only perfect practice makes perfect, Vince Lombardi."  Yes!  This is what I have been learning over the last few years of piano lessons.  This is what my marching band teacher was trying to teach, but it wasn't sinking in.

Perfect practice is what is needed.  We practice to get it right.  And then we do it again, and again, and again.  We do it right so many times, that we no longer need to think about it.  It then becomes a part of us and we can move on to bigger and better things.

So, next time you hear that practice makes perfect, remember that it is how you practice that makes it perfect.

Friday, September 28, 2012

Custom Data Attribute "data-*"

I learned something today, that I wanted to share.

You see I had some elements on a web page that needed to make an AJAX call back to the server when you clicked on them.  But I needed some extra data to go along with that call that would be different for each element.  

The method I devised was to put that data in the id attribute like this:

<tr id="fileid-513-type-17" ... > ... </tr>

Now all I had to do was parse the id attribute in my script and make the AJAX call.  Not the prettiest way to get it done, but it works.

Well, today while reading Unobtrusive JavaScript by Jason Moon I found the following:
Each unobtrusive widget can be configured using HTML5 data- attributes on the element. The sole purpose of these attributes is to provide information to the JavaScript code.
That is exactly what I was looking for 6 months ago.  It makes reference to the W3C HTML5 Specification: 3.2.3.9 Embedding custom non-visible data with the data-* attributes.

Using the custom data attributes I could have done the following:

<tr data-fileid="513" data-type="17" ... >...</tr>

Now in my script I would use jQuery to parse out the data for me like so:

var id = $( event.target ).data( "fileid" );
var type = $( event.target ).data( "type" );

There is one little caveat with the naming convention.  All attributes of an HTML element get lowercased automatically.  This is true for custom data attributes as well, because, they are attributes.  When jQuery and other APIs load the data, they will camelcase the names of the attributes based on the hyphens in the attribute name.  Here is an example with jQuery:

<tr id="myTR" data-fileid="213" data-file-type="pdf" data-file-size="2143">

var fileid = $( "#myTR" ).data( "fileid" );
var fileType = $( "#myTR" ).data( "fileType" );
var fileSize = $( "#myTR" ).data( "fileSize" );

// or getting alls the values as a JavaScript object
var obj = $( "#myTR" ).data();

alert( "ID = " + obj.fileid + "\nFile Type = " + obj.fileType + "\nFile Size = " + obj.fileSize );

Notice how the hyphens are removed and we get a capital letter after each hyphen?

Here is an example using element.dataset:

var element = document.getElementById( "myTR" );

alert( "ID = " + element.dataset.fileid + "\nFile Type = " + element.dataset.fileType + "\nFile Size = " + element.dataset.fileSize );



Wow.  So much easier.  I hope that helps you out.  It sure helped me.

Now off to refactor some code.

Wednesday, January 19, 2011

Broken

Last year (2010) just about everything that could break, did. We called it the year of the broken. I replaced the control panel on the dishwasher as well as the fuse a couple of times. I replaced the motor on the clothes dryer. We junked the Toyota Camry because of failed rod bearings. Donovan did major damage to his leg and is the proud owner of a huge scar that allowed entry to a plate and several screws. The upstairs shower started leaking which necessitated a huge hole in the downstairs ceiling in order to fix it. I could go on, but I am trying to block it all from my memory.

Then, this morning, this happens.



Icy roads helped Spencer over the curb and into a tree. Everyone was fine. The air bags didn't even go off. But the wheel was damaged so that it cannot be driven.

I sure hope this doesn't turn into the the decade of the broken.

Tuesday, December 14, 2010

The Dichotomy of Music

I was enjoying the high school choir holiday concert on Sunday when one of the groups began to sing "This Little Light of Mine." My mind wandered back a few years to preschool concerts. I could see in my mind the children being herded to the front of the room by their teachers. I remembered how cute the children were as they sang their little hearts out. Their enthusiasm and smiles made it impossible not to grin from ear to ear.

Sunday was different. The music director had complete control. With just a wave of the hand or a knowing glance, the young adults made seamless transitions. Their faces beamed with pride. They sang with confidence and clarity as their voices rang through the auditorium. Their was a smile on my face, but it was difficult to hold back the tears in my eyes from the beauty of the music.