<?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: Hastycode Andreh</title>
    <description>The latest articles on DEV Community by Hastycode Andreh (@hastycodea).</description>
    <link>https://dev.to/hastycodea</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%2F1627499%2Fcf2323eb-62c2-4c7c-9706-1ae469881b39.png</url>
      <title>DEV Community: Hastycode Andreh</title>
      <link>https://dev.to/hastycodea</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hastycodea"/>
    <language>en</language>
    <item>
      <title>🔐 Fixing SSH Conflicts: Using a Separate SSH Key for GitHub</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Sat, 31 May 2025 09:00:00 +0000</pubDate>
      <link>https://dev.to/hastycodea/fixing-ssh-conflicts-using-a-separate-ssh-key-for-github-4in1</link>
      <guid>https://dev.to/hastycodea/fixing-ssh-conflicts-using-a-separate-ssh-key-for-github-4in1</guid>
      <description>&lt;p&gt;When working on multiple environments, you might run into this error when pushing to GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;identity_sign: private key /home/hastycode-andreh/.ssh/id_ed25519 contents do not match public
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This usually happens when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You already have an SSH key (&lt;code&gt;id_ed25519&lt;/code&gt;) used for something else (like a server), and&lt;/li&gt;
&lt;li&gt;You're trying to use GitHub with that same key, but GitHub doesn't recognize it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Solution:&lt;/strong&gt; Create a &lt;strong&gt;dedicated SSH key for GitHub&lt;/strong&gt;, and tell your system to use it only for GitHub connections.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Step 1: Generate a New SSH Key for GitHub
&lt;/h2&gt;

&lt;p&gt;Let’s create a new key and name it something distinct, like &lt;code&gt;id_ed25519_github&lt;/code&gt;.&lt;br&gt;
&lt;/p&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; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"your_email@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Enter file in which to save the key (/home/your-name/.ssh/id_ed25519): 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Respond with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/home/hastycode-andreh/.ssh/id_ed25519_github
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates two files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;~/.ssh/id_ed25519_github&lt;/code&gt; (private key)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;~/.ssh/id_ed25519_github.pub&lt;/code&gt; (public key)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ Step 2: Add the Key to Your SSH Agent
&lt;/h2&gt;

&lt;p&gt;Start the SSH agent if it's not already running:&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;eval&lt;/span&gt; &lt;span class="s2"&gt;"&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;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add your new GitHub key:&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_ed25519_github
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ✅ Step 3: Add Your Public Key to GitHub
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Copy your public key:
&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;cat&lt;/span&gt; ~/.ssh/id_ed25519_github.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;a href="https://github.com/settings/keys" rel="noopener noreferrer"&gt;GitHub SSH keys page&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;"New SSH Key"&lt;/strong&gt;, give it a name like “Andreh Laptop GitHub Key”, and paste the key.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  ✅ Step 4: Create a Custom SSH Config for GitHub
&lt;/h2&gt;

&lt;p&gt;Now, tell your system to use the GitHub key &lt;em&gt;only&lt;/em&gt; when talking to GitHub.&lt;/p&gt;

&lt;p&gt;Edit or create your SSH config file:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Add this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="c1"&gt;# GitHub account&lt;/span&gt;
&lt;span class="k"&gt;Host&lt;/span&gt; github.com
  &lt;span class="k"&gt;HostName&lt;/span&gt; github.com
  &lt;span class="k"&gt;User&lt;/span&gt; git
  &lt;span class="k"&gt;IdentityFile&lt;/span&gt; ~/.ssh/id_ed25519_github
  &lt;span class="k"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="no"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 This ensures your original server SSH key is untouched.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Step 5: Test the SSH Connection
&lt;/h2&gt;

&lt;p&gt;Let’s verify everything is working:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-T&lt;/span&gt; git@github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hi your-username! You've successfully authenticated, but GitHub does not provide shell access.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perfect! 🎉 You're now pushing to GitHub securely using a separate SSH key.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Optional: Clean Up Your SSH Agent (If Needed)
&lt;/h2&gt;

