Wednesday, September 8, 2010

Roku rocks the world! I love it!

I love my Roku so much I own 3 of them now. These little guys are easy enough for my kids to use, and is really convenient when they want to watch "kid movies", and we don't have any in the house. Pandora streaming, Amazon.com video, and great wireless setup means you can put them anywhere.

Did I mention I love it? Get a great deal on the entire line - they're much cheaper this month!

Get $20 off a Roku Player!


Friday, April 30, 2010

Stupid fun with cygwin and sqlplus

So, I have Oracle 11g running on a RedHat Enterprise Linux box, and for some reason, after I switched to a new client workstation, the backspace key in sqlplus stopped working correctly, although it worked well in bash. Well, I reckoned, something must have been different in my Cygwin settings, right? The answer is *right*, of course. Figuring out the simple solution was really hard, given the ton of misinformation that came up on the net. I hope that someone might find this solution really useful one day.

The scenario: Using Cygwin on the client workstation, connecting via ssh to the RHEL box, and running bash and sqlplus on the linux box.

Bash works great on the local workstation and the remote RHEL box. However, sqlplus did not. When I typed a backspace key, the prior character was erased from the buffer, but a control character was echoed to the screen. It looked like a little house, but was actually ^? in stty-speak.

stty -a | grep erase shows that erase is mapped to ^?, which is the backspace key, and all should be good. Like I said, bash works! Vi works... Only sqlplus did not.

The solution is not trying stty erase ^H, like so many posts said. I think that is a remnant of times gone by now, or at least I hope so.

The reason that bash and vim (VI) behave differently from sqlplus is simple - they both do their own processing of input. bash uses readline, and is controlled by /etc/inputrc. sqlplus uses something else, I presume getty, although I don't know for sure, and really don't care.

If you look at the output of stty -a, look for some flags at the bottom of the output saying something like:
iexten echo -echoe -echok -echonl

To fix the borked sqlplus behavior, all I had to do was change the setting for echoe, like this:

~ $ stty echoe

Now when I type stty -a, near the end you will see:
iexten echo echoe -echok -echonl

echoe does the same thing as crterase, which the man page for stty says does this:
"echo erase characters as backspace-space-backspace"

Basically, when the backspace occurs, wipe the character off the screen in addition to removing it from the buffer. Problem solved! sqlplus works fine when I ssh to the RHEL box, and all is good.

Of course, to make sure it works the NEXT time you login, you have to do something like add it to your .bashrc or .bash_profile. I chose to do this on my cygwin box, and put stty echoe into my .bashrc. All works, and I am on to the real problems I am supposed to be solving. :)


Thursday, April 8, 2010

Bill's Law

THEOREM: Strategy, Tactics and Logistics can be considered separately only in the realm of theory.

COROLLARY: Design, without regard to implementation, is flawed in the real world.

I've had these on my white boards for about 15 years. I do it to remind myself that you need to remind yourself that you have a REAL environment that you will play in, and not just some make believe world where everything behaves the way you want it to.