"...different isn't always better, but better is always different" Trev's Blog

Thursday May 01, 2008

I've posted before about the Flight Planner application that my team has been developing the past few months.  I thought I'd share a few screen shots.  We gave Silverlight a try, and this is what we got.  It actually doesn't look too bad.  The first shot is of our custom airport locator dialogue, which lets you run custom queries for specific airports.  The second shot is of the results screen, showing a (simplified) flight plan.  It indicates distances, times, waypoints, and most importantly, current weather at each of the airports.  Still a work in progress, but take a look and see what you think.

 

 

Sunday Apr 13, 2008

It's been a year already since Sun first announced JavaFX, the new rich interface scripting language that would be built into the Java runtime.  Now, finally, we are on the brink of a first release; the latest speculation is that a stable developer preview will be out in May and then v1.0 shortly thereafter.  It's good timing, considering Silverlight and Flex are trying to compete in this ripe market as well.  But I'd argue that Sun is wise to take its time and do it right. 

Remember my previous post about building a flight planner application with GWT?  Well, unfortunately back in the design phase we changed our minds and decided to go with Silverlight.  What a painful mistake!  We should have known that in Microsoft's hasty attempt to ride the coattails of Flash, time to market would win over completeness of implementation.  Even in what they call the 2.0 release, basic functionality is missing... how the heck is there no combobox control in an RIA framework???

Anyway, Flex is promising, but not yet up to par in terms of speed.  One of the JavaFX architects comments on this in his blog, about how it's complicated to benchmark performance between rich web user interfaces.  He notes that they use this site called Bubblemark, which contains implementations of a simple animation program in several different technologies, including basic DHTML, Silverlight (Javascript and CLR versions), Flex, Java (Swing and JavaFX versions), as well as others.  The findings are amazing: both the JavaFX and Swing versions run 3 to 4 times faster (in fps) than Flex.  He also points out that the graphics layer in JavaFX is built on what is still an un-optimized library. "...we are focusing on bug fixes and correctness right now, not optimization, so it's not as fast as it could be."  Awesome.  They haven't even tried to optimize yet, and still it's faster.  We'll see who wins this battle in the end.

Wednesday Mar 05, 2008

For our User Interface Design class we've been working on a flight planner application to allow recreational pilots and aviators to quickly and easily create a flight plan.  The web technology of choice? Right now it's the Google Web Toolkit.  The rich web interface tools GWT has available are powerful and easy to use.  After all, it's just programming in Java... with some added CSS of course.  We've discovered an extensive add-on library to GWT called GWT-EXT.  This toolkit has the power to turn your browser into a truly rich, desktop-like environment.  There is a full demo showcase, with sample source code and all.   

Window managers, dynamic history support, custom tabbed panels, layout managers... this is really sweet stuff.  Our project is still in the prototyping stages, but within a few weeks a concrete interface should be available for your viewing pleasure.

 

 

 

