Note: This is the archive of my old homepage. To continue to the new homepage, go to http://davidtanzer.net

This is the personal homepage of David Tanzer. Here you can find a blog-like collection of articles I write. The RSS newsfeed is available here. You can contact me via email: mail-AT-davidtanzer-DOT-net.

You may use everything I write in this blog (tagged as "Submitted by struppi") except the linked papers and some other parts with explicit exceptions to this license, in whole or in part, without asking as long as you give me credit (like for example: "David Tanzer (http://davidtanzer.net) wrote in his blog: [Some quote from this homepage]").

Statement of Audience

I just read Why I Hate Personal Weblogs, an essay by Donald Brook written in Septemer 2002. There is a lot of truth in there, even if it is hidden between lots of swear words, so here is my Statement of Audience as suggested by the essay:

Statement of Audience
---------------------
I realize that nothing I say matters to anyone else on the entire planet. 
My opinions are useless and unfocused.  I am an expert in nothing.  I know
nothing.  I am confused about almost everything. I cannot, as an
individual, ever possibly know everything, or even enough to make editorial
commentary on the vast vast majority of things that exist in my world.  This
is a stupid document; it is meaningless drivel that I do not expect 
any of the several billion people on my planet to actually read.  People who 
do read my rambling, incoherent dumbfuckery are probably just as confused as 
I am, if not moreso, as they are looking to my sorry ass for an opinion when
they should be outside playing Frisbee with their dog or screwing their life
partner or getting a dog or getting a life partner.  Anyone who actually
takes the time to read my bullshit probably deserves to ingest my fucked up
and obviously mistaken opinions on whatever it is that I have written about.

Signed: David Tanzer

