$msg = ""; $myaddress = "sacha" + "@" + "sachachua.com"; $page = "2007.11.28.php"; $page_title = "2007.11.28"; $page_updated = "2007-11-2823:04:4823:04:48-0500"; $maintainer = "sacha" + "@" + "sachachua.com"; require_once "include/calendar.php"; require_once "include/planner-include.php"; require_once "include/header.inc.php"; ?>
Headlines for Wednesday:
|A||_||Dylan McGuffin's birthday|
Yesterday, I imported five years of blog posts into Wordpress through RSS. This would have been _painful_ if I wasn't comfortable with programming. With 4587 posts in 2596 files, I wouldn't have even thought about copying them over manually. Instead, I would have just started with a clean slate. I didn't think anyone's really going to want to go back and see everything I've written on my blog. ;) Who was going to notice?
But five years of blog posts—reflections, ideas, notes, interesting links—might still be worth something, so I decided to give it a shot. Initially, I wrote a function which visited files, searched for notes, and added the note to one big RSS feed. However, this slowed down too much when I hit megabytes, so I changed it to dump each note to a file in a directory.
;(sacha/planner-dump-rss "~/public_html/blog-dump/" nil nil) (defun sacha/planner-dump-rss (directory from to) (let ((pages (planner-get-day-pages from to)) (planner-rss-feed-limits nil) (planner-rss-initial-contents "") buffer) (while pages (condition-case err2 (progn (planner-find-file (caar pages)) (setq buffer (current-buffer)) (unwind-protect (progn (goto-char (point-min)) (while (re-search-forward "^\\.#\\([0-9]+\\)" nil t) (save-excursion (condition-case err (progn (let ((inhibit-read-only t) (file (concat directory (caar pages) "-" (match-string 1)))) (planner-rss-add-note file) (find-file file) (save-buffer 0) (kill-buffer (current-buffer)))) (error (message "Problems processing note on %s: %s" (caar pages) (error-message-string err))))))) (kill-buffer buffer))) (error (message "Problems processing %s: %s" (caar pages) (error-message-string err2)))) (setq pages (cdr pages)))))
I then concatenated all of these files using
cat header 200* footer > dump.rdf
This file was still much too big, so I manually split it by year, copying and pasting text into different files. I used http://www.feedvalidator.org to check for errors. After Feedvalidator verified that the files were all valid RSS, I tried to import them into Feedwordpress. Nope, still too big. I needed to trim them to around 400k, so I used the following code on the server:
(defun sacha/split-dump () (interactive) (goto-char (min 400000 (point-max))) (let ((counter 0) (base-name (file-name-sans-extension buffer-file-name))) (while (not (eobp)) (re-search-backward "<item>") (kill-region (match-beginning 0) (point-max)) (insert "</channel></rss>") (save-buffer 0) (find-file (format "%s%d.rdf" base-name counter)) (erase-buffer) (goto-char (point-min)) (insert "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <rss version=\"2.0\"> <channel> <title>M-x plan :: sachachua's blog</title> <link>http://sachachua.com/notebook/wiki/today.php</link> <description>Sacha Chua's blog about Emacs, personal information management, open source, and random stuff</description>") (yank) (setq counter (1+ counter)) (goto-char (min 400000 (point-max))))))
This program looks complicated, but it really isn't. In fact, I could have probably done something just as powerful with keyboard macros, not writing a single line of code. But the code was easy to write, and I figured that I'd keep it around just in case I needed to do something like this again.
After a little bit of manual tweaking, I got all the entries into http://sachachua.com/wp/ .
The ability to write short programs quickly and interactively has not only saved me so much time, but it's also made it possible for me to even _think_ of doing some things. =) I could probably have written the same snippets in Perl or Ruby, but being able to combine manual editing and automated operations in the text editor made it just so much faster. I really like being able to scan back and forth in buffers easily in Emacs, instead of thinking in terms of file streams as in other programming languages.
If you work with lots of text, I definitely recommend learning Emacs Lisp, or whatever language your editor can be programmed in. I started by reading other people's source code and the Emacs Lisp Intro and Emacs Lisp info files. I reread them countless times, picking up a little more each time I went through. Now Emacs Lisp is one of the first things I turn to whenever I want to save time doing something complex and repetitive on the computer, such as adding everyone's pictures to a wiki page. (That's a story for next time!)
Emacs is awesome stuff. More than 20 years old, it's the most advanced program I've ever used. What makes it special? It's _definitely_ optimized for the power user, and it provides so many reasons to become one.
Random Emacs symbol: gnus-summary-goto-last-article - Command: Go to the previously read article.
One of the downsides of posting code on your blog is that you tend to confuse your blogging software. In this case, some stray tags that I used in my RSS dumping code resulted in lots of errors in my blog. In a tizzy over the bug, I forgot about the first two public comments ever posted on my Wordpress blog, and I accidentally deleted them while trying to refresh my blog posts. This is a pity, as they were particularly nice comments too.
Ah, life. That's okay.
Just wanted to let you know what happened to them. And kids, if you're going to do this kind of shuffling around... save your data somewhere!
Random Emacs symbol: Custom-goto-parent - Command: Go to the parent group listed at the top of this buffer.
Thanks to Michael Nielsen and Jennifer Dodd for highly recommending Made to Stick, a great book about storytelling. It arrived at the same time as The Elements of Persuasion, which made a terrific complementary read. Book notes to follow. =)
Random Emacs symbol: radians-to-degrees - Macro: Convert ARG from radians to degrees. - Variable: Radian to degree conversion constant.
Over at Matt's Idea Blog, Matthew Cornell has listed some of the coolest job titles he's seen. Not only that, he links to the people who've given themselves those job titles. Check those out for inspiration, and add joy to your own job description. Passion Catalyst! Continuous Self-Improvement Guru! =) How can you not want to get to know people like that?
What's my title? I'm somewhat in between titles. I'm moving away from being a tech evangelist because it doesn't capture my focus on processes and practices. I help companies help people connect. I want to get really good at spotting and telling great stories, refining and sharing best practices, and exploring new tools and new ways of doing things. I want to help companies enable more connection, more conversation, more collaboration... and more innovation. And I want to do all that and make it _fun._ Fun the way discovering how small the world is when you discover that the other person in the elevator with you also reads tons of books and you end up chatting about great reads all the way to the cafeteria and all throughout lunch. Connection is fun. Networking is fun. I want to make it easy.
Random Emacs symbol: calendar - Command: Choose between the one frame, two frame, or basic calendar displays. - Group: Calendar and time management support.
If you want to be radically more effective at doing things, get better at deciding what to do. Few things are more personal than figuring out what you're going to do with your life: at this moment, for this day, for the next few years. Few decisions are made as frequently. If you can improve the way you make that decision, you'll reap the benefits everywhere.
We've all developed some ways of coping. We all have our quirks. One of mine is that I can't settle on one way of planning my tasks. Some days, I'm all strategic and top-down, connecting my life goals with the tasks I plan to do that day. Other days, I just need to get a crucial task out of my head so that I don't forget it while hunting for my keys. Some days, I block out time to work on my priority projects. Other days, I have to work around other people's schedules, so it's all about cramming whatever I can into whenever I've got.
Now think of all the other geeks out there, and you'll understand how to-do list programs might outnumber programmers. Despite the collective efforts of companies like Microsoft and IBM, despite the coolness of Web 2.0 services like Remember the Milk, despite the renaissance of paper-based planners such as the Hipster PDA, I have never found anything as powerful as a plain text file in terms of personal productivity: a plain text file with shortcuts that are form-fitted to the way I work.
Here's what my workday looks like:
A plain text file keeps me all organized, thanks to the Org module for the Emacs text editor. The text file shows me what's on my horizon and what's on today's schedule. The text file helps me deal with interruptions because it keeps track of what I was working on and what I need to do.
The text file even helps me learn more about myself and my skills through detailed time-tracking. Every time I start a task, the clock starts. Every time I mark a task as waiting or done, the clock stops, and the elapsed time is stored in the task. This helps me tune my time estimates and report time at the end of the week.
And it's just amazing. I don't feel that I waste a lot of time. I have a sense of progress. I can see the big picture, and things almost never fall through the cracks. (When they do, that's because I hadn't gotten around to putting them in my text file yet.) Sure, this still doesn't give me enough time to do everything I want to do, but I don't feel stressed out about it because I'm working well. From now on, most of the performance improvement will come from improving my skills and learning more.
If I can do this much as a new hire with a pretty nifty task management system, think about what you can do with all your experience. What _could_ you do if you spent less time fighting with your memory or with your TODO system, and more time making the difference you want to make?
Random Emacs symbol: edebug-stop - Command: Stop execution and do not continue.
Inbox items: 53 as of 22:56