Yay, Yay I Say!

An RPython Extension Module Compiler has finally been released. RPython is fast. RPython is real fast. RPython is a restricted python variant that doesn't have much of the dynamic behaviour that a python programmer is used to. But It's Fast.

The net result is, if you have python code that isn't especially dynamic, but CPU heavy, you can compile it as a RPython extension module, and see it fly. Yay!

'rati tags: ,


First Steps In The Darc

I had an excellent open source experience today, I have been writing test code for work, and have been progressively replacing year old PBP test code with Twill test code.

When I first looked at twill, less than a week ago, I knew it was the successor, to PBP. I knew what to expect, a nice little interface that allowed me to pretend I was a web browser using a commandline interface.

What I expected was to find a source distribution either using Subversion and Trac, or just straight tarballs.

What I didn't expect was to find that it was distributed by a source control system I had heard of, but never used, Darcs. I fell in love with darcs nearly immediately, because of the following documentation found on the twill website:

To propose a change to the lead developer, make the changes and then do a 'send':
darcs record -am "explanation of change"
darcs send -a

I immediately saw the potential of this system. From the very outset, I didn't feel like I often feel with other projects (Not to single anyone out, but I feel this way with TurboGears and SQLObject), where I feel I can make valueable contributions, but the steps are:

  1. Find problem
  2. Fix problem
  3. Prepare patch from local version
  4. Submit bug in bugtracker
  5. Upload prepared patch
  6. Maintain local fix until patch is applied

I should note at this point that my development host's MTA was broken,
and so the darcs changes I sent didn't get sent immediately

  1. Find problem
  2. Fix problem
  3. Commit Change
  4. Submit Change

Awesome! I already have about 7 patches committed to my local copy of twill, 3 have been sent upstream, but the best bit was talking to the author of twill, we had this (abridged, paraphrased) exchange:

Me: I found a bug, you can't deselect checkboxes.
Titus: Dang, I guess my patch yesterday didn't fix it, can you provide a nonworking example?
Me: I've modified the unit tests, and I'm going to send them to you via darcs.
Titus: I'm going to have blog about it if you do that, fair warning ;).
Me: Oi! I wanted to blog about this first!

The point is, I found a problem in the program, and instead of complaining about it and filing a bug and having to have it triaged and wait for someone to look at it. I found a bug and was able to prepare a unit test. The test gets committed, and no one wants to leave a failing unit test in their code. So it'll get fixed. It'll get fixed good.

This is the way Open Source developers can serve their (technical) users. Allow them to skip the bug tracker. To go straight to the repeatable unit tests.

'rati tags: ,


Dear John

Dear Paypal,

I received a phishing scam today, it wasn't any good, but it got through my spam filter. I make a note of passing on phishing scams to those services that are being phished. It's quite simple usually, I think, "who do I tell?" and the answer comes to me immediately! abuse@service.com! Of course. Why not, they'll read the email I got, find the host that's responsible and shut them down.

Well. Not Your Service Apparently Apparently PayPal, instead of clicking Forward, typing abuse@paypal.com and Send. I'm supposed to go to the your paypal website, give you my email address (they already have this), the reason I'm contacting you (as if THAT isn't obvious) and - of all things - I have to log in with my paypal password.

Not just that, but you send me these instructions with a handy link to the paypal website. Telling me to click on the link to take me to your website.

Great going Paypal! Are you trying to encourage phishing?

Yours Truely,
Stupified Customer.

spoof@paypal.com is the correct email address to send phishing mails to. Paypal told me when I logged in to crosscheck my VISA bill against paypal's records.


I Try To Explain This To People

What I have ascertained is not that PCs as we know them lack good design, but that PCs as we know them have hardly any design to speak of. I'm not trying to be insulting. Use a Mac for a week, and we'll talk again.

Penny Arcade! - The Forbidden Fruit

technorati tags:



Q: What is a dialog box called if it doesn't have any buttons?
A: A monolog box.


Views in SQLObject

I've been doing lots of turbogears hacking lately, and one of the things that i've found it necessery to do, is arbitarily complicated queries, without the help of the magic of SQLObject's query building syntax. So I present, the way to implement SQL Views as SQLObject abstracted objects. Views are database specific, and I have only ever tested with postgresql, YMMV, no warranty implied, etc.

This is not a real example, my use-case for a view had left-joins on 6 tables, not just one, but it's a good template to work from. Note that you always have to have an 'id' column come back, and it has to be a valid primary key for the view, otherwise SQLObjet magic blows up.

class SiteSearch(SQLObject):
    name_one = StringCol()
    name_two = StringCol()
    somebool = BoolCol()

    def createTable(cls, ifNotExists=False, createJoinTables=True,
                    createIndexes=True, applyConstraints=True,
        conn = connection or cls._connection
        if ifNotExists and conn.tableExists(cls.sqlmeta.table):

        sql, constraints = cls.createTableSQL()

        # Treat the view like a constraint, only create it
        # after all the other tables have been created.
        return [sql]

    def createTableSQL(cls, createJoinTables=True, createIndexes=True,
        return """CREATE VIEW %s as (
        SELECT table_one.id as id,
               table_one.some_name as name_one,
               table_two.some_name as name_two,
               SOMEFUNC(table_one.foo + table_two.bar) as somebool
            LEFT JOIN table_two ON (table_one.foo_id = table_one.id)
        ) """ % (cls.sqlmeta.table,), []

I hope someone finds that useful. :)