... using Blosxom to retrace my steps

tstigers.net - Home :: Entries :: Feeds :: Photos
June 2017
Sun Mon Tue Wed Thu Fri Sat

Mon, 22 Sep 2008

Now even safer!

Regarding my new online blog entry editor, I still had to do something about quotes (single and double), which got commented out so I ended up with ugly backslashes in my text and links wouldn't point at the proper URL. This was easy to solve with the PHP "str_replace(search, replace, subject)" function.

Then I also built in two basic security features: one makes sure I get an e-mail message whenever my editor page is used, the other asks for a password before displaying the form from which a user can post an entry.

Posted on 22 Sep 2008 at 19:07 in /technology/internet/blosxom. -- Permalink

Posting Blosxom entries online, without FTP

I've started experimenting with PHP again. I used the "import" function to use one single file for the navigation on most of the pages on my website, and another single file for the links in the right column of some of my "old blog" pages. Now I've just finished a kind of simple blog entry editor, where you can enter a title and some text and select a category, which will then be saved as a text file in the correct directory on the server.

Posted on 22 Sep 2008 at 18:43 in /technology/internet/blosxom. -- Permalink

Fri, 07 Dec 2007

Relative links in Blosxom (4): fixed

The version of the rename command on my remote server is from 2000 or so and doesn't understand perl expressions. Instead, it works like "from to file".
So I had to change the last line of my script to:

rename txt.new txt *.new

I then ran the script in each directory. Now everything seems OK. Good-bye, relative paths!

Posted on 07 Dec 2007 at 16:40 in /technology/internet/blosxom. -- Permalink

Relative links in Blosxom (3)

The final version of my little shell script is here ... I had to keep the original files in order to set the timestamps of the corrected files back. This is why the original files couldn't simply be overwritten with the corrected ones. In the end, however, obviously the original files had to be discarded and the corrected files had to be given the same names as the original ones.

for i in *.txt;
do sed 's/href="blosxom\.cgi/href="http://\/\/tstigers\.net\/cgi-bin\/blosxom\.cgi/g' $i > $i.new;
touch -r $i $i.new;
rm *.txt;
rename 's/\.new//' *.new

This works fine locally. If anything goes wrong when I run it on my remote server, I'll have wrecked my whole Blosxom blog. But what's the alternative? Blosxom's dependence on file timestamps makes it difficult to create backups. I guess I should have a look at low-level copying.

But maybe it's enough to write a script which copies all files and folders of the Blosxom blog and sets the timestamp of each copied file according to the timestamp of the original file. Such a script wouldn't change anything in the original place - no writing there, only reading.

So the problem of recursively entering directories comes up again. Well, I guess it's still easier to run such a script in every single directory and pass it the correct path to the original files every time.

Posted on 07 Dec 2007 at 14:08 in /technology/internet/blosxom. -- Permalink

Relative links in Blosxom (2)

I found writing a script which changes relative to absolute paths less trivial than I had anticipated.

Editing multiple files in vim ("argdo") is OK - but what happens when your command doesn't apply to all open files (e.g. because you want to substitute something which in some of these files just isn't there)? vim doesn't just skip them but refuses to do anything in any file.

Regarding sed, at first I didn't realise that by default all output is written to standard output, so you have to pipe the output into a file if you want your substitutions to be permanent. Now I've got a simple shell script which loops through all file names in a directory, substitutes relative links with absolute ones and writes the result in a new file:

for i in *.txt;
do sed 's/href="blosxom\.cgi/href="http://\/\/tstigers\.net\/cgi-bin\/blosxom\.cgi/g' $i > $i.new;

I'm sure that this is not the most elegant solution - but it works. It would be nicer to have a script which does the trick recursively for all directories; but with the handful of directories I have, entering every directory by hand and running the script there is probably easier than writing and testing such a fully automatic script.

Next step: reading the timestamp of each original file and setting the timestamp of each new file to the timestamp of the corresponding original file. It shouldn't be too difficult to do this by incorporating a "touch" command into my script. Finally, I'll need to run this script on my server: downloading all Blosxom text files to my local machine changes the timestamps, of course.

