Saturday, February 10, 2024

Story Masterclass notes

Day 1

First week of Story telling Masterclass by Matthew Dicks brought to us by Duggup, had some great pointers to tell a story on how to create a frame of story, identifying the map of the story followed by how to identify moments of transformation and how to use the opposite of the end state.

I once was a ________, but then some stuff happened, so now I'm a __________

I once thought ________, but then some stuff happened, so now I think __________

Storytelling is Storytelling is Storytelling and it's for everyone

What constitutes a story

Creating a Frame of your story

Developing a Thesis Statement for your story.

Homework : How did I get to role where I am currently in. Tell it to 3 people.

Day 2 :

Start your story with a location

I am sitting in Portland, Oregon and working from home with my kid asking how did you decide what you want to be

Cinema of Storytelling

- Tell your story in scenes

- The power of location

Scenes are delineated by :

1. Location

2. Time

3. Action

4. Disposition

5. Though

Scenes for my own story:

Location : WFH office sitting at my desk almost exhausted with meetings

Time: Looking towards the end of workday

Kid comes back from School and tells me what he wants to be when he grows up, ends up asking how I knew what I am going to do.

I am teenager looking to beat the summer heat (Crime )

Come across this room with AC

How to Entertain


  • What do you want ?
  • What do you need ?
  • Iceberg on Stakes
  • ET: will ET get home
  • Jaws: Who will be eaten
  • What are you worried about
  • Why are you afraid
  • what must you arrive
  • what must you find
  • When you were surprised, your audience should be surpised. So try to remember when you were surprised
  • The best way to preserve is telling the story moment by moment, beat by beat.
  • Avoid Preambles
  • Verbal detritus to avoid
    • Suddenly
    • Out of the blue
    • From left field
    • Guess what
    • All of a sudden
    • Would you believe it


Bringing together Stakes, Suspense and Surprise

Goal of storytelling is to take a moment from our life and make it unforgettable

Wednesday, October 12, 2022

Deep Python

Source code for reference:

 Attended Deep python workshop by Sanjay Vyas Sir, here are my notes from the session :

----------- Day 1 -------------------


Memory MAnagement 


JIT Compiler 

Garbage collector 

Variable declared are not global or local they are both 

Each Function call creates its own Stack frame 

Each stack frame has its own dictionary 

Checking the type (static programming ) and not checking in Type (dynamic programming)

Better comments configuration: 

