Friday, December 31, 2021

Blocks

Submisssion Summary && Submission Editor  :  Submission Combo Block

Role Editor : Role Editor Block



Monday, November 29, 2021

Implement CQRS with MediatR in ASP.NET Core Web API

 


https://www.youtube.com/watch?v=bgoGtkmUAQg
https://www.youtube.com/watch?v=T1qyGmdgSQE
The Command and Query Responsibility Segregation(CQRS) is an architectural pattern that separates the read and writes operations of a data source
Mediator is used to reduce communication complexity between multiple objects or classes. This pattern provides a mediator class which normally handles all the communications between different classes and supports easy maintenance of the code by loose coupling. Mediator pattern falls under behavioural pattern category.
 
Basically, a Mediator perform 2 operations.
  • · Accept the incoming request
  • · Handles the incoming request and provide the response.
CQRS Mediator Patterns are prefered over large projects.

Advantages of CQRS

  1. Independent scaling
  2. Optimized data transfer objects
  3. Provides separation of concern
  4. High scalability

 





Sunday, November 14, 2021

Angular Help

https://nodejs.org/en/download/



Publish : ng build is the command you use when you're ready to build your application and deploy it.
  1. Run the command npm install in the terminal. This command will read the package.json file and install all the required dependencies into a node_modules folder in your project.











 C:\>node -v

c:\users\ng --version

c:\users>npm install @angular/cli

npm install -g @angular/cli@1.0.0  //npm install @angular/cli@latest   //npm install -g @angular/cli@latest

ng serve -- open

npm start

open vs project in VS code: code .

npm install -g @angular/cli@9.1.11

npm uninstall -g @angular/cli                                            

 Angular CLI Commands   : https://www.c-sharpcorner.com/article/quick-preview-angular-cli-commands/

ng generate module/component/service/class name

ng generate component login //ng generate component register

ng g c login

ng generate module user-auth //1 file

ng g c user-auth/sign-in // component under module

ng g class Dummy

ng g service  api-service

ng g service user-auth/test-service //service under module

ng build --prod   //ng build --dev


ngOnInit :

Executes after the constructor and after ngOnChange hook for the first time. It is most commonly used for component initialisation and retrieving data from a database


<form (submit)="onSubmit()"> <input [(ngModel)]="playerName"> </form> let playerName: string; onSubmit() { return this.playerName; }

Interview: https://www.youtube.com/watch?v=-jeoyDJDsSM














develop & debug applications using latest features of Angular. Candidate should have knowledge of below:
Angular 18/19
New features of Angular 18/19
Services in Angular
Components, Modules, Routing, forms, reactive programming.
Components & their life cycle
Templates & data binding, directives
Change Detection Mechanism
Zone less strategy
Pipes and different types of pipes
Signals in Angular
Passing data from One component to another
Observables
Auth guards
Flex box in CSS
Prototypes, callbacks
JavaScript, TypeScript




Sunday, August 22, 2021

Strategy_Pattern

 namespace WindowsFormsApp

{

    public interface IEmployeeSal

    {

         float GetSalary(int basic,float dividend,float commission);

    }

}

namespace WindowsFormsApp

{

    public class HRDeptSalary : IEmployeeSal

    {

       // @Override 

        public float GetSalary(int basic, float dividend, float commission)

        {

            return basic + dividend+commission;

        }

    }

    public class SalesDept : IEmployeeSal

    {

        // @Override 

        public float GetSalary(int basic, float dividend, float commission)

        {

            return basic + dividend+commission;

        }

    }

    public class PurchaseDept : IEmployeeSal

    {

        // @Override 

        public float GetSalary(int basic, float dividend, float commission)

        {

            return basic + dividend;

        }

    }

}

namespace WindowsFormsApp

{

    public class EmployeeSalary

    {

        public string EmployeeName { get; set; }

        public int Basic { get; set; }


        private IEmployeeSal _iEmployeeSal;


        public EmployeeSalary(IEmployeeSal iEmployeeSal)

        {

            this._iEmployeeSal = iEmployeeSal;

        }


        public float CalculateSalry(int basic, float dividend, float commission)

        {

            return _iEmployeeSal.GetSalary( basic,  dividend,  commission);

        }

    }

}

