<?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: Josh</title>
    <description>The latest articles on DEV Community by Josh (@jryther).</description>
    <link>https://dev.to/jryther</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%2F370512%2F8b0630c8-0583-4d5e-ae14-89b1c12601a2.JPG</url>
      <title>DEV Community: Josh</title>
      <link>https://dev.to/jryther</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jryther"/>
    <language>en</language>
    <item>
      <title>Java Main Method</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 14 Nov 2021 19:34:18 +0000</pubDate>
      <link>https://dev.to/jryther/java-main-method-3k87</link>
      <guid>https://dev.to/jryther/java-main-method-3k87</guid>
      <description>&lt;p&gt;Hello everyone, this week I am going to go over one of the most important concepts in Java, the main method.  The main method in itself is pretty easy to understand as it is the part that runs the program but there are components to it most early programmers don’t take the time to learn.&lt;/p&gt;

&lt;p&gt;Lets start by taking a look at the syntax of the method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ty4uB8Gu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q24owzagkqkrfcayexzt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ty4uB8Gu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q24owzagkqkrfcayexzt.png" alt="Java Main Method Syntax" width="476" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Public: The method must be public so it is accessible.  If the method is marked as private, protected, or default the JVM will not be able to locate it.&lt;/p&gt;

&lt;p&gt;Static: The static keyword allows methods to be called without instantiating an object first.  We don’t want to be required to create an object to run the main method.&lt;/p&gt;

&lt;p&gt;Void: The main method doesn’t return anything so we use void as the return type.&lt;/p&gt;

&lt;p&gt;Main(): This is the default signature for the JVM and is used to execute a program.&lt;/p&gt;

&lt;p&gt;String args []: This is a string array of command line arguments that are passed to the main method.  If this is left out of the parameters the JVM will not be able to locate the main method because it looks for a method with a string array.&lt;/p&gt;

