Steve On Java - Flash

Hacking Java, JavaFX, and Flash with Agility
  • rss
  • Home
  • About
  • Contact
    • E-mail Steve
    • SC2 Challenge
  • JFXtras
    • JFXtras Individual CLA
    • JFXtras Corporate CLA
  • Freedom From XML
  • Travel Map
    • Let’s Meetup!

JavaFX and HTML5 at JavaOne India

steveonjava | May 6, 2012

This past week I had the opportunity to attend JavaOne India, and in my opinion it was even better than last year.  I was speaking together with Kevin Nilson, leader of the SV Web JUG, and he commented on what a great venue that had for the event, which was easily able to hold 2000+ attendees.

Walking around the event, you could appreciate how much passion there was for Java development in India, with a diverse group of attendees that included students, professional developers, and Java community members.  Yara Senger, who came all the way from Brazil to speak about Java home automation with jHome, was impressed with the large number of women developers attending the conference.

The session that Kevin and I gave was an updated version of our HTML5 and JavaFX talk.  Since we last gave this at Devoxx, we were able to add some exciting info about Bootstrap, which is a new JavaScript framework developed by Twitter that has surpassed both jQuery and node.js in activity.  Definitely worth a look if you are developing responsive UIs in JavaScript!

Here is the full presentation deck (which you can also download by going to SlideShare):

For the finale of the presentation, which showed a Conference Tour application that shows how simple it is to mix JavaFX and HTML5 into a single, interactive application.  The whole user interface is rendered using JavaFX including the Accordion control and the Reflection effect, while the map itself is an embedded WebView that makes use of Google Maps.  By clicking on any of the conference locations in the Accordion, it automatically centers on that application in the map showing you where you can find some of the most amazing Java conferences throughout the world!

To run the project yourself, you can download the source code and open it in NetBeans or your favorite IDE.

Download Java Conference Tour Code

The code for both the JavaFX UI and Google Maps component is under 150 lines, so this is definitely something you could develop yourself.  Feel free to take the code and leverage it in your own JavaFX/HTML5 hybrid projects as a starting template, and let us know what sort of cool applications you are able to build!

 
Comments
3 Comments »
Categories
HTML5, JavaFX
Tags
HTML5, JavaFX, javaone, JavaOne India, Presentation
Comments rss Comments rss
Trackback Trackback

Oracle Propels JavaFX Forward by Enlisting Weaver and Chin

steveonjava | April 2, 2012

I put out an April Fools’ post yesterday about joining NASA to help with exploration of the big red planet.  That post was not far from the truth…  all the details about technologies developed by NASA were 100% accurate.  Heck, even the fact that I quit my job was the truth!  The only part that was not true was the company that I will be joining.

While working for NASA to help explore Mars would be a very cool gig as well, I am joining another big red entity that you might be familiar with…

I was initially skeptical about joining Oracle, but have been won over by their commitment to moving forward the Java platform that they have demonstrated over the past 2 years.  For example:

Oracle released Java 7 on schedule in only 1 year

This is something that Sun had been unable to accomplish in the 3 years preceding the merger, and had historically struggled with.

Hudson and OpenOffice have been freed

While the community outcry around the Jenkins and LibreOffice project splits made all the headlines, the ensuing freeing of these platforms by Oracle in which they donated the code to the Eclipse and Apache Foundations, respectively, was not nearly as well publicized.

Oracle saved JavaFX 2

Sun lost touch with their developer base, and built a platform that was inaccessible to Java developers and didn’t meet the needs of business client applications.  Oracle turned this around by rewriting all the APIs in pure Java, adding a much-needed focus on desktop business applications, and shipped JavaFX 2.0 on time!

For these reasons and more, I am glad to have the opportunity to continue to drive Java forward from the inside out.  In fact, not only am I going to be joining Oracle’s Java evangelism team, but at the same time they also recruited Jim Weaver, my friend and co-author on the Pro JavaFX 2 Platform title.  So what can we infer from the hiring of two JavaFX gurus like Jim and myself?

For one, JavaFX is here to stay as a part of the Java platform.

With the 2.0 release, JavaFX finally has the performance, Java language support, and business focused controls to be a worthy successor to Swing.  This is good news to those companies who have a heavy investment in Swing, because they have a path forward to continue developing mission critical business applications on the highly robust JVM platform.  Also, with the new JFXPane component that allows embedding of JavaFX applications in Swing, it is easy to begin incorporating JavaFX elements in existing web applications.

Also, JavaFX has the potential to be a driving force in cross-platform mobile application development.

Right now you have to choose between with the limited functionality, poor usability, and device incompatibility of web-based cross-platform frameworks or the high cost of writing multiple native applications.  I had high hopes that Flash would fulfill the gap between these two approaches, but Adobe fumbled he ball.  Fortunately, JavaFX has shown great promise in this area with some impressive technology demos at JavaOne, and has the opportunity for a touchdown with a business-focused release of JavaFX 2 on mobile.

I am optimistic about the future of Java and JavaFX technology in the coming years, and in my new role will be in a good position to give all of you a front row seat.  Expect plenty of blogs, articles, demos, and the usual satiric, but realistic, developer viewpoint on the Java platform as I dig my heels in at the big red giant!

 
Comments
19 Comments »
Categories
Announcements, JavaFX, Oracle
Tags
Hudson, java, JavaFX, OpenOffice, oracle
Comments rss Comments rss
Trackback Trackback

Joining NASA to Conquer Space with Java

steveonjava | April 1, 2012

This was an April Fools’ spoof — everything is factual except the company I joined.  Read more here.

Just in the past year I lead the OSCON Java conference, wrote a new book on Android Flash, and also put out an update to Pro JavaFX 2.  A lot of rumors have been flying around about what the next big thing for me will be, especially since I just quit my job this past week!  Well, time to put the speculation to rest and announce my new gig at the NASA Ames Research Center.

“…time to put the speculation to rest and announce my new gig at the NASA Ames Research Center.”

NASA actually already has quite a bit of Java in use internally at NASA today.  You may not know that the command and control systems for many of the mars rovers, including the Spirit and Opportunity, use Java technology to send instructions to the remote robots as well as analyze the data coming back and construct 3D views for the navigation software used in the control center. After 8 years on the planet, the Opportunity is still going strong, collecting data on Mars craters and seasons, and bringing back priceless images from the red planet.

NASA is so reliant on Java technology that they are also active contributors to the open-source community.  The newer K-9 rover has even more use of Java technology, for which they developed a tool called Java PathFinder in order to identify and eliminate software errors. This is actually an open-source project that you can use in your own application development to trace through different bytecode paths and identify and debug potential deadlocks or exceptions. One of the main features is the ability to deliver not just a stack trace where the error occurred, but the entire execution path that lead to that error.

Recent advances in Java make it a great platform for doing the sort of mission-critical work that NASA needs.  Embedded Java offers a compact, reliable platform for building Java applications on a variety of hardware platforms that are efficient and robust enough to be used in unfavorable conditions such as space and planetary exploration.  The Java EE platform is the industry standard for server technology, and provides a number of reliable, fault-tolerant communication transports that can speed up and data transmission and analysis for researchers worldwide.  And the part I am most excited about is JavaFX technology, which is a modern UI toolkit for developing rich client applications that can incorporate business controls, data charting, media playback, and even 3D.

“JavaFX … is a modern UI toolkit for developing rich client applications that can incorporate business controls, data charting, media playback, and even 3D.”

So you might be wondering why NASA has so much investment in Java and not web technologies like HTML5 and Javascript…  Well, let’s imagine an alternate world where Javascript and web applications were the way we did space exploration:

Swigert: ‘Okay, Houston, we’ve had a problem here.’
Houston: ‘This is Houston. Say again please.’
Lovell: ‘Houston, we’ve had a problem. We’ve had a 404 error.’

“Houston, we’ve had a problem. We’ve had a 404 error.”

Needless to say, I am glad to be working on Java, and taking it to new heights at NASA!

 
Comments
2 Comments »
Categories
Announcements, JavaFX
Tags
java, JavaFX, NASA
Comments rss Comments rss
Trackback Trackback

JavaOne is Rebuilding Momentum

steveonjava | October 10, 2011

Just finished up an extremely busy week at JavaOne and there was a lot to like about this year’s event.  There were plenty of surprise announcements, lots of good content/sessions, and a lot of improvements on the venue and organization.

For folks who have been patiently waiting for me to publish all my talks, I apologize for the delay…  giving 4 talks + a keynote (plus 3 more talks at Silicon Valley Code Camp yesterday) was a lot more work than I expected.  To make sure I can cover the topics and code in enough detail I am going to publish 1 talk plus commentary a day for the next week.  Please follow me on twitter or rss to catch the updates as they roll out.

To get you started, here are some of the highlights from JavaOne:

JavaFX is back in the spotlight!

After a year of hibernation, JavaFX is back with a 2.0 release, big open source announcement (more on this below), and mobile prototypes on Android and iOS.  For those naysayers who said JavaFX is dead, Oracle has proved that they are going to continue to move the platform forward and support state-of-the art development on Java client technology.  As always, Jasper and the rest of the JavaFX team had some pretty impressive demos and the entire Java community was re-energized about the future of client Java.

If you haven’t already, go download JavaFX 2.0 right now!  It is available in production for Windows and there is a developer preview of Mac OS X, so you have no excuse for not trying it out today.  (unless you are on Linux…  but that is supposed to be coming soon too)

The Open Source Petition Was Successful!

Thanks to all my blog readers who spent the time and energy to sign and support the petition to open source JavaFX.  In part due to the huge community sentiment about the need to open source JavaFX, Oracle has taken action and promised to open source the entire platform.  They are going to start with the controls library as announced last year, and continue to open source the entire platform as part of the OpenJDK project.

This is a huge benefit to JavaFX, which will finally be getting equal treatment with the rest of the Java platform.  They are also actively working on getting JavaFX to be fully redistributable, which will remove yet another obstacle to making JavaFX the standard for desktop development.

Community, Community, Community.

