Programming

Making eclipse Kepler and Luna work on Ubuntu

This is a «note to self and to anyone that could need it» post. I’ve had troubles with Eclipse with some Ubuntu installations for some time. I even have had switched to other IDEs, but now I «needed» some plugins that exists for eclipse, so I decided to try to make it work. The problem has been that it either just hangs (OpenJDK 7) or crashes (Oracle JDK 7) after 4 seconds.

Round, Floor and Ceiling in Expression Language

Expression Language makes working with Java Server Pages a slightly less pain in the behind. But, its functionality is very limited, there is for instance no way to round off a number, neither as floor, ceiling or to the closest integer ?View Code JAVA Floor(foo) -> ${foo - ( foo % 1 ) } Ceiling(foo) -> ${foo + ( 1 - (foo%1)) % 1} Round(foo) -> ${foo +0.

Video: BLUG Last Thursday November 2009: Mercurial

Dette er mitt første forsøk på å lage video av BLUG-foredragene. Forhåpentligvis blir det flere etterhvert, og med mer erfaring, sannsynligvis bedre kvalitet (og kanskje litt mindre filer…). Volumet kan variere relativt mye igjennom foredraget. OGG Theora (512×288) MP4 h.264 (720×405) If you had an HTML5 video capable browser or flash and javascript enabled, a video player should appear here, you can download the video instead Mercurial er et distribuert versjonskontrollsystem som har blitt svært populært siden det ble annonsert i 2005.

Flickr shortcode plugin for WordPress

Earlier this week I wrote about how you can add a shortcode to the functions.php to make it easier to use Creative Commons images on your blog, while always remembering to put in the correct attribution. Adding this to your theme has some drawbacks. The most important one is that you’ll have to do it all over when you change the theme, another is that you have to add the flickr api key directly into the code.

[1 of 3] Updating your brightkite location using Google latitude

BrightKite is a service, much like twitter actually, but that uses your location to find interesting stuff. It could be a great tool to create ad-hoc gatherings of some group of people, for instance coders. If there were a lot of BrightKite users in Bergen for instance, I could leave a message on brightkite that I and some other Python coders were going for a beer at Henriks, and that any others that is interested could join if they wanted, together with the GPS coordinates for Henriks.

PHP frustration

Most of the code I’ve written in my life so far has been PHP, as long as I include all the small testing of different stuff just to see if it could be done. PHP is quick to prototype stuff in, because you quickly get something you can poke around with, there’s little boilerplate code. However, specially when I’m just hacking together something in a hurry, theres one thing that’s really, really frustrating.

Flickr shortcode (and some nice HDR photos)

I like using creative commons photos from flickr as illustrations on my blog, however, I find it tedious to add all the metadata to satisfy the BY directive in the creative commons license in a consistent manner. Then it’s really nice that flickr has an API where I can automatically fetch that information. I use the shortcode feature of wordpress, so I can use ?View Code PHP [flickr url=”

Merging two lists

Lets say you have two lists, one of them containing the values [1,2,3] and the other one containing the values [4,5,6], and you want to combine these two lists into one list, like this one: [1,2,3,4,5,6]. Let’s see how this can be done in different (high level) programming (or scripting or templating) languages. Java Java has multiple list implementations, lets start with the most basic one, the builtin array.

Blogging code

As a programmer and linux geek I often need, or at least want to write about code, scripts and commands on my blog, but as many of you know, displaying raw code in HTML is setting yourself up for failure. The simplest part of the problem is the fact that line breaks and whitespace might be significant, this is simply solved by putting the code inside a block. The more tricky part is that code often is full of characters like &, > and <.

Unreadable code

If you’re really trying, you will always be able to write completely unreadable code in any programming language. All the language designers attemts to force you to write readable code, and even making it so the easiest way ahead, even for quick hacks is to write it as readable and reusable code will fail if you’re really trying to write unreadable code. This guy is obviously concerned about “job security”. (not the blog author, but the code author)