<?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: Feruz Oripov</title>
    <description>The latest articles on DEV Community by Feruz Oripov (@feruzoripov).</description>
    <link>https://dev.to/feruzoripov</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%2F51812%2F6fd6edc9-775b-45dd-a074-d326608ce499.png</url>
      <title>DEV Community: Feruz Oripov</title>
      <link>https://dev.to/feruzoripov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/feruzoripov"/>
    <language>en</language>
    <item>
      <title>A Guide to Blocking Unwanted Websites</title>
      <dc:creator>Feruz Oripov</dc:creator>
      <pubDate>Wed, 10 Jan 2024 18:25:29 +0000</pubDate>
      <link>https://dev.to/feruzoripov/a-guide-to-blocking-unwanted-websites-5665</link>
      <guid>https://dev.to/feruzoripov/a-guide-to-blocking-unwanted-websites-5665</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the vast landscape of the internet, not all websites are created equal. Some may harbor malicious content, while others could be a source of distraction. In this guide, we'll explore the importance of blocking unwanted websites and how you can safeguard your digital space.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Block Unwanted Websites?
&lt;/h2&gt;

&lt;p&gt;The internet is a treasure trove of information and entertainment, but it also comes with its fair share of pitfalls. Blocking unwanted websites can offer several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enhanced Productivity&lt;/strong&gt;: Avoid distractions by blocking time-wasting websites during work hours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved Security&lt;/strong&gt;: Prevent access to potentially harmful sites that could compromise your computer's security.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Control&lt;/strong&gt;: Ensure a family-friendly online environment by blocking inappropriate content.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tools and Techniques
&lt;/h2&gt;

&lt;p&gt;Now that we understand the importance of blocking unwanted websites, let's delve into the tools and techniques to achieve this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Editing the Hosts File:&lt;/strong&gt; The &lt;code&gt;etc/hosts&lt;/code&gt; file on your computer can be edited to block access to specific websites. We will learn how to do this on Linux/Mac later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Using Browser Extensions:&lt;/strong&gt; Browser extensions like &lt;a href="https://blocksite.co/"&gt;https://blocksite.co/&lt;/a&gt; and &lt;a href="https://www.webblockerextension.com/"&gt;https://www.webblockerextension.com/&lt;/a&gt; allow for easy and customizable website blocking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parental Control Software:&lt;/strong&gt; For a comprehensive solution, consider using parental control software that offers website blocking features.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Editing the Hosts File
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open Terminal:&lt;/strong&gt; On both Linux and Mac, you'll need to use the terminal to edit system files.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access the Hosts File:&lt;/strong&gt; Run the following command in the terminal to open the &lt;code&gt;etc/hosts&lt;/code&gt; file with a text editor (in my case I will use &lt;code&gt;vim&lt;/code&gt;, I hope you know how to exit :)):&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/hosts
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enter Admin Password:&lt;/strong&gt; You'll be prompted to enter your administrator password since editing the &lt;code&gt;etc/hosts&lt;/code&gt; file requires elevated privileges.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Add Blocking Entries:&lt;/strong&gt; To block a website, navigate to the end of the file and add an entry in the following format:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;127.0.0.1   unwantedwebsite.com
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Save the changes in the text editor and exit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Flush DNS Cache (Optional):&lt;/strong&gt; To ensure changes take effect immediately, you can flush the DNS cache. Run the following command:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dscacheutil &lt;span class="nt"&gt;-flushcache&lt;/span&gt;  &lt;span class="c"&gt;# For macOS&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart systemd-resolved  &lt;span class="c"&gt;# For Linux (Debian-based)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Verify Changes:&lt;/strong&gt; Open a web browser and try accessing the blocked website. It should now be inaccessible.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;Blocking unwanted websites is a proactive step toward creating a secure and focused digital environment. Whether you're aiming for increased productivity or maintaining a family-friendly online space, implementing these techniques can make a significant difference.&lt;/p&gt;

&lt;p&gt;Remember, the key is to strike a balance between enjoying the internet's benefits and protecting yourself from its potential drawbacks. Happy browsing!&lt;/p&gt;




