Fixing the Ajaxterm shift key (and no login) problem

Ajaxterm is a wonderful little program written by Antony Lesuisse to create an ssh terminal from a browser window.  This is important to me because a local library allows *only* web surfing from public terminals, but not ssh.  So, I use ajaxterm to act as a ssh server that I can access from http.

However, I could not login.  After some playing around, I determined that it was because I had capital letters in my password.  When I looked at the way ajaxterm interprets keystrokes, it turns out that it captures the pressing of the shift key as a separate keystroke (and interprets it as uparrow).  It then interprets the capitalized letter correctly — i.e. shift+A  counts as two keystrokes, “shift” and “shift+A”.  Uparrow in my shell  provides the previous historical shell command.  Thus, if my last command was “ls” then instead of “A”, hitting shift+A gives me “lsA”.

So I went back and looked at the code for ajaxscript (thank God for open source), and found where this was done.  I put in a little line that captures the shift key by itself and sets it to the null character.  Now everything works fine.  Here’s the code for Mandriva 2010.0.  I assume the files are in a similar place in Ubuntu and other debian distros.  In any case, file you need to look at is ajaxterm.js, and on my box it lives in /usr/share/ajaxterm.

If you open up /usr/share/ajaxterm/ajaxterm.js, you will see a function keypress(ev):

function keypress(ev) {
     if (!ev) var ev=window.event;
     //s="kp keyCode="+ev.keyCode+" which="+ev.which+" shiftKey="+ev.shiftKey+" ctrlKey="+ev.ctrlKey+" altKey="+ev.altKey;
     //return false;
     //else { if (!ev.ctrlKey || ev.keyCode==17) { return; }
    var kc;

Basically, it goes through and captures any control codes, and then interprets each. If you turn on the debug code that’s in there you will find that the shift key is ev.keyCode=16 and ev.which=16. Thus, after the code checks for control, alt, etc. you just need to add a little snippet that turns the key into a no-op if the keycode is 16. I did it here (my added code is in red):

    (...long list of characters...)
     else if (kc==123) k="[24~"; // F12
     if (k.length) {
    } else {
        if (ev.which==16) {
      if (kc==8)
     k=String.fromCharCode(127);  // Backspace

That seems to have fixed the problem.

Remember when the Dems said it was just *horrible* to mention Hitler?

Well, maybe not so much.  From Ace:

Democrat: Arizona law like ‘Nazi Germany’

Arizona illegal immigrant law is a Nazi measure says Catholic Archbishop Mahony

(Newsweek) Arizona or Nazi Germany?

Sharpton, other activists compare Arizona immigration law to apartheid, Nazi Germany and Jim Crow

Roger Ebert Compares Arizona Immigration Bill To Nazi Germany

NYT Former Reporter Greenhouse Fires on Arizona’s ‘Police State,’ Makes Nazi Comparison

The Tea Party — of hate!!

The mainstream media and the dems have been harping on how the Tea Party movement is, yes they’ve used the word, “seditious” and “violent” along with the standard “racist.”  All the while, of course, ignoring the beatings, threats, and violence performed by the left.  But, you know, criticism can be helpful, and Freedomworks has been listening.  Warning, these are Democrats speaking, so you should probably not let your kids listen.

H/T Redstate

Apple dropping wireless periodically with a D-Link DIR-655 solution (update — not quite)!

OK, I have had years of issues with AirPort wireless on my wife’s Macs, mostly when I switched my router from g to n. For my wife’s old MacBook, I ended up buying an AirPort Extreme router and putting it behind my regular router. It worked, but slowed things down and she had problems getting to our wireless printer. I assumed that a new MacBook Pro would do the job — all new firmware, new hardware, etc.

Well, it didn’t really fix things. Sure enough, every few hours the MacBook would drop signal. Hmmm…. I tried all sorts of stuff, to no avail. The only thing that really seemed to fix it was power cycling the router. Then one night I accidentally left my laptop on over night, and noticed the same sort of thing happening. The difference was that *my* laptop would drop signal for a few seconds and then come back up. If I wasn’t actively doing something on the net, I wouldn’t notice it, and I’m not constantly surfing. The difference was that when the Mac lost signal, it took *much* longer for it to reattach, and sometimes it didn’t do it all.

Well, this time, I didn’t power cycle the router, but instead managed to look at its logs. I had automatic time synchronization turned on. Every time the router went out to a timeserver and adjusted its time, it went down and came back up. I turned off the nntp option, and it’s been up ever since — well for two days. We’ll see in the future…

UPDATE: Well, it was improvement, but not perfect. I’ve gone from dropping every few hours to two times a day. I changed the router to not scan channels, but only use channel 8. That dropped it to once in a day.

My open letter to the mayor of Knoxville about red light cameras

Predatory red light cameras have become a feature of money-hungry jurisdictions for a long time now.  Study after study has shown that the increase, rather than decrease, accidents.  They serve no purpose other than extorting more revenue from citizens — at the cost of their safety.

And Knoxville got me.  As I was visiting some family, we got snapped.  Fifty bucks.  And, of course, there’s nothing I can do, really.  I can’t appeal it since I live over 400 miles away, and I can’t ignore it because I go to Knoxville frequently.  But I can do a few things.  I can stop buying stuff in Knoxville.  So I wrote the mayor to tell him that.  It’s below.  Maybe if we all did this, folk would start having second thoughts about this kind of predation.

Here’s the letter:

The Honorable Bill Haslam
City Of Knoxville
400 West Main Street
Knoxville, TN 37902-2405

Dear Mayor Haslam,

While I live in Greenville, NC, I frequently visit Knoxville, TN to visit my in-laws and godchildren. I normally have a great time when I visit. We take the extended family out to dinner, we go watch the kids play little league baseball, we visit parks, see movies, go to church, and go shopping.

I was appalled, as you might expect, to receive a citation from your city stating that I had run a red light, based on a red light camera. I did not. The citation was for $50.00.

I noticed your amusing notation that, should I wish to contest this citation, I am welcome to drive the 439 miles from my house to Knoxville. For fifty bucks.

This is extortion, no more and no less. This is not about safety. This is not about the law. Of course, I will pay the fine. I will continue to visit my friends and family in Knoxville for many years to come, and I don’t want to take the chance that I will be stopped with an outstanding ticket. You got me, and there’s nothing I can do about it.

But I can do something about cities who engage in this kind of red light camera predation as a revenue source. I can cost the city of Knoxville money. I happen to know, since I recently prepared my income taxes, that I spent approximately $3300 in Knoxville last year.

No more.


I will never eat at a restaurant within the city limits of Knoxville.
I will never buy gas in Knoxville.
I will never spend a night in a hotel in Knoxville.
I will never buy snacks at a convenience store in Knoxville.
I will never buy presents for my godchildren at a store in Knoxville.
I will never buy overpriced gewgaws at Caswell Park when my godchildren play baseball there.
I will never take my godchildren to a movie in the city limits of Knoxville.
I will never shop for books, electronic accessories, sporting goods, or licensed clothing in Knoxville.
I will never buy last-minute presents for my wife in Knoxville.
I will not put a dollar in the plate when I attend church in Knoxville (but I will put an extra dollar in the plate here when I get home in your name).

Enjoy the fifty bucks, because Knoxville will never get another voluntary dime from me for the remainder of my productive lifetime – even if I have to drive to Farragut for a lousy hamburger.