Saturday, December 10, 2011

Backlog 3: DB, JS, Bad Code

I'm not a DB admin or DB anything, I'm just a dev
So it's no shock I have tons to learn about databases, especially Oracle
And so I was surprised to hear when Oracle would ignore indexes
Based on stats/sampling of data to determine if the index would be useful. But the sample picked might not be representative, leading to a bad plan and a SLOW query.

Recent converting of Richfaces to JQuery, attempting to use a newer JQuery than the version packaged with Richfaces. Found it needed to be loaded before Prototype but couldn't change the JS load ordering with older Richfaces version. So solution was to just remove Richfaces components which removed dependency on Prototype (so it wasn't loaded anymore).
Then multiple JQuery versions could be loaded properly using no conflict.
And the Richfaces components, like a modal, could be replaced by JQuery plugins.
In the end it worked out, but after many attempts to fix the script load order.

Another pain point that has persisted is rounded corners and being restricted to CSS2 (using flying saucer and meeting older browsers). Also annoying are browser optional display of background images on printing (seen in IE/Firefox and needed to be configured in page setup).
A nice feature I was able to use with Flying saucer for PDF rendering was image caching by url. Instead of fetching images remotely, load them from a cache by url. Especially useful for generated images (not stored to file - my use case).

I've mentioned it before, but the lone developer is dangerous,
especially without unit tests or code reviews or good sample data for testing.
How bad can it be? How about killing a production server with an endless loop?
Not just a slowdown, I mean dead and out of use.
How about causing an all day investigation taking up tons of resources?
And what is the cause? A simple condition not checked for.
It just took the right set of data to break the algorithm.
But I guess the lesson is to expect the edge cases/bad input since people are messy and defensive coding is important. And unit tests!

1 comment:

  1. Hi,

    I am using RichFaces 4 and need to print the components to pdf using Flying Saucer. I have followed the steps given on http://blog.sergnese.com.ar/2012/12/how-to-render-xhtml-with-images-using.html but the richfaces components are not rendered properly. Could you please help me out here?

    ReplyDelete