Get started with python and postgres

import psycopg2
from psycopg2.extras import RealDictCursor
from datetime import date
connection = psycopg2.connect(user = "root",
                              password = "password",
                              host = "localhost",
                              port = "5432",
                              database = "database")
cursor = connection.cursor(cursor_factory=RealDictCursor)
cursor.execute("""select * from table where date(created_at)=%s order by id desc limit 100""",(,))

Explanation :

First you need to import required module.For postgres database access,psycopg2 is latest and recommended modue. RealDictCursor is required to get data in proper dictinary form otherwise data will arrive without column name( hard to guess for wide tables).

Create a connection object with defined connection string. Prepare query. Execute it with a cursor and fetch result from cursor . Fetching and selections will be discussed in later series.

You can start with it. Use the data to apply different types of visualization or draw useful conclusions using python,postgres,pandas and python visualization library

How to Increase the amount of inotify watchers

increase the amount of inotify watchers
To find count of inotify watcher - cat /proc/sys/fs/inotify/max_user_watches
Set a new limit of inotify watchers - echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
Apply systemwide changes - sudo sysctl -p
Recheck and confirm changes - cat /proc/sys/fs/inotify/max_user_watches

How to use docker for common applications

Docker help us to reuse softwares without worrying about its environments and sideaffects. You can not easily run 2 versions of software( 2 different version of redis or mongo or mysql or apache etc ) on same host without making any special arrangment. Docker make it portable and reusable. So, do not install , dock it

Some Common cli flags for dockers

  1. -d = demonised mode
  2. -it = interactive mode
  3. -v = attach volume
  4. -p = port mapping from host to docker
  5. –name = naming an instance for quick reference

Now some popular dockers for us.

  1. Couch db server = docker run -d –name couchdb -p 8091-8094:8091-8094 -p 11210:11210 couchbase
  2. Mongo db = docker run –name some-mongo -d mongo
  3. Postgres = docker run –name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
  4. redis db = docker run –name some-redis -d redis
  5. maria-db = docker run –name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb

I will keep adding more information about docker, container management in coming post.. Switch to better

“VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path”

If you are facing the same problem as stated above, there may be some issue related to path of docker-machine location and virtualbox location.

When docker installed, its path is like /usr/snap/docker and virtualbox is /usr/bin .

Dockermachine is unable to resolve using absolute path. It is searching in relative path( possibly a bug)

I reinstalled using ( apt install ) and did custom setup for docker machine for ubuntu 18. Finally I have all executable in nearly same path

I think, this will help you to resolve problem by some extent.

How to remove password from password protected PDFs

Most of time, you get email attatchments as password protected and whenever you open it, password is prompted and you need to find password scheme ( like dob, contact no + dob , social numbers etc)

Trick 1 :

Open the file in chrome. Put password obtained from mail body or sms etc. Now pdf file opened, just print it ( ctrl + f ) and save as pdf. This new pdf file is password free

How and why use SQLite in R

If you need small amount of data to work with( like development of a alert system to store alert conditions). Using a full fleged db would be painful.

Most of Programming system have sqlite drivers inbuilt, therefore no need to install any other driver.

First you need to install R package for sqlite database


Basic usage of RSQLite package ( code snippet)

> library(DBI) 
> con <- dbConnect(RSQLite::SQLite(), ":memory:")
> con2 <- dbConnect(RSQLite::SQLite(), "mydb.sqlite")
> dbListTables(con) #list the tables character(0)
> dbWriteTable(con, "mtcars", mtcars)
> dbListTables(con) #list the tables
> res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
> dbFetch(res)
> dbClearResult(res)

Complete reference to ggplot2

Why you need to use ggplot?

For EDA. We can analyse and overlook information hidden in large amount of data using visualization. EDA also enable to identify trend and transfer summary of information to anyone.

How to use ggplot2 with R.

In this session, I will describe all of them one by one , so everyone including me(this time) get fine tuned application of ggplot for EDA.

How Orthopedic Medicine Can Help You ?

Orthopedic medication concentrates to the musculo skeletal technique’s performance. Health practitioners and other healthcare employees who specialize within this industry give attention to the way the tendons, joints, tendons, joints and bones do the job, and also on repairing conditions which exist in all these areas to ensure patients may survive comfy and high heeled lifestyles, as much as you can

Many medical practitioners working in oral drugs and spinal injury are surgeons, however maybe not most them. Some health practitioners and other health employees worried about spinal injury centered on drugs which are nonsurgical, for example prevention.

In the event you wish to take a look at naturopathic medication in simple to comprehend terms, the attention will be done up on the musculo skeletal regions of your human body that may proceed. Prevention of problems for such pieces will contain practice, at which you will stop harm by proceeding attentively. By way of instance, if your project involves lifting weights that are heavy, he’ll be educated by means of a health professional to elevate the ones weights closely and firmly without any injury .

As an illustration, these professionals become involved with having a Workmen’s’ Compensation-related trauma. The other frequent revolve around avoidance can occur as soon as at the very top athlete, or as an instance, performs by a trainer or therapist afterwards trauma to obtain fitness back to stop harm from occurring again.

The most of spinal injury demanding operation. All these are instances when nonsurgical therapy and treatments tend not to get the job done. Thus, a physician will mend injuries, as an instance, these got from the sport discipline, or even within a collision, as a result of its own incident.

It could shock you to be aware of one of one of the most often occurring orthopedic traumas that occurs are the ones which are as like a consequence of persistent injury like carpal tunnel syndrome. Another kinds of persistent injury will result in joint swelling which can call for physical treatment or operation. In a few instances, the most optimal/optimally intervention for bodily injury will undoubtedly be surgical operation, accompanied closely by physical treatment, and supplemented using medications which help manage inflammation and pain.

Other injectable medication methods, for example grip for spine issues may likewise be properly used. Surgical processes now are exceptionally higher level and certainly will produce the individual believe his knee alternative or hip alternative is practically like the initial.

Congenital Orthopedic Issues
Many issues have been inherited, rather than being accident associated with these will necessitate surgical intervention, such as braces or surgery. That is generally achieved in scenarios such as osteogenesis cerebral or incomplete palsy. In these situations, orthopedic resources such as dentures allow the affected person become mobile.

Orthopedic Medication Training
A budding orthopedic doctor in hyderabad must study to get any range of decades at medical institution. Then he must proceed by means of residency for the following four decades. Health practitioners additionally have the choice to get extra curricular credentials, such as for instance, sports-medicine

Orthopedic surgeons and physicians are looking at different staples such as chiropractic attention in addition to massage therapy. Those who exercise this kind of orthopedic specialties aren’t health practitioners, but have experienced professional trained inside this discipline. They typically function with health practitioners in order they provides individuals with special treatment method in scenarios of orthopedic injury and also other psychiatric issues