Monday, February 11, 2008

It's that time of the year again!

Hack week!

*does little jiggly dance*

If you're not familiar with what it is, here's the gist of it: For one week, all the geeks at Novell stop what they're doing and dive into a project of their choice. That's right, a full week of pure, anadulterated hacking!

This year I'm going to use this week to scratch an hitch I've been having with bugzilla, by getting together a proper GUI for the thing, together with uber-hacker Marek Habersack. Join up if you're interested, the more the merrier!

Wednesday, January 02, 2008

Generating C# interfaces the lazy way

Since all this Winforms WebBrowser control / Mono.Mozilla / gluezilla business started, there's one thing that's been nagging me at that place in the brain where I store stuff I'd rather not think about at the moment (and yes, it's a place that quite resembles those junk-filled attics you see in movies where the kids go to play and occasionally encounter old moth-eaten dresses, the occasional treasure map or your garden-variety skeleton of the aunt nobody had seen in 50 years - a stuffy, moldy place where you can't take a step without tripping on something...)...

Where was I? Oh, yes, nagging me was the thought that, while I had successfully created C# interfaces from the mozilla idl files, and was successfully accessing mozilla through XPCOM directly from the managed side, those interfaces were created by hand, which was not that hard at all, and I really could go on doing them by hand, only getting full DOM support on Mono.Mozilla would require generating some 50 interfaces... by hand.... ugh

So, whilst suffering without net last week due to a router dying and a firewall showing solidarity towards said router (i.e., dying too), I ran across some perl scripts that are being used for various tasks all over the mono tree, and decided that enough was enough, I should get it over once and for all and do a little script to parse the idl files and generate my badly needed interfaces.

Queue a fun-filled day playing around with perl, learning from scripts and from what little documentation I could find on my system (no net, no manuals...) In the end, scraped something together which is living on svn in mcs/class/Mono.Mozilla/tools/xpidl2cs

xpidl2cs basically parses an idl file and generates a C# interface that's ready to be used. It goes all the way up the inheritance tree and generates all parents and, since .NET interop doesn't support interface inheritance and requires child interfaces to also include all the declarations from the parent, xpidl2cs recursively includes all the parent declarations, so you end up with a (probably rather) huge but working interface.

xpidl2cs also generates all the interfaces that are used in methods and properties of your target idl (and parents) so that all dependencies are satisfied in one pass. To avoid endless looping on this, the script doesn't generate the interface if a .cs file with the same name already exists in the directory, so if you want to make sure everything is regenerated, you should rm all interfaces first.

The usage is simple: xpidl2cs.pl file.idl [/path/to/idl/files/]

Any bugs, comments, flames, etc, feel free to nag here or on the #mono channel over at irc.gnome.org, or just mail me.

Tuesday, December 11, 2007

There and back again... The Mono Summit 2007, and so much more

I had written this huge post about how awesome the Mono Summit in Madrid was, how great it was to meet everyone (some again, some for the first time face-to-face), how much I learned from talking and sharing ideas and watching the presentations... and then @#$@$% synergy went and turned on control again and when I scrolled, the entire page was gone!

gnnngnnnngnn

Of course, the autosave function didn't work either, so I was left with the title and the first line.... *sigh* and I had pretty pictures in too *sigh*

So, this is going to be much shorter.

Mono Summit 2007: awesome

Highlights:

* Talking and debugging speedy-gonzalez-like with my favourite marsupial Geoff Norton about all things mac-ish;

* Discussing winforms and it's direction with Jonathan Pobst, as well as blowing up his Visual Studio 2008 with a carefully aimed HAHA;

* Meeting our awesome tester Gert Driesen, recipient of our lifetime achievement award for extreme uberness in testing everything with extreme prejudice (award which will, for sure, take physical form and reach him... :) );

