Docker Cheat sheet, a general cheat sheet for all use case
Docker general Help - docker COMMAND --help This is for each command’s detail For example, docker run --help TL;DR docker run <image> - to initialize a new container docker start <container_name> start running the “stopped” container docker stop <container_name> docker run - Initialize a container Run a command in a new container Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Basic form to initialize a container, or to run a command...
Spring Boot Controller Service Repository
Spring RESTful service Laur Spilca Youtube Tutorial series spring docs Spring Restful service is a popular backend application. The architecture usually is made up with 3 layers: Controller, Service, and Repository. Configuration setup @SpringBootApplication - define the app root The start point of program It’s with @ComponentScan - tell spring to create beans in which the classes have been annotated with. Spring RESTful Service architecture Spring RESTful service usually has this architecture....
Curl cheat sheet, for web developement
HTTP Request Specify Method by -X Form: curl -X <METHOD> <URI> By default, it uses GET method curl https://www.google.com/ # same as curl -X GET https://www.google.com/ Use Post simply by: curl -X POST https://www.example.com/ GET Get entire document of the website in terminal curl https://www.google.com/ POST curl -X POST https://example.com/ More complex, pass data, -d and header -H to server. Below shows POST with json body curl -d '{"option": "value", "something": "anothervalue"}' \ -H "Content-Type: application/json" \ -X POST https://example....
Java Abstract Class and how to use it? When we combine it with interface?
Java abstract class An abstract class is like a structure of data. However, unlike interface, it can define methods and attribute. You can view it as an enforced blueprint for an object. You cannot initiate an object from it but from its sub-classes. An abstract class is: It cannot be instantiated It can contain constructor and object fields. Contains abstract method (0 to many), and concrete methods Its subclasses must override its abstract method An abstract class example:...
Java IO package - What is RandomAccessFile and how to use it
RandomAccessFile This allows you to read from it or write to it as you please. You can replace the content of the file. This cannot achieve by FileInputStream or FileOutputStream. Create a RandomAccessFile object RandomAccessFile file = new RandomAccessFile("file.txt", "rw"); Mode Description r Read mode. Calling write methods will result in an IOException. rw Read and write mode rwd Read and write mode - synchronously. All updates to file content is written to the disk synchronously....