Shalini Tewari Profile picture
full stack developer | simplifying web development and programming for you & an occasional yapper.
6 subscribers
Feb 16 5 tweets 3 min read
Ever wondered how websites stay fast even with millions of users?

Let’s talk about caching and CDNs: why website speed is critical?
- more than 50% of users leave if a website takes more than 3 seconds to load.
- a 1-second delay in page load time can reduce conversions by 7%.
- Search engines like Google prioritize fast websites in rankings.
But how do websites manage to stay fast, even when millions of people visit them at the same time?

The answer lies in two powerful technologies: Caching and CDNs (Content Delivery Networks).
These ensure websites load quickly, handle high traffic, and deliver a seamless experience.
Jan 19 4 tweets 2 min read
People often get confused between SQL and MySQL.

Here's the difference: SQL

- Language:
SQL (Structured Query Language) is a standardized querying language used for managing and manipulating relational databases.

- Purpose:
It is used to perform tasks such as querying data, updating records, and managing database structures.

- Standardized:
SQL is a standard language that can be used with various database management systems (DBMS) like Oracle, Microsoft SQL Server, PostgreSQL, and MySQL.

- Commands:
Includes commands such as SELECT, INSERT, UPDATE, DELETE, CREATE, and DROP for database operations.

- Platform-Agnostic:
It is not tied to any specific DBMS, making it versatile for use across different systems.
Jan 8 5 tweets 3 min read
Ever wondered how websites stay fast even with millions of users?

Let’s talk about caching and CDNs: why website speed is critical?
- more than 50% of users leave if a website takes more than 3 seconds to load.
- a 1-second delay in page load time can reduce conversions by 7%.
- Search engines like Google prioritize fast websites in rankings.
But how do websites manage to stay fast, even when millions of people visit them at the same time?

The answer lies in two powerful technologies: Caching and CDNs (Content Delivery Networks).
These ensure websites load quickly, handle high traffic, and deliver a seamless experience.
Jan 7 4 tweets 2 min read
Did you know why restarting your computer actually fixes most problems?

Let's see why: - It Stops Problematic Background Processes
Many programs and system services run in the background. Sometimes, they get stuck, crash, or just don’t work as intended.

These rogue processes can slow down your computer or cause errors.

Restarting forces all processes to stop and reload, fixing many of these issues.

- It Fixes System Resource Issues
Your computer has limited resources (CPU, RAM, storage). If too many programs are open or a program gets stuck, it can hog these resources.

Restarting frees up everything being used unnecessarily, letting your computer allocate resources properly again.
Jan 5 5 tweets 1 min read
Did you know your browser doesn’t render HTML, CSS, and JavaScript in the order they appear?

Here’s what actually happens: How the Browser Handles HTML and CSS
- When you load a webpage, the browser doesn’t just display the HTML, CSS, and JavaScript in the order they appear. Instead, it follows a systematic process to ensure everything is rendered correctly.

- First, the browser starts with HTML parsing. It reads the HTML file line by line, building a structure called the DOM (Document Object Model). Think of the DOM as a tree where each HTML element becomes a node. For example,
,

, and are all nodes in this tree. This process continues until the entire HTML is read.

- As the browser encounters links to external CSS files, it temporarily pauses HTML parsing to fetch and process the CSS. Once the CSS is loaded, the browser creates another structure called the CSSOM (CSS Object Model). This structure contains all the styling rules and how they apply to the elements in the DOM.

- The combination of the DOM and CSSOM forms the Render Tree, which tells the browser how elements should look on the screen. Without this process, you’d only see plain, unstyled HTML.

Dec 28, 2024 4 tweets 2 min read
A friend of mine was asked this in an interview,

"What's the difference between HTTP and HTTPS?"

Here's how you can answer: HTTP is the foundational protocol used for transferring hypertext on the web. It defines how messages are formatted and transmitted and how web servers and browsers should respond to various commands.
When you enter a URL in your browser, an HTTP command is sent to the web server directing it to fetch and transmit the requested web page.

HTTPS is HTTP with encryption. It uses SSL/TLS to encrypt the data transferred between the web server and browser, ensuring a secure connection.
HTTPS provides a secure channel over an insecure network, protecting the integrity and confidentiality of data between the user's computer and the site.Image
Nov 10, 2024 4 tweets 2 min read
To all who call themselves web developers, do you know how the web works?

