Home

Three Things TODO After Vacation

  • Apr. 16th, 2009 at 12:14 PM
z_default
Gah! There's way too much to do, and so little time. All I can do at the moment is document what I need to get done before vacation. And even then, I was torn between documenting it here, or at my new experimental Habari blog at david.dlma.com. What am I going to do with that blog? (I treat it like some people treat their Moleskines. It's too special to write on. That domain name is the most me, so I've been protecting it.)

Anyway, in no particular order, here's what I want to get done:

  • Customize Twitter Friends Feed: I need to customize my twitter friends feed so that it won't spam my feed reader with @replies I don't care about. I need to set my preferences on a per-twitterer basis. I really enjoy all @replies from some of my friends, but not all.  Maybe I'll break down and find an app that already has the feature, but I prefer having just one place aggregate all the feed activity I'm interested in. [Edit: Biz is going to do this himself!]
  • Make a Dictionary Popup: I loved the DQSD mwd popup definition result. But merriam-webster.com has a history of changing the layout of their page so that maintaining the mwd.xml search became onerous. It's time to replace that popup definition with one from aonaware. Here's the API call I'm most interested in: DefineInDict, with "gcide" for the dictId. [Edit: Completed!]
  • iTunes library rsync with OpenTape: As originally hinted.

technical
Installing PyGreSQL isn't trivial, especially on Dell computers.  Here's a recipe that worked for me and Python 2.5:

  1. Download and install postgresql-8.3.5-2-windows.exe  (You shouldn't need the whole install.)
  2. Add C:\Program Files\PostgreSQL\8.3\lib to your PATH for libpq.dll.
  3. Add C:\Program Files\PostgreSQL\8.3\bin to your PATH for ssleay32.dll.
  4. Hide System32's copy of LIBEAY32.dll  (If you're on a DELL, and that one is far smaller and older than the others.)
  5. Download and install PyGreSQL-4.0.win32-py2.5.exe
And here's some explanation with accompanying error text so that people searching for a solution to this problem can find it.  Here's my experience:

Downloaded PyGreSQL first, before realizing it had dependencies to a postgresql install.  Got some nebulous ImportErrors when I tried to "import pg".

from _pg import *
ImportError: DLL load failed: The specified module could not be found.
Great.  What module?  Searching the web, I discovered I needed to install postgresql.  So I did, but I still got the error, even after updating the system's PATH variable.  (Note, sys.path and os.environ("PATH") are two different things.)  Eventually I discovered this great tip:

Try doing the failing import from the Python command line.  (Start->Python 2.5->Python (command line)).  Doing that will actually display a modal dialog that says exactly which dll could not be loaded.  Yay!

Finally, I got the LIBEAY32.dll error mentioned above, the exact text of which follows:

The ordinal 2821 could not be located in the dynamic link library LIBEAY32.dll
and once I hid the old LIBEAY32.dll, I got pg linking with the correct libraries, I was good to go.  Hope this helps somebody.

Dear Lazyweb: Help with Lifestream Design

  • Dec. 17th, 2008 at 11:19 PM
z_default
I've got a new feature in my lifestream, but I don't know how to expose it. Currently, the lifestream entries look like this:


I like this look, because it's uncluttered. There are only two noticeable links when you hover over stuff. The text in the middle is a link to the original entry, and the little icon to the right takes you to my account at that site.

However, I decided it would be handy to be able to have lifestream pages that show only entries from livejournal, my family blog, delicious, or plurk, or any of the others.  I made it so.  Yay!  There they are!

But now the problem: From where should I put links to them? It's the same issue as with the lifestream legend. The lifestream legend is meant to be just a little table to help the reader know which services are being tracked. It's a handy thing, but it doesn't belong on the lifestream page. So I left it out.

But it seems like I should be able to put links to the filtered pages somewhere. Hopefully from the lifestream itself, because that's the handiest. But a new link from that page will hurt the current design. Here are some examples that would put the link just to the left of the little icon at the end:

I don't know what I should do.  In the picture above there's a picture of a funnel, which apparently is geek code for "filter."  Below that is an icon of a page with a green "go" arrow (from famfamfam), and below that is a down arrow unicode character.  Below that is a nebulous, mysterious box.  I'm not really pleased with any of these.  I like the feature, but just don't know how to expose it.

Do you have any ideas of what would look good?  Should I leave those links out of the lifestream and put them in from the legend?  Maybe I should change the link of the icon at the end to be to the filtered page instead of my account page at the remote service?
 
[Edit]  Currently, I changed the link of the icon at the end to point to the filtered page.  I'll see how that works.


The Best Lifestream Ever!

  • Oct. 18th, 2008 at 11:26 PM
z_default
I'm really proud of my lifestream. Originally I got the idea from Jeremy Keith. (And I use a subset of his style. I intended to use my own style, but I simply love his, and I don't have any design skill.) A lifestream is an aggregation of your user activity feeds from across the internet. Essentially, it can be thought of as an automatic online diary. It writes itself.



I think I can be thought of as a late early-adapter. I thought I had a lot of original ideas as I made my lifestream, but it turns out that more often than not, somebody else had already implemented one of the ideas. Happily, no one seems to have made all the same decisions as me, so my effort wasn't wasted. For me, my lifestream really is the best lifestream ever! Here's why:


[Edit] I changed the icon link.  Now they point to a filtered lifestream page.

The Best of Both Worlds


Jeremy implements his as an aggregation of RSS and Atom feeds with no persistent storage of previous entries. So, as newer entries are made, the oldest entries are lost forever. His lifestream is always only the most recent few entries. Jeff, on the other hand, implements his with APIs, so he has access to the complete history of entries for any account. I maintain mine with feeds, but I imported my entire history from many accounts.  My lifestream is huge, and spans years, even though I just started it a couple of months ago.

Also The Best of Both Worlds

Jeremy's lifestream is handy, because it never becomes unwieldy.  It'll always be about the same size.  Jeff Croft's and Emily Chang's persist every entry and thus continuously grow.  They paginate their lifestream.  You can view page 234 out of 399, for example.

I decided that 98% of the time, I'm only interested in something I wrote down in recent memory.  Say, the last four weeks.  So I made that the index page of my lifestream.  Just the 28 most recent days of my online activity.  It make for a nice, small page.

But the other 2% of the time, I'm searching for something older, or I'm feeling nostalgic.  So I put my entire lifestream on one page, too.  Sure, it's big, and I'll never browse it from a phone, but modern web browsers are perfectly capable of downloading it and rendering it, and will be able to do so for years to come.  The entire history really has the same appeal to me as being able to search through a diary.

Even if I decide to paginate it eventually, it'll be easy, the backend will facilitate that.

The Details Matter

Since I provide my entire lifestream on one page, I also made sure to include the year for dates that precede this year.  (Eg., October 5th, 2006.  Note that that uses the intra-page anchor, another important detail.)

My lifestream has a discoverable RSS feed too.

But you know what?  Nobody'd want a feed of a lifestream that constantly updates for individual entries.  That's one thing that really bothers me about sweetcron feeds.  They're just too noisy.  Update, update, update!

So the RSS feed for my lifestream only provides weekly updates.  That's what I'd really want from a lifestream feed.  Just some sort of nice regular overview of all the activity over a certain period of time.  And its permalinks are intra-page links into the huge complete history page.

Some of the accounts that I include in my lifestream don't support user activity feeds.  For example, YouTube's feed for each user's Favorited videos doesn't have "date-favorited" information associated with it.  Since I wrote my own lifestream engine, I was able to work around that problem.  I doubt that most lifestream services like FriendFeed would go to the lengths I did in ensuring that I get exactly the information I want, regardless of whether or not the site's feed or API supports it.

It Helps Me Find Things

Searching for things half-remembered turns out to be pretty successful at the lifestream.  I sometimes don't know if I posted a link to delicious, or if I plurked it.

It Encourages Me To Write Better

I always think twice before I write a clever title to a tweet, plurk, or blog entry.  I realize now that I may well be searching for that entry in the lifestream later, and the lifestream may only have the title.  (The lifestream also contains actual content from the entries, but the content isn't presented in the web pages.  So maybe the content will be searchable too, eventually.)

Cleverness is out.  Accessibility and searchability are in when you have a persistant searchable lifestream.  Now, I strive for clarity in my titles.

I also stopped services that cross-post from one service to another.  Having the lifestream made the idea of cross-posting even more redundant.  If my livejournal friends don't want to see my tweets, I won't force them to with LoudTwitter.

Lifestream Status

  • Aug. 28th, 2008 at 8:00 PM
z_default
My current programming project is a custom made lifestream. It's fun!

Think there's privacy online? Here are a few of the public feeds that track me.  Since they're there already, I'm going to aggregate them into one place.  It'll be like a digital diary that writes itself.
 

Edit: Ha, ha.  I forgot my livejournal.

Tags:

The Ways I'll Improve FeedParser

  • Aug. 17th, 2008 at 7:46 PM
z_default
So, I'm going to start a lifestreaming project. (Yes, I've wanted to do this since 2006.) I've already got a lot of snippets that I can use, but I'll use Mark Pilgrim's feedparser.

