The Wayback Machine - https://web.archive.org/web/20170701025805/http://www.advogato.org/person/oubiwann/diary.html?start=171

Older blog entries for oubiwann (starting at number 171)

Twisted News Resources and Divmod Sprint at PyCon

These days, there's a lot going on right now in the Twisted community as well as here at Divmod. It's really quite exciting :-) But, in an effort to not spam the world, I'll try to group things together when possible.

First off is Twisted news: in case you haven't noticed yet, Twisted Labs now has a group blog here. We're making an effort to share more of our conversations and vision with the wider community. We'll also be posting news items there, which means (at long last!) we now have an RSS feed for the latest Twisty Happenings. To just read the news items (if that's your preference), you can visit this page (it's a "news" tag filter). What's more, if you want an RSS feed that just covers the news, you can use this one, which is also being maintained. As always, our News Archives page continues its non-feed-having, wiki-ish existence.

Next up is the Divmod Sprint at PyCon 2008: we're having one! I posted an entry on our company blog, so please check it out and follow the links to join our sprint, if you are so inclined.

More soon!

Technorati Tags: community, divmod, pycon, twisted

Syndicated 2008-02-21 21:01:00 (Updated 2008-02-21 21:02:48) from Duncan McGreggor

zope.testbrowser: Automating the Web

Speaking of little known python modules, if you haven't used zope.testbrowser, please raise your hand. Okay, all of you that raised your hand and have ever wanted to automate web forms, check a web site's functionality, or perform screen-scraping related tasks, pull up a chair. This won't take long, because zope.testbrowser's API rocks so hard and is so easy to use.

I first started using zope.testbrowser sometime before consulting for Zenoss. However, when I implemented Zenoss' "Synthetic Transactions" (I believe this was originally part of their open source offering, but has since been moved into the Enterprise Edition), I used it again and profusely. It provided me with a wonderful Python API (a mechanize wrapper and then some), one so intuitive that I could use not only without thinking, but for which I didn't even have to read the docs. This solution proved to be friendly to programmers, but we were really targeting non-programming network administrators and IT managers with the Zenoss plugin, so I completed the plugin using Twill and TestGen4Web (whose python runner I rewrote and to which I added support for zope.testbrowser).

I used it again at Zenoss later when building the community software, enabling users to set their Mailman preferences from their Plone settings. Most recently, I've been using it to publish news articles to various sites from a single file used by a script.

Here are a couple of standard use cases with sample code:

Visit a page and follow some links

>>> from zope.testbrowser.browser import Browser
>>> b = Browser('http://google.com')
>>> b.title
'Google'
>>> b.getLink('About Google')
<Link text='About Google' url='http://www.google.com/intl/en/about.html'>

That gives us the actual link object... but what if we want to follow that link?

>>> b.getLink('About Google').click()
>>> b.title
'About Google'


Simple enough :-)

Check for content

Let's continue on the Google link trail, and check for content:

>>> b.getLink('Investor Relations').click()
>>> b.title
'Google Investor Relations'
>>> b.getLink('Guidelines').click()
>>> 'Corporate Governance' in b.contents
True


Sign into a site

Signing into a site requires filling in form information and submitting that data.

>>> b = Browser('https://launchpad.net/+login')
>>> b.title
'Log in or register with Launchpad'
>>> b.getControl(name='loginpage_email', index=0).value = username
>>> b.getControl(name='loginpage_password').value = passwd
>>> b.getControl(name='loginpage_submit_login').click()
>>> b.title
'Launchpad'
>>> 'Logged in as' in b.contents
True


A couple things to note here:

  1. you need to look at the HTML so that you know what the form elements are named;
  2. there are two form elements on the page that are named loginpage_email, and we want the first one; and
  3. I omitted the part of the code where I pulled my credentials from the file system.
Submit form data

