<?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: Ahmed Mannai</title>
    <description>The latest articles on DEV Community by Ahmed Mannai (@ahmedmannai).</description>
    <link>https://dev.to/ahmedmannai</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%2F1000347%2Fdb28b701-270c-45a7-86a6-e597934a9e49.jpeg</url>
      <title>DEV Community: Ahmed Mannai</title>
      <link>https://dev.to/ahmedmannai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmedmannai"/>
    <language>en</language>
    <item>
      <title>The Multifaceted Nature of Programming</title>
      <dc:creator>Ahmed Mannai</dc:creator>
      <pubDate>Thu, 19 Oct 2023 09:19:20 +0000</pubDate>
      <link>https://dev.to/ahmedmannai/the-multifaceted-nature-of-programming-1o5d</link>
      <guid>https://dev.to/ahmedmannai/the-multifaceted-nature-of-programming-1o5d</guid>
      <description>&lt;p&gt;&lt;em&gt;Hello World.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I remember the day I first dipped my toes into the world of coding. Back then, I had a rather simplistic view of software engineering. It felt as if software engineers possessed the uncanny ability to crack code out of their fingers onto the screen, as if they had all the answers stored away in their minds and merely needed to type them out. But I couldn't have been more wrong; that's not coding; it's just typing or whatever you want to call it, really.&lt;/p&gt;

&lt;p&gt;When I began my journey into coding, I was primarily focused on solving algorithmic problems. These problems seemed deceptively simple. I would just visualize the solution in my mind, and it was as if the code was writing itself on the screen. It was almost magical in its simplicity.&lt;/p&gt;

&lt;p&gt;However, the transition to real-world projects was nothing short of a seismic shift. Coding, I realized, was not the act of typing out pre-conceived solutions. It was a multi-faceted process involving more than just typing. It was about searching for documentation, reading it, and then re-reading it. It was about debugging, refactoring, and constantly rethinking my code. It became a relentless cycle of learning, doing, and redoing.&lt;/p&gt;

&lt;p&gt;One vivid memory from my internship still lingers in my mind. We faced a problem that appeared fairly unique. No one seemed to have documented it online, and we were stumped. I spent nearly 8 hours straight, poring over one documentation after another, from one GitHub repository to another, trying every conceivable approach. In the end, it all came down to a single line of code that fixed the entire issue. You might think it was a colossal waste of time, but it was the only way forward. There were no shortcuts.&lt;/p&gt;

&lt;p&gt;Speaking of shortcuts, I've learned the hard way that they can be the bane of a software engineer's growth. It's tempting to follow tutorials, copying and pasting code without fully comprehending why it works. It might help you go from point A to B quickly, but when it's time to go from B to C, you'll find yourself lost, struggling to adapt the copied code to your needs.&lt;/p&gt;

&lt;p&gt;However, this is what makes us love coding. It's the thrill of problem-solving, the joy in searching for and discovering new information, and the relentless pursuit of the most optimal way to convey your intentions to a computer. That is the essence of coding.&lt;/p&gt;

&lt;p&gt;The flow of coding is not about shortcuts; it's about the journey. It's about delving into the unknown, taking on the challenge, and arriving at the solution with an enriched understanding. It's about the satisfaction of seeing your code come to life and the realization that coding is not just about typing but about thinking, solving, and creating.&lt;/p&gt;

&lt;h2&gt;
  
  
  In conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, coding is far more than a mere act of typing lines of code. It's a complex, multi-faceted process that involves dedication, problem-solving, and a relentless pursuit of knowledge. The true essence of coding lies in the joy of the journey, in searching and discovering, and in the pursuit of the optimal way to communicate with a computer. It's not about shortcuts; it's about the thrill of cracking the code.&lt;/p&gt;

&lt;p&gt;You can see more article like this on &lt;a href="https://www.ahmedmannai.me/blog"&gt;ahmedmannai.me/blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>coding</category>
      <category>softwaredevelopment</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to insert a responsive YouTube Video to react using Tailwind CSS</title>
      <dc:creator>Ahmed Mannai</dc:creator>
      <pubDate>Tue, 12 Sep 2023 11:40:49 +0000</pubDate>
      <link>https://dev.to/ahmedmannai/how-to-insert-a-responsive-youtube-video-to-react-using-tailwind-css-1jb5</link>
      <guid>https://dev.to/ahmedmannai/how-to-insert-a-responsive-youtube-video-to-react-using-tailwind-css-1jb5</guid>
      <description>&lt;p&gt;Liquid syntax error: Unknown tag 'endraw'&lt;/p&gt;
</description>
      <category>webdev</category>
      <category>react</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>how to communicate with a serial port using flutter_libserialport package</title>
      <dc:creator>Ahmed Mannai</dc:creator>
      <pubDate>Tue, 24 Jan 2023 13:59:15 +0000</pubDate>
      <link>https://dev.to/ahmedmannai/flutter-communicate-with-external-devices-through-a-serial-port-44o4</link>
      <guid>https://dev.to/ahmedmannai/flutter-communicate-with-external-devices-through-a-serial-port-44o4</guid>
      <description>&lt;p&gt;Hello everyone! Don't you just hate when documentation is scarce and tutorial blog posts are almost non-existent for something you're working on? I've been there. I was working on a Flutter app pertinent to serial port communication and faced the same issue. But now that I've figured it out, you don't have to feel the frustration that comes with the lack of guidance.&lt;/p&gt;

&lt;p&gt;By the end of this blog post, you'll learn how to send and receive data through a serial port using Flutter. Let's dive in!&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%2Fmdngriv8gluvlgc9jtdv.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%2Fmdngriv8gluvlgc9jtdv.png" width="800" height="450"&gt;&lt;/a&gt;## Getting Started&lt;/p&gt;

&lt;p&gt;To start with, we need to add the package named &lt;code&gt;flutter_lib_serial_port&lt;/code&gt; to our empty Flutter project. We will then import the &lt;code&gt;lib_serial_port&lt;/code&gt; package that we just downloaded.&lt;/p&gt;

&lt;p&gt;Here's a bit of code to assist you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'lib_serial_port.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Identifying Available Ports
&lt;/h2&gt;

&lt;p&gt;Once the package is successfully imported, the first thing we need to do is to identify the available ports connected to our PC.&lt;/p&gt;

&lt;p&gt;To do that, we will declare a list of strings that will receive the names of the available ports.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;availablePorts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;availablePorts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SerialPort&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;availablePorts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;availablePorts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On running this code, you should see a list of the available ports. In my case, there were only three ports, labelled as serial port.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Serial Port Object
&lt;/h2&gt;

&lt;p&gt;Now we'll need to create a serial port object, let's call it &lt;code&gt;portOne&lt;/code&gt;. This object requires the name of the port we got from our list of available ports.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;SerialPort&lt;/span&gt; &lt;span class="n"&gt;portOne&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SerialPort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'serial_port_three'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F7r1ul1su1mf3ty3i0isw.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%2F7r1ul1su1mf3ty3i0isw.png" width="800" height="450"&gt;&lt;/a&gt;The above code will create an object referenced to 'serial_port_three'&lt;/p&gt;

&lt;p&gt;After creating the object, it's best to use a try-catch block to handle any serial port errors. If an error occurs while reading or writing to/from the port, we simply print it to the console.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening the Port for Communication
&lt;/h2&gt;

&lt;p&gt;Now we can open the port for communication. The &lt;code&gt;openReadWrite&lt;/code&gt; method enables opening the port for both reading and writing.&lt;/p&gt;

&lt;p&gt;Let's implement that in our code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;portOne&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;openReadWrite&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Writing to the Port
&lt;/h2&gt;

&lt;p&gt;After successfully opening the port, we can write to it. We have a problem though; the &lt;code&gt;write&lt;/code&gt; method takes a &lt;code&gt;Uint8List&lt;/code&gt; but what we have is a string.&lt;/p&gt;

&lt;p&gt;To make the conversion, a method needs to be created that converts a string to &lt;code&gt;unit8List&lt;/code&gt;. The return type of the write method will be the bytes written. Let's print these bytes written to check if the data was written successfully.&lt;/p&gt;

&lt;p&gt;Here is how to do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'Hello'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;Uint8List&lt;/span&gt; &lt;span class="n"&gt;uint8list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Uint8List&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;codeUnits&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="n"&gt;print&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;portOne&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uint8list&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fv93x5few3mxxyrjq069g.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%2Fv93x5few3mxxyrjq069g.png" width="800" height="450"&gt;&lt;/a&gt;On executing this code, a number (5) will be printed, which corresponds to the length of the string 'Hello', indicating the successful write operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading from the Port
&lt;/h2&gt;

&lt;p&gt;Now let's implement the functionality to read from the serial port. To achieve this goal, we need to create a serial port reader object.&lt;/p&gt;