private void button1_Click(object sender, EventArgs e)

        {

            //Use the EmployeeSalary to see change in behaviour when it changes its Strategy.

            EmployeeSalary objEmpSal = null;

            objEmpSal = new EmployeeSalary(new HRDeptSalary());


           textBox1.Text = objEmpSal.CalculateSalry(9000,500,50).ToString();

            objEmpSal = new EmployeeSalary(new PurchaseDept());


            textBox2.Text = objEmpSal.CalculateSalry(5000, 200, 20).ToString();


        }

Saturday, January 30, 2021

microservices

 

What are microservices?

Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities
  • Owned by a small team
The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.

Microservices break down the application into smaller, independent services. Each service (e.g., Catalog API, Basket API) is dedicated to a specific function and can be scaled or updated independently. It connects with databases like MongoDB, Redis, and MySQL, and uses messaging tools like RabbitMQ to stay efficient.












Installing on Windowshttps://www.rabbitmq.com/install-windows.html 




Stop then start
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.12.11\sbin>
rabbitmq-plugins.bat list
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.12.11\sbin>rabbitmq-plugins.bat enable rabbitmq_management




















MSMQ:
If you want to check the message queue paths directly from Windows without using code, you can also: 1. Open **Computer Management** (right-click on "This PC" or "My Computer" and select "Manage"). 2. Navigate to **Services and Applications** > **Message Queuing** to see the list of available queues.






কিভাবে কাজ করে (Bangla)

RabbitMQ-এর কাজের ধাপগুলো সহজভাবে নিচে দেওয়া হলো:

  1. Producer

    • Producer হলো সেই অ্যাপ্লিকেশন যা বার্তা (message) তৈরি করে এবং RabbitMQ-তে পাঠায়।
    • Producer বার্তাটি একটি Queue-তে পাঠায়।
  2. Queue

    • Queue হলো একটি বাফার যেখানে বার্তাগুলো জমা থাকে যতক্ষণ না Consumer সেগুলো গ্রহণ করে।
    • এটি বার্তাগুলোকে অস্থায়ীভাবে ধরে রাখে।
  3. Consumer

    • Consumer হলো সেই অ্যাপ্লিকেশন যা Queue থেকে বার্তা গ্রহণ করে এবং প্রসেস করে।
    • Consumer বার্তা পাওয়ার পর সেটি প্রিন্ট করতে পারে, ডাটাবেসে রাখতে পারে, বা অন্য কোনো কাজ করতে পারে।
  4. Connection এবং Channel

    • Producer এবং Consumer RabbitMQ সার্ভারের সাথে Connection তৈরি করে।
    • Connection-এর ভিতরে Channel থাকে, যা আসল কাজ করে (Queue declare, message publish, consume)।
  5. Flow

    • Producer → Queue → Consumer
    • Producer বার্তা পাঠায় → Queue বার্তাটি ধরে রাখে → Consumer বার্তাটি পড়ে এবং প্রসেস করে।

RabbitMQ-এর মূল সুবিধা:

  • Decoupling: Sender এবং Receiver একসাথে চলতে হবে না।
  • Reliability: বার্তা হারিয়ে যায় না (acknowledgment এবং persistence সাপোর্ট করে)।
  • Scalability: অনেক বেশি লোড হ্যান্ডেল করতে পারে।
Azure Service Bus Interview50+ Azure Service Bus Interview Q&A (Bangla + English)
Copilot said:
Copilot

Here you go, Mohammad!
50+ Azure Service Bus Interview Questions and Answers (Bangla + English) — simple, clear, side‑by‑side.
Perfect for interviews and revision.


✅ Azure Service Bus Interview – 50+ Questions & Answers

(Bangla + English side-by-side)


1. What is Azure Service Bus?

EN: Azure Service Bus is a fully managed enterprise message broker that enables reliable communication between applications using queues and topics.
BN: Azure Service Bus হলো একটি fully managed enterprise message broker, যা queues এবং topics ব্যবহার করে অ্যাপ্লিকেশনগুলোর মধ্যে নির্ভরযোগ্য যোগাযোগ নিশ্চিত করে।


2. Why do we use Azure Service Bus?

