By Mike Saputo.
Anyway, the feed is now cleansed of that cruft and I also made sure it was validating correctly. Or at least mostly correctly.
(One side effect of going entirely to CSS for all formatting is that the feed comes out unformatted in readers. I haven't done any research to see if this is fixable. It would be cool if I could at least do some layout.)
Foam Totem has always been in a sort of limbo between a dirty, slimy hack and a well-considered and -behaved hack. I stepped into some of the slimy parts today. I kept all my dates and times in local time. In nearly all situations, this was fine. However, Facebook, Posterous, and Twitter all (wisely) stick to GMT. So as I started importing them, there was some friction which eventually required a fix rather than a patch. Ferreting out all the little inconsistencies in the code was a pain.
Redoing the dates meant I had to regenerate all the JSON files back to the beginning of the year. (Which is easy to do.) I think I finally have the final data format, and I've set up the scripts to just update rather than blow away existing data.
Also in the hack category was using "select" to choose the output file and then just printing everything as if it was going to STDOUT. As soon as I wanted to emit a page for each item, this quick hack self-destructed. So I had to add a file handle parameter to everything. Wholesale API changes are dangerous because they make you review all the code, which often has a side effect of finding a couple things you want to touch up. And they tell two friends, and so on, and so on...
I've added handling for Facebook links and videos now. I actually had the videos embedded, but they made the page layout look really random and crappy. If I get clever, I'll set it up so that clicking on the image will replace it with an embedded player. But not now. (And it'd only work for YouTube anyway.)
I'm pretty happy with it now, and what I have should be able to handle the remainder of my plans without needing another cleansing. Although I'm generating individual pages for each post (click on the title of the post to go there), they still need the Open Graph stuff stuck into them. And after that, I'll start looking at comments.
Well, GMail makes some pretty strange HTML in its editor, it seems.
Let's try this with plain text. I'll add an attachment for maximum
(BTW, this post is mostly for me rather than anyone else.)
After fixing a bug in the CSS and a little more tweaking, it seems like the page layout and HTML are good on most browsers. Both validate (which I forgot to do before making it live-- whoops). Some people saw very, very tiny text. Unbelievably, this was caused by a line in the CSS which said "background-color: brown". "Brown" isn't a valid color, or isn't allowed there or something. This made older Firefox and Internet Explorer versions screw up other entries in the CSS in strange and arbitrary ways.
Yesterday, I switched to a new data format. Previously, the contents of each post was bundled into a file as a blob which the system just plunked down. Now each post is structured data (in JSON format) and actually carries with it its ID, the time it was posted, and stuff along those lines as individual fields. When the HTML is generated, it uses those fields in addition to the content blob. For now, the main thing this does is let the code generate different HTML structures for the posts depending on its whim. Previously, a good amount of the HTML structure was implicit in the blob of content. The next step along the data axis is to put the data into a NoSQL database such as Mongo or Cloud. For now, though, there's no real need for that. I'm using the file system as the database (with the filenames having the keys I'm sorting on).
I think the next step is generation of an individual page for each post (along with the open graph metadata). I'll definitely do this for regular posts. Unsure about Twitter posts. Probably not.
I'm torn regarding the Twitter entries. I had been (and still do for the moment) bundling all the ones sent during the day into a single block at the end of the day. Using the new layout, and looking forward to how I might integrate Facebook, etc I think I might go back to putting them directly in line at the appropriate spot in the timeline. I'm not really satisfied with the layout of singleton twitter entires, however. They seem a bit bulky, so I'll need to fiddle with that some.
I was also checking on the commenting APIs and noticed that my "Echo license" expires in 9 days. I bought a perpetual license to HaloScan years ago, and they were bought by JS-kit, who then were either acquired or transformed into Echo. I can get a $12 a year license to Echo, it seems (because I have so little traffic). That may be worth it just to not switch. If I ever get traffic it's $10 a month. There is no free version. (And jeez, but their website makes it impossible to get price quotes without sending an email to Sales?! Since I already have an account I can "upgrade" and see the prices, but if I were a potential new customer I would be stopped dead. Dumb.) An alternative is to go to Disqus/someone else. A last alternative is to roll my own. This last insane alternative is the only way I know of to let me get both Facebook and non-Facebook comments integrated. As a human person, I think I'm allowed to do this. If I were a corporation (like Echo or Disqus) I think I would be violating the terms of service. Not sure on the technical legality of it all.
A last thing is that I'm working on using WebFonts for the titles. Sadly, the font I bought doesn't work properly. They're looking into it...
(Posted via Posterous email, to test how it gets munged along the way.)
Here you see the first phase of the Foam Totem revamp. Besides the change to layout and theme, this is largely groundwork. It's now written HTML5 and finally, after eight or more years from when I first attempted it, stylistically driven with a seperate CSS stylesheet. Wonders may never cease.
Next is some data munging. I'm adding some fields to each post (such as title and via) but the current data format I'm using is just a blob of stuff that I cram into the HTML file. I'm only going to modify the data for the most recent months. In fact, I don't plan to modify or regenerate any of the Foam Totem pages before 2011. It'll stick around as is indefinately.
Once the data is structured some, I'll start generating standalone pages for each post. They already have permalinks, but the permalinks direct you an internal anchor (e.g. #20110411_727272) on a monthly page. This works fine for humans, but crossposting to other sites (say Facebook) doesn't work well with this links. By putting each post on its own page, I can specify the summary text, pictures, etc that Facebook and other sites will associate with the post.
After that, I'm going to start looking into commenting again. I'm going to try and reflect any Facebook comments directly here on Foam Totem. At the same time, I don't want to force people to have a Facebook login to comment. I have an idea or two on how to skin that cat, but it will require some hacking before I know if it'll work at all.
(And, yes, I have a backup of the old site in case this goes horribly wrong.)
Awesome (modified) postcards.