<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Adithya A</title>
    <description>The latest articles on DEV Community by Adithya A (@adithya_a_508b89c3885ee40).</description>
    <link>https://dev.to/adithya_a_508b89c3885ee40</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2205787%2Fea6bd64e-9d0f-42e5-876a-81df7b4955d0.jpg</url>
      <title>DEV Community: Adithya A</title>
      <link>https://dev.to/adithya_a_508b89c3885ee40</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adithya_a_508b89c3885ee40"/>
    <language>en</language>
    <item>
      <title>Breaking the CORS Puzzle: What Every Developer Must Know for Interviews</title>
      <dc:creator>Adithya A</dc:creator>
      <pubDate>Tue, 29 Oct 2024 19:54:25 +0000</pubDate>
      <link>https://dev.to/adithya_a_508b89c3885ee40/breaking-the-cors-puzzle-what-every-developer-must-know-for-interviews-45fe</link>
      <guid>https://dev.to/adithya_a_508b89c3885ee40/breaking-the-cors-puzzle-what-every-developer-must-know-for-interviews-45fe</guid>
      <description>&lt;p&gt;Let’s talk about something that every web developer encounters — CORS Policy. I recently faced some interview, in which medium-level questions were asked on CORS (Cross-Origin Resource Sharing),and they’re exactly what you’ll want to know if you’re preparing for an interview. Here’s what I was asked and the answers I gave, plus a few tips to deepen your understanding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. What is CORS? And What Does It Stand For?&lt;/strong&gt;&lt;br&gt;
CORS stands for &lt;strong&gt;Cross-Origin Resource Sharing&lt;/strong&gt;. It’s a security feature in browsers that controls how resources can be shared between different origins. In simpler terms, it allows web servers to grant permission for external sources (like websites or applications) to access their resources.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How CORS Works:&lt;/em&gt;&lt;br&gt;
CORS revolves around three elements in an array: &lt;strong&gt;[protocol, URL, port]&lt;/strong&gt;. Imagine you have a server running at &lt;em&gt;&lt;a href="https://localhost:3000" rel="noopener noreferrer"&gt;https://localhost:3000&lt;/a&gt;&lt;/em&gt;—this server uses HTTPS, the localhost URL, and port 3000. If a client tries to access this server from a different URL, protocol, or port, the browser’s &lt;strong&gt;Same-Origin Policy (SOP)&lt;/strong&gt; will block it. This is where CORS steps in, giving servers a way to share with specific external origins while maintaining security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. How Did You Implement CORS in Your Project?&lt;/strong&gt;&lt;br&gt;
In the project I was interviewed for, I used Node.js. CORS comes up a lot when building APIs for client-server communication, and here’s the Node.js code I used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cors = require("cors"); // Import CORS middleware

app.use(
  cors({
    origin: "http://localhost:3000", // Only allow requests from this origin
    methods: ["GET", "POST"], // Restrict allowed HTTP methods
    credentials: true, // Enable cookies and authentication headers across origins
  })
);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration lets the server accept requests only from &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; and only for GET and POST methods. Enabling credentials: true is key here—it allows cookies and auth headers to be shared, which is essential for sessions that require login or token-based authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Why Use Middleware? Isn’t It Just Adding Complexity?&lt;/strong&gt;&lt;br&gt;
One question that came up was Why even use middleware for CORS? If you can connect the server and client directly, isn’t middleware just causing a delay?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here’s the scoop&lt;/em&gt;: Middleware is actually a way to handle common tasks (like CORS) in a streamlined, reusable way, making it possible to set rules at a global level instead of repeatedly applying them throughout the code. This saves time and minimizes errors, especially in complex applications where different endpoints may have different access rules. While there’s a slight delay, the trade-off for security, scalability, and simplicity is worth it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. What’s the Difference Between a Simple Request and a Preflight Request?&lt;/strong&gt;&lt;br&gt;
This one’s a little trickier but essential to understand.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;simple request&lt;/strong&gt; is when a browser can directly send a request to a server without checking permissions in advance. This usually applies to GET and POST requests without custom headers, making it faster and easier for clients.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;preflight request&lt;/strong&gt; comes in when a request goes beyond the scope of a “simple request.” If a client wants to use an HTTP method that isn’t GET or POST (like PUT or DELETE) or add custom headers (such as &lt;em&gt;Authorization or Content-Type: application/json&lt;/em&gt;), the browser needs to double-check that this is allowed. To do this, it sends an &lt;strong&gt;_OPTIONS _&lt;/strong&gt;(very important) request to the server before making the actual request.&lt;/p&gt;

