How to Dynamically Discover & Create Classes in Python

ye olde Python logo

Or reasons why Python is cool #273.

There are many snippets of code on the internet detailing how to go about dynamic class creation when the compiler (and thus, you the programmer) knows the name and module location of the class some time in advance, e.g. initial deploy time or via some parameter being entered in by the user when they want to instantiate such a class.

However if I want to create objects without knowing their module/class in advance a little bit more thinking is required. Here is a simple tutorial that will leave you with a package that when updated with new modules will introspect & instantiate their classes on demand. Continue reading ‘How to Dynamically Discover & Create Classes in Python’

Deploying Updates from Windows Dev Box to Linux Server

I develop on my local Windows 7 (or XP netbook when out of town) and to test/deploy projects I need to send them to my Gentoo Linux server. While manual copying of files quickly becomes a pain in the arse a fully fledged continuous integration environment is needlessly complex for a single programmer project so I created the following batch script that once run checks my windows folders for new & updated files since the last time the script was run then sends them across the ether using scp1.

The script has been tested on XP & 7 successfully.

For the linux side of things I run a python paster instance with the —reload flag that means paster will pickup changes and restart automatically, making deployment from my windows box a single click action.

Initially I started out a little rusty in my command line knowledge Continue reading ‘Deploying Updates from Windows Dev Box to Linux Server’

First Impressions on Dropping ICT/Gaining Programming

Dropping the old ICT curriculum with it’s much maligned emphasis on M$ Office is a brave move by education minister Michael Gove. It could be argued that from purely a learning point of view this one action is more important than any of the recent decisions on increasing education cost. Sending children back to where it all began – the formulation of grammars and statements thereof into machine-readable instructions that produce new computing tasks rather than just learn old ones by rote – is in many ways fundamental to getting a British engineering discipline back on track.

But it’s easy to get carried away here. Continue reading ‘First Impressions on Dropping ICT/Gaining Programming’

2011: Marking 10 Years of Evolution in Evil Lair Design

circa. 2001
Evil Lair circa. 2001

2011
Evil Lair 2011

Fiscal Union Probably Means an End to Irish Republic’s USP

This Friday on the anniversary of the Maastricht Treaty draft and amid a likely worsening economic outlook (Eurozone GDP out Tuesday) the EZ economies should announce moves to rein in the spending of the southern European states & complement this with a plan to harmonise fiscal policy. This will mean among other things bringing tax rates in peripheral nation states into line with eurozone leaders France & Germany.

Continue reading ‘Fiscal Union Probably Means an End to Irish Republic’s USP’

In Defence of Ideas

concentrate on the ideas

An insightful blog post1 the other day railed against having lots of ideas and emphasised the need to stay on track, to concentrate on execution of The Big Idea. Here’s the other side of that argument.

There are many economic activities in which the rapid generation of ideas is a must have – take trading as one example. This is purely the game of projecting your ideas for where the market is going onto what is happening in reality. And just as you must see both sides of the trade as they say, so too do you need to foresee multiple scenarios ahead in order to understand all potential market movement. Because how it gets to the projected end result is just as important as when/if it gets there. Multiple & even contradictory ideas are the lifeblood then on which trading activity is based.

Continue reading ‘In Defence of Ideas’

Leaving Vilnius

Last time round. The blur matches the state of my inebriation.

The urban sprawl is rapidly outpacing the idyllic rural lifestyle it engulfs at the city limits – a man & his wife tend to their vegetable field against a backdrop of high rise apartment blocks. The buildings are new, but retain a drabness that is subtly Soviet. Elsewhere the other chief external influence on modern Baltic architecture is evident – Scandinavian ‘box’ living spaces with their dark wooded veneers & pastel green panelling.

Modern Warfare…

Less

More

The Waiting Game

Modern Warfare 3 – ONN from kenny yuan on Vimeo.

It was the largest roll of notes I’d ever seen. 3 grand in fifty pound notes. The guy who hauled it out did so as if it were a rolled up copy of the Sun. One night on sentry I had a conversation with another guy on how his law exams were going. Another evening those of us new to the unit went through a joining process at the end of which we were judged by our peers as suitable to serve alongside them.

The side effect of leaving us in a state of complete physical incapability as we crawled into our pits in the early morning was only a minor talking point, getting up the next day for annual fitness tests just another non event none of us stopped to think about for a second. No one failed.

No one ever fails.

Continue reading ‘The Waiting Game’

Netbook Upgrading & Housekeeping

I’m a longtime fan of netbooks over other mobile tech gadgets, finding their versatility an important stepchange in the prior arms race for increasingly powerful ‘portables’ that weigh a metric ton and need their own special carrying case, or mobiles with a preposterous array of unusable functions.

May have missed the hackathon at QUB but I’ve still managed to do a bit of hardware related fiddling with this guide on boosting my 4211′s performance & removing a niggle.

Continue reading ‘Netbook Upgrading & Housekeeping’