the corner office : tech blog

a tech blog, by Colin Pretorius

Links 2010.08.14

  • InfoQ: Oracle Fixes Eclipse's Java Problem. Good points made. Oracle didn't have to, but rolled a new JVM build quicker than Eclipse could get a critical fix out the door. And when Oracle do re-rebrand, old versions of Eclipse will be broken. Pity.

{2010.08.14 16:34}

git. Windows. Line endings.

Git/Windows/Eclipse line ending fun. I've already set up Eclipse to create new files as Unix but git has other ideas.

  • GitHub help: dealing with line endings

  • To fix an already duffed file in Eclipse, go to File | Convert line delimiters to...

{2010.08.14 05:51}

Oracle sues Google

Hmmm.

  1. A run-down of the Oracle suing Google thing by Miguel de Icaza, Mr Mono himself. The irony.
  2. James Gosling confirms this was Oracle's game plan from the start.

{2010.08.14 02:15}

Local Applications Cannot Be Detected

Bah. Wanted to take a peek at something running on my laptop but JVisualVM grumbled about unable being able to detect local apps. Helpfully had a link to the trouble-shooting page and the underlying issue, which is that HotSpot won't write the necessary perf stuff to the temp dir if it's on a FAT partition because it'd be world readable. Thanks Acer.

The trick is to run both the app you want to look at and JVisualVM with the argument -XX:+PerfBypassFileSystemCheck.

{2010.08.12 15:48}

Is it just me?

Or is the new offical Javadocs site at download.oracle.com a helluva lot slower and more sluggish than java.sun.com ever was?

{2010.08.08 08:01}

git refusing to update checked out branch

I created a local clone of my main (in git-speak 'origin') repo for one of my projects, and after committing locally and then doing a git push I got this error:

remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.

After reading this it started to make sense. My main/origin repo looked like a first-class, in-use repo, and git thinks that since it might be an active repo, pushing to it would be a bad idea.

The solution was in the post above. Step 1 is to change to the directory containing the origin repo and execute

git config --bool core.bare true

With that done, git knows that the repo is bare, and you can push to it.

Step 2 would be to delete of any checked out code in the origin directory so that all that directory contains is the .git directory.

Update: a good way to do a bunch of directories at once is something like this:

for f in `ls`; do cd $f && git config --bool core.bare true && cd ..; done

{2010.08.06 16:50}

It's about the Ctrl-Space

At Artima:

In which I argue that (a) Generics have done egregious harm to both the elegance and readability of the Java language and, (b) they prove by example that static type checking is a linguistic dead-end. Are you persuaded? Do you agree? Read on...

I'm really busy at the moment so I must admit I haven't yet read on, yet I will say three things because the themes come up so often:

  1. Generics do suck until you remember how ugly code used to be when you needed monstrosities like ((Widget)list.get(0)).foo().

  2. I also remember how much effort it was when you couldn't type list.get(0) Ctrl-2-L and have your IDE autosuggest a sane local variable, etc etc. I also remember how I used to think C++ templates were much better - and in many ways they are, but the one downside is how easily templates break the IDE's autocomplete and navigation functionality.

  3. the benefit of static typing isn't about the compiling, it's about the navigating and the typing (of the keyboard variety). A modern Java IDE allows you to move around and analyse code and autocomplete and generate code and refactor in ways that dynamically typed languages just can't hope to match. As I like to say, Java may be horrendously verbose, but when your IDE allows you to type in paragraphs and sentences instead of words and phrases, it doesn't seem to matter as much.

I suspect that many people in the anti-static/Java camp haven't seen and aren't aware of what an accomplished Java dev can do. Which isn't to say that I think static typing is necessarily or always better than dynamic typing, just that I don't think IDE capability is fully considered in the debate.

{2010.07.26 14:09}

Eclipse Bookmarks Plugin

Eclipse has a bookmarks feature, but the keyboard support is limited. The Eclipse Bookmarks Plugin does the job nicely.

As a poster in this StackOverflow thread mentions, when installing the new plugins via the update site, you have to uncheck "Group items by category" in order to see (and install) both features.

{2010.07.22 13:54}

Links 2010.07.14

So you've just been hired by an IT department... and it's your first job. Here's what they didn't teach you in college.

(via)

{2010.07.14 16:32}

Combining git repos

In the good old days before maven all my projects would be standalone in CVS modules. I wanted to combine a few CVS modules which I'd recently imported into a single maven project, with a single git repo. This page (which I'd linked to before) has the details. I chose the git filter-branch option since it looked relatively painless.

Using the monster git filter-branch command mentioned on that page, I got the error:

Cannot rewrite branch(es) with a dirty working directory.

A quick google found this page which mentions the issue and suggested making sure that git status reported "nothing to commit". My problem was that git status was saying that, and yet I still got the error. What I actually needed to do was run

git add .

After that git status still reported "nothing to commit" (unsurprisingly), but filter-branch now ran fine.

{2010.07.09 16:22}

« Older | Newer »