&lt;p&gt;Think of this OPTIONS request as a “permission letter.” The browser is essentially asking the server, “Hey, can I send this request with these specific methods or headers?” The server then responds with which methods, headers, and origins it’s willing to accept. If the server gives the green light, the browser proceeds with the real request. If not, the browser blocks it, keeping everything secure.&lt;/p&gt;

&lt;p&gt;Preflight requests add a layer of security by ensuring that non-standard requests aren’t just blindly sent to the server, giving servers control over exactly what gets through and how.&lt;/p&gt;

&lt;p&gt;END…..&lt;/p&gt;

&lt;p&gt;After covering CORS basics, the interview dove into **system design **questions. These tend to dig deeper into how you’d structure an application or design a scalable backend with multiple clients in mind.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Curious for more on this?&lt;/em&gt;&lt;/strong&gt; Let me know in the comments if you’d like insights on the system design questions — they can really add value to your preparation!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Transform Your Text Analysis Journey: How KeyBERT is Changing the Game for Keyword Extraction!</title>
      <dc:creator>Adithya A</dc:creator>
      <pubDate>Sun, 13 Oct 2024 14:40:57 +0000</pubDate>
      <link>https://dev.to/adithya_a_508b89c3885ee40/transform-your-text-analysis-journey-how-keybert-is-changing-the-game-for-keyword-extraction-56pn</link>
      <guid>https://dev.to/adithya_a_508b89c3885ee40/transform-your-text-analysis-journey-how-keybert-is-changing-the-game-for-keyword-extraction-56pn</guid>
      <description>&lt;p&gt;In today’s world, where we are bombarded with information, being able to extract meaningful insights from extensive content is more important than ever. Whether you’re a data scientist, researcher, or developer, having the right tools can help you break down complex documents into their key elements. That’s where KeyBERT comes in—a powerful Python library designed for extracting keywords and keyphrases using BERT embedding techniques.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is keyBERT?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Contextual Understanding: KeyBERT utilizes BERT embeddings, which means it captures the contextual relationships between words.They also use cosine similarity to check the similarity of the context which results in more relevant and meaningful keywords. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Customizability: The library allows you to customize various parameters, such as n-grams, stop words, change model, use open ai integrated with it and the number of keywords to extract, making it adaptable to a wide range of applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ease of Use: KeyBERT is designed to be user-friendly, enabling both beginners and seasoned developers to get started quickly with minimal setup.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Getting Started with KeyBERT
&lt;/h4&gt;

&lt;p&gt;Before getting started with keyBERT, you must have python installed on your device.Now, you can easily install the keyBERT library using pip&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install keybert
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, create a new python file in your code editor and use the below code snippet to test the library&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from keybert import KeyBERT

# Initialize KeyBERT
kw_model = KeyBERT()

# Sample document
doc = "Machine learning is a fascinating field of artificial intelligence that focuses on the development of algorithms."

# Extract keywords
keywords = kw_model.extract_keywords(doc, top_n=5)

# Print the keywords
print(keywords)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, KeyBERT processes the input document and extracts the top five relevant keywords.&lt;/p&gt;

&lt;h3&gt;
  
  
  Applications
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Understanding Preference: This can be used to gather user preferences based on their readings on any platform, such as news articles, books, or research papers.&lt;/li&gt;
&lt;li&gt;Content Creation : Bloggers and marketers can use KeyBERT to find trending topics on the internet and optimize their content.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In the world where data is abundant having a tool like keyBERT can extract the valuable information from it. With the use of keyBERT you can potentially extract the hidden information from the text data. I recommend KeyBERT for its user-friendly interface, as I have personally used it to complete a project.&lt;/p&gt;

&lt;h4&gt;
  
  
  Link to official Docs
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://maartengr.github.io/KeyBERT/api/keybert.html" rel="noopener noreferrer"&gt;Link To keyBERT Documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
