Planet INdT

July 24, 2010

Bruno Abinader

QTestLib / Plasma Animations presentations @ FISL11

Hi again :)
It's been amazing days here at Porto Alegre, Brazil, where the 11th Forum Internacional de Software Livre (Free Software International Forum - aka. FISL11), one of the biggest open-source conferences in the world. On 22nd I've made a presentation about QTestLib, entitled "QTestLib: Creating intelligent unit tests for Qt-based projects" (slides available below - sorry, portuguese only), and yesterday me and Igor Oliveira spoke about Plasma Animations, pretty much similar to what I've had talked about in Akademy this year. Today we'll have Igor talking solely about Gallium3D, so things are pretty much on the way we've expected :)


QTestLib slides available here.

ps: And of course, we have pictures taken with Tux and GNU!



by Bruno de Oliveira Abinader (noreply@blogger.com) at July 24, 2010 10:59 AM

July 19, 2010

Marcelo Lira

Tubarão

Antigamente pensava que, embora goste muito dele, tinha pouco em comum com meu pai. Não estava completamente errado, mas esta estória não é sobre isso.

Fomos lá no hospital Santa Maria, na minha cidade, pra render o turno da minha mãe, que está acompanhando meu tio na internação.
O hospital fica uns duzentos metros da casa dos meus pais. Mais duzentos metros e temos a casa do tio, e com mais duzetos é o cemitério. Tudo é perto na minha cidade, pouca necessidade de carro ou ônibus.

Só pra localizar melhor as coisas, esse tio não é um tio genérico, ele criou minha mãe como pai, logo é como se fosse meu avô. Todos chamamos ele de Nêgo (com ê mesmo). Ele tomava conta do pequeno eu de 5 anos (acho) enquanto minha mãe analisava amostras de sangue no laboratório. Mas meu tio também tinha seus compromissos de sacristão de uma paróquia, pra onde ele me levava. Lembro de ir pra uma extrema unção (ou era um velório?) onde fiquei cantando com o folhetinho virado de cabeça pra baixo.

Chegando na enfermaria do hospital mandamos minha mãe jantar. Eu tinha a intenção de entreter o doente, mas ele estava com a voz bem fraquinha pra conversar. Melhor uma estória. Então fiz a pergunta mágica ao meu pai sobre como vovô aprendeu a nadar tão bem vivendo num sítio no interior de Pernambuco.

Fernando de Noronha

Então, era uma vez meu bisavô, que não sei o nome, por causa de quem começa tudo. Tem essa estória vaga e difusa de que ele matou duas pessoas, em duas situações distintas, com tiros à queima roupa de seu perverso bacamarte. Me foi contado que ele socava vidro e pregos junto com a pólvora. Um dos tiros teria arrancado o coração de uma mulher e o outro a cabeça de um sujeito. Mas pode ter sido o oposto. A causa de tanta raiva pode ter sido fofoca e ciúme. Ele tinha uma amante e estavam contando pra minha bisavó. Meu bisavô, amante da paz que era tentou resolver do jeito dele. Contudo, nada é preciso nessa estória. Essas lendas de família são assim mesmo.

Fato é que nos idos de mil novecentos e dez e poucos os bandidos perigosos iam para… O que é que ele vai ganhar Lombardi? Uma viagem com tudo pago pra Fernando de Noronha, Silvio! E a estranheza só aumenta, meu pai contou que a família do condenado ia junto com ele, mas ficavam numa casa de verdade na ilha, e o meliante só precisava dormir na cela com provável vista pro mar. E essa era vida do meu bisavô, dormir no xilindró e fazer mais filhos durante o dia. Penso que ele só fazia pela diversão, mas cada filho nascido na ilha diminuia sua pena.

E foi assim que meu avô aprendeu a nadar, praticando dos 13 aos 18 em Fernando de Noronha, enquanto o pai cumpria pena por crimes hediondos.

Sabia desse conto só até essa parte, mas o mais legal de ouvir meu pai narrando tudo de novo é que sempre posso confiar na ampliação da estória com um detalhe que lembrou na hora. O detalhe dessa vez foi um tubarão.

Tubarão

Estavam pescando numa jangada lá no mar azul de Fernando de Noronha meu avô e seu irmão. Pescavam com anzol grande e corda resistente, esperando pegar algo graúdo. Pois foi um tubarão que veio, não sei a espécie, só sei que era do tipo com dentes afiados e do tamanho da jangada onde cabem duas pessoas.

Eles lutaram com o peixão por um bom tempo, até que o bicho virou o barquinho. Nessa parte da narrativa eu só acreditei que meu avô saiu vivo porque estavam o filho e o neto conversando sobre ele. Assisti muitos filmes de tubarão pra saber que o objetivo da espécie, em todas suas variantes, é o extermínio da raça humana. Veja o tubarão baleia por exemplo, aquele jeitão simpático dele, aquela boca de garagem de fusca, isso é só pra baixar nossa guarda.

