Toasted computer scientists  
Tuesday, May 29, 2007, 12:52 PM - Coding
I think this is really old, but it's too good not to spread:


How Computer Scientists Would Design a Toaster




[ add comment ]   |  permalink  |   ( 3 / 2839 )
Backporting N3 to 1990  
Monday, May 14, 2007, 04:27 PM - RDF
(X)emacs is an evil evil disease. Despite a great selection of other text-editors, I can never work as comfortably or quickly as with xemacs, and the xemacs keybindings are so deeply embedded in my soul that I've come to realise that I will never forget them, nor can I override them by learning something new. Therefore I bit into the sour apple that is emacs-lisp and made n3-mode for xemacs!



It's crappy, and does syntax highlighting and comment support only. It didn't take as long as I thought since I recycled the regexps from my previous three efforts:


If you want to take part in the glorious double-fun that is xemacs N3 editing:

  • Download n3mode.el into ~/.xemacs/
  • Add the following lines to ~/.xemacs:

(load "~/.xemacs/n3mode.el")
(setq auto-mode-alist (cons '("\\.n3$" . n3-mode) auto-mode-alist))
(add-hook 'n3-mode-hook 'turn-on-font-lock)

  • Open an N3 file and enjoy!

Now maybe I can finally get around to editting those N3 files, and stop wasting my time.

[ add comment ]   |  permalink  |   ( 3 / 3026 )
Weird Email  
Friday, May 11, 2007, 09:51 AM - Everything Else
Yesterday I got an odd email to my gmail account:

From: Master Doofus <masterdoofus at the domian of gmail.com>
Subject: Hey gromgull, consider getting a new e-mail address

Apparently, your email address happens to have a really high PageRank
value for a Google search for E-mail addresses, making you more
susceptible spam like this that use lame Perl scripts. Feel free to
reply to this mail. Thanks.


WTF? What do I make of this? Do I trust the anonymous person who identifies himself as Master Doofus? Do I break the holy rules of spam prevention and reply? And most importantly, where can I get my own lame perl script?

[ add comment ]   |  permalink  |   ( 3 / 2908 )
N3 Syntax highlighting for gtksourceview  
Thursday, May 10, 2007, 10:24 AM - RDF
Since finding a decent mode for N3 in xemacs seems impossible, and writing a new mode is non-trivial I decided to face the fact that there is more than one editor out there, and I dug out this N3 language definition I did for gtksourceview, the component uses in gedit and various other gnome applications.



Download the .lang file here and put it in /usr/share/gtksourceview-1.0/language-specs or ~/.gnome2/gtksourceview-1.0/language-specs. Now the N3 mode is available from the View->Highlight Mode->Markup menu.
To automatically highlight all .n3 files add:

<mime-type type="text/rdf+n3">
<comment>N3</comment>
<glob pattern="*.n3" />
</mime-type>

to ~/.local/share/mime/packages/Override.xml.



[ add comment ]   |  permalink  |   ( 3 / 2864 )
Plotting graphs with R  
Thursday, May 3, 2007, 10:03 AM - PhD
This morning I spent 3 hours, from 8am to 11am, trying to force R into plotting beautiful graphs. To increase the challenge I do all my R work through rpy, since the R command-line drives me crazy. Problems, solutions and lessons learner were as follows (if you've never used R this will look like gibberish):

  • To get square line ends you have to the the lend parameter using par BEFORE you call plot.

  • Getting greek characters and other math notation into labels is rather complicated, and right out goddamn impossible through rpy. In the end I fell back to constructing long R commands as string, then using r(command) to execute them.

  • It is not possible to have diagonal axis labels.

  • At least in my version of R (=2.1.0, 2.4.0 crashes with rpy), the axis command ignores the xaxp set with par when at is not specified. Use axTicks specifying xaxp instead.

In the end I got what I wanted though:



The axis here were generated with:
axis(1,at=c(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0),
labels=c(expression(paste("Aleph")),
expression(paste("KNN ")),
expression(paste("KNN ", gamma, "1")),
expression(paste("KNN ", gamma, "2")),
expression(paste("SLIPPER")),
expression(paste("SLIPPER ", gamma, "1")),
expression(paste("SLIPPER ", gamma, "2"))),las=3, srt=90)


Sub-scripting the number after gamma should also be possible, but I gave up.

Oh and before you say: "why didn't you just use excel/openoffice" - Because where would the wonderful vector-based PDF antialiases goodness be then?


[ add comment ]   |  permalink  |   ( 3 / 2063 )

Back Next