March 29, 2010

Skal aldri kjøpe ferdigsalsa igjen...

Var tomt for salsa viste det seg når jeg skulle spise rester av kyllingtaco. «Jaja» tenkte jeg, «lage noe selv eller stikke i butikken?» En kjapp titt i kjøleskapet viste at der var alt som trengtes for å lage selv. Så...

Ingredienser:
Olje (jeg brukte Chiliolje, vil jo ha det sterkt)
½ hakket liten løk
½ hakket tomat
Litt hakket paprika
Litt hakket jalapeños (not on a stick)
En dæsj knuste tomater (jeg hadde et storglass med Mutti Polpapezzi stående og brukte litt av det, men regner med det funker like så greit med Coops eller Heinz' knuste tomater)
½tsk salt
½tsk pepper
½tsk sukker

Varm opp oljen mens du hakker løk, Ha løken i oljen mens du hakker tomat, paprika og jalapeños. Når løken ser passe ferdig ut lemper man oppi de hakkede grønsakene og fres de litt. Ha så i knuste tomater og krydder og la det putre noen minutter. Ferdig.

Total tid, ca 10 minutter. Grønsaker må man jo uansett hakke til tacoen, så den tida kan man jo trekke fra.

Denne ble rimelig sterk, sikkert mye pga chilioljen og at jeg brukte endel jalapeños. Vil man ha den mildere er det bare å bruke vanlig olje, og bytte ut jalapeños med grønn paprika. Og ellers kan man jo bruke fersk chili eller eksperimentere på masse andre måter her.

March 10, 2010

Quick thoughts on webservice user navigation

Wrote this as a reply on TwentySided, but thought I could just as well share it here.

Case in point is the hilarious, headslapping, lose-all-faith-in-humanity episode over at ReadWriteWeb, where the author commented on Facebook login, and ended up being the top entry for google searches on just "facebook login". Read the comments to see what happened.

When I installed Jolicloud on my netbook a few months ago, I smirked at the notion that the web-service is an application, but kinda saw it’s usefulness. Jolicloud installs twitter, facebook, gmail, etc. as applications, that really are just a full screened browser without any address bar.

This case however demonstrates quite clearly why users SHOULD be taught to create desktop shortcuts to their favorite websites rather than navigating to them. (New users don’t grasp bookmarks, and all applications live on the desktop as icons). With a shortcut created the first time you register on a site, you know you will be going back to the same site when clicking that icon.

This is even more important for new users these days where the URL input field doubles as the search field in most browsers. 5 years ago googling “facebook login” required going to google first, now you do that by simply typing “facebook login” into the address field. It is actually understandable that new users do that instead of learning the weird wizardry incarnations of URLs, with all their hacks and slashes.

So, to all of you teaching your parents, grandparents or kids how to use facebook or some other site to connect with you and friends, make sure to create a shortcut for them to use for logging in.

December 16, 2009

Norsk Tipping på Gentoo Linux

Etter at smartkortleseren til Buypass sluttet å fungere i Windows 7 betaen min, tenkte jeg at det var på tide å se om jeg fikk den til å fungere i OSet jeg bruker mest til daglig, Gentoo Linux.
Litt kjapp googling viste meg at dette i grunn ikke burde være spesielt vanskelig. Buypass har tilogmed en egen miniguide for dette.

  • Nødvendige pakker installeres enkelt med:
    sudo emerge -av pcsc-lite ccid

  • Legg til nsplugin som make-flagg for java. (evt legg det inn for hele systemet ved å legge det i /etc/make.conf). Installer deretter vanlig Sun Java:
    sudo emerge sun-jre-bin

  • Start smartkort-daemonen
    sudo /etc/init.d/pcscd start

  • Bruk en browser som støtter javapluginsen og gå til Norsk Tipping. (Jeg brukte chromium-bin, da jeg ikke umiddelbart fikk det til å fungere med Firefox og Opera)

  • Til slutt, sørg for at smartkort-daemonen starter etter neste kjerneoppgradering:
    sudo rc-update add pcscd default

    Husk nå å ikke spille bort alle pengene du har. :)
  • November 15, 2009

    Opera user javascripts: Remove redirection URLs

    A little known feature of the Opera web browser is the built-in support for adding personal Javascripts that are run on each page. The uses for this is left to the user, so here I will present a few small snippets that I currently use.

    Basics

    To enable user javascripts, open the Preferences dialog, go to the Advanced tab, then the Content page. Click the Javascript options and set the directory where you want to keep your files. All *.js files in this directory will be loaded on all pages.

    To avoid all javascripts being run on all pages, it is recommended to wrap all code in a test checking which server is currently in use. This is easily done using the location.hostname attribute.

    if(location.hostname == 'www.dagbladet.no') {
    function do_stuff() {
    alert("time to do stuff");
    }
    document.addEventListener ('load', do_stuff, false);
    };

    Dagbladet No-Go

    Dagbladet (and some other Norwegian news sites) employ a redirection service for keeping track of which links are being actively used by the readers. In essence this is rather harmless, but unfortunatly this redirection service seems to be less stable than the news sites themselves. The result being that every now and then all links on the page starts failing. The following little piece of code strips the redirection bit from the URLs, leaving just the base URLs.

    if(location.hostname == 'www.dagbladet.no'
    || location.hostname == 'www.kjendis.no'
    || location.hostname == 'www.se.no') {

    function no_go() {
    var anchors = document.getElementsByTagName("a");
    for (var i in anchors) {
    var a = anchors[i];
    if (a.href) {
    var b = a.href.replace(/.*go.dagbladet.no.*(http.*)/, "$1");
    a.href = b;
    }
    };
    };
    document.addEventListener ('load', no_go, false);
    }

    This can of course easily be modified for other pages using the same, such as vg.no.

    October 20, 2009

    Subversion helper functions in zsh

    Subversion has taken over the position as the boring version control system that just works. And even though several good alternatives have come up from the camp of distributed VCS's, I still prefer the good old central repository model. The drawback of having a central server is in my opinion subversion's strong side. Scattering multiple copies around just makes getting everything into a system and ready for production a whole lot more difficult.

    As an old Linux user, I'm also quite fond of using a proper shell to help my workday along. And for that I prefer zsh, mostly because of its strong completion system. Like most unix shells, zsh can be extended with custom functions, simple or complex. Below are three such functions that I use frequently. (They can probably easily be ported to bash or other shells as well, but the syntax used here is for zsh).

    Filtered status view

    If you're anything like me, you frequently pollute your repository with dump files, debug files and other junk while working. This will clutter the status check with a bunch of files that subversion does not recognize, and therefore displays with a '?' at the front, like this:

    .-(gobo@fraggle)-()--------------------------------------(~/Projects/hottipi)-.
    '-(18:51:%)-- svn status --(Tue,Oct20)-'
    ? pypi-classifiers.txt
    ? dump.pcap
    M src/httpchat.py

    If you just want to see what files have changed since last sync with the repository the following small function is helpful.

    svnstatus () {
    templist=`svn status $*`
    echo `echo $templist | grep '^?' | wc -l` unversioned files/directories
    echo $templist | grep -v '^?'
    }

    This will print a quick summary of unknown files, and then list files with modifications since last commit.

    .-(gobo@fraggle)-()--------------------------------------(~/Projects/hottipi)-.
    '-(18:51:%)-- svnstatus --(Tue,Oct20)-'
    2 unversioned files/directories
    M src/httpchat.py

    Show log when updating

    When running svn update a list of modified files is output but there is no mention of what exactly has changed in these files. The following little snippet will display the log before doing the update. Handy for seeing just what your coworkers have been up to lately.

    svnup () {
    svn log --stop-on-copy -r HEAD:BASE $1
    svn up $1
    }

    A little warning on this though. svn log can be slow if run on a huge set of files, or if there has been a very long time since the last update from the server repository.

    Colorful diff tool

    This little function relies on the code2color script often automatically installed in gentoo with the standard less package. If you're not using gentoo, you can get it here. It might need a bit of massaging.

    This little function will simply do what a normal svn diff will, but the output is fed through code2color, and the result is a screenful of pretty colors. If you want to, pipe it further to less as you would normally do.

    export C2C=/usr/bin/code2color
    svndiff () {
    svn diff $* | $C2C -l patch -
    }

    That's it. To use these functions, just add them to your $HOME/.zshrc file, and start a new instance of zsh. (or source $HOME/.zshrc if you like).

    September 7, 2009

    Irssi charset issues

    For future reference, mostly to myself, here's how to get irssi working properly with utf-8 terminals, on latin1 channels, through screen.

    1. Make sure your terminal is utf-8.

    Putty: In the Window->Translation page of the Session configuration, change "Received data assumed to be in which character set" to "UTF-8".

    urxvt: Seems to be Utf-8 by default when the locale is. Check "locale". It should look something like this:

    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    en_US.UTF-8

    2. Start screen in UTF-8 mode

    screen -U is your friend. It is possible to switch this live using C-a followed by :utf8 on.

    3. Irssi.

    • Never ever use irssi 0.8.12 (default in ubuntu for several revisions). If you use ubuntu older than 9.10, install irssi from source (or apropriate .deb if you can find one, I didn't).
    • Set the following options:
      /set term_charset utf-8
      /set recode_out_default_charset iso8859-1
      /set recode transliterate off
      /set recode fallback iso8859-1
      /set recode on
    • The above assumes all channels you use on the server has latin1. To only set latin1 recode for a single channel use /recode add #channel iso8859-1

    4. Joining a channel with latin1 characters in the name.

    This is the tricky bit, and I've yet to find a good solution for it. My best tip so far is to add it to the autojoin list before starting irssi. In ~/.irssi/config add/modify the channels setting:

    channels = (
    {
      name = "#blåbær";
      chatnet = "IRCNet";
      autojoin = "yes";
      },
    );

    Of course, you will need to edit the file with an editor that saves the file as a latin1 file.

    August 4, 2009

    The secret, revealed!

    Some claim that I look too young for my age. Which is nice. Really. I feel a lot younger than I am as well, so that fits. But why is that?

    I think I've figured it out. By old reckoning, one counted age in how many summers one has seen. And for my part, that would currently be 33 summers. Hmm, 34 soon actually. But 15 of those summers are here in Tromsø. And it is common knowledge that the summers here are short. I think it is fair to say that the summer here is about a third of a "proper summer".

    So, by that logic, I've now seen 19+15/3 = 24 summers. :)

    So if you want to stay young? Move to Tromsø.