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

install.packages("RSQLite") 

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)

R package Installation failed: Timeout was reached: Resolving timed out after 10000 milliseconds

If you are facing problems like above, timeout may be problem of your network( domain name resolution). 
Possible solution is to update the network dns . It should be fast dns like Google DNS or Cloudflare DNS 

Google DNS – 8.8.8.8,8.8.4.4
Cloudflare DNS – 1.1.1.1

With low latency network and responsive dns, this problem will be resolve as resolved in above image. 

This post is also answer to how to install IRkernal for jupyter notebook 

Flask sqlalchemy error : SQLALCHEMY_TRACK_MODIFICATIONS

Problem :FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
‘SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and ‘

Solution:  app.config[‘SQLALCHEMY_TRACK_MODIFICATIONS’] = False

Why you need structured data for better SEO ?

Webpage is not 100% data unlike other data only formats ( excel sheets, json , xml , csv ) etc . It has other goal – present information in visual manner, therefore data is mixed with lot of unwanted content( tags ). 

Each and every webpage have some unique design guidelines to present information and carry data. Crawler are not so smart to fetch all information from webpage. Beside fetching data, it is not easy to catagorize and index data correctly all the time. Therefore, there must be some unique method to carry data , without worrying about the html of webpage. 

Structured data comes to rescue. It follow a fixed , validated semantics to present data. I will recommed to use structured data using javascript ( JSON format)

You can find more about it from Google search gallery

In search gallry , you will find information about webpage component and its structure . 

Vue JS Issue – Devtool inspection is not available

Full description of problem:  Vue.js is detected on this page. Devtools inspection is not available because it’s in production mode or explicitly disabled by the author.

Cause: You may be using compressed production version of vue

Solution : You need to use development version with debugging support.
<script src=”https://vuejs.org/js/vue.js” ></script>



vue.js source

If your problem solved, share this to others. 

HOW TO KEEP YOUR SHINY SERVER RUNNING ?

If your facing problem in keep running shiny server for long time , I have a solution . 

The Problem: 

  • Shiny server need server restart
  • Shiny server not responding after sometime

    The Solution:  

Increase the RAM size
Ping server at regular interval
Increase app_idle_timeout in Shiny Server Conf
Use systemd to automatically restart shiny server

How to automatically ping your server at regular interval 

Your can add a cronjob to curl the index page of your application

Edit the crontask using crontab -e  . Schedule to run every minute 
* * * * * curl url_to_your_shiny_application


How to increase app_idle_timeout 
On unix system, your can find the configuration file for shiny server at /etc/shiny-server directory

In case of any problem, please ask in comment and solution will be updated 

You can start,stop,restart and check for status of shiny-server through these easy commands

sudo systemctl start shiny-server #to start it
sudo systemctl stop shiny-server # to stop it
sudo systemctl restart shiny-server # to restart 
sudo systemctl status shiny-server  # to know status of shiny-server

Does CTR has any impact on google ranking?

As a search engine, Google/Bing/Yahoo try to serve the best response to the user. Intent is important factor and getting local/relevent result is neccessary. 

CTR is important because it reflect the usefulness of site. In more depth, search engine provide personalized results , therefore it is always better chance to rank higher for specific set of users ( for non bounced user). Google chrome is most used browser world wide and it gather statistics about site usage and behaviour. Better ctr and more usage of site will definitely contribute quality ranking score.

I advise to make user aquistion process simple and effective. Ranking will be improve definitely.

Why you should use sqlite as portable database

Most of time when we need some tasks to run for long hours in a loop, sqlite is ideal solution to use as a database.

  1. sqlite is available in most of system. No need to install big binary files.
  2. You can easily use it with multiple programming language using simple apis.
  3. You can transport it as file to other system. No need to export and import files to recreate the same
     
    I use sqlite too much in smaller long running batch tasks to store data and use across different cli apps. I can run this on smallest and tiniest machine easily

Why deploy nginx as most preferred proxy server?

Nginx define itself as open-source, high-performance HTTP server and reverse proxy engine. It is simple to configure proxy server, effective load balancer. 
Nginx is super easy to configure. Multiple types of proxy configuration is possible – round robin, least connected , ip bound , fail over connection, path based.

It is easy to host a rails app on mail domain and wordpress on /blog path. Run an analytic engine using R (shiny apps) and do some smart system tasks using python backend.

nginx is free and open source . It is much robust than apache and first choice for proxy. I love it when need to operate a bunch of service varied by different type of services .