SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
PubNative Tracker
Andrew Djoga
Elixir is what would happen if Erlang, Clojure and
Ruby somehow had a baby and it wasn't an
accident.
Devin Torres
open source enthusiast
Immutability
animals = ["capybara", "apple", "lemur"]
List.delete(animals, "apple")
#=> ["capybara", "lemur"]
animals
#=> ["lion", "table", "bear"]
High-order functions
double = fn(i) -> i * 2 end
Enum.map([1, 2, 3], double)
#=> [2, 4, 6]
Pattern matching
[first, second, _] = [
:virginia,
:singapore,
:ireland,
]
first
#=> :virginia
second
#=> :singapore
Pattern matching
list = [1, 2, 3]
[1 | tail] = list
tail
#=> [2, 3]
[2 | _] = list
** (MatchError) no match of right hand side
value: [1, 2, 3]
Collections
Enum.any?(["foo", "bar", “hi"],
fn(s) -> len(s) == 2 end)
#=> true
File.read("path/to/unknown/file")
#=> {:error, "reason"}
map = %{:foo => "bar", :hello => "hi"}
map[:foo]
#=> “bar"
Functions
def square([]), do: []
def square([head | tail]) do
[head * head | square(tail)]
end
square([1, 2, 3])
#=> [1, 4, 9]
Enum.map([1, 2, 3], fn(x) -> x * x end)
#=> [1, 4, 9]
Composition
defmodule Math do
def sum(a, b) do
a + b
end
end
Math.sum(1, 2)
#=> 3
Concurrency
lightweight
isolation
message passing
Concurrent processes with no data sharing
provide a strong measure of fault isolation.
A software error in a concurrent process
should not influence processing in the other
processes in the system.
creator of Erlang
Joe Armstrong
Based on its designated behavior, the actor responds
to incoming messages by send new messages,
spawn new actors and/or changing its future behavior.
Each actor has its own mailbox and isolated state.
Supervisor
children = [
supervisor(Stats.Supervisor),
supervisor(Queue.KafkaSupervisor),
worker(Queue.SQSWorker, [period, []]),
supervisor(Queue.Supervisor),
supervisor(Cache.DBSupervisor),
Plug.Adapters.Cowboy.child_spec(:http, Router, [],
[port: port])
]
supervise(children,
strategy: :one_for_one,
max_restarts: 10,
max_seconds: 1
)
Worker
def handle_cast(:receive, state) do
case :sqs.receive(state.queue) do
[] -> Logger.info("no messages")
messages -> to_kafka(messages)
end
{:noreply, state}
end
def terminate(reason, _) when reason == :normal, do: :ok
def terminate(reason, state) do
Logger.error("#{reason}: #{inspect state}")
:ok
end
tooling
IEx
iex(1)> Weather
...(1)> |> where(city: "Berlin")
...(1)> |> order_by(:temp_lo)
...(1)> |> limit(10)
...(1)> |> Repo.all
Mix
mix new my_app
compile
test
deps.get
ExUnit
test "decodes a base64 without padding chars" do
assert Token.urlsafe_decode64("YWJjZA") == "abcd"
assert Token.urlsafe_decode64("YWJjZA=") == "abcd"
assert Token.urlsafe_decode64("YWJjZA==") == "abcd"
end
➜ tracker mix test test/tracker/api/token_test.exs --trace
Tracker.API.TokenTest
* decodes a base64 without padding chars (8.1ms)
* decodes a base64 in the URLEncoding mode defined in RFC 4648 (0.01ms)
* fixes a token with a double question mark (0.01ms)
* decrypts a token (15.2ms)
* returns error with a broken token (14.8ms)
Finished in 0.1 seconds (0.09s on load, 0.03s on tests)
5 tests, 0 failures
Type Specifications
@spec network(integer) :: {String.t, String.t} | :not_found
def network(id) do
case :ets.lookup(:db_networks, id) do
[{^id, name, url}] -> {name, url}
_ -> :not_found
end
end
Dialyzer is a static analysis tool that identifies software
discrepancies such as type errors, unreachable code,
unnecessary tests, etc in Erlang / Elixir applications.
$ iex --name console@127.0.0.1 --remsh tracker@127.0.0.1
etop
Erlang Top is a tool for presenting information about Erlang
processes similar to the information presented by "top" in
UNIX.
erlang.processes()
Returns a list of process identifiers corresponding to all
the processes currently existing on the local node.
erlang.memory()
Returns a list with information about memory dynamically
allocated by the Erlang emulator.
Built-In Term Storage
ETS tables are implemented as BIFs in the ets
module.
The main design objectives ETS had was to
provide a way to store large amounts of data in
Erlang with constant access time and to have
such storage look as if it were implemented as
processes in order to keep their use simple and
idiomatic.
http://learnyousomeerlang.com
http://elixir-lang.org
http://erlang.org/doc/design_principles/users_guide.html
http://ninenines.eu/docs/en/cowboy/1.0/guide

Weitere ähnliche Inhalte

Was ist angesagt?

Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScriptniklal
 
Simulator customizing & testing for Xcode 9
Simulator customizing & testing for Xcode 9Simulator customizing & testing for Xcode 9
Simulator customizing & testing for Xcode 9Bongwon Lee
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful weddingStéphane Wirtel
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of RubyTom Crinson
 
An (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to PythonAn (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to PythonNicholas Tollervey
 
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)Tobias Pfeiffer
 
Parse Everything With Elixir
Parse Everything With ElixirParse Everything With Elixir
Parse Everything With ElixirGabriele Lana
 
스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내Jung Kim
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeStripe
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeMongoDB
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeMongoDB
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Baruch Sadogursky
 
Investigating Python Wats
Investigating Python WatsInvestigating Python Wats
Investigating Python WatsAmy Hanlon
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기NAVER D2
 
How fast ist it really? Benchmarking in practice
How fast ist it really? Benchmarking in practiceHow fast ist it really? Benchmarking in practice
How fast ist it really? Benchmarking in practiceTobias Pfeiffer
 

Was ist angesagt? (20)

Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
 
Simulator customizing & testing for Xcode 9
Simulator customizing & testing for Xcode 9Simulator customizing & testing for Xcode 9
Simulator customizing & testing for Xcode 9
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful wedding
 
Lập trình Python cơ bản
Lập trình Python cơ bảnLập trình Python cơ bản
Lập trình Python cơ bản
 
The Magic Of Elixir
The Magic Of ElixirThe Magic Of Elixir
The Magic Of Elixir
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of Ruby
 
An (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to PythonAn (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to Python
 
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
Stop Guessing and Start Measuring - Benchmarking in Practice (Lambdadays)
 
Parse Everything With Elixir
Parse Everything With ElixirParse Everything With Elixir
Parse Everything With Elixir
 
스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내스위프트를 여행하는 히치하이커를 위한 스타일 안내
스위프트를 여행하는 히치하이커를 위한 스타일 안내
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
7li7w devcon5
7li7w devcon57li7w devcon5
7li7w devcon5
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Investigating Python Wats
Investigating Python WatsInvestigating Python Wats
Investigating Python Wats
 
ES6: Features + Rails
ES6: Features + RailsES6: Features + Rails
ES6: Features + Rails
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기
 
How fast ist it really? Benchmarking in practice
How fast ist it really? Benchmarking in practiceHow fast ist it really? Benchmarking in practice
How fast ist it really? Benchmarking in practice
 

Andere mochten auch

Andere mochten auch (8)

LIArena_141014_9_8
LIArena_141014_9_8LIArena_141014_9_8
LIArena_141014_9_8
 
Proyecto 1-Aprendiendo sobre las TICs
Proyecto 1-Aprendiendo sobre las TICsProyecto 1-Aprendiendo sobre las TICs
Proyecto 1-Aprendiendo sobre las TICs
 
Young Employee Award - Clare Bassett
Young Employee Award - Clare BassettYoung Employee Award - Clare Bassett
Young Employee Award - Clare Bassett
 
Double award pitch
Double award pitchDouble award pitch
Double award pitch
 
2.2. luís gonçalo campos, paulo fernandes, margarida c. coelho
2.2. luís gonçalo campos, paulo fernandes, margarida c. coelho2.2. luís gonçalo campos, paulo fernandes, margarida c. coelho
2.2. luís gonçalo campos, paulo fernandes, margarida c. coelho
 
2.2. andré pedrosa, helena albuquerque, zélia breda
2.2. andré pedrosa, helena albuquerque, zélia breda2.2. andré pedrosa, helena albuquerque, zélia breda
2.2. andré pedrosa, helena albuquerque, zélia breda
 
Managing risk through change: charities
Managing risk through change: charitiesManaging risk through change: charities
Managing risk through change: charities
 
How to Determine CLIENT LIFETIME VALUE in Five Minutes
How to Determine CLIENT LIFETIME VALUE in Five MinutesHow to Determine CLIENT LIFETIME VALUE in Five Minutes
How to Determine CLIENT LIFETIME VALUE in Five Minutes
 

Ähnlich wie PubNative Tracker

Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語ikdysfm
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG CampinasFabio Akita
 
What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)Kerry Buckley
 
Useful javascript
Useful javascriptUseful javascript
Useful javascriptLei Kang
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a ElixirSvet Ivantchev
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
Brief tour of psp-std
Brief tour of psp-stdBrief tour of psp-std
Brief tour of psp-stdPaul Phillips
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala LanguageAshal aka JOKER
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testingVincent Pradeilles
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Evgeny Borisov
 
Towards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptxTowards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptxmarkmarron7
 
Slaying the Dragon: Implementing a Programming Language in Ruby
Slaying the Dragon: Implementing a Programming Language in RubySlaying the Dragon: Implementing a Programming Language in Ruby
Slaying the Dragon: Implementing a Programming Language in RubyJason Yeo Jie Shun
 

Ähnlich wie PubNative Tracker (20)

Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
 
What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)What I learned from Seven Languages in Seven Weeks (IPRUG)
What I learned from Seven Languages in Seven Weeks (IPRUG)
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Slides
SlidesSlides
Slides
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Brief tour of psp-std
Brief tour of psp-stdBrief tour of psp-std
Brief tour of psp-std
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testing
 
ssh.isdn.test
ssh.isdn.testssh.isdn.test
ssh.isdn.test
 
Basics
BasicsBasics
Basics
 
Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2Groovy puzzlers jug-moscow-part 2
Groovy puzzlers jug-moscow-part 2
 
Erlang
ErlangErlang
Erlang
 
Towards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptxTowards Programming Languages for Reasoning.pptx
Towards Programming Languages for Reasoning.pptx
 
Elixir cheatsheet
Elixir cheatsheetElixir cheatsheet
Elixir cheatsheet
 
Slaying the Dragon: Implementing a Programming Language in Ruby
Slaying the Dragon: Implementing a Programming Language in RubySlaying the Dragon: Implementing a Programming Language in Ruby
Slaying the Dragon: Implementing a Programming Language in Ruby
 

Kürzlich hochgeladen

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEselvakumar948
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 

Kürzlich hochgeladen (20)

1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 

PubNative Tracker

  • 2.
  • 3. Elixir is what would happen if Erlang, Clojure and Ruby somehow had a baby and it wasn't an accident. Devin Torres open source enthusiast
  • 4. Immutability animals = ["capybara", "apple", "lemur"] List.delete(animals, "apple") #=> ["capybara", "lemur"] animals #=> ["lion", "table", "bear"]
  • 5. High-order functions double = fn(i) -> i * 2 end Enum.map([1, 2, 3], double) #=> [2, 4, 6]
  • 6. Pattern matching [first, second, _] = [ :virginia, :singapore, :ireland, ] first #=> :virginia second #=> :singapore
  • 7. Pattern matching list = [1, 2, 3] [1 | tail] = list tail #=> [2, 3] [2 | _] = list ** (MatchError) no match of right hand side value: [1, 2, 3]
  • 8. Collections Enum.any?(["foo", "bar", “hi"], fn(s) -> len(s) == 2 end) #=> true File.read("path/to/unknown/file") #=> {:error, "reason"} map = %{:foo => "bar", :hello => "hi"} map[:foo] #=> “bar"
  • 9. Functions def square([]), do: [] def square([head | tail]) do [head * head | square(tail)] end square([1, 2, 3]) #=> [1, 4, 9] Enum.map([1, 2, 3], fn(x) -> x * x end) #=> [1, 4, 9]
  • 10. Composition defmodule Math do def sum(a, b) do a + b end end Math.sum(1, 2) #=> 3
  • 12. Concurrent processes with no data sharing provide a strong measure of fault isolation. A software error in a concurrent process should not influence processing in the other processes in the system. creator of Erlang Joe Armstrong
  • 13. Based on its designated behavior, the actor responds to incoming messages by send new messages, spawn new actors and/or changing its future behavior. Each actor has its own mailbox and isolated state.
  • 14. Supervisor children = [ supervisor(Stats.Supervisor), supervisor(Queue.KafkaSupervisor), worker(Queue.SQSWorker, [period, []]), supervisor(Queue.Supervisor), supervisor(Cache.DBSupervisor), Plug.Adapters.Cowboy.child_spec(:http, Router, [], [port: port]) ] supervise(children, strategy: :one_for_one, max_restarts: 10, max_seconds: 1 )
  • 15. Worker def handle_cast(:receive, state) do case :sqs.receive(state.queue) do [] -> Logger.info("no messages") messages -> to_kafka(messages) end {:noreply, state} end def terminate(reason, _) when reason == :normal, do: :ok def terminate(reason, state) do Logger.error("#{reason}: #{inspect state}") :ok end
  • 17. IEx iex(1)> Weather ...(1)> |> where(city: "Berlin") ...(1)> |> order_by(:temp_lo) ...(1)> |> limit(10) ...(1)> |> Repo.all
  • 19. ExUnit test "decodes a base64 without padding chars" do assert Token.urlsafe_decode64("YWJjZA") == "abcd" assert Token.urlsafe_decode64("YWJjZA=") == "abcd" assert Token.urlsafe_decode64("YWJjZA==") == "abcd" end ➜ tracker mix test test/tracker/api/token_test.exs --trace Tracker.API.TokenTest * decodes a base64 without padding chars (8.1ms) * decodes a base64 in the URLEncoding mode defined in RFC 4648 (0.01ms) * fixes a token with a double question mark (0.01ms) * decrypts a token (15.2ms) * returns error with a broken token (14.8ms) Finished in 0.1 seconds (0.09s on load, 0.03s on tests) 5 tests, 0 failures
  • 20. Type Specifications @spec network(integer) :: {String.t, String.t} | :not_found def network(id) do case :ets.lookup(:db_networks, id) do [{^id, name, url}] -> {name, url} _ -> :not_found end end Dialyzer is a static analysis tool that identifies software discrepancies such as type errors, unreachable code, unnecessary tests, etc in Erlang / Elixir applications.
  • 21. $ iex --name console@127.0.0.1 --remsh tracker@127.0.0.1 etop Erlang Top is a tool for presenting information about Erlang processes similar to the information presented by "top" in UNIX. erlang.processes() Returns a list of process identifiers corresponding to all the processes currently existing on the local node. erlang.memory() Returns a list with information about memory dynamically allocated by the Erlang emulator.
  • 22. Built-In Term Storage ETS tables are implemented as BIFs in the ets module. The main design objectives ETS had was to provide a way to store large amounts of data in Erlang with constant access time and to have such storage look as if it were implemented as processes in order to keep their use simple and idiomatic.