Monday, June 01, 2009

Okular, PDF and file permissions

There seems to be some controversy about how Okular handles file permissions (sometimes called DRM) in PDF files. I will put here my personal opinions (weird i have to say this since this is *my* blog so when i write here it's always *my* personal opinion).

As a note for those that don't know me much, i was KPDF maintainer from 2004 or so till it's death, mentored the SoC project that created Okular, a regular Okular developer and i'm also the maintainer of poppler since a few time ago, so well, i think we'll agree i know what i'm talking about ;-)

Let's analize the bug-reporter sentence:

"So what I want to know is: why are people putting code into Debian
that limits our freedom? Why are people putting such code into KDE?"

So he wants to KNOW why *we* did this, yet he mails Debian bug tracker. First weird thing man, we have the okular irc channel, the okular mailing list and the kde bug tracker, all this are MUCH BETTER places for knowing.

First question:
"why are people putting code into Debian that limits our freedom?"
is very similar to
"why is people coding in GPL that that limits our freedom?" from the BSD fanboys. It all boils down to your freedom ends where other people freedom starts. And someone freely decided he doesn't want you to copy his PDF, you may hate him for that, but it is his freedom, *his* license, and we all like people respecting our license (GPL) so we should respect others, or are we just going to respect licenses we like?

Second question:
"Why are people putting such code into KDE?"
because it's what the PDF specification says and we want to have a PDF reader, don't we?

Now, there's even a LWN article talking about it (sorry folks, you have to pay them to read that unresearched article), but i'll quote here a small part (under the fair quotation law i hope)

Applications which do implement this "feature" tend to disable it by default.

he means evince has it disabled by default and okular enabled by default? I don't see a "tend to" here

Perhaps this behavior is result of the relative newness of this application; as it accumulates more users, the pressure for more user-friendly behavior is likely to grow.


KPDF had the exact very same behaviour since 2005. And well, if Okular is not called KPDF in KDE 4 it's just because we decided to support more formats but for the rest it's the same program.

Linux, at all levels, has felt free to ignore standards when following them makes no sense.

Repeat with me Okular is not Linux, Okular is KDE, Okular runs in Linux, Okular runs in Solaris, Okular runs in FreeBSD, Okular runs in Windows, Okular runs in Mac OS X.

And now my final words. I hate DRM, i don't buy DRM enabled things (or try as hard as i can not to) BUT KDE is not the place to protest about that. The place to protest against that is with your wallet (don't buy DRM'ed things), with your vote (don't vote politicians that pass pro-DRM laws) or even in the streets in demonstrations.

Friday, May 29, 2009

A day in scam land

So i'm looking for two tickets for FIB now that tickets are sold out.

One goes to google and finds three announcements on craigslist, price is okaish so you contact the posters ... and all you get are scammers.

The first one says "please provide me this details asap so i can start this transaction asap through craigslist they will contact you", a mention to craigslist itself, this must be safe for sure, but then you go to craigslist and see a page that explicitly says that they don't handle transactions at all. The announcer does not answer back once i point her to this page.

The second and third announcements end up being from the same mail address, interesting as one announcement is from Barcelona and the other from London, one asks 400€ and other 380£. The poster says he is not able to meet me and Barcelona and neither an hypothetic friend of mine in London because "he works all day" (though answers my mails in 5 minutes). I ask him to post pictures of the tickets with a newspaper of today or the very same mail i just send and he just sends pictures of the tickets themselves. More over he says we'll do the transaction via "Ebay and Square Trade". If you look at Square Trade, they are not a transaction company at all either, seems someone is using their name to scam gullible people.

So basically it seems that yeah, the prices they were selling the tickets were "too low" and are just a honey pot to scam people.

I hate how the world is full of people that don't any respect for others at all. Meh :-/

Thursday, May 28, 2009

Your talk in Akademy-es 2009

You may that we are celebrating Akademy-es 2009 inside GCDS. If you did not know you do now ;-)

So if you think you have something to say to the Spanish community that will gather there do not hesitate to read the call for activities and submit one before the 8 of June!

We are waiting for them ;-)

