I recently lived through one of Sherlock Holmes famous quotes in development land the other day.
when you have eliminated the impossible, whatever remains, however improbable, must be the truth
It was a serious bug in a recent Adobe Flex project that was something so simple (appearing) but could not for the life of me find out why it was occurring. I mean, I would not be releasing the software without this guy being fixed, it was a blocking issue.
Now I am far from an ActionScript junky that has been drinking the cool-aide since 2000 (yes AS is 10 years old, they grow up so quick). Anyhow…
So the issue at hand was pretty straight forward: A AdvancedDataGrid on portion of a panel that had numerous columns, some with ItemRenders some without. Not much data (still in a testing phase) and one huge bug:
DataGrid ALWAYS had the last row selected as soon as the grid gained focus.
You could interact with the grid and even ItemRenders that had sub-components reacted properly, but no row highlighting would ever move. ALWAYS that last row of data was highlighted.
So normal debug started to occur thinking some of the new “gee whiz” features I recently tacked on to the grid, was the cause (this is when version control saves you a zillion hours).
So I start rolling back to previous versions to go and find where the grid was acting like it should.
Previous version, nope, OK, a little further back…
Previous version, nope. jump further back….
Dang this bug has been here since the beginning of time it seems. Boy that is a bad UI oversight.
Where is the QA team!? I demand the QA guys head… oh that would be me. Dang, shut up, move on.
At this point I am thinking I have bad builds, bad development environment, start looking at other DataGrid’s in other projects (that are working and build fine). Making the whole thing much more worse and I think I have a huge underlying flaw somewhere. Not really, but we will get there. This is when a sane developer becomes an insane one. This is when the alchemy comes in and you start thinking the lead will always stay lead and there really is no gold at the end of the rainbow. This is when a true coder at heart thinks they hear the code weeping. But alas, we have a P that needs solving.
So I start ripping out the guts. I mean everything, code that have nothing to do with the problem is tossed aside, just to see if it magically gets fixed. Nope, nope and still nope. So it was time to step back.
Deep breath, OK, this is NOT UI code issues at play here. We have removed 99% of and it is still broken! Hmmmm. (I hear off in the distant, “when you have eliminated the impossible”)
So what was left? Not the UI, the source of the data? How could that be impacting what row was highlighted? The data is showing up fine in the grid and interacting with the data objects even work. That can’t be it! Ah, but it does.
A single lonely property that Adobe uses to keep track of its objects that normally would have never been an issue was the culprit this time round. See, it turns out that the ArrayCollection of data object’s remotely retrieved had a single property in it that should of never been there in the first place (dang badly designed data objects).
So what was the property in the DO that could of caused all this: UID
DOH
It actually would not have been a problem if it had been uniquely populated, but it wasn’t. It was null.
DOH DOH
So basically when the grid tried to uniquely look at the data objects so it knew which one was highlighted, they all looked the same since all the uid properties where all null.
Lesson learned and I swear those poor uid’s will never be overlooked and looked down upon ever again. Of course in this happy ending of story, the damn UID was ripped out and thrown against the wall and post haste the DataGrid selection and highlighting was once again working exactly as it should.
They just released their next music video. Felicia sounds great, not to mention that this is what all The Guild fans have been waiting for!
Season 3 starts August 25 on XBOX Live (right now the only reason I can see I want an 360 right now!). How is this for a early gift to get you ready for the new fall season!
Support them by buying the MP3, the entire crew of The Guild deserve it. Amazon MP3 iTunes
MUSIC AND LYRICS BY FELICIA DAY AND JED WHEDON
LYRICS:
Hang with me in my MMO
So many places we can go
You’ll never see my actual face
Our love, our love will be in a virtual space
I’m craving to emote with you
So many animations I can do
Be anything you want me to be
Come on, come on, share a potion with me
CHORUS:
Do you wanna date my Avatar
She’s a star
And she’s hotter than reality by far
Wanna date my Avatar?
You can type commands
I’ve got slots for what I hold in my hands
Don’t care what’s in your character bank
How ‘bout, How ‘bout a little tank and spank
Grab your mouse and stroke the keys
In cyberspace there’s no disease
Pick a time, send a tell to me
Just pay, just pay a small subscription fee
CHORUS
Single white human,
Looking for group
My stats so high
Don’t be out of the loop
Got an uber-leet staff
That you can equip
Close your mouths ladies
This is pure nerd-nip
I’m a pixel-based fantasy
A man who is stoic
I hack and slash
Who the heck’s more heroic?
Check me out:
Cloth armor
Fits me like a glove
Just twitta a time
And I’m ready for love
Hang with me in my MMO
So many places we can go
I’m better than a real world quest
You’ll touch, my plus 5 to dexterity vest
What role do you wanna play
I’m just a click away night or day
And if you think I’m not the one
Log off, Log off and we’ll be done
I ran into the need to change a project I am working on from keeping a ton of java objects in the air due to real-time calculations and performance. Didn’t need (or want) full database that would need to be maintained by a database group.
Every time the application was restarted, the entire thing would be reloaded based on other sources (other databases of data — all different db’s, data and transformation needed). The transformation requires each base source to have different set of transformations and calculations performed on them. Also since the sources have different real-time intervals there needed to be different levels or transformation going on.
Of course if I was a dba, I would be saying this should all be done in some huge db iron and storing it into some jumbo sized tables and all could be done with scripts, triggers, etc. But I am not a dba, I like my logic in code, not a database. That is just who I am. I love Java and like to see what my code is doing to the data and db are used to store and get things for me, period. Just wasn’t going down that road. We can agree to disagree or not.
Ruled out in like 5 seconds that the use of flat files to store the calculated data would just not work. I had to have the ability to retrieve the data fast (wanted hash maps or trees in memory, but that quickly ran out of steam due to quantity of data). I also wanted to keep everything in the single app (single deployed war) at the end of the day. Makes support easier in the long run. One point to look at instead of 12!
So I came up with a list of what I wanted:
Needed to be quick.
Needed to be embeddable (not an Oracle, MySQL or anything like that) / memory friendly.
Needed to deploy when the web application deployed (all self contained).
Needed it to be support by ORM (Apache Cayenne) since already using in the project for other db work.
Needed to be open source.
Needed to be temporary, last only while web app was up and running and throw everything away when app restarted.
I had narrowed my list down to three choices I was entertaining (your experience might be different):
They probably would all get the job down. But I tried to narrow it down by my criteria by doing a little reading (Google + reviews + blogs + groups complaining about stuff + did I like what I saw):
Started reading, it appeared H2, then Derby (latest) and then HSQLDB was the speed arrangement. (YMMV)
More reading… All would meet the need, but H2 had some really nice instant up and running features that I liked. (IMO)
Same as #2, they all would meet the need more or less. Just different feature set, but once again H2 was drawing my attention. (IMO)
All had native support in Cayenne since I am using 3.0 (H2 was not supported prior to 3.0, but that didn’t matter since I am using 3.0).
All met this need and would of been fine.
All met this need in some fashion and would of been fine as well.
So it really came down to how easy “did it appear” for me to get this started, embedded and actually working, using it in actual live code all in the same day. For me it had to be H2.
There were quite a few reasons other than meeting my 6 requirements above. I also liked that it had an active change log which every month appeared to have forward progress and making the project better. Open source projects are either constantly evolving and or dead. Get worried when a project hasn’t had commits or quite a bit of progress in months, 6 months, last year, etc. Code is never perfect, it can always be better. Don’t leave it there to just die.
I have to admit that venturing down the H2 path in the first day of use has turned out to be a great choice.
Love the embedded console you get by including 1 (one, yes one) jar in your project which you were going to do anyways since that is the only lib required. Edit your apps web.xml and bang. That is supporting your dev project front and back. I can see it will come in handy trouble shooting the application both during development and even possibly productional since we are talking ever changing live data.
Integrated really quickly with Cayenne. I have cayenne actually building the schema from its own XML each and every time the app starts up. Talk about reuse and single place for describing the model. ORM creates the model, creates the Java classes and now builds me my schema in my temp db. That is a win, win, win situation folks. No SQL monkey business, period!
With a little more code (I mean little) I have it dropping everything (entire schema) and db temp files when it shuts down (all through a single listener config in the web.xml). I love when things are simple and just work. Kudos to Thomas for creating such a great db that works right out of the gate. Simplest Java library I think I have ever used.
I plan to write up some of the things I find interesting in the coming month or two (along with some other Wicket and Cayenne stuff I have mocked up, but not typed into here). Here are some of those ideas I have already worked through turned out beautifully (eluded to above)!
DB embedded in app config.
Cayenne used to build H2 schema.
Purge db on shutdown.
Performance / usage.
It should be noted that H2 is developed by Thomas Mueller who was the creator of HSQLDB (H2 can be seen as HSQLDB2, just better and it even said that it could merge back into HSQLDB)… anyhow.
Everybody has a Facebook page – but who do you know who is still on MySpace but who isn’t a member of a struggling band with shockingly bad taste in web design?
Facebook makes sense if you are a teen and have nothing better to do with your life. Let’s not even talk about Facebook trying to tweet it’s way into something better. MySpace is EOL and reshuffling its upper management will do little to stop the bleeding on yester-year fad. GeoCities is finally closing it’s doors on bad web design and now we can only hope the same for MySpace. Somethings set the web back a decade instead of making it better.
Well, I finally had to bite the bullet and migrate a large Wicket project from 1.3 to 1.4. I was really not looking forward to it because of all the generic mess and model changes.
This was nothing against the Apache Wicket team, since they do an incredible job on the BEST Java framework ever (it is more than that.. but that is further down).
I just thought of having to review so much code and updating the ever growing set of Wicket “component” libraries, but that was the actual reason for the surge of change.
Some of the key sub projects I was leveraging were all converted (for sometime now) and were really starting to not go back to their 1.3x branches to update the older code. I saw the 1.3x branches dying. NO!!!!
I was trying to keep some of my key sub component / libraries manually synced from their newer bigger brother 1.4 code trees, but that was getting ever increasing painful and foolish. Not to mention to find bug issues fixed in the 1.4 branches, but not in the 1.3x code base I was using. So the decision was to maintain old branches for the sub projects (not my code even) or update my project and use all new 1.4 code for everything.
Jump… 1.4 1.4 is a very good great thing.
I know in the Wicket community there has been some huge Generic battles and long, long, long threads on it was the wrong approach, too verbose, too much code for no bang, blah, blah, blah. It was painful to watch since last year (thankfully they took it out of the forum and gave it a wiki home for folks to die over).
I actually find so far that 9 out of 10 times, it has made my code more understandable and actually working with models even more concise. You get the added benefit of types collisions be detected in your IDE (if you use a real one) / compile time on models in the code that you would not get until you actually put the wrong object in a model for a component… then crash and burn and do a wtf was I thinking! Nothing beats detecting issues before ever running a line of code. I have C (not ++ or #, C) flashbacks of trying to figure out what code didn’t work, but would compile. Boy I am glad I don’t code in that world anymore.
I am glad though, that I did hold out past the 1.4M3 period. Much of the early on back and forth over how to implement generics was not pretty and I could only think of moving code from M1, M2 to M3, to RC… Even sweet utility classes (albiet small classes) like ListModel and MapModel really do ease the coding and sets up the enhanced model design even better. Once again, it makes the code more understandable as to what the Model contains and what you are working on.
Of course with any cleaning, updating has spurred on some good old refactoring of my own to leverage some new efforts in 1.4 branch and even how I plan to continue to leverage Apache Cayenne in some more elegant base Model designs of my own. Should help with the whole deteaching and seperation level between Cayenne and Detachable models in Wicket so much cleaner.
So the dread, regret and final excitement was all part of my 1.4 migration. At this point all projects will of course be 1.4x and some day 1.5… (Ajax enhancements could be even more awesome to come.)
Once again, it just goes to show that Wicket never steers me wrong and increases my I love for the whole framework project (99.9% of the time) that much better. It makes Java Web development fun and exciting. Come on kids, drink the cool aid, it won’t hurt ya!
SIDENOTE:
Wicket is not just a web framework, but a Java web way of life. I don’t how many times I have told the story of that I will not / never (never say never right) go back to doing JSP development period. It is just wrong once you see the light.
The Apache Wicket team is proud to present the second release candidate of Apache Wicket 1.4. This is the first Wicket version with java 1.5 as minimum requirement.
1.4 is really starting to shape up and since the whole generic movement in the project has settled since M3 days, I am going to have to jump from 1.3 to 1.4 big brother.