Goodbye, Hello

# 2007-08-01 22:02:54 -0400 | General / Java | 2 Comments

Today, Atlassian acquired Cenqua. More details here.

Kinda seems surreal typing that in. But without a doubt exciting. Certainly seems surreal that I’ll be moving to Sydney, but that is real exciting too.

Not much more to say than that at the moment, other than it is full steam ahead on making FishEye, Crucible and Clover kick more arse than ever before. And looking forward to catching up with a lot of the Sydney crowd.

Just a theory

# 2007-07-24 12:16:27 -0400 | General | 15 Comments

Creationism vs. Evolution is a hot topic at the moment. A common criticism (or more often: slur) against Evolution is that it is “just” a theory. It is so easy to roll your eyes at this, but it is a criticism that is not without merit if only because the word has an overloaded meaning:

  • Common usage; “in theory” as opposed to, and often different to, “in practice”.
  • Scientific usage.
  • Mathematical usage; a truth derived from fact.

To any slur against Evolution on its basis as a “theory”, you need to shift the person from the common usage of the word to the scientific. My problem is I’ve often found explaining the scientific method to a novice very hard. A slippery-slope of “weak” prepositions that seems a far cry from the popular view of science and scientific certainty.

So it was nice to find this quote today that I think sums it up quite well (via about.com):

“A theory is a meta-scientific elaboration, which is distinct from, but in harmony with, the results of observation. With the help of such a theory a group of data and independent facts can be related to one another and interpreted in one comprehensive explanation. The theory proves its validity by the measure to which it can be verified. It is constantly being tested against the facts; when it can no longer explain these facts, it shows its limits and its lack of usefulness, and it must be revised.”

This is from a 1996 writing by Pope John Paul II to the Pontifical Academy of Sciences (full text).

I like this quote because it moves a “weakness” of scientific theories — a theory is not a truth but merely something that matches the facts — to a strength: their explanatory power.

Explaining power and truth

Scientific theories are not truths.

Or rather, they may be true but we don’t care about that so much. We only care a) if they are demonstrably not true, and more importantly b) that they are useful. There is no better example of this than Newtonian physics, which is a theory of how objects should move. Newtonian physics is demonstrably false. But the predictions (explanations) it makes for every-day sized objects are very very very close to correct. In addition, Newtonian calculations are much easier to do than the calculations of Relativistic physics (which is the rival theory). So Newtonian theory is useful.

And many other things being equal, useful trumps truth.

Well, perhaps that is a bit hyperbolic. Maybe it just trumps being false.

Anyway, and going back to the late Pontiff’s quote, we must keep these two things separate:

  • the extent to which a theory matches observations made so far; and
  • accepting something as a fact.

The first of these is the domain of the scientific method. Which is a very interesting domain, and one I have had fair exposure to.

The second of these is the domain of philosophy, epistemology (study of knowledge) and belief. Which is also very interesting, but one to which I am new.

Serving one Apache site from two parallel directories

# 2007-05-23 16:29:23 -0400 | General / Java | 2 Comments

Some of you may say “whytf umofo”, and some may say “I’ve always wanted to be able to do that!”. This hack is for the later, but I will try below to explain to the former why it is useful. If anyone knows of an easier way to do it, please let me know.

Apache httpd serves static content out of its DocumentRoot :

DocumentRoot /usr/local/apache/htdocs
<Directory /usr/local/apache/htdocs>
  Order allow,deny
  Allow from all
</Directory>

The contents of that location in the filesystem might look like:

/usr/local/apache/htdocs/index.php
/usr/local/apache/htdocs/images/a.png
/usr/local/apache/htdocs/images/b.png
/usr/local/apache/htdocs/images/c.png

And to a web browser, the site looks like:

/index.php
/images/a.png
/images/b.png
/images/c.png

All very vanilla. But sometimes you want to be able to store the site in two parallel and overlapping directories in the filesystem, without changing the way it is presented to the browser.

/usr/local/apache/htdocs/index.php
/usr/local/apache/htdocs/images/a.png
/home/matt/alt_htdocs/images/b.png
/home/matt/alt_htdocs/images/c.png

If you don’t have parallel or overlapping requirements, then Alias is your friend. If you do, read on.

The Hack

Do this:

DocumentRoot /usr/local/apache/htdocs
<Directory /usr/local/apache/htdocs>
  Order allow,deny
  Allow from all
</Directory>

RewriteEngine on

RewriteCond "/home/matt/alt_htdocs%{REQUEST_URI}" -f [OR]
RewriteCond “/home/matt/alt_htdocs%{REQUEST_URI}” -d
RewriteRule ^/?(.*)$ /home/matt/alt_htdocs/$1 [L]

<Directory /home/matt/alt_htdocs>
  Order allow,deny
  Allow from all
</Directory>

If you don’t want to serve directories from the alternate docroot (Options +Indexes) then you don’t need the RewriteCond with the -d. Remove it and the [OR] from the previous line.

If you want to add a restriction to the alternate docroot, for example only allow the images directory, then put that in your regex:

RewriteCond "/home/matt/alt_htdocs%{REQUEST_URI}" -f [OR]
RewriteCond “/home/matt/alt_htdocs%{REQUEST_URI}” -d
RewriteRule ^/?(images/.+)$ /home/matt/alt_htdocs/$1 [L]

If you want three or four or five alternate docroots, just copy-and-paste the three rewrite lines as necessary. And remember you may need a <Directory> section for each location.

How it works

If you see a file or directory in the alternate docroot, then serve it. Otherwise: DocumentRoot.

The RewriteConds look into the alternate docroot, and checks if a file (-f) or directory (-d) exists under there that matches the REQUEST_URI, which is something like /index.php or /images/b.png.

If either/both of the RewriteConds match, then the RewriteRule runs. If its regex matches, then we give Apache the explicit filesystem path it should serve. If no such rules match, then the DocumentRoot comes into play.

In some situations (if you are doing further rewrites) then you may not want the [L], which instructs mod_rewrite to run no further rules for this request.

Untested

Today is the first day I’ve used this hack, so YMMV. But it seems to work very well for static files. Preliminary testing also indicates it works for .php files (in both the normal and alternate docroot). I doubt it would work if trying to include one .php into another across docroots.

The Use Case

Why would anyone, or even myself, find this useful?

Websites tend to end up like my son’s food at the end of dinner: all mushed up into a claggy mess. You may be running a couple of PHP apps, a couple of your own apps, in addition to a bunch of static files. And you may care about permalinks. And sometimes all these things overlap in the filesystem.

One solution is to copy everything into the one docroot. When it comes time to upgrade a component, you have to selectively pull out the old bits and dump in the new bits, without overwriting everything else. That sucks, and is why I always hate upgrading my WordPress instance.

The other solution is to put each component in its own directory. Upgrading a component is then the graceful process of deleting a directory and replacing it with new content. Separate directories can also have differing permissions, so that they can be edited by different people or programs.

If your components don’t overlap, then vanilla rewrites or Aliases work very well. Otherwise this hack may come in handy.

Further work

I’m sure this could be done much more easily with a custom module, in the vein of VirtualDocumentRoot. Ideally it would be nice to say (with options for specifying priority):

DocumentRoot /usr/local/apache/htdocs
AltDocumentRoot /home/matt/alt_htdocs

It would be also nice to be able to support parallel-overlapping views in the filesystem proper. A kind of “mount” that presented a view of several parallel directories.

JavaOne Wrapup: days 2 to 4

# 2007-05-13 09:32:29 -0400 | General / Java | 4 Comments

I’m now back here in Sydney waiting for my connecting flight back to Canberra. Great-googamooga the last few days have been a whirl, and hence a lack of blogging.

Day Two (Wednesday)

(I didn’t have my camera with me this day.)

A good day at the booth. I had a couple of Technical Sessions on my schedule, but it was a busy day on the floor.

The Java Posse was walking around interviewing the vendors, I’m sure it is going to be a very interesting podcast. They stopped by our booth, so listen in to that podcast if you want to find out what code-coverage our Clover product achieves.

The first event of the evening was the Adobe party, at the poolroom in Jillian’s (in the Metronone). Open bar, good food, lots of nerds, pool tables. What more could you want. Joe Nuxoll taught us how to play “cut throat”, which is an awesome 3-player (or 3 teams of 2) game. Kind of a cross between billiards, Risk and Diplomacy.

Next was the Google party, and while at a much swisher location, didn’t quite achieve the same vibe. But full of interesting people. I spent a lot of the night chatting with this very nice chap from the Google-mobile team in London.

