October 21, 2004

Bulk view

Trackback implementation for Emacs

From http://elisp.info/archive/80614224, posted by Mark A. Hershberger:

This will be put into nnrss.el or weblogger.el, but, for now, here
is an implementation of trackback.

(defun tb-find-tb-url (url &optional local)
  "Find the track-back URL for a resource."
  (with-temp-buffer
    (let* (xmlform htmlform)
      ;; bit o' work necessary for w3 pre-cvs and post-cvs
      (if local
	  (let ((coding-system-for-read 'binary))
	    (insert-file-contents url))
	(mm-url-insert url)))
    (when (re-search-forward "" nil t)
	  (let ((rdf-end (match-end 0)))
	    (goto-char rdf-start)
	    (re-search-forward "trackback:ping=\"\\([^\"]+\\)" rdf-end)
	    (match-string-no-properties 1)))))))

(defun tb-get-trackback (url)
  "Get who's tb-ed an entry."
  (let ((tb-url (tb-find-tb-url url)))
    (when (not tb-url)
      (error "No trackback URL found at %s" url))
    (w3-fetch (concat tb-url "?__mode=rss"))))

(defun tb-send-trackback (url data &optional no-seek)
  "Send a trackback."
  (let ((tb-url (tb-find-tb-url url)))
    (when (and (not no-seek)
	       (not tb-url))
      (error "No trackback URL found at %s" url))
    (let* ((enctype "multipart/form-data")
	   (query (w3-encode-multipart/form-data data))
	   (url-request-method "POST")
	   (url-request-data (cdr query))
	   (url-request-extra-headers
	    (cons (cons "Content-type" (concat enctype "; boundary=\""
					       (substring (car query) 2 nil)
					       "\""))
		  url-request-extra-headers)))
      (w3-fetch (or tb-url url)))))

(defun w3-encode-multipart/form-data (items)
  ;; Create a multipart form submission.
  ;; Returns a cons of two strings.  Car is the separator used.
  ;; cdr is the body of the MIME message."
  (let ((separator (format-time-string
		    "--separator-%Y%j%H%M%S-for-www-form-data")))
    (cons separator
	  (concat
	   (mapconcat
	    (function
	     (lambda (item)
	       (w3-form-encode-make-mime-part
		(car item) (cdr item) separator)))
	    items "\r\n")
	   "\r\n" separator "--\r\n"))))

Example Code:

(tb-send-trackback
 "http://www.movabletype.org/mt/trackback/3"
 '(("title"     . "Emacs Trackback Implementation")
   ("excerpt" . "An implementation of trackback for emacs webloggers.")
   ("url"       . "http://elisp.info/archive/80614224")
   ("blog_name" . "elisp.info")) t)

Now all we need is a way to receive trackback pings…

http://elisp.info/archive/80614224

ARGH! Drying clothes!

I refuse to be held hostage by laundry tags.

I’ll hang the suits up to dry, but darn if I’ll let most of my blouses
get away with that kind of threat. If I mess up, well, better that I
learn that lesson now, right?

So, sorry, hang-dry clothes, you’re going to get spun-dried today…

(I’ll leave the dry-flat clothes for some other time.)

Tentative Osaka plans

- Work tomorrow
- Leave MSI at 5:40 and arrive at TKC by 7:30.
- Shower and change into casual clothes. Pick up bags and phone.
- Leave TKC by 8:30. Be in Shinjuku by around 10:30. Make it to the bus with plenty of time to spare.
- Saturday: Wander around. Attend conference. Check into ryokan, change into provided yukata.
- Sunday: Change shirt, possibly pants (bring spare). Wander around. Find a nice public bath or onsen. Take night bus back.
- Monday morning, arrive in Shinjuku at around 6:00. Change into business clothes and go to work.

Stuff I need to bring:

- mobile phone charger
- laptop, charger
- Debian keysigning papers
- A day or two’s worth of clothes.
- Money, misc.

Possibly have these brought:

- business shoes
- business clothes for Monday: white turtleneck, pleated black skirt.

First day

Think technical challenge. Think fun. Don’t think about classrooms
and a dorm five minutes away from school.

Delphi is fun, although I miss Lisp’s you-can-lowercase-everything
style. I miss Lisp parentheses and easy syntax. I’m weird, aren’t I?

S’okay. Am getting the hang of Delphi, and am looking forward to the
translation challenge tomorrow.

I miss the academe, though. I feel more suited to it than to this.
That’s okay. I’ll have the next few months to develop a really fine
appreciation of the academe, something that’ll sustain me through
years of studies, frustrating classes, loads of tests to
check… <laugh>

That said, I’m going to give this my best shot. It might not be one of
my alternative careers, but that doesn’t mean I don’t want to be good
at it. <grin>

Must figure out logistics for my Osaka trip.

Training so far

Software installation in a foreign language is difficult. The first
time around, I selected “repair” instead of “reinstall”. I realized my
mistake around fifteen minutes into the installation. The second time,
I used my laptop (yay!) to look up the kanji I didn’t know. It was
slow going, but at least I knew what was going on. I’m glad kanjipad
exists.

I’m waiting for my Windows 2000 installation to finish formatting the
hard disk. Our trainers don’t really speak English, so I’ve asked them
to e-mail us the design documents we need to study so that I can work
on translating the specs. Aris will read up on Delphi. I think that’ll
work out.

I also asked about cheap places to get bento boxes so that we don’t
have to eat at restaurants all the time. With a lunch allowance of 800
yen, all the restaurants are too expensive.

We have a week to learn how to read specifications, understand
Japanese software design, and write Java programs. I’m a bit worried
about software engineering, particularly if they want to use lectures.
I think we’d have an easier time with computer-mediated communication,
because then I have an instant record of everything said, and I can
look words up quickly.

Today’s commute was one and a half hours. Longer than I expected, but
apparently quite normal. We have monthly tickets, so we don’t have to
worry about transportation expenses unless we lose the ticket. I’ll
probably still spend a bit on transportation during weekends, as the
paid segment doesn’t give me access to a lot of tourist spots. Oh
well, that’s all right. =)

More stories soon.