Saturday 31 October 2020

Season 1 - Hacktoberfest Recap

 

WHAT A RUSH!

A race against time and other open source devs to qualify for open issues on repositories you are interested in.

What a great past time activity that is also accredited for school. 

Hacktoberfest! What a great idea. Especially in these interesting and difficult times.

It has finally ended. The busiest month I have ever lived through. It was not that bad to be honest. I have gotten through a lot worse (I think). 

Welp, this blog will serve as a recap to the most interesting event I have participated in, Hacktoberfest. The point of Release 0.2 was to contribute to at least 3 different repos and make 4 different PRs. 

What a great experience to gain knowledge in different projects and languages... UGH Python

Without further adu, Season 1 Recap of my Hacktoberfest journey.

Release 0.2.1 - Entry into Open Source

To get into the swing of Open Source contributions, I wanted to start off with something small. The first repository I chose was of a website that I had used on occasion to keep up with VR news when I first bought my Oculus Quest HMD. Unfortunately, I found a more intriguing website that contained more up-to-date information and game release/news. My first PR was to locate a script that was returning a status code 404. This was not that hard, like at all (thanks chrome dev tools). I made an issue on the repo and created a PR that had simply commented out the script returning a 404, which was doing nothing anyways. I think the maintainer does not check his github often since the issue and PR still remain open, Oh well.

Release 0.2.2 - Entering Another (Virtual) Reality

This was by far the most exciting repo I worked on throughout the whole month. I love virtual reality and I am really glad I got to contribute to this repo because the whole idea behind it is very neat. Oculus Quest is a standalone headset and has no connection to your PC. This owner of the project created a link to your HMD and PC through your LAN so that the Quest can communicate with discord and update your "discord presence", or simply put what game you are playing at the moment. I felt really accomplished with this PR because, I was finally doing something I have a passion for. I made a PR to update his JSON file which contained all sorts of applications and games. I even chatted with "MadMagic" on discord and we are now friends and talk regularly.

Release 0.2.3 - Avoiding Boring People with Chat Automation

My third PR was actually two smaller PRs. Why two? Well, because I didn't think it was enough for the fixes I made on the first one. I found this really neat repository that was basically a chat automation bot for the whatsapp web-based platform. The chatbot did everything you could imagine a chatbot doing. The maintainer was looking for a small refactor on his code by including a different style of CSS selectors from calling his constant selector class file. I replaced the selectors the way he wanted and got acquainted a little more with python, my arch nemesis. For the second PR of my third PR I had to basically copy the basic logic of his whatsapp bot, but make slight modifications so that a facebook session is made (click link above for more details).


Release 0.2.4 - More Pythonic Automation

This was yet another contribution towards automation bots. However this was tailored only to scraping elements from the whatsapp web-based platform. The maintainer (Navpreet) wanted me to write a function to scrape and return a phone number of a specific person that the user has an existing chat with. Really neat and as it turns out not that easy. It was interesting seeing how code varies from machine to machine. A problem I encountered was that the code ran fine on my machine and did the intended task, but once Navpreet ran it on his end it gave him an error (see blog for more details).

That was it for the month. Overall the experience was amazing and I will definately participate in next years Hacktoberfest. I really enjoyed getting involved in various projects and most importantly I made friends and (Hopefully) connections by interacting with the project maintainers. There are a lot of people that are like minded and have the same cores and interests as I do, no matter where in the world they are. a big thank you to my professor for picking something so interesting to get us involved. 

Oh and I made my 4 + 1 Hacktoberfest accepted PRs even though 2 of the PRs I made for Release 0.2 were not in hacktoberfest repos.


Now, all that is left is to wait for the PRs to mature and for me to get a sweet T-shirt. 
That was everything that happened during Season 1, stay tuned for Season 2 of my hacktoberfest journey next year around the same time... obviously for hacktoberfest.

Till next time, 
XOXO, 
Gossip Plamen


Release 0.2.4 - More Pythonic Automation

 


Hello again, my fellow programmers.

The end of the month of October is here and a fourth and final PR has to be made in order to fulfil the requirements of my 0.2 Release.

I will keep this post short and sweet (again)... because it is Halloween and I have candy to eat... erhm give out O.o 

So, this week as I mentioned above I had to complete my final PR for Hacktoberfest. I was stumped on what I actually wanted to do and contribute to as I was also pressed for time due to spending time on my ever growing open world concept level for my Game Dev. course. #ThanksGeorge

I searched and searched for something interesting to do with knowledge I already had. I then remembered that the point of each consecutive contribution was to learn something new. I remembered the Selenium/Python automation bot from my previous PR and saw that there was open issues the owner of the repo wanted help with. I picked one where I needed to scrape a phone number from a specific "open" chatroom in whatsapp web.

