Saturday, April 11, 2009

Contribution Update

I went back and did some further rework for the changes to the "Download code" I submitted to the forum earlier. I posted these on the forum as well (still do not have commit access to SVN). There were no clear directions so I took some suggestions from forum users and combined that with already existing functionality (that was in the code but not used due to a bug I think I fixed).

I spent this day making these updates. Basically there were 3 files updated.

Changes include:
  • Now individual tiles will be put in a HashTable if they get 3 404 errors. They will be prevented from being readded to the download queue. Pressing 'F5' will clear this HashTable as will restarting the program.
  • After 5 failed tiles download attempts (tiles reaching the status above) the current anti-hammer logic kicks in to prevent further requests to that server for that layer. The default timeout period is 2 minutes before it will try to download for this layer again. Pressing 'Pressing F5' will clear this counter, and will stop the timeout and restart the download queue for this layer.
  • When the above condition is reached it will display a message in the top right saying "Problem connecting to server... Trying again in 2 minutes" when that layer is rendered after a timeout is reached. This stays visible for the first 20 seconds of the timeout then will be fade out...this logic was actually in there currently, but I was able to confirm that you can see it now (plus I extended the time it is visible from 15 to 20 seconds).

Tuesday, April 7, 2009

World Wind 1.4.1 Issues

I reported two more issues based on my work over the weekend. I did not get a whole lot of responses yet.

Issue 1:
I notice that when you uncheck "Starfield" in the Layer Manager, it doesn't actually remove the stars that are in the background.

Response: confirmed issue

Issue 2:
I have noticed this on my new development environment which is Vista (64-bit).

