Posts about Posts about bartleblog

2009-02-05 22:40

Back to my own dogfood.

So, I must confess something. I have not been using uRSSus for a couple of months. It all started on my vacations. Since I had only my eee, I ran into some problems and was forced to use google reader.

And it was NOT terrible. Mind you, it was not great, either, but really, not terrible at all.

Since switching RSS apps is a pain (because you need to REALLY catchup on your reading before switching), it took me a long time to get back.

And now I find all sorts of problems in uRSSus which I will have to fix. Which means I better start cranking.

Not that it looks bad, it's a handsome program!


I don't expect to do anything like last year's "A release of something every friday" madness, but I will do something.

Also, I need to rewrite BartleBlog, the app that generates this blog you are reading. It's broken in many ways.

2007-11-20 13:02

New blog feature: Spanish translation!

I have decided to make this blog available also in Spanish starting yesterday.

Since it's generated by my own software called BartleBlog, that meant I had to implement everything so each post can have multiple translations.

And it's starting to work. You may notice several things:

  • Below the banner there is an "Available in English - Español" thing.
  • Each Post has links to the different translations for which it's available.

The location and styling of these elements will change, and they may be broken in different ways for a few days. Sorry about that.

There will also be a "Lateral Opinion en Español" RSS feed soon.

Update: here it is

2007-08-11 23:15

Thinking about this blog.

I suppose it happens to everyone once in a while, and it has happened to me often in the past, but I am thinking if I should keep on writing this blog, or if some large change is needed.

Here are some random things from my head:

  1. Almost noone reads it. Really. It has less than 40 subscribers. That's pathetic for a blog that has content for over 7 years :-)

  2. Maybe I should post in spanish, or at least bilingually.

  3. Maybe I should write more features. When I write a longish piece and announce it, there is a respectable traffic surge.

  4. On the other hand, I enjoy writing it. And it's really very little effort (specially now, with BartleBlog ;-)

  5. Maybe it should be more focused in one area, make it a python programming blog, or a tutorials blog, or something like that.

  6. But I am not a focused person. I am a generalist. This week I have worked in the following things:

    • VoIP
    • Django
    • PyQt
    • Linux sysadmining
    • Firewall/Proxy integration with windows clients
    • Consulting in the most generic sense, sitting with a company's IT staff and thinking about their situation.
    • Learning PyGame

    And this was in 5 days of work. If I listed what I have done this year, it would take me 500 items. I am broad, how could my blog be narrow?

  7. Maybe it's just not interesting? Or badly done?

  8. Is it too nerdy? Is it not nerdy enough?

  9. I have had a blog with a small readership for 7 years, why is it bothering me now?

  10. If I stop, it doesn't matter, I can always pick it up again later when I feel like writing.

So, there. You, the 40 guys, comment on it if you want ;-)

2007-08-04 14:49

Coming ideas

Nowadays, the very little time I have for personal projects is spent doing things like fixing little things and adding little features to BartleBlog [1] and thinking how I could use GLE and mako templates to create a cool nerdy tool to create charts.

However, I will be having a little time for personal projects in a couple of weeks, and having stumbled onto chipmunk today really got me thinking.

It's a seriously nifty 2D physics library. Consider this demo video:

Now, what could possibly be done with it... I need to really think.

[1] What I use to post this.

2007-05-21 13:18

Web Typography

Since I am trying to make my blog into a serious site [1] I decided to take a serious look into web typography. It should be useful if BartleBlog ever gets a second user (which is not precisely coming soon ;-)

Specially since this link appeared in Ned Batchelder's blog.

Right now, I am into basic things, like vertical rythm and such, but you can already see a difference:


Now, let's go into more serious material to read on the subject.

[1] as in "excessive or impressive in quality, quantity, extent, or degree", not "not joking or trifling". This site is all about trifling.

2007-05-15 14:08

BartleBlog live!

I was thinking: how can I implement page previews in BartleBlog?

The obvious way is to render the page and open the local file. However, the page may link or include pieces that are not updated yet in the static version, so that can give confusing results.

Then it hit me... generate the page on the fly and serve it. And do the same for everything else the browser asks for.

So, after searching for 15 minutes for the simplest python "web framework" that let me use the code already in Bartleblog, and deciding for Colubrid...

Now, this is cute: bartleblog as a dynamic web app in 34 lines.

from colubrid import RegexApplication, HttpResponse, execute

from import Blog
import BartleBlog.backend.dbclasses as db
import os, codecs

class webBlog(Blog):
    def __init__(self):
        if not os.path.isdir(self.dest_dir):

class MyApplication(RegexApplication):
    urls = [
        (r'^(.*?)$', 'page'),
        (r'^(.*?)/(.*?)$', 'page'),
        (r'^(.*?)/(.*?)/(.*?)$', 'page'),
        (r'^(.*?)/(.*?)/(.*?)/(.*?)$', 'page')

    def page(self, *args):
        return HttpResponse(, path)).read())

