Emacs, flyspell-mode and “centralized”

June 12, 2009

It was a rather irritating fight, today. It’s been a while since I last tried Emacs’ flyspell mode, which is supposed to check you writing on-the-fly, as the name implies. It works quite well, yes, but I soon got irritated by all the suggested corrections for “-ize” endings, like “centralized” should be replaced by “centralised”, which looks sort of unnatural to me. I had to check the Oxford English Dictionary, which does not even recognize the form “centralise”, and this made me pretty irritated!

Google came to help, or so it seemed. I ended up looking at wordlist packages for Debian etc., but lets cut the story short. The default spell checking program used by flyspell-mode is “ispell”, which is a venerable program, functional, but outdated by, for example, aspell — which then suddenly had tens of various dictionaries available, amongst which I found various with -ize suffixes.

Now, the only question that remains is, why does Emacs Ispell-mode default to ispell instead of aspell?


A Very Small Example of Applicative Functors in Haskell

January 29, 2009

This is to document a small, working example of how applicative functors can be used in Haskell.

import Control.Applicative

f1:: Int -> Int -> Int
f1 x y = 2*x+y

main = do return $ show $ f1 <$> (Just 1) <*> (Just 2)

A very short explanation follows.

On line 1, the necessary base library module is imported

On lines 3 and 4, a small function from two integers to one integer is defined

On line 6, it is shown, how the applicative functors are used to apply the function on Maybe- values.


Archives of European Sociology

May 9, 2008

This time I’ll be writing something more connected to history than computers, but it has pretty much to do with modern technology, anyway.

If you do a Google search for the journal title “Archives of European Sociology”, you’ll get a long list of citations to a journal by that name, like “Brubaker, Rogers, Ethnicity without Groups, Archives of European Sociology, 18, 2 2002″. Now, my wife, who happens to be a historian, tried to find this journal, as she wanted to see an article published there. Based on the huge amount of citations to the journal found by Google, she of course assumed, that the journal was well-known, widely distributed, and logically, available at the local university library. To her big surprise, she was not able to find the journal in any library database — the closest match was the Archives européennes de sociologie, and international publication, that also had an english title (European Journal of Sociology) and a German title (Europäisches Archiv für Soziologie). That obviously could not be it, as the Journals home page at the publishers site very clearly stated the title in all three languages.

But, in the end, a comparison of the references to the mysterious journal with the table of contents -data at the publishers site did show, that this was, after all, the mysterious Archives of European Sociology. Why on earth was it always referred to under this name, when the publisher, and the journal itself, very clearly used the english title European Journal of Sociology? The thing remained a mystery, until today, when she found one potential explanation for this misnomer:

More and more, the scientific journals have been adopting the convention, that the headers and footers of the pages include, in addition to the page number, the authors name and a part of the title, also a reference to the journal itself: the name of the journal, the year, volume and number of the current issue, and the pages covered by the article in question; most often this information appears in the footer of the first page of each article. This is a wonderful habit, as it saves the nerves of so many academics fervently copying articles and trying to sort the piles of copies later. The Archives européennes de sociologie had adopted this policy already in the yearly 1980’s. And you know what? They did not want to print the whole name of the journal in the footer, as it was rather long, and would have forced the footer to extend to the second line; instead, they used an abbreviation — also a venerable habit. The abbreviation was Arch. europ. sociol.

One can just imagine, how the academic sorting his piles of photocopies finds this interesting article he did remember having somewhere, is convinced of its value, and decided to cite it in his/her next work. But where did the article come from? Luckily the necessary information is included in the photocopy itself: “Arch. europ. sociol.” Now, if you’re mother tongue is English, and you have this article written in English from a journal, the name of which is abbreviated thus, what is the logical English name that can be constructed from that: “Archives of European Sociology”.


The wonders of dual-core systems

March 12, 2008

Just a quick note, today. My personal way of working is close to some kind of multitasking. As I personally have only one processor (“the brain”), things do come out sequentially, but I am quite convinced, that the brain actually operates many parallel threads at the same time. Of course, most of this are independent, autonomous processes connected with the bodily functions etc., but some threads are obviously some kind of sub-conscious analytical processes, to which the consicous mind passes pressing problems to be processed without any external disturbances. Then at some point, when your conscious level of the brain has reached a point in its progress, to which these sub-conscious processes have some relevance, they send an interrupt and require attention.

Practically, what this means, is that the ideas, what to do with the data often appear in the middle of the writing process itself, and force me to divert my attention from producing as much text as possible to performing some new analysis with the data. Now, with the traditional, single core systems this used to mean a halt in the writing. No matter how nice you tell your GRASS module to be, it still seems to bog down the system while doing something with your ~30M cell raster. Now, with the modern nay dual-core processors, this does not happen any more — the GRASS module takes everything the second core has to offer, while I can still keep happily using the first one to all the other things.

Especially nice this is on my work computer, as I run GRASS on Debian as a VirtualBox virtual machine. VirtualBox occupies the second core completely, while the rest is left to the actual OS (XP, in my case) to run my Emacs and other stuff. Probably with Quad-core I would feel like wasting the cores, but for my purposes, a Dual core system is very nice indeed.


XMonad and Gnome

February 1, 2008

This has nothing to do with the theme of the blog, but I just happened to find a wonderful window manager for my laptop. I’m generally using Gnome, since I like the looks, but I’ve never really liked Metacity, the default window manager in Gnome. On the other hand, I’ve lately been studying Haskell, a functional computing language. A wonderfully weird experience.

There just happens to be this new window manager written completely in Haskell, XMonad, which is a so-called tiling window manager — no empty spaces on your screen any more. I just had to try it, and believe me, it is very nice to use indeed. I wanted to integrate is with my Gnome system, and the panels especially, but that was not so easy. First I had to get very recent versions of XMonad — happily there are Debian packages, but not on the official repo — and then I had to figure out, how to configure XMonad so, that it

  1. ignores the gnome panels on my screen;
  2. Leaves empty space for the panels.

The instructions on the XMonad site were for the old versions and did not really completely work. The installation goes according to the instructions on that page, but what the page lacks is a complete, working example of the configuration. Here’s one:

You’ll have to create the file
~/.xmonad/xmonad.hs
where to put your configuration. A sample content for this file:

import XMonad

main = xmonad $ defaultConfig
       { defaultGaps = [(24,24,0,0)],
         manageHook = composeAll
                      [ className =? "MPlayer" --> doFloat
                      , className =? "Gimp" --> doFloat
                      , resource =? "gnome-panel" --> doIgnore ]
       }

That gives you an empty space of 24 pixels at the top and bottom of the screen, and ignores gnome-panel. In addition, it lets Gimp and MPlayer float above other windows. Some fiddling with the session setup (see the link to the instructions) and this file in place, everything works fine, at least with XMonad 0.6. I haven’t tried the 0.5 series, so I cannot say, whether this works with them, and the versions before 0.5 use adifferent kind of a configuration scheme, so this does not work for those.

Update on 2008/05/01:

There is a page in the HaskellWiki on XMonad and Gnome, which contains all the information on this page plus much more. Go there!


Word to LaTeX

January 30, 2008

For years now, I’ve been using a venerable old tool, rtf2latex, to convert documents from MS Word to LaTeX. For my purposes it has served well: the purpose being mostly to transform submitted articles into something, that can then made to conform to my LaTeX-style for the journal whose layout I’m doing. In practice the needs are: keep the footnotes intact, let italics, bold and underline survive the translation. Nothing else is needed, as I trust LaTeX to do rest.

I’ve felt strangely uneasy about using rtf2latex lately, though. The fact that is is no more available in Debian has made me look for alternatives. Also, the Word documents I received I still had to translate first from .doc to RTF. wvWare seemed the proper alternative, but it does not work with footnotes at all, and its web page says, that its use for this purpose is deprecated in favour of Abiword.

Abiword I use occasionally, it is your typical Gnome program. Not too complicated, works well, and is nice to look at. But this conversion function I was never able to get working, until today, when I realised, that I need to install also the abiword-plugins… how stupid of me. Now the conversion from MS .doc to latex works well, although the resulting documens is slightly too fancy to me. I’d be happy with something that preserves only the logic of the markup, and discards all of the funny spaces that are used to make it look like a Word document (Why on earth would anyone want that?)

But I guess I can finally stop worrying about not accidentally removing rtf2latex from my system. A replacement has been found! And although from the web page and release history it might seem, that Abiword is a dead project, the traffic on the development mailing list demonstrates, that the project is very much alive. I guess we will have the version 2.6 someday — not that there’s really anything wrong with 2.4.6.


Statistics, SPSS and R

October 29, 2007

As I’m currently forced to work on a computer running Windows XP at a university, I have started to explore the possibilities, the commercial programs might offer as replacements for the open source tools I’ve learned to use during the past years on Linux. Last week and today I’ve been studying how to do some cluster analysis on the software availabe in the university network. I had already installed my database on a PostgreSQL server running on my work computer – I can’t be bothered to even try things out with Access anymore, even though the current versions are probably much better than the horrible Access 97 -, so an important feature was the ability to access views and tables on the server.

First I tried Statistica, version 7. The data import worked well through the ODBC driver provided by PostgreSQL, and the user interface was surprisingly nice; not immediately accessible, but this seems to be a powerful tool. I never got to the clustering part, though, as this morning Statistica started to complain, that it has expired, and that I need to fill in a new date code. That’s that then, I’ll file a report to the support unless in works again tomorrow.

So today, I turned to SPSS (version 14). Data import was less intuitive, but worked well. The analysis methods are not as easy to use, and I was quite surprised, when the simple hierarchical clustering of ca. 500 measurements, each with ca. 30 variables, locked the computer for almost 30 minutes. Seven years ago I wrote a C++ program for my old, old laptop for a similar purpose, with 3000 measurements with 10 variables, and it lasted 20 minutes. And that was my first ever real computer program, so I had expected somewhat better performance.

I decided to test the good, old tools, and installed R on the XP. I had some trouble importing the data from PostgreSQL, until I realised, that I just have to use the same ODBC interface as with the other programs. After that, everything went quite quickly; a hierarchical, agglomerative clustering with agnes took 4 seconds, but nicer results were produced with diana (about the same time), both from the package cluster. After this, I won’t be going back to SPSS, but I might still give a try to Statistica, if it agrees to run one of these days.

Based on these quick tests, R is a much more efficient tool. The learning curve is probably quite much steeper, as using R is like shell programming, but once you learn how to use it, there’s no limit what you can do. But don’t take my opinions at face value: I don’t really know how to use SPSS, so anyone really knowing his/her way around with it is probably better source. This is just a blog, anyway…


Annotating pdf

October 24, 2007

For a long time I’ve been looking for a tool to annotate the pdf documents. The electronic versions of academic journals usually provide the articles in pdf format, and it would be nice to work with them like with the printed versions: underlining, making notes in the margin etc. This far, this has required the purchase of a full version of Adobe Reader — rarely anyone distributes their pdf-files with the “comment” property enabled, if not for anything else then for the reason, that to enable this property is not trivial.

A wonderful alternative seems to be PDF-XChange Viewer. It is as free as the Adobe product, but seems to be faster and lighter on the computer. The display quality at the XP I use at work is as good, and the biggest bonus is, that you can add your own annotation to the pdf file. These are saved with the file, and can be seen with any other pdf viewer, it seems.

You never know about the policies of individual companies, but it seems, that Tracker Software tries to do the same thing as Adobe, because the other versions of the program have more capabilites; they just offer more for nothing.

Downsides? Of course, there is no Linux version available, which is a pity. But for the time being, as I have to use XP at work anyway, I’ll be doing my readings (and annotations!) with this program.

Update on 2008-06-20:

I just tested PDF-XChange viewer on Wine after having updated my Debian testing distribution. Works well now, so even though there is no Linux version yet, the program can be used under Wine. No special setups in my case were needed.