Functional Requirement Design Constraint Google Docs users get a lot of storage space with their accounts, but it’s not unlimited. Each account can have up to: First, we need to understand some logic that a lot of users can change a document at the same time without any conflict. Operational Transformation Operational Transformations as an …
Author Archives: codeblogforfun
Jwt Token
{header{encoded along for payload}.{payload(info about, claims(public and private)}. {Signature} 1: Jwt Token: JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed …
Mongo DB Compound Index Creation Guide:
Indexes Indexes support the efficient execution of queries in MongoDB. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect. …
Web Server
A web server is computer software and underlying hardware that accepts requests via HTTP, the network protocol created to distribute web pages, or its secure variant HTTPS. Basic common features[edit] Although web server programs differ in how they are implemented, most of them offer the following basic common features. HTTP: support for one or more versions of HTTP protocol in order to send …
Async Method Return Types at a Glance
Methods marked with async in C# must return one of the following: Task Task<T> ValueTask ValueTask<T> void Why You Should Generally Stick to Task If you feel overwhelmed by the list of return types above, let me put your mind at ease. Most of the time, you should just use a return type of Task or Task<T> with async methods. Everything else in the list …
Singleton Vs Static Classes
1:sigleton classes support Interface inheritance whereas a static class cannot implement an interface: 2: public class Singleton { private static Singleton instance; private Singleton() {} public static Singleton Instance { get { if (instance == null) { instance = new Singleton(); } return instance; } } } static public class StaticSampleClass { private static readonly int SomeVariable; //Static constructor is executed only once when the type is first used. //All classes can have static constructors, not just static classes. static StaticSampleClass() { SomeVariable = 1; //Do the required things } public static string ShowValue() { return string.Format(“The value of someVariable is {0}”, SomeVariable); } public static string Message { get; set; } } When shall we use singleton class …
Improving scalability in C# using Async and Await
Asynchronous code targets scalability making us use the resources of our servers better. The inspiration for this article comes from the talk given byMaarten Balliauw. What is asynchronous code good for? Asynchronous programming can in some cases help with performance by parallelizing a task. But, that is not its main benefit in day to day …
Continue reading “Improving scalability in C# using Async and Await”
Sync vs. Async vs. Concurrent vs. Parallel
“How do you distinguish between sync vs. async vs. concurrent vs. parallel?” It’s a question you’ll probably be asked in your first technical interview. Having witnessed a lot of answers from interviewees, I see that people know the terms, but they rarely understand what they conceptually are. Knowing use cases are essential. However, just knowing …
Continue reading “Sync vs. Async vs. Concurrent vs. Parallel”
Long-Polling vs WebSockets vs Server-Sent Events
Ajax PollingHTTP Long-PollingWebSocketsServer-Sent Events (SSEs) Ajax Polling# Polling is a standard technique used by the vast majority of AJAX applications. The basic idea is that the client repeatedly polls (or requests) a server for data. The client makes a request and waits for the server to respond with data. If no data is available, an empty …
Continue reading “Long-Polling vs WebSockets vs Server-Sent Events”
A High Performance Multi-Threaded LRU Cache
Introduction A LRU Cache is a key-value based data container that is constrained by size and/or age, removing the least recently used objects first. This algorithm requires keeping track of the most recent time each object is accessed. 1:Most LRU Caching algorithms consist of two parts: a dictionary and a doubleLinkLlist. 1:The dictionary guarantees quick …
Continue reading “A High Performance Multi-Threaded LRU Cache”