Press "Enter" to skip to content

Posts published in January 2010

Making Blogging Easier, Part I

centaur 1
chihuly art at palo alto medical foundation

So I want to blog more, ideally approaching one a day.  If I was just tossing up blog entries for filler, like I sometimes do, that wouldn't be a problem; however, I'd like to put up more substantive articles.  But I find that putting up more substantive articles takes a lot of time - so keep up the pace I need to improve my process.

I already have trained myself to use Blogger more efficiently, use tools like Qumana to make it easier to access Blogger while offline, and am experimenting with AndroBlogger in an attempt to make it easy to post while, well, anywhere I've got my Nexus One.  But there are still barriers to putting up entries.

One barrier is my process.  Note the last paragraph?  It has four links.  I like to put in links to topics I reference, so a certain amount of time is taken up finding appropriate web pages and linking them in.  There isn't much I can do about this except not go down the rabbit hole - ideally, I'd like to post a short paragraph about each link, but that's too much detail.

Another barrier are my goals.  One of my friends, Jim Davies, thinks that blog posts should have pictures - and I agree, though I can't immediately find the blog post in which he said it - perhaps that means we discussed it aloud.  So ANYWAY, there was another chunk of time wasted trying to find a link.  Where was I?  Ah.  The barriers of my goals.

If I want to blog an article with a picture, the picture needs to be on the web.  But I try to avoid linked images for copyright  reasons (and to prevent brittleness in case the target takes it down; for embedded Youtubes, which, well, there isn't a good substitute for yet).  So I need to upload the image to MY site, a chore I currently do with the Cyberduck ftp client.

And here the constraints get harder: in precisely the same way I don't let iTunes tell me where to put songs, I choose not to use Blogger's interface because I have scheme for posting images which predates Blogger and which I will continue to use after Blogger is gone: http://www.dresan.com/images/imagename.jpg, which is simple and easy to remember.

What's worse, my cameras take images at huge resolutions, so I need to shrink and resize the images to fit in the width that fits on my website.   For a variety of reasons, I go with 800x600 or 600x800, in a standard block of HTML which shrinks the image, adds a link to the source of the image, and ads some alt text.

So now I've put on myself a huge set of constraints which makes the simple task of putting up images on my website a chore - get the picture, resize it, start Cyberduck, upload it, write the two lines of HTML gloop necessary to display it, and then and only then see the preview so I can see I made a mistake.  There has to be a better way.

chihuly art at palo alto medical foundation

Enter UNIX shell scripting, Python and the ImageMagick toolkit.

The first thing that I did to make my life easier was to auto-generate the stanza of text that displays the image.  I mean, it's the same thing each time - an anchor tag pointing to the image, with alt text, then the img tag itself, with the same alt text, sizing and border information, like this:

 
some alt text
src="https://www.dresan.com/images/image.jpg" />

So why write ALL of that every time? Why not just write the changes and let the computer do it for you? SO I wrote a piece of code in Python which does just that, produces that text for me:

#!/usr/bin/python
import sys

TEXT= """
%s
"""
if len(sys.argv) < 3:
print "usage: %s image alt text" % sys.argv[0]
else:
image = "http://www.dresan.com/images/%s" % sys.argv[1]
alt = ' '.join(sys.argv[2:])
print TEXT % (image, alt, image, alt)

I'm not going to turn this into a Python tutorial, so, briefly, all this does is check to make sure I specify a filename and some alt text, stuffs it into a template, and prints it out so I can cut and paste. Here's an example of that in operation, turning chihuly.jpg and "chihuly art at palo alto medical foundation" into a stanza of HTML (spaces added for readability):

centaur@Deliverance (Wed Jan 13, 22:48:25) [520] ~/Development/Workspace/Webworks:
$ ./imagelink.py chihuly.jpg chihuly art at palo alto medical foundation



alt="chihuly art at palo alto medical foundation"
src="https://www.dresan.com/images/chihuly.jpg" />

That saves me several minutes of typing each time. This is one of the great Programmer's Virtues: laziness - making the computer do something you don't want to do for yourself.  The maybe thirty minutes I've spent tweaking that little script have paid off not just in the time that I saved typing, but in the extra blog posts that I've done because they were easier to do.

In the next installment (or two, depending), I'll write a tool to shrink the images to size with ImageMagick and upload them automatically with UNIX tools, and discuss some of the other tools and organization schemes I use which make it easier for me to collect the images and keep them organized - schemes that work even if you switch between operating systems.

-the Centaur

 chihuly art at palo alto medical foundation

The images are Chihuly glass sculptures hanging in the Mountain View campus of the Palo Alto Medical Foundation.

AndroBlog FAIL

centaur 0
First posting claimed it failed; retrying resulted in a double post. Plus it can't handle multiple blogs on one Gmail account, and capitalization of the first words in sentences is oddly broken. And it crashed while writing this post. Meh.

Thank You, Carl Sagan

centaur 0
"Thank you, Carl Sagan" is an in-joke I and my friends use which requires a bit of explanation. I've been a member, on and off, of the Planetary Society since ... oh, heck, I don't know, since I lived in Greenville, South Carolina ... which makes it at least 25 years, a credible guess since the Planetary Society was founded by Carl Sagan in 1980.

Back in the 80's, I was first coming into my own as a space enthusiast - getting a subscription to Scientific American, joining the Science Fiction Book Club, and of course joining the Planetary Society.

A few years after I joined, I opened my mailbox in Greenville and found a renewal letter for the Planetary Society. That was great - I had planned to renew - but when I pulled out the envelope and prepared to write my check, I found the following (roughly reconstructed from memory):
Thank you, Carl Sagan for the opportunity to renew my subscription at the Planetary Society! Yes, I'd like to sign up for another year of the Planetary Report and to contribute to all the Planetary Society's great causes!

I was flabbergasted. This was my first barely-adult encounter with marketing speak and I couldn't imagine the hubris of someone asking me for money writing the response letter in such a way that it looked like I was thanking them.

Even though I was young and naive, on some level I knew Carl Sagan hadn't written that letter, and even if he had seen it he would have approved it without a second thought (I mean, come on, the Society IS providing a valuable service). But it was funny enough at the time to show it to all of my friends, most of whom were also big fans of Cosmos.

So every time Carl Sagan's name was mentioned, it was immediately followed by a chorus of: "Thank You, Carl Sagan!" I still hear those words every time I hear his name ... but the meaning has changed:
Cosmos. Contact. Intelligent Life In the Universe (with Shklovskii). The Pioneer Plaque. The Pale Blue Dot. The Planetary Society itself. And A Still More Glorious Dawn Awaits (with Stephen Hawking and Colorpulse).

Thank you, Carl Sagan, indeed...
-the Centaur

Best definition of recursion EVAH.

centaur 0
recursion did you mean recursion

For those that don't get it, recursion in computer science refers to a process or definition that refers back to itself. For example, you could imagine "searching for your keys" in terms of searching everywhere in your house for your keys, which involves finding each room and searching everywhere in each room for your keys, which involves going into each room and looking for all the drawers and hiding places and looking everywhere in them for your keys ... and so on, until there's no smaller place to search.

So searching for [recursion] on Google involves Google suggesting that you look for [recursion]. Neat! And I'm pretty sure this is an Easter Egg and not just a bug ... it's persisted for a long time and is geeky enough for the company that encourages you to "Feel Lucky"!

-the Centaur

“He always had a lot to say … too bad he left so soon”

centaur 0
[youtube=http://www.youtube.com/watch?v=p86BPM1GV8M]

Carl Sagan ruminates on life on Earth, how, as seen by a far-off camera on a spacecraft, a pale blue dot houses everyone anyone ever has known in the course of human history.

the pale blue dot

From his speech on the Pale Blue Dot:
It has been said that astronomy is a humbling and character-building experience. There is perhaps no better demonstration of the folly of human conceits than this distant image of our tiny world. To me, it underscores our responsibility to deal more kindly with one another, and to preserve and cherish the pale blue dot, the only home we've ever known.

Thanks, Carl.
-the Centaur

Just found a short between the keyboard and monitor…

centaur 0
... otherwise known as an ID10t error in the operator component.

Trying to install a new device, wasn't working, and the reason was I never applied the firmware upgrade that the instructions clearly said had to be required. Anthony's nth (7th?) law:
If you don't follow all of the instructions, you won't finish in the goal state.(*)
(*) Except through dumb luck, or just possibly deep knowledge. Did I have deep knowledge in this case? No. So if you're doing voodoo, try, perhaps, following the complete recipe before you complain your zombie isn't coming back to life as advertised.

-the Centaur

3:30am – pager duty suuuuuuuucks EOM

centaur 0
PS: For those not in the know, EOM stands for "End of Message" - generally used for a subject-only email without a body, like sending someone an url:
Here's the presentation: http://short/url EOM
Technically I guess that means the EOM in the header is not an EOM, and also by corollary the PS is not a PostScript since it introduces the body of the message.

Well, then, in that case: Hello, Internets!

The Year of Blogging Dangerously

centaur 0
So, last year I had an extraordinarily complicated series of New Year's Resolutions which almost completely failed. Looking back, I succeeded at my major goals for the year, but the complex plan of weekly / monthly things completely failed.

So, here's a simpler set of New Year's resolutions, goals, what have you:
  • Establish a weekly pattern of exercise, including some karate
  • Set aside some time each month to do art in addition to writing
  • Post to this blog on the average once a day, measured each week
The last one is the hard one, of course; I'm already 4 posts behind. But I have such a huge backlog of articles and ideas in folders that I shouldn't find this too hard ... if I can just change my habits.

In other news, Warren Ellis has already blogged 365 times since January 1st. Damn him.

-the Centaur