Other online diaries:
Thu, 28 Oct 2004
Cache Time stamps - 18:44
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.
That lost feeling of being disconnected - 14:39
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>