MW

Tag programming

Recent Posts

Take 2: Download script for springerlink.com Ebooks (March 12, 2010)

NOTE: This script is apparently against the licensing contract between universities and Springer, see: http://www.bib.hm.edu/aktuelles/news/newsdetail_9984.de.html

NOTE 2: I do not maintain this script anymore. Please look for an alternative.

Seems like quite some people are interested in my bash script for downloading ebooks from http://springerlink.com.

That script has some quirks, the greatest of all that it was written in bash which makes it kind of hard to implement new features. And one which was requested was support for books which span multiple pages on SpringerLink.

So here I present springer_download.py - a Python rewrite which should handle all the old links and some more. This is the very first program I’ve written in Python. And since it has to run on the Zedat servers it’s limited to Python 2.4.x without any fancy shmancy additions (a pity, since I’d love to use urlgrabber or pycurl).

continue reading...

Will code for food (December 22, 2009)

Ha, what a bit of a bribe can do to me… Someday earlier today a user of the PHP plugin for KDevelop brought up the flickering issue in it again. Well as I told him: I myself find it very annoying and wanted to fix it since quite some time, but never got around to it… Usually that would be it and I’d go watch some more FamilyGuy until I’m in the mood to track this bugger down. But well, thankfully Phlogi wasn’t so easy to dispatch:

milian: ok… I’ll send you pizza and beer if you fix this!

Hours of gdb sessions later, I finally committed a fix. So Phlogi, if you read this: You owe me ;-)

To all others: If you tried the PHP plugin out and the flickering was too much for you: Give it a try again! I’m personally totally overwhelmed, the difference is huge! I often perceived the PHP plugin to be magnitudes slower than the C++ one. Well, looks like most of this was only due to the flickering. Now things are much smoother.

Happy holidays!

continue reading...

Real FOSS appreciation (December 07, 2009)

So, it’s been roughly a year since my first commit to kdelibs. According to Ohloh it’s been in November 2008. And boy have I learned much in this year. I learned C++ just to be able to contribute to KDE, since I thought it would be awesome to be able to “fix your own itch”. I have to say: It was the best decision I ever made.

I really came to appreciate FOSS in a whole new light: Contributing to a big project like KDE gets you in contact with lots of nice people. And they will help you get things done. What’s better is that in the process you learn lots of things. And I mean lots. I can now use GDB, Valgrind, now my way around some parts of the KDE/Qt API, can investigate performance related questions… And since these are such huge topics, there’s always more to learn, much more!

I doubt someone could learn that much by reading books or writing his own little application without the help of a community. The wealth of possibilities inside KDE will increase your horizon constantly. And there is tons of very good code to study! Want to know why something is not working? Look at the source. Still not helping? Ask your fellow developers. I really have to say it’s an awesome feeling to be part of this big community.

continue reading...

KDevelop & KWrite/Kate hacksprint 2010 in Berlin (November 16, 2009)

Hey everybody!

If you are a KDevelop and/or Kate/Kwrite developer and do not read the mailing lists: There’s a hack sprint coming up in Berlin in 2010. I think there’ve been enough sprints in Berlin already so that you know it’s a great city for such an event. Though this time it won’t be at KDAB or Nokia offices, but at the Physics Faculty of the FU-Berlin. Since I (currently) work there as an IT admin, it was my first choice and worked out. I hope it will be a good location for the meeting. If you want to attend, vote on doodle:

http://www.doodle.com/vkyh9up9794zr4s8

But you probably also should register either on the KDevelop or KWrite mailing lists so I have some kind of way to contact you.

PS: in unrelated news I’ll do an internship at KDAB next year! yay

continue reading...

Kate linter plugin (September 28, 2009)

Just a quicky: I wrote a little plugin for KTextEditor which supplies you with basic error checking when you save documents. Currently only PHP (via php -l) and JavaScript (via JavaScript Lint) are supported.

Screenshots

Requirements

  • usual tools for compiling C++, e.g. gcc.
  • cmake
  • Qt development packages, i.e. under Ubuntu: sudo aptitude install libqt4-dev
  • KDE 4.2 with development packages for kdelibs and kdebase, i.e. under Ubuntu: sudo aptitude install kdebase-dev kdebase-workspace-dev kdelibs5-dev. Note: You’ll need the experimental KDE 4.2 packages activated as of now, see for example the Kubuntu news on KDE 4.2 RC1 for hints.
  • proper setup of environment variables, read this techbase article for more information. the .bashrc linked there should be enough for most people
  • For PHP support: a PHP executable which supports the -l switch for linting
  • For JavaScript support: a JavaScript Lint executable, you could download and compile the sources for example.

continue reading...

KDevelop Hack Sprint (April 02, 2009)

Huzza! The KDevelop Hack Sprint 09 is now official.

Thanks to the huge engagement of Alexander Dymo we will meet from the 19th to 26th April 2009. The meeting will take place at Alexander’s university, the national university of shipbuilding in Odessa Mykolayiv, Ukraine. Thanks to the people there responsible for making this sprint possible by providing us with the premises, internet, power etc.

Since this is my very first Hack Sprint and considering that I only recently started contributing to KDE in general and KDevelop in particular I am very excited. The topics I will plan to hack on include (all related to PHP language support plugin):

  • add auto completion after require(_once) and include(_once), just like it works for #include in CPP
  • add auto completion of PHP statements (think echo, exit, require(_once, include(_once) etc. pp.)
  • add auto completion for build-in PHP keywords
  • fix auto completion of interfaces / classes after the keywords implements and extends (working on that right now)
  • fix KDevplatform and the Generic Plugin Manager to support remote projects, i.e. via fish or ftp (or anything else supported by KIO)

continue reading...

Building KDevplatform, KDevelop and the PHP plugin from Git (March 06, 2009)

In a follow up to my last post about the PHP plugin for KDevelop and Quanta I want to detail how I setup my build environment. Since I’m only working on KDevelop I only want to compile that. For all other applications, I use the packages my distribution makes available. Below you this is possible.

Note: I use Kubuntu and hence some commands like aptitude and the package names etc. will have to be adapted to your specific distribution. But the general idea should be the same and the packages should be called at least somewhat similar. You could always take a look at the techbase article on compilation of KDE 4 to get a more general HowTo.

It is generally a very good idea to read some articles on the techbase. Especially in the Getting Started section.

getting the dependencies

First, you’ll need to install some packages to satisfy dependencies and to get a working compile chain (think cmake, gcc and stuff). The following command only lists very few packages but they have a huge list of dependencies which your package manager will take into account automatically. Don’t be suprised by a possibly huge list of packages ;-) So some disk space will be required (though I doubt it’s more than 250MB in total).

continue reading...

Building KDevplatform, KDevelop and the PHP plugin from Git (March 06, 2009)

In a follow up to my last post about the PHP plugin for KDevelop and Quanta I want to detail how I setup my build environment. Since I’m only working on KDevelop I only want to compile that. For all other applications, I use the packages my distribution makes available. Below you this is possible.

Note: I use Kubuntu and hence some commands like aptitude and the package names etc. will have to be adapted to your specific distribution. But the general idea should be the same and the packages should be called at least somewhat similar. You could always take a look at the techbase article on compilation of KDE 4 to get a more general HowTo.

It is generally a very good idea to read some articles on the techbase. Especially in the Getting Started section.

getting the dependencies

First, you’ll need to install some packages to satisfy dependencies and to get a working compile chain (think cmake, gcc and stuff). The following command only lists very few packages but they have a huge list of dependencies which your package manager will take into account automatically. Don’t be suprised by a possibly huge list of packages ;-) So some disk space will be required (though I doubt it’s more than 250MB in total).

continue reading...

PHP support for KDevelop 4 (and eventually Quanta+) (March 03, 2009)

Hello Planet KDE!

I want to give you a little insight on the current state of PHP support in KDevelop4:

Me and Nikolaus Sams (nsams) are working diligently on a plugin for PHP support in playground. It’s somewhat stable, i.e. we fix any crashes we stumble upon, but I would call it Alpha state at most. It may eat your babies so to speak. Yet I’m happy to say that at least one user is already using it for production (hi leinir ;-) ).

implemented PHP support

Well, here’s a (not complete) list of features that are already working. Though I have to warn you: no screenshots included ;-) It’s actually all very similar to the C++ screenies you can see on the web.

sematic highlighting

Let’s start with a feature that only very recently was added for PHP - semantic highlighting. Niko moved some language independent parts of the C++ plugin from KDevelop to KDevplatform and now PHP has the same code highlighting features as C++.

continue reading...

profile.class.php (June 24, 2008)

Every now and then I want to profile a given part of PHP code. For example I want to quickly check wether my current changeset to GeSHi works faster or is horribly slower. For a big change I’ll stick to Xdebug and KCachegrind. But for a quick overview? Overkill in my eyes.

Say hello to profile.class.php, a simple timer class for PHP5 which you can use to get an overview about where how much time is spent. This is in no way a scientific method nor should you take the results of a single run as a basis for you decisions.

I’ve set an emphasize on an easy API so you don’t have to pollute your code with arbitrary hoops and whistles.

UPDATE: You can find the current updated source in the SVN repo of GeSHi.

Simple example

This is a quick example on how you could use the class:

    <?php
    require 'profile.class.php'; // should be obvious ;-)
     
    // here might be uninteresting code
     
    profile::start('overall'); // start a timer and give it a name
                                       // we add this one to get a time
                                       // for the overall runtime
     
    // this is the code you want to profile
    profile::start('$_SERVER');
    $foo = count($_SERVER);
    profile::stop(); // stop the last active counter
     
    profile::start('$GLOBALS');
    $bar = count($GLOBALS);
    profile::stop();
     
     
    profile::stop(); // stop overall timer
    profile::print_results(profile::flush()); // print the results

continue reading...