At the end of the day

Everyday we hear technological news, every week it’s about new discovery, every month we hear about a breakthrough, every year – an important fundamental research.

robot

First frontier

Already today robots in everyday life is not just a science fiction, you can buy from the shop robot that will clean the floor or one, which looks like a dog. But of course their possibilities are still restricted by some factors like cost of the production, energy consumption, but the most problematic are difference of the operating systems what doesn’t make it easy for programmers to develop some additional robot’s functions and weak marketing. Even though I don’t know how to solve marketing issues, I already have seen in the internet some kind of “robot App store” – where people can for an example buy a program which will make your robot to dance rumba.

Even though today machines are created for some specific tasks, future makes us to think about multi-purpose robots. However, many people afraid of so-called “doomsday” or “rise of the machines” – when robots will try to take over the world. I’m quite optimistic about that, and I am not the only one. Isaac Asimov (science fiction writer and creator of the basic three robots laws) in the middle of the twentieth century wrote the series of books “Foundation”, where he shows robots as a personal assistants of the whole humanity. Even if robots made some bad things in his books, they did it because of the true villain – human. Also people can sleep peacefully, because there is already today organisation (Life boat foundation), which has a program “AIShield” (Artificial intelligence shield) and involving a lot of scientists an organisation develops a methods of fighting with “terminators”.

Second frontier

Bioengineering, unity of human and mechanisms. A lot of laboratories are developing right now either near future technology like brain implants plus glasses with camera, which will allow a blind people to see, or they doing something futuristic like Nano-bots which will be able to heal us. Already today we can find videos, how American military forces are testing exoskeletons which will help soldiers to carry heavy things. Even in our everyday life soon we will see a lot of people with Google-glass (it is not really about bioengineering, but still a big step to the right direction).

There is “2045.com” (Russian avatar project) – group of scientists which has a goal to build up “avatar”, so that in the end of the life human could transfer his mind into it and by doing this human will become immortal. Personally I, being an educated man, understand that no one should live forever, however increasing the life duration by scientific methods, or helping people with limited abilities are always good ideas.

PPTMooresLawai

The last frontier

According to the Moore’s law, processor’s speed will be doubled every eighteen months. Futurists like Ray Kurzweil believe it will lead to technological singularity (Point, after which technical progress becomes so rapid and complex, that it won’t be possible to reach an understanding). In simple, but more confusing words it can sound like we will observe limitless progress in limited time. Within Moore’s law approximately at 2030 people will create an artificial intelligence which is capable of self-improvement, it will strengthen itself unboundedly, passing each acceleration cycle faster, and at each stage finding new technological and logical possibilities for self-improvement. Automation and efficiency will be everywhere around.

And here as always we can find two different opinion groups, where one says, that it will bring to us solution for all world’s problems like food distribution, global warming, because machine will find that solution much faster than anybody. And on the other side people either don’t believe that it will happen soon (or even happen at all) or that it will bring the mentioned above “doomsday” for humanity.

An the end of the day

Personally, I believe that truth is always somewhere in between. I don’t think that point (singularity) will come soon.

So at the end of the day, if we follow rational behaviour – we make rational decisions. If we work together for the common goal – we solve the common problems. Progress (technological or any other) is the symptom of life, and if we are not optimistic about that – we are not optimistic about life, we are doomed to failure. At the end of the day, progress is just a tool in our hands, and only we ourselves keep responsibility how we going to use that tool and how much benefits we will get from it.

References

http://www.robotappstore.com/

http://en.wikipedia.org/wiki/Isaac_Asimov

http://lifeboat.com

http://2045.com/

http://en.wikipedia.org/wiki/Moore%27s_law

http://en.wikipedia.org/wiki/Ray_Kurzweil

http://en.wikipedia.org/wiki/Three_Laws_of_Robotics

Notes

Singularity –
(physics) central point of a black hole, at which gravitation is approaching infinity.
(mathematics) A point at which the derivative does not exist for a given function but every neighbourhood of which contains points for which the derivative exists.

Programming in Linux

