Peter's Blog

Redefining the Impossible

How to blog on a pocketpc


There are three ways to blog from a pocketpc that I have found:

  1. open your blog in a web browser and edit it as normal. This doesn't work so well in practise unless your web page has been designed with a css style sheet that works nicely on a pda. I tried modifying my drupal theme accordingly and made it presentable but it's not up to data entry.
  2. try using an application for posting to blogs. There are a couple of these about but those that I tried were buggy or had tiny little edit boxes.
  3. write the article and submit by email. This is how I am posting this, I use phatnotes, a notetaking application that can send the notes via email. I don't use pocket outlook for the simple reason that it doesn't seem to save sent mail so I cannot edit the article and send it again to modify it. I use my old mailbot script on the server to capture posts and poke them into drupal.

So far this has worked ok and I can compose posts offline and upload them at my leisure.

Disadvantages:

  • No preview unless I go online, hence I keep posts simple.
  • cutting and pasting urls is fiddly and I cannot be bothered with it.
  • my script adds tags by scanning the database for existing tags, searching the post for the tag words and adding the tags that it finds. This can give irrelevant tags and I cannot define new tags. I need a neat way to specify tags in the post.

Advantages:

  • the convenience of whipping my pda out and having a quick blog. I don't have to go upstairs and get my laptop.
  • can lay on settee and blog in comfort.

Sami Khan Says:

over 2 years ago

Do you have example of the code that you use to scan your post and add the tags?? I think it would be helpful to other people who are interested in doing something similar.

Peter Says:

over 2 years ago

The code is part of a rather hacky python script. I won't post the whole thing but an old version is here. This is executed just after using the metaWeblog api to post or edit the node into drupal. It adds awtags tags by poking the database directly.

Entry conditions:

oNid
node number for post just added/edited. May be a string, may be an int, depends on subtleties of xmlrpc
strBody
body of the post
   1  #
   2  # Search for awtags and add automatically.
   3  #
   4  import MySQLdb
   5  
   6  oConnection = MySQLdb.Connect( 'localhost', 'username', 'password', 'database')
   7  
   8  #
   9  # Get a list of all available tags
  10  #
  11  oCursor = oConnection.cursor()
  12  oCursor.execute( 'SELECT tid, tag FROM awtags')
  13  
  14  #
  15  # Delete existing tags mapped to the node.
  16  #
  17  oCursor2 = oConnection.cursor()
  18  oCursor2.execute( 'DELETE FROM awtags_node WHERE nid = %d;' % int(oNid))
  19  
  20  #
  21  # Go through each tag searching the post for the tag word
  22  #
  23  while 1:
  24      oRow = oCursor.fetchone()
  25      if not oRow:
  26          break
  27  
  28      #
  29      # Use a regular expression to do the searching.
  30      #
  31      oMatch = re.search( r'\b' + oRow[1] + r'\b', strBody, re.IGNORECASE)
  32      if oMatch:
  33          #
  34          # Found tag word so add a mapping from the tad id to the
  35          # node id.
  36          #
  37          oCursor2.execute( '''INSERT INTO awtags_node (nid, tid)
  38                               VALUES( %d, %d);''' % ( int(oNid),
  39                               oRow[0]))

In another script (part of the microblog) I already have code that can add new tags to awtags so sometime I might tidy up the email posting script (depends on finding the time). It's also worth bearing in mind that drupal 4.7 is imminent and it has native free tagging support (at last) so I might be waving awtags bye bye.

Peter

Have Your Say

I welcome constructive comments or questions but I reserve the right to delete any comments that displease me.

Who are you?

(Optional) If you enter an email address here I might email you back. Your email address will not be sold to spammers or shown anywhere

What do you have to say?