<?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: Damian Brdej</title>
    <description>The latest articles on DEV Community by Damian Brdej (@quentindamianino).</description>
    <link>https://dev.to/quentindamianino</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%2F474188%2Fa89bc5d8-5415-4bfa-b8e7-92a06783b229.jpg</url>
      <title>DEV Community: Damian Brdej</title>
      <link>https://dev.to/quentindamianino</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/quentindamianino"/>
    <language>en</language>
    <item>
      <title>The problem with tech Twitter</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Thu, 17 Oct 2024 16:08:05 +0000</pubDate>
      <link>https://dev.to/quentindamianino/the-problem-with-tech-twitter-g39</link>
      <guid>https://dev.to/quentindamianino/the-problem-with-tech-twitter-g39</guid>
      <description>&lt;h1&gt;
  
  
  The Problem I Have with Tech Twitter
&lt;/h1&gt;

&lt;p&gt;As a developer who's been in the industry for a while, I've noticed a concerning trend on tech Twitter that's been bothering me more and more. It's not just about the constant stream of new technologies or frameworks – it's about the way information is shared and the impact it has on the developer community.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hype Train Never Stops
&lt;/h2&gt;

&lt;p&gt;The other day, I found myself justifiably using MongoDB in a project, and it made me reflect on how we got here. Remember when MongoDB was the hottest thing in tech Twitter? Everyone was singing its praises, urging developers to abandon their SQL databases for this NoSQL solution.&lt;/p&gt;

&lt;p&gt;It was as if the entire dev community on Twitter collectively decided that relational databases were outdated overnight. But here's the thing: for many projects, this shift was like a family of five trading in their practical station wagon for a Porsche 911. Sure, the Porsche is sleek and fast, but good luck fitting your kids, the dog, and the groceries in it! (Though I have a friend who insists a 911 is a family car - to each their own, I suppose.)&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Gurus" Problem
&lt;/h2&gt;

&lt;p&gt;The longer I spend in the programming world and on tech Twitter, the more I realize that many of these self-proclaimed "programming gurus" are just jumping from one hype train to another. They're like tech magpies, always drawn to the next shiny object without considering its practical applications.&lt;/p&gt;

&lt;p&gt;It's almost comical to watch them hop from one trendy technology to the next, proclaiming each as the ultimate solution to all of our coding woes. Their tweets often read like infomercials, promising revolutionary changes with each new tool or framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Shifting Tides
&lt;/h2&gt;

&lt;p&gt;But here's where it gets interesting: as the tech industry faces challenges, we're starting to see a shift on tech Twitter. These same gurus who once praised only the cutting-edge are beginning to endorse the "boring" technologies they previously shunned.&lt;/p&gt;

&lt;p&gt;It's not just me noticing this trend. On Twitter, these hype-chasers are increasingly being called out as "tech bros." The community is becoming more aware of the hollow nature of their constantly shifting allegiances, and it's refreshing to see some pushback.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Drama Cycle
&lt;/h2&gt;

&lt;p&gt;Tech Twitter seems to thrive on drama and predictions of doom. Take the recent discussions about WordPress, for example. Many tweetstorms are prophesying the fall of WordPress, conveniently forgetting how they made similar predictions about GitHub's demise when Microsoft acquired it.&lt;/p&gt;

&lt;p&gt;This cycle of hype and doom-saying isn't just annoying – it's potentially harmful to developers, especially those new to the field who might take these proclamations at face value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;As developers, it's crucial to see past the hype that dominates tech Twitter and focus on what truly matters: choosing the right tool for the job. Sometimes, that might mean embracing a cutting-edge technology. Other times, it might mean sticking with a "boring" but reliable solution.&lt;/p&gt;

&lt;p&gt;The problem with tech Twitter is that it often fails to provide this balanced perspective. Instead, it amplifies voices that are more interested in gaining followers than in providing nuanced, practical advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Call for Change
&lt;/h2&gt;

