Local Storage, Session Storage, and Cookies in JavaScript

1. Local Storage Purpose: Stores data in the browser that persists even after the browser is closed. Lifespan: Permanent until explicitly cleared by the user or program. Storage Limit: Usually 5-10 MB per domain. Accessibility: Only accessible on the client-side (browser), not sent with HTTP requests. Example: // Store data localStorage.setItem('username', 'Alice'); // Retrieve…

0 Comments

Error handling in JavaScript using try/catch

1. The Basics of try/catch try/catch lets you handle errors gracefully instead of letting your program crash. Syntax: try { // Code that might throw an error } catch (error) { // Code to handle the error } finally { // Optional: code that runs regardless of error } try { // Code that…

0 Comments

Working with APIs using fetch()

1. What is fetch()? fetch() is a modern JavaScript function that allows you to make network requests (like GET, POST, etc.) to APIs. It returns a Promise, which resolves to the Response object. 2. Basic fetch() Example Suppose we want to get some data from a public API: JSONPlaceholder (fake API for testing). //…

0 Comments

Aggregations and filters in MongoDB

1. Filters in MongoDB Filters are used in queries to select documents that match certain conditions. You generally use find() for this. Example: Suppose we have a collection employees: [ { "_id": 1, "name": "Alice", "age": 30, "department": "HR", "salary": 5000 }, { "_id": 2, "name": "Bob", "age": 25, "department": "IT", "salary": 6000 },…

0 Comments

Difference between SQL and NoSQL

Here’s a clear breakdown of the differences between SQL and NoSQL databases: FeatureSQL (Relational)NoSQL (Non-Relational)Data ModelStructured, table-based with rows and columnsFlexible, can be document, key-value, column-family, or graph-basedSchemaFixed schema; must define tables and column types beforehandDynamic or flexible schema; fields can vary across documentsQuery LanguageUses SQL (Structured Query Language) for complex queriesUses varied query…

0 Comments

N+1 problem

The N+1 problem is a common performance issue in programming, especially when dealing with databases and object-relational mapping (ORM) frameworks. It occurs when an application makes one query to fetch a list of items (the “1”) and then makes an additional query for each item in the list (the “N”), resulting in many more…

0 Comments

Partitioning and Sharding in databases

1. Partitioning Definition:Partitioning is the process of dividing a single database table into smaller, more manageable pieces, called partitions, while still keeping them within the same database. Each partition can be stored separately, often based on some key (like date, region, or ID). Purpose: Improves query performance. Makes management easier (backups, archiving). Can reduce…

0 Comments

Security and Permissions in SQL

In SQL (Structured Query Language), Security and Permissions are mechanisms that control who can access the database and what actions they are allowed to perform.This ensures that sensitive data is protected and only authorized users can read, insert, update, or delete data. 1. Authentication Determines who the user is (login system). Example: In SQL…

0 Comments

Transactions in SQL

🔹 What is a Transaction? A transaction is a sequence of one or more SQL statements executed as a single unit of work.It ensures the ACID properties: Atomicity → all or nothing Consistency → maintains data integrity Isolation → transactions don’t interfere with each other Durability → once committed, changes are permanent 🔹 Transaction…

0 Comments

Views in SQL

A view in SQL is a virtual table that is based on the result of a query.It does not store data itself, but rather displays data stored in one or more tables. You can think of a view as a saved query that you can treat like a table. 🔹 Why use Views? To…

0 Comments

End of content

No more pages to load