Thursday, 3 April 2014

Touching picture

Sometimes Warsaw can bestow on you a touching picture ...


Agriculture era invented wheel, today's information area invented computers and internet.

We live in the world of information. The information is handled using computers and the internet. There is no field in science or even in our everyday life that has not been influenced by computers or the internet yet. Is it true that these two great inventions nudged other great inventions and achievements?

When we come to think about it then we can come up with many ideas confirming this statement. Far and foremost, access to information as well as better and faster communication have enabled us to live a happier and longer life. Currently we can find solutions to our problems just by typing a few words in a search engine like Google. In many cases we no longer have to go and look for specialists or find a relevant book because modern algorithms can process information and return helpful results faster. In addition, people can communicate using emails, online chats, twitter, hangouts, skype and many other services. Social media give us an opportunity to stay in touch with our old friends and maintain professional and business connections.

The computer and the Internet were made by scientists for scientists. These people still use these technologies heavily and most effectively. Thanks to them we were able to build space crafts and calculate many things to eventually land safely on the moon. Recently, we have also landed the curiosity rover on Mars. Computers enable us to store and process information in many subject areas. Financial instruments are very complicated and without computers and the internet it would be rather impossible to trade them effectively and invest money in the areas that really need financial support. Besides, we store human genome in big databases and are close to finding solutions to many genetic diseases. Furthermore, physicists at CERN can notify all interested people of the latest results of their experiments via World Wide Web which actually was invented at CERN.

All in all, there have been many inventions but these two, namely computers and the internet, were milestones that laid the foundations of many other inventions and have enabled us to achieve such great results. We still can improve computers and the internet and make our mother earth an even better place to live.

Social settings in “Stones for the rampart”

A new war movie based on the book “Stones for the rampart” is a story of two lads in the Polish underground movement in 1944. The film, directed by Robert Gliński, perfectly shows the social settings in Warsaw during the Second World War. The main focus is on the youth who have to live in this severe circumstances. In addition, parents of the young people and Polish society as well as German soldiers are presented.

First of all, the film is about young, well-educated, brave, decisive and companionable young people living in occupied Warsaw. Rudy is one of the main characters who speaks German fluently. Not only that, but his sister plays piano well and amuses everybody during a party at home. This clearly demonstrates a high level of education in the interwar Poland. Furthermore, the movie depicts small acts of sabotage carried out by Polish underground movement, the Gray Ranks. The young people do not hesitate if there is any occasion to weaken or lampoon the enemy. For example, they hang a German uniform filled with straw on a street lamp in the city centre. The scouts are very brave and determined to fight in any possible way. Moreover, they value their friendship very much. They rescue their friend who was interrogated and tortured by German soldiers. This is when the film reaches its climax.

On the contrary, the remaining part of the society is frightened and generally they do not want to confront the German army. Parents of the scouts want to save their lives as well as their children's lives at all costs. They try to discourage their children from fighting. Also they strive to find any source of income which is very tough during war. Most of the Polish citizens are very poor and they suffer starvation. Children kill pigeons to eat meat whereas some adults trade guns and other arms. On the other side, German soldiers are very cruel and brutal. What's an example of this? They organise raids on the streets of Warsaw and torture many people in prisons.

In conclusion, the film illustrates different groups of society living in occupied Warsaw during World War Two. It was done in a clever and touching way. The whole movie does come across as true and convincing story in which the society is shown from different perspectives.

Friday, 14 March 2014

Emacs - set alt as meta key

I had Esc key set as the meta key in Emacs and wanted to change it to have alt key as my meta key. It was done by putting this command to the end of my ~/.emacs file:
  
(setq x-alt-keysym 'meta)

It wasn't straightforward to find this answer, so this is why I put it on my blog. Enjoy!

Saturday, 1 February 2014

know-how

Jeżeli coś wymaga specjalistycznego know-how, trudno to skopiować, a wówczas konkurencja na rynku jest niewielka i można dobrze na tym zarabiać. Naprawdę nie dziwi dlaczego Chiny stają się potężną gospodarką, bo nie każdy może sobie pozwolić na produkcję samolotów czy superkomputerów. Polska nadal nie ma zaawansowanego towaru lub usługi, dla której nie ma konkurencji. Ileż można chwalić się świetną kiełbasą, jabłkami czy innymi mało przetworzonymi produktami. Specjalistyczne know-how można przełożyć także na mniejszy kaliber. Zakładając firmę opartą na prostym modelu łatwym do skopiowania możemy tylko zacząć odliczać godziny kiedy pojawi się silny rywal, a może wystarczy spojrzeć za rogiem, bo pewnie tam nasza konkurencja już jest. Nie pozostaje zatem nic innego jak zacząć wgryzać się w zaawansowane technologie i posiąść właściwe know, a potem wymyślić how.

Tuesday, 28 January 2014

How did you implement a shooting algorithm for the game of Battleship?

Let me describe it a little bit. I took a course on Java programming at my university. I had to implement the game of Battleship in the framework of my project.

The application was divided into 3 parts: model, controller and view (traditional MVC). You could play the game in console using only the model part. The model package (module) contained the main class Model. The Model class contained two attributes of type Player (two players: fist and second) and shotPlayer attribute that denoted the player who could shoot (of type PlayerState). When a shot arrived, the PlayerState object routed the shot to the player that was shot. For example, if first player shot, the PlayerState object routed the shot to the second player.

The PlayerModel class contained the "opponentHit(Point point)" method. Point had two attributes: (x,y) coordinates of the shot. In the method, the shot was sent to the player's board called Sea. The Sea board consisted of fields. Each field had a state:

    /** Field is not used. */
    UNUSED,
    /** Field has been hit and it was a miss. */
    MISS,
    /** There is a mast and the field has not been hit yet. */
    SHIP,
    /** There was a mast, but the field has been hit. */
    HIT,
    /** There was a mast and the ship (which contained the mast) was sunk. */
    DESTROYED

Each stated of the field decided on the transition to the next state and the new state was returned. I used the state design pattern here. The coordinates of the point determined the field of the Sea. If the previous state of the field was UNUSED then there was a miss. If the previous state of the field was SHIP then there was a hit. Otherwise, the shot should be repeated.

The code can be found here: https://github.com/adam-dziedzic/battleShips

Sunday, 29 December 2013

CLASSPATH

This: http://kevinboone.net/classpath.html is really great explanation of the classpath in Java. Worth reading!