Now that we're logged in, let's change some out-dated information in my profile (my old blog's link has been there for too long):

>>> b.getLink('Duncan McGreggor').click()
>>> b.title
'Duncan McGreggor in Launchpad'
>>> b.getLink('http://www.advogato.org/person/oubiwann/')
<Link text='http://www.advogato.org/person/oubiwann/' url='http://www.advogato.org/person/oubiwann/'>
>>> b.getLink('Change details').click()
>>> b.getControl(name='field.homepage_content').value = 'blog: http://oubiwann.blogspot.com'
>>> b.getControl(name='field.actions.save').click()

Now that we saved it, let's check our results:

>>> b.getLink('http://www.advogato.org/person/oubiwann/')
Traceback (most recent call last):
[snip]
mechanize._mechanize.LinkNotFoundError
>>> b.getLink('http://oubiwann.blogspot.com')
<Link text='http://oubiwann.blogspot.com' url='http://oubiwann.blogspot.com'>

Excellent; just what we expected to see.

These are all really simple examples, but they should be helpful in providing some insight and inspiring you to use it :-) Working with radio buttons is a little more complex in that you have to get the containing object first and use getControl on that object in order to get the selection you want. However, if you've worked with HTML more than any sane person should have to (I think that exact amount is "any") , this will all be quite expected.

So, who's up for making an async version to work with Twisted? ;-)

A tangential caveat: I made a comment above about the zope.testbrowser API rocking, and that needs some clarification. As far as I am concerned, there are two major ways in which API's can be graded:
  1. how easy is the API to use, how well is it documented, how much of the problem domain does it cover? (developer as user)
  2. how elegantly/efficiently was the solution implemented (developer as contributor)
zope.testbrowser rocks from the perspective of a coder using the API. I've never looked at how it is implemented, because I haven't needed to. It does everything I require without me having to dig around in its guts. As such, I can make no assertions as to the quality of its implementation. However, it's packages, modules, classes and methods are all named just as I would expect them to be named and do what I would expect them to do. That may not sound like a big deal, but it really is.

Technorati Tags: howto, programming, python, web, zope

Syndicated 2008-02-20 15:57:00 (Updated 2008-02-20 16:02:39) from Duncan McGreggor

PyCon 2008 Registration Discounts Expire Tomorrow!

Hey all, in case you're like me and wait for the last minute to do everything, you need to hop on the good foot and do the bad thing: pay now. Or do the worse thing: pay later, and pay more.

Currently, the rates are as follows:

  • hobbyist registration: $220
  • corporate registration: $400
  • single room: $99 (maybe all rooms are the same price?)
After tomorrow, the rates jump up to the following (until March 7):
  • hobbyist registration: $300
  • corporate registration: $500
  • single room: dunno... I've heard rumors that you might be able to get something for $160/night

Don't wait any longer... :-)

Technorati Tags: community, pycon

Syndicated 2008-02-19 16:50:00 (Updated 2008-02-19 16:51:06) from Duncan McGreggor

Twisted's filepath Module

Glyph recently blogged about some of the buried treasure in Twisted, the filepath module in particular. Since working at Divmod, I've made use of this module quite a bit, and thought I'd share some of the features that I've found most useful (and intuitively nice to use).

Assuming you've got Twisted installed, let's fire up a python interpreter and import the FilePath class and instantiate it with /tmp:

>>> from twisted.python.filepath import FilePath
>>> tmp = FilePath('/tmp')


Now let's test some basic operations:

>>> tmp.exists()
True
>>> bogus = tmp.child('bogus')
>>> bogus.exists()
False


Isn't that nice? I love not having to import and use the os.path.exists function; it's a method on the object representing a file or a path, as it should be. I also enjoy the convenience FilePath offers when it comes to creating paths:

>>> mydir = tmp.child('notbogus').child('anotherdir').child('mydir')
>>> mydir.exists()
False
>>> mydir.makedirs()
>>> mydir.restat()
>>> mydir.exists()
True


We had to call restat() so that the object would check the file system again (since we just made some changes). Now, for some files:

