Skip to main content

Posts

Docker commands

50 Essential Docker Commands for Developers 50 Essential Docker Commands for Developers Command Description docker run Creates and starts a new container from an image. docker ps Lists running containers. Use `docker ps -a` for all. docker stop Stops a running container. docker start Starts a stopped container. docker restart Restarts a container. docker kill Forcefully stops a container. Use with caution. docker rm Removes a stopped container. docker rmi Removes an image. Remove dependent containers first. docker images Lists available images. docker build Builds an image from a Dockerfile. docker pull Downloads an image from a registry. docker push Uploads an image to a registry. docker exec Executes a command inside a container (e.g., `bash`). docker logs Displays container logs. docker cp Copies files between container and host. docker inspect Displays detailed...

RAG Architecture

RAG -  Retrieval: Uses a vector store to fetch relevant contextual data. Augmentation: Combines the retrieved documents with the original query before calling ChatGPT. Generation: The AI model (ChatGPT) generates a response based on the augmented input .

mTLS

The client and the server interaction, sequence diagram -  Configuring Keystores (JKS) and Truststores for mTLS in Java Configuring Keystores (JKS) and Truststores for mTLS in Java 1. What Are Keystore and Truststore? Keystore (JKS) : Stores private keys and public certificates. Truststore : Stores trusted CA certificates. Component Purpose Contains Keystore (JKS) Stores private keys and public certificates Private key + Public Certificate Truststore Stores trusted CA certificates CA Certificates + Trusted Public Certificates 2. Generating Keystore and Truststore Step 1: Generate Server Keystore (JKS) keytool -genkeypair -alias server -keyalg RSA -keysize 2048 \ -dname "CN=server, OU=IT, O=Company, L=City, ST=State, C=IN...

C4 Daigram

Understanding Complex Systems with C4 Diagrams A C4 diagram is a graphical representation of a software system's architecture, structured into four hierarchical levels: Context , Containers , Components , and Code . This model was developed by Simon Brown to provide a clear and concise way to communicate the architecture of complex systems. Levels of the C4 Model Context Diagram (Level 1) : Shows the system in scope and its interactions with users and other external systems. It provides an overview of how the system fits into its broader environment. Container Diagram (Level 2) : Decomposes the system into interrelated containers such as applications or data stores. It illustrates how these containers interact with each other. Component Diagram (Level 3) : Further decomposes containers into individual components. It details how these components interact within their container or with other containers/systems. Code Diagram (Level 4) : Offers detailed insights into ...

Recursion & Choice

Understanding Recursion and Choice Diagrams with Examples Understanding Recursion and Choice Diagrams with Examples Recursion is a powerful concept in programming where a function calls itself to solve smaller instances of the same problem. It's often used in solving complex problems that can be broken down into simpler subproblems. In this blog post, we'll explore the basics of recursion, understand choice diagrams, and see examples to illustrate these concepts. What is Recursion? Recursion occurs when a function calls itself directly or indirectly to solve a problem. A recursive function must have a base case to terminate the recursive calls and prevent infinite recursion. Here's a simple example of a recursive function to calculate the factorial of a number: public class RecursionExample { public static void main(String[] args) { int number = 5; int result = factorial(...

Java Concurrency & Threads

My Blog Post Java Concurrency Topic covered here are Concurrency vs Parallelisim A process is a group of threads and thread is an smallest unit of execution. Every thread has two data areas i.e. Execution Stack and Program counter register . Execution stack is created when the thread starts, and it stores local variables, method call frames. A process is a group of threads and thread is an smallest unit of execution. Program counter register Keeps track of the address of the currently executing instruction Thread shares Heap Memory, Runtime constant pool and Method area Thread life cycle , Thread th = new Thread(), here the thread object is created but execution is not yet started, when the th.start() method is called thread is elligible to run or running state, when the thread completes or uncaught exception is throw thread state becomes terminated. A runnin...

Cloud Comparison

Azure vs AWS Infrastructure As A Service (AWS) EC2 Instance - elastic cloud compute Pricing  1. On demand - pay by hour or pay by second based on the type of instances  (Testing Purpose) 2. Reserved - reserved capacity for One or Three years (For Production, like reserved capacity requirement). The standard reserved instance - upto 72% of the reserved price. The Convertible reserved instances (change the reserved instance to greater capacity like t3 medium to t3 large - upto 54% off on the demand price). Scheduled reserved instance - like fraction of the day , window or month. 3. Spot instances -  instances would be terminated or hibernated if the, not available, price fluctuates  with supply or demand 4. Dedicated - physical EC2 instances, for Compliance or regulatory requirements or licensing requirement Savings plan - Commit for one or three years    (Azure) Azure Virtual Machines Serverless Computing   Function as a service - FAAS , T...