Run a program forever in linux

Running programs indefinitely ensures that services and applications are always available, reliable, and capable of handling real-time data and tasks effectively. So People often want to run programs indefinitely on computers. In Linux, if you have root access, you can use systemctl to manage services and ensure that they run continuously. Without root access, you … Read more

The simplest scatter boundary in electromagnetic

In computational electromagnetics, the scatter boundary (also known as the radiation boundary or far-field boundary) is an artificial boundary that simulates the infinite extent of free space surrounding a finite computational domain. This boundary is used to terminate numerical simulations, ensuring that the outgoing electromagnetic waves do not reflect back into the computational domain. For … Read more

Automation for Optimization in Comsol

The Optimization Module in COMSOL Multiphysics provides tools for optimizing designs by finding the best combination of parameters to satisfy certain objectives or constraints. It’s commonly used in engineering and physics simulations to optimize designs for various applications. Besides the parameters sweeps and basic design parameters optimizations, it provides some automation for more complex optimization. … Read more

Detect proxies and user IP by PHP

To get the IP address of a visitor in PHP, you can use the $_SERVER superglobal array, specifically the $_SERVER[‘REMOTE_ADDR’] variable. To handle cases where the visitor’s IP address is masked by proxies or load balancers, you can check for specific HTTP headers that may contain the original IP address. Common proxy headers include X-Forwarded-For, … Read more

Run directly or in docker container

Containerization is a technology that allows you to package an application along with its dependencies and runtime environment into a self-contained unit called a container. Docker provides tools and a runtime environment to create, deploy, and manage containers efficiently. The advantages and disadvantages of Docker: Advantages of Docker Disadvantages of Docker Isolation and Portability Learning … Read more

Infix expression to prefix expression and function calls

In computer science and mathematics, expressions can be represented and manipulated in different formats, such as infix, prefix (also known as Polish notation), and postfix (also known as Reverse Polish Notation or RPN). Each format has its advantages and use cases, and understanding all three can be beneficial for various reasons:Prefix Notation (Polish Notation): In … Read more

Microstrip Lines

Microstrip lines are a type of transmission line used in microwave and RF (radio frequency) engineering for routing signals on printed circuit boards (PCBs) and integrated circuits (ICs). They are widely used due to their simplicity, ease of fabrication, and cost-effectiveness compared to other transmission line technologies like stripline or waveguides.A microstrip line consists of … Read more

How to get the tangential and normal components of fields from FEM softwares?

Finite Element Method (FEM) software often provides results in Cartesian coordinates due to its inherent computational approach. The FEM breaks down complex problems into smaller, manageable elements, typically triangles or quadrilaterals in 2D or tetrahedra and hexahedra in 3D. These elements are defined by their vertices and edges, forming a mesh that covers the entire … Read more

Useful formula for electromagnetism

Here are some useful vector identities commonly used in electromagnetic theory: Gradient of a scalar function: \[ \nabla (\phi) = \frac{\partial \phi}{\partial x} \mathbf{\hat{i}} + \frac{\partial \phi}{\partial y} \mathbf{\hat{j}} + \frac{\partial \phi}{\partial z} \mathbf{\hat{k}} \] Where \(\phi\) is a scalar function and \(\mathbf{\hat{i}}\), \(\mathbf{\hat{j}}\), and \(\mathbf{\hat{k}}\) are unit vectors along the \(x\), \(y\), and \(z\) … Read more