Rounding to .0 or .5

I found this post on rounding via my RSS reader and started giggling since I myself wrestled with this problem a while back. I too started out with string operations etc. but ended up (after some discussion at the office) with a very easy solution.

The below code is in Java but should be easily convertable to JavaScript or any other language that allows you to round a number… The v-variable is a float holding the value we would like to round to .0 or .5:

int value = Math.round(v * 2);
float result = (float)value / 2;

It’s so simple it’s scary…

Update 3 May 2006: Updated the code based on feedback in comment.

Introduction to regular expressions in ten steps

If you have been following my blog for a while you know I’m a big fan of regular expressions. Previously I also showed you how to use Regular Expressions from LotusScript using the Microsoft VBScript component. What have been missing however was a simple “This is how to get going with regular expressions” tutorial but that has been solved. Take a look at Russ Olsen’s weblog and his two part series “Regular Expressions In Ten Steps”. Check it out using the links below.

I also recommend the Mastering Regular Expressions book from O’Reilly as a good guide into this exciting realm.

Optical keyboard? (includes pictures)

function previous() {
go(-1);
}
function next() {
go(1);
}
var filename_base = “./images/misc/optical_keyboard/optisk_keyboard-“;
var filename_ext = “.jpg”;
var start_counter = 1;
var max_counter = 5;
var counter = 1;

function go(step) {
// declarations
var prefix_number = “”;
var filename = “”;

// modify step
counter += step;
if (counter max_counter) {
counter = start_counter;
}

// calculate prefix
if (counter < 10) {
prefix_number = "0" + counter;
} else {
prefix_number = "" + counter;
}

// compose filename
filename = filename_base + prefix_number + filename_ext;

// get image division
var d = document.getElementById("slide_image");
d.innerHTML = "“;
}
function doStart() {
go(0);
}
window.onload = doStart;

How cool is this? At a client site today I saw an “optical” keyboard. The keyboard is projected from the black Bluetooth device onto the desk and works like any other keyboard once connected and configured. It works by tracking where your fingers meet the desk by using a laser grid. Nice – although very geeky!! 🙂

Previous | Next

(Use the above links to go through the pictures)

Previous | Next

(Use the above links to go through the pictures)

Taking the plunge – going all MP3s

I finally got so tired of changing CDs that I took the plunge and ordered a Squeezebox 3 from Slim Devices so I’m ripping most of my CDs to MP3 and tagging them with ID3 tags. In that connection I needed an ID3 editor and found a nice free one called ID3-TagIT written using .NET that allows me to do bulk changes to genre, artist etc. I don’t know if it’s the .NET framework or whatever but unfortunately the application runs very slowly.

For the server part of the setup I’m using the server software from Slim Devices called SlimServer which you can actually use without a Squeezebox. The server puts out a MP3 stream at http://some.address:9000/stream.mp3 that any player can connect to. Nice.

If you simply need a streaming server at your house you could also look into using the Shoutcast server.

Talk about putting your money where your mouth is…

“IBM announced a new Eclipse innovation award program, under which the company will reward Eclipse innovators with US$10,000 to $30,000 for cool new projects. IBM also announced the availability of its new instant help plug-in system. The system is built on Eclipse, but developers can integrate it into their projects to provide both online and offline user support within their applications.”

Full article @ sdtimes.com: EclipseCon Bursting at Seams

Robert Cringely: Apple must replace Microsoft Office and buy Adobe

As a Friday read I highly suggest Robert Cringelys newest post called “Killer Apps: For Apple’s Windows Strategy to Work, It Must Replace Microsoft Office and Buy Adobe Systems“. It’s an interesting take on what Apple is planning in relation to an office suite.

“…what’s missing is an Apple application strategy to go with this operating system strategy, because Microsoft’s true power lies not in Windows, but in Microsoft Office. Fortunately for Apple, I believe there is an application plan in the works, and I will describe it here.”

A RSS feed I would like to see from IBM…

What if there was a RSS feed in the Notes/Domino 6 and 7 Forum that let you keep track of responses to threads you are actively participating in. It would make it much easier to help other developers by letting you know when they added that crucial piece of information that you requested in order to help them.

I guess it could be done automatically if the backend was DB2. Wouldn’t it be a great showcase for Domino on DB2 and the kinds of joining possible with a relational backend? I think there was a demo of this kind of functionality in the Domino on DB2 session at Lotusphere.

An alternative is a “Add responses to my feed” functionality that you manually activate when responding.

I know there is an e-mail notification functionality but they are only sent once a day, I have to manage the list of posts being watched (only 25 posts allowed), plus I really hate e-mail… 🙂

Gana On The Net (a fellow Notes/Domino Java blogger)


As a followup of my recent posts on Java in Notes/Domino I would like to highlight a fellow blogger: Ganapathiram Natarajan. Gana and I have been commenting/e-mailing a bit back and forth recently and I really think he would be a valuable addition to your blogroll if you’re already into Java or starting to get so… (and you really should!)

Ganas two latest posts explains how to use Apache log4j in Notes/Domino agents (log4j with JavaAgent – Part 1) and how to use the Java PolicyTool (PolicyTool ). Check them out!

The latter is really nice if you are messing around with Java security:

developerWorks article: Compare Informix Dynamic editions


You know these situations where you’re thinking: “Wouldn’t it be nice if I could find an article on this or that subject?” Well the Information Management RSS feed on developerWorks came to the rescue today. I have been looking for articles about Informix since we are looking into it for a new project and there it was: Compare Informix Dynamic editions.

It’s really nice to see that the table fragment support is available in the Express version since this is one of the reasons we are looking into IDS.

Nice. I’m one happy camper!

Comment SPAM

Aaaarrrhhhhhh!!! I’m once again being flooded with comment SPAM – what’s in it for these guys? The good thing is that most SPAM is being caught by my blogging software but for some reason some of the comments are subverting the comment approval setup which is in effect. Very strange. Changed my admin. password last night to make sure it wasn’t that but there was a new comment this morning which I didn’t approve.

So if you’re using Pebble and have seen this issue before please let me know.