&lt;p&gt;So, what can we do about this? As consumers of tech content on Twitter, we need to be more critical of what we read. We should seek out voices that provide balanced, experience-based insights rather than just jumping on the latest trend.&lt;/p&gt;

&lt;p&gt;For those of us creating content, let's strive to be more responsible. Let's talk about both the pros and cons of new technologies. Let's admit when we don't know something, and let's be open about the times we've been wrong.&lt;/p&gt;

&lt;p&gt;The next time you see a tweet proclaiming the death of a popular platform or the rise of a new game-changing technology, take a step back. Remember the MongoDB craze, the GitHub acquisition panic, and all the other false alarms that have echoed through tech Twitter.&lt;/p&gt;

&lt;p&gt;In the end, solid engineering principles and a clear understanding of your project's needs will serve you far better than chasing the latest trend championed by tech Twitter. Let's work towards a more thoughtful, nuanced discussion of technology – even if it doesn't fit neatly into 280 characters.&lt;/p&gt;

</description>
      <category>twitter</category>
      <category>techbros</category>
      <category>trends</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Laradock - ready to use PHP docker environment</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Sun, 16 Jan 2022 21:38:30 +0000</pubDate>
      <link>https://dev.to/quentindamianino/laradock-ready-to-use-php-docker-environment-320e</link>
      <guid>https://dev.to/quentindamianino/laradock-ready-to-use-php-docker-environment-320e</guid>
      <description>&lt;p&gt;Laradock is a full PHP development environment for Docker. It contains a variety of popular services such as PostgreSQL, MySQL, Redis, MongoDB, PHPmyAdmin, and so on.&lt;/p&gt;

&lt;p&gt;Let's setup empty Symfony project with a PostgreSQL database to see how it works:&lt;/p&gt;

&lt;h4&gt;
  
  
  First clone project from GitHub repository:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;git clone https://github.com/Laradock/laradock.git&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Next enter the laradock directory and rename &lt;code&gt;.env.example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt;:
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;cp .env.example .env&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Let's look at the basic settings in the &lt;code&gt;.env&lt;/code&gt; file
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;APP_CODE_PATH_HOST&lt;/code&gt; - here you can specify the location of the directory with your project&lt;/p&gt;

&lt;p&gt;&lt;code&gt;PHP_VERSION&lt;/code&gt; - with this setting you can set up a version of PHP, unfortunately at the time of writing this article the newest available version in laradock is 8.0&lt;/p&gt;

&lt;p&gt;I set up the location on my project to &lt;code&gt;../app&lt;/code&gt; and PHP version to 8.0.&lt;/p&gt;

&lt;h4&gt;
  
  
  Now we can start containers
&lt;/h4&gt;

&lt;p&gt;To do so type: &lt;code&gt;docker-compose up -d nginx postgres&lt;/code&gt; - this command will create Nginx and Postgres container. First start-up may take a while but next ones should be quick.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you get an error that the address is already in use just change the port in the blocking service. For example to change the port of Nginx change value of &lt;code&gt;NGINX_HOST_HTTP_PORT&lt;/code&gt; variable in the &lt;code&gt;.env&lt;/code&gt; file.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Nginx and PostgreSQL are two of many services available in laradock. Full list of services you can check on the project &lt;a href="https://laradock.io" rel="noopener noreferrer"&gt;page&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  Set up our Symfony project
&lt;/h4&gt;

&lt;p&gt;We need to get into Docker container by typing:&lt;br&gt;
 &lt;code&gt;docker exec -it laradock_workspace_1 sh&lt;/code&gt;&lt;br&gt;
When we are in a container we can use composer to install Symfony:&lt;br&gt;
&lt;code&gt;composer create-project symfony/skeleton .&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;After this, we can visit &lt;code&gt;localhost&lt;/code&gt; in our browser to see the standard Symfony 404 page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpntgm9qw3glwf5uqbdl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpntgm9qw3glwf5uqbdl.png" alt="Symfony 404 page" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Setting up PostgreSQL:
&lt;/h4&gt;

