- Make Sure u have setup account created for Azure
- You have enabled Free Subscription
- You have created a webapp instance manullay example "flaskserverpushparanimptest2"
$brew update && brew install azure-cli
$az upgrade
class Person: | |
def __init__(self,name): | |
self.name=name | |
import json #yaml | |
v='{"name":"deepak"}' | |
j=json.loads(v) | |
person=Person(**j) |
trait Activities | |
case class PersonWalk(km:Float) extends Activities | |
case class PersonTalk(words:String) extends Activities | |
class CompanionPerson { | |
def perform(act:Activities)= { | |
act match{ | |
case PersonWalk(km) => println(km) | |
case PersonTalk(words) => println(words) |
trait Activities | |
case class PersonWalk(km:Float) extends Activities | |
case class PersonTalk(words:String) extends Activities | |
class CompanionPerson { | |
val perform:PartialFunction[Activities,Unit]= { | |
case PersonWalk(km) => println(km) |
import org.apache.spark.sql.SparkSession | |
import org.apache.spark.sql.functions._ | |
val spark=SparkSession | |
.builder() | |
.master("local") | |
.appName("local") | |
.getOrCreate() | |
import spark.implicits._ |
/* | |
Nodejs is javascript engine from Chrome V8 Engine . | |
Which runs javascript code in the backend | |
node js is non blocking io module ie., if any lines takes more time , than the cpu does not block other lines and continues execution of other lines | |
npm - package manager for js .Similar to pip in python | |
Note: Never push node module dependencies to Git as it is huge | |
docs: all functions in npm is | |
- https://nodejs.org/dist/latest-v17.x/docs/api/ | |
- https://nodejs.dev/learn/introduction-to-nodejs |
// They’re an idiomatic way of representing data using “ands” and “ors”. For example: | |
// a shape is a rectangle or a circle | |
// a rectangle has a width and a height | |
// a circle has a radius | |
// In ADT (Algebraic Data Types (ADTs))terminology, “and” types such as rectangle and circle are products, | |
// whereas the “or” types such as shape are coproducts. | |
// In Scala, we typically represent products using case classes and coproducts using sealed traits: |
//https://medium.com/beingprofessional/understanding-functor-and-monad-with-a-bag-of-peanuts-8fa702b3f69e | |
object Monad extends App { | |
// Functor + unit+ Flatmap = Monad | |
case class Sugar(weight: Int) | |
case class Bag[A](content: A) { | |
def map[B](f: A => B): Bag[B] = Bag(f(content)) | |
def flatMap[B](f: A => Bag[B]): Bag[B] = f(content) | |
} |
case class Bag[Int](a: Int) { | |
def map[Double](f: Int => Double): Bag[Double] = Bag(f(a)) | |
} | |
val f = i:Int => i/1.0 | |
Bag(10).map( i=> f(i))//result =Bag(10.0) |
""" | |
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/create-sql-api-python | |
https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/cosmos/azure-cosmos/samples/examples.py | |
Pre-Req: | |
pip install --pre azure-cosmos | |
Have a Azure Account with Free Subscribption Enabled | |
Make sure Cosmosa DB is created along with DB and Container | |
#Azure portal > Azure Cosmos > ck on Existing Cosmos Db > Settings > Keys |
$brew update && brew install azure-cli
$az upgrade