[Java Concurrency] 02: Runnable

One of the methods to run tasks in multiple thead is to pass Runnable instance to thread and call that start() method. Runnable is a Functional interface that has only one method that returns void. If you prefer the lambda syntax, you can write the above code like so: However, for tasks with more than … Read more

[Java Concurrency] 01: Thread & Process

What is a thread? Thread is the smallest execution unit that can be schedule by the operating system. A process is a running program. When you start a program, you create a process.In one process, there can be more than one thread. Threads in a process share an environment created by the process. System vs … Read more

Configure HAProxy to Accept Preflight Requests (CORS)

Recently I developed an API with Spring Boot. All the tests on the local environment went well with Postman. However, when deploying to prod through HAProxy, I got this CORS error: There are also other errors regarding missing headers, origin… There are some solutions available, such as adding code to my Spring Boot code base. … Read more

Fix Angular 404 on reload Nginx

To keep it short, here is the code you need to replace in /etc/nginx/conf.d/default.conf You may want to update server_name to your domain name if you are not deploying in docker. Otherwise, this config works with docker. Give it a try, you’ll see that the 404 page is gone when you refresh your site.

Ubuntu package management cheat sheet

Most used commands (copy directly from the man page) To remove a package To install a package List installed packages Search an installed package To remove mulitple packages using regex wildcard: For example, you want to remove all php related packages on your system, you can do like this: You’ll see messages like these: It … Read more