Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API
Many people are fascinated with the possibility of traveling through time. Over the years, a considerable number of television shows and movies have been created to exploit this fascination. Two of these movies, along with a third movie that appears to be under development, focus on two alleged time-travel events occurring in 1943 and 2000:
Scientists believe you need a wormhole (or some other exotic device) to travel through time. But in 2002, I discovered another way to visit the past and any one of the many possible futures. All this computer-based technique requires is an appropriate programming language, such as Java. I prefer to use Java because Java's support for big integers and buffered images greatly facilitates the implementation of this technique.
You have probably heard someone refer to a picture as being worth a thousand words. Pictures save people time by sparing them from having to accurately describe, via many spoken words, what those pictures express. Perhaps even more importantly, pictures are windows into the past. Whenever you look at a picture, you are looking back in time to the moment when that picture was taken. From that perspective, you are traveling back in time. Confused? Sit back, close your eyes, and think about this concept before continuing to read this article.
| Note |
|---|
| While you are thinking about pictures and the past, you might want to think about this: if you create a picture of some item from some possible future, are you also looking back in time to the moment when this picture was created, whenever you look at the picture? |
A picture appears on a computer screen as a rectangular grid of colored pixels, an image. I believe that generating all possible
images from a solid black image to a solid white image will reveal the past and all possible futures. All it takes to accomplish
this task is a simple algorithm. The following algorithm, which I have expressed in pseudocode, uses constants NROWS and NCOLS to describe each image's pixel resolution, and assumes the maximum number of colors per pixel to be 224 or 16,777,216 colors:
LET NROWS = 100 ' 100 rows in image
LET NCOLS = 100 ' 100 columns in image
DIM image [NROWS][NCOLS] ' Create 100x100 array of 32-bit integers. Each entry
' represents a color, ranging from 0 (black) through
' 16777215 (white). Each entry defaults to 0 (black).
' Generate and display all possible images for the 100x100 resolution and the
' 2^24 possible colors per pixel.
' The stopping condition is the lower-right pixel -- image[NROWS-1][NCOLS-1]
' -- exceeding the white color. This is analogous to setting up a counter that
' counts all possible values from 0 through 99. When the counter reaches 100,
' you know that it has gone through all 100 values (0 through 99).
' For each iteration of the while loop, we increment the color in image[0][0],
' the upper-left pixel. When this color reaches one past white (16777216, in
' other words), we have the equivalent of a mathematical carry. We propagate
' this carry to the pixel to the right of image[0][0], by incrementing
' image[0][1]. If we go past white, we propagate to image[0][2], and continue
' until we reach the pixel in the lower-right corner. Eventually, the while
' loop will come to an end, having generated every possible color combination.
' Think of this algorithm as performing roughly the same task as adding two or
' more numbers (with a carry each time a digit column sum exceeds 9).
WHILE image [NROWS-1][NCOLS-1] != 16777216
DISPLAY image
INCREMENT image [0][0]
IF image [0][0] == 16777216 THEN
LET image [0][0] = 0;
FOR index = 1 TO NROWS*NCOLS-1
INCREMENT image [index/NROWS][index%NCOLS]
IF image [index/NROWS][index%NCOLS] != 16777216 THEN
BREAK
ELSE
IF index != NROWS*NCOLS-1 THEN
LET image [index/NROWS][index%NCOLS] = 0
ENDIF
ENDIF
ENDFOR
ENDIF
ENDWHILE
The algorithm reveals many meaningless images between the solid black and solid white extremes; they exhibit a randomness much like "snow" that often appears on a television screen when a channel's signal is lost. Other images are meaningful, and reveal people's faces, city skylines, animals, and so forth. Many of those images are part of the real past (the Titanic sinking in the early part of the twentieth century), an imagined past (President Al Gore), or a possible future (human beings living on the moon).
| Subject | Replies |
Last post
|
|
By h3nryx |
0 |
09/26/07 12:02 PM
by h3nryx |
|
By Anonymous |
9 |
12/01/06 01:13 PM
by Gary_J_Korman |
|
By Anonymous |
1 |
10/04/06 07:22 AM
by Anonymous |
|
By Anonymous |
2 |
10/04/06 07:20 AM
by Anonymous |
|
By Matthias |
1 |
10/03/06 02:23 PM
by Anonymous |
Free Download - 5 Minute Product Review. When slow equals Off: Manage the complexity of Web applications - Symphoniq
![]()
Free Download - 5 Minute Product Review. Realize the benefits of real user monitoring in less than an hour. - Symphoniq