Interesting patterns: Proxy

Imagine a class which wraps an external API or read large files or parses huge XML files, fetches data from the Internet or something else. There are thousands of situations like that.


In many cases, you can want to not parse/download/load some resources every time, right?. A good option is to use a cache but, to be honest, it’s difficult. In this article I’ll show you a simple and flexible solution.

Interesting patterns: Marker interface

Some time ago I got my friend’s code to review. Nothing special. After a few minutes of reading, I noticed that he added an empty interface to the definition of some classes. I was ready to write a comment about it but I heard a voice in my head to ask Google first.


I’ve discovered something interesting. A long time ago, when Java 1.5 was not yet released and annotations were not available in the language it was common to use something called “marker interface”. What is marker interface?


An agony of trying to do the job

I’ll tell you a story of Igor. Igor is a web developer. He’s a young man with a girlfriend and some ambitious plan in the future. Igor sit at his desk because he has some work to do. In front of him is a PC. He turns it on and sees some system updates. 30 minutes have passed, and he can see his desktop with a beautiful wallpaper. Funny cats always make his day better. Some people are walking around his working desk, talking and drinking coffee. A typical day.


The IDE is on, but he cannot start working immediately because it’s indexing your project. It takes two extra minutes. Igor is okay with it – more time to finish the coffee is always a good idea.


History of WWW


The history of the WWW wasn’t simple and still isn’t easy. In the beginning, it was a complete mess. Every browser tried to meet developers halfway without any standards or cooperation with other web browser’s developers. Interested?

It all started with Memex – a theoretical machine created by Vannevar Bush with the ability to create links between documents and books and add comments to them. Until early 90’ Memex was derided and described as unreal because we had no tools to implement this idea. But then modern computers appeared…

Indexing in MySQL


Why do we use indexes? Searching through a row in a sorted file with N length takes O(log2N) comparisons and the same number of reads from a filesystem which is heavy itself. However, tables in databases are not sorted which complicates the operation, Especially, if you have a lot of reads, updates and deletions on them. Writing the sorted version of the file (table) would dramatically slow the database down. There is one more thing which makes it even more complicated: every table may be sorted in more than one order. That’s why we use indexes which hold only attributes used in sorting and a reference to the place where the data are kept.

How to pass a variable to Android activity


I’ve started learning Java and Android. I will tell more about the project in the future. After a while, I tried to pass an object to Android activity to give a possibility to edit some data in a form. Because you do not create activities directly, you cannot just pass them to a constructor or add a setter to it. It’s more complicated.

I started looking for an answer and I found a post on StackOverflow with few possible solutions.

How to hack #4 – XML External Entity Processing


Today, we use XML files over JSON because of old, legacy applications which support communication only using XML files (for example SOAP) or because the XML Schema which is much more adult than JSON Schema or Swagger. Or you like XML or… you use Java! Anyway, regardless of the reason for your decision using this standard may be dangerous and today I want to show you one of the attacks called XML External Entity Processing (XEE).

How to hack #3 – Clickjacking

Today, I will show you one of the most common tricks that are used to force users to click on something we do not want. I developed a simple jQuery plugin to make it simpler.

What is clickjacking?

It’s described very on Wikipedia but in a very simple sentence: users click on something different than they think they do. Example? Do you remember pop-ups with an X and when you click on it and another website shows up? Facebook is protected against this attack but imagine: you are on an interesting website, you click a “Read more” button and… you liked a Facebook profile. Then, you click one more time (because you think something did not work) and you go to the page you wanted. In very many cases you would not realize you added a Like somewhere. Sounds interesting?

Why Bitcoins may not be a good option


A few days ago, I heard the news that the value of 1 bitcoin is same as an ounce of gold. I thought it’s interesting. Why?

In the 17th Century, people LOVED tulips. They were very popular. The price of tulip bulb was rising so many people noticed it’s a good idea to become wealthy. Speculative bubble that was created mostly in 1636-1637 let some people earn a lot of money, but a lot of people lost everything because of it. Why did that happen? Because the bulbs were so expensive that nobody was interested in buying it only to plant them in his garden. They cost too much.

Let’s back to Bitcoins

Why do I write about tulips in an article about Bitcoins? In my opinion, the news that Bitcoins are becoming more and more expensive causes that less and fewer people may be able to buy it. So if there will be no buyers, then sellers will not be able to sell Bitcoins, and they will have to decrease the prices to get their money back.

I think it may be a problem with this virtual currency. People get money by buying and selling it, but one day they may lose everything like people in 17th Century. Imagine that in one day Bitcoin fails 75% of his value. Everyone who keeps a lot of money in the markets may lose 75% of their saving so even everything. Lots of markets may be closed after declines. In one word: chaos in virtual currency words.

How to hack #1 – SQL Injection


Security becomes more and more important. Clients will not use our products if they will not trust us. On the other hand, sensitive data are a tasty morsel for attackers who can try use this data to grant access to another website or use them for phishing and so on. In this article, I will tell you about using this kind of vulnerabilities.

One of the most popular vectors of attack is SQLInjection. Almost every website on the Internet uses some kind of database like MySQL, PostgreSQL, MSSQL and so on. SQLi is a technique where an attacker edits a request to modify an SQL query to get information to which access does not have.

3 ways to ignore files in GIT

Almost everyone heard about and used GIT. It is a good idea to know better tools we use so I found 3 ways to ignore file/folder you may not know. Interested?

.gitignore file

This is the most popular way to remove some items from your repository. Just add the .gitignore file to your project and it just works. You need to remember that if you add the file to ignoring list it will be applied to every collaborator.