Archive for May, 2007

PyCentral broken?

May 31st, 2007
INFO: using old version '/usr/bin/python2.4'
Traceback (most recent call last):
  File "/usr/bin/pycentral", line 1348, in <module>
    main()
  File "/usr/bin/pycentral", line 1342, in main
    rv = action.run(global_options)
  File "/usr/bin/pycentral", line 1077, in run
    pkg.update_bytecode_files(runtimes, default_rt, bc_option)
  File "/usr/bin/pycentral", line 714, in update_bytecode_files
    self.default_runtime.byte_compile(self.private_files,
AttributeError: 'NoneType' object has no attribute 'byte_compile'

This will fix it:

root@volverine:/usr/bin# rm python && ln -sf python2.5 /usr/bin/python

pycentral doesn’t like absolute links.

JavaScript 1.8

Wohoo. John Resig about JavaScript 1.8. Some of the new things are on my wishlist for quite a long time :-)

New Stuff in Perl 6

Here some nice blog posts by Austin Seipp about new things in Perl 6: #1 and #2.

Polymorphic Associations with SQLAlchemy

zzeeek explains how to create rails like polymorphic associations with SQLAlchemy. Well done!

G8 Gipfel in Genua

G8 Gipfel in Genua 2001 — ohne Worte.

Pygments 0.8 Maikäfer Released

May 30th, 2007

The new version of Pygments 0.8 aka Maikäfter is out now. Changes in this release:

  • Lexers added:
    • Haskell, thanks to Adam Blinkinsop
    • Redcode, thanks to Adam Blinkinsop
    • D, thanks to Kirk McDonald
    • MuPad, thanks to Christopher Creutzig
    • MiniD, thanks to Jarrett Billingsley
    • Vim Script, by Tim Hatch
  • The HTML formatter now has a second line-numbers mode in which it will just integrate the numbers in the same <pre> tag as the code.
  • The CSharpLexer now is Unicode-aware, which means that it has an option that can be set so that it correctly lexes Unicode identifiers allowed by the C# specs.
  • Added a RaiseOnErrorTokenFilter that raises an exception when the lexer generates an error token, and a VisibleWhitespaceFilter that converts whitespace (spaces, tabs, newlines) into visible characters.
  • Fixed the do_insertions() helper function to yield correct indices.
  • The ReST lexer now automatically highlights source code blocks in .. sourcecode:: language and .. code:: language directive blocks.
  • Improved the default style (thanks to Tiberius Teng). The old default is still available as the "emacs" style (which was an alias before).
  • The get_style_defs method of HTML formatters now uses the cssclass option as the default selector if it was given.
  • Improved the ReST and Bash lexers a bit.
  • and again improved highlighting and fixed some bugs

Get it while it’s hot from the cheeseshop.

Pygments in Wordpress

May 30th, 2007

I wanted to have pygments support in wordpress and so I hacked up a small wordpress plugin that enables pygments support in wordpress. Because I was lazy and PHP sucks like hell I just supported the case of a php.ini with magic slashes disabled. Somehow wordpress reinserts some of those annoying things automatically in some places though.

If you want to try it out: pygments.php. Note that I do not support it, it’s released under the BSD license like Pygments itself, it requires an installed pygments with the pygmentize script, no idea which PHP version, disabled magic quotes I guess and that you generate a pygments.css file yourself that matches the style defined in the plugin.

It caches in the text, and has few overhead on rendering Basically all you have to do is typing <pre lang="LANGUAGE">code</pre> instead of using a normal pre tag. Escaping happens automatically.

Example:

# Server: ruby p2p.rb password server server-uri merge-servers
# Sample: ruby p2p.rb foobar server druby://localhost:1337 druby://foo.bar:1337
# Client: ruby p2p.rb password client server-uri download-pattern
# Sample: ruby p2p.rb foobar client druby://localhost:1337 *.rb
require'drb';F,D,C,P,M,U,*O=File,Class,Dir,*ARGV;def s(p)F.split(p[/[^|].*/])[-1
]end;def c(u);DRbObject.new((),u)end;def x(u)[P,u].hash;end;M=="client"&&c(U).f(
x(U)).each{|n|p,c=x(n),c(n);(c.f(p,O[0],0).map{|f|s f}-D["*"]).each{|f|F.open(f,
"w"){|o|o<<c.f(p,f,1)}}}||(DRb.start_service U,C.new{def f(c,a=[],t=2)c==x(U)&&(
t==0&&D[s(a)]||t==1&&F.read(s(a))||p(a))end;def y()(p(U)+p).each{|u|c(u).f(x(u),
p(U))rescue()};self;end;private;def p(x=[]);O.push(*x).uniq!;O;end}.new.y;sleep)

Wie funktioniert Geld?

Nettes und amüsantes Video über das Geldsystem. #1, #2, and #3.

Pygments GTK Rendering

May 30th, 2007

I found in Pete Savage’s blog and entry about using GtkSourceView in pygtk. The new version of GtkSourceView absolutely rocks, the old one does not because the ruby highlighter and more complex stuff simply does not work because the library is somewhat limited.

As a proof of concept I tried to integrate pygments into a pygtk window and it worked :-) Of course it doesn’t allow realtime updating thus it’s impossible to use it as editor component (at least for now) but it makes a good source view.

You can find the sources here: gtkpygments.py

__loader__ support in django

Totally missed that, but someone applied my django patch for the debug system. With django [5051] onwards it’s possible to debug Jinja and eggs in django :-)

cogitations driven by wordpress