Dungeon Crawl är otroligt

Spöade Dungeon Crawl i helgen :-). Min minotaurbärsärk tog sig hela vägen ner till Zots kammare och tillbaka. Sjukt skönt att äntligen få det klart. Tyvärr har det skett på bekostnad av diskandet, städandet, dammsugandet med flera hushållssysslor. De får jag ta itu med den här veckan.

Tillbaks i Tjockhult

Det är något alldeles speciellt med att komma hem till storstan. Allt folk, de labyrintlika fångarna i centralen, lukten av damm i tunnelbanan. Det är rogivande eftersom det är bekant. Jag är säker i civilisationen. Nu ska jag hem, dricka mjölk, äta sallad och spela gitarr. Sedan sova.

testpost

This article describes my experiences trying out various emacs module for managing your blog.

My requirements for a great blogging solution for emacs should support the following:

  • Write blog posts in Markdown, preferably using markdown-mode.el.
  • Syntax highlighting. Stackoverflow's online editor does it in a nice way.
  • Keybinding to upload the current buffer to blogspot. This is not a critical point and I'm prepared to move to another host if it's not possible to work with blogspot.
  • Easy way to attach images to the post.

Here are the various blogging solutions I tried out:

Blogging with org-mode and org2blog

org-mode is great for dealing with tabular data. I use it all the time for time series data, like keeping track of my weight, my score in Vem vet mest? and my work hours. It's also not bad for writing todo lists of all kinds. The org-mode syntax does not appear to be Markdown, but something close enough.

My information about org2blog comes from an old blog post written by Irreal.

Apparently, blogger uses the Atom API, so what I need is something called Org2BlogAtom.

The first problem is how to get org-mode to export to html with syntax highlighting. I'm often inserting code snippets in my posts, so getting that to work correctly is definitely a must. Two things are needed for that to happen:

  1. htmlize.el need to be installed.
  2. .emacs must contain:
