iPhoto 8.1 is on Software Updates

August 19th, 2009

iLife09.jpg

iPhoto 8.1 has been updated by Apple, and is available on Software Updates this morning. It adds a few new book print options:

  • Hardcover books can now be ordered in a new extra-large (13?x10?) size
  • Includes three new book themes with travel-oriented designs: Tropical, Asian, Old World
  • A variety of new holiday greeting cards themes are now available

With all the pictures I'm taking with my iPhone, iPhoto has become a great tool to organize them. Gotta get the update.

Working on a Barrier Breach Alert System

August 18th, 2009

Today I've been working on a lot of ideas for a barrier breach alert - something where a data stream is coming into the system and you have set up a series of barriers defined by an expression - typically something like this:

  value > (2.0*n + 1)*10000.0

where:

  n = 0..5

so that the first barriers are actually at:

n Expression
0 value > 100000.0
1 value > 300000.0
2 value > 500000.0
3 value > 700000.0
4 value > 900000.0
5 value > 1100000.0

so now we have the barriers we'll be crossing through.

The trick is that when I cross any two barriers, I need to alert on the last one we crossed. So if we're going from 50,000 to 550,000 I want to alert on the 500,000 barrier not all the ones getting up to that value. Likewise, if I fall from 550,000 to 50,000 I need to alert on the 100,000 barrier not anything before that.

So we have to have an idea of direction of each barrier we're crossing, and we have to maintain a history of some sort to know what we crossed last, so as to know if we need to report on the crossing we're making right now.

This has been something I've been working on most of the day. Sadly, I do not, as yet, have a solution to the problem, but I'm sure I'll get something tomorrow.

[8/19] UPDATE: Yeah, I have something that seems to work rather nicely. I have two arrays of booleans - one for the previous state of all the barrier equations and another for the current state of the same equations. Then, I can compare the differences. If there's a difference, that's the "edge detection" we need. By looking at the values, we can tell if the current values are rising or falling.

Slick ideas that seem to be working nicely. Love this stuff.

Added numberFormat() to BKit for Completeness

August 18th, 2009

BKit.jpg

I was pretty impressed with Java when it added in the String.format() method. It's very much right out of C and can make some formatting tasks very simple. I added this into the BKJEP expression parser as format() with the pretty impressive Java VarArgs. Pretty nice stuff. But over the course of the last few days I've been wishing for a little more control of the numeric formatting on the format() command. It wasn't allowing the optional decimal place like the DecimalFormat class.

So I decided to put in another method to the BKJEP parser: numberFormat(). This guy takes two arguments: a Number, and a String format consistent with the DecimalFormat class. This helped me clear up a nasty little formatting problem on one of the logging messages I was working on in a project. Very nice to have the flexibility of both, that's for sure.

While I admit the argument list is backwards from the format() function, it's in keeping with the dateFormat() function already in the BKJEP parser. I decided to keep these two similar, and let format() stand alone. It's not perfect, but I didn't want to switch everything and then worry about the things that might break.

Miracles Don’t Warrant Attention Any Longer

August 17th, 2009

cubeLifeView.gif

Well... maybe it's the Slump talking, but today I was asked to put in a feature quickly and in less than two hours I had a new view of the data available to my clients just like they'd asked for. Two hours. One would call that pretty nice - maybe even pretty wild. But today it didn't even warrant a "Nice job!" email.

I'm sure they expect this from me now, and that's a double-edge sword. One one hand, it's great because I can then expect impressive bonuses, but on the other hand, it's expected now, and if I just do a "good" job, it's seen as me 'slipping'.

Everyone likes to hear that what they are doing is appreciated. I'm no different. I don't require it, but there are times when I hammer out a new feature on a 'rush' schedule and it'd be nice to hear something. Oh well... I do it for myself. I do it because I'm who I am.

It's just a little tough to take this hit in the middle of a slump. But I'll get over it. I always do.

[8/18] UPDATE: I did get a 'good job' email today, so I guess it was noticed. It helps.

Base 1.3.2 is Out

August 17th, 2009

Base.jpg

I haven't been keeping really good tabs on Base recently, but this morning I was thinking about an interesting take on SQLite3 in Mac OS X development voiced by a pretty good developer a while back. Basically, he sees SQLite3 on the Mac as an easy way to skip using fopen() ever again, and to that I can see his point: if you're using files to save data, be it parameters, or application data, you can use a file and deal with encoding and decoding, or you can simply use a database that's a single file and have it organized any way you like.

It's a neat concept. Using a database system as an alternative to the standard file formats. When that happens, it's easy to dig into the file and see what data you've written - as opposed to making a custom file reader/displayer. Slick.

Anyway, Base is a nice GUI tool for the Mac that would be that GUI viewer tool for SQLite3 databases. Today's update to v1.3.2 means it's moving along nicely which is a real treat.

MacVim Snapshot 49 is Out

August 17th, 2009

MacVim.jpg

The guys working on MacVim have been busy once again, and released Snapshot 49 (actually 48 and then 49) to refactor the keyboard code and make it a little more international-friendly as well as allowing key bindings on more key combinations. Interestingly, this also ends up help us ASCII folks, and that a nice perk.

Still one of the bet editors on the planet.

Fighting to Get Out of a Slump

August 14th, 2009

It's been a hard week, and I'm finding it more and more difficult to focus and get motivated to get work done. It's a slump, I know it. It happens every so often when I'm not really having a fun project to work on and the hours are getting long and there's no real outlet in the evenings and weekends. It's a slump.