Tuesday, May 19, 2009

Buenos Presagios (Good Omens)

So yesterday i finished reading Buenos Presagios the translation of Good Omens by Terry Pratchett and Neil Gaiman, a book written in 1990 and that has the Spanish first edition on ... April 2009 ... it's intriguing how some editorials decide to translate not so great books asap and better ones are left on the dust for almost 20 years.

And now onto the book, it's my first Gaiman book, but my n-th Pratchett one and i have to say it lives to the expectation.

It's a novel about the end of the world because of the Armageddon, the coming of the Antichrist, with the Four Horsemen of the Apocalypse, a witch that did 300 years of exact predictions and an earth-living Angel and Demon that prefer to work together instead of for their far away bosses. All that mixed with the great humour that Pratchett gives to all his books, will have to read some Gaiman to see if it's good too (Just saw he's the writter of Stardust, i haven't read the book but the movie was entertaining). The only thing i did not like much is that book ending is a bit weak in my opinion, but otherwise a very recommended book.

Monday, May 11, 2009

Poppler 0.11.0 (0.12 Alpha 1) released

Available from
http://poppler.freedesktop.org/poppler-0.11.0.tar.gz

WARNING: This is a unstable release, it is actually 0.12 Alpha 1 release, it should work like any release from the 0.10 branch, but do not blame us if it turns the sea into Coke.

Changes against the 0.10 branch:
core:
* Add initial support for color management
* Remove case-insensitive matching of filenames in PDFDoc constructor
* Fix extraction of some ActualText content
* More work on Annotations support
* Improve font rendering in Cairo output device
* Fix bug in cairo backend with nested masks
* Fix cairo luminosity smask rendering
* Add optionally text support to Cairo output device
* Add the possibility of setting the datadir on runtime
* Return an error code instead of a boolean when saving
* Make the font scanner more versatile
* Small opimization in documents that use PostScriptFunction
* Minor optimization to Stream handling
* Fix some compile warnings

glib:
* Optional content support
* More work on Annotations support
* Improvements to the demo
* Documentation improvements
* Fix build when compiling with GTK_DISABLE_SINGLE_INCLUDES

Qt4:
* Support URI actions for Table Of Contents items
* Documentation improvements
* Improvements to the demo
* Add a FontIterator for iterating through the fonts of the document

utils:
* Allow the use of cropbox in pdftoppm
* Make pdftohtml output png images when the image is not a jpeg
* Make pdftotext accept cropping options like pdftoppm
* Support rendering non-square pixels in pdftoppm

build system:
* Require Cairo 1.8.4 for the Cairo output device
* Require CMake 2.6 when using the CMake build system
* Optionally require libpng for pdftohtml
* Optionally require libcms for color management


Testing, patches and bug reports welcome.

Thursday, April 30, 2009

i18n as second citizen in KDE

Sadly it seems that i18n (short for internationalization), that is, making your program available for non english speakers is a second citizen between KDE developers.

Programmers are treating bugs reported against i18n as non critical when effectively they are making their program unavailable for lots of users.

You may think this is a personal perception, but let's mention some examples:
* Plasma: Category names ("Application Launchers", "Astronomy") in the drop down box of the "Add Widget" dialog are untranslatable. Plasma developers excuse themselves saying i18n is not their best aptitude
* Places names are set after first use and don't follow the user locale https://bugs.kde.org/show_bug.cgi?id=177536
* KMail view names have a similar problem, can't find the bug number right now
* Places names for devices are not translatable http://lists.kde.org/?t=123937583500004&r=1&w=2
* Amarok: Items in the playlist layout editor are not translated https://bugs.kde.org/show_bug.cgi?id=189750
* Amarok: Default layout names are not translatable https://bugs.kde.org/show_bug.cgi?id=189751

These are just some examples, don't feel finger pointed if your app is here.

You'll notice that some of this bugs/reports have patches or suggestions on how to fix it, yet nothing has been done to fix them.

So please, don't treat i18n as second citizen, you *really* don't want to alienate so much users from your program.

Wednesday, April 29, 2009