A couple months ago I wrote a little tool that converts an Excel file to HTML and then uploads it to a remote host via FTPS (that's right, FTP over SSL).  There are a few good Java libraries out there for FTP, but I spent hours and hours finding one that supported TSL/SSL and was free.  And worked.  There are several out there that claim to have this ability, but I've tried most of them, and most of them don't work right out of the box, or at all. 

Finally, I found a library called ftp4che.  It's free, well-documented, and just works.  I'll give you a glimpse of my uploadFile() method:

 private boolean uploadFile() {
        txtStatus.append("Setting connection properties..." + newLine);

        String host = properties.getProperty("host");
        String port = properties.getProperty("port");
        String user = txtUserName.getText();
        String pass = new String(txtPassword.getPassword());
        String path = properties.getProperty("path");

        Properties pt = new Properties();
        pt.setProperty("connection.host", host);
        pt.setProperty("connection.port", port);
        pt.setProperty("user.login", user);
        pt.setProperty("user.password", pass);
        pt.setProperty("connection.type", "AUTH_SSL_FTP_CONNECTION");
        pt.setProperty("connection.timeout", "10000");
        pt.setProperty("connection.passive", "true");
        FTPConnection connection = null;
        try {

            FTPFile fromFile = new FTPFile(htmlFile);
            FTPFile toFile = new FTPFile(path, htmlFile.getName());

            txtStatus.append("Connecting to " + host + " on port " + port + "..." + newLine);

            connection = FTPConnectionFactory.getInstance(pt);

            connection.connect();
            connection.noOperation();
            txtStatus.append("Connected..." + newLine);

            try {
                txtStatus.append("Deleting old file..." + newLine);
                connection.deleteFile(toFile);
            } catch (FtpWorkflowException ex) {
                connection.noOperation();
            }

            txtStatus.append("Uploading new file..." + newLine);
            connection.uploadFile(fromFile, toFile);
            connection.disconnect();

            return true;

        } catch (Exception ex) {
            ex.printStackTrace();
            if (connection != null) {
                connection.disconnect();
            }
            txtStatus.append(ex.getMessage() + newLine);
            txtStatus.append("Cannot continue..." + newLine);
            return false;
        }
}


 
Pretty straightforward, as you can see.  You just set up a Properties object with a set of key/value pairs defining the parameters for your connection, including the authentication type, and then just use an FTPConnectionFactory to create a connection.  After that, I try deleting the remote file if it already exists, and then upload the new one, with appropriate exception handling of course.  Simply and easy, the way it should be.

 

Tuesday Mar 04, 2008

Another interesting article about how web developers have "never had it so good", thanks to Sun and MySQL joining forces.  Check it out.

 

..."Sun Microsystems has hired high-profile Python programmers Ted Leung and Frank Wierzbicki, stepping up its bet on open source and scripting languages."  Full story here.

Another strategic move from Sun, right on the heels of the exciting MySQL acquisition; they have really taken this open source movement to the next level.  Netbeans is already "the only IDE you need", but soon there will be support for Python, among other dynamic languages.  And this support will no doubt make its way into the JVM as well.  Someday it will be the only VM you need.
 

Thursday Feb 28, 2008

If you haven't already, you need to check out GotAPI.comIt's a one-stop API source for all of the common web technologies, toolkits, programming languages, and frameworks.  This is a huge time saver, no matter what you develop.  If you work on any kind of integrated systems that use multiple API's or even databases, this is a dream come true.  You load up several different API's in a tab-panel, and then within each one you can custom search for functions and constructs.  It actually crawls the official API's and loads them into its interface.  Check it out.


We got word today that the Texas Advanced Computing Center has officially unveiled "Ranger", the world's largest general-purpose supercomputer.

"Ranger is funded by the U.S. Government's National Science Foundation (NSF) as part of a multi-track effort to improve the computing capability available to scientists. Developed by Sun in conjunction with TACC, it is the most powerful computing cluster used for open science research in the world -- capable of an astonishing 504 trillion floating point operations per second."  Sweeeet.

As I was reading about this, one thing that I noticed is that Ranger is based on the Lustre File System.  All I really have to say is, who comes up with this stuff?  Well okay, Lustre came up with it, but really...  a node/object-based cluster system with capacity for billions of files with such astonishing reliability... HPC has come so far.  The scalability potential here is crazy; I just need a personal server so I can play with stuff like this.

Note that there are already 500+ projects at work on Ranger already, and more are being added all the time.  It's "optimized for science", so scientists: have at it.

Saturday Feb 09, 2008

Back in January I did a demo on JavaFX, Sun's declarative scripting language for creating rich media and content for user interfaces.  I want to take a few minutes and tell you what I like and what I don't like from what I've seen so far.  First of all, integration with existing Java libraries and the Java language itself is seamless.  Everything works just like a normal Java object, and you can make any API call you need to just as you would in a standard Java project.  In fact, you can have all your business logic be normal Java classes and just write you UI in JavaFX.  Awesome!  Secondly, static typing.  I think it's cool to have a script-like language with static typing, because it better enforces the principles of design by contract.  And again, this obviously resembles the Java language itself.  Thirdly, the language constructs are designed to make building a UI much faster and easier.  For example, anything you put inside a Do loop automatically gets executed in a background worker thread.  You mean I don't have to create a custom override of SwingWorker? Yep, that's right.  There are dozens of these nifty little language constructs and conventions that make life easier as a developer.  Take the declarative syntax, much like the XAML model for the Windows Presentation Foundation:  Instead of defining user interface properties and binding back-end data objects to components via a sequence of method calls, JavaFX script allows the programmer to declare the existence of a user interface component (and any subcomponents) via an easy syntax and then declare that component's value be bound to some back-end object property just using the keyword bindFrom that point on, the UI component property and the back-end object property are fully two-way bound; when one changes, the other changes right along with it.

Ok, so what do I not like?  Well, since in the declarative world program execution is not sequential, debugging support is more or less out of the question.  This means we're left with trial-and-error to find out if our code works (or looks, I should say) as intended.   However, your UI itself should not have a lot of complex code to it, so this is not a big deal.  Another thing you will see is that a lot of the example and demo programs are partial recreations of flash websites, and the look really good, but they have to be run on the desktop.  As of now, there's no way to compile this cool stuff into something the browser will understand.  The best alternative at this point is to compile your FX app into a Java Web Start application.  Unfortunately, we're still limited to HTML, javascript, and css to make things run in the browser.  My understanding, though, is that JavaFX will become like applets.  You'll write your UI in JavaFX, and embed it into HTML, much like the way flash applications work.  It will run in the browser but hook into the consumer JRE for its true power.  The proliferation of the standard JRE is quite impressive, and although this is all just speculation, I bet we'll see more examples like this in the near future. 

 

Wednesday Dec 12, 2007

As a campus evangelist, one of the most common complaints I hear about Netbeans is that it hogs memory.  While it is true that the IDE does have a moderate memory requirement, I think there are several underlying issues that affect this misconception.    Unfortunately, most students do their development on a laptop, usually with a gig or less of physical RAM.  This in itself is not a problem, unless you have too many other processes running.  From java-tips.org:

"If your Java process requires more memory than underlying OS can provide it can cause swapping of pages from/to disk. This results in significantly degraded performance.  It is sometimes useful to increase amount of memory available to the application to allow it manage memory more effectively and this can reduce the time spent during garbage collection cycles." 

Netbeans does not "hog" memory; it uses what it needs, and sometimes the OS isn't able to provide that.  I run Netbeans 6.0 on a Vista laptop with an Intel 2.0 GHz chip and 1GB RAM.  Fairly good specs, although these days one gig of RAM isn't that much.  I do notice increased memory consumption when running Netbeans, but only experience performance issues when building web apps and running Glassfish, usually.  Why?  Well let's start at the bottom.  Windows Vista and the Aero desktop consumes a large amount of memory in and of itself.  Now run the most comprehensive IDE in the world AND an application server AND the JavaDB database server, all on a laptop.  It shouldn't surprise you if things get a bit sluggish.    

Another issue: I/O operations.  From java-tips.org:

"During some tasks the IDE is performing many I/O operations. With a slow device this can cause slowdown of the whole application. Typical examples are resources accessed on network drives or plugable drives like USB disk, storages using compression or encryption and anti-virus applications guarding all accesses to files.  Notebooks running on batteries have slower I/O too."

It's also important to realize that Java's memory footprint is lower than you might think.  It's not as simple as adding up the numbers for all the javaw.exe processes in Task Manager.  You have to account for shared bytes; a lot of memory is shared between multiple processes, but the "Mem Usage" field adds that shared space to every process that uses it.  More on this here.

Sunday Nov 04, 2007

Wow, I close my eyes for just a second and two months go by. Here at UNL we're already starting to think about final exams and classes for next semester. Some of the progress made by both Sun and the Campus Ambassadors this semester has been astonishing. First of all, I'd like to point out that the UNL Open Source User Group has been steadily growing and is excited about all the new features and enhancements in Netbeans 6.0. I've been doing a lot of word-of-mouth evangelism with peers and professors lately, and all have been very impressed. Personally, I think that the Ruby support in Netbeans is phenomenal; just another example of how this IDE is so powerful and yet so flexible. It's amazing how many different technologies the Netbeans IDE actually supports. And they're constantly adding more (a PHP plugin is on its way!).

It's also not a bad time to mention that Project Indiana is already turning heads. We're still a few months from the final release, but a developer preview is out and is said to be worlds better than previous versions of OpenSolaris. Traditionally as a non-Linux/Unix user, I'm excited that Sun is making the Solaris operating system easier to use and more developer-friendly. I'll keep you posted when I get it installed.

Thursday Sep 13, 2007

Today I realized that my iPod is old... and so are the 5000+ songs on it. By the way, I'm glad I didn't overpay by $200 on an iPhone only to get $100 back from Apple while the wiser point and laugh. Anyways I've often found the need for portable music, and more and more I'm thinking that sites like ProjectPlayist and Deezer are the way to go. You wouldn't think that music streaming sites are in the same market as MP3 players, but for the past year I've turned to the internet over the iPod almost every time. Obviously this isn't yet practical when you're out for a jog or at the gym, but the more accessible the internet becomes, the closer we're getting to that reality. Look at phones... they almost all have the ability to get music and video, right when you want it. But back to the point: entertainment has leaped into the on-demand age, and we're redefining "portable". Of course, your stereo setup now needs to include a computer, but hey, isn't that becoming the standard now anyway? Now I can log in from any computer anywhere and have all my playlists instantly at my fingertips, ready to go. It's the same with TV shows and movies. The pace of technology is almost sickening, and it reminds me of all the stuff I have that I don't use. But hey, as long as technology can satisfy my "I want it now" mindset, I'll be happy.