Friday, July 31, 2009

Biking in Pisgah National Forest

I've spent a good chunk of my vacation pounding on this project (it's fun, really), but took a break to bike a small part of the Pisgah National Forest near the Fish Hatchery. Just amazing fun: downhill in a rainstorm on a modern mountain bike (my Trek 920 is so old it was Made in the USA).

Thanks to Bio-Wheels in Asheville for the expert and friendly advice that came with the bike rental.

Wednesday, July 29, 2009

Javascript isNumeric()

After flopping around looking for a Javascript isNumeric() function, Rosetta Code came to the rescue with isFinite(num):

 string value = "123.45e7";  
if (isFinite(value))
{
// do something
}
//Or, in web browser in URL box:
// javascript:value="123.45e4"; if(isFinite(value)) {alert('numeric')} else {alert('non-numeric')}

Getting a value from JQuery .each()

I struggled mightily trying to get an attribute out of what gets returned from the JQuery .each() function, but eventually tried this and it works:

 <td id="skill_0_ranks" skill_id="0" align="right">0a</td>  
// update skill mods
$('td[skill_id]').each(function(i, element){
skill_id = $(element).attr('skill_id')
update_skill(skill_id)
})


Incidentally, found a cool site for code formatting: http://codeformatter.blogspot.com/2009/06/about-code-formatter.html

Thursday, July 23, 2009

Edit Screen




The Edit and Main screens as they are today. The should be functional on a 320x smartphone screen.

Monday, July 20, 2009

From the top, but this time with feeling

A character manager for a smartphone actually makes sense, so I'm writing it over again in Javascript. By the time I finish I may actually own one of these phones. What finally sent me over the edge was TaffyDB, a "database" for the browser. I can store all the data in these hashes, and Taffy gives you a nice way way to pull the data you're interested in. I think of the databases as Excel sheets (or Calc sheets, for the FOSS folks), and there are goodly number of Excel-based character managers out there, so I should be able to pull this off.

Tuesday, June 26, 2007

This is the end (for now)




The thing is done. The database is fairly stable, the edit perspective is basically done, and most importantly, I'll never use it.

Todos:

  • Feat special rules need to be implemented

  • MainPerspective calculated values (melee, damage, etc.)

  • Create charactersheet print out

Monday, June 25, 2007

CheckboxTableViewer.setChecked() fails silently

Took me a while to figure this out:

If you have a CheckboxTableViewer and want to set the initial state of the table contents as (un)checked, you cannot do the initialization in the LabelProvider. It seemed like the most logical place, and the viewer does enter the code for setChecked(element, true), but nothing is displayed. Turns you have to let the table draw first (I don't understand why):

public void update() {
// inputs the same
tableViewer.setInput("");
tableViewer.refresh();

List weapons = WeaponHome.inst.findAll();
for (DAO weapon : weapons) {
if (Ctx.getChar().weapons.contains(weapon)) {
((CheckboxTableViewer) tableViewer).setChecked(weapon, true);
}
}
}


For the record, this is the code that does not work:

public String getColumnText(Object element, int columnIndex) {
String value = "";
Weapon weapon = (Weapon) element;
if (isEditable()) {
if (Ctx.getChar().weapons.contains(weapon)) {
((CheckboxTableViewer) tableViewer).setChecked(element, true);
}
}