| |||||||||||||||||||||||||||||||||||||||||||||||||
|
/ (38) code/ (1) emacs/ (2) go/ (1) hardware/ (2) python/ (2) spam/ (1) twisted/ (8) web/ (1) weblog/ (5) | |||||||||||||||||||||||||||||||||||||||||||||||||
Hey, that wasn't too bad. I also added some CSS to make everything a tiny bit less ugly.
Now all I need is auto-completion on the category elisp..
I think I've gotten my elisp code to handle pyblosxom categories now. pyblosxom was easy, but I have to add the glue to let you choose a category. Unfortunately creating new categories requires manual work (registering the CVS directory).
Next step: find a pyblosxom plugin to create that spiffy little category sidebar I've seen on so many other blogs.
#! /usr/bin/python
import sys
template = \
"""<html>
<head><title>$blog_title_with_path</title>
<meta name="robots" content="follow,noindex" />
</head>
<body><h1>$blog_title</h1><p>$pi_da $pi_mo $pi_yr</p>
"""
def cb_head(args):
"""This replaces the HEAD portion of the template whenever a 'directory'
is being rendered. The modified template adds special 'noindex' meta tags
to tell google that it shouldn't bother indexing the main page (since it
will change), but to index the permalink pages instead.
"""
#print >>sys.stderr, args['template']
if args['request'].getData()['bl_type'] == "dir":
args['template'] = template
return args
</pre>
(defvar pyblosxom-entry-dir "~/stuff/Projects/WebLog/entries")
;; adapted from http://wiki.woozle.org/BlogdorEngine
;; and http://list-archive.xemacs.org/xemacs/200211/msg00022.html
(defun char-isalpha-p (thechar)
"Check to see if thechar is a letter"
(and (or (and (>= thechar ?a) (<= thechar ?z))
(and (>= thechar ?A) (<= thechar ?Z)))))
(defun char-isnum-p (thechar)
"Check to see if thechar is a number"
(and (>= thechar ?0) (<= thechar ?9)))
(defun char-isalnum-p (thechar)
(or (char-isalpha-p thechar) (char-isnum-p thechar)))
(require 'cl-seq)
(defun blog-publish ()
"Publish the blog entry in the current buffer"
(interactive)
(shell-command (format "cvs commit -m 'blog entry' %s"
(file-name-nondirectory buffer-file-name)))
(shell-command "make -C .. publish") ; publish
)
(define-minor-mode pyblosxom-post-minor-mode
"Minor mode for blog posts"
nil
" blog-post" ; mode-line indicator
'(
("\C-c\C-c" . blog-publish)
)
() ; forms run on mode entry/exit
)
(defun blog-post (title)
"Create a journal entry"
(interactive "sTitle: ")
(let ((filetitle (substitute-if-not ?_
(lambda (c) (char-isalnum-p c))
title)))
(find-file (concat pyblosxom-entry-dir "/"
filetitle
(format-time-string "-%Y-%m-%d-%H-%M")
".txt"))
(goto-char (point-min))
(insert title "\n\n")
(save-buffer)
(vc-register)
(pyblosxom-post-minor-mode 1)
))
I've been trying to get my project notes online for years now, and I finally realized that I need to start smaller. After a week of intermittent activity, I finally got PyBlosxom set up and behaving fairly well.
In the process, I discovered that the CGI specification doesn't actually require the web server to close the child process' stdin: the child is supposed to read exactly CONTENT_LENGTH bytes and then stop. Pyblosxom violates this (it just reads until EOF), but it usually doesn't matter because most web servers are nice enough to close it. It turns out that Twisted's CGI handling module does not. I fixed it upstream (at least in the old 'web' module.. web2 is another matter), and filed a pyblosxom bug. For now I have to monkeypatch Twisted in my web setup program, at least until Twisted-2.0.1 comes out.
My goal for this web log is twofold. The first is to contain an archive of useful things I come across, cool stuff, new ideas, things I've learned, the usual blog fodder. The second is to publish the diaries that I keep on each of my projects, diaries that I use to help remember what I was thinking when I last put energy into that project, in the hopes of reducing the context-switching penalty that comes about from having a dozen active projects at once. I have something like 1.5MB of diary entries on these projects, going back to mid-2002 when I started keeping them. By getting these projectlogs online (and enabling comments on them), I hope to give the rest of the world a chance to look at my workbench and tell me what they find interesting. Maybe someone else will pick up on an idea that I haven't had time to pursue, maybe they will leave a note with useful directions to go or tools to use. Perhaps by letting others in, and hopefully forming a bit of a community here, I'll be more encouraged to work on the projects that have a chance of forming communities of their own.
I plan to use pyblosxom's categories to put all the projects in places like Projects/BuildBot . Non-project related things like site-setup notes or personal rants can go in other categories next to Projects.
The blog is pretty basic for now, and not necessarily pleasant to look at, but it's a start, and I've learned that waiting for perfection is the best way to never get anything finished at all.
Welcome!
-Brian