I got to work and I completely forgot about asking the maintainer to assign me to this problem, which I think is a big NO NO in Open Source Dev. 

So, I thought that since I used selenium in my 0.1 release to scrape a web page for links using Java, it would be similar. 

I mean it was not that different but the way the maintainer does the scraping is weird and I was not familiar with it. He finds/scrapes data by using the CSS selector class. Which I found to be an interesting approach, it is risky because whatsapp can change the layout and selector class and that can cause everything in the bot to break. But, I am not one to judge.

Nevertheless, I started searching how to scrape exactly what I was looking for:


Now, that I had the exact selector for the specific class I put the parent div selector class into the constant file class that Navpreet (owner of the Repo) had previously made.

In order to scrape the telephone of a specific chatroom with a person I had to:
  1. Use his already made function to Open a chat with a specific person
  2. Open the chat info
  3. Scrape the phone number from the person's info
  4. Close the chat room
  5. Return the scraped phone number
I ended up using a lot of already made functions throughout his code to avoid code duplications where it was unnecessary, and finished with something looking very simple and clean.

I tested and everything ran fine on my computer... KEYWORDS: "My Computer"
I made a PR thinking everything would be fine.

Navpreet reviewed the code and merged it. YAY!

He then messaged me on discord a couple of hours later saying that there was a bug scraping the number. This was happening because the element that contained the phone number was not yet loaded but the bot scraped something that did not "exist" yet... I have no idea what could be causing this since everything ran fine on my end.

Eh, whatever, I hopped on a call and we started debugging and we thought to implement a "wait" functionality for the bot to hang and wait for the element to be available in order to be scraped.

It worked!
Navpreet made a PR addition to my PR and everything was fine and dandy. 

He is actually a really cool dude. He lives in India and his English was perfect! I was surprised. We exchanged a couple of stories and laughs after we finished debugging. Needless to say I made a friend all the way across the world. Awesome feeling when you can connect with someone on a personal and intellectual level.

Anyways I am off to go HaNd OuT candy and watch a bunch of scary movies. 

Till next time, 
XOXO, 
Gossip Plamen

Saturday 24 October 2020

Release 0.2.3 - Avoiding Boring People with Chat Automation

 


Hello my wonderful followers, aka my professor.

These past two weeks have been a nightmare for me (and many of my colleagues). This is due to the overwhelming amount of work that I have to do in my final year of my Computer Science program. #ThanksGeorge... BTW, George is my game development professor.

Anyways...
I will begin this blog by asking a question. Have you spent too much time on social media? Do you have boring/ignorant people that chat with you on a regular basis but you just have no interest in talking to them at this specific time? Yeah, you know who I am talking about. AND, if you don't know/have, you are one of those people.