Sometimes, but not every time (can't seem to pinpoint an obvious cause or pattern), after I have run World Wind from VCE2005 and exit it from the File menu, then try to Run it in Debug again it will not start up. There is no Worldwind.exe process running and the problem remains if I just restart Visual Studio.


This was a juicy one, I had seen this before but thought it was some change to the code I had made caused this problem.

Thankfully I found that in WorldWind.cs it is actually checking for a Window handle named 'NASA World Wind', finding one and then returning after sending arguments for it.

I have had to comment out this return. Otherwise I need to log off of Windows and log back on to fix the problem.

The bug is that probably the Window is not being shut down completely.

// If World Wind is already running, pass any commandline
// arguments from this instance, and quit.
IntPtr handle = GetWWHandle();
if (!System.IntPtr.Zero.Equals(handle))
{


if(args.Length>0)
NativeMethods.SendArgs( handle, string.Join("\n",args) );

//[Ammianus] by commenting out this return I can get it to start every time.
//return;
}


Both bugs are being discussed in this stickied thread on the World Wind forums.

First contribution?

Technically I did not check-in any changes to SVN, but I did suggest a fix for World Wind on the forums.

I have been spending a good while looking into the "download code" issue. I have taken a step back and this past weekend I dove into the code using my new development machine.

By tweaking a couple of lines of code I managed to unlock behavior already built in to the download classes that would prevent multiple failed downloads from repeating for a particular layer (after 5 failures, stop downloads for a timeout period of 2 minutes). This was slightly different from the expressed requirement to flag specific tiles for not being found and not retrying those.

So on April 5, 2009, I went back to the World Wind forums and posted my update including the changes to the two class files to make the existing functionality work correctly. I even got some replies by a few active members that they would try it out. I asked for clarification as well if I should go back and make the anti-hammer logic work for tiles specifically rather than whole layers which is what I initially wanted to do.

It was such a successful feeling on Sunday to get this working the way I wanted. My wife and I spent all day working on our various projects, me on World Wind, her on her doctoral dissertation. It took about 5-6 hours of steady work, debugging and reading log files to really wrap my head around how these classes were truly interacting. Making a simple change (which I understood) and having it work was very rewarding, it gives me confidence to continue with some more changes.

Things to check:

* One recommendation was to display a message in the UI that the connection to the server is on hold for the 2 minute timeout period. I did in fact see something like that at one point in my testing but it quickly went away, may have been unrelated to my code changes
* Pressing 'F5' will clear the cache for a specific area and force a retry of the download of the visible tiles. Suggestion was that this should reset any timeout or counters of failures if the user doesn't want to wait (I suppose would be the case if they scrolled back over some location that they were more confident had tiles to download from the server)
* Need validation on whether current anti-hammer logic is ok, or we need per-tile anti-hammer logic

New development machine

Not wanting to abuse my work laptop too much, I decided that for my own personal development I needed a new machine, laptops are relatively cheap these days.

I decided on getting a lower-end machine (which means less on the CPU and Graphics card side, but leaving ample memory and hard disk space). After browsing around different reviews and shopping a bit, I decided to settle on a Toshiba Satellite M305-S4907

Basic specs:
* 2GHz Intel® Pentium® Processor T3400
* 4GB PC6400 DDR2 800MHz SDRAM
* 320GB HDD (5400rpm)
* Windows Vista® Home Premium (SP1, 64-bit)
* 14.1" widescreen display
* 5.2 lbs

It took me a few weekends to get used to how use Windows Vista, but I am really enjoying this pc now. I recommend it. Graphics scored somewhat low on the Windows Vista benchmark, but other than World Wind, I don't really use any graphics intensive applications. Unfortunately, World Wind is fairly graphics intensive and that was one of the primary reasons I bought this laptop, to do open source development when not at home.

Tuesday, March 3, 2009

Asynchronous downloads

One of the things I've learned about the download code is that it uses Asynchronous calls to handle the downloading of the image files from the server in the background.

I found a good article on doing these calls in .NET which explains a lot of the World Wind .NET download code and what it is doing.

http://www.codeproject.com/KB/dotnet/async_pattern.aspx

I need to understand this in order to really implement the more robust queuing method.

Sunday, March 1, 2009

Download code

So I have struggled with the infamous "download code" for the past week or more. It was really difficult to untangle what connects to what and where. I found myself resorting to drawing my own class diagrams to keep the pieces straight from what I could tell.

What was interesting is that there looks like two separate and independent "download code" implementations that do almost the same thing for different areas of the application.

The first component, if you will, was in the project called WebDownload, this was the first one I was able to step my way through. Unfortunately, it was not the component that could solve the problem I was tasked with fixing.


The next set of classes was in another project, PluginSDK. Here was where I eventually made some quick changes to actually stop the repeating downloads from happening.



The QuadTileSet is the center of action here, it has the queue of download requests that it services. I changed this class to have a Hashtable where it would store the download requests for tiles where the server responded with a 404 response. Then it wouldn't re-add these items to the download queue if they were in this Hashtable already.

All in all I had to make some slight changes to three classes here:

  • QuadTileSet

  • GeoSpatialDownloadRequest

  • WebDownload




You may notice the snazzy UML class diagrams I used above. I am not really big on UML, though I used to do class diagrams a lot for a previous company. I went looking for some free, preferably Open Source UML Editors, just to let me crank out the class diagrams above (which I had already hand-drawn on paper).

I tried out two, both were basically Eclipse plugins. One did not work and the other I felt was too complex and buggy for the simple diagrams I want to do.
Papyrus UML - this actually worked but was difficult to use

acceleo - I installed this in my Eclipse environment as a plugin as per directions. I didn't allow me to create any diagrams after about 10 minutes of trying so I uninstalled it.

Sunday, February 22, 2009

Back into the fray

I have been on a hiatus from any of my leisurely coding pursuits. I had some deadlines on my current project for my real job, and spent the majority of the past two weeks and weekends working on finishing up some of those items. I completed most of those items on Friday so I am able to catch my breath and look into WorldWind .NET again.

Since I've been gone there has been discussions of setting up a Jira site for .NET that was apparently taken down right around when I signed up for world wind (yet another sign that I've jumped into an active healthy open-source community ;-)). So latest word is that they will probably shortly set up a new Jira instance on a WorldWind central server, then they will need to get the old Jira data from NASA.

In addition it looks like I've started to receive the emails from SourceForge with logs of everything checked in to SVN. Which is cool. Looks like a couple of members are starting to make modifications and updates. There is also an thread now of open 1.4.1 issues.

There are some issues with the download code for WW it seems. And when it was stated that no developers were around to fix it I stuck my head out again to let them know I was going to be helping soon. Some members wise-cracked that whomever works on the download code disappears in 7 days...

I'll try to spend some time this week, I have a couple of issues going on at work still that might take up my time. But I'm not giving up yet.