>>> for filename in ['test1.txt', 'test2.txt', 'test3.tst']:
... mydir.child(filename).touch()
...
>>> mydir.listdir()
['test1.txt', 'test2.txt', 'test3.tst']


And if you don't believe that, we can switch to shell:

lorien:oubiwann 20:51:58 $ ls -al /tmp/notbogus/anotherdir/mydir/
total 0
drwxr-xr-x 2 oubiwann wheel 170 Feb 17 20:51 .
drwxr-xr-x 3 oubiwann wheel 102 Feb 17 20:46 ..
-rw-r--r-- 1 oubiwann wheel 0 Feb 17 20:51 test1.txt
-rw-r--r-- 1 oubiwann wheel 0 Feb 17 20:51 test2.txt
-rw-r--r-- 1 oubiwann wheel 0 Feb 17 20:51 test3.tst


Reading and writing operations are the same as usual:

>>> myfile = mydir.child(filename)
>>> myfile.isdir()
False
>>> myfile.islink()
False
>>> myfile.isfile()
True
>>> fh = myfile.open('w+')
>>> fh.write('do the usual thing')
>>> fh.close()
>>> myfile.getsize()
18L
>>> myfile.open().read()
'do the usual thing'


But you can use shortcuts like this, too:

>>> myfile.getContent()
'do the usual thing'
>>> myfile.setContent('and now for somethibg completely different...')
>>> myfile.getContent()
'and now for somethibg completely different...'


Let's get the path and recheck the file size, just to make sure:

>>> myfile.path
'/tmp/notbogus/anotherdir/mydir/test3.tst'
>>> myfile.restat()
>>> myfile.getsize()
45L

Or, again from shell:

lorien:oubiwann 20:52:06 $ ls -al /tmp/notbogus/anotherdir/mydir/
total 8
drwxr-xr-x 2 oubiwann wheel 170 Feb 17 20:58 .
drwxr-xr-x 3 oubiwann wheel 102 Feb 17 20:46 ..
-rw-r--r-- 1 oubiwann wheel 0 Feb 17 20:51 test1.txt
-rw-r--r-- 1 oubiwann wheel 0 Feb 17 20:51 test2.txt
-rw-r--r-- 1 oubiwann wheel 45 Feb 17 20:58 test3.tst


Hmm... for some reason, I really like this file and want to keep it. What do I do?

>>> docs = FilePath('/Users/oubiwann/Documents')
>>> myfile.moveTo(docs.child('special_file.txt'))


That's it! Nice, eh? Of course, we're careful, so we check to make sure it happened:

>>> myfile.exists()
False
>>> newfile = docs.child('special_file.txt')
>>> newfile.exists()
True
>>> newfile.path
'/Users/oubiwann/Documents/special_file.txt'
>>> newfile.getsize()
45L
>>> newfile.getContent()
'and now for somethibg completely different...'


To see more, check out the source, or at least do dir(FilePath) to see what other goodies this class has to offer, and enjoy :-)

Technorati Tags: howto, python, twisted

Syndicated 2008-02-18 03:21:00 (Updated 2008-02-18 03:24:07) from Duncan McGreggor

14 Feb 2008 (updated 21 Feb 2008 at 22:03 UTC) »

Twisted Presence at PyCon 2008

