Thursday, May 31, 2007

In Review: May 20-26, 2007

Again, the week in review:

  • Computing, Development and the Internet
    • Google: Efficient Power Supplies: A Google whitepaper on why power supplies are inefficient, what they're doing about it, and the possibility that we'll all eventually benefit from it.
    • Rails made web frameworks so 'cool' that even Perl's got one: Catalyst [Jamie].
    • Telus, like most carriers, locks down the features of their phones. Fortunately, I'm not the only one who doesn't want to live within those constraints, so I simply have to follow in the footsteps of others to use MP3 ringtones, shut off the loud camera noise and install J2ME applications [howard forums].
    • BlogPulse is a nice way to research blog trending.
    • Lessons from Usenet, and the internet form of the Tragedy of the Commons [Chuqui 3.0].
    • OpenDNS on Google and Dell's browser error handling; is it ethical? Is Google "doing evil"?
    • UMLGraph is an interesting idea, but I'd like it to be more directed. Graphs are most meaningful when they're trying to communciate something specific. I don't find UML to be the best form for documentation/reference.
    • You may know most of all of these Eclipse shortcuts, but it doesn't hurt to do a quick review. If you learn something here, it may pay off.
    • Coding Horror stands up for Javascript, the Lingua Franca of the Web.
    • Flickr Backup seems to allow you to get a backup of the images you've promoted to Flickr. Not a bad idea in the case of catastrophic archive failure.
    • I keep meaning to use WikiTravel, but I never do.
    • Transmission seems to have done a good job of getting Torrents on Pierrette's macbook.
    • A little bit more about the art of interface design and the uncanny valley which uses the Polar Express as an example.
  • Stuff
    • Reyka Vodka: Icelandic vodka made from glacial water and distilled using geothermal energy. Of course, unless you live in Iceland, this is probably shipped direct-to-you on plane using jet fuel, so unless you already drink imported vodka, you might be better off buying locally [NOTCOT].
    • I'm interested in digital photo frames that can connect to Flickr, but I'm still not sold on either battery-operated or corded forms; I guess it has to be one or the other, but I don't have to like either tradeoff.
    • Amusing "Dear Cell Phone User" cards you can deliver to loud conversers. Then again, I use my cellphone in public, so perhaps I'll get one of these instead.
    • National Geographic Adventure Paper sounds good, but some reviewers seem to have troubles with the waterproofing, and the cost is very steep.
    • The 'Open Design Club' sounds like an interesting idea. Always interesting to see 'open' move beyond 'open source'.
    • PYG Design's "Snug" (under Furniture) looks both cute and useful. Basically, a blanket with "tentacles" that allow you to get your hands or head outside at strategic points. Allows you to be enclosed and warm, but still interact with your environment.
    • This Miyake watch is stylish, but, then, I don't wear the watches I have much, so perhaps I should just given up on watches.
    • I'm not sold on ultra-mobile PCs, but, frankly, it's depressing watching the once-great Palm suffer, so I hope they manage to do something really interesting.
    • An amusing take on the potential meltdown of Web 2.0 [Sterling].
    • myownsketch.com allows you to sketch on top of a photo from flickr; diverting mashup.
    • A good rant by "Uncle Bob" on XML languages and BPEL.
    • Visually interesting "inside-out" glassware protects your beverage from the heat of your hand.
    • If Dell really brings something like this monitor to production, it'll be fascinating, but color me skeptical.
    • Interesting and detailed coverage of the high-iso claims of recent point-and-shoot cameras. [dpreview.com]
  • Other
As before, I'm surprised by the volume of this; I know I read a lot of material on the internet, but when I look at it in aggregate, it seems like more than I'd expect, considering I must save a good chunk less than what I consume.

Wednesday, May 30, 2007

iTunes Plus - Two-Way Music Transfer?

So with iTunes Plus, and DRM-free music, Apple should offer a way to transfer songs from your iPod to your computer.

Right?

Wednesday, May 23, 2007

In Review: May 13-19


Wow, I'm on the web a lot. Who knew?

Update: I accidentally wrote 'Chet Haase' instead of 'Chase Jarvis'; guess the name stuck in my head from the InfoQ article I just finished on the Consumer JRE. Sorry: Chet, Chase.

Monday, May 21, 2007

Java ME: Pain Points

Frank Sommers asks, "What are your Java ME Pain Points?". Mine are:

Carrier Stranglehold
Carriers want to own the phones. This seems to be consistent from Canada to the USA, and quite possibly elsewhere. Carriers don't want you messing with your phone, loading things on to it. Actually, they do, they just want to charge you for it in as many different ways as is corporately possible.

This means, among other things, that they usually don't go out of their way to make it easy for you to load software onto your phone for the purposes of development. It also means that if you do manage to get an application on your phone, it's not easy to share that application with others.

This is, to my eye, the biggest barrier to adoption.

Canadian Data Rates
Data rate plans in Canada are brutal. There's no serious 'unlimited' plan at this point, and the non-unlimited ones are highway robbery. Between this and the previous point, Canadian carriers are themselves destroying adoption of the very tools they sell. If carriers would just let users use the phones the way that PC manufacturers let them use their PCs, wireless applications would be a much larger, more vibrant world. Let this be a lesson to OS vendors who have been implementing DRM. Sooner or later we're going to dump your over-protective operating systems and move on to other pastures.

High Barrier to Entry
Many Palms don't have Java VMs for free. iPhone may not support Java. Different phones have different support for Java, require different tools and procedures. I've looked into Java ME development several times, only to get thrown back by the high barrier to entry. I don't want to buy a JVM for my Palm, and it's not that easy to learn which tools I need to build a Java ME application for my Nokia, build it, and install it. This needs to get easier, be more seamless.

There are others, but these three are the biggest categories of pain. Fix these, and you'll see more consumers and developers interested in what Java ME can offer them.

Friday, May 18, 2007

Eclipse's Ant Editor and Maven


We have a number of Maven XML files in our project; if you accidentally open one of these in the Ant editor, it attempts to verify the contents, and will often fail. If it does so, it marks the file as having errors and refuses to believe otherwise unless you correct what it perceives to be problems, even through IDE restarts.

I've mostly corrected this by using WTP's XML Editor, but I still accidentally open one now and again using the Ant editor. When this happens, I curse, fix the "problems", close the editor, open it back up in the XML Editor and "unfix the problems".

This happens often enough that, today, when it happened again, I did another Google search for alternate solutions. Happily, this time I found one. You can specify a list of files that you don't want the Ant editor to check for problems in Preferences > Ant > Editor > Problems. Beautiful. One less thing to complain about. Thanks, Joerg Schaible!

Wednesday, May 16, 2007

I'm Apparently Not Getting Enough Sleep


... because I'm up reading blogs about software, photography, and god knows what else.

Monday, May 14, 2007

Reminder: Apple's Design Approach

This article is more of a 'reinforcing' than a 'groundbreaking one', but a good read. Basically, the argument is that Apple's design process succeeds because there a small number of empowered people making design decisions, rather than large committees, they question the constraints in which they're placed, and that Apple designs are good at leaving "frills" out in search of a streamlined design.

All true, IMO, and nothing really surprising, but you see the alternatives so often that everyone needs a reminder of this, now and again. These lessons are equally true in software.

Friday, May 11, 2007

Eclipse 3.3 M7: Better Diffing


I'm not sure which of the 3.3 milestones included the improved diffing, but ... thank you!

This is so, so much better when it comes to differentiating between changes that are mostly whitespace and those that aren't. Very, very nice to have this. (Woulda been nice three years ago, but, hey, better late than never.)

Thursday, May 10, 2007

Eclipse 3.3 M7 - Web Tools and First Thoughts

I've had some issues getting Web Tools (XML Editor, HTML editor) up and running on M7 using the Europa update site. It seems as if it might be missing pre-requisites that the update site didn't force me to get.

At first, even the XML editor didn't load; so I got a few things that I thought it might need. GEF, EMF, the like. That got the XML editor loading, but not the HTML editor. Got a few more prerequisites (SDO, DTP, and a few others) after checking the WTP page, and it looks like I've got them both loading.

All in all, 3.3's working out reasonably well. The on-by-default spell check is vaguely annoying in some files, and great in others. The clean-up-on-save feature is great, I'm loving that, as is the ability to show the JARs under a 'Referenced Libraries' item in the package explorer.

Wednesday, May 9, 2007

Launchy 1.25

If you're on Windows and you haven't tried Launchy yet, I'd recommend that you give it a try. My appreciation for it grows daily, and the new version adds several nice features. I'm pretty happy with the Go-y community-contributed plugin as well, although I imagine I'll only use that when I've got a lot open.

Eclipse Plugin: NTail

NTail looks useful; the ability to 'tail' a log can be handy; integrating that with Eclipse makes it convenient, particularly if you're running a debug session or something of that nature.

Tuesday, May 8, 2007

An Introduction to Commons IoC

Not to be outdone by the Dependency Injection Meta-Container, the Jakarta project is proud to announce Commons IoC.