&lt;p&gt;This object provides us with a stream, which we can listen to, and then print the incoming data. The problem here is that the stream returns &lt;code&gt;unit8List&lt;/code&gt; data, thereby necessitating the conversion back to a string.&lt;/p&gt;

&lt;p&gt;Here is the code snippet to do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;SerialPortReader&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SerialPortReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;portOne&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromCharCodes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;));});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fbxlxjm4e56mijof8m0tc.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%2Fbxlxjm4e56mijof8m0tc.png" width="800" height="450"&gt;&lt;/a&gt;If you've followed along correctly and everything goes without a hitch, you should be able to read data from the serial port successfully!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"&lt;em&gt;Don't be discouraged by what you don't know. That can be your greatest strength and ensure that you do things differently from everyone else.&lt;/em&gt;" - Sara Blakely&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I hope you've found this tutorial useful. Remember, in technology, the best way to learn something new is by doing. Happy coding, and until next time, take care!&lt;/p&gt;

</description>
      <category>leadership</category>
      <category>remote</category>
      <category>discuss</category>
      <category>career</category>
    </item>
    <item>
      <title>Why Programming is FUN</title>
      <dc:creator>Ahmed Mannai</dc:creator>
      <pubDate>Sat, 21 Jan 2023 14:41:02 +0000</pubDate>
      <link>https://dev.to/ahmedmannai/why-programming-is-fun-ng0</link>
      <guid>https://dev.to/ahmedmannai/why-programming-is-fun-ng0</guid>
      <description>&lt;p&gt;You start programming and all of a sudden, you have lost connection to the external environment, times flies by without noticing it. all your psychic energy is directed towards fixing that bug or make that code works.&lt;br&gt;
let's be honest guys challenges are what makes programming fun and bugs are no exceptions.&lt;br&gt;
facing a problem while coding and work hard to solve it puts our mind in a state of Flow.&lt;br&gt;
programmers experience flow when they are fully immersed in the task at hand and in a state of optimal performance. &lt;/p&gt;

&lt;h2&gt;
  
  
  wait what is flow ?
&lt;/h2&gt;

&lt;p&gt;The term "flow" was first introduced by psychologist Mihaly Csikszentmihalyi (pronounced six-cent-mihaly) to describe the experience of being completely engrossed in an activity, where time seems to fly by and self-consciousness disappears. This state of flow is characterised by a feeling of effortless concentration, full engagement in the task, and a sense of control and mastery over one's actions.&lt;br&gt;
in his book he goes deep into flow and what makes us happy.&lt;br&gt;&lt;br&gt;
&lt;a href="https://www.amazon.com/Flow-Psychology-Experience-Perennial-Classics/dp/0061339202" rel="noopener noreferrer"&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%2Fvlfa987nel1nz595d42u.jpg" alt="Alt text" width="193" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Programming and Flow
&lt;/h2&gt;

&lt;p&gt;In programming, flow can be experienced when a developer is fully absorbed in the process of creating and solving problems, and the code is flowing easily from their mind to the screen. This state can be incredibly productive, as it allows developers to focus on the task at hand without getting bogged down by distractions or self-doubt.&lt;/p&gt;

&lt;p&gt;To achieve flow, a number of conditions must be met. The task at hand must be challenging but also achievable, with a clear goal and a sense of progress being made. Developers must also have the skills and knowledge necessary to complete the task, and they must be free from distractions and other sources of stress.&lt;/p&gt;

&lt;p&gt;When the conditions for flow are met, the experience can be incredibly rewarding. The sense of control and mastery that comes from solving complex problems can lead to a feeling of satisfaction and a sense of accomplishment. In addition, the state of flow can lead to increased creativity and problem-solving abilities, as well as improved productivity and code quality.&lt;/p&gt;

&lt;p&gt;In my experience it is the same like playing a good football game where you have no idea about the external environment,&lt;br&gt;
you mind is executing one and only one thing (one task). you wouldn't believe me when I tell you that those moments are what makes us happy.&lt;/p&gt;

&lt;p&gt;The problem is that this state is not easy to achieve and it can be easily interrupted. The biggest obstacles are procrastination, lack of motivation, poor environment and bad habits that impede the concentration.&lt;/p&gt;

&lt;p&gt;One way to overcome these obstacles is to actively work on developing good programming habits, such as setting clear goals, breaking down large tasks into smaller, more manageable chunks, and minimising distractions by working in a dedicated, comfortable and organised work environment.&lt;/p&gt;

&lt;p&gt;have fun while coding and good bye.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>welcome</category>
      <category>community</category>
    </item>
  </channel>
</rss>
