Theory Coming Soon
Theory Coming Soon
Previous Question With ANSWER on Web Technologies
SOAP API
SOAP (Simple Object Access Protocol) is a protocol used in web services to exchange structured information between applications. It relies on XML for message format and follows strict standards. SOAP is commonly used in enterprise-level applications where security and reliability are critical.
RESTful API
REST (Representational State Transfer) is an architectural style for designing web services. RESTful APIs use standard HTTP methods such as GET, POST, PUT, DELETE and can exchange data in multiple formats like JSON, XML, or plain text. REST is lightweight and widely used in modern web and mobile applications.
Main Difference (Data Exchange)
The main difference is that SOAP exchanges data only in XML format, while REST can exchange data in multiple formats, most commonly JSON.
SOAP API
SOAP (Simple Object Access Protocol) হলো একটি web service protocol যা application গুলোর মধ্যে structured তথ্য আদান-প্রদান করতে ব্যবহৃত হয়। এটি XML format ব্যবহার করে এবং কঠোর নিয়ম অনুসরণ করে। সাধারণত enterprise-level application এ SOAP ব্যবহৃত হয় যেখানে security ও reliability খুব গুরুত্বপূর্ণ।
RESTful API
REST (Representational State Transfer) হলো web service design করার একটি architectural style। RESTful API গুলো GET, POST, PUT, DELETE এর মতো HTTP method ব্যবহার করে এবং JSON, XML বা text format এ data আদান-প্রদান করতে পারে। এটি lightweight এবং আধুনিক web ও mobile application এ ব্যাপকভাবে ব্যবহৃত।
মূল পার্থক্য (Data Exchange)
মূল পার্থক্য হলো SOAP শুধুমাত্র XML format এ data exchange করে, আর REST একাধিক format এ data exchange করতে পারে, যেখানে JSON সবচেয়ে বেশি ব্যবহৃত হয়।
DNS (Domain Name System)
DNS is a system that translates domain names (like google.com) into IP addresses (like 142.250.190.78). It works like the phonebook of the internet.
How DNS Works:
- 1. User Request: User enters a domain name (e.g., www.google.com) in the browser.
- 2. DNS Resolver: The request goes to a DNS resolver (usually ISP or local cache).
- 3. Root Server: If not cached, resolver queries the Root DNS server.
- 4. TLD Server: Root server directs to TLD server (.com, .org).
- 5. Authoritative Server: TLD server provides the authoritative DNS server for the domain.
- 6. IP Address Returned: Authoritative server returns the IP address.
- 7. Connection: Browser uses the IP to connect to the website.
Example:
- User types www.facebook.com
- DNS converts it to an IP (e.g., 157.240.x.x)
- Browser connects to that IP and loads the website
DNS (Domain Name System)
DNS এমন একটি system যা domain name (যেমন google.com) কে IP address-এ রূপান্তর করে।এটি internet-এর phonebook হিসেবে কাজ করে।
DNS কীভাবে কাজ করে:
- ১. User Request: user browser-এ domain name লিখে (যেমন www.google.com)।
- ২. DNS Resolver: request প্রথমে DNS resolver-এ যায়।
- ৩. Root Server: cache না থাকলে root DNS server-এ query যায়।
- ৪. TLD Server: root server .com/.org TLD server-এ পাঠায়।
- ৫. Authoritative Server: TLD server domain-এর authoritative server দেয়।
- ৬. IP Address: authoritative server থেকে IP পাওয়া যায়।
- ৭. Connection: browser সেই IP দিয়ে website-এ connect করে।
উদাহরণ:
- user লিখলো www.facebook.com
- DNS এটাকে IP-এ convert করে
- browser সেই IP দিয়ে website load করে
Given Rules:
- Rule 1: Source A → Destination B, port = 89
- Rule 2: Source A → Destination B, port < 443
- Rule 3: Source A → Destination B, port = 443
First-Match Rule Inspection:
- Firewall checks rules from top to bottom.
- As soon as a packet matches a rule, action is taken and no further rules are checked.
Case: Packet arrives with port = 443
- Check Rule 1: port 89 → ❌ Not matched
- Check Rule 2: port < 443 → ❌ 443 is NOT less than 443
- Check Rule 3: port = 443 → ✅ Matched
Final Decision:
- The packet will follow Rule 3.
- If Rule 3 action = ALLOW → packet accepted ✅
- If Rule 3 action = DENY → packet rejected ❌
Given Rules:
- Rule 1: Source A → Destination B, port = 89
- Rule 2: Source A → Destination B, port < 443
- Rule 3: Source A → Destination B, port = 443
First-Match Rule Inspection:
- Firewall উপরে থেকে নিচে rule check করে।
- যেই rule match হয়, সাথে সাথে decision নেওয়া হয় এবং পরের rule আর check করা হয় না।
Case: port = 443 packet আসলে
- Rule 1: port 89 → ❌ match নয়
- Rule 2: port < 443 → ❌ 443, 443-এর কম নয়
- Rule 3: port = 443 → ✅ match
Final Decision:
- packet Rule 3 অনুসরণ করবে।
- Rule 3 যদি ALLOW হয় → packet accept ✅
- Rule 3 যদি DENY হয় → packet reject ❌
Responsive Design: Media Queries, Viewport & Mobile-First
CSS Media Queries (Role):
- Used to apply different styles based on screen size, resolution, or device type.
- Helps create responsive layouts for mobile, tablet, and desktop.
- Example: @media (max-width: 768px) → apply styles for small screens.
Viewport Meta Tag (Role):
- Controls how a web page is displayed on mobile devices.
- Ensures proper scaling and layout on different screen sizes.
- Example: <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
Mobile-First Approach:
- Design the website first for mobile devices, then enhance for larger screens.
- Uses min-width media queries to add features for tablets and desktops.
- Benefits: better performance, simpler design, and improved user experience on mobile.
Responsive Design: Media Queries, Viewport & Mobile-First
CSS Media Queries (ভূমিকা):
- screen size বা device অনুযায়ী ভিন্ন style apply করতে ব্যবহার করা হয়।
- mobile, tablet, desktop-এর জন্য responsive layout তৈরি করতে সাহায্য করে।
- উদাহরণ: @media (max-width: 768px) → ছোট screen-এর জন্য style।
Viewport Meta Tag (ভূমিকা):
- web page মোবাইলে কিভাবে display হবে তা নিয়ন্ত্রণ করে।
- সঠিক scaling এবং layout নিশ্চিত করে।
- উদাহরণ: <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
Mobile-First Approach:
- প্রথমে mobile device এর জন্য design করা হয়, পরে বড় screen-এর জন্য উন্নত করা হয়।
- min-width media queries ব্যবহার করে ধাপে ধাপে feature যোগ করা হয়।
- সুবিধা: ভালো performance, সহজ design, এবং mobile-এ ভালো user experience।
HTTP Status Code Categories
i. 2xx (Success)
- Indicates that the request was successfully received and processed.
- Example: 200 OK → Request successful
- Example: 201 Created → Resource successfully created
ii. 4xx (Client Error)
- Indicates an error from the client side (wrong request).
- Example: 400 Bad Request → Invalid request format
- Example: 404 Not Found → Requested resource not found
iii. 5xx (Server Error)
- Indicates an error from the server side.
- Example: 500 Internal Server Error → Server failed to process request
- Example: 503 Service Unavailable → Server temporarily unavailable
HTTP Status Code Categories
i. 2xx (Success)
- এটি বোঝায় যে request সফলভাবে process হয়েছে।
- উদাহরণ: 200 OK → request সফল
- উদাহরণ: 201 Created → নতুন resource তৈরি হয়েছে
ii. 4xx (Client Error)
- এটি client side error নির্দেশ করে (ভুল request)।
- উদাহরণ: 400 Bad Request → ভুল request format
- উদাহরণ: 404 Not Found → resource পাওয়া যায়নি
iii. 5xx (Server Error)
- এটি server side error নির্দেশ করে।
- উদাহরণ: 500 Internal Server Error → server error হয়েছে
- উদাহরণ: 503 Service Unavailable → server সাময়িকভাবে বন্ধ
[Source:Mozilla]
HTTP Cookies
- Definition: HTTP Cookies are small pieces of data stored in the user’s browser by a website.
- Purpose: Used to store user information such as login session, preferences, and tracking data.
- Working: Server sends cookies → Browser stores them → Browser sends them back with future requests.
Security Risks of Cookies
- Session Hijacking: If cookies are stolen, attackers can access user accounts.
- Cross-Site Scripting (XSS): Malicious scripts can read cookies and send them to attackers.
- Man-in-the-Middle Attack: Cookies can be intercepted if not encrypted (no HTTPS).
- Privacy Issues: Cookies can track user behavior across websites.
HTTP Cookies
- সংজ্ঞা: HTTP Cookies হলো ছোট data যা website browser-এ সংরক্ষণ করে।
- উদ্দেশ্য: user-এর login session, preferences, tracking data সংরক্ষণে ব্যবহৃত হয়।
- কাজের ধরণ: Server cookies পাঠায় → Browser সংরক্ষণ করে → পরবর্তী request-এ আবার server-এ পাঠায়।
Cookies-এর Security Risk
- Session Hijacking: cookie চুরি হলে attacker user account access করতে পারে।
- Cross-Site Scripting (XSS): malicious script cookie চুরি করতে পারে।
- Man-in-the-Middle Attack: HTTPS না থাকলে cookie intercept হতে পারে।
- Privacy Issue: cookies user-এর browsing behavior track করতে পারে।
HTTP Status Codes are standard response codes sent by a web server to a client (browser or application) after receiving an HTTP request.
These codes indicate whether the request was successful, failed, redirected, or caused a server error.
HTTP status codes are represented by three-digit numbers.
Purpose of HTTP Status Codes
- Inform the client about request status.
- Help in debugging network or website problems.
- Control browser and application behavior.
- Support communication between client and server.
Categories of HTTP Status Codes
HTTP status codes are divided into five categories:
| Status Code Range | Category | Description |
|---|---|---|
| 100 – 199 | Informational | Request received and processing continues |
| 200 – 299 | Success | Request completed successfully |
| 300 – 399 | Redirection | Further action required |
| 400 – 499 | Client Error | Error caused by client request |
| 500 – 599 | Server Error | Error occurred on the server |
1. Informational Status Codes (100–199)
These codes indicate that the request has been received and processing is continuing.
- 100 Continue: Client can continue sending the request.
- 101 Switching Protocols: Server agrees to switch protocols.
2. Success Status Codes (200–299)
These codes indicate successful request processing.
- 200 OK: Request completed successfully.
- 201 Created: New resource created successfully.
- 204 No Content: Request successful but no content returned.
3. Redirection Status Codes (300–399)
These codes indicate that additional action is needed.
- 301 Moved Permanently: Resource has permanently moved to another URL.
- 302 Found: Resource temporarily moved.
- 304 Not Modified: Cached version can be used.
4. Client Error Status Codes (400–499)
These errors occur due to problems in the client request.
- 400 Bad Request: Invalid request syntax.
- 401 Unauthorized: Authentication required.
- 403 Forbidden: Access denied.
- 404 Not Found: Requested resource not found.
5. Server Error Status Codes (500–599)
These errors occur when the server fails to process the request.
- 500 Internal Server Error: General server-side error.
- 502 Bad Gateway: Invalid response from another server.
- 503 Service Unavailable: Server temporarily unavailable.
- 504 Gateway Timeout: Server response timeout.
Commonly Used HTTP Status Codes
| Status Code | Meaning |
|---|---|
| 200 | OK |
| 301 | Moved Permanently |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
HTTP Status Code হলো standard response code যা web server কোনো HTTP request পাওয়ার পর client (browser বা application)-কে পাঠায়।
এই code দ্বারা বোঝানো হয় request সফল হয়েছে কিনা, ব্যর্থ হয়েছে কিনা, redirect হয়েছে কিনা অথবা server error হয়েছে কিনা।
HTTP status code সাধারণত তিন অংকের সংখ্যা দ্বারা প্রকাশ করা হয়।
HTTP Status Code-এর উদ্দেশ্য
- Client-কে request-এর অবস্থা জানানো।
- Website বা network সমস্যা debugging করতে সাহায্য করা।
- Browser এবং application behavior নিয়ন্ত্রণ করা।
- Client এবং server-এর মধ্যে communication সহজ করা।
HTTP Status Code-এর শ্রেণিবিভাগ
HTTP status code পাঁচটি category-তে বিভক্ত:
| Status Code Range | Category | বর্ণনা |
|---|---|---|
| 100 – 199 | Informational | Request গ্রহণ করা হয়েছে এবং processing চলছে |
| 200 – 299 | Success | Request সফলভাবে সম্পন্ন হয়েছে |
| 300 – 399 | Redirection | অতিরিক্ত action প্রয়োজন |
| 400 – 499 | Client Error | Client request-এর কারণে error |
| 500 – 599 | Server Error | Server-এর অভ্যন্তরীণ error |
1. Informational Status Codes (100–199)
এই code বোঝায় request গ্রহণ করা হয়েছে এবং processing চলছে।
- 100 Continue: Client request পাঠানো চালিয়ে যেতে পারে।
- 101 Switching Protocols: Server protocol পরিবর্তনে সম্মতি দিয়েছে।
2. Success Status Codes (200–299)
এই code বোঝায় request সফলভাবে সম্পন্ন হয়েছে।
- 200 OK: Request সফল হয়েছে।
- 201 Created: নতুন resource সফলভাবে তৈরি হয়েছে।
- 204 No Content: Request সফল কিন্তু কোনো content ফেরত দেয়নি।
3. Redirection Status Codes (300–399)
এই code বোঝায় অতিরিক্ত action প্রয়োজন।
- 301 Moved Permanently: Resource স্থায়ীভাবে অন্য URL-এ সরানো হয়েছে।
- 302 Found: Resource সাময়িকভাবে অন্যত্র সরানো হয়েছে।
- 304 Not Modified: Cached version ব্যবহার করা যাবে।
4. Client Error Status Codes (400–499)
এই error সাধারণত client request-এর সমস্যার কারণে হয়।
- 400 Bad Request: Invalid request syntax।
- 401 Unauthorized: Authentication প্রয়োজন।
- 403 Forbidden: Access denied।
- 404 Not Found: Requested resource পাওয়া যায়নি।
5. Server Error Status Codes (500–599)
এই error server request process করতে ব্যর্থ হলে ঘটে।
- 500 Internal Server Error: সাধারণ server-side error।
- 502 Bad Gateway: অন্য server থেকে invalid response এসেছে।
- 503 Service Unavailable: Server সাময়িকভাবে unavailable।
- 504 Gateway Timeout: Server response timeout হয়েছে।
বহুল ব্যবহৃত HTTP Status Codes
| Status Code | অর্থ |
|---|---|
| 200 | OK |
| 301 | Moved Permanently |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
| Static Web Page | Dynamic Web Page |
|---|---|
| Content is fixed and does not change | Content is dynamic and can change |
| Written using HTML, CSS | Uses server-side languages (PHP, Node.js, etc.) |
| No interaction with user | Supports user interaction |
| Loads faster | Slower due to processing |
| No database required | Often connected with database |
| Example: Simple portfolio page | Example: Facebook, YouTube |
| Static Web Page | Dynamic Web Page |
|---|---|
| Content fixed থাকে, পরিবর্তন হয় না | Content dynamic এবং পরিবর্তনশীল |
| HTML, CSS ব্যবহার করা হয় | server-side language (PHP, Node.js) ব্যবহার করা হয় |
| User interaction নেই | User interaction সম্ভব |
| দ্রুত load হয় | Processing-এর কারণে ধীর |
| Database লাগে না | সাধারণত database ব্যবহার করে |
| উদাহরণ: Simple website | উদাহরণ: Facebook, YouTube |
<!-- HTML -->
<input type="text" id="email" placeholder="Enter email">
<button id="checkBtn">Validate</button>
<p id="msg"></p>
<!-- jQuery Script -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$("#checkBtn").click(function() {
var email = $("#email").val();
// Email pattern
var pattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (pattern.test(email)) {
$("#msg").text("Valid Email").css("color", "green");
} else {
$("#msg").text("Invalid Email").css("color", "red");
}
});
});
</script>
