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...

Sunday, September 26, 2010

Here comes Graphene... sharpen your pencils!

Reading about research and development around carbon-based, two dimensional, nano-worldly Graphene has been a lot of fun. If you're just ramping up as well, I thought I'd jot down some of my collected notes to help others on their way to good knowledge of Graphene.

First of all, Graphene is a one atom thick, 2-D slice of graphite, the "pure" stuff in your 2H pencil. It looks like a cross-section of a honey-comb with carbon atoms in a chicken wire-like pattern. Scribble on a piece of paper, take some scotch tape and left up your carbon-based jottings. Then desolve the tape with a solvent, like Benzene, and you're left with a few (or more) layers called Graphene.

Now, some tidbits or "reasons to care"...

  1. Graphene is the strongest material known.
  2. It's the thinnest membrane known, in the lab, to separate two bodies of liquids.
  3. Pop a hole in a sheet of Graphene a few carbon atoms wide, you have a "nanopore". Drag a strand of DNA through it, you can figure out its sequencing (all that G, T, C A stuff). FAST.
  4. Thanks to its incredible conductivity, it may eventually replace silicon as chip fodder. It's 100x more conductive than silica and isn't it nice it's not environmentally toxic as those other silica alternatives, like gallium arsenide?
  5. As part of the quest to utilize Graphene as laid on substrates of silica, researchers are working heavily on getting the signal-to-noise ratio ramped up to maximize all that good conductivity.
  6. Nanotubes are rolled up single layer sheets of Graphene.
  7. Because of its high conductivity, Graphene makes great sensor devices, able to detect substances and get the word out quickly.
  8. Graphene may represent a new class of capacitors, thanks to its conductivity and extremely large ratio of surface area to mass.

Lost the article I grabbed some of these details from. I'll post the link as soon as I find it. The bit about nanopores came from http://www.physorg.com/news203345672.html

Hope you found this helpful and now see Graphene as slightly less mystifying.

Saturday, September 18, 2010

Server software architecture technology today... a "drive by" appraisal

A colleague at my company distributed a couple of links on MUD -- "A BIG BALL OF MUD is haphazardly structured, sprawling, sloppy, duct-tape and bailing wire, spaghetti code jungle." from A Big Ball of Mud.

I never liked chaining (object methods end-to-end, ad nausem) because it made me feel stupid... It always came off as the "cool" thing at the expense, to me, of clarity. It also felt like a side-effect of IDEs where you just keep getting a drop-down pick list of methods once you complete the previous method name. I know I'm ridiculously blue collar about using vi instead, but what I like about it (being the absence of an IDE) is that it forces you to become more knowledgeable about the object/class definitions you're referencing. You know at some point you're going to have to track down a bug and wouldn't it be nice if you've already explored that deeper code, often written by somebody else. It gives you the extra layer of perspective you need when bug-chasing...

Yes, architectures are beginning to feel commoditized. But I like that. It's like design patterns. When Microsoft came out with C# it pissed me off, big time, as a rip-off of my beloved Java. But then I realized that the favor MS did for all of us was to raise the conversation to the next level of design patterns where the implementation details became less important. My guess is that was not MS's intent, but I believe it was a favorable consequence.

Anther advantage (or consequence) of commoditization is that these architectures are beginning to feel canned and the tools that support them are like-wise starting to feel that way, as they continue to mimic each other... Grails-Rails... does it really matter other than some business considerations?

But I have become a believer in the programming-by-convention. Yes, it goes overboard when you realize so many methods have been automatically created (views, controllers, services, session variables, etc.). But at least there's a higher level of "local standardization" that anybody who dives into the project can expect. I used to like thinner, start-from-scratch architectures... but it's so incredibly silly to have to re-think how to track session, how to send email, how to configure security, how to do things you've done a few hundred times over the past 15 years.

How's that for a preach-y entry?

Friday, July 30, 2010

from a budding post-biologist... check your fears at the door

Well, I probably won't live long enough, but I still love to play in this sandbox...

I hope you've come across the book "The Coming Singularity" by Ray Kurzweil or have checked out his Singularity University. Kurzweil speculates on a not-so-distant moment in time when the growing rate of technological change transitions from its already step slope to vertical status, representing infinite change, and therefore defines a singularity (i.e., a single point when you look downwards).

A natural (sic) consequence of this event, or the time leading up to it, is (speculated) that we'll start replacing our squishier organic body components with more advanced functional equivalents. The motivation will come from the reality that computers will far exceed our brains in computing power in many ways, leaving us with a sink or swim scenario. Moving to this "post-biological" phase will be necessary in order to keep up with this next order of knowledge and simultaneously benefit from it.

So, as a spectator, the most fascinating part of this is how people might react to this pending reality. People will understandably picture Terminator robots. That's inevitable and unfortunate.

But it ain't going to be that way. Take a look at what's happening with nanotechnology. It's not about making tiny machines out of metal (that look like robots). It's about reformulating configurations of elements, for instance, carbon into bucky balls, nanotubes or ultra thin sheets called graphene that, by their physical characteristics, do amazing, highly focused functions such as sniffing out toxic elements in the air. Nanotechnology will be the foundation of better hearts, better brains, better motor skills, better senses...

So aside from just dealing with good old change, I don't really think there's as much to fear about the guttural reactions I'm seeing when the public is confronted with this amazing and, understandably, disconcerting topic.

After all, what's really happening here is that we're taking knowledge we acquire from a point in time ten to twenty years in our past and apply it to completely new projections twenty to thirty years in the future. Not a problem 100 years ago when the rate of change in a few decades was so small from the perspective of the average guy and gal. Big problem when the data you're just getting comfortable is out-data and just plain wrong. When the rate of change becomes more asymtopic, the knowledge we are just getting to be comfortable with, like cell phones and GPS, prepares us even less for the new stuff around the corner. It's basically that feeling you get at the Boardwalk when you're slowly approaching the apex of that first Roller-coaster peak and...

Check out the arguments at: http://video.stumbleupon.com/#p=390vckvrxu