Thursday, March 26, 2009

Punjabi Lohri Invitation Cards

The Theory at the End of Time

few new minor, but all put together can be worth a few lines. I finally

the badge of 'ICTP , Number 8000359, which is the first (I can understand that you care very much ...) and a first twin. It allows me to acedo the canteen and the library in the evening. Not that I want to try it soon ...

Along with the badge (which brings to five the number of identification cards that I own) I took also the fundamental key to the coffee machine. I had to share my set of keys into two, because it starts to become too cumbersome.

I still wonder if I was asleep or to be discussed if we really invent the first interstellar travel or a metal self-cleaning, always shine for ships. I mean, how credible are the ships of the Star Wars prequels? Maybe

did you know, but it seems that the Chinese have a lot of loanwords from English, so in China greet each other with "Hi" or "Hello". At the very least curious.

I have photos of the Persian New Year, They

Fahimeh and Zhaleh, SBP in the industry.


But the backgrounds were quite different ...



The title comes from talk of Juan Martín Maldacena , who was today awarded the ICTP Dirac Medal, along with Joseph Polchinski . While he wondered what kind of world awaits us at the edge of time (or on board a space-time negative curvature ) ha consigliato agli astanti - che erano tantissimi, tanto che mi sono seduto sui gradini della lecture hall - di leggere "Il ristorante alla fine dell'universo" di Douglas Adams!

Sunday, March 22, 2009

Watery Cm2 Days Before Period

Automatic bindings to C + + libraries

As I wrote last time, this post will be about lqt, and first of all about what lqt does.

Qt's and KDE's native language is C++, however some people wants to use them in a different language (in my case Lua) so many bindings have been created for these libraries. There are several methods you can use to do this.

The simplest way in principle is to write the bindings by hand: most languages have some way to communicate with C/C++ so, by writing wrappers for all the functions and methods in the library, you can create the modules you want. For example if you have this

int foo(int);

you can write this (in C)
   int call_foo(lua_State *L) { 
int ret;
int arg;
arg = lua_tointeger(L, 1); /* take the first argument */
ret = foo(arg);
lua_pushinteger(L, ret); /* give the return value to Lua */
return 1;
}

This function can then be used when a Lua script calls foo().

If you had instead "int bar(int);" only a single line needs to be changed, while the rest is boilerplate code. This fact is not Lua-specific at all and in fact many solutions have been created to make bindings more automated. Java bindings to Qt are created this way, and also Swig and SMOKE just to name a few.

Most of the automated generators require an "API description" file that tells the generator which functions, classes and methods it should wrap, with their arguments and members. This is the case for QtJambi and Swig (and tolua/tolua++). So someone has to write down this description in the first place, but for big libraries it is not so easy. QtSoftware can pay someone to write and mantain this file, but what about KDE?

KDE has SMOKE that takes a better approach because it parses the C++ code, with almost no manual work required. The headers are changed; run it again; you have new bindings; stop.

(SMOKE has many other qualities, such as being language agnostic. Stuff for another post/author)

