Archive for March, 2009

Something NOT New for a Change?

March 27th, 2009
Comments Off

I’m never really that surprised when I see the latest gadget on the shelves or on one of the many gadget websites that are for the express purpose of flaunting the fact that you don’t have the latest and greatest “thing”. New things are…. well old. There is always something new. There is always an “upgrade”, “new model” or something “totally revolutionary”.

Revolutionary? That word has been so watered down over the years… it almost lacks meaning altogether. Is shoving 100 gigs of ram onto a USB thumb drive revolutionary? Well, no… cool and complex, but not revolutionary.

Worm Poop in a Jug

Worm Poop in a Jug

Today, I saw something that ACTUALLY impressed me. Not in the “ooh”, “ahhhh”, “gotta have it” kinda way. It caught my attention in the overall purpose and drive behind the innovation. I’m talking about the company TerraCycle, Inc..

Okay, so I’m not typically the tree hugger type, but I consider myself conservation minded. Regardless, this is just cool. TerraCycle, Inc. takes trash, just everyday trash, and makes stuff out of it, reuses bottles and other packaging, etc… What caught my interest is that most other companies continue create new “stuff” that adds to the constant barrage of “buy this” and “get that”, while adding to the mountains of trashed iPods, disc players, spent PC’s and other trendy junk already in the landfills.

While I’m not likely to go out and buy one of their “Capri Sun” handbags or a jug of worm poop, it’s their tactic and business model that I find interesting. What if we applied this to technology? What if instead of making yet another shopping cart, blog system, CMS or code framework, we actually put effort into building on top of or improving what we already have access to? What if we could find TRULY creative ways to reuse the mounds of rejected hardware filling up our landfills for something other than sculptures and doorstops? Sure, there are several developers and companies that do that, but most don’t plain and simple.

I think perhaps there is a lot to be learned by looking at this way of doing business, not only as individuals but as an industry. As developers, can we add value to our industry and the world? Or are we filling the net with endless piles of already done cruft destined to be forgotten about next week for the latest and greatest cruft? Admittedly, every day of our career can’t be overflowing with pure innovation and meaning, but looking at TerraCycle, Inc. has me thinking about how I will spend my energy and resources in the future.

See a video about TerraCycle at CNN.

Reviews, Technology , , ,

GE Brings Minority Report to Life?

March 9th, 2009
Comments Off

Okay, well not quite, but I thought this was pretty amazing. GE “brings good things to life”, almost literally.

Tom Cruise doing virtual computing

Tom Cruise doing virtual computing

For those of you that have seen Minority Report, you know that that people have been trying to recreate that type of computing model in the real world since the movie came out. Well, it doesn’t quite exist yet, but GE may be headed in the right direction.

Tom Cruise doing virtual computing

Tom Cruise doing virtual computing

As a way to draw interest to their Smart Grid energy technology, GE has created an interactive 3D experience that is pretty startling at first. It almost seems unreal… until you realize that it is actually interacting with you. Check out a video of the guys at experiencing this first hand, although you will want to try it out for yourself.

Okay, so it’s not quite Minority Report level computing. However, with the live human 3D interaction inside of a virtual, yet real, space, all done in the comfort of your browser using Adobe Flash… this is quite amazing, nonetheless. I would love to see this kind of technology take off and be available in a browser… maybe we’re not far off.

Flex, Technology , , , , ,

Variable Conflicts in JavaScript

March 8th, 2009
Comments Off

It is quite common to find yourself with a heinous JavaScript error on a page that until recently seemed to work flawlessly. Perhaps you changed your JavaScript. Maybe you included a 3rd party script or a script from another domain onto your page. Now, everything that was once peachy has turned to sour grapes!

More than likely the problem is that with all the varying scripts on the page, variables from other functions will conflict with variables in the existing code, causing failures and errors, and even worse, overwrite variable values without any notification. It can take hours to track down variables that conflict between scripts before it finally works. Some developers figure that these kinds of issues are probably just inherent in client-side web development and use that as another “reason” as to why JavaScript is inferior.

I don’t think client-side development should be looked at as inherently quirky. Sure there are some browser nuances and environment issues that you can’t control, but you can develop very robust code that works well and adequately serves its purpose.

There are a few key things that you can do to make sure you code is clean and runs in it’s own scope.

First, anytime you create a variable in a function that should not be available outside of the function use the “var” identifier to initialize the variable and restrict it to the local scope.

var item_count = 20;

Second, I would recommend putting much of your code into JavaScript prototype objects. The prototype method of creating objects is JavaScript’s way of creating a class-like object (although prototypes are quite different from actual classes, read up on JavaScript prototypes for more info). In short they allow you to create a group of related function that can share assets between prototype functions (method equivalents).

// start by creating your initial prototype function, like a constructor
function Calendar(month, year)
    this.month = month;
    this.year = year;
    date = new Date();
    this.current_year = date.getYear();

// create functions that inherit characteristics of the prototype Calendar
Calendar.prototype.display_Month = function()
    var max_days_in_month = 31;
    ... continue body of function

// reference variables from the prototype using "this"
Calendar.prototype.display_Week = function()
    if(this.year < this.current_year)
        // return error of some kind
    ... continue body of function

Later in your code you can instantiate one or more of the prototype classes, each having their own scope and assets. This will keep them from conflicting with any other code.

cal_1 = new Calendar(5, 2005);

cal_2 = new Calendar(3, 2006);

If you abstract your code well enough, using the power of JavaScript in this manner allows you to create very reusable code that can be used in any application with any combination of JavaScript without problems. There are other things you can do to abstract your JavaScript and make it more functional, but these examples serve the purpose of resolving scope issues and get you on the road to cleaner, reusable code.

Development, JavaScript , , , , , ,

Sponsored Links

agile ajax black hat Cake PHP centering clifford stoll css cuckoo's egg energy energy drinks espionage flash Flex hacker jquery modular MVC objects optimization performance PHP script timer smarty smarty templates stylesheet up-time uptime variable scope web 2.0 Zend Framework