So this week I decided to break away from the VR scene and continue my studies on my automation skill set. I found this really cool github with all kinds of automation bots that do various kinds of things. I found the most "popular" repo which was on the whatsapp platform. I saw one issue that still had no assignee so I acted quick. When I say quick I mean I commented asking to take on this issue quicker than my girlfriend changing her mind about where she wants to eat (and that's quick).
I got assigned to it probably within the hour.

Anyways, the issue was not hard at all. It was to replace some code with a modified version of an already made CSS selection "library". It really was not rocket science and any python beginner could do it. Now, re-read what I just said....
YEP, Python. 
But, Why Plamen, I thought you couldn't stand python and that the snek and you despised each other.
Yeah, well... I don't know, I really do not have an explanation to it. Maybe I enjoy being punished, maybe I am a masochist. Who knows.
No, the actual reason was that it was using selenium and I have a little experience with selenium from my 0.1 release. I wanted to see what else selenium can do so I forced myself to slowly start learning python.

Moving on.

I began to do exactly what was asked of me and began making the appropriate changes, as follow:
# from 
MAIN_SEARCH_BAR = '._3FRCZ'
EC.presence_of_element_located((By.CSS_SELECTOR, selector))
relement = element.find_element(By.CSS_SELECTOR, selector)

# to 
MAIN_SEARCH_BAR = (By.CSS_SELECTOR, '._3FRCZ')
EC.presence_of_element_located(selector)
relement = element.find_element(selector[0], selector[1])
 and so on...
I made my PR and it got merged the next day.
I thought this was not enough though so I looked through the person's other repos and saw they had began making a similar automation bot for facebook, a dying social media platform.

This issue was a bit more challenging as I had to make the base file for opening a browser with facebook as opposed to whatsapp and retain similar logic to his whatsapp file waobject.py 
I fiddled my thumbs around for a little bit and began examining how his code exactly worked. I soon realized that he did not want me to make any implementations but simply make the base file to open a session with facebook. Kinda lame but gotta give the people what they want I guess.
I finished my implementation and sent him a quick PR. Honestly, I believe that two small fixes/contributions were enough to call a combined 3rd PR for my 0.2.3 release. 
I just hope my professor sees it like that.
Even if they were not I came out with a lot more knowledge of python and selenium than going in. Quite frankly I enjoyed contributing to this person's repo as automation is becoming a more popular and growing idea of the current times. 

Well that was it for this week my friends. Short and sweet (again...)

Till next time, 
XOXO, 
Gossip Plamen

Friday 23 October 2020

Lab 5 - Changing the Course of Time

Oh Boy oh Boy!
I am back with another week's worth of (meaningful) knowledge.

This week we were tasked with refactoring our code for our never ending assignment, link checker (DeadLinkage) for those of you who have not been keeping up with the Kardashians blog. 

I had to pick and choose at least 3 things I wanted to refactor about my code... TBH, I wanted to throw the whole thing away and never look at it again. SERIOUSLY! Although it worked flawlessly the whole thing was held together by a piece of reused duct tape that had fallen on the carpet.

Anyways, I started thinking about how to refactor this whole gigantic mess that looked like my current room state, into something that was modular and easier to look at, as well as easier to work with and maintain.

I came up with something similar to the suggestions put out from our professor.

  • I decided to get rid of global variables such as the CLI ANSI colors and store them into a completely separate class.

  • Split the main driver of the program into smaller more maintainable components and naturally moved them to other classes/files.

  • Refactored how the parsing of the arguments was being handled in the main driver program and split into components based on whether the user provides a URL or a local html file.

Now that the "hard" part of the lab was done, it was time to do some git...git...git outta here...

First thing I had to do once my final commit had been made into my refactoring branch was to rebase and squash the previous commits into one final commit.
This was done by: "git rebase master -i" which opened an interactive rebase editor where I was to pick which commit I wanted to squash the others into.

That went pretty smooth. I was expecting some sort of conflict to occur, but no. ðŸ’¯

The next step before I merged into master was to make a meaningful commit message because frankly the rebasing commit message was not doing it for me.
This is achieved by: "git commit --amend"

IT IS TIIIIIIIMMEEEE!

Let's merge to master ~sweating profusely~

uhhhhmmmm... WHAT?!? No merge conflicts second week in a row?
Am I doing this right? I mean I will take it and go on about working on designing my game for yet another time consuming course GAM537. #ThanksGeorge

I will leave you guys with that for this week.
Expect more of my greatness O.o in the upcoming weeks.

Till next time, 
XOXO, 
Gossip Plamen

Saturday 17 October 2020

Release 0.2.2 - Entering Another (Virtual) Reality

 

Hello my fellow gamers.

Today's blog will be a continuation on the festivities of Hacktoberfest.

As I mentioned on my last hacktoberfest blog, I am a big VR enthusiast. I absolutely love escaping reality and jumping into the virtual world where I can be whoever or... erhm... whatever I want to be without any judgements. 

So as you all know I bought an Oculus Quest roughly a year ago and have been dabbling into VR open source lately. There are a lot of cool apps/games that are made specifically for the Oculus Quest.

Anyways,
for my second PR I wanted to contribute to something I recently found and have been using ever since I found it. The discord rich presence application for the Quest. It is basically an app that runs on your computer and updates your discord status based on the packets sent from the quest to your local network. The Quest sends packets based on event driven tasks, so every time you open an application a packet is sent. The PC application picks it up and updates your discord status to whatever the packet was.

The creator of this application mentioned that he is looking for contributions to their games/apps json list. 
I got into contact with him and chatted for quite a bit. He told me how to properly test the updates and how the application itself works (see above).

My chat with him went something like this.



Extremely cool dude.

Awesome, I got the OK from the owner to go ahead and contribute to his repo.

The first thing I did was open up his json file to find that there were already over 100 games/apps that were being picked up by discord... That did not make my job easier.

I opened up a third party store (SideQuest) tailored for Oculus Quest developers and got to searching for games that were not in his list.

I found content that I can update his json file with and got to work.

I added about 20 games to the list. Might not seem a lot but it definitely is for the amount of time I spent searching.

Everything was working as expected I fed the package name, the state and the description for each app.



I then pushed it to my fork on github and opened an issue on his repo. I made a PR and linked it with the issue.
To my satisfaction he merged my PR. I felt so good about contributing to an actual VR project. It was awesome. 

I will contribute something more in the future to this repo as it is very useful for Quest owners.

Well... that was it from me for this week. Stay tuned for my next contribution in the VR scene.


Till next time, 
XOXO, 
Gossip Plamen

Friday 16 October 2020

Lab 4 - More Python Nightmares

 


Hello my fellow programmers/coders/readers... ah w.e.

Just an update on my academic career, or mainly my open source endeavors.

Now I know I said this in my past blogs, You've been following right??, but I absolutely hate Python. I don't know what it is the Snek is just not compatible with me.

So WHY for the love of god did you choose to work on Python again, you ask? Well, the answer is quite simple because I am a loser work well with my friend @chris. Mainly because I like his coding style (similar to mine) and his bald head

Anyways, this week in my open source dev class we had to pick someone else's previous 0.1 release and implement a rather easy but tricky feature to their program. We had to implement a feature that reads a text file and scans links to be ignored from a file or URL.

Alright, Cool! I've worked on Chris' code before this should be a light summer breeze. Boy little did I know that Chris wanted me to do a lot more than just implement this feature...

My guy basically wanted me to restructure his whole program to look cleaner.
Yeah... good times. But, w.e. I told him I'd do it and I am a man of my word.
He had this gigantic code block that was an eye sore. 

This was the first thing I did. I made different functions that were called and outsourced a lot of the work for each type of link with a specific status code. In a sense it is not more modular (I should probably make my code as neat as his TBH! But... then again who really cares).

Once that was done, it was time to get back to the issue at hand. My initial step was to add a "-i" argument option for ignoring links from the file specified.
Super easy. I wish Java had something similar of how it handles arguments. I had to write the following to the "-i" argument option: "nargs=2, action='append' " nargs allows me to take in multiple arguments with a single option. Neat! Yet again Python proves to be superior than Java.

*Actual representation of me dying on the inside*
The other option I had to handle was "concatenating" the arguments into a single list/array. This is done by the " action='append' " pretty self explanatory.

The actual file checking of the links was not that hard to implement. A basic try and catch.
  • Try to open file
  • if file opens call regex function to search for links that do not start with a "#"
  • return array if it found any links

I actually contacted Chris and asked him how he would like me to handle the removing the links that were to be ignored. He told me he would like to continue using BeautifulSoup

In all honesty, that actually made my life much easier, as I did not have to use a separate function for checking links. I simply modeled the checker around his old function.
That's it. I didn't really have any issues with the implementation, more the cleanup... (Damn it Chris)

The second part of the lab was to Review and Test the the code via Remote. so I did just that
I reviewed the feature that Chris had worked on for me and I was thoroughly impressed.
lol O.o
I did not have any issues or remarks towards his code. I am actually thinking of refactoring all those nasty if conditions to match his style of logic (as mentioned earlier, "cleaner"). 
For real, Great job as per the ujee.

I merged the code and to my favor there was actually no merge issues. 
Sweet! 
I honestly learned more about Python from this lab than about git. It's a neat feature but I would find it easier to make a pull request via github than on bash/cmd. 

Till next time, 
XOXO,
Gossip Plamen

Monday 12 October 2020

Release 0.2.1 Entry into Open Source

 


OMG!

It's finally happening, DO NOT PANIC!

October is finally upon us and Hacktoberfest has officially started. What an amazing experience to get involved with other developers across the globe and contribute something meaningful.

So, anyway. For the month of October we have to make 4 PRs in at least 3 different repos. I loved the idea of getting involved with something and transitioning outside of my comfort zone.

Roughly a year ago I bought myself an Oculus Quest (Best purchase I ever made). I entered into a whole new reality (literally). Accompanying this new purchase I developed a new hobby. A hobby for VR, Virtual Reality, and as every new hobby I was, still am, really interested in all news and things in regards to VR. When I was still a "newby" in the VR scene I started following all these cool websites and forums to maximize the gain of my new toy.

Therefore, it only made sense that my first PR to someone outside of our OSD class was to an Oculus Quest related repo.

I began my search for repos related to Oculus in general but the projects seemed way too big and out of my scope (at least for this week). After hours of searching and going through countless of README files. I found the ONE.


The repo I found was for a website I used to follow and get my gaming information from when I first bought my Oculus Quest.

The website itself looked amazing, for it having been done by one person.

It was time to begin looking through the code and finding potential bugs. I remember our professor showing us how to find bugs in one of his lectures. My initial urge was to open up the developer inspection tool on chrome and see if any links are broken.

To my avail there was a script that was returning a status code of 404.


I looked over the code to see if the flipclock.js was being used anywhere that was of importance. YES! It was not. I proceeded to make an issue notifying the owner. 

Short and sweet. That was my fix.
I made a quick PR where I simply commented out the js file incase he wanted to have it in his code for future reference.

AND THAT'S A WRAP.




It was not much but fixing a bug does not have to be a complicated thing. With that being said, I do have a much bigger contribution coming to another Oculus Quest Repo coming up. So stay tuned my peeps.

Till next time,
XOXO,
Gossip Plamen

The Merge Conflicts of Life


Hello my fellow strugglers,

This week in Open Source Development we were tasked with making a couple of small features to our ever growing and glorious link checker program.

TBH. 
I feel like there is nothing glorious about this program and the way I did it. I am realizing this the hard way. Even though Selenium gets the job done, but at what cost, something like this would be written better in plain java. Eliminate all these dependencies.

Anyways, before I go off topic too much, we had to implement 2 small features or "upgrades" if you will.

The first feature I chose was to add in exit codes, really simple. Since I had made a separate function to check links all I had to do was put the function call in main in a nice little try and catch. If anything went wrong an exception would be thrown and a boolean variable would be made false and would exit with an exit code of 1. Super simple even my cat could write it.

My second feature however, took a little thought. I implemented a command line argument to check for good, bad, and all links with their respective arguments. Sounds easy, but  I had to refactor a lot of my old code to make it happen.

BUT!

That was not the point of the lab. The point of the lab was to merge the 2 branches together and see if we get any merge conflicts and deal with them.

Alas, my two features were complete and it was time to merge them. Naturally my first merge went without a sweat.

Time for my second merge.

MERGE CONFLICT!!!!!!!!

Of course there was a merge conflict, why wouldn't there be one. Life couldn't have just given me this one favor this week.
Meh, W.E.

I opened up my IDE and checked out what the issue was. To my benefit it was just a couple of lines that were having problems with each other. Easy fix!
Thank goodness that was over because I had just came off a whole nighter for one of my other courses (Game dev....)

I had to fix a merge conflict before and it got real messy because I didn't know what I was doing I never encountered one before and had no experience with them.

TBH.
I would not change anything next time when merging something because working on different branches and having these small merge conflicts are just part of the fun road to success.

I am now going to stare at my screen pretending I know what is happening work on some data structure labs.

Till next time,
XOXO,
Gossip Plamen

Thursday 1 October 2020

Open Source Progression - Lab 2

Heya Everyone

I hope everyone is enjoying the week so far. It sure has been a busy one for your boy.

So, I'm going to try and keep this one short.
Just as a refresher, in my last post I talked about how I reviewed Chris' repo and filed issues and even submitted a small PR.

Well, I jumped the gun on that a bit showed initiative last week because contributing something useful was the task for this week. We were tasked with adding 2 optional features that had not been implemented yet. So naturally, I chose the feature I thought would be easiest to implement I could do since I absolutely detest python. 

Going down the list and reviewing his code once again I noticed that he was using the request "get" as opposed to "head". I figured this wouldn't be much of a PR as it was fairly simple. I decided to make another feature because Chris was doing two why not. Next on my hitlist was the 300 redirection. It sounds pretty simple right?!

Well it was and it was not at the same time. I had troubles storing the URL of where you were being redirected. A quick search and I found my answer on a stackoverflow thread.

In order to store the history and allow redirecting I had to implement another request.

req2 = requests.head(test_link, allow_redirects=True)

Awesome everything worked out and redirects were now being followed. I don't know what happened when I was trying to create a PR for this feature but I had an issue with pushing my updates. Super weird... I had no idea. After a little tinkering I figured it out but it was annoying.

That was the feeling I was getting.

Anyways...
I got some features implemented on my own repo. Chris copied my idea for added redirection feature which was really neat. I completely understand the battle with getting the web driver to cooperate with what exactly you want to do. Maybe selenium isn't the best way to do this sort of thing, but then again anything can be done. I also saw that he fixed my status code ranges. Chris added Linux command line support which shouldn't have been that hard, aka adding more conditions in the if statements.

HAHA. Jokes aside, thanks for the contributions my dude. That is two less features I have to worry about. I really appreciate it.

Something I agree with Chris on is that we should have communicated ALOT more in regards to implementation. Instead of spending hours searching for an answer on threads we could have just asked each other, but I guess you live and you learn right?! Doing this I confirmed my initial thoughts that I HATE (love) PYTHON.

Till next time,
XOXO,
Gossip Plamen

Release 0.4.3 - The End of Something Great

  Hello my wonderful followers! It is here... It is finally here. The end of this nightmarish semester is finally here. I have to say the pa...