Building a Future with LEGO: My Nephew Andrew Roberts

8 02 2012

(Excerpt from the Community Advocate Newspaper, Friday, February 3, 2012, article by Sue Wambolt, Contributing Writer.)

Marlborough – Prior to November 2011, Andrew Roberts worked for County House Research performing in-court background checks. By the end of November, though, he retired to pursue his lifelong passion, building Army tanks with LEGOs.

Lego tank and APC, designed and built by Andrew Roberts.

A sample of the many tanks that can be built with Andrew Robert’s LEGO kits.

Roberts’ love for LEGOs began at age 5 when he was given a big bucket of the brightly colored building blocks as a gift, and he has been playing with them ever since. About two years ago, Roberts heard about a man who was building World War II tanks out of LEGOs. Intrigued, he decided to build his own LEGO tank which he then put on eBay – and it sold. He made another and it sold as well, snowballing into something bigger than Roberts could have anticipated.

… Read the full article at the Community Advocate Newspaper site.

Andrew Roberts poses with a Lego M1 tank he designed and built.

Andrew Roberts has made building with LEGOs a full-time business.

To see or purchase any of Andrew’s sets or instructions, visit his eBay store: http://stores.ebay.com/Battle-Brick.





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

10 06 2011

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!





Nope, Nothing Familiar Here

5 06 2011

On the left is Psycho, with his nanosuit in strength mode, from the Crysis game. On the right is a movie poster from Green Lantern. See any similarities?

Of course, this isn’t the first time the Crysis Nanosuit has been copied in film. [cough]GI Joe: The Rise of Cobra[/cough].





Minecraft

25 05 2011

We became involved with Minecraft early in its beta development cycle. Frankly, it’s been amazing and fascinating. We operate our own server at home, modded with Runecraft so we could make teleporters (generally it’s up from early evening until the morning), and have started to add more users to the system. There are still some open slots, if you’re interested in joining us.

The new addition of powered rail boosters has gotten us rail-and-rollercoaster-crazy.





My Little April Fool

2 04 2011

When I got home yesterday, I discovered that NaNi had put her snow day time to very good use.

R2 looks a little different. But he does have a huge smile.

"Dad, please lifted up the helmit."

Under the helmet ...

NaNi did some redecorating.

"Hay, you. Kiss me, please."

"No. Well, just one. I love this!!! Happy April Fool's Day. I love you, Dad. "Thank you for the kiss, you kind Jedi."

I love the details. Lipstick attached to the phaser.

... and matching shoes.





On the day in 1958, The World Changed

28 01 2011

For devotees, [today is the anniversary] of an event in Copenhagen that transformed toys and revolutionized childhood itself.

It was at 1:58 p.m. on January 28, 1958, that then-Lego head Godtfred Kirk Christiansen filed a patent for the iconic plastic brick with its stud-and-hole design. Since then, the company has made a staggering 400 billion Lego elements, or 62 bricks for every person on the planet. And if stacked on top of one another, the pieces would form 10 towers reaching all the way from the Earth to the Moon.

This Lego Logo is composed entirely of Minifigures.


(Image credit Lee LeFever, Creative Commons License.)

Read more at Time.com.





Lego 3D Printer: Amazing!

19 10 2010

From MLCAD to Lego Model … all via some sweet Lego ‘bot construction. Awesome.





Rope-Climbing Lego NXT Robot

10 06 2010

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.





It’s Lego!

30 04 2010

Thanks to Bob Richardson.





LARP or Party Game: How to Play “Zombies”

25 04 2010

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.)