Fix for broken hplip in Jaunty upgraded from Intrepid

If hp-toolbox fails to start for you with

Traceback (most recent call last):
File "/usr/bin/hp-toolbox", line 246, in
from ui4.devmgr5 import DevMgr5
File "/usr/share/hplip/ui4/devmgr5.py", line 45, in
from dbus.mainloop.qt import DBusQtMainLoop
ImportError: No module named qt

The solution is purging and reinstalling the python-qt4-dbus package

Tuesday, April 21, 2009

Book reviews

This week is Saint George's Day and in Catalonia it's typical to buy/gift books so i'm commenting over the fours last books i've read.

El Códice de la Atántida (Decipher) by Stel Pavlov: A Science Fiction book that carries the tag "Best Seller in USA and Italy". Well, i'm not going to comment on these countries taste for books, but this is a book you should avoid, it's a mix of Atlants, nanobots, armies, earth to be destroyed, misc adventures and all, but at the end i just had no interest for keep reading another page, and i just finished the book because it's what i do will all books.

Los hombres que no amaban a las mujeres (The Girl with the Dragon Tattoo) by Stieg Larsson: A noir novel, you should read it if you are not scared of a book were some pages talk about crimes on women being killed by cutting their head and putting it on the fire. It's a book i got addicted fast and could not stop reading it until the end. It features kidnaped girls, assassins, investigators and more important Lisbeth Salander, best good-evil character since Wolverine.

La chica que soñaba con una cerilla y un bidón de gasolina (The Girl Who Played with Fire) by Stieg Larsson: Second part of The Girl with the Dragon Tattoo. You'll have to read it after reading the first one, the story is less macabre than in the first book but as vibrating as the first one and involves some "I'm your father" Star Wars-like scenes that even feature everywhere still impacts the reader.

La verdad (The Truth) by Terry Pratchett: It's for sure not the best Discworld novel, but still worth a read, Pratchett can create jokes from almost everything, and newspapers are not going to be an excempion. In this novel a new character is introducted William de Worde that will try to do real journalism and investigate the charges of embezzlement and attempted murder against Lord Vetinari.

So all in all, don't buy Decipher, read Stieg Larsson books if you like noir novels and The Truth is just another Discworld novel, so it's of course worth a read.

P.S: Stieg Larsson books since to have a much more catchier name in Spanish than in English, wonder which is more closed to the original swedish though.

Saturday, April 11, 2009

How to make foreach loops that don't suck

Calling values in Hashes/Maps/Sets

QHash<QString,Plasma::Meter*> meters;
foreach (Plasma::Meter *w, meters.values()) {
  w->setLabelColor(0, theme->color(Plasma::Theme::TextColor));
}


This code is iterating over the values of a hash and doing something over them. Everything seems ok, but it's not, it's calling values() on the hash and that's causing the creation of a temporary list with all the values of the list, effectively causing a bigger memory usage and iterating over the list twice (one to get the values and other to do something over them).

You can write something that does the same without these two problems doing

QHash<QString,Plasma::Meter*> meters;
foreach (Plasma::Meter *w, meters) {
  w->setLabelColor(0, theme->color(Plasma::Theme::TextColor));
}


So if you are using values() in a foreach, just remove it and your code will be instantaneously faster.

Calling keys in Hashes/Maps


QHash<QString,Plasma::SignalPlotter*> plotters;
foreach (const QString& key, plotters.keys()) {
  plotters.value(key)->setShowLabels(detail == SM::Applet::High);
  plotters.value(key)->setShowHorizontalLines(detail == SM::Applet::High);
}


This is calling keys() over the hash, this, as values(), means going across the container and creating a temporary list containing all the keys of the hash, that's a waste of memory when you could simply use a proper
QHash<QString,Plasma::SignalPlotter*>::const_iterator
and just iterate keys one by one.

Then it does plotters.value(key) twice, ok, accessing a value in a hash is amortized O(1) but still you are going to calculate the qHash of the string twice for no reason.

But more important, what the code is doing is actually iterate over the values, so the proper way is doing