Oracle has been listening to the Java community, and put in place many of the changes and suggestions that were raised.  This was evident in the entire JavaOne conference, which was a huge improvement over last year’s event.  Some of the improvements that I noticed while hanging out at JavaOne this year included:

  • A Community-focused Keynote – While I may have been biased as a participant, I thought the best keynote of the conference was the wrap-up community keynote that Sharat Chander lead.  This included some amazing demos by the Duke’s Choice Winners of audible development for the blind and home automation using Glassfish, a spicy panel that had a lot of positive things to say about the Java Community and OSCON Java, and a surprise appearance by the Java Posse who were at 3/4 of their finest!  (the 1/4 being poor Tor, the Googler)
  • Community Hang Spaces – While navigating the conference it was much easier to bump into folks you know by hanging around one of the many hang spaces that were built out around the venue.  In fact, Dean Iverson and I found ourselves preparing for one of our talks in the hang area, because it was more conducive to collaboration and interaction than the speaker room.
  • Easier Venue Navigation – A couple things contributed to this…  One was that all 3 hotels were reserved for JavaOne talks, so you had more talks concentrated in the same vicinity.  Another was the plethora of helpful staff directing traffic and answering questions (I made quite a lot of use out of this myself).  Finally, the signage and open tent configuration made it much easier to get form Point A to Point B.

And a Few Things to Improve for Next Year…

Everyone has their personal gripes…  here are some of mine:

  • Fewer Sponsored Keynotes – When you pay big $$$ to attend a conference, the last thing you want to do is sit in a session and watch a canned talk by a corporate stooge.  The Juniper Networks talk was a particularly blatant example of something that was not really focused on the Java crowd tossed in as a sales kick-back.  In the future, it would be better to make the sponsors earn the attention of the attendees by labeling the talks as sponsored and giving attendees some alternatives.
  • Better Network Connectivity – It was almost impossible to get on the wifi network in any crowded situation (like a session), and once connected the response times were abysmal. That is until everyone left around Thursday midday and the network started going blazingly fast for those who stuck it out for the last few talks.  :)
  • Improved Tech Support on Talks – I listened to the presenter advice and formatted all my slides in 16:9, which didn’t seem to work for the first couple talks that had big black letter-boxes above and below the slides.  Also, my first talk had no network connectivity on the wired connection (and as I mentioned, wireless was useless).  However, I had to the good fortune of giving way too many talks, so by the time I got to my 3rd and 4th ones they seemed to have figured out how to use the very expensive screen adjustment boxes and got everything tuned just right.  Also, the wired network seemed to work fine in all the other rooms I hi.
  • Patching Things Up With Google – This is the second year that Google has refused to let anyone speak at JavaOne. They blame the lawsuit for this, but at some point the policy is more retaliation than just good legal defense. (Is letting Tor speak on stage in a community setting is really going to jeopardize the Android platform?) The real losers in this battle are the average developer who is missing out on great technology and content from one of the most innovative companies in the world.

Overall, JavaOne was a great conference this year, and is definitely back on the upswing.  There was mention of improving the venue in the community keynote, and I hope the upper management at Oracle takes this seriously.  The 3-hotel setup is not ideal, and really not large enough to contain the Java community.  It is time to unleash the Java Community in a full conference venue of its own.

 
Comments
3 Comments »
Categories
Events, JavaFX, OSCON Java, Uncategorized
Tags
community, JavaFX, javaone
Comments rss Comments rss
Trackback Trackback

JavaFX 2.0 and Scala, Like Milk and Cookies

steveonjava | September 27, 2011

JavaFX 2.0 and Scala are both great technologies individually, but work even better when used together.  JavaFX 2.0 is a powerful rich client technology with advanced graphics, animation, and media capabilities.  Scala is a simple, yet powerful language with advanced language features for writing domain-specific languages (DSLs).  Add a little Scala UI DSL to your JavaFX 2.0 project and you will be in cookie and cream heaven!

Time Lapse Photography Creative Commons Licensed by Robbie’s Photo Art

JavaFX Colored Circles

I will go into more detail on why Scala in a bit, but I believe this is all best illustrated with a code example.  One of the basic examples of JavaFX 2.0 functionality that comes with the SDK is a sample application called ColorfulCircles.  The full source code can be found here:

Java Colored Circles Code

With the help of Sven Reimers, we ported this to Scala on top of the ScalaFX library.  The working application source can be found here:

ScalaFX Colored Circles Code

Update: Dean Iverson has a great example of the same code in GroovyFX

Feel free to peruse the source code at your leisure, and take note of the following:

1. ScalaFX is More Concise

The ScalaFX version is shorter both in number of lines and more importantly number of characters.

Code Count (excluding licenses and imports):

  • Lines:
    • Java: 48
    • ScalaFX: 42
  • Characters:
    • Java: 1602
    • ScalaFX: 866

This is due to custom tailored DSL language that is fully expressive with less redundancy.  In the Java version of the code you will notice a lot more boilerplate and syntactic repetition that is required by the language.

2. ScalaFX Code Looks Like the Output

