Problem with NGINX - Unprocessable entity localhost

Category: Better programmer :: Published at: 09.06.2024

When you try to run application, for example on Amazon Linux server, and trying to connect it
with a domain with the use of NGINX you can encounter some problematic issue.

You're starting server but, and it works, but when you try to make POST request, you're getting 422 Unprocessable Entity error.

This is because your application is still sending localhost Header, an this is not recognized by the app.

To fix this you need to modify your NGINX configuration

Read more

How to create SystemCTL Service on Amazon EC2 to run application on start

Category: Better programmer :: Published at: 06.05.2024

There are two simple ways to run application on Amazon EC2.

One is to run screen command and run application there as a process.

Second one, probably better, is to create SystemCTL Service which you can run later.

This is how to do it:

Read more

The role of foreign keys in SQL database

Category: Ruby :: Published at: 31.05.2023

5 rules, why we use Foreign Keys in our databases:


  1. Relationships establishment - we can create relations between tables, and even inner join relation within one table between two records
  2. Data Integrity - for example, you can create an order with client_id for client which does not exist in the database
  3. Data consistency and accuracy - when foreign key is defined, it restricts the values that can be inserted or updated in the referencing column
  4. Data querying - thanks to the foreign keys we can retrieve data from multiple tables faster and easier
  5. Data maintenance - it helps cascading updates and deletions, preventing locks mechanisms

MonkeyPatching in Ruby - simple example

Category: Ruby :: Published at: 25.05.2023

MonkeyPatching in Ruby is actually extremely easy to understand and use.

We can monkey patch any ruby class, and this is how to do it.

Read more

Run one spec multiple times

Category: Ruby :: Published at: 22.05.2023

Simple code to run one spec multiple times:

for i in `seq 10`; do rspec spec; done

How to create simple Docker container with Python code?

Category: Machine Learning :: Published at: 04.03.2023

This is how i usually create a simple Docker container for Python code:

Read more