October 08, 2009

I won the JFXStudio challenge of september 2009!

Last Sunday, Joshua Marinacci announced the winner of September's JFXStudio JavaFX coding challenge. Now, guess who won. Yes, me!

The challenge was to write an interesting application in just 30 lines of code (or 3000 characters), in the theme "time". Most submissions were clocks of some sort, and so was mine. I don't know what made me came up with the idea for a pacman clock, but I did, and it made me win the challenge too!

I have tried to stuff as much interesting behavior in my clock as I could while staying within those 30 lines of code.

Here are some of the tricks to pull that off:

  • Against all sound coding principles, I used lots of cryptic, one letter variables and functions with really short names (like "lz" for "leading zeros", and now I am reading back my code, I could have made it even more compact if I had defined a function "r" for invoking Math.random),
  • so, it is a good thing I also used this important object orientation principle to keep things compact and be able to create autonomously haunting ghosts: encapsulation
  • I used a constant named "forever" in stead of Timeline.INDEFINITE for all the TimeLine instances used in the application,
  • I used SVGPaths, which are a bit cryptic, but very compact,
  • I avoided typing spaces and carriage returns as much as I could,
  • and I tried not to care too much about code readability (which, for a Java developer like me, is a very hard thing to do).
So, as you can see, I squeezed JavaFX as much as I could, and out comes a fun to watch little clock. My kids love to watch it!

You can webstart the pacman clock here, and you can download the source code to see if you can make any sense of it (I know I won't be able to after a year or so) here.

This challenge was a lot of fun! Hopefully, I will find some spare time to enter next month's challenge. This time, we are challenged to write a 30 line (or 3000 char) app again but now in a different theme: "five". Let's see, what can I make of that...

five
alive
hive
jive
live
strive
drive
...


September 16, 2009

My submission for the JFXStudio challenge

The JFXStudio blog challenged the JavaFX fanatics out there again to code something awesome in JavaFX. This time the challenge is to write something interesting in just 30 lines of code (or 3000 characters): Small is the new Big. The theme for this challenge was announced a week later: time.

So, I decided to join in and code something cool in very compact code. I tried to keep my code reasonably readable, but I did use a few SVGPaths and several long lines to stay within the limits. So far I have managed to stay within 30 lines of code and also within 3000 characters (exactly 2901).

I am still working on making it even more compact, but a first result of my noodling can be seen below. Or click here to web start the application.

September 04, 2009

Stop polluting Twitter!

I am big fan of twitter. I will even go as far as admitting that I am addicted. But lately, I am getting rather annoyed with it. I'll explain why after explaining why I do like Twitter. Twitter isn't interesting because of the technology that lies behind it (hardly rocket science, even if they didn't get it right at first. But then again, how could they have foreseen how it was going to be used?). Even the service that Twitter is providing isn't all that exciting either, although its simplicity is what makes it so powerful. So, what is it then that makes Twitter so interesting?

The success of any social medium is hugely determined by the activity of its users. If that activity can't be sparked in a new social application, then it is doomed from the start, but that is besides my point here. Twitter literally floods me with lots and lots of updates from many people (and organizations) from around the world. I hardly read any of them, because that would mean I would probably have to read hundreds of messages each minute. I dip into my stream a few times per day and read the 10 or 20 most recent updates or so. I never scroll down or go to the next page of updates. I just consume what I see at that moment. That is the nature of Twitter. It is sort of real-time. That is what makes Twitter so interesting and useful. You instantly know what is going on right now in your network.

My current annoyance with Twitter doesn't have anything to do with Twitter itself, but with the shallowness of many (or should I say "most"?) of its users lately. All these people seem to care about is their precious number of followers. Sure, having an audience for the things you want to share is necessary, but it is a means and not a goal in itself. I really hate to see how Twitter gets polluted with updates that are all too obviously aimed at gaining followers.

Lately, I get lots of updates hashtagged with #NPF and containing a list of twitter names. A list of nice people to follow. Give me a break! Why don't you just submit "follow me please, please, please, pretty please?" Stop polluting Twitter!!

My advice to you when you receive a #NPF is this: block and unfollow the sender and do not return the courtesy that it seems to be.