Index ¦ Archives ¦ RSS > Category: hacking ¦ RSS

TDF Interview

Estimated read time: 1 minutes

The Document Foundation guys made an interview with me. In case you find out there something new about me, happy reading!


LibreOffice comment finder

Estimated read time: 1 minutes

So I wrote a short script to find undocumented classes in the LibreOffice source code - I don’t mean when some of the public methods are not documented, but the case when the class itself doesn’t even have a one-liner mission statement.

Of course it should be used with care - if someone starts adding bullshit or misleading documentation using this script, that just makes the situation even worse.

The patch generated a nice thread where basically they argue if it makes sense to have a KDE-like API documentation for LibreOffice or it’s just better to refactor code to have self-documenting function names, etc.

At the end of the they, looks like there are people who find it great. :) (In the meantime that patch has been pushed, of course.)


Poor man's PDF duplex printing

Estimated read time: 2 minutes

Yesterday I wanted to print a PDF document: two pages per sheet, and of course I wanted duplex printing as well (on the short side).

Given that the hardware (the printer) was not capable of duplex printing, I needed some software workaround. If you want one page per sheet, this is trivial, as the print dialog of any PDF reader will let you select "odd pages", then you re-feed the printer with the output paper and you select "even pages" and that’s it.

OTOH, if you want 2 pages per sheet, then first you need some trick first to create two PDF from the original: the first containing the pages 1, 2, 5, 6, etc. - and the other containing 3, 4, 7, 8, etc.

After all this isn’t really hard using pdftk. First, the input PDF was around 150 pages, so I wanted to split the input to one file / page:

pdftk in.pdf burst output out/%03d.pdf

Then let’s move the pages to the subdirs a or b, based on the above pattern:

cd out
mkdir a b
for i in *.pdf
do
        base=$(basename $i .pdf)
        if [ $base -lt 100 ]; then
                rem=$(($(echo $i|sed 's/^0\+\(.*\)\.pdf/\1/')%4))
        else
                rem=$(($base%4))
        fi
        if [ "$rem" = 1 -o "$rem" = 2 ]; then
                mv $i a
        else
                mv $i b
        fi
done

Finally concat the files from the a and the b dir to a single file:

cd a
pdftk *.pdf cat output ../a.pdf
cd ../b
pdftk *.pdf cat output ../b.pdf

That’s it!


Rejourn: Using an unpatched version

Estimated read time: 1 minutes

One may have noticed that right now my rejourn tree is empty. That’s not an accident, after Ram accepted my 15th patch, finally the site runs an unpatched version of rejourn - of course with a custom config and design.

Of course I still have a few ideas on what to improve, so this is not the end of the story, but still - I’m happy he was so open for changes and new features that we reached this post. :)


German comment finder mentioned on LWN

Estimated read time: 1 minutes

So we had this script with Jonas, and the current news about it is that it’s mentioned by in this LWN article. I just innocently read the article and noticed:

After ten years, the code still has over 100,000 lines of German-language comments; those are now being targeted with the help of a script which repurposes the built-in language-guessing code which is part of the spelling checker.

— LPC: Michael Meeks on LibreOffice and code ownership

Nice! :)


Handy Latex bookmarks

Estimated read time: 1 minutes

Today I had some Hungarian mathematical logic notes to type in Latex, and again I had to dig up the various references to get the proper symbols I needed.

I used the following pages:


QtSql vs. SQLite

Estimated read time: 1 minutes

The problem was the following: I had this example code and the size() method just gave me insane result all the time, while just changing the driver to QMYSQL made the code work properly. After asking on #qt, I have been pointed out that the SQLite backend of QtSql does not support the size() method. :/

So - for now - I’ll just use MySql for my unit tests, even if that means I have to manually truncate the contents of each table. Worths checking a bit later again, though - since I already used in-memory SQLite for my unit tests when I had a project in PHP with Doctrine, and it was working just fine.


Rejourn

Estimated read time: 2 minutes

The story is old, it was exactly 3 years ago when last time I switched the engine under my blog. That time I switched from my custom php/mysql blog to b2evolution, and I hoped that using that engine it’ll require less time to manage it. Actually this wasn’t true:

  • When the php-5.3 upgrade came, I had to manually fix stuff.

  • I got a lot of spam, even if the captcha provided by the ready-to-use b2evo plugin was enabled.

  • The last thing: It turned out that it created the SQL schema in latin2, so utf8 comments had problems.

At that point I had enough trouble to think about migrating away from b2evo. And then I found rejourn, which is quite close to what I think is ideal to me. I just changed it a bit:

  • Added asciidoc support next to markdown.

  • Added RSS support, as my blog is part of the Frugalware and the LibreOffice planet, and I didn’t want to lose those readers.

  • Added support for tags, so that I can have a feed with a given tag only (to avoid OT posts on planets).

Before you ask: yes, I plan to submit back these feature to rejourn, if Ram accepts them. ;)

And finally, some more benefits:

  • the whole blog is now static HTML, generated by a single Makefile (so it’s faster + the server load is lower)

  • I can blog while I’m offline then later just git push the result.

  • I no longer have to use WYSIWYG editors or write HTML manually, I can use asciidoc. :)

Update: I forgot to mention:

  • I put up a simple b2evo → rejourn conversion script.

  • I just discovered that when I get email about new comments, I can reply via email as well - that’s really cool! :)


CSS Validator HTTPS support

Estimated read time: 1 minutes

Did you ever notice the CSS Validator does not support HTTPS? I sent two patches (ant dependencies fix, SSL Host verifier fix) to its devel list a while ago and they are now in CVS, hopefully they will soon upgrade their service as well. :)

vDSL

Estimated read time: 1 minutes

Time to say bye-bye to adsl!

The optical fiber is now only 260 meters away and that means it's possible to order vDSL here.

That means that means that the average download speed is now about 14MBit/s while it was about 5MBit/s with adsl. :)

Completely unrelated: if you use ps2pdf and the margins a screwed up, don't forget to give -sPAPERSIZE=a4 a try.

© Miklos Vajna. Built using Pelican. Theme by Giulio Fidente on github.