QHash<QString,Plasma::SignalPlotter*> plotters;
foreach (Plasma::SignalPlotter *plotter, plotters) {
  plotter->setShowLabels(detail == SM::Applet::High);
  plotter->setShowHorizontalLines(detail == SM::Applet::High);
}


Probably in this case the net benefit is not much because probably the number of element of plotters is small, but there's no need to write inefficient code when the efficient one is as easy to write.

And of course it could be worse. If plotters was a map instead of a hash, lookup would be O(log(n)).

So if you are using keys() in a foreach, please think twice what you are doing and if you only need the value, iterate of the container and if you really need the key use a proper iterator to avoid constructing the temporary list.

Wednesday, April 01, 2009

3 years and 8 months later...

...i got my University Engineering diploma. I wonder what's the reason for taking so much for printing a paper :D

The nice swindler inside Apple

Apple has just gone a step higher in my list of companies i hate. Let me explain my last experience with them.

So i am browsing the net and see there's an iPhoneOS 3.0 pre-release, you have to register, pay something like 80€ and then you are part of the developer program and can download the SDK. So as my daywork involves working with phones i decide to register and pay with my boss credit card, something i've done lots of times already and never had any problem with.

But seems Apple is special and needs the names to match. No problem, i can accept that.

What i can not accept is they charging my boss the 80€ and then denying me the access to the developer zone because names do not match. That's what i call a swindle.

And the even more wonderful thing is the people that answers my mails don't see Apple did anything wrong and is asking me to send a fax (to US that i don't want to know how much it cost) of my and my boss ID cards with a notary sign saying it's ok (i don't know elsewhere, but in Spain a notary is NOT CHEAP). And won't return the 80€ either. Wonder if the only chance is asking the bank not to pay that 80€ :-(

That's what i get for dealing with Apple :-/

Thursday, March 19, 2009

Transactions and rollback and their lack of in viajar.com

This post should be called "I'm going to Akademy! (i hope)", but instead of rejoicing of going for 4th consecutive year to KDE meeting, i'm going to do a rant about transactions and how rollback should work.

So here was I, sitting in my computer trying to find a good flight to go to Gran Canaria and ended up in viajar.com. They had a mixed offer (flight from Barcelona to Gran Canaria with one company and back with a different one) that was the best considering time and money so i went on and bought from them.

So i clicked the "buy" button after filling all the data and scared saw that the server was taking too much time to show me the "done" page. After 5 minutes or so, it told me "error", and i went like "oh, i'll have to find some other place to buy". But first i had a look at my credit card account and saw in horror that a the company of the second flight (clickair) had charged me about the half of the amount of money of what i had bought.

Calm down! I thought, and waited for a mail explaing something, but there was none for 12 hours so i had to call them. A nice person answered and explained me that they had absolutely no record of my purchase so they could not give me any info, i then explained the situation and she realized that clickair bookings are somewhat done differently from the rest because it's a Low Cost Company so she asked me which dates i had booked and promised to give an answer back.

Two hours later she phoned me with the needed data to take both flights as it seems she could book me also the first flight, good, all resolved!

But i was still wondering, how can the system book one ticked without checking the other one is available? how can i get a ticket booked and get no information back? Probably i went to the last if/else/if/else/if/else of conditions, but that's no excuse.

So if you are doing internet "shops" think twice your transactions and rollbacking mechanism, and then, think it a third time!

Sunday, March 15, 2009

NetworkManager settings not shared/specified?

Dear lazyweb, please prove me wrong.

I've been having a quick look at how NetworkManager is implemented and from what i see the public DBUS API is only for querying, not editing there. The edition of new networks et al is to be provided by a separate NetworkManager service that has no common API. This has two consequences to me:
* Users that edit/create connections under KDE don't see them under Gnome/Xfce/wathever and viceversa
* You can not write a desktop agnostic program that needs to modify/create networks as you don't know who you have to talk to <-- This is specially ugly

Wednesday, February 25, 2009

ddrescue to the rescue

