<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tech on The Smoking Duck Blog</title><link>https://blog.aabouzied.com/blog/tech/</link><description>Recent content in Tech on The Smoking Duck Blog</description><generator>Hugo</generator><language>en-US</language><copyright>Copyright © 2021, Ahmed Abouzied.</copyright><lastBuildDate>Wed, 07 Oct 2026 04:34:55 +0200</lastBuildDate><atom:link href="https://blog.aabouzied.com/blog/tech/index.xml" rel="self" type="application/rss+xml"/><item><title>goprove: A prover for Golang</title><link>https://blog.aabouzied.com/goprove-a-prover-for-golang/</link><pubDate>Thu, 26 Mar 2026 00:00:00 +0000</pubDate><guid>https://blog.aabouzied.com/goprove-a-prover-for-golang/</guid><description>&lt;p&gt;Now that AI is writing a lot of production code. We need to have as many checks and validators as possible to validate the code AI writes. That&amp;rsquo;s why I want to share &amp;ldquo;goprove&amp;rdquo;. A project I have been cooking for more than a month (by hand, AI helped a lot with testing for edge cases though).&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://goprove.dev/"&gt;goprove.dev&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;It&amp;rsquo;s a &amp;ldquo;prover&amp;rdquo; for Golang. A prover that mathematically proves that your Go code is safe against certain issues such as nil pointer panics and integer overflows. Go was not built for safe mission-critical software. You will not be building a medical ICU monitor in Go (well, I certainly hope not XD). That&amp;rsquo;s a C++ job with all the tools that prove C++ code and certify it against explicit safety certification standards. And Rust has been catching up to this game.&lt;/p&gt;</description></item><item><title>Let’s build a Golang knowledge specific RAG system with a local llama LLM</title><link>https://blog.aabouzied.com/golang-knowledge-specific-rag/</link><pubDate>Fri, 27 Dec 2024 09:40:45 +0000</pubDate><guid>https://blog.aabouzied.com/golang-knowledge-specific-rag/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;&#10;&lt;p&gt;In this article, we’re going to build a Golang knowledge specific RAG AI Chat system using open source and free components with the ability to make more documents available for it. This RAG system can be used for example for internal documentation, where we can make a chat LLM answer questions based solely on our documentation. Also, it means that it will be able to answer more specific questions that general use case chat LLMs fail with due to not being trained on the internal specific data set.&lt;/p&gt;</description></item><item><title>On Fact-checking RAG Outputs</title><link>https://blog.aabouzied.com/on-fact-checking-rag-outputs/</link><pubDate>Thu, 26 Dec 2024 18:36:34 +0000</pubDate><guid>https://blog.aabouzied.com/on-fact-checking-rag-outputs/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;&#10;&lt;p&gt;In this article, we explore the challenges and methods of &lt;strong&gt;fact-checking RAG&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;(Retrieval-Augmented-Generation) output.&lt;/p&gt;&#10;&lt;p&gt;We begin with a &lt;strong&gt;philosophical rant&lt;/strong&gt; about what exactly a fact is. And why I think knowledge is better represented in an “index” &lt;strong&gt;(encyclopedia) rather than in a “knowledge graph”&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Following that, we go into &lt;strong&gt;practical experiments&lt;/strong&gt;, including:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Implementing a &lt;strong&gt;fact extractor&lt;/strong&gt; using &amp;ldquo;GPT-4o-mini&amp;rdquo;.&lt;/li&gt;&#10;&lt;li&gt;Utilizing &amp;ldquo;DeBERTa&amp;rdquo; for &lt;strong&gt;detecting contradictions&lt;/strong&gt; between two sentences.&lt;/li&gt;&#10;&lt;li&gt;Building a &lt;strong&gt;fact-checker pipeline&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;Finally, we test these tools in a controlled environment using a single-document Retrieval-Augmented Generation (RAG) setup to &lt;strong&gt;detect if the RAG system has given us false information&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;The code accompanying this article can be found&lt;/strong&gt; &lt;a href="https://github.com/ahmedaabouzied/rag-systems/tree/main/fact_checking"&gt;&lt;strong&gt;here on Github.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>An Experiment with RAG Search Accuracy</title><link>https://blog.aabouzied.com/experiment-rag-search-accuracy/</link><pubDate>Fri, 20 Dec 2024 06:30:13 +0000</pubDate><guid>https://blog.aabouzied.com/experiment-rag-search-accuracy/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;&#10;&lt;p&gt;In a previous article, we explored the foundations of a basic Retrieval-Augmented Generation (RAG) system by building a straightforward implementation and loading it with articles from the Go blog. This simple setup allowed us to test the concept of enhancing search accuracy by combining a document corpus with advanced retrieval techniques.&lt;/p&gt;&#10;&lt;p&gt;Now, we’re taking that experiment further. In this article, we’ll delve into optimizing RAG search accuracy through more advanced techniques and comparisons. Specifically, we’ll discuss:&lt;/p&gt;</description></item><item><title>Problem solving: Minesweeper</title><link>https://blog.aabouzied.com/problem-solving-minesweeper/</link><pubDate>Thu, 02 Apr 2020 05:25:44 +0000</pubDate><guid>https://blog.aabouzied.com/problem-solving-minesweeper/</guid><description>&lt;h2 id="problem-statement"&gt;Problem Statement&lt;/h2&gt;&#10;&lt;p&gt;As stated on &lt;a href="https://app.codesignal.com/arcade/intro/level-5/ZMR5n7vJbexnLrgaM"&gt;CodeSignal&lt;/a&gt; :&lt;/p&gt;&#10;&lt;p&gt;In the popular Minesweeper game you have a board with some mines and those cells that don&amp;rsquo;t contain a mine have a number in it that indicates the total number of mines in the neighboring cells. Starting off with some arrangement of mines we want to create a Minesweeper game setup.&lt;/p&gt;&#10;&lt;h2 id="input-and-output-examples"&gt;Input and output examples&lt;/h2&gt;&#10;&lt;h4 id="for-input-"&gt;For Input :&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;matrix = [[true, false, false],&#10; [false, true, false],&#10; [false, false, false]]&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="output-"&gt;Output :&lt;/h4&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;minesweeper(matrix) = [[1, 2, 1],&#10; [2, 1, 1],&#10; [1, 1, 1]]&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="solution"&gt;Solution:&lt;/h2&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt;&lt;span style="color:#ff79c6"&gt;&amp;gt;&amp;gt;&lt;/span&gt; minesweeper(std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#8be9fd"&gt;bool&lt;/span&gt;&lt;span style="color:#ff79c6"&gt;&amp;gt;&amp;gt;&lt;/span&gt; matrix) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt;&lt;span style="color:#ff79c6"&gt;&amp;gt;&amp;gt;&lt;/span&gt; res;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;for&lt;/span&gt; (&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt; y &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;0&lt;/span&gt;; y &lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt; matrix.size(); y&lt;span style="color:#ff79c6"&gt;++&lt;/span&gt; ){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#ff79c6"&gt;::&lt;/span&gt;vector&lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt;&lt;span style="color:#ff79c6"&gt;&amp;gt;&lt;/span&gt; row;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;for&lt;/span&gt; (&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt; x &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;0&lt;/span&gt;; x &lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt; matrix[y].size(); x&lt;span style="color:#ff79c6"&gt;++&lt;/span&gt;){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#8be9fd"&gt;int&lt;/span&gt; count &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;0&lt;/span&gt;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;for&lt;/span&gt; (&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt; a &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; &lt;span style="color:#ff79c6"&gt;-&lt;/span&gt;&lt;span style="color:#bd93f9"&gt;1&lt;/span&gt;; a &lt;span style="color:#ff79c6"&gt;&amp;lt;=&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;1&lt;/span&gt;; a&lt;span style="color:#ff79c6"&gt;++&lt;/span&gt;){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;for&lt;/span&gt;(&lt;span style="color:#8be9fd"&gt;int&lt;/span&gt; b &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; &lt;span style="color:#ff79c6"&gt;-&lt;/span&gt;&lt;span style="color:#bd93f9"&gt;1&lt;/span&gt;; b &lt;span style="color:#ff79c6"&gt;&amp;lt;=&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;1&lt;/span&gt;; b&lt;span style="color:#ff79c6"&gt;++&lt;/span&gt;){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#8be9fd"&gt;int&lt;/span&gt; c &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; a &lt;span style="color:#ff79c6"&gt;+&lt;/span&gt; y, d &lt;span style="color:#ff79c6"&gt;=&lt;/span&gt; b &lt;span style="color:#ff79c6"&gt;+&lt;/span&gt; x;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;if&lt;/span&gt; (c &lt;span style="color:#ff79c6"&gt;==&lt;/span&gt; y &lt;span style="color:#ff79c6"&gt;&amp;amp;&amp;amp;&lt;/span&gt; d &lt;span style="color:#ff79c6"&gt;==&lt;/span&gt; x){&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;continue&lt;/span&gt;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;if&lt;/span&gt; (&lt;span style="color:#bd93f9"&gt;0&lt;/span&gt; &lt;span style="color:#ff79c6"&gt;&amp;lt;=&lt;/span&gt; c &lt;span style="color:#ff79c6"&gt;&amp;amp;&amp;amp;&lt;/span&gt; c &lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt; matrix.size() &lt;span style="color:#ff79c6"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;0&lt;/span&gt; &lt;span style="color:#ff79c6"&gt;&amp;lt;=&lt;/span&gt; d &lt;span style="color:#ff79c6"&gt;&amp;amp;&amp;amp;&lt;/span&gt; d &lt;span style="color:#ff79c6"&gt;&amp;lt;&lt;/span&gt; matrix[&lt;span style="color:#bd93f9"&gt;0&lt;/span&gt;].size()) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; count &lt;span style="color:#ff79c6"&gt;+=&lt;/span&gt; matrix[c][d] &lt;span style="color:#ff79c6"&gt;?&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;1&lt;/span&gt; &lt;span style="color:#ff79c6"&gt;:&lt;/span&gt; &lt;span style="color:#bd93f9"&gt;0&lt;/span&gt;;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; row.push_back(count);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; res.push_back(row);&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff79c6"&gt;return&lt;/span&gt; res;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Problem solving: Box Blur</title><link>https://blog.aabouzied.com/problem-solving-box-blur/</link><pubDate>Wed, 01 Apr 2020 05:25:44 +0000</pubDate><guid>https://blog.aabouzied.com/problem-solving-box-blur/</guid><description>&lt;h2 id="problem-statement"&gt;Problem Statement&lt;/h2&gt;&#10;&lt;p&gt;As stated on &lt;a href="https://app.codesignal.com/arcade/intro/level-5/5xPitc3yT3dqS7XkP"&gt;CodeSignal&lt;/a&gt; :&lt;/p&gt;&#10;&lt;p&gt;The pixels in the input image are represented as integers. The algorithm distorts the input image in the following way: Every pixel x in the output image has a value equal to the average value of the pixel values from the 3 × 3 square that has its center at x, including x itself. All the pixels on the border of x are then removed.&lt;/p&gt;</description></item><item><title>On Memory Management in C++</title><link>https://blog.aabouzied.com/on-memory-management-in-c-/</link><pubDate>Fri, 13 Sep 2019 05:25:44 +0000</pubDate><guid>https://blog.aabouzied.com/on-memory-management-in-c-/</guid><description>&lt;h2 id="overview"&gt;Overview&lt;/h2&gt;&#10;&lt;p&gt;Due to it&amp;rsquo;s being type unsafe , it&amp;rsquo;s very difficult to develop a garbage collector for c++. It&amp;rsquo;s rather something that the C++ community often boosts about. It&amp;rsquo;s true that it makes the compiled programs very lean and smaller in size. However it adds work to the development process. You&amp;rsquo;d have to handle the memory yourself as a c++ developer.&lt;/p&gt;&#10;&lt;h2 id="types-of-memory"&gt;Types of memory&lt;/h2&gt;&#10;&lt;p&gt;There are mainly three types of memory that can be used by the developer :&lt;/p&gt;</description></item><item><title>On Cancel Propagation in Web Servers</title><link>https://blog.aabouzied.com/on-cancel-propagation-in-web-servers/</link><pubDate>Fri, 24 May 2019 09:33:35 +0200</pubDate><guid>https://blog.aabouzied.com/on-cancel-propagation-in-web-servers/</guid><description>&lt;h2 id="on-cancellation"&gt;On Cancellation&lt;/h2&gt;&#10;&lt;p&gt;Consider the common situation of a web server making a call to the database then returning the data to the client .&lt;/p&gt;&#10;&lt;p&gt;What would happen if the client cancelled the request in the middle ?This could be due to that it lost connection or just simply if the user cancels the request from the browser while it&amp;rsquo;s still loading by closing the browser or simply clicking &lt;code&gt;x&lt;/code&gt;. The &lt;code&gt;Server&lt;/code&gt; and &lt;code&gt;Database&lt;/code&gt; layers would still process the request and take resources and all this effort would render no profit since the data would not be sent to the client.&lt;/p&gt;</description></item></channel></rss>