Saturday, May 24, 2008

Visual Studio Add-in suckage - part deux


As you can see, I have managed to slap together some rudimentary integration of JIRA with Visual Studio. You can log in to JIRA, download saved filters, run them and display filtered issues. Adding other functionality exposed by JIRA SOAP and RSS interfaces should not be a problem.

But there is another problem: integration as it looks right now is pretty useless. And it seems that due to Visual Studio's automation interfaces being somewhat limited in functionality there is not much I can do about it.

See, the whole point of integrating JIRA (or whatever other external tool) with IDE is automation of workflow. For JIRA, that would be mostly task flow automation. You would want to:
  1. select a task from some list of tasks
  2. work on it for some time, potentially finishing the task
  3. commit files you have modified during your work
  4. report time spent on a task (if you are one of these old-school project management enthusiast and don't believe in agile ways, for which individual effort tracking is sort of pointless)
We already support this in our IDEA plugin, mostly by means of:
  • standard and very potent VCS interface
  • built-in support for change sets (sets of files modified after being checked out of the repository), into which we could plug in
We are still far away from the completeness and automation of Mylyn's task support, but even today you can:
  1. list issues based on some filter
  2. assign an issue to yourself
  3. create a change set based on an issue key and make it active
  4. modify a bunch of files, which will land in this change set
  5. commit the whole change set in one go, automagically using the issue key as a part of commit message, so that information about committed files lands in JIRA
Now, with Visual Studio, the last three steps seem to be absolutely impossible to implement using its extensibility interface. The crucial window - Solution Explorer, does not expose any automation interfaces, and does not support filtered views. The only way to "filter" files is to exclude them from the project. Which is an absolutely dumb thing to do, because then they will not be a part of the build! Moreover, Visual Studio's VCS interface (MSSCCI) is not used by two of the most popular Windows Subversion clients - TortoiseSVN and AnkhSVN! I could theoretically (although it would be as pleasant as pulling teeth) use a command line SVN client. But without some way to show sets of modified files (like in IDEA's changesets), I don't think I can do anything.

It would really really (and I do mean realy) suck if I had to create my own source file tree views, detect file modifications (especially because of non-standard SVN client APIs) and synchronize these views with main "solution explorer" view somehow.

On the positive side, C# continues to be quite decent. Also, the whole System library has been quite nice to use so far. My only nitpick is that I would make public member variables first-class properties. It is dumb to have to write a getter and setter for a read/write int-type property (not that Java is any better in this respect mind you).

Oh, by the way, you can grab sources of the visual studio plugin here

Wednesday, May 21, 2008

Let's write to Europe

Support Polish candidacy for EIT (European Institute of Innovation and Technology)

Simply go to this page: http://napiszmydoeuropy.onet.pl/ (switch to English if you don't speak Polish :), read the letter and sign it (or just sign it without reading).

Thank you for your support :)

Monday, May 19, 2008

.NET: First Blood - or - Visual Studio JIRA Connector

Well, so I have decided to try if a JIRA add-in for Visual Studio can be created. Why? Two reasons:
  • a lot of users asked for it. Much more users than I would have imagined
  • I want to finally learn C#. Somehow I never had time and opportunity to do it
Result - well, it is perfectly doable. So I will work on it as my "20% project" for Atlassian and release it as open source. When will I release it? Hmm - whenever it has just enough functionality to be useful to somebody.

I have learned some things in the process, both good and bad, about .NET and Visual Studio add-in programming.

The good:

C# as a language is actually pretty damn good. Frankly I have not expected it to be that good. It certainly is as good as Java. What do I like in particular? Two things so far:
  • operator overloading. Oh yes, baby! whoever decided that operator overloading is not going to be available in Java should seriosly reconsider. Overloaded operators rock. Their absence in Java is my second grudge about this language, right behind the lack of 'const' keyword (which always catches me by surprise - it is such an obvious thing to have in a language, yet somehow it does not exist in Java)
  • the fact that object properties are first-class citizens in C#, which is not the case in "straight JSE" Java.
These two things allows you to elegantly set event handlers for Form windows and such - you simply write something like something.someEvent+=someHandlingMethod. Notice also how the handler is just a method (as it is supposed to be) and not this ugly-looking and clumsy Swing's in-place -created anonymous inner class object.

The Expected:

It was a sigh of relief that .NET's SOAP stack plays well with JIRA's quite ancient AXIS SOAP stack. Which did not necessarily have to be the case. For example, CXF refuses to cooperate with JIRA.

The other thing that I have sort of expected is that the quality of the built-in "intellisense" leaves a lot to be desired. It is no match to Eclipse's or IDEA's.

The Bad:

As usual, Microsoft blew it when it comes to both API quality and its documentation. The first thing I wanted to do is automatically open a "tool window" thingy whenever Visual Studio starts. After some 30 minutes of googling around (don't get me started on MSDN's search feature - it sucks bug time), I have found the CreatToolWindow() method of some crucial class. The thing is - this method is so inconvenient to use (read: requires creation and registration of a COM object and wrapping it around some sort of a "shim" wrapper - blargh...) that it was replaced, in a typical Microsoft style, by a CreateToolWindow2() method (nice name, huh?).
The thing is, if you try to use this method the way MSDN tell you to use it - it will not work. The window will just not show up! The problem with this code is that the created window object is assigned to a local handle in an OnConnection() method of the (charmingly named) IDTExtensibility2-derived class object. This makes it go out of scope when the OnConnection() method returns - which seems to kill the window before it shows up. The funny thing is, if you crate the window the same way in some command handler method (say, attached to a menu or a button) - the window will show up, even though its handle goes out of scope just the same! Race condition? Sloppy design? Sloppy docs? Go figure...

The "proper" way to show a tool window is to create it in the OnStartupComplete() method and assign to an object's member variable (or to whatever variable that stays put after the method returns). Somehow, putting the window creation code in the OnConnection() method does not work for me no matter what.

Let me just tell you that it took me quite some time to figure this shit out. Somehow, even google does not know the right answer. I guess this blog post is the first ever source of information on how to create tool windows in Visual Studio! Yes! I rule!

Quality doesn't suck (at all)

I disagree with previous post written by Pawel regarding quality. And what I'd like to write is too much for just a comment.

- Quality? - all right, but if time permits...

How often do you hear that? If you hear that often it means that probably your product's quality sucks.

Suppose that your team has to implement some stories in the fixed period of time (let's also suppose you are not using Scrum and you are not iteration-oriented). Then the customer pushes the higher management to move the deadline - of course for the earlier date. Team lead will not throw away any stories (what she should do) because the higher management would fire her. What she will do? Tell the developers to implement the same amount of features in shorter time. Developers subsequently will also have to sacrifice something - most probably they will not sacrifice their family life and free weekends. They will sacrifice QUALITY.

According to "Peopleware" book your product requires much higher quality than your customers need. Why? Because Quality, far beyond that required by the end user, is a means to higher productivity.

Reading the same book further there is an excellent example (Janusz who drives Toyota cars is absolutely right :) I will try to rephrase it here. If you think of high quality (either company, nation, culture, etc.), what pops to your mind in the first place? For me it would be Japan. Again, if you think of high productivity, what pops to your mind in the first place? Japan?

The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.

But Pawel complains that there is no need to think on the design, architecture, etc. for too long - just do it. Yes - you're right. That's the XP idea of simplicity - design what you need today - tomorrow you will refactor your code, design and architecture, but if only you will need to do it.

And that's the quality for me! And quality doesn't suck, at all :)

Thursday, May 15, 2008

Big brother is watching

So, here's a funny thing - if you enter US or UK in that matter (probably some other countries too) your laptop can be checked and I don't mean "please turn it on so we see if it's real". According to article written by Bruce Schneier (one of security gurus in US) border agents can actually dump your disk image to process it, or can keep your laptop for a few days to search it for anything they want. Got naked pictures of your SO - you'll make them happy ;-)

Recently US court ruled that it's legal for border agents to search your drive. UK agents have similar power. Check article for details.

I say - WTF?! Soon you'll have a full 24 hours monitoring in your home provided by the government, just for your protection of course ;-)