A quick post to let folks know that there is a planned Twisted presence at PyCon this year (last year's was a happy coincidence). We're already coordinating travel and have some BoF ideas up our collective sleeves that are sure to intrigue if not titillate and please.

Twisted brothers and sisters: be there or... well, you'll just miss out on all the goodness that is the unstoppable force of Twisted :-)

Technorati Tags: community, pycon, python, travel, twisted

Syndicated 2008-02-13 23:36:00 (Updated 2008-02-21 21:11:27) from Duncan McGreggor

Blendix Update

Glyph just posted a great entry on Blendix -- I highly recommend it!

We've had a really excellent response from tons of new users both with accolades and fantastic suggestions. You guys are awesome and I hope you stick with us, helping us make this app something useful to you and one that you enjoy using :-)

Technorati Tags: blendix, community, divmod, software

Syndicated 2008-01-19 00:04:00 (Updated 2008-01-19 00:06:37) from Duncan McGreggor

Divmod's New Product: Blendix

In several previous blog posts, private email conversations with some of you, and Facebook conversations with others, I have referenced Divmod's new product. We quietly released our first beta on November 9th and are currently about 85% through the second beta (to be released some time in the next couple of weeks). I'm blogging about it now because I just can't wait any longer :-) And we've been getting some really great feedback from users.

"But what is this mystery product?" you ask. Say no more! I am talking about Blendix. As the front page says, this first incarnation of Blendix is primarily a tool for consolidating web properties into a single URL, for your convenience and that of your friends/family. A striking example of this is my page on Blendix: https://blendix.com/users/oubiwann/. As you can see from the "Now Blending" panel, you'd have to visit 14 URLs at 10 different sites to see this same content. By checking me out on blendix.com instead, you are not only saving yourself the time and trouble, but you're getting a more complete picture of what I've been up to.

"Um, yeah... looks like an RSS reader to me..." True, there are a lot of similarities. But there's another twist: you can add your friends, too. Even the ones that don't want to create an account on Blendix :-) I'd say that it's a safe bet most of us have friends who publish some sort of content online but who also can't be bothered to join yet another social networking or similarly service-oriented site. With Blendix, that's not a problem -- you don't have to wait on anyone :-) You simply add them to your contacts where you can provide feeds, email addresses, and user names. Then, their public content (i.e., "feeds") will be displayed at a unique Blendix URL.

Right now, anything that provides an RSS feed can be added to your profile (and your contacts' profiles). Additionally, we're getting custom content from such sources as Amazon wishlists, last.fm playlists, weather, Google maps, and Flickr images... with lots more planned :-)

I wanted to write about Blendix here (on my blog) before we made any official press releases because you guys -- the members of the python community -- are our "home town" :-) We want you to get "first dibs" (as it were) and we wanted you to hear the news from one of your own, not from the cold lips of some news story. We're keeping things small for now, but if you have any interest (or if you use similar features with a related service), please come check us out (oh, and this too), sign up, take an account for a spin, and email us with any problems, questions or suggestions.

The team has been in amazing spirits during this multi-month push, working really hard, and adding new features left and right. We've been at it for a while, so competition is growing in this increasingly important user space. We may not be the shiniest or have the most users, but it is consistently apparent that our product is addressing needs and features that others seem to be skipping. Our development process may have taken longer than others due to the infrastructure we decided was essential to build, but this has given us an edge over other shops with similar plans.

And boy, do we have some nice surprises in store for you in the months to come :-)

Technorati Tags: business, community, divmod, internet, software, web

Syndicated 2008-01-17 04:32:00 (Updated 2008-01-17 04:32:38) from Duncan McGreggor

New ED Blogger Template

Well, I finally got around to migrating my blog over to the new blogger templates.

I customized their "Rounders" style by Douglas Bowman of stopdesign.com to use the colors and background image of my old-style blogger template. I found the process most painless and am happy with the results; it's nice to be able to manage the content in discreet chunks and the added convenience of the various widgets blogger offers is a big bonus.

I've also added a couple new sections that are populated based on the view/click rankings in feedburner. This should provide folks with easier access to the content they find most interesting.

I feel that the blog is now crisp, cleaner, and more enjoyable to read. Hopefully, so do you ;-)

Technorati Tags: blog, design, web

Syndicated 2008-01-16 08:32:00 (Updated 2008-01-16 08:36:30) from Duncan McGreggor

Reflecting on the Future via Thunderbird...

I've been using Thunderbird/Mozilla Mail/Netscape Communicator for quite some time now, with mbox files that date back to 1997. A few months back, however, I had some issues with Thunderbird handling my 7GB+ of archived email. This happened a couple years ago, too, when I added a near decade's worth of email to "Local Folders." Thunderbird took 10-15 minutes to load, every time I started it up.

