Gillius's Programming

All Posts

JFXUtils 0.2: Panning and NumberAxis Replacement: StableTicksAxis

I released version 0.2 of the JFXUtils project I started recently, and now there is code for chart panning, and zooms are now animated. With panning and zooming working, I noticed that the default NumberAxis was not working at all how I would like. The tick positions remain in the same place no matter what the graph's bounds, and the values of the ticks then change to reflect the value. Well, with zooming and panning you will get for example a lower bound of "1432.34234", and this is exactly what NumberAxis will display. So, I created a replacement axis type called StableTicksAxis that keeps the ticks at the same data location for the given zoom level, which has a drastically better UI feel when the graph is changing rapidly during panning and zooming operations. It automatically computes the number and distance between tick marks based on the size of the graph, the graph label font, and the range of data displayed to maximize the number of tick marks without having the labels run into each other. When auto-ranging, it can force zero in the view like NumberAxis, and also like NumberAxis it can add some padding around the data, but unlike NumberAxis the amount of padding (as a percentage of graph size) is configurable.

Continue Reading >

JFXUtils 0.1 Released

I wrapped up some of the JavaFX code I've been working with into a library org.gillius:jfxutils, which is hosted at github (project page). The artifact is also published in my Maven repository. It offers the following now:

  1. Ability to add zooming capabilities to a JavaFX XYChart in both plot area and axes.
  2. The scaling-on-resize effect described in my previous post.
  3. An experimental way to replace a Node in the scene graph with a different one (it's not as easy as you think)
  4. A way to get X and Y offsets of a Node from an arbitrary ancestor in a way that handles translation/padding/layout, etc., but does not yet handle scale and rotations (this might be possible if transforms can be combined as rumored for JavaFX 8)

I plan on adding panning compatibility in a future release.

JavaFX Window Scaling like a PowerPoint Slide on Resize

With JavaFX billed as the preferred new front-end system for Java, and Java 7 becoming prevalent and bundling JavaFX as of 7u6, I've started to take a very hard look at this technology, especially compared to Swing. And from everything I've seen so far, I'm very impressed.

The first application I've had the chance to use JavaFX with is a presentation application on a custom piece of kiosk hardware that has 4 separate screens on it. For my skillset, the choices were either HTML5 or Java. I wasn't keen on trying to figure out how to get 4 separate monitors to work with Chrome browsers or something similar, and I know Java better, so I went the route of JavaFX.

For this application, I wanted to create screens that worked basically like PowerPoint slides. The resolution on the kiosk screens is high and the user is far away, so the "normal size" of the GUI interface would not be sufficient. I wanted something where as I expand the window the content gets larger (like in PowerPoint) rather than stay the same size and reflow, like in a standard GUI application. Fortunately, the transform capabilities in JavaFX make this very easy.

Continue Reading >

Adapting Smartclient DataSource to RequestFactory

SmartGWT controls are beautiful.  Unfortunately, using them is an all-in proposition - you miss out on most of the benefits (and make a lot of extra work for yourself) if you don't use the entire stack from GUI to backend.  I had some good reasons for not using their backend, namely that my GWT application already used Jersey and GWT RequestFactory, and I didn't want to add yet a third servlet to feed data in a form of SmartGWT's liking.  This post shows a simple way to create your own SmartGWT compatible DataSource to back their sexy controls and widgets but mapped to your existing backend.

Continue Reading >

Java and C++

While my strongest programming language now is Java, there was a time long ago where my strongest language and my preferred language was C++. In my educational career and early personal projects, I did a lot of work in C++, but in my professional career I've done mostly Java. Recently I had an opportunity to build a non-trivial program in C++, something I haven't had a chance to do in some years (since GNE). I was surprised at how fast my knowledge came back, it seems that learning a programming language is like learning to ride a bike -- you never quite forget. But through this project, I came to revisit a lot of my opinions. The main one is that over time I ended up underestimating the power of C++ and overestimating the difficulty of building C++ programs compared to managed languages like C#/Java.

While I still feel development is much faster and easier in managed languages, I noticed right away two features I really missed.

Continue Reading >

WinSCP Jump Lists

When I updated my WinSCP beta recently, I noticed that the jump list stopped updating. I'm not quite sure why it stopped, but clearing out the value "JumpList" from the key HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Configuration cleared the jump list, then recent sessions would be added to the jump list. I was unable to find this issue via Google search, so hopefully this blog post makes its way to some other searchers having the same problem.

Continue Reading >

Samsung Captivate and Cyanogenmod

After my last post about Android, I want to highlight some of the best things about the modding community. Thanks to the Google Android Open Source Project, projects like Cyanogenmod provide for an alternative operating system image for many Android devices. In the case of the AT&T Captivate, the latest official OS is Android 2.3 Gingerbread. A "stable" CM7 exists that is also based on Android 2.3; however, a more recent build exists, CM version 9, based on the latest Android 4 (Ice Cream Sandwich, or ICS). When I upgraded from stock Samsung OS to CM7, the functionality of my device was far better than the original OS. Upgrading CM7 to CM9 was even a bigger upgrade, like night and day, and despite being labeled an "experimental" build, it's been far more stable than CM7. With the Samsung OS I would lose wifi and cell all the time, on CM7 I did not but the phone would lock up and I had to reboot it. Since CM9 I have had no problems at all.

Continue Reading >

Open Platforms Require Respect

Open platforms require respect. Open platforms provide freedom and with freedom comes the responsibility to not abuse that power. When that power is abused, respect is lost and then instead of a innovative collaboration between OEM and community, it becomes more like a battle, as with iOS. Do we really want to encourage OEMs to take Android down the path of locked down OS builds, underground modding, paying for the privilege just to make an app subject to arbitrary rules and delays from a app store resulting from a forced monopoly?

I believe that a few recent posts by xda-developers and Engadget crossed that line of respect. Recently, a leaked firmware for the new Samsung Galaxy S3 became available online. Shortly after, an XDA user ripped all of the proprietary apps off the image, including S-Voice, a direct competetor to Apple's Siri, and posted them in a thread called S-Voice and ALL I9300 goodies (Get whatever you want). This was then highlighted as front page news "Samsung S Voice Ripped for the World to Enjoy", and covered on Engadget. Samsung then blocks clients not on S3 with a simple check of the phone's model name, something trivial to workaround technically but a clear sign (in my opinion) that Samsung did not want this happening. Shortly afterwards, a cracked copy surfaces that sends S3's model code regardless where it is installed, "fixing" the issue. XDA praises this achievement again on the front page as S Voice Back Again, the XDA Way. People rip apps/ROMs/proprietary functionality all the time, but some aspects of this particularly bothered me:

Continue Reading >

JSONP Requests with RestyGWT Marshaling

I have been experimenting with GWT using a RESTful (jersey server) backend as its data source.  When deploying both my application and the backend to the same server this worked great, but once the server side was finished I wanted to deploy it to Tomcat on my Amazon EC2 instance, and continue debugging the application using GWT's Developer mode.  This, unfortunately, does not work, due to Same Origin Policy restrictions of virtually all browsers.

The most standard way of circumventing the Same Origin Policy is to use Json with Padding, or JSONP.  The technique in a nutshell is that the server returns a JavaScript function call.  The client thas prepared for this by creating this function in the DOM of the current page in the browser.  The client tells the server "The name of the function is xyzzy" by sending in a query parameter, usually named "callback." This post shows some ways around this issue.

Continue Reading >

Major GNE Bug in Endian Handling

A major bug in GNE put HawkNL properly in little endian mode when using NO_NET network type, but any other type such as NL_IP called nlInit after nlEnable(NL_LITTLE_ENDIAN_DATA), which erased this setting. Amazingly, over all these years this error was not caught. I very seriously thought about changing all documentation and having GNE use big endian all the time, but decided to fix the bug and use little endian consistently.

Thanks goes out to Héber Costa Ferreira for finding this problem in GNE/HawkNL and providing suggestions, code, and testing effort to fix this issue.

This change has been commited into GNE SVN as of revision 680. If you are not using the SVN version of GNE, you should, it is much more stable than 0.70 and contains many critical fixes.

Continue Reading >