Software Engineer From Syria, working @OLX Group #php #python #flask #django #laravel #mongodb #redis #docker #rest #k8s #microservices
Image for post
Image for post
Photo by Diego Gavilanez on Unsplash

I got graduated from the Cloud Developer nano-degree program ~ 2 weeks ago, and I decided to share my experience in quick Q&A, so if you have any other questions in your mind after reading this post, please don’t hesitate to comment.

What’s Udacity Nano-degree? 💡 💡

It’s an online certificate that you earn it after you enroll in one of the nano degree programs provided by Udacity.

How long will it take to graduate from the program? 🎓🎓🎓

Usually, most of the programs take ~ 4-6 months, but it depends on the program you enroll in, as each one…

Image for post
Image for post
“brown and black city landscape 3D map” by Thor Alvis on Unsplash

There are many ways to implement finding nearest locations by given latitude and longitude .

Some of the implementations can be achieved through a backend logic,

and the other ways can be done by utilizing some features(Spatial Indexes) provided by DBMSs’(Mysql, SQL, MongoDB,….etc).

In this post I will explain by example how we can do it with MongoDB.

What are Latitude and Longitude? , You can find more from here

How To ?

Let’s create a collection in MongoDb and we call it locations .

To Achieve the query of finding nearest locations by given latitude and longitude, we do the following…

Image for post
Image for post
“Soaring snow-capped mountains under the evening sky” by Daniel Leone on Unsplash

What is it ?

— A query language for your API .
— It is a methodology that directly competes with REST (Representational state transfer) APIs, much like REST competed with SOAP at first .
It’s not tied to a specific technology, but you can implement it in any language.

-GraphQL is a data query language using two types of requests queries (read operations retrieving data from the server) and mutations (write operations modifying data on the server).
- You can serve all the client requests with one endpoint.

Who and When did they develop that ?

GraphQL was developed internally by Facebook in 2012 before being publicly released in…

Image for post
Image for post
“A drone view of evergreen trees and a stream in Mühlebach VS” by Joao Branco on Unsplash


It’s a feature added in MongoDB starting from the version 3.6, that give you an ability to keep you up to date with your data changes .

So in case of any changes(write messages: Insert, Update, Delete) that happen against a specific collection, it triggers a `change event` with the data that has been changed.

Change streams will engage developers to effectively use the control of MongoDB’s real-time usefulness to respond to pertinent information changes promptly.

What are the needed requirements to start using change stream in MongoDb ?

1- MongoDb version 3.6 or any version after it.
2- Create MongoDb Replica Set [How to create replica set using docker ? >]

Image for post
Image for post

Yes!, we can execute DOM commands against documents or ( web pages ) using javascript.

Actually, it started to happen when the HTML document has been switched to designMode .

The entire document becomes editable, then the document object exposed new method called `execCommand`.

Most of the commands affect the document’s selection (bold, italics, etc.) .

Code, Code, and Code …..

Ahead to do some coding 🚀 … in the following example, we have a `div` which is editable, and we will execute some commands like `Bold`, `italic`, `delete` , and `adding an image` to that `div` via document’s commands :

Note: Run the Pen…

Image for post
Image for post
Photo by Igor Ovsyannykov on Unsplash

How the requests are being handled inside Node.js server ?

First of all we need to know the main components inside any Node.js server :

1- Event Queue: It’s a queue that contains all the requests which are coming from the clients.

for example: When the node.js server gets 1,2,3,4,…n number of requests, all of them will be pushed to that queue , before being picked up by the event loop .

2- Event Loop: It’s a Component inside node.js server that allows node.js to perform non-blocking I/O operations, so event loop is picking up the requests from the Event…

…………………………Cross Origin Resource Sharing ………………………..

Image for post
Image for post
“A traffic light showing a red light under a bridge” by Hermes Rivera on Unsplash

Let’s start with the following screenshot!

Image for post
Image for post
“Camel walks through deserts of Great Sand Dunes National Park and Preserve” by Lyndsey Marie on Unsplash

What’s Redux?

Redux is an open-source JavaScript library for managing application state [Wikipedia]

Actually, I will jump quickly, into an example so I can explain the Redux concept step by step in a better way .

Let’s assume that we have a React JS application , and this application has 3 Components , each component has its own states :

A- Component 1 has state object of ( X1, Y1 ).

B- Component 2 has state object of( X2 , Y2 ).

C- Component 3 has state object of ( X3 , Y3 ).

Image for post
Image for post

What are the websocket’s headers that have to be configured ?

First of all we have to know the two types of HTTP headers :

1- End to end headers : Which must be transmitted to the ultimate recipient of a request or response.

2- Hop by Hop headers : Is getting transferred between intermediate points, so those headers are not stored by caches or forwarded by proxies .

Check here to read about Hop by hop headers.

So as a Note:

Web Sockets rely on hop by hop headers especially( `Connection` and `Upgrade`) , and as we just knew…

Image for post
Image for post
Photo by Nick Hillier on Unsplash

Let’s talk first about the type and levels of locking :

Types of locking:

1- Read Lock or a shared lock:

The locked data is reserved for read by the current session. Other sessions can read the locked data. But they can not write (update) the locked data.

2- Write Lock or an exclusive lock:

The locked data is reserved for write by the current session. Other sessions can not read and write the locked data.

Levels of locking:

1- Table lock : All the rows will be locked when the table is locked. 2- Row lock : Some rows will be locked in the table , but other rows will not be locked…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store