Convert diff output to colorized HTML

If you search the web you can find a number of references to programs/scripts that convert diff output to HTML. This is a bash version. The script expects “unified” diff output (diff -u) on its standard input and produces a self-contained colorized HTML page on its standard output. Consider the two files: #include <stdio.h> // main main() { printf(“Hello … Continue reading Convert diff output to colorized HTML

How to Convert Date and Time from One Time Zone to Another

Using PHP It’s really simple to convert a DateTime from one time zone to another in PHP. Just create a DateTime object using date & time to be converted as the first parameter and the original time zone as the second parameter. Then change the time zone to the desired one using the setTimezone method. That’s all! $date = new DateTime(‘2022-02-01 … Continue reading How to Convert Date and Time from One Time Zone to Another

Java Socket Programming – Send the file using TCP Sockets

Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server. When the connection is made, the server creates a socket object at the end of the communication. The client and the server can now … Continue reading Java Socket Programming – Send the file using TCP Sockets

C Socket Programming – Send the file using TCP Sockets

Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server. When the connection is made, the server creates a socket object at the end of the communication. The client and the server can now … Continue reading C Socket Programming – Send the file using TCP Sockets

Handling complex number using C++ class

#ifndef COMPLEX_H #define COMPLEX_H #include <iostream> #include <fstream> #include <string> #include <complex> class Complex { private: double real; double imag; public: Complex(); Complex(const Complex& obj); Complex(const std::string& str); Complex(double real); Complex(double real, double imag); double real_num() const; double imag_num() const; std::string toString() const; Complex operator+(const Complex& rhs) const; Complex operator-(const Complex& rhs) const; Complex operator*(const … Continue reading Handling complex number using C++ class

Sliding Block Puzzle Solver(2×3, 3×2, 3×3) – C++ Programming

A program written in c language to solve a 2×3, 3×2, 3×3 sliding block puzzle. 1. DFS (Brute-Force)We can perform depth-first search on state space (Set of all configurations of a given problem i.e. all states that can be reached from initial state) tree. Image source: https://courses.cs.washington.edu In this solution, successive moves can take us away … Continue reading Sliding Block Puzzle Solver(2×3, 3×2, 3×3) – C++ Programming