The roadblock to learning (two) new things

I used to fear learning. When I was an adolescent, I would go out of my way to avoid learning topics I didn’t consider useful. It must have set me back developmentally by years had I been more inquisitive. Why would young me restrict myself in such a way?

Because I heard the idea that your brain can become ‘filled’ and consequently slows in skills acquisition and memory retention.

A catch 22, I know; to be smart, I must resist learning. While there is some validity to the idea, it’s utterly bunk. Why?

Because when your brain reaches capacity for one thing, it will (nearly) forget another. For me to explain, let me relate a personal tale from these adolescent years.

I played clarinet in highschool. The most ‘dope’ instrument on the symphonic block. I kept at it my whole highschool career, and got pretty good. So good, in fact, that my band director asked me if I wanted to join the school Jazz band. I was stoked; the band had a good reputation, and more importantly, an opportunity to learn the fundamentals of improvisation.

But there was one issue. I told my band director “Clarinet isn’t a Jazz instrument.” “Oh,” he told me. “No worries, just practice this over the summer.” He gave me a 15 lb, 4″ tall baritone saxophone. It sounded like a blow-horn on a mississippi cargo barge. And practice I did.

Over the school year, I had a blast. I performed my first fully improvised solo to an audience of a hundred, learned all about music and chordal theory, even picked up Piano on the side. My young brain was saturated.

One day, I went to play a clarinet. I put my lips on the mouthpiece, and blew. Nothing happened. Not a single sound came out. Trying harder only made a squeaking noise. I was confused; Clarinet and Saxophones are nearly identical in operation. Every day, I would set my Sax down after Jazz Band, and pick up a Clarinet during Symphonic band. And every day, I would spend that hour making no noise on that cursed instrument.

Somehow, in expanding my skillset , I’d crippled my previous abilities. I literally forgot how to play the Clarinet.

If the story ended here, it would a tragic tale to the limits of the human brain. But it doesn’t. It took my nearly six months of effort, more effort – I’m tempted to claim – than my first time learning the Clarinet, to finally produce sound from that instrument. Once I got the hang of it, my original talent instantly came back.

A simple mental roadblock prevented me from recalling my skills. But better than that, I found I had become far better at manipulating the sounds of the Clarinet using my mouth – the thing that had been holding me back. Reeded instruments of all kinds felt more natural to me. It took my a while, but once my brain acclimated to the variation between Clarinet and Saxophone, I became a master at the entire range of technique.

I feel that this principle applies to many talents in life. In learning one thing, you find yourself to be less certain of what you knew before. And uncertain you will remain, until you put in the effort to revisit your old talents. This stumbling block deters many people from reaching expertise. But if you overcome this, you will find mastery reaching beyond your experience.

Universal jquery enter-key binding for any function

var enterkey = function (jquery_obj, func, args) {
 jquery_obj.bind('keypress', function(e) {
  if (e.keyCode==13 && e.shiftKey==false) {
   e.preventDefault();
   func.apply(this, args);
  }
 });
}

This little snippet of code is cleverly designed to allow you to bind any page, textbox, button, with a function that will trigger the moment the enter-key is pressed. Here’s an example:

// Bind the textbox to alert 'Potatomonkies!' when the enterkey is pressed
var potatofunc = function (food, animal, exclamation) { alert(food + animal + exclamation); } 

enterkey($("#textbox"), potatofunc, ['Potato', 'monkies', '!'])

Now, whenever the enterkey is pressed on any element with an id=”textbox”, an alert will show saying “Potatomonkies!”. Easy.

Screen shot 2013-08-30 at 5.43.40 PM

Break it down now.

jquery_obj.bind('keypress', function(e) {

This line is a jquery method for listening for a keypress. Jquery does the heavy lifting, all we need to do is confirm that the keypress is the ‘enterkey’.

  if (e.keyCode==13 && e.shiftKey==false) {
   e.preventDefault();

’13’ is the ascii code for carriage return, IE., the enterkey. It’s convention, when writing in a textbox, to allow the user to hold the shiftkey down when pressing enter to put in an actual new-line instead of submitting. If shift isn’t held down, e.preventDefault() is there to stop the newline from writing.

Now the fun part.

   func.apply(this, args);

function.apply() is a method for manually calling function(), while providing the arguments as a list.

var potatofunc = function (food, animal, exclamation) {
 alert(food + animal + exclamation);
}

The function potatofunc demands three arguments, yet our func.apply(this, args); has only two, and the first argument this appears to do nothing.

This is because the arguments passed to potatofunc was provided when we called bound the enterkey function to potatofunc, as shown below:

var enterkey = function (jquery_obj, func, args)

enterkey($("#textbox"), potatofunc, ['Potato', 'monkies', '!'])

The function enterkey, as the first argument, is given the jquery of items with an id=textbox; the function potatofunc which now triggers on the enterkey as second; and then args, which contains the text to be displayed, as a list of strings.

func.apply(this, args) automatically takes the list [‘Potato’, ‘monkies’, ‘!’] and expands them as the parameters given to potatofunc.

The this in func.apply(this, args) does… well… nothing. It can easily be written as:

func.apply("cats and dogs", args);

And it’ll still work just fine. I’ll leave it up to you to figure that out. 😉