Friday, January 02, 2009

Christmas Letter from the Kevin J. Rice

Update from the Holidays and the Rice Household:

The summer this year was taken up by working on a wrap-around brick patio for our house, so when we get out of the van it's onto a brick walkway instead of mud. This hopefully contributes to the cleanliness of our entrance hall. We (mostly me) broke out the concrete walk with a jackhammer (me! Fun!), and dug down 14 to 18 inches to put in a drain tile system. This turned out to be about 20 yards of dirt and gravel moving.

I put on some muscle during this. Unfortunately, it's still not finished. The hole has about 6 inches of lift left before we can put the bricks in. I would have finished with another weekend, but something interfered with this plan: a broken jaw.

On October 27th, I was working at clearing and burning some brush (buckthorn trees/bushes) at my church. While moving some large branches in the fire, I bent one back and then had it fly up and hit me in the face. It broke my jaw in 2 places (chin and near my ear). I've had my jaw wired shut for about 7 weeks and it the last two have had it opened but not unwired. There's still with the 'dental arch' in place sticking the insides of my cheeks with sharp wires, but hopefully this will come off in the next week or so.

So, drinking through a straw has meant losing 20 pounds, which makes me look nicer and I could certainly have used it, but I don't recommend it as a weight loss method.

Other news of the family:

Beck is working on her writing, and enjoying that. She's not enjoying arthritis in her foot and hip, and some plantar fasciitis to go with it.

Atticus is in kindergarden. He just turned 6, and there was much celebrating. He will (of course) be bummed out for the rest of his life having a birthday so close to Christmas, but we did what we could to make it properly a birthday just for him, with cake and a party and such things.

Xander is 7 and in first grade, doing very well. He's reading to himself some, and we've all been gathering at night (all the kids and mama at least) on the master bedroom bed, while Beck reads from the Harry Potter series. This is going over VERY well, even with some of the scary parts. We're in book 4 now and much of the kids' free-play has Harry Potter motifs.

Carter is 4 and frequently tries to get her way by screaming loudly. This hurts my ears horribly, and I've found my stress level increases directly with the noise level. With stress, I get a little angry, so I've taken to wearing earplugs during times of likely noisy events, which give me much more patience and thus ability to parent well.

Of course, the whole house has quieted down significantly since Christmas, when the boys got Nintendo DS's and Carter got a Leapster. Lego StarWars is a favorite, followed by Mario. We had a relaxing drive of over an hour when they had something to do besides pester the driver.

Speaking of driving, I saw good friends at New Years' eve and day. Kevin Gordon (who lives about 1.5 hours away) and his family, and Steve Brodson (who is minutes away from us) and his family, then the Brodsons' again for football on new years' day. Not that I'm THAT into football, but I like watching it occasionally and it's always fun to hang out and be social, especially since the kids have made such events less frequent.

The party at Kevin's on the eve was very interesting conversationally. One guest was a neighbor who does electrical contracting for a railroad nearby. He told some stories about putting up a whip antenna near high tension wires and having the induced voltage from the lines of several hundred volts on this relatively short antenna. Apparently everything has to be VERY well grounded around railroads due to lightning strikes, etc., too.

My work at Textura is taking up a lot more time recently, due to our serving the construction industry, which (as everyone knows) is being hit hard by the recession. We're working on putting out a new feature that solves a larger business problem and are hoping that it will generate some more business / revenue because people will find it more useful. So, lots of extra hours for me, but it's fun work since I can readily see the benefit to our users and hope our business outlook grows with the additional users and usage that this feature will bring.

Today we got a new kitten/cat, which had been at my mother in law's house, but she's not home enough for it so we took it. This brings our total back to 3; we had 3 but one had to go away because of a behavior problem and it's good to have a group again. They play together very interestingly (cat politics) and it's fun to watch and warm to be sat upon whilst watching TV, reading, etc.

Fitnesse ArrayFixture: my simple example

Recently I've been fighting with Fitnesse, specifically a pyFit server, trying to get an ArrayFixture to run properly. The only example of ArrayFixture I could find was the generic one. Here is a better example of ArrayFixture.

I'm calling this from within a DoFixture, mind you, so sorry if there's that added complication, but you should be able to figure out what's happening based on this.


class LwRow(object):

_typeDict = {}

def __init__(self):
self.rowNumber = None ; self._typeDict['rowNumber' ] = "Int"
self.indent = None ; self._typeDict['indent' ] = "Int"
self.refobjType = None ; self._typeDict['refobjType'] = "String"
self.refobjId = None ; self._typeDict['refobjId' ] = "Int"
self.sNumber = None ; self._typeDict['sNumber' ] = "String"
# ... blah more here...

def name(self):
self._typeDict['name'] = "String"
return self.linkOrgEditContractorText or ''

def getSetOfRowObjects(self):
rows = []
obj = LwRow()
obj.rowNumber = 1
obj.indent = 3
# ... more setting here...
rows.append(obj)
# blah, repeat, appending more rows...
return rows

class ReviewLwsArrayFixture(ArrayFixture):

def __init__(self, p, c, dr, user, trans=None):
ArrayFixture.__init__(self)
rows = []
#... do stuff here to retrieve data...
retData = getSetOfRowObjects()
print "Have retData=%s" % (pformat(retData))

# THESE ARE PRO-FORMA, MUST BE HERE:
self.paramCollection = retData
self.setActualCollection()

def getTargetClass(self):
return LwRow

def reviewLwsArrayAsUserPpCcDrUser(self, p, c, dr, user, trans):
return self.ReviewLwsArrayFixture(p=p, c=c, dr=dr, user=user, trans=trans)


# then you can write your UAT / Fitnesse code as follows.
# Note that I can use ANY attribute of the lwRow object without declaring it
# in my arrayfixture code (I have LwRow declared in a non-fixture related module)

|review lws array as user | gcUser| pp | p1 | cc | c1 | dr| Dr1 |
|rowNumber|name|indent|refobj type|
|1|manual name one|Manual|False|
|2|subMc1|LW Sub|True|
|3|subMc2|LW Sub|True|
|4|subMc3|LW Sub|True|


and / or:

|review lws array as user | gcUser| pp | p1 | cc | c1 | dr| Dr1 |
|rowNumber|name|sNumber|
|1|x|62|
|2|y|63|
|3|z|64|
|4|z|46|
|5|z|55|
|6|z|63|
|7|q|64|

That's it!

Thursday, December 18, 2008

AutoComplete Bug: item has comma won't select (but I have workaround)

Found an AutoComplete bug:

I've just found a bug with AutoComplete plugin. If one of the items in the list retrieved has an embedded comma in the string, the string is not considered 'matched'. This is with options 'multiple' false.

This I discovered because I've implemented the 'afterNoMatch()' method (see an other post to this list). If I select an item from the list that has an embedded comma, it will trigger the afterNoMatch() and consider the item not matched.

This could impact otherse even if they don't have this patch because this means the mustMatch option will not trigger as they think it will.

I haven't found the true cause, but it would seem to have something to do with multiple selections - like it's on by default anyway. So the workaround is to specify another multipleSeparator character. Here, I use backtick:

$("#mcOrgName").setOptions({multipleSeparator: '`' });

where mcOrgName is the jquery name of the field I'm using autocomplete for.

Here's hoping the author does a bugfix, but in the mean time, this workaround should enable full functionality presuming you don't need backticks in the text you're selecting.

Enjoy!

Thursday, December 11, 2008

JQuery AutoComplete: code/diff for new option afterNoMatch

Below please find a mod for adding an option to AutoComplete.

The option is 'afterNoMatch'. It specifies a function to call if the value provided does not match any value in the dropdown box. This has been mentioned as a problem, and I needed a solution. So, here it is.

If the autocomplete cannot return a value (it's not found by the JSON lookup), the callback is called. At this point, I reset the values of a div and a hidden field holding the ID of the thing I was looking for.

This may not be perfect, but it does get the job done.

First, how to call it:

<script type="text/javascript">

var autocompleteJSON = function(raw) {
var json = typeof(raw) === "array" ? raw : raw.resultSet;
var parsed = [];
for (var i=0; i <json.length; i++) {
var row =json[i];
parsed.push({
data: row,
value: row["orgName"] + ' [' + row["id"] + ']',
result: row["orgName"]
});
}
return parsed;
};

function afterNoMatch() {
document.forms[0].mcOrgID.value = 'nomatch';
locationDiv = document.getElementById('mcOrgLocationDiv')
locationDiv.innerHTML = "<b>Manually Entered Organization Name - No location.</b>";
return;
}

function formatCompanyName(row) {
ret = row["orgName"] + " (id: " + row["id"] + ") " + row["orgCity"] + ", " + row["orgState"]
document.forms[0].mcOrgID.value = row['id'];
return ret
}

</script>

<script>
$(document).ready(function(){
var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
$("#mcOrgName").autocomplete('BrowseOrgsJSON.py')
.result(function(event, data, formatted) {
//alert("Got data back from server: name=" + data['orgName'] + ", id=" + data['id'] + ", city=" + data['orgCity'] + ", state=" + data['orgState'] + ", formatted=" + formatted);
$("#mcOrgLocationDiv").html('Location: ' + data['orgCity'] + ', ' + data['orgState'] + ' (Textura Organization id: ' + data['id'] + ')' );
document.forms[0].mcOrgID.value = data['id'];
});

$("#mcOrgName").setOptions({scrollHeight : 400 });
$("#mcOrgName").setOptions({queryArgument : "search" });
$("#mcOrgName").setOptions({formatItem : formatCompanyName });
// $("#mcOrgName").setOptions({autoFill : true }); CANNOT DO THIS WITH SUBSTRING SEARCH.
$("#mcOrgName").setOptions({mustMatch : false });
$("#mcOrgName").setOptions({dataType : "json" });
$("#mcOrgName").setOptions({parse : autocompleteJSON });
$("#mcOrgName").setOptions({selectFirst : false });
$("#mcOrgName").setOptions({extraParams : {'includeOffSystem': 'False'} });
$("#mcOrgName").setOptions({afterNoMatch : afterNoMatch });
});
</script>


Now, here's the code. I'll start off with the diff and then cut/paste the section the code is in case the code changes between now and the time you're reading this.

In jquery.autocomplete.js, the function hideResultsNow() is changed to be the following:


function hideResultsNow() {
var wasVisible = select.visible();
select.hide();
clearTimeout(timeout);
stopLoading();
if (options.mustMatch) {
// call search and run callback
$input.search(
function (result){
// if no value found, clear the input box
if( !result ) {
if (options.multiple) {
var words = trimWords($input.val()).slice(0, -1);
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
}
else
$input.val( "" );
}
}
);
}
else
{
// call search and run callback
$input.search(
function (result){
if( !result ) {
options.afterNoMatch();
}
}
);
}

if (wasVisible)
// position cursor at end of input field
$.Autocompleter.Selection(input, input.value.length, input.value.length);

};


and one option is added to the options section:


...
max: 100,
mustMatch: false,
afterNoMatch: function() { return; },
extraParams: {},
selectFirst: true,
...


Now for the technical diff:


Index: resources/js/jquery/autocomplete/jquery.autocomplete.js
==============================================================
307a308,319
> else
> {
> // call search and run callback
> $input.search(
> function (result){
> if( !result ) {
> options.afterNoMatch();
> }
> }
> );
> }
>
310a323
>
403a417
> afterNoMatch: function() { return; },

Friday, August 22, 2008

CodeStriker: Inappropriate IOCTL for device

I just had a troubleshooting session with a nifty code review tool called codestriker.

All of a sudden, we're getting an error of: "Inappropriate IOCTL for device" during creation of a new topic. This is maddening. I found lots of references to this, but nothing about what's going on to cause it. I can write to the directory, I can touch files there, everything seems to work, but no joy.

So, I tried putting in a modification to test the return values of the open statements in the code (/var/www/codestriker/codestriker-1.9.4/lib/Codestriker/Repository/Subversion.pm):


push @args, '--revision';
push @args, 'HEAD';
push @args, $self->{repository_url} . '/' . $url;

my $read_stdout_data;
my $read_stdout_fh = new FileHandle;
my $ret = open($read_stdout_fh, '>', \$read_stdout_data);
if (not $ret) { die("Died on open of file stderr",
$read_stdout_fh, ", msg: ", $!); }


my $read_stderr_data;
my $read_stderr_fh = new FileHandle;
my $ret = open($read_stderr_fh, '>', \$read_stderr_data);
if (not $ret) { die("Died on open of file stderr",
$read_stdout_fh, ", msg: ", $!); }


Codestriker::execute_command($read_stdout_fh, read_stderr_fh, $Codestriker::svn, @args);
$file_url = 1;
open($read_stderr_fh, '<', \$read_stderr_data); while(<$read_stderr_fh>) {
if (/^svn:.* refers to a directory/) {
$file_url = 0;
last;
}
}

Adding the 'if not ret...' lines after the opens fixed the problem. Note, I had to restart apache with /etc/init.d/httpd restart and tail /var/www/error_log to fix a minor syntax error first, but it worked out.

Tuesday, August 12, 2008

How I Would Run the Stargate System

How I Would Run the Stargate Program
by Kevin J. Rice

Preface: This is written as if Stargate was real. It isn't, it's a nice pair of shows on TV with human actors and all that. But, sometimes it's fun to put yourself into a fictional 'universe' and think about how you'd run things differently.

In the Stargate: SG1 and Stargate:Atlantis universe, the SGn teams and Atlanteans venture forth to interact with several worlds in which large numbers of humans live at roughly an 1850's level of civilization. There is a lot of rough housing, with some horse and buggy transportation, outhouses, and a lot of preindustrial development.

This is mostly consistent throughout the gate network: Settlements on most worlds have a relatively low technological level compared with modern U.S. manufacturing and service-sector capabilities.

If I were in charge of Atlantis, I would be doing things quite a bit differently. I would create a set of survival packs (gift packs to newly met worlds) and start visiting these worlds with the express intent of bringing them up to modern standards of development capacity.

Here are my plans and reasoning:

1. Reveal the Gate

Everyone (on other planets) presumes we know about the gate already anyway. Domestically, all major Earth governments know about it and have adjusted their foreign policies somewhat. So, why not? It seems to me that very little is to be gained by keeping the Gate system secret from the population of Earth. In fact, I would argue that a large scale commerce between various worlds would be the best course of action. Certainly, many more kids would be inspired to study hard so they could grow up to be engineers and businessmen building things on other planets.

2. Set Up A Stargate Emigration Authority

Many millions of people around the world would love to emigrate to a near-'virgin' planet where they could farm, raise cattle, prospect/mine, be left alone, etc. There are lots of countries that are very repressive and if it were known that it was possible or even easy to emigrate to one such world, they would flee their home country and ask for transport to the new world. This would presumably be pretty cheap to do. We witnessed this writ large in the 1800's into the American midwest. This would take significant population pressure off portions of the globe where resources are scarce and populations large.

3. Reveal Spaceflight Technology

Spaceflight tech in the SG1 universe is presented as having many solved problems available. In fact, the dreadnaught spaceships already built are testimony that the Americans, at least, know how to build and use this technology.

Likewise, spreading out to create outposts on other planets and in large, independent, and dispersed space stations lowers the risk of catastrophic attack on Earth affecting Human tech development. Every computer programmer knows, if you have something important, back it up! Humanity is important, let's "back it up". Outposts do that.

4. Develop large-scale Ring-based Transportation Infrastructure

I would create a special set of rail lines that allow two way rail transport through the ring system. This would enable large industrial commerce. Further transport could be enabled with the Al-Kesh transport ships.

Commerce, and therefore GDP growth, depends on transportation infrastructure. Getting goods to and from market efficiently lowers the cost of the goods.

5. Create a "Gate System Peace Corps"

Peace Corps volunteers/employees have taught schools, built bridges, wells, roads, etc., all over the world and have created both goodwill and a better educated populace. This obviously benefits both the U.S. and the host country. The hosts get a higher standard of living, they buy our goods and sell us things, use the money to create better factories and a richer populace that can better afford our products and vice versa, etc. Economics of free trade are not zero-sum: they are positive-sum in that everyone benefits.

A gate corps would do the same thing, and present significant opportunities for good storytelling. Story lines could be culled from the annals of the Peace Corps themselves. Most of all, we should send teachers and textbooks to other worlds, getting them into the 20th century so we are better able to become a galaxy-spanning civilization capable of resisting outside threats like aliens and inside threats like pandemics and terrorism.

6. Explore from Another Planet

Many times during SG1 it was demonstrated that merely dialing up another world could present huge problems and possibly destroy Earth:
- Black hole world
- Nasty parasitic insect world
- Gua'ould worm world
- etc.

So, my proposal is the creation of an Gate EXploration Authority (GEXA) on ANOTHER planet. This would be a well-defended but very much separate world in which gate teams explore new worlds and report back on their findings. Should contact with the GEXA planet be lost, Earth is still safe. Automated receivers hidden on nearby moons could receive log reports broadcast non-directionally; we could gate to a nearby world, then fly a ship to pick up the logs from those receivers, should contact be lost, etc.

7. Ring System to Earth's Moon

I don't know if this is possible in the fictional phyics of Stargate. However, it would be cool and solve many problems of mass transportation to/from this location. An outpost there would have some very cool aspects, including a great tourist industry, and reinforcing the idea that the Earth is a very small place. Then, maybe our petty fights (wars) might be less interesting compared to getting rich off-planet.

8. Reveal Some Military Tech

Further, if we want to create viable defenses against "the bad guys", we have to create and deploy large scale defensive systems. The nations of the Earth are engaged in an arms race, but with tech that doesn't match the 'bad guys'. So, fix that, and we'll be able to defend ourselves because we've already fought each other with this technology. Note, this could be troublesome.

---------

Overall, I would be running things significantly differently than the SG1 universe presents it. Of course, writers, you're welcome to my ideas if you thank me in the credits!

Thursday, July 31, 2008

Harriett Miers and Karl Rove: Contempt!

Again, again I cry, What of the Jail Cell in the basement of the capitol building, used throughout the 1800's to hold anyone congress found to be in contempt. The judiciary can thus be consulted AFTER THE FACT for confirmation of the solemn and proper nature of this citation of contempt. If Judges in their proper course find Congress' justifications lacking, of course the person(s) may be released. However, the burden is then on the defendant to be prompt and proper in their defense, deliberations, and legal ponderings.

On behalf of the good citizens of these United States of America, I cry, Havoc! Let slip the dogs, let us take the debate to the higher plane of prompt action. I pray thee Congress, take by your assemblage that confidence that befits the just representatives of the People. Assert thee your relevance and assuage this wrong. These contemptible scoundrels trodding heavily your constitutional duties and sauntering off, noses in the air. The time to act is at hand, Congress! Let your oath-sworn duties of oversight return to you a sense of dignity and forthright action !

All the country cries out for action... Shall we be waiting forevermore?

We the people demand: Justice Delayed is Justice Denied.