In keeping with the proud tradition of Commons projects like Commons Logging, Commons IoC aims to bridge the wide array of Inversion of Control frameworks with a single API.

Accordingly, using a single programming model, users of Commons IoC can now build an injected-dependency application that can seamlessly switch, with a minimum of coding changes, between IoC from:

  • Spring Framework
  • Pico Container
  • HiveMind
  • Guice
Although this doesn't span all IoC frameworks, Commons IoC plans to continue to bolster support in later releases as necessary.

Configuration
Here's an example of injection in the Spring framework:
<bean id="exampleBean" class="examples.ExampleBean">

<i class="lineannotation"><span class="lineannotation"><!-- setter injection using the nested <tt class="literal"><ref/></tt> element --></span></i>
<property name="beanOne"><ref bean="anotherExampleBean"></property>

<i class="lineannotation"><span class="lineannotation"><!-- setter injection using the neater 'ref' attribute --></span></i>
<property name="beanTwo" ref="yetAnotherBean">
<property name="integerProperty" value="1">
</bean>

<bean id="anotherExampleBean" class="examples.AnotherBean">
<bean id="yetAnotherBean" class="examples.YetAnotherBean">


One from Hivemind:
service-point(id=CayenneService interface=markko.hivemind.CayenneService) {
invoke-factory(service-id=hivemind.BuilderFactory) {
construct (class=markko.hivemind.CayenneServiceImpl) {
initialize-method (method=init)
}
}
interceptor (service-id=hivemind.LoggingInterceptor)
}


And one from Guice:
public class MyModule extends AbstractModule {
protected void configure() {
bind(Service.class)
.to(ServiceImpl.class)
.in(Scopes.SINGLETON);
}
}

Notice how each of these is significantly different. Not only are they different in format, but they're different in intent. After some discussion, Commons IoC has elected to take another page from the Commons Logging and simply allow the users of Commons IoC to configure their injection within the base implementation, thereby retaining the full power of your chosen IoC tool's configuration.

Commons IoC in Action
So, having configured your application for injection, how do you use Commons IoC? You simply define your objects using one of these protocols, which Commons IoC supports for injecting dependencies into an object.

Constructor Injection:
public class MyClass()
{
private MyDependency depend;
public MyClass( MyDependency depend ) { this.depend = depend; }
}


Setter Injection, e.g.:
public class MyClass( )
{
private MyDependency depend;
public void setMyDependency( MyDependency depend ) { this.depend = depend; }
}


I hope this has given you a new understanding of Commons IoC and how to use it in your projects.

(yes, i'm kidding; really)

Saturday, May 5, 2007

Why RIAs Look Good: The Web Is a Mess

Bruce Eckel's "Web Standards: Only Less of a Mess" comes down to these three points:

  • These days, you can build the web using standards and get it to work in the major browsers.
  • This usually involves a fair amount of trial-and-error, some learning. Even in this new "web standards" world, the web is still a bit of a mess.
  • This mess is what has made building rich internet applications so painful all these years, and what makes alternate approaches, like flash and flex, appealing.
Now, I'm not sure that Eckel would agree with the way I've summarized these points, so feel free to read the original, but it's in line with how I feel about the web.

A web designer came by my desk the other day. I was waiting for my build, and re-reading the ALA article on three-column layouts. He noticed, and asked, amused, "Are you aiming for my job?"

Far from it. I've been programming for so long that I expect a clean working relationship between me and the computer: I tell the computer what to do, and it does what I tell it. Between inconsistent brower implementations and object models, incomplete and half-hearted standards implementations, the Web is not quite so sensible. It's a trial-and-error affair, one where many people rely on abstraction layers like Dojo, and Yahoo UI widgets, because doing it yourself is so darn painful.

I mean, three-column layouts are one of the most common web layouts -- how can it be so hard to do one? Why is this not basically equivalent to declaring in CSS that you'd like to take the three sections you've specified in HTML and lay them out in three columns?

This is why I almost wish we'd toss out a few of these standards and start again, start with something more complete and more standardized. That's not going to happen, but I can dream.

Friday, May 4, 2007

Eclipse 3.3 M7 Released - New Features

It's been released, you can go download it. The new and noteworthy includes:

  • Quick Access: Looks like this'll be a nice way to use the IDE from the keyboard.
  • Editor Area Drag-and-Drop: This is one of those things that you get used to, but can be a little frustrating. Glad to see that I'll be able to just drag files into Eclipse now.
  • Launch Selection vs. Launch Last: This seems like it'll ease the transition for some people.
  • Introduce Parameter Object: This looks like a good way to refactor methods that take many parameters.
  • Block and line comments in the first column can be excluded from reformatting. This is useful when you use Ctrl-/, because the reformat makes it more painful to undo using Ctrl-/.
And more, of course; these are just the ones that appeal to me.

UPDATE: Since Eclipse can be hard to get in the first few days, depending on congestion, I've shared it on GigaSize (so I can get it at home without competing with the rest of you). You're welcome to make use of that same share, if you're having trouble with the main site.

Eclipse 3.3 M7 - Due Today

Keep your eyes on the download page.

Wednesday, May 2, 2007

Forensic Code Reviews

Several times within the last year, I've conducted what amounts to a forensic code review: in order to find out how a portion of the codebase ended up in a particular state, I've had to delve through its history and gather evidence.

When you do you first one or two forensic code reviews, it's fascinating to see how much you really can dig up, if you try. The information's all there, if you're using a good source control system. You are using source control, aren't you?

Unfortunately, if you're using CVS, as I imagine many of you are, and you're refactoring your code, as I hope many of you are, it helps to have a pretty good understanding of how the codebase has changed. When conducting a forensic code review, I often have to go back beyond the last file location, which means I need to know where the code used to be -- particularly when the first comment doesn't make that clear. (Note: you can save yourself some pain here; use a good commit comment when moving or renaming files).

The Current Example
We have a work product that requires some heavy calculation to achieve. As an example, I'll use an insurance quotation that takes the customer's desired insurance needs, profile, autos, runs them through a proprietary set of business rules and creates a quotation. This isn't the domain of our system, but it's one that most people are familiar with, so it's an easier example.

Although the insurance quote is entirely derived information, the quotation process takes a fair amount of time to run, so we store the end result in the database. If the customer wishes to see the quote again, we simply retrieve it.

Before we retrieve it, though, we run a quick check to see if the quotation is valid. We check the date the quotation was calculated against the last date on which inputs to the quotation have changed. If the quotation was calculated after the last input change, then it's "clean", and we can offer it to the customer direct from the database. If the inputs have changed since the quotation was calculated, then the quotation is 'dirty', and we have to calculate a new one.

Before I get into the problem at hand, let me describe one other date: the calculation-effective-date. This is the date for which the calculation should be effective. There are a number of date-effective routines in the system that look up competitive data, choose versions of the business logic, check against date-sensitive actuarial tables, that sort of thing. In order to ensure that a customer doesn't experience an unexpected change in rates between one "what if" quotation and another, we use the beginning of the insurance quotation session as the calculation effective date. This means that a customer won't hit "recalc" and be presented with radically different results for almost-identical data.

The Problem
Recently, we've seen that the quotation process seems to be invoked more often than it should be. In the process of making another change, I discovered why.

Where we used to record the current date as the date on which the quotation was calculated, we seem to have started using the calculation effective date. Since this calculation effective date is the beginning of the quotation session, this is usually before the last input data changed. The system thinks the quotation is always dirty, and thus calculates a new quotation each time we ask to see it.

The Causes
There are two independent things that caused this problem. At a point in the not-too-distant past, we used the 'current date' at the time of calculation for calculation-effective routines. This meant that one quotation was internally consistent, but it might not be consistent with the last quotation the customer received, minutes ago.

The code that invoked the quotation engine created a date variable, calculationEffectiveDate, then went on to use that both as the calculation effective date, and as the date on which the solution was calculated. This worked for a long time, because the two were effectively the same.

However, when we moved to using the session start, another developer came along and revised the assignment to calculationEffectiveDate so that the session's start was used for this. Unfortunately, this variable, and thus date, was, as described above, also used as the date on which the solution as calculated. This caused the caching failures we've already described.

Conclusions
There are a few conclusions here:

  1. Name your variables for how they are used; if a variable has two uses, make sure that's clear in the name, or use two variables.
  2. When modifying existing code, make sure you understand the impact. In this instance, judicious use of Eclipse's "Mark Occurrences" would have quickly shown the variable whose assignment was being modified was being used in two distinct ways.
  3. Don't use source control; there's always some bastard like me waiting to dig up your mistakes later, and blame you for them. :)

Christ Church Cathedral Cross


Christ Church Cathedral Cross
Originally uploaded by diathesis.
Still working my way through the photos from Ireland, a day at a time. We spent a fair amount of time in Christ Church Cathedral in Dublin, taking natural-light photos on tripods. There were so many nice architectural details.

Working with natural light has its challenges, so I took a few series of light-to-dark photos so that I could work on my DRI/HDR techniques. I prefer these to be relatively subtle.