Day ended around 3pm after a quick trip to Loui’s Diner for some pancakes.

Day Three (Thursday)

(I didn’t have my camera this day either… perhaps a good thing.)

This was the last day on the booth. Didn’t get to any technical session but spoke to a heap of interesting punters. In previous years, I was a reasonably dedicated schwag hunter, but there are only so many flashing buttons and mouse-pads that you need. I picked up a Duke plush doll, and a couple of Sun mugs with funny phrases on them (the details of which allude me right now, blame it on the timezone shift). One of the coolest schwag items (beside our own t-shirts, of course, of which we ran out earlier that day) was a cool blue/pink ball (from Terracotta I think). It was blue, and if you threw it up it would kind of turn inside out and when you caught it it would have turned pink. I suppose you had to be there.

Later that afternoon we decided to organize what will hopefully become the Inaugural Cenqua Just-In-Time JavaOne party. To protect the innocent, and perhaps not so innocent, I won’t go into too much details about who we managed to drag along. Let’s just say it involved a little obfuscation. There were some abstractions in the design that definitely did not leak, no matter how hard we looked.

The day ended again around 3pm, with another trip to Loui’s. Well, for some of us it ended at 3pm: some were still arriving back at the hotel when I was getting up for the General Session on day 4.

Day Four (Friday)

The last day. Fighting a hangover that was much smaller than it deserved to be, I headed out for the “Toy Show” General Session. This was pretty fun, and like each year James makes a great host. (I should really try getting to the other General Sessions and Keynotes next year.)

The show started with a set of “tycho” (spelling?) drummers, which was really fun.

Roman Sholopsk showed the “DTrace Light” / “DLight” visualizer. This would actually be really really useful if dtrace ran on something other than Solaris.

Tor Norbye a gave “mashup” presentation showing off the new Netbeans. I can’t say that the refactorings and tools on show in Netbeans were anything I hadn’t seen before in IntelliJ IDEA, aside perhaps from the great JRuby support. Tor’s style and presentation was top notch: even though he talked fast, clicked around the screen fast, and presented a lot of dense information, I was always able to grok what he was saying and as I then started to wonder about how you would do X, he started showing how to do X. A very cohesive and coherent and grokkable presentation.

There was a demo of the Blu-Ray technology: the whole menu-system jobbie in Blu-Ray is a Java derivative. Very impressive actually.

A couple of guys from Cinegistics showed an app for use when setting up video shots. Plug your HD camera into a laptop, and this (almost 100%) Java Swing app shows the scene, can highlight light/audio problems etc. The most impressive thing was that all the number crunching was done in Java. I have seen a few things at JavaOne that I wouldn’t have given credit as implementable in Java.

Those Java-enabled robots made an appearance. They are very cute, I went and checked out their booth the previous day. This following robotic arm was able of achieving rapid movements in access of 10g. All in RealTime Java. Impressive.

They “flew” in (suspended from wires) Paul Perrone’s remote helicopter, which has a 3D laser imaging system on the bottom. It was able to take these great 1000-scan-per-second 3D linear maps of the stage, with James and Paul lying on the floor. All the imaging and stability processing was done in RT Java. I think that’s great.

After a trip to the Pork Shop for breakfast, and Ritual Roasters for coffee, I headed back to JavaOne for Martin Odersky’s Scala talk.

Scala is very, very interesting.

And that, as they say, is the end. Another great JavaOne.

JavaOne day one

# 2007-05-10 03:13:32 -0400 | General / Java | No Comments

Woi, and intense, exhausting, exciting day yesterday.

In typical form, we managed to setup our booth (above) and demos just moments before the Exhibitor’s Pavilion opened. The first day on the floor is always a killer: 11:30am to 8:30pm. I was wise and kept up my sustenance over that period; an apple for breakfast and an Oreo for lunch.

It was my turn to be the media whore today. Lucky I had had a shave. First up was an interview with SYSCON-TV http://soa.sys-con.com/read/372918.htm (the title is a little OT, and I’m pretty sure I didn’t use any of those exact words, but the gist is right). I was also interviewed by Frank and Bill for an Artima podcast. They both ask great questions and it was a lot of fun chatting to them.

Against one of the far wall in the Pavilion is one of those Sun datacenters-in-a-cargo-box thingies on the back of a huge semi trailer. High candy value, I’ll try and take some internal photos tomorrow.