* Meeting our wtf-is-wrong-with-transparency-dude/winforms designer Ivan Zlatev and making him come to dinner with us (hey, it was fun, wasn't it! ;) )

* Meeting my COM hero Jonathan Chambers!

* Watching with delighted surprise as Jim Purbrick (of Second Life fame) presented the pathfinding / tower of defense game we had been working on at Codebits Lisbon actually live in Second Life

* Watching the moonlighters work their magic;

* Watching Aaron Bockover turn his T into a portable disco by sending commands to the thinkpad acpi

* Finally meeting my good friend/asp.net master Marek Habersack

* Getting back together with all my teamsters

These are only the highlights, mind you, there was so much more, between the Boo, Debugging, MD, Mac and all the other presentations, meeting contributors and users and developers and getting together to discuss and debug and hack and having a few laughs over drinks and jamón and coffee and walking around Madrid trying to steer through the huge crowds and having our room keys deactivated every couple of days so that everyone had to meet downstairs and chat a bit more while they were reactivated (nice touch there, hotel service)... Did I mention how awesome it was?

So that was the Mono Summit 2007 in Madrid. Now that I'm back and filled with all the energy I got from this amazing event, I decided to make some changes to the way I work, because I realized that I was still carrying around some old habits from the closed-source/enterprise world that are keeping me back. Old habits are really hard to break, so this past week I've done two radical changes that will, hopefully, be the trigger to improving my whole way of working.

The first change was dumping Windows completely, and with it, Visual Studio. The past thursday marked my first Windows-free week in 10 years of work. I'm now running full time on openSuse, and it's great :)

The second change was switching to a US International layout on the keyboard. I just reached the conclusion that the PT layout is not suited to coding at all, most of the keys I hit the most are hidden away with ctrl+alt combos, while in the US layout they are readily available on the sides. Also, the accentuation marks I need when typing portuguese are very easily reachable on a US layout, funnily enough, so I can still type correctly in pt without having to switch layouts. And my fingers and wrists are oh so thankful for the change, I hadn't realized what a strain it was to code until the strain was gone :D

So that's that, went there and back again, and it was inspiring in so many ways. Can't wait for next year ;)

PS: oh yes, almost forgot, you can check out the pics I took if you're in the mood. There are also links to more albums from other monoers in the Mono project site.

Saturday, October 06, 2007

Microsoft disponibiliza código fonte

Como já devem ter lido por aí, a Microsoft anunciou que irá disponibilizar o código fonte da maioria das bibliotecas do .NET 3.5. O código estará disponível para download, e estará integrado no Visual Studio 2008, pelo que passará a ser possível fazer debug ao .NET, tal como, aliás, o pessoal do Java já pode fazer há uma data de anos.

Já houve muitas reacções e comentários a esta notícia. Como parte integrante da equipa do Mono, não posso deixar de frisar o seguinte aviso:

Qualquer pessoa que olhe para código Microsoft, seja através de ferramentas como o Reflector, ou através deste pacote de código que a MS irá disponibilizar, não poderá contribuir para o projecto Mono. As regras de contribuição estão aqui, e não está previsto que mudem.

O Miguel de Icaza tem alguns comentários interessantes sobre isto, btw, recomendo a leitura.





Ficam avisados. Não cedam à tentação :)

Wednesday, September 26, 2007

Mono.Mozilla on Windows

Alexandre Gomes posted on his blog his experiences getting Winforms+Mono.Mozilla building and running on Windows.

First of all, I'd like to thank him for taking the time to try this out; I'm building regularly on Windows and I try to keep things simple, but things do always slip past unnoticed (especially when trying to keep linux, win+vs2k3 and win+vs2k5 in synch), so it's great to have an external pair of eyes looking at your stuff :)

He had some problems getting things up and running, so I thought I'd leave some pointers to help out those who want to test this out on Windows. Do check out his post so it's easier to follow along.

Building

You don't need the whole mozilla shell to setup the headers, the only thing you need is

  • the xulrunner sdk
  • xpidl.exe (from the xulrunner sdk)
  • libIDL-0.6.dll and glib-1.2.dll (from the wintools zip)
There's now a make.cmd on the "build" directory that does the same as the Makefile, so the steps are:
  • unzip the xulrunner sdk somewhere
  • put xpidl.exe and the two dlls in the build directory
  • open a command prompt, go to the build directory, and run "make [path-to-xulrunnersdk]".
In the include and linker configurations, you only need to point to your newly created build\include and build\lib, respectively. These contain everything that is in the sdk plus the extra header files.

