Skip to main content

Posts

Python Generator

 Generators are useful when we want to produce a large sequence of values but we don't want to store them in memory at once yield keyword helps python to execute generator .  Key Features of Generators Memory Efficient – They do not store all values in memory; instead, they generate values one by one. Lazy Evaluation – Values are produced only when needed. Automatic State Retention – The function retains its state between yield calls. Iterable – Generators can be iterated using a for loop or the next() function.
Recent posts

4 built-in data types in Python

 There are 4 built-in data types available in python.  Lets learn about them  List:  Lists are used to store multiple items in a single variable. List items are ordered, changeable, and allow duplicate values. List items are indexed, the first item has index [0], the second item has index [1] etc. Python Tuples: Tuples are used to store multiple items in a single variable. A tuple is a collection which is ordered and unchangeable.  Tuples are unchangeable, meaning that we cannot change, add or remove items after the tuple has been created.  Since tuples are indexed, they can have items with the same value: thistuple = ( "apple" ,  "banana" ,  "cherry" ,  "apple" ,  "cherry" ) print (thistuple) Python Sets: A set is a collection which is unordered, unchangeable*, and unindexed. Set items are unordered, unchangeable, and do not allow duplicate values. thisset = { "apple" ,  "banana" ,  "cherry" } print (thiss...

Implementing Advance Query Optimization in Django ORM

 Django's ORM makes database interactions seamless, allowing developers to write queries in Python without raw SQL. However, as applications scale, inefficient queries can slow down performance, leading to high latency and database load.  This guide explores advanced query optimization techniques in Django ORM to go beyond basic CRUD (Create, Read, Update, Delete) operations and improve efficiency.  1. Use QuerySet Caching to Avoid Repeated Queries Using cache reduces redundant queries for frequently accessed data. Caching helps reduce repeated database hits. 2. Avoid .count() on Large Datasets Using .count() on large tables can be expensive Inefficient way: Optimized way ( .exists() is Faster) 3. Use Indexes for Faster Lookups Indexes speed up queries on frequently filtered fields. Add db_index=True for frequently queried fields: 4. Optimize Bulk Inserts and Updated Performing operations on multiple records one by one is inefficient. Use bulk_create() for mass insert...

যারা System Design শিখতে চাচ্ছেন, তাদের জন্য একটি কমপ্লিট রোডম্যাপ

  যারা System Design শিখতে চাচ্ছেন, তাদের জন্য একটি কমপ্লিট রোডম্যাপ 🚀 ✅ ১. ফাউন্ডেশন স্কিলস: - নেটওয়ার্কিং বেসিকস - ডাটাবেস (SQL & NoSQL) - ডিস্ট্রিবিউটেড সিস্টেমস - API ডিজাইন ✅ ২. কী কী শিখবেন: - স্কেলেবিলিটি - পারফরম্যান্স - রিলায়েবিলিটি - সিকিউরিটি ✅ ৩. প্র্যাকটিস প্রজেক্টস: - URL শর্টেনার - চ্যাট অ্যাপ্লিকেশন - পেমেন্ট সিস্টেম - নোটিফিকেশন সিস্টেম ✅ ৪. এডভান্সড টপিকস: - লোড ব্যালান্সিং - ক্যাশিং স্ট্র্যাটেজি - মাইক্রোসার্ভিসেস - ডাটা পার্টিশনিং ✅ টিপস: - সিনিয়রদের ধরে তারদের কাজ করা সিস্টেম এর ডিজাইন শিখে নিন। - ছোট প্রজেক্ট দিয়ে শুরু করুন - ডায়াগ্রাম আঁকার অভ্যাস করুন (use draw.io ) - সিস্টেম ডিজাইন ইন্টারভিউ প্র্যাকটিস করুন (read Alex lu book) ✅ রিসোর্সেস: - System Design Primer (GitHub) - Grokking System Design - High Scalability Blog - AWS Architecture Blog Practice mock interviews মনে রাখবেন: থিওরি শেখার পাশাপাশি প্র্যাক্টিকাল প্রজেক্ট করা জরুরি।

কোডিং ইন্টারভিও ক্র্যাক

  কোডিং ইন্টারভিও ক্র্যাক করার জন্য লিটকোডে হচ্ছে বেস্ট প্ল্যাটফর্ম । কিন্তু লিটকোডে হাজার হাজার প্রবলেম আছে, সব প্রবলেম তো সল্ভ করা পসিবল না , এমন কি দরকার ও নেই । বরঞ্চ আপনার কাজ হচ্ছে প্রবলেম সল্ভিং এর প্যাটার্নগুলো মাথায় রাখা এবং কখন কোন প্যাটার্ন ব্যবহার করা সেটা বুঝা । কিছু কিছু কমন প্যাটার্ন আছে যেগুলো থেকে ইন্টারভিও তে প্রচুর প্রশ্ন আসে । ডাটা স্ট্রাকচার , এলগরিদম শিখার পর এই ১৬ টা প্যাটার্ন এবং এই রিলেটেড লিটকোড প্রবলেমগুলোর সলিউশন করে ফেলবেন । তাহলে বেশিরভাগ ইন্টারভিউ তে উতরে যেতে পারবেন । ১. স্লাইডিং উইন্ডো প্যাটার্ন এটি সময়ের সাথে সাথে পরিবর্তিত একটি সাবসেটের ডেটা ট্র্যাক করতে ব্যবহৃত হয়, সাধারণত অ্যারে বা স্ট্রিং এর ক্ষেত্রে। ২. টু পয়েন্টার প্যাটার্ন এই প্যাটার্নে দুটি পয়েন্টার অ্যারের ভিন্ন প্রান্ত থেকে একত্রে কাজ করে একটি সমাধানের দিকে এগিয়ে যায়। ৩. ফাস্ট & স্লো পয়েন্টার প্যাটার্ন দুটি পয়েন্টার ভিন্ন গতিতে চলে এবং সিকোয়েন্সের মধ্যে সাইকেল শনাক্ত করতে সহায়তা করে। ৪. মার্জ ইন্টারভ্যাল প্যাটার্ন এই প্যাটার্নটি ওভারল্যাপিং ইন্টারভ্যালগুলিকে একত্রিত করতে ব...