&lt;p&gt;What is a command line argument?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ java myProgram arg1 arg2 arg3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then use these arguments from the array in your main method if needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Example {
    public static void main(String[] args) {
        for(String arg: args){
            System.out.println(arg);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last thing I want to touch on is how the main method applies to a process.  The main method is a thread in a process that is automatically created by the JVM.  Each time a thread is created, the JVM allocates a stack of memory to it.  Since additional threads are created from the main thread each additional is considered a child of the main thread which means it must finish execution last.  This is because the thread that created another must perform the various shutdowns to safely stop it.  For more information on multi-threading please click the &lt;a href="https://dev.to/jryther/understanding-threading-5c9o"&gt;link&lt;/a&gt; to see my post on it.&lt;/p&gt;

&lt;p&gt;That is all for this week.  Please leave a like and comment down below if you found it useful.  Follow me for more posts like this each week as I work to improve my programming knowledge with you all.  Have a great day and happy coding!&lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.javatpoint.com/java-main-method"&gt;https://www.javatpoint.com/java-main-method&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://techvidvan.com/tutorials/java-command-line-arguments/"&gt;https://techvidvan.com/tutorials/java-command-line-arguments/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://javagoal.com/main-thread-in-java/"&gt;https://javagoal.com/main-thread-in-java/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Getting Started with Docker 🐋</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sat, 06 Nov 2021 22:47:12 +0000</pubDate>
      <link>https://dev.to/jryther/getting-started-with-docker-39h6</link>
      <guid>https://dev.to/jryther/getting-started-with-docker-39h6</guid>
      <description>&lt;p&gt;Hello everyone!  This week I am going to give a brief tutorial on how to get started with Docker.  See my last post for a conceptual breakdown of what containers are and when to use them.  First thing is to make sure you install docker on your computer.  Click the link for instructions for &lt;a href="https://docs.docker.com/desktop/mac/install/"&gt;Mac&lt;/a&gt;, &lt;a href="https://docs.docker.com/desktop/windows/install/"&gt;Windows&lt;/a&gt;, and &lt;a href="https://docs.docker.com/engine/install/ubuntu/"&gt;Linux&lt;/a&gt;.  Once everything is set up, you can run the hello world command to verify everything is working.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is good to go we will get started with a prebuilt busybox image.  Busybox is an executable software suite that contains many Unix utilities.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker pull busybox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next you tell docker to take the image and run it as a container.  It will look like nothing is happening but docker is running the container behind the scenes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run busybox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case the container started but there were no commands passed to the container for busybox to execute so it exited without doing anything.  Lets throw it an echo statement to see what it does.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run busybox echo “My name is busybox!”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next feature we are going to look at is the ps command.  This is the tool used to see all of the containers that are currently running.  Currently if we were to use it there would be nothing listed because the busybox container exits once it is done.  If we add the -a option to it then it will all of the containers that have been ran.&lt;/p&gt;

&lt;p&gt;Once you are done with a container you can remove it using the rm command followed by the container ID.  Note: the container ID below is an example.  You will have to look up yours with the ps command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker rm 305297d7a235
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding the Docker terminology is important to reading up on the documentation for more complex projects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Images: These are like the blueprints or a snapshot of the application that is going to be put into the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers: Containers are built using the corresponding image and works kind of like a virtual machine in concept.  See my previous post for a more in depth discussion.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker Daemon: This is the background service that runs on the host machine.  It manages building, running, and distributing them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker Client: This is the command line tool that allows users to interface with the daemon.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker Hub: This is a &lt;a href="https://hub.docker.com/search?q=&amp;amp;type=image"&gt;registry&lt;/a&gt; of prebuilt docker images like the busybox one we used.  You can pull prebuilt images of ubuntu, postgres, python, and many more.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last thing I am going to discuss before wrapping up this post are Dockerfiles.  Dockerfiles are a text file that is a series of commands that tells the client how to build the container.  Depending on how complex your container is this can be simple.  Below I will show the structure of a Dockerfile for a basic python flask app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM python:3

# set a directory for the app
WORKDIR /usr/src/app

# copy all the files to the container
COPY . .

# install dependencies
RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 5000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order of operations for this is that you first want to specify the image you are pulling FROM which in this case is Python.  Next you specify the working directory and copy all of the files in it to the container.  Once that is done you run pip install in the container to install any needed dependencies.  For networking you expose port 5000 so that it can be accessed outside of the container.  Lastly you run the CMD command to tell the container which command it should run and the file to run the command on.&lt;/p&gt;

&lt;p&gt;From here you run the docker build command on the directory that contains the dockerfile which should be in the root folder of your project.  See the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t yourAppFolder .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well everyone, this was a guide on how to get started with Docker.  There are many more things to learn especially if you want to start working with micro-services and have to orchestrate two or more containers for an application.  I invite you to dig deeper and try building your own containers for an application.  Let me know in the comments if you enjoyed this guide or like this post so that more people check it out.  I hope you all have a great week and happy coding!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docker-curriculum.com/"&gt;https://docker-curriculum.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.tutorialspoint.com/docker/docker_images.htm"&gt;https://www.tutorialspoint.com/docker/docker_images.htm&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.docker.com/"&gt;https://docs.docker.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>docker</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Containerization with Docker 🐳</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 01 Nov 2021 13:17:26 +0000</pubDate>
      <link>https://dev.to/jryther/containerization-with-docker-40o0</link>
      <guid>https://dev.to/jryther/containerization-with-docker-40o0</guid>
      <description>&lt;p&gt;Hello everyone!  This week I am going to go over containerization in docker and when it might be best to use it.  For those that are familiar with virtual machines, containers have the same concept.  Their purpose is to create an isolated environment that can be configured for a specific application.  Since virtual machines and containers are similar I think it is important to explain the difference between them for those that aren’t familiar.&lt;/p&gt;

&lt;p&gt;Virtual machines were developed first and they are essentially virtual computers that are ran on the same hardware.  Each VM has it’s own OS and environment.  It uses something called a hypervisor to manage the hardware resources between each VM.  Disadvantages of a VM is that they are resource heavy and difficult to migrate between platforms.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgzktewhe9l5unmgq419.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgzktewhe9l5unmgq419.png" alt="Virtual Machine Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Containers are similar to VMs in concept but the big difference is that they don’t include the OS in the container.  This allows developers to create an environment for the application without including the resource heavy components of the VM.  Unlike VMs, containers are easy to migrate between platforms with the same OS and are lightweight.&lt;/p&gt;

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

&lt;p&gt;Containers do have their downsides though, some of which have to do with sharing the OS.  Any security vulnerabilities introduced with one container that effects the OS will therefore affect all of the containers on the same machine.  The containers are also initialized to work on a specific OS so if you want to migrate it, the new platform will need to be the same.  With the positives and negatives weighed, the developer will need to consider what migration, resource, and security concerns will effect the application.  Neither method is inherently better and will depend on the type of project.&lt;/p&gt;

&lt;p&gt;I hope you all found this post helpful in understanding the basics of what containerization in docker is.  Next week I plan on giving a tutorial for setting up and using docker.  Please like and comment to let me know how I am doing and I hope you all have a great rest of your week.  Happy coding!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://docker-curriculum.com/#getting-started" rel="noopener noreferrer"&gt;https://docker-curriculum.com/#getting-started&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=JSLpG_spOBM" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=JSLpG_spOBM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.netapp.com/blog/containers-vs-vms/" rel="noopener noreferrer"&gt;https://www.netapp.com/blog/containers-vs-vms/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.redhat.com/en/topics/containers/containers-vs-vms" rel="noopener noreferrer"&gt;https://www.redhat.com/en/topics/containers/containers-vs-vms&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>webdev</category>
      <category>docker</category>
      <category>todayilearned</category>
      <category>architecture</category>
    </item>
    <item>
      <title>AI Applications in Medication-Therapy-Management</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Fri, 29 Oct 2021 18:21:48 +0000</pubDate>
      <link>https://dev.to/jryther/ai-applications-in-medication-therapy-management-40fb</link>
      <guid>https://dev.to/jryther/ai-applications-in-medication-therapy-management-40fb</guid>
      <description>&lt;p&gt;***Hello everyone.  This post is a bit different from what I normally write on dev.to.  Please visit my &lt;a href="https://medium.com/@jryther91?p=4021225464f0"&gt;Medium&lt;/a&gt; blog where I will start posting more long form discussions such as this one if you find it interesting.  Thank you!&lt;/p&gt;

&lt;p&gt;In today’s world, pharmaceuticals help manage a wider range of health concerns than ever before. Prescription medications are combined with lifestyle changes to create a care plan to improve patient’s health. However, for many people it can be difficult to connect with the right medical professionals to optimize or receive care. There are programs in place, often required by state funded healthcare entities, that have insurers provide services by pharmacists to members to review and manage their medications. The benefits of these programs can be staggering. Patients that take many medications often have difficulty recalling all of their medications or relaying concerns. The goal of a pharmacist here is to establish a complete medication reconciliation and then optimize each component. Some medications are best used at a certain time of day, cause an interaction with vitamins or supplements, or are not acting as effective as hoped by the physician. By regularly meeting with a pharmacist the patient can get a form of care that often is lacking in a fast paced provider appointment.&lt;/p&gt;

&lt;p&gt;The benefits of these programs are pretty apparent when fully utilized. It makes you wonder why this is not available to everyone? Unfortunately healthcare is a very specialized role that requires many years of studying and certification. Healthcare professionals are also expensive to employ and it is not cost effective to offer this service to everyone. This is where AI can help. Most of the users that would benefit from these programs don’t realize that they are available to them. Insurers and health providers have a large amount of patient data that can be utilized effectively. AI can be used to identify patients and points of concern. Over time the models can be enhanced to determine who has the greatest need and allow staff to outreach to this population to see if they would be willing to participate.&lt;/p&gt;

&lt;p&gt;To breakdown this system we will first look at who would be eligible for the program. The system would need to utilize machine learning techniques to take large amounts of data and create models on who would benefit from the program the most with the restraints of providers available. For those not familiar, machine learning is a subsection of AI programming that uses modeling techniques to train a program to analyze and make decisions through data. The system could take into account pharmacists who have specializations in fields such as Hepatitis C or Oncology and allocate them for those patients. The models would need to include factors such as comorbidity, medication volume, and total providers currently in their care. Once patients have been identified and scheduled the system can further assist pharmacists by identify talking points that may need addressed. Pre-appointment forms, insurance claim history, and EMRs can provide data on: which providers prescribe specific medication, medication dosing/strength, unaddressed health concerns, etc. Machine learning techniques can tap into drug databases such as Lexicomp to find sub optimal dosing or interactions to discuss in the appointment. Time of day, number of tablets, and cost are inconveniences that can deter patients from being compliant with their medication regimen which may be optimized with Pharmacist intervention.&lt;/p&gt;

&lt;p&gt;With any AI application or private health information (PHI) it is important to consider the ethical ramifications of the product and the potential for harm. Starting with the selection process, the AI would be largely in charge of deciding who is to receive services and who will not. Safeguards will need to be in place to try and avoid discrimination. Cultural or systemic limitations may not allow people to submit necessary or accurate information that would trigger an acceptance by the AI. Once patients are in the program there can be additional barriers to understanding and accepting help from a pharmacist. Patients that may speak another language would require an interpreter or provider that can speak the language. Additional cultural components may prevent a patient from accepting care if not presented in a way appropriate for them. Lastly, with any healthcare entity there is always the fear of releasing PHI or violating HIPAA. Measures will need to be taken to ensure that access to PHI is limited only authorized personnel that have a need for it in order to provide services.&lt;/p&gt;

&lt;p&gt;As you can see, AI in healthcare has a huge potential to automating processes that can increase access to care. Increasing efficiency can relieve some of the burden that is plaguing the system and decrease overall costs. As with anything there are possible pitfalls that will need to be identified and addressed but this is to be expected with any new system. The possibilities here are exciting and can usher in a new paradigm of healthcare for future generations.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How do Websites Work?</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Tue, 26 Oct 2021 01:16:15 +0000</pubDate>
      <link>https://dev.to/jryther/how-do-websites-work-326p</link>
      <guid>https://dev.to/jryther/how-do-websites-work-326p</guid>
      <description>&lt;p&gt;Last week I went over the basics of the hardware and protocols that allow the internet to function.  In this second part of the series I am going to deep dive into the steps that go into displaying a website so that we can better understand the protocols in place.  The steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DNS Query&lt;/li&gt;
&lt;li&gt;TCP Handshake&lt;/li&gt;
&lt;li&gt;TLS Handshake&lt;/li&gt;
&lt;li&gt;HTTP Request&lt;/li&gt;
&lt;li&gt;HTTP Response&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A DNS query is your computers way of taking a domain name and finding the correct IP address of the site you are trying to visit.  A request is sent to a DNS resolver chosen by the user which then queries the IP address from its DNS servers and returns it to the client that sent the request.  The default DNS resolver is usually your internet service provider.  The URL is broken up into different servers such as a  Top Level Domain (TLD) server which would contain directories for each .com extension.  This example is  known as a recursive DNS query whereas a non-recursive query follows the same procedure but the DNS client (user’s computer) will take on the responsibilities of the resolver and directly ask the servers itself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi4mruro8brdih3g1efrb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi4mruro8brdih3g1efrb.png" alt="DNS Query Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A TCP handshake is a way of establishing a connection with the host destination.  It is a three-way handshake used to synchronize and acknowledge the packet transmission before the process starts.  The client initiates the transfer by sending a a Synchronize message used to establish a connection and advise of the sequence numbers used to keep track of the packets being sent over.  The host server then responds back with an acknowledge message.  The last message is another acknowledge message sent back to the server and then the connection is established.  After the connection is completed a FIN message is sent to the server to disconnect the session.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqluyuy5f0lhbny0k4u4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqluyuy5f0lhbny0k4u4.png" alt="TCP Handshake Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next step in the process is the TLS handshake.  TLS is an encryption protocol for internet communication.  It is the evolution of the previous protocol used, SSL.  The steps of the handshake are to first specify which version of TLS will be used.  Next is to establish the cipher suites utilized.  Third,  authentication of the server through the server’s public key and the SSL certificate authority’s digital signature.  Lastly, generate session keys to use symmetric encryption for the duration of the connection.  This is a generalized version of the exchange which is broken up into more steps and is dependent on the key exchange algorithm and cipher suites supported.  See this &lt;a href="https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/" rel="noopener noreferrer"&gt;link&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;The last two steps to view a web page are HTTP requests and responses.  HTTP is a protocol used to request and receive information from a web server.  A request is sent with a method it wishes the server to perform and relevant information needed in order to execute that action.  Common request methods are GET, POST, and UPDATE.  A GET method asks the server for the information at the provided URL  in the header.  Your browser will send a GET method in order to get the HTML and CSS for a website to render.  Once the request is received by the server it will send a response back as a status code.  Status code 200 means the request is OK and the server starts sending over packets of data.  Click &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods" rel="noopener noreferrer"&gt;here&lt;/a&gt; for a list of request methods and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status" rel="noopener noreferrer"&gt;here&lt;/a&gt; for status codes.&lt;/p&gt;

&lt;p&gt;What I have provided is a high overview of how an internet web page is rendered.  Each section has a lot more you can spend time researching if you choose to do so.  Below I have provided links to the resources I used to write the post.  I hope you learned something and if you did please feel free to like the post or leave a comment below.  Have a great week and happy programming!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;- DNS Query:&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.cloudns.net/wiki/article/254/" rel="noopener noreferrer"&gt;https://www.cloudns.net/wiki/article/254/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://smallbusiness.chron.com/primary-secondary-dns-65413.html" rel="noopener noreferrer"&gt;https://smallbusiness.chron.com/primary-secondary-dns-65413.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://smallbusiness.chron.com/domain-name-system-dns-resolvers-work-76639.html" rel="noopener noreferrer"&gt;https://smallbusiness.chron.com/domain-name-system-dns-resolvers-work-76639.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;- TCP Handshake&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.guru99.com/tcp-3-way-handshake.html" rel="noopener noreferrer"&gt;https://www.guru99.com/tcp-3-way-handshake.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;- TLS Handshake&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/" rel="noopener noreferrer"&gt;https://www.cloudflare.com/learning/ssl/what-happens-in-a-tls-handshake/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;- HTTP Request/Response:&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Status&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>todayilearned</category>
      <category>html</category>
    </item>
    <item>
      <title>How does the Internet Work?</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 17 Oct 2021 22:51:14 +0000</pubDate>
      <link>https://dev.to/jryther/how-does-the-internet-work-h65</link>
      <guid>https://dev.to/jryther/how-does-the-internet-work-h65</guid>
      <description>&lt;p&gt;One thing that many of us take for granted is the internet.  The internet is this vast distributed network that connects all of us in almost everything we do.  Probably like you, I had no idea how it worked, even at a high level overview.  Today I am going to go over the basics of how a system this vast and independent operates.&lt;/p&gt;

&lt;p&gt;First, what is a network?  A network is a group of computers that are connected to each other.  They can share information by passing parts of the whole called packets.  Sometimes the devices sharing packets of information with each other are different.  This required standardization that could be implemented into each device called protocols.  A protocol is a set way of performing certain actions or organizing the data.  Protocols exist for sending data between computers on a local network (IP), making sure they arrive in the right order (TCP), and to format them for websites and web applications (HTTP).&lt;/p&gt;

&lt;p&gt;Next I will describe some of the physical components that contribute to the internet:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Routers: These forward packets to different networks based on their destination.  One way to think of them is if each time you passed through an intersection in your car there was a person there to tell you which direction to go in order to get home.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switches: These are similar to routers but they work on a local network.  They take information passed from one source and send it to the computer it was meant to go to.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Web Servers:  These are high-powered computers that take requests and serve information.  They may need to process requests and apply business logic before responding with the appropriate data which can be computationally intensive.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Now that we have some of the basics understood lets look at the specific steps that go into displaying a website on your computer.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;DNS query: Computers use IP addresses to find where a website is located on the network.  IP addresses are long and hard to remember so we use DNS to apply an easier naming convention.  Think of it as a phone book for IP addresses.  So a DNS query is essentially looking up an IP address with the URL provided.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TCP handshake: This is the process of opening up a connection to the IP address with your browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TLS handshake: The browser encrypts the connection to try and prevent malicious individuals from being able to read the packets if they are intercepted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTTP request: The browser uses the HTTP protocol to “ask” for information from the web server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTTP response: The web server processes the request and provides a response for the browser to render on your computer.  For applications other than a browser it may just provide data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are the basics for how the internet and local networks function.  I plan on going deeper in the future about DNS, TCP, TLS and maybe more.  Let me know in the comments if you would find that helpful or if you enjoyed this post.  I hope you all have a great week and happy coding!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.cloudflare.com/learning/network-layer/how-does-the-internet-work/" rel="noopener noreferrer"&gt;https://www.cloudflare.com/learning/network-layer/how-does-the-internet-work/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.hp.com/us-en/shop/tech-takes/how-does-the-internet-work" rel="noopener noreferrer"&gt;https://www.hp.com/us-en/shop/tech-takes/how-does-the-internet-work&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/How_does_the_Internet_work" rel="noopener noreferrer"&gt;https://developer.mozilla.org/en-US/docs/Learn/Common_questions/How_does_the_Internet_work&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Lambda Expressions in Java</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Mon, 11 Oct 2021 02:00:16 +0000</pubDate>
      <link>https://dev.to/jryther/lambda-expressions-in-java-5gme</link>
      <guid>https://dev.to/jryther/lambda-expressions-in-java-5gme</guid>
      <description>&lt;p&gt;This week we are going to go over something I have ran across but didn’t really understand until recently, lambda expressions!  Lambda expressions are Java dipping its toes into functional programming.  It takes parameters and applies it to an expression or code block.  Below is a basic example of the syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(parameter1, parameter2) =&amp;gt; expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(parameter1, parameter2) =&amp;gt; {code block}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lambda expressions are extremely limited and must immediately return a value if it isn’t void.  They can’t use keywords such as if or for to maintain simplicity.  If more lines of code are needed then you can use a code block instead.&lt;/p&gt;

&lt;p&gt;Now when implementing lambdas you can’t only use the expression.  Lambdas are implementations of functional interfaces.  A functional interface is an interface that only has one abstract method.  The benefits of lambdas are that they allow you to implement the method without having to implement the interface’s class and instantiate an object.  An example of this is below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface FuncInterface
{
    // An abstract function
    void abstractFun(int x);

    // A non-abstract (or default) function
    default void normalFun()
    {
       System.out.println("Hello");
    }
}

class Test
{
    public static void main(String args[])
    {
        // lambda expression to implement above
        // functional interface. This interface
        // by default implements abstractFun()
        FuncInterface fobj = (int x)-&amp;gt;System.out.println(2*x);

        // This calls above lambda expression and prints 10.
        fobj.abstractFun(5);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lambda expressions are often used as parameters to a function.  To increase readability you can also store lambda expressions in a variable as long as the type is an interface that only has one method, the same number of parameters, and the same return type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.ArrayList;
import java.util.function.Consumer;

public class Main {
  public static void main(String[] args) {
    ArrayList&amp;lt;Integer&amp;gt; numbers = new ArrayList&amp;lt;Integer&amp;gt;();
    numbers.add(5);
    numbers.add(9);
    numbers.add(8);
    numbers.add(1);
    Consumer&amp;lt;Integer&amp;gt; method = (n) -&amp;gt; { System.out.println(n); };
    numbers.forEach( method );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A common use for lambdas are creating threads.  Here is an example of implementing a Runnable object with a lambda code block for the thread to execute.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Lambda Runnable
Runnable task2 = () -&amp;gt; { System.out.println("Task #2 is running"); };

// start the thread
new Thread(task2).start();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most of us as beginners have been taught to program using OOP concepts so it can be a bit jarring to use a different paradigm like functional programming.  I myself am still learning to wrap my head around these concepts.  Anyway, I hope you all were able to learn something today.  If you have more questions or want to deep dive into this topic check out the links below that I used to write this post.  The code examples I pulled are also from there.  Have a great week!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.w3schools.com/java/java_lambda.asp"&gt;https://www.w3schools.com/java/java_lambda.asp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.codejava.net/java-core/the-java-language/java-8-lambda-runnable-example"&gt;https://www.codejava.net/java-core/the-java-language/java-8-lambda-runnable-example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.geeksforgeeks.org/lambda-expressions-java-8/"&gt;https://www.geeksforgeeks.org/lambda-expressions-java-8/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.developer.com/microsoft/start-using-java-lambda-expressions/"&gt;https://www.developer.com/microsoft/start-using-java-lambda-expressions/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>java</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>programming</category>
    </item>
    <item>
      <title>Implementing Threading with Java</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 03 Oct 2021 22:12:23 +0000</pubDate>
      <link>https://dev.to/jryther/implementing-threading-with-java-2g50</link>
      <guid>https://dev.to/jryther/implementing-threading-with-java-2g50</guid>
      <description>&lt;p&gt;In my last post we went over what a thread is and how it fits in the scope of a process.  Now we are going to discuss two ways of implementing them in Java which are,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extending the Thread Class&lt;/li&gt;
&lt;li&gt;Implementing the Runnable Interface&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Starting with working in the Thread class, see the code block below taken from &lt;a href="https://www.w3schools.com/java/java_threads.asp"&gt;w3schools&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;public class Main extends Thread {
    public void run() {
        System.out.println("This code is running in a thread");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method works by extending the Thread class and overriding its run () method.  Another example is provided below for threading with classes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main extends Thread {
    public static void main(String[] args) {
        Main thread = new Main();
        thread.start();
        System.out.println("This code is outside of the thread");
    }
    public void run() {
        System.out.println("This code is running in a thread");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we have an example of implementing the Runnable interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main implements Runnable {
    public void run() {
        System.out.println("This code is running in a thread");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As before another more complex example using classes is provided below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main implements Runnable {
    public static void main(String[] args) {
        Main obj = new Main();
        Thread thread = new Thread(obj);
        thread.start();
        System.out.println("This code is outside of the thread");
    }
    public void run() {
        System.out.println("This code is running in a thread");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now at this point you are probably wondering why there are two ways of implementing threading in Java.  If you remember from early in your programming journey, you can only extend from one class in Java.  If you extend from the Thread class that means you miss out on inheritance benefits from other classes.  However, the Thread class does have some pre-built useful methods that can streamline some of your code.  These are things you will need to consider when choosing how to implement threading into your project.&lt;/p&gt;

&lt;p&gt;Runnable and Thread both use the run method.  This method is where you code the functionality of the thread.  When you want the thread to start executing you then call the start method for the object.&lt;/p&gt;

&lt;p&gt;Now that we are up to speed on how to create a thread the next thing to consider is concurrency.  The main benefit to threading is that they perform lightweight operations at the same time.  However this can be a bad thing too.  The programmer never knows the order of execution for the threads in the process.  If an application was set up for multiple threads to perform actions on a variable for instance, it is impossible to know the order of operations performed on the variable.  As a general rule it is best to configure threads to share as little attributes as possible.  In the real world this can not always be achieved though, so there are ways of solving for concurrency and performing thread safe actions.&lt;/p&gt;

&lt;p&gt;An example is the use of the isAlive() function in the Thread class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Main extends Thread {
    public static int amount = 0;

    public static void main(String[] args) {
        Main thread = new Main();
        thread.start();
        // Wait for the thread to finish
        while(thread.isAlive()) {
            System.out.println("Waiting...");
        }
        // Update amount and print its value
        System.out.println("Main: " + amount);
        amount++;
        System.out.println("Main: " + amount);
    }
    public void run() {
        amount++;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see from this weeks post that threading in itself is not too complicated to implement but as you add threads and run into concurrency problems it can get to be a huge undertaking to keep track of.    Thank you everyone for reading my post this week.  Please make sure to visit the links down below for more detail and examples on how to use threading in a project.  I also want to thank &lt;a href="https://www.w3schools.com/java/java_threads.asp"&gt;w3schools.com&lt;/a&gt; for their implementation examples that I used in the post.  Please feel free to leave a like and comment if you found this helpful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.w3schools.com/java/java_threads.asp"&gt;https://www.w3schools.com/java/java_threads.asp&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.javatpoint.com/multithreading-in-java"&gt;https://www.javatpoint.com/multithreading-in-java&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/implement-runnable-vs-extend-thread-in-java/"&gt;https://www.geeksforgeeks.org/implement-runnable-vs-extend-thread-in-java/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.geeksforgeeks.org/difference-between-thread-start-and-thread-run-in-java"&gt;https://www.geeksforgeeks.org/difference-between-thread-start-and-thread-run-in-java&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>java</category>
      <category>tutorial</category>
      <category>computerscience</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Understanding Threading</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 26 Sep 2021 22:09:22 +0000</pubDate>
      <link>https://dev.to/jryther/understanding-threading-5c9o</link>
      <guid>https://dev.to/jryther/understanding-threading-5c9o</guid>
      <description>&lt;p&gt;Multi-threading is a feature used to process concurrent requests in order to maximize efficiency.  Executing one piece of code at a time may work for lightweight programs but can really bog down the system if something heavy needs to be done.  One way to think of it is if you are driving a car up a hill that only has one lane.  If the road is only passenger cars driving a normal speed then it probably would not be an issue.  However if a semi-truck was ahead of you it would take forever to get over the hill.  Threading has similar concepts to creating two lanes on the road.  With two lanes the cars can drive at different speeds next to each other and the semi-truck isn't slowing the flow of traffic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eqLKT6XS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lbp17xav2a17rwb6xss.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eqLKT6XS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lbp17xav2a17rwb6xss.jpg" alt="Car Driving Up Hill"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In reality threads are a bit more complicated.  A thread is an execution context, which is information the CPU needs to execute and keep track of a list of instructions.  The execution context holds register locations where the next line of instructions is waiting it’s turn.  CPU’s give the illusion that they are doing multiple computations at the same time but it is starting and stopping many things very quickly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g5OX3qgV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fj6ecfoy2wwnsw6e58so.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g5OX3qgV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fj6ecfoy2wwnsw6e58so.png" alt="Process Chart"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zooming out a bit, you can see in the image above that threads are part of a process.  A process is an instance of the program being executed.  The threads make up the Process State of the process and contain the information needed to keep track of what still needs to be computed in the program.  The process also contains other resources such as the code, data, heap and stack.  Some of these resources are shared while others can be thread specific.&lt;/p&gt;

&lt;p&gt;Now like everything in programming, if this is such a great boost to efficiency why don’t we apply it to everything?  Threads do impose minimal impact, require less overhead to create/maintain/manage, and can provide structure simplification.  However, they are much more complicated to implement.  They also bring about problems with concurrency.  The programmer doesn’t know which order of operations the threads are going to execute so safeguards have to be implemented to guarantee the validity of data.  Without protection, one thread may manipulate data that will ruin it for computations by other threads.&lt;/p&gt;

&lt;p&gt;Now that we have an understanding of what threading is, next week we will discuss how to implement it in Java!  I hope you all have a great week and feel free to leave a comment and a like on the post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/5201852/what-is-a-thread-really"&gt;https://stackoverflow.com/questions/5201852/what-is-a-thread-really&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://randu.org/tutorials/threads/"&gt;https://randu.org/tutorials/threads/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.oracle.com/cd/E19455-01/806-3461/6jck06gqj/index.html#:%7E:text=Threads%20impose%20minimal%20impact%20on,server%2Dclass%20and%20multimedia%20applications"&gt;https://docs.oracle.com/cd/E19455-01/806-3461/6jck06gqj/index.html#:~:text=Threads%20impose%20minimal%20impact%20on,server%2Dclass%20and%20multimedia%20applications&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.codemotion.com/magazine/Glossary/process-computing/"&gt;https://www.codemotion.com/magazine/Glossary/process-computing/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>computerscience</category>
      <category>programming</category>
      <category>java</category>
    </item>
    <item>
      <title>Lazy Initialization</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 19 Sep 2021 22:29:12 +0000</pubDate>
      <link>https://dev.to/jryther/lazy-initialization-90g</link>
      <guid>https://dev.to/jryther/lazy-initialization-90g</guid>
      <description>&lt;p&gt;While searching on Stack Overflow for solutions to problems, I notice certain terms and phrases that are mentioned frequently.  One of the most common I see is lazy initialization.  &lt;strong&gt;&lt;em&gt;Why would we want anything to be lazy?&lt;/em&gt;&lt;/strong&gt;  Lazy initialization in a nutshell is the idea of delaying initialization of an object until later when it is needed.  When an application creates many objects, taxing operations performed by each object can add up.  If you don’t need those operations right away then why would you perform them immediately and bog down the system?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class LazyInit {

    private static Resource resource;

    public static Resource getResource() {
        if (resource == null) {
            resource = new Resource();
        }
        return resource;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using a code snippet taken from an article published by Maciej Najbar, you can see an example for a single thread implementation.  For those that have used the Singleton design pattern this may look familiar.  The class creates a placeholder for the Resource object name resource.  Using the getResource() method the object is checked to see if it has been initialized with a value or is null.  If null, it is then assigned with a value which is returned otherwise it just returns the value already assigned.  This allows the programmer to create conditions on when the initialization occurs with the getResource() method rather than in the constructor at object creation.&lt;/p&gt;

&lt;p&gt;Examples on when it may pay to be lazy&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Loading images in a web application&lt;/li&gt;
&lt;li&gt;Java Spring Boot Beans&lt;/li&gt;
&lt;li&gt;Database connections&lt;/li&gt;
&lt;li&gt;Blog posts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As with everything there are some downsides to consider.  Lazy loading is more taxing on the system than just initializing the object.  This is why everything isn’t implemented that way.  Some systems may need these objects to be created right away to be configured correctly.  Also, it may be harder to debug since errors or exceptions won’t be thrown until initialization.  As with anything in programming there are both pros and cons to consider before implementing.  Make sure to weigh the costs on the system before adding a lazy loading to your application.&lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Najbar, M. (2019, January 23). Lazy initialisation - what's a correct implementation? Medium. Retrieved September 19, 2021, from &lt;a href="https://medium.com/android-news/lazy-initialisation-whats-a-correct-implementation-64c4638561e"&gt;https://medium.com/android-news/lazy-initialisation-whats-a-correct-implementation-64c4638561e&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maayan, G. D. (2020, December 25). Don't be LAZY: 3 problems with lazy loading and when to use eager loading. Hacker Noon. Retrieved September 19, 2021, from &lt;a href="https://hackernoon.com/dont-be-lazy-3-problems-with-lazy-loading-and-when-to-use-eager-loading-qq1d34cl"&gt;https://hackernoon.com/dont-be-lazy-3-problems-with-lazy-loading-and-when-to-use-eager-loading-qq1d34cl&lt;/a&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>computerscience</category>
      <category>java</category>
    </item>
    <item>
      <title>What is OAuth?</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 12 Sep 2021 22:29:05 +0000</pubDate>
      <link>https://dev.to/jryther/what-is-oauth-f6b</link>
      <guid>https://dev.to/jryther/what-is-oauth-f6b</guid>
      <description>&lt;p&gt;Most websites that users visit today have some sort of user authentication to access their services.  Previously website providers would implement HTTP Basic Authentication where the user would be asked for a username and password through a form on the web page.  The site would then use that information to log in as you.  The client would receive an authenticated API key ID and a secret to then send to the server with each HTTP request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s wrong with this?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Giving log in credentials to a third-party application or site can greatly compromise security.  Once the credentials have been acquired they cannot be revoked.  Also, there is no way to control how much user access these applications have in the system.&lt;/p&gt;

&lt;p&gt;Enter OAuth.  The idea behind OAuth is that you grant the application authorization to data while keeping authentication secure.  This limits access to only information that is required which can be revoked at any time.&lt;/p&gt;

&lt;p&gt;OAuth works through a series of steps.  First the third party application requests a token with a secret from the provider.  Once granted, the third party application has the user login to the provider with the token to grant the levels of access required.  Once approved, the provider marks the token on their end and it can be used to access the API within the allowable scope.  See the info-graphic below for a visual representation of this.&lt;/p&gt;

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

&lt;p&gt;Implementation of this depends on the framework being used.  I primarily use Java so I would choose the Spring security module within Spring Boot.  For more information and a tutorial please see the link listed in resources.&lt;/p&gt;

&lt;p&gt;That is all I have for my post this week.  I hope you learned what OAuth is and how it works within an application.  Feel free to like and comment the post below as I will greatly appreciate it.&lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;p&gt;Spring Boot OAuth Tutorial:&lt;br&gt;
&lt;a href="https://spring.io/guides/tutorials/spring-boot-oauth2/" rel="noopener noreferrer"&gt;https://spring.io/guides/tutorials/spring-boot-oauth2/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sobers, R. (2018, August 30). What is OAuth? Definition and how it works. Inside Out Security. Retrieved September 12, 2021, from &lt;a href="https://www.varonis.com/blog/what-is-oauth/" rel="noopener noreferrer"&gt;https://www.varonis.com/blog/what-is-oauth/&lt;/a&gt;. &lt;br&gt;
Raible, M. (2017, June 21). What the heck IS OAuth? Okta Developer. Retrieved September 12, 2021, from &lt;a href="https://developer.okta.com/blog/2017/06/21/what-the-heck-is-oauth" rel="noopener noreferrer"&gt;https://developer.okta.com/blog/2017/06/21/what-the-heck-is-oauth&lt;/a&gt;. &lt;br&gt;
Paul, R. (2010, January 18). OAuth and OAUTH Wrap: Defeating the password anti-pattern. Ars Technica. Retrieved September 12, 2021, from &lt;a href="https://arstechnica.com/information-technology/2010/01/oauth-and-oauth-wrap-defeating-the-password-anti-pattern/" rel="noopener noreferrer"&gt;https://arstechnica.com/information-technology/2010/01/oauth-and-oauth-wrap-defeating-the-password-anti-pattern/&lt;/a&gt;. &lt;/p&gt;

</description>
      <category>security</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>java</category>
    </item>
    <item>
      <title>Aggregation Pipeline</title>
      <dc:creator>Josh</dc:creator>
      <pubDate>Sun, 29 Aug 2021 04:35:55 +0000</pubDate>
      <link>https://dev.to/jryther/aggregation-pipeline-25gd</link>
      <guid>https://dev.to/jryther/aggregation-pipeline-25gd</guid>
      <description>&lt;p&gt;Welcome back everyone.  For this post I am going to continue talking about databases, specifically the aggregation pipeline in MongoDB.  Most people learn how to pull data by using find commands in the Mongo Shell.  While this is fine for simple queries it becomes insufficient as requests become more complex.  This is where the aggregation pipeline comes in.  It breaks up the query process into stages that form the pipeline.  A generic example can be seen below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SkjQ4i6u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6nv658jlurveur105ubp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SkjQ4i6u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6nv658jlurveur105ubp.png" alt="MongoDB Aggregation Pipeline Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most common stages are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Match: Filters the documents to pull what is needed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Group: Separates the documents into specified groups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sort: Sorts the documents in each group (ex: ascending or descending)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are other more complex stages such as unwind and project but we will not be going over them.&lt;/p&gt;

&lt;p&gt;The syntax to create a pipeline is to first create an array of JSON documents that contain each stage in the order you wish them to be performed.  See an example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline = [
    {$match : {name: “John”},
    {$group : {_id: “city”},
    {$sort: {age: 1}
]
db.collection.aggregate(pipeline)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Walking through the example, the pipeline first finds all of the documents that have a name that equals John.  It then groups all of the John’s by their city and sorts them in each group by their age in ascending order.&lt;/p&gt;

&lt;p&gt;As you can see this form of query can be extremely powerful and enhance readability of complex operations.  It is important that as you learn to use the framework that the stages are ordered in ways to increase performance and do not hit the memory limitations.  Let me know down below if you enjoyed the post and I hope you have a great rest of your week.&lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Couto, J. (2021, May 4). The beginner's guide to MongoDB Aggregation (With Exercise). Studio 3T. &lt;a href="https://studio3t.com/knowledge-base/articles/mongodb-aggregation-framework/"&gt;https://studio3t.com/knowledge-base/articles/mongodb-aggregation-framework/&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Aggregation pipeline. Aggregation Pipeline - MongoDB Manual. (n.d.). &lt;a href="https://docs.mongodb.com/manual/core/aggregation-pipeline/"&gt;https://docs.mongodb.com/manual/core/aggregation-pipeline/&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>mongodb</category>
      <category>database</category>
      <category>beginners</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
