sjh - mountain biking running linux vegan geek spice - mtb / vegan / running / linux / canberra / cycling / etc

Steven Hanley hackergotchi picture Steven
Hanley

About

email: sjh@svana.org

web: https://svana.org/sjh
twitter: https://twitter.com/sjhmtb
instagram: https://instagram.com/sjhmtb

Other online diaries:

Aaron Broughton,
Andrew Pollock,
Anthony Towns,
Chris Yeoh,
Jeremy Kerr,
Martijn van Oosterhout,
Michael Carden,
Michael Davies,
Michael Still,
Tim Potter,
Tony Breeds,

Links:

Linux Weekly News,
XKCD,
Girl Genius,
Planet Linux Australia,
Bilbys,
CORC,

Canberra Weather: forecast, radar.

Subscribe: rss, rss2.0, atom

October
Mon Tue Wed Thu Fri Sat Sun
       
28

2004
Months
Oct

Categories:

Archive by month:

Thu, 28 Oct 2004

Cache Time stamps - 18:44
This diary entry is about a new blosxom plugin I wrote, you can find the files related to this here (the files are cache_timestamps (the plugin) and cache_insert_ts.pl (a helper program).

I complained once or twice a while back about time stamp handling in blosxom. My complaints were centred around relying on the timestamp on the file system to work out he date of an entry and the order of all the entries. There are already some plugins that get around this in some manner, such as entries_index by the blosxom author, and entries_index_tagged (not available from the link there, google can find it).

The entries_index plugin keeps a cache of the time stamps of diary entries and uses the time stamps in the cache by preference. It adds time stamps for new files as they are found. This way if the time stamps change at a later date due to an edit or similar the cache retains the old time stamp.

The entries_index_tagged does the same as entries_index and takes it a step further. It allows you to have time stamps in some format in the diary entry header area. Read the code/docs if you want to know the details.

I wanted the capabilities of entries_index_tagged, with a slightly different way to read time stamps from the entries, also using the same format cache as the two already written. This way like entries_index_tagged if the cache is deleted it will still use the saved time stamps in the files rather than the system time stamps when it finds time stamps in the files. The reason I wanted a different format was I had already been adding time stamps to my diary entries since September as an html commented time stamp on the second line of the file (after the heading). For example <!-- 2004-10-28 19:56:32 -->. Also a few people suggested it would be cool if the plugin had the option to add such a tag to the entries if there was not one using the file system time stamp the first time it sees the file.

So I wrote the module, it works fine for all but adding the time stamps to the entries. The problem here is you need write access to the entries in order to add text to them. Also even with write access the utime(2) system call can not change the time stamp back to what it should be after editing the file unless you also own the file.

Anyway I ended up writing a small helper program that could theoretically be run from cron or similar as the owner to add the files time stamps and reset the mtime. This means you have the functionality even if you do not give write access to your diary entries by the web server uid.

With the add time stamps capability you can rely on the first time stamp being added so even if the file system time stamps get messed up at some point all files will have a time stamp and you need not remember to add one to each entry.

[/comp/blosxom] link

That lost feeling of being disconnected - 14:39
Two computer issues to deal with just now. First before heading out for my lunch time mtb ride today, I was unable to save a perl program I was editing on my laptop in emacs. Looking /proc/mounts I found the partition was read-only, /var/log/syslog said something about an ext3 error. Fortunately I was able to save the work I was doing to another partition, I decided to deal with it when returning from the ride and lunch, pretty simple, log out of my account and unmount and e2fsck the filesystem, mostly annoying more than anything else this time, though file system errors are a stark reminder of the need to backup often.

Upon returning from lunch I found I was unable to connect to calyx (svana.org), I rang the Co-location people and they said they had some problem with router upgrades (un announced and un scheduled) and noticed the route to the colocated machines was not working. It is now back up, however for a little while I felt all lost and alone, unable to receive email or any of that. Maybe I am too dependant on connectivity, time to go to an IA meeting. <g>

[/comp] link


home, email, rss, rss2.0, atom