This is a great example of creative programming. Check out this neat JavaScript.
Instructions. Enter a website that contains a lot of pictures (example). Then copy this script into your adress line, and hit enter.javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',5); void(0);
Neat!
_______________________________________________________
Further reading and source:
StopGeek - Neat trick with JavaScript
Tuesday, May 27, 2008
Fun with programming - JavaScript
Phoenix lands on Mars
24 hours ago NASA's Phoenix spacecraft landed on Mars. It's the first successful Mars landing without airbags since Viking 2 in 1976.
So, what is there do be done on Mars? Well, there is plenty of information to be gathered. The complement of the Phoenix spacecraft and its scientific instruments are ideally suited to uncover clues to the geologic history and the biological potential of the planet. Phoenix will be the first mission to return data from either polar region providing an important contribution to the overall Mars science strategy "Follow the Water".
Follow the water?
Without a clear presence of surface water, it may seem like a strange name for a Mars exploration. How can we follow water, when it doesn't seem like there is any to be found?
Following the water really means looking for scientific evidence that water was present in the past or is present today, either below the surface or possibly in rare locations near small, hydrothermal vents like those we might find at Yellowstone. Our Mars missions have already sent back views of the Martian surface that seem to show evidence of dry riverbeds, flood plains, rare gullies on Martian cliffs and crater walls, and sedimentary deposits that suggest the presence of water at some point in the history of Mars. 
Illustration of the Phoenix landing
The Phoenix will contribute to our overall picture of Mars. It will help us to determine if life ever arouse on Mars, and to understand its climate and geology. In addition it could also contribute to the preparations for human exploration.
_______________________________________________________
Further reading and source:
NASA - Phoenix Mars Lander
Dagbladet (Norwegian)
Tuesday, May 20, 2008
C++, Setting up your computer and writing your first program.
First of all we'll introduce some basic C++ terminology. It is important to learn good terminology in order to understand the concepts that we will be describing and discussing later on.
If you have been programming in other languages, you might have learned words like methods, functions and procedures. These are all named just "functions" in C++. A C++ program in its simplest form consist only of one function, which is called main. This is a pre-defined function name, and its body is enclosed in braces {}. The main function needs to exist so that your system (your run-time enviroment) will know where to start the execution of your program. If it didn't exist it would be like not knowing where to start reading a book. In order for your program to make sense, it needs a starting location – the main function.
When writing C++ code, you will be using some sort of text editor. If you are programming in a Windows enviroment, you could use a simple text editor like Notepad, Textpad or Notepad2. If you're in a linux enviroment you could use i.e. Notepad++, Pico or Nano. It really doesn't matter which editor you choose to use, as long as you give your source files the extension *.cpp. I.e. your first program could be named:
myFirstProgram.cpp
Let's say this file contains some code that you've written using Notepad. In order to make this file an actual program, we need to translate it into native machine code, a binary code consisting of only ones and zeros. Fortunately we don't do this manually. We have a program to do it for us – the compiler.
There are many C++ compilers out there, which perform pretty much the same (although they may vary slightly). It all boils down to this: You will have to make choice. Which editor will you be using? Which compiler will you be using? Tough questions? Well, don't worry. We will provide for you a complete and easy solution to these questions. This solution applies best to the Windows OS, because binaries only are availible to Windows systems. You can however compile the source code for your desired system. Well, anyway, the answer that we like, is Dev-C++ from Bloodshed. Dev-C++ is what we call an "IDE" (Integrated Development Enviroment). An IDE combines the editor, compiler and other useful tools in the same software package. There are of course alternatives, but Dev-C++ is under GNU General Public License which means it's free and open source (publicly availible source code), and it's also a very neat IDE.
Note: There might be other IDE alternatives that are better if you're an OS X or Linux user. If you want more information about this, just google it. I.e. "c++ IDE for linux", or simply post your question at our site.
For downloads and more information, please check out:
http://sourceforge.net/projects/dev-cpp/
After installing the IDE, we are ready to move on to our next section.
Writing your first program
Start up your IDE software, and create a new source file (a clean document). In Dev-C++ you can hit CTRL + N. This is where we'll type our code. So, let's get started.
Our program will be using commands for outputting and inputting information in a console window. To enable this functionality, we must include a library named iostream. Then we have to choose namespace to use, so the compiler will know what names are connected to our imported functionality. You don't need to fully understand at this point. The numbers to the left are line numbers.1 #include <iostream>
2 using namespace std;
Next we have our main function, and the starting brace of our main function. As you can see the main function should return an integer value. When we return the value 0 (later in the code), our program will be terminated. This is considered good style, but it is not required by all compilers. Some compilers will allow your main method to return nothing thus writing void main( ), and some compilers doesn't even require a return statement, even if the function should return an integer. Well, anyway, we will use the following style, because it is good style.3 int main( )
4 {
We are now inside the main function. The code that we write here will be executed line by line. So, let's declare a variable of type int, that we will name yourLuckyNumber. Btw: int is the C++ type for whole numbers; integers. Then we will use some of our imported functionality: cout (console output) and cin (console input). This is used for outputting and indputting information in the console window. Note that cout and cin used different operators (<< and >>). You will learn about operators later. Note: endl ends the current outputted line.5 int yourLuckyNumber;
6 cout << "Please enter your lucky number, and hit enter: ";
7 cin >> yourLuckyNumber;
8 cout << endl;
Now that we have read an integer from the user, and stored this value in our variable, we can analyze this number so we can output appropriate information.9 /* Determine whether your number is positive,
10 negative or zero */
11 cout << "Your lucky number is ";
12 if (yourLuckyNumber == 0)
13 {
14 cout << "zero";
15 }
16 else if (yourLuckyNumber < 0)
17 {
18 cout << "negative";
19 }
20 else if (yourLuckyNumber > 0)
21 {
22 cout << "positive";
23 }
Line 9 and 10 are comments. By enclosing text within /* and */ you can provide information for yourself and the person that is reading your code. Comments will be skipped by the compiler and can be very useful when documenting the different parts of your program.
Now we will use an operator which is called modulo (in C++ this is represented by the percent symbol, %). The modulo function finds the remainder of division of one number by another. Given two numbers, a (the dividend) and n (the divisor), a % n is the remainder, on division of a by n. In example, the expression "7 % 3" would evaluate to 1, while "9 % 3" would evaluate to 0.
This function can be used to determine whether an integer is odd or even. If we have an integer, n, then the following expression will help us determine whether n is odd or even "n % 2". If the remainder is 0, then it is even (or zero), and if it's 1 that means our integer is an odd number.24 cout << ", and it is also an ";
25 //Determine whether your number is an odd or even number
26 if (yourLuckyNumber % 2 == 0)
27 {
28 cout << "even number.";
29 }
30 else if (yourLuckyNumber % 2 != 0)
31 {
32 cout << "odd number.";
33 }
34 cout << endl;
35 cout << "That is all =)";
36 cout << endl;
37 system ("PAUSE");
38 return 0;
39 }
Notice line 25. Here we use a different style for our comment. In stead of enclosing some text within /* and */, we use // to make the rest of the line a comment, but only this line. If our comment uses more space than one line, we could put // in the beginning of each line, or we could enclose it with /* and */ as previously discussed.
Line 37 makes the console perform a pause. If we omit this line then our console window would open up, run, and then close again, giving us very little time to read the output of our program. Line 38 and 39 includes the return statement for the main function, and the closing brace for the main funciton.
You now have a complete C++ program which is ready to be compiled. If you are using Dev-C++ you can hit F9 (compile and run).
Here is the program running under Windows XP:
Introduction to Java
Welcome to our first lesson in Java programming. This lesson provides a brief historical background to Java and its fundamental differences to traditional programming languages as C and C++.
In June 1991 James Gosling created a programming language. The language was created as a part of the Green Project of Sun Microsystems. Initially the language was called Oak, reflecting an oak tree that stood outside Gosling's office. Unfortunately the trademark lawyers rejected the used of this name. It came to the point when the lack of a name was the main reason preventing the shipping of the language. In a rush to find a proper name, a dozen employees spent an afternoon yielding out random words. These words were ranked, and the sorted list was sent to the trademark lawyers. The fourth suggestion on the list passed the lawyers test and became the name of the newborn programming language, Java.
The first public implementation of Java, named Java 1.0, became available in 1995. Since launch the average performance of Java programs has increased. Todays public implementation, Java 1.6, perform comparable with C and C++. The whole Java implementation have been available under the terms of the GNU General Public License (GPL) since 8. May 2007, except for a relative small portion of code which Sun did not hold the copyright of.
The Java maskot, Duke
From its beginning an important feature of Java can be summed up in Suns slogan Write once, run anywhere (WORA), reflecting Javas platform independence. That is, a program written in Java should run similarly, or ideally identically, on any supported platform and hardware. This is achieved by the fact that most Java compilers code the Java language file only halfway, to a code called Java bytecode. This bytecode is run on a virtual machine (VM) which interprets and executes the Java bytecode.
Java suffered, and in some circuits still suffers, from a reputation of poor performance because of the need for interpretion of the Java bytecode or a convertion to native machine code. The performance of Java is dependent on the virtual machine that is used to execute the Java bytecode. As previously noted, new virtual machines perform comparable to some of the most efficient programming languages as C and C++. In general the difference in performance between the languages varies, each of the languages is out-performing the other on spesific tasks. In real life programs benchmarks shows that there is typically little to no performance difference.
For completeness it should be mentioned that there exists compilers, such as The GNU Compiler for the Java (GCJ), which is capable of coding Java source code or Java bytecode to native machine code. When compiled to native machine code no interpretion or futher convertion is needed, as is the case for most traditional languages as C and C++, but this is of course performed at the expense of the Javas platform independence.
Looking aside from platform independence and performance efficiency, Java offers a class library consisting of million of codelines, which is, as mentioned, currently released under the GPL. This library, which for each new Java version is being updated and optimized, provides a solid foundation that can and should be used in every Java program. In most other programming languages no such library is present, the only library one can rely on, apart from custom implemented libraries and the libraries some compilers provide, is the general library of the operation system in use. These library is generally much smaller than the class library Java offers, resulting in the need of fewer items to be coded. In addition, most programmers, and especially beginners, often find Java easier to use. Indeed, it could be argued that Java in general is easier to use, since the combination of its library and its syntax tend to give Java source code much fewer codelines, as a rough estemate compared to C or C++, half the number of lines are needed in the Java source code compared to the same program written i C or C++. Of course, patriotic C or C++ programmers will probably argue that their custom libraries is only created once, so the number of codelines need for future programs is less (with the use of these old custom libraries). Keeping in mind that Javas library consist of million of codelines, it is left to the reader to persuade this argument.
We conclude the discussion noting that there are applications where a spesific programming language will have its clear advantages. In addition, the choice of programming language will often depend on the programmers previous experience, since this often defines the programmers way of thinking. However, either if you are new to programming or are ready to change your language, Java should be given a good chance to be your language of choice.
_______________________________________________________
Further reading and sources:
James Gosling commenting on the question How was Java named?
GCJ Homepage
Java pulling ahead? Java versus C++
Jake2, a port of Quake2 game engine, benchmarks
Friday, May 16, 2008
Convert flat images into 3D models
Computer scientists from the university of Stanford have developed an algoritm which they call "Make3d". A suitable name?
Extracting three-dimensional data from still images is an emerging field of computer technology. Make3d does this completely automatically. It takes a two-dimensional image as input, and creates a three-dimensional "fly around" model. This way you can experience the depth of the scene, and view it from numerous locations. If you install VRML viewer or Adobe Shockwave, you can even fly around in your favourite scene.
The algorithm uses a variety of visual cues that humans use for estimating the three-dimensional aspects of a scene. To make a computer perform such a complex task they utilize powerful machine learning techniques. This way the computer can learn the three-dimensional structure of a scene (as a function of the image features).
This is a very interesting step in technology, simply because it's a way to digitalize our world. This digital information opens up doors in many other technologies. The application, the researchers say, could range from enhanced pictures for online real estate sites to quickly creating environments for video games. And also, it might be a great way to improve the vision and dexterity of mobile robots as they navigate through the spatial world.
_______________________________________________________
Further reading, and sources:
Make3d website
Article on science daily
Tuesday, May 13, 2008
Can mushrooms and the Life Box save our world?
How can mushrooms make the world a better place? What is the Life Box? Paul Stamets has the answers.
Paul Stamets has been a dedicated mycologist for over thirty years. Over this time, he has discovered and coauthored four new species of mushrooms, and pioneered countless techniques in the field of edible and medicinal mushroom cultivation. In addition, he has written six books on mushroom cultivation, use and identification.
We all know (especially gardeners) that microorganisms convert organic material into rich and nutrient soil. This is required for plant growth. In example, they break down rotting food, leaves and other forms of decaying organic material. Fungi play a key role in this process.
We will not try to cover the depths of his research, as that would make this article very long. Instead we will present different applications of his research, which all are truly amazing. Watch this video, or/and continue reading.
Breaking down diesel spill
Paul Stamets has collected more than 250 strains (in 2002) of wild mushroom, which he stores in several gene libraries. Some years ago he and his team conducted experiments in breaking down a diesel spill in Bellingham, Washington. There were four piles of contaminated soil. One pile was treated with bacteria. One was a control pile. One was treated with chemical enzymes. The other pile was treated with oyster mushroom mycelium.
After four weeks, oyster mushrooms up to 12 inches in diameter had formed on the soil treated with oyster mushroom mycelium. After eight weeks, 95 percent of the hydrocarbons had broken down, and the soil was declared nontoxic! Neither of the other treated piles showed significant changes.
Mushroom against ants and termites?
Termites and carpenter ants can invade and damage crops and buildings. Metarhyzium is a unique group of fungi, that can kill these vermins. And so the pesticide industry has tried to use Metarhyzium spores to kill termites, but with poor luck. The termites understand that it's poisonous, so they simply avoid it.
Stamets had carpenter ants in his house, so he ordered some metarhyzium. He found out that if he coaxed the fungus into a form that delayed sporulation, the ants would be attracted to it. Because he noticed that they were attracted to the fungus before it started to produce spores.
Carpenter ants took pieces of mycelium Stamets grew back into their nests, and two weeks later, they were gone. His house was protected from reinvasion for four or five years.
Paul Stamets - the mushroom man
The Life Box
Perhaps the man’s most intriguing and practical invention to date is the Life Box. Here’s how it works. Say you order a pair of Timberland shoes online. Under shipping options, you can check “plain old brown box” or pay an extra dollar or two and get them shipped in a Life Box. You order the Life Box and your shoes arrive. Instead of recycling the box, you toss it into the backyard, water it, and boom, you’ve got a garden. Depending on your zip code, you’re growing corn, beans and squash, or grassland plants, old growth forests, you name it. Stamets even thought of shipping them to refugees after his initial test box yielded 30,000 seeds, enough to start a small farm!
Stamets sees the Life Box as a means to “combat global warming, teach our kids about sustainability, and re-green the planet.”
_______________________________________________________
Further reading and sources:
How Mushrooms Can Help Save the World
How mushrooms will save the world
Mighty mushrooms
Monday, May 12, 2008
Introduction to C++
Welcome to our very first lesson in C++ programming. This introductory lesson will give you some historical background and also the important differences between C++ and its predecessor C.
The C++ programming language can be thought of as the traditional C progamming language with an important added feature; classes. Classes is a significant feature of a very popular and indeed powerful programming technique called object-oriented programming (OOP). Well, let's have a look at the C programming language.
The C programming language was developed by Dennis Rithcie of AT&T Bell Laboratories in 1972. It was designed for writing and maintaining UNIX operating system. Before C, UNIX system programmers wrote their programs in assembly (a low-level language) or a in language called B. Today B is almost extinct, as it was replaced by C. C is a very powerful and fast language. It is also considered a general-purpose language, as it can be used to write any sort of program. C and UNIX fit very well together, actually so well that almost all commercial programs that ran under UNIX were written in the C language. It simply rocked the programming world, but C was not perfect.
The C progamming language is a high-level language, with many features of a low-level language. Like low-level assembly you have directly access to the computer memory, so memory manipulation is easy. In its written style it is a high-level language, which makes it more easy to read and write (compared to assembly). This way, it was a very good and fast language for writing system programs and system applications. But for many other programming tasks, it was not so easy to understand and come around. In addition to this, it didn't have the automatic checks as some other high-level languages. This made errors much harder to spot.
Bjarne Stroustrup, the developer of C++
This is partly why C++ was born. The C++ programming language was also developed at AT&T Bell Laboratories (by Bjarne Stroustrup), seven years after C (that is 1979). It was first named "C with classes", but in 1983 it was renamed to C++, as there were made more enhancements. These further enhancements were mainly virtual functions, operator overloading, multiple inheritance, templates and exception handling. Note: C++ being an enhancement of C, means that most C programs also are C++ programs (the reverse, however is not true).
Well, thats all for now. If you do not understand all of these terms discussed here, that is perfectly ok. We will start with the basics next time, so there's no need to worry.
Next lesson: Setting up your computer, and writing your first program.
Sunday, May 11, 2008
ATLAS - What's really going on?
What is the worlds largest experiment all about? Physcist Brian Cox talks about the Large Hadron Collider at CERN.
Further reading at LHC homepage.
Saturday, May 10, 2008
Programming in C++ and Java
As from now, programming in C++ and Java will be a part of this blog.
For starters, we will be writing:
- Lessons in both languages (C++ and Java)

