DPS909 0.4 Release – Blog 1

Hello there. Long time no see. It feels like a while since I worked on open source. With the end of the semester around the corner, I can start to feel the weight of my other assignments. The past few weeks, my time has been split between Web Services, Mobile Programming on iOS, Human-Computer Interaction, and Open Source. I recently finished my last test which means I can use all of my time to focus on the major assignments that are due soon. That includes figuring out what external project I can work on. Since I completed two pull requests in external projects and one pull request for an internal open source project for the 0.3 Release, this time I will have to do the opposite. That means I have to complete two pull requests for an internal open source project and one in an external open source project.

I already know what I’m working on for the internal open source project. For the 0.3 Release, I was working on the GitHub Dashboard so I’ll be continuing on that for the 0.4 Release. My pull request for that repository was a Javascript program that pulled files from a specific repository, in this case it was the GitHub Dashboard. I was trying to figure out how to use octokit/rest.js to gather simple metrics from a repository. My goal was to gather simple data from a repository and have a json file filled out with the data. I was not able to do that, but by using octokit/rest.js I was able to pull files into my computer. I think that this is a step in some direction but it is obvious that I have to continue using this repository and somehow gather some metrics from a repository which can be used for the dashboard. If its not perfect but I am able to gather some simple data, then I will know that I am going in the right direction.

For the one pull request in an external open source project, I am not exactly sure what I can do. I could look at the Possible Issues to Work On for hacktoberfest to find an issue or bug to work on. I could also look at the Interesting Open Source Projects which deals with larger open source repositories. I am still unsure as to what I’ll be working on for the external pull request so I guess I can leave this one to the end. Since I know what I have to do for the internal open source project, I guess I can move forward with that. I do have a major assignment due this Friday for another course so I’ll have to manage my time wisely.

I’ll check back in a week to update you on my progress.

References

octokit/rest.js

DPS909 0.3 Release – Blog 3

It is the end of the 0.3 Release and I was able to complete the three required pull requests. The task was to either complete two internal pull requests for any of the open source projects and one external pull request, or complete one internal pull request for any of the open source projects and two external pull requests. I decided for this pull request that I would complete two external pull requests first then finish off with the one pull request for the internal open source project. The internal open source project that I decided to work on was the GitHub Dashboard. I was interested in working with this project because personally it seemed like the most interesting project out of all of the other projects. I do not have much experience in open source so I decided that I should work with something that I would feel comfortable in. I made sure to read through the other internal open source projects that were available but they all seemed a bit more complicated. Also, the GitHub Dashboard did seem like a cool idea and it is something that I would be interested in using in the future. But before completing the internal open source project, I had to first find two external open source projects and complete two pull requests for the respective issues.

For my first pull request, I came across a a repository where a website was using React and the issue was to add touch support to a themed login screen which was written on LightDM and the LightDM-webkit-greeter. The following is the issue for the repository that I chose to work on.

Issue 1 (External)

LightDM is a free and open source X display manager that aims to be lightweight, fast, extensible and multi-desktop. It can use various front-ends to draw User Interface, also called Greeters. It is written in C and is available for over fifty languages. I had to do a bit of research before getting started with this pull request because I had never added any kind of touch support to a program. Then after researching how to add touch support, I started to study what was completed already for the Lock Screen page. I had to gain an understanding since I had to make an enhancement to an existing program. I learned that when the user clicks with the mouse drags a page up, a login page is shown. The user has to click and drag the Lock Screen page along the y-axis and once the mouse reaches a certain point, the login screen is shown. So after doing research on adding touch support, I made the additions just like the tutorials showed. By adding touch support from the start of the event and at the end of the event, the Lock Screen can be dragged up and the login page can be shown. The following is the pull request that I made for the repository.

Pull Request 1 (External)

The second pull request was to fix a bug for a Fitbit watchface program which mainly uses Javascript. The issue was that the midnight hour was showing 0 for the 12 hour clock. The following is the issue that I decided to work on from the repository.

Issue 2 (External)

After studying the code, I saw that where the 12 hour clock time was being gathered. There was a check where if the hour was over 12, then a subtraction would be made by taking away 12 from the hour. This is where I assumed the value 0 for the hour was coming from. The program would subtract 12 from 12 resulting in the hour 0. So I inserted a condition before the subtraction condition where if the hour was 12, then it would stay at hour 12. After making my addition to the program I made the pull request and made sure to reference the issue in my pull request. The following is the pull request that I made for the repository.

