<?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>Forem: asim-builds</title>
    <description>The latest articles on Forem by asim-builds (@asimbuilds).</description>
    <link>https://forem.com/asimbuilds</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%2F3250507%2Ff0e5af1b-f130-4dec-97ac-2eb4ffe72672.png</url>
      <title>Forem: asim-builds</title>
      <link>https://forem.com/asimbuilds</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/asimbuilds"/>
    <language>en</language>
    <item>
      <title>Building a Dumb Sensor Simulator in C (That Taught Me How I Took Python For Granted)</title>
      <dc:creator>asim-builds</dc:creator>
      <pubDate>Mon, 14 Jul 2025 13:45:12 +0000</pubDate>
      <link>https://forem.com/asimbuilds/building-a-dumb-sensor-simulator-in-c-that-taught-me-how-i-took-python-for-granted-49f5</link>
      <guid>https://forem.com/asimbuilds/building-a-dumb-sensor-simulator-in-c-that-taught-me-how-i-took-python-for-granted-49f5</guid>
      <description>&lt;p&gt;Ever since I have build hobby projects using Arduino, I have been fascinated by how embedded systems process real-world data in real time. Since I was interested in embedded systems, I picked up C and started to read theory. But learning by reading was just boring to me and most of the concepts went straight to my head. So I decided to do something practical: Do a mini project that I can talk about. So I decided to create a "sensor simulator". Here is my journey of the mini project, what I learned at each step, what was hard, and where I am taking it next!!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 1: Basic Dumb Simulator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first step was to simulate reading sensor data from a CSV file.&lt;br&gt;
So I did the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read sensor values from a CSV file.&lt;/li&gt;
&lt;li&gt;Scaled the values to reflect real-world readings.&lt;/li&gt;
&lt;li&gt;Stored the values in an array.&lt;/li&gt;
&lt;li&gt;Calculated basic stats: average, min, max, and sum.&lt;/li&gt;
&lt;li&gt;Printed alerts if any values crossed defined thresholds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Key Learnings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic file handling in C (using fopen, fscanf, etc.).&lt;/li&gt;
&lt;li&gt;Using arrays and practicing both indexing and pointer arithmetic.&lt;/li&gt;
&lt;li&gt;Implementing structs to represent sensor data and thresholds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The hardest part here was switching from indexing (arr[i]) to pure pointer arithmetic (*(arr + i)). At first, it felt unintuitive, but after forcing myself to do it, I got a much better understanding of how memory works in C.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 2: Real-Time Data Processing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, I wanted to make the simulator feel "alive" by processing data in real time. Here is what I did:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implemented a loop that reads values every second (using sleep).&lt;/li&gt;
&lt;li&gt;Continuously updated alerts and recalculated stats.&lt;/li&gt;
&lt;li&gt;Allowed the user to change threshold values at runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Key Learnings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simulating real-time behavior taught me about timing, delays, and how to keep a loop responsive.&lt;/li&gt;
&lt;li&gt;Using structs to pass around stats instead of using many global variables.&lt;/li&gt;
&lt;li&gt;Starting to modularize the code into functions and (later) separate files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The biggest challenge here was avoiding to write everything in the main function. I had to force myself to split code into smaller, manageable chunks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 3: Control Logic &amp;amp; Event Simulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The final phase was about making the simulator act like a simple control system. Here is what I did:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Added control outputs based on sensor data (e.g., turn on a "fan", "heater", or an "LED" — printed to console for now).&lt;/li&gt;
&lt;li&gt;Added a switch-case menu for the user to choose between simulation, stats, or updating thresholds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;What's next? *&lt;/em&gt;&lt;br&gt;
While I was working through pointers, index arithmetic, and splitting code into multiple functions in C, I couldn’t help but think about how much easier all of this felt in Python.&lt;/p&gt;

&lt;p&gt;When I was first learning Python, I thought lists, dictionaries, and their methods were hard. But now, I realize I hadn’t even scratched the surface.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;In Python, to add an element to an existing list, I can simply do this:&lt;br&gt;
&lt;code&gt;my_list.append(42)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In C, I have to manually manage memory and handle resizing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (size == capacity) {
    capacity *= 2;
    arr = realloc(arr, capacity * sizeof(int));
}
arr[size++] = 42;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Working in C made me appreciate how many things Python quietly takes care of for us — dynamic arrays (lists), memory management, high-level abstractions.&lt;/p&gt;

