Tuesday, December 14, 2010

Do you sell any clocks in this bookstore?

When I was in college I worked in a bookstore. One day a lady came in and asked us if we had any clocks for sale. Today, that question might not be too strange. After all, mega-bookstores like Barnes and Noble and Borders carry a lot of different stuff, but it was an odd question at the time.

I was reminded of that incident today while thinking about job interviews. Why? Hold on.

Imagine a universe where that lady's question was perfectly sensible. In that world, you might enter a traditional book-only bookstore and be greeted by the proprietor who asks you "What kind of product were you looking for?"

I think some interviewers have been to that world.

I selected your company to send my Resume to. I even applied for a particular job you are offering. Why are you asking about what kind of job I want? If I were looking for something you can't offer, I wouldn't be here.

Monday, December 6, 2010

Who says you don't need your MFC books anymore?

I have a problem with my van. The battery connectors are corroded and I don't have the money to have it fixed. (Did I mention that I approach car repair like the stereotypical grandma approaches installing an operating system on her computer?)

Anyway, I needed something heavy to hold the wires to the battery while I started the van, so Jeff Prosise's Programming Windows with MFC came to the rescue. I also have a copy of Jeff's Programming Microsoft .NET, but I hope to have my van repaired before I need it.

Friday, September 17, 2010

What I learned about JavaScript from Douglas Crockford

About a year and half ago, O'Reilly published Douglas Crockford's book: JavaScript: The Good Parts. It's a great book and is particularly useful if you have the opportunity to create new JavaScript code so that you can use the subset of the language that he describes.

One thing the book lacks is a summary of all the good advice in the form of a best practice list. Now, such lists are useful as long as we keep in mind that nearly every "rule" has an exception. Perhaps Crockford deliberately avoided the problems that can come from separating recommendations from their explanation and justification.

Nevertheless, I want to present some of his recommendations as a list that you can apply without necessarily knowing their background. I highly recommend that you consult Crockford's book for more details.

  1. Mitigate JavaScript's default global variables by creating a single global variable that acts as a container for your application.
    code example:

    var THEAPP = {};
    THEAPP.book = {
    "name": "JavaScript The Good Parts",
    "author: "Douglas Crockford"
    };


  2. When using the Function Invocation Pattern, save a copy of this in a variable (called "that" typically). This will allow an inner function access to the outer function's objects.

  3. JavaScript doesn't have block scope, so declare a function's variables at the top of the function body.

  4. Use the Module Pattern to encapsulate singletons.

  5. Use Cascade to call many methods on the same object in sequence in a single statement. Each method of the Cascade returns the object.

  6. The length property of an array is the largest integer property name in the array plus one. So assigning a smaller value than the current one to the length property truncates the array.

  7. Avoid the for in statement and use the conventional for statement instead.

  8. When to use arrays vs. objects. When the property names are small sequential integers, use an array. If not, use an object.

  9. Regular expressions are best when they are short and simple.

  10. The array.sort, sorts arrays of numbers incorrectly because its default comparison method does a string compare.

  11. Use K&R style braces (put "{" at the end of the line) to avoid a serious language design flaw in JavaScript's return statement.

  12. Don't use an assignment expression in the condition part of an if statement.

  13. Don't allow switch cases to fall through to the next case.

  14. Don't use implied global variables. Any variable used without declaring it, will be global by default.

  15. Avoid using new.

  16. Always provide the radix parameter when using parseInt.

  17. If you intend + to add, make sure that both operands are numbers.

Link to book description: JavaScript: The Good Parts
Link to Douglas Crockford's JavaScript Video

Friday, August 13, 2010

One of my favorite Spoon River Anthology quotes

Edgar Lee Masters wrote a very unusual book of poetry where each character described their life and sometimes their death. A collection of fictional auto-obituaries you might say. One of my favorites is

ALEXANDER THROCKMORTON

IN youth my wings were strong and tireless,
But I did not know the mountains.
In age I knew the mountains
But my weary wings could not follow my vision—
Genius is wisdom and youth.

Saturday, July 24, 2010

Daniel Schorr

The long time, highly respected journalist, Daniel Schorr died yesterday at the age of 93. Years ago I had the pleasure of reading his book: Clearing the Air which described his experience reading his own name on President Nixon's enemies list on live TV and his leaking of the Pike Congressional Committee's report on illegal CIA and FBI activities.

He once described how he approaches a television news story:

"My typical way of operating is not to stick a camera and a microphone in somebody's face and let him say whatever self-serving thing he wants to say, but to spend a certain amount of time getting the basic information, as though I was going to write a newspaper story.... [I] may end up putting a mike in somebody's face, but it is usually for the final and hopefully embarassing question."

In broadcast news today, the philosophy seems to be that "balance" comes from allowing each side a chance to say "whatever self-serving thing" they want to say, as opposed to searching for, and broadcasting the facts.

There's a great and detailed tribute to Mr. Schorr at NPR: http://n.pr/9BMHz4.

Tuesday, July 20, 2010

Conservatives' advice to the unemployed increasingly bizarre

Laid off from your job? No problem. Just offer to work at your old job for half the money. That's the advice of Jeff Miron of the conservative Cato Institute. In a debate on The Nightly Business Report about extending unemployment benefits, Mr. Miron said the following:

"The broader thing is it creates the wrong incentive. There's clear evidence that people who are unemployed tend to leave unemployment just before their unemployment benefits run out. It's not just a question -- it's not the right way to think about it -- are there jobs? The right way is are there jobs at what wages? If people lower their wage demands, if they offer to take say their old job for 50 percent of what they were getting, there would be a lot more jobs out there. That's the adjustment that needs to happen in many cases. But unemployment insurance and especially very, very long-term unemployment insurance impedes that kind of adjustment."


Full transcript is here: http://to.pbs.org/d3tLvb

Perhaps Mr. Miron has never been laid off or has no experience in HR. If he did, he'd know that being laid off isn't an opportunity for negotiation - it's about completing some paperwork before you're escorted off the premises. After that you're persona non grata at your former place of employment. They will talk to you about the bureaucratic aspects of being terminated such as your 401K or Cobra, but they're not interested in talking to you about positions in the company.

Monday, July 5, 2010

Great minds think alike :)

It seems that economist Paul Krugman agrees with me about extending unemployment benefits: http://nyti.ms/bMqVmn .Of course, his article is more informed and eloquent than mine: http://bit.ly/9Pa2G0