Here’s a quick breakdown: - The web is powered by web servers, which are powerful computers connected to the internet 24/7. These servers store and serve web pages, files, and data. When you access a website, you're essentially requesting data from these servers.
It is a software and hardware that uses HTTP (Hypertext Transfer Protocol) and other protocols to respond to client requests made over the World Wide Web.

- Each web server has a unique IP (Internet Protocol) address, which is a series of numbers like 192.158.1.38. However, since IP addresses are not user-friendly, we use domain names.
Domain names are human-readable addresses mapped to IP addresses, making it easier for people to access websites.

Example of an IP Address: 192.158.1.38
Example of a Domain Name: example. com

- A URL is the complete address used to access a specific resource on the internet. It includes the protocol, domain name, path, query, and fragment, specifying the exact location of a resource on a server.
Nov 9, 2024 4 tweets 3 min read
In one of my interviews for Backend Developer position, I was asked,

"How would you design an API?"

Here is how you can answer: This can be the approach you follow:

1. Understand the Requirements
- Purpose and Scope:
Determine what the API is meant to achieve.
Identify the main use cases and target users (e.g., internal developers, third-party partners, public use).

- Resources and Operations:
Define the primary resources (e.g., users, products, orders).
Identify the actions (CRUD operations - Create, Read, Update, Delete) that can be performed on these resources.

2. Design Principles
- RESTful Architecture:
Follow REST (Representational State Transfer) principles if the API is to be RESTful.
Ensure stateless operations, meaning each request from a client must contain all the information needed to understand and process the request.

- URL Structure and Endpoints:
Design intuitive and consistent URLs.
Use nouns to represent resources (e.g., /users, /products).
Use HTTP methods to indicate actions (GET for reading, POST for creating, PUT for updating, DELETE for deleting).

3. Request and Response Format
- Use JSON:
JSON (JavaScript Object Notation) is commonly used due to its simplicity and compatibility with most programming languages.

- Consistent Responses:
Ensure responses have a consistent structure.
Include standard HTTP status codes (200 OK, 201 Created, 400 Bad Request, 404 Not Found, 500 Internal Server Error).
Provide meaningful error messages and codes.

4. Authentication and Authorization
- Authentication:
Decide on the authentication method (e.g., API keys, OAuth, JWT - JSON Web Tokens).
Implement secure authentication mechanisms to protect the API.

- Authorization:
Ensure that users can only perform actions they are authorized to.
Implement role-based access control (RBAC) if needed.

5. Rate Limiting and Throttling
- Protect the API:
Implement rate limiting to prevent abuse (e.g., 100 requests per minute).
Use throttling to ensure fair usage among users.

These are the points you can keep in mind before framing your answer.
Nov 7, 2024 4 tweets 2 min read
Beginners often get confused between SQL and MySQL.

Here's the difference: SQL

- Language:
SQL (Structured Query Language) is a standardized programming language used for managing and manipulating relational databases.

- Purpose:
It is used to perform tasks such as querying data, updating records, and managing database structures.

- Standardized:
SQL is a standard language that can be used with various database management systems (DBMS) like Oracle, Microsoft SQL Server, PostgreSQL, and MySQL.

- Commands:
Includes commands such as SELECT, INSERT, UPDATE, DELETE, CREATE, and DROP for database operations.

- Platform-Agnostic:
It is not tied to any specific DBMS, making it versatile for use across different systems.
Nov 6, 2024 5 tweets 2 min read
We often check the "Accept all cookies" option. Do you know what these cookies mean?

Here is the explanation: What are cookies?

Cookies are small text files that websites store on your computer or device when you visit them. These files contain information about your interactions with the site and are designed to enhance your browsing experience.

There are different types of cookies:

1. Session Cookies:
Temporary cookies that are erased when you close your browser.

2. Persistent Cookies:
These cookies remain on your device for a set period (days, months, or years).

3. First-party Cookies:
Set by the website you are currently visiting. Essential for the site's functionality, remembering user preferences, and providing a personalized experience.

4. Third-party Cookies:
Set by domains other than the one you're currently visiting. These are often used for tracking and advertising. For example, when you see ads related to your interests on various websites.
Sep 12, 2024 7 tweets 1 min read
If you're learning a new programming language, open this: 1. Identify Your Purpose
Start by understanding why you want to learn this new language. Whether it's for a project, a job, or personal development, knowing your “why” will keep you motivated when challenges arise.
Sep 8, 2024 4 tweets 2 min read
you're in an interview, and the interviewer asks,

