Being aware of reality

Photo by Hunters Race on Unsplash

I used to say things like: “We all know money does not bring you happiness.” In the last couple of years, my thoughts on this idea have changed drastically. My parents would always ask me what I wanted to be when I grew up. I would tell them that I wanted to be a mechanical engineer. The only reason for this response was because my Uncle was a mechanical engineer and made great money doing it. I never had any knack for building things. Engineering was definitely not for me. …


CODEX

How a little Selenium knowledge can go a long way

Photo by Siora Photography on Unsplash

A bot is a program that interacts with web elements (elements from a website, web application, etc.). It makes it seem as if an actual person is using some web application, when in reality, it’s really a program. Bots can be used for things like: testing website functionality, producing information for a user within an application, and generating conversational messages (chatbot).

Selenium is a framework for testing the functionality of web applications. Selenium has many methods that perform human-like processes. Clicking on buttons and entering data into input fields are just some of the things implemented. There are libraries and…


CODEX

Analyzing an incredible feature

Photo by Jordane Mathieu on Unsplash

The code above shows that the BeautifulSoup constructor (on line 12, imported as soup) takes in arguments of a site’s HMTL and a string indicating the type of parser that we need. This creates a BeautifulSoup object that we can use to scrape data from. Scraping a page or two from a website with this setup should be fine. However, if you need to scrape multiple pages of data, then this is probably not the way to go. The BeautifulSoup object by default will parse the entire page of HTML that we provide it with. We then have to…


Let me explain…

Photo by Joshua Earle on Unsplash

Yes, I was dropped from all of my classes in my very first semester of college. I thought that I was prepared by enrolling as soon as they became available. I had this foolish assumption that you could make your payments by the end of the semester. This could not have been farther from the truth. As the weeks went by during summer, there was never even a thought that crossed my mind about checking my enrollment status. In usual fashion, I procrastinated to almost the very end of summer to finally refresh myself on my schedule (room numbers, meeting…


CODEX

Bringing everything together

Photo by Joshua Aragon on Unsplash

The code above imports the Beautiful Soup library, urlopen function, BeautifulSoup function, and csv module. You will see how each of these things are used as we continue with the code.

In Python, you can import a function through a different alias. Therefore, request(url) and soup(page_html, ‘html.parser’) are actually urlopen(url) and BeautifulSoup(page_html, ‘html.parser’) respectively.

On lines 3 through 5, we are opening the URL, grabbing the HTML, and closing out the connection. Line 7 turns the HTML code from our URL into a parsed document. Line 8 calls find_all() to retrieve the HTML code directly associated with the…


CODEX

Downloading the right tools for the job

Photo by Andrey Tikhonovskiy on Unsplash

What’s a web scraper?

We can write programs that allow us to read certain kinds of files. These can include text (.txt), comma-separated values (.csv), and image files (.jpg, .png, .bmp) (just to name a few). However, a web scraper is an application that reads the HTML code from a website. HTML parsing libraries can be used to interact with the website source code in an elegant way.

Description of the scraper I built

The web scraper I built is based off a tutorial video from YouTube (the video will be referenced at the bottom of the article). The video focuses on building a web scraper to obtain information from…


CODEX

A mind-numbing concept simplified

Photo by Tim Marshall on Unsplash

What’s all the fuss about?

Recursion seems to be the one topic that gives every beginning computer science student a headache for months. This concept can be introduced through a variety of different materials, however, it is most notably seen in the form of recursive functions. Functions, in general, are used to group statements together that perform a specific task and to get rid of repetitive lines of code. You call a function to execute lines of code. Functions can even call other functions to assist in completing the process at hand. A function that calls itself is referred to as a recursive function.


Addressing an existential crisis

Photo by Jeremy Thomas on Unsplash

I have been stuck trying to figure out the answer to this question for what seems like an eternity. More and more people have no curiosity left in their lives. No one wants to know why anything happens anymore. Questions like: “Who am I?,” “Why does the universe exist?,” “Why is there a universe and not something else?,” and “Why is there even something rather than nothing?” are pawned off as meaningless. To take a step back, means to rethink what you are doing. Trying to answer the questions above (and ones that are similar) force people to step back…


Photo by David Clode on Unsplash

String slicing is Python’s way of generating a substring. A substring is a part of a string. For example, “Hi there!” is a string and “there!” is a substring of the original string.

phrase = 'Python String Slicing'
phrase[0:6] # 'Python'
phrase[7:13] # 'String'
phrase[14:len(phrase)] # 'Slicing'

The code above defines Python’s string slicing syntax as: string[start index : end index]. Starting index is always included. This means that the starting index you provide is the character index that is used to begin the production of the substring. However, end index is excluded. In the example above, phrase[7:13] produces: String…


Photo by Jon Tyson on Unsplash

I always had a difficult time knowing whether or not I could use a ternary operator ((condition) ? a : b) in my code. It was never made clear to me about which situation needed to arise in order for this operator to be deployed. Eventually, I figured out this conundrum. It’s time to share this discovery with the world. A ternary operator can be used when something is returned whether a single condition evaluates to true or false. The best way to understand this is through the recursive implementation for computing the factorial of a number.

In the…

Joey Zamiski

Computer Science student. Hopeful Research Scientist in Computer Graphics.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store