Posts
Recursion Made Simple: How Two Calls Shape Your Code | binary recursion
- Get link
- X
- Other Apps

In recursion, when a function makes two recursive calls within its body, it is referred to as binary recursion . This is because the recursion "branches" into two parts at each step, much like a binary tree. Binary Recursion : A function that calls itself twice within the recursive case, creating two subproblems for each call. As in your example, the function counter(n) calls counter(n - 1) twice, causing the recursion to branch into two directions. This leads to a recursive tree with exponential growth, which results in the time complexity of O(2^n), as seen in the image. Recursion is a fundamental programming technique where a function calls itself to solve smaller instances of the same problem. This image beautifully illustrates how recursion works through a simple counter function that prints numbers, and the recursion unfolds into a tree-like structure. Let’s break it down step by step. ----- function counter ( n ) { if (n > 0 ) { console . log (n); ...
Upload File in .net core
- Get link
- X
- Other Apps
We are going to understand uploading using the Add Product method, we have a product controller and inside that we have an Add Product method. CODE REPO First we will create a model for AddProduct and set Validation to properties Add IFormFile Type in Model to get the file see above image. Lets create AddProduct method and Use AddProduct Model We can also configure Form option in Program.cs file Run and upload the file using AddProduct API, File will be stored in uploads folder, Create folder before using this otherwise it will throw, we can auto create folder if not exists that code is not included here. Create an api to download the file see below image.
Middleware, Filter and Attributes.
- Get link
- X
- Other Apps
Examples: Attributes Aspect Filter Middleware Attribute Purpose Execute custom logic at specific points during the MVC request pipeline (e.g., before/after actions). Handle requests and responses globally or for specific routes; used for cross-cutting concerns. Add metadata to code elements for various purposes, often used with reflection. Scope Specific to MVC actions, controllers, or globally across MVC actions. Applied globally or to specific routes in the application. Applied to classes, methods, properties, etc. Execution Stage Executes before and/or after action methods, before and/or after results, or when exceptions occur. Executes during the request-processing pipeline; can short-circuit the pipeline. Executes at compile time or runtime, depending on how metadata is used. Configuration Configured in the MVC pipeline (e.g., via Startup.cs / (Program.cs v6 or later) or attribute-based). Configured in the Startup.cs / (Program.cs v6 or later) file. Configured by app...