&lt;p&gt;If your old key is causing conflicts, you can remove it:&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 &lt;span class="nt"&gt;-d&lt;/span&gt; ~/.ssh/id_ed25519
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures your system prioritizes the GitHub key when needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Bonus: Multiple GitHub Accounts?
&lt;/h2&gt;

&lt;p&gt;If you're juggling both personal and work GitHub accounts, you can add an alias in your SSH config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Personal GitHub&lt;/span&gt;
&lt;span class="k"&gt;Host&lt;/span&gt; github.com-personal
  &lt;span class="k"&gt;HostName&lt;/span&gt; github.com
  &lt;span class="k"&gt;User&lt;/span&gt; git
  &lt;span class="k"&gt;IdentityFile&lt;/span&gt; ~/.ssh/id_ed25519_personal
  &lt;span class="k"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="no"&gt;yes&lt;/span&gt;

&lt;span class="c1"&gt;# Work GitHub&lt;/span&gt;
&lt;span class="k"&gt;Host&lt;/span&gt; github.com-work
  &lt;span class="k"&gt;HostName&lt;/span&gt; github.com
  &lt;span class="k"&gt;User&lt;/span&gt; git
  &lt;span class="k"&gt;IdentityFile&lt;/span&gt; ~/.ssh/id_ed25519_work
  &lt;span class="k"&gt;IdentitiesOnly&lt;/span&gt; &lt;span class="no"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in Git remotes, use the alias:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote set-url origin git@github.com-personal:username/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 Wrapping Up
&lt;/h2&gt;

&lt;p&gt;This setup gives you a clean and flexible way to manage multiple SSH keys on the same machine — no more conflicts between GitHub and your server environments.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>OperationalError - no such table (Django 101)</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Sat, 31 May 2025 08:58:16 +0000</pubDate>
      <link>https://dev.to/hastycodea/operationalerror-no-such-table-django-101-4e9d</link>
      <guid>https://dev.to/hastycodea/operationalerror-no-such-table-django-101-4e9d</guid>
      <description>&lt;p&gt;When you encounter the error message:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;OperationalError at /task_list - no such table: myapp_task&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Django, it typically means that the application is trying to query a database table that hasn't been created yet. In this case, Django is attempting to access the &lt;code&gt;myapp_task&lt;/code&gt; table, but it doesn't exist in the database. This situation usually happens when database migrations have not been properly made or applied after defining your models.&lt;/p&gt;

&lt;p&gt;To fix this, the first step is to ensure that your app is correctly registered in your project’s settings. Open the &lt;code&gt;settings.py&lt;/code&gt; file and check the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; list. Make sure that the name of your app — in this case, likely &lt;code&gt;'myapp'&lt;/code&gt; — is included there. If it’s missing, Django won’t recognize your models when you try to make migrations.&lt;/p&gt;

&lt;p&gt;Once you have confirmed that the app is properly listed, the next step is to generate the migrations. Migrations are Django’s way of tracking changes you make to your models and applying those changes to your database schema. To create the necessary migration files, you should run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python manage.py makemigrations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running this, Django will scan your models for any changes and prepare migration files, typically under an app’s &lt;code&gt;migrations/&lt;/code&gt; directory. If successful, you’ll see a message indicating that a new migration file has been created for your app.&lt;/p&gt;

&lt;p&gt;Following that, you need to apply these migrations to your database by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command actually executes the SQL statements necessary to create the tables in your database, including the missing &lt;code&gt;myapp_task&lt;/code&gt; table. After completing the migrations, your database will be properly updated to match your models, and the error should disappear when you revisit your &lt;code&gt;/task_list&lt;/code&gt; URL.&lt;/p&gt;

&lt;p&gt;If you run &lt;code&gt;makemigrations&lt;/code&gt; and Django tells you "No changes detected," it could mean that your &lt;code&gt;models.py&lt;/code&gt; file is missing the &lt;code&gt;Task&lt;/code&gt; model, or that it was not properly defined. In that case, you would need to double-check your model definitions to ensure that everything is correctly set up.&lt;/p&gt;

