<?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: Shenouda Fawzy</title>
    <description>The latest articles on DEV Community by Shenouda Fawzy (@shenoudafawzy).</description>
    <link>https://dev.to/shenoudafawzy</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%2F1361149%2F2fd22b76-692b-46d4-a8c3-623bad6e4021.jpeg</url>
      <title>DEV Community: Shenouda Fawzy</title>
      <link>https://dev.to/shenoudafawzy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shenoudafawzy"/>
    <language>en</language>
    <item>
      <title>Tiny Checks, Massive Impact</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Fri, 20 Jun 2025 07:43:12 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/tiny-checks-massive-impact-c36</link>
      <guid>https://dev.to/shenoudafawzy/tiny-checks-massive-impact-c36</guid>
      <description>&lt;p&gt;Straight to the point — whenever I build a system, the very first thing I implement is a health check for all critical infrastructure components.&lt;/p&gt;

&lt;p&gt;I ping the database. I ping Redis. Just simple, lightweight checks.&lt;/p&gt;

&lt;p&gt;They may seem minor, but skipping them can lead to serious consequences. At best, you get a false sense that everything is working fine. At worst, the system enters an inconsistent state that's painful to debug and even harder to recover from.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>backend</category>
    </item>
    <item>
      <title>AI Built My Landing Page — I Didn’t Write a Single Line of Code</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Sat, 26 Apr 2025 04:36:24 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/ai-built-my-landing-page-i-didnt-write-a-single-line-of-code-1lf1</link>
      <guid>https://dev.to/shenoudafawzy/ai-built-my-landing-page-i-didnt-write-a-single-line-of-code-1lf1</guid>
      <description>&lt;p&gt;I opened my browser, launched ChatGPT and Claude, and watched as they built my product idea... with zero code from me.&lt;/p&gt;




&lt;p&gt;A friend of mine wanted to build an email verification API — a simple service that checks whether an email is real (i.e., not disposable and can receive messages).&lt;/p&gt;

&lt;p&gt;Now, I'm a backend guy. I literally don’t know how to center a div.&lt;/p&gt;

&lt;p&gt;But I thought... why not try this thing people call "vibe coding"?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s Vibe Coding?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Basically the AI is the pilot and the human (that case me) is the copilot.&lt;/p&gt;

&lt;p&gt;So, I put myself in the shoe of the customer, were the customer knows nothing about writing code or IDEs. &lt;/p&gt;

&lt;p&gt;Therefore, I opened up my browser and launched two free AI models side-by-side, ChatGPT-4 (o4) and Claude Sonnet 3.7.&lt;/p&gt;