Posted on 07 Dec 2007 at 13:19 in /technology/internet/blosxom. -- Permalink

Thu, 06 Dec 2007

Relative links in Blosxom

I realised I made a stupid mistake - I used relative paths instead of absolute ones for the internal links on this blog. The relative links work fine when you click on them from the main page; they lead to nirvana when you're on a different page, e.g. after clicking on a category path. The reason is that Blosxom creates a pseudo-path for such a page, appending stuff to the name of the Blosxom script file (blosxom.cgi).

Fixing this will be quite a hassle: editing the relevant files (using sed or just vim) is easy enough but resetting the timestamp individually for each file will be cumbersome. Can I do this automatically with a script?

Posted on 06 Dec 2007 at 13:02 in /technology/internet/blosxom. -- Permalink

Sat, 24 Nov 2007

Tweaked the "blox" plugin ...

... so now it creates <br /> tags instead of <br>. I'm using the following as a test:

a line
another line
a third line

Posted on 24 Nov 2007 at 13:10 in /technology/internet/blosxom. -- Permalink

Blosxom and W3C standards

I managed to tweak a few of my Blosxom files so that this blog is now "virtually" free of errors - it "almost" validates as XHTML 1.0 Transitional! I learned that the "blox" plugin, which automatically inserts <p> and <br> tags so you don't have to type them all the time, doesn't work properly when a paragraph starts with a tag (e.g. an <a href= ...>) and inserts <br> tags instead of (XHTML-compliant) <br /> ones. Also, it's best to escape characters like &.

When I corrected some of my posts and put them on the server again, of course they ended up on top of the stack - were posted with today's date. That's not what I want. So now I'm looking for a way to manipulate file dates on the server.

Posted on 24 Nov 2007 at 12:24 in /technology/internet/blosxom. -- Permalink

Tue, 20 Nov 2007

New look for this Blosxom blog

I couldn't keep my fingers off the stylesheet - now just about everything looks different here from before. Colours, fonts, sizes, boxes, backgrounds ... And it's still a simple "text only" blog. I like it this way.

Posted on 20 Nov 2007 at 21:40 in /technology/internet/blosxom. -- Permalink

Tue, 13 Nov 2007

Positioning the calendar

I learned how to create columns with CSS - fine. Decided I don't like it for this blog after all, though. So what I did is I simply positioned the calendar where I want it, up there in the right corner, and made a few other small adjustments. There are several divisions (in <div> tags) now in the HTML code to facilitate the use of CSS.

Posted on 13 Nov 2007 at 20:34 in /technology/internet/blosxom. -- Permalink

Creating columns with CSS

Even though I want to keep this blog really simple and don't want to add sidebars with lots of stuff - link lists, categories, archives, this kind of things -, I'm still interested in how to create a website layout which has several columns. Not using a table is, of course, a point of honour. So CSS is the answer.

I've just googled for "columns css" and found a couple of useful sites right away. Now I'm trying things out, hoping that the calendar up there will move to the side before long.

(Yes, sure, I've figured out by now that Blosxom is quite dead. Still, I like it as it is, and trying things out "by hand" is always fun.)

Posted on 13 Nov 2007 at 19:43 in /technology/internet/blosxom. -- Permalink

Sun, 11 Nov 2007

Updated the stylesheet again

I put more of the style info into the CSS file and made the name of the blog (at the top of the page) clickable - this makes it easy to go back "home" from wherever you are in this blog.

Posted on 11 Nov 2007 at 17:07 in /technology/internet/blosxom. -- Permalink

Double slashes in RSS links

I just realised that I get those double slashes only in the RSS feed link on the main page, i.e. for the "root directory" - not in the RSS feed links for other directories (/technology/internet and the like). Seems strange to me!

Posted on 11 Nov 2007 at 17:02 in /technology/internet/blosxom. -- Permalink

Wed, 07 Nov 2007

Further fumbling with the stylesheet

I can't help it, the Linux standard "serif" font looks best to me for this. Which is why I changed the stylesheet in a probably unusual way, putting "serif" before some other fonts I like too. Don't know how much sense this makes - not very much, I guess, because browsers will just go for their standard "serif" font and ignore the rest.

Still, I'm not too happy with the rendering of Chinese characters in this setting. They were clearer when I used a sans-serif font.

Posted on 07 Nov 2007 at 22:26 in /technology/internet/blosxom. -- Permalink

Tue, 06 Nov 2007

Added some style

I added a CSS file to this blog (whose only job, for the time being, is making the calendar a little smaller) and replaced "b" tags with "strong" tags for the title - in my ceaseless striving for web standards compliance. I guess with this Blosxom blog, there's still some way to go ...

Posted on 06 Nov 2007 at 17:35 in /technology/internet/blosxom. -- Permalink

Mon, 05 Nov 2007

RSS feeds don't quite work

Turns out it does matter that there are these double slashes. Firefox seems to ignore them and display the feeds all the same; Google Reader has a problem and can't subscribe me to such a defective feed.

Another problem: although the blog is now in UTF-8, the feeds aren't. Chinese characters aren't displayed properly in the feeds.

Posted on 05 Nov 2007 at 18:49 in /technology/internet/blosxom. -- Permalink

RSS feeds seem to work

After quite a lot of "trial and error", the RSS feeds for this blog seem to work, too. See bottom of this page, or of any page here.

Strangely, sometimes there are double slashes in the actual link locations. I don't understand why they're there. They don't seem to matter though, clicking on an RSS feed link takes me to the feed alright. I don't understand this either.

It's great that Blosxom provides a separate feed for every category. Also, they're rather easy to get at (so you can add links pointing to them to a page) with the help of some variables.

Posted on 05 Nov 2007 at 18:40 in /technology/internet/blosxom. -- Permalink

UTF - success!

Once again, that was easy. Simply putting a file named "content_type.html" into the Blosxom "data folder" on my server did the trick - this file makes sure that browsers recognise the character encoding as UTF-8. It contains just one line: "text/html; charset=UTF-8". A look at the FAQ and I got all the info I needed. 太好了!

Posted on 05 Nov 2007 at 18:18 in /technology/internet/blosxom. -- Permalink


Well, that was easy. There's the timestamp plugin - you download, unzip and put it into your plugins directory. This gives you access to quite a few variables, which you can then use e.g. in your "story" flavour file.

Posted on 05 Nov 2007 at 14:31 in /technology/internet/blosxom. -- Permalink

Flavours and a calendar!

Well, in the meantime I found out how to use "flavours" in order to manipulate the look of a Blosxom blog.

Also, I found a plugin which creates a nice calendar (clicking on a day in the calendar takes visitors to the articles posted that day) and learned how to integrate it into the blog (you just need to put a line of code into one of your flavour files).

Once you've learned which files should go to which directories, it's really not that difficult anymore. And the combination of "lightweight" and "feature-packed" (to quote from the Blosxom homepage at Sourcefourge) is charming indeed. Simple as dirt and flexible as water!

Posted on 05 Nov 2007 at 13:57 in /technology/internet/blosxom. -- Permalink

Fighting - cont'd ...

Quite a lot of the links to plugins from Blosxom's Sourceforge page are dead. Even though you can still find such plugins somewhere on the internet, it's not easy to get them to work.

For example, I just can't get Blosxom to encode its posts in UTF - which I need in order to display Chinese characters. With the relevant plugin, Blosxom returns a 500 page ("a server hiccup").

On the other hand, the "blox" plugin does a good job of inserting "paragraph" tags so I don't have to type them anymore. That's nice.

All in all, this whole Blosxom thing doesn't seem to be all that well maintained.

Posted on 05 Nov 2007 at 13:53 in /technology/internet/blosxom. -- Permalink

Fighting with Blosxom

Blosxom, described by its makers as "the zen of blogging", has a certain charme because it is so sparse.

Getting it to work properly, however, is far from easy - even though the documentation isn't all that bad.

Posted on 05 Nov 2007 at 13:46 in /technology/internet/blosxom. -- Permalink

Powered by Blosxom RSS feed: technology/internet/blosxom/index.rss