Sunday, September 26, 2010

linkFlow Wins Design Award

Yesterday I received notice that FamousWhy has just granted linkFlow an award for software design.  The award recognizes the usability, creativity, professional appearance and structure of the software. More info at their site. They also will be another linkFlow hosting site besides the SourceForge site.  In addition, they will be preparing a tutorial and a demo of the software, and hosting that on the site as well.


It is great for the software being recognized for the very things I was trying for in developing linkFlow. Namely, a great user experience and excellent portability.  I hope this award encourages more people to download and try out my software. In addition, I hope it encourages others to strive toward the same goals, especially for developers in the engineering and scientific software field. We have a long way to go in getting this field of software accessible to more people.

I will be linking to the tutorials and demos from my main bogturtletech.com site when they are posted at FamousWhy.

Monday, September 20, 2010

Installing Eclipse for Android on Ubuntu

In order to develop applications for Android, it is highly recommended by Google and the Android people to use the Eclipse IDE. When installing Eclipse, there are a few pitfalls I found.

First off, don't do as I did and just install Eclipse from the Ubuntu Software Center.  The Eclipse version in the installer is not the right one. You want to install version 3.5 of Eclipse, not 3.6.  If you have 3.6 installed, you need to uninstall it and go to 3.5, since there are reported problems with the Android Development Kit and version 3.6.  Eclipse 3.4 works as well.

Despite what it says on the Android SDK install page, you need to install the Java Development environment into Eclipse before installing the development tools. There is a little bug with Ubuntu 10.04 that prevents you from installing the development tools unless Java has been installed.  You will need the Java environment anyways, so install that first. Be sure you have the latest version of JDK 1.6 correctly installed before installing Eclipse for Java.  You can install Java with the Ubuntu Software Center, which makes this task rather painless. Just search for "Java" in the Software Center and install "OpenJDK Java 6 Runtime" from the list.

To get the best version of Eclipse, go to this site and download using one of the links on the right hand side of the page (Linux 32, do not try this in 64 bit). The downloaded file will be named eclipse-java-galileo-linux-gtk.tar.gz in your download folder. The file doesn't need to be installed, just unzipped into the right place. If you are lazy like I am, the easiest way to do this is graphically.  Go to your Ubuntu menu and open a Terminal from the Accessories menu. Open up Nautilus as a root user in the Terminal by typing sudo nautilus at the prompt in the Terminal window. After you supply your password, Nautilus will pop up, and you can then browse over to your /usr/share folder. Open another instance of Nautilus by clicking on places > home  in the Ubuntu menu.  Browse to the Download folder. Now find the eclipse tar file and drag it over to the /usr/share folder window. Once the file has been moved to the folder, right click on it.  Open the archive, then install all files to the original folders.  You should end up with an Eclipse folder in the /usr/share folder.

Now you need to install the Android SDK. Go to the SDK download page and click on the link for Linux (i386). Note there is no link for 64 bit environments. After the file has downloaded, do the same as before, and unzip the archive in the /usr/share folder.  Now you need to tell Eclipse where to find the SDK.

Again with your Nautilus, go to your /home/username folder and look for the file named .bashrc and right click on it.  Choose to open it with gedit. You need to add a path statement. If you have a regular install of Ubuntu, there won't be a PATH statement in the file.

