Back again with another lab regarding for my OSD600 class. For this week's lab we had to implement additional features to another student's link checking program that we've slowly been developing for the last month and a half.
My new friend Plamen messaged me again and asked if we wanted to team up again for this week's lab. We worked well together the last time so why not. I set out to implement the ability to read a file of ignored links and not check for them:
Users want to be able to run our link checker tools and be able to include an extra argument, a file of URL patterns to be ignored. This week's feature will add the ability to exclude URLs from our check based on a URL pattern file.
When I first read the lab spec I thought it sounded a bit challenging. Then I started it and thought it was easy. When I got about half way into it and reverted back to my previous stance back of "challenging." Ohhhh boy.
Here's my new monitor I bought. I told the salesperson that I was programming in Java, they patted me disappointingly on the shoulder, and suggested the largest ultrawide monitor they had. They apologized when I noticed the box said 34 inches. Man people are weird in a pandemic.
My biggest issue (besides my now maxed out credit card) with this lab was just trying to get Java to cooperate with opening the text file. Mostly this stemmed from learning how to read multiple arguments from a single option e.g.
-i links.txt index.html. I ended up implementing this weird shifting logic (update: oops. Just noticed I left in a comment that helped me sort the args...) to accommodate Plamen's existing logic for his other command line arguments.
I also initially had issues reading the actual file. For some reason when using
java.util.Scanner it just kept ignoring the first line in the file. I don't know why and couldn't for the life of me find other people having this issue (or at least, with a solution tailored to what I was currently working on.) Most people just recommended switching to
java.io.BufferedReader and ditching Scanner all together. So I did that. Interestingly, without checking if the next line is equal to null:
(line = br.readLine()) != null) breaks stuff. If the line we're currently checking was empty (e.g. if the line was just a new line) Java would scream at me. Makes sense, moving on.
Finally, after that was finished I had to decide how actually feed the file of links to be ignored into his link checker. I asked him if he had any concern with how he wanted me to do this, he told me to model it after how he ignored
mailto: links. Essentially, he replaced each
mailto: with an empty string so I did the same: if it starts with one of the links we're ignoring, replace it with an empty string. I did the same for ignored links. Then I just checked each link normally inside the
In hindsight, not too hard, not too easy, just (thankfully) like most of the other labs we've had to do in this class so far. Then I had to merge it. And create a pull request. WITHOUT USING GITHUB, ONLY REMOTES. Cold sweat ran down my face as I had to not only communicate with another human to set up our remotes.
I didn't particularly find any aspect of it difficult. The hardest part was coordinating with Plamen with what he could and could not see on his git.
git remote add plamen https://github.com/pyvelkov/DeadLinkage.git
git fetch plamen
git checkout -b issue-14 plamen/issue-14
git add && git commit && git push origin issue-14
git fetch upstream
git checkout master
git merge issue-14
Man this shit is amazing. Every time I learn something new about git I'm in more and more awe of it.
Surprisingly (disappointingly?) nothing broke and everything fast-foward merged just fine. Though it did take about 45 minutes to figure out what to really do to accomplish this from both this week's lecture video and the instructions specified in the lab spec. Sorry, nothing exciting to write home about this time.
Using Git in this manner was strange. Having to keep track of the remotes, stages, and commits was very confusing. I understood what was going on but wouldn't say I was very thrilled doing it like this. I guess a process like this is more reserved for git gui programs, as opposed to doing it by hand. It was really fun learning about it! Now let's never speak of it again.
Now if you don't mind I'm going to try to scratch one of the many things I have to do off my to-do list. Woohoo midterms.