&lt;p&gt;In summary, always ensure your app is listed in &lt;code&gt;INSTALLED_APPS&lt;/code&gt;, then run &lt;code&gt;makemigrations&lt;/code&gt; to create the migration files and &lt;code&gt;migrate&lt;/code&gt; to apply them. This process will synchronize your models with your database and resolve errors related to missing tables.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>OperationalError - no such table (Django 101)</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Mon, 28 Apr 2025 08:08:23 +0000</pubDate>
      <link>https://dev.to/hastycodea/operationalerror-no-such-table-django-101-mo2</link>
      <guid>https://dev.to/hastycodea/operationalerror-no-such-table-django-101-mo2</guid>
      <description>&lt;p&gt;When you encounter the error message:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;OperationalError at /task_list - no such table: myapp_task&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Django, it typically means that the application is trying to query a database table that hasn't been created yet. In this case, Django is attempting to access the &lt;code&gt;myapp_task&lt;/code&gt; table, but it doesn't exist in the database. This situation usually happens when database migrations have not been properly made or applied after defining your models.&lt;/p&gt;

&lt;p&gt;To fix this, the first step is to ensure that your app is correctly registered in your project’s settings. Open the &lt;code&gt;settings.py&lt;/code&gt; file and check the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; list. Make sure that the name of your app — in this case, likely &lt;code&gt;'myapp'&lt;/code&gt; — is included there. If it’s missing, Django won’t recognize your models when you try to make migrations.&lt;/p&gt;

&lt;p&gt;Once you have confirmed that the app is properly listed, the next step is to generate the migrations. Migrations are Django’s way of tracking changes you make to your models and applying those changes to your database schema. To create the necessary migration files, you should run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python manage.py makemigrations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running this, Django will scan your models for any changes and prepare migration files, typically under an app’s &lt;code&gt;migrations/&lt;/code&gt; directory. If successful, you’ll see a message indicating that a new migration file has been created for your app.&lt;/p&gt;

&lt;p&gt;Following that, you need to apply these migrations to your database by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command actually executes the SQL statements necessary to create the tables in your database, including the missing &lt;code&gt;myapp_task&lt;/code&gt; table. After completing the migrations, your database will be properly updated to match your models, and the error should disappear when you revisit your &lt;code&gt;/task_list&lt;/code&gt; URL.&lt;/p&gt;

&lt;p&gt;If you run &lt;code&gt;makemigrations&lt;/code&gt; and Django tells you "No changes detected," it could mean that your &lt;code&gt;models.py&lt;/code&gt; file is missing the &lt;code&gt;Task&lt;/code&gt; model, or that it was not properly defined. In that case, you would need to double-check your model definitions to ensure that everything is correctly set up.&lt;/p&gt;

&lt;p&gt;In summary, always ensure your app is listed in &lt;code&gt;INSTALLED_APPS&lt;/code&gt;, then run &lt;code&gt;makemigrations&lt;/code&gt; to create the migration files and &lt;code&gt;migrate&lt;/code&gt; to apply them. This process will synchronize your models with your database and resolve errors related to missing tables.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Resolving Missing `_sqlite3` Module in Python on Ubuntu</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Sun, 19 Jan 2025 03:45:37 +0000</pubDate>
      <link>https://dev.to/hastycodea/resolving-missing-sqlite3-module-in-python-on-ubuntu-47id</link>
      <guid>https://dev.to/hastycodea/resolving-missing-sqlite3-module-in-python-on-ubuntu-47id</guid>
      <description>&lt;p&gt;If you encounter the error &lt;code&gt;ModuleNotFoundError: No module named '_sqlite3'&lt;/code&gt; while running Python scripts, it means the SQLite module required by the &lt;code&gt;sqlite3&lt;/code&gt; library is not installed. This is common when Python is built from source without the required SQLite development libraries. Here's how to resolve the issue:&lt;/p&gt;




&lt;h4&gt;
  
  
  1. Install SQLite Development Libraries
&lt;/h4&gt;

&lt;p&gt;Ensure your system has the necessary SQLite development libraries by running the following commands 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 update  
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;libsqlite3-dev  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This installs the &lt;code&gt;libsqlite3-dev&lt;/code&gt; package, which provides the header files and libraries needed for Python's SQLite support.  &lt;/p&gt;




