Monday, December 18, 2006

Instance Variables

For my fellow students/programmers (and tutees):

Instance variables are variables that are declared at the top of a class. They are created any time an object of that class is instantiated. Hence, their name.

For example:

In my previous blog entry I talked about constructors and my examples there made use of an Employee Class and the instance variables name and id. I'm going to show an example of an employee class that has both an empty constructor, a constructor with parameters, and instance variables. So let's see what a simple Employee class would look like for VB .Net and for Java. (By the way, an Employee class is an excellent example of a type of class that would go into a Class Library of an application)


**** VB .Net ****

Public Class Employee

Private name As String
Private id As String

Public Sub New()

End Sub

Public Sub New(ByVal newName As String, ByVal newId As String)

name = newName
id = newId

End Sub

End Class

****

**** Java ****

public class Employee {

private String name = null;
private String id = null;

public Employee() {

}

public Employee(String newName, String newId) {

name = newName;
id = newId;

}

}

****


Next time: VB .Net Properties and Java getters & setters

Sunday, December 17, 2006

Object instantiation

For my fellow students/programmers (and tutees):

Objects are instantiated using the new keyword regardless of whether you're using VB .Net or Java. The keyword new is then followed by the class name of the type of object you want to instantiate. This is because as I said before, classes are object definitions.

First, however, you must declare the object reference's variable name.

For example:

**** VB .Net ****

Dim [object reference variable name] As [Class Name]

****

**** Java ****

[Class Name] [Object reference variable name];

****

Then you can instantiate.

For example:

**** VB .Net ****

[Object reference variable name] = New [Class Name]

****

**** Java ****

[Object reference variable name] = new [Class Name];

****

You can also do both at the same time in either language.

For example:

**** VB .Net ****

Dim [Object reference variable name] as [Class Name] = New [Class Name]

****

**** Java ****

[Class Name] [Object reference variable name] = new [Class Name];

****

So if we were wanting to declare a variable and instantiate it later, we would do the following:

**** VB .Net ****

Dim emp as Employee

emp = New Employee

****

**** Java ****

Employee emp = null;

emp = new Employee();

****

Or if we were doing both at the same time...

**** VB .Net ****

Dim emp as Employee = New Employee

****

**** Java ****

Employee emp = new Employee();

****

Note also that scope can be assigned to variables whether they are object references or primitive types. The same scopes used for methods can be used for variables. In case you forgot, they were:


  • Public

  • Private

  • Protected

  • Friendly



For example:

**** VB .Net ****

Private letterGrades as String() = {"A", "B", "C", "D", "F" }

Private emp as Employee = New Employee

****

**** Java ****

private String[] letterGrades = {"A", "B", "C", "D", "F" }

private Employee emp = new Employee();

****

Note also that class names are always capitalized in Java. It is a naming convention. It doesn't hurt to follow that naming convention in VB .Net either.

Also notice that Java's use of the word new requires that the class name after new have parentheses after it. That's because when you instantiate an object, you're actually calling a method. VB .Net doesn't require the parentheses like Java does, but also won't complain if you use them.

When you instantiate an object, you're actually calling a particular kind of method known as a constructor. Constructors, like other methods, can take arguments. They specifically are methods that the computer uses to know how to create the object you're instantiating.

If a class doesn't have a constructor explicitly coded into it, the compiler automatically creates one when the class is compiled. Specifically it creates what is called an empty constructor because its parameter list is empty.

An empty constructor looks like this:

**** VB .Net ****

Public Sub New()

End Sub

****

**** Java ****

public [Class Name]() {

}

so for an Employee class, Java would have:

public Employee() {

}

****

You can also create constructors explicitly in your classes that have parameters. However, if you do code one, the compiler will not automatically create an empty constructor for that class. If you want both, then you need to explicitly code the empty constructor and the constructor with the parameters you need.

For example:

If we were to have an Employee class that required that every Employee object have a name and employee id, then we would code the following constructor in our Employee class. Some people like to use the same name for the parameter as for the instance variable. I'll talk about instance variables next. I like to use the convention of each parameter having the same name as the instance variable preceded by the prefix "new".

**** VB .Net ****

Public Sub New (ByVal name as String, ByVal id as String)

Me.name = name
Me.id = id

End Sub

I like the prefix new because it makes each statement actually read like an english sentence. Also you don't have to worry about scope and therefore can skip the keyword "Me" in VB .Net and "this" in Java to designate the left hand variable as being the instance variable rather than the local variable. This is because when you have variables of the same name, the most local one is used. Hence name in the above example is the parameter and Me.name tells the computer to use the instance variable (object-level variable) name.

Hence, I usually code the above example like this:

Public Sub New (ByVal newName as String, ByVal newId as String)

Name = newName
Id = newId

End Sub

****

**** Java ****

public Employee (String name, String id) {

this.name = name;
this.id = id;

}

OR

public Employee (String newName, String newId) {

name = newName;
id = newId;

}

****

Finally, one important thing to note that will help debug your programs. When you run into the run-time error Null Reference Exception, this means that an object reference variable you declared and were trying to use had not been instantiated before the program reached that statement in your code. So find where the instantiation of the object should have taken place and put it in!

Next time: Instance Variables

Method declarations

For my fellow students/programmers (and tutees):

Like variables, methods are another foundation of programming languages. They are the pieces of code that do all the work in every Object-oriented program.

So what do methods look like?

Every method should have the following pieces:


  • A method header

    • A scope

    • (VB specific) A overrides or overloads keyword when necessary

    • An state of implementation

    • (Java specific) returned data type

    • (VB specific) Method Type

    • A signature, comprised of the following:

      • A name

      • A parameter list


    • (VB specific) As clause for returned data type


  • A body of code

  • (Function specific) a return statement

  • A code block ending




The Scope

The scope is indicated in both VB .Net and Java by one of four keywords:


  • Public - indicates the method is available to all other programs/classes/modules

  • Private - indicates the method is available to only this program/class/module

  • Protected - indicates the method is available to objects that inherit this class

  • Friendly - indicates the method is available to other programs/classes/modules in this assembly (grouping of applications/programs that constitute the current system)



Overrides/Overloads

Overrides indicates in VB .Net programs that the method replaces another method in a class this class inherits its members from. I'll talk about members and inheritance later.

Overloads indicates that there are more than one method with the same name, but not the same signature (i.e. they use the same name, but have a different parameter list).

State of Implementation

The state of implementation defaults to non-shared in VB .Net and non-static in Java. Neither of those two states in either language require any keywords in the method header. However, non-shared and non-static methods require that the class they are a part of be instantiated as an object instance. I'll talk about instantiation and objects later.

The shared or static state of implementation require those words as keywords in the method header. Shared/static means the method is available regardless of how many times the class has been instantiated, including zero times. Hence, it is always available. However, this method can only be running once at any given time. This makes it ideal for data access classes.

The Method Type
The method type is only required in VB .Net and must either be a subprocedure denoted by the word sub or a function when returning a value denoted by the word function.

The Signature
The signature consists of two parts:

The Name
The name can be anything, but should indicate what the code inside of the method does. In Java, the naming convention for methods is the following:

[lower case verb]([Capitalized adjectives])[Capitalized noun being affected]

For example: calculateEmployeePayroll

The Parameter List
The parameter list is the entire list of information the method requires from external sources to perform its code block. Each parameter always includes a name by which the incoming value will be refered to inside the method, and a data type telling the computer what kind of memory format it needs to store the parameter in memory.

The Method Body (Code Block)
This is the portion of the method where all its work is performed to change its inputs into the values the method is meant to create to either affect information within the module or to pass back to the calling method as a single data type.

The Return Statement
The return statement is for a type of method often called a function (as opposed to a subprocedure (or sub for short) ). It is this statement that tells the computer what this method is going to return to its calling method. The data type the return statement is required to give back to its calling method is determined by the returned data type before the function name in Java and as part of the As clause in VB .Net.

Code Block Ending
In Java, the method must have a beginning code block character "{" and then a code block ending character "}" at the end of its code statements. In VB .Net, a function requires a end function statement or an end sub statement depending on the method type.

Next time: Object instantiation

Declaration of Variables

For my fellow students/programmers (and tutees):

In most languages, you have access to the following simple data types:

Boolean (true/false)
Numeric (numbers)
Character ((nearly) any symbol)

Depending on the language, they are further distributed into the following flavors often called primitive variable types.

Boolean
Boolean

Numeric
Integer
Long
Single
Double
Decimal
Date (often a long representing milliseconds since an arbitrary base date)

Character
Character
String

Strings and dates, however, are most often special cases in Object-oriented programming languages. It has to do with how the computer needs to handle the ways we usually use them.
Hence, they often end up being given some of the same simple forms of manipulation available to primitive variable types, but are actually implemented as objects. Take Strings for instance.

Strings are actually arrays of the Character data type. They also need a great deal of functionality placed into them due to the diversity of the ways we manipulate our spoken and written languages.

Dates similarly are very diverse due to the various cultures and revolutions in time-keeping over the years.

Since variables are a primary foundation of programming, programming languages have strived over the years to keep the means of informing the computer what is required of it down to a minimal and simple syntax.

For instance:

**** Variable declarations in VB .Net ****

dim [name] as [data type] (= [value])
dim [name, name, ...] as [data type]
dim [array name]() as [data type]
dim [array name] as [data type]() = { [value1, value2, value3, etc...]}

****

Why does VB .Net follow this convention?

Visual Basic is simply a GUI-type (hence, Visual) programming language that was created using the old Basic programming language syntax for its code syntax.

Basic used the abbreviation "dim" to mean "dimension". Or perhaps to make the statement sound more like an English sentence:

dim i as integer

is actually telling the computer:

"Dimensionalize i as an integer data type"

Meaning allocate room in system memory for a data type that can be stored as a binary numeric value.

You may also notice that Visual Basic doesn't allow conversion to integer with its convert abstract class. Rather it has as part of its convert abstract class:


  • convert.toInt16([value])

  • convert.toInt32([value])

  • convert.toInt64([value])



(Although it does have an old function called cint([value]) that does go to the generic integer type (i.e. the computer assigns an integer of appropriate bit-size as needed))

It used to be that Integer was simply an 8-bit (1 byte) number stored as a binary value. Hence, it could handle values between -127 and +128 or optionally 0 to 255.

A 16-bit integer handles values between -32167 and 32168 or 0 and 65535.

The old data type Long is a 32-bit integer. It handles values from -2147483647 to 2147483648 or 0 to 4294967295.

A 64-bit integer is a newer creation as memory available has increased significantly over the past years. It can handle values between -9223372036854775807 and 9223372036854775808 or 0 and1844674407370955161!

The decimal data type is used primarily for currency as it defaults to 2 decimal places in most instances when used.

The single is an older, smaller version of the double data type and is rarely used any more due to the current availability of memory. The double can handle very large numbers and both it and the single could handle decimal positions unlike integers. It is because of the capabilities of the double that most modern programming languages actually convert values to doubles internally before performing division operations. Some languages handle all calculations using the double data type to maintain precision throughout.

**** Variable declarations in Java ****

[Data type] [variable name] (= [value]);
[Data type] [variable name1, variable name2];
[Data type][] [array name] (= {[value 1], [value 2], [etc ...]} );

So as to avoid confusion, let me give an example of an array for Java as java syntax uses brackets for array index notation:

String[] letterGrades = {"A","B","C","D","F"};

****

Next time: method declarations

Looping

For my fellow students/programmers (and tutees):

Since the primary purpose of any system is to reliably recreate the same transformation of its media over and over again, and programs are systems, we need some means of creating repetition in our programs. This is done with loops.

Regardless of what programming language you're in, there's at least one way to perform a loop. However, this form of logic is so important that modern programming languages have four commonly used looping syntaxes.

The question becomes which one should you use?

To answer that question, I have a little spiel that give to those I'm tutoring.

Basically, the order of priority for looping syntaxes is followed best by answering a list of questions you should ask yourself in the following order (that parallels the priority of looping):

Do you have a collection (or even an array in some languages)? Then use the following loop type:

1) For each [item] in [grouping]

(repeated code block using [item] as a reference to the current item in this iteration)

For example:

Given an employee list is an ArrayList called employeeList and the for loop has access to a class called Employee...

**** For Each in VB .Net ****
For each emp as Employee in employeeList

[repeated code goes here]
[using emp as a reference to the loop's current Employee]
[object in your ArrayList called employeeList]

Next
****

In Java, given a HashMap of employees called employeeMap with a key-value pair of [employeeId and Employee object], your code would look like this:

**** "For Each" in Java ****
Set employeeSet = employeeMap.entrySet();

for (Iterator i = employeeSet.iterator(); i.hasNext();) {

Map.Entry mapEntry = (Map.Entry) i.next();
String empId = (String) mapEntry.getKey();
Employee emp = (Employee) mapEntry.getValue();
[repeated code goes here]
[using empId as a reference to each employeeId]
[String and emp as a reference to each Employee]
[object in your HashMap called employeeMap]
}
****

If you don't have a collection, do you have an array or at least an indexed grouping of variables or objects? Then use a simple for loop:

2) for [index] [initial starting value] [maximum value] [incremented by this value]

(repeated code block using [array] at [index] in this iteration)

For example:

Given an array of grades called letterGrades

****Simple for loop in VB .Net****

For i as Integer = 0 to letterGrades.length

[repeated code using letterGrades(i) as a reference to the current element in the array]

Next

****

****Simple for loop in Java ****

for (int i = 0; i<letterGrades.length;i++) {

[repeated code using letterGrades[i] as a reference to the current element in the array]

}
****

If you don't have a collection or an indexed grouping, do you need a loop that must be performed at least once? Then use a Do Until Loop

3) [Loop start]

[code to be repeated and must be executed at least once goes here]

[Loop end with condition]

For example:

Given a menu must be displayed in a console application at least once to receive input, even if the first option the the user selects is the quit option.

**** Do Until Loop in VB .Net ****

dim quitProgram as boolean = false
Do
[display menu here]
[receive user selection here]
[option selection handling goes here]
[if option to quit was selected]
quitProgram = true
Loop Until quitProgram = true

****

**** Do Until Loop in Java ****

while true {

[display menu here]
[receive user selection here]
[option selection handling goes here]
[if option to quit was selected]
break;

}

****

If all of the above options have been exhausted, it is likely you just need to loop an unknown number of times and the number of times may include 0 (i.e. don't loop at all). So use a simple while loop.

4) [While (condition is true) ]

[code to be repeated unknown number of times]

[end of while loop]

For example:

Let's say you need to read a file and process each line as a record.

**** Simple While Loop in VB .Net ****

At top of code: Imports System.IO

Dim sr As New StreamReader(New FileStream("[filepath]", FileMode.Open))
Dim input As String
Dim record() As String

While sr.Peek <> -1

input = sr.ReadLine
record = input.Split("[delimiters]".ToCharArray)
[code to manipulate each record's elements goes here]

End While

****

**** Simple While Loop in Java ****

At top of code: import java.io.*;

BufferedReader br = new BufferedReader(new FileReader(new File("[filepath]")));
String input;
String[] record;

while (br.ready()) {

input = br.readLine();
record = input.split("[delimiters");
[code to manipulate each record's elements goes here]

}

****

Next time: Declarations of variables.

The constituents of an Object-oriented application

For my fellow students/programmers (and tutees):


  • User Interface Layer

  • Controller Layer

  • Data Access Layer

  • Class Library



Object-oriented applications rely on these four groups to create a unified whole that is flexible, diversifiable, and easily deconstructed and reconstructed to fit the current situation. In fact, it is a reflection of the present-day urban business.

Consider that businesses have a similar set of layers:


  • Public Relations (Customer Service, Human Resources, etc)

  • Management (Executives, Board of Directors, Middle-management, etc

  • Storage (Warehousing staff, Database Administrators, Distribution, etc

  • Business-specific staff (stockers, clerks in retail; laborers in manufacturing, etc



In fact, parallels could be drawn between programs and nearly anything due to the fact that applications are systems and everything can be interpreted as a system using the broadest interpretation of system.
That being that systems have:


  • Inputs/Outputs - points of interaction between itself and its environment

  • Governance - rules that determine its behavior

  • Liminality - an internal environment or threshold state for the media it works upon

  • Internals - The internal constituents/structure that enacts change



Programs, specifically, are information manipulation systems.

When we also consider that every activity furthers our understanding of Existence (and we all hope for the better), that programs often refine data into information to enhance that understanding, and that programs are systems and, therefore, can virtually parallel anything (pun intended?), their diversity and reusability is paramount.

But let's come back down to Earth again. Our programs need to be practical and deal with the here and now because that's where we're at. As such, it is best when creating every program to start with something very specific and not as reusable since we're often facing deadlines and it keeps things simpler when we code this way. However, as your experience as a programmer progresses, you'll start seeing parallels in your code. Specifically, code blocks that are repeats of work you've done before. That's your cue to create a more general block of code that you only need create once (more) and then call (make use of) in your other programs.

That's precisely where our philosophy and reality meet in the object-oriented model (and programming in general to an extent).

We create the user interface as a separate set of code so if we need to migrate our application from a console to a GUI operating system or even to the web, we can simply deconstruct our application by pulling our UI layer out and putting a different one in.

We use the same idea with our data access layer. We may need to migrate our application between a file system, a database, or other external datastream like a raw data-collection device such as the LEAP I mentioned before.

The reason I separated the control layer from the class library is that we may also want to move and reuse our business virtual objects to another application. Or perhaps we have multiple applications relying on working with the same entities our business deals with. Ensuring consistency in how they are conceived and manipulated goes a long way towards creating a reliable system for the entire business.

Effectively, the only thing that is "stable" then, is what is often called our business logic which should be contained entirely in the control layer. This makes sense as once we have a singular business process created in code, it is unlikely to change as our business's stability is relying on the rules that govern it as its foundation. In case you don't think that's true, then it is likely the process you are considering is actually more than one process. Recall what I stated before about our objects. It also holds true to their methods:

"One of the major philosophies behind object oriented programming is a separation of processing into re-usable bundles that handle anything and everything related to a particular entity, be it a cultural or natural category, but no more. Indeed, what is put into practice is often less and that is a good thing as it increases the likelihood of reusability and you can always add more later."

Hence, a singular business process should go unchanged. Rather a collection of processes may increase their number or order of execution to handle new challenges or broaden their scope of capability.

So how does this all look in practice? I did promise to show how they interact...

Basically, the control layer is entirely a coordinator of active processes that are required to accomplish a particular series of tasks to enact a particular business practice.

As an example, since the current trend is towards web-based applications, even for in-house operations, the current model of processing is event-driven. This basically means that an application looks for particular events to occur and then launches processes that handle or respond to those events. The reason this is the case is the underlying logic and physical properties of the web.

Specifically, the web model includes a page that is inactive until the user triggers an event that requires a response from the server providing the web page. Then a new page is generated (for dynamic content web pages) or simply sent (for static content web pages).

The controller layer then determines what should be done based upon the information sent to it by the UI layer. It may have to call upon the data access layer to get information required to generate the appropriate response or instantiate new objects in the class library or likely both. It then controls the processing the data access and class library should do and finally constructs a set of information to send back to the UI. The control layer may even tell the UI to change which page or format the UI should display the information in. The UI then generates the newly received information from the control layer into the format the control layer specified.

Notice that the user interface layer, the data access layer and the class library never have direct communication with one another. This means that any of those pieces can be replaced with new pieces as needed to handle the current demands of the business. Visually, the interaction should look like this:



Next time: Besides reusability, programs rely upon repetition. Indeed, systems and computers especially are used primarily to do repetitious work and do it fast. Hence, I'll next talk about looping logic.

Object-Oriented Philosophy

For my fellow students/programmers (and tutees):

One of the major philosophies behind object oriented programming is a separation of processing into re-usable bundles that handle anything and everything related to a particular entity, be it a cultural or natural category, but no more. Indeed, what is put into practice is often less and that is a good thing as it increases the likelihood of reusability and you can always add more later.

The above comes from the major philosophy of programming in general to copy or reuse code. This means not only to copy your own code and make your own code as reusable as possible, but to read any and all code you can find. Then copy what you need, getting permission when it's not open source. You'd be surprised how many people are willing to share their code when not held back by obligations to employers. Why?

It's really quite simple. Programming is done with programming languages. There's a reason they're called languages. They are entirely symbolic and are as deeply complex and intricate as any spoken tongue in the world. So every time you read code, you're learning how to become more fluent in the language. And if you ever get frustrated in not understanding why a computer isn't doing what you're "telling" it to do, just remember how long it took you to become fluent in your first language. Most people would say it was years or so of continuous use much of every day before they were comfortable with their first language. So be patient with yourself and the machine you're using. Mastery often requires more than time and patience, but never less.

So looking at programs from the paradigm of languages, each program a programmer writes is a "book" or even a "story" by loose interpretation. Ever known an author who didn't want people to read their "books" or "stories"?

With the above thought and philosophy in mind, we come to the logical next step in the Object-Oriented Model. The Object itself and how it is used for, in, and with the system and environment around it.

Ultimately, every program is a manipulation of data using abstract symbols to create a digital algorithm of 1s and 0s to be manifested in the physical realm via the on and off states of electromagnetic media. More simply, a program controls information (refined and formatted data).

Since every system used by us (humanity) needs to be able to interact with us, this means most programs and every collection of programs commonly called an application, needs a user interface or UI. A graphical user interface, a GUI, is the most common form of UI.

As information is the most important part of any program, most programs and every application requires a way to persist that information. Hence, data storage is needed and data access processes to interact with the data storage.

Finally, since every program is made to manipulate information, every program requires a controlling process or controller object in Object-Oriented programming.

Now most OO programmers would stop there with those three concepts: UI, data access and controller processes. However, I like to conceptualize the ideal model as having a fourth component even though most OO programmers consider it part of the controller concept.

The fourth concept I add to the three above is the abstract entity(ies) about and around which your program is built. After all, this is Object-oriented programming.

Since we need to use our programming language to tell the computer what to do, we need to be able to define new concepts to the computer in a way it will understand. Since Object-oriented programming is about objects, we need to be able to give the computer definitions of the objects we're trying to make it understand. Enter the concept of the class.

Classes are best described as literally being object definitions. As something is often described by its features, objects are said to have properties. As it also helps to describe the ways an object can act, objects also have methods.

To create a complete application then, using the Object-oriented philosphies and concepts, we need to have the following groups: The ones that do processing (UI, data access and control) are often called layers and the one that describes the entities we're manipulating is called a class library. So we have the following groups:


  • User Interface Layer

  • Controller Layer

  • Data Access Layer



and all three pass between them the entities (objects) or parts of the entities (properties) described in the:


  • Class Library



Next time: How these four groups constitute an application, why they not only make logical groupings, but adhere to the reusability philosophy, and how they interact to accomplish their purpose while maintaining their reusability.

Monday, December 04, 2006

RSS Feeds

What are RSS Feeds?

Since it's always best to start simple and build from there, I find the definition and then explore the history of the concept/word/idea.

RSS has three acronyms. Each one represents a different RSS format (from Wikipedia):

Really Simple Syndication (RSS 2.0)
Rich Site Summary (RSS 0.91, RSS 1.0)
RDF Site Summary (RSS 0.9, RSS 1.0)

where RDF stands for: Resource Description Framework.

All of them use the XML (Extensible Markup Language) data format specification for transfer of its contents over the internet.

RSS is used by its readers using programs called RSS aggregators. RSS is normally provided by web sites that have a rapid update cycle such as news feeds and blogs. In fact, this blog has an RSS feed available to it here: Atom Feed

So why am I mentioning RSS Feeds? The course I'm taking has us actually programming an RSS Feed Aggregator using Tomcat, Java Standard Tag Library, Ant, JSP and MySQL.

Next time: A little coding advice for my tutees.

Monday, November 27, 2006

The external drive conundrum

My Enterprise Java course got off to a rocky start. How rocky? Let's just say I was still doing exercises for the first week in week six. Why?

The difficulty begins with Eclipse. An Eclipse project is stored entirely in a virtual directory. The directory's name is the same name as the project. However, that virtual directory is mapped to a physical location on the machine. In my case, I had a project called Novus. It mapped it to my F: drive. (Being able to designate a relative path from the executable's directory in the project's properties would have been a quick fix!)

Now, toss in the fact that I'm running from an external USB drive. In class I was connecting as drive E:, in the lab I was connecting as drive F:, and at home I was connecting as F:, G:, or H:!

Yes, if I really wanted to, I could have gone to My Computer, right-clicked on "Manage" and selected Disk Management, removed the drive and reassigned it a letter. That was my first clue. However, still quite a hassle.

Meanwhile, I had to keep working. This meant I ended up with 2 or 3 different projects all at various stages of progress and none working due to the virtual path mapping in Eclipse. I needed some way to get everybody working on the same drive letter in Eclipse (since I could find no way to change Eclipse's mind and our instructor insisted we use Eclipse)

So I took my furthest project, recreated it from scratch, mapped it to the F: drive (as F was in common for all the computers (the classroom computers had F: available at least)) and then did the following:

All throughout, due to the nature of working from an external drive, I've been having to run a batch file in a command window to set various variables like JAVA_HOME and extend the PATH variable to include important directories on my drive. The variables were only avaiable to me within that particular command window, however, the key was the SUBST command:

subst [drive letter for virtual drive] [physical directory assigned to drive letter]

Now instead of having to use a wild character in my batch file for the drive letter, I could use f AND also virtually map my drive's physical location to F: as a virtual drive. Additionally, the subst command had an affect on the system, not just the command window's environment so Eclipse was also fooled into thinking my drive was on F: even while it was originally auto-assigned another letter by windows. Additionally, the subst command has no adverse affect if my drive is already on f and I run my batch file. The resulting batch file was thus:

subst f: .
set PATH=f:\svn\bin;f:\ant\bin;f:\PuTTY;f:\tomcat\bin;%PATH%
set JAVA_HOME=C:\Program Files\Java\jdk1.5.0_07
set SVN_EDITOR=notepad

Now instead of navigating through the manage window and so on, all I have to do is this:

Windows+R (launches the run dialog window)
cmd (to run the command window)
*: (where * is the drive letter my external drive is currently mapped to by windows)
setup

And I'm off and running!

This means that when I'm finished, I could log onto any computer with a high-speed connection, attach my drive, run setup, launch tomcat and wham: instant website from any location.

Next time: RSS Feed? What's that?

(Note to instructor: The previous entry was held as a draft until permission was obtained to post. 5 days past between blog entries, just not publication of blog entries)

Monday, November 13, 2006

Local Electrode Atom Probe

A family friend and real gentleman, Tom Kelly, is the Founder and CTO of Imago Scientific Instruments. The company can be found here: Imago Scientific and a brief bio of him here: Tom Kelly

What does the LEAP do?

It allows researchers to analyze substances at the atomic level. The substances included only metals at first, but now with the introduction of a pulsing laser, it can do semi-conductors and ceramics.

How does it do this?

From the perspective of the sample being analyzed, the following occurs:
The sample is prepped, usually to bring it to a size that can be analyzed. To get an
idea, the probe can handle around 80 million atoms at a time. If a cross-section of a human hair
were one atom thick, that would be around 250 million atoms or about 3 times more atoms than the LEAP can normally handle.
It is taken through a three-stage vacuum process to create an UHV (Ultra-high Vacuum).
The first stage chamber is brought to 1 millionth of an atmosphere, the second stage chamber to 1 billionth of an atmosphere, and the third to 1 trillionth of an atmosphere. Along the way, the temperature drops to less than five Kelvin. This environment inside the third chamber is "as cold as and even less dense than interstellar space."
Once inside the third and last chamber, the sample (normally on a plate) is moved into location over the electrode. To accomplish this, the LEAP makes use of two electron microscopes to pinpoint the sample on an XY-grid over the electrode.
The electrode, in the case of metals, begins pulsing while a magnetic field focuses the charged ions onto a sensor above. The location of their impact and time of travel (impact time - pulse time) is then used to determine distance travelled. With the distance known, the time known, and the amount of energy known, the mass can be derived. The computer then calculates the element and location of every particle that was in the sample.
In the case of semi-conductors and ceramics, the electrode maintains a static electrical field. A laser is then used to provide the remaining energy required to excite the atoms off the surface of the sample.

Now you know what an LEAP does. You're probably wondering what it's used for. I can probably sum that up in one word: nanotechnology. More importantly, prior to the LEAP, atom probes handled about 20 million atoms at a time and took about 2 days to process a sample. The LEAP does its work of 80 million atoms in minutes. This means researchers can put in work requests in the morning and get them back the same day versus putting them in on Monday and getting them back the next week.
So while only a handful of LEAPs exist, what they do is minor on the global scale. What they will do in the near future is allow researchers the world over to discover the world of nanotechnology many times faster than before. And that is a good thing.

Next time - Have a program running off a detachable drive(memory stick or external HD), but the program has hard-coded full path references (i.e. the programmers should be SHOT!) and you need to work on several different computers that drive you mad by inconveniently mapping the drive to different letters? I have a couple solutions for you...

(May be edited at a later date)

Friday, November 03, 2006

On second thought...

I was going to explain in detail everything going on here. However, if I were to do that, it would take me days to get every detail I would like to include and even then, I would probably forget something. So, instead, I'm going to rely on a site I have referred people to for years who expressed interest in finding out how stuff works. Not surprisingly, the name of the site is www.howstuffworks.com. Imagine that!

It's an excellent resource for nearly anything and unlike Wikipedia, there will never be 30,000 different definitions of Elephant (Colbert Report joke)

I think I will eventually hunt down the links to specific parts of howstuffworks to help people see a more wholistic view of the WWW experience including, but not limited to: why HTML and monitors use three color values, how information is serialized into a binary bit stream for transmission over the internet, how information knows where to go, etc in addition to the focal subject: HTML & Web Design. To truly understand something, you need to not just understand the subject, but its context(s).

That's it for tonight.

Next blog: What exactly is a Local Electrode Atom Probe or LEAP for short?

Thursday, September 28, 2006

In the beginning... (behind the scenes)

What exactly is going on here?