While the output of the Colored Circles example is quite simple, it actually hides quite a bit of complexity in the way it is structured.  Here is the output run from JavaFX 2.0 Build 45 using ScalaFX:

What you are actually seeing is a SceneGraph composed of the following layers:

  • A Scene with a black background that contains…
    • A Group that contains
      • 30 semi-transparent Circles covered by…
    • A rainbow-colored Rectangle overlay

When reading the ScalaFX code you get this nesting through the object-literal style declaration of the Nodes in the Scene as excerpted here:

// ScalaFX Scene Excerpt:
scene = new Scene {
  content = Seq(
    new Group {
      circles = for (i <- 0 until 30) yield new Circle { ... }
    }
    new Rectangle { ... }
  )
}

However, the Java version does not give you the same hierarchical representation, and instead uses an imperative series of calls to constructors, getters, and collection methods.

3. Tailored Animation Syntax

Animations are very commonly used in creating good UIs, which is why JavaFX Script had a built-in construct to simplify the creation of animations. ScalaFX has a similar syntax that allows you to quickly and easily create animations, which is used in the ColorfulCircles example:

Seq(
  at(0 s) {circle.centerX -> random * 800},
  at(0 s) {circle.centerY -> random * 600},
  at(40 s) {circle.centerX -> random * 800},
  at(40 s) {circle.centerY -> random * 600}
)

This makes it trivially easy to create complex animations.

4. And the ScalaFX Version Has a Hidden Bonus Feature…

Unlike the JavaFX version, the contents are bound to the width and height of the stage. Binding in ScalaFX is as simple as replacing the assignment operator (=) with the bind operator (<==) as shown here:

// ScalaFX Property Setting:
width <== scene.width
height <== scene.height

While this is a simple operator change in ScalaFX, it requires complex enough code that they decided to omit it from the JavaFX sample. A loose translation to Java would be the following:

// Java Fixed Property Binding
colors.widthProperty().bind(scene.widthProperty())
colors.heightProperty().bind(scene.heightProperty())

Although, the precise equivalent code in Java syntax would actually be the following:

// Java Dynamic Property Binding
colors.widthProperty().bind(Bindings.selectDouble(primaryStage.sceneProperty(), "width"))
colors.heightProperty().bind(Bindings.selectDouble(primaryStage.sceneProperty(), "height"))

Either of these versions is quite a bit more complex and unwieldy than the ScalaFX equivalent, and this is for a very simple binding!

About ScalaFX

ScalaFX is a UI DSL written within the Scala Language that sits on top of JavaFX 2.0 (not to be confused with Ingo Maier’s great work on Functional Reactive Programming for Swing). This means that every ScalaFX application is also a valid Scala application. By extension it supports full interoperability with Java and can run anywhere the Java Virtual Machine (JVM) and JavaFX 2.0 are supported.

Some of the features of ScalaFX include:

A Programmer-Friendly Object-Literal-Like Syntax

ScalaFX uses a simple, hierarchical pattern for creating new objects and building up the scene graph.  Here is a simple example that creates a new stage with a rectangle that changes color based on mouse events:

stage = new Stage {
  title.value = "Hello Stage"
  width = 600
  height = 450
  scene = new Scene {
    fill = Color.LIGHTGREEN
    content = new Rectangle {
      x = 25
      y = 40
      width = 100
      height = 100
      fill <== when (hover) then Color.GREEN otherwise Color.RED
    }
  }
  visible = true
}

Unlike the builders you find in the core JavaFX APIs, the ScalaFX object declaration syntax uses the normal object API. This means that you can use the same operators and convenient syntax to create and modify your scene graph. Also, anything that is permissible in a Scala block (such as variable declarations, method calls, binding, etc.) can also be done inline while constructing objects. For JavaFX builders you need to declare binding after you finish creating your objects, which leads to disassociated and hard to maintain code.

Natural Language Bind Expressions

One of the greatest advantages of using the Scala language as a DSL is the rich support for operators as methods. This is similar to the C++ concept of operator overloading, but much more uniform and clean in its application.

The ScalaFX bind library exposes normal operators such as &&, ||, +, -, *, / on top of all bindable objects. Also, Scala supports operator precedence, so it looks and feels like you are writing normal expressions even though you are creating bound objects under the covers. As a result, you have the full functionality available from the JavaFX 2.0 binding libraries with code that looks akin to mathematical expressions and operators.

Here are some examples of what you can do with the ScalaFX bind API:

Infix Addition/Subtraction/Multiplication/Division/etc.

height <== rect1.height + rect2.height

Aggregate Operators

width <== max(rect1.width, rect2.width, rect3.width)

Conditional Expressions

color <== when (hover) then Color.GREEN otherwise Color.RED

Complex Boolean Expressions and String Concatenation

text <== when (rect.hover || circle.hover && !disabled) then textField.text + " is enabled" otherwise "disabled"

Free-form Invalidation and Change Handlers

rect.hover onInvalidate {
  needsRepaint = true
}

Fully Type-Safe APIs

This may seem like an insignificant point…  Type safety is something that Java developers have always had (and often take for granted), and developers in other scripting languages live without (and unknowingly suffer with runtime errors as a result). However, it is a critical feature if you are developing applications that cannot have unexpected runtime errors and bugs after deployment.