"How many types of API functions are available in Node.js? Explain them."

here's how you can answer: Node.js provides a variety of API functions that help developers interact with the core functionalities of the platform, manage asynchronous tasks, and handle data efficiently. The API functions can be broadly categorized based on how they handle execution.

The Two Main Types of API Functions in Node.js:

1. Blocking (Synchronous) API Functions
2. Non-Blocking (Asynchronous) API Functions
Sep 7, 2024 4 tweets 2 min read
To become a web developer, you don't just need frontend & backend.

DevOps is also a really important topic.

Here is DevOps, explained simply: What is DevOps?

- The term "DevOps" is a combination of "development" + "operations."

- DevOps is a set of practices that aims to automate and improve the collaboration between software development and IT operations teams. The goal is to shorten the development life cycle and deliver high quality software continuously.

DevOps Principles:

- Collaboration:
Developers and operations teams work together from the start, sharing responsibilities and insights.

- Automation:
Use tools to automate repetitive tasks, reducing errors and speeding up the development and deployment processes.

- Continuous Integration:
Developers frequently merge their code changes into a shared repository, allowing for early detection of issues.

- Continuous Delivery:
Ensure that software can be released to production at any time, making the release process smoother and more reliable.

- Continuous Deployment:
Take automation a step further by automatically deploying code changes to production after passing all tests.

- Monitoring and Logging:
Keep an eye on the performance of your systems and applications, and use logs to troubleshoot issues.

- Feedback Loop:
Collect feedback from users, operations, and other stakeholders to continuously improve processes and products.
Sep 6, 2024 4 tweets 2 min read
Ever been told to "clear the browser cache" when your browser slows down?

Let's understand what happens: What is cache?

In web development, a cache is like a quick-access memory that stores important data temporarily. Its job is to make things faster by keeping copies of stuff your computer or website uses often. Instead of going all the way to get the data again, it just grabs it from this handy spot.

Types of Cache:

1. Browser Cache (Client-Side):
Web browsers maintain a cache to store copies of resources like images, stylesheets, and scripts. This allows the browser to load web pages more quickly by retrieving these resources locally rather than from the web server.

2. Server Cache (Server-Side):
Web servers and application servers may implement caching mechanisms to store precomputed or frequently accessed data. This helps reduce the load on the server and speeds up response times.
Sep 5, 2024 4 tweets 3 min read
you're in an interview, and the interviewer asks,

"How will you differentiate between DELETE, TRUNCATE, and DROP in SQL?"

here's how you can answer: Let’s try to understand each command and highlight the key differences so you can ace this question:

1. DELETE Command
DELETE is used to remove specific rows from a table based on a condition in the WHERE clause.
Syntax:
DELETE FROM table_name WHERE condition;
- It removes rows one by one and logs each deletion, making it slower for large datasets.
- It can use WHERE clauses to selectively delete records.
- It is a DML (Data Manipulation Language) command.
- Supports rollback if wrapped in a transaction, allowing data recovery.

2. TRUNCATE Command
TRUNCATE is used to remove all rows from a table, effectively resetting it.
Syntax:
TRUNCATE TABLE table_name;
- It removes all rows without logging individual row deletions, making it faster than DELETE.
- It does not support WHERE clauses, it's all or nothing.
- It is a DDL (Data Definition Language) command, altering the table’s metadata.
- Cannot be rolled back if not inside a transaction; recovery is usually impossible.

3. DROP Command
DROP is used to completely remove a table, view, or database from the schema.
Syntax:
DROP TABLE table_name;
- It completely removes the table structure, data, and all associated indexes, triggers, and constraints.
- It’s the most destructive of the three commands.
- It is a DDL command.
- Cannot be rolled back. once executed, the data and structure are permanently lost.Image
Sep 4, 2024 4 tweets 2 min read
You're in an interview, and the interviewer asks,

"Is there anything that makes you different from other candidates?"

Here's how you can answer: The purpose of this question is, the interviewer wants to know:
- What unique value you bring to the table.
- How well you know your strengths.
- Your ability to differentiate yourself without comparing negatively to others.

