Archive for the 'Geek speak' Category

SSH tunnel from the command line

Every once in a while I need to set up a temporary SSH tunnel from one computer to another, possibly via a third one, and can’t be bothered with configuring any of my otherwise frequently used GUI tools ‘SSH Tunnel Manager’ for OS X or ‘SSH Tunnel’ on Win XP. Each time, however, I end up reading the man page for the ssh command or googling for ’ssh tunnel linux’ or something similar, since I never seem to remember how to set up a simple SSH tunnel on the command line. The ssh man page is especially unhelpful:

-L [bind_address:]port:host:hostport

What? Which port goes where? And what’s the bind_address and hostport? If you read the explanation of the switch you’ll probably just become even more confused. After a few trials and errors I usually get my SSH tunnel up and running, but most of the time I’m not quite sure what I’ve really done.

So here’s a note to self on how to do this once and for all.

Continue reading ‘SSH tunnel from the command line’

Move or Copy? Um.. Yes?

There are a lot of these out there on the Interwebs, but this is one of the few I’ve run into (since I don’t normally use Windows) and the only one I’ve captured.

There are two serious wtfs here.

  1. The application wasn’t Internet Explorer, although it says so in the dialog title. It was Windows’ (supposedly built-in) zip application. The scenario: I opened up a zip file and dragged one of the compressed files to the desktop.
  2. The question. Move or copy…? Ok, I want to copy, since I want the file to remain in the zip file. So then I’ll answer… Yes..? No?

Of course, this is a matter of interpretation, but still. Dialogs mustn’t be ambiguous like this.

Failure.

The power consumption of a geek

Lately, I’ve been curious about what’s consuming electricity in my flat. My electricity bill just increases as more and more geeky appliances find their way into my home. So yesterday I bought an electricity consumption meter and started measuring. This is what I’ve found out so far.

Continue reading ‘The power consumption of a geek’

Executing embedded JavaScript after Ajax-call

A nasty problem jumped up and bit me in the ass a few days ago at work. I was making a widget of a piece of code formerly part of the web page now hosting the widget. The widget code consisted of some HTML and a couple of embedded JavaScript tags. The widget needed to be loaded into a div the hosting web page with an Ajax-call, after which the embedded JavaScript needed to be executed. Something like this (I’m using YUI3 here):

Y.io("/foo/bar/some_widget", {
  method: 'GET',
  on: {
    complete: function(id, respdata) {
      thediv.innerHTML = respdata.responseText;
      initWidget(); // this function is embedded in the responseText
                    // and doesn't get evaluated. I.e. it doesn't exist.
    },
    failure: function(id, respdata) {
      alert('Feed failed to load!');
    }
  }
});

If a search engine sent you here, you probably know that this doesn’t work. JavaScript embedded in a piece of HTML code loaded with Ajax and injected in a web page doesn’t get evaluated. If you’re wondering why, you’re in the wrong place. If you want to know how to make it execute, read on.

Continue reading ‘Executing embedded JavaScript after Ajax-call’

Connect Leopard to the Internet using a Nokia phone

Despite numerous howtos and instructions on connecting a Mac to the Internet through a Nokia phone, none of them has corresponded 100% to my reality and thus I’ve always failed. However, through a bit of trial and error, I managed to find out how to connect my MacBook running Leopard to the Internet using my Nokia E66.

Continue reading ‘Connect Leopard to the Internet using a Nokia phone’