I know that time will take care of this, it always has in the past. The only real question is How long? Clearly, I'm hoping for "not too bloody long", but there's no way to tell. It could be something as simple as an update to some program that's got something I really have needed for a while... or maybe it's Snow Leopard... or maybe it'll be a few days off at home.

Something will start the ball rolling and then it'll build on itself just like the slump did, and in the end, I'll be back on top where the sun is shining. Just wish it'd hurry up and get here.

Hubble Ultra Deep Field in 3D – What I Love Most About Scientists

August 14th, 2009

Courtesy of BoingBoing this morning is this fantastic video about what scientists found when they pointed the Hubble Space telescope into the blackest of blacks in space. They were probably told by many that there's nothing there - after all, shouldn't there be at least a few places in space where "nothing" is there? But they didn't listen.

Instead, they believed it was a great experiment - something worthy of human time and effort to see the results - if only for the knowledge itself.

To realize what's out there - that blackness of space is really just faintness of source, and not absence of source, well... it's just what I love most about science and scientists. It is, after all, just knowledge. No one is going to have a better day today because they know this. It's not going to put food on the tables of millions, or change the GDP of the poorest countries in the world. But that's not to say that it's not something that should be done.

Liza's tagline on emails is simple: The Human Race is a relay., and while it took me no time to understand what she was saying, it took me a while to really understand the significance to her, and now, to me.

We aren't all there is. We aren't even really all that important - except to ourselves and those around us. But we are, as a species, the intellectual custodians of this existence. It is up to us to learn, document, and preserve things we see and learn about this life of ours for future generations that might find importance in some little bit of knowledge we maintain.

I got into science, as a kid, from this point of view. Learning and experimenting for the knowledge. Just knowing it was enough. Later, realities sunk in and I had to pay a mortgage, but in the beginning, the purest form of my interest in knowledge was just that - to read, to understand, and to coalesce.

Bless these men and women that to this for all of us.

It Seems Very Easy to Misuse Google Collections

August 13th, 2009

I like reusable code as much as the next guy. I really do. For what I've seen of the Google Collections Java code, I like that too, though to be honest, I haven't seen all that much. But that's not to say that it's not possible - even easy, to create a mess with the Collections. In fact, it can make code very difficult to read. Take as an example, the code I ran into today:

  public Set<Trade> getTradesForReport(PositionService aPositionService) {
    // get all the trades from the service
    Set<Trade>  retval = aPositionService.getAllTrades();
    // now filter them on the trading parameter
    for (Iterator<Trade> iter = retval.iterator(); iter.hasNext(); ) {
      Trade   t = iter.next();
      if (!allowedUsers.contains(t.getUser())) {
        iter.remove();
      }
    }
    return retval;
  }

Java's definition of the initial Set<Trade> does not address the mutability of the Set. In fact, Java has no native immutability, and the way that Google achieved this is to make an Iterator that overrides the remove() method and throws an Exception.

That's dangerous. Not illegal for the language, but certainly dangerous.

If you look at NeXTSTEP/OPENSTEP/Cocoa on the Mac, the 'base class' is by definition immutable. You have to create a mutable version deliberately. This makes it clear what you are dealing with. The 'default' (base) behavior is to assume that you can't mess with it. Makes perfect sense.

But Java is the opposite. By default, all the objects, collections, etc. are mutable, and they handle immutability by removing the iterator() method, and using a different Enumerator. Look at the ConcurrentHashMap. No way to remove an item during a 'scan' of the data because the Enumerator doesn't have a remove() method. Period.

While I admire Google's work, it's not clear what they are doing. Say, in the example above, there were several position services, and some of them decided to return Google's ImmutableSet. Now I'm sunk. The compiler won't see that I can't do this, because as far as it's concerned, I can. I'd have to trap for the exception and reverse the logic - create a blank one and add those I wanted to it. But if I do that, I might as well use that logic for all cases:

  public Set<Trade> getTradesForReport(PositionService aPositionService) {
    // get all the trades from the service
    Set<Trade>  src = aPositionService.getAllTrades();
    // ...and make a place to put the good ones
    Set<Trade>  retval = new HashSet();
    // now filter them on the trading parameter
    for (Trade t : src) {
      if (allowedUsers.contains(t.getUser())) {
        retval.add(t);
      }
    }
    return retval;
  }

While this works in all cases, it doubles the references used, and that's not a good thing when you get into a tight memory application and garbage collection is already an issue.

What they should have done isn't clear. Face it, they wanted this to fit into the standard Collections in Java. But they are all mutable by default. No... the problem here lies with the coder that uses these. You need to be more explicit on the return types and explicitly say they are ImmutableSets. Then, the user/maintainer of the code can see what was intended.

Alas, such was not the case for me today. I had a production problem because some of the code returned a standard HashSet to the method signature and some returned a Google ImmutableSet. Unfortunately, this has been in production for several weeks, but it's just now getting hit. Lovely bug to catch and fix in a hurry.

Another Security Update for Mac OS X 10.5.8 on Software Updates

August 13th, 2009

Leopard.jpg

This morning Apple released another Security Update - this time for a problem in the DNS component, if I read the notes correctly. Given that we had 10.5.8 released about a week ago, and Safari 4.0.3 yesterday, this is a bit of a surprise, so it must be a pretty bad problem, or very widespread - to warrant a new release.

But I'm not about to be unprotected on my Mac, so upgrade it is.