Sunday, October 10, 2010

The little things in vi that make folks watch and go "wow"

My guess is that I'll add more hints & tips to this posting, so be sure to bookmark it and revisit every now and then.

-- David 10Oct2010

I don't know if all of your colleagues will go "wow", but I know you'll be a lot more productive than you would with a standard Eclipse editor or MS Word.

Task: You want to enter command mode to try all of the commands in the rest of this page:

# press Esc key
<ESC>

Task: You want to find whole words spelled "the", excluding words like "them".

<ESC>
/\<the\>

Task: You have a text file of numbers representing some of your customer account ID numbers. You're creating an SQL query statement and you want to corral those numbers into an IN clause like "... where clientId in (333, 444, 555...). But the 10 numbers are listed, one by one, on ten lines. How do you get them collected into your IN claus?

First thing, you want to append commas after each number, with the exception of the 10th number.

# replace the endline of each line with a comma.
# to avoid putting a comma after the 10th number, specify the line range as 1 through 9.
:1,9s/$/,/g

Now it's time to bring everything onto a single line. Do this using "J" for join.

# Join the 10 lines onto a single line
<ESC>
:10J

You should see all 10 numbers on the same line now. Fill out the rest of your SQL query.

Task: You have a bunch of concatenated strings that each should occupy a single line. Each string is separated by the damn ^M characters that do nothing to create a visual line break.

<ESC>
:1,$s/<cntr-v>M/\\r/g

Task: You want to insert "</span>" between "Task" and ":", like I did when I decided to wrap a span tag around each Task word in this blog posting.

<ESC>
:1,$s/Task:/Task<\/span>:/g

Task: You want to jump to the 13th line in your text file.

<ESC>
:13

Task: Come back on occassion to see additional vi editor tasks here.

# At your browser's URL:
http://discretepassions.blogspot.com/2010/10/little-things-in-vi-that-may-folks.html

Thursday, October 07, 2010

The miracle called "Khan Academy" -- Web-Ed the maximized way

It took me 5 minutes to realize I was witnessing a miracle. What grabbed me about Sal and his www.khanacademy.org?

  • A charismatic, humorous voice.
  • 1,800 12 to 15 minutes lectures - physics, math, business, chemistry, statistics and more.
  • Explained at a pace and in a style that makes comprehension possible.
  • Makes you feel like you can learn things you were never able to nail down back in college.
  • And I sensed immediately that my 10 year old would relate to him, thanks to his trusting humor and kind voice.

So where does Khan Academy fit in? The answer: where doesn't it fit in?

  • My daughter loves Migaland, a 2nd Life for kids. The agreement we have is that she must watch one Khan Academy math class before logging in to Migaland.
  • This is the perfect supplemental homework pill for school teachers to give to their kids. Kids get distracted in class, kids have poor listening habits. Khan gives them a resource at home that 1) the kid can trust, 2) the teacher can trust and 3) the parents can trust.

So, why does this work? Why am I so convinced that this IS the greatest gift of the Internet?

  • It's teaching using common sense... a person who has the gift is able to share that gift in a way that only the Internet can make possible.
  • 15 minute lessons. How perfect is that? Life is fast. Afternoons are short. Evenings are just about impossible. But 15 minutes is a reasonable commitment with the option of doing another 15 minutes.
  • 15 minutes is the perfect amount of time to except hyper focus. Yes, we do, can and should go longer than 15 minutes when we need to. But 15 minutes is also a way of limiting us from gorging, so that we can develop the long term memory of the lesson in a high quality, quickening manner.
  • It's a huge opportunity for folks to diversify their knowledge. Go to the Khan Bank of Knowledge and check out "credit default swaps" or "La Place transforms." It's almost analogous to take a little pill and you have instant knowledge.
  • It's been awhile since college for me. I've had a great career as a software developer and business executive. Khan is a gold mine of possibilities for me for "the next phase" of my life. It's all there.

Enough cheerleading for now. I don't know if Khan's courses will prevent Alzheimer's, but it sure will make life feel more unlimited than it already does. And for parents, it's a true answer to the on-going challenging of keep that kid learning...