<?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: kevin klatman</title>
    <description>The latest articles on DEV Community by kevin klatman (@kevin_klatman_2f5c17327a6).</description>
    <link>https://dev.to/kevin_klatman_2f5c17327a6</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1868757%2Fbe04d5e5-b85f-4d88-91e8-877d654f9d61.png</url>
      <title>DEV Community: kevin klatman</title>
      <link>https://dev.to/kevin_klatman_2f5c17327a6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kevin_klatman_2f5c17327a6"/>
    <language>en</language>
    <item>
      <title>Python packages</title>
      <dc:creator>kevin klatman</dc:creator>
      <pubDate>Fri, 04 Oct 2024 16:06:33 +0000</pubDate>
      <link>https://dev.to/kevin_klatman_2f5c17327a6/python-packages-nde</link>
      <guid>https://dev.to/kevin_klatman_2f5c17327a6/python-packages-nde</guid>
      <description>&lt;p&gt;In looking to scrape some professional sports statistics last week I executed a program that opened my Chrome browser, navigated to a given URL, scraped 37 tables of Colorado Rockies pitching statistics and compiled them into a SQLITE database before closing the browser (this was before I read the terms of service about the potential $1,000 fine. This was a bit worrying, and I'll have to be more cognizant as I didn't even know that was a thing, but I guess it makes sense. Also for anyone looking to fine me, $1,000 is pretty optimistic. I don't even have my own computer. I'm typing this out at a public library on a beige computer that runs on Windows XP).&lt;/p&gt;

&lt;p&gt;Anyways scraping this data introduced me to the cool world of packages/modules/tools in Python, and it felt sort of eye opening/ horizon expanding, so I thought I'd try to find some other Python packages and modules with varying uses and list them below, with help from others who have basically done the same.&lt;/p&gt;

&lt;p&gt;1 Pyjokes:&lt;/p&gt;

&lt;p&gt;Usage&lt;br&gt;
Command line&lt;br&gt;
Once installed, simply call pyjoke or pyjokes from the command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pyjoke
Why do Java programmers have to wear glasses? Because they don't see sharp.
Or add it to your .bashrc or .zshrc file to see a joke every time you open a terminal!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See pyjokes --help for more info.&lt;/p&gt;

&lt;p&gt;Python&lt;br&gt;
You can also access the jokes in your own project by importing pyjokes and using the function get_joke:&lt;/p&gt;

&lt;p&gt;`&amp;gt;&amp;gt;&amp;gt; import pyjokes&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;print(pyjokes.get_joke())&lt;br&gt;
Why do programmers confuse Halloween with Christmas? Because OCT 31 == DEC 25.`&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://pypi.org/project/pyjokes/" rel="noopener noreferrer"&gt;https://pypi.org/project/pyjokes/&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Arcade:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Allows you to create 2d arcade games. Apparently it makes it easier!&lt;/p&gt;

&lt;p&gt;pip install arcade&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/pythonarcade/arcade" rel="noopener noreferrer"&gt;https://github.com/pythonarcade/arcade&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pygame:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Another tool for writing video games&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/pygame/pygame" rel="noopener noreferrer"&gt;https://github.com/pygame/pygame&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ReactPy&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;ReactPy is a library for building user interfaces in Python without Javascript. ReactPy interfaces are made from components which look and behave similarly to those found in ReactJS. Designed with simplicity in mind, ReactPy can be used by those without web development experience while also being powerful enough to grow with your ambitions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://reactpy.dev/docs/index.html" rel="noopener noreferrer"&gt;https://reactpy.dev/docs/index.html&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;NLTK&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning, wrappers for industrial-strength NLP libraries, and an active discussion forum.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://www.nltk.org/" rel="noopener noreferrer"&gt;https://www.nltk.org/&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Edward&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Edward is a Python library for probabilistic modeling, inference, and criticism. It is a testbed for fast experimentation and research with probabilistic models, ranging from classical hierarchical models on small data sets to complex deep probabilistic models on large data sets. Edward fuses three fields: Bayesian statistics and machine learning, deep learning, and probabilistic programming.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://edwardlib.org/" rel="noopener noreferrer"&gt;https://edwardlib.org/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A random problem</title>
      <dc:creator>kevin klatman</dc:creator>
      <pubDate>Fri, 13 Sep 2024 16:02:39 +0000</pubDate>
      <link>https://dev.to/kevin_klatman_2f5c17327a6/a-random-problem-ioa</link>
      <guid>https://dev.to/kevin_klatman_2f5c17327a6/a-random-problem-ioa</guid>
      <description>&lt;p&gt;If you've ever seen a fancy chandelier you've seen what looks most similar to a quantum computer, a long, twisting and cylindrical shining thing of gold metal and wires that hangs vertically in its oblong direction,  but unlike chandeliers, quantum computers seek to solve some of humanity's problems that have evaded even our most powerful computing systems to date. &lt;/p&gt;