app = MyApplication
app = StaticExports(app, {
    '/static': './static'

if __name__ == '__main__':

2007-05-15 12:44

BartleBlog change: Mako Templates

Since the very beginning, BartleBlog has been using CherryTemplate for its output formatting needs. I like it, because it's very simple.

However, it had grown rather cumbersome.

Specifically, most pages in a blog are sort of a page template with a body template inside (the main content).

To do that on CherryTemplate, I used a two-pass approach: generate the body, then pass it as parameter to the page template.

Which is a pain in some cases because you end basically having to do a rendering function for each kind of page, or some crazy-evil function (what I did).

Exploring the different python template engines, I ran into Mako and decided to give it a whirl. It looks good.

The approach is a bit different, it is much more powerful, but you can still use it simply if you can.

And the main feature was template inheritance. Using that, no more inner and outer templates, baby!

Oh, and performance is better:


real    31m44.732s
user    21m18.336s
sys     2m7.628s


real    24m54.472s
user    19m9.508s
sys     1m56.375s

This is for completely rerendering the whole 7 years, 574 posts, 40 static articles, 14 category blog, and there is tons of optimizations to be done.

BTW: this is how you rerender the whole blog:

from import Blog

2007-05-13 21:15

Sometimes I am stupid. Then again, it doesn't matter, because I am lucky!

I am working on changing BartleBlog so it can be used from scratch. That may sound odd but because I have been using it since day 2 to post this blog, it has grown very organically, meaning there are things that only work because of the way I used it while developing it.

So, I created a test user, and created a test blog there, and I am working, and decide to do another from-scratch test, and...

I deleted my production copy.

Yes. The one that generates this blog. So this blog disappeared. Because I used the wrong terminal window.

And I had one-week old backups.

So I felt very very stupid.

Because undeleting in Linux is a joke.

So I was thinking how to spend a few hours recreating the last week of posts, and whatever, when I noticed on the taskbar... bartleblog was still running.

Which means that the DB was still open by a process. Which means...

[[email protected] bartleblog]$ ps ax | grep python
17063 pts/1    S     24:33 python
17161 ?        S      0:04 konqueror [kdeinit] -mimetype text/html
17454 pts/1    D+     0:00 grep python
[[email protected] bartleblog]$ su
[[email protected] bartleblog]# cd /proc/17063/fd
[[email protected] fd]# ls
0  1  10  11  12  2  3  4  5  6  7  8  9
[[email protected] fd]# ls -l
total 0
lrwx------ 1 ralsina users 64 2007-05-13 21:07 0 -> /dev/pts/1
lrwx------ 1 ralsina users 64 2007-05-13 21:07 1 -> /dev/pts/1
lrwx------ 1 ralsina users 64 2007-05-13 21:07 10 -> socket:[159486]
lrwx------ 1 ralsina users 64 2007-05-13 21:07 11 -> socket:[159488]
lrwx------ 1 ralsina users 64 2007-05-13 21:07 12 -> /mnt/centos/home/ralsina/.bartleblog/blog.db (deleted)
lrwx------ 1 ralsina users 64 2007-05-13 21:07 2 -> /dev/pts/1
lr-x------ 1 ralsina users 64 2007-05-13 21:07 3 -> /mnt/centos/home/ralsina/Desktop/proyectos/bartleblog/bartleblog/BartleBlog/ui/
lr-x------ 1 ralsina users 64 2007-05-13 21:07 4 -> pipe:[159481]
l-wx------ 1 ralsina users 64 2007-05-13 21:07 5 -> pipe:[159481]
lr-x------ 1 ralsina users 64 2007-05-13 21:07 6 -> pipe:[159482]
l-wx------ 1 ralsina users 64 2007-05-13 21:07 7 -> pipe:[159482]
lr-x------ 1 ralsina users 64 2007-05-13 21:07 8 -> pipe:[159485]
l-wx------ 1 ralsina users 64 2007-05-13 21:07 9 -> pipe:[159485]
[[email protected] fd]# cp 12 /root/db
[[email protected] fd]# ls -l ~/db
-rw-r--r-- 1 root root 3582976 2007-05-13 21:07 /root/db
[[email protected] fd]# sqlitebrowser ~/db
[[email protected] fd]# cp ~/db /home/ralsina/.bartleblog/blog.db

And I got the database back.

If you don't understand how that worked.... here's the explanation:

  • On unix, files are really unlinked (removed from directories) when no process has them open. Even then, the data is not deleted, but finding it is much harder.
  • On /proc/PID you can see the file descriptors each process has open.
  • You can actually copy a file descriptor.

So I went and copied the open file. And got it back. And this blog didn't go away.

So I am lucky! Stupid. But lucky!

2007-05-11 12:01

New Bartleblog Feature: Menu Editor

Took a while to implement, but BartleBlog finally got a functional menu editor:


Right now, it only works with the mootools-based menu gadget, but I will start working on the yahoo menu version in a moment.

The only thing not working is the preview button, because it needs more support on the backend side.

2007-05-08 21:05

Making your QTextBrowser show remote images

It's remarkably easy to turn your QTextBrowser into a limited web browser, at least good enough to show images from the web.

Here's all the code:

from PyQt4 import QtCore,QtGui
import urllib, os, md5

class PBrowser(QtGui.QTextBrowser):
    def loadResource(self, type, name):
        if url.startswith('http://'):
            if not os.path.isdir(dn):
            if not os.path.isfile(fn):
                urllib.urlretrieve(url, fn)
            ret=QtGui.QTextBrowser.loadResource(self, type, QtCore.QUrl(fn))
            ret=QtGui.QTextBrowser.loadResource(self, type, name)
        return ret

And here's bartleblog taking advantage of it:


It even has a primitive cache and everything ;-)

Contents © 2000-2019 Roberto Alsina