Index ¦ Archives ¦ RSS > Tag: en

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!


libwpd-bindings-0.1.0

Estimated read time: 1 minutes

I tried to search back when did I create Java bindings for libwpd - it seems this was the first commit.

First I kept back the source code to get some money for it (there were a customer who seemed to be willing to pay, but then disappeared), then I just abandoned the idea and pushed it to SourceForge.net to some CVS repo, (I even mentioned it in a blog post), which is finally now converted to git.

Long story short, a week ago finally Fridrich released the first version of the code, after about 2.75 years. :)


OSL_TRACE()

Estimated read time: 1 minutes

Background: OSL_TRACE() is an internal LibreOffice macro that is like printf(), but it’s only enabled in debug mode. Without it, you would add a debug printf during development:

printf("debug, foo\n");

then you would comment it out when the code started working,:

//printf("debug, foo\n");

then remove the comment when it breaks again, etc.

In the past, if you built a LibreOffice module, then you executed:

build

inside a module, and in case you wanted debug symbols and such messages you built using:

build debug=t

which increased the debug level to 2 (from 0), where 1 is required for debug symbols, 2 for debug messages. (See the OOo wiki page.)

The recent update, why I’m writing this post: Now this has been changed, and debug=t gives you debug symbols only, but no extra debug output. While this is great in most cases, sometimes you still want the old behaviour to get the debug messages. In that case the solution (as pointed out in the mailing list post) is to use:

build debug=t dbglevel=2

(Hopefully this post will be handy for who missed that post, like I did the first time.)


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. :)


How to split gpx files using gpsbabel

Estimated read time: 2 minutes

I usually just download the gpx track from my GPS and delete the track from device each time I arrive home and I was at some interesting place before. Last week this was not the case, I was at Gyúró two weeks ago, then I borrowed by device, without clearing the log from it.

So the task was easy: I had a timestamp and I had the full log from the device, and I want to split it: before and after a given timestamp. It turned out that I had some log from Oct 28th as well, so I wanted:

  • The log till Oct 28th

  • The log between Nov 5th and 8th

  • The log after 10th.

Luckily the gpsbabel documentation is quite clear in this area (see Example 4.8), I just needed the following commands:

$ gpsbabel -t -i gpx -f in.gpx -x track,stop=20101028 -o gpx -F out1.gpx
$ gpsbabel -t -i gpx -f in.gpx -x track,start=20101105,stop=20101108 -o gpx -F out2.gpx
$ gpsbabel -t -i gpx -f in.gpx -x track,start=20101110 -o gpx -F out3.gpx

Update: two more notes:

  • the stop is exclusive, start is inclusive

  • when using the result in digikam, the camera time zone has to be set to "manual: gmt+0", even if both the gpx result and the camera time is in local time


OpenOffice.org: vmiklos01 CWS integrated

Estimated read time: 1 minutes

Once I was ready with this year’s GSoC work I started to submit it back to OpenOffice.org. Before that was completed, LibreOffice was launched, though I thought if I started working on submitting it to OpenOffice.org as well, I’ll finish it. About 6 weeks later they now integrated (merged) the vmiklos01 CWS (the branch containing my GSoC work) to DEV300, what will became OpenOffice.org 3.4 later.


Google account migration

Estimated read time: 1 minutes

The whole story starts here. The whole conflict is about I had a google account with my vmiklos.hu domain already, but now the google apps account took it over and they asked me to rename the old account to something else.

I joined the early adopter program and I was happy about it, finally I could access Picasa with my google apps account, though I could not make it to picasa.vmiklos.hu or something. But at least I could use it.

Why I’m writing is that now they changed something regarding google groups as well, since I just noticed I can no longer post to the invite-only lists hosted on google groups where I use my personal address… It turns out the trick is to get the old (renamed) address unsubscribed and get the new one subscribed.

I’m not really claiming, since the new state is much more clear, but this unsubscribe + subscribe dance is rather uncomfortable…

Oh, and a related doc link in case you want to use gtalk on your domain as well (for now I decided not to use it).


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! :)


BitlBee 3.0

Estimated read time: 1 minutes

Even if I gave it a quick testing about two weeks ago, now I tried the new Twitter / identi.ca support and I like it a lot. Now messages are not coming from a single user by default, but a separate channel is created, nicks are appearing there, and I can just highlight people to reply to their last tweet or simply type to submit a new one.

And of course my Skype module still works, as Wilmer fixed it up. :)

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