Posts

Showing posts from 2013

Java 8 - Using Parallel Streams

Java 8 is not slated to come out until Spring 2014, but the features are so enticing that I just had to download the snapshot, and give it a test run. After messing with python the past few weeks the Java 8 feature that I am most looking forward to is lambda support. The second feature I'm digging is the new Stream API. Now these are both very useful APIs on their own, but I really like how Python uses them with the functions filter, map, and reduce. You can read about that here if you'd like. Java 8 provides the same functionality, but it is a bit more verbose. On the plus side, it gives you a few extra useful features that Python does not. (At least that I know of, I'm a Python n00b.) Note: All example code can be found here. My first test was just a few simple filters, and maps. public void test1() { List strings = Arrays.asList( "One","Two","Three","Four","Five"); List longerThanThree =

Taming the GWT PopupPanel

I was working on a feature of a GWT application today, and decided to fix a problem that had been bugging me.  While the issue was not a server crashing bug, it was a usability nuisance. Between the main content of the app, and the navigation bar, there was an Anchor.  When a user moused over the Anchor, a PopupPanel would be shown with some user data in it.  Everytime i moved my mouse up to the navigation bar, I'd mouse over the anchor, and have this annoying PopupPanel in my way.  To compund the issue, there was a RPC call each time the panel was popped up. To combat this issue, I decided to use the GWT Timer class, along with the MouseOverEvent and MouseOutEvent.  This was incredibly simple after I moved the presenter and view to use the UiField, and UiHandler annotations along with the UiBinder. The Code: @UiHandler("popupAnchor") void showPopup(ClickEvent e) { showPopup(); } private long mouseOverTime = 0; private int loadPopupTime = 300; @UiHandler("p