A good compiler will be able to pick up many common coding mistakes through comparison of expected and actual types, and a great compiler (like Scala) will automatically infer types for you so you don’t have to tediouisly repeat them throughout your code.

ScalaFX gets the best of both worlds with a scripting-like DSL syntax where you can rarely have to explicitly type objects, with the strong type-safety of the Scala compiler that will infer and check the types of every expression and API call. This means less time spent debugging weird code bugs and misspellings, and higher quality code right out of the gate!

Seamless JavaFX/ScalaFX Interoperability

It is often the case that you do not have complete freedom about the predominant language of the codebase, or of the libraries you are including functionality from.  Even in a mixed environment codebase where you have Java, Scala, and possibly other JVM languages, ScalaFX will seamlessly convert and interoperate.

ScalaFX gets this functionality through the implicit operator capabilities of Scala.  Anywhere your program expects a JavaFX typed object, it will automatically insert the code to convert from ScalaFX wrapped objects to JavaFX native classes.  Any time you use a ScalaFX specific feature, the compiler automatically creates a ScalaFX wrapper object that allows you to call advanced methods and access the full functionality. This all happens behind the scenes, letting you focus on writing clean code, and not fussing about integration and interoperability.

With all this interoperability magic happening behind the scenes, there is some additional overhead on your application. We have taken pains to minimize this using features like @specialize in the Scala language, which allows us to avoid boxing and unboxing costs on primitives. However, without real benchmarks it is hard to tell just how good of a job we have done. Hopefully more on this in a future post.

Finding out More About ScalaFX

The ScalaFX project site is hosted by Google Code including a couple mailing lists that you should join if you are interested:

  • ScalaFX Users
  • ScalaFX Developers

At the time of writing we do not have a bundled release, but are interested in early adopter feedback.  If you would like to give it a try, please download the source and give it a quick spin!

I will have more details about ScalaFX at my upcoming JavaOne session with Dean Iverson entitled “JavaFX 2.0 With Alternative Languages“.  Come to hear more about Scala, Groovy, and other JVM languages you can use to write simpler, cleaner code.

 
Comments
10 Comments »
Categories
JavaFX, ScalaFX
Tags
dsl, JavaFX, javafx 2.0, ScalaFX
Comments rss Comments rss
Trackback Trackback

Steveonjava Track at JavaOne

steveonjava | September 1, 2011

The JavaOne Session Builder is now up and available for setting up your sessions. If you are not used to the JavaOne ritual, it is always a good idea to sign-up for sessions well in advance so you don’t get bumped out of the more popular ones. This also helps them fix the room allocation so popular talks get the right size room.

I put together my own schedule of all the JavaFX-related content I plan to attend, and published it on Google Calendar. It is also a pretty good guide to some of the top JavaFX content that is being featured at JavaOne this year. — Apologies to my fellow speakers with conflicting session slots. I wish I could be in multiple places at once, but even rich client technology is not that advanced — yet.

Note: Click for details — sessions I am actually giving are highlighted in green.

Also, for those of you brave enough to attempt to use the schedule builder, it is no simple feat. The UI is fairly convoluted, so getting your schedule tweaked to be just right takes a lot of time and experimentation. Fortunately, I did a lot of this work for you and have figured out the happy path through the system.

JavaOne Schedule Builder Happy Path:

  1. Login to the system and go to the JavaOne Content Catalog
  2. Setup your filters to get the sessions you want (if you are reading this, you probably want to search on “javafx”)
  3. Click on the stars to pick the sessions you are interested in — this adds them to the “My interests” list
  4. Finally, click on “Schedule My Interests” and follow the little wizard UI

Just about any other path through the system (scheduling by time, resolving conflicts as you add sessions, etc.) is fraught with peril, so be warned. :)

Enjoy, and I hope to see you at JavaOne!

 
Comments
1 Comment »
Categories
Events, JavaFX, JFXtras, Presentation, Visage
Tags
JavaFX, javaone, JFXtras, Visage
Comments rss Comments rss
Trackback Trackback

OSCON Java Makes a Difference

steveonjava | August 1, 2011

What was the last conference you went to where you felt like you actually had a positive impact on the larger technical community? A lot of conferences feel like corporate marketing where companies (usually the ones that pay the big sponsorship $$$) are pushing you to buy services or product. Other conferences feel like brainwashing where the message is constrained by a “Ministry of Truth” that limits the topics and speakers to those that align to their world view. No matter how many big parties and aging rock stars they truck in to woo the masses, you leave the conference feeling like you have been sold a technical lemon.

If you were fortunate enough to be at OSCON Java this past week, you were able to experience a different type of conference first hand.  Here are some of the ways in which OSCON Java was not just another technical conference…

Hacking for a Purpose

What was the last time you got to sit down side-by-side with a conference speaker and technical guru such as Joe Darcy, Stuart Marks, Bob Lee, and Jeff Genender, and hack out some code?  We setup and experimental hacking session where we did exactly this, pairing up attendees 1-to-1 with expert hackers to convert an open source codebase to use Java 7 features.  For this project we chose Google Guice (no surprise) and by the end of the session had converted several source files to use new Java 7 features such as strings in switch, the diamond operator, and try with resources.

In addition, we also had a follow-on event after the very successful OSCON JVM Languages Symposium to work through a technical solution for JVM language interoperability. Normally this is something that could take months of technical debate to come up with a few possible solutions, but with the collective brainpower of several compiler authors and some technical herding by Ben Evans, they came up with a solution after only several hours.

No Corporate Shills

At OSCON Java you got to see leaders from across the industry standing side by side up on stage, and being transparent about how their corporate strategies affect technology and open-source. Steve Harris, SVP at Oracle, was bluntly honest about his corporation’s failings in communicating to the Java community and made the point with some funny, self-deprecating slides, such as the “Oracle Threat Level” diagram:

However, he ended his speech on a high note with enthusiastic support for the Java community and Java User Groups in particular:

“Java User Groups Rock!”

And Some Geeky Fun

A good technical conference would not be complete without good, geeky fun. For this, we converted one of the exhibition halls into a giant carnival, complete with clowns, games to test your strength, obstacle courses, and of course plenty of carnival food. It was quite a stark difference from being in a tech conference surrounded by screens and computer, and was a great break from typical networking events.

My money in the above race is definitely on Fabiane Nardon (center), Brazilian Java User Group Leader. Once she sets her mind on something, she is extremely determined! :)


As you can see, OSCON Java is not your average technical conference. I owe the O’Reilly folks a huge debt of gratitude for being supportive of doing a different style of conference. They have a great culture of innovation and are far enough away from the corporate politics of Java that they can bring everyone to the table or the mutual benefit of the community.

While you may have missed out on one of the greatest Java events since the collapse of Sun, you can still catch some of the best parts on the OSCON video site:

http://www.youtube.com/user/OreillyMedia#grid/user/93FC98105B19725C

Also, all the speaker slides are now available for the presentations:

http://www.oscon.com/oscon2011/public/schedule/proceedings

See you at OSCON Java next year!!!

 
Comments
No Comments »
Categories
JavaFX, OSCON Java
Tags
carnival, java 7, jvm languages, oscon, OSCON Java
Comments rss Comments rss
Trackback Trackback

Improving Java 1 Bytecode at a Time

steveonjava | July 25, 2011

This past weekend we held the very first OSCON JVM Languages Symposium.

This was truly a meeting of minds with a huge brain trust of language authors, JVM hackers, and professional developers tackling some of the biggest issues for the Java community at large.

I think we had a pretty good recipe for success that went something like this:

  • We ate some yummy Voodoo Donuts
    • (while discussing the impact of Java 7++ on JVM languages)
  • Washed down our donut remains with some of Portland’s finest Stumptown coffee
    • (while discussing JVM language interoperability)
  • Had some tasty pizza and drinks on a private patio
    • (while pontificating on JVM community dynamics)
  • And then back for some more Voodoo Donuts…

As you can see, we took our work (and play) very seriously.

Thanks to our sponsors, Typesafe and OSCON, this event was entirely free to the participants.

The full proceedings of our event can be found below… given the success, I am looking forward to making this a long standing OSCON Java tradition!

OSCON JVM Language Proceedings

 
Comments
No Comments »
Categories
Events, JavaFX, OSCON Java
Tags
jvm languages, oscon, stumptown coffee, voodoo donuts
Comments rss Comments rss
Trackback Trackback

The Frugal Geek’s Guide to Conference Crashing

steveonjava | July 24, 2011

Conferences are expensive…  they assume you work for a stacked megacorporation that believes the fastest path to increasing their shareholder value is investing in your individual career training.  If your employer is not having a great year or has had a surge of resignations from last year’s crew of esteemed conference goers, chances are that you won’t be getting reimbursed to attend your local geek-fest.

Fortunately for you, I happen to know the inside secrets to enjoying all the conference perks at OSCON without handing over a single Benjamin.

Secret 1:  Conference pre-events are free and easily crashable!

Today I dropped in completely unexpectedly on the Community Leadership Summit today, and even after boldly announcing myself as a party crasher was awarded with a super-secret badge (a.k.a. index card w/sharpie etchings).  This gave full access to their sessions and let me attend the after-party for free drinks!

Tomorrow I am planning on crashing the free OSCON JVM Languages Symposium…  I hear they have some of Portland’s scariest pastries being brought in and might even be doing a free lunch outing thanks to their sponsor, Typesafe.

It helps that both of these events have an unbelievably high Rockstar to attendee ratio…  more on why this matters a little later.

Secret 2:  The best type of conference pass is the free type

There are 9! different OSCON passes available for you to choose from on the registration site.  While this is a bewildering array of options, but if you pay attention to the price it is quite an easy decision.  Click the “Register Now” button below and you are good to go:

Register
Register now for a FREE Expo Hall Pass (use code EXPOPASS)

So what are you missing out on with an Expo Pass?  Well…  you can’t sit with the rest of the attendees and listen to a canned lecture, but you can hang out with your new Rockstar friends in the hallways.  Which takes us to Secret 3…

