How To Set Up A Light-Weight On-line Thesaurus For Vim

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:

  1. a vim script that passes the cursor word to an external shell script.
  2. a shell script that looks up the word using an online thesaurus, then parses     [continued...]

Tumblr Blog

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.

Categories: general, blogging

Blog Content for Mobile Users

10:28 Thu, 08 Sep 2011

Quick, easy and simple way to convert blog content to a mobile-friendly format using sed.

When I set up this blog three years ago I did not bother to design anything different for mobile users, mainly because I had the notion of mobile as meaning laptop users. It was a safe bet to assume that the screen would be at least 800 pixels wide, or more commonly at least 1280 pixels wide. Phone users of web content were still very much in the minority.

In the three years since, the landscape has changed enormously. Now, there are plenty of users of mobile devices and they are using netbooks, tablets and mobile phones. It was time to cater to those users with small screens by providing special content.

I was not looking forward to this. My CSS skills are average at best and the thought of trudging through the CSS and HTML to set up special handling was daunting.

Then I googled how other people handled it and read a neat idea: use sed or awk to filter the normal output. I would not have to rewrite the application or the CSS. Great!     [continued...]

Categories: blogging

This Is Valid; a Superior Experience

17:08 Tue, 16 Aug 2011

Just spent a tedious afternoon validating the HTML and CSS for this blog. It's amazing how many small errors creep in over time when you do minor edits to the source code. For example, I dynamically generate the list of content links to the right of where you are reading. I made a small change in the source code to include an <hr> tag (the horizontal rule you can see), but forgot that the list is all comprised of links, so, bang!, the validator complains about a bunch of <hr> within <a... > tags. And then the fiddly bits of generating paragraphs with valid <p> and </p> tags. (Solution: forget the closing tags; life should be simple, right.)

And so on.

Anyway, it is all fixed now. Enjoy this HTML 4.01 Strict and CSS 2.1 validated reading experience. Try to pretend you care.

Categories: blogging, internet

Generate a Sitemap for Your Blog

17:41 Tue, 19 Jul 2011

A script to automatically generate a sitemap for a website, especially useful for text blogs.

I use a heavily modified version of the Kukkaisvoima blog software for my blog, which I previously wrote about. One of the reasons I like it is that it uses plain text files for blog entries, which means I can write blog entries in my favourite text editor (Vim) quickly and easily. Each blog entry is a separate file and the filename, stripped of the suffix, forms the URL.

So that's the basics. The task is to generate a sitemap for the blog. First, a sitemap follows the protocol detailed on the sitemaps.org website. Second, you can have more than one sitemap. In that case, you use a sitemap index file that specifies all the sitemaps.

The formats for sitemap files are quite straightforward. Here's an example index sitemap:     [continued...]

Categories: unix, blogging, internet

Kukkaisvoima Blogging Software

10:44 Sun, 20 Dec 2009

I wanted a simple light-weight personal blogging tool that lets me write in flat files. Like many others, I very much dislike editing text in a browser, especially anything more than a few lines. Browsers seem so overloaded with junk and javascript nowadays that their response time has crept up to several tenths of a second, very frustrating for a touch-typist who needs response times of around a tenth to catch errors 1. So, this tool needed to work with flat files that I could edit in vim and easily transfer up to the blog host.

As well, it needed to be light-weight. I can't see my blog ever running to more than a few hundred entries per year max. Tools like Wordpress et al are too heavy for me, in the sense that their processing slows things down by comparison.

Python would be good, I prefer it to PHP. I really like it, it is a great language.

Also, I wanted some simple things like categories and comments, and search would be nice too.

Originally, I had tried pyblosxom, but I found the lack of documentation     [continued...]

Categories: python, software, blogging