&lt;p&gt;The oft used analogy for quantum computing is the "boat versus car analogy." A quantum computer is not like a faster car with better handling. &lt;/p&gt;

&lt;p&gt;Rather, it's a boat, not better than a car, but it can access intellectual problems that have previously eluded us because of the the terrain it can traverse, not the superiority of its makeup.&lt;/p&gt;

&lt;p&gt;Chief among these problems, or at least what strikes me as the umbrella that covers the list of problems, is the ability for a quantum computer to solve the problem of randomness. &lt;/p&gt;

&lt;p&gt;Unlike classical bits, which can only be in one of two states (0 or 1), qubits can exist in a superposition of states. This means that a qubit can be in a combination of both 0 and 1 simultaneously, with varying probabilities. When a qubit in superposition is measured, it collapses into either the 0 or 1 state, and the outcome is inherently random. &lt;/p&gt;

&lt;p&gt;That is to say, no one told the qubit to become a 1 or a 0, because this randomness is a fundamental property of quantum mechanics which cannot be predicted or determined prior.&lt;/p&gt;

&lt;p&gt;This article:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/quantum/tutorial-qdk-quantum-random-number-generator?tabs=tabid-copilot" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/quantum/tutorial-qdk-quantum-random-number-generator?tabs=tabid-copilot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;demonstrates code for a program written in q# for those interested in the process of harnessing the randomness of quantum computing and turning it into a useable random number generator. &lt;/p&gt;

&lt;p&gt;So why is randomness not just a problem, but the problem. Well to fundamentally understand our reality we have to be able to simulate the principles which govern our reality. &lt;/p&gt;

&lt;p&gt;Quantum computing promises to solve some of the most pressing issues known to man and science alike by meeting reality on its base level. The level of the very small, the level of random.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>UseEffectively?</title>
      <dc:creator>kevin klatman</dc:creator>
      <pubDate>Wed, 21 Aug 2024 21:54:45 +0000</pubDate>
      <link>https://dev.to/kevin_klatman_2f5c17327a6/useeffectively-j0</link>
      <guid>https://dev.to/kevin_klatman_2f5c17327a6/useeffectively-j0</guid>
      <description>&lt;p&gt;When I first started learning React, I encountered the useEffect hook and found myself overwhelmed by the terminology surrounding it. Terms like "side effects," "memory leaks," "mounting," and "unmounting" sounded daunting and confusing. I knew useEffect was an essential tool in React, but I struggled to understand its purpose and how to use it effectively.&lt;/p&gt;

&lt;p&gt;As I dug deeper into useEffect, I realized that these terms, while intimidating at first, weren't as complex as they seemed. Let's break them down:&lt;/p&gt;

&lt;p&gt;Side Effects: This refers to any operation that affects something outside the scope of the current function. In the context of React, side effects often involve interacting with the browser API, such as fetching data from an API, subscribing to events, or manipulating the DOM directly.&lt;/p&gt;

&lt;p&gt;Memory Leaks: A memory leak occurs when unnecessary memory is being consumed by an application due to improper resource management. In React, memory leaks can happen when components subscribe to events or create resources that are not properly cleaned up when the component is no longer needed.&lt;/p&gt;