EN: It decouples systems, supports asynchronous communication, ensures reliability, and handles spikes in traffic.
BN: এটি সিস্টেমগুলোকে decouple করে, asynchronous যোগাযোগ সাপোর্ট করে, নির্ভরযোগ্যতা নিশ্চিত করে এবং হঠাৎ লোড বৃদ্ধি ম্যানেজ করে।


3. What are the key components of Service Bus?

EN: Namespace, Queues, Topics, Subscriptions, Filters, SAS Policies.
BN: Namespace, Queue, Topic, Subscription, Filter, SAS Policy।


4. What is a Service Bus Queue?

EN: A point‑to‑point messaging system (sender → queue → receiver).
BN: একটি point‑to‑point মেসেজিং সিস্টেম (sender → queue → receiver)।


5. What is a Topic?

EN: A publish‑subscribe messaging system where multiple receivers can subscribe.
BN: Publish‑subscribe মডেল যেখানে একাধিক subscriber মেসেজ পায়।


6. Difference between Queue and Topic?

EN: Queue = Single Consumer.
Topic = Multiple Subscribers.
BN: Queue = এক consumer পায়
Topic = একাধিক subscription পায়।


7. What is a Dead Letter Queue (DLQ)?

EN: A sub-queue where failed messages are stored.
BN: যেসব মেসেজ প্রসেস করা যায় না, সেগুলো রাখার জন্য DLQ ব্যবহার হয়।


8. Why do messages go to DLQ?

EN: TTL expire, max delivery count exceeded, processing errors.
BN: TTL শেষ হওয়া, বারবার প্রসেস ব্যর্থ হওয়া, errors।


9. What is Message TTL?

EN: A time limit after which a message becomes invalid.
BN: নির্দিষ্ট সময় পর মেসেজ invalid হয়ে যায়।


10. What is Max Delivery Count?

EN: Number of times Service Bus retries delivering a message.
BN: কতবার retry করে deliver করার চেষ্টা করবে।


11. What are Sessions?

EN: Used for ordered message processing.
BN: Ordered মেসেজ প্রসেস করার জন্য Session ব্যবহার করা হয়।


12. What is Partitioning?

EN: Spreads messages across multiple brokers for high throughput.
BN: Load ভাগ করে throughput বাড়ায়।


13. What is Duplicate Detection?

EN: Service Bus prevents duplicate messages within a time window.
BN: নির্দিষ্ট সময়ে duplicate মেসেজ ব্লক করে।


14. What is PeekLock mode?

EN: A message is locked for a specific receiver but not deleted.
BN: Receiver মেসেজ পড়তে পারে কিন্তু ডিলিট হয় না, locked থাকে।


15. What is Receive and Delete mode?

EN: Deletes message immediately after reading.
BN: মেসেজ পড়ার সাথে সাথেই ডিলিট হয়ে যায়।


16. Which mode ensures no message loss?

EN: PeekLock
BN: PeekLock


17. What is Auto-Forwarding?

EN: Automatically forwards messages from one queue/topic to another.
BN: একটি queue/topic থেকে আরেকটিতে মেসেজ অটো ফরওয়ার্ড করে।


18. What is Scheduled Messaging?

EN: Sending messages to be processed at a future time.
BN: ভবিষ্যতে নির্দিষ্ট সময়ে মেসেজ পাঠানো।


19. What is Deferring a message?

EN: Temporarily postponing processing.
BN: মেসেজ প্রসেস কিছু সময়ের জন্য পিছিয়ে দেওয়া।


20. What is a Subscription Filter?

EN: Rules to decide which message a subscription will receive.
BN: কোন মেসেজ কোন subscription পাবে তা নির্ধারণের নিয়ম।


21. Types of Filters?

EN: SQL Filter, Correlation Filter
BN: SQL Filter, Correlation Filter


22. What is Namespace?

EN: A container for queues, topics, subscriptions.
BN: Queue, Topic, Subscription রাখার কন্টেইনার।


23. What is Shared Access Signature (SAS)?

EN: Token-based authentication method.
BN: Token ভিত্তিক authentication পদ্ধতি।


24. What is AMQP?

EN: Advanced Message Queuing Protocol used for efficient messaging.
BN: কার্যকর মেসেজিংয়ের জন্য ব্যবহৃত একটি প্রোটোকল।


25. Difference between AMQP and HTTPS?