Pull Request 2 (External)

The final pull request for the 0.3 Release was for the Internal open source project. I chose to work on the Seneca Student Personal GitHub Dashboard. The goal of this internal open source project is to create a web-based GitHub Dashboard suitable for Seneca students doing open source. The following is the issue that I filed for the repository.

Issue 3 (Internal – GitHub Dashboard)

My goal for this pull request was to work with octokit/rest.js to gather some simple data from a GitHub repository. After doing research with octokit, I was not able to gather the data like I wanted to but I was able to download certain contents from a repository to a local folder on my machine.

The following is displayed after compiling the program that I put together.

A3_PR3

 

The following is the pull request that I made for the repository.

Pull Request 3 (Internal – GitHub Dashboard)

For the 0.4 Release I am definitely looking forward to moving on with gathering simple data from a repository for the GitHub Dashboard. Hopefully I can get on top of my other school work so I can finish this aspect of the project within a reasonable time, and if I can get it working the way I want to then I think my contribution would be a success.

References

Touch Support

Javascript

LightDM

octokit/rest.js

DPS909 0.3 Release – Blog 2

The 0.3 Release is already underway and it seems that everyone is currently working on their pull requests for either the external or internal open source projects. It seems that people have already made pull requests for certain projects. Three pull requests must be completed by this Friday and I am still working on my first pull request. My goal is to complete the pull request for the internal open source project. I am currently working on the GitHub Dashboard. The pull request that I’m currently working on is to gather data from a GitHub repository using Octokit/rest.js. I am in the process of gathering some kind of simple data from a GitHub repository just to make sure it works. After I complete that, I can push my contributions to the GitHub Dashboard which can be used in the future to add to this dashboard.

For my external open source project I am still undecided as to what I will be working on. I have been looking at Microsoft/vscode but it seems that it is mostly written in Typescript and I do not have much experience with that. I would honestly like to make a pull request for a repository where a language that I am experienced in is being used. With all of my other course work, I do not think I would have the time to familiarize myself with a different language for a certain project then make a pull request. Going into this course I was open to working in Swift and possibly an iOS project but that would most likely require me to have a MacBook. I’m already taking an iOS course this semester and I have to spend many hours in the library to use a Mac since I do not have one for personal use. So working on an issue from mozilla-mobile/focus-ios is out of the question. But there are many other repositories where I could make a contribution.

Some repositories where I could make a contribution could be filerjs/filer. I have some experience working with this repository from the 0.1 Release. I could possibly find an issue or a bug and make some sort of improvement to the repository. Another repository that has my attention is notepad-plus-plus/notepad-plus-plus. Notepad++ is a text editor which I use regularly so it would be kind of cool to make some sort of improvement to it and the great thing about it is that it is written mostly in C++ which is a language that I have some experience in. Other repositories which I have some interest in are some Android applications such as TeamAmaze/AmazeFileManager and dkim0419/SoundRecorder. Both repositories are written in mostly Java which is another language that I have experience in and I also have experience working with Android applications from a course that I took two years ago which was on Mobile Application Development with Android.

All these choices are a bit overwhelming but I am sure that I can decide by tomorrow what external projects I can work on. But another thing that I would have to decide on is the second internal issue that I would have to work on. I’m going to have to communicate with the other members of the GitHub Dashboard to decide on what else would need to be added for this week and the following weeks before the 0.4 Release due date comes up. But I believe that I can complete all of the assigned tasks before they are all due. With some time management and a bit of research I can complete my tasks in time and possibly learn something new while working.

DPS909 0.3 Release – Blog 1

It is November which means Hacktoberfest has come to an end. I was successful in completing the five pull requests, but I am not entirely sure if I made them in time to earn a free t-shirt. But all is well because I leave Hacktoberfest with gained knowledge on GitHub and the open source community. During Hacktoberfest I mainly stuck with topics that I already had experience in, except for my first pull request which was completed in Ruby. Mainly because of my other course work, so experimenting with new languages had to be put on hold. While continuing with Hacktoberfest after my first pull request, I gained a better understanding of open source in general and how contributions to different projects are made. I always assumed projects for Mozilla or Microsoft or any other large software company completed projects internally. But now I realize that pretty much anyone can contribute to whatever issues are available on a repository.

For the 0.3 Release, we are instructed to complete 3 larger pull requests. I can either complete two larger pull requests in external open source projects with one large pull request in an internal open source project. Or I can complete one large pull request in an external open source project with two large pull requests in an internal open source project.

To start I think I’ll be working on an internal open source project. The following is the link to the project.

GitHub-Dashboard

The goal of this project is to create a web-based GitHub Dashboard suitable for Seneca students doing open source. The Dashboard can include information like repositories that are forked, pull requests that are made, projects that are of interest and even more. I think this is a great idea since GitHub does not exactly provide a dashboard which holds this kind of information. Some information that GitHub does show on a users profile includes repositories made, organizations joined, and an activity chart showing the certain months of activity the user has been active on GitHub.

I have been told of Octokit and how it can be used to gather metrics on GitHub data and possibly added to a json file. The json file might not be perfect at first but as long as some information is being gathered, then I’ll know I’m on the right track. I think that I’ll have to conduct more research into this topic so I can gain a better understanding of the subject since this is the first time I’m working on a project of this scale. The following is a link to the repository.

Octokit

I am not entirely sure of the other internal open source projects so I’ll be looking at possible external open source projects that I could work on. I think after looking into the available projects I can check back and say what I’ll be working on in the future. But for now, I’ll be researching Octokit and possibly making a pull request before I come back with my second blog.

DPS909 0.2 Release – Hacktoberfest Conclusion

For Hacktoberfest, I completed 5 pull requests for 5 different issues in different repositories.

The following is a list of the issues I worked with.

Issues

  1. Fix error character “!” event not found #4
  2. Add a good about page layout #7
  3. Add two matrices #74
  4. Find the height of binary tree – javascript #22
  5. Add program to count dyck paths #6

The following is a list of the pull requests that I made, referencing the respective issues above.

Pull Requests

  1. Fix #4 Use ‘ ‘, Add equal #18
  2. About page #26
  3. Added addTwoMatrices.cpp -74 #82
  4. Fix 22 – Height of binary tree #49
  5. Count dyck paths #138

When I first started Hacktoberfest I was a bit nervous because I was pretty sure at the beginning that I would be working with coding geniuses and now that Hacktoberfest is done, I like to think that I was right. Mainly because of the collection of issues available and the amount of code that has been written.

Issue 1

When deciding what to work on for my first issue, I clicked on the link to Possible Issues to Work On and I was taken to a page with hundreds of issues in different programming languages. I first noticed that the most issues available were in Javascript, so I felt that I should work in Javascript towards the end of Hacktoberfest, because I assumed that those issues might be the most challenging since there were so many issues in Javascript. At the bottom of the list of languages used in the posted issues was Ruby, Typescript, and C#. I have experience in C# so that was a language that I did not to work on because I wanted to experiment with something that I have not done before, which leaves Ruby and Typescript. I had never heard of either languages so I first looked at the issues in Ruby and I found this one project that was sort of interesting. The following is the link to the issue.

Fix error character “!” event not found #4

The issue was that the “!” character was not found. The project was a program where a user would compile the program in Ruby, then enter a string and the string would be displayed in bigger letters. The letters weren’t increased in font size, but the letters were just made up of different characters and displayed in the following lines like the following image.

OpenSource

The problem was the if the user entered the “!” character, then the error, -bash: !": event not found

After some research, it turns out that the user only had to enclose the string in single quotes, ‘ ‘.  After completing the research and adding some code to create a giant equals sign, then making the pull request, I felt like I had gained some basic knowledge of Ruby, and it was something that I could put under my resume under technical skills. What also helped was working with Git Bash to make the pull request. It was my third pull request for the class and the extra practice helped because working with GitHub was always intimidating.

Issue 2

For the second issue, I had to work with HTML and CSS. The following is the issue that I chose to work on.

Add a good about page layout #7

While deciding to chose an issue I had a lot of other course work at the time so I figured it would be better to work with an easy issue so I could complete it quickly and then go back to my other course work. The issue was asking to work on an About page to the already existing website. I made some additions in CSS to make certain sections of the About page standout and after making the additions, I made the pull request. This pull request served as a good review in styling with CSS since I don’t get a lot of work in that subject these days.

Issue 3

The third issue that I decided to work in was in C++. The issue was asking for a program where two 2-dimensional matrices can be added with each other. The following is the issue.

Add two matrices #74

It had been sometime that I had worked with C++ so I felt that working on this issue was a good refresher in the subject. I had to first research if the matrices had to be the same dimension or not in order to be added. After doing the research I made the program and I made sure to have the user input the dimensions of the matrices which is done once. Then the user would enter the values and after, the matrices would be added with the sum displaying at the end. After completing this issue and making the pull request, I felt that working with GitHub and Git Bash was not as intimidating compared to when I first started this course. I felt that I was starting to realize how helpful GitHub was when it came to collaborating in different projects and being able to see the changes that are made in different projects and the issues available to the public.

Issue 4

My fourth issue was an issue using Javascript. At this point in Hacktoberfest, a lot of the issues that are being posted are being taken quickly by others so while working on other course work, I would have the issues page on the side and once in a while I would refresh that page to see what new issues are being posted that I felt that I could work on. At this point, I wanted to work on Javascript because of the number of issues that are posted but many of the issues already there were taken or just very old. Finally I found an issue that I felt I could solve because I had some experience in the subject. The following is the issue.

Find the height of binary tree – javascript #22

The issue was to find the height of a binary tree. I had experience working with data structures which includes binary trees. At first a refresher was needed so I could remember, not how to code a binary tree, but how it is created and how values are inserted. After my refresher, I had an idea as to what needed to be done and how the height is solved so I created my short program to create a binary tree and to find the height of the binary tree. After creating a set of example numbers and running the program, I was able to correctly find the height of the binary tree. I also added two other functions to display the inserted variables in two different traversals which were preoder and inorder.

Issue 5

My fifth and final issue was using C++ again. This is towards the end of Hacktoberfest and at this time I had a lot of work for my other courses so I figured I would figure out an issue quickly just so I could continue with my other course work. I’ve taken two Calculus courses at a University level so I like to think that I have a good background when it comes to math. For this issue, I had to create a program where the number of Dyck paths could be found. A Dyck path is a staircase walk from (0, 0) to (n, n) that lies strictly below (but may touch) the diagonal y = x. The number of Dyck paths of order n is given by the Catalan number. Consider a n x n grid with indexes of top left corner as (0, 0). Dyck path is a staircase walk from bottom left, i.e., (n-1, 0) to top right, i.e., (0, n-1) that lies above the diagonal cells (or cells on line from bottom left to top right). The following is the equation that had to be used in order to find the number of Dyck paths.

PR5.2

Creating a program for this equation seemed straightforward, but by increasing the value n, the value of C goes a lot higher too. So I had to research data types with the highest range in order to get the exact value of the number of Dyck paths. At the end, I finished the program, made my pull request, and I was officially done with Hacktoberfest.

Looking back, Hacktoberfest was been a great learning opportunity when it comes to working in open source, and I am glad I participated in it because I have definitely improved my knowledge in GitHub and Git Bash. By continuously working on different issues and contributing code to different projects, I am able to say that I have a decent background in open source. At first, working with GitHub and Git Bash did not go so well, especially when I was not able to commit for some reason and having to do research, but eventually I was able to complete the pull requests with no problems. I think in the future I would like to work in larger open source projects, and work with programs with many lines of code, instead of just creating my own programs from scratch. That would be a good opportunity and learning experience when going into the professional  field because I will have to work with existing programs and somehow improve or enhance what has been done already. At the beginning, I was very hesitant of taking the Open Source class because I knew I would have to work with existing projects that have been create by people around the world, but now I’m very pleased that I took this course because I feel I have expanded my knowledge and experience in different areas of the IT field.

References

C++

Dyck Path

HTML/CSS

Javascript

Ruby

DPS909 0.2 Release – Pull Request 5

My fifth and final pull request for the 0.2 Release was on C++. This my second time in this release working with C++. C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation. When trying to figure out what I should work on for my final pull request, I was not able to be picky about it. A lot of the issues that would go up would get taken minutes after. Some people might not leave comments under issues. Instead they would just reference the issue in their pull request. So if I’m scrolling through the issues and see an issue with no comments I would get excited thinking I could work on it, but most of the time, the issue would be completed with some one else leaving a link to their pull request on the issue page. At first I sorted the issues by Least Commented but that would mostly show issues from a year ago. So I went back to sorting the issues by Newest. I had to go back a couple of pages and finally I found an issue that was posted four days ago which I felt I was confident in completing. The following is the link to the issue.

Add program to count dyck paths #6

What was being asked from the issue was to create a new file, where the number of Dyck Paths could be solved. A Dyck path is a staircase walk from (0, 0) to (n, n) that lies strictly below (but may touch) the diagonal y = x. The number of Dyck paths of order n is given by the Catalan number.

Consider a n x n grid with indexes of top left corner as (0, 0). Dyck path is a staircase walk from bottom left, i.e., (n-1, 0) to top right, i.e., (0, n-1) that lies above the diagonal cells (or cells on line from bottom left to top right).

PR5

The following are example inputs:

  • Input: n = 1 – Output: 1
  • Input: n = 2 – Output: 2
  • Input: n = 3 – Output: 5
  • Input: n = 4 – Output: 14

The following is the mathematical equation to calculate the Dyck  Path which is given by the Catalan Number C(n).

PR5.1

In terms of what I had in my code was the following equation. It seemed simple enough, but when it came to calculating the factorial, I had to take some time to figure that out.

PR5.2

Since there are three instances of using the factorial in the equation, it made sense to make a factorial function. I created two more variables to hold the values after the value entered is multiplied by 2 and added with 1. I coded everything but at first something did not seem right. When I entered the value 7 to calculate the number of Dyck paths, I was getting a different value compared to what was calculated on my sheet of paper because I was testing to see if my program was working properly. It turns out that because I was using an int data type, the number of Dyck paths would be beyond the range of an int data type. I looked up different data types and used the data type with the highest range which was a long long. Since we’re only working with positive values, I made the variables of type unsigned long long int. After changing the data types, and after entering 7 to calculate the number of Dyck paths, I got the same value as what I had calculated manually. The following image is an example of different inputs with the number of Dyck paths calculated.

PR5.3

After completing my program, I made the pull request and made sure to reference the issue in my pull request.

Count dyck paths #138

After completing this second release, I feel more confident working with GitHub and Git Bash. For the third and fourth release, I look forward to working with larger projects and collaborating with more people and starting on new projects with people from our class.

References

Dyck Path

C++

Tutorial

DPS909 0.2 Release – Pull Request 4

My fourth pull request was on another topic that I have not worked for some time. This time I was working with Javascript. Javascript is a high-level, interpreted programming language. It is a language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm. I chose to work with Javascript because I had not made a pull request in Javascript for this assignment and Javascript is the language that has the most issues in the list for possible issues to work on. When I first started in my program I did a lot of work in Javascript in my earlier semesters but as the semesters went on, I was working with Javascript less compared to the earlier semesters.

But over the winter and summer semester, I did a lot of work in Visual Basic during my work term working at Environment and Climate Change Canada. At the government, a lot of old programming langauges are still being used like Visual Basic and PHP, which I worked with. While learning Visual Basic and before starting on the assigned work, I was able to quickly grasp the content because Visual Basic was similar to Javascript, so remembering the content for this issue was a bit easier for me.

The following is the issue that was posted that I decided to work on and hopefully make a pull request.

Find the height of binary tree – javascript #22

What was being asked from the issue was to add a new file where the user would be able to find the height of a binary tree. First I had to review binary trees and how they were programmed. I took a course during the Fall 2016 semester that was about Data Structures but in that course the language that we used was C++. For this issue, we are asked to program in Javascript. In my opinion, coding in Javascript is a lot simpler than coding in C++ but coding the binary tree would be different because I was used to doing it in C++.

After some research and refreshing my mind in the subject, the first step was to create a binary tree. I had to create functions to create the root of the tree, and functions to set the left and right nodes of the created root. Each function would be used every time a new node was inserted. In order to insert a new node I created a function called insertNode() which takes the root and the new node. Then to test if the tree was created properly I had to insert values into the tree. I created a function called insertValue() which inserts five values into the binary tree and then three function calls are made within the insertValue() function. The first two function calls are to display the values of the binary tree. The first function call displays the values in a preoder traversal. A preorder traversal displays the node values starting with the root. Then it works its way to the left-most node displaying the values on its way. Then it goes back to the root and goes to the right-most node displaying the values on its way. The second function call displays the values in an inorder traversal. A inorder traversal displays the node values starting with the left-most node. Then it works its way to the root displaying all the other nodes, then displays the nodes going to the right of the tree.

The last function call, height(), gets the height of the binary tree after the values have been inserted into the tree. The height of a binary tree would be the largest number of edges in a path from the root node to the leaf node. So after creating the binary tree and populating the tree with values, the height function is called which would add one every time a node was there and it would go through the function recursively.

The following image shows exactly the two traversals and the height of the binary tree.

PR4

After completing the code and testing it multiple times with different values, I made sure to make a pull request and reference the issue. The following is the link to the pull request that I made.

Fix 22 – Height of binary tree #49

References

Javascript

Code Academy

Binary Tree