<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Charlie on Medium]]></title>
        <description><![CDATA[Stories by Charlie on Medium]]></description>
        <link>https://medium.com/@nishannishankar?source=rss-5ea79f83594e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1hg4xq6r3hGkvmBGgAmSxg.png</url>
            <title>Stories by Charlie on Medium</title>
            <link>https://medium.com/@nishannishankar?source=rss-5ea79f83594e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:53:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nishannishankar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[First Step into Robotics: A Beginner's Guide to WeBots]]></title>
            <link>https://medium.com/@nishannishankar/first-step-into-robotics-a-beginners-guide-to-webots-297d9bb1bbed?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/297d9bb1bbed</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[webots]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 07:12:21 GMT</pubDate>
            <atom:updated>2025-09-10T07:12:21.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R1mDjkudBBIC5CfL7cl3gg.png" /></figure><p>Ever wanted to mess around with robots but thought it sounded too hard or expensive?</p><p>I’m just like you, a total newbie to robotics, super curious but clueless about where to start. I don’t have a fancy computer (yep, my laptop’s a bit of a 🥔), and I wanted something <strong><em>easy, fun, and free</em></strong> to play with robots. That’s when I stumbled on <strong>Webots🐞.</strong></p><h3>What’s Webots, Anyway?</h3><p>Webots is like a video game where <em>you</em> build and control robots. It’s a free app where you can create a virtual world, pop in a robot, and tell it what to do, like making it roll around or dodge walls. It’s perfect for beginners because it’s simple to use, and you can’t break anything. Plus, it’s used by real robot nerds, so you’re starting with the cool stuff!</p><h3>Getting Webots on Your Computer</h3><p>First, let’s get Webots on your laptop or PC. It’s super easy:</p><ol><li><strong>Download It</strong>: <a href="https://cyberbotics.com/#download">Go to Webots’ website</a>. Pick the version for your computer (Windows, Mac, or Linux). It’s free, no sign-up needed!</li><li><strong>Install It</strong>: Double-click the downloaded file and follow the steps (just keep clicking “Next” or “Install”). It’s like installing any app.</li><li><strong>Open It</strong>: Launch Webots. You’ll see a window with a 3D view, some menus, and a place to type code. Don’t worry — it’s less scary than it looks!</li></ol><p><em>Got stuck?</em> Check the Webots help page or ask in the comments. You’ve got this! 👍 [<a href="https://cyberbotics.com/doc/guide/tutorials">https://cyberbotics.com/doc/guide/tutorials</a>].</p><h3>Understanding Webots’ Playground</h3><p>When you open Webots, it might look a bit like a sci-fi control panel, but don’t worry, it’s just your robot playground! Here’s what you’ll see:</p><ul><li><strong>3D View (Middle)</strong>: This big window is where your robot performs. It’s like watching your robot star in its own movie!</li><li><strong>Scene Tree (Left)</strong>: This list is like your toy box. It shows everything in your world (robots, floors, walls). You’ll click here to add stuff.</li><li><strong>Code Editor (Right)</strong>: This is where you type instructions (code) to tell your robot what to do. It’s like writing a note to your robot buddy.</li><li><strong>Toolbar (Top)</strong>: Buttons like Play (triangle) and Save let you run or save your work. Think of it as your control center.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xC8JKDhTwjRKBOXAZY6B_Q.png" /><figcaption>3D View</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*fqmBfuRbvaJtosI3fPoZ1A.png" /><figcaption>Scene Tree</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67w2m_7FFJJRk9JmeQQbXw.png" /><figcaption>Code Editor</figcaption></figure><h3>Make a Robot Move!</h3><p>Now for the fun part: let’s make a little robot zoom around! We’ll use a cute robot called <strong>e-puck</strong>. <strong>Before all that, make sure the simulation is stopped.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*-EWqidvddu51qOsv0hrhnA.jpeg" /><figcaption>e-puck: Educational robot by EPFL</figcaption></figure><h3>Step 1: Create a Tiny World</h3><ol><li>Open Webots and click <strong>File &gt; New World</strong>. When the prompt box appears, tick the rectangle arena.</li><li>Right-click the robot, choose <strong>Add Node &gt; Proto Nodes(webots project) &gt; Robots &gt; gctronics &gt; E-puck</strong> to add our little robot buddy.</li><li>Save your world as my_robot_world.wbt (File &gt; Save World).</li></ol><p>For each step,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*6dbOAZowpMnz-uPZ98pFNQ.png" /><figcaption>Prompt box after first step tick the “Add a rectangle arena”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfHQ6DqM07Cd0X6Hree-gg.png" /><figcaption>New world with rectangle arena</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*lba0u50t12BYy1JRGFTDQw.png" /><figcaption>Click Add to add the E-puck</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Tg3eSikKZSXIlFGHQ0qQw.png" /><figcaption>Now you will have your E-Puck Robot</figcaption></figure><h3>Step 2: Tell the Robot to Move</h3><p>We’ll use a tiny bit of Python code to let you control the e-puck with the <strong>arrow keys</strong>. Don’t worry if you’ve never coded. It’s just copy-paste!</p><ol><li>Click <strong>File &gt; New Controller</strong>.</li><li>Choose <strong>Python</strong> and name it my_controller or any name you want.</li><li>Now select the my_controller in the controller settings of E-Puck</li><li>Copy this code into the text box and save it.</li><li>Now play the simulation and you can control your robot using the keyboard. You can do more using the simulator. Check their official website for more cool stuffs.</li></ol><pre>from controller import Robot, Keyboard<br><br># Meet your robot!<br>robot = Robot()<br><br># Set up the keyboard<br>keyboard = Keyboard()<br>keyboard.enable(100)  # Check keys every 100ms<br><br># How fast we update (don’t worry about this)<br>timestep = int(robot.getBasicTimeStep())<br><br># Find the robot’s wheels<br>left_wheel = robot.getDevice(&quot;left wheel motor&quot;)<br>right_wheel = robot.getDevice(&quot;right wheel motor&quot;)<br><br># Tell wheels to keep spinning<br>left_wheel.setPosition(float(&#39;inf&#39;))<br>right_wheel.setPosition(float(&#39;inf&#39;))<br><br># Main loop<br>while robot.step(timestep) != -1:<br>    # Get the key pressed<br>    key = keyboard.getKey()<br>    <br>    # Default: stop the robot<br>    left_speed = 0.0<br>    right_speed = 0.0<br>    <br>    # Arrow keys control movement<br>    if key == Keyboard.UP:<br>        left_speed = 2.0  # Go forward<br>        right_speed = 2.0<br>    elif key == Keyboard.DOWN:<br>        left_speed = -2.0  # Go backward<br>        right_speed = -2.0<br>    elif key == Keyboard.LEFT:<br>        left_speed = -1.0  # Turn left<br>        right_speed = 1.0<br>    elif key == Keyboard.RIGHT:<br>        left_speed = 1.0  # Turn right<br>        right_speed = -1.0<br>    <br>    # Set wheel speeds<br>    left_wheel.setVelocity(left_speed)<br>    right_wheel.setVelocity(right_speed)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=297d9bb1bbed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Dune Became the Godfather of Modern Fiction and Novels]]></title>
            <link>https://medium.com/@nishannishankar/how-dune-became-the-godfather-of-modern-fiction-and-novels-0a656a9a5a2b?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a656a9a5a2b</guid>
            <category><![CDATA[dune]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[pop-culture]]></category>
            <category><![CDATA[movıe]]></category>
            <category><![CDATA[entertainment]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Mon, 05 May 2025 18:12:34 GMT</pubDate>
            <atom:updated>2025-05-05T18:12:34.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDIBhk8DEZjWhtq1FOFQ9A.jpeg" /><figcaption>Dune: Part Two ( Photo Credit — IMDb )</figcaption></figure><p>Frank Herbert’s <em>Dune</em>, first published in 1965, stands as a towering milestone in speculative fiction, often hailed as the godfather of modern novels across genres. Its intricate world-building, philosophical depth, and narrative innovation have left an indelible mark on science fiction, fantasy, and even mainstream literature. From inspiring iconic works like <em>Star Wars</em> to shaping contemporary novels, <em>Dune</em>’s influence permeates modern storytelling. This article explores how <em>Dune</em> became a foundational text, redefining narrative possibilities and inspiring generations of writers.</p><h3>A New Blueprint for World-Building</h3><p>At the heart of <em>Dune</em>’s legacy is its unparalleled world-building. Herbert crafted the desert planet of Arrakis with meticulous detail, blending ecology, politics, religion, and culture into a living, breathing universe. Unlike the simplistic settings of earlier science fiction, Arrakis feels tangible — its spice-driven economy, feudal houses, and Fremen tribes are as vivid as any historical society.</p><p>This approach revolutionized how authors construct fictional worlds. <em>Dune</em> showed that a setting could be a character in its own right, with its own rules and consequences. George R.R. Martin’s <em>A Song of Ice and Fire</em> owes much to Herbert’s layered political intrigue and geographically diverse world. Similarly, the sprawling universes of <em>Mass Effect</em> and <em>The Expanse</em> echo <em>Dune</em>’s fusion of hard science and socio-political complexity. By treating Arrakis as a microcosm of human ambition and survival, Herbert set a standard for immersive storytelling that remains unmatched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLs4r_98uA1E7oOXmMrfdg.jpeg" /><figcaption>Arrakies riding a sandworm</figcaption></figure><h3>The Hero’s Journey, Subverted</h3><p><em>Dune</em> engages with the classic hero’s journey but subverts it in ways that resonate with modern fiction’s preference for moral ambiguity. Paul Atreides, the prophesied messiah, is no simple savior. His rise to power unleashes a galactic jihad, questioning the cost of heroism and the dangers of charismatic leadership. This deconstruction of the chosen one trope prefigures modern narratives that challenge black-and-white morality.</p><p>Authors like Neil Gaiman and China Miéville have cited <em>Dune</em>’s influence in crafting protagonists who grapple with flawed destinies. In <em>Star Wars</em>, Luke Skywalker’s arc mirrors Paul’s, but George Lucas borrowed heavily from <em>Dune</em>’s mythic structure, tempering it with a more optimistic lens. Even in fantasy, <em>Dune</em>’s skeptical take on prophecy informs works like Brandon Sanderson’s <em>Mistborn</em>, where heroes confront the unintended consequences of their actions. Herbert’s nuanced portrayal of power dynamics gave writers permission to explore the gray areas of heroism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SObLOhgyW8yRNAG-K5VNqw.jpeg" /></figure><h3>Philosophy and Themes That Transcend Genre</h3><p><em>Dune</em> is as much a philosophical treatise as it is a novel. Herbert weaves themes of ecology, religion, and human potential into the narrative, drawing from diverse influences like Islamic history, Zen Buddhism, and environmental science. The novel’s focus on spice as a resource mirrors real-world oil politics, while its ecological concerns — preserving Arrakis’s water-scarce environment — anticipate today’s climate fiction.</p><p>This thematic richness has inspired authors to tackle big ideas in their work. Kim Stanley Robinson’s <em>Mars Trilogy</em> reflects <em>Dune</em>’s obsession with terraforming and societal evolution. N.K. Jemisin’s <em>Broken Earth</em> series channels Herbert’s blend of speculative science and cultural critique, addressing systemic oppression through a geological lens. By proving that genre fiction could grapple with profound questions, <em>Dune</em> paved the way for novels that transcend entertainment to engage with humanity’s deepest challenges.</p><h3>A Template for Epic Storytelling</h3><p><em>Dune</em>’s multi-generational saga, spanning the original novel and its sequels, introduced a model for epic storytelling that balances personal and cosmic stakes. Herbert’s ability to intertwine Paul’s personal journey with the fate of entire civilizations set a precedent for ambitious narratives. This structure is evident in modern epics like <em>The Wheel of Time</em> by Robert Jordan, where individual character arcs intersect with world-altering events.</p><p>The novel’s serialized potential also influenced transmedia storytelling. <em>Dune</em>’s adaptations — films, games, and TV series — demonstrate its adaptability, inspiring franchises like <em>The Witcher</em> and <em>Warhammer 40,000</em>, which borrow <em>Dune</em>’s blend of mythic grandeur and gritty realism. Herbert’s saga showed that a single story could spawn a universe, a lesson modern creators have embraced in building expansive IPs.</p><h3>Cultural and Political Resonance</h3><p><em>Dune</em>’s engagement with colonialism, resource exploitation, and cultural appropriation remains strikingly relevant. The Fremen, inspired by Bedouin and Islamic cultures, navigate their oppression under off-world rulers, a dynamic that mirrors historical and contemporary struggles. This sensitivity to cultural narratives has influenced writers like Octavia E. Butler, whose <em>Parable</em> series explores power and survival through marginalized perspectives.</p><p>Moreover, <em>Dune</em>’s critique of imperialism resonates in works like Ann Leckie’s <em>Imperial Radch</em> trilogy, which examines hegemony and identity in a galactic empire. By addressing real-world issues through a speculative lens, <em>Dune</em> empowered authors to use fiction as a mirror for societal critique, a hallmark of modern literature.</p><h3>The Ripple Effect Across Media</h3><p>Beyond novels, <em>Dune</em>’s fingerprints are all over popular culture. Its visual and thematic DNA shaped <em>Star Wars</em>’s desert planets and mystical orders, while <em>Avatar</em>’s resource-driven conflict echoes spice wars. In gaming, <em>Dune</em>’s strategic depth inspired titles like <em>Civilization</em> and <em>Stellaris</em>, where players manage complex societies. Even anime, such as <em>Nausicaä of the Valley of the Wind</em>, reflects <em>Dune</em>’s ecological focus and strong-willed protagonists.</p><p>This cross-pollination underscores <em>Dune</em>’s role as a cultural touchstone. Its ability to inspire across mediums — novels, films, games, and comics — demonstrates its versatility and enduring appeal. Writers and creators continue to mine <em>Dune</em> for ideas, adapting its themes to new contexts and audiences.</p><h3>Conclusion: A Legacy That Endures</h3><p><em>Dune</em> is more than a novel; it’s a paradigm shift that redefined what fiction could achieve. Its intricate world, subversive storytelling, and philosophical depth have made it a cornerstone of modern literature. From fantasy epics to hard sci-fi, from video games to climate fiction, Herbert’s masterpiece continues to inspire creators to push boundaries and explore the human condition.</p><p>As new adaptations, like Denis Villeneuve’s acclaimed films, introduce <em>Dune</em> to new generations, its influence shows no signs of waning. Like the spice itself, <em>Dune</em> is a rare and potent force, shaping the landscape of storytelling for decades to come. It is, undeniably, the godfather of modern fiction — a saga that invites us to dream big, question deeply, and create boldly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJLoEG6cx1QdaFxP9ioezA.jpeg" /></figure><p>This concept art was made by H. R. Giger for the “Dune” movie that never happened. Does it look familiar, though?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a656a9a5a2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Vision Transformers (ViT) with Hugging Face Implementation.]]></title>
            <link>https://medium.com/@nishannishankar/understanding-vision-transformers-vit-with-hugging-face-implementation-91bb6247972d?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/91bb6247972d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Mon, 05 May 2025 06:03:18 GMT</pubDate>
            <atom:updated>2025-05-05T06:19:23.720Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wN0RrM3FoOmhhDHp0AyHKg.png" /><figcaption><strong>ViT Architecture</strong></figcaption></figure><p>In 2020, a groundbreaking paper titled <em>“An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale”</em> by Dosovitskiy et al. introduced the Vision Transformer (ViT), a model that revolutionized computer vision by applying transformer architectures, originally designed for natural language processing (NLP), to image recognition. This article provides a simple, understandable, and detailed explanation of ViT as described in the original paper, followed by a practical guide on how to use and fine-tune ViT models using the Hugging Face library.</p><h3>What Are Vision Transformers (ViT)?</h3><p>Vision Transformers (ViT) are a type of neural network that adapts the transformer architecture — famous for powering models like BERT in NLP — for computer vision tasks like image classification. Unlike convolutional neural networks (CNNs), which rely on localized filters to process images, ViTs treat an image as a sequence of patches and use the transformer’s attention mechanism to understand relationships between them.</p><p>Imagine you’re looking at a puzzle of a cat. A CNN might focus on individual pieces (like the whiskers or eyes), while a ViT looks at all the pieces together, figuring out how they connect to form the full picture. This global perspective is what makes ViTs unique and powerful.</p><h3>The Vision Transformer Architecture: A Deep Dive</h3><p>Let’s break down how ViT works, as described in the original paper, in a way that’s easy to grasp.</p><h3>Step 1: Splitting the Image into Patches</h3><p>The first step in ViT is to divide an input image into smaller, fixed-size patches. For example, a 224x224 pixel image might be split into 16x16 pixel patches, resulting in 196 patches (since 224 ÷ 16 = 14, and 14x14 = 196). Each patch is like a “word” in NLP, and the collection of patches forms a “sentence” that the transformer will process.</p><p>To make these patches usable, each one is flattened into a vector. For a 16x16 patch with 3 color channels (RGB), the flattened vector has 16x16x3 = 768 elements. This vector is then passed through a linear layer to project it into a fixed-size embedding (e.g., 768 dimensions), which the transformer can understand.</p><h3>Step 2: Adding Positional Embeddings</h3><p>Since transformers don’t inherently understand the order of their inputs (unlike CNNs, which rely on spatial locality), ViT adds positional embeddings to each patch embedding. These are learnable vectors that encode the position of each patch in the image (e.g., top-left, bottom-right). This way, the model knows where each patch is located, preserving spatial information.</p><h3>Step 3: The Transformer Encoder</h3><p>The core of ViT is the transformer encoder, which processes the sequence of patch embeddings. The encoder consists of multiple layers, each containing two main components:</p><ul><li><strong>Multi-Head Self-Attention (MHSA)</strong>: This mechanism allows the model to focus on relationships between all patches. For example, when processing a patch of a cat’s ear, the model can “attend” to patches of the eyes or whiskers to understand the whole cat. MHSA computes attention scores for every pair of patches, determining which ones are most relevant to each other.</li><li><strong>Feed-Forward Neural Network (FFN)</strong>: After attention, each patch embedding is passed through a small neural network to refine its representation.</li></ul><p>Between these components, ViT uses layer normalization and residual connections (adding the input to the output) to stabilize training and improve performance. The transformer encoder repeats this process for several layers (e.g., 12 layers in ViT-Base), allowing the model to build increasingly complex representations.</p><h3>Step 4: Classification Head</h3><p>For image classification, ViT adds a special “class token” (CLS) to the sequence of patch embeddings before feeding them into the transformer. This token acts like a summary of the entire image. After passing through the transformer, the final embedding of the CLS token is used to predict the image’s class (e.g., “cat” or “dog”). This is done by passing the CLS token through a linear layer followed by a softmax function to output class probabilities.</p><p>Alternatively, ViT can average the embeddings of all patches (global average pooling) instead of using the CLS token, but the CLS token approach is more common.</p><h3>Step 5: Pre-Training and Fine-Tuning</h3><p>The original paper emphasizes that ViTs perform best when pre-trained on large datasets and fine-tuned on smaller, task-specific datasets. During pre-training, ViT is trained on a massive dataset like ImageNet-21k (14 million images) or JFT-300M (300 million images) using supervised learning (i.e., with labels). This teaches the model general visual features, like edges, textures, or object shapes.</p><p>For fine-tuning, the pre-trained ViT is adapted to a specific task (e.g., classifying flowers) using a smaller dataset with labels. Fine-tuning adjusts the model’s weights to specialize in the new task while leveraging the general knowledge gained during pre-training.</p><h3>Key Insights from the Original Paper</h3><p>The ViT paper revealed several important findings:</p><ul><li><strong>Scalability</strong>: ViTs outperform CNNs when trained on very large datasets (e.g., JFT-300M). With enough data, ViTs can learn richer representations than CNNs.</li><li><strong>Data Hunger</strong>: ViTs require more data than CNNs to perform well. Without large-scale pre-training, their performance lags behind CNNs on smaller datasets like ImageNet-1k (1.3 million images).</li><li><strong>Simplicity</strong>: ViTs are simpler than CNNs because they don’t rely on hand-crafted convolutional filters. The transformer’s attention mechanism learns everything from scratch.</li><li><strong>Global Context</strong>: By processing all patches simultaneously, ViTs capture global relationships in images, unlike CNNs, which focus on local patterns and build global understanding gradually.</li></ul><p>The paper introduced several ViT variants, such as ViT-Base (12 layers, 86M parameters), ViT-Large (24 layers, 307M parameters), and ViT-Huge (32 layers, 632M parameters), with larger models performing better when data is abundant.</p><h3>Why ViTs Matter</h3><p>ViTs have transformed computer vision because they:</p><ul><li>Offer a unified architecture for vision and language tasks (since transformers work for both).</li><li>Excel in transfer learning, making them versatile for tasks like object detection, segmentation, or even medical imaging.</li><li>Scale well with data and compute, paving the way for large-scale vision models.</li></ul><p>Now, let’s get hands-on and see how to use and fine-tune a ViT model using Hugging Face!</p><h3>Hugging Face Implementation: Using and Fine-Tuning ViT</h3><p>Hugging Face provides pre-trained ViT models and tools to fine-tune them easily. Below, we’ll walk through a Python script that demonstrates how to:</p><ol><li>Load a pre-trained ViT model.</li><li>Use it for image classification.</li><li>Fine-tune it on a custom dataset.</li></ol><p>We’ll use the transformers library and assume you’re working with a dataset like CIFAR-10 (10 classes, 32x32 images) for fine-tuning.</p><h3>Prerequisites</h3><ul><li>Install required libraries:</li><li>pip install transformers datasets torch torchvision</li><li>A Python environment with PyTorch and access to a GPU (optional but recommended for faster training).</li></ul><h3>Step 1: Loading a Pre-Trained ViT Model</h3><p>Hugging Face offers pre-trained ViT models, such as google/vit-base-patch16–224, which is trained on ImageNet-21k and fine-tuned on ImageNet-1k. Let’s load it and use it for inference.</p><h3>Step 2: Fine-Tuning on a Custom Dataset</h3><p>For fine-tuning, we’ll use the CIFAR-10 dataset, which contains 60,000 images across 10 classes (e.g., airplane, cat, dog). Hugging Face’s datasets library makes it easy to load CIFAR-10.</p><h3>Complete Code</h3><p>Here’s a comprehensive script that loads a pre-trained ViT, performs inference, and fine-tunes it on CIFAR-10.</p><pre>from transformers import ViTImageProcessor, ViTForImageClassification, TrainingArguments, Trainer <br>from datasets import load_dataset <br>import torch <br>from PIL import Image <br>import numpy as np<br><br>#Step 1: Load pre-trained ViT model and processor<br>model_name = &quot;google/vit-base-patch16–224&quot; <br>processor = ViTImageProcessor.from_pretrained(model_name) <br>model = ViTForImageClassification.from_pretrained(model_name)<br><br>#Step 2: Perform inference on a single image<br>def classify_image(image_path): <br>  image = Image.open(image_path).convert(&quot;RGB&quot;) <br>  inputs = processor(images=image, return_tensors=&quot;pt&quot;) <br>  with torch.no_grad(): <br>    outputs = model(**inputs) <br>    logits = outputs.logits <br>    predicted_class_idx = logits.argmax(-1).item() <br>    return model.config.id2label[predicted_class_idx]<br><br>#Example usage (replace &#39;sample.jpg&#39; with your image path)<br>print(classify_image(&quot;sample.jpg&quot;))<br><br>#Step 3: Load CIFAR-10 dataset for fine-tuning<br>dataset = load_dataset(&quot;cifar10&quot;)<br><br>#Preprocess dataset<br>def preprocess_function(examples): <br>  images = [img.convert(&quot;RGB&quot;) for img in examples[&quot;img&quot;]] <br>  inputs = processor(images=images, return_tensors=&quot;pt&quot;, padding=True, truncation=True) <br>  examples[&quot;pixel_values&quot;] = inputs[&quot;pixel_values&quot;] <br>  examples[&quot;label&quot;] = examples[&quot;label&quot;] <br>  return examples<br><br>#Apply preprocessing<br>train_dataset = dataset[&quot;train&quot;].map(preprocess_function, batched=True, remove_columns=[&quot;img&quot;]) <br>test_dataset = dataset[&quot;test&quot;].map(preprocess_function, batched=True, remove_columns=[&quot;img&quot;])<br><br>#Step 4: Set up training arguments<br>training_args = TrainingArguments( output_dir=&quot;./vit_finetuned_cifar10&quot;, per_device_train_batch_size=16, per_device_eval_batch_size=16, num_train_epochs=3, evaluation_strategy=&quot;epoch&quot;, save_strategy=&quot;epoch&quot;, logging_steps=100, learning_rate=2e-5, load_best_model_at_end=True, )<br><br>#Step 5: Define compute metrics function<br>def compute_metrics(eval_pred): logits, labels = eval_pred predictions = np.argmax(logits, axis=-1) <br>  accuracy = (predictions == labels).mean() <br>  return {&quot;accuracy&quot;: accuracy}<br><br>#Step 6: Initialize Trainer<br>trainer = Trainer( model=model, args=training_args, train_dataset=train_dataset, eval_dataset=test_dataset, compute_metrics=compute_metrics, )<br><br>#Step 7: Fine-tune the model<br>trainer.train()<br><br>#Step 8: Save the fine-tuned model<br>model.save_pretrained(&quot;./vit_finetuned_cifar10&quot;) <br>processor.save_pretrained(&quot;./vit_finetuned_cifar10&quot;)<br><br>#Step 9: Evaluate the fine-tuned model<br>eval_results = trainer.evaluate() print(f&quot;Evaluation results: {eval_results}&quot;)<br></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91bb6247972d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DINO: Understanding Emerging Properties in Self-Supervised Vision Transformers]]></title>
            <link>https://medium.com/@nishannishankar/dino-understanding-emerging-properties-in-self-supervised-vision-transformers-a074d0adea59?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a074d0adea59</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Mon, 05 May 2025 05:58:56 GMT</pubDate>
            <atom:updated>2025-05-05T05:58:56.650Z</atom:updated>
            <content:encoded><![CDATA[<p>Self-supervised learning (SSL) has taken the machine learning world by storm, especially in computer vision. Among the stars of this revolution are Vision Transformers (ViTs), which have shown remarkable abilities to learn visual representations without needing labeled data. But what makes these models so special? In this article, we’ll dive into the emerging properties of self-supervised Vision Transformers, explaining them in a simple and understandable way.</p><h3>What Are Vision Transformers?</h3><p>Before we get to the exciting stuff, let’s break down what Vision Transformers are. Unlike traditional convolutional neural networks (CNNs) that process images using localized filters, Vision Transformers borrow ideas from natural language processing. They treat an image as a sequence of patches (think of small image squares) and use a mechanism called “attention” to understand relationships between these patches.</p><p>Imagine you’re looking at a picture of a cat. A ViT doesn’t just focus on the whiskers or the tail in isolation — it learns how the whiskers, eyes, and tail relate to each other to form the concept of a “cat.” This ability to capture global relationships makes ViTs powerful.</p><h3>Self-Supervised Learning: Learning Without Labels</h3><p>Now, what does “self-supervised” mean? In traditional supervised learning, models need tons of labeled data (e.g., thousands of cat pictures labeled as “cat”). Labeling is expensive and time-consuming. Self-supervised learning is like teaching the model to be a detective — it figures out patterns in the data without explicit labels.</p><p>For Vision Transformers, SSL involves tasks like predicting missing parts of an image or understanding how patches fit together. By solving these “puzzles,” the model learns meaningful visual representations. Think of it as a child learning about the world by observing, not by being spoon-fed answers.</p><h3>Emerging Properties: The Magic of ViTs</h3><p>When Vision Transformers are trained with self-supervised learning, they develop some fascinating “emerging properties” — abilities that weren’t explicitly programmed but arise naturally during training. Let’s explore a few of these:</p><h3>1. Robust Feature Representations</h3><p>Self-supervised ViTs learn to extract features (like edges, textures, or shapes) that are incredibly robust. These features work well across different tasks, such as image classification, object detection, or even medical image analysis. For example, a ViT trained on random internet images can still help identify tumors in medical scans, even though it was never explicitly trained for that.</p><p>Why does this happen? During SSL, ViTs are exposed to diverse, unlabeled data and learn to generalize patterns that are universally useful. It’s like learning the “grammar” of images, which applies to many visual tasks.</p><h3>2. Attention to Context</h3><p>One of the coolest things about ViTs is their attention mechanism. In self-supervised settings, ViTs learn to focus on the most relevant parts of an image while ignoring distractions. For instance, if you show a ViT an image of a dog in a park, it can focus on the dog’s features (ears, fur) while ignoring the background grass or trees.</p><p>This ability to prioritize context emerges because SSL tasks force the model to understand relationships between patches. It’s like the model learns to say, “Hey, these patches together form a dog, so let’s pay attention to them!”</p><h3>3. Transfer Learning Powerhouse</h3><p>Transfer learning is when a model trained on one task is reused for another. Self-supervised ViTs excel at this. Because they learn general visual concepts (like shapes, textures, or object boundaries) during SSL, they can be fine-tuned with very few labeled examples for specific tasks.</p><p>For example, a ViT trained on millions of unlabeled images can be fine-tuned with just a handful of labeled flower images to classify different flower species. This makes ViTs incredibly efficient and practical for real-world applications where labeled data is scarce.</p><h3>4. Robustness to Noise and Variations</h3><p>Self-supervised ViTs are surprisingly resilient to noisy or distorted images. Whether an image is blurry, rotated, or partially occluded, these models can still recognize key patterns. This robustness emerges because SSL tasks often involve reconstructing or understanding images under challenging conditions, teaching the model to focus on the essence of the image.</p><p>Imagine trying to recognize a friend in a crowded, dimly lit room. A self-supervised ViT is like your brain — it picks up on your friend’s unique features despite the noise.</p><h3>Why Do These Properties Matter?</h3><p>The emerging properties of self-supervised Vision Transformers are a big deal for several reasons:</p><ul><li><strong>Cost Efficiency</strong>: By reducing the need for labeled data, SSL makes AI development cheaper and faster.</li><li><strong>Versatility</strong>: Robust features and transfer learning mean ViTs can be used in diverse applications, from self-driving cars to art generation.</li><li><strong>Real-World Impact</strong>: Their ability to handle noisy or incomplete data makes them ideal for practical scenarios, like analyzing satellite images or detecting defects in manufacturing.</li></ul><h3>Challenges and Future Directions</h3><p>While self-supervised ViTs are impressive, they’re not perfect. Training them requires a lot of computational power, and their performance can depend on the quality and diversity of the unlabeled data. Researchers are working on making ViTs more efficient and exploring ways to combine self-supervised learning with other techniques, like reinforcement learning, to push their capabilities even further.</p><h3>Conclusion</h3><p>Self-supervised Vision Transformers are unlocking new possibilities in computer vision by learning powerful, generalizable representations without labeled data. Their emerging properties — robust features, contextual attention, transfer learning prowess, and noise resilience — make them a cornerstone of modern AI. As research advances, we can expect ViTs to power even more innovative applications, from smarter robots to better medical diagnostics.</p><p>So, the next time you hear about Vision Transformers, think of them as curious detectives, piecing together the visual world one patch at a time, all on their own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a074d0adea59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Competitive Programming: Exploring the Best Learning Platforms]]></title>
            <link>https://medium.com/@nishannishankar/mastering-competitive-programming-exploring-the-best-learning-platforms-e48a8068430c?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e48a8068430c</guid>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[hackerrank]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Mon, 21 Aug 2023 01:29:06 GMT</pubDate>
            <atom:updated>2023-08-21T01:29:57.135Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8AcmgwqclbOgV1a9v41cQ.jpeg" /></figure><p>Competitive programming has evolved from a niche interest to an essential skill for software developers. The ability to solve complex algorithmic problems efficiently and under time constraints is not only a requirement for technical interviews at top tech companies but also a rewarding mental exercise for those who enjoy coding challenges. In this comprehensive guide, we will delve into the world of competitive programming and explore the best learning platforms that can help you hone your skills.</p><p><strong>The Significance of Competitive Programming</strong></p><p>Competitive programming is more than just a hobby; it’s a way to enhance your problem-solving skills, improve your algorithmic thinking, and deepen your understanding of data structures and mathematical concepts. The benefits extend beyond interview rooms and coding competitions, as the skills you acquire can greatly contribute to your efficiency as a developer in real-world scenarios.</p><p><strong>1. LeetCode: A Powerhouse of Practice</strong></p><p>LeetCode has become synonymous with interview preparation. With its extensive collection of problems categorized by difficulty and topic, it offers a gradual learning curve for beginners and challenges for experienced programmers. LeetCode’s mock interviews and company-specific questions simulate real interview scenarios, giving you an edge in your job hunt.</p><p><strong>2. Codeforces: For the Competitive Spirit</strong></p><p>If you’re interested in competitive programming as a sport, Codeforces is the place to be. It hosts regular contests that cater to a global audience of programmers. The problems are carefully crafted to encourage creative solutions and efficient algorithms. Participating in Codeforces contests is an excellent way to gauge your skills and track your progress.</p><p><strong>3. HackerRank: Diverse Practice Opportunities</strong></p><p>HackerRank offers not only a vast collection of coding challenges but also domain-specific practice and tutorials. Its “Interview Preparation Kit” contains a curated set of problems frequently asked in interviews. HackerRank’s emphasis on learning paths and projects makes it a versatile platform for comprehensive skill development.</p><p><strong>4. TopCoder: Where It All Began</strong></p><p>TopCoder is one of the oldest and most respected platforms in competitive programming. It’s renowned for its algorithm and development challenges, and it has a strong global community of competitive programmers. TopCoder’s marathon matches and single-round contests cater to different interests and skill levels.</p><p><strong>5. AtCoder: Rising in Popularity</strong></p><p>AtCoder, originating from Japan, has gained international attention due to its well-designed contests and user-friendly interface. It features regular beginner-friendly contests, making it a great starting point for newcomers. AtCoder is known for its editorial quality, which helps learners understand problem solutions better.</p><p><strong>6. CodeChef: Nurturing Indian Competitive Programmers</strong></p><p>CodeChef is an Indian platform that hosts contests like the “Long Challenge,” which spans ten days and encourages participants to dive deep into problems. The platform focuses on algorithmic and programming skills while also fostering a sense of community among Indian competitive programmers.</p><p><strong>7. UVa Online Judge: Classic Training Ground</strong></p><p>The UVa Online Judge is a pioneer in online judging systems. Although its interface might appear outdated, its extensive problem archive and solid algorithmic challenges have stood the test of time. It’s an excellent resource for foundational practice and building a strong understanding of algorithms.</p><p><strong>Conclusion</strong></p><p>Competitive programming is a journey that requires consistent practice, dedication, and a willingness to learn from failures. The platforms mentioned in this guide offer different perspectives and experiences, catering to various learning styles and goals. LeetCode and HackerRank stand out for their interview-focused preparation, Codeforces and TopCoder appeal to the competitive spirit, and AtCoder, CodeChef, and UVa Online Judge provide unique experiences for learners.</p><p>As you embark on your competitive programming journey, remember that success comes not just from solving problems but also from understanding the underlying concepts. With the right mindset and the resources provided by these platforms, you’re well on your way to mastering the art of competitive programming and elevating your coding skills to new heights.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e48a8068430c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOAP API]]></title>
            <link>https://medium.com/@nishannishankar/soap-api-652f1fdca313?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/652f1fdca313</guid>
            <category><![CDATA[soap-api]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rest-vs-soap]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[soapui]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Wed, 04 Jan 2023 03:43:54 GMT</pubDate>
            <atom:updated>2023-01-07T08:26:10.183Z</atom:updated>
            <content:encoded><![CDATA[<p>SOAP (Simple Object Access Protocol) is a messaging protocol that allows programs to communicate with each other using the Internet. It is a standardized protocol that uses XML to encode the messages and HTTP to transport the messages. SOAP is widely used in the integration of web-based systems and is supported by a variety of programming languages.</p><p>In this article, we will discuss how to get started with SOAP API. We will cover the following topics:</p><ul><li>What is SOAP API and how does it work?</li><li>Setting up a SOAP API server</li><li>Making SOAP API requests using cURL</li><li>Consuming SOAP API using a programming language</li></ul><h3>What is SOAP API and how does it work?</h3><p>SOAP is an XML-based protocol for exchanging information in a decentralized and distributed environment. It allows programs to communicate with each other using the Internet as a medium.</p><p>A SOAP message consists of four parts: an envelope, a header, a body, and a fault. The envelope defines the start and end of the message, the header contains optional metadata, the body contains the message payload, and the fault contains error information. Here is an example of a SOAP message:</p><pre>&lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope/&quot;&gt;<br>  &lt;soap:Header&gt;<br>    &lt;header-element /&gt;<br>  &lt;/soap:Header&gt;<br>  &lt;soap:Body&gt;<br>    &lt;body-element&gt;<br>      &lt;content&gt;message&lt;/content&gt;<br>    &lt;/body-element&gt;<br>  &lt;/soap:Body&gt;<br>&lt;/soap:Envelope&gt;<br></pre><p>A SOAP API is a web service that uses SOAP as the communication protocol. It exposes a set of operations that can be invoked by clients using HTTP POST requests. The request and response are both encoded in XML, and the content of the message is defined using a Web Service Definition Language (WSDL) document.</p><h3>Setting up a SOAP API server</h3><p>To set up a SOAP API server, you need to define the operations that you want to expose and the data types that you want to use. You can do this using a WSDL document.</p><p>A WSDL document is an XML document that defines the operations and data types of a web service. It consists of four main parts: types, message, portType, and binding. The types element defines the data types used by the web service, the message element defines the input and output messages of the operations, the portType element defines the operations and their messages, and the binding element defines how the operations are mapped to the transport protocol (e.g., HTTP).</p><p>Here is an example of a WSDL document:</p><pre>&lt;definitions xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope/&quot;<br>             xmlns:tns=&quot;http://example.com/calculator&quot;<br>             xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;<br>             targetNamespace=&quot;http://example.com/calculator&quot;&gt;<br>  &lt;types&gt;<br>    &lt;xsd:schema&gt;<br>      &lt;xsd:element name=&quot;addRequest&quot; type=&quot;xsd:int&quot;/&gt;<br>      &lt;xsd:element name=&quot;addResponse&quot; type=&quot;xsd:int&quot;/&gt;<br>      &lt;xsd:element name=&quot;subtractRequest&quot; type=&quot;xsd:float&quot;/&gt;<br>      &lt;xsd:element name=&quot;subtractResponse&quot; type=&quot;xsd:float&quot;/&gt;<br>    &lt;/xsd:schema&gt;<br>  &lt;/types&gt;<br>  &lt;message name=&quot;addRequest&quot;&gt;<br>    &lt;part name=&quot;arg1&quot; type=&quot;xsd:int&quot;/&gt;<br>    &lt;part name=&quot;arg2&quot; type=&quot;xsd:int&quot;/&gt;<br>  &lt;/message&gt;<br>  &lt;message name=&quot;addResponse&quot;&gt;<br>    &lt;part name=&quot;result&quot; type=&quot;xsd:int&quot;/&gt;<br>  &lt;/message&gt;<br>  &lt;message name=&quot;subtractRequest&quot;&gt;<br>    &lt;part name=&quot;arg1&quot; type=&quot;xsd:float&quot;/&gt;<br>    &lt;part name=&quot;arg2&quot; type=&quot;xsd:float&quot;/&gt;<br>  &lt;/message&gt;<br>  &lt;message name=&quot;subtractResponse&quot;&gt;<br>    &lt;part name=&quot;result&quot; type=&quot;xsd:float&quot;/&gt;<br>  &lt;/message&gt;<br>  &lt;portType name=&quot;CalculatorPortType&quot;&gt;<br>    &lt;operation name=&quot;add&quot;&gt;<br>      &lt;input message=&quot;tns:addRequest&quot;/&gt;<br>      &lt;output message=&quot;tns:addResponse&quot;/&gt;<br>    &lt;/operation&gt;<br>    &lt;operation name=&quot;subtract&quot;&gt;<br>      &lt;input message=&quot;tns:subtractRequest&quot;/&gt;<br>      &lt;output message=&quot;tns:subtractResponse&quot;/&gt;<br>    &lt;/operation&gt;<br>  &lt;/portType&gt;<br>  &lt;binding name=&quot;CalculatorBinding&quot; type=&quot;tns:CalculatorPortType&quot;&gt;<br>    &lt;soap:binding style=&quot;rpc&quot; transport=&quot;http://schemas.xmlsoap.org/soap/http&quot;/&gt;<br>    &lt;operation name=&quot;add&quot;&gt;<br>      &lt;soap:operation soapAction=&quot;http://example.com/calculator#add&quot;/&gt;<br>      &lt;input&gt;<br>        &lt;soap:body use=&quot;encoded&quot; namespace=&quot;http://example.com/calculator&quot;<br>                   encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;/&gt;<br>      &lt;/input&gt;<br>      &lt;output&gt;<br>        &lt;soap:body use=&quot;encoded&quot; namespace=&quot;http://example.com/calculator&quot;<br>                   encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;/&gt;<br>      &lt;/output&gt;<br>    &lt;/operation&gt;<br>    &lt;operation name=&quot;subtract&quot;&gt;<br>      &lt;soap:operation soapAction=&quot;http://example.com/calculator#subtract&quot;/&gt;<br>      &lt;input&gt;</pre><p>Once you have defined the WSDL document, you can implement the web service using a programming language of your choice. There are several frameworks and libraries available that can help you build a SOAP API server quickly. Some popular options include Apache CXF for Java, Zato for Python, and ASP.NET for .NET.</p><p>Once you have implemented the web service, you can deploy it on a web server and make it available to clients over the Internet.</p><h3>Making SOAP API requests using cURL</h3><p>cURL is a command-line utility that allows you to make HTTP requests from the terminal. It can be used to make SOAP API requests by specifying the Content-Type and SOAPAction headers and the XML payload in the request body.</p><p>Here is an example of a SOAP API request using cURL:</p><pre>curl -X POST \<br>  https://example.com/soap-api \<br>  -H &#39;Content-Type: text/xml; charset=utf-8&#39; \<br>  -H &#39;SOAPAction: &quot;http://example.com/soap-api#operation&quot;&#39; \<br>  -d &#39;&lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope/&quot;&gt;<br>  &lt;soap:Body&gt;<br>    &lt;operation xmlns=&quot;http://example.com/soap-api&quot;&gt;<br>      &lt;arg1&gt;value1&lt;/arg1&gt;<br>      &lt;arg2&gt;value2&lt;/arg2&gt;<br>    &lt;/operation&gt;<br>  &lt;/soap:Body&gt;<br>&lt;/soap:Envelope&gt;&#39;</pre><p>In this example, we are making a POST request to the https://example.com/soap-api endpoint with the Content-Type header set to text/xml and the SOAPAction header set to the operation defined in the WSDL document. The request body contains the SOAP message encoded in XML.</p><h3>Consuming SOAP API using a programming language</h3><p>To consume a SOAP API using a programming language, you need to parse the WSDL document to generate the client-side code. There are several tools available that can do this for you, such as wsdl2java for Java and wsdl2py for Python.</p><p>Once you have generated the client-side code, you can use it to invoke the operations exposed by the web service. The client-side code typically provides a method for each operation with the appropriate parameters and return type.</p><p>Here is an example of consuming a SOAP API using Python:</p><p>from suds.client import Client</p><pre>from suds.client import Client<br><br>client = Client(&quot;http://example.com/soap-api?wsdl&quot;)<br>result = client.service.operation(arg1=&quot;value1&quot;, arg2=&quot;value2&quot;)<br>print(result)</pre><p>n this example, we are using the suds library to parse the WSDL document and generate the client-side code. The Client class is used to create a client instance, and the service attribute is used to access the operations exposed by the web service. We can then call the operation() method with the appropriate parameters to invoke the operation and print the result.</p><h3>Conclusion</h3><p>In this article, we discussed how to get started with SOAP API. We covered the basics of SOAP and how it works, how to set up a SOAP API server, how to make SOAP API requests, and how to consume a SOAP API using a programming language.</p><p>SOAP is a powerful protocol that allows programs to communicate with each other using the Internet. It is widely used in the integration of web-based systems and is supported by a variety of programming languages.</p><p>To get started with SOAP API, you need to define the operations and data types of your web service using a WSDL document. You can then implement the web service using a programming language of your choice and deploy it on a web server. To make SOAP API requests, you can use cURL or a programming language. To consume a SOAP API, you need to generate the client-side code from the WSDL document and use it to invoke the operations exposed by the web service.</p><p>I hope this article has helped you understand how to get started with SOAP API. If you have any questions or comments, please let me know in the comments section below.</p><p>My Fiverr GIG for web development you can order here</p><p>Check out my Gig on Fiverr: create web application using react, angular, node, springboot and any framework <a href="https://www.fiverr.com/share/69d8wR">https://www.fiverr.com/share/69d8wR</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=652f1fdca313" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stack Data Structure in programming]]></title>
            <link>https://medium.com/@nishannishankar/stack-data-structure-in-programming-be218bc0c090?source=rss-5ea79f83594e------2</link>
            <guid isPermaLink="false">https://medium.com/p/be218bc0c090</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[stack]]></category>
            <dc:creator><![CDATA[Charlie]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 19:09:32 GMT</pubDate>
            <atom:updated>2023-01-03T19:09:32.733Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJjA9aGDFVBDHArwaa8I-w.jpeg" /></figure><p>Stack is a linear data structure that follows a last-in, first-out (LIFO) principle. It means that the element which is added last to the stack will be the first one to be removed from it. This structure is useful in various programming scenarios, such as implementing function calls and maintaining history. In this article, we will discuss how to use stack for programming with three code examples in Python.</p><h3>Example 1: Implementing function calls</h3><p>Consider a scenario where you have a function foo() that calls another function bar(). When bar() is called, it may further call another function baz(). This creates a chain of function calls, with baz() at the bottom and foo() at the top.</p><p>We can use a stack to keep track of these function calls. Whenever a function is called, we can push its name onto the stack. When the function returns, we can pop its name from the stack. This way, we can maintain a record of the sequence of function calls.</p><p>Here is an example implementation in Python:</p><p>stack = []</p><p>def foo():<br> stack.append(“foo”)<br> bar()</p><p>def bar():<br> stack.append(“bar”)<br> baz()</p><p>def baz():<br> stack.append(“baz”)</p><p>foo()</p><p>print(stack) # Output: [“foo”, “bar”, “baz”]</p><p>In this example, we have defined three functions foo(), bar(), and baz(). The function foo() calls bar(), which in turn calls baz(). As a result, the names of these functions are pushed onto the stack in the sequence foo, bar, baz.</p><h3>Example 2: Reversing a string</h3><p>We can use a stack to reverse a string. The idea is to push each character of the string onto the stack, and then pop them one by one to form the reversed string.</p><p>Here is an example implementation in Python:</p><p>def reverse_string(s):<br> stack = []<br> for ch in s:<br> stack.append(ch)<br> reversed_string = “”<br> while stack:<br> reversed_string += stack.pop()<br> return reversed_string</p><p>print(reverse_string(“hello”)) # Output: “olleh”</p><p>In this example, we have defined a function reverse_string() that takes a string as input and returns the reversed string. The function first pushes each character of the string onto the stack. Then, it pops the characters one by one and concatenates them to form the reversed string.</p><h3>Example 3: Balancing parentheses</h3><p>We can use a stack to check if a given string has balanced parentheses. The idea is to push an opening parenthesis onto the stack when it is encountered, and pop it when a closing parenthesis is encountered. At the end, the stack should be empty if the parentheses are balanced.</p><p>Here is an example implementation in Python:</p><p>def is_balanced(s):<br> stack = []<br> for ch in s:<br> if ch in (“(“, “[“, “{“):<br> stack.append(ch)<br> elif ch in (“)”, “]”, “}”):<br> if not stack:<br> return False<br> top = stack.pop()<br> if (top, ch) not in ((“(“, “)”), (“[“, “]”), (“{“, “}”)):<br> return False<br> return not stack</p><p>print(is_balanced(“(a+b)”)) # Output: True<br>print(is_balanced(“(a+b”)) # Output: False<br>print(is_balanced(“[a+b]”)) # Output: True<br>print(is_balanced(“{a+b}”)) # Output: True<br>print(is_balanced(“a+b}”)) # Output: False</p><p>In this code, we have defined a function is_balanced() that takes a string as input and returns a Boolean value indicating if the parentheses are balanced. The function iterates over the characters of the string and uses a stack to keep track of the opening parentheses. If a closing parenthesis is encountered, it checks if the corresponding opening parenthesis is at the top of the stack. If it is not, or if the stack is empty, it returns False. At the end, it returns True if the stack is empty and False otherwise.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be218bc0c090" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>