Skip to main content

Posts

Showing posts from May, 2017

Installing NGINX on macOS

I have heard of a lot of NGINX recently. One of them was it can help for security issues; for sure, it much be more. It so happens that our team has got a ton of user stories from a security audit. It's time to delve into it. What is NGINX? In order to get a basic idea and have some fun , I've just picked some available posts from my favorite Vietnamese blogger communities as below: https://kipalog.com/posts/Cau-hinh-nginx-co-ban---Phan-1 https://viblo.asia/hoang.thi.tuan.dung/posts/ZabG912QGzY6 NGINX (pronounce: Engine-X) is a web server (comparing to IIS, Apache). It can be used as a reverse proxy ( this is what I need for security issues with configuration ), load balancer and more. How to get started? I found the below path for learning NGINX by googling "learn nginx": https://www.quora.com/What-are-some-good-online-resources-to-learn-Nginx In this post, I only went first step. This is installing NGINX on macOS and taking a first look at the confi...

Today I Learned - Git at First Glance

Getting Started It's always fun to jump right in to the "HelloWorld" app. Just go for it! Visit: https://try.github.io/levels/1/challenges/1 Cheatsheet It's time for us to store our "magic tools". Visit:  https://www.git-tower.com/blog/git-cheat-sheet Which collaboration way fit your team? Git is just a tool which doesn't teach you how to work properly in a team. It depends on your projects and you need to choose your own team workflow. Visit: https://www.atlassian.com/git/tutorials/comparing-workflows

Make Our Code More Testable with Proxy Design Pattern

If you heard about the term separation of concerns , you could agree this concept is very important for making a system "clean". One of the most important characteristics of a clean system is testable. Let me tell you my story about how I've just come acrosss the design pattern Proxy. Note: to get started, you can find a very simple example of the pattern Proxy  here .  Let's start! I have an interface as below: public interface DocumentGenerator { File generate(Document document) throws BusinessException; } The following is my first implementation for a concrete class of DocumentGenerator . public class DocumentGeneratorImpl implements DocumentGenerator { private Dossier dossier; private Locale locale; public DocumentGeneratorImpl(Dossier dossier, Locale locale) { validateNotNullParams(dossier, locale); this.dossier = dossier; this.locale = locale; } private void validateNotNullParams(LibertyDossier dossier, Locale locale) { if(Objec...

Separate Constructing a System from Using It

I n the real world, in order to use a building (hotel, supermarket, etc) we need to construct it first. This concern should be applied for software development as well. Step by step, I would like to show you the issue about no separation of constructing and using it and then I'll give you some approaches to overcome this issue. | Note : you can find the  below  demonstrated code here    Take a Look the Following Simple Application Used tools and technologies: Eclipse (Mars), JDK 1.8 I had an App which uses Controller . Controller uses Service (an interface). Finally, Service has one concrete class is DefaultService . //package vn.nvanhuong.system.separationconstructing; public class App { public static void main(String[] args) { Controller controller = new Controller(); controller.doAction(); } } public class Controller { private Service service; public void doAction(){ System.out.println("doAction in Controller"); getService().execut...