Posts

Showing posts from May, 2024

DP

https://leetcode.com/problems/target-sum/solutions/455024/dp-is-easy-5-steps-to-think-through-dp-questions/ First i have to use recursion to the question then i have to go for memoization and then last i will go for top down approaches. How to find the base case? Think of the smallest valid input.  if(n==0 || w==0) return 0 as the smallest n would be 0 and also the weight for 0/1 knapsack would be 0 as well, we can not take negative weight on a bag. if i go to a store and the store has all the bigger items then i can not hold it to the bag so weight would be 0. similarly if the store has no item so n=0 Recursive function: fn (i/p) fn(smaller i/p) if the input is n then we have to go for (n-1) as the smaller input as that will work as recursion.   0/1 Knapsack Problem: 416. Partition Equal Subset Sum 474. Ones and Zeroes 494. Target Sum 1049. Last Stone Weight II 879. Profitable Schemes 1155. Number of Dice Rolls With Target Sum       Unbounded Knapsack Prob...

fix

 https://stackoverflow.com/questions/70465659/why-is-tailwinds-build-command-not-working  tailwindcss

vim

keybinding.json and settings.json file. https://gist.github.com/wojukasz/d76ca3162debc66d4227b9dc6049789e   VIM tips: https://www.youtube.com/watch?v=lWTzqPfy1gE

Whatever mind

 I have to finish identity and solid course and then i will finish with a good knowledge about backend. then i will go learn angular and following that i will work on signalr and learn signalr and angular together. then i will have practical knowledge about both angular and signalr that will be good. when im done, i will go start making project. my project will be a chat application, i will use solid architecture and design principles.

SOLID and Clean Architecture

 Layerd approachs. When each layer will be doing specific task such as LeaveManagement.application layer will only do the business logic and LeaveManagement.web will be doing only the web logic like working on the dependencies, wwwroot, program.cs, appsettings.json etc. But in the layerd approach also in the class there are methods where one more task are being doing and it is still cleanable. Test: Unit test, it allow us to know how the parts are working and starting up, integration testing is how the other components are working together. Inside a class, we should not use more than one class as the separation of concern, so we make each class separated and move. One file one class one responsibility. abstract: We can not create object of a abstract class using new keyword. abstract and static both have limitation on instantiation.

Question

 * Why not pass multiple post or multiple get api inside a controller? Although traditional REST api will not do this type of thing and inside a controller, if there are multiple methods then it is not a good practice of software architechture, it violates the single responsibility principle then what to do? If i separately create the apis of thousands then there will be not a scaleable practice. A solution to this problem would be graphQL. *Use custom api.

Before exam

 using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; namespace apiasp.Controllers {     [Route("api/[controller]")]     [ApiController]     public class ProductController : Controller     {         public static List<Product> Products = new List<Product>()         {             new Product { Id = 1, Name ="Rice", Price=3434.3},             new Product { Id = 2, Name ="Sugar", Price=343},             new Product { Id = 3, Name ="Salt", Price=444}         };         // GET api/product         [HttpGet]         public List<Produc...

ASP.NET Core Identity

 Authentication is of two types: Cookie based, Token based. Authorizaion is of two types: Role based(roles are like clims but did not have values), Claims based(Attribute of the user) it could be date of birth, emails etc.

ki ki

 move, shampoo, cent, oats,