&lt;h4&gt;
  
  
  2. Rebuild Python with &lt;code&gt;pyenv&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;If you are using &lt;code&gt;pyenv&lt;/code&gt; to manage Python versions, you need to reinstall the affected version to include SQLite support. Use this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pyenv &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--force&lt;/span&gt; 3.8.13  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This forces &lt;code&gt;pyenv&lt;/code&gt; to rebuild Python version &lt;code&gt;3.8.13&lt;/code&gt;, ensuring SQLite support is enabled.  &lt;/p&gt;




&lt;h4&gt;
  
  
  3. Verify Python Installation
&lt;/h4&gt;

&lt;p&gt;After rebuilding Python, you can confirm that SQLite support is working correctly. Run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"import sqlite3; print('SQLite is working')"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see &lt;code&gt;SQLite is working&lt;/code&gt; in the output, the issue has been resolved.  &lt;/p&gt;




&lt;h4&gt;
  
  
  Additional Tip
&lt;/h4&gt;

&lt;p&gt;You can check your installed Python versions using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pyenv versions  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rebuild any version of Python where SQLite support might be missing.  &lt;/p&gt;

&lt;p&gt;By following these steps, you'll ensure that your Python environment is fully equipped to handle SQLite operations.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Troubleshooting 'pip install pipenv'</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Sat, 18 Jan 2025 07:08:37 +0000</pubDate>
      <link>https://dev.to/hastycodea/troubleshooting-pip-install-pipenv-4pga</link>
      <guid>https://dev.to/hastycodea/troubleshooting-pip-install-pipenv-4pga</guid>
      <description>&lt;p&gt;If &lt;code&gt;pip install pipenv&lt;/code&gt; is not running in your terminal on Ubuntu, here are steps to troubleshoot and resolve the issue:&lt;/p&gt;




&lt;h3&gt;
  
  
  1. &lt;strong&gt;Verify Python and pip Installation&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Check if Python is installed:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; python3 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check if &lt;code&gt;pip&lt;/code&gt; is installed:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; pip3 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;pip&lt;/code&gt; is not installed, install it:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
 &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; python3-pip
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. &lt;strong&gt;Run pip with the Correct Python Version&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;On Ubuntu, the command &lt;code&gt;pip&lt;/code&gt; may point to Python 2. Use &lt;code&gt;pip3&lt;/code&gt; for Python 3:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; pip3 &lt;span class="nb"&gt;install &lt;/span&gt;pipenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3. &lt;strong&gt;Ensure &lt;code&gt;pip&lt;/code&gt; is Up-to-Date&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Update &lt;code&gt;pip&lt;/code&gt; to the latest version:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; python3 &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--upgrade&lt;/span&gt; pip
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. &lt;strong&gt;Install pipenv&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;After updating &lt;code&gt;pip&lt;/code&gt;, install &lt;code&gt;pipenv&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; python3 &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install &lt;/span&gt;pipenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  5. &lt;strong&gt;Fix Permissions Issues&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If you encounter permissions errors, use the &lt;code&gt;--user&lt;/code&gt; flag to install &lt;code&gt;pipenv&lt;/code&gt; locally:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; python3 &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--user&lt;/span&gt; pipenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ensure the local binary path is in your &lt;code&gt;PATH&lt;/code&gt; environment variable:&lt;br&gt;
&lt;/p&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 PATH="$HOME/.local/bin:$PATH"'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
 &lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  6. &lt;strong&gt;Use a Virtual Environment (Optional)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If you want to avoid system-level installation issues, create a virtual environment:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv myenv
 &lt;span class="nb"&gt;source &lt;/span&gt;myenv/bin/activate
 pip &lt;span class="nb"&gt;install &lt;/span&gt;pipenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  7. &lt;strong&gt;Debugging Common Issues&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Command Not Found&lt;/strong&gt;: Ensure &lt;code&gt;python3&lt;/code&gt; and &lt;code&gt;pip3&lt;/code&gt; are correctly installed and in your &lt;code&gt;PATH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Conflicting Dependencies&lt;/strong&gt;: If you encounter dependency issues, try using &lt;code&gt;--force-reinstall&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; python3 &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--force-reinstall&lt;/span&gt; pipenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  8. &lt;strong&gt;Verify Installation&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Check if &lt;code&gt;pipenv&lt;/code&gt; is installed:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; pipenv &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If the issue persists, share the exact error message, and I’ll provide further assistance.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Using Homebrew to Install Pyenv on Ubuntu</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Sat, 18 Jan 2025 07:07:07 +0000</pubDate>
      <link>https://dev.to/hastycodea/using-homebrew-to-install-pyenv-on-ubuntu-54ge</link>
      <guid>https://dev.to/hastycodea/using-homebrew-to-install-pyenv-on-ubuntu-54ge</guid>
      <description>&lt;p&gt;Did you know Homebrew isn’t just for macOS? You can use it on Linux too! Often called &lt;strong&gt;Linuxbrew&lt;/strong&gt;, it allows Ubuntu users to leverage Homebrew’s powerful package management features. Here’s how to install &lt;code&gt;pyenv&lt;/code&gt; using Homebrew on Ubuntu:&lt;/p&gt;




&lt;h4&gt;
  
  
  1. &lt;strong&gt;Install Homebrew on Ubuntu&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Start by installing Homebrew with this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/bin/bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts during installation. When asked, add Homebrew to your system's &lt;code&gt;PATH&lt;/code&gt; by appending this line to your shell configuration file (&lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.zshrc&lt;/code&gt;):&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;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;/home/linuxbrew/.linuxbrew/bin/brew shellenv&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reload your shell to apply the changes:&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;source&lt;/span&gt; ~/.bashrc  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify the installation:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h4&gt;
  
  
  2. &lt;strong&gt;Install pyenv Using Homebrew&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;With Homebrew set up, installing &lt;code&gt;pyenv&lt;/code&gt; is a breeze:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;pyenv  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  3. &lt;strong&gt;Configure pyenv&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Finally, set up &lt;code&gt;pyenv&lt;/code&gt; by adding this to your shell configuration file:&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;export &lt;/span&gt;&lt;span class="nv"&gt;PYENV_ROOT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/.pyenv"&lt;/span&gt;  
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PYENV_ROOT&lt;/span&gt;&lt;span class="s2"&gt;/bin:&lt;/span&gt;&lt;span class="nv"&gt;$PATH&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;  
&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;pyenv init &lt;span class="nt"&gt;--path&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reload your shell once more:&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;source&lt;/span&gt; ~/.bashrc  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  4. &lt;strong&gt;Verify pyenv Installation&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To confirm everything is working, check the &lt;code&gt;pyenv&lt;/code&gt; version:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  Why Use Homebrew on Ubuntu?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unified Management&lt;/strong&gt;: Manage all your packages consistently across systems.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of Use&lt;/strong&gt;: Homebrew simplifies installations and updates.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this setup, you're ready to install Python versions using &lt;code&gt;pyenv&lt;/code&gt; and start managing your development environment with ease.  &lt;/p&gt;

&lt;p&gt;Give it a try and enjoy the flexibility of Linuxbrew on Ubuntu!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Resolving HTTP 302 Errors</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Wed, 25 Dec 2024 17:25:54 +0000</pubDate>
      <link>https://dev.to/hastycodea/resolving-http-302-errors-11mn</link>
      <guid>https://dev.to/hastycodea/resolving-http-302-errors-11mn</guid>
      <description>&lt;p&gt;An HTTP 302 status code indicates redirection, often caused by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication requirements.&lt;/li&gt;
