Eclipse selection and when to process or not

I heard from a user of the Attachment Viewer today that when a large ZIP was selected the client appeared to hang.  He explained that the attachment viewer was not even showing yet it looks like it still processed the selection.  Well, he was right.  After looking at the code, it was actually processing the ZIP file every time – whether the viewer was showing or not.  So I made a simple change and he is checking it out (testing it for me).  I did my small unit tests but I figured giving him a patch and testing his large ZIP file attachment would also be good – a second set of tests is always welcome in software.  🙂

So what did I do?

In the selectionChanged() event I had to determine if the view was visible or open.  This was an interesting problem because the view itself does not contain this state.  What I had to do was register the view with the workbench as an IPartListener2.  Why the “2” and not just IPartListener?  The key event we need is actually partHidden()!

The description of the event is here:

Notifies this listener that the given part is hidden or obscured by another part.

What I do is have a class level property named “_closed” and set it to true or false in the different events for IPartListener2.  This allows me to not process the selection if its “_closed” and just return out of the selectionChanged() callback.

I scoured the SWT and Eclipse world and I could not see another way to do this so if anyone has any input please let me know.  I will be updated the OpenNTF project with the fix in a few days.  I am sure one of the Eclipse guru’s reading would know if this is correct or not.


First Explosion using Blender

I love the open source community.  The amazing Super3Boy has a really good set of tutorials and is extremely popular in the Blender community.  Following his 24th tutorial video I was able to create a basic explosion.  In the end, after playing with the many settings it looks more like a gravitational pulling apart video, or something like that, then an explosion but anyway, its pretty cool.

Facebook changes…again…

I like how Facebook just changes its UI somewhat randomly.  I am sure they announce this stuff somewhere but from a casual users perspective its pretty annoying.  I log on to FB tonight and notice the “Share” field is now gone and I have to click an option of what I want to share:

Click to enlarge

So is this how the cloud works?  Will applications in the cloud “just change” one day when a user logs in?  I wonder how this would fly in real enterprises.  I know when I worked at a large company in IT there had to be all kinds of training, warnings, etc that a new version was coming.  This just seems to easy to frustrate the average employee.

One key thing that may distinguish cloud based applications from on premise custom applications is that they are so intuitive it doesn’t even matter if the stuff changes.  Unfortunately FB has not been so intuitive.  I remember several changes totally frustrated me in the past.  This one change is minor but its funny how I immediately noticed it because I could just click in a field and start typing!

Dojo woes went away with Dojo 1.5

I learned a big lesson creating the attachment viewer as shown in my previous post (Attachment Viewer on Steroids).  I was struggling to use the slide show user interface.  For the life of me I could not figure out why it was not working and from the samples provided everything I was doing seemed right.  Out of the blue I had a late night vision to look at the Dojo version I was using.  I often dream of JavaScript and Dojo in my deep sleep – so that was nothing new.  The next, I realized I was using Dojo 1.4.  I decided to change the one line of code to point to the Google Dojo 1.5 CDN:

Viola!  The rendering worked just by changing that one line!  I am not sure what I was doing right or wrong but I do know that this was very frustrating and wanted to pass it on.  If you are using “dijit.layout.StackContainer” with “dijit.layout.ContentPane” and are seeing some strange things then try Dojo 1.5.

I really wanted to dive on the two versions of Dojo to write about what exactly was the problem but I have been too swamped to take that dive.  Hopefully this helps out others.

Slide Show

Got the kids into animation!

Today I sat down with my eight year old and showed him a little bit about Blender.  After the first video he immediately took interest and I also showed my two oldest kids the video and pointed them to the YouTube tutorials by Super3Boy and Blender site so they could play around if they wanted.  In the end, Nathan came up with the animation below.  I helped by doing the actual work but he pretty much directed the entire animation – which was cool.  He seemed to have a pretty good interest level.  You can do a Save As on this link if you want to download the blend file.

Which Java sort is faster? Part 2

After taking some feedback and hearing further arguments I went ahead and automated a program that runs many permutations of the sort comparisons.  For these results I ran against an array that has 150,000 random strings that are sent into each different sort approach as I showed in the previous post.   I then wrapped these calls into a loop and ran that loop 50 times.  The results are a little different than the first set of tests but in the end the Java sort is much faster.  Maybe the next exercise would be to code a search that is as fast as the Java sort – without looking at the Java sort code…

Here are the average numbers.  Each set below is the average for a 150,000 element array running 50 times.  I actually ran this twice just to get another set of numbers.

Set 1

150,000 elements run 50 times
Average Merge Time = 176
Average Quick Time = 190
Average Java Time = 161

Set 2

150,000 elements run 50 times
Average Merge Time = 182
Average Quick Time = 200
Average Java Time = 165

I really can not stand this!

Does anyone else hate this new collapsing block of advertisements you see on some sites now?  The ad initially expands and pushes the content of the article down the page and you either wait for it to disappear (scroll back up) or click the close button.  This has got to be the most annoying advertisement method I have ever seen on the web!  I actually get extremely annoyed daily on one of my favorite sites:, InfoWorld.  I am sure some marketing person thought this was a great idea.  I for one absolutely hate it.  Put your ads on the top, the side, or throughout.  I don’t care.  Just don’t make blocks scrolling around uncontrollably.