What lqt does is basically the same as SMOKE, but specialized for Lua, and using a different tool. While SMOKE uses the perl based "kalyptus" to generate the wrappers, I used the parser written by Roberto Raggi. Since a well written C++ parser like this is officially a Big Thing(TM), there are uncountable copies and versions around the marble (the last one I'm aware of is in QtCreator). Thus it's difficult to make it clear which one you are talking about. The one lqt uses was written for KDevelop4 and used in QtJambi. I usually call it RPP for the sake of brevity, until Roberto gives it an official name and versioning system.

My little tool "cpptoxml" just dumps the data structure of RPP into an XML. This simple step has drawn some attention to cpptoxml, while the main work is actually done by RPP. Then a Lua script takes this XML and writes the binding modules. Peter wrote a sane build system, so the bindings can also be used on Windows and OSX. And in the end you can write your Lua program using Qt:
   require'qtcore' 
require'qtgui'

app = QApplication(1 + select('#', ...), {arg[0], ...})

hello = QPushButton(QString("Hello Planet!"))
hello:resize(140, 40)
hello:show()
app.exec()

I was planning to Show Some complex example with cool stuff like WebKit But I'd rather leave something for the next post.

Saturday, March 21, 2009

Counter Offer Settlement Letter

Hello 1388 Happy Planet

We celebrated the Persian new year yesterday, on the terrace of the ICTP, despite the freezing wind. The Iranian sweets are really sweet: Luckily not assume a lot of sugar normally - not even coffee. There was plenty of nuts (especially pistachios), the theme music and a small table with the "Seven S": seven objects whose name begins with S and to represent as many wishes for the new year. The photos I have not yet arrived.

I have really seen "The Millionaire" and I'm sure he would have won the Oscar for "Milk" or "Gran Torino" if it had not been completely snubbed. The awards for editing and photography were actually earned.

On the other hand is known as the Oscars are not awarded to films that are considered too "political." That is a way to tell those movies that show (or suggest) that something is wrong. In addition to a somewhat 'hypocritical to justify, since it does not talk about politics is just a way of doing politics - and are certainly not the first to say so. The Academy works well, you just know.

about "Gran Torino," if you have not seen not to be missed.



Finally I saw "Watchmen", which was better than I expected. Have made it slightly darker than it was comics, but the atmosphere is still fairly accurate. During the opening credits there are many episodes that could not be included in the film, it will be fun to see them in slow motion as soon as I get a copy. The voice of Manhattan is not really up to. I do not understand the controversy over the final amended, since the result is the same. The means by which it is achieved is of secondary importance - a true MacGuffin. I guess they have admitted the same authors.

In the pool I went under thirty seconds (fifty yards). Although it is not amazing I am satisfied with the stesso. Comunque, il risultato migliore è esserci andato tutte le volte.

Prima o poi troverò un relatore. A costo di invocare il suo nome per tre volte a mezzanotte in un incrocio deserto .

Tuesday, March 17, 2009

Piaggio Zip Tuning Ideas



Hello everyone,

I finally added my blog to the PlanetKDE , so here is the obligatory "Hello Planet" post.

First of all something about me: I'm an italian PhD student in Physics. I get to deal routinely with simulations and numerical analysis, which in my field means mostly FORTRAN. If you ever dealt with that you can probably feel my pain. I stick to C++ whenever I can, and in these cases Eigen is a life saver.

But sometimes I have some task which is not performance critical and is better suited for a scripting language. Then my choice is Lua .

My contributions to KDE include three things: Qt bindings for Lua, called "lqt" (with the help of Peter Kümmel), a tool that transforms C++ into XML ("cpptoxml") and a Kross backend for Lua named "kloss". I know, I suck at names...

If you look at the logs (or the fine graphics created by Paul Adams) you will notice that I commited two or three times in a several months period (my account dates from the KDE Bindings meeting in summer 2008). That is because I mostly develop in a separate repository and then commit a lot of changes at once.

You can find the most recent source of lqt here , with the most up to date version of cpptoxml. The Kross backend is kept in playground/bindings/kloss .

I plan to talk about what is lqt, how it works and what are our plans in the next posts.

I will also occasionally talk about how I hate FORTRAN, dislike C/C++ and feel the whole world should get rid of any other language to adopt Lua in every possible situation. Random ideas that somehow manage to evade the sanity filter may be spotted too...

Sunday, March 1, 2009

How To Invest In Rennaissance Technologies

Back in Pisa. Back from Pisa.

Yuasa-san è venuto in Italia per pochi giorni e non potevo farmi sfuggire l'occasione di incontrarlo. Come al solito è stato molto useful and we have solved many problems. Mostly him, I must confess. I'm pretty tired, or because we have worked continuously for the train ride today.

I was good to see friends, and I feel sorry for those who, inevitably, I could not cross. Pisa still does not like it, but in small doses is not terrible, and for three days the weather was even nice.

last update I saw three films: "The Curious Case of Benjamin Button," "The Reader" and "Milk." The latter seems to have suffered some kind of veiled censorship, because it was impossible to see it in prime time, and still has not been shown before he won the Academy Award. So are all the more glad I saw the same. It's a fantastic film.



I have yet to see "Millionaire," which was the alternative for that evening. The expectations are good.

Also on Oscar Oktapodi was nominated for best animated short. The winner must be really spectacular and I'll see him soon.

The other two films I was not disappointed and worth to be seen if there is nothing better. Self-evident statement, I must admit, but I hope that the meaning is clear.