Na vida real o tubarão com um gancho na boca só quer fugir. Vovô e seu irmão com suas inseparáveis facas (sim, os filhos do condenado andavam por aí com facas – eram aqueles tempos que todo mundo fala de amarrar cachorro com salsicha) só queriam um almoço de frutos do mar.

Bem, voltando, vovô conseguiu furar o tubarão e logo o bicho enfraquecia. Eles desviraram a jangada e jogaram o peixão no meio. Os pescadores adultos festejaram a habilidade e ousadia dos meus antepassados adolescentes e todos fizeram um feliz churrasco de tubarão.

Essas horas minha mãe já voltou e tenho um ônibus pra pegar.

by admin at July 19, 2010 07:23 PM

July 16, 2010

Morpheuz

Applying transformations to your bugs

Today there was this presentation from Apple to talk about the famous iPhone4 antenna problem. I’ll represent this problem (bug) with the picture below made by one of INdT’s designers (Patricia Montenegro) some time ago:

The Bug

The Bug - watch out the way it looks to you!

To be honest I wasn’t expecting anything “technical” in the sense that I wasn’t expecting a technical explanation to the problem itself (you can find it in numerous places on the web) or for a possible solution, but I wanted to watch how Jobs would deal with with the situation.

Being honest again, he did what he does best! At first, he acknowledged the problem as it couldn’t be denied. Then he said that actually they did a favor to the smartphone’s industry because there were other phones with the same problem (showed pictures of other phones having the same issue – what doesn’t prove much, but…) but instead of “hiding” the antenna and hiding the problem, they actually put a big “X” on the problem (see picture below).

iPhone4 antenna

iPhone4 antenna

From my point of view it was just what we would call a “n00b” mistake :) . I mean, Apple is doing phones since not so many time ago. It’s their 4th device (iPhone, iPhone 3G, iPhone 3GS and iPhone4 now), and they just didn’t face this problem before and had the brilliant idea. The problem may show up on other phones? Sure, but I’m sure that the other manufacturers know about the problem and try to “fix” it, being that hiding the antenna inside the case or whatever.

The next steps were just the table’s “turn over” (not sure if this expression exists in English, but it works pretty well in Portuguese :P ): some (small) numbers about the how many people were actually affected by the bug. It was less than 1 in a 100 users (a beautiful way of saying less than 1% hehe). They get these numbers from the people that actually complained at Apple Care about the issue so those out there that just reading Engadget and Gizmodo about the issue were not counted of course.

But besides the number being so small, Apple does care about it’s users. All of them. See the kind of words used here? This is the place to do the magic trick. This is the place where you say that you’re not evil or bad but you actually care. Just after stating that you human enough to make mistakes, you ensure your “human position” showing that you care about others. Genious! It’s a statement that just makes the others stronger ;) .

In order to take care of those 1% Apple will give for free cases for the iPhones, what prevents the bug and users will even be able to choose colors! And if they do not want the case, then a refund is offered. In Brazil this would be something that they would need to do because of the law: if you sell something that doesn’t work, you need to refund. I’m not sure how this works out on US but anyway, he transformed the user’s “right” into a company’s “feature”. Points again for Apple and Jobs for playing nice with the words.

After that, it was just more slides about all the nice features of iPhone4, why you should have one and more and more statements that Apple loves it’s users (yes, the word love is used in all the slides).

Apple and Love

Apple and Love

Summary: from the technical point of view it was just “we don’t have a way to fix this as this is a hardware problem and it’s a huge problem then.”. But saying so is the same as pushing the picture of our fellow bug in every user’s face.

Instead of doing that, they will solve the issue by giving the users a rubber case that costs less than 1 dollar and then create a link between the users and the company that is: “we are all humans. have you ever made a mistake? this is our first mistake. sorry. take this gift. ah, by the way we love you.”. This creates compassion (every human did something wrong once in his life) and then people stop bashing the company and it’s product. This “love history” also reinforces that they are humans, enabling them to screw things eventually. So with a few minutes, Jobs got our fellow and dressed him properly transforming The Bug in a Feature:

The feature - not so ugly anymore!

The feature - not so ugly anymore!

From my point of view, the truth is that Apple is a company with a product that costs you some money and just like any other company in any other industry, the products should be properly tested and should not have this kind of problems that are not solvable (what if they didn’t have the luck of the case solving the issue?). The good about open source products is that at least from the software side we can fix stuff as quick as possible. So please vendors: pay attention to the hardware you manufacture and leave them as open as possible to software that we want to put into that! :D

by morpheuz at July 16, 2010 06:45 PM

July 11, 2010

Igor Oliveira

