Conan C++ Package Manager

install conan

sudo apt install python3-pip
pip install conan

looking for library

conan search poco --remote=conancenter

creating a conanfile.txt inside our project’s folder with the following content:



Next step: We are going to install the required dependencies and generate the information for the build system:

$ conan profile new default --detect  # Generates default profile detecting GCC and sets old ABI
$ conan profile update settings.compiler.libcxx=libstdc++11 default  # Sets libcxx to C++11 ABI
$ mkdir build && cd build  #create build folder of cmake binary
$ conan install ..           #install libraries
#or conan install .. --settings os="Linux" --settings compiler="gcc"

Now let’s create our build file. To inject the Conan information, include the generated conanbuildinfo.cmake file like this:

 cmake_minimum_required(VERSION 2.8.12)



 add_executable(md5 md5.cpp)
 target_link_libraries(md5 ${CONAN_LIBS})

C Libraries


double atof(const char *str)
Converts the string pointed to, by the argument str to a floating-point number (type double).
int atoi(const char *str)
Converts the string pointed to, by the argument str to an integer (type int).
long int atol(const char *str)
Converts the string pointed to, by the argument str to a long integer (type long int).
double strtod(const char *str, char **endptr)
Converts the string pointed to, by the argument str to a floating-point number (type double).
long int strtol(const char *str, char **endptr, int base)
Converts the string pointed to, by the argument str to a long integer (type long int).
unsigned long int strtoul(const char *str, char **endptr, int base)
Converts the string pointed to, by the argument str to an unsigned long integer (type unsigned long int).
void *calloc(size_t nitems, size_t size)
Allocates the requested memory and returns a pointer to it.
void free(void *ptr)
Deallocates the memory previously allocated by a call to calloc, malloc, or realloc.
void *malloc(size_t size)Allocates the requested memory and returns a pointer to it.
void *realloc(void *ptr, size_t size)
Attempts to resize the memory block pointed to by ptr that was previously allocated with a call to malloc or calloc.
void abort(void)
Causes an abnormal program termination.
int atexit(void (*func)(void))
Causes the specified function func to be called when the program terminates normally.
void exit(int status)
Causes the program to terminate normally.
char *getenv(const char *name)
Searches for the environment string pointed to by name and returns the associated value to the string.
int system(const char *string)
The command specified by string is passed to the host environment to be executed by the command processor.
void *bsearch(const void *key, const void *base, size_t nitems, size_t size, int (*compar)(const void *, const void *))
Performs a binary search.
void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*))
Sorts an array.
int abs(int x)
Returns the absolute value of x.
div_t div(int numer, int denom)
Divides numer (numerator) by denom (denominator).
long int labs(long int x)
Returns the absolute value of x.
ldiv_t ldiv(long int numer, long int denom)
Divides numer (numerator) by denom (denominator).
int rand(void)
Returns a pseudo-random number in the range of 0 to RAND_MAX.
void srand(unsigned int seed)
This function seeds the random number generator used by the function rand.
int mblen(const char *str, size_t n)
Returns the length of a multibyte character pointed to by the argument str.
size_t mbstowcs(schar_t *pwcs, const char *str, size_t n)
Converts the string of multibyte characters pointed to by the argument str to the array pointed to by pwcs.
int mbtowc(whcar_t *pwc, const char *str, size_t n)
Examines the multibyte character pointed to by the argument str.
size_t wcstombs(char *str, const wchar_t *pwcs, size_t n)
Converts the codes stored in the array pwcs to multibyte characters and stores them in the string str.
int wctomb(char *str, wchar_t wchar)
Examines the code which corresponds to a multibyte character given by the argument wchar.
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main () {
   int n=4;//number of elements
   int *a;
   a = (int*)calloc(n, sizeof(int));

   char *str;
   str = (char *) malloc(15);
   strcpy(str, "tutorialspoint");
   str = (char *) realloc(str, 25);
   strcat(str, ".com");//append string

   free( a );


install and config with npm

npm install typescript -D -g
npm link typescript
npm install -D ts-node
npm install -P @types/node

add scripts to package.json

"scripts": {
    "start": "node --inspect=5858 -r ts-node/register ./tutorial.ts",
    "build": "tsc  && copyfiles -U 1 ./**/*.env ./dist"

build script convert all ts files to js and move it to ./dist folder

copyfiles is a tool to help you to move files to destination folder

npm install -D copyfiles

tsconfig.json file  in a directory indicates that the directory is the root of a TypeScript project. The tsconfig.json file specifies the root files and the compiler options required to compile the project.

    "compilerOptions": {
        "module": "commonjs",
        "moduleResolution": "node",
        "pretty": true,
        "sourceMap": true,
        "target": "es6",
        "outDir": "./dist",
        "baseUrl": ".",
    "include": [
    "exclude": [

so once you call tsc command it will build all files specified by tsconfig.json to target

let var1:string|number=44;
let var2:object={};
let var3:any;
let var4:void;//null or undefined
let strArr:string[];//accept only array of string
let strArr2:[string,number];//tuple string,number
let strArr3:Array<string>;
let any:any;//take any value
let fun:(a: string) => void;//function type

TypeScript interface

interface Options {
  color: string;
  volume: number;
let options = {} as Options;
options.color = "red";
options.volume = 11;
interface User {
  name: string;
  id: number;
class UserAccount {
  name: string;
  id: number;
  constructor(name: string, id: number) { = name; = id;
const user: User = new UserAccount("Murphy", 1);
interface  A{
class AA{
    constructor(name:string,age:number) {
let val:A=new AA("hello",12);

classes and abstract classes

interface IPerson {
    name: string;

interface IEmployee {
    empCode: number;

class Employee implements IPerson, IEmployee {
    empCode: number;
    name: string;
    constructor(empcode: number, name:string) {
        this.empCode = empcode; = name;
    display(): void {
        console.log("Name = " + +  ", Employee Code = " + this.empCode);

let per:IPerson = new Employee(100, "Bill");
per.display(); // Name = Bill, Employee Code = 100

let emp:IEmployee = new Employee(100, "Bill");
emp.display(); //Compiler Error: Property 'display' does not exist on type 'IEmployee'
class Car {
    name: string;
    constructor(name: string) { = name;
    run(speed:number = 0) {
        console.log("A " + + " is moving at " + speed + " mph!");

class Mercedes extends Car {
    constructor(name: string) {
    run(speed = 150) {
        console.log('A Mercedes started');

class Honda extends Car {
    constructor(name: string) {
    run(speed = 100) {
        console.log('A Honda started');

let mercObj = new Mercedes("Mercedes-Benz GLA");
let hondaObj = new Honda("Honda City");  // A Mercedes started A Mercedes-Benz GLA is moving at 150 mph!; // A Honda started A Honda City is moving at 100 mph!
class StaticMem {  
   static num:number; 
   static disp():void { 
      console.log("The value of num is"+ StaticMem.num) 

StaticMem.num = 12     // initialize the static variable 
StaticMem.disp()      // invoke the static method
abstract class Person {
    abstract name: string;

    display(): void{

class Employee extends Person { 
    name: string;
    empCode: number;
    constructor(name: string, code: number) { 
        super(); // must call super()
        this.empCode = code; = name;

let emp: Person = new Employee("James", 100);
emp.display(); //James
class StaticMem {  
   static num:number; 
   static disp():void { 
      console.log("The value of num is"+ StaticMem.num) 

StaticMem.num = 12     // initialize the static variable 
StaticMem.disp()      // invoke the static method


namespace SomeNameSpaceName { 
   export interface ISomeInterfaceName {      }  
   export class SomeClassName {      }  

as keyword

const myCanvas = document.getElementById("main_canvas") as HTMLCanvasElement;

type aliases

type func=(a: string) => void;
type Point = {
  x: number;
  y: number;
// Exactly the same as the earlier example
function printCoord(pt: Point) {
  console.log("The coordinate's x value is " + pt.x);
  console.log("The coordinate's y value is " + pt.y);
printCoord({ x: 100, y: 100 });

ubuntu C++ configurations

build-essential : tools and libraries that are required to compile a program. For example, if you need to work on a C/C++ compiler, you need to install essential meta-packages on your system before starting the C compiler installation. When installing the build-essential packages, some other packages such as G++, dpkg-dev, GCC and make, etc. also install on your system.

Cmake + Ninja

GDB: The GNU Project Debugger

then for Qt and vcpkg

Besides build-essential and cmake you need to install git

for vcpkg

sudo apt-get install curl zip unzip tar
sudo apt-get install pkg-config
apt install gperf
sudo apt-get install bison
sudo apt install git
sudo apt install autopoint  
sudo apt install gettext
sudo apt install libtool 

for Qt

sudo apt-get install mesa-common-dev
sudo apt install libglu1-mesa-dev -y
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev

Conic Sections

Common Parts of Conic Sections

A focus is a point about which the conic section is constructed. In other words, it is a point about which rays reflected from the curve converge. A parabola has one focus about which the shape is constructed; an ellipse and hyperbola have two.

A directrix is a line used to construct and define a conic section. The distance of a directrix from a point on the conic section has a constant ratio to the distance from that point to the focus. As with the focus, a parabola has one directrix, while ellipses and hyperbolas have two.


  • 0 < eccentricity < 1 we get an ellipse,
  • eccentricity = 1 a parabola, and
  • eccentricity > 1 a hyperbola.

A circle has an eccentricity of zero, so the eccentricity shows us how “un-circular” the curve is. The bigger the eccentricity, the less curved it is.


A parabola is a curve where any point is at an equal distance from:

  • a fixed point (the focus ), and
  • a fixed straight line (the directrix )


“F” is a focus, “G” is a focus,and together they are called foci (pronounced “fo-sigh”).
The total distance from F to P to G stays the same
Well f+g is equal to the length of the major axis.


A hyperbola is two curves that are like infinite bows.
Looking at just one of the curves:
any point P is closer to F than to G by some constant amount
The other curve is a mirror image, and is closer to G than to F.

  • an axis of symmetry (that goes through each focus)
  • two vertices (where each curve makes its sharpest turn)
  • the distance between the vertices (2a on the diagram) is the constant difference between the lengths PF and PG
  • two asymptotes which are not part of the hyperbola but show where the curve would go if continued indefinitely in each of the four directions

Hyperbolic functions

Catenary (hanging cable)

Math Problems 1

Problem 1

what is the area of the rectangle?
the minimum area of the triangle satisfied these conditions?

part 1

so the area of a rectangle is


part 2

Problem 2

find the radius of biggest circuit

take first two circuits
hypotenuse of both are collinear

Problem 3

a cable of 80 meters hanging from the top of two poles there are two 50 meters from the ground
what is the distance from two poles if center of cable 20 meters above the ground ?

Problem 4

find the area of the red segments