Wednesday, May 30, 2012

Downloading sources and JavaDoc for JBoss AS 7.1 using Maven

If you work in an IDE like NetBeans, or Eclipse with m2eclipse, you'll be used to having the sources and JavaDoc of Maven artifacts downloaded automatically. This usually works well.

Sometimes you want the sources for things that aren't direct dependencies though. I most often run into this when debugging an issue takes me into the guts of an application server. For example, when debugging yet another annoying Mojarra issue on JBoss AS 7.1 I needed sources for several unrelated chunks of the server. I didn't particularly want to build the server from scratch; I was interested in behavior on a release build. So I just asked Maven to download the dependency sources and JavaDoc for me:

$ mvn dependency:resolve -Dclassifier=javadoc
$ mvn dependency:sources

Of course, this'll only help you if library packagers have bothered to bundle the sources and JavaDoc of their library with their binary artifacts. This should be mandatory for upload into Central, but unfortunately isn't enforced or even strongly encouraged so artifacts are often missing sources. Maven can't (yet) use the SCM info to check them out for you, so you're stuck dealing with this mess yourself.

With the increasing profusion of complex dependencies in use in apps, we really need to make it mandatory to publish sources and JavaDoc to central alongside any binary artifacts for packages with open source licenses.

Can't check out a remote branch from git?

Trying to check a remote branch out with git, and having it deny the existence of the remote branch? Or report something like:

$ git checkout --track -b 7.1 upstream/7.1
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'upstream/7.1' which can not be resolved as commit?

You need to fetch the remote. Not just the branch you want; git fetch upstream 7.1 won't work, you need git fetch upstream to fetch branch refs etc. See http://stackoverflow.com/questions/945654/git-checkout-on-a-remote-branch-does-not-work and http://www.btaz.com/scm/git/fatal-git-checkout-updating-paths-is-incompatible-with-switching-branches/

There's also a handy tool I didn't know about despite using git for a fair while now:

$ git remote show upstream
* remote upstream
  Fetch URL: git://github.com/jbossas/jboss-as.git
  Push  URL: git://github.com/jbossas/jboss-as.git
  HEAD branch: master
  Remote branches:
    7.1    new (next fetch will store in remotes/upstream)
    master new (next fetch will store in remotes/upstream)
  Local ref configured for 'git push':
    master pushes to master (up to date)

Extremely handy Java debugging trick

Tuesday, May 29, 2012

Adventures in Eclipse-land - Coming to Eclipse from NetBeans

When working with JBoss AS 7, it appears that it's just assumed you'll be working with Eclipse. Nobody seems to really talk about NetBeans, the IDE I've been using most of the time for the last few years. I thought there had to be a reason for this, and decided to give it another go.

I'll be jotting things as I go in the hopes of helping others out, and to highlight potential usability issues.

So far, it's pretty simple. Eclipse is painful to use in places, does some things quite strangely, and it's all worth it for the dynamic web module. I cannot possibly express how wonderful it is to use after the compile-redeploy-test cycles I've been doing while using JBoss AS 7 on NetBeans.

Friday, May 25, 2012

PostgreSQL usability - PgAdmin-III and Pg need some usability love

As anyone who's read much here will know, I'm a huge fan of PostgreSQL, the powerful open source relational database management system. It is an amazingly project with a team that keeps on releasing high quality updates full of very useful new features and improvements.

This is my blog, so there must be a "but", right? You're quite right.

I already wrote a PostgreSQL: Great even when you can see the warts in response to a perhaps overly glowing write-up someone did a while ago. I'm not covering that again here; this post is specifically about a topic more and more dear to my heart, that of usability.

As a long-time UNIX geek I've always found PostgreSQL quite easy to use, because I live on the command line where psql is just wonderful. Recently, though, I had to use PostgreSQL on Windows, and in the process couldn't help seeing it from the new user's point of view. In fact, I tried to think like a new user as I performed the tasks I needed to do.

It wasn't all roses. I knew enough about Pg to get past the issues pretty easily, but some of them would be real roadblocks for new or even intermediate users, and I think they're worth highlighting. Many of the issues were with PgAdmin-III, but far from all of them.

This post started out as a minor critique of a few usability sore points in Pg and PgAdmin-III. As I went through step-by-step producing screenshots and thinking through the process as a user, though, I realised it's an absolute, complete and utter train-wreck. If this had been my first experience with PostgreSQL, I'd be a MySQL, MS-SQL or Oracle user now.

You CAN download legal Windows 7 ISO images, it's just well hidden

UPDATE 2015-04-08: It looks like the ISOs are no longer available from DigitalRiver, or at least not at their old locations, since Windows 7 went EOL.

Yesterday I had a frustrating time after discovering that the one and only non-OEM-contaminated Win7Pro x64 disk I had was faulty - half way through a win7 reinstall. All I wanted was a download of replacement media, as I had a license already. This should've been simple, but no! Microsoft direct you to your OEM or retailer in all documentation on the topic, never even hinting that you can just download the ISOs without needing MSDN.

I even called Microsoft support, which is a mark of desperation if ever I saw one. They were as unhelpful as expected, patronisingly explaining that the license key is from a computer manufacturer so I have to contact them for replacement media. Even though I don't want the OEM's butchered Windows install media, I just want stock win7. I don't want the mangled Windows the OEM supplies, and even if I did they'd only post it to me not offer a download. They also only supply service pack 0, and I needed SP1-integrated ISOs.

I have a license to the product. You can't use the media without a license. The media have no copy protection so it's not like they particularly try to prevent their copying/distribution. Yet the official story is that you just can't download it unless you've bought an new license to a retail version online through Microsoft Store. Pathetic.

After too long digging around the net I found out that, yes, you can just download the ISOs after all. Microsoft just apparently don't admit it or talk about it. That's customer-hostile even for them. Go here:

http://www.mydigitallife.info/official-windows-7-sp1-iso-from-digital-river/

or http://www.mytechguide.org/10042/windows-7-service-pack-sp1-official-digitalriver-download/

... to get service pack 1 ISOs. Legally, from Digital River, MS's online/digital distributor. Yes, that means you must have a valid license and key to use them, as normal.

They even provide SHA1 checksums, which NOBODY seems to publish for Windows ISOs or pretty much anything else in the Windows world.

  • Windows 7 Ultimate SP1 x86 SHA1:
    92C1ADA4FF09C76EC2F1974940624CAB7F822F62
  • Windows 7 Ultimate SP1 (SP1-U Media Refresh) x86 SHA1:
    65FCE0F445D9BF7E78E43F17E441E08C63722657
  • Windows 7 Ultimate SP1 x64 SHA1:
    1693B6CB50B90D96FC3C04E4329604FEBA88CD51
  • Windows 7 Ultimate SP1 (SP1-U Media Refresh) x64 SHA1:
    36AE90DEFBAD9D9539E649B193AE573B77A71C83

I've verified the x64 SP1-U checksum to match what I downloaded from Digital River. I haven't checked the others.