<?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: Jhohannes</title>
    <description>The latest articles on Forem by Jhohannes (@_jhohannes).</description>
    <link>https://forem.com/_jhohannes</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%2F709943%2Fd4e14c71-cd3b-47d0-8571-8a667415dc07.jpg</url>
      <title>Forem: Jhohannes</title>
      <link>https://forem.com/_jhohannes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/_jhohannes"/>
    <language>en</language>
    <item>
      <title>Why Your Applications Need Optimistic Updates</title>
      <dc:creator>Jhohannes</dc:creator>
      <pubDate>Sat, 20 Jul 2024 22:57:38 +0000</pubDate>
      <link>https://forem.com/_jhohannes/why-your-applications-need-optimistic-updates-3h62</link>
      <guid>https://forem.com/_jhohannes/why-your-applications-need-optimistic-updates-3h62</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Optimistic update is a key concept in software development, instrumental in enhancing the user experience by making applications feel faster and more efficient. This is where developers tend to be ‘optimistic’ that the server will surely return a success on whatever action the user performs. This strategy involves the application of updates on the client side instantly, without waiting for a server response to confirm the operation’s success. It operates on the assumption that the server-side operation will succeed. This strategy is widely embraced in developing modern web applications, where speed and efficiency are paramount. Despite its advantages, the approach presents unique challenges that must be handled effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deep Dive into Optimistic Update
&lt;/h2&gt;

&lt;p&gt;Optimistic update is fundamentally based on the principle of optimism. It operates on the assumption that most interactions in an application will succeed. For instance, when a user performs an action such as liking a post or adding a comment, the update is instantly reflected on the user interface, even before the server confirms the operation’s success. This instant feedback gives users a sense of immediate gratification, making the application more responsive and quick. It enhances the user’s perception of the application’s speed and performance, contributing to a positive user experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: Social Media Likes
&lt;/h3&gt;

&lt;p&gt;Consider whatever social media platform we use daily, be it  X, Instagram or Facebook, where users can like posts. When a user clicks the “like” button, the application immediately updates the like count and changes the button’s appearance to indicate that the post has been liked. This happens without waiting for the server to confirm that the like has been recorded. The user sees the change instantly, which makes the application feel fast and responsive. If the server later confirms the like, no further action is needed. If the server reports a failure (e.g., due to a network issue), the application can revert the like count and button appearance to their previous states and notify the user of the failure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: Online Multiplayer Games
&lt;/h3&gt;

&lt;p&gt;In online multiplayer games, players often perform actions that must be reflected immediately on their screens. For instance, when a player moves their character or performs an attack, the game client updates the game state instantly without waiting for the server to confirm the action. This ensures that the game feels smooth and responsive. If the server later detects an issue (e.g., the action is invalid or a network problem), it can send a correction to the client, which then adjusts the game state accordingly.&lt;/p&gt;

&lt;p&gt;From a technical perspective, optimistic updating also reduces the server load, as the client doesn’t need to check for updates constantly. This can lead to more efficient use of server resources and potentially reduce the cost and complexity of server-side operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Upsides of Optimistic Update
&lt;/h2&gt;

&lt;p&gt;The implementation of optimistic update brings several benefits to both users and developers. Most notably, it significantly enhances the user experience. It eradicates the lag that typically occurs while waiting for server response, which gives the application a faster, more seamless feel. This immediate feedback is particularly beneficial in applications where real-time feedback is crucial, such as social media platforms and online multiplayer games.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges: Handling Failures in Optimistic Update
&lt;/h2&gt;

&lt;p&gt;Despite its many advantages, optimistic update is not without its challenges. The most significant of these is the handling of failures. Since the application does not wait for server confirmation, there is a risk that the action might fail on the server side. This could lead to inconsistencies between the user’s view of the data and the actual state of the data on the server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: E-commerce Shopping Cart
&lt;/h3&gt;

