<?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 Ahmed Ba Haggag on Medium]]></title>
        <description><![CDATA[Stories by Ahmed Ba Haggag on Medium]]></description>
        <link>https://medium.com/@ahmedbahaggag?source=rss-8db261925218------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*F1fRkSePKWzCJkN02xZGNA.jpeg</url>
            <title>Stories by Ahmed Ba Haggag on Medium</title>
            <link>https://medium.com/@ahmedbahaggag?source=rss-8db261925218------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:08:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmedbahaggag/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[A Comprehensive Guide to Using screen on Ubuntu]]></title>
            <link>https://medium.com/@ahmedbahaggag/a-comprehensive-guide-to-using-screen-on-ubuntu-cd2b69d898c4?source=rss-8db261925218------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd2b69d898c4</guid>
            <dc:creator><![CDATA[Ahmed Ba Haggag]]></dc:creator>
            <pubDate>Wed, 29 Jan 2025 18:54:33 GMT</pubDate>
            <atom:updated>2025-01-29T18:54:33.193Z</atom:updated>
            <content:encoded><![CDATA[<p>screen is a powerful terminal multiplexer available on Ubuntu that allows users to manage multiple terminal sessions efficiently. This guide aims to provide a detailed reference for beginner users, with clear examples and expected outputs for each step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V7x3jJ-OhWbSPJHgKHcJKA.jpeg" /></figure><h3>Overview</h3><p>screen is a tool used for:</p><ul><li><strong>Managing long-running processes</strong>: Keep processes running even if your terminal disconnects.</li><li><strong>Session persistence</strong>: Resume your work seamlessly after a disconnection or reboot.</li><li><strong>Multi-tasking</strong>: Run and monitor multiple sessions in a single terminal window.</li><li><strong>Sharing sessions</strong>: Collaborate with another user in real-time.</li></ul><p>Common use cases include managing remote servers, running background scripts, and monitoring logs.</p><h3>Installation</h3><h4>Check if screen is installed</h4><p>Run the following command to check if screen is already installed:</p><pre>screen --version</pre><p>Output (if installed):</p><pre>Screen version 4.08.00 (GNU) 05-Feb-20</pre><h4>Install screen</h4><p>If not installed, use the following command:</p><pre>sudo apt update &amp;&amp; sudo apt install screen</pre><p>Verify the installation:</p><pre>screen --version</pre><h3>Create a Screen Session</h3><h4>Without a Session Name</h4><p>To start a new session:</p><pre>screen</pre><p>You will enter a new screen session. The command prompt will look the same, but you are now inside a screen environment.</p><h4>With a Session Name</h4><p>To create a session with a name:</p><pre>screen -S my_session</pre><p>This helps in identifying and managing multiple sessions.</p><h4>Benefits of Naming Sessions:</h4><ul><li>Makes it easier to find specific sessions when listing them.</li><li>Useful for organization when running multiple tasks.</li></ul><p>Command when session is open:</p><pre>Ctrl + A, then : sessionname my_session</pre><h3>List All Sessions</h3><p>To view all active screen sessions:</p><pre>screen -ls</pre><p>Output example:</p><pre>There are screens on:<br>    12345.my_session    (Detached)<br>    67890.other_session (Attached)<br>2 Sockets in /run/screens/S-username.</pre><h3>Rename Existing Session Name</h3><p>Renaming a screen session is useful for <strong>organizing and identifying sessions</strong>, especially when you have multiple sessions running. You can rename a session either <strong>from the command line</strong> or <strong>while the session is attached</strong>.</p><p><strong>Inside Session (Attached Session)</strong></p><p>This will rename the current session to new_name. The sessionname command must be used while the session is open.</p><pre>Ctrl + A, then :sessionname new_name</pre><p>It’s important to note that this does not create a new session, it only renames the existing one.</p><p><strong>From Command Line</strong></p><p>If you are not inside the session and want to rename it from outside, you would need to detach from the session and use the screen -S old_name -X sessionname new_name command like this:</p><pre>screen -S &lt;old_session_name&gt; -X sessionname &lt;new_session_name&gt;</pre><p>This will rename the session old_name to new_name without needing to attach to it.</p><p><strong>Why Rename a Session?</strong></p><ul><li><strong>Organization</strong>: Helps you easily identify and manage multiple sessions.</li><li><strong>Clarity</strong>: Useful when working with similar tasks or projects.</li><li><strong>Reattaching</strong>: Makes it easier to reattach to a specific session using its name.</li></ul><h3>Detach from a Screen Session</h3><p>To detach without closing the session, press:</p><pre>Ctrl + A, then D</pre><p>You will see a message like:</p><pre>[detached from 12345.my_session]</pre><p>Alternatively, to detach a specific session from the command line:</p><pre>screen -d &lt;session_id&gt;</pre><p>Note that detaching does <strong>not</strong> terminate the session; processes continue running.</p><h3>Reattach to a Screen Session</h3><p>To reattach to a detached session:</p><pre>screen -r my_session</pre><p>If there are multiple sessions, specify the session ID or name:</p><pre>screen -r 12345</pre><p>Command while the session is open (to reattach another session):</p><pre>Ctrl + A, then : sessionjoin &lt;session_id&gt;</pre><p>Note that sessionjoin command is only available in <strong>4.06.02 or newer </strong>versions.</p><h3>Scroll Back in a Session</h3><p>While in an attached session, you cannot scroll using the terminal scrollbar because screen intercepts input to manage its own buffer. To scroll back and view previous output:</p><pre>Ctrl + A, then [</pre><p>Use the arrow keys to navigate. Press Esc to exit scroll mode.</p><h3>Quit a Session</h3><p>To close the current screen session:</p><pre>exit</pre><p>Output:</p><pre>[screen is terminating]</pre><p>Alternatively, you can quit a specific session by providing its session name or ID directly from the command line:</p><pre>screen -S my_session -X quit</pre><p>This command terminates the session named my_session.</p><h3>Exit All Sessions</h3><p>To terminate all sessions, you will need to manually quit each session or use forceful methods.</p><h4>Remove Dead or Terminated Sessions</h4><p>To clean up dead or stale sessions:</p><pre>screen -wipe</pre><p>This command does not affect active or detached sessions.</p><h4>Forcefully Close All Sessions</h4><p>To terminate all sessions, including active ones:</p><pre>pkill screen</pre><h3>Summary</h3><p>screen is an essential tool for managing terminal sessions effectively. By learning the commands provided in this guide, you can:</p><ul><li>Run and monitor multiple processes simultaneously.</li><li>Reattach to sessions after disconnections.</li><li>Increase productivity with session persistence and multitasking.</li></ul><p>This guide covers installation, session management, advanced usage, and troubleshooting commands. With these tips, you can make the most of screen and streamline your workflow in Ubuntu.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd2b69d898c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Number to Word Converter for Arabic and English Languages (number_humanizer gem)]]></title>
            <link>https://medium.com/@ahmedbahaggag/number-to-word-arabic-language-humanizer-number-humanizer-gem-acb45f7dfee8?source=rss-8db261925218------2</link>
            <guid isPermaLink="false">https://medium.com/p/acb45f7dfee8</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[number-to-words]]></category>
            <category><![CDATA[arabic]]></category>
            <category><![CDATA[gem]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Ahmed Ba Haggag]]></dc:creator>
            <pubDate>Wed, 01 Jun 2022 13:49:24 GMT</pubDate>
            <atom:updated>2022-06-05T05:23:26.299Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwA0FUKJBmi3VgSIy7ogeg.jpeg" /></figure><p>One of the requirements you need when dealing with amounts is that you want to print amounts in numbers and words. This implementation might get different from language to language whether spoken or programming.</p><p>Before implementing this requirement, we should first look if anyone else already implemented it and shared it as a package or gem (as in ruby language) and this is what I exactly did. As a ruby engineer, I started looking for gems that convert numbers to words that support the Arabic language but unfortunately, I did found any so I start building a new one.</p><p>I called this gem <a href="https://github.com/abahaggag/number_humanizer">`number_humanizer`</a> and designed it to support multiple languages but started with the Arabic Language. The first version (0.1.*) has the essential functions for converting numbers to Arabic words and fixed issues with test cases so any change in the future should not affect existing functionalities.</p><p>Now version 0.2.0 is released with English language support and the structure of the configurations got enhanced so that will be easier to add more options in the next releases.</p><h3>Installation</h3><p>Add this line to your application’s Gemfile:</p><pre>gem ‘number_humanizer’</pre><p>And then execute:</p><pre>$ bundle</pre><p>Or install it yourself as:</p><pre>$ gem install number_humanizer</pre><h3>Usage</h3><p>You have two ways to use the gem:</p><ol><li>Using service class</li></ol><pre>require ‘number_humanizer’</pre><pre>NumberHumanizer::Manager.new(1500).call.result</pre><pre>#=&gt; “ألف و خمسة مائة”</pre><p>2. Call monkey patching methods added to Integer and Float classes</p><pre>require ‘number_humanizer’</pre><pre>1500.to_word</pre><pre>#=&gt; “ألف و خمسة مائة”</pre><p>Also, you can pass the currency option as follows:</p><pre>require ‘number_humanizer’</pre><pre>NumberHumanizer::Manager.new(1500, currency: ‘ريال’).call.result</pre><pre>#=&gt; “ألف و خمسة مائة ريال”</pre><pre>1500.to_word(currency: ‘ريال’)</pre><pre>#=&gt; “ألف و خمسة مائة ريال”</pre><p>Note that sub currency is also supported but not fully functional so if you need to use it then you can pass amount and sub amount separately to the service and you need to combine.</p><h3>Configurations</h3><p>You have to way for setting configurations in the number humanizer gem:</p><ul><li><em>Set configurations globally</em>: this will be used in all conversions. You can add the following snippet in the initializers folder or any file that is loaded automatically. Note that this configuration can be changed at any time by calling this code.</li></ul><pre># initializers/number_humanizer.rb<br>require &#39;number_humanizer&#39;</pre><pre>NumberHumanizer.setup do |config|<br>  # default language is arabic<br>  config.language = :arabic</pre><pre>  # currency is not set by default and you can set from here<br>  config.currency = &#39;ريال&#39;</pre><pre>  # all upcoming configs will be placed here<br>end</pre><ul><li><em>Pass configurations instantly</em> whether when using service object or monkey patched methods so that global configurations will be ignored</li></ul><pre>require &#39;number_humanizer&#39;</pre><pre>NumberHumanizer::Manager.new(1500, language: :arabic, currency: &#39;ريال&#39;).call.result<br>#=&gt; &quot;ألف و خمسة مائة ريال&quot;</pre><pre>1500.to_word(language: :arabic, currency: &#39;ريال&#39;)<br>#=&gt; &quot;ألف و خمسة مائة ريال&quot;</pre><h3>Supported Languages</h3><p>Initially, the gem was supporting the Arabic language only but now the English language is supported too. Here are the details needed for each language:</p><h4><strong>Arabic Language</strong></h4><p>This is the default one and you don’t need to specify it but if you set another language and want to have an Arabic word for a given number then you can pass it to the service or as args in to_word monkey patched method as explained in the configurations section.</p><p><strong><em>Note that accepted values are: </em></strong><strong><em>arabic and </em></strong><strong><em>ar</em>.</strong></p><h4>English Language</h4><p>Like the Arabic language, the English language can be configured globally or instantly as described in the configuration section. Here you just need to set language config.</p><p><strong><em>Note that accepted values are: </em></strong><strong><em>english and </em></strong><strong><em>en</em>.</strong></p><h3>Finally,</h3><p>I’m planning in the next release to add more options to cover language rules as the Arabic language has many. These configurations will add more flexibility to meet user expectations. You can visit gem in GitHub <a href="https://github.com/abahaggag/number_humanizer">number_humanizer</a> and in case you have any suggestions you reach me any time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acb45f7dfee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>