Wednesday, May 7, 2008

Ouch, UTF-8 not supported?

Funny story, I was digging into FishEye's bug database and noticed one bug related to Russian localization. I thought it'll be easy by me to reproduce (as I use Polish locale) so I'll take care of it.

The problem was that zip archives created by FishEye don't handle well Russian characters. It was very easy to reproduce for me. Then I started digging more - I wanted to fix this.

And here's a funny thing - I thought that in 2008, after web 2.0 explosion, after UTF-8 became de facto standard (OK, assumed by me) for characters encoding as many sites support multiple languages at the same time I expected that archives should also support UTF-8 out of the box. Well - wrong me :-)

I read ZIP spec and found out that UTF-8 support was added pretty recently - as Wikipedia says around September 2007. Ouch!

Today I found out that 7-ZIP one of populars archivers is going to support UTF-8 in upcoming release! Wow! I amazed. But it seems that they piss on ZIP's spec and decided to use their own approach on detecting UTF-8.

As I tried to handle this issue for our customer I tried some alternative archivers - Windows Explorer, WinRAR, WinZip. None of them was able to understand my ZIP archives.

I thought, let me switch to some ZIP's alternative - tar. Ouch again! Tar is supposed to store filenames in ASCII according to spec, it seems that Linux implementation does not follow spec word by word - so you actually can put UTF-8 into it. But Ant's tar implementation which we use in FishEye actually truncates characters to 8 bits. So it produces even prettier trash ;-)

RAR is supposed to handle UTF-8 (at least spec says it does), 7-Zip's own format 7z also supports UTF-8. But there's a problem - RAR is a closed format that you have to pay for and I don't think there's any API for Java for it, 7-Zip also has no support in Java world.

So did the world stopped on ZIP and Tar? It seems it did. I can't believe! Isn't there any real alternative that you could use? I'd love to see some format that has API for C, C++, Java, python, PERL, ruby, and so on with nice GUI on Windows, Mac. Any volunteers? :-)

Or is it just a sign of times - that those kind of applications are not widely used anymore?

Thursday, May 1, 2008

New neighbor

Dear rm,

As you asked to lower our rants volume I'll try to rant more quietly...
And you mentioned the depression and spring and the weather, and I am just looking out the window...
OK, I was joking :-)

Last year we had an invasion of martins, one pair decided to build an apartment on my balcony:


This spring we have new neighbors - a pair of sparrows moved into the nest. It was fun watching them bring all sorts of stuff to make the apartment more cosy.



And guess who is the most passionate bird watcher.

Directly Marketed Charity

I've just been Directly Marketed by a charity organization.

I am particularly picky about any marketing/psychological tricks played on me, so I instantly started a little background investigation.

The mailing contained a heart-breaking leaflet about hunger among polish children, reaching 70% of population below 15 years old (quite a lot for an European country, IMO. I asked them about which research exactly they took this data from), 3 nice postcards and a set of stickers with my name and address (with a mistake, unfortunately, otherwise they would be quite useful). How to translate "reguła wzajemności" to English?
I googled the organisation, it looked fine.
I looked at the published annual report, it also looked fine.

I was 1 second away from making some donation.

Then my inner Richard Stallman woke up.

The mailing stated the source of my personal information - acxiom.pl (does it sound familiar to anyone? ;-) ). Where the hell did they get my PII from - with this kind of mistake in the address? (3 instead of 5, wrong character case - IMO must have been mis-OCRed)

Why does the charity organization insist on sending the donation to a personally identifiable account? Do they intend to nag me about more donations once I make one, track their ROI on chosen marketing strategy or sell back info about my response willingness to Acxiom?

Why does a charity organization with 3M PLN yearly budget have 1M PLN in cash at the end of fiscal year? Shouldn't they distribute cash as quickly as possible?
Why the hell do they state in details in the annual report who received ~120kPLN of their funding, but the rest of ~2M PLN was spent on just "statutory activities"?

Am I too paranoid to be useful for the society?

I just made a donation to a semi-random charity org to prove myself that I am not just being mean ;-)