&lt;p&gt;In an e-commerce application, when a user adds an item to their shopping cart, the application might immediately update the cart’s contents and display the new item. However, if the server later reports that the item is out of stock, the application needs to remove the item from the cart and notify the user. This requires a mechanism to revert the changes on the client side and handle the failure gracefully. The application might display a message informing the user that the item is unavailable and suggest alternative products.&lt;/p&gt;

&lt;p&gt;Developers need to implement a robust system to handle such scenarios. This typically involves a mechanism to revert the changes on the client side and notify the user about the failure. These mechanisms must be designed carefully to ensure they do not negatively impact the user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Optimistic update is a powerful technique that can significantly improve the user experience in modern web applications. By assuming success and updating the user interface immediately, applications can feel faster and more responsive. However, it is crucial to handle potential failures effectively to ensure the reliability of the application.&lt;/p&gt;

&lt;p&gt;While optimistic updating may not be suitable for all situations, with careful planning and robust error handling, it can be a valuable tool in a developer’s arsenal. It’s a strategy that requires a balance - the benefits of immediate feedback and perceived speed must be weighed against the challenges of handling potential failures. But when done right, the benefits can significantly outweigh the challenges, leading to applications that are not just faster, but also more user-friendly and efficient.&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>react</category>
      <category>nextjs</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Installing Tensorflow(with GPU support) in linux or WSL</title>
      <dc:creator>Jhohannes</dc:creator>
      <pubDate>Tue, 20 Jun 2023 20:07:23 +0000</pubDate>
      <link>https://forem.com/_jhohannes/installing-tensorflowwith-gpu-support-in-linux-or-wsl-2le5</link>
      <guid>https://forem.com/_jhohannes/installing-tensorflowwith-gpu-support-in-linux-or-wsl-2le5</guid>
      <description>&lt;p&gt;I was trying to install Tensorflow with GPU support on my Linux machine and WSL, but I was having a terrible time. I spent hours and days🤦‍♂️ scouring the internet looking for solutions, but nothing seemed to work. I felt like I was going in circles, and I was getting more and more frustrated with each passing minute. Eventually, I did manage to figure out a way to install Tensorflow with GPU support, and it was like a weight had been lifted off my shoulders.&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%2Fk4q1qgvvvnw09a993vdk.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%2Fk4q1qgvvvnw09a993vdk.png" alt="I was very frustrated" width="356" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I don't want you to go through the same pain and frustration that I experienced, so I'm going to share with you the steps to follow to install Tensorflow with GPU support in Linux or WSL. Trust me, it will save you a lot of time and headaches!😉&lt;/p&gt;

&lt;p&gt;Tensorflow is an open-source software library used for dataflow and differentiable programming across various tasks. It is a popular choice for machine learning and deep learning tasks due to its flexibility and scalability. By default, Tensorflow installation does not include GPU support. However, GPU support can significantly speed up the training of deep learning models.&lt;/p&gt;

&lt;h2&gt;
  
  
  System Requirements
&lt;/h2&gt;

&lt;p&gt;To install Tensorflow with GPU support, you need the following system requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NVIDIA® GPU card with CUDA®. Check if your GPU has CUDA support &lt;a href="https://developer.nvidia.com/cuda-gpus" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;CUDA® Toolkit 11.0 or higher&lt;/li&gt;
&lt;li&gt;cuDNN SDK 8.0.4 or higher&lt;/li&gt;
&lt;li&gt;Linux or Windows Subsystem for Linux (WSL) [will be using ubuntu in this blog]&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.6 - 3.9&lt;/li&gt;
&lt;li&gt;Ubuntu 16.x or later&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation Steps
&lt;/h2&gt;