&lt;p&gt;If you're looking for a convenient way to block unwanted websites on your computer, check out my open-source project, &lt;a href="https://github.com/feruzoripov/block-unwanted-hosts"&gt;Block Unwanted Hosts&lt;/a&gt;. This tool, written in Go, fetches and blocks websites from various sources, adding them to your system's &lt;code&gt;etc/hosts&lt;/code&gt; file for enhanced security and productivity.&lt;/p&gt;

&lt;p&gt;Block websites from predefined sources, including &lt;a href="https://someonewhocares.org/hosts/hosts"&gt;Someonewhocares&lt;/a&gt;, &lt;a href="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"&gt;StevenBlack's Hosts&lt;/a&gt;, &lt;a href="https://adaway.org/hosts.txt"&gt;AdAway&lt;/a&gt;, and &lt;a href="https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts;showintro=0&amp;amp;mimetype=plaintext"&gt;PGl Yoyo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Additional resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Shock_site"&gt;https://en.wikipedia.org/wiki/Shock_site&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://someonewhocares.org/hosts/"&gt;https://someonewhocares.org/hosts/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/StevenBlack/hosts"&gt;https://github.com/StevenBlack/hosts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>What is declarative programming?</title>
      <dc:creator>Feruz Oripov</dc:creator>
      <pubDate>Wed, 12 May 2021 13:50:42 +0000</pubDate>
      <link>https://dev.to/feruzoripov/what-is-declarative-programming-2pam</link>
      <guid>https://dev.to/feruzoripov/what-is-declarative-programming-2pam</guid>
      <description>&lt;p&gt;Recently, while preparing for my finals, I saw a question related to declarative programming. It was a familiar topic. I have heard this somewhere before, but couldn’t remember what exactly declarative programming is. Maybe I missed the lesson sleeping when my teacher was explaining it during the class &lt;code&gt;¯\_(ツ)_/¯&lt;/code&gt;. So I decided to learn more about declarative programming, and I want to share what I learned.&lt;br&gt;
&lt;a href="https://i.giphy.com/media/3o7btSIGiuRJZJCS9W/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/3o7btSIGiuRJZJCS9W/giphy.gif" alt="computer-science-gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is actually declarative programming? Declarative programming is a programming paradigm that’s the opposite of imperative programming. Wait, what? What is imperative programming? In imperative programming, you should define steps that your program follows to achieve the “end” result. In other words, you have to describe &lt;strong&gt;&lt;em&gt;how&lt;/em&gt;&lt;/strong&gt; your program should operate. In some cases, it is also called procedural programming. For example, let’s say you want to find an element in an array. What are you going to do? Of course, you’ll write an algorithm that finds an element in an array. You will write an algorithm that sorts the array first and then uses binary search to find the element. As you can guess, you are describing a sequence of tasks, using variables and some memory operations to achieve the goal.&lt;/p&gt;

&lt;p&gt;OK, what is declarative programming then? In declarative programming you don’t have to describe &lt;strong&gt;&lt;em&gt;how&lt;/em&gt;&lt;/strong&gt; to achieve the “end” result, but you just declare &lt;strong&gt;&lt;em&gt;what&lt;/em&gt;&lt;/strong&gt; your “end” result should be. It’s like building UML diagrams for your database while hiding actual implementation under the hood. SQL itself also follows a declarative programming paradigm though, because SQL is a domain-specific language, which serves as an interface for your relational database and it hides the low-level implementation of your database. Infrastructure configuration languages like HCL, Terraform Language, and markup languages, such as HTML, XML, XAML are examples of declarative programming. You don’t write algorithms or workflows in HTML, but you declare &lt;strong&gt;&lt;em&gt;what&lt;/em&gt;&lt;/strong&gt; your page should display.&lt;/p&gt;

&lt;p&gt;In programming languages like Python, you can combine both declarative and imperative programming styles. You can write the OOP section following an imperative approach, and you can also write small functions and declare &lt;strong&gt;&lt;em&gt;what&lt;/em&gt;&lt;/strong&gt; your program should perform by merging those functions(a.k.a. functional programming).&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