&lt;p&gt;In workspace container execute another command: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;composer require symfony/orm-pack&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and then configure a database connection in Symfony &lt;code&gt;.env&lt;/code&gt;, all needed configuration data we can find in laradock &lt;code&gt;.env&lt;/code&gt;. The default ones 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;POSTGRES_VERSION=alpine
POSTGRES_DB=default
POSTGRES_USER=default
POSTGRES_PASSWORD=secret
POSTGRES_PORT=5432
POSTGRES_ENTRYPOINT_INITDB=./postgres/docker-entrypoint-initdb.d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But what's the host?&lt;/p&gt;

&lt;p&gt;Host is simply a service name, so in our case it is &lt;code&gt;postgres&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Whole connection configuration variable in symfony &lt;code&gt;.env&lt;/code&gt; looks like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;DATABASE_URL="postgresql://default:secret@postgres:5432/default?serverVersion=13&amp;amp;charset=utf8"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And that's it, we've set up docker environment with nginx and postgreSQL. Now go and write some code!!!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>php</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Selection sort algorithm</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Wed, 29 Dec 2021 20:41:11 +0000</pubDate>
      <link>https://dev.to/quentindamianino/selection-sort-algorithm-46nc</link>
      <guid>https://dev.to/quentindamianino/selection-sort-algorithm-46nc</guid>
      <description>&lt;p&gt;Let's look at the "&lt;a href="https://dev.to/top/week"&gt;top&lt;/a&gt;" tab on dev.to, there is a list with the most popular articles on the portal. To display it, first we need to sort all articles by number of views. To do that we can use Selection sort algorithm.&lt;/p&gt;

&lt;p&gt;The principle of this algorithm is very simple - we search the list of articles looking for the one with the highest number of views, then we copy it to the first index in the newly created list and remove this item from the old list. We repeat these steps until we have a sorted list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;findBiggest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;biggest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;biggest_index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;biggest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;biggest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="n"&gt;biggest_index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;biggest_index&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;selectionSort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;newArr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="n"&gt;biggest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;findBiggest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;newArr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;biggest&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newArr&lt;/span&gt;


&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;selectionSort&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;51&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;63&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt; &lt;span class="c1"&gt;# [101, 63, 51, 32, 2]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The algorithm although simple is very slow with a large amount of data, so the dev.to developers surely used something faster. The speed of this algorithm specified in Big O notation is O(n2), since we have to search every element in the list.&lt;/p&gt;

&lt;p&gt;More about Big O notation you can read in my previous post &lt;a href="https://dev.to/quentindamianino/big-o-notation-418h"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>beginners</category>
      <category>programming</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Binary search algorithm</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Tue, 28 Dec 2021 12:06:17 +0000</pubDate>
      <link>https://dev.to/quentindamianino/binary-search-algorithm-104c</link>
      <guid>https://dev.to/quentindamianino/binary-search-algorithm-104c</guid>
      <description>&lt;p&gt;Binary search is an algorithm in which a sorted list of elements is given as input. If the list contains the item we are looking for, the algorithm returns information about its location. Otherwise, it returns the null value.&lt;/p&gt;

&lt;p&gt;In a binary search, we guess the middle number in order to eliminate half of the remaining numbers in each trial.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;binnary_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;  &lt;span class="c1"&gt;#1
&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;    &lt;span class="c1"&gt;#2
&lt;/span&gt;        &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;     &lt;span class="c1"&gt;#3
&lt;/span&gt;            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;      &lt;span class="c1"&gt;#4
&lt;/span&gt;            &lt;span class="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;                 &lt;span class="c1"&gt;#5
&lt;/span&gt;            &lt;span class="n"&gt;low&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;