&lt;p&gt;Follow the below steps for installing Tensorflow with GPU support:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, install the CUDA® Toolkit. You can download the latest version of CUDA® Toolkit from the NVIDIA® website(&lt;a href="https://developer.nvidia.com/cuda-downloads?target_os=Linux&amp;amp;target_arch=x86_64&amp;amp;Distribution=Ubuntu&amp;amp;target_version=22.04&amp;amp;target_type=deb_local" rel="noopener noreferrer"&gt;ubuntu&lt;/a&gt; or &lt;a href="https://developer.nvidia.com/cuda-downloads?target_os=Linux&amp;amp;target_arch=x86_64&amp;amp;Distribution=WSL-Ubuntu&amp;amp;target_version=2.0&amp;amp;target_type=deb_local" rel="noopener noreferrer"&gt;linux&lt;/a&gt;). Make sure to select the appropriate version of the toolkit according to your GPU card and Linux distribution. &lt;/li&gt;
&lt;/ol&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%2Fcdp75ldik8zb1hw3sayg.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%2Fcdp75ldik8zb1hw3sayg.png" alt="Tensorflow" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installing the deb(local) file, you can install this by running this in the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; ./&amp;lt;name_of_file&amp;gt;.deb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; Make sure you are in the right directory before running the above command.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Alternatively, you can install the CUDA® toolkit right in your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;nvidia-cuda-toolkit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run this command to check if installation of the toolkit has been successful.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nvcc &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;output should look like this.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;nvcc: NVIDIA (R) Cuda compiler driver&lt;br&gt;
Copyright (c) 2005-2021 NVIDIA Corporation&lt;br&gt;
Built on Thu_Nov_18_09:45:30_PST_2021&lt;br&gt;
Cuda compilation tools, release 11.5, V11.5.119&lt;br&gt;
Build cuda_11.5.r11.5/compiler.30672275_0&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;After installing the CUDA® Toolkit, download the cuDNN SDK from the NVIDIA® &lt;a href="https://developer.nvidia.com/rdp/cudnn-download" rel="noopener noreferrer"&gt;website&lt;/a&gt;. Unzip the downloaded file and move the contents to the appropriate directory.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; To be sure of the version of the cuDNN to install. Please check the version on the tensorFlow website.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Unzip with this command:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xvzf&lt;/span&gt; cudnn-linux-x86_64-8.9.2.26_cuda11-archive.tar.xz.tgz
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;After extracting the files, I like to rename to folder because of the next command. In this case I renamed the folder from  &lt;strong&gt;&lt;em&gt;cudnn-linux-x86_64-8.9.2.26_cuda11-archive&lt;/em&gt;&lt;/strong&gt; to &lt;strong&gt;&lt;em&gt;cudnn.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&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%2Fzj78qod9mr5zopa9gn24.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%2Fzj78qod9mr5zopa9gn24.png" alt="ls command" width="421" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Now let’s copy the extracted files into the cuda dir.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```bash
sudo cp cudnn/include/cudnn.h /usr/lib/cuda/include/
sudo cp cudnn/lib/libcudnn* /usr/lib/cuda/lib64/
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Set file permissions for cudnn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```bash
sudo chmod a+r /usr/lib/cuda/include/cudnn.h /usr/lib/cuda/lib64/libcudnn*
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Export CUDA environment variables. To set them, run:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
 &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install Tensorflow using pip. To install Tensorflow with GPU support, use the following command:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;tensorflow-gpu

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


&lt;p&gt;Maybe instead of just installing globally into the python environment, let’s use the conda and create an environment out of it. It is recommended to use a virtual environment for your Tensorflow project to avoid conflicts with other packages and ensure reproducibility. You can create a virtual environment using the following command:&lt;/p&gt;
&lt;h3&gt;
  
  
  Steps with using miniconda.
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;First &lt;a href="https://docs.conda.io/en/latest/miniconda.html" rel="noopener noreferrer"&gt;download&lt;/a&gt; and &lt;a href="//Installing%20on%20Linux%20%E2%80%94%20conda%200.0.0.dev0+placeholder%20documentation"&gt;install&lt;/a&gt; Miniconda from their website.
&lt;/li&gt;
&lt;li&gt;Let’s create our environment.
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;3.8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;Activate the environment.
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;activate&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;Create a jupyter support for this environment.
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;nb_conda&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;Time to install tensorflow. For CPU support only, use this:
&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="n"&gt;anaconda&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;For both CPU and GPU support, use this:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="n"&gt;anaconda&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;gpu&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Verify the installation by running a simple Tensorflow program that uses the GPU. If the program executes without any errors, then the installation was successful.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;
&lt;span class="n"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;list_physical_devices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GPU&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You will see similar output, [PhysicalDevice(name=’/physical_device:GPU:0′, device_type=’GPU’)]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, installing Tensorflow with GPU support can significantly speed up the training of deep learning models. By following the above steps, you can easily install Tensorflow with GPU support in Linux or WSL.&lt;/p&gt;

&lt;p&gt;If you encounter any issues during the installation process, you can refer to the Tensorflow documentation for troubleshooting or seek assistance from the Tensorflow community. It is also important to note that the installation steps may vary depending on your system configuration.&lt;/p&gt;

&lt;p&gt;By installing Tensorflow with GPU support, you can take advantage of the power of your GPU to accelerate the training of deep learning models and achieve faster results. With the increasing demand for deep learning applications, installing Tensorflow with GPU support is becoming more important than ever.&lt;/p&gt;

</description>
      <category>tensorflow</category>
      <category>linux</category>
    </item>
    <item>
      <title>Adding SSH-key to GitHub🔐🗝️</title>
      <dc:creator>Jhohannes</dc:creator>
      <pubDate>Mon, 09 May 2022 10:56:23 +0000</pubDate>
      <link>https://forem.com/_jhohannes/adding-ssh-key-to-github-10ic</link>
      <guid>https://forem.com/_jhohannes/adding-ssh-key-to-github-10ic</guid>
      <description>&lt;p&gt;In this blog, I am going to be teaching you exactly how you could add an SSH key to your GitHub which could prevent you from constantly typing in your email and password anytime you want to push to Github. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSH key&lt;/strong&gt; which stands for &lt;em&gt;Secure Socket Shell or Secure Shell&lt;/em&gt; is just an access credential which resembles a password used to gain access to an encrypted connection between systems and and use that connection to manage a remote system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting it up on your machine
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First thing you would need to do is to generate the public and private key which would be used for the connection between your computer and Github. Your private key is meant not to be shared. If something is to be shared here, that should probably be your public key as the name suggests.&lt;/li&gt;
&lt;li&gt;And to do this, run this command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s1"&gt;'type your email here'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You would be asked the location to store the file. You can specify where you want it to be stored or press ENTER to store it in the default location.&lt;/p&gt;

&lt;p&gt;Establish your passphrase which is nothing different from password. It adds to the security of your connection so it is good you set it up. &lt;/p&gt;

&lt;p&gt;Press Enter after confirming your passphrase and you should see something like this.&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%2F5rybm4zra3r8oy8kh1qj.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%2F5rybm4zra3r8oy8kh1qj.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We need to add a key-manager which would hold our private keys for public keys authentication and would also save us some time typing our passphrase over and over again.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;ssh-agent &lt;span class="nt"&gt;-s&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to add the key-pair to the SSH.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-add ~/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hit enter and enter the passphrase.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you change your directory, you would need to specify that dir here also&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Copy the public key to use in Github&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;clip &amp;lt; ~/.ssh/id_rsa.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you couldn’t copy the key with your terminal, you can simply go the .pub file via the dir you saved the keys to. With what we have here, I will navigate to root dir and &lt;em&gt;show all hidden files and dir. Go into the .ssh folder and open and copy the key in **id_rsa.pub&lt;/em&gt;**&lt;/p&gt;

&lt;h3&gt;
  
  
  How to add the keys to Github.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open your Github and go to settings. (Top right corner by clicking on your avatar | image)&lt;/li&gt;
&lt;/ul&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%2Fe4uyhtfsfnrrocqxajhn.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%2Fe4uyhtfsfnrrocqxajhn.png" alt=" " width="191" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On your left pane, you would find SSH and GPG key. Click on thin &lt;/li&gt;
&lt;/ul&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%2Fo9u44625ro0dk0txy24r.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%2Fo9u44625ro0dk0txy24r.png" alt=" " width="320" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add new SSH key&lt;/li&gt;
&lt;/ul&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%2Fggg1gh1qfy0l1o6p40up.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%2Fggg1gh1qfy0l1o6p40up.png" alt=" " width="800" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Fill in the title and paste the copied ssh key from your clipboard.&lt;/p&gt;

&lt;p&gt;The title could be &lt;em&gt;anything&lt;/em&gt; of your choice but should be a name that would easily identified.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You would be redirect to confirm the operation by entering your Github password.&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%2F4aynfi5hj1oxtd22cio7.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%2F4aynfi5hj1oxtd22cio7.png" alt=" " width="771" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CONCLUSION
&lt;/h2&gt;

&lt;p&gt;You have now set up a secure and encrypted connection for data transfer between your computer and Github.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>github</category>
      <category>git</category>
    </item>
    <item>
      <title>Wireplumber and pipewire in conflict (Arch linux)</title>
      <dc:creator>Jhohannes</dc:creator>
      <pubDate>Fri, 29 Oct 2021 09:07:58 +0000</pubDate>
      <link>https://forem.com/_jhohannes/wireplumber-and-pipewire-in-conflict-arch-linux-1cif</link>
      <guid>https://forem.com/_jhohannes/wireplumber-and-pipewire-in-conflict-arch-linux-1cif</guid>
      <description>&lt;p&gt;If you ever try an update and run into this error in your terminal that &lt;br&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%2Fh6g8zy15guosb89qj9q9.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%2Fh6g8zy15guosb89qj9q9.png" alt=" " width="783" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is all you have to do.&lt;br&gt;
In your terminal, &lt;br&gt;
type &lt;code&gt;sudo pacman -S pipewire-media-session&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then after that&lt;br&gt;
run &lt;code&gt;sudo pacman -Syyu&lt;/code&gt; and try updating.&lt;/p&gt;

&lt;p&gt;If questions are being asked, just be careful if you have to delete or replace any file.&lt;/p&gt;

&lt;p&gt;You're welcome&lt;/p&gt;

</description>
      <category>archlinux</category>
      <category>linux</category>
    </item>
    <item>
      <title>Printing emojis😏🎉😛😛😝 in python 🐍🐍</title>
      <dc:creator>Jhohannes</dc:creator>
      <pubDate>Sun, 24 Oct 2021 11:03:31 +0000</pubDate>
      <link>https://forem.com/_jhohannes/printing-emojis-in-python-2dgg</link>
      <guid>https://forem.com/_jhohannes/printing-emojis-in-python-2dgg</guid>
      <description>&lt;p&gt;Have you ever thought of inserting emojis into your python program? Well, if you haven't, you should start thinking of inserting one into some of your mini projects to make it fun😜.&lt;br&gt;
Emojis are now everywhere, even in programming now.&lt;br&gt;
In python now, there are three ways you could insert an emoji.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You could use unicodes&lt;/li&gt;
&lt;li&gt;The Common Locale Data Repository(CLDR) names&lt;/li&gt;
&lt;li&gt;The

&lt;code&gt;emoji&lt;/code&gt;

module&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Using the unicodes
&lt;/h2&gt;

&lt;p&gt;Every emoji we use when chatting all have unicodes and we can use these unicodes in python to output these same emoji.&lt;br&gt;
&lt;strong&gt;Codes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# face with tears of joy
print("\U0001f602")

# face with tongue
print("\U0001f61b")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
😂&lt;br&gt;
😛&lt;/p&gt;

&lt;p&gt;For the full emoji list, visit &lt;a href="//unicode.org/emoji/charts/full-emoji-list.html"&gt;Link&lt;/a&gt;&lt;br&gt;
Replace the "+" with "000". So "U+1F602" becomes "U0001F602".&lt;/p&gt;
&lt;h2&gt;
  
  
  Using CLDR names
&lt;/h2&gt;

&lt;p&gt;Emojis also have CLDR short names. All the short names are provided in the link above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# face with tears of joy
print("\N{face with tears of joy}")

# face with tongue
print("\N{face with tongue}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
😂&lt;br&gt;
😛&lt;/p&gt;
&lt;h2&gt;
  
  
  Using the emoji module
&lt;/h2&gt;

&lt;p&gt;To install the module, run &lt;code&gt;pip install emoji&lt;/code&gt; in your terminal.&lt;br&gt;
We will use the CLDR short names here by using the &lt;code&gt;emojize()&lt;/code&gt; function. All spaces the the CLDR short names would be replaced by an underscore.&lt;br&gt;
&lt;strong&gt;Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import the module
import emoji

print(emoji.emojize("Python is :thumbs_up:")
print(emoji.emojize("I :red_heart: python")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
Python is 👍&lt;br&gt;
I ❤️ python&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>emoji</category>
    </item>
    <item>
      <title>Arch linux with Realtek rtl8821ce kernel freezing when WIFI is connected</title>
      <dc:creator>Jhohannes</dc:creator>
      <pubDate>Mon, 20 Sep 2021 20:58:22 +0000</pubDate>
      <link>https://forem.com/_jhohannes/arch-linux-with-realtek-rtl8821ce-kernel-freezing-when-wifi-is-connected-492d</link>
      <guid>https://forem.com/_jhohannes/arch-linux-with-realtek-rtl8821ce-kernel-freezing-when-wifi-is-connected-492d</guid>
      <description>&lt;p&gt;If you have recently installed linux and you are facing any freezing problem when connected to the WIFI, chill up buddy. I am here for you.&lt;/p&gt;

&lt;p&gt;Do not panic. There is nothing wrong with the distro nor your device. Just the kernel using the default wifi driver it came with. &lt;/p&gt;

&lt;p&gt;I would recommend you run a system update first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pacman -Syyu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If problem still persists, then follow the next instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Solved Mine.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;I tried installing the drivers manually.
&lt;a href="https://tutorialforlinux.com/2020/01/12/step-by-step-arch-linux-realtek-rtl8821ce-driver-installation-guide/" rel="noopener noreferrer"&gt;https://tutorialforlinux.com/2020/01/12/step-by-step-arch-linux-realtek-rtl8821ce-driver-installation-guide/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The link above should help.&lt;br&gt;
For garuda linux users, you can visit the &lt;strong&gt;add/Remove Software&lt;/strong&gt; to download the drivers.&lt;br&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%2Fk5sl3vjhg7z8yfpy2rxd.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%2Fk5sl3vjhg7z8yfpy2rxd.png" alt="Alt Text" width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I went into the &lt;code&gt;/etc/modprobe.d/&lt;/code&gt; folder and created a file blacklist.conf. You might have to root the folder before you can create the file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside the file I only wrote:&lt;br&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%2Fx8reb5xyzcfd53bijdrw.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%2Fx8reb5xyzcfd53bijdrw.png" alt="Alt Text" width="668" height="532"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I then went to &lt;code&gt;/etc/default/grub&lt;/code&gt; and added &lt;code&gt;pci=noaer&lt;/code&gt; to the kernel parameters.&lt;br&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%2Fsdkdi2mnu64rm1boicgf.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%2Fsdkdi2mnu64rm1boicgf.png" alt="Alt Text" width="668" height="308"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open terminal and run&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo update-grub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;then&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Problem solved!!! Screen freezes no more.&lt;br&gt;
I hope it solves yours.&lt;/p&gt;

</description>
      <category>archlinux</category>
      <category>garudalinux</category>
      <category>linux</category>
      <category>newbie</category>
    </item>
  </channel>
</rss>
