How to deploy node js code in heroku?

To use Heroku CLI it requires Git, before get starting with Heroku make sure Git was installed. Once installed, you can use the heroku command from your command shell.

In commandprompt, login with your heroku logins.

$ heroku login
Enter your Heroku credentials.
Email: **********
Password:*********

By using the below commands make sure you have installed all the requirements.

$ node --version
$ npm --version
$ git --version

Create an app on heroku and push the code to it.

$ heroku create

Usually we use the git push command to push our code from local repository to server. we can use the same to push our code to heroku.

$ git push heroku master

once deployed we can open the website using,

$ heroku open

How to create a cloud server (droplet) in digitalocean?

  • Create a new account in digital ocean and login with your email and password.
  • Click Create => Droplets from top right corner.

In the next page we have to choose the configuration options for the droplets.

  • In the first step choose an image from the 3 categories.

Distributions are images without any additional software.

Container distributers include CoreOS, Fedora etc;

One click apps are images that include preconfigured applications.

  • Then choose the size of RAM and storage space required.
  • Next, you’re required to choose the data center regions.
  • Add your SSH keys which provide more security than using a password.

In the final step, choose the number of droplets and hostname. Then click create droplet.

How to use cookies in PHP 7

COOKIE

A cookie is used to identify a user. Cookies are text files stored on the client computer and they are kept of use tracking purpose.

PHP transparently supports HTTP cookies. Browser stores this information on local machine for future use. Server script sends a set of cookies to the browser. For example name, age, or id etc.

A cookie is created with the setcookie() function. Using PHP, you can both create and retrieve cookie values.

Syntax

setcookie (name, value, expire, path, domain, secure, httponly);  

(or)

Setrawcookie(name, value, expire, path, domain, secure, httponly);  

Setrawcookie() is to send a cookie without url encoding the cookie value (for PHP 5, PHP 7)

Only the name parameter is required. All other parameters are optional.

Example Scripts

Create Cookies:

<?php
$cookie_value = 'Test_cookie';

setcookie("TestCookie", $value); /* TestCookie is Cookie Name */
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
?>

Retrieve Cookies:

<?php
// Print an individual cookie
echo $_COOKIE["TestCookie"];

// Another way to debug/test is to view all cookies
print_r($_COOKIE);
?>

Edit Cookies:

<?php
if(!isset($_COOKIE[$cookie_name])) {
    echo $cookie_name . "' is not set!";
} else {
    echo $cookie_name . "' is set!<br>";

   /*Again Set Cookie value to updated (New) value */

   setcookie($cookie_name, 'changed value ', time() + (86400 * 30), "/");
    echo "Value is: " . $_COOKIE[$cookie_name];
}
?>

Delete Cookies:

When deleting a cookie you should assure that the expiration date is in the past.

<?php
// set the expiration date to one hour ago
setcookie("TestCookie", "", time() - 3600);
setcookie("TestCookie", "", time() - 3600, "/~rasmus/", "example.com", 1);
?>

Installing Litecoin cryptocoin data and deploying its blockchain server in CentOS7

Installation
https://download.litecoin.org/litecoin-0.16.0/linux/litecoin-0.16.0-x86_64-linux-gnu.tar.gz

Download the above tar file and extract it using following commands
tar xvf litecoin-0.16.0-x86_64-linux-gnu.tar.gz

Starting a litecoin server
Here, first time you need to reindex the whole chain using -reindex command
First time command: ./litecoind –txindex -daemon -reindex

litecoind -server -txindex -daemon -rpc -rpcbind=0.0.0.0 -rpcuser=theone -rpcpassword=pass123 -rpcport=9332

The above command lets you to download the blocks continously and you can access the server private data using RPC API calls.

Stopping a litecoin server
litecoind stop
if the above command doesnt work
killall -9 litecoind

Litecoin reference (params)
https://litecoin.info/index.php/Litecoin.conf

It should automatically download the blocks in the root
/root/.litecoin/..

Will keep you updated with more commands.