Monthly Archives: April 2010

Biobike Tooltips

Progress is being made, guys, I promise.

Here is the current issue: I’ve identified how the menus are made. Specifically the “Function menus” which contain the stuff you actually want tooltips for. They belong to a class called “dynamic palette menus” because they are built beforehand from a list stored server-side in biobike. At the server compile it reads this list and generates a menu item for each function. This seems like a fairly hairline difference between a “hard-coded” menu item. I guess the only difference being that if you make a new function, all you have to do is update that list with the function name and recompile the server and it will make a new menu item for it.

Either way, there’s a set of even more dynamic than the previously-mentioned dynamic menus. These are the ones I like to call the truly dynamic menus: the User Favorites menu. This pays attention to what functions you as the user are employing, and it puts your top five most used in a constantly-updating little menu box.

In order to get tooltips to show up on biobike, the question presents itself: Do I want to take a static approach, or a more dynamic approach? I think in the end the underlying changes will be the same. I, or hopefully someone more knowledgeable in Biology, will either have to go through and add a “Tooltip” variable to the definitions of each function in biobike, which is a string containing said tooltip, or a file that lisp reads to create an array holding all available tooltips, matched against all currently existing functions.

Actually making the tooltips appear is going to be easier than figuring out how to get the tooltips in there. Also, the decision isn’t technically mine alone. Since I’m not the only person looking at and maintaining this program, we’ve got a little bit of interoffice communication/collaboration going on!

Edit:I’ve discovered that every function, as it is defined, has a SUMMARY field that contans a string with EXACTLY what we wanted to show up in the tooltip. Why isn’t this anywhere in biobike already? I’m not sure. I’m really confused about it.

Static on my Android

This post is mostly to document a pretty tricky little ‘gotcha’ in Android, but I’ll give some background on how I discovered it as well. I’ve been wrestling with a minor bug in MtgHelper lately, mainly for something to do / something to keep me sharp. (RTMg.mob is in a holding pattern at present until Rob has time to tweak the CGI a little.)

Essentially the bug deals with how my two main application modes interact. Normally, MtgHelper operates from an Activity bearing the same name. There is an alternate view mode which operates from the Head2HeadMode Activity which splits the screen and changes how some methods work as a result. In particular, Head to Head ignores orientation changes.

The bug occurs in head to head mode when the user ‘changes orientation’ and then presses the back button. A second copy of the Head2HeadMode activity gets created, so the app gives the illusion of needing to press the Back button twice to get back to the home screen.

I ran into a very interesting snag when trying a solution to correct this bug. I created a static boolean variable (so that I could share it across my two activities without bundling it with my other data). Instead of painstakingly coding the state-saving stuff in the several places it would be needed, I wanted the variable to live and die with the application’s Activities. Interestingly, due to the static variable declaration, the variable was seeming to outlive the application!

As it turns out, even when you use the Back button in Android to completely close an application by taking all of the activities off of the stack, there can still be an Activity process lingering around for a while. This process is every bit as entitled as anything else to have static access to your variable. This results in unpredictable behavior wherein the variable appears to save state sometimes, but may not always. If Android decides to garbage collect my lingering process, the static goes with it.