&lt;span class="n"&gt;my_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;345&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;binnary_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;345&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;#9
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;binnary_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;#6
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;binnary_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_list&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;#None
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break this program down into parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use low and high to control which part of the list is searched&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As long as the search area has not been narrowed down to one element, we select the middle element&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Element found&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Our guess is too big&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Our guess is too low&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There is no such element&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Remember that numbering in lists starts at 0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Binary search is a good alternative to searching the entire list of items one by one. The speed of a binary search with a list of 10 elements is O(log 10) which gives us a maximum of 4 guesses.&lt;/p&gt;

&lt;p&gt;More about Big O notation you can read in my previous post &lt;a href="https://dev.to/quentindamianino/big-o-notation-418h"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>computerscience</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Big O notation</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Mon, 27 Dec 2021 12:46:33 +0000</pubDate>
      <link>https://dev.to/quentindamianino/big-o-notation-418h</link>
      <guid>https://dev.to/quentindamianino/big-o-notation-418h</guid>
      <description>&lt;p&gt;&lt;strong&gt;Big O notation is a special way to describe the speed of algorithms.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's say we need to find a name in the phone book (yes, that old book with phone numbers). We can, of course, search all the names one by one, but this will be time consuming, better at this point to open the phone book halfway and see if we hit it. If not we open the phone book in the middle again, this time between the previous middle and the beginning or end of the book, and so on until we find the right name.&lt;/p&gt;

&lt;p&gt;To see which algorithm is faster we can measure the time between the two algorithms simply by measuring the time in which they executed. But what if we are looking for the first name in the phone book - the first way will prove to be more efficient as it will only need one operation to complete. But what if we are looking for the last name in the phone book - then the second algorithm will turn out to be incredibly faster.&lt;/p&gt;

&lt;p&gt;Which algorithm to choose, then? With help comes the Big O notation&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The big O notation specifies the worst-case running time of the algorithm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The information alone on how long an algorithm took to execute is not sufficient, more important information for the programmer is how much the execution time increases as the number of elements increases.&lt;/p&gt;

&lt;p&gt;Big O notation looks like this: &lt;/p&gt;

&lt;p&gt;O(n) - First comes big O, and in parentheses the number of operations to be performed in the worst possible case&lt;/p&gt;

&lt;p&gt;The name "Big O notation" comes from the fact that it puts the letter O in front of the number of operations (yes, seriously!)&lt;/p&gt;

&lt;p&gt;Below is a list of the most common execution times expressed in the Big O notation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;O(log n) - logarithmic time, e.g binary search&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;O(n) - linear time, e.g linear search&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;O(n ⋅ log n) - e.g quicksort&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;O(n&lt;sup&gt;2&lt;/sup&gt;) - e.g selection sort&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;O(n!) - very slow algorithm, e.g traveling salesmen problem&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;the speed of execution of algorithms is not expressed in seconds, but in the rate of increase in the number of operations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When discussing the speed of the algorithm, it is stated how fast the execution time increases as the size of the input set increases&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The execution time of the algorithms is expressed in the Big O notation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The larger the dataset the greater the difference in algorithm execution time&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>algorithms</category>
      <category>beginners</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>if/else in CSS</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Sat, 25 Dec 2021 22:53:31 +0000</pubDate>
      <link>https://dev.to/quentindamianino/ifelse-in-css-45f5</link>
      <guid>https://dev.to/quentindamianino/ifelse-in-css-45f5</guid>
      <description>&lt;p&gt;As we know, there are no conditional statements in CSS, but this may soon change with new &lt;code&gt;@when&lt;/code&gt; and &lt;code&gt;@else&lt;/code&gt; operator&lt;/p&gt;

