Wiki2beamer 0.8.1 is out

I just released wiki2beamer 0.8.1.

update: sping updated the ebuild for Gentoo, too

Ooops, is this KDE4?

Yes it is…

As KDE4 (4.3.1) went stable on ~amd64 in Gentoo Linux, I accidently pulled it in and compiled it during my last emerge –update world. And as I had it installed I decided to just use it and make the full switch. Although it probably will have some bugs here and there, it seems to be pretty usable and it looks really damned beautifull. That again, comes with price: it’s slow. Interaction with the GUI is a litle bit unresponsive sometimes, but I guess I will get used to that. Most important applications are there and work. Only one important thing is still missing: a fully integrated KNetworkManager for KDE4. So long I’m using the KDE3.5 KNetworkManager, which works fine but looks a bit ugly. A good thing is, that power and display management seems to be integrated more nicely, the important special-buttons worked instantly.
I’m currently working on migrating all of the application-settings to KDE4.

I can see now why the Gentoo people will drop KDE3.5 out of the tree sooner or later. It just doesn’t make alot of sense to maintain something, that upstream doesn’t maintain anymore, or atleast not much.

update: disabling Nepomuk semantic desktop in the control panel (system settings->advanced->desktop search->enable nepomuk semantic desktop, uncheck) seems to increase performance and reduce power consumption.

Besides that, I had some free time at the it-sa security fair (where I gave a talk together with Daniel about our thesis) and coded some new features for wiki2beamer:

  • selective slide compiling: mark a frame with a ! (!==== frametitle ====) to only compile the selected frame to latex. Speeds up compilation times during slide creation and also saves you battery when sitting in the train and making slides ;)
  • shortcut syntax for \vspace and \vspace*: –2em– on a single line creates a vspace of 2em, –*2em– respectively creates a \vspace*
  • shortcut syntax for \uncover and \only: +<2->{content} (uncover) and -<2->{content} (only)

As I once again hacked in the wiki2beamer code, it became clear that the code will become more or less unmaintainable. It’s just a matter of time until the complexity is too high. Wiki2beamer definitly needs a formal parser and syntax.

A.



A. by ~Cleeus on deviantART

Knzlrdll && Schwrmstrm

SPON produziert ja selten wirklich Niveauvolles. So ist auch das hier bestimmt nicht auf der Basis einer handfesten Recherche entstanden. Aber gut isses trotzdem.

Und wo wir schonmal dabei sind: Freier Strom für freie Häcker — Deutschlands Energieversorgung jetzt per GSM kontrollierbar. Wurde in diversen Medien als tolle Erfindung kolportiert.

Why I do, what I do.

Because I’ve been asked.

Here’s what Street Photography is.

Street Photography for the Purist

and a little bit more entertaining:

Street Photography: Documenting the Human Condition — Part I

Street Photography: Documenting the Human Condition — Part II

Street Photography: Documenting the Human Condition — Part III

And it’s not about the Leica thing.

And these documentaries if you still like it:
WNYC Street Shots: Bruce Gilden

WNYC Street Shots: Jake Dobkin

WNYC Street Shots: Sandra Roa

WNYC Street Shots: Jamel Shabazz

WNYC Street Shots: Joe Wigfall

Es ist Herbst.

Gestern das erste mal. Die Sonne hat sich verändert, scheint jetzt gelber, und auch früh morgens riecht die Stadt anders. Achtet mal drauf.

The Future Is Analogue!

Digital is yesterday!

Film has just so much more soul.

Don’t get me wrong, the digital is … certainly better in every way, but … look at this tiny cute thing (LOMO LC-A+):

LOMO LC-A+

Or … my latest love, a russian rangefinder Leica clone, the FED 2d, (built in 1963):

FED 2d Industar 26 M

We need the DSLRs for work, but film is love!


update:

She has a new lens: The Industar 61, 52mm/2.8, said to be one of the finest russian lenses. I had to do some adjustments of the rangefinder to the new lens. I hope I got it all right, only the next roll of BW400CN or NEOPAN400 can tell.

FED 2d Industar 61

music for the unsettled.

www.bassdrive.com

keeps your mind awake.

(via danielkaes.wordpress.com)

Performance Python

As I needed some heavy optimization of some inner loop in an O(n^2) problem, I turned to C extensions for Python this weekend. Well, writing native C extensions for Python (2.x) turned out to be a real mess. The Python C API isn’t something you want to use, which is understandable since Python is a heavily object oriented language where C is only procedural.