It seems like a good jumping off point. I'll improve it with various advanced features I've already implemented elsewhere like:
  1. Conditional GETs.
  2. Authentication, (cURL example)
  3. Accessing all feeds with a simplified interface.
Let's see, where do I get started?
  1. Conditional GETs. Mark already did it.
  2. Authentication. Mark already did it.
  3. Content Normalization. (That's what I meant.) Mark already did it.
Wow. That's a nice, fully-featured little library there.

There's nothing left for me to do, but the stuff I can't do. Make it pretty.

Introducing Karma Medic

  • Jul. 18th, 2008 at 8:02 PM
z_default

If you use Plurk, you know how fun the service is. It's one of the most addictive sites around. But I'm not here to convince you to try it. I'm here to help those who are already there.

Plurk utilizes a point system called Karma. It's a finely tuned system that appeals to those personalities that are competitive or like to collect. I love the reward system associated with karma. I despise the penalty system associated with karma. For example, if you're away from the service for a few days, you lose karma.

If you're already on Plurk, you need Karma Medic. Karma Medic's plurk user name is dblumebuddy. Karma Medic watches out for all her friends. If they're away from the service for too long, Karma Medic administers Karma in their absence.

Finally, you're allowed to leave Plurk and return to it without feeling like you've been unduly punished.

[Edit 07/28/2009] It's been over a year now, and Karma Medic has discontinued her distribution of karma.  She's decided to continue singing, though.  Many thanks to Plurk itself, for making the Karma system less punitive than it was a year ago.

Instructions

1. Friend (not Follow) dblumebuddy.
2. There is no step 2.

Karma Medic will* accept the friend invitation, and will begin watching out for you in about two hours.

What Happens

Karma Medic is a cron daemon that watches out for her friends every hour. She notices the following sorts of things.

  • If you been plurking, that's great.
  • If you Karma isn't going too far into the negative, that's OK, too.
  • If she's helped you recently, she'll move along.

But, if you haven't been plurking, and your karma's going dangerously low, she'll administer a little karma love in the form of a plurk response.

Also, she likes to sing.

Leaving Karma Medic

There are two ways to leave Karma Medic's services.

  1. Unfriend Karma Medic. Karma Medic will forget everything she ever knew about you within an hour.
  2. Stop plurking. If you leave Plurk by just walking away for a few weeks, Karma Medic notices and stops watching out for you.

The Details

Karma Medic is a completely transparent service. You can see everything she knows. She was written in Python and uses YAML and JSON.

She can only see public plurks.

I intend to release Karma Medic as open source under the MIT license at Google Code. I just need some free time. She uses the Python variant of the Unofficial Plurk API.

*She's only accepting up to 20 35 55 80 111 friends at the moment.  But if any of them leave plurk or unfriend her, she'll accept new friend requests.

So what are you waiting for?  Go friend her!  Help her help you!

The Unofficial Plurk API in Python

  • Jul. 14th, 2008 at 1:52 PM
technical
I've ported some of the unofficial Plurk API in Python at Google Code.

There were already a couple Python scripts out there that connect to Plurk, but nothing that constituted anything like an API like Ryan Lim's PHP version.

It's only a partial port, and it's not documented yet. But it's pretty easy to understand and it's usable. If you use it, please conform to Plurk's Terms and Conditions.

Here are some examples:
import plurkapi

p = plurkapi.PlurkAPI()

## View some plurks
for plurk in p.getPlurks(your_userid):
print plurk['content']

## Retrieving Karma
p.login(nickname, password)
print "%s has %1.2f karma." % (p.nickname, p.uidToUserinfo(p.uid)['karma'])

A-frackin'-Men, Brother

  • Apr. 21st, 2008 at 9:44 AM
technical
Is it any wonder that after another weekend love-fest with Python (I chose to use Python to read Javascript's native format) that I'm totally delighted with this awesome xkcd comic?

Tags:

Rockin' The Geek-Fu, or Not On Your Cloud

  • Apr. 19th, 2008 at 12:12 AM
technical
I use Foxmarks to keep different computers' bookmarks sync'ed to each other. I have one set of bookmarks for use on home computers, and another set for use at work computers. (I also use delicious for low usage bookmarks I know I want available everywhere.)

With Foxmarks, you can sync your bookmarks to their servers, or you can sync to your own webdav server. I prefer to host my own stuff, so I sync to my own webdav server. The bookmarks are stored in JavaScript's json file format.

But, that doesn't give me the option to browse to the server and easily see the other set of bookmarks. (If I sync'ed to Foxmarks' servers, then I could see them at my.foxmarks.com if I login with my other username.)

What's a Pythonista to do? Write a script that displays the bookmarks as URLs on a webpage! Sweet! Now I host my own repository for my bookmarks, and they're available online in case I need to see the other set's bookmarks. Here's the script:

#!/usr/bin/python
# foxmarks_reader.py by David Blume

import urllib
import simplejson # http://www.undefined.org/python/
import types

urls = ( ('Home Computer', r'http://user:pwd@url.com/fm/foxmarks.json'),
         ('Work Computer', r'http://user:pwd@url.com/fmw/foxmarks.json')
         )

def do_insert(folders, command):
    if 'nid' in command:
        args = command['args']
        if args.has_key('ntype'):
            if args['ntype'] == 'folder':
                my_folder = []
                folders[command['nid']] = my_folder
                if command['nid'] != 'ROOT':
                    parent = folders[args['pnid']]
                    parent.append((args['name'], my_folder))
            elif args['ntype'] == 'separator':
                parent = folders[args['pnid']]
                parent.append('---')
            else: # 'bookmark'
                parent = folders[args['pnid']]
                parent.append('<a href="%s">%s</a>' % (args['url'], args['name']))

def print_folders(folders, indent):
    for item in folders:
        if type(item) == types.ListType or type(item) == types.TupleType:
            print '%s%s' % ('  '*(indent * 4), item[0].encode('iso-8859-1', 'replace'))
            print_folders(item[1], indent + 1)
        else:
            print '%s%s' % ('  '*(indent * 4), item.encode('iso-8859-1', 'replace'))

if __name__=='__main__':
    print "Content-type: text/html; charset=ISO-8859-1\n\n"
    print '<pre>'
    for url in urls:
        print '<h2>%s</h2>' % url[0]
        sock = urllib.urlopen(url[1])
        json = simplejson.load(sock)
        sock.close()
        folders = {}
        for command in json[u'commands']:
            do_insert(folders, command)
        print_folders(folders['ROOT'], 0)
    print '</pre>'

Tags:

Promising Tech

  • Mar. 13th, 2008 at 9:31 AM
technical
I've now got phone envy.  I didn't know the S60 has Python.  (Discovered while reading an entry investigating Fire Eagle.)

Completely different, but something that makes me just as happy:  This video of voiceless talking hits me as hard as the first time I saw the multi-touch demo from the TED conference in Monterey.

Being able to help people with ALS in the near term rocks.  The longterm potential for hardcore geeks is just icing.  (Imagine how frustrating it'd be for teachers when their students are collaborating during tests without looking, moving or talking!)

The Avid World Wide Weather Competition

  • Nov. 2nd, 2007 at 11:07 PM
technical


We've been displaying the Avid World Wide Weather Competition on our printer at work for some time.  It was great fun in the beginning.  The printer only displays the site with the best weather, and then the site with the worst weather, leaving out all the others.

But who wants to have to travel to the printer to know where they're glad they're not?  Now, I bring the printer's weather to you, whereever you are!  Introducing:  The world's first printer weather feed.

Or, here's just a slightly better explanation of what I made.

HP Printer Ready Message "INSERT COIN"

  • Oct. 17th, 2007 at 12:18 PM
technical
Courtesy of our local HP printers and this awesome tip, I present today's python script:
from socket import *
import sys

printer = "10.1.1.2"  # Change this to the IP of your printers
msg = "INSERT COIN"   # Or, AYBABTU for longer displays

if __name__=='__main__':
  if len(sys.argv) == 3:
    printer = sys.argv[1]
    msg = sys.argv[2]
  s = socket(AF_INET, SOCK_STREAM)
  send_message = \
    '\x1b%%-12345X@PJL JOB\n@PJL RDYMSG DISPLAY="%s"\n@PJL EOJ\n\x1b%%-12345X' % (msg, )
  s.connect((printer, 9100))
  s.send(send_message)
  s.close()

Baby's first urllib2.URLError

  • May. 20th, 2007 at 6:29 PM
technical
If you subscribe to any of my syndicated-feeds-for-static-sites, you'll see a one-time false positive because I changed the feed's item text today.

For what it's worth (in bandwidth credits), Chuck Shepard's News of the Weird successfully returns HTTP code 304, and my daemon honors it.  So we've got bandwidth green credits to sell.

But yesterday, my daemon got its first URLError -2 (Name or service not known).  Geek that I am, it gave me a little thrill to see how the exception was handled, and to add a little code that'll further isolate the exception.  Whee!  I program all day at the office, then go home and have fun programming a little more.  I'm easy to please.

python arguments are post-its

  • Mar. 30th, 2007 at 8:39 PM
z_default
Consider:


>>> def foo(a): a = 2
...
>>> x = 1
>>> foo(x)
>>> x
1


And:


>>> def bar(b): b.append(2)
...
>>> y = []
>>> bar(y)
>>> y
[2]

Alex Martelli dismisses newbie "by value or by reference" questions with the following:

The terminology problem may be due to the fact that, in python, the
value of a name is a reference to an object. So, you always pass the
value (no implicity copying), and that value is always a reference.

I find it simpler to explain as: the semantics of argument passing are
_exactly_ identical to that of assignment (binding) to a barename; you
can fruitfully see argument passing as local (bare) names of the called
function being assigned initial values by the caller (that's exactly
what happens, in practice). Now if you want to coin a name for that,
such as "by object reference", "by uncopied value", or whatever, be my
guest. Trying to reuse terminology that is more generally applied to
languages where "variables are boxes" to a language where "variables are
post-it tags" is, IMHO, more likely to confuse than to help.

Happy Productivity Day

  • Mar. 16th, 2007 at 12:56 AM
z_default
Today should be a day filled with Python love. I'm giddy! The computer's going to crunch data for hours, and present me with a pretty little view.

I'm looking closely at LibraryThing (old, popular), Shelfari (newer, prettiest, not so fully featured), and Listal (newer, pretty, very general).  It'd be fun to share and compare books.  Do any of you use services like these?

Note To Self: Python's Apply

  • Nov. 8th, 2006 at 12:03 PM
z_default
Self, discover why args has to be manipulated the way it does.
def fprintf(file,fmt, *args):
file.write(fmt % args)

def printf(fmt, *args):
apply(fprintf, (sys.stdout,fmt)+args)

Convenience Trumps Security

  • Nov. 5th, 2006 at 1:04 AM
z_default
I access my remote svn repository by way of a ssh+svn tunnel.  Typing my passphrase in PuTTY pageant is tedious, but for security's sake, I've lived with it until now. 

But no more. 

Color my computer compromised.  (Which is no big deal, since it has a sandbox on it anyway.)  I'm now using Simon Brunning's excellent Python module winguiauto to take care of the old passphrase inconvenience.

You've been feeded!

  • Sep. 18th, 2006 at 11:58 PM
technical
That's a pretty lame dis.  Maybe if I say it with more attitude: "You've been feeded, boyee!"

Ah, never mind.  Let me just publish one entry from the script's prefs file:

# yaml preferences for FeedMaker
# http://www.yaml.org/
# This file is read in and written by the FeedMaker python script
---
site:
  - url: http://www.[namewithheldtoprotecttheguiltyyouknowwhoyouare].com
    rss: [namewithheld].xml
    etag: None
    last_modified: Tue, 19 Sep 2006 06:45:28 GMT
    md5_tag: <span class="titleHd">
    md5: '\xa1KJ\r\xd6E\x03t\x03Fl>\xc7k\xcd\x08'


The script takes that in, checks the specified tag's content, spits out an rss feed, and updates three fields in the preferences: etag, last_modified (for bandwidth-friendly conditional GETs), and md5 (fingerprint of specified tag's data).  I've got two sites so far, but now I can at least have my machine easily monitor sites that don't publish their own feeds.

Python Sorting

  • Jun. 11th, 2006 at 10:35 AM
z_default
Python's sorting is extremely powerful and intuitive, so it seems foolish for me to post this note-to-self here, but I want to do so, in case I forget the operator module.

import operator

rows.sort(key=operator.itemgetter(4))
# or
rows.sort(lambda x, y : x[4] == y[4] and cmp(x[2],y[2]) or cmp(x[4], y[4]))

...not like I could just find the same info at the Python wiki or anything. :-P