Recently, I started seeing a similar but worse problem: it never finished loading at all. Not having the time to investigate, I gave up and started using GMail exclusively. I'm a big fan of GMail for both personal and business communications, so I had no problem with this. My only annoyance is that GMail seems to really slow down FireFox after an extended period of time (after being open for a week, for instance).

However, just the other day, I had desperate need of my archived mail. As such, I set about to find a way around the ThunderBird problem once and for all. What ended up working was adding one *.sbd folder at a time, checking it, quitting TB, restarting it, and adding the next one.

After all the old data was added and TB was running smoothly, I noticed that many of my mail folders were several GB is size, despite the fact that they contained only a few KB worth of messages. Peeking inside the files, I saw some really old emails that ThunderBird wasn't displaying. On a hunch, I went to the "File" menu and noticed the "compact" item. Bingo, that did the trick.

So far, everything is running great and I'm glad to be using TB again.

But here's the point: I'm really glad to be using TB again. I can't tell you the bizarre amount of contentment and near-euphoria I felt after seeing all that mail in its "rightful place", where I can search and find what I need, where I can reminisce, get old business information, content from which I can draw new inspiration, etc. I felt some weird form of "cleanliness" about having my mail in its own app and out of the browser.

I mean, hell yeah, Google's got a good thing going -- no denying that. But with the decreasing cost of storage, historical correspondence is something I want at my fingertips so that even if I have no internet connection, I can still get to it; even if I have no ThunderBird, I can still fire up vi and dig around.

And this made me think: we're all looking at web apps, MMOs, Amazon's EC2/SimpleDB, etc., but what about users like me? How many are there of us? What kind of market do we form? What *other* tools might we like to have besides email clients? I want to manage my data on my hard drives under my conditions. I like little scripts and even GUI apps that do one or two things really well. I'd love to have little GUI apps like that could be combined with other apps, forming exactly what I need when I need it with little or no pain.

Glyph was recently showing me the latest version of the Glade UI builder, and I was really impressed. It reminded me of working with Apple's XCode a few years ago -- a wonderful experience. And now... I wonder. What it would take to build a "meta IDE"? Where instead of assembling pieces of code and GUI widgets, we're assembling little GUI apps that all communicate via a shared, open protocol. Apps that could be easily reskinned to look like one complete application...

As a developer, the first thing that comes to mind is a tool that would be a combination of an IM/IRC client, a bug tracker, a wiki editor, an IDE, an email client, an svn client, and a time tracking tool. Each would be able to communicate with any other, allowing data to be correlated, tagged, cross-referenced, etc. Building that monstrosity from scratch would be heinous. But building each part wouldn't be too bad, really. What about having the flexibility to use any one of those as a stand-alone app, or combined with as few or as many of the others as you desired? That'd be killer. And wouldn't it be great not to have to use a web browser?

There has *got* to be some demand for this sort of thing...

Technorati Tags: software, web

Syndicated 2008-01-10 23:23:00 (Updated 2008-01-10 23:24:02) from Duncan McGreggor

2 Jan 2008 (updated 17 Jan 2008 at 01:04 UTC) »

Divmod Rocks

So I've been working at Divmod for several months now, and I thought I'd report on things a little bit. I've actually wanted to do this for a while, but things have just been soooo busy here, that I honestly haven't gotten the chance.

Simply put, this is the best company I have ever worked for. The team is brilliant and hard-working; the (virtual/distributed) working environment is highly creative one; the CEO is amazingly supportive and gracious; the software and supporting architecture is fascinating; and our product is actually useful and people like it :-)

I've done my time in Corporate America and swore I'd never go back. I've been a consultant since 2002, and the fact that I am actually an employee again really says something about the company I'm working for and team I'm working with.

Technorati Tags: divmod, work

Syndicated 2008-01-02 13:30:00 (Updated 2008-01-16 23:54:51) from Duncan McGreggor

162 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!