Cairo State Tracker what we already have done

In my last post I showed how we can fill self intersected polygons using stencil buffer. It is one of the operations I have implemented in Cairo Gallium backend.

We already have many features implemented and others one in WIP.  This week i was working in make the stroke operation styles, like join, caps and dashes. I already have them working, Cairo has a nice helper function called _cairo_path_fixed_stroke_to_shaper, it converts the stroke in polygons like quads and triangles.  The result can be seen below.

We already have the fill operation also working(like you saw in my last post) , mask, clip and paint(solid pattern). Now i am working in blend operations, Cairo has many and some ones i need to write a shader like i did in my openvg branch not commited.


by Igor Trindade Oliveira at July 11, 2010 03:47 PM

July 10, 2010

Igor Oliveira

Cairo state tracker: filling rules(the power of stencil buffer)

When creating a Cairo Graphics Backend we need to implement some operations, one of them is the fill operation.

Fill operation basically describe how a polygon is filled, and cairo has two fill rules:

Non-Zero Winding:  takes into account the direction of the path. Being enclosed by a clockwise loop counts as +1 and being enclosed by a counter-clockwise loop counts as -1. When of the sum of these counts is zero, it is a hole otherwise it is filled.

Evend-Odd: Every area that is inside of an even number of “interiors” is a hole and every region that is inside a odd number of “interiors” is filled.

These operations are easily implemented using stencil buffer.  About the Even-Odd we just need draw each of the polygons in turn, using the PIPE_STENCIL_OP_INVERT function in the stencil buffer.  This flips the value between zero and a nonzero value every time a triangle is drawn that covers a pixel. After all the triangles are drawn, if a pixel is covered an even number of times, the value in the stencil buffers is zero; otherwise, it’s nonzero. Finally, draw a large polygon over the whole region.[1]

And the No n-Zero rule we need to know using the cull face if we are drawing the polygon into clockwise or counter-clockwise, we increment the stencil(PIPE_STENCIL_OP_INCR_WRAP) if is in clockwise and we decrement(PIPE_STENCIL_OP_INCR_DECR) the stencil if is in counter-clockwise.  After we just need to draw a large polygon over the whole region.

So thinking about a star with the coordinates:

(Remember the star is a self intersected polygon)

cairo_move_to(cr, 0, 1.0);
cairo_line_to(cr, 0.5, 0.0);
cairo_line_to(cr, 1.0, 1.0);
cairo_line_to(cr, 0.0, 0.5);
cairo_line_to(cr, 1.0, 0.5);
cairo_line_to(cr, 0, 1.0);

Using Even odd rule this star is draw with a hole:

Using Winding rule we have the all the star filled:

So see you in the next post :) .

[1] Drawing Filled, Concave Polygons Using the Stencil Buffer.

link:http://www.dei.isep.ipp.pt/~jpp/sgrai/livros/RedBook/chapter14.html


by Igor Trindade Oliveira at July 10, 2010 08:15 PM

Morpheuz

KDE calls ‘home’

Yep, I didn’t have time to blog during aKademy as you may have noticed :) The main reason is that I had a lot of discussions and attended to a huge number of BoFs. This aKademy rocked just as the others that I went. Huge thanks to the organization team, KDE e.V and sponsors for providing ways to make this happen and to have a lot of KDE hackers there!

Instead of doing a technical blog today, I will just say that during this aKademy KDE ‘called home’ for the first time. This means that for the first time in history :) we had KDE running on a mobile phone and we made a call with it! This was AWESOME! Just a summary: Plasma-Mobile and a plasmoid that worked as a dialer did the work, using the phone API of Maemo5 on a N900.

As Aaron noticed, our first call was a little bit more “interesting” than Graham Bell’s one. The first words on a telephone in history are:

Mr. Watson, come here. I want to see you.

Interesting…..but you may think that the transcription below is a little bit more interesting. I will also omit some context that would explain some of the questions/answers during this talk as I think that it may turn this more…let’s say…special ;) Enjoy!

My phone rings (for the sake of curiosity, my ringtone is “Snow” by Red Hot Chili Peppers) and the ID of the caller is “+41″. I answer and the call drops. I tell Helio that it should be some company from Brazil during TeleMarketing. While we walk to the bus for aKademy’s day trip it rings again. Alexis Menard is the caller this time:

Me: Bonsoir! er, Bonjour Alexis!
Alexis: Guess what?!
Me:
hhmm, you’re going to miss the dray trip because you just woke up?
Alexis: NO! Guess what ‘amiguinho’!? (note: ‘amiguinho’ means ‘little friend’ in portuguese)
Me: Oh, I got it! You’re the guy! Your bed is warmer than it should be?
Alexis: What?! No, no, no! Come on! GUESS WHAT?!
Me: I don’t know then! Let me think….ow yeah! GREAT! This phone call was made through the Plasma-Mobile stuff that we did yesterday?!
Alexis: Yes!! Finally!! I’m turning off my computer and meet you at the bus!
Me: OK! See you!

