Developing an Immune System — The Hard and Soft Skills required to avoid OutagesPascal-Louis Perez
In just three years, Square has achieved ubiquitous recognition for mobile card processing grossing over $10B a year in credit card transactions. At the heart of Square's technology are many financial systems which must operate safely, correctly, and sustain rapid growth.
During this tech talk, Pascal will describe the concept of an immune system, go over best practices, share lessons leaned and provide a detailed layering of best practices. This talk will cover non-controversial topics such ad TDD, but from new angles. We'll also cover emerging practices like continuous deployment, and softer areas such as engineering management practices geared towards safety. You'll come out of this session with a fresh perspective on how to build software.
A brief overview on Oracle R12 Warehouse Management System (WMS). The available functionality and various processes. Also go through the benefits of WMS.
Agenda:
- WMS overview
- Processess of warehouse
- Inbound logistics
- Outbound logistics
- Material Control
- Q & A session
Developing an Immune System — The Hard and Soft Skills required to avoid OutagesPascal-Louis Perez
In just three years, Square has achieved ubiquitous recognition for mobile card processing grossing over $10B a year in credit card transactions. At the heart of Square's technology are many financial systems which must operate safely, correctly, and sustain rapid growth.
During this tech talk, Pascal will describe the concept of an immune system, go over best practices, share lessons leaned and provide a detailed layering of best practices. This talk will cover non-controversial topics such ad TDD, but from new angles. We'll also cover emerging practices like continuous deployment, and softer areas such as engineering management practices geared towards safety. You'll come out of this session with a fresh perspective on how to build software.
A brief overview on Oracle R12 Warehouse Management System (WMS). The available functionality and various processes. Also go through the benefits of WMS.
Agenda:
- WMS overview
- Processess of warehouse
- Inbound logistics
- Outbound logistics
- Material Control
- Q & A session
Presentation given by Martin Kleppmann at Rails Underground in London on 24 July 2009. Gives an overview of how to develop a commercial B2B SaaS web app using Rails or other Ruby web frameworks, including best practices of structuring accouting data.
Integration of payment gateways using Paypal account Phenom People
E-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks and clicks or traditional brick and mortar. It is the equivalent of a physical point of sale terminal located in most retail outlets. Payment gateway protects credit cards details encrypting sensitive information, such as credit card numbers, to ensure that information pass securely between the customer and the merchant and also between merchant and payment processor.
Banks offer various types of accounts, such as savings, checking, cer.pdfrajeshjain2109
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and
money market, to attract customers as well as meet their specific needs. Two of the most
commonly used accounts are savings and checking. Each of these accounts has various options.
For example, you may have a savings account that requires no minimum balance but has a lower
interest rate. Similarly, you may have a checking account that limits the number of checks you
may write. Another type of account that is used to save money for the long term is certificate of
deposit (CD). In this programming exercise, you use abstract classes and pure virtual functions to
design classes to manipulate various types of accounts. For simplicity assume that the bank
offers three types of accounts: savings, checking, and certificate of deposit, as described next.
Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no
minimum balance and a lower interest rate and another that requires a minimum balance and has
a higher interest rate Checking accounts: Suppose that the bank offers three types of checking
accounts: one with a monthly service charge, limited check writing, no minimum balance, and no
interest, another with no monthly service charge, a minimum balance requirement, unlimited
check writing and lower interest, and a third with no monthly service charge, a higher minimum
requirement, a higher interest rate, and unlimited check writing Certificate of deposit (CD): In an
account of this type, money is left for some time, and these accounts draw higher interest rates
than savings or checking accounts. Suppose that you purchase a CD for six months. Then we say
that the CD will mature in six months. The penalty
Solution
#include
#include
using namespace std;
class bankAccount
{
private:
string accHolderName;
string accountType;
int accountNumber;
double accBalance;
public:
bankAccount(string fullName = \"\", string accType = \"\", int accNum = 0, double balance =
0.0);
string getAccHolderName() const;
string getAccountType() const;
int getAccountNumber() const;
double getAccBalance() const;
void deposit(double amount);
void withdrawl(double amount);
virtual void print() const = 0;
};
/*contructor*/
bankAccount::bankAccount(string fullName, string accType, int accNum, double balance) {
accHolderName = fullName;
accountType = accType;
accountNumber = accNum;
accBalance = balance;
}
string bankAccount::getAccHolderName() const{
return accHolderName;
}
string bankAccount::getAccountType() const{
return accountType;
}
int bankAccount::getAccountNumber() const{
return accountNumber;
}
double bankAccount::getAccBalance() const{
return accBalance;
}
void bankAccount::deposit(double amount) {
accBalance += amount;
}
void bankAccount::withdrawl(double amount) {
if (amount > accBalance) {
cout << \"Insufficent Funds. Account balance: \" << accBalance << endl;
} else {
accBalance -= amount;
}
}
class checkingAccount: public bankAccount
{.
Talk given at DDDx London on 27th of April about how to implement long running processes in Domain Driven Design properly. Describes patterns like Process Manager and Saga.
Banks offer various types of accounts, such as savings, checking, cer.pdfakbsingh1313
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and
money market, to attract customers as well as meet their specific needs. Two of the most
commonly used accounts are savings and checking. Each of these accounts has various options.
For example, you may have a savings account that requires no minimum balance but has a lower
interest rate. Similarly, you may have a checking account that limits the number of checks you
may write. Another type of account that is used to save money for the long term is certificate of
deposit (CD). In this programming exercise, you use abstract classes and pure virtual functions to
design classes to manipulate various types of accounts. For simplicity, assume that the bank
offers three types of accounts: savings, checking, and certificate of deposit, as described next.
Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no
minimum balance and a lower interest rate and another that requires a minimum balance and has
a higher interest rate. Checking accounts: Suppose that the bank offers three types of checking
accounts: one with a monthly service charge, limited check writing, no minimum balance, and no
interest; another with no monthly service charge, a minimum balance requirement, unlimited
check writing and lower interest; and a third with no monthly service charge, a higher minimum
requirement, a higher interest rate, and unlimited check writing. Certificate of deposit (CD): In
an account of this type, money is left for some time, and these accounts draw higher interest rates
than savings or checking accounts. Suppose that you purchase a CD for six months. Then we say
that the CD will mature in six months. The penalty for early withdrawal is stiff. bankAccount:
Every bank account has an account number, the name of the owner, and a balance. Therefore,
instance variables such as name, accountNumber, and balance should be declared in the abstract
class bankAccount. Some operations common to all types of accounts are retrieve account
owner\'s name, account number, and account balance; make deposits; withdraw money; and
create monthly statements. So include functions to implement these operations. Some of these
functions will be pure virtual. checkingAccount: A checking account is a bank account
Therefore, it inherits all the properties of a bank account. Because one of the objectives of a
checking account is to be able to write checks, include the pure virtual function writeCheck to
write a check. serviceChargeChecking: A service charge checking account is a checking account.
Therefore, it inherits all the properties of a checking account. For simplicity, assume that this
type of account does not pay any interest, allows the account holder to write a limited number of
checks each month, and does not require any minimum balance. Include appropriate named
constants, instance variables, and functions in this class. noServiceChargeChecki.
The published document gives overall view of OTC, is the end-to-end business process for receiving and processing customer orders. It also gives accounting and technical insight for Oracle application R12 OTC cycle.
Test-Driven Development (TDD) and Behaviour-Driven Development (BDD) are powerful techniques, helping developers write better designed, more maintainable and more reliable code, and stay focused on the real user requirements. But how does the rest of the team fit in to the picture?
In this talk, we will look at how BDD techniques, and tools such as easyb, FitNesse, and other BDD-related tools can also act as drivers for the overall development process, and also as communication tools, giving testers and end-users clear and unambiguous feedback on what is being developed and where it is at in terms of delivery and schedule.
Serverless is the most clickbaity title for an actually interesting thing. Despite the name, Serverless does not mean you’re not using a server, rather, the promise of Serverless is to no longer have to babysit a server. Scaling is done for you, you’re billed only for what you use. In this session, we’ll cover some key use cases for these functions within a Vue.js application: we’ll accept payments with stripe, we’ll gather geolocation data from Google Maps, and more! We’ll make it all work with Vue and Nuxt seamlessly, simplifying how to leverage this paradigm to be a workhorse for your application.
Learn about the Fuchsia RFC Process (https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/rfc_process): what it is, when it should be used, how it works, and how to make the best of it.
Presentation given by Martin Kleppmann at Rails Underground in London on 24 July 2009. Gives an overview of how to develop a commercial B2B SaaS web app using Rails or other Ruby web frameworks, including best practices of structuring accouting data.
Integration of payment gateways using Paypal account Phenom People
E-commerce application service provider service that authorizes payments for e-businesses, online retailers, bricks and clicks or traditional brick and mortar. It is the equivalent of a physical point of sale terminal located in most retail outlets. Payment gateway protects credit cards details encrypting sensitive information, such as credit card numbers, to ensure that information pass securely between the customer and the merchant and also between merchant and payment processor.
Banks offer various types of accounts, such as savings, checking, cer.pdfrajeshjain2109
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and
money market, to attract customers as well as meet their specific needs. Two of the most
commonly used accounts are savings and checking. Each of these accounts has various options.
For example, you may have a savings account that requires no minimum balance but has a lower
interest rate. Similarly, you may have a checking account that limits the number of checks you
may write. Another type of account that is used to save money for the long term is certificate of
deposit (CD). In this programming exercise, you use abstract classes and pure virtual functions to
design classes to manipulate various types of accounts. For simplicity assume that the bank
offers three types of accounts: savings, checking, and certificate of deposit, as described next.
Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no
minimum balance and a lower interest rate and another that requires a minimum balance and has
a higher interest rate Checking accounts: Suppose that the bank offers three types of checking
accounts: one with a monthly service charge, limited check writing, no minimum balance, and no
interest, another with no monthly service charge, a minimum balance requirement, unlimited
check writing and lower interest, and a third with no monthly service charge, a higher minimum
requirement, a higher interest rate, and unlimited check writing Certificate of deposit (CD): In an
account of this type, money is left for some time, and these accounts draw higher interest rates
than savings or checking accounts. Suppose that you purchase a CD for six months. Then we say
that the CD will mature in six months. The penalty
Solution
#include
#include
using namespace std;
class bankAccount
{
private:
string accHolderName;
string accountType;
int accountNumber;
double accBalance;
public:
bankAccount(string fullName = \"\", string accType = \"\", int accNum = 0, double balance =
0.0);
string getAccHolderName() const;
string getAccountType() const;
int getAccountNumber() const;
double getAccBalance() const;
void deposit(double amount);
void withdrawl(double amount);
virtual void print() const = 0;
};
/*contructor*/
bankAccount::bankAccount(string fullName, string accType, int accNum, double balance) {
accHolderName = fullName;
accountType = accType;
accountNumber = accNum;
accBalance = balance;
}
string bankAccount::getAccHolderName() const{
return accHolderName;
}
string bankAccount::getAccountType() const{
return accountType;
}
int bankAccount::getAccountNumber() const{
return accountNumber;
}
double bankAccount::getAccBalance() const{
return accBalance;
}
void bankAccount::deposit(double amount) {
accBalance += amount;
}
void bankAccount::withdrawl(double amount) {
if (amount > accBalance) {
cout << \"Insufficent Funds. Account balance: \" << accBalance << endl;
} else {
accBalance -= amount;
}
}
class checkingAccount: public bankAccount
{.
Talk given at DDDx London on 27th of April about how to implement long running processes in Domain Driven Design properly. Describes patterns like Process Manager and Saga.
Banks offer various types of accounts, such as savings, checking, cer.pdfakbsingh1313
Banks offer various types of accounts, such as savings, checking, certificate of deposits, and
money market, to attract customers as well as meet their specific needs. Two of the most
commonly used accounts are savings and checking. Each of these accounts has various options.
For example, you may have a savings account that requires no minimum balance but has a lower
interest rate. Similarly, you may have a checking account that limits the number of checks you
may write. Another type of account that is used to save money for the long term is certificate of
deposit (CD). In this programming exercise, you use abstract classes and pure virtual functions to
design classes to manipulate various types of accounts. For simplicity, assume that the bank
offers three types of accounts: savings, checking, and certificate of deposit, as described next.
Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no
minimum balance and a lower interest rate and another that requires a minimum balance and has
a higher interest rate. Checking accounts: Suppose that the bank offers three types of checking
accounts: one with a monthly service charge, limited check writing, no minimum balance, and no
interest; another with no monthly service charge, a minimum balance requirement, unlimited
check writing and lower interest; and a third with no monthly service charge, a higher minimum
requirement, a higher interest rate, and unlimited check writing. Certificate of deposit (CD): In
an account of this type, money is left for some time, and these accounts draw higher interest rates
than savings or checking accounts. Suppose that you purchase a CD for six months. Then we say
that the CD will mature in six months. The penalty for early withdrawal is stiff. bankAccount:
Every bank account has an account number, the name of the owner, and a balance. Therefore,
instance variables such as name, accountNumber, and balance should be declared in the abstract
class bankAccount. Some operations common to all types of accounts are retrieve account
owner\'s name, account number, and account balance; make deposits; withdraw money; and
create monthly statements. So include functions to implement these operations. Some of these
functions will be pure virtual. checkingAccount: A checking account is a bank account
Therefore, it inherits all the properties of a bank account. Because one of the objectives of a
checking account is to be able to write checks, include the pure virtual function writeCheck to
write a check. serviceChargeChecking: A service charge checking account is a checking account.
Therefore, it inherits all the properties of a checking account. For simplicity, assume that this
type of account does not pay any interest, allows the account holder to write a limited number of
checks each month, and does not require any minimum balance. Include appropriate named
constants, instance variables, and functions in this class. noServiceChargeChecki.
The published document gives overall view of OTC, is the end-to-end business process for receiving and processing customer orders. It also gives accounting and technical insight for Oracle application R12 OTC cycle.
Test-Driven Development (TDD) and Behaviour-Driven Development (BDD) are powerful techniques, helping developers write better designed, more maintainable and more reliable code, and stay focused on the real user requirements. But how does the rest of the team fit in to the picture?
In this talk, we will look at how BDD techniques, and tools such as easyb, FitNesse, and other BDD-related tools can also act as drivers for the overall development process, and also as communication tools, giving testers and end-users clear and unambiguous feedback on what is being developed and where it is at in terms of delivery and schedule.
Serverless is the most clickbaity title for an actually interesting thing. Despite the name, Serverless does not mean you’re not using a server, rather, the promise of Serverless is to no longer have to babysit a server. Scaling is done for you, you’re billed only for what you use. In this session, we’ll cover some key use cases for these functions within a Vue.js application: we’ll accept payments with stripe, we’ll gather geolocation data from Google Maps, and more! We’ll make it all work with Vue and Nuxt seamlessly, simplifying how to leverage this paradigm to be a workhorse for your application.
Similar to How to Send a Receipt, Topics in Concurrency and Distributed Systems (20)
Learn about the Fuchsia RFC Process (https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/rfc_process): what it is, when it should be used, how it works, and how to make the best of it.
Survey of corporate finance knowledge.
Top-of-mind for the CEO / founder:
- Company creation, and initial share pool
- Raising capital the usual way
- Raising capital via debt
- Raising capital via bridge loans
- Common Shares vs Preferred Shares
- Section 409A, and valuation
- Employee pool growth (and equity plan, e.g. http://www.slideshare.net/wealthfront/wealthfront-equity-plan)
Top-of-mind for employees:
- Shares, Options and valuing a grant
- Exercise
- Tax Scenarios
Applying Compiler Techniques to Iterate At Blazing SpeedPascal-Louis Perez
In this session, we will present real life applications of compiler techniques helping kaChing achieve ultra confidence and power its incredible 5 minutes commit-to-production cycle [1]. We'll talk about idempotency analysis [2], dependency detection, on the fly optimisations, automatic memoization [3], type unification [4] and more! This talk is not suitable for the faint-hearted... If you want to dive deep, learn about advanced JVM topics, devoure bytecode and see first hand applications of theoretical computer science, join us.
[1] http://eng.kaching.com/2010/05/deployment-infrastructure-for.html
[2] http://en.wikipedia.org/wiki/Idempotence
[3] http://en.wikipedia.org/wiki/Memoization
[4] http://eng.kaching.com/2009/10/unifying-type-parameters-in-java.html
Continuous deployment is a a process that allows companies to release software in minutes instead of days, weeks, or months.
Pascal-Louis Perez will describe how to use continuous deployment to iterate so fast that you run circles around the competition. He will cover the high level concepts as well as the nitty gritty details including examples from the continuous deployment system that he and his team developed at KaChing.
Pascal-Louis is the VP of Engineering and CTO at KaChing, where he practices continuous deployment continuously.
He previously worked at Google and holds a Master's degree in Computer Science from Stanford University.
At kaChing (www.kaching.com), we are on a 5-minute commit-to-production cycle. We have adopted continuous deployment as a way of life and as the natural next step to continuous integration.
In this talk, I will present how we achieved this extreme iteration cycle. We will start at a very high level and look at the two fundamental aspects of software: transformations, which are stateless data operations, and interactions, which deal with state (such as a database, or an e-mail server). With this background we will delve into practical matters and survey kaChing's testing infrastructure by motivating each category of tests with different kind of problems often encountered. Finally, we will look at software patterns that lend themselves to testing and achieving separation of concerns allowing unparalleled software composability.
(This talk will focus on a Java environment even though the discussion will be largely applicable.)
A high-level overview of the Closure Compiler's type system, type checking and type system capabilities. For a full description http://code.google.com/closure/compiler/docs/js-for-compiler.html
Abstract: kaChing powers the largest social investment site on the web with nearly 500,000 registered users. Our mission is to make the investment world open by offering transparent investment vehicles that directly compete with mutual funds.
Over the past year and a half, we have built a large feature set and evolved our software continuously with very short iterations and (almost) no regression. In this talk, I will present our experience building a large test-driven code base from the ground up. Using concrete examples, we will have a look at component based APIs, declarative programming, minimizing the concepts of an API, specific cases of separation of concern and interactions with third-party software. We will look at multiple programming paradigms from languages such as Scala, shell script and Prolog and see how these ideas can be embedded as syntactic sugar in your Java.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Gen AI Study Jams _ For the GDSC Leads in India.pdf
How to Send a Receipt, Topics in Concurrency and Distributed Systems
1. How to Send a Receipt
Topics in Concurrency and Distributed Systems | @pascallouisperez
2. The Situation
‣ It’s Black Friday on an e-commerce site.
‣ When a customer makes a purchase,
‣ We send said customer a purchase receipt.
3. Not That Simple
Sending a purchase receipt via email after a purchase is a
concrete product requirement which takes us down into
distributed systems design.
Generalizable Problematic
Many problems we encounter can be rephrased as the
canonical ‘sending a receipt’ problem. And hence,
understanding it well is a powerful tool.
How to Send a Receipt
Topics in Concurrency and Distributed
Systems
5. Bad Solution
Mo Money Mo Problems
‣ Not easy to charge a credit
card.
‣ Auth / Capture model? Single
Charge?
‣ Gateway Idempotency?
‣ Handling of timeouts? TCP
interruptions?
‣ Database crash?
purchase_handler(…) {
err = charge_cc(cc, order.amount);
if err != nil { return err }
err = mark_as_paid(db, order);
if err != nil { return err }
err = send_receipt(order.customer);
if err != nil { return err }
err = mark_receipt_sent(db, order);
if err != nil { return err }
return nil
}
6. ‣ Failure to mark as paid leads
to dangling payment without a
confirmed order!
‣ Or a paid order without an
email receipt.
‣ Retrying the handler would
double charge.
‣ (Many other bad things.)
Bad Solution
Some of the Failure Modes
purchase_handler(…) {
err = charge_cc(cc, order.amount);
if err != nil { return err }
err = mark_as_paid(db, order);
if err != nil { return err }
err = send_receipt(order.customer);
if err != nil { return err }
err = mark_receipt_sent(db, order);
if err != nil { return err }
return nil
}
7. (Shorthand) purchase_handler(…) {
err = charge_cc(cc, order.amount); on err return
err = mark_as_paid(db, order); on err return
err = send_receipt(order.customer); on err return
err = mark_receipt_sent(db, order); on err return
return nil
}
9. Charging
Single Call Model
‣ Creating a charge debits the
customer’s credit card.
‣ Charges are uniquely
identified, and the payment
provider guarantees
idempotency.
‣ Makes it easy to charge,
simply retry until success.
However, requires care to
avoid dangling payments.
10. Charging
Auth / Capture Model
‣ Authorize creates a pending
transaction, and reserves
funds. Auth are uniquely
identified… And providers
expose pseudo idempotency.
‣ Capture confirms the
transactions.
‣ Makes it hard to charge.
However, avoids dangling
payments in failure cases.
(Let’s ignore this model for now.)
11. Charging
Let’s Fix It
purchase_handler(…) {
err = run_transaction(db, func(tx) error {
order.cc_charge_uuid = new_uuid(…);
save(order);
}); on err return
charge, err = stripe.create_charge(order); on err retur
err = run_transaction(db, func(tx) error {
order.cc_charge = charge;
save(order);
}); on err return
err = send_receipt(order.customer); on err return
err = mark_receipt_sent(db, order); on err return
return nil
}
12. Charging
The Pattern
Prepare, Do, Propagate
‣ Tell them what you are going
to tell them;
‣ Tell them;
‣ Then tell them what you told
them.
purchase_handler(…) {
err = run_transaction(db, func(tx) error {
order.cc_charge_uuid = new_uuid(…);
save(order);
}); on err return
charge, err = stripe.create_charge(order); on err retur
err = run_transaction(db, func(tx) error {
order.cc_charge = charge;
save(order);
}); on err return
err = send_receipt(order.customer); on err return
err = mark_receipt_sent(db, order); on err return
return nil
}
13. Charging
Let’s Fix It
purchase_handler(…) {
err = run_transaction(db, func(tx) error {
order.cc_charge_uuid = new_uuid(…);
save(order);
}); on err return
charge, err = stripe.create_charge(order); on err retur
err = run_transaction(db, func(tx) error {
order.cc_charge = charge;
save(order);
}); on err return
err = send_receipt(order.customer); on err return
err = mark_receipt_sent(db, order); on err return
return nil
}
‣ No ‘cc_charge_uuid’: failed
early, can retry.
‣ No ‘cc_charge’: retry
payment, Stripe guarantees
idempotency.
‣ Did we send the receipt?
15. $ telnet smtp.thatsanexample.com 25
HELO thatsanexample.com
MAIL from: <pascal@thatsanexample.com>
RCPT to: <pascallouisperez@gmail.com>
DATA
From: pascal@thatsanexample.com
To: pascallouisperez@gmail.com
Subject: SMTP is low level and simple
This is an example.
.
QUIT
Sending Emails
Quick SMTP Primer
‣ RFC2821 for SMTP protocol;
and
‣ RFC2822 for message format.
17. Sending Emails
Avoiding Duplicates
‣ Only four mentions of
‘duplicate’ in RFC2821:
1. Avoiding duplicates for
mailing lists, not relevant;
2. Specification of a ‘text line’
which has a ‘dot duplicate’,
not relevant;
3. Page 62 represented here,
simplistic recommendation;
4. Reference 28 which points to
an 1988 article “Duplicate
messages and SMTP”, which
became RFC1047.
18. Sending Emails
Avoiding Duplicates
‣ Oh, and RFC1047 is not useful.
Good Description of the Problem
“If the communications link fails during this synchronization gap,
then the message has been duplicated. Both mailers have active
copies of the message that they will try to deliver.”
Simplistic Suggestion
“The best way to avoid the synchronization problem is to
minimize the length of the synchronization gap. In other words,
receiving mailers should acknowledge the final dot as soon as
possible and do more complex processing of the message later.”
19. Sending Emails
Avoiding Duplicates
‣ RFC2821 replaced RFC821 in
2001;
‣ In particular, it saw the
introduction of a ‘message-id’.
‣ One can hope most clients
correctly populate this field
(just kidding); and
‣ One can hope most SMTP
relays use this field to de-
duplicate messages.
22. Sending Emails
Email Delivery Services
‣ MailChimp doesn’t expose the
message-id;
‣ Though it allows custom
headers to be passed, hence
likely making it possible to
pass a message-id.
23. Sending Emails
Email Delivery Services
‣ SailThru has a ‘send_id’, yeah!
(Note: Haven’t tested if this is used
to populate the message-id. Seems
to imply as much.)
24. ‣ Impossible to avoid duplicates.
‣ Hence, we have
‣ No delivery; or
‣ At least once delivery.
(It sucks. SMS is worse. So is the post office frankly.)
Sending Emails
The Conclusion
26. Fix It, How?
Back to the Subject at Hand
purchase_handler(…) {
err = run_transaction(db, func(tx) error {
order.cc_charge_uuid = new_uuid(…);
save(order);
}); on err return
charge, err = stripe.create_charge(order); on err retur
err = run_transaction(db, func(tx) error {
order.cc_charge = charge;
save(order);
}); on err return
err = send_receipt(order.customer); on err return
err = mark_receipt_sent(db, order); on err return
return nil
}
‣ If we are unable to record the
charge, don’t send the receipt.
‣ If we are able to record the
charge, we must guarantee
that the receipt will be
delivered.
‣ Given what we learned about
email delivery, our choice is
between no delivery, or at
least once delivery.
27. Fix It, How?
Back to the Subject at Hand
purchase_handler(…) {
err = run_transaction(db, func(tx) error {
order.cc_charge_uuid = new_uuid(…);
order.receipt_uuid = new_uuid(…);
save(order);
}); on err return
charge, err = stripe.create_charge(order); on err retur
err = run_transaction(db, func(tx) error {
order.cc_charge = charge;
order.receipt_state = PENDING;
save(order);
}); on err return
return nil
}
Prepare
‣ Record intent to send receipt.
‣ The intent includes the
identifier of the receipt: it is
this specific email we intend
to send.
Do
‣ Charge
Propagate
‣ In the background, process
the email queue and retry
until confirmation of delivery.
29. Inventoried Item (e.g. a seated ticket to a show)
Prepare: check availability, and ‘soft reserve’ to avoid
double bookings.
Propagate: confirm reservation.
Activating Gift Cards
Prepare: soft creation of the card.
Propagate: activate and fund.
Coupons
Prepare: verify the validity, and ’soft redeem’ to avoid
double use.
Propagate: actually redeem it.
Similar Problematics
Hard Across µServices Boundaries
30. The Order as Distributed Transaction Coordinator
Distributed transaction processing, and two-phase commit.
Order ManagementOrder Management
Purchase
31. The Order as Distributed Transaction Coordinator
Distributed transaction processing, and two-phase commit.
Order ManagementOrder Management
Prepare: “Soft Reserve” Prepare: “Create Gift Card”
“The Commit Request Phase”
32. The Order as Distributed Transaction Coordinator
Distributed transaction processing, and two-phase commit.
Order ManagementOrder Management
Do: “Charge”
“The Commit Phase”
33. The Order as Distributed Transaction Coordinator
Distributed transaction processing, and two-phase commit.
Order ManagementOrder Management
Propagate: “Confirm” Propagate: “Activate”
Propagate: “Send”
“The Success Phase”
34. The Order as Distributed Transaction Coordinator
Distributed transaction processing, and two-phase commit.
Order ManagementOrder Management
Propagate: “Cancel” Propagate: “Dispose”
“The Failure Phase”
35. Propagate: “Reconcile to
Cancel (or Refund) Dangling
Payment”
The Order as Distributed Transaction Coordinator
Distributed transaction processing, and two-phase commit.
Order ManagementOrder Management
Propagate: “Expiry” Propagate: “Garbage Collect”
“The (Unofficial) Cleanup Post Failure Phase”
36. In Closing
‣ RTFM (“Read The Fucking Manual”)
‣ It's turtles all the way down, follow the thread
‣ Correctness at app level requires understand of low level details
‣ Distributed Systems are Hard
‣ No need to re-invent the wheel, most of CS was invented in the 1970s, and we’re just
repurposing known techniques
‣ Design Early, Design Often
‣ You can’t iterate your way to correctness
‣ Think through your systems early, write it down, rinse, repeat