Just after the first comments (comment lines have a # as the first character) in the bashrc file, add the line:

export PATH=${PATH}:/usr/share/android-sdk-linux_x86/tools

Now save and close the file.

You are almost done, you just need to set up Eclipse and the Android Development Tools (ADT). The installation of the ADT goes smoothly if all the setup work has been done correctly. Go to the installation page and follow the instructions for Eclipse 3.5 (Galileo). After you restart Eclipse, the ADT should be installed.  You can now install the Android platforms, so that Eclipse has a development target, and you can run Android emulations.

You need to browse with Nautilus over to the Android SDK folder we installed earlier. By the way, you need to be connected to the internet in order to install these files. Go to the tools subfolder, and then look for the file called android. Right click on it, and run it.  You should get the tools program with a listing of all available platforms for Android. Just select all of them and install them. You are done!

Have fun programming!

Sunday, September 19, 2010

NetBeans IDE 6.8 review

I wrote the Linkflow software on the standard Sun/Oracle IDE NetBeans 6.8.  Although NetBeans is certainly powerful and can be very flexible, the process was at times frustrating.  By using NetBeans, I was automatically wed to the swing framework for developing the front end of the software. This was not really a bad thing, although making swing work is a detailed and time consuming process.

The IDE is set up to enable the developer to layout the controls on the page and not worry about coding all the placement.  I found this to work OK, but there was no way to layout complex page views without doing some of my own coding anyways.  The code generated by the IDE got gigantic, and there is no way to edit the code on your own without losing the WYSIWYG editing. I also experienced a few crashes along the way, enough so that I made sure to save before I hit the preview button.

Once setting up your page in the IDE, you were really locked into the Sun methodology of separating all strings, descriptors and tooltips from the actual GUI element.  In a few cases, label strings I defined went missing and just refused to be recovered. Other times, the code would keep forcing my controls to have a height of 0 pixels. This forced me to set a few label values and even menu titles in the GUI setup code, which I could see as a problem down the road.

I searched for solutions to the problems I had and hit a large snag. There really is no decent documentation on using NetBeans. Not anywhere. The Sun tutorials are sparse, and jump from Freshman to Master level in a single bound. The features change so often, there was even an upgrade to NetBeans 6.9 made available while I was working on linkFlow, and they were talking about how great the version 7.0 was going to be. I decided to pass on that until my 1.0 project was completed.

By the final re-write of the program, I ended up writing all the formatting by hand. I set up a method or two in the constructor of each GUI element that handled the construction of all the fields and buttons, etc, and all the event calls.  Another method initialized all the values in the fields and set default for buttons and spinners. This way, all strings are set up for internationalization in one method.  All the formatting is set up in static method calls to one class so it can be reversed to read right to left instead of left to right if this is needed as well.

Writing the program this way also got rid of all the resource files used by NetBeans to hold the descriptor data. So now, the class files and image resources can be ported over to Eclipse, where I plan on writing future versions of the software. After that, will use NetBeans only for simple applet projects.

Tuesday, September 14, 2010

linkFlow is now in Beta at SourceForge

I have spent the the last few months learning Java and a whole lot of other technologies. Why? There are some projects I have in my head that I have never been able to take the time and get out into the Universe.  Linkflow is one of those projects.

There are many hydraulic design programs out there. I designed linkFlow for a particular purpose, with one aim.  It is designed to make things a complex design situation very simple, in a piece of software that is so lightweight it can run on anything, preferably even while you have a lot of other pieces of software running on your desktop.  The simplicity and portability of the program also means it can be used anywhere.  It is written in Java so it runs on anything.  So an engineer in the field in a developing country has the same design tool as an engineer in an air conditioned office in Chicago.

So linkFlow is also flexible, allowing the designer to work in US Customary Units and in SI units.   Any pipe series can be used for the design. Any erosion control fabric can be used for the lining, and any kind of crushed stone can be used for stability.  Even the local vegetation can be input into the program to better model local conditions.  All these things are stored in the back-end data of the program.  The front, the direct user interface, is designed to be intuitive to operate. These are features not found in other hydraulic calculators.

The user only has to decide on the section he is designing, input a few design parameters, and with a few clicks, let linkFlow do the iterations to solve the problem. Simple computations of pipe diameters, to complex riprap channel design - both take seconds to fully design. All designs conform to the latest FHA standards for roadside drainage.

What else? This program has the ability to design complex and irregular sections with flexible materials, with varying n values. This is another feature not found in other hydraulic calculators. This opens the door to a lot of possibilities, including ditches with compound sections, and the design of watercourses with adjacent wetland areas in the same model.

So linkFlow is the first of many designs. I hope that it serves to help make the world a more livable place, by protecting water quality and reducing erosion. I am already working on the next project, but I will still be maintaining and updating this one. Download linkFlow free at SourceForge.

Thursday, September 9, 2010

Creating documents in LaTeX

I am in the middle of a technical document writing project that involves formatting math formulas, keeping track of cross-references, and multiple section levels.  The usual format for writing a project such as this is LaTeX, which enables the writer to concentrate on writing and not all the typesetting and references involved in the document creation.  Another advantage to the format is that a very nice PDF file can then be created directly from the LaTeX document.

I certainly knew I did not want to  try writing this document in OpenOffice or Word.  OpenOffice because it becomes very challenged with complex documents. Both programs suffer when doing cross referencing, bibliographies, and the math add-ons are clumsy and in-elegant.

I came upon a document processor call LYX that allows you to type in the text and enter the LaTeX formatting commands as you go along.  The commands are entered transparently as you designate each document environment.  The program has a nice math toolbar which make formatting complex equations very simple. Although the program does not a have a spell check built in, one can be added from a third party source.  Many templates are available to allow the document to conform to submission standards to scientific and professional journals.

After the document is complete, it can be exported as a pure LaTeX document, saved as a PostScript document, or saved to PDF.  There is a add-on available under Linux to format the document in the DocBook (XML) format.  Although much of the typography will no doubt be lost, there is another small program to change LaTeX language formulas to small PNG files to insert into the xml file.

For some of the figures in the project, I am going to try the LaTeXDraw program, which enables you to draw svg format files that can be embedded directly as vector art in LYX.