It’s time to talk about programming. In Linux we can work with pretty much every programming language, so in the end of the day it is only matter of choice or specifics of task. To start with any of programming languages – all you need is text editor and interpreter/compiler, get one and you can do pretty much what ever you want.

#C++
This old-school guy is very useful for many purposes, especially when the talk comes to high performance. to start with it first thing to do is to check whether compiler is installed. In terminal simply type ‘g++’ and if something like ‘no input file’ appear – that means you already have. So let’s start with program.  In some text editor, create following program:

#include<iostream>
using namespace std;
int main()
{
cout << “Hello world” << endl;
return 0;
}

Save it, for example, with name ‘HelloCpp.cpp’. And in the command line compile like that: “g++ -o helloCpp helloCpp.cpp”, where parameter ‘-o’ specifies a name for output file. Here we go, to run the program simply type “./helloCpp” and that’s it.
CppScreen

#Java
Mostly used in production for many years programming language. Just as before ensure that you have development kit by following command “sudo apt-get install openjdk-7-jdk”. Now lets go to text editor and do same program:

class HelloJava {
public static void main(String[] args){
System.out.println(“Hallo world”);
}
}

To compile it use following “javac HelloJava.java”, and then just run it “java HelloJava”.
JavaScreen

#Ruby
This language along with Python suits very well for quick development. To start, firstly get interpreter and libraries by command “sudo apt-get install ruby-full”.  When it is installed just as with any other language create a file ‘helloRuby.rb’ and in that file simply put:

puts ‘Hello world!!!’

Since Ruby is scripting language – there is no need to have entry point for a program. After that simply type following command: “ruby helloRuby.rb”. More than that ruby has Interactive Ruby Shell, which can be called in command line ‘irb’, and it gives possibility to run ruby commands in real time without need to create source code file.
RubyScreen

#Octave
Octave is high-level interpreted language with specific purpose – mathematical computations. It perfectly suits for algorithm prototyping. It can be installed with simple command “sudo apt-get install octave”. Octave can be used only through interactive shell, however it doesn’t mean that no files can be used. Let’s create file “helloOctave.m” and in that file we will define following function:

function helloOctave(a, c)
x = (1:10)’
y = x.*a+c
plot(x, y);
endfunction

Then, we just need to run Octave by command ‘octave’, and call the function “helloOctave(5,2)”
OctaveScreen

#Python
To try this one, simply either create file and run it “echo ‘print “Hello”‘ > helloPy.py” and then “python helloPy.py” or just call interactive shell by command “Python”.

###Have fun, and don’t forget – Chuck Norris is watching for you###
timthumb.php

Ssh and openSsh server

#OpenSsh-server
So first of all to start I need to have a server to provide connection. To do so – type in terminal “sudo apt-get install openssh-server”. You won’t have a time even to make a cup of coffee ’cause your server will be up and running after couple of seconds. Now to test it I will create new user and connect to my own computer through ssh. “sudo adduser [nameForUser]” in my case it was like “sudo adduser testalex123″. And yeaps – new user is created.

#Ssh connection
Now for test purposes it is time to logon. To do so the following command should be executed: “ssh localhost@testalex123″ where localhost is domain name for my own ip address and after (at) sign comes user name. The same can be done through typing the ip, to know your ip is enough to type “ip addr”. So my private ip inside my lan is 192.168.0.10. So let’s try that one. And as I said the following: “ssh testalex123@192.168.0.10″ works exactly the same way just fine.

#Doing things remotely
After successful connection – everything you can do on your own computer – you can do as well remotely, or in my case being logged on with one account I imitate that my other account is located somewhere else. But yeah, in previous post “Appache and MySql” I already installed web server and set it up to user own directories. So let’s create a personal web page for our new, figuratively speaking, remote user using ssh. After establishing connection check the working directory by command “pwd”. If it shows “/home/testalex123″ then we are good to go. Firstly we need folder for personal web page, so type following: “mkdir public_html” and then simply go into it “cd public_html”. Now we need an index page and some simple html mark-up to test things. To do so, we can used terminal based text editor, but since we just need to test things we can simply type command: “echo ‘<h1>Hello</h1><p>ssh working properly. <h3>We are online and ready</h3>’ > index.html”. Alright so the final part is actual test – navigate browser to “localhost/~testalex123″
SshTestScreen
So if you see that in your browser – then the surgery was successful. Yes, we manged to do things figuratively remotely and what is more important – it wan no more difficult then doing things on your own machine. That’s it!

530136

Apache and MySql

#Apache
So… Apache is apache – nothing to say – just install and use it. To do so in the terminal the following command should be executed: “sudo apt-get install apache2″. And if you manage to type your sudo password correctly – after couple of seconds it will be installed. You even can check it right away by navigating your browser to “localhost”.
ApacheWorksScreen
“It works!” your browser will say – no jokes. But to start creating your personal page would be nice to change physical directory on your computer for websites. The easy way is to set it up under user home directory where you and other user can have dedicated pages. To do so in good old terminal the following command should be executed – “sudo a2enmod userdir” after which the server need to be restarted – “sudo service apache2 restart”. Now to complete the preparation a directory “public_html” has to be created under user’s home directory. To check that it works – create simple “index.html” file under public_html directory and define there simple test paragraph or header.
userPageScreen
Here we go. Quick and easy just in few minutes we can start creating a web page.

#MySQL
Well, you know, sooner or later you’ll come to a point where there will be need for database and MySQL is a good choice. To manage with it you can use either phpMyAdmin or command based client. Today I’m in a command line mood so just type in terminal the following command: “sudo apt-get install mysql-server mysql-client”. And yeps, now we can play with it a bit. You can run it by command “mysql -u root -p” and then just create first database.

For test purposes, I’ll create database where information about courses I’m currently taking will be kept.

  • So “Create Database hhCourses”.
  • The next thing is to create little teacher table: “CREATE TABLE Teacher(id INTEGER PRIMARY KEY, name NVARCHAR(50), email NVARCHAR(50));”.
  • Second table I need is Room: “CREATE TABLE Room(number INTEGER PRIMARY KEY, type NVARCHAR(50));”.
  • After that I need table which would represent course modules: “CREATE TABLE Module(id INTEGER PRIMARY KEY, code NVARCHAR(10));”.
  • And finally the main course table: “CREATE TABLE Course(id INTEGER PRIMARY KEY, name NVARCHAR(100), dayOfWeek NVARCHAR(10), courseTime TIME, moduleId INTEGER REFERENCES Module(id), roomNumber INTEGER REFERENCES Room(number), teacherId INTEGER REFERENCES Teacher(id));”.

showTablesScreen

Now it is time to put into it some data:
INSERT INTO Teacher VALUES(1, ‘Pekka’, ‘pekka@mail.com’);
INSERT INTO Teacher VALUES(2, ‘Juhani’, ‘juhani@mail.com’);
INSERT INTO Teacher VALUES(3, ‘Tero’, ‘tero@mail.com’);

INSERT INTO Module VALUES(1, ‘SYS’);
INSERT INTO Module VALUES(2, ‘DAT’);
INSERT INTO Module VALUES(3, ‘ITP’);

INSERT INTO Room VALUES(4004, ‘lab’);
INSERT INTO Room VALUES(1001, ‘lecture’);
INSERT INTO Room VALUES(5001, ‘lab’);
INSERT INTO Room VALUES(5009, ‘lab’);

INSERT INTO Course VALUES(101, ‘Development project’, ‘MON’, ’10:00:00′, 1, 4004, 1);
INSERT INTO Course VALUES(102, ‘Linux’, ‘THU’, ’12:00:00′, 2, 5001, 3);
INSERT INTO Course VALUES(103, ‘Java’, ‘WED’, ’16:00:00′, 3, 5009, 2);
INSERT INTO Course VALUES(104, ‘Mobile’, ‘FRI’, ’08:00:00′, 3, 5009, 2);

Check:
tableDataScreen

That’s it folks! Play around and enjoy.