&lt;p&gt;Mounting and Unmounting: In React, a component is said to be "mounted" when it is rendered and inserted into the DOM. Conversely, a component is "unmounted" when it is removed from the DOM. useEffect allows us to perform side effects when a component mounts or unmounts.&lt;/p&gt;

&lt;p&gt;Armed with a basic understanding of these terms, I started to explore useEffect further. I learned that useEffect is a way to tell React that my component needs to do something after it renders. This could be fetching data, setting up subscriptions, or anything else that doesn't directly result in rendering UI.&lt;/p&gt;

&lt;p&gt;One concept that initially confused me was the dependency array in useEffect. It took me a while to grasp that the dependency array allows us to specify when the effect should re-run. If we leave the array empty, the effect runs only once when the component mounts. If we include variables in the array, the effect will re-run whenever those variables change.&lt;/p&gt;

&lt;p&gt;Another aspect that tripped me up was cleaning up side effects. I learned that some effects, like subscribing to events, need to be cleaned up to avoid memory leaks. I discovered that I could return a cleanup function from the effect, which would be executed when the component unmounts or before the effect runs again.&lt;/p&gt;

&lt;p&gt;As I continued to practice using useEffect, I started to appreciate its power and flexibility. I realized that it provides a way to synchronize my component's side effects with its lifecycle. By specifying dependencies and cleanup functions, I could ensure that my effects were running only when necessary and cleaning up after themselves.&lt;/p&gt;

&lt;p&gt;I'm not sure my uncertainty is completely resolved, however. Every time I feel as though I understand something, I'm introduced to a new method that re mystifies me. Perhaps that's just the nature of the beast.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>const bankruptcy = () =&gt; { console.log("I declare bankruptcy!"); };</title>
      <dc:creator>kevin klatman</dc:creator>
      <pubDate>Fri, 02 Aug 2024 06:28:11 +0000</pubDate>
      <link>https://dev.to/kevin_klatman_2f5c17327a6/const-bankruptcy-consolelogi-declare-bankruptcy-1a47</link>
      <guid>https://dev.to/kevin_klatman_2f5c17327a6/const-bankruptcy-consolelogi-declare-bankruptcy-1a47</guid>
      <description>&lt;p&gt;For the first two months of my programming journey (so up until about two weeks ago), I thought Java was just short for JavaScript. Thinking I was in the know, I walked around for two months referring to JavaScript as "Java" for short, only to find out from a seasoned programmer that Java and JavaScript are two separate languages. What?! How embarrassing...&lt;/p&gt;

&lt;p&gt;I only preface the post this way so that any potential reader can understand the level I'm operating on when I say writing this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function hasTargetSum(array, target) {
  for (let i = 0; i &amp;lt; array.length; i++) {
    for (let j = i + 1; j &amp;lt; array.length; j++) {
      if (array[i] + array[j] === target) {
        return true;
      }
    }
  }
  return false;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is the crowning achievement of my coding career thus far (well it was when I wrote it anyway(one week ago-ish)). It's a function that returns true if the sum of any two numbers in an array add up to  a target number using a nested loop.&lt;/p&gt;

&lt;p&gt;It took me 5 hours to figure out what I thought was the right answer, but what I came to realize is that I hadn't found the "right" answer, I had only found "an" answer (and not a great answer at that, but I'm still proud of it).&lt;/p&gt;

&lt;p&gt;In searching online I came to a sort of epiphany when I found a solution that reduces the time- complexity by recognizing that each number in the array has an implicit "pair number." &lt;/p&gt;

&lt;p&gt;(For example if the target number is 10 and the first number of an array is 3, one would only need to search the rest of the array for a 7, the implicit "pair number" (because 3 + 7 = 10).&lt;/p&gt;

&lt;p&gt;To me this was a creative and out of the box solution, which, as boring as it seems, changed the way I looked at programming. I had been looking at programming as a set of methods to mesmerize rather than as a language and a form of communication, and like in literal language, there are an indefinite amount of ways to convey what you want, some are better than others, but there is no single right way and there's plenty of room for various approaches and creativity.&lt;/p&gt;

&lt;p&gt;I think anywayz, idk im only like 2 months in to programming.  &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>declaringbankruptcy</category>
    </item>
  </channel>
</rss>
