bored summary of the past day. / 750words, 1buckapp, java coding tipps

So, on this very exceptionally snowy day here in Stuttgart, i decided to procrastinate a bit and do some fun stuff. Because going outside would have been at least life-threatening, I decided that the most exciting adventure would be to clean the kitchen take a panorama image out of my 3 living room windows. Here it is.

After having mastered the fun part of the day, I had a really interesting skype call with a former colleague of mine who is now enrolled at UCL. We spoke about some projects we have been doing, and of course the upcoming ones. And I guess a sideproject of his, 1bucketapp.appspot.com, is really worth mentioning. I don’t know what to do with it, but maybe you can put it to use.

Another, at first sight, useless site is http://750words.com/, a project where everyone is encouraged to write 750 words every day. The texts are not published nor accessible to anyone else but you, so it’s a private diary for everyone who has a need for one. From my personal attempt to use it I can tell that 750 words is a lot.

The last interesting snippet of the day was a collection of tipps for keeping Java code clean and maintainable. Although the text dates back to 2001, it’s still of remarkabel relevance and definitely worth reading.

Character Encoding for the rest of us: UTF-8

I spent a fair part of my past life not understanding character encodings in its entirety. While this was totally unimportant in past times, when e.g. a dataformat or file was written or created by the same program reading it, most likely not crossing country or language borders, nowadays it is. Very. So what is this all about? Continue reading

Sharer, Giver, whatever, Filesharing

A short note on a previous post where I talked about my project of a simple File-Sharing applications that basically works using drag’n'drop and some zeroconf to find other peers. I wasn’t exactly surprised to find something that matches that description pretty well, but here it is, it’s called giver and should run on any platform that has support for some kind of .net/mono framework. I haven’t tried it yet, but I’ll sure give it a shot and tell you about it.

I’m already thinking about dropping the Java-project and instead do a client for the giver-protocol in Cocoa. I would be excited to have someone reporting about the actual use of giver! Moritz.

Still no Java 6 for Intel 32 bit and PowerPC based Macs

Running Mac OS X, i forgot to mention that in the headline. Why? Apple is most likely busy updating it’s own stuff, promoting it’s platform, and since the iPhone came up, many people started learning Cocoa, so the developer base there has grown, too. Additionally, the general user base is also growing, making it a more interesting target for Software Companies. And there are not many basic rules, valid everywhere, but one is for sure that Java Desktop applications just don’t integrate well. There is maybe an exception for programs using SWT, but still, the native look and feel is something different.

So the question I’m asking is whether it’s that bad that there is no Java support? Yes! Absolutely! At least if you either use programs or build programs depending on it. Of course, most programs just work fine with Java 5, but there are some that just don’t. And so one of the main reasons for Java is obsolete: write once, run everywhere. And while Sun, the company behind Java, is providing Runtime Environments for Windows and Linux, it’s not for Mac. So it’s not Apples fault alone. But careless of who’s fault it is, it just sucks, clearly spoken.

Zeroconf made easy: Bonjour for Java, Part 2, Client Implementation

I’ve been writing about the server side implementation aspects of Bonjour for Java a while ago, and I promised to explain the client side, which is a bit more tricky. The reasons therefore is that it makes heavy use of asynchronous callbacks, leaving you no other choice but to implement some interfaces and understand the way things work behind the curtain. Continue reading

Antiusability at its best: Language Documentation

Whether you’re an active developer busy doing some Java, Ruby, Perl or ( fill in your language here ) based projects, you’ll most likely have some kind of browser windows opened sometimes providing you with the necessary documentation for libraries or ( but hopefully not ) language basics. 

Because I’m not in love with one language and used to switching back and forth between several of them, I tend to forget some details about built-in classes etc.. It’s certainly o.k. to have the documentation for such features available somewhere on the web, but I’d love to be able to simply download bundles for a language in a “documentation reader”. Open format ( there are lots of them that would suit this application ), simple to transform anything to it via xsl or something comparable, and it would just work ( even offline ). 

I won’t claim to start a new project here as I’m already quite busy doing the rest, and celebrating new years eve, but if somebody is looking for a challenge, here it is. 

This subject shows another important aspect of usability. Usability shouldn’t stop at the Users place. Developers are users, too. And happy users tend to be more loyal and happy, a goal certainly worth achieving.

Edit: Now the night has finally arrived, and I think the following tasks should be completed before any such project can be forged. 

  1. Define an open format for efficiently saving Language Documentation. Keep in mind that language documentation differs in structure depending on what kind of language is documented. Object oriented languages need other formats or present other structures than procedural or functional ones. 
  2. Create scripts that convert existing documentation into that new format. XSL is a powerful friend here. No one will ever take care about a cool project without a funky demo.
  3. Build clients that are eaasssyy to use for all major platforms. I’m talking about smooth integration ( e.g. a spotlight plugin for OS X ), not some dirty hack.
  4. Tell all your programmer friends.

Thats it. But I’m still not ( yet ) interested in doing it by myself, but if anybody wants to do it, don’t bother contacting me. Sleep well.

Edit: found this link, like it.

Pass-by-reference workaround in Java

As anybody knows, java passes variables by value. and i haven’t found the magic compiler switch to change that. of course, there are problems caused by this restriction, but in most cases, pass-by-value works just fine. 

If you end up in a situation where it’d come in handy to have a pass-by-reference facility, think about the way java is storing objects, and how these objects are then passed-by-value. 

First of all, an object variable contains only a ( typed ) memory address. Thus, comparing e.g. two strings for equality will yield only true if they are in fact the same strings, same applies for all other types. And this is the value. So in fact you pass a ( kind of ) pointer to a function, enabling to manipulate the original object, as the object is not cloned or something else.

Its also common to encapsulate basic types like int into a object just for the sake of manipulating it in some methods.

So let’s break it down to a simple example:

class MInt {
	int x;
}

public void inc(MInt what){
	what.x++;
}

This will result in the int x of a MInt object being indeed incremented. Let’s imagine calling a increase method with a plain integer. This will change just nothing, at least not outside the methods scope.

Zeroconf made easy: using Bonjour for Java, Part 1

It’s really easy. If you have some clue about network programming and Java, this shouldn’t be extra hard to understand. It’s about zero-configuration, the ability of devices to e.g. discover them independently of any server. There are several implementations, I choose to use Bonjour, which is provided and developed by Apple. The Java-Bindings are available for Windows and, of course, Mac. Continue reading