Friday, May 9, 2008
Virtually anything, anywhere
Computer graphics have become very sophisticated, and eventually, it will reach a certain level where realism is no longer restricted by graphics quality, but rather the fact that action is taking place on a flat display.
In order to emulate reality and the feeling of realism, we need to enhance stimulation of our senses, and the 3D feeling. To do this, reasearchers will in the next decade be working on integrating todays awesome graphics into real world enviroments. This new technology is called augmented reality (AR), and will make the line between reality and computer-generated components considerally more blury.
AR is simply a fusion between real and virtual. AR displays, will overlay computer-generated graphics onto the real world. It's still in an early stage of research and development at various universities and high-tech companies, but its application is getting wider and wider.
When the technology is getting older, and we learn to master it, AR will likely pervade every corner of our lives. It has the potential to be used in almost every industry. And maybe especially gaming, construction and instant information services.
Have a look at these interesting links:
Total Immersions Augmented Reality Demo
"Variety of videos", scroll down this page to see
a collection of YouTube movies.
Can we save lives by playing computer games?
Researchers at the University of Washington have developed a game (currently in Beta stages) which enables heavy contribution in a certain scientific field - proteins - the key for biological mysteries.
Proteins are involved in almost all of the processes going on inside the human body. They break down food to power your muscles, they send signals to your brain which again controls your body and they also speed up chemical reactions. It's absolutely vital in a huge variety of tasks.
In this game, named "Fold It!", you are going to fold and shape proteins to satisfy several conditions. It might sound boring, but it's actually a fun puzzle experience. You can also chat with your fellow puzzle solvers. Best of all - your gameplay can actually contribute to curing diseases.
With a decent broadband connection, it took less than 5 minutes before we had this game set up and running. It's availible for Windows XP/Vista and Mac OS X (10.4 or later). And the installer was only 52,7 MB. It does, however require registration, as you will be uploading testimonial data to their servers.
It's absolutely free.
If you want to give it a try, visit the project homepage.
Question and Answer
Q: But why folding and shaping?
A: Even though proteins are just a long chain of amino acids, they don't like to stay stretched out in a straight line. The protein folds up to make a compact blob. Every kind of protein folds up into a very specific shape - the same shape every time. The unique shape of a particular protein is the most stable state it can adopt. This shape/structure specifies the function of the protein.
Q: What disease mysteries will I be contributing to solving?
A: Just to name a few: HIV/AIDS, Cancer and Alzheimer's.
Q: Isn't there any computer programs to fold and shape these proteins for us?
A: Yes, there are. But they are not efficient enough. This game will be collecting data about your puzzle solving strategies. Based on data from thousands of users, programmers can optimize and teach these strategies to computers.
Q: What are the future plans of this sofware?
A: Since proteins are part of so many diseases, they can also be part of the cure. Over the summer, there are plans for adding new functionality to the game to allow users to design brand new proteins that could help prevent or treat important diseases.
Wednesday, May 7, 2008
Teaching robots to learn
There have been numerous debates concerning robots, and their (possible) future involvement in our lives. This is an interesting question, because robotics as a scientific field is getting bigger and broader. Especially the field concerning artificial cognitive systems (ACS). This has become a very fragmented field with a very high degree of specialization during the last years. Some have focused on machine vision, human-robot interaction, others on optimizing two legged walking, just to name a few.
CoSy
In september 2004 EU launched a project called Cognitive Systems for Cognitive Assistants (CoSy). This project is planned to end august 2008, so it has actually been going on for quite some time. What have they been doing all this time? Well, for starters, they have been trying to unify the fragmented fields within ACS technology - making these different yet related technologies work together is no simple task. The next generation of cognitive robots are still under development, but the complexity of the tasks being solved by robots is increasing dramatically these days. Mainly, one could say that these new robots are more aware of their enviroment and better to interact with humans. A good example of this is the Explorer:
Explorer, which is developed by the CoSy team, has a more human-alike understanding of its environment. Explorer can even talk about its surroundings with a human.
Take a look at the CoSy's homepage. There are many interesting video presentations for you to check out. Just scroll down at the pages below and have a look at the two main projects:
Question and Answer
Q: What could we expect from robots, are they part of our future?
A: Most certainly, yes. We think, that in the near future we will see robots performing errands of great diversity, but it will probably take some time before we can rely on them in daily life situations.
Q: What tasks can we expect them to perform?
A: Well, they are already moving our lawns and vacuum cleaning our floors (at least some),
so it wouldn't be completely off track to suggest that in 10 years they could be cleaning our entire house. The service sector is a perfect place for robots.
“In the future people may all be waited on by robots in their old age”.
Further reading on ICT results. Enjoy :)
Monday, May 5, 2008
The worlds largest experiment
What is the unknown 96 percent of the universe made of?
Why do particles have mass?
What lies beyond Earth's dimension?
What happened in the Big Bang?
100 metres below ground at CERN in Geneva, Switzerland lies an enormous device that has been built to unlock the mysteries of the universe. Let's just cover the basics (for now).
The construction* mainly consists of a 27 km tunnel, and a very large particle detector. This wild thing will recreate conditions akin to the Big Bang - the scientific birth of our universe. Protons will be accelerated inside the tunnel to reach the highest speed possible (close to the speed of light**). At top speed there will be approximately 1 billion proton collisions every second. These collitions will be carefully monitored by the detection device called the ATLAS, which weighs 7000 tons.
To understand how precise the ATLAS is, we can compare it to a digital camera with 100 million image sensors that can produce 40 million snapshots every second. That will give us serious amounts of information. And scientists are hoping to use this information to answer the questions above.
_______________________________________________________
*Also reffered to as "large hadron collider" (LHC)
** 300 000 km/s , the speed of light
Question and Answer
Q: Will the machine produce information of importance?
A: Most likely (personal opinion). In fact, 2500 scientists from 37 countries were recruited to help design, test and build the ATLAS detector. This is the worlds largest experiment. This is as good as we get right now.
Q: Does it radiate?
A: Yes, the radiation field produced by the usage of the machine is stronger than a nuclear reactor.
Q: When is the ATLAS turned on?
A: Summer 2008 (goosebumps)