I managed to sneak away from the Cenqua booth to go see Neal Grafter’s Closure technical session. He does a lot of pointing.

Neal’s explanation of his Closure proposal is thorough and clear. I got up and asked him a question during the Q&A, but managed to completely dilute my real question with qualifications. I’ll try and write more about that later, if I can get my head together.

At the end of the day I hit the Closure and Java Posse BOFs. The Closure BOF ended up as mostly a re-cap of the previous technical session. The Posse’s BOF was great, though not all of us found it enthralling as others:

After that some of the people at the Posse BOF went to the pub for a few well-desereved coldies.

phew now starts Day Two…

Netbeans day: arvo

# 2007-05-08 16:47:30 -0400 | General / Java | 1 Comment

The “JRuby: understanding the fuss” talk was very interesting. I was surprised to see how rich and “deep” the Ruby mode in Netbeans was. And step-debugging through lines in .rhtml files was a very neat trick. They asked how many people in the audience liked doing webapp development using their framework of choice. The response should neither shock nor surprise: very close to zero.

Tor found a few bugs in Netbean’s doco-popup support, which was funny for us and no doubt useful for him.

The JRuby presentation was structured very well, which couldn’t really be said for Gosling’s “Netbeans Toys” segment that came next.

Gosling was his usual self: excited yet monotone, and not giving anyone an inch. I suppose it is a hard task to come up with an interesting “toy” story involving Netbeans, and none of the presenters were up to the challenge. There were about 8 too many class diagrams in the RDF presentation (and, wtf, between alt-tabbing windows I could see his Inbox unread count; it went from 2800 one minute to 2934 the next). The JMF guy was dropping frames like there was no tomorrow. The best effort was put in by Bob Beasley and his D.O.R.K. device. I give the man full credits for showmanship, and those SunSpot jobbies look pretty cool.

Tomorrow: JavaOne day one. 9 hours on my feet, hopefully I’ll get to the Closure Technical session during the day, and the Closure and Java Posse BOFs in the evening. The Java Puzzlers TS will be a stretch-goal.

Netbeans day: morning

# 2007-05-08 08:02:25 -0400 | General / Java | No Comments

After a quick visit to the Apple store, I spent the morning at the CommunityOne event (ala Netbeans day).

The first general session included a chat by Jonathan Schwartz and Rich Green. Although they jumped around a little, they kept coming back to “Java is too hard” (Jonathan’s words). I suppose that it is a reasonable (or at least expected) schpeel if you are pushing a tools platform like Netbeans. That didn’t stop me from rolling my eyes when they said that; but at the same time there is a small part of me that said “damn straight”. That part of me is a little bugger to try and pin down and interrogate, so I don’t have much more to say on the topic yet; but I hear that voice all the time when considering new potential features like closures in Java.

After the general session, the Java Posse recorded a podcast. Definitely a funny bunch, and particularly gratifying that both FishEye and Crucible were in their “top 10 tools we use” list.

Laughing out loud

# 2007-05-08 01:10:43 -0400 | General / Java | 2 Comments

I work 99.9% of the time from home. But I keep in mostly constant contact with the gang through IRC and IM. This of course brings with it the usual accompaniment of standard (lol, rofl, bbiab, ack, nak) and non-standard (co=cool, swee=sweet, mo=mos=’o=morning) shorthand phrases.

Inevitably, at least for me, this physical-isolation but virtual-colocation has lead to me tuning down the physical component of communication. For example, I may not be actually laughing out loud even when I’m lol-ing on the inside.

So I always enjoy the time I get to spend with the boys at JavaOne, and as Conor’s weird look to me this morning can attest to, I still do laugh out loud (as seen on IRC and heard in the hotel room):

spud: as conor can confirm: laughing-out-loud http://xkcd.com/c258.html

JavaOne once again

# 2007-05-07 09:14:56 -0400 | General / Java | 1 Comment

Just arrived at San Francisco again, for this years JavaOne. Bee-autiful day here, just enough time for a quick blog from the hotel room before heading out for drinks.

Under reasonable experimental conditions

# 2007-05-03 15:46:01 -0400 | General | No Comments

Some of they guys at work went to see Tim Minchin this week. Wish I could have gone, check out this great short song: “If You Open Your Mind Too Much Your Brain Will Fall Out (Take My Wife)” mp3 link.