(setq org-src-fontify-natively t
        org-export-htmlize-output-type 'css)
        

Then just press C-c C-e h to generate an html file of your org buffer. That's the first step, the next is to get the generated html file published online on my blog.

There are two different versions of org2blog, a fact that struck me after some googling. One for posting to Wordpress blogs and a different module for Blogger ones. Since I'm currently with the latter, what I need is org2blog/atom which is found at the sparsely documented git repo.

It depends on g-client, which has its own EmacsWiki page, but no obvious way to download the module. Checking out and building the Subversion reposity seem to have worked:

            svn co http://emacspeak.googlecode.com/svn/trunk/lisp/g-client/
            cd g-client
            make
            cp g-cus-load.el* g.el* gcal.* g-utils.el* g-app.el* gblogger.el* \
            ~/.site-lisp/
        

(~/.site-lisp/ is on load-path ofcourse).

org2blog/atom itself has an installation procedure that depends on "elinstall" which seem to be a custom installation module created by same author. But copying all elisp files from the ./atom and ./common to my ~/.site-lisp directory sems to work.

Next error "Requires a different version of org-mode. See README.org". The one shipped with emacs 24.3 isn't enough? But I think it should be since emacs 24.3 was released after the last commit was made to the org2blog repository. Let's check the code.

(unless (boundp 'org-html-cvt-link-fn)
        (error 
        "Requires a different version of org-mode.  See README.org"))
        

Aha! So where does org-html-cvt-link-fn come from? After some heavy google, I think the answer is that it was defined in a file called org-html.el that is no longer part of org-mode. Additionally, there is a mailing list thread which seem to imply that the function is used for converting links when exporting to HTML. Commenting out the references to it in main.el in org2blog helps – I should be able to do without that features.

Next error:

            File error: Cannot open load file, org2blog/common/l2r
        

This time the missing dependency is tinydb/persist. Installation is quick:

            git clone http://repo.or.cz/r/tinydb.git
            cd tinydb
            cp *.el ~/.site-lisp
        

Hopefully, I should be able to do without that feature. And finally! I'm able to load org2blog using this configuration:

(load-library "asynq")
        (load-library "persist")
        (load-library "l2r")
        (load-library "g")
        (load-library "main")
        (require 'org2blog/atom/main)
        

But running M-x org2blog/atom:post emits yet another problem:

            Symbol's function definition is void: org-mode-p
        

Googling for it produces a pull request with a patch for a different project that I think I can adapt. Easily fixed by commenting out these two superfluous lines in main.el in org2blog:

(unless (org-mode-p)
        (error 
        "Only useful in an org-mode buffer"))
        

Then I get to the next error:

            org-export-as-html: Wrong type argument: stringp, t
        

At this point, someone wiser than me would probably give up. Conclude that org2blog/atom isn't salvagable and that there's better uses for ones time. But.. I'm not that person. What's required is another simple change in main.el:

(org-export-as-html nil nil))
        ;; 
        (org-export-as-html nil nil nil t nil))
        

The next error message is encouraging, because it seem to complain about a missing configuration variable which makes me think the final is near:

            let*: Symbol's function definition is void: gblogger-blog->posting-url

The symbol is a function that is called with the return value of a function call to gblogger-ensure-blog. There are no search results for the symbol name. I'm done with org2blog/atom, at least for now. org2blog/atom probably needs to be rewritten anyway because it needs to be updated to org-mode's and Bloggers latest API changes. g-client could probably be salvaged though.

Blogging with emacs, org-mode and org2blog/atom

This article describes my experiences trying out various emacs module for managing your blog.

My requirements for a great blogging solution for emacs should support the following:

  • Write blog posts in Markdown, preferably using markdown-mode.el.
  • Syntax highlighting. Stackoverflow's online editor does it in a nice way.
  • Keybinding to upload the current buffer to blogspot. This is not a critical point and I'm prepared to move to another host if it's not possible to work with blogspot.
  • Easy way to attach images to the post.

Here are the various blogging solutions I tried out:

Blogging with org-mode and org2blog

org-mode is great for dealing with tabular data. I use it all the time for time series data, like keeping track of my weight, my score in Vem vet mest? and my work hours. It's also not bad for writing todo lists of all kinds. The org-mode syntax does not appear to be Markdown, but something close enough.

My information about org2blog comes from an old blog post written by Irreal.

Apparently, blogger uses the Atom API, so what I need is something called Org2BlogAtom.

The first problem is how to get org-mode to export to html with syntax highlighting. I'm often inserting code snippets in my posts, so getting that to work correctly is definitely a must. Two things are needed for that to happen:

  1. htmlize.el need to be installed.
  2. .emacs must contain:
(setq org-src-fontify-natively t
org-export-htmlize-output-type 'css)

Then just press C-c C-e h to generate an html file of your org buffer. That's the first step, the next is to get the generated html file published online on my blog.

There are two different versions of org2blog, a fact that struck me after some googling. One for posting to Wordpress blogs and a different module for Blogger ones. Since I'm currently with the latter, what I need is org2blog/atom which is found at the sparsely documented git repo.

It depends on g-client, which has its own EmacsWiki page, but no obvious way to download the module. Checking out and building the Subversion reposity seem to have worked:

svn co http://emacspeak.googlecode.com/svn/trunk/lisp/g-client/
cd g-client
make
cp g-cus-load.el* g.el* gcal.* g-utils.el* g-app.el* gblogger.el* \
~/.site-lisp/

(~/.site-lisp/ is on load-path ofcourse).

org2blog/atom itself has an installation procedure that depends on "elinstall" which seem to be a custom installation module created by same author. But copying all elisp files from the ./atom and ./common to my ~/.site-lisp directory sems to work.

Next error "Requires a different version of org-mode. See README.org". The one shipped with emacs 24.3 isn't enough? But I think it should be since emacs 24.3 was released after the last commit was made to the org2blog repository. Let's check the code.

(unless (boundp 'org-html-cvt-link-fn)
(error 
"Requires a different version of org-mode.  See README.org"))

Aha! So where does org-html-cvt-link-fn come from? After some heavy google, I think the answer is that it was defined in a file called org-html.el that is no longer part of org-mode. Additionally, there is a mailing list thread which seem to imply that the function is used for converting links when exporting to HTML. Commenting out the references to it in main.el in org2blog helps – I should be able to do without that features.

Next error:

File error: Cannot open load file, org2blog/common/l2r

This time the missing dependency is tinydb/persist. Installation is quick:

git clone http://repo.or.cz/r/tinydb.git
cd tinydb
cp *.el ~/.site-lisp

Hopefully, I should be able to do without that feature. And finally! I'm able to load org2blog using this configuration:

(load-library "asynq")
(load-library "persist")
(load-library "l2r")
(load-library "g")
(load-library "main")
(require 'org2blog/atom/main)

But running M-x org2blog/atom:post emits yet another problem:

Symbol's function definition is void: org-mode-p

Googling for it produces a pull request with a patch for a different project that I think I can adapt. Easily fixed by commenting out these two superfluous lines in main.el in org2blog:

(unless (org-mode-p)
(error 
"Only useful in an org-mode buffer"))

Then I get to the next error:

org-export-as-html: Wrong type argument: stringp, t

At this point, someone wiser than me would probably give up. Conclude that org2blog/atom isn't salvagable and that there's better uses for ones time. But.. I'm not that person. What's required is another simple change in main.el:

(org-export-as-html nil nil))
;;  (org-export-as-html nil nil nil t nil))

The next error message is encouraging, because it seem to complain about a missing configuration variable which makes me think the final is near:

let*: Symbol's function definition is void: gblogger-blog->posting-url

The symbol is a function that is called with the return value of a function call to gblogger-ensure-blog. There are no search results for the symbol name. I'm done with org2blog/atom, at least for now. org2blog/atom probably needs to be rewritten anyway because it needs to be updated to org-mode's and Bloggers latest API changes. g-client could probably be salvaged though.

Glada kiosken har stängt

Kanske har den slätt igen för gott? Visst handlade jag nästan aldrig där, men den var trevlig att ha. Kyldisken som den nye ägaren installerade hade potential. Fast kaffet kom fortfarande från den äckliga igenkalkade kaffemaskinen den förra ägaren hade. Därför gick man hellre till Ica för att köpa billigt kaffe.

Vaknade på fel sida

Vaknade på fel sida idag. Bokstavligt talat. Axeln och vänstra ryggsidan var full med sängstreck från fel sida. Tror det var för jag körde bil igår och det rubbade min rytm för jag sov dåligt också. Hoppas resten av dagen blir bättre.

Bra frisör

Det är inte ofta som jag blir nöjd efter att jag gått och klippt mig. Men frisörskan på Hon & Han i Kista galleria gjorde ett strålande jobb. Dit ska jag gå nästa gång också.

A Beautiful Mind

Bra film om John Nash om än lite sötsliskig. Blir väl ofta så i hollywooddokumentärer. För gemene man kanske inte Nashs teorier är speciellt intressanta och därför fokuserar de på känslor istället.

Högintensiv intervallträning

Har börjat med min egen variant av träningsformen högintensiv intervall träning den här veckan. Jeflar vad effektivt det är om hur utpumpad man känner sig efteråt är en indikation på hur bra träningen är. Konceptet är busenkelt, man varvar korta spurtar med ett par minuters återhämtning och repeterar ett fåtal gånger.

Såhär gör jag: Först 60 sekunder då jag trampar så snabbt jag kan med högsta motstånd på motionscykeln eller springer så snabbt jag kan på ett löpband. Pulsen ökar då till 170-180 slag/minut vilket är mitt max. Efter den minuten, ett par minuters vila eller sakta lunkande tills pulsen återgår till 120-130 och jag känner mig fit-for-fight. Sedan 60 sekunder på maxintensitet. Repetera sex gånger. Finns en massa guider på internet som förklarar det mycket bättre än vad jag kan.

Det låter inte så jobbigt eftersom det bara är totalt 60 * 6 sekunder, eller sex minuter som man tar i, men tro mig, det är krävande. Efter ett sånt pass är jag helt slut i kroppen och kan knappt stå på benen. Det bästa med det är att det är tidseffektivt. Ett pass tar knappt 30 minuter så det borde inte vara några problem att hinna med att träna några gånger i veckan.

The "Cannot add an entity with a key that is already in use." error

If you are getting the above Linq2sql error, here is the first thing you should do. It will not solve the problem for you, but it will greatly help you when tracking down the root cause:

    try
    {
        db.SubmitChanges();
    }
    catch (DuplicateKeyException dke)
    {
        Console.WriteLine(
            "DuplicateKeyException caused by {0}!", 
            dke.Object
        );
        throw;
    }
Yeah I know, it's not much. :) But this way you know the entity instance that is caused the problem which will make your code much (much) easier to debug.

Mer Jujutsu

Nu har jag gult bälte! Wohoo!! Fast jag måste vänta tills mitten av januari innan terminen börjar igen. :) Det ska bli görskoj.

Självklart...

När man väl lyckats sparka igång sig själv och tagit sig ner till jujutsun, ja då har man glömt kläderna hemma. Asch! Dessutom har nobelfesten tagit över Vem Vet Mests programtid. Vilka i-landsproblem man har.

My CV Online

I have made an online cv site for my resume. I think it is pretty good looking and it is much funnier to style it using HTML and CSS than with boring Latex :). It appears to look good on handheld devices because I'm using a "responsive design" framework. When I get to work at Monday I'll test how it looks printed too.

Alla vet vad pilatus är för något

Alltså, man kan inte kugga någon för de uttalar ett ord en endaste bokstav fel. Rickard Olsson uttalar själv ortsnamn och efternamn helt felaktigt flera gånger i nästan varje program av Vem Vet Mest. Ibland är reglerna helt ologiska. Dessutom borde det finnas någon spärr så att inte en person skickar en fråga på samma person flera gånger i rad eftersom det är orättvist.