&lt;p&gt;Currently, the only way to perform a conditional statement was to use media queries like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* ... */&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;599px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* ... */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works perfectly, but in the new proposal it looks much cleaner and very similar to many programming languages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@when&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* ... */&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* ... */&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can do multiple conditions as well by using multiple &lt;code&gt;@else&lt;/code&gt; statements, and not just use &lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt;, but @supports too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@when&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="err"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="m"&gt;600px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;fine&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;supports&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* A */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="n"&gt;supports&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;caret-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;supports&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;double-rainbow&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* B */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;@else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* C */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There may be questions about the naming of this new feature. Some people think that &lt;code&gt;@if&lt;/code&gt; would be a better name than &lt;code&gt;@when&lt;/code&gt;, the reason behind this naming is probably that Sass already uses &lt;code&gt;@if&lt;/code&gt;, and it would be annoying to many developers if they had to refactor their Sass logic.&lt;/p&gt;

&lt;p&gt;The bad news is that it's not supported by any browser at this moment, it's not even listed on &lt;code&gt;caniuse.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What do you think about this new proposal?&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>news</category>
    </item>
    <item>
      <title>8 most useful PhpStorm keyboard shortcuts</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Mon, 20 Dec 2021 13:40:12 +0000</pubDate>
      <link>https://dev.to/quentindamianino/8-most-useful-phpstorm-keyboard-shortcuts-4476</link>
      <guid>https://dev.to/quentindamianino/8-most-useful-phpstorm-keyboard-shortcuts-4476</guid>
      <description>&lt;h3&gt;
  
  
  &lt;code&gt;Double Shift&lt;/code&gt; - Search Everywhere
&lt;/h3&gt;

&lt;p&gt;Quickly find any file, action, class, symbol, tool window, or setting in PhpStorm, in your project, and in the current Git repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Ctrl+Shift+A&lt;/code&gt; - Find Action
&lt;/h3&gt;

&lt;p&gt;Find a command and execute it, open a tool window, or search for a setting.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Alt+Enter&lt;/code&gt; - Show Context Actions
&lt;/h3&gt;

&lt;p&gt;Quick fixes for highlighted errors and warnings, intention actions for improving and optimizing your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;F2&lt;/code&gt; and &lt;code&gt;Shift+F2&lt;/code&gt; - Navigate between code issues
&lt;/h3&gt;

&lt;p&gt;Jump to the next or previous highlighted error.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Ctrl+E&lt;/code&gt; - View recent files
&lt;/h3&gt;

&lt;p&gt;Select a recently opened file from the list.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Ctrl+W&lt;/code&gt; and &lt;code&gt;Ctrl+Shift+W&lt;/code&gt; - Extend or shrink selection
&lt;/h3&gt;

&lt;p&gt;Increase or decrease the scope of selection according to specific code constructs.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Ctrl+/&lt;/code&gt; and &lt;code&gt;Ctrl+Shift+/&lt;/code&gt; - Add/remove line or block comment
&lt;/h3&gt;

&lt;p&gt;Comment out a line or block of code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Alt+F7&lt;/code&gt; - Find Usages
&lt;/h3&gt;

&lt;p&gt;Show all places where a code element is used across your project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;To master your programming skills first you have to master tools you use. &lt;br&gt;
Which keyboard shortcut you use most often?&lt;/p&gt;

</description>
      <category>programming</category>
      <category>php</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Number one question on every PHP interview</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Fri, 17 Dec 2021 10:40:27 +0000</pubDate>
      <link>https://dev.to/quentindamianino/number-one-question-on-every-php-interview-2na2</link>
      <guid>https://dev.to/quentindamianino/number-one-question-on-every-php-interview-2na2</guid>
      <description>&lt;p&gt;I am a PHP programmer and have been on many job interviews. I noticed that on each of them one question always came up.&lt;/p&gt;

&lt;p&gt;That question is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's the difference between abstract class and interface?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer to this question is simple and proves the candidate's familiarity with object-oriented programming.&lt;/p&gt;

&lt;p&gt;So let's compare these two:&lt;/p&gt;

&lt;h2&gt;
  
  
  Abstract class
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It can provide some functionality and leave the rest for the derived class.&lt;/li&gt;
&lt;li&gt;The derived class may or may not override the concrete functions defined in the base class.&lt;/li&gt;
&lt;li&gt;A child class extended from an abstract class should logically be related.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To declare class to be abstract just simply &lt;code&gt;abstract&lt;/code&gt; before &lt;code&gt;class&lt;/code&gt; keyword&lt;/p&gt;

&lt;h2&gt;
  
  
  Interface
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It cannot contain any functionality. It only contains definitions of the methods.&lt;/li&gt;
&lt;li&gt;The derived class MUST provide code for all the methods defined in the interface.&lt;/li&gt;
&lt;li&gt;Completely different and non-related classes can be logically grouped together using an interface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To declare interface use &lt;code&gt;interface&lt;/code&gt; keyword&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface Template
{
    public function setVariable($name, $var);
    public function getHtml($template);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>webdev</category>
      <category>php</category>
      <category>beginners</category>
    </item>
    <item>
      <title>PHP - Deprecation of Dynamic Properties</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Sun, 28 Nov 2021 18:12:12 +0000</pubDate>
      <link>https://dev.to/quentindamianino/php-deprecation-of-dynamic-values-4fko</link>
      <guid>https://dev.to/quentindamianino/php-deprecation-of-dynamic-values-4fko</guid>
      <description>&lt;p&gt;Recently the Deprecate dynamic properties RFC has been approved for PHP 8.2, which means that dynamic properties will not be allowed in PHP 9.0.&lt;/p&gt;

&lt;p&gt;here's an example of declaring dynamic property:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$user&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;User&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Assigns declared property User::$name.&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"foo"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Oops, a typo:&lt;/span&gt;
&lt;span class="nv"&gt;$user&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;nane&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"foo"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// PHP &amp;lt;= 8.1: Silently creates dynamic $user-&amp;gt;nane property.&lt;/span&gt;
&lt;span class="c1"&gt;// PHP    8.2: Raises deprecation warning, still creates dynamic property.&lt;/span&gt;
&lt;span class="c1"&gt;// PHP    9.0: Throws Error exception.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;code snippet from &lt;a href="https://wiki.php.net/rfc/deprecate_dynamic_properties" rel="noopener noreferrer"&gt;https://wiki.php.net/rfc/deprecate_dynamic_properties&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Judging by the pace of PHP development, version 8.2 will be released in November 2022, and version 9.0 in November 2025 so we have plenty of time to prepare for this change.&lt;/p&gt;

&lt;p&gt;In my opinion, this is a good change, it makes PHP more strict language and it will prevent mistakes and hard to find bugs.&lt;/p&gt;

&lt;p&gt;And what do you think about this change?&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Useful Docker Commands</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Mon, 22 Nov 2021 21:22:02 +0000</pubDate>
      <link>https://dev.to/quentindamianino/useful-docker-commands-2mi0</link>
      <guid>https://dev.to/quentindamianino/useful-docker-commands-2mi0</guid>
      <description>&lt;p&gt;Today I learned some docker commands, let me share it with you:&lt;/p&gt;

&lt;h2&gt;
  
  
  To stop all containers simply type:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker kill $(docker ps -q)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;docker ps&lt;/code&gt; - list all running containers&lt;/p&gt;

&lt;p&gt;flag &lt;code&gt;-q&lt;/code&gt; - displays only ids of these containers&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker kill&lt;/code&gt; - stops containers&lt;/p&gt;

&lt;h2&gt;
  
  
  If you want to remove all containers use the command:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker rm $(docker ps -a -q)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;docker rm&lt;/code&gt; - removes containers&lt;/p&gt;

&lt;p&gt;flag &lt;code&gt;-a&lt;/code&gt; - lists all containers not only running ones&lt;/p&gt;

&lt;p&gt;The rest is similar to previous command&lt;/p&gt;

&lt;h2&gt;
  
  
  To remove all docker images type:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker rmi $(docker images -q)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;docker rmi&lt;/code&gt; - removes images&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker images - q&lt;/code&gt; - lists ids of all images&lt;/p&gt;

</description>
      <category>docker</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>PHP Match statement</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Sun, 14 Nov 2021 14:23:22 +0000</pubDate>
      <link>https://dev.to/quentindamianino/php-match-statement-4pbj</link>
      <guid>https://dev.to/quentindamianino/php-match-statement-4pbj</guid>
      <description>&lt;p&gt;PHP 8 introduces match expression which is similar to switch. Let's look into the differences between these two:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg5xv71q6mr6a6uvid334.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg5xv71q6mr6a6uvid334.png" alt="Match statement" width="800" height="911"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  More strictness
&lt;/h2&gt;

&lt;p&gt;Match compares values strictly (===) instead of loosely (==) as the switch statement does.&lt;/p&gt;

&lt;p&gt;In Match Unknown values cause errors, so if you forget to check for a value and you don't have a default value PHP will throw an UnhandledMatchError exception&lt;/p&gt;

&lt;h2&gt;
  
  
  Returns value
&lt;/h2&gt;

&lt;p&gt;Match returns value so you have to It once instead in each case like in switch statement, which make code much shorter&lt;/p&gt;

&lt;h2&gt;
  
  
  Combining conditions
&lt;/h2&gt;

&lt;p&gt;Match arms do not fall-through to later cases the way switch statements do, but you can combine conditions on the same line, separated by commas to achieve the same effect&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30maztb3ktppz49jqsoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F30maztb3ktppz49jqsoz.png" alt="multiple conditions" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Single-line expressions
&lt;/h2&gt;

&lt;p&gt;Only single-line expressions are allowed in Match statement. In switch you can have multiple expression till the 'break' statement&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In my opinion Match is better option than switch in situations where you don't need multiple-line expressions.&lt;/p&gt;

&lt;p&gt;And what do you think about this "new" feature?&lt;/p&gt;

</description>
      <category>php</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Constraints in SQL</title>
      <dc:creator>Damian Brdej</dc:creator>
      <pubDate>Wed, 07 Jul 2021 18:37:10 +0000</pubDate>
      <link>https://dev.to/quentindamianino/constraints-in-sql-1im2</link>
      <guid>https://dev.to/quentindamianino/constraints-in-sql-1im2</guid>
      <description>&lt;p&gt;Constraints in SQL are used to specify rules for data. You can't insert a row if any of these rules are broken. It's a good way to prevent user from inserting wrong data.&lt;br&gt;
Here's CREATE TABLE statement with most common constraints in it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE TABLE user(
    id INT PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    status_id INT NOT NULL DEFAULT 1,
    age INT NOT NULL,
    CHECK (age &amp;gt;= 18)
    FOREIGN KEY (status_id) REFERENCES status(id)
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  NOT NULL
&lt;/h2&gt;

&lt;p&gt;With this constraint you can ensure that every row in this column has value, and cannot be NULL.&lt;/p&gt;

&lt;h2&gt;
  
  
  UNIQUE
&lt;/h2&gt;

&lt;p&gt;Specify that every value in this column has different value.&lt;/p&gt;

&lt;h2&gt;
  
  
  PRIMARY KEY
&lt;/h2&gt;

&lt;p&gt;Is a combination of NOT NULL and UNIQUE, often use to identify a specific row in table. There can be only one PRIMARY KEY in each table.&lt;/p&gt;

&lt;h2&gt;
  
  
  FOREIGN KEY
&lt;/h2&gt;

&lt;p&gt;Prevents from destroying links between two tables when deleting or modifying data.&lt;/p&gt;

&lt;h2&gt;
  
  
  CHECK
&lt;/h2&gt;

&lt;p&gt;Ensures that value of this field meets certain condition. In our example we check if the user has minimum 18 years old&lt;/p&gt;

&lt;h2&gt;
  
  
  DEFAULT
&lt;/h2&gt;

&lt;p&gt;It's simply default value for field, if no value is specified.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
    </item>
  </channel>
</rss>