Secret 3:  Conference value = # of Rockstars / # of Attendess

This makes sense if you think about it…  if you were the only attendee, surrounded by a cluster of speakers and geniuses waiting to impart their knowledge on you, it would be infinitely valuable.  Most conferences you are one speck of sand in a huge pool of attendees vying for a little bit of wisdom to be imparted on your section of the audience.  The smaller the audience, the more chance you might actually get something of value out of the experience.

So what does this mean for the value you get from difference conference events?

  • Keynote = 1 speaker to 1000 attendees:  Avoid this at all costs…  you can always get the highlights off twitter, so who cares.  [as you can see, my days as a conference chair are clearly numbered.  :) ]
  • Technical Session = 1 speaker to 100 attendees:  This is slightly better, but still the odds are clearly against you!  [yes, and now my days as a speaker are coming to an end as well...  see if anyone invites me to give a technical talk again]
  • Birds of a Feather Sessions = 1 speaker to 30 attendees:  A slightly better ratio, more focused, and absolutely free!
  • Ignite = 30 speakers to 300 attendees:  Ignite talks are for the speaker grazer in all of us…  yeah, talk your heart out…  for 5 minutes.  If you haven’t impressed us in that amount of time, at 40 minute session will not change our opinion.  It also helps that this event is absolutely free!
  • Unconference = 20 speakers to 100 attendees:  Now we are talking.  With this many technical gurus walking around you are virtually bound to learn something…  without even without trying!  This includes the JVM Languages Symposium and Community Leadership Summit, both of which are free!
  • OSCON Hallways = 1 speaker to 1 attendee:  When you bump into Martin Odersky in the hallways after having had some good times over beer and pizza at the JVM Languages Symposium you are at a ratio where the real value comes in!  (and didn’t pay a dime to start the conversation)

If you were paying attention, you probably noticed an interesting relationship…  the most valuable parts of the conference were the parts that cost absolutely nothing to get into.  (don’t let your megacorp friends know about this, or all the wonderful corporate sponsorships that pay for all these extras might dry up!)

Secret 4:  Free stuff is the open source way

Open source is all about giving software out for free, right?  Well, maybe there is more to it than that, but there is still plenty of free conference stuff flying around that you can take advantage of with over 60 exhibitors waiting to hand you prizes just for the privilege of scanning your free badge!

Secret 5:  And parties galore!

While all those folks who paid for the high priced admission tickets may think they are special, the reality is that from a sponsor’s point of view, their eyeball is worth exactly the same as yours.  This means that you have an equal opportunity to take advantage of the most important part of any conference experience…  the parties!

Here are some of the free events that you won’t want to miss out on:

  • Opening Reception – Grab a drink and mingling with exhibitors and fellow attendees
  • OSCON Carnival – Join us for food, drinks, entertainment, and lots of good old fashioned fun
  • Puppet Labs Party at their headquarters in Portland’s Pearl District.
  • OpenStack Party – Join OpenStack for cocktails and hors d’oeuvres at the Spirit of 77
  • Surprise Attendee Event on Wednesday evening (sorry, we can’t tell you anything else about this event because it’s a secret)
  • Booth Crawl where you can quench your thirst with vendor-hosted libations and snacks while you check out all the cool stuff in the expo hall.
  • Media Temple Party at the Jupiter Hotel with open bar, music, and all you can eat tacos!

Final Secret:  Everyone can be a Rockstar

What makes the difference between a Rockstar speaker and an attendee?  Just the drive to do something with technology and be proud of it.  You can be an open-source contributor, user group leader, and technical speaker if you simply apply the skills you already have to the benefit of the community.  Don’t expect to get paid much, but at least it is a really easy way to get invited to conferences around the world.

—-

While this article is all meant in good humor, on a serious note I want to thank the O’Reilly folks for putting on OSCON, offering discounted expo tickets, and compiling this great list of free events.

 
Comments
1 Comment »
Categories
Events, Flash, JavaFX, OSCON Java
Tags
conferences, crashing, free, oscon
Comments rss Comments rss
Trackback Trackback

Turbocharging Performance with Caching

steveonjava | July 21, 2011

This is the third installation of my Flex Mobile series.  In my first post I talked about multitouch, and my second post I dug in on how to control the soft keyboard.  This post goes into detail on performance, specifically caching.

Flash applications tend to use a lot more vector graphics than other UI platforms. This is a great thing for designers who can directly use all their path art and graphics.  However, on mobile devices it increases the challenge to build high performing applications.

Fortunately, there is a feature of the Flash platform called cacheAsBitmap (and its newer sibling, cacheAsBitmapMatrix) that lets you speed up rendering performance at the expense of memory.

Cache as Bitmap

CacheAsBitmap is a boolean property of DisplayObject, and by extension all the visual elements you use in Flash and Flex includings Sprites and UIComponents, have access to this variable. When set to true, each time the DisplayObject or one of its children changes it will take a snapshot of the current state and save it to an offscreen buffer. Then for future rendering operations it will redraw off the saved offscreen buffer, which can be orders of magnitude faster for a complicated portion of the scene.

To enable cacheAsBitmap on a DisplayObject you would do the following:

cacheAsBitmap = true;

Flex UIComponents have a cache policy that will automatically enable cacheAsBitmap based on a heuristic. You can override this behavior and force cacheAsBitmap to be enabled by doing the following:

cachePolicy = UIComponentCachePolicy.ON;

While cacheAsBitmap is a very powerful tool for optimizing the redraw of your application, it is a double-edged sword if not used properly. A full size screen buffer is kept and refreshed for each DisplayObject with cacheAsBitmap set to true, which can consume a lot of device memory or exhaust the limited GPU memory if you are running in graphics accelerated mode.

Also, if you have an object that updates frequently or has a transform applied, then cacheAsBitmap will simply slow down your application with unnecessary buffering operations.

Cache as Bitmap Matrix

CacheAsBitmapMatrix is also a property on DisplayObject, and works together with cacheAsBitmap. For cacheAsBitmapMatrix to have any effect cacheAsBitmap must also be turned on.

CacheAsBitmap does not work when a transformation, such as a rotation or a skew, is applied to the object. The reason for this is that applying such a transformation to a saved bitmap produces scaling artifacts that would degrade the appearance of the final image. Therefore, if you would like to have caching applied to objects with a transform applied, Flash requires that you also specify a transformation matrix for the bitmap that is stored in the cacheAsBitmapMatrix property.

For most purposes, setting cacheAsBitmapMatrix to the identify matrix will do what you expect. The offscreen bitmap will be saved in the untransformed position and any subsequent transforms on the DisplayObject will be applied to that bitmap. The following code shows how to set cacheAsBitmapMatrix to the identify transform:

cacheAsBitmap = true;
cacheAsBitmapMatrix = new Matrix();

Tip: If you plan on setting cacheAsBitmapMatrix on multiple objects, you can reuse the same matrix to get rid of the cost of the matrix creation.

The downside to this is that the final image may show some slight aliasing, especially if the image is enlarged or straight lines are rotated. To account for this, you can specify a transform matrix that scales the image up prior to buffering it. Similarly, if you know that the final graphic will always be rendered at a reduced size you can specify a transform matrix that scales down the buffered image to save on memory usage.

If you are using cacheAsBitmapMatrix to scale the image size down you need to be careful that you never show the DisplayObject at the original size. The following figure shows an example of what happens if you set a cache matrix that reduces and rotates the image first, and then try to render the object at its original size:

Notice that the final image has quite a bit of aliasing from being scaled up. Even though you are displaying it with a one-to-one transform from the original, Flash will upscale the cached version resulting in a low fidelity image.

The optimal use of cacheAsBitmapMatrix is to set it slightly larger than the expected transform so you have enough pixel information to produce high quality transformed images.

Flash Mobile Bench

The Flash Mobile Bench is a simple application that lets you test the affect of different settings on the performance of your deployed mobile application.

The functionality that it lets you test includes the following:

  • Addition of a large number of shapes to the display list
  • Animation speed of a simple x/y translation
  • Animation speed of a simple clockwise rotation
  • Impact of cacheAsBitmap on performance
  • Impact of cacheAsBitmapMatrix on performance
  • Impact of the automatic Flex cache heuristic on performance

The code that updates the cache behavior of the shape group is shown below:

private var identityMatrix:Matrix = new Matrix();

private function cacheOff():void {
  shapeGroup.cachePolicy = UIComponentCachePolicy.OFF;
}

private function cacheAuto():void {
  shapeGroup.cachePolicy = UIComponentCachePolicy.AUTO;
}

private function cacheAsBitmapX():void {
  shapeGroup.cachePolicy = UIComponentCachePolicy.ON;
  shapeGroup.cacheAsBitmapMatrix = null;
}

private function cacheAsBitmapMatrixX():void {
  shapeGroup.cachePolicy = UIComponentCachePolicy.ON;
  shapeGroup.cacheAsBitmapMatrix = identityMatrix;
}

Even though we have only one instance of an object to apply the cacheAsBitmapMatrix on, we follow the best practice of reusing a common identity matrix to avoid extra memory and garbage collection overhead.

Upon running the Flash Mobile Bench, you will immediately see the FPS counter max out on your given device. Click on the buttons to add some shapes to the scene, set the cache to your desired setting, and see how your device performs. The following figure shows the Flash Mobile Bench application running on a Motorola Droid 2 with 300 circles rendered using cacheAsBitmapMatrix:

How does the performance of your device compare?

 
Comments
5 Comments »
Categories
AIR, Flash, Flex, Mobile
Tags
Android, caching, Flex, Mobile, performance
Comments rss Comments rss
Trackback Trackback

« Previous Entries

  • Travel Map - Let's Meetup

Publications

   

Upcoming Talks

QCon NY

Steve On…

  • Everything
  • Agile
  • Flash
  • JavaFX

Archives

Affiliations

Awards

2009 JavaOne Rock Star!

Disclaimer

Views and opinions expressed here are all my fault... complain to me, not my employer. :)
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox