Blog

Open Source

Experimenting with Chrome Extensions

Continuing with my open source projects, our class decided to develop a browser extension to improve our school’s BlackBoard website! This was a great way for us to experience what it’s like to start an open source project from scratch. The goal of the extension was to make improvements on the website such as removing elements that we thought were unnecessary.

The two tasks I took up were to create a dark theme for the website and an options panel for the extension itself. Creating a dark theme was simple enough: finding which elements on the page you wanted to change the properties of and putting it all into a CSS file. However the options panel took me days to figure out.

Implementing the Options Panel

Having never worked on browser extension before, I was a little nervous since I had only did a little research into how the files should be structured. I thought it would be easy enough though since there were other projects that implemented this feature such as Refined Twitter. I assumed that a simple copy and paste and some renaming would do the trick.

…Yeah that sounded too good to be true

Turns out that Refined Twitter structured their code very differently and also used a bunch of external libraries to achieve this. I didn’t exactly want to add a whole bunch of new files to the project as it would confuse everyone else that was working on it as well. Still, it was good to see how a working example of an options page looks like (and their design was one that I liked).

Instead,  I turned to the good old documentation from chrome itself. Admittedly, it is something that I would normally avoid if there was a quicker solution. However considering that I knew almost nothing about extensions,  this was the best solution. At the beginning, our manifest file looked like this:

manifest1
Very bare bones, just enough information to get the extension working

However to get the options panel functioning the manifest now looks like this:

manifest2
Adding in “storage”, “activeTab”, “options_ui” and “background” sections

This meant reading up and understanding how the following functioned and interacted with each other:

From there I started with making the simplest options panel I could think of and used the example provided in the documentation to help me. In the end I did manage to get it working for the scripts that we had! However that’s where our next problem comes: splitting up all the implemented features of our extension.

Reorganizing the Code

Thankfully there weren’t too many features that were already implemented in the one file that we had running. All that was needed to be done was to split them all into separate files and organize them into another folder for organization. This did however mean that it would change the way future features were to be added into the project (which is fine since the intention of this task was to make features able to be switched on and off). I had to do some rebasing and also added comments throughout all the files I added so that others, who may not be too knowledgeable in extensions like me, would be able to easily identify what each of the files did.

Hopefully this pull request gets approved soon so that others that are currently working on new features can properly adjust for this change (and that way I could submit a PR for my dark theme too!).

Also I wanted to give a huge shout out to yevseytsev, the sole maintainer of the project. He has been quick with responses and always follows up with others’ comments and concerns. I’m sure that he has many other class projects like the rest of us students do, so for him to take the extra time to ensure this project is running smoothly is amazing!

Open Source

Hacktoberfest Haunts Back!

Surprise!

Just when I thought everything was good and done with, one of the Pull Requests that I submitted before came back to give me a haunting. The creators of the repo have since upgraded their application to the newest version and got around to checking my contribution.

The code underwent a big reconstruction, causing a lot of my submitted methods to not be compatible. Not to mention that they also added a whole bunch of new rules for me to comply to when submitting the code. After fiddling around with the code and committing countless times I hit a stage where I only had a few unit tests that I needed left to fix for my code to pass. However, I seemed to have messed up with the tree at some point when I tried to rebase my branch. What was even worse was that I tried to create multiple branches in an effort to back track where I went wrong and ended up creating a huge mess, causing me to spend multiple days figuring out what went wrong.

YIKES1
Somehow all the commits got replicated on each branch!
YIKES2
Continuation from the first image

I had to then step back and clean up my code a bit. I deleted all the unnecessary branches and instead squashed some of the commits together to make things neater. Thankfully that seemed to clear up the issue and I was ready to resubmit the PR.

But again surprise surprise! The repo seems to have been updated again and caused my submission to violate some new unit tests. It seems like I still have some more work in store for me. Hopefully it won’t take much longer, I need to start getting the Seneca Blackboard Web Extension rolling!

Open Source

Hacktoberfest Recap

Looking back at how I was during the beginning of the month, I felt like I’ve made significant progress as an open source developer.

When I was first introduced to Hacktoberfest, I was pretty excited to work on real projects with potentially people from all over the world. When I first started looking for issues to contribute to however, I quickly became overwhelmed due to the nature of their difficulty as well as seeing so many experience and knowledgeable developers already contributing to these projects. I was afraid to tackle projects that I had limited knowledge in and was also reluctant to ask questions to avoid looking stupid.

Thankfully, I found the perfect first project. The project was to create a website to celebrate Hacktoberfest and anyone was welcome to help in any way they wanted. The friendly and easygoing nature of everyone work here eased me in to the month really well.

I then began to think how I could grow as an open source developer. I decided to try and tackle a different type of issue for each of my pull requests. That way I could get a feel for what kind of issues I enjoy helping out on. Over the month I’ve cleaned up code, edited documentation, implemented new features, as well as provided translation work.

I also tried to explore different programming languages as well to get out of my comfort zone. It’s amazing how much you can learn just by looking at other people’s code. The projects that I helped out on used : C/C++, Java, JavaScript, HTML and Python.

Overall the biggest challenge that I think I experienced was navigating through everyone’s code. Everyone has their own style of coding and it was pretty confusing at times trying to understand what they meant. Some of the projects had a lot of files and sub-directories as well, which made navigating even harder. Thankfully the techniques we were taught in class made the navigating process a bit better, though it was still annoying having to tell with numerous opened file tabs and remembering which one associated with which part of the code I was looking at.

Next time I would definitely try to tackle more complex issues. Most the ones I chose this time could be considered as quick fixes. Only once did I ever really have to struggle and take the time to understand what was going on in the project as a whole. I could also try to get more involved with the project members as well. All I ever really posted on GitHub this time was that I was interested in taking on the task and that the pull request was ready. Hacktoberfest is also a great way to network and I definitely should have taken advantage of that opportunity.

It was a great experience as a whole and I am looking forward to see what I can accomplish during next year’s Hacktoberfest! Who knows maybe I might do some open source work on my spare time as well.

Previous blog posts:

  1. Hacktoberfest is here!
  2. Second Bug Fix!
  3. Continuing with Hacktoberfest!
  4. Almost done!
  5. Aaand We’re Done!

Issues that I worked on:

  1. Add an easter egg solved through here
  2. Clean up code solved through here
  3. Updating README solved through here
  4. Add a new rule solved through here
  5. Provide translation solved through here

 

Hacktoberfest2018
Hacktoberfest Stats!
Open Source

Aaand We’re Done!

Hooray! Hacktoberfest has successfully been completed!

For my final issue, I decided to help out with some translating for a mobile app. “Backing Tracks” is an application that provides music accompaniment to allow users to practice playing their instruments or singing. The issue was simple enough: translate the texts that were displayed on the Google PlayStore into any of the listed languages that haven’t been completed yet.

Thankfully, this project was still rather new so a lot of room was available for help. A few quick translations into French and the pull request was made! While this wasn’t the most exciting issue to work on, I did want to try and tackle different types of problems for each of my pull requests during Hacktoberfest. Perhaps in the future I could look into bigger localization or translation projects to work on!

Open Source

Almost done!

For my 4th issue for Hacktoberfest I decided to tackle a programming language that I didn’t know yet: Python. This particular project is meant to serve as a stylistic guide for Python code to make it more consistent, neat and encourage the use of newer Python versions.

The particular issue that I was working on was to add a rule to prohibited the use of variable names that are too long. Implementing the rule took a bit of figuring out since multiple files would need to be changed when implementing and enforcing a new rule. The rule also needed to be configurable, with a standard default size limit. Since there were already other rules in place, I used those as a reference and searched the documents for key words that were related to implementing these rules and that resulted in changes that needed to be made in the config and default files.

After I submitted the pull request, the tests they had were another obstacle that I encountered. I didn’t realize that it checked for a maximum line size and unnecessary white spaces in each line, so I had to go and fix those in my code. However even after that, there was still errors involving nested code. This was odd since I had never implemented such a thing and spent over half an hour trying to figure out why the test failed and where I went wrong. However after reading a few other pull requests (which also failed), I realized that there was problem with the tester itself and it wasn’t directly related to my changes. The author shortly after commented that they were migrating to a new version and that they would check the PR again once that was done and marked the issue as “on hold” for now. So hopefully everything goes smoothly once the new version is released!