1. Highlight Your Unique Skills and Experiences:
Focus on what truly sets you apart, such as unique skills or specific experiences that are relevant to the role but might not be common among other candidates.
For example, having a dual skill set in front-end development and UX design can allow you to create more user-centric applications. This combination not only makes your work stand out but also demonstrates your ability to bring additional value that aligns with the company’s needs.

2. Show Your Passion and Motivation
Demonstrate your enthusiasm for the field, such as a passion for solving complex problems or continuously learning new technologies, which makes you a proactive candidate.

3. Emphasize Soft Skills:
Highlight rare soft skills like clear communication or problem-solving that make you effective in roles beyond just technical capabilities.

4. Keep It Positive:
Focus on your strengths without negatively comparing yourself to others, maintaining a positive and professional tone.
Sep 3, 2024 5 tweets 3 min read
Complete Full Stack Developer Roadmap🚀

Step 1: Learn HTML, CSS, and JavaScript
Step 2: Learn Git and GitHub
Step 3: Learn Node.js and Express.js
Step 4: Learn MongoDB and Mongoose
Step 5: Learn React (Frontend)
Step 6: Learn Advanced Node.js and APIs
Step 7: Learn Authentication and Security
Step 8: Learn Deployment (CI/CD)
Step 9: Learn State Management in React
You're readyyy!🥳 Step 1: Learn HTML, CSS, and JavaScript
1. Learn HTML
HTML forms the backbone of any web application.
Focus on:
Basic HTML syntax
Forms and inputs
Understanding the DOM (Document Object Model)
Semantic HTML
SEO basics

2. Learn CSS
CSS handles the design and layout of the application.
Key topics:
Basic CSS syntax
CSS box model
Flexbox and Grid for layouts
Responsive design principles
CSS variables and animations

3. Learn JavaScript
JavaScript brings interactivity to your application.
Focus on:
Basic syntax and constructs
Asynchronous JavaScript (Promises, async/await)
ES6+ concepts (let/const, arrow functions, destructuring, modules)
DOM manipulation and events
JSON and data fetching (AJAX, Fetch API)
Understanding closures and prototypal inheritance

Step 2: Learn Git and GitHub
Version control is crucial for tracking changes and collaborating.
Learn:
Basic command-line commands
Git basics (add, commit, push, pull)
Branching and merging
Resolving merge conflicts
Using GitHub (repositories, pull requests, issues)

Step 3: Learn Node.js and Express.js
1. Learn Node.js
Node.js is a server-side JavaScript runtime for building backend services.
Key topics:
Basics of Node.js and NPM (Node Package Manager)
Creating a server with Node.js
Understanding modules and file system
Asynchronous programming with callbacks, promises, and async/await
Error handling in Node.js

2. Learn Express.js
Express.js is a minimal and flexible Node.js web application framework.
Focus on:
Setting up an Express server
Routing and middleware
Handling requests and responses
Working with RESTful APIs
Error handling and logging
Using templating engines (like EJS or Pug) [optional]
Aug 24, 2024 4 tweets 2 min read
Day 10 of SQL

Some exercises to strengthen your concepts:

Exercise 1: Create Table
Create a table named students with the following columns:

student_id (integer, primary key, auto-increment)
first_name (varchar(50))
last_name (varchar(50))
birth_date (date)
enrollment_date (date)

Exercise 2: Alter Table
Add a new column email (varchar(100)) to the students table and ensure it can store unique values.

Exercise 3: Drop Table
Drop the students table from the database.

Exercise 4: Insert Data
Insert three rows into the students table (assume the table has been created as in the above exercises).

Exercise 5: Update Data
Update the email address of the student with student_id = 1 to shalini@example.com. Exercise 6: Delete Data
Delete the student with student_id = 3 from the students table.

Exercise 7: Commit
Perform a transaction that inserts a new student and then commits the transaction.

Exercise 8: Rollback
Perform a transaction that inserts a new student but roll back the transaction before committing.

Exercise 9: Savepoint
Create a savepoint, perform an insert, and then roll back to the savepoint.

Exercise 10: Grant Privileges
Grant SELECT and INSERT privileges on the students table to a user named user1.

Exercise 11: Revoke Privileges
Revoke INSERT privileges on the students table from user1.