(Text of the Statement: Donald Brooks)
(Note: It's funny. Lough.)
(Another note: I do think that most of the points in the essay are valid, but I don't write my blogs for anybody except for me - so that's why I have no problem with making this statement of audience. If you don't like my blog don't read it. If you like it feel free to come back ^_~)

When a NullPointerException occurs in a line of code where nothing is null...

it's probably an auto-boxing issue. The following code throws a NPE in line 7:

1: class Foo {
2:     public Long getFoo() {
3:         return null;
4:     }
5:
6:     public void doSomething() {
7:         long l = new Foo().getFoo();
8:     }
9: }

The problem here is that in line 7 there is no object which can be null, so a different Exception (like, for example, AutoBoxingException) would have been nice (and the error would be much easier to find). With the NPE this can be quite hard to find when the code is a little bit more complex than my short example above.

But, after the long debugging today I will immediately think "Auto Boxing!" when I encounter such a situation again. And I hope you'll think about it too after reading this blog entry ;)

New JCK license for OpenJDK

|

The Java TCK (JCK) is now availiable for OpenJDK-Based Java implementations under quite liberal license. This is really good news, since projects like Iced Tea and others to become certified Java implementations. The one thing that bothers me here is that this license won't be availiable for Apache Harmony, since it is explicitly stated that the Java implementation must be distributed under the GNU General Public License and that the implementation must be derived from OpenJDK.

There are a lot of people who are much better than me in writing about this topic, so if you're interested you might want to read:

Congrats, Tim!

|

Congratulations, Tim Ellison for being appointed to the Chair of the Apache Harmony Project! (I know I'm a week late, I don't have a RSS reader here at work)

Tim takes over the Position from Geir Magnusson Jr., "who has been chair since the project's inception in 2005. Geir moves on the Apache Board, and remains Apache's JCP SE/EE Executive Comittee member".

Version Control: Why pessimistic locking of source code is a very bad idea

|

When multiple developers work on a single project it is necessary to use software configuration management tools, the minimal requirement here is a version control system. The version control system ensures that the developers can concurrently work on the code without accidentally destroying the work of others. To ensure this there are 2 basic strategies a version control system can support:

  • Lock-Modify-Unlock (LMU) ("Pessimistic Locking"): Before a developer can change a file he/she hast to obtain a lock, and while the file is locked no other developer can change the file. When the work is done the developers unlocks the file to make it available to all others again.
  • Copy-Modify-Merge (CMM) ("Optimistic Locking"): When a developer starts working he/she obtains a copy of the repository (the "working copy"). All work is done in this working copy, and when some junk of work is finished the developer merges his/her changes back into the repository. If some other developer has also changed a file which should be merged back there is a conflict. The version control system will try to solve the conflict, and if it can't do so automatically it will ask the developer to resolve it.

Most version control systems support only one of these strategies, for example Microsoft's "Visual Source Safe" only supports LMU and the "Concurrent Version System" (CVS) supports only CMM. Newer versions of subversion (SVN) support both strategies, and I have already seen cases where this feature has been abused. When working with a version control system which supports both stragegies one has to decide which strategy is best for which parts of the project. Here is MNSHO about this topic:

  • LMU: Should be used only for files where manual conflict resolving is impossible (i.e. binary files, like images, Word documents, ...).
  • CMM: Should be used in all other cases, particularly for all kinds of text files (i.e. source code).

Pessimistic locking of is arguably a bad idea because:

  1. Merging conflicts in text files is a really trivial task. Everybody can do it, and it does not consume very much time.
  2. In a project with a reasonable project plan and good communication between the developers conflicts will occur wery seldom.
  3. LMU can cause sequentialization of tasks which could easily be parallelized, and this can cost a lot of time.
  4. With LMU, if a developer can not check in a file because it still has compile errors and he/she becomes sick, the file might be locked for a long time. This causes trouble for all other developers and the administrators of the version control system.
  5. Locking creates a false sense of security: When a developer locks a file and works on it while another developer works on another file, the system can be broken anyway if the two files depend on each other.

Sources:
Lock-Modify-Unlock v/s Copy-Modify-Merge (Charles Lobo)
Einführung in Subversion (Thorsten Möller, Uni Basel)
Lock-Modify-Unlock or Copy-Modify-Merge (Scott Bellware)

Open JDK

|

Just some random thoughts and links...

Roman Kennke sais contributing to Open JDK is a rediculous pain in a Blog posting titled "Contributing to OpenJDK, no thanks".
Lillian Angel writes the Iced Tea - developers are feeling pushed over considering the hoops they have to jump through to get OpenJDK to an acceptable point.

Meanwhile, Tim Ellison points out that Iced Tea is in fact a fork of OpenJDK (GNU Classpath people alway said they won't fork Sun's Java)
Just keep in mind Geir Magnusson Jr.'s Blog posting about Sun creating a walled garden from 8 months ago. In fact he was right, wasn't he?

And to all the folks who said Apache Harmony is useless now that Sun has made the RI open source: Well, let's wait and see.

iPhone: Will it blend?

Well, see for yourself. Really, watch the video!

Fucked up Windows Vista

|

I just re-installed Vista on one of my computers, and after installing windows told me it has moved the old operating system (Vista beta) to the Folder "Windows.old". I needed some more space on the hard drive and so I deleted this directory. Soon after that I found out that Vista had moved all home directories to this "Windows.old" directory! So all data (Documents, Images, Emails) of all users is lost on this computer. Ok, I can restore it from an older backup, so not very much is permanently lost, but Why the hell does vista move around the home directories of my users? I reallyhate Microsoft. I think I'll go and buy a Mac now... Does anybody need a 3 year old PC with a freshly installed Windows Vista?

Update: No usable backup. Fuck.

People Ready... Um, What?

|

So, Microsoft has a new buzzphrase and is paying A-List bloggers to blog about it. Alright, I am not one of them (unfortunately), but here is what People Ready Business means to me. Voila, I did it ;)

Drupal Robots Exclusion

If you are running a blog using drupal like me (or like guglhupfclimbing.at, another drupal-powered site I administer) which has the newest stories on the front page you probably don't want search engines to index the front page. This is because it is really annoying when you search something, click on the link and you get a news page which has contained the searched text a year ago but shows something completely different now.

To tell the robots from the search engines which pages they are allowed to index the most flexible way is the ROBOTS meta-tag. To include this meta tag to your drupal pages simply put the following code in the HTML <head>...</head> section of the page template from your drupal theme:

<?php
  if(!isset($_GET["q"]) || $_GET["q"]==="node") {
    ?>  <META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW" />
    <?php
  } else {
	  if(strpos($_GET["q"], "taxonomy")===FALSE) {
      ?>  <META NAME="ROBOTS" CONTENT="INDEX, FOLLOW" />
		<?php
    } else if(strpos($_GET["q"], "taxonomy")==0) {
      ?>  <META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW" />
		<?php
    } else {
      ?>  <META NAME="ROBOTS" CONTENT="INDEX, FOLLOW" />
		<?php
    }
  }
?>

This code snippet sets the robots meta tag to "NOINDEX, FOLLOW" for the front page and all taxonomy summary pages, and to "INDEX, FOLLOW" for every other page. One problem I still have here is that the rss feed ($_GET["q"]==="rss.xml") still gets indexed with this code.

Update: It works great with an additional robots.txt file like this:

User-agent: *
Disallow: /?q=rss.xml
Disallow: /index.php?q=rss.xml