&lt;p&gt;This also led me to question something important:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I actually love embedded systems and low-level coding, or was it just the excitement of hobby projects (where I didn’t have to think too deeply about memory and pointers) that I enjoyed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I think it’s good to ask this question now rather than blindly keep "learning C" just because it sounds cool or "hardcore."&lt;/p&gt;

&lt;p&gt;So, my plan is to go one step further: I’ll dive head first into programming actual hardware (like microcontrollers), and see if I truly enjoy embedded systems when I get to interact with real-world components.&lt;/p&gt;

&lt;p&gt;This isn’t just about syntax anymore — it’s about finding out what kind of work excites me most, what kind of bugs I can tolerate, and what challenges keep me coming back instead of burning me out.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>cpp</category>
      <category>c</category>
      <category>iot</category>
    </item>
    <item>
      <title>I built a File Sharing App in Python (with Auto Discovery + Drag &amp; Drop). Here is what I learned.</title>
      <dc:creator>asim-builds</dc:creator>
      <pubDate>Sat, 07 Jun 2025 04:24:57 +0000</pubDate>
      <link>https://forem.com/asimbuilds/i-built-a-file-sharing-app-in-python-with-auto-discovery-drag-drop-here-is-what-i-learned-1dol</link>
      <guid>https://forem.com/asimbuilds/i-built-a-file-sharing-app-in-python-with-auto-discovery-drag-drop-here-is-what-i-learned-1dol</guid>
      <description>&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8hjkxxvvrslj35b4ta21.jpg" alt="Screenshot of Python"&gt;
&lt;/h2&gt;

&lt;p&gt;Hi everyone! 👋&lt;br&gt;
I recently completed a weekend project: a Python-based file sharing app that works over local networks. I built it to deepen my understanding of networking and have a bit of fun with Python and its libraries (sockets). This post is a quick walkthrough of my project, what it can do, how I built it and what I learned in the process.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;What the App Does&lt;/strong&gt;&lt;br&gt;
Here's a breakdown of the features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Graphical Interface (Tkinter) -&amp;gt; Has one tab for sender and one tab for receiver.&lt;/li&gt;
&lt;li&gt;Sender Side -&amp;gt; The sender side has the following features: &lt;strong&gt;Auto-discovers&lt;/strong&gt; hosts on the local network, manual ip entry if preferred, port  selection, drag and drop support, manual file browsing, and file integrity check using hash verification.&lt;/li&gt;
&lt;li&gt;Receiver Side -&amp;gt; The receiver side has the following features: Choose listening port, selecting folder to save received files and start/stop receiving buttons.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This project uses &lt;strong&gt;socket&lt;/strong&gt;, &lt;strong&gt;threading&lt;/strong&gt;, &lt;strong&gt;tkinterdnd2&lt;/strong&gt;, and a few other standard Python libraries - no external dependencies.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Why I built it?&lt;/strong&gt;&lt;br&gt;
Honestly? I had a free weekend and an immense desire to finally do something with Python and networking — not just read about it. In the past, I’d &lt;strong&gt;spend hours&lt;/strong&gt; going through tutorials, blog posts, or watching videos, but I rarely built anything concrete. I’d get stuck in the cycle of consuming information without ever putting it into practice. I’ve had many project ideas over the years — cool concepts and fun challenges I wanted to build. But more often than not, the GitHub repos ended up empty or abandoned. Why? Because I got stuck in &lt;strong&gt;perfectionism&lt;/strong&gt;. I wanted to do everything myself, from designing to coding to testing, without asking for help or using any shortcuts. I thought that was the only “right” way to learn and grow. But this mindset became a huge barrier.&lt;br&gt;
It held me back from actually finishing projects and sharing my work. Instead of progress, I got stuck in endless tweaking, doubting, and self-criticism.&lt;/p&gt;

&lt;p&gt;This time, I wanted to break that habit. I decided: No overthinking. No waiting for the "perfect" idea. Just build something practical that works.&lt;/p&gt;

&lt;p&gt;I’ve always enjoyed working with Python — not because I want to be a full-time developer again, but because it’s flexible, elegant, and fun. I also wanted to understand how real-world networking worked under the hood — sockets, broadcasting, file streams, ports — all those concepts that I’d read about but never truly internalized.&lt;/p&gt;

&lt;p&gt;So I picked a challenge that would combine both: a local file-sharing app. It was a perfect blend of GUI work, sockets, and system-level communication — and it gave me a tangible reason to dive into networking from a hands-on perspective.&lt;/p&gt;

&lt;p&gt;It wasn’t always smooth sailing — I ran into weird VM issues, firewall rules, and networking quirks — but that was the whole point: to learn by doing. And I’m glad I did&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;What I learned?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Broadcasting can be tricky with VMs. I tested the code with my laptop and VM and learned that  doesn't always work between VMs and host machines. I solved it by using custom broadcast ip (192.168.1.255) as  a fallback mechanism.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not everything works magically. It might work in test environment but when experimenting in real world, some things break, some policies are enforced and so on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using GitHub copilot helped speed things up, but I still had to debug, refactor, and stitch logic together across files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To divide the apps into modules. Every project I did before had all the code in a single main.py file but this time I decided to break things up. I especially did this because there was one of my specific personal project whose debugging became a nightmare to me because all the code was piled into a single file. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;🔗GitHub Repository&lt;/strong&gt;&lt;br&gt;
You can check out the full code here:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/asim-builds" rel="noopener noreferrer"&gt;
        asim-builds
      &lt;/a&gt; / &lt;a href="https://github.com/asim-builds/File-Share" rel="noopener noreferrer"&gt;
        File-Share
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A simple file share project using python
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;📁 Python File Share&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;A simple yet powerful &lt;strong&gt;peer-to-peer file sharing app&lt;/strong&gt; built in Python! Works across devices on the same network.&lt;/p&gt;
&lt;p&gt;Supports:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ One-to-one file transfers&lt;/li&gt;
&lt;li&gt;✅ Auto host discovery&lt;/li&gt;
&lt;li&gt;✅ Drag &amp;amp; Drop interface&lt;/li&gt;
&lt;li&gt;✅ Multiple file transfers&lt;/li&gt;
&lt;li&gt;✅ Transfer progress tracking&lt;/li&gt;
&lt;li&gt;✅ File integrity check using SHA-256&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🎯 Features&lt;/h2&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;📤 &lt;strong&gt;Sender Tab&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Select files via file browser or drag &amp;amp; drop&lt;/li&gt;
&lt;li&gt;Enter host manually or use &lt;strong&gt;Auto Discover&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Custom destination filename&lt;/li&gt;
&lt;li&gt;Configurable port&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;📥 &lt;strong&gt;Receiver Tab&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Choose save location&lt;/li&gt;
&lt;li&gt;Start/Stop receiving with one click&lt;/li&gt;
&lt;li&gt;Set listening port&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;🔍 &lt;strong&gt;Host Discovery&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Scan and list available hosts on the network&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;📊 &lt;strong&gt;Transfer Progress&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Real-time file transfer status and logs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;🔐 &lt;strong&gt;Integrity Check&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Uses SHA-256 to verify the file was transferred without corruption&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;📁 &lt;strong&gt;Multi-file Support&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Send multiple files in one go (automatically zipped)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;📸 Screenshots&lt;/h2&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/asim-builds/File-Share/assets/sender_tab.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fasim-builds%2FFile-Share%2Fassets%2Fsender_tab.png" alt="alt text"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/asim-builds/File-Share/assets/receiver_tab.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fasim-builds%2FFile-Share%2Fassets%2Freceiver_tab.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🚀 Getting Started&lt;/h2&gt;

&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;✅ Requirements&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Python 3.7+&lt;/li&gt;
&lt;li&gt;Cross-platform (Windows/Linux/macOS)&lt;/li&gt;
&lt;li&gt;No internet connection required (runs…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/asim-builds/File-Share" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;





&lt;p&gt;&lt;strong&gt;🧠Final Thoughts&lt;/strong&gt;&lt;br&gt;
I used to be scared of sharing my work - afraid of being judged, being seen or that my project wasn't good enough. But you know what? I had fun, I learned a lot and I am allowed to enjoy small victories even if its small. That's what matters. If you're learning Python or want to explore socket programming, I hope this inspires you to build something small and meaningful.&lt;br&gt;
Let me know what you think - I'd love your feedback.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Photo Credits: Photo by Rubaitul Azad on Unsplash&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>productivity</category>
      <category>sideprojects</category>
    </item>
  </channel>
</rss>
