Beaten by Children

Each Friday evening I take a class in Mandarin at the Chelmsford Chinese Language School. After that class, I go to chess club, while Naomi studies Chinese Folk Dance. I wrote this at the end of last year.

Carissa is quietly contemplative. She keeps her body movements still, with a level of concentration that seems incongruous with her age. She looks disarming. Yet she plays chess with such aggression that I find myself doing nothing more than react to her constant attacks the entire game, with no chance to implement a winning strategy of my own.

Jeffrey is “all boy.” Every time he makes a good move, his whole body shakes with elation. He laughs with glee every time he puts forth another reveal, or forces me to choose which of two pieces I am going to have eaten by his.

I am 42. They are both just seven years old. In addition to their age, they have one other thing in common: They absolutely destroy me at chess.

But the children weren’t the only ones who learn and improve. I go back every week, and I get better.

From We to Me

An involuntary divorce is, quite frankly, a terrible event. I doubt that will surprise anyone. There are dozens of expected perils and adjustments. It is tragic, and painful beyond belief.

But that pain does, eventually, well and truly end. One adjusts. Balance returns. Life becomes fabulous again.

But occasionally, there are bits of adjustment that are just plain odd or unexpected.

The one of these, with which I struggle constantly, is whether to use the plural first person pronoun, we, to describe events in the past that were performed when there was a we. Do I say, “We always wanted a daughter, and had the name Naomi chosen for many years,” or should it be, “I always wanted …”?

As the time passes, I still find myself waffling on this one. Some weeks I strongly lean toward, “I will describe things as they were,” and other weeks I think, “No! I have to be clear that I’m single. What if some unmarried Nobel-prize-for-science-winning* supermodel missionary gal is eavesdropping on this conversation and mistakenly thinks I am married?”

Anyway, these are the kinds of post-divorce things that nobody talks about.

Cheers.

*No, the Nobel Prize for Economics does not count. (I have standards, you know.)

(And, yes, I know that I am not using parallel structure in the title. The rhyme seemed more appropriate.)

Pagination Control While Printing in Flex: Unwrap mx.printing.FlexPrintJob’s Private flash.printing.PrintJob Variable

I’ve worked with Adobe’s Flex platform now for several years, beginning with my Star Trek transporter simulator, a project I wrote for a Boston University course.

Now, my job at Transparent Language involves mostly FFA (Flash/Flex/AIR) development, and I enjoy the challenges of working in this fairly cutting-edge environment. This week, though, I was shocked by an apparent limitation in the mx.printing.FlexPrintJob class: It doesn’t return the operating system’s print dialog information to the Flex application. So, if I want to print, say, the first five pages of a document, it cannot normally be done. It’s all or nothing, regardless of what I specify in the OS print dialog.

Windows XP operating system print dialog.

The FlexPrintJob class wraps an older class, PrintJob. The primary difference is that PrintJob, designed for Flash, takes a Sprite as passed parameter to its addPage() function, whereas FlexPrintJob’s equivalent addObject() takes a UIObject. Fair enough.

But, what’s weird, is that the FlexPrintJob class contains a private PrintJob object, but it doesn’t expose any of the useful properties of that PrintJob object, except pageHeight and pageWidth. Want the printer name? The first and last pages in the page range the user has entered? The paper size? The orientation? Forget it! None of them are accessible.

Granted, most of these properties are AIR-only, but I’m working on an AIR project, and it would be darned useful for my users to be able to control their output, which can often run to many tens of pages, so I really need access to the properties of the “hidden” PrintJob object.

Thankfully, there’s a relatively easy solution. I can du plicate the FlexPrintJob class, and add accessors (getters) that will allow me to read the variables I need. Normally, I’d extend the class, but because the object and properties I need are private, I can’t even do that. I have to essentially clone the class, and add what I need to it. Thankfully, FlexPrintJob is part of Adobe’s code that has been open-sourced, so I can do this with impunity, and even distribute it.

So, I open the FlexPrintJob code, copy it to an empty class, rename it to FlexPrintJobExtended, and remove the reference to import Version.as, and add the following:

//--------------------------------------------------------------------------
//
//  Additional accessors for PrintJob object
//
//--------------------------------------------------------------------------

public function get copies():int {
    return printJob.copies;
}

public function get firstPage():int {
    return printJob.firstPage;
}

public function get isColor():Boolean {
    return printJob.isColor;
}

public function get jobName():String {
    return printJob.jobName;
}

public function get lastPage():int {
    return printJob.lastPage;
}

public function get maxPixelsPerInch():Number {
    return printJob.maxPixelsPerInch;
}

public function get orientation():String {
    return printJob.orientation;
}

public function get paperArea():Rectangle {
    return printJob.paperArea;
}

public function get paperHeight():int {
    return printJob.paperHeight;
}

public function get paperWidth():int {
    return printJob.paperWidth;
}

public function get printableArea():Rectangle {
    return printJob.printableArea;
}

public function get printer():String {
    return printJob.printer;
}

Then, wherever I needed the FlexPrintJob class, I can then use my FlexPrintJobExtended class instead, and get access to all the glorious properties on the now-much-friendlier printJob object. Note that I’ve kept the properties read-only, by only writing getters. I did not envision any need to change the values: I only wanted to know what the user told the operating system.

The next obstacle is in the sample code provided for printing multipage documents. Begin by consulting the published examples for Printing with multipage PrintDataGrid controls. I’m not going to elaborate too much on this, merely illustrate how to get to the next step, printing multiple pages using the pages the user specified.

Looking at the section of the sample code marked with // The function to print the output, there are only a few things we need to change.

First, we need to change the FlexPrintJob instance created to use our new class:

// Create a FlexPrintJobExtended instance.
var printJob:FlexPrintJobExtended = new FlexPrintJobExtended();

The user might not have chosen to start on page one, so we need to advance to the first page the user has chosen.

// Jump to the first specified page, not necessarily page 1.
while (errorPrintView.pageNumber < printJob.firstPage && errorPrintView.printGrid.validNextPage) {
	thePrintView.printGrid.nextPage();
	thePrintView.pageNumber++;
}

Then we modify the

while(true)

so that it won't go further than the number of pages the user has specified.

// Loop through the following code until all pages are queued.
// If the user has chosen to print all pages, printJob.lastPage will be zero.
while(printJob.lastPage == 0 || thePrintView.pageNumber <= printJob.lastPage)

Voila!

Feel free to download the code cited in this post: FlexPrintJobCode.zip.

If you find this to be useful, or find a better way to do it, let me know, by e-mailing "doug" at this domain. Cheers!

Dance Macadam

Naomi had been very, very sick for almost 10 days—double ear and ear canal infections, that we finally got under control. Even though she stayed home from school, she hadn’t had a fever all day, and I let her go to ballet. (Isaac took care of her while I was at work—my first day back in the office in a while. I am very grateful that Transparent Language has such excellent work-from-home infrastructure.) So I went home, got her ready for ballet (tights need help), and off we went. Gate City Ballet is pretty much on the same street as my job, so I normally drop her off, go back to work, and pick her up at the end.
Naomi with her artwork.

On the way to ballet, we stopped at the school department offices, where one of her pieces of artwork is being displayed. Naomi was thrilled to see it.

Naomi's Art on Display at the Nashua School System Offices.
Naomi's Art on Display at the Nashua School System Offices.

We got to ballet (on time, even—everything in Nashua is close and convenient), and she exclaimed, “My ballet bag!”

I said, “No problem, you can see if they will let you start in your stockings,” and I went home to get the bag. I picked it up, and realized there were no tap shoes in it. So, I hunted around her room to find tap shoes, and put them in the bag, and delivered them to ballet.

“Dad, these are my old tap shoes. They hurt my feet if I wear them.”

I laughed. “Okay, I’ll be back in a bit.” Back to the house … play the “find the real tap shoes” game—not as easy as finding the wrong pair. Back to the ballet studio. Along with a sweater she forgot to pack.

I hold up the correct shoes and the sweaters. Naomi beams and blows me a kiss.

I am in Heaven.

It's two years old, but this is still one of my favorite ballet photos of NaNi.
It's two years old, but this is still one of my favorite ballet photos of NaNi.

Losing

If I were to lose you today
I would lose …

The one who mothered my children
The one who was my only lover
The one who laughed at my jokes
The one who tolerated my inability to get my socks into the hamper right-side out
The one whose smile always brightened my day
The one who cut my hair
The one who prepared my meals
The one who shared my poverty
The one who shared my wealth
The one whom I have laughed with
The one whom I have cried with
The one whose illness tested my faith, showing me that it was okay to let God know I was really angry with Him
The one who received all my love notes
The one whose every success I applauded
The one who left clumps of hair everywhere in the house
The one safe driver in the family
The one who encouraged me when I did crazy things like ride my bike in the snow
The one who I could eat ice cream with
The one who made a million double standards
The one who was my water-fight and snowball target
The one who was my Snugglebunny
The one with whom I have shared a Caribbean sunset
The one who made me change my clothes when they do not match
The one woman I have ever kissed
The one who kicks my butt as my personal trainer
The one with whom I can watch chick-flicks
The one who supported me when my brain would not work right and I did not know what to do
The one who taught me how to exercise
The one who couldn’t stay awake for reading Starship Troopers
The one for whom I have prayed
The one who tolerated and tried to understand my anxieties
The one who was my Queen of Sarcasm
The one who made me not afraid to walk down dark alleys
The one who always froze me with her feet in bed in the winter
The one who prayed for me when I most needed it
The one who recognized all my Star Wars quotations
The one for whom I have bought flowers
The one who trusted me with her secrets
The one who always beat me to the bathroom
The one who my family liked better than they liked me
The one for whom I asked God
The one who pampered me when I was sick
The one whose drinks I could sip and then make “that face”
The one for whom I always thanked God
The one by whom I defined the word beautiful
The one who got me to eat mostly healthily
The one whom I did not see Hyannis with on our honeymoon
The one whose adventure dreams I always envied
The one with whom I could talk through any decision
The one who let me decorate with Lego
The one who always ignored my advice about computing
The one who has made my vacations worth taking
The one who realized immediately that we needed to live closer to work
The one who kept our children safe when I was not cautious enough to do so
The one whose laugh always made me smile
The one who made me think “Wow!” the first time I saw her
The one who was my friend for years
The one whose voice was the most beautiful one in the world to me
The one whose body I always longed to touch
The one for whom I lived
The one whom I love.

Nichelle is moving out today, pursuant to her intent to divorce me. I wrote this a couple of months ago, after a conversation we’d had. Nichelle’s decision was unilateral, and has been the most heartbreaking thing I have ever experienced, but there’s nothing I can do to prevent it.

Goodbye, my darling. Know that I love you, unconditionally and unceasingly.

Rope-Climbing Lego NXT Robot

This is the rope-climbing robot myself and ASD student Joe Cole worked on, as a competitor in the “Robolympics” program I developed after Robot Sumo was done this year.

We were hoping to modify the base to allow it to compete in robot drag racing, but there simply wasn’t enough time.

Ours was the only team to successfully complete a robot that would climb the rope, although two other teams came close. There’s a red Lego Astromech droid on top of a pole that triggers a touch sensor to reverse the robot (usually) when it gets to the top of the rope. If I’d had more time, I’d have replaced that with the ultrasonic distance sensor.

Adam White’s stripped-down speed demon completely dominated the robot drag racing event. No one stood a chance against him.

LARP or Party Game: How to Play “Zombies”

There’s something fascinating about zombies, and a current cultural meme seems to have made them even more popular than the silly idea that the world will end in 2012. (One of the most popular video games around now is the second installment of Left 4 Dead, called Left 4 Dead 2, which is a teamwork-based game pitting humans against hordes of “infected.”) I’ll remind readers that I was a fan before the current massive popularly, generally ever since reading Max Brooks’ brilliantly-written survival-guide parody The Zombie Survival Guide: Complete Protection from the Living Dead, and his captivating World War Z: An Oral History of the Zombie War novel.

Zombies seem to be everywhere. There’s even a Wait Wait Don’t Tell Me parody centering on a zombie apocalypse.

LARPing—live action role playing—is detailed in Little Brother, which can be downloaded for free at Corey Doctorow’s site, or, of course, purchased in hardcover.

Somewhere between reading Little Brother and being inundated with zombies, it occurred to me that a zombie hunt LARP would make a great party game for David and his friends on his 11th birthday. Here’s what we did:

  • One person is elected to be the starting zombie.
  • The zombie “infects” others by giving them a gentle Indian sunburn.” (I didn’t want the kids biting each other.)
  • Once infected, a human has wait 30 seconds and then become an active zombie, hunting any human he can find.
  • The only way to stop a zombie is to shoot the zombie in the head with a Nerf gun. Such a shot removes the zombie from the remainder of the round.
  • Zombies move slowly and relentlessly, generally while moaning loudly.
  • The round ends when all human have been infected, or when all zombies have been killed.

Overall, this went very well. Next time, I’ll include a couple of minor improvements:

  • The kids kept barricading themselves in bathrooms. This sort of interior door will absolutely not stop a zombie, but will slow one down for a moment or two. I think to account for this, I’ll have the zombies go back to a central location, and get a paper sign that, when slid under the door, requires those within to open the door.
  • I need to figure out a way to allow for simulation of decapitation by sword. I think a Nerf or toy sword to the neck should work. Water-based magic markers would be fine, too.

There were a couple of really great moments. One was when my sweet daughter Naomi came up to me and gave me the “Indian sunburn.” This was perfectly reflective of the psychological difficulty of fighting zombies who were formerly loved ones. I should have shot her on sight!

Lego_Left_4_Dead_by_XenoPrime
Lego Left 4 Dead: Coming Soon (image thanks to XenoPrime).

(Sadly, you probably won’t see this anytime soon, but you never know. I remember when Lego wouldn’t manufacture Lego weapons for their minifigs.)

What to Do When Comcast’s Norton Security Suite Breaks Your Shared Resources

Comcast has recently switched its provided-for-free antivirus vendor from McAfee to Norton Security Suite, from Symantec. The subscriptions to McAfee Security Suite are due to expire in May. (Norton is named after Peter Norton, a true god of early personal computing utilities back when DOS was king and before all the cool things Peter wrote got licensed by Microsoft for use within their operating systems.

Overall, this is probably a good move, as Symantec’s 2010 offering seems to have recovered its lagging performance, and surged ahead of McAfee in the ratings.

A month ago, I installed Norton on our mostly-gaming-and-homework computer to see how it would run. I hadn’t had any real problem with Norton, and it does seem to be less intrusive than McAfee was, doing most of its scanning during idle times. I also switched our church’s media computer over to use it, and had only one minor problem that a reboot fixed.

(I should interject that “the cloud” has allowed me to radically de-task my specific-machine-focused life, so that, for most of the things that were so critical before, it now doesn’t matter which computer I use. Our wilcoxfamily.net e-mail and calendar are hooked to Google Apps; my notes are in Evernote, frequently accessed files are in DropBox, and even remote access tasks can be handled through LogMeIn.)

Last night I decided to switch from McAfee to Norton on the computer that gets the most use at home. This is the one that hosts our shared printer. I ran the installer from Comcast for Norton, which automatically uninstalls McAfee, lets you reboot, and installs Norton. There didn’t appear to be any problems … until Isaac tried to print from the other machine, and got an error.

I checked the cables, successfully printed from the host machine, but nothing I did would fix the printing. I also discovered that trying to get to my host machine’s C drive from the network wouldn’t work (usually we do \{machinename}c$ to open it as a network share), although the D drive would open. I tried disabling the Norton firewall and anitvirus temporarily, but the network resources still wouldn’t connect.

I fired up a chat session with a Symantec representative named Srini, and he checked my spooler settings. Ultimately Srini wasn’t able to help. While this fairly slow support was going on, I hit the Web, searching for one of the error messages I received while trying to open the C drive, “Not enough server storage is available to process this command.” Among other results indicating the same problem, I found a KnowledgeBase article at Microsoft that describes the symptoms and a possible fix. I also discovered a number of posts suggesting that this was a relatively common problem with Symantec products, although other products or networking configurations can produce the same symptoms.

So, having nothing to lose, I took a stab at fixing the IRPStackSize property in my registry. In my case, the key didn’t exist, so I added it by using RegEdit to navigate to the HKEY_LOCAL_MACHINESystemCurrentControlSetServicesLanmanServerParameters key, and then added a new DWORD named IRPStackSize (the capitalization is important). I right-clicked on the new key, and edited the decimal value to 18 (hexadecimal 12). Then I restarted the computer, which is necessary for the change to work.

Setting the IRPStackSize parameter in the registry editor.
Yep, there's your problem right here: Setting the IRPStackSize parameter in the registry editor.

Upon restart, my network resources were accessible again, and printing to the shared printer worked perfectly. Tonight I’ll try to contact the Symantec representative again and let him know how this was fixed.

How Adam-12 Ruined My Squeaky-Clean Reputation

Courtesy of Netflix streaming over our Xbox 360, my son David (primarily) and I have been enjoying watching Adam-12, the police television series that started the year I was born, and ran for seven years thereafter, and much longer in syndication. Adam-12 was one of my favorite televisions programs when I was a kid, and I remain impressed by its lasting quality, straightforward, honest characters, and clear moral implications. (Director Jack Webb, of Dragnet fame, was clearly not an “everybody’s-doing-it” kind of guy, even in the ’60s.)

Officers Pete Malloy (Martin Milner) and Jim Reed (Kent McCord) from the Adam-12 television series.
Officers Pete Malloy (Martin Milner) and Jim Reed (Kent McCord) from the Adam-12 television series.

In 1978, I was in Mrs. Lovell’s third grade class at Parkview Elementary School, in Easton, Massachusetts.

One day we were reviewing vocabulary with a small reading group after a multiple-choice exercise. The vocabulary word in discussion was heroine, and, among the possible definitions was a medicine.

When the correct answer was given by another student, I suggested, a medicine, getting me quite a troubled look from Mrs. Lovell, who then asked, “Do any of you know what he is referring to?” “Drugs,” answered Dennis, with an implication of disgust.

I’d never heard the female version of hero, but Adam-12 had provided me with an excellent education in the dangers of illegal drug use. In my eight-year-old mind, heroin was a drug, and one obtained medicines at the drugstore, so a drug such as heroin perhaps could be classified as a medicine.

I was too embarrassed by the reactions of my teacher and peers to explain this logic, and the incident eventually became eclipsed by even worse incidents of faux pas that we shall consign to the horrible depths of “the junior high years.”

Adam-12 photograph courtesy of http://www.kentmccord.com.

To Boldly Go: Star Trek Online

A couple of weeks ago marked a watershed moment in MMORPGs: Star Trek Online wrapped up its mostly-open-beta program, and went live with its early-access-for-preorders launch. Delighted with the quality of the game, we sprung for a lifetime membership, which is approximately as costly as paying per-month for a year and a half. (I wish World of WarCraft would offer such a deal.)

The boys and I have been hooked. (Isaac, the weasel, has remained several levels ahead of me, and is about to get a promotion that will give him access to even better ships.) The game features space exploration and combat, and ground exploration and combat. The missions are described as “episodes,” and, like the plots of a television series, often require following unexpected developments and changing tasks as the plot unfolds across planetary surfaces and space. Each player captains his or her own starship, outfitting it with weapons, equipment that gives bonuses, and senior officers who also provide special abilities. I’ve attached a couple of screen shots of the gorgeously-rendered space exploration scenes below. The planets are beautiful, often including moving cloud layers that partly cover the ground below, as well as appropriate atmospheric illumination by the planet’s star, depending on one’s location in orbit.

The USS Naomi, approaching a planet within the Delta Volaris sector.
The USS Naomi, approaching a planet within the Delta Volaris sector.

(My first ship is named the USS Nichelle.)

The USS Naomi, exploring a system in the Delta Volaris sector.
The USS Naomi, exploring a system in the Delta Volaris sector.

Ground locations are often also highly detailed, with a wide variety of plants and terrain. Some of the outdoor ground locations (there are also caves, and starbase and other complex interiors) sometimes seem very reminiscent of the ToS set locations, although generally with more detail than the show’s budget allowed.

Combat and exploration are both integral to the game. Combat is far more skill-intensive than most MMORPGs, particularly as one commands an “away team” to whom orders must be given, and as space combat works in three dimensions and often against multiple enemies. Some missions automatically draft the cooperation of other players, and nearly everything can be accomplished by choice as a teamwork exercise. Like the best MMOs available, there are also large PVP combat areas where players can earn even more rewards.

The game is still in early release, and is apparently only going to get better, but it still shows some weaknesses of an early release with higher-than-expected levels of demand on its servers, and some frustratingly common bugs, such as the game locking up.

Overall, though, our romps through the Star Trek universe have been delightful, with much future enjoyment anticipated.

Addendum, Stardate 201002.18: I am fully convinced that this game was worth every penny. Even my beloved World of WarCraft has never captured me with this intensity.

Beaming out after an away mission.
Beaming out after an away mission.

Rescuing diplomats taken hostage; the end of a truly well-crafted mission series.
Rescuing diplomats taken hostage; the end of a truly well-crafted mission series.

Beautiful environments abound: This is Regulus.
Beautiful environments abound: This is Regulus.

Scanning with my tricorder. What could be better?
Scanning with my tricorder. What could be better?

Approaching Starbase 114.
Approaching Starbase 114.