A funny way to restrict access to website hosted on S3

S3 is a popular choice when you want to host a static website. Often, “a website” means a public website. But not all websites are made to be public. If you tried googling the options to restrict access to the website, you’ve probably seen the recipes like restricting based on IP addresses or even 3-rd party services.

IP address-based approach doesn’t work for me, because I often work from home and I definitely don’t want to whitelist my ISP’s subnets. The 3-rd party services are by default to be avoided when it’s about security. So I had to look for alternatives.

Read More

Using CloudFormation to route the webhooks

What I find most interesting about AWS, is that there’s no distinction between “normal services” (e.g. DynamoDB) and “infrastructure services” (e.g. CloudFormation). In both cases there are APIs. Your code can use the DynamoDB API to save the data, as well as it can use the CloudFormation API to understand which componets your system consists of.

Read More

Generate Java code documentation with QDox, EJS, Nashorn and Asciidoctor

Javadoc comments are a nice approach to documenting the code. By following a specific comment structure, you can describe what the classes are responsible for and what the methods do. Many developers use the standard javadoc tool to generate documentation.

But what if your client asks for custom documentation? In this post I want to show how QDox and Asciidoctor make it a straightforward task.

Read More

Enforce software design with Checkstyle and QDox

Developers care about the code they write. They build tools that enforce spaces instead of tabs, forbid 1-letter identifiers and ensure that every class and method has Javadoc comments. One example of such a tool is Checkstyle.

But usually, it’s not code style violations that makes code hard to read and maintain. More often, it is higher level code organization (software design) – all the decisions made about classes, their responsibilities, connections between them, etc.

Tools like Checkstyle surprisingly won’t help you to avoid making your view layer go directly to the database. In this post I want to show how to implement this kind of design constraint by building a custom Checkstyle check.

Read More

Use Asciidoctor to create great publications

I’m a big fan of Markdown. I really love this idea of lightweight markup – you write plain text, mix it with formatting instructions and get your text formatted. I like it, because it feels very similar to writing the code.

Asciidoctor is another lightweight markup processor. It’s similar to Markdown, but more powerful – it can do more than just making your text bold or underlined. Asciidoctor is what Spring team uses to write their documentation.

Read More

How do Protractor and Angular synchronize?

One of the annoying things about writing Selenium tests is that you must ensure to only interact with the page at the right moments of time. Buttons tend to trigger asynchronous operations, so after you click a button, you should wait for the this operation to finish before you go any further.

The common practice is to poll the DOM – “as long as this spinner element is visible, operation is running” (WebDriverWait). However, in different scenarios your spinners may be different DOM elements and sometimes you may not have a spinner at all, which makes this approach harder to implement.

Protractor somehow handles asynchronous operations transparently. How does it do it?

Read More