Wednesday, 13 November 2013

Essay - how should we behave?

There is no general and final rule that could establish the way of our behaviour. There were different philosophical as well as religious concepts that strived to give us a recipe for life, but without success. Moreover, there is always a clash between conservative and liberal approaches to life.
Technology seems to be the one of the sources of frictions between older people and teenagers. The elder are reserved towards new electronic devices, whereas young generation absorbs them rapidly and uses them everywhere, especially in public places. In my view, young people should neither play songs noisily from their smartphones in public places nor telephone to somebody and talk loudly. It can be really annoying. On the other hand, sitting there and waiting for somebody or going by bus and doing nothing can be boring. Then, the person can read something on a tablet, listen to music using earphones, play a game or textchat with somebody. It is at least difficult to get to know somebody in a bus, so why not to catch up with your friends on Facebook. The best way to solve the problem is to have both sides the elder and younger to sit there and talk about technology. Maybe, this time young people could teach  something their parents and grandparents.
We should remember about individualism. We should not be concerned about other people's judgement about us. Only then can we be creative and enthusiastic. Each of us has his or her big value as an individual. We ought to be aware of that since this forms a fundamental role in our personal and professional life. I fully agree with this. However, we do not have to become rebels. The case is to find our own paths in our lives and follow them even against the odds. Everybody will die someday, so we have nothing to loose. It is easy to copy others. Although it is much harder to be innovative, it gives more fun and satisfaction.

All in all, our behaviour is a result of many factors. Each of us had better find their own path, but at the same time be tolerant and be aware of different opinions. We should inhibit the bubbles created around us by the other people from inflating. We must stay hungry, full of energy and open-minded.

Friday, 8 November 2013

Who is an outcast?

I'm attending an online course on Algorithms, Part II by Robert Sedgewick and Kevin Wayne. I implemented a tool that uses WordNet data to determine an outcast in a group of words. What was interesting about that? There was a file outcast2.txt which contained only two words: von_Neuman and Turing. Here is the result of a test:

Test 1: test outcast() on WordNet digraph
  *  outcast2.txt
     -  nouns = Turing von_Neumann 
     -  student   outcast() = von_Neumann
     -  reference outcast() = Turing
 
It occurs that Turing was an outcast, not von_Neuman. Hmmm, according to the video by Bret Victor http://bit.ly/1d47YgE, if we had listened to all von_Neuman's theories, we all would write code in an assembly language ;)

Sunday, 20 October 2013

Algorithms (graphs)

34.2-2 (Cormen, Leiserson, Rivest, and Stein, Introdution to Algorithms, 3rd edition)

Prove that if G is an undirected bipartite graph with an odd number of vertices, then G is nonhamiltonian.

Introduction to the problem
A bipartite graph is a graph whose vertices can be divided into two disjoint sets A and B such that every edge connects a vertex in A to one in B, that is, A and B are each independent sets.

Examples of bipartie graphs:

As we can see, in the upper picture the graph with odd number of vertices is nonhamiltonian. The second one is hamiltonian.

Proof
Let G=(A∣B,E) be a bipartite graph. To be Hamiltonian, a graph G needs to have a Hamilton cycle: that is, one which goes through all the vertices of G. As each edge in G connects a vertex in A with a vertex in B, any cycle alternately passes through a vertex in A then a vertex in B.

There are odd number of vertices, so |A|!= |B|. Suppose, without loss of generality, that |A|>|B| , that is, that there are more vertices in A than in B. Let |A|=m,|B|=n. Suppose G has a Hamilton cycle C.
Let that cycle start at u∈B. After 2n edges have been traversed, we will have arrived back at u again, and all the vertices of B will have been visited. But there will still be m−n vertices in A which have not been visited. Hence G cannot be hamiltonian. 

QED

Saturday, 19 October 2013

Thus, there is limited but practical research at Google, blue-sky research at CERN and "the sky is the limit", sometimes useless research in academia.

http://www.youtube.com/watch?v=jJ-IwnnjBy0

Friday, 18 October 2013

A solution to Exercise 35.2-5 in the book "Introduction to algorithms" by Cormen, Leiserson and Rivest.

Suppose that the vertices for an instance of the traveling-salesman problem are
points in the plane and that the cost c(u,v) is the euclidean distance between
points u and v. Show that an optimal tour never crosses itself.


 
If the optimal tour crosses itself then it can be in a manner shown in the attached picture. Thus, there are edges AC and DB (a tour with crossing) instead of AB and DC (optimal tour). The edge AC can be represented as a sequence of edges: AX and XC. The same can be done for edge DB, which can be represented as a sequence of edges: DX and XB. By the triangle inequality, AB < AX + XB (red) and DC < DX + XC (green). In this case, we can show that the optimal tour cannot cross itself, because: AB + DC < AX + XB + DX + XC = (AX + XC) + (DX + XB) = AC + DB. Now, we can generalize the case, and have a cross between more than two consecutive vertices, for example, A'C' and AC, but then we can see from the picture, that we will have to turn back at some point, for example from A to C (instead of going forward), which lengthen the path even more.

Tuesday, 1 October 2013

Saturday, 31 August 2013

Facebook, Youtube, LinkedIn and other CSS and JavaScript files from CDNs not loading on Ubuntu

I used to live in a dormitory in Warsaw. Many times there was a problem with a DNS server. It was broken regularly and it was blooming ridiculous as the building was a property of a technical university.

Anyway, there was a problem with DNS on my own router. It occurred that Ubuntu automatically assigned primary DNS setting to my router and it was broken. I found the solution here: http://bit.ly/17tDSQG Then according to my "standard" procedure changed the DNS settings for my local connection: http://bit.ly/1dvAuuP and "voila" it worked. Facebook, Youtube, LinkedIn and some other big players could load their CSS files and other resources!

My current settings: