rotated text in reportlabs

Nikolaus Gradwohl2009-04-09T10:09:00+02:00

if you want to make a great chart like the one below in reportlab, you need rotated text. it isn't very complicated - its just a bit hard to find som examples on the net.

the canvas in reportlab has a saveState and a restoreState method, and supports rotate and translate similar to openGL or processing. see the code example below who it is done.

chart with rotated lables

read more ...

using the BlenderGameEngine as OSC client

Nikolaus Gradwohl2009-03-08T15:18:00+01:00

i just managed to use the GameEngine of blender as a client for OSC events :-)

now i can change the color of a cube by sending osc events from my pd-patch or the ruby-script i wrote for my openframeworks-demo

bge-cube.png

the blend file can be downloaded here

the blend file needs OSC.py by Daniel W. Holth to be in the python searchpath, so either copy it to location you start blender form or copy it to your site-package folder (obviously i'm not the only one who had the idea of using this lib with the blender game engine :-] )

read more ...

very simple OSC debug tool

Nikolaus Gradwohl2009-03-06T08:09:00+01:00

when playing with OSC and i'm not quite sure what osc messages get send by an application i use a little python script which uses the simple OSC api

import osc
osc.init()
osc.listen( "127.0.0.1", 1234 )

in fact it misuses the library ;-)

every time a message is received that isn't bound by a callback function (which is all messages, since we dont bind anything here ), the listener prints a waring containing the address, the format and the value of the message

read more ...

What's new in Python 3.0

Nikolaus Gradwohl2009-02-09T18:48:00+01:00

i have played a bit with python3.0 and this are the things that catched my eye:

  • the new print syntax
  • the exception-handling
  • decorators
  • the new io module
  • classes in python

are no complete list of changes between 2.5 and 3.0 - and don't want to be. they are just a list of thing's i noticed. Some of them are already present in python 2.6 but i newver used that release - so i don't realy know.

read more ...

flying with python3.0

Nikolaus Gradwohl2009-01-16T18:48:00+01:00

I recently installed python3. While scanning through the module directory a package named "antigravity" catched my eye.

when i typed "import antigravity" python opend a browser-window with this link

i really like python - and xkcd :-)

read more ...

Disco

Nikolaus Gradwohl2008-09-22T07:45:00+02:00

I recently read about disco a implementation of the map-reduce algorithm using erlang for the master node and the workload management and python for the map-reduce jobs. Its realy funny that the nokia research labs implemented an algorithm introduced by google using a language developed by erricsson :-)

its a bit complicated to install, but once running its realy fun to code with

read more ...

ReportLab Test

Nikolaus Gradwohl2008-09-10T09:03:00+02:00

I just have tested reportlab a python-framework for pdf generation.

from reportlab.pdfgen import canvas
from reportlab.lib.units import cm


c = canvas.Canvas("hello.pdf")

c.drawString(2*cm,28*cm,"Hello World")

c.line( 2*cm, 26*cm, 2*cm, 16*cm)
c.line( 2*cm, 16*cm, 12*cm, 16*cm )

c.setFillColorRGB( 0, 0, 1 )
c.rect( 2.5*cm, 16*cm, 1.5*cm, 7*cm, fill = 1 )
c.setFillColorRGB( 0, 1, 0 )
c.rect( 4.5*cm, 16*cm, 1.5*cm, 6*cm, fill = 1 )
c.setFillColorRGB( 1, 0, 0 )
c.rect( 6.5*cm, 16*cm, 1.5*cm, 8*cm, fill = 1 )

c.showPage()
c.save()

this little script generates a pdf containing 'hello world' and a simple bar-chart. i think i will give it a try if i have to generate pdf-reports the next time

read more ...

Multicard setup with freevo

Nikolaus Gradwohl2008-01-15T07:07:00+01:00

I'm using freevo for my vdr and like it very much. Recently in austria terestrial analog tv has bin turned off and everyone had to switch to DVB. So our block got a big Satelite-Receiver and a box that transcodes the DBV-S signal to DBV-C. and i hat to put a DVB-C card in my freevo box ...

to "make the hunt more interessting (shirkan - the jungle-book)" some of the channels still come over analog-tv. freevo handles mulit-card setups very well, but only if the cards are the same type. So i had to patch it a little to support my setup where some channels have to be recorded and viewed from one card and some from the other.

i extended the 'VideoGroup' class by a "vcr_cmd" member, and wrote a little record-pluin that sets the command depending on the channel description

VIDEO_GROUPS = [
    VideoGroup(vdev='/dev/video0',
            adev=None,
            input_type='tuner',
            input_num=0,
            tuner_norm='pal',
            tuner_chanlist='europe-west',
            desc='Default Video Group',
            group_type='ivtv',
            record_group=None,
            vcr_cmd='/usr/local/bin/ivtv-record.py %(filename)s %(channel)s %(seconds)s',
      ),
    VideoGroup(
            vdev='/dev/video0',
            adev=None,
            input_type='tuner',
            input_num=0,
            desc='DVB Viewer',
            group_type='dvb',
            record_group=None,
            vcr_cmd = 'mencoder -oac copy -ovc copy -o %(filename)s -dvbin card=1
                            "dvb://%(channel)s" -endpos %(seconds)s'
      )
    ]

ivtv-record is a small script i have written because i cant use the ivtv plugin anymore (it doesnt use the cmd variables). my record-plugin is a extenion to the "generic-record.py" where i changed the line 'self.rec_command = config.VCR_CMD % cl_options' to 'self.rec_command = vg.vcr_cmd % cl_options'

read more ...