Sunday, February 19, 2006

Geeks Only - AJAX - Can it clean my code ??


There has been alot of buzz during the past year regarding a web development technology named AJAX, which is short for Asynchronous Javascript and XML. Google has popularized this technology with their breakthrough mapping web site Google Maps - which allows users to "grab" their maps and scroll them interactively on the web browser without forcing the browser to refresh or to visibly submit requests back to the server as in traditional browser scenarios (i.e. Yahoo Maps).

This is achieved by using client-side JavaScript to send asynchronous remote procedure calls and then parsing the results (usually XML-based results) which are used to perform logic or to render in some fashion on the browser. This type of functionality was usually the domain of “server-side” web code where developers were required to utilize XML libraries consisting of XML Parsers, XML DOM objects, XSLT/XPATH objects and also some form of data access or web services integration. All these facilities are now available from client-side JavaScript when using AJAX.

3 Major Technology Elements of AJAX
  • Javascript – the scripting language used to implement AJAX functionality
  • XMLHttpRequest – XML RPC object used to send asynchronous remote procedure calls
  • XML DOM - XML Document Object Model objects used to encapsulate and parse XML.

Now lets not get things twisted, AJAX is not some hot new technology that some geekoid deep in Google's basement just invented; rather it's a nexus of maturing technologies that come together very well when trying to overcome the traditional deficiencies with implementing rich, interactive web user interfaces. I've previously implemented AJAX-like functionality using Microsoft's Remote Scripting roughly 5 years ago (around 2000-2001) and not too many programmers had a clue on what it was and how it worked; actually - at the risk of getting you Java and LAMP coders pissed off - Microsoft was also central to the birth of the XMLHttpRequest object ... but I digress...

Let's look at a Google Maps coding sample below to get an idea of a real-world AJAX implementation. Pay special attention to the AJAX relevant code in dark red. This example provided by the Google Maps API Documentation is used to (A) download a series of longitude and latitude coordinates from an XML file. These coordinates are (B) loaded into an XML DOM object then (C) parsed out to (D) dynamically create the Google Markers which are then rendered on the map.

============ BEGIN CODE SAMPLE ============
// Center the map on Palo Alto.
var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);

// Download the data in data.xml and load it on the map.
// The format we
expect is:
// <markers>
// <marker lat="37.441" lng="-122.141"/>
// <marker lat="37.322" lng="-121.213"/>
// </markers>

// CREATES XMLHttpRequest object
var request = GXmlHttp.create();

// A) INVOKES HTTP GET REQUEST TO RETRIEVE XML
request.open('GET', 'data.xml', true);
request.onreadystatechange = function()
{
if (request.readyState == 4)
{
// B) LOAD UP XML RESULTS IN XML DOM OBJECT
var xmlDoc = request.responseXML;

// C)PARSE XML AND RETRIEVE MARKER VALUES
// INTO ARRAY OF XML NODES

var markers = xmlDoc.documentElement.
getElementsByTagName("marker");


for (var i = 0; i < markers.length; i++)
{
// D)CREATE NEW GOOGLE MARKERS FROM LONGITUDE
// and LATITUDE VALUES

var point = new GPoint(
parseFloat(markers[i].getAttribute("lng")),

parseFloat(markers[i].getAttribute("lat")));
var marker = new GMarker(point);
map.addOverlay(marker);
}
}
}

request.send(null);
============ END CODE SAMPLE ============

To summarize, AJAX is a set of maturing software technologies primarily based on JavaScript and XML, when used together, provides the web developer with a powerful toolset to create rich and interactive web browser applications and user interfaces.

Resources:

Wednesday, February 15, 2006

Medicine - Stem Cells - A Primer

image : © 2005 Advanced Cell Technology

Stem cells have been at the heart of serious debates between all types of politicians, bio-ethicists, church groups, patient advocacy groups, liberals, conservatives and everyone in between. Unfortunately, many people don't understand what the hoopla is all about, so here's a quick introduction on the subject.

A stem cell is a generic type of cell that has the ability to renew itself for long periods of time (or indefinitely in some cases) and has the amazing ability to become one of a host of different cell types including heart cells, skin cells, liver cells, muscle cells, nerve cells and others. This "specialization" process that occurs when a "generic" stem cell becomes a specific type of cell - is called differentiation.


A large population of scientists, doctors and patients are very excited because they envision stem cells providing a nearly infinite supply of new cells that can help fight a variety of medical conditions and diseases that tend to destroy cells in their path - some examples include Parkinson's disease, diabetes, chronic heart disease, end-stage kidney disease, liver failure, and cancer.

So you're probably asking, "what the h@ll are we waiting for ... let's go cure some diseases" - well its not that simple. It seems that all stem cells are not created equal. Stem cells come in different flavors, we'll focus on the following 2 flavors:

  • pluripotent - this stem cell can become any type of cell in the human body.
  • unipotent - this stem cell can only become one type of cell or a small set of cell types of a particular tissue in the body (for example - only cells that are found in the liver)

Now, unipotent stem cells have been found in several areas of the adult body including the bone marrow, blood, the cornea and the retina of the eye, brain, skeletal muscle, dental pulp, liver, skin, the lining of the gastrointestinal tract, and pancreas. Even though several sources and types of unipotent stem cells have been found they are rare and difficult to isolate from the adult body.

It should be obvious that the pluripotent stem cell is much more valuable since it can become ANY type of cell in the human body versus only one type of cell but here's the catch !! -- this type of stem cell has only been found in embryonic tissue of early stage embryos.

To clarify, pluripotent stem cells are found in embryonic tissue and are usually referred to as embryonic stem cells while unipotent stem cells are found in adult tissues and are usually referred to as adult stem cells.

This is why the stem cells issue has been so contentious in America - because it ran smack into the middle of the entire pro-life / pro-choice debate and as we all know - no matter what side you're on -America is split right down the middle on this topic.

  • When does life begin? At conception (a fertilized egg)? or when the heart starts beating?
  • When does a fetus gain recognition as a citizen and afforded protections by the law?

Embryonic stem cells provide an interesting twist to this debate since they may hold the potential for significant medical breakthroughs that affect millions of diseased Americans today. We will delve deeper into the science, the politics and the major players involved in a future blog post.

Some additional resources:

National Institutes of Health - Stem Cells
University of Wisconsin
President Bush Stem Cell Speech - 2001
Advanced Cell Techonogy

Saturday, February 11, 2006

Geek - The Commodore 64 - Coding in the hood

As geeky as this may sound, there was probably no larger influence in my life during my adolescent years in the ghetto then my introduction to the Commodore 64 (C64) computer. I was first given the Commodore VIC-20 as a present and then one of my friends got the C64 and then all hell broke loose. We all start getting the C64 - probably a group of 5 of us including my older cousin - we'll call Junior.



One day Junior and I went to the Gaming store in the Gallery located in Philadelphia (across the bridge from Camden, NJ). We were checking out all the games on the wall for the C64 and we knew that we'll only be able to get one - if that (I think they were $10 at the time) until the friendly store clerk - a black man probably in his late 20's - named Will Hines, looked at us and said "You can either get 1 game for $10 ... " as he motioned to the wall of games - "... or you can get them ALL for $10 ... " --- I had no clue what this guy was talking about but I knew I wanted to know more but my cousin, a street-wise opportunist, engaged in a conversation with Mr. Hines and 250 games and 12 months later, the entire ghetto crew were copying and bartering games amongst themselves and others at a furious pace - we called ourselves the Camden Commodore Crew or CCC.

My cousin's tagline was "Cosmic Kid" and I was "The Master" along with "Karate Kid", "Vidd Kid", the "Boy Wonder" and a couple of others. Cosmic Kid was always a couple of steps ahead of us, he learned how to crack games and read & write in Assembly language and before we knew it - we were loading up games to play and a big splash screen with awesome graphics and calligraphy text stating



CRACKED BY
COSMIC KID

will splash across our screen. We were in absolute awe and couldn't believe he actually altered the code of the game itself to show his name and tagline. My cousin was soon writing his own games while another crew member Raymond Searles (his tagline escapes me at the moment) was providing the code for the sound effects and music. Ray was an expert on the C64 sound chipset and astonished us all when he authored "Who's that Girl" using Music Shop for the C64 and his keyboard. One of the absolute funniest guys you can ever meet.

One of my best friends "Boy Wonder" was poorer then the rest of us (raised by his grandmother)-- so he couldn't afford the 1541 floppy drive that u needed to play the games on the C64 - so he did what any other poor, motivated computer geek wanna-be in the hood would do - he stole the 1541 Floppy drive from our high school - Camden High. Once the C64 got popular amongst the general public - Drug addicts were coming up to me at my parent's grocery store - where I worked at night throughout most of my teenage years - trying to sell me 1541 Commodore drives for $10 (retail was around $250 dollars).



I was amazed to see how many hood-rats were involved in computer gaming and hacking. One of the most vivid memories I have is being in this guy's house somewhere in some West Philly neighborhood while he was hacking apart a C64 Fast Load cartridge and wiring a special reset button. This reset button allows anyone who was loading a game using the 1541 floppy drive while using the Fast Load cartridge to enter straight into a "disassembler" program allowing the hacker to alter the actual machine code of the game.

By the time I hit high school (1985), I was constantly playing dozens of games on the C64 when one game by a young company named Electronic Arts changed the way I thought about computers, gaming and life.
The Bards Tale. I never experienced such an overwhelming addiction to anything (sex was still a couple of years away for me) then the game play, the music, the story, the maps and the overall sensory experiences of playing this game. I could not stop playing and I used to put a large metallic cup of ICE on top of my power supply so that it wouldn't overheat - especially during the 24 or 36 hour gaming sessions I would sometimes have playing The Bards Tale.

The Bards Tale">

This game came at a critical time for me personally (and for my friends), I was 14 years old and already losing my interest in being a "good student" - I was hanging on the streets ALOT - don't get me wrong - I was generally a good kid but most of my street friends were already making money selling cocaine to the line of cars driven by subarban professionals that were always camped out near the hot drug corners, or they were smoking weed or were involved in sticking up (robbing) people or playing with weapons and I didn't want to be part of that bullshit - I just wanted to play with the C64, play sports and "play" with the great group of girl friends I had at Camden High. I sincerely believe if the C64 wasn't such a big influence in my life at this critical time I would have gone down a more perilous path growing up in Camden, NJ during the mid 80s.

Where are they now ??
  • The Master (me) - Successful software consultant and .NET architect
  • Cosmic Kid - Successful software engineer and Computer Science graduate of Rutgers University
  • Vidd Kidd - Successful financial analyst with a Bachelors degree and a law degree from the University of Nebraska (also played for the Nebraska Cornhuskers)
  • Karate Kid - Successful software engineer for Comcast Corporation and Computer Science graduate.
  • Boy Wonder - Successful tugboat captain and aspiring Docking Pilot
  • Ray Searles - Deceased.