"better-comments.tags": [ 


            "tag": "!",

            "color": "#FF2020",



            "tag": "~!",

            "color": "#FFFFFF",

            "backgroundColor": "#FF2020",



            "tag": "_",

            "color": "#FF2020",

            "underline": true



            "tag": "-",

            "color": "#FF2D00",

            "strikethrough": true,



            "tag": "^",

            "color": "#CD607E",



            "tag": "~^",

            "color": "#FFFFFF",

            "backgroundColor": "#CD607E",



            "tag": "?",

            "color": "#0096FF",



            "tag": "~?",

            "color": "#FFFFFF",

            "backgroundColor": "#0096FF",



            "color": "#75757",

            "tag": "//",



            "color": "#FF8C00",

            "tag": "%",



            "tag": "~%",

            "color": "#FFFFFF",

            "backgroundColor": "#FF8C00",



            "tag": "*",

            "color": "#66FF66",



            "tag": "~*",

            "color": "#FFFFFF",

            "backgroundColor": "#29AB87",



            "tag": "#",

            "color": "#FFFF00",



            "tag": "~#",

            "color": "#000000",

            "backgroundColor": "#FFFF00",



            "tag": ">",

            "color": "#00FFFF",



            "tag": "~>",

            "color": "#000000",

            "backgroundColor": "#00FFFF",


----------- Day 2 -------------------

Language have a pattern 

- Type System -- Static or Dynamic both of them have type system 

- Operators -- + = >

- Control Flow -- Conditional, Loops, Switch 

- Function -- Abiliti to write a function

- Object Oriented -- Class

- Functional -- f(x)-> x * x

Principles of Object Oriented 

There are no native types in pure OOP language, even Integer is a class 

Native data types are single unit 

Objects are supposed to be opaque 

SmallTalk has classes but no public private for building classes in SmallTalk 

Communication happens through messages 

Objects are supposed to be composite 

C++, Java, C# are hybrid OOP language 

One can define classes but there are also Native types, so one can creat object and can create variables 

Public, Private and Protected 

Even in Python everything is an object 

Communication happens through message passing AT RUNTIME 

Objects are not OPAQUE in case of Python 

Types in Python 

- bool

- int 

- float

- complex

- string 

- list 

- tuple 

Python has no native types but instead we call them as Basic Datatypes as they are classes 

Control Flow 

Alter the sequence of program 

No code blocks but indentation which defines the scope of the code 

For python the control flow is mainly : 

- if, 

- for, 

- while 

: does the job of establishing code block 

; is a python separator which is used to write multiple lines of code in same line 

id() can be used to determine the equivalence of the objects in terms of both being the same object 

----------- Day 3 -------------------

Expressions are assigned and consumed, also they emit a value which can be consumed by someone  



b = a = 1

Statements are actions and not values 

if a == 1: 


for a in range(0, 11):


if you one tries to asign statement to expression the there is an error

which says  "Expresssion expected to the right of ="

Pascal Case : first letter of english word is capitalized 

Camel Case: first charater of english word is lower case 

Snake Case: english word followed bu underscore  - def day_of_week (Used by Python)

Kebab Case: english word followd by the hyphen (-) --> webkit-toolkit- (Used in HTML classes and in CSS)

while can be paired with else to identify if the loop completed 

while a < b: 

# conditions 

if a == b : break # If break happens then the else part does not kick in, 

  # while having continue still executes the else part and contiues the loop too. 


# this is done only if the loop was not broken 

----------- Day 4 -------------------

__init__ is called once the object is created 

first parameter of __init__ is self which points to current object, it can be named as anything self is just a variable name. 

Same class can be written as part of the class 

Monkey patching --> Insert a function inside an obejct at run time, 

def hello():


p.hello = hello


q = Person()



Every thing in a class is a dictionary, assigning a function to a variable 

is nothing but assigning a funtion body to the key. 

Key can be a name while value can be function body or anything 

Can Monkey patching be done at Class Level ? 

Answer is yes the it can be done using the setattr(ClassName, "Method_name", method_definition)

print(locals()) --> This print locals 

----------- Day 5 -------------------

mypy is a tool which is used to check the types statically in Python 

mypy will flag the monkey patching as errors but the code will still run 

python3 -m pip install mypy

mypy filename --> is the command which can run a static type checking 

When we create a class python creates a PyClass object 

When deriving a class the first parameter of class definition is super which is base class : 

class SavingsAccount(Account)

Class which is the owner of the field should initiaize the field 

super() is a function in python which refers to the base class, it can be used refer the constructor of base class :

super().__init__(self, base class init params )

----------- Day 6 -------------------

simple array in python is not a contiguous location of memory 

Internally its a type of linked list, with one node pointing to another 

in the latest version of python there is a Array class which has contiguous memory 

Different methods attached to the list

Python can create mixed type list like [1, "Guido", True, 1], but python is strongly typed because it will not 

allow to add 2 different types but C can do it by implicitly conerting the data. 

import array from array # creates a contiguous memory array 

Lists are less performant than array, hence new version explicitly introduced array 

Map operations --> Hash Tables --> Dictionary 

----------- Day 7 -------------------

Constructor chaining 

The logic to update a field should be present in the class which owns the class 

super().withdraw() --> to call the base class method

Memory management in Python 

C, Pascal, C++ --> Manual Memory Management 

Python uses --> Reference Counting, when one adds reference to an object the refCount += 1 

Every time a new reference is pointed to same object the ref count is incremented by 1 

Also known as Automatic Reference Counting (ARC)

For every object Python holds its own reference hence the ref count starts at 1 

Python has RefCount GC and Generational GC 

Mark-Sweep-Compact GC used by Java, C#, 

----------- Day 8 -------------------

string.format library:

print("name [{0:^20s}] {1:o}").format(name, 14) --> first positional parameter center it in 20 charaacter and print it as a string

specifying f in front of a string in python makes it as a format string which we specified above 

__str__ is the same as toString in C# 

implementing __str__ for a class will help in printing the method 

there is another method repr(object) --> Representation of the object

which also calls the __repr__ which should present the representation of the object 

repr shows how the object was created --> Something similar to reflection 

Operators are te reak workhorses of programming

+, ==, > , < are the examples of operators 

to overload the operator == use the dunder method __eq__ 

operator overloading 

> maps to __gt__

< maps to __lt__

!= maps to __ne__

>= maps to __ge__

<= maps to __le__

Defining the __eq__ and __gt__ will also cater to implementing the __lt__

it will do a not of the greater than 

+ maps to __add__ (Add)

+= maps to __iadd__ (Plus equal to)

- maps to __sub__ (Subtract)

-= maps to __isub__ (Minus equal to)

----------- Day 9 -------------------

built-in data structures in python 

list - modification (insert, remove)

set (unique)

dictionary key:value pairs, unique keys 

tuple - readonly quick record, tuple requires a comma to be considered as a tuple 

otherwise with single it will be considered as the type of the element, read only quick record

ternary operator --> Condition ? when-true: when-false 

                 --> when-true Condition else when-false

return label if label is not None else "Unknown" 

Python dictionaries are always ordered since Python 3.8 

Default params have to be the last params the and can be followed by default params only 

Variadic parameter (var-args or rest arguments) use * represents that there can be any number of arguments, 

the name args can be changed, it's a convention 

----------- Day 10 -------------------

Decorator is an function which will call your function, it takes the function as a param to which it is applied

It must return a function to which it is called 

When you pass a parameter to decorator it becomes decorator factory and the decorator function is indented one level more 

Inbuilt decorators like 

@staticmethod to mark methods as static method 


@balance.setter --> Property setter 

 Generators yield out the transactions 


Thursday, January 06, 2022

Dependency Injection

One of the places I interviewed asked to present a small write up on DI, expectation was to be small and concise, here's what I came up with: 

What is dependency injection in C#, and what are the benefits of dependency injection?

Dependency Injection is a software design principle and pattern that enables developers to write loosely coupled code. 

It supports the notion of program to an interface and not an implementation. 

Dependency Injection addresses following problems: 

- The application uses an interface or base class to abstract the dependency implementation 

- Registration of the dependecy in DI container, once all the implementations of the service are registered the DI container can be built

- Injection of the service into the constructor of the class where it's used. The DI framework takes care of instatiation and disposing of the instance. 

Here are some of the advantages of the DI : 

- Late Binding : Implemented Services can be swapped with other services if needed. This is helpful in case if there's a requirement to use ORACLE instead of SQL. 

- Extensibility : Code can extended and reused in ways not specifically planned for.

- Parallel Development: Since the components are dependent on each others interfaces the development can happen parallely. This is especially helpful in large organizations. 

- Testability: Classes can be unit tested. Since the dependcies are abstracted using interfaces writing unit tests on the classes become easier by using mocking frameworks. 

Friday, December 17, 2021

Interview Attempt

I went into the Interview not knowing what to expect and expecting that with the level of preparation I had I will fail. I was desperate for a failure (surprising right) to know what plays out in a coding interview in US.

To my surprise I was asked few .Net Questions initially: 

- Explain the whole .Net Ecosystem with what's happening with .NetFramework, .Net Standard, .Net Core and .Net 6.0. Why and how we came to a state where we are. 

- What is Boxing and UnBoxing

- Explain the IDisposable pattern, Why can't we use the finalize method instead of implementing the IDisposable patterrn? 

- Have you ever encountered a problem with Memory Leak and what tools did you use to solve it and what was your approach. 

- What is dependency Injection and What are the advantages of that, how can you implement that in a feature.

- How do you keep yourself updated with the latest technology updates and what are your go to resources for the latest developments.

This was followed by a coding round where in I was provided with LeetCode problem number 253:

Definitely I did not do well cause of lack of preparation and did receive an honest feedback from the interviewer, I did not generate enough test data for the coding puzzle, should have solved simpler cases and then moved onto the complicated cases. Also while considering the timing I took DateTime as a input, Interviewer suggested I could have started with the int solved few cases and then moved onto the DateTime. 

Friday, October 29, 2021

What happens when you type in your browser

I will be describing the lifecycle using the ASP.Net MVC framework hosted on IIS on Windows. I will be describing the case under the assumption that the application is using .Net Framework 4.7.2 and not .Net Core. I am doing this based on what I have worked on in my current role. 

- The browser expects the URL to be in the format : scheme://host:port/path?query#fragment

- In this case the scheme is https which determines the default port to be used is 443. In this case the host is webapplication 

- The URL format above is adhered in this case and now the browser knows the hostname which it needs to resolve to an IP Address.

The browser will start to find the IP Address from the cache of browser or the next is to lookup in the host file of the machine, Windows has a local host file. 

- Once the cache lookup fails the browser sends a DNS request which using UDP.  The request is forwarded to the ISP's DNS Server. 

- Assuming that the request message is received by a DNS Server the server looks for the IP address associated with the requested hostname, if the address is found then the response is sent back else DNS recursively forwarded to the next configured DNS server until the address is found. 

- Assuming that the response of the UDP request is back the requesting client will now have a target IP Addressed which will be cached so that next set of requests do not have to go through multiple DNS hops. 

- Now that the client has an IP Address, browser can send the https request which is a application level protocol and uses transport layer security. The request at lower level uses the TCP which is a transport layer protocol which ensures the delivery of data in the same order as it was sent. 

- The browser in this case opens a TCP connection which is a 3 way hand shake, here's an example of how this interaction looks like 

 First Step: Browser: ---(Sends SYN=1234) ---> :Server 

 Second Step: Server: ---(Sends SYN=4011 ACK=1235)--> :Browser 

 Third Step : Browser: -- (Sends ACK=4012) --> :Server 

- Now that a 3 way handshake is completed an connection is established, now we are ready to send a https request. Ahh wait, Not quite yet because we are using https here.

- Since the scheme in the URL was https After the TCP handshake there's a TLS HandShake, with TLS the client and server 

adhere to the common ground of secure communitcation. Here's a small snippet of what a TLS HandShake looks like : 

Client Hello ---(TLS Version, Cipher Suites, Client Random) --> Server 

Server Hello --- (SSL Certificate, Cipher, Server Random) --> Client 

Authentication --> Client verifies the SSL Certficate 

Client --> Sends a premaster secret which is encrypted using the cipher and public key

Server --> decrypts the premaster secret using the private key. 

Both Client and server generate session key using the information exchanged above, the result should be the same. 

Client sends a finished message with SessionKey 

Server sends finished message with a sessionKey. 

Symmertic encryption is acheived and communication can continue using the session keys. 

- The client now sends a https request which contains http Method (GET, PUT, POST or DELETE), in this case its a GET since the browser is requesting a resource from the server. 

In this case the http request may look like 

GET http/1.1


- Assuming that the web application is hosted by an IIS Server and is build using the ASP.Net MVC. 

- The httpRequest reaches the IIS Server which based on the domain identifies the correct web application to service the request. 

- I will not go into the detail of how IIS processes the request, instead we will assume that IIS makes sure that the request reaches the correct the web application. 

- Now we will dive into begining from receiving the http request from the browser to sending the http response back within the the ASP.Net MVC pipeline.

- At a highlevel MVC Pipeline has the following processes in order : Routing --> Controller Initializtion --> Action Execution --> Result Execution --> View Initializtion and Rendering.

- https://webapplication/ , assuming there's no overriding of the default route map, UrlRoutingModule starts matching the perfect URL pattern from the RouteTable,

the request will be routed to, Controller which will be Initialzed is HomeController and the Action is Index 

- Once the URLRoutingModule finds the controller the appropriate controller is instantiated, appropriate action on the controller is invoked in this case Index. 

- Assuming the browser requested a resource which does not require authentication or authorization to access. Hence no authentication and authorization filters will be called. 

- As stated earlier in assumption that this is a GET operation the model binders will not play a role. 

- After the execution of Action the ActionResult is generated. This step completes the action execution. 

- ActionResult can be of many times for example ViewResult, RedirectToRoute, JsonResult. Let's make an assumption that we get a ViewResult back. 

- ViewEngine along with HTMLTagHelpers render the view and create a http Response with Body and applicable httpHeaders. 

- Once the response is generated At TCP layer the client receives the data which contains the httpResponse Header. 

- Assuming that the response is fully received by the client then there's a way 4 handshake to close the connection between the browser and the server. 

    (FIN <--> ACK)

Above discription is a simple interaction in a non-persistance interaction. 


Saturday, June 13, 2020

Apigee Learning and references.

At work there's an ongoing project to expose our existing set of Rest API's to outside world. The chosen product for API management is apigee. I wanted to learn more about this product and started looking around. 

I am documenting the set of resources that I completed: 

To get started create a trial account on apigee, google has been pretty kind with the eval accounts. One can be created by going to this link here

You'll get an activation link on the email entered and then once the account is activated google will provision a tenant (not sure if this is the right word here may be Organization may be a better word) for you. 

It takes a little bit of time to complete the provision but be patient and let google do the hard work for you :)

Once I had my eval Organization created, I followed steps here. Following the steps gives you an idea about the layout of the apigee UI. I highly recommend going through the Basic Concepts section too. 

I also found that there's a leaning track (again not sure if I am using the right word) on Coursera which has a set of courses which targets API development with apigee. 

(I have not completed this yet but hopefully I will and then update this post about how this course was). 

Tuesday, June 02, 2020


Implementing a client for an http PATCH route got me confused that which is the correct way to implement. 

Here are couple of links which helped me grasp this concept:

Another one:

Here's the package which was used to implement the server as well as client for the http PATCH: