08:02 Fri, 17 Feb 2012
Vim has support for a built-in thesaurus. However, it consumes a
lot of memory, which you may not want for a feature you do not use much, and its
auto-complete selection has issues. Here is how to set up an on-line thesaurus query that is light weight.
Summary
This is the first post of two about a light weight way to implement a thesaurus. It is
great for what I need, which is the occasional use of a thesaurus for writing text such
as this article. Once it is set up, you can forget about it and just use K
whenever you want to look up a word.
A nice bonus or synergy is that the website also returns a definition for the word, so
it functions as a simple dictionary as well.
The second post will deal with how to use Vim's built in syntax rule sets to provide
highlighting and nice colours.
There are two or three simple steps:
- a vim script that passes the cursor word to an external shell script.
- a shell script that looks up the word using an online thesaurus, then parses
[continued...]
09:17 Sun, 05 Feb 2012
Slackware, like other Linuxes and BSDs, uses pm-utils to manage
sleep and resume, including managing the cpu frequency governors. The standard scripts
restore the governor after the machine has woken from sleep mode, but they don't restore
the governor's frequency. Here is how to fix it.
I run Slackware on my laptop, as I've mentioned here before, and about the only issue I
have with it instead of the natively installed Vista Home is that it runs a bit hot.
From what I can tell (because Vista does not give you a lot of tools to investigate),
Vista does two things more aggressively: it slows down the CPU frequency, and it changes
the fan speed sooner. However, the benefits of have a unix-y environment more
than make up for that so I am happy with running Slackware.
However, that does not mean I can't tweak things a bit, such as setting up a CPU
frequency governor and scaling the frequency, which I wrote
about previously.
Pm-utils
Slackware uses pm-utils, a suite of scripts from
freedesktop.org, to manage suspend and
[continued...]
12:12 Mon, 30 Jan 2012
Well, the Melbourne Open has finished after a huge couple of weeks. If you read my
previous post on tennis, you know I am not usually a fan of this overpaid over-hyped
event. But this one was pretty good.
We saw some great games. The main thing for me, though, was that we saw some relative
new-comers get up and win their important games from the big stars. There is a changing
of the guard underway in all areas, women's and men's. That started last year or even
the year before, but this year was conclusive.
However, to harp on again, women's tennis is still unwatchable because of the banshee
shrieking. It is not even improving. If anything, it is getting worse. They have
become more vocal and, if it is possible, louder.
Why do they do it? Why is it impossible for them to grunt without shrieking? It is
extremely distracting. Until they stop (unlikely), or authorities regulate it
(unlikely), or viewers start protesting (maybe), I can't watch it.
Which isn't a great loss since it is as boring as batshit anyway. Pip, pip!
[continued...]
10:00 Wed, 25 Jan 2012
A quick note to say I haven't been posting much because a) it is as hot as
hell, too hot to use my overheating laptop; and b) I've been involved in a
couple of projects that have been overheating my laptop, and I will post about them
soon.
11:33 Tue, 17 Jan 2012
I wanted to try out Tumblr to see how easy it was. Turns out it is pretty easy.
Actually, I'm (surprisingly, perhaps) pleased with how seamless the whole thing was.
Even from the limited number of posts so far, the tumblr blog gets more feedback, which
always gives an incentive to write more. I think that applies whether you are driven by
vanity or not.
I'm not sure whether I'll keep the tumblr blog going or not, nor how I am going to split
content between the two.
I usually blog in two distinct categories: general stuff which includes science, and
unix and programming stuff. For the time being, I guess I will just post to which blog
seems more suitable.
You can check out the tumblr blog
here.
11:13 Sat, 14 Jan 2012
Here is a fascinating factoid about crumpled paper. Take a piece of paper and crumple it,
then place it over another piece of paper. Some point of the crumpled piece is exactly
over its corresponding point of the other piece.
No way, you say.
It is true. You can prove it intuitively. If you stand somewhere in your city and place a
map of the city on the ground, one point on the map will be exactly over its
corresponding physical point. It has to be, since the map is nothing but the city
shrunk down. If you are at the corner of A Street and B Street and place the map on the
ground, the map's A & B corner is right over the actual corner.
Similarly, the crumpled paper is, in a sense, the paper shrunk down. If you place the
crumpled paper over another, there must a point on the crumpled paper that is over its
corresponding point on the other piece of paper.
15:21 Fri, 13 Jan 2012
Calcc is a useful command line calculator for programmers, with a
full range of bit and byte operators.
I have been going through James Malloy's tutorial on writing your own operating system1 , which involves some assembly and
quite a bit of bit twiddling with shifts and masks in C.
I haven't written any assembly or done any serious bit manipulation for years. I can do
simple (i.e. 1 byte) hexadecimal addition in my head, but nothing more complex than that, so I
needed a quick calculator that showed me the results from doing things like bit shifts,
rotates, masking, and so on.
A bit of googling found one contributor to
Stackoverflow recommending calcc by Luigi Auriemma. A quick download
of a small zip file and there it was, GPL'ed source code and pre-built binaries for
unix and MS Windows.
It is quick and simple to use and has the usual unary and binary
[continued...]
09:58 Thu, 29 Dec 2011
If you are wondering where Simon O'Donnell is in The
Cricket Show, it turns out he will be the host for Nine's Sunday Footy
Show. O'Donnell is leaving because he has commitments outside Channel Nine and
would not be able to do both shows.
I like O'Donnell's presentation style. He had an easy conversational interview style
and he had the knowledge that comes from being a former Test player. With his relaxed
nature, he was able to get past the formulaic plastic face of PR spin and get his
interviewees to really talk about themselves and their game. His tips and answers to
young viewer questions about their technique was insightful.
All in all, it was an enjoyable way to spend the lunch break and get some of the
background and culture of cricket.
Michael Slater is taking up the reigns from O'Donnell and, from his efforts so far, is
doing a pretty good job.
09:22 Wed, 21 Dec 2011
ABC3 is the ABC
TV's station for young viewers, mainly pre-teens. It closes around 9pm each night.
Then they play some music and display a "We will be back tomorrow" image.
Over the last few months, I have occasionally miscued the remote and landed there.
Surprisingly, or perhaps not given the time of night, the music is not kiddies' music.
Sometimes it is really great.
Last night, for example, appeared to be Funk night, with some great tunes from the 80s
and 90s and including some bands you have never heard of like The Soul Seven who
were mainly a session band and who only put out two singles.
I don't know if they are using Rage's
producers to draw up their play list, but whoever did certainly knows their music.
Last night I cancelled my TV viewing, cranked up the volume and listened to some good
music courtesy of ABC3 Childrens' Channel.
11:15 Sun, 18 Dec 2011
Slackware's cron daemon has some new features that make it
especially good for laptops.
As long as I can remember, Slackware has used Dillon's cron dcron as its cron
daemon. Dcron is a lightweight cron with an emphasis on a solid secure codebase which,
while missing a few esoteric features found in bigger cron daemons, is great for most users.
Since 13.1 and continuing with 13.37, Slackware has had an updated version of dcron that
introduced some very handy features that make it especially suitable for laptops, or
indeed any machine that spends much of its time in sleep mode. The features give dcron
some of the characteristics of anacron.
Somehow I managed to miss the changes until now, almost two years later. (I must have
been in a personal sleep mode.) Here I am going to explain the features and why they
are great for laptops, and give a couple of examples.
Sleep
Over the years you have probably picked up several handy scripts that you run from a
cron job. Some of them might run every day, some of them every week. For example, I
have a weather script that grabs the local weather forecast from the Bureau of
[continued...]