And then I tell everybody that was by my side that it was the first KDE phone call in history! REALLY GREAT! :) The conversation above may seem non-sense but all the questions had a reason and the answers too :P

Soon we should post some more technical bits about Plasma-Mobile and also I plan to talk a little bit about KDE-Pim-Mobile, the new Sharebin engine (that will support scripted plugins and GHNS) and if you want to contribute to some use cases of Plasma-Mobile take a look at this link.

As a kind of “sad note”, I would also like to tell you that the QEdje scriptengine was removed due (my) lack of maintenance of the QEdje project.

by morpheuz at July 10, 2010 07:42 PM

July 07, 2010

Bruno Abinader

Plasma Animations Overview Slides Available

Hi KDE :)

It's been quite awesome times for me in these days, since I was able to meet the guys behind the code or IRC channels. Today I've presented my workshop entitled "Plasma Animations Overview", and it was quite good, with useful feedback from the crowd about JavaScript animations and the plans for implementing support for QML-based widgets animations. You can find the download links for the presentation (and source code for the examples) below:

Plasma Animations Overview (PDF)
Plasma Animations Examples

Also I would like to share the beautiful view of the Tammerkoski river took on my way to Demola:

by Bruno de Oliveira Abinader (noreply@blogger.com) at July 07, 2010 04:43 AM

July 04, 2010

Adenilson Cavalcanti

Sliderlayout

It all started with a simple problem: I want to change from one list of things to another, doing a ‘slider’ like transition (like you would do for example in a music player when you choose an artist and go to another list with the tracks).

That sounds pretty simple, right? Just fire a QPropertyAnimation (or if you are using Plasma, a SliderAnimation is even better) and animate the position of 2 widgets.

But what if I want to have those widgets inside of a layout (e.g. QGraphicsLinearLayout)? After all, I want my UI to scale between different window sizes, screen resolutions (and in mobile devices, adjust to screen rotations).

Hum… you could draw your widgets *over* the linear layout and check for resize events of the main widget *while* correctly positioning your set of widgets in the scene. But that sounds a bit too much hack-ish.

I asked 2 friends about this very same issue and one suggested me to create a layout with this behavior. Initially, I was not sure about it, after all, I have never worked before with QGraphicsLayouts and I got almost no time to have something working.

Well, the good news are that it only took me a couple of hours to get this:

Explanation: it is a layout were you can add several widgets and move from one to another by calling next()/previous(). And since it is just a layout, can be inserted in another layouts (in this case, inside of QGraphicsLinearLayout).

Maybe a bit of code would help to explain… say that you have 2 widgets and you want to move next when the current one is clicked:

Item obj1, obj2;

SliderLayout *slider = new SliderLayout;

slider->addWidget(&obj1);

slider->addWidget(&obj2);

connect(&obj1, SIGNAL(clicked()), slider, SLOT(next()));

slider->setCurrentWidgetIndex(0);

and you are done.

The secret here is to keep hidden all the widgets (except by the current one) and in the slider event, animate the position of both widgets (the current and soon-to-be-current widget) while correctly repositioning the widgets in the scene (and setting to show state both widgets of course).

Since I have the movement methods on this layout as slots, I have to derive from both QObject and QGraphicsLayout (and that I’m not completely happy, anyone has suggestions to workaround that?).

I have tested this layout (integrated with *far* more complex widgets) in varied devices (from ARM@430Mhz up to Intel Atom@1.6Ghz))and it behaved pretty well, basically because I’m only animating the position of 2 widgets. It might happen that if you have an overly complex widget, that your hardware is not able to do the animation with good frame rate (but here you can workaround by hiding some of the content of this overly complex widget, and that will be probably the subject of my next post).

There are 2 other remarks about the code:

  • I used Plasma SliderAnimation just because it was easier, but it could be replaced by a QPropertyAnimation
  • Since Plasma Animations expect to receive a QGraphicsWidget, I assumed that you are going to supply a QGraphicsWidget to the SliderLayout. But the real requirement could be a QGraphicsItem, since it is the position that is being animated.

You can get the code here, my personal sandbox for experimenting with plasma animations and other stuff (please, please, we *do* need to migrate away from svn and start using git) and look for src/lib/sliderlayout.cpp and src/example/slidertest.cpp. I wonder when the feature freeze of KDE is over, if this could be part of libplasma.

Maybe this concept could be expanded so there would be a layout class and the animation behavior (fade, rotate, slide, etc) be defined by a delegate. Anyone is tempted to help me to develop this further? :-)


by savago at July 04, 2010 09:05 AM