&lt;p&gt;No code editors. No local setup. Just me, the browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Goal&lt;/strong&gt;&lt;br&gt;
I wanted to build a clean, simple landing email validation API service (&lt;a href="https://sweepemails.com/" rel="noopener noreferrer"&gt;https://sweepemails.com/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To the Action&lt;/strong&gt;&lt;br&gt;
I needed to bound the AI model to a context and steer down the conversation to reach to the point of designing the landing page.&lt;/p&gt;

&lt;p&gt;Therefore, I started with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If I'm going to develop an API service that checks for fake emails, who are the top 3 audiences that would benefit from it the most?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ChatGPT replied with, E-commerce SaaS products, Online communities and newsletters, ... etc&lt;br&gt;
And it even suggested me on positioning the product, which I have no clue what does mean, but it turns out is listing of core features, customer pain points and target customers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Landing page attempt&lt;/strong&gt;&lt;br&gt;
And then things started kicks in, when it suggested to me to build a landing page.&lt;br&gt;
I answered:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes, build a landing page and include the API usage as tabs for cURL, Go, JS, and Python, with syntax highlighting&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="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%2F4olkajvb9h3lij302kao.png" class="article-body-image-wrapper"&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%2F4olkajvb9h3lij302kao.png" alt="Initial attempt" width="756" height="478"&gt;&lt;/a&gt;&lt;br&gt;
As you can see... it's not pretty. Functional? Sure. But not something that screams, “Use me!” It’s more like “a developer built this at 2 AM.". I don't know why it does it like that, does it know that I'm a backend guys, so it tries to mimic me =D.&lt;/p&gt;

&lt;p&gt;Now it's turn for the coding beast, Claude Sonnet 3.7&lt;/p&gt;

&lt;p&gt;I guess this article is already too long, so the next article will cover converting this ugly landing page to one that is more beautiful and neat.&lt;/p&gt;

&lt;p&gt;This will be the end results, and I literally didn't write single line of code myself.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2F2a6adhp1ym5b28w2iw33.png" class="article-body-image-wrapper"&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%2F2a6adhp1ym5b28w2iw33.png" alt="Final result after using Claude Sonnet" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're someone like me (a backend dev who’s allergic to CSS), that is good for us.&lt;/p&gt;

</description>
      <category>vibecoding</category>
      <category>nocode</category>
      <category>ai</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Thoughts on AI while debugging</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Sat, 08 Feb 2025 12:33:43 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/thoughts-on-ai-while-debugging-1h64</link>
      <guid>https://dev.to/shenoudafawzy/thoughts-on-ai-while-debugging-1h64</guid>
      <description>&lt;p&gt;Recently, I was exploring message brokers, particularly Kafka, leveraging Docker Compose for the setup. Among the services utilized was Kafdrop, a dashboard facilitating the monitoring of Kafka topics and partitions. While the publisher functioned seamlessly, encountering networking challenges within the Docker services hindered the loading of events in the Kafdrop dashboard.&lt;/p&gt;

&lt;p&gt;I know that service name can be used as host url to connect with within the application as well as other siblings containers withing the compose. But that didn't work out. &lt;/p&gt;

&lt;p&gt;So, I head directly to AI Copilot specifically as it is already installed on my vscode. Given it has access to work space therefore the context as well.&lt;br&gt;
Spent more than hour, but couldn't get the Kafdrop work.&lt;/p&gt;

&lt;p&gt;Then I've tried Claud, which give me the fix which turns out it's an env variables with Kafka to let it connect to both publisher as well as Kafdrop.&lt;/p&gt;

&lt;p&gt;Telling this story to pinpoint something, that is with the emerge of LLMs and every couple of days we see new LLM coming. Now instead of just Googling and looking for Stackoverflow answers, I spend time trying to different LLMs, I was lucky that I tried Claud as my second shot, who know if I tried other LLMs would I get the fix immediately. &lt;/p&gt;

&lt;p&gt;This brings me to a conclusion, at this stage, I'm in a loophole, which means yesterday I was spending time looking for the answer on Google/stackoverflow, now I'm spending time shopping around trying different LLMs hoping to get an answer fixing my issue. Not sure, with new LLMs coming each day, are we really saving time using LLMs looking for the correct answer?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>kafka</category>
      <category>docker</category>
    </item>
    <item>
      <title>Debugging missing records Golang and CSV</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Wed, 30 Oct 2024 19:27:35 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/the-mystery-of-missing-records-debugging-a-json-to-csv-transformation-in-go-n6</link>
      <guid>https://dev.to/shenoudafawzy/the-mystery-of-missing-records-debugging-a-json-to-csv-transformation-in-go-n6</guid>
      <description>&lt;p&gt;During my work on building a utility for data transformation on one of my side projects, I needed to convert a JSON-formatted file into CSV format. I ran into a tricky issue that took nearly an hour to debug before identifying the root cause.&lt;/p&gt;

&lt;p&gt;The process should have been simple, consisting of three main steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the JSON file&lt;/li&gt;
&lt;li&gt;Parse that JSON file into a specific struct&lt;/li&gt;
&lt;li&gt;Write the data to a CSV file
First, to give you an idea, the JSON is an array with 65,342 elements.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;JsonToCSV&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;SrcSheet&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// Create file name in a format like "email_241030172647.csv" (email_yymmddhhmmss.csv)&lt;/span&gt;
    &lt;span class="n"&gt;fName&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c"&gt;// Create file&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Unable to create file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c"&gt;// Closing to release resources&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c"&gt;// Initializing CSV writer&lt;/span&gt;

    &lt;span class="c"&gt;// Add header&lt;/span&gt;
    &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"added_on"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Unable to write header"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;elm&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Email&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newRecord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;elm&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Unable to add new record"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Number of records written ="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;newRecord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;SrcElements&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;DBFormat&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"2006-01-02 15:04:05.000"&lt;/span&gt;
    &lt;span class="n"&gt;addedOn&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DBFormat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;addedOn&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;The code is straightforward: create a new file with a specific name format, defer its closing, initialize the CSV writer, and start writing to the file. Super simple, right?&lt;/p&gt;

&lt;p&gt;Steps 1 and 2 worked well, so omitted them. Let’s shift focus to step 3, where something unexpected happened: the CSV output contained only 65,032 records, meaning 310 records were missing.&lt;/p&gt;

&lt;p&gt;To troubleshoot, I tried the code with just 7 JSON elements instead of 65,032. Surprisingly, nothing was written to the CSV file at all!&lt;/p&gt;

&lt;p&gt;I double-checked for simple mistakes, like missing file closure, but everything looked fine. I then retried with the full 65,032 elements, hoping to get more clues. That’s when I noticed that not only were 310 records missing, but the last record was incomplete as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;65030 adam@gmail.com, gmail, 2023-03-17 15:04:05.000
65031 jac@hotmail.com, hotmail, 2023-03-17 15:04:05.000
65032 nancy@xyz.com, hotmail, 2023-03-
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was progress—I could now narrow down the issue and focus on &lt;code&gt;w.Write(newRecord(domain, elm))&lt;/code&gt;, specifically the &lt;code&gt;w.Write(...)&lt;/code&gt; method. I checked the documentation and found the reason:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;... Writes are buffered, so [Writer.Flush] must eventually be called to ensure that the record is written to the underlying io.Writer ...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I had forgotten to call &lt;code&gt;w.Flush()&lt;/code&gt;. This made sense since, from a performance perspective, the CSV writer buffers writes instead of executing I/O operations every time &lt;code&gt;w.Write()&lt;/code&gt; is called. By buffering data, it reduces the I/O load, and calling &lt;code&gt;w.Flush()&lt;/code&gt; at the end ensures any remaining data in the buffer is written to the file.&lt;/p&gt;

&lt;p&gt;Here’s the corrected code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Unable to create file"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Flush&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c"&gt;// Add header&lt;/span&gt;
    &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"added_on"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To confirm, I checked the &lt;a href="https://cs.opensource.google/go/go/+/master:src/bufio/bufio.go;l=19?q=bufio&amp;amp;ss=go%2Fgo" rel="noopener noreferrer"&gt;bufio.go&lt;/a&gt; source code and found that the default buffer size is 4K. In the &lt;code&gt;WriteRune(...)&lt;/code&gt; method, you’ll see that it calls Flush whenever the buffer reaches its limit.&lt;/p&gt;

&lt;p&gt;That’s all! I hope you enjoyed reading. I tend to learn a lot from mistakes—whether mine or others’. Even if there’s no immediate fix, discovering a wrong approach helps me avoid similar pitfalls in the future. That’s why I wanted to share this experience!&lt;/p&gt;

</description>
      <category>go</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Your first PR on your recently joined company</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Fri, 21 Jun 2024 15:11:36 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/your-first-pr-on-your-recently-joined-company-1eae</link>
      <guid>https://dev.to/shenoudafawzy/your-first-pr-on-your-recently-joined-company-1eae</guid>
      <description>&lt;p&gt;Joining a new company can be challenging. You may feel like everyone is watching you and has high expectations. This can be stressful, especially at the beginning.&lt;/p&gt;

&lt;p&gt;Here is a simple pull request (PR) you can make during your first couple of weeks as a new joiner. In the software industry, you will often be introduced to an existing codebase and need to run it on your local setup. This process can be straightforward, like running &lt;code&gt;make start&lt;/code&gt; or &lt;code&gt;npm start&lt;/code&gt;, etc. If it runs smoothly, that's great.&lt;/p&gt;

&lt;p&gt;But if it doesn't, you'll likely need to dig deep to get it to work. This may involve installing some dependencies, such as Redis, among others. This is where you will shine.&lt;/p&gt;

&lt;p&gt;Take note of every step and action you take to make it work. Finally, refine those steps and update the repository's README file (&lt;em&gt;or create a new one if it doesn't exist&lt;/em&gt;). Then, make a PR with that change.&lt;/p&gt;

&lt;p&gt;This not only helps others who join after you but also breaks the ice for you.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>software</category>
    </item>
    <item>
      <title>My effective approach to explore new codebase</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Sat, 08 Jun 2024 08:21:39 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/my-effective-approach-to-explore-new-codebase-3173</link>
      <guid>https://dev.to/shenoudafawzy/my-effective-approach-to-explore-new-codebase-3173</guid>
      <description>&lt;p&gt;Whenever I explore a new codebase, whether it is open source or not, I look for three things:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to log my first "Hello, World!" message&lt;/strong&gt;&lt;br&gt;
This serves as my flashlight, helping me explore and tinker with different parts of the codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are there any background tasks/jobs?&lt;/strong&gt;&lt;br&gt;
This is crucial because these tasks can cause unexpected behavior. For example, I might wonder why a certain part isn't working as expected, only to find out later that a background worker is flipping some field after a few minutes. Understanding this can prevent a lot of frustration and confusion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The configurations&lt;/strong&gt;&lt;br&gt;
To see if there is any third party services is being used and have an idea about those third party services. Or port number that could conflict with existing one.&lt;/p&gt;

&lt;p&gt;This approach has never failed me, whether the codebase is spaghetti or a piece of cake.&lt;/p&gt;

</description>
      <category>go</category>
      <category>software</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Using UTC time in Golang slog</title>
      <dc:creator>Shenouda Fawzy</dc:creator>
      <pubDate>Mon, 18 Mar 2024 07:16:25 +0000</pubDate>
      <link>https://dev.to/shenoudafawzy/using-utc-time-in-golang-slog-151n</link>
      <guid>https://dev.to/shenoudafawzy/using-utc-time-in-golang-slog-151n</guid>
      <description>&lt;p&gt;Go introduced slog in Go1.21. That makes logging more flexible and consistent. And when I tried to use it on one of my side projects I found that it logs the time in local timezone, which isn't the best choice for me. Cause for example, I may own a server machine at Stockholm and I live in Egypt, that case when the logs is written, it will be logged in UTC+1 &lt;em&gt;(Stockholm Time)&lt;/em&gt;, however Egypt is UTC+2. So, I had to interpret it in my mind every time I read a log line. This is tedious. Not only that, imagine a team scattered around the globe, each one will try to do the interpenetration his own. And even sharing log lines won't be efficient for the same reason.&lt;/p&gt;

&lt;p&gt;Therefore, a UTC would solve that issue, and wherever I'm located, we will going interpret it straight forward. So, tried to find out how this can be done. But didn't, even asked GPT models, but didn't give me answer &lt;em&gt;(at least the free one)&lt;/em&gt; But finally I manged to make it. Here is a full working go program that writes log in UTC time. Further more, it write it in a secure way. The key player here is the &lt;code&gt;ReplaceAttr&lt;/code&gt; function in the slog. Where you can override certain log message.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"log/slog"&lt;/span&gt;
    &lt;span class="s"&gt;"os"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cardPan&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"4701322211111234"&lt;/span&gt;
    &lt;span class="n"&gt;cardCvv&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"789"&lt;/span&gt;
    &lt;span class="n"&gt;secLog&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;SecureLogger&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;secLog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"This is secure logger"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"secret"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cardPan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"secret"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cardCvv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c"&gt;// time=2024-02-17T15:52:01.119Z level=INFO msg="This is secure logger" secret=47013######11234 secret=***&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// SecureLogger write logs in a secure way in UTC time&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;SecureLogger&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Logger&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;l&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewTextHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Stdout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerOptions&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;ReplaceAttr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;groups&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Attr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Attr&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Key&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"time"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AnyValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Key&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"secret"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c"&gt;// This is probably a card pan, so we can only reveal&lt;/span&gt;
                &lt;span class="c"&gt;// The first 5 and last 5 and the rest can be masked with #&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;16&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;pan&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                    &lt;span class="n"&gt;first5&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;pan&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                    &lt;span class="n"&gt;last5&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;pan&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="m"&gt;11&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                    &lt;span class="n"&gt;masked&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;first5&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"######"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;last5&lt;/span&gt;
                    &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StringValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;masked&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StringValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"***"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;slog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Each log entry has built-in keys which is &lt;code&gt;time&lt;/code&gt;, &lt;code&gt;level&lt;/code&gt; and &lt;code&gt;message&lt;/code&gt;. So I override the &lt;code&gt;time&lt;/code&gt; one.&lt;br&gt;
And introduced new &lt;code&gt;secret&lt;/code&gt; key, which supposed to be used for logging sensitive elements.&lt;/p&gt;

&lt;p&gt;And that's all!&lt;/p&gt;

</description>
      <category>go</category>
      <category>slog</category>
      <category>logging</category>
    </item>
  </channel>
</rss>