Exercise 12: Create User
Create a new user named user2 with a password password123.
Aug 22, 2024 9 tweets 2 min read
Are you following my SQL series? If not, check it out here:
Day 1:
Aug 22, 2024 4 tweets 3 min read
Day 8 of SQL

- SQL Joins

What are SQL joins?
SQL Joins are used to combine rows from two or more tables based on a related column between them. Imagine you have two tables: one with customer data and another with their orders. Joins allow you to link these tables to see which customers made which orders.

There are several types of joins, but the most common are:
INNER JOIN
LEFT JOIN (or LEFT OUTER JOIN)
RIGHT JOIN (or RIGHT OUTER JOIN)
FULL JOIN (or FULL OUTER JOIN)
CROSS JOIN

1. INNER JOIN
An INNER JOIN returns records that have matching values in both tables. Use Case: You want to retrieve only the customers who have placed orders. This join excludes customers who haven’t ordered anything.

2. LEFT JOIN (or LEFT OUTER JOIN)
A LEFT JOIN returns all rows from the left table, and the matched rows from the right table. If there is no match, NULL values are returned for columns from the right table.

3. RIGHT JOIN (RIGHT OUTER JOIN)
A RIGHT JOIN returns all records from the right table and the matched records from the left table. If no match is found, NULL values are returned for columns from the left table.
Use Case: You want to see all orders, including those that weren’t linked to any customers.

4. FULL JOIN (FULL OUTER JOIN)
A FULL JOIN returns all records when there is a match in either left or right table. If no match is found, NULL values are returned for the columns from the table that lacks the match.
Use Case: You want to see all customers and all orders, regardless of whether there’s a match between them.

5. CROSS JOIN
A CROSS JOIN returns the Cartesian product of the two tables, meaning it joins each row of the first table with every row of the second table.
Use Case: You need to pair every customer with every order for analysis, even if it doesn’t make logical sense in a business context.

6. Self Join
A SELF JOIN is when a table is joined with itself. This can be useful for comparing rows within the same table.
Use Case: You want to find out which employees report to which managers in a company hierarchy.Image Refer to the tables in the attached screenshot.

1. INNER JOIN:
SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName
FROM Employees
INNER JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID;

2. LEFT JOIN (or LEFT OUTER JOIN)
SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName
FROM Employees
LEFT JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID;

3. RIGHT JOIN (or RIGHT OUTER JOIN)
SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName
FROM Employees
RIGHT JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID;

4. FULL JOIN (or FULL OUTER JOIN)
SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName
FROM Employees
FULL OUTER JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID;

5. CROSS JOIN
SELECT Employees.EmployeeID, Employees.EmployeeName, Departments.DepartmentName
FROM Employees
CROSS JOIN Departments;Image
Aug 20, 2024 4 tweets 3 min read
Day 6 of SQL

- SQL functions
- Aggregate functions
- LIKE operator

What are SQL functions?

SQL functions are predefined operations that can be invoked with specific arguments to perform computations, manipulate data, or return specific results. These functions can be categorized into several types based on their purpose:

1. Scalar Functions: These functions operate on a single value and return a single value.
eg: LEN(), CAST() etc.

2. Aggregate Functions: These functions operate on a set of values and return a single value summarizing that set.
eg: SUM(), AVG() etc.

3. Analytic Functions (Window Functions): These functions perform calculations across a set of rows related to the current row.
eg: ROW_NUMBER() etc.

4. Table-Valued Functions: Unlike scalar functions, table-valued functions return a table as a result. They can accept parameters and perform complex processing to generate the output table. AGGREGATE FUNCTIONS:

An aggregate function is a function that performs a calculation on a set of values, and returns a single value.
We often use aggregate functions when you have a lot of data and you want to summarize it in some way, like finding totals, averages, or extremes.

For example, imagine you have a bunch of numbers and you want to find the total, average, or maximum number. Aggregate functions help you do that.

We can also use these functions with a GROUP BY clause, which is like organizing your data into groups based on certain criteria. So, you can get summaries for each group separately.

Some examples for aggregate functions are given below:

1. MIN() - returns the smallest value within the selected column.

2. MAX() - returns the largest value within the selected column.

3. COUNT() - returns the number of rows in a set.

4. SUM() - returns the total sum of a numerical column.

5. AVG() - returns the average value of a numerical column.

Other than COUNT(), aggregate functions ignore null values.