<?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: Kenneth Isaac</title>
    <description>The latest articles on DEV Community by Kenneth Isaac (@kenzysc).</description>
    <link>https://dev.to/kenzysc</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%2F852716%2F2316016a-510e-422a-b366-35e90790c1ea.jpg</url>
      <title>DEV Community: Kenneth Isaac</title>
      <link>https://dev.to/kenzysc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kenzysc"/>
    <language>en</language>
    <item>
      <title>[vite] Internal server error: Cannot read properties of undefined (reading 'length') for Tailwind and PostCSS.</title>
      <dc:creator>Kenneth Isaac</dc:creator>
      <pubDate>Tue, 25 Oct 2022 14:21:53 +0000</pubDate>
      <link>https://dev.to/kenzysc/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss-5g7</link>
      <guid>https://dev.to/kenzysc/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss-5g7</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclaimer: this is not a fix but rather a quick hack, so that, for instance, you might continue building.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; You've just installed TailwindCSS but you get the error below as well as some indication that it might related to the PostCSS config.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ [postcss] Cannot read properties of undefined (reading 'config')
$ [vite] Internal server error: [postcss] Cannot read properties of undefined (reading 'config')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Quick Hack:&lt;/strong&gt; Copy the content of &lt;em&gt;module.export&lt;/em&gt; in the &lt;em&gt;tailwind.config.js&lt;/em&gt; file into the value of the &lt;em&gt;tailwindcss&lt;/em&gt; property in the &lt;em&gt;postcss.config.js&lt;/em&gt; file. Your final result should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./postcss.config.js

1  module.exports = {
2   plugins: {
3    tailwindcss: {
4       content: [
5         "./index.html",
6         "./src/**/*.{vue,js,ts,jsx,tsx}",
7       ],
8       theme: {
9         extend: {},
10      },
11      plugins: [
12        require('@tailwindcss/forms'),
13      ],
14    },
15    autoprefixer: {},
16  },
17 }

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

&lt;/div&gt;



&lt;p&gt;That should do the hack. Cheers.&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>postcss</category>
      <category>vite</category>
      <category>config</category>
    </item>
    <item>
      <title>How to stop Localhost server running on multiple ports.</title>
      <dc:creator>Kenneth Isaac</dc:creator>
      <pubDate>Tue, 25 Oct 2022 12:40:34 +0000</pubDate>
      <link>https://dev.to/kenzysc/how-to-stop-localhost-server-running-on-multiple-ports-3hab</link>
      <guid>https://dev.to/kenzysc/how-to-stop-localhost-server-running-on-multiple-ports-3hab</guid>
      <description>&lt;p&gt;I ran into a situation where I had multiple localhost ports. This is my fault as I failed to clearly close them. &lt;/p&gt;

&lt;p&gt;So what do we do? A very simple way is to run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx kill-port &amp;lt;port&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;replace port with the port you want to close without the bracket.&lt;/p&gt;

&lt;p&gt;Note that if you don't have the &lt;em&gt;kill-port&lt;/em&gt; package installed, you would be prompted to install it.&lt;/p&gt;

&lt;p&gt;There you go. Make sure you close your servers with &lt;strong&gt;Ctrl + C&lt;/strong&gt;, unless stated otherwise. &lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>localhost</category>
      <category>ports</category>
      <category>wsl2</category>
    </item>
    <item>
      <title>How to Connect WSL2 (with Laravel App) to a XAMPP MySql Server on Windows</title>
      <dc:creator>Kenneth Isaac</dc:creator>
      <pubDate>Sat, 22 Oct 2022 15:28:14 +0000</pubDate>
      <link>https://dev.to/kenzysc/how-to-connect-wsl2-with-laravel-app-to-a-xampp-mysql-server-on-windows-7jd</link>
      <guid>https://dev.to/kenzysc/how-to-connect-wsl2-with-laravel-app-to-a-xampp-mysql-server-on-windows-7jd</guid>
      <description>&lt;p&gt;You have a MySql server running on Windows perhaps with XAMPP. You also have Wsl2 and want to access that database from Wsl2 for your for your application. What do you do?&lt;/p&gt;

&lt;p&gt;I assume you have XAMPP running already and have Apache and MySql started and you've also created a table you want to access. Good.&lt;/p&gt;

&lt;p&gt;You also have a Laravel app and you are having problem running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and you are getting such error as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ Illuminate\Database\QueryException

  SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = laravel_survey and table_name = migrations and table_type = 'BASE TABLE')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that, when you connect from a remote system (and WSL2 is remote system), that you'll need to create a user with access from Wsl2 and allow connections from Wsl2. You can get more detailed info from this &lt;a href="https://www.reddit.com/r/bashonubuntuonwindows/comments/t2wu6q/how_to_connect_to_ubuntu_to_xampp_mysql/"&gt;reddit post.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next you have to check if you have a Sql client on your Wsl2 machine. This client is different from a Sql Server. The client is what you would use to connect to the Sql server on windows.&lt;/p&gt;

&lt;p&gt;Try any of the command below. The second command worked for me and I'm on an Ubuntu box. &lt;a href="https://dev.to/qviper/connecting-mysql-server-in-windows-machine-from-wsl-4pf1"&gt;source&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install mysql-client-core-8.0     # version 8.0.27-0ubuntu0.20.04.1, or
$ sudo apt install mariadb-client-core-10.3  # version 1:10.3.31-0ubuntu0.20.04.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;_make sure you've also installed a Sql driver if you are running on a Laravel app. Run:&lt;br&gt;
&lt;code&gt;$ sudo apt-get install php7.4-mysql&lt;/code&gt;&lt;br&gt;
_&lt;/p&gt;

&lt;p&gt;Next, go into PhpMyAdmin, locate your created table and click on it. Navigate to &lt;strong&gt;Privileges&lt;/strong&gt; among the menu at the top of the screen. Find all username with &lt;em&gt;root&lt;/em&gt; and click on &lt;em&gt;Edit privileges&lt;/em&gt;. Tick on &lt;strong&gt;Global privileges&lt;/strong&gt; and click Go.&lt;/p&gt;

&lt;p&gt;Now, there is an alternative method to do this, using Windows Cmd or Shell from XAMPP and connecting to the MySql database directly and type in some SQL code directly.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ mysql -u root -p -h 127.0.0.1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then type this command in:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;gt; CREATE USER 'root'@'%' IDENTIFIED BY 'root'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As I've written above, what the command does is, create a user with access from Wsl2 and allow connections from Wsl2 or any remote system and as you might tell, could constitute a security risk since you are granting all privileges.&lt;/p&gt;

&lt;p&gt;Next, on Wsl2, run:&lt;br&gt;
&lt;code&gt;$ mysql -u root -p -h "$(hostname).local"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Skip the password prompt by tapping enter.&lt;/p&gt;

&lt;p&gt;Congratulations, you've connected to your MySql database on your Windows host from Wsl2. &lt;/p&gt;

&lt;p&gt;Now, for the Laravel app to be able to run migrations, you need to go into the &lt;strong&gt;.env&lt;/strong&gt; file and edit the Sql section but before that, run:&lt;br&gt;
&lt;code&gt;$ echo $(hostname).local&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and copy or note the result. &lt;/p&gt;

&lt;p&gt;Next, edit the MySql section of your &lt;strong&gt;.env&lt;/strong&gt; file to the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=mysql
DB_HOST=DESKTOP-BB111.local #this should be the result of the last command above and should end with .local
DB_PORT=3306
DB_DATABASE=laravel_counter #this is the name of the database you created and as seen on your PhpMyAdmin
DB_USERNAME=root
DB_PASSWORD= #leave this empty
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save that file and get back to your terminal and run:&lt;br&gt;
&lt;code&gt;php artisan migrate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Watch as your migration loads and smile. &lt;/p&gt;

&lt;p&gt;You've successfully connected your Wsl2 box to a service running on your Windows host. Now if you don't mind, go reward yourself a bit. Cheers.&lt;/p&gt;

&lt;p&gt;Apparently, connecting to a Wsl2 service from windows is much easier and comes set up, I guess because of Port Forwarding. &lt;/p&gt;

&lt;p&gt;I hope this post has helped you in some way. Thank you for reading.&lt;/p&gt;

</description>
      <category>wsl</category>
      <category>laravel</category>
      <category>mysql</category>
      <category>windows</category>
    </item>
  </channel>
</rss>