The missing nsAppDirectoryDefs header has been added, so you don't need to google for it anymore. Ooopsie :)

Running:

To run an application, you always need to have in the same directory:
  • the contents of the xulrunner runtime package
  • your app's exe :)
  • the mono.mozilla dll
  • the xulbrowser.dll
If you want to have the runtime in a different directory, you'll need to first register it: in a command prompt, go to the xulrunner runtime directory, and run "xulrunner.exe --register-global".

Then, on the build directory, run "setup-runtime.cmd [path-to-your-application-exe], which will create some directories that are required to be where your app is.

Other problems
The browser problems mentioned (unable to input text) have been fixed, so the latest version should be fine.

The Mono.Mozilla project is also fixed.

As for the TortoiseSVN problems, I use tortoise for all my work and it's always worked great :p
Of course, I've never used the _svn variant, it's too much trouble and incompatibility just to have svn with webapps on vstudio. I suggest using the regular version for fun and happiness :)

Thanks again to Alexandre, and do nag me if anything goes wrong.

Friday, September 21, 2007

Something I drew...

Today I happened to be looking for a pic on my hd, and I came across the following picture.


First off, translation:

Top: "Citizen calling the tax service helpdesk so as not to waste the time of actually going there."
Bottom: "The good thing is you get to hear a nice lullaby while you wait."

I drew this in Photoshop, carelessly doodling, while waiting for the helpdesk callcenter to pick up my call. I think it's safe to say they weren't exactly fast.

And yes, I know, my drawing skills are, hrm, sketchy. But, I don't know, I just love this one.

Thursday, September 06, 2007

Interesting conversations

Being a very, errr, head-in-the-clouds sort of person, I had to go in a rush to renew my ID card. It expired yesterday, and I completely forgot to renew it before today, multiple warnings from friends, family and the occasional stranger notwithstanding. It's especially bad due to the fact that I sorta need it for an official thingamajig tomorrow, so it was kinda important to have it up to date... or at least not expired :p

Immersing myself in that weird place called a citizen's shop, where all the official stuff is gathered so it's easy to do everything in one place (you know, taxes, utilities, id renewals...), I went around looking for the proper booth or desk or whatever it's called so I could take my numbered ticket, and found it, easy enough. Actually, found two. First, there's the booth where you buy the forms. Gotta take a ticket for that and wait in line. Then there's the booth where you deliver the forms. Gotta take another ticket for that and wait in line. Yes, typical. Got both tickets before going to wait by the first booth, because, as I had guessed, the line to deliver the forms was at number 403 when I got there, and my ticket had the number 490. Typical. Cue long wait, punctuated by a trip to the photo store to take pics for the card... I had figured I would have time enough to do that, so I didn't bother doing it before going there :)

My number is up, get to the counter to deliver the forms, sign the id card.

woman: "oh oh"
me: "oh oh?
woman: "you'll have to sign the form again, the signature doesn't match the one you put in the id card"
me: *looks at both and finds no differences.*
me: "where are they different?"
woman: "can't you see? they're different!"
me: "I can't see it. Ok, maybe this one is slightly rounder, is that it?"
woman: "no, don't you see? look at it"
me: "..."
woman: "the G!"
me: "..."
me: *signs again*
woman: "they're still different! this is the id card we're talking about!"
me: "ok..."
woman: "you're missing a dot there on the i"
me: *puts the dot in*

Going smoothly so far. I get my finger all blackened up for the fingerprint, she takes my old card, I get the receipt of delivery with my data and when I can pick it up, and then...

me: "so... will this receipt serve as a standin for my id card?"
woman: "no"
me: "so... what do I use if I need to identify myself?"
woman: "your driver's license will do"
me: "so... what if I don't have a driver's license?"
woman: *blank stare and pushes the buzzer to call up the next number*

These things are always so much fun.

Note: it's not that uncommon here for people not to have a driver's license, but you must carry your id card at all times. The id card expires every 5,7 years, while the driver's license lasts about 50 years without needing a renewal, so if you're 50 you can be carrying a license with a picture of you when you were 18... not a particularly trustworthy piece of identification if you ask me. :)