Monday, 24 July 2017

Heroku tutorial - Basic understanding

Heroku  tutorial - Basic understanding

Question: What is Heroku?
Heroku is a cloud "platform as a service (PaaS)" supporting several programming languages that is used as a web application.


Question: Can we deploy the PHP Project in Heroku?
Yes, you can do. You can even deploy Java, nodeJs, Python and Go project also.


Question: What other programming language it support?
Ruby programming
Java 
Node.js
Scala
Clojure
Python
PHP
Go


Question:How many Apps created on Heroku?
13 million.


Question:How many services Heroku have?
150+ Add-on Services


Question: Is Heroku secure?
Yes, It is.


Question: What Heroku does?
Heroku is a platform for data as well as apps - providing a secure, scalable database-as-a-service.
It is million of developers tools like database followers, forking, dataclips and automated health checks.

Question: What is offical website of heroku?
https://www.heroku.com/


Question: What are the steps to configure PHP Project?
  1. Introduction: Installed PHP, composer locally.
  2. Set up: a) Download the heroku CLI.
    b) Installed the CLI with Git.
    c) Login with heroku account.
  3. Prepare the app
  4. Deploy the app
  5. View logs
  6. Define a Procfile
  7. Scale the app
  8. Declare app dependencies
  9. Push local changes
  10. Provision add-ons
  11. Start an interactive shell
  12. Define config vars
  13. Provision a database



Tuesday, 18 July 2017

node js underscore tutorial with examples

node js underscore tutorial with examples

Question: How to install underscore in nodeJS?
npm install underscore





Question: How to include underscore in nodeJS?
var _ = require('underscore');





Question: What is map in underscore? How to use? Give example?
Produces a new array of values by mapping each value in list through a function. The iterates is passed three arguments: the value, then the index (or key) of the iteration, and reference.


console.log(_.map([1, 2, 3], function(num){ return num * 2; })); //2, 4, 6
console.log(_.map([1, 2, 3], function(num){ return num * 3; })); //3,6,9



Question: Give an example of underscore.each?
console.log(_.each([1, 2, 3], function(value, key){
     console.log(key+'>>'+value)
 }));



Question: Give an example of underscore.reduce?
console.log(_.each([1, 2, 3], function(value, key){
     console.log(key+'>>'+value)
 }));



Question: Give an example of underscore.reduce?
console.log(_.each([1, 2, 3], function(value, key){
     console.log(key+'>>'+value)
 }));



Question: How to check if variable is empty OR Not?
_.isEmpty({});//true
_.isEmpty({'1'});//false



Question: How to create range values?
_.range(6);//[1,2,3,4,5,6]



Question: Can we use underscore for Web Client?
Yes, for this you need to include following JS.
https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js



Question: What are collections available in underscore?
each
map
reduce
reduceRight
find
filter
where
findWhere
reject
every
some
contains
invoke
pluck
max
min
sortBy
groupBy
indexBy
countBy
shuffle
sample
toArray
size
partition



Question: What are array are available in underscore?
first
initial
last
rest
compact
flatten
without
union
intersection
difference
uniq
zip
unzip
object
indexOf
lastIndexOf
sortedIndex
findIndex
findLastIndex
range



Question: What functions are available in underscore?
bind
bindAll
partial
memoize
delay
defer
throttle
debounce
once
after
before
wrap
negate
compose