EN: AMQP = faster, duplex.
HTTPS = simpler, slower.
BN: AMQP = দ্রুত, দুই‑দিকের যোগাযোগ
HTTPS = সহজ, ধীরগতি।


26. What is Prefetch Count?

EN: Number of messages fetched in advance.
BN: আগেই একসাথে কিছু মেসেজ টেনে আনা।


27. What is Message Lock Duration?

EN: Duration a message remains locked in PeekLock.
BN: PeekLock‑এ মেসেজ কত সময় locked থাকবে।


28. Can a Topic have multiple subscriptions?

EN: Yes.
BN: হ্যাঁ।


29. Can a Queue have multiple receivers?

EN: Yes, but each message goes to only one.
BN: রিসিভার একাধিক হতে পারে, কিন্তু মেসেজ একটির কাছে যাবে।


30. What is Geo-Disaster Recovery?

EN: Cross-region failover.
BN: Region-wide সমস্যায় backup region এ স্যুইচ।


31. Standard vs Premium differences?

EN:

  • Premium = Dedicated compute, higher throughput
  • Standard = Shared infrastructure
    BN:
  • Premium = Dedicated resources, বেশি throughput
  • Standard = Shared resources

32. Can Service Bus trigger Azure Functions?

EN: Yes.
BN: হ্যাঁ।


33. What is Dead-letter Reason?

EN: Explains why message went to DLQ.
BN: কেন DLQ‑এ গেল তা দেখায়।


34. Maximum message size?

EN:

  • Standard: 256 KB
  • Premium: 1 MB
    BN:
  • Standard: 256 KB
  • Premium: 1 MB

35. Is FIFO supported?

EN: Yes, via Sessions.
BN: হ্যাঁ, Session ব্যবহার করে।


36. What is Service Bus Explorer?

EN: Tool to manage and test Service Bus.
BN: Service Bus টেস্ট ও ম্যানেজ করার টুল।


37. What are Message Properties?

EN: Custom key-value meta-data.
BN: কাস্টম কী-ভ্যালু তথ্য।


38. Queues vs Storage Queues?

EN:
Service Bus = enterprise, ordering, sessions
Storage Queue = simple, cheap
BN:
Service Bus = এন্টারপ্রাইজ, ordering সহ
Storage Queue = সহজ, সস্তা


39. What is Auto-Complete?

EN: Auto deletes message after function completes successfully.
BN: Function সফল হলে মেসেজ নিজে ডিলিট হয়।


40. What is DeadLetter() API?

EN: Manually moves message to DLQ.
BN: মেসেজ manually DLQ‑তে পাঠানো।


41–50: Rapid-fire (Bangla + English)

  1. Batch Receive?
    EN: Receive multiple messages at once.
    BN: একসাথে অনেক মেসেজ রিসিভ করা।

  2. Atomic Transactions?
    EN: Multiple operations as a single unit.
    BN: একাধিক কাজকে একসাথে atomic ভাবে চালানো।

  3. Ordering guarantee?
    EN: Only with sessions.
    BN: শুধু sessions‑এ।

  4. Can we send large files?
    EN: Not recommended; use blob + reference.
    BN: বড় ফাইল নয়; blob এ রেখে রেফারেন্স পাঠান।

  5. Poison Messages?
    EN: Messages that always fail processing.
    BN: বারবার error হওয়া মেসেজ।

  6. Auto Delete on Idle?
    EN: Deletes unused subscriptions after inactivity.
    BN: দীর্ঘ সময় ব্যবহার না হলে subscription ডিলিট হয়।

  7. What is CorrelationId?
    EN: Used to match related messages.
    BN: related মেসেজ track করতে ব্যবহৃত।

  8. Can Service Bus work offline?
    EN: No (cloud service).
    BN: না (cloud service)।

  9. What is Message Deferral Id?
    EN: ID needed to retrieve deferred message.
    BN: deferred মেসেজ ফেরত আনার জন্য আইডি।

  10. How to reprocess DLQ messages?
    EN: Read and send to main queue again.
    BN: DLQ থেকে পড়ে আবার main queue‑তে পাঠানো।


128 Civics Questions

  128 Civics Questions – Group Names (First English, then Bangla) Group 1: Principles of American Democracy বাংলা : মার্কিন গণতন্ত্রের...