So two weeks ago my HD did a huge CRACK and it stopped working. The system did not boot up and it just did CRACK CRACK CRACK all the time. So i browsed a bit and saw that ddrescue was a dd variant able to skip failing sectors. So i picked up a new HD the double size of the old one and a RIP CD and started the process of dumping the old filesystem into a file. Two weeks after ddrescue told me i had lost 77MB and thankfully after dumping the file into a newly created filesystem and some fsck later i did not lost anything important.

So thanks a lot ddrescue devels!

Monday, February 02, 2009

How to get Konsole 4.2 to behave?

Dear lazyweb: My Konsole in KDE 4.2 does not like me. Let me explain myself, i like to use vim for quick text editing and i like using the numeric keypad to type numbers, if i use the "Default (XFree 4)" input method, that doesn't work, and pressing any keypad number makes vim go nuts, so i'm using the "Linux Console" input method.

"Linux Console" works correctly when on a local session but if i log into a remote machine using ssh, then suddenly the Home and End keys start outputing ~ characters. And this all does not happen in xterm so it must be a konsole feature, any idea how can i get rid of it?

Saturday, January 10, 2009

Announcing KDE 4.2 Barcelona Release Party

Along with other KDE 4.2 Release Parties all over the globe, the KDE barcelona crew is also hosting one. The date is the 30th of January. Place is still to be determined, so if you have suggestions contact me asap! Also contact me if you want to be in the list of people.

Some KDE Merchandising available at Barcelona

Since last Akademy-es i've some KDE Merchandising left at home (apol has some more), so if you live Barcelona or nearby and want stickers (15cmx15cm, 5cmx5xm, round 8cm), baseball caps, akademy 2008 t-shirts, akademy-es 2008 t-shirts, fridge stickers(round 3.5cm), badges(round 3.5cm) or mouse pads(19x19cm) contact me for availability and prices. Of course if you don't live Barcelona or nearby you are also allowed to contact me but then probably shipping is going to be more expensive that the item itself.

Wednesday, January 07, 2009

Every bug report is important

Yesterday a user reported KTuberling being unable to save. Imposible! - i said, as i had tested that feature, but further investigation revealed that KTuberling was indeed unable to save files with non ascii characters, that made me create a simple regular expression i executed all over KDE code and found similar bugs in kmahjongg, parley, kross, kgpg, digikam and krita. So never underestimate the power of a bug report!

Sunday, January 04, 2009

My top 10 blog posts of 2008

Here the top 10 of blog entries visited in 2008 in my blog:

10 - pdftk frontend for KDE
9 - Poppler for windows
8 - KDE 4.1 adoption seems high
7 - KHTML rocks
6 - Performance of radeon free drivers
5 - KDE, plugins, GPL and closed source applications
4 - keyboard crazyness
3 - Morocco trip
2 - fglrx blocking Xorg on logout
1 - KUbuntu 8.04 released with rock solid 3.5.9 goodness...

One can extract several interesting things from this list:
- Last year i did not make interesting blogs, 5 out of 10 are from either 2006 or 2007
- People really want a pdftk frontend for KDE since my 2007 post of my no longer existant project is visited frecuently
- People want to use poppler in windows, strange that all those users almost never sent patches to the project, seems like windows culture is not so much about collaborating but about just using.
- My Morocco trip summary is liked by google, it's linked in the first page of results usually
- The two most read blog entries are about bugs in kubuntu ... maybe that's why Canonical never replied to me applying for jobs there :D

Thursday, December 18, 2008

Symbian C++ sucks

Let's say you are developing on a Symbian phone. You are creating something more complex than a "Hello World" app so you need threads.

You create a RThread, and inside that thread you append things to a RArray (dynamic array) and then from the main thread you want to retrieve them.

NO! You can't! Accessing elements of a RArray from two different RThreads is not allow and it'll crash on you.

Ok you think, they just ported STL to Symbian, let's use a std::list, and NO! It'll crash even earlier.

So you are about to throw the phone across the window, but then you think, wait the also ported some POSIX things to Symbian, and try pthread and it suddenly works and you realize how simple things can be a nightmare when using weird tools/SDK, that's why Qt rocks it gives you almost all you want in a practical API, and when something is missing KDE adds the missing bit.