But, there are some cool extensions which make calling C code from Python easy. Of all those extensions, I tried out Pyrex.

Pyrex is basically a language that is very similar to Python. It’s so similar, that you can just cut-and-paste most of your Python code into a Pyrex module file (.pyx) (there are some limitations, e.g. no *-comprehension, but these can be fixed easily, most of the time). The next step is to compile the Pyrex Code into C code with the Pyrex compiler and then compile this into shared library with gcc. This shared library can then be imported into Python as a module and the methods can be called.

The fun starts when you a) start calling other native C libraries and b) start writing optimized Pyrex code. Calling native C libraries is pretty easy, most of the time. The Pyrex compiler builds the required code to convert the basic python types into C types. E.g. if you have a C function that want’s a char *p as an argument, you can just assign it with a python str-Object, same goes for int and float.

The second use-case is writing really fast Pyrex code. If you just cut-and-paste Python code, your variables will be complex Python-objects and the C output of the Pyrex compiler contains some really nasty Python-API calls on these. E.g. adding two python variables is anything else then trivial and results in something like this:

add.pyx:

a = 1
b = 2
c = a + b

turns into:

[…snip…]

PyObject *__pyx_1 = 0;
PyObject *__pyx_2 = 0;
PyObject *__pyx_3 = 0;

[..snip…]

/* “/home/kai/add.pyx”:1 */
[…snip (3 nasty lines for value assignment to Python-object)…]

/* “/home/kai/add.pyx”:2 */
[…snip (same here) …]

/* “/home/kai/add.pyx”:3 */
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_a); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
__pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
__pyx_3 = PyNumber_Add(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
Py_DECREF(__pyx_1); __pyx_1 = 0;
Py_DECREF(__pyx_2); __pyx_2 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n_c, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
Py_DECREF(__pyx_3); __pyx_3 = 0;

[…snip…]

This is really nasty and anything else then fast, isn’t it?

BUT! If we tell Pyrex to treat our variables as C integers, it can generate clean C code:


cdef int a
cdef int b
cdef int c
a = 1
b = 2
c = a + b

what we get is:


[…snip…]
static int __pyx_v_3add_a;
static int __pyx_v_3add_b;
static int __pyx_v_3add_c;

[…snip…]
/* “/home/kai/add.pyx”:4 */
__pyx_v_3add_a = 1;

/* “/home/kai/add.pyx”:5 */
__pyx_v_3add_b = 2;

/* “/home/kai/add.pyx”:6 */
__pyx_v_3add_c = (__pyx_v_3add_a + __pyx_v_3add_b);
[…snip…]

And this is just clean C code. The same goes for loops. If you just use your python code, alot of Python-object operations have to be used. But if you use C variables, then Pyrex can create really fast C code and can even do pointer arithmetics. Pyrex allows you to speed up your code where you really need it without all the hassle of using the Python C API.

And my code turned out about five times faster after doing just some minor C adjustments :)

As I mentioned above, there are some other methods of improving Python performance, there is a good overview from the people at SciPy. And before you turn to Python+C, check the Python-performance tips first.

Wiki2beamer 0.8 is out (update)

Some weeks ago, already, I released wiki2beamer 0.8. It’s mostly a maintenance release. It now works again with python 2.4 which makes it easier to run on ancient systems (like our universities ;) ), has a litle bug fixed where “expressions” immediatly following lists were not transformed (so you had to add a newline) and the license was changed to “GPL 2.0 or later” so we don’t get stuck in some copyright problems as time moves on.

I also put the manpage for wiki2beamer online here (via man2html) so google can find it and non-*nix users can read it, too.

I should probably finish my thesis before I start coding at wiki2beamer, but if anyone out here is interested, there still are some things to be done:

  1. Create a Lessig-style slide environment, like the [code]-environment
  2. Split the code into a commandline wiki2beamer frontend and a python module as backend
  3. Write a formal syntax description, so we can create a real parser/compiler instead of these regular expression tricks.
  4. Build distro packages. (Fedora, RedHat, Arch, … anyone? Gentoo already has one. Update: I’ve built a Debian/Ubuntu package now, too. Go get it at SourceForge.)
  5. Build a windows installable package. (?)
  6. Update online documentation.

Also, we finally seem to get users :)
According to the sourceforge download statistics, we had 86 downloads in the last 2 months.

So, add one and head over to get wiki2beamer 0.8.