&lt;li&gt;Backend misconfigurations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Fixes
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Check Backend Logic:&lt;/strong&gt; Ensure no unintended redirection occurs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Authentication Headers:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="s2"&gt;`http://localhost:8080/api/product/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Debug with Tools:&lt;/strong&gt; Use Postman to inspect backend responses.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Backend Adjustment
&lt;/h3&gt;

&lt;p&gt;Return the correct status code in the controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/product/{id}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Product&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getProductById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@PathVariable&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Product&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getProductById&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
        &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;product&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;OK&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="nc"&gt;HttpStatus&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;NOT_FOUND&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By addressing these issues, you can eliminate unexpected redirections and ensure proper API responses.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mastering Surrounds in Vim: Add, Remove, and Modify Like a Pro</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Mon, 18 Nov 2024 09:11:09 +0000</pubDate>
      <link>https://dev.to/hastycodea/mastering-surrounds-in-vim-add-remove-and-modify-like-a-pro-57fb</link>
      <guid>https://dev.to/hastycodea/mastering-surrounds-in-vim-add-remove-and-modify-like-a-pro-57fb</guid>
      <description>&lt;p&gt;If you're working in Vim and frequently need to add, delete, or modify surrounding characters like parentheses, quotes, or tags, the vim-surround plugin is a must-have. Here's a quick guide to get you started.&lt;/p&gt;

&lt;p&gt;What is vim-surround?&lt;br&gt;
vim-surround, developed by Tim Pope, is a plugin that simplifies working with surrounding characters in Vim. Whether you're wrapping a word in quotes, removing parentheses, or changing tags, vim-surround makes it effortless.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding Surroundings
To add surrounding characters to text:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Install vim-surround using a plugin manager like vim-plug:&lt;br&gt;
vim&lt;br&gt;
Copy code&lt;br&gt;
Plug 'tpope/vim-surround'&lt;br&gt;
Use the command ys (yank surround) in normal mode:&lt;br&gt;
ys wraps the specified motion with the given character.&lt;br&gt;
Examples:&lt;br&gt;
ysiw) → Wraps the inner word with parentheses: (word)&lt;br&gt;
ysiw" → Wraps the inner word with double quotes: "word"&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deleting Surroundings
To remove surrounding characters:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Place the cursor inside the surrounding.&lt;br&gt;
Use the ds command followed by the surrounding character:&lt;br&gt;
ds" → Removes surrounding double quotes: "word" → word&lt;br&gt;
ds) → Removes surrounding parentheses: (word) → word&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Changing Surroundings
To change one type of surrounding to another:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Place the cursor inside the current surrounding.&lt;br&gt;
Use the cs command followed by the current and desired surrounding characters:&lt;br&gt;
cs"' → Changes double quotes to single quotes: "word" → 'word'&lt;br&gt;
cs)( → Changes parentheses to curly braces: (word) → {word}&lt;br&gt;
For Vim Without Plugins&lt;br&gt;
If you don't have vim-surround installed, you can still manually add or remove surroundings:&lt;/p&gt;

&lt;p&gt;Add: Use i (insert) or a (append) to type the surrounding characters manually.&lt;br&gt;
Remove: Use x to delete characters or visual mode (v) to select and remove.&lt;br&gt;
Why Use vim-surround?&lt;br&gt;
This plugin saves time and keystrokes, especially for repetitive editing tasks. It's simple, powerful, and enhances productivity in Vim.&lt;/p&gt;

&lt;p&gt;Try it out and watch your Vim workflow transform!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Resolving the "Unable to Resolve Name [org.hibernate.dialect.MySQLDialect]" Error in Spring Boot</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Wed, 28 Aug 2024 04:45:02 +0000</pubDate>
      <link>https://dev.to/hastycodea/resolving-the-unable-to-resolve-name-orghibernatedialectmysqldialect-error-in-spring-boot-17jj</link>
      <guid>https://dev.to/hastycodea/resolving-the-unable-to-resolve-name-orghibernatedialectmysqldialect-error-in-spring-boot-17jj</guid>
      <description>&lt;p&gt;If you've encountered the error message "Unable to resolve name [org.hibernate.dialect.MySQLDialect;] as strategy [org.hibernate.dialect.Dialect]" while working with Spring Boot and Hibernate, you're not alone. This error usually points to a misconfiguration related to the Hibernate dialect setting. In this post, we'll walk through how to resolve this issue step-by-step.&lt;/p&gt;

&lt;p&gt;Understanding the Error&lt;br&gt;
Hibernate uses the concept of "dialects" to communicate with different databases. A dialect tells Hibernate how to convert the specific SQL of your database into its own format. The error indicates that Hibernate is unable to find or recognize the specified dialect. This can be due to a typo, an incorrect class name, or even a syntax error like an extra semicolon.&lt;/p&gt;

&lt;p&gt;Step 1: Verify the Dialect Configuration&lt;br&gt;
The first step is to ensure that the Hibernate dialect is correctly specified in your configuration file (application.properties or application.yml).&lt;/p&gt;

&lt;p&gt;Here’s how you should define the dialect for different versions of MySQL:&lt;/p&gt;

&lt;p&gt;For General MySQL Use:&lt;/p&gt;

&lt;p&gt;properties&lt;br&gt;
Copy code&lt;br&gt;
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect&lt;br&gt;
For MySQL 5.x:&lt;/p&gt;

&lt;p&gt;properties&lt;br&gt;
Copy code&lt;br&gt;
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect&lt;br&gt;
For MySQL 8.x:&lt;/p&gt;

&lt;p&gt;properties&lt;br&gt;
Copy code&lt;br&gt;
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect&lt;br&gt;
Key point: Make sure there are no extra characters or typos, such as an accidental semicolon ; at the end of the dialect name.&lt;/p&gt;

&lt;p&gt;Step 2: Ensure Proper Dependencies&lt;br&gt;
The correct Hibernate and MySQL dependencies must be included in your project. If these dependencies are outdated or missing, it can cause Hibernate to fail in resolving the dialect.&lt;/p&gt;

&lt;p&gt;Here’s how you can specify these dependencies in Maven and Gradle:&lt;/p&gt;

&lt;p&gt;For Maven Users:&lt;/p&gt;

&lt;p&gt;xml&lt;br&gt;
Copy code&lt;br&gt;
&lt;br&gt;
    mysql&lt;br&gt;
    mysql-connector-java&lt;br&gt;
    8.0.x &amp;lt;!-- Replace with your MySQL version --&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
    org.hibernate&lt;br&gt;
    hibernate-core&lt;br&gt;
    5.x.x &amp;lt;!-- Replace with your Hibernate version --&amp;gt;&lt;br&gt;
&lt;br&gt;
For Gradle Users:&lt;/p&gt;

&lt;p&gt;gradle&lt;br&gt;
Copy code&lt;br&gt;
implementation 'mysql:mysql-connector-java:8.0.x'  // Replace with your MySQL version&lt;br&gt;
implementation 'org.hibernate:hibernate-core:5.x.x' // Replace with your Hibernate version&lt;br&gt;
Step 3: Clear Caches and Rebuild Your Project&lt;br&gt;
Development environments like IntelliJ IDEA or Eclipse may cache old configurations, causing issues even after you've fixed your code.&lt;/p&gt;

&lt;p&gt;Invalidate Caches/Restart in IntelliJ IDEA: Navigate to File &amp;gt; Invalidate Caches / Restart to clear the cache and restart your IDE.&lt;/p&gt;

&lt;p&gt;Clean and Rebuild the Project: Use the following commands to clean and rebuild your project:&lt;/p&gt;

&lt;p&gt;Maven: mvn clean install&lt;br&gt;
Gradle: ./gradlew clean build&lt;br&gt;
Step 4: Update the Hibernate Dialect&lt;br&gt;
If you're using a specific version of MySQL, it's essential to use the corresponding dialect to avoid compatibility issues.&lt;/p&gt;

&lt;p&gt;For MySQL 8.x:&lt;br&gt;
properties&lt;br&gt;
Copy code&lt;br&gt;
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect&lt;br&gt;
Using an outdated or incorrect dialect can lead to unexpected errors, so always ensure you're using the correct one for your database version.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
The "Unable to resolve name [org.hibernate.dialect.MySQLDialect;] as strategy [org.hibernate.dialect.Dialect]" error is primarily a configuration issue. By carefully verifying your dialect settings, ensuring you have the correct dependencies, and cleaning your project cache, you can resolve this issue and get your Spring Boot application running smoothly.&lt;/p&gt;

&lt;p&gt;Have you encountered this error before? Share your experiences or any additional tips in the comments below!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Pattern and Matcher Classes in Java</title>
      <dc:creator>Hastycode Andreh</dc:creator>
      <pubDate>Wed, 21 Aug 2024 10:12:22 +0000</pubDate>
      <link>https://dev.to/hastycodea/understanding-pattern-and-matcher-classes-in-java-c8</link>
      <guid>https://dev.to/hastycodea/understanding-pattern-and-matcher-classes-in-java-c8</guid>
      <description>&lt;p&gt;When working with regular expressions in Java, the &lt;code&gt;Pattern&lt;/code&gt; and &lt;code&gt;Matcher&lt;/code&gt; classes are essential tools. Both are part of the &lt;code&gt;java.util.regex&lt;/code&gt; package and provide robust mechanisms to search, match, and manipulate strings based on regular expression patterns. In this blog post, we'll explore each class in detail and provide examples to illustrate their usage.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Pattern Class
The &lt;code&gt;Pattern&lt;/code&gt; class represents a compiled version of a regular expression. In simpler terms, it's a blueprint for the regex operations you want to perform. Here’s a quick overview of its role:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Compilation: Before you can perform any regex operations, you need to compile your regular expression into a &lt;code&gt;Pattern&lt;/code&gt;. This step transforms your regex string into an optimized format that Java can use efficiently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Usage: Once compiled, you can use the &lt;code&gt;Pattern&lt;/code&gt; to create &lt;code&gt;Matcher&lt;/code&gt; objects, which can then be used to perform various operations, such as searching or matching.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.regex.Pattern&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PatternExample&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"[a-zA-Z]+"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="nc"&gt;Pattern&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pattern&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compile&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Now, the pattern is ready to be used for matching operations.&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;[a-zA-Z]+&lt;/code&gt; is a regex that matches one or more letters, both uppercase and lowercase. This pattern is compiled into a &lt;code&gt;Pattern&lt;/code&gt; object, which can be used to create a &lt;code&gt;Matcher&lt;/code&gt; for further operations.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Matcher Class
The &lt;code&gt;Matcher&lt;/code&gt; class is where the action happens. After you have a &lt;code&gt;Pattern&lt;/code&gt;, you can use it to create a &lt;code&gt;Matcher&lt;/code&gt; object that applies the regex to a specific string. The &lt;code&gt;Matcher&lt;/code&gt; class provides several methods to interact with the string:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Matching: You can check if the entire string matches the pattern using the &lt;code&gt;matches()&lt;/code&gt; method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finding Substrings: The &lt;code&gt;find()&lt;/code&gt; method allows you to search for substrings within the string that match the pattern.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replacing: The &lt;code&gt;replaceAll()&lt;/code&gt; method enables you to replace all occurrences of the pattern within the string with a new substring.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.regex.Pattern&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.util.regex.Matcher&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MatcherExample&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"\\d+"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"My number is 1234 and my friend's number is 5678."&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="nc"&gt;Pattern&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pattern&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;compile&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="nc"&gt;Matcher&lt;/span&gt; &lt;span class="n"&gt;matcher&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;matcher&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;matcher&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;find&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Found a number: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;matcher&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the regex &lt;code&gt;\\d+&lt;/code&gt; matches one or more digits. The &lt;code&gt;Matcher&lt;/code&gt; object is created by applying the compiled pattern to the input string. The &lt;code&gt;find()&lt;/code&gt; method is then used to locate all substrings within the input that match the pattern.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
The &lt;code&gt;Pattern&lt;/code&gt; and &lt;code&gt;Matcher&lt;/code&gt; classes are powerful tools for working with regular expressions in Java. By compiling regex into a &lt;code&gt;Pattern&lt;/code&gt; and using a &lt;code&gt;Matcher&lt;/code&gt; to apply that pattern to strings, you can perform complex string manipulations and searches with ease. Whether you're validating input, searching for patterns, or transforming strings, these classes provide the functionality you need to work efficiently with regular expressions in Java.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
