Skip navigation.

BlogtimeException

By Behrang Saeedzadeh (the 5th incarnation)

Opera again

About two months ago I uninstalled Opera from my PC due to some not-very-important bugs that I just couldn't live with them. Opera 9.10 was just released a few days ago, so I decided to give it another try. Oops! That very simple bug is not entirely fixed so far. But the world is not such a bed of roses without Opera (wot?!#?!?) so I didn't uninstall it this time. Man! Opera's Feed Reader is grrreat!

What keyboard is that?

Any ideas what that keyboard on aptana.tv's homepage is?

A clean answer to the DailyWTF equality checking issue...

This DailyWTF post about implementing a method that assigns a new value to a member variable and sets a dirty flag accordingly, actually does have a cleaner solution.

Here's the original code:
/**
    Set the value of the isRecordLocked attribute.
    @param newValue is the new isRecordLocked value.
*/
public void setIsRecordLocked(Boolean newValue) {
    // Update state if required.
    if (isRecordLocked != null) {
        if (newValue == null || !isRecordLocked.equals(newValue)) {
            context.setDirty(true);
        }
    }
    else if (newValue != null) {
        context.setDirty(true);
    }
    // Change the value.
    isRecordLocked = newValue;
}

And here's the cleaner implementation:
public void setIsRecordLocked(Boolean newValue) {

   if (newValue == null) {
      context.setDirty(isRecordLocked != null);
   } else {
      context.setDirty(!newValue.equals(isRecordLocked));
   }
   
   isRecordLocked = newValue;

}

Actually, at the first glance I found myself in a mind freeze situation. But then in a a few minutes I came up with the cleaner solution.