Planet CDOT

October 18, 2018


Allan Zou

Release 0.2 part 5 (Active Forks)

For my fifth issue/PR for Hacktoberfest, I worked on Active Forks by Techagun, which I talked about in earlier blog posts about how I was planning to work on it, then abandoned because I couldn’t get it to work, but now it’s working for some reason so I decided to work on it.

This project lets the user input a GitHub repository and it shows them the active forks of that repository.

Screenshot

Capture

It uses GitHub API which I have no understanding of, but fortunately for me my contributions didn’t have to deal with that. My contribution was to make the program accept direct HTTPS and HTTP links such as https://github.com/techgaun/active-forks, instead of only accepting the username/reponame format. I added 3 lines of code which would search the string which the user inputted and remove the https://github.com/ part of the string, as well as one for http, and one for .git at the end. Now, the user can use direct links, .git links and username/reponame just like they did before.

repo = repo.replace('https://github.com/', '');
repo = repo.replace('http://github.com/', '');
repo = repo.replace('.git', '');

Issue: https://github.com/techgaun/active-forks/issues/15
Pull request: https://github.com/techgaun/active-forks/pull/16

WIP

by azou1 at October 18, 2018 05:01 PM

October 16, 2018


Ryan Vu

Hacktoberfest - first 5 PR - part 2

2nd PR -  oddOccurrencesInArray 

The second issue is a puzzle containing pairs of characters. The task is to find one character that does not pair to any others. Quote from the author of the issue:
A non-empty array A consisting of integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired. Write a function that, returns the value of the unpaired element.

The Solution 

For this kind of puzzle, using a collection to store unique numbers is the easiest way to achieve. The basic idea is, we take a number, check if it exists in the collection; if it does not, we put it into the collection; if it does, which means there is a pair, so we remove it from the collection. We will process all the numbers, then at the end the final number left in the collection is the one we need to find.

The Options

The problem is which type of collection we should take for this task. There are three options I thought about: plain object, array and map. Looking back at what we need, there are only two things, to check existing and to delete.
  • Array: for checking existence we can use findIndex(number), then we take the index into splice(index) to remove paired numbers.
  • Map: is pretty much the same as array, with has(number) and delete(number). Map is more than enough for what we need, since we only need to store values, we do not care about keys. However, one pro of map in this case is that we don't have to loop all the numbers just to find the existence of a number, so let's say a little bit more efficient.
  • Plain Object: now this turns to be the best choice because just like map, it doesn't require looping all items, and it is simple.

The Choice

Considering map and plain object are sort of similar, however map is more likely supposed to act as a collection, so my final decision was using map in the PR.

Link:

by pyn nl (noreply@blogger.com) at October 16, 2018 09:58 PM

Hacktoberfest - first 5 PR - part 1


  • Hacktoberfest - first 5 PR - part 2
  • Hacktoberfest - first 5 PR - part 3 (incoming)
  • Hacktoberfest - first 5 PR - part 4 (incoming)
  • Hacktoberfest - first 5 PR - part 5 (incoming)

The Repo

As the Release 0.2 of DPS909, I have to take part in the event Hacktoberfest and create 5 PR. All my works will be on the repository hackoberfest-2k18-katas, which is a collection of programming problems, puzzles from beginner to advanced levels. This blog series having 5 parts, will cover all 5 PR.

1st PR - wordSpiral

The first issue is an interesting puzzle, where only inputs and outputs are given. The challenge is that we have to figure out ourselves how the logic works without any descriptions.

  
There are 3 examples as the hints. Lets take a look to the similarities of the three:
  • Inputs are strings, and outs are word spirals (2d character images)
  • The word spirals start from the last characters of the strings
  • The word spirals start at bottom right corner, first directions are always to the right
  • When changing characters, they turn right
  • The numbers of repeated characters before changing are fixed, and map to the pattern - a:1, b:2, ..., z:26

Links

by pyn nl (noreply@blogger.com) at October 16, 2018 01:44 PM


Jagmeet Bhamber

Hacktoberfest: Week 2

OpenDota homepage

Introduction

This week I worked on my second issue for Hacktoberfest! Last week I worked on redditdota/subredditcss (and was a bit late with posting my blog for it..), and this week I was ready to keep moving forward with contributing and learning.

As I continued on my journey to earn a free t-shirt, I ended up once again on working with something related to my favourite game: Dota. This week I worked on OpenDota, an open-source, React-based web app providing detailed profile and match stats for players. For example, here is my profile. This project takes a huge amount of pride in being a open source, evidenced by the “Open” in the name. On their homepage the user is also greeted with the text “ Open source Dota 2 data platform,” and their GitHub link is displayed in their footer on every page within the site. They also promoted Hacktoberfest in their release notes.

Release Notes shown at the top of the page every time they update production. You can see that they are promoting Hacktoberfest to all their users!

Their homepage also lists all of their sponsors, one of which includes OpenAI, founded by Elon Musk. OpenAI has also created an AI bot to play the game, which they hope can stand against and defeat professional teams (not yet however).

OpenDota

OpenDota operates under odota on Github, and have 2 big projects they offer:
1. core: an API that other developers can use to make their own tools.
2. web: a React web app that uses their API to offer profile and match statistics for players.

Their core API also uses a replay parser, that downloads and parses replay files of games. It then presents that parsed info in the API. This offers much more detailed information than what is provided by Valve’s API.

The Issue

The issue I ended up working on was one that I actually encountered myself during my normal usage of this site. So when it came time to find my second issue to work on, I decided to report this issue and ask to work on it.

One of the many features that this site provides is graphs that show data throughout the match (example). They plot out values for each player such as gold and XP. Mousing over the graphs provides a tooltip showing the exact value.

The issue itself: the tooltips should be sorted by value, but were not being sorted at all.

The bug in action: the popup values should sort dynamically at each point in the graph

As seen above, the ordering of elements in the tooltip stayed the same for the entire graph. They were shown in the default order (blue = player 1, teal = player 2, etc) for the entire game.

Initially I reported the issue in core, which I later realized was wrong, and realized it should be filed under web. I joined their Discord and told them it should be closed. I then filed my issue correctly under web, and asked to have it assigned to me.

Getting Started

As I began to get ready, I realized that even building the project was going to be an issue. I was getting an install error in npm, and had to do some searching on Google. I found the solution, and after clearing npm cache I was able to build the project successfully!

Next: I had to find out where in the code the issue was located. This ended up being easier than I expected. I used GitHub’s file finder and searched for graph and it was narrowed down to about 15 files. A few were image assets and I was able to ignore those. There were also some files with names like StackedBarGraph.jsx and HistogramGraph.jsx which were obviously not what I needed. After looking through the remaining few files I was able to narrow it down to MatchGraph.jsx and Styled.jsx.

Opening these files up in my editor, I skimmed through them both. I was able to figure out some important things:
1. MatchGraph.jsx: contained code for the entire Graphs page of a match (a Controller).
2. Styled.jsx: described visual components, including tooltip popups, used in graphs (a View).

I began playing around with the code by changing values and refreshing the webpage. Stuff like increasing px count for borders and other things in the View. As I did this I noticed stuff changing on the webpage, so I knew I was on the right track. I then started changing values in the Controller, such as where to draw colour values from — colours are not bound to the View because colours are tied to players, so the Controller calls them so it is able to bind them to the correct player. This also affected the part of the page my bug was on: the tooltip values. At this point I knew my bug was in this area of the code.

Line 43: sort method. This is where my issue was located

In this block that I had been tinkering with, I saw a sort(...) method on line 43. It read
.sort((a, b) => a.props.value < b.props.value)
I looked through older commits in this file and found that the props was only recently added. I decided to undo that, but it didn’t affect anything.

Now I was feeling a bit lost. I didn’t know what else the issue could be caused by if changing the sort method’s parameters did nothing.

I decided to search up react sort props on Google in hopes of finding an answer. Most of the solutions offered had very different syntax. Since I knew React was a JavaScript library, and that I was working with JavaScript here, I decided to search javascript sort instead. I found the w3schools page for JavaScript’s sort method, which also offered a way to sort in a descending order: points.sort(function(a, b){return b-a});
I decided to use this logic in my code. It ended up working! It was a strange feeling to know that I had spent all this time researching a solution to find out it was only 1 line of code that needed to be changed, and I wasn’t sure how to feel.

The issue is fixed! The values are now being sorted correctly.

I ran tests and they all passed, so I submitted my pull request. I received a comment from the project’s co-founder saying he couldn’t recreate the issue. My experience from working as QA during my summer co-op kicked in, and my first thought was “is it because of the browser?” I had been running exclusively Chrome up to this point. I opened the site on Firefox and tried hovering over graphs, and the issue was not occurring. I then replied to his comment saying I can only recreate the issue on Chrome, and that Firefox seems fine, and a few minutes later my pull request was approved and merged! I found this a bit funny that the project maintainers had perhaps forgot to test across different browsers, and might not have even noticed it until this point.

Conclusion

After solving this issue I felt very proud. Not only did I contribute to a project I cared about, I was able to tackle an issue that I had almost no knowledge of going in, and was able to solve it without giving up. I had never worked with React before, and was scared that I would not be able to understand anything. In actuality it was mostly similar to JavaScript and I could follow along pretty well. I also think I did a good job of quickly finding the issue in the codebase and isolating the part of code where the issue was located.

Also, as a nice bonus, the developers recently added a feature where any contributor can add their user ID to a json file in the project, which will give them a special contributor badge on the OpenDota site, so that’s nice.

Next week I will continue on my Hacktoberfest journey as I have 3 more pull requests to make this month. Until next time.

by Jagmeet Bhamber at October 16, 2018 07:37 AM


Alex Kong

Hacktoberfest PR 2: Updating Travis CI’s GitHub Check Report

Travis CI is a continuous integration tool which builds and tests software on GitHub. The issue I’ll be tackling today is issue 10028 which involves displaying the name of the jobs executed by Travis in the GitHub Check Report. At the moment, the check report displays the job ID which is relatively undescriptive and doesn’t help readers identify what’s going on.

So my goal is to change the job ID to the job name identified in the travis.yml to provide a more informative table in the GitHub Check Report. Thanks to some help from one of the maintainers I knew that the table logic is located in travis-tasks/lib/travis/addons/github_check_status/output/. After digging around some of the code I found the code I was looking for in travis-tasks/lib/travis/addons/github_check_status/output/stage.rb.

So looking at the code, the issue occurs because the code defaults to the job number. This makes sense as the name is an optional argument so it may or may not be in the travis.yml.

Let’s give a quick logic fix a try:

Then run the tests to verify that we haven’t broken anything.

Now that our rough code works let’s abstract a bit of the code to make future changes easier if definitions ever change.

After one last check with the tests we are ready to create a pull request.

I was unable to update any of the tests as they appear to test against a real repository which I do not have access to and I would like to know how the Travis maintainers want to handle this situation before proceeding.

by Alex Kong at October 16, 2018 07:19 AM


Ruihui Yan

Pull Request 2

For this second pull request, I wanted to move away from localizations and work on developing new features or solutions for bugs.

Since the beginning of this month, I have been watching a few projects on Github with the Hacktoberfest tag. It was really hard to find a legit project amount all those created with the sole purpose of generating pull requests for the Hacktoberfest. I have been looking into a few big projects on Github (HandbrakeAtom, WordPress iOS, video.js, and Electron) and I find them a bit intimidating because of the size of the project and it is kind of overwhelming to get started. Because of that, I wanted to work on a simpler and smaller project that is interesting enough for me to invest my effort on, where I can feel comfortable and get confidence for future pulls.

I ended up working on H2, a minimal browser for Youtube videos and other types of media in PiP mode. Another reason why I chose this project is the fact that it is written in JavaScript and that is one of the languages I like the most and one that I think I have room for improvement.

 

The creator of the project proposed a new feature for the application that would make the window translucent and I volunteered to work on it.

At first, it was a bit hard to figure it out how to implement it so it took me a while and lots of tries a first.

After reading through Electron’s documentation (framework on which H2 is based), I learned how easy it actually was. I went from more than 20 lines of code in 3 different files to simply 5 lines of code in one file:

Here is my implementation:

  globalShortcut.register('CommandOrControl+Shift+T', () => {
    // toggles translucent mode
    var translucency = 0;
    mainWindow.getOpacity() == 1 ? translucency = 0.7 : translucency = 1;
    mainWindow.setOpacity(translucency);
  })

And here is a Youtube video running in translucent mode:

I have submitted the pull request and hopefully it gets merged into the project.

With this second pull request, I have learnt that sometimes although a project might look scary and overwhelming at first, it can be quite simple to work on. Taking that time to try the project, read the documentation of frameworks or dependencies your project make use of can be very helpful. I really had fun working on this project and I find it very interesting, maybe I return to it in the future.

With my first pull request being localization and this one being a simple new feature, I believe for the third one I am ready to tackle on sometime bigger.

by blacker at October 16, 2018 05:25 AM


Jagmeet Bhamber

Hacktoberfest: Week 1

This October marks the start of the 5th annual Hacktoberfest!

Introduction

October has arrived, and with it, another Hacktoberfest. Hacktoberfest is an annual event presented by DigitalOcean, Github, and Twilio that acts as a celebration of open-source software, and helps encourage newcomers to join the open-source community by beginning to contribute to projects.

To participate, anyone with a Github account must make 5 pull requests in the month of October to complete the challenge. The first 50,000 people to complete the challenge will also receive a free t-shirt!

In my open-source development at Seneca, our professor made it our 2nd assignment (aka “Release 0.2”) to take part in Hacktoberfest, and make 5 pull requests this month. Over the next few weeks, I’ll be sharing my progress on this blog as I make PR’s, and talk about what I learned and enjoyed with each project.

First Steps

When I was assigned this project, I was as excited as I was nervous 😬. I was looking forward to contributing to projects that I was interested in as well as learning a lot and gaining experience. But I was also worried that I may struggle to find something that I was able to contribute to; did I really have the skills to work on real-world projects?

I decided to start slow and work with something I knew was within my scope; I was still getting started with this, and I was also busy this week with interviews for winter co-op. With this busy schedule I tried to find something easy to get my feet wet, and hopefully work on something larger as the month progresses.

The most popular repos for Hacktoberfest. I wanna contribute to something else…

The Hacktoberfest site has a section that aims to help participants find projects to contribute to. But after looking through them, they seemed very spammy/cheesy. They weren’t really real projects, just repos that would encourage users to submit a pull request with some meaningless data to earn some easy points. It almost seemed like cheating to me, and I decided I would stay away from these and find something where I could make a real contribution as well as challenge myself and learn something.

First Issue

The project I ended up contributing to was redditdota/subredditcss. This repository hosts the css for the /r/dota2 subreddit, a community for the online multiplayer game Dota 2. I am part of this community, and I found an opportunity to contribute to it, so I decided to use that for my first contribution.

Context

Dota 2 is an competitive online real-time strategy game. 2 teams of 5 players work together to destroy the opposing team’s base. Players take turns picking playable characters (called heroes) from a roster of 100+ heroes before the start of the game, each with their own strengths/weaknesses, and niche to fill. Throughout the game players earn XP to improve skills and gold to buy items, to become stronger and take down the enemy and destroy their base.

It’s become a very popular game; last month it had 10M+ unique players! In addition to being very popular to play, its high skillcap has led to players dedicating a lot of time to being competitive at the game and trying to be the very best. This has led to the game becoming a very popular esport, a competitive game played professionally for money.

Ok, but what was the issue you worked on?

Being part of this community, I help the moderators of this subreddit run an account that posts tournament discussion threads (Some. Example. Posts). Dota fans love to watch tournaments just as much as they play, and esports-related posts make up a bulk of the discussions on /r/dota2.

In these posts we use CSS to add images within the posts for team logos, to make them look pretty (think of it like emotes… kinda). Every year in August, Valve hosts The International, the biggest tournament of the season with the biggest prize pool. Afterwards, teams shuffle a lot and new organizations begin to sponsor teams, or orgs that have teams in other games see this as an opportunity to join the Dota scene. Because of this, there are a lot of new names popping up in terms of teams and organizations at this time of year.

As the new season began and many new teams were formed, I decided to update the subreddit stylesheet to include logos for new teams that would be used for tournament posts.

Getting to Work

When I set out to solve this issue, I knew the tasks ahead of me:
1. Update the logos.png image that contained sprites for all the logos
2. Update the stylesheet.css file to include the corresponding names of the teams.

I posted an issue myself, and asked one of the moderators to assign it to me. Since this wasn’t a very popular repo, I didn’t have to worry about someone stealing my issue. Most of the communication took place on Discord where I asked questions about what the best way to edit the image was, what the dimensions were for each sprite, etc.

As I edited the image, I was also updating the stylesheet.css to include the teams I was adding. After an hour or so, I was done (or so I thought). I created my pull request. The image which had the sprites was not hosted in the repo, so I just uploaded it as an image in my PR. It was merged the next day.

Setbacks

However, I noticed after it was merged that I had made a couple mistakes:
- I overestimated the size each sprite had, which caused some of my logos to be cut off around the edges
- I didn’t use the correct methods to downscale my logos, making their edges really jagged and ugly.

Realizing my mistake

For the first problem, I had noticed in the css file that each logo was 64px and 29px apart, vertically and horizontally respectively. However, the size each logo had was 60px by 25px. This led to some some confusion and me making them bigger than they should be, leading to cutoff.

The second problem was caused by me dragging images to make them smaller instead of using my image editor’s resize function.

The next day I fixed the issues, and posted the updated image in my pull request as a comment, which was uploaded onto reddit shortly. The issue had been completed!

Conclusion

I had completed my first issue+pull request, and it was (mostly) successful. I had some hurdles along the way, but was able to deal with them, and was ultimately able to solve the issue.

I had a lot of fun with this issue. I was able to contribute to a community I was part of and enjoyed working with already, as well as gain experience with open-source.

Bonus

Difference between old and new logos, and wiki list of logos (that has to be updated; blank ones are the ones that were replaced)

by Jagmeet Bhamber at October 16, 2018 05:11 AM


Shawn Mathew

DPS909 0.2 Release – Pull Request 2

My second pull request was on a topic that I have not done in a long time. This time, I was working with HTML and CSS. Hypertext Markup Language (HTML) is the standard markup language for creating web pages and web applications. Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language like HTML. I chose to work with HTML and CSS because I have a good background in the topics and because I was working on other assignments at the time so I did not have the time to experiment with a new programming language. Hopefully for my next pull request I can try something new depending on what my schedule looks like. The following is the issue that was posted that I decided to work on.

Add a good about page layout #7

What was being asked from the issue was to add a page for about.html. What I was updating was someones website which included a home, contact, and about page. The about page already had some work done to it, so I added whatever I could think of to improve the overall look of the website.

The first change that I made was to add a new CSS for the about page. I also made sure to link the about.html page to the about.css sheet. Then for the about.css page, I tried different colors and patterns to improve the overall look. The website already had an image taking the top half of the page so it was difficult to add colors that would go with the placed image. So I made some minor improvements like making changes to the font and the font style. I changed the font to Lucida Console, made it bold, and added a shadow to the header at the beginning of the about section. After my changes were completed, I made the pull request but I happened to run into some problems. The following is the link to my pull request.

About page #26

The repository that I was working with had a specific branch that had all of the necessary files including the about.html page that I needed to work with. So initially I was pushing to the master branch but in order for my pull request to be merged, I had to push into the hacktoberfest branch that was already created. After I realized this mistake, I made sure to complete my pull request to the hacktoberfest branch.

After completing this pull request, I am feeling more confident when it comes to GitHub and Open Source. But now that many people are participating in hacktoberfest, it is a bit difficult to find a recent issue that no one has taken yet because it seems that an issue could be posted for five minutes and then it gets taken. So I will make sure I have sufficient time before the next due date to get an issue so I won’t run into any problems in the future.

References

HTML

CSS

by Shawn at October 16, 2018 02:42 AM


Minying Chen

Release 0.2: Hacktoberfest

Sorry professor, I have interview in these two days, i will finish it tomorrow!

The Second Pull Request

This is my second pull request for Hacktoberfest. This is an interesting project that i did fork to my GitHub.

by minyingchen at October 16, 2018 01:52 AM


Huda Al Dallal

Hacktoberfest – So Many Struggles!

Hello!

I am back with my second blog for Hacktoberfest. As I am trying to get used to using GitHub, Git, and the idea of open-source in general, I found a few projects that I think would be interesting to work on.

I found one project that dealt with front-end (something I enjoy!) and the issue has already been created so I have commented asking if it was okay for me to work on it (since it did not have any labels related to hacktoberfest) I got a “yes” so I went ahead and worked on it. Unfortunately, it didn’t go as well as I wished. I woke up the next day only to see that someone else created a pull request for this issue before I did 😦

This is probably one of the worst things that could happen when working on an open-source project! Luckily, I had another project in mind (that was supposed to be my third issue) so I shifted to my now “second” project.

The second project I have decided to work on is: GitPoint

It is an application that is available on iOS and Android. The application allows users to view repository, user information, control notifications and even manage issues and pull requests.

My main task was to add another language so that users from around the world can use the application with the language of their choice! Since I know a language that many of my peers do not know, I had the opportunity to add Thai language to the list.

This is a process that is also known as localization. It is the process of adapting an application or a product into a specific language, country or region.

The steps?

As usual, I had to fork, clone, and add the upstream of the repository and created a new branch. Something new is that I did not create a new issue but rather commented on an existing issue that I will be adding Thai to the list. I did all of the usuals and started translating! You can find this issue right here

This might sound nice and easy, however, it took a lot longer and required more work than I though! I had to run a bunch of installs since GitPoint is a pretty big program with many features in it. Also, trying to translate a programming-related words into a different language took me so much time! I had to make sure that whatever words I chose would make sense in Thai… Even though I have been speaking this language for my entire life, but I never had to use programming language in a different language other then English!

Screen Shot 2018-10-15 at 9.02.27 PM

The trick for translation that worked for me was to say them out loud! Say them multiple times to see if I would understand it. Also, I tried googling some of the sentences I have translated to see if I get any suggestions the changes! These seemed to have helped a bit but the most important part is to make sure that you are a native speaker when you are trying to translate something!

Now, I have done all of my translations but… one of the requirements for the translation is to test it on the application on either iOS or Android devices. This was one of the most difficult part for me! As it is not a program I am familiar with.. I had to run multiple tests and got so many errors, even though all I did was a bunch of translations.

Unfortunately, this issue has not been solved and I am still working on it. I am working hard to fix any of the issues unrelated to the translations I have done and create a pull request for it.

This is not the end to this blog as I am hoping to update this with a pull request soon. Stay tuned to this blog and hopefully the fix to the problems I am currently facing!

 

by Huda A at October 16, 2018 01:40 AM


Jeffrey Espiritu

Dates, Times, and Parsers

I chose SchedulerBot as my first project to contribute to for Hacktoberfest. You can find more details about my contribution in my previous post.

One of the features that really piqued my interest was the ability to express the date and time in human natural language. So you can write the following and SchedulerBot would be able to recognize the date and time of the event that someone wanted to schedule.

+event Upload progress report next Monday at 1pm
+event Special Halloween giveaway from 8pm to 9 next Tuesday

That’s where Microsoft’s Recognizers.Text.DateTime package comes in. It does the heavy lifting and is able to produce an object that can be used in an application.

For instance, so if the current date is Monday, Oct 15, 2018, then the following event Upload progress report next Monday at 1pm would produce the following JSON output:

          1         2         3         4
01234567890123456789012345678901234567890
Upload progress report next Monday at 1pm
[
  {
    "Text": "next monday at 1pm",
    "Start": 23,
    "End": 40,
    "TypeName": "datetimeV2.datetime",
    "Resolution": {
      "values": [
        {
          "timex": "2018-10-22T13",
          "type": "datetime",
          "value": "2018-10-22 13:00:00"
        }
      ]
    }
  }
]

Ambiguous Dates and Times

When parsing dates and times, there can be missing information leading to ambiguous dates, meaning that the the year and time of day can be either/or. To simplify the processing, there will be a maximum of 4 results in the case of ambiguous dates and times.

To demonstrate, the user can input an ambiguous date like this: May 2nd at 5.

Year and time is ambiguous. The year will be set one year in the past and one year in the future depending upon the current date while the time can be either AM or PM.

If the current date was Oct 15, 2018 then May 2nd at 5 would resolve to the following dates and times:

1. May 2nd 2018 at 5AM
2. May 2nd 2019 at 5AM
3. May 2nd 2018 at 5PM
4. May 2nd 2019 at 5PM

Output Results:

          1         2         3
0123456789012345678901234567890
May 2nd at 5
[
  {
    "Text": "may 2nd at 5",
    "Start": 0,
    "End": 11,
    "TypeName": "datetimeV2.datetime",
    "Resolution": {
      "values": [
        {
          "timex": "XXXX-05-02T05",
          "type": "datetime",
          "value": "2018-05-02 05:00:00"
        },
        {
          "timex": "XXXX-05-02T05",
          "type": "datetime",
          "value": "2019-05-02 05:00:00"
        },
        {
          "timex": "XXXX-05-02T17",
          "type": "datetime",
          "value": "2018-05-02 17:00:00"
        },
        {
          "timex": "XXXX-05-02T17",
          "type": "datetime",
          "value": "2019-05-02 17:00:00"
        }
      ]
    }
  }
]

As you can see, the XXXX value is used to indicate that the year was ambiguous.

Parsing Text Beyond Dates and Times

There are several text recognizers to choose from that are available on several platforms and languages including C#, Node.js, Python, and Java. These text recognizers can parse different forms of written text expressed in human natural language, which can be a mix of numbers, words, letters, and symbols to extract information such as dates, dimensions, temperatures, numbers, currencies, phone numbers, and more.

For example, I can use the text recognizers to parse the following strings, extract relevant information in a form that is useable by an application.

I'd like to order 10 boxes of pepperoni pizza.
I want the pizza to be delivered to my house this Saturday at 1pm.

Output Results

          1         2         3         4
0123456789012345678901234567890123456789012345
I'd like to order 10 boxes of pepperoni pizza.

          1         2         3         4         5         6
0123456789012345678901234567890123456789012345678901234567890123456789
I want the pizza to be delivered to my house this Saturday at 1pm.
[
  {
    "Text": "10",
    "Start": 18,
    "End": 19,
    "TypeName": "number",
    "Resolution": {
      "subtype": "integer",
      "value": "10"
    }
  }
]

[
  {
    "Text": "this saturday at 1pm",
    "Start": 45,
    "End": 64,
    "TypeName": "datetimeV2.datetime",
    "Resolution": {
      "values": [
        {
          "timex": "2018-10-20T13",
          "type": "datetime",
          "value": "2018-10-20 13:00:00"
        }
      ]
    }
  }
]

SchedulerBot Issue#14

What first began as curiosity, my research on the natural language text parsing feature in SchedulerBot, provided by Microsoft’s text recognizers, led me to actually finding a bug in the program. I won’t bore you with the details in this blog post, but given the information you’ve read (if you got this far), the bug that I found would make more sense. You can find more details about it here. There are several ways to fix the bug so I’m waiting on the author’s response to figure out how he (or she) wants to handle it.

by Jeffrey Espiritu at October 16, 2018 01:34 AM


Julia McGeoghan

Determining Priorities

As I participated more in Hacktoberfest, one of the questions I often asked myself was; What will I get out of contributing to this project?

Most would have their own mix of merits, but as I browsed repositories I was beginning to categorize a lot of them into three specific types I’d want to work on:

Research

  • Small projects maintained by one person or a small team of people
  • Their issues tend to be easy but still have a learning curve and purpose
  • They can be a good way to learn simple but important concepts, since the bulk of time spent on them might be on researching a new concept vs. working on a particular bug or enhancement

Real World

  • Large projects with a big list of contributors and/or are used by a lot of people, popular
  • Issues and enhancements seem to be more in-depth/difficult since the project is more complicated and no longer in its early stages of development
  • There are undeniably still things to be learned, but more time might be spent working on the actual problem or enhancement vs honing in on a particular concept. More like getting experience with a real-world development project vs. an exercise to learn something in particular

Personal

  • I just want to work x or y because it seems really cool
  • The main benefit is personal enjoyment or utility, the pride of having contributed to something I personally use or love

Keep in mind that these will probably change as I gain experience, it’s just a snapshot of how I currently see things.

I knew that I wanted to work on a simple issue this time around, so my priority was to find a one that could fit the first category; something easy that would help me learn a very specific set of concepts.

Pull Request #2

For my next pull request I picked a mock Vue application. While it wasn’t providing a service for millions, its issues often touched on things I really wanted to learn more about.

Above is the first issue I chose, with the solution itself being fairly simple.

I didn’t solve this one immediately; I first needed to understand what they were asking for.

I read the MDN pages linked in the issue (focusing mostly on this one) and learned the difference between default and named exports. How you can combine both in a file and reference them. And how you would access each type when imported in another module, how to properly test for this in the application.

There were a lot available issues for this particular project, and having had a good experience with it so far, I decided to attempt a more difficult one they listed.

The one I found looked great; it was a nice way to practice TDD and learn about async/await calls. The inspiration for the issue was put forth my this post, which helped me learn the difference between Promises and async/await from that perspective.

Since I was attempting to do TDD, I needed to write the test first. I got to work learning about jest mocks, and writing a test for an application that uses Vue in particular (this was my first time working with Vue). It was late at night so I went to bed, and woke up the next morning…

…to realize that somebody made a pull request for my issue.

I decided to wait. I felt they’d probably have the pull request accepted soon and that there was no point going further. But it turns out they needed to make a lot of changes after a certain review, and after those changes were made there was silence…despite the maintainer still being active.

The issue remained open.

I was conflicted; should I forge ahead to completion? Since working on this would be a great way to learn more about TDD, and because I still had a chance to make a relevant pull request? Or do I risk doing all that work without being able to incorporate it?

To see what I decided to do, check out the third part of this Hacktoberfest installment here.

by Julia McGeoghan at October 16, 2018 12:53 AM


Shawn Pang

Hacktober Second Pull Request

For my next pull request, I will be attempting to replace string concatenation into a Path module, issue #8 of the image2pattern directory.. The reason I want to work on this is because I would like to learn more about the Path module for Node and will take this opportunity to test out the differences.

First, I made a comment to the issue that I planned to work on the issue and asked where to start working on it. One of the contributor told me which files to work on, so I began working on them. After it successfully ran, I forked the app into my repositories and cloned the directory onto my PC. I ran the npm start command and had the app open up, and tested to see if it functioned correctly. I then began working on the image2pattern.js file and looked through to see what needed to be changed. From the issue, I noticed that the imageFilePath variable was still using the string concatenation, so I began work there. Knowing I had to work on the node path module, I searched up some information for the module and determined that I needed to add the path.dirname function to the code.

const imageFilePath = (process.platform === 'win32')
? path.dirname(`${config.outputLocation}\\images\\page-${startX}x${startY}.svg`)
: path.dirname(`${config.outputLocation}/images/page-${startX}x${startY}.svg`);

After adding it, I kept running into problems trying to run the pattern creation script, as it kept informing me that I was missing the path variable. I added it in to the list of variables at the top, and it was now working well.

Next I moved on to the prepImage.js file and started to work on that. I found the filePath variable and did what I did for the last one, adding in the path.dirname function with the path require at the top. However, when I ran this one, the image would not load into the HTML and the preview would fail, along with the cross stitch generation. I looked into the code, and noticed that it was running by the basename and replaced the dirname function with the basename function.

const filePath = (process.platform === "win32")
      ? path.basename(`${imagePath}`)
      : path.basename(`${config.outputLocation}/images/${imagePath}`);

Afterwards, I created pull request #15 for the change and made a comment in the issue #8 thread and referenced the changes.

Overall, this issue was not too difficult. I did run into a few problems trying to implement the Node path modules, as it was a bit difficult to test for the error without simply running the code itself. It was interesting to look into the Node path, as I haven’t worked with it for a while and it was nice to refresh my memory and learn a few new things.

by sppang at October 16, 2018 12:25 AM

October 15, 2018


Andriy Yevseytsev

Hacktoberfest Part #2 (2nd PR of release 0.2)

Next week of Hacktoberfest and second PR of release 0.2...

Hacktoberfest is going on and our task for this week is to do a second pull request to one of the repositories on GitHub.

Pull Request #2

For the second pull request I decided to take some web project because I feel confident in html, css and javascript. After researching I have found the repository where the owner asked to develop a simple form just to practice and for future use I guess.


After looking through the code I have found out that the code is little messy and some css code are in the html file as an inline declaration. I decided to fix these small problems and created an issue.
After fixing the code I created the pull request.

Waiting my code to be merged will take some time I believe because repository seems to be not touched for 9 days and maybe author thinks it is dead right now, but I am planning to improve this form a lot in my future pull request because I know that some programmers often struggle with forms in html and this repository will definitely have the chance to help them.

by Andriy Yevseytsev (noreply@blogger.com) at October 15, 2018 09:53 PM


Yoosuk Sim

Pwning my favorite game

Hectoberfest part 2: Pwning my favorite game

While I have used various open source programs in daily bases, I have never imagined to be the one contributing to it. It has been the reason why I got interested in computer, so that was always my holy grail, but it was not until recently I could see myself as someone standing with the giants. Turns out, I can stand on their shoulders. What a view! Anyways, for my second PR, I decided to work on one of my favorite game:[Cataclysm-DDA](https://github.com/CleverRaven/Cataclysm-DDA). It is about time my survivor got himself some rocket fuels!

Cataclysm - Dark Days Ahead

This is a rouge-like survival game. Your character is spawned in the middle of an unfriendly, zombie-infested world. Depending on the difficulty, you may spawn anywhere from a relatively safe bunker to neck-to-neck with the next-door, undead-and-hungry neighbors. The goal is to utilize every object and knowledge to gain an upper hand and survive. The player has the world at the disposal to craft and use.

Specific Issue

Rocket fuel is one of the consumable used in the game. It is relatively easy to learn with some limited purpose. The problem is that zinc, one of the components used to craft the chemical, spawns in only one location, school chem lab, that is often relatively difficult to reach until the player reaches much higher level. To provide a balanced game play, an issue was opened requesting to increase availability of zinc.

Approach

First, I looked up zinc. With the assumption that the world tries to closely mimic a real-life town, I wanted to know where we would find zinc in any form in our lives. After some search, it turns out, zinc is very popular in creating metal molds and used in many industries such as automobiles. In different chemical forms, zinc is also used in wide range of common products such as paint. With this information, I decided to add zinc to the hardware stores, Cataclysm world-wide. I also decided other chemistry-related locations may have zinc for various purposes, adding zinc to chem_home and chem_lab locations.

Alternative

As mentioned, zinc is a component in various items such as paint, and paint exists in the Cataclysm world. As chemical crafting plays a big role in the game, it would also be interesting to add a recipe that would turn paints or other object into zinc and other compound.

Conclusion

This was much easier fix but was an interesting general learning experience. Perhaps, for my next pull request, I might try to implement the recipe idea to increase zinc availability.

by y2s1982 (noreply@blogger.com) at October 15, 2018 09:37 PM


Oluwaseyi aketepe


Thanh Nguyen

OSD600 Release 0.2 Part 2

In this blog post, I’ll talk about the second Pull Request for the Hacktoberfest event.

I chose to work on the Vocabulary Builder project. Basically, this project is a collection of word definitions stored in json format.

Here is the process of completing this first PR:

  1. I forked the original repo.
  2. I chose to work on issue that add words starting with “Di”, ask for permission to work on the word “diminutive”.
  3. Then I went on google and search up the word definitions for different part of speech.
  4.  Then I follow the contributing guidelines and follow the instruction to create a new JSON file in a new branch, with all the word definition written in json format. The code looks like this:  Screenshot (6).png
  5. After I finished with coding, I push the codes to my remote branch on GitHub and created a PR from the original repo.

by Thanh Nguyen at October 15, 2018 07:52 PM


Victor Kubrak

Hacktoberfest Second Pull Request

In my second pull request I fixed a bug in Filer.

How I fixed a bug

  1. I was writing a test for rename() when oldPath==newPath (You can see a discussion here). It was expected that function will successfully rename a file, but it failed. We came to the conclusion that function implementation has a bug. Bug was assigned to me and I started working on it.
  2. I went to the implementation file, found rename() and tried to understand how it works.
  3. I found out that find_node() is called and went to it.
  4. In find_node() another function is called, in another function one more function is called, etc. There was a long way to find a mistake, a lot of functions was called. This long process is not interesting to read about, so I will not write about all ifs and function calls.
  5. Finally, check_if_new_file_exists() is called. It has this "if" inside:
if(_(newDirectoryData).has(newname)) { callback(new Errors.EEXIST('newpath resolves to an existing file', newname)); }
If a file with the name we want to rename a file to already exists, callback with an error is called. I removed this if statement and spaces in the else statement that is following this "if". After these changes my test with oldPath==newPath passed (all other tests also passed).

Fixing bugs in your own code is sometimes difficult, even though you know how your code works. But fixing bugs in someone else's code is always more difficult: you have to find out how it works. Different styling and programming techniques slow down debugging. So, I think it would be more rational if a person that wrote a code fixed bugs himself and other people just wrote tests.

by Victor Kubrak (noreply@blogger.com) at October 15, 2018 07:52 PM


Aleksei Kozachenko

SwifterSwift (continued)

Last week I wrote about SwifterSwift— a library with more than 500 native Swift extensions for iOS, macOS, tvOS, watchOS and Linux.

Since last week there was a couple pull requests to the project and a couple of merges.
As a result, my local(and origin) repos were behind the upstream master branch. (In this project we work on master branch). Additionally, my origin was not only 6 commits behind the upstream, but also 9 commits ahead of it (it is still not clear to me why it was ahead).

Get latest changes from upstream

The first things I did to get all the changes that were made and merge them into my repo were:

git fetch upstream
git merge upstream/master

At this point I had a merge conflict, that I had to resolve manually.
After resolving it, I committed all the changes and pushed master to my fork on github.

git push origin

Something went wrong

After merging and pushing to origin my main branch was now 11 commits ahead (not 9) of the upstream (it was not behind anymore). So after I fetch changes from the upstream and merged everything into my local repo, I was still N commits ahead. My last commit was 6 days ago when I created a PR which was later merged. After a few hours of trying to understand my master was ahead of upstream, reverting commits, trying to pull from the upstream again, I could not solve this problem. I did not want to add new code, commits and push changes,because I did not want to mess up with upstream when I would create a PR with new and supposedly old commits.

So I had only one idea how to get all the changes from upstream. I decided to clean up my fork and restart it from the upstream.

git fetch upstream 
git checkout master
git reset — hard upstream/master
git push origin master — force

After that I had my local and origin repos matching to the upstream.

Adding more to extensions to SwifterSwift

Last time I added a new property ‘yesterday’ to the Date class, to quickly get yesterday’s date without calling functions with arguments (for example it could be done by calling date.adding(.day, -1)).

I decided to add a variable ‘tomorrow’ to complete my previous PR. This computed property would return a Date object representing tomorrow’s date. So two properties would allow to get next results:

let date = Date() // “Oct 3, 2018, 10:57:11”
let yesterday = date.yesterday // “Oct 2, 2018, 10:57:11”
let tomorrow = date.tomorrow // "Oct 4, 2018, 10:57:11"
let date2 = Date(iso8601String: "2018-10-10T100:57:11.000Z") // "Oct 10, 2018, 10:57:11"
let date2Tomorrow = date2.tomorrow // "Oct 11, 2018, 10:57:11"

I added a UnitTest to test if the method is working properly

func testTomorrow() {
     let date = Date()
     XCTAssertTrue(date.tomorrow.isInTomorrow)
}

Since now my repo had all the changes from the upstream, I updated CHANGELOG.md file, committed my changes, and created a new pull request.

Next contribution(s)

I want to add more extension methods that I have been using in my own projects. Additionally, next time I want to be able to properly merge upstream changes to my local repo before adding new content.

by Alexei Kozachenko at October 15, 2018 07:02 PM


Xuan Dinh Truong

OSD600_Release0.2 _Hacktoberfect _Post2

Awesome!!!!!😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂

In this second pull request, I searched 3 issues for working on.

  1. The first issue is about this vueToDo project. I got stuck when I was doing some coding. I could not put my issue here because the author already remove it on the list of issues. 😐
  2. The second issue is about open-source-library-data-collector project and my issue is Document new Git workflow in CHANGELOG.md #151. I created a document and take all screenshots about the process how to fork, brach off the `development` branch and submit PRs agains the `development` branch. However, I could not submit my pull request and could not figure out the reason at that time. I asked the author about it, but I did not get any response. Until I started working on the 3rd issue, I knew why I could not submit a pull request. I made a BIG BIG problem. I was on the master branch when I submitted the pull request. This is the reason the author filed this issue. How can I explain it "I MAKE THE SAME ERROR ON ONE OF THE EXPECTED RESULT OF THIS ISSUE". My note had one step how to sync a fork, so I run these following commands `git fetch upstream`, `git checkout master` to have a change to take the screenshots. I forgot to change to my branch when I submitted a pull request. LEARNED A LESSON! 
  3. The last issue is about quicksort algorithm in python. First, I want to learn something about python, so I asked commission to work on it. After one hour, someone came up and noted "I am on it sign me up", but I was the first person to ask permission. At that time, I thought I have the above second issue to work on so I ignored it. Until I got stuck in the second issue, nothing is to work on, I got permission from the author to work on this issue. Happy time is coming. I did some research about quicksort in python and tried to understand it by making some comments beside the code. I did a whole process to get a pull request done and tried to merge. After asking merge, I figured out that I have some mistakes on my changes file about the comments sign. We need to use ` # ` for comment in python, but I used ` // `. A long history to say about how to remove my file on master branch, create a new commit on my branch, push new commit, get a non-fast-forward error, fix error, get conflict on the merge about the change file, fix it, create and push a new commit, asking for merge again. 
          The following links are helpful to fix all of those errors I got for the last issue.
      Issue: quicksort algorithm in python
      Pull Request: Fix #92: quicksort algorithm in python

Finally, I am not sure now that I can get "merged" light on this last issue, but I got the second pull request have been done for this month. I will follow up.


    by Dinh Truong (noreply@blogger.com) at October 15, 2018 05:47 PM


    Stephen Ward

    Hacktoberfest pt. 2

    blogging

    This is my second installment, of a 5 part series involving open source development. I suppose the title of the blog post that away tho.

    Anyways, this week I ended up working on a project called cogear.JS Essentially, it is a platform which allows a user (perhaps not as technically inclined as the developers) to create static websites in minutes, with the option to deploy them if they have the available resources. Beyond this, it is also a great way for front-end developers to quickly deploy test runs of their websites before they deploy them.

    Judging by the commits on it’s repo, this is a fairly new project — started back in August of this year. Currently, it is run by one man out of Saint-Petersburg, Russia. Which leads to me to my first oversight of the week: I need to start things way earlier, because communication with someone in a completely different time-zone takes days.

    I started back on Wednesday, informing Dmitriy that I could help him set-up bootstrap 4 templates for his platform. It took 2 days for a response back that I could give it a go. No big deal, I could work on it between my weekend bar-tending shifts. It never occurred to me, however, that if I made a PR with my bootstrap themes, that they would conflict terribly with his repository. Nowhere on the main repository is there a place for theme. So, I’ve sent him a message about how he wants me to make a pull request. And for now, it’s a waiting game. (Well, I’ll go find another project to contribute to in the meantime).

    My second learning curve of the week came from having to dive head first into technologies I don’t know too well. For one cogear itself has a multitude of commands to learn. Thank goodness there is an amazing amount of documentation as well as videos to learn how to use cogearJS. This is one of the main reasons why I chose to work on it. Cogear also uses a .pug format. This is a javascript API used to render javascript into HTML. This was a little wonky to me, and took a moment (a whole night) to wrap my head around. What I had to overcome then, was somehow writing bootstrap compents as javascript rather than HTML classes. With a little bit of luck I sort-of converted all the known bootstrap classes into pug mixins.With this out of the way, I was able to quickly render a few boilerplate pages for cogear.js:

    screenshot.PNG1.PNG

    Finally, the structure of contributing to cogear.js happens in two ways. The first, is uploading your work to git. That, I am still waiting to do, as I believe I’ll need a new repo (this is how Dmitry has setup his other cogear themes) to push to. Secondly, I need to also publish my code on NPM, as cogear allows users to grab themes on the fly using NPM commands. Again, I have no problem doing this, as I’ve created NPM packages before. However, for my own sake, I am holding off on this part until I can get what I want out of this week — which is my PR. Selfish? I suppose so. Either way, cogearJS is an open source framework, free for anyone to use, with a ton of practical use. I’d recommend it.

    —————————————————————————————————————————

    EDIT: The main developer got back to me quicker than previous times, and I was able to make a PR on another repository of his. How exciting. Now I can say I have worked with people from around the world!

     

     

    by steaward at October 15, 2018 04:44 PM


    Mera Gangapersaud

    Hacktoberfest — Week Two

    Hacktoberfest — Week Two

    I’ll be honest and say the PR I did this week only served the purpose of increasing my PR count for Hacktoberfest. I didn’t have much time this week to find something interesting to do so I worked on this issue I found a couple weeks ago. It was a simple fix; I added two functions to support additional functionality.

    As easy as it was, creating the actual PR was a bit of an exercise. The upstream repo was now a couple commits ahead of my fork so I had to rebase my branch and fix a few minor conflicts. Luckily, our Open Source class had gone over how that works just a couple days prior so I didn’t have to dig around git documentation too much. The best thing about this experience is the experience itself. I sat through the class and understood everything we were told about rebasing and merge conflicts but now that I have actually gone through it myself I have an even better idea of how it works and how potentially complicated it can get. The practice beat the theory.

    Rebase aside, the most important thing for me this week is I have finally picked a project I’m interested in working in! If Me is a website that fosters a community where people can share stories and experiences with regards to mental health. It’s something that hits close to home for me and its something I would be proud to be able to contribute to.

    The repo can be found here. Its coded in Ruby which I have no experience in but I’ve been looking at the code and getting advice from friends and the If Me community. I also found a few issues that I am looking into but I’ll save that for next weeks blog post.


    Hacktoberfest — Week Two was originally published in MeraG on Medium, where people are continuing the conversation by highlighting and responding to this story.

    by Mera Gangapersaud at October 15, 2018 04:34 PM


    Dilan Guneratne

    Hacktoberfest Part 2: Hacktoberfest Finder

    Hacktoberfest Part 2: Hacktoberfest Finder

    Last week on my hunt for issues to work on for Hacktoberfest I came across a project called Hacktoberfest Finder by damcclean. It's a small project that searches the GitHub API for issues labeled Hacktoberfest and displays them as cards.

    Hacktoberfest Part 2: Hacktoberfest Finder

    I found using the site more pleasing than trying to do the same with GitHub's search bar. Moreover, since it lists issues by most recently updated, most of the time issues displayed by Hacktoberfest finder are new and not taken by anyone. However, white it's great to have a list of issues to pick from, the only way to know the repository name would be to actually click on the issue. So, I decided to request a feature to add repository names to cards. Once I got the go-ahead I forked, cloned the repository locally and made a branch to match the issue number.

    Setup

    I had some trouble getting the project setup. The first step was to install npm packages which went without a hitch. The package.json file lists four npm scripts, but they are not setup to run on Windows as Windows does not recognize setting node environment variables with NODE_ENV:

    Hacktoberfest Part 2: Hacktoberfest Finder

    This was a quick fix as all I had to do was to change NODE_ENV to set NODE_ENV.

    The next issue was running one of the scripts did nothing. It turns out that the command webpack was not being executed, so I want to run npm run watch, I had to either install webpack cli globally or run it like this:

    "watch": "node_modules/.bin/webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",

    My last hurdle was to figure out why webpack was hanging on emitting 95%:

    Hacktoberfest Part 2: Hacktoberfest Finder
    After a bit of searching I found out that if you're using laravel-mix as a standalone package (i.e without using it with Laravel), you need to give it the public path in webpack.mix.js:

    Hacktoberfest Part 2: Hacktoberfest Finder

    Contribution

    When the site is loaded it makes a call to the GitHub API using a HTTP client called axios and displays issue titles as cards. Since GitHub has rate limit of 60 unauthenticated requests per hour, during development I didn't want to exceed the limit or hammer the API everytime I made a change. So I changed the axios API call to fetch issues from the GitHub API and save it to a file.

    Hacktoberfest Part 2: Hacktoberfest Finder

    From there on, instead of making calls to the API I made axios read from the JSON file.

    Next step was to grab the repository name from the API results. While the repository title is not exposed as a property, I noticed that it is always the last part of the repository_url. For example,

    repository_url: "https://github.com/dnguneratne/hacktoberfest-finder"

    So I modified the code to iterate through all the results, get the repository_url, split wherever there is a '/', which gave me:

    Array ["https:", "", "github.com", "dnguneratne", "hacktoberfest-finder"]

    From there I grabbed the last array element with slice(-1), which I then appended to the API results as repoTitle.

    Hacktoberfest Part 2: Hacktoberfest Finder

    Next was to show the repoTitle in the cards and I did that by adding a h6 element to the card and using Vue's v-html directive to display the repoTitle property.

    Hacktoberfest Part 2: Hacktoberfest Finder

    That was it! Then I made a PR which was later merged to master. Here's the final result:

    Hacktoberfest Part 2: Hacktoberfest Finder

    What I Learned

    1. axios - I've run in to axios a few times before but never had the opportunity to use it. It's a handy promise-based utility to make HTTP calls from the client side and I can definitely see myself using it in my own projects.

    2. Using Laravel Mix As A Standalone Package - Laravel Mix is a wrapper around webpack to make build steps cleaner and simpler. It was interesting to see Laravel Mix being used outside of Laravel, and I might take a deeper look at the advantages of doing this over using webpack by itself.

    3. GitHub GraphQL API - At one point during this PR I considered switching to GitHub's GraphQL API. In this project we are really only interested in the issue url, issue title, and project title. However, the data fetched from the GitHub includes a whole bunch of other things related to the repositories. This is where GraphQL shines as it allows one to request only the data that is needed. Unfortunately, I soon found out that this approach would not work here as the user needs to be authenticated first in order to use GitHub's GraphQL API. However, in the process I found out about GitHub's GrahpQL Explorer which seems quite handy.

    Conclusion

    I use hacktoberfest-finder on a daily basis on my hunt for new issues to work on, and I like being able to quickly glance at the repository title, and along the way I learned to use some new packages. That's it for this week and next week I'll continue with my Hacktoberfest 2018 adventure with part 3.

    Photo by Serge Kutuzov on Unsplash

    by Dilan Guneratne at October 15, 2018 03:35 PM


    Stuart Crust

    Hacktoberfest - Week Two

    Hacktoberfest week two! Week one was all about getting into the groove of Hacktoberfest, making a small change to contribute, and finding out about other awesome projects in open source and my area of interest.

    My contribution for this week had a bit more self-interest involved; I contributed a change to dplesca/purehugo, the Hugo blog theme I use for this blog, to normalize URLs that use Hugo's .Site.BaseURL variable.

    The Problem

    Using the dplesca/purehugo theme, I was noticing that many links to other parts of the site - that is, links that were not external links to e.g. GitHub or Twitter - contained multiple slashes after the site root. Modern web browsers are really good at dealing with partially-malformed URLs so there was no functional problem with any of the links as the browser's URL parser took over and cleaned them up into a value it could resolve, but it would still be better if the URLs were correctly formatted when Hugo generates the static site content.

    The malformed URLs looked something like this:

    <a class="pure-button" href="http://localhost:1313//index.xml">[...]</a>
    <a class="post-category post-category-open source" href="http://localhost:1313//categories/open-source">open source</a>
    

    Delving into the template code revealed how dplesca/purehugo was generating the URLs:

    <a class="pure-button" href="{{ .Site.BaseURL }}/index.xml">[...]</a>
    <a class="post-category post-category-{{ . }}" href="{{ $baseUrl }}/categories/{{ . | urlize }}">{{ . }}</a>
    

    The template string used .Site.BaseURL and appended a slash before the next URL fragment. Since this results in a double slash in the generated output, I presume but have not confirmed that .Site.BaseURL always ends in a trailing slash that needs to be taken into consideration when generating URLs relative the the site's root.

    The Solution

    In a similar way to how we join file paths in NodeJS with path.join(), we almost never want to be responsible for building URL paths ourselves. Luckily, Hugo provides many built-in helper functions that cover a whole range of use cases, including the one I decided to use to normalize URL paths throughout dplesca/purehugo: absURL

    From the Hugo documentation, absURL

    Creates an absolute URL based on the configured baseURL.

    where baseURL is the hostname (and path) to the root of the site which is set as part of Hugo's site configuration.

    This function was a perfect solution in most of the places where static files need to be linked and served to the client, such as JavaScript or CSS content. In those cases it was a simple matter of removing .Site.BaseURL and the subsequent concatenation and replace it with a call to the absURL function, like so:

    <a class="pure-button" href='{{ "index.xml" | absURL }}'>[...]</a>
    

    Normalizing the post category links turned out to be a bit more complicated than this simple substitution because these links needed to include more URL fragments to create the complete path. In order to correctly concatenate and then normalize these URLs, I turned to another of Hugo's built-in functions: printf.

    Hugo's templating system is built almost entirely on top of Go's built-in template package, which makes things very familiar if you have worked with Go templates before. It also means that Hugo can expose a lot of Go functions as Hugo functions available inside templates. In this case, Hugo's printf function exposes Go's fmt.Sprintf function which works much like printf in C.

    This is the solution I came up with for building the more complicated post category link URLs while still being able to normalize the resulting URL using absURL:

    <a class="post-category post-category-{{ . }}" href='{{ ( printf "categories/%s" . ) | absURL }}'>{{ . }}</a>
    

    Unlike in NodeJS, in this case it's safe to do a simple string concatenation of categories/<category-name> because unlike with file systems, the fragment separator in URLs is always the / character.

    To be Continued

    I am very thankful to purehugo's author, @dplesca, for responding so quickly to my pull request with this change and for merging the pull request within a few hours of my submission. While working on this change I noticed a few other areas where I think dplesca/purehugo could be improved, and I'm looking forward to working on it more as I continue using it to generate my blog and host my site content.

    Hacktoberfest continues on, and I need to start thinking about my next contribution. My school is on a break starting next week, so I'm hoping to find the time to dig into something a bit larger and more challenging based on the projects I've seen so far or had recommended to me by classmates.

    October 15, 2018 04:00 AM


    Volodymyr Klymenko

    Hacktoberfest #2: Graph algorithms implementation in Swift

    Hacktoberfest 2018 #2: Graph algorithms implementation in Swift

    The second week of Hacktoberfest is almost finished, and this week I’ve made another contribution. I decided to continue developing my skills in Swift programming, and after scrolling through the issues with label “hacktoberfest”, I found a project called “All Algorithms”. The idea of this project is that there are different repositories with names of programming languages, and each of these repositories implements different algorithms in a particular language. I didn’t really do any algorithms and data structures before, so I thought that it would be a great opportunity to work with algorithms by contributing to this project.

    Obviously, I chose Swift, and, fortunately, there were not many algorithms developed in Swift repository. After having a quick look, I didn’t find any graph implementations there, so I let maintainers know that I would like to work on the graph algorithms, and I was welcomed.

    I decided to add two algorithms to the project:

    • Breadth-first search
    • Depth-first search

    I set up a local repository and started to work on the issue. Unlike the issue from last week, I didn’t have to get familiar with the existing code because I needed to implement the algorithms from scratch.

    I started a research by reading 22 chapter of “Introduction to Algorithms” by Cormen, Leiserson, Rivest, and Stein. The chapter is called “Elementary Graph Algorithms”. I read first three parts of it:

    1. Representations of graphs
    2. Breadth-first search
    3. Depth-first search

    Representations of graphs

    There are two ways of representing graph in computer:

    1. Adjacency-list
    2. Adjacency-matrix

    Here is an example of graph (a) presented in adjacency-list (b) and adjacency-matrix (c):

    http://staff.ustc.edu.cn/~csli/graduate/algorithms/book6/chap23.htm

    I found that it’s better to use adjacency-matrix when the graph is dense (many edges), but if a graph is sparse, you’d better to use adjacency-list.

    An adjacency-matrix is just a 2-dimensional array of size n² (n — quantity of edges), where 1 is used to represent an edge between nodes, and 0 if there is no connection between vertices. If you have sparse graph (not many edges), it means that most of the matrix entries wouldn’t be used, so it’s just a waste of memory, that’s why adjacency list would be a better solution.

    I’ve used adjacency-matrix before, so I decided to use adjacency-list in my graphs for this project.

    Graph implementation in Swift

    In order to implement graph data structure, I have created three classes:

    1. Node
    2. Edge
    3. Graph

    Node class

    import Foundation
    public class Node: Equatable{
      public var label: String
      public var neighbors: Array<Edge>
      public var color: String?
      public var predecessor: Node?
      public var distance: Int?
      public init(_ label: String){
        self.label = label
        self.neighbors = Array<Edge>()
      }
      public static func == (lhs: Node, rhs: Node) -> Bool{
         return lhs.label == rhs.label
      }
    }

    Edge class

    import Foundation
    public class Edge {
      public var neighbor: Node
      public var weight: Int?
      public init(_ neighbor: Node){
        self.neighbor = neighbor
      }
    }

    Graph class

    import Foundation
    public class Graph{
      public var nodes: Array<Node>
      public init(){
        self.nodes = Array<Node>()
      }
      public func addNode(_ label: String){
        let newNode = Node(label)
        nodes.append(newNode)
      }
      public func addEdge(from source: Node, to destination: Node){
        let newEdge = Edge(destination)
        source.neighbors.append(newEdge)
        destination.neighbors.append(Edge(source))
      }
    }

    Algorithms

    Breadth-first search

    Visualization of breadth-first search

    Breadth-first search (BFS) starts from a specified source node, and explores its neighbours by discovering all nodes on the same level, and then going to the next depth level (see animation above).

    This algorithm uses coloring to keep track of progress, so that

    • White color stands for undiscovered vertex
    • Gray color stands for discovered vertex
    • Black color stands for visited vertex

    Here is the pseudocode of the algorithm (from: Introduction to Algorithms):

    BFS(G, s)
    for each vertex u ∈ G.V � - {s}
    u.color = WHITE
    u.d = ∞
    u.π = NIL
    s.color = GRAY
    s.d = 0
    s.π = NIL
    Q = Ø
    ENQUEUE(Q, s)
    while Q ≠ Ø
    u = DEQUEUE(Q)
    for each v ∈ G.Adj[u]
    if v.color == WHITE
    v.color = GRAY
    v.d = u.d + 1
    v.π = u
    ENQUEUE(Q, v)
    u.color = BLACK

    where d — distance from source node, π — predecessor(parent node), s — source node.

    As you can see, this pseudocode uses Queue data structure, so I developed a Queue struct:

    import Foundation
    public struct Queue<T> {
      var items: [T] = []
      public init(){}
      public mutating func enqueue(element: T){
        items.append(element)
      }
      public mutating func dequeue() -> T? {
        if items.isEmpty {
          return nil
        } else{
          return items.remove(at: 0)
        }
      }
      public var isEmpty: Bool {
        return items.isEmpty
      }
    }

    And here is my translation of Breadth-first search to Swift code:

    func breadthFirstSearch(graph: Graph, source: Node){
      var visitedNodes = Queue<Node>()
      for node in graph.nodes{
        node.color = "White"
        node.distance = nil
        node.predecessor = nil
      }
      source.color = "Gray"
      source.distance = 0
      source.predecessor = nil
      visitedNodes.enqueue(element: source)
      while !visitedNodes.isEmpty{
        if let currentNode = visitedNodes.dequeue(){
          for edge in currentNode.neighbors {
            if edge.neighbor.color == "White" {
              edge.neighbor.color = "Gray"
              edge.neighbor.distance = currentNode.distance! + 1
              edge.neighbor.predecessor = currentNode
              visitedNodes.enqueue(element: edge.neighbor)
            }
          }
          currentNode.color = "Black"
        }
      }
    }

    Depth-first search

    Visualization of depth-first search

    Depth-first search (DFS) works in the way it goes down the edges of the most recently discovered node. Once it discovered all the edges of one node, it comes back, and does the same thing with next undiscovered node (see animation above).

    In a similar way as BFS, DFS also uses coloring to keep track of progress.

    Here is the pseudocode of the algorithm (from: Introduction to Algorithms):

    DFS (G)
    for each vertex u ∈ G.V
    u.color = WHITE
    u.π = NIL
    time = 0
    for each vertex u ∈ G.V
    if u.color == WHITE
    DFS-VISIT(G, u)
    DFS-VISIT(G, u)
    time = time + 1
    u.d = time
    u.color = GRAY
    for each v ∈ G.Adj[u]
    if v.color == WHITE
    v.π = u
    DFS-VISIT(G, v)
    u.color = BLACK
    time = time + 1
    u.f = time

    where π — predecessor, time — timestamp, d — timestamp to record when node was discovered, f — timestamp to record when node was visited

    And here is my translation of Depth-first search to Swift code:

    func depthFirstSearch(graph: Graph){
      for node in graph.nodes{
        node.color = "White"
        node.predecessor = nil
      }
      var timestamp = 0
      for node in graph.nodes{
        if node.color == "White"{
          dfsVisit(node: node, timestamp: &timestamp)
        }
      }
    }
    func dfsVisit(node: Node, timestamp: inout Int){
      timestamp = timestamp + 1
      node.discoveredTimestamp = timestamp
      node.color = "Gray"
      for edge in node.neighbors{
        if edge.neighbor.color == "White"{
          edge.neighbor.predecessor = node
          dfsVisit(node: edge.neighbor, timestamp: &timestamp)
        }
      }
      node.color = "Black"
      timestamp = timestamp + 1
      node.finishedTimestamp = timestamp
    }

    You can see the whole source code in my Pull Request, where I also created a sample graph and ran BFS and DFS. To sum up this week with some outcomes:

    • implemented Graph in Swift
    • studied and implemented Breadth-search algorithm
    • studied and implemented Depth-search algorithm
    • strengthened my skill in Swift development

    by Volodymyr Klymenko at October 15, 2018 03:54 AM


    Stephen Truong

    Release 0.2.2

    My second Issue and Pull Request for Release 0.2 was creating a Korean translation file for erxes, which is an open-source growth marketing platform. Originally for this release I was planning on starting off with a little coding, however after wasting a few hours from Wednesday to Friday searching I failed to find something I felt I could confidently learn and fix. When it Saturday came I decided I was out of time so I started looking for Issues related to Markdown/Documentation/Translations. After a while of searching I found erxes where there were a few Issues posted previously in regards to translations.

    When I first selected this project, I only skimmed the first 30 or so lines of the file that required translations and thought “I could manage this”. Since I was running out of time and also have labs from other classes due soon, I made a stupid mistake of not fully checking over the file before creating the issue and rushing to start translations. While translating slowly I realized the file was actually 600+ lines, in the end it took 2 days to finish with some help from Korean friends who I asked for help after seeing the number of lines.

    Although I realize open source doesn’t involve only coding, sometimes while looking through Issues I feel like some don’t really seem to be major enough to be considered “legit” Pull Requests. However through this course I learned and realize that every little contribution counts, and it helps make projects great after many of these small improvements. As it says on the Hacktoberfest site under Quality Standards: Last but not least, one PR to fix a typo is fine. 5 PRs to remove a stray whitespace… not.

    I plan to find some Issues which involve coding at some point and attempt to fix them, however I still worry if I am capable of doing so within a reasonable amount of time. I find that the majority of Issues I look at would require at a minimum a few days to learn about advanced features of the language/feature before potentially being able to perform the fix. However the main problem which has been giving me trouble for finding an Issue arises, I feel reluctant to spend a few days to learn something due to the risk of not being able to submit a Pull Request. Part of that may be cause of how things are taught in school, where mode coding is just the basics without having to link to external sources/plugins/APIs/etc.

    Project: https://github.com/erxes/erxes
    Issue: https://github.com/erxes/erxes/issues/670
    Pull Request: https://github.com/erxes/erxes/pull/674

    by Stephen Truong at October 15, 2018 12:21 AM


    Edgard Arvelaez (akdev)

    Profiling with gprof

    One of the key points when doing software optimization is that you must know where the bottlenecks in your program are. It would make very little sense to spend a lot of time optimizing a function that only makes up for ~1% of the runtime. But how can we know which functions are critical for performance? This is where the different profiling tools come in.

    What is profiling?

    First we have to touch on the definition of profiling. From Wikipedia:

    profiling (“program profiling”, “software profiling”) is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the frequency and duration of function calls. source

    Let’s digest this definition a bit: profiling is a form of analysis that measures the space(memory) or time complexity of a program. From this simplified definition we can see that profiling is just measuring either how much memory a program uses(space) or how long does it take to run (time). It’s worth noting that we can profile for other variables other than space and time but we will be focusing on these two.

    Tools

    In order to profile a program we must use a profiler. Two well known ones are the GNU Profiler(gprof) and valgrind. The GNU profiler comes with a standard distribution of gcc which makes it readily available. Valgrind on the other hand is usually a separate package(usually available from your distro’s repositories). These two profilers use wildly different approaches.

    The GNU Profiler uses code injected at compile-time to measure the length of each function call as well as frequency. The advantage of this approach is that there is less of a performance penalty when doing profiling which should gives us more realistic results.

    In contrast, the valgrind tool injects itself into the program at runtime (not unlike a debugger does) and does measurements that way. This does cause the execution time of the program to get a lot longer when comparing against non-profiled runs.

    In either case we have that the profiler itself will alter the runtime of our program and this is something we must keep in mind when reading profiling results. We care about the relative time spent in each function rather than the absolute timings provided by the profiler.

    The Program

    I will try to show how to use gprof to get timings on the following program:

    #include <stdio.h>
    #include <stdlib.h>
    #include <errno.h>
    
    #define WRONG_ARGS 1
    #define FILE_ERR 2
    
    #define BUF_SIZE 4096
    
    int copy(FILE* src, FILE* dest)
    {
    	char buffer[BUF_SIZE];
    	size_t bytesRead = 0;
    	size_t bytesWritten = 0;
    
    	do {
    		bytesRead = fread(buffer, sizeof(char), BUF_SIZE, src);
    		bytesWritten = fwrite(buffer, sizeof(char), bytesRead, dest);
    	} while(!feof(src) && !ferror(src) && !ferror(dest));
    
    	return ferror(src) || ferror(dest);
    }
    
    int main(int argc, char** argv)
    {
    	if(argc != 3) {
    		fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
    		return WRONG_ARGS;
    	}
    
    	const char* destPath = argv[2];
    	const char* srcPath = argv[1];
    	FILE* src = fopen(srcPath, "r");
    	FILE* dest = fopen(destPath, "w");
    
    	if(src == NULL || dest == NULL) {
    		perror("could not open file");
    		return FILE_ERR;
    	}
    	
    	printf("%s -> %s\n", srcPath, destPath);
    	int failure = copy(src, dest);
    	if(failure) {
    		perror("could not copy file");
    	}
    
    	return 0;
    }
    

    This is a very simple program that copies a file into another. Similar to the cp command. In order to try it we can generate a decently sized file with this command:

    dd if=/dev/zero of=/path/to/file bs=1M count=1024
    

    This will generate a file of 1GB in size located at /path/to/file. I have put this in a Makefile and will post the github link at the end of the post in case you would like to try this yourself.

    Getting profile data

    So now that we have a program and we compile and test it by doing:

    $ gcc cp.c -o cp
    $ ./cp /path/to/source /path/to/destination
    

    This may take a bit depending on the size of the file, with 1GB of data it takes a few seconds on my laptop(i7-7200U, 8GB of RAM, 1TB SSD).

    Alright but now how can we start profiling this program? The first thing we need to do is to compile the program with the profiling code enabled. The GNU Profiler needs code added to the program to measure each function call. A downside of this approach is that we need to recompile our program if we want to profile it.

    We must add the -pg flag to out command line:

    $ gcc cp.c -pg -o cp
    

    Then we need to run the program as usual; this will generate a gmon.out file which contains all the statistics we need. We can read the gmon.out file by using the gprof command and passing the related executable to it.

    $ gcc cp.c -pg -o cp                 # Let's compile the program with profiling enabled
    $ ./cp /etc/passwd /tmp/passwd       # Run it to generate timing data
    /etc/passwd -> /tmp/passwd
    $ ls                                 # Let's see if gmon.out was generated
    cp.c cp gmon.out
    $ gprof cp                           # Read the timing data and show statistics
    Flat profile:
    
    Each sample counts as 0.01 seconds.
      %   cumulative   self              self     total           
     time   seconds   seconds    calls  ms/call  ms/call  name    
    100.43      0.01     0.01        1    10.04    10.04  copy
    
     %         the percentage of the total running time of the
    time       program used by this function.
    
    cumulative a running sum of the number of seconds accounted
     seconds   for by this function and those listed above it.
    
     self      the number of seconds accounted for by this
    seconds    function alone.  This is the major sort for this
               listing.
    
    calls      the number of times this function was invoked, if
               this function is profiled, else blank.
    
     self      the average number of milliseconds spent in this
    ms/call    function per call, if this function is profiled,
    	   else blank.
    
     total     the average number of milliseconds spent in this
    ms/call    function and its descendents per call, if this
    	   function is profiled, else blank.
    
    name       the name of the function.  This is the minor sort
               for this listing. The index shows the location of
    	   the function in the gprof listing. If the index is
    	   in parenthesis it shows where it would appear in
    	   the gprof listing if it were to be printed.
    
    Copyright (C) 2012-2017 Free Software Foundation, Inc.
    
    Copying and distribution of this file, with or without modification,
    are permitted in any medium without royalty provided the copyright
    notice and this notice are preserved.
    
    		     Call graph (explanation follows)
    
    
    granularity: each sample hit covers 2 byte(s) for 99.57% of 0.01 seconds
    
    index % time    self  children    called     name
                    0.01    0.00       1/1           main [2]
    [1]    100.0    0.01    0.00       1         copy [1]
    -----------------------------------------------
                                                     <spontaneous>
    [2]    100.0    0.00    0.01                 main [2]
                    0.01    0.00       1/1           copy [1]
    -----------------------------------------------
    
     This table describes the call tree of the program, and was sorted by
     the total amount of time spent in each function and its children.
    
     Each entry in this table consists of several lines.  The line with the
     index number at the left hand margin lists the current function.
     The lines above it list the functions that called this function,
     and the lines below it list the functions this one called.
     This line lists:
         index	A unique number given to each element of the table.
    		Index numbers are sorted numerically.
    		The index number is printed next to every function name so
    		it is easier to look up where the function is in the table.
    
         % time	This is the percentage of the `total' time that was spent
    		in this function and its children.  Note that due to
    		different viewpoints, functions excluded by options, etc,
    		these numbers will NOT add up to 100%.
    
         self	This is the total amount of time spent in this function.
    
         children	This is the total amount of time propagated into this
    		function by its children.
    
         called	This is the number of times the function was called.
    		If the function called itself recursively, the number
    		only includes non-recursive calls, and is followed by
    		a `+' and the number of recursive calls.
    
         name	The name of the current function.  The index number is
    		printed after it.  If the function is a member of a
    		cycle, the cycle number is printed between the
    		function's name and the index number.
    
    
     For the function's parents, the fields have the following meanings:
    
         self	This is the amount of time that was propagated directly
    		from the function into this parent.
    
         children	This is the amount of time that was propagated from
    		the function's children into this parent.
    
         called	This is the number of times this parent called the
    		function `/' the total number of times the function
    		was called.  Recursive calls to the function are not
    		included in the number after the `/'.
    
         name	This is the name of the parent.  The parent's index
    		number is printed after it.  If the parent is a
    		member of a cycle, the cycle number is printed between
    		the name and the index number.
    
     If the parents of the function cannot be determined, the word
     `<spontaneous>' is printed in the `name' field, and all the other
     fields are blank.
    
     For the function's children, the fields have the following meanings:
    
         self	This is the amount of time that was propagated directly
    		from the child into the function.
    
         children	This is the amount of time that was propagated from the
    		child's children to the function.
    
         called	This is the number of times the function called
    		this child `/' the total number of times the child
    		was called.  Recursive calls by the child are not
    		listed in the number after the `/'.
    
         name	This is the name of the child.  The child's index
    		number is printed after it.  If the child is a
    		member of a cycle, the cycle number is printed
    		between the name and the index number.
    
     If there are any cycles (circles) in the call graph, there is an
     entry for the cycle-as-a-whole.  This entry shows who called the
     cycle (as parents) and the members of the cycle (as children.)
     The `+' recursive calls entry shows the number of function calls that
     were internal to the cycle, and the calls entry for each member shows,
     for that member, how many times it was called from other members of
     the cycle.
    
    Copyright (C) 2012-2017 Free Software Foundation, Inc.
    
    Copying and distribution of this file, with or without modification,
    are permitted in any medium without royalty provided the copyright
    notice and this notice are preserved.
    
    Index by function name
    
       [1] copy
    

    As we can see the output of gprof is quite extensive. It gives us a table of all the functions called in our program along with relative and absolute timings for each one. From the output above, we can see the program spends 100% of its runtime in the copy() function. If we were to optimize this tiny program this is where we should start.

    gprof will give a count of how many times a function was called, allowing us to quickly spot which functions are part of the “hot path” and which ones we can safely ignore when optimizing.

    Conclusions

    We can see that profiling is vital when it comes to optimizing software. It allows us to quickly identify where we should be spending our time to get the best results.

    The source code can be found on github.

    by Alex at October 15, 2018 12:00 AM

    October 14, 2018


    Dilan Guneratne

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!

    Hacktoberfest is in full swing and I am excited to be a part of it! This time around I've decided that I am going to start blogging about my Hacktoberfest adventures. As my first contribution I wanted to do something small, and what better way to get started than with a HelloWorld.

    The Project

    HelloWorld is a collection of snippets from different programming languages that print the word 'Hello World'. I've always been curious about WebAssembly, so for my contribution I decided to write a hello wold program that can be compiled to it. So I commented on the issue to let the owner know that I would like to write a WebAssembly example.

    Setting Up WebAssembly on Windows 10

    According to the WebAssembly getting started guide the first step to setting up WebAssembly on Windows 10 is to install Windows Subsystem for Linux.
    Windows Subsystem for Linux makes it possible to run Linux inside a Windows machine, and it needs to be activated through PowerShell with Administrator privileges.

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!Activating Windows Subsystem for Linux in Windows 10

    Once activated, I went to the Windows Store and downloaded a copy of Ubuntu 16.04.

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!Ubuntu 16.04 in the Windows store

    The installation process took quite some time and after it was done, I updated and upgraded Ubuntu.

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!Updating Ubuntu

    WebAssembly needs Python, and I installed Python with,

    sudo apt install python2.7 python-pip

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!

    In order to compile source code in to WebAssembly the Emscripten toolchain is required. It was installed by downloading a pre-compiled toolchain from GitHub, then installing and activating it.

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!Downloading and installing the pre-compiled Emscripten toolchain from GitHub
    Hacktoberfest Part 1: Happy Hacktoberfest 2018!Activating the Emscripten toolchain

    The last step in getting the Emscripten ready to is to setup environmental variables. Doing this will add environmental variables to and required directory entries to the system's PATH. Fortunately it's pretty easy to do with one command:

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!

    The Program

    Now that all the required dependencies were installed I wrote very simple hello world program in C and saved it as hello.c.

    #include <stdio.h>
    int main(int argc, char ** argv) {
        printf("Hello, world!\n");
    }
    

    To compile it to WebAssembly I ran emcc hello.c -s WASM=1 -o hello.html. Specifying .html will generate an HTML file from the C source code.

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!

    Then I ran emrun --no_browser --port 8080 . to serve the compiled HTML output file over HTTP. Then on the web browser I went to http://localhost:8080.

    Hacktoberfest Part 1: Happy Hacktoberfest 2018!

    Pretty neat isn't it? A web page with source code written in C!

    Contribution

    Once I knew my hello world program worked, I forked the repository, created a new branch and added a new folder called WebAssembly. I copied my hello.c program in to it, saved, pushed it to my GitHub fork and made a PR.

    What I Learned

    From my understanding, WebAssembly is still in it's infancy but it has the potential to have a huge impact on how we code for the web. It essentially allows us to write code in a variety of languages which once compiled can run incredibly fast. Take a look at this excellent article on MDN web docs for more information on how it works.

    Conclusion

    I am excited to see how WebAssembly will develop and how people will use it. However, perhaps the most important lesson I learned from this PR was that you can learn something from even the smallest PR. Isn't open source wonderful?

    Cover photo by rawpixel on Unsplash

    by Dilan Guneratne at October 14, 2018 11:21 PM


    Volodymyr Klymenko

    Thank you for following

    Thank you for following 😀

    Is it a book by Apple? If it is, I’ve heard good things about that book!

    by Volodymyr Klymenko at October 14, 2018 09:03 PM


    Yeonwoo Park

    Hacktoberfest Contribution 2

    I was looking for another project on github, which has an issue with ‘hacktoberfest’ label, and found a project, called randomatic. Randomatic is the javascript pacakge, which generates randomized strings with a customized length and character sequences. I was interested in this project because the concept of regular expression is crucial for any programming languages in general, and it would be a great opportunity to learn about the javascript way of regular expressions.

    The issue was that it did not generate the randomized string properly when excluding character set was provided. See the issue here. I installed this module, and run the same statement as the issue filer provided.

    var randomize = require('randomatic');
    
    var arg1_str = randomize('*');
    var arg1_num = randomize(2);
    var arg2_second_option_chars = randomize('?', {chars: 'jonschlinkert'});
    var arg2_second_option_chars2 = randomize('?', {chars: 'jonschlinkert'});
    var rand2 = randomize('*', 10);
    var issue1 = randomize('*', 10, { exclude: '0oOiIlL1$^()_{}[];\',.' });
    
    console.log("arg1_str");
    console.log(arg1_str);
    console.log();
    
    console.log("arg1_num");
    console.log(arg1_num);
    console.log();
    
    console.log("arg2_second_option_chars");
    console.log(arg2_second_option_chars);
    console.log();
    
    console.log("arg2_second_option_chars2");
    console.log(arg2_second_option_chars2);
    console.log();
    
    console.log("issue1");
    console.log(issue1);
    

    The output of this code is :

    arg1_str
    ~
    
    arg1_num
    xf
    
    arg2_second_option_chars
    rjtkhnrlsoseo
    
    arg2_second_option_chars2
    oskthcocnsslo
    
    issue1
    ^O2m8QyZc+
    

    The issue1 string should not contain any characters in ‘exclude’ option, but it was not working. I checked the code file, and found the code block in the file ‘index.js’, which might generate this issue. Here is the code block :

    ...
      var opts = options || {};
      var mask = '';
      var res = '';
    
      // Characters to be used
      if (pattern.indexOf('?') !== -1) mask += opts.chars;
      if (pattern.indexOf('a') !== -1) mask += type.lower;
      if (pattern.indexOf('A') !== -1) mask += type.upper;
      if (pattern.indexOf('0') !== -1) mask += type.number;
      if (pattern.indexOf('!') !== -1) mask += type.special;
      if (pattern.indexOf('*') !== -1) mask += type.all;
      if (custom) mask += pattern;
      // Characters to exclude
      if (opts.exclude) {
        var exclude = typeOf(opts.exclude) === 'string' ? opts.exclude : opts.exclude.join('');
        mask = mask.replace(new RegExp('[' + exclude + ']+', 'g'), '');
      }
    
      while (length--) {
        res += mask.charAt(parseInt(mathRandom() * mask.length, 10));
      }
    
      return res;
    ...
    

    If the exclude option exists, eliminate the excluding characters in the variable ‘mask’ using RexExp object. I tested with different exclude character sets, and found that the process of eliminating characters was not running when the closing square bracket was added in exclude character set.

    var randomize = require('randomatic');
    
    var issue1 = randomize('*', 10, { exclude: '0oOiIlL1$^()_{}[];\',.' });
    var issue1_without_closing_bracket = randomize('*', 10, { exclude: '0oOiIlL1$^()_{}[;\',.' });
    
    console.log("issue1");
    console.log(issue1);
    console.log();
    console.log("issue1_without_closing_bracket");
    console.log(issue1_without_closing_bracket);
    console.log();
    
    issue1
    .JLz4M!ji#
    
    issue1_without_closing_bracket
    k3E#MxSteX
    
    

    So, I had to figure out the way to handle the closing square bracket for generating correct randomized string. First, I removed the ‘]’ character from exclude variable by using string replace method and RegExp object to apply the regular expression rules correctly. I had to use two back slashes to escape the character in the regular expressions.

    exclude = exclude.replace(new RegExp('[\\]]+', 'g'), '');
    

    It generates the mask character set including ‘]’, excluding user input characters. Also, I had to consider whether user added the closing square bracket or not.

    if(opts.exclude.indexOf(']') !== -1) mask = mask.replace(new RegExp('[\\]]+', 'g'), '');
    

    I tested and it generated correct randomized string.

    for(var i = 0; i < 10; i++)
        console.log(`Test ${i+1}: `, randomatic('*', 10, { exclude: '0oOiIlL1$^()_{}[];\',.' }));
    

    The output is :

    Test 1:  zH#uPhcUtF
    Test 2:  %zX!Fe8b6R
    Test 3:  TwPHTX-rH@
    Test 4:  Tf5jb=4qhA
    Test 5:  hAzTStQ-eH
    Test 6:  &v=aYaY9X8
    Test 7:  sYmHRCgQZa
    Test 8:  eejmMS5ZGS
    Test 9:  UYt7vz#xn8
    Test 10:  =enP#xKc-X
    

    Finally, I checked the test cases, and realized that there is no test cases for excluding ‘]’ character. I added two test cases for excluding ‘]’ character: providing as a string and as an array. I tried to follow the current writer’s coding style so that it looks like one person wrote this code. I run the test after, and it passed successfully.

      it('should generate a random string excluding right square bracket on the `exclude` option', function() {
        var actual = randomize('*', 16, {exclude: ']'});
        assert(test(/[^\]]{16}/, actual));
        assert.equal(actual.length, 16);
      });
    
      it('should generate a random string excluding array with one element(right square bracket) on the `exclude` option', function() {
        var actual = randomize('*', 16, {exclude: [']']});
        assert(test(/[^\]]{16}/, actual));
        assert.equal(actual.length, 16);
      });
    

    I submitted a Pull Request with the title Fix Issue #18 : Exclude not working. Currently, the owner of the repository has not merged yet.

    All the process of contributing to open source projects, including finding the code to start, fixing or improving, and getting a feedback from other people, really helps me solving the variety of issues. It also gives me a sense of writing a readable and efficient code by looking at other people’s codes. I think I am still hesitating to start working on big projects, and I am hoping that I get more confidence by working on more projects.

    by ywpark1 at October 14, 2018 07:43 PM


    Sean Prashad

    Hacktoberfest: Part 2

    Familiar faces

    The abundance of leaves on the ground signals that we are venturing further into October, and coincidentally, another week of Hacktoberfest. The community so far has nearly 50k participating repositories and over 150k pull requests opened:

    My stats are available at hacktoberfest.digitalocean.com/stats/SeanPrashad!

    Glancing at that graph makes me realize that I’m a speck somewhere in it all. It truly is amazing to think that I am part of something much bigger — that I as a student, have made an impact, no matter how small. And so armed with that confidence, I knew that it was time to dive once more into the sea known as GitHub.

    Familiar Faces

    Many of my contributions in the OSS realm have been for Mozilla — owners of Firefox, Rust, Pocket and 1,879+ other projects. In particular, I’ve thoroughly enjoyed giving a hand to the AMO community. The amount of patience and commitment displayed time and time again has been the key to my success:

    Mathieu Pillard — AMO Developer
    Andreas Wagner — AMO Developer
    Kumar McMillan — AMO Developer
    Stuart Colville — AMO Manager
    Matthew Riley MacPherson — Former AMO Developer
    Ioana — QA Team Lead
    William Durand — AMO Developer

    The list of individuals doesn’t just end there — there are many others like Alexandra, Caitlin, Rebecca, and Bob who are all helping behind the scenes. And so, this time around I wanted to return to familiar faces and help out where I could — next stop, AMO 🦊

    Choosing a Feature

    The contrib:welcome label helps to identify issues that don’t interfere with AMO’s release cycle and are beginner friendly. There was one in particular that was interesting to me — users could currently “flag” their own review:

    Attempting to flag my own review 🤪

    Essentially, this means that I can post a 5/5 review with a nice comment and then flag it for being inappropriate.

    While the current behaviour pops up a tooltip saying “You cannot flag your own review”, it would make more sense to completely hide that button altogether, right?

    Being 110% against self-induced harm, I sought out a solution to hide the flag button for reviews written by the same user:

    Hiding the “flag” button for reviews made by the current user 👍🏽

    Submitting a Fix

    The fix was quite simple and involved only a single line of code:

    flaggable && review

    became

    flaggable && review && siteuser && siteUser.id !== review.userId

    All we needed to do was check if the review belonged to the current user, and if so, simply hide the flag button:

    Ironically, the hard part was fixing up adjacent tests that broke after introducing this new behaviour. One key thing was to look at other tests that had been written. By doing so, I found breadcrumbs from similar tests that allowed me to copy-pasta and modify them accordingly.

    Fast-forward many hours later and my PR is now armed with a green checkmark from Travis and ready for a review:

    Final Thoughts

    I’ve come to learn that growth doesn’t just happen in new scenarios, but old ones as well. Interacting with new projects put my previously gained skills to the test (as well as my comfort zone). Revisiting past projects allows me to practice what else I’ve learned whilst I was gone. I consider it healthy to venture out and experience new things but to also reconnect with those who took you in when you first started.

    Cheers,

    Sean 👨🏽‍💻


    Hacktoberfest: Part 2 was originally published in Open Source @ Seneca on Medium, where people are continuing the conversation by highlighting and responding to this story.

    by Sean Prashad at October 14, 2018 07:42 PM


    Robert Dittrich

    Hacktoberfest PR #2

    The Project

    For my second pull request I just wanted to do a quick and easy fix. I had enough of cloning projects, builds failing, dependencies missing and just decided how about we update a README that sounds like it can be done without install 100000000 files. So I searched around and found the repository for HandBrake, HandBrake is an opensource video transcoder. Their main page had a docs repository which seemed just like the place to look.

    Issue

    It was actually quite easy finding an issue. It seems like this repo didn't have too much activity and the newest issue a month old. Conveniently the newest issue also didn't have anyone actively working on it so I decided to take a stab at it. It was just two misspelling fixes, created a pull request and that was it.

    Conclusion

    Even thought this pull request is pretty small I still feel a sense of accomplishment. Handbrake is a widely used tool and its nice to contribute to a larger project.

    by Robert D (noreply@blogger.com) at October 14, 2018 06:47 PM


    Yuecheng Wu

    Hacktoberfest – My Second Pull Request

    hacktoberfest_logo

    Hi guys, I am back with another blog post about my second pull request for the Hacktoberfest (You can checkout my first blog post here if you like). I feel really proud for what our class has achieved during the first week of Hacktoberfest. There are total of 286,781 lines of code added, 35 pull requests were merged, and 17 programming languages touched. It was a great success. Also, I was very surprised when my professor David picked out a part from my last blog post to show the class. It feels great to be acknowledged. These achievements have certainly motivated me to keep contributing to the open source environment.

    For my second issue and pull request I wanted to work on something that is more challenging than the first one. As I was looking through on Github for Hacktoberfest issues, I noticed issue #11 which titled “Cool modules” and in the description says “Anything goes”. I thought to myself, “this can’t be too hard, I have learned something about modules in my Web class.” Therefore, I immediately commented saying that I will give it a go which received a thumbs up from the repo owner (@svimanet).

    However, after I forked it to my repo and cloned it onto my local machine, I noticed all files in the modules folder have .py file format. This is when I realized the “Cool modules” actually meant Python modules! Before this, I have only heard of Python, but never learned or used it, so I thought “shoot, I may have dig myself a hole here.” As I was about to start panicking, I remembered during the class Professor David mentioned some students have tried something entirely new for their first pull requests, and that takes a lot of courage. This has given me some motivation because I believe if my classmates can do it, I can do it too. Therefore, I decided not to give up on the issue and try to tackle it instead.

    I started researching about Python and trying to learn all about it through online classes, documents, and tutorial videos. I actually found a couple websites that are very helpful (w3schools and tutorialspoint). These two websites have given all the information we need to know about Python with examples, so it’s very easy to follow and understand. The more I research about Python, the more I realized that the basics of the language is very similar to what I have learned in C++. This has given me a much needed confidence boost that I will be able to complete my pull request. Once I feel that I obtained enough knowledge about Python, I decided to create a simple Python module that will ask users to input a number, and it will find all factors for the number. It will also check if users have entered a positive number, if not, the function will find the absolute value for that number and print all factors for it. Here is the link to my pull request #14.

    After I completed my pull request, I feel very proud of myself because I have learned a new language which I did not think I was able to do at the beginning of this. This is why these open source events are so great, it forces us to go out there to learn new things and tackle new issues everyday. I truly hope the rest of my Hacktoberfest will be as interesting as this one.

    by ywu194 at October 14, 2018 06:18 PM


    Daniel Bogomazov

    Hacktober I

    This is my first blog post in my Hacktober Series. Throughout the next 5 blog posts, I hope to explain my introductory work into contributing to Open Source Software.

    What I Worked On

    For my first Hacktober Pull Request, I decided to contribute to Mozilla's focus browser for iOS. This is a browser written in the Swift programming language with the intent of an increased anonymized browsing experience. I looked through the issues and found one that I thought was simple enough to do within a week yet would provide a challenge. Fixing the bug wasn't as easy as I thought it would be - the solution wasn't too straightforward - but with the help of the existing code as reference, I was able to find a solution.

    I Think I'm Too Used To School Work

    When working on a project at school, the instructions are laid out for you. You know which functions to work on, what they should do, and what they shouldn't do. Working on OSS was a completely different experience. School work is straightforward and because of that I'd be able to jump straight in and code. Being used to coding in this way made my first day trying to fix the bug very frustrating. After a day of trying to fix functions that looked as if they could be related to the bug without success, I decided to look at it again the next day.
    This time, I decided to take my time. I removed all of my edits to the code and spent around an hour just reading the code and drawing out the dependencies. This finally allowed me to find a solution. In the future, I plan on spending a majority of my time reading the code, as opposed to my previous strategy of code first, read later.

    My Pull Requests

    by Daniel Bogomazov (noreply@blogger.com) at October 14, 2018 12:51 AM

    Hacktober II

    This is my second blog post in my Hacktober Series. Throughout these 5 blog posts I hope to explain my introductory work into contributing to Open Source Software.

    What I Worked On

    After my first Pull Request to Mozilla's focus browser for iOS, I saw that a new issue was opened in the repo - one that was very similar to the bug that I just fixed.

    I made a comment on the issue that I could work on it as it related very closely to my previous pull request and began to look through it. Unlike my previous work that took me a couple days to fix, this one took me less that 10 minutes. It was so closely linked to what I previously worked on that I immediately knew what the problem was and how to fix it.

    The fix itself was less than a line long - all I had to do was change the object that was being affected by the functions. I changed the code from addGestureRecognizer(singleTap) to textAndLockContainer.addGestureRecognizer(singleTap).

    When I first sent in the pull request, I undervalued the work a lot. I didn't think that a commit this small was anything to be proud of. But then I realized that this fix that took me less than 10 minutes to fix was only possible because of my past commit that took over 2 days to fix. If I tried to fix this bug without having fixed the previous bug, I'm sure it would have taken me much longer to figure out.

    Through this fix, I've learned that what may seem and look like a simple fix to someone who has worked with the code before, may not be as simple to someone coming in for the first time. It was also a very good introduction to how previous fixes are great at paving the road for future fixes.

    The more you work, the more you learn, the quicker and more simple fixes seem to be. The more you work on a project, the more familiar you become with how to continue improving it.

    My Pull Requests

    by Daniel Bogomazov (noreply@blogger.com) at October 14, 2018 12:48 AM

    October 13, 2018


    Brendan Hung

    Second Bug Fix!

    Hooray my second pull request has been submitted! (Well actually I did have one other one but I figured it wouldn’t count as a “good PR” since all I did was add one word to the document).

    This time I stumbled upon a project called AndHow, which is “an easy to use configuration framework with strong typing and detailed validation for web apps, command line or any application environment”. The issue had already been laid out and was meant to be a code cleanup: two modules existed in the repository which had very similar functions so one needed to be deleted.

    At the beginning I misinterpreted the issue and thought owner, “@eeverman”, was simply explaining the situation and only needed add a reference to the newer module to one of the .xml files. He was kind enough to clarify for me after I had initially submitted the PR. Finding the old module itself was simple enough with a quick search through the files, but finding out where the old module was referenced, and then replacing the references to that file with a reference the newer module took a while.

    I wasn’t sure exactly what to search for in order to locate the files: package name? class name? functions used? It also had a hard time figuring out what the .xml files were supposed to be doing since they referred to the modules as well. It also didn’t help that the repository was huge and had numerous nested folders with similar names, making navigation extremely difficult. It also overwhelmed me a bit since I was trying to figure out how all these files related to each other. After searching through all the .xml files I was really at a lost since none of them were referring to the old module.

    However, I then remembered that both modules utilized the same functions, so I simply searched for files that contained each function name and then scanned through them to see if they had already imported the new module.  At last I had finally found ONE file that was missing the reference and added it in. I then updated my PR with the new commits and it is now waiting for approval. Hopefully this time everything goes well!

    “@eeverman” was really nice: he thanked me for my initial submission and even apologized for potentially not being clear enough in describing the issue. At one point there was even someone else who wanted to take over and asked for authorization, but luckily “@eeverman” informed him that I was still working on it so he wouldn’t “steal” it. I have already witnessed quite a few issue where people would just submit PRs and not bother claiming them, making it rather unfair in my opinion. It is people like “@eeverman” that make me enjoy doing open source development work and he showcases the inclusiveness that this environment should be bringing. It also made me feel at ease and appreciated, especially being an aspiring developer, and want to continue doing this type of work. I hope that I will continue to work with people like him.

    by bhung6494 at October 13, 2018 10:07 PM


    Matthew Daniels

    Summoned to the Council

    The dawn breaks over the tips on the distant mountains bringing the warmth of its golden caress down into the forests of ancient growth. Joining and mixing with a gentle summer breeze to tickle the leaves and sway the branches to case a dancing pattern of rays upon the forest floor. Dancing and twirling through the trees the wind races across the land until the trees give way to a vast crystal lake sparkling in the dawn light. Small waves flow across the surface being coaxed to life by the winds spreading across the lake to lap against and rock a small ship having just set out from the docks. This ship glides across the surface towards a distant island.

    With  the crew tending to the sails maintaining a steady course there remains two figures clad in metal armor reflecting the light of the morning , gazing towards the island and particularly the city upon it’s heart. Similar in height, both with identical long braids of flame red hair, yet this is where similarities cease. Upon the left stands a woman of average height encased in brilliant steel with a heavy kite shield in her left hand while a rather heavy looking mace hands against her right hip. Her counterpart stands slightly taller and without a shield, yet held in her hand base set against the deck beside her foot stands a 6.5 foot tall pole-arm with a wicked curved axe head at its tips. There names are Nemea and Venya de Villefort, divine champions and paladins in the holy order of Iomedae.

    “Must we go through with this summons Sister?” Nemea asks as she gives no attempt to hide a yawn of boredom.

    “It is the will of our order Sister, the High Council requested to meet with us. I know not what to expect but a summons from the Council is not to be ignored.” her sister patiently replied, her gaze not breaking from the distant island.

    “Yeah… Yeah… But the others inside…. They say they have also received the summons and look at them…” Nemea mutters under her breath as she gives a short glance over her shoulder, back towards the main part of the deck.

    Back behind the twins in the center part of the deck, three other members have begun their journey to meet the Council. The three however could be no further apart in appearance. An older man, grizzled and grey stands eyeing the crew and the others on board. He stands straight backed, his uniform kept in pristine condition arms folded across his chest.

    “Come now, you upon the Mast! Adjust the rigging twelve degrees to port to capture more wind.” his gruff voice calls out from the deck.

    “Oy! Who do you think you are giving orders upon my boat?!” the angered voice of the captain calls from the stern of the deck. “The Misty Maiden by my ship and this do be my crew. Keep yer trap shut else you wish to swim to Fal’Morrena yourself.”

    “Hrumph” We are summoned to the High Council. That means no delays” His words fall upon deaf ears as the crew continues their normal work

    “They do travel these waters daily.” A voice of a higher pitch with a subtle squeak comes from the bench against the port railing. Hidden within blackened emerald green robes sits a small, well 4’2″ thank you very much, creature with a pointed muzzle and a pink tail wrapped around its furry feet. “Let them do their job without interference from us”

    “Well… I suppose if I must but they will know my anger if they make High Captain Ben Vimes late for an official summons.” The gruff officer known as Vimes grumbled as he walked towards the small figure. “Who are you Sir?”

    “I am known as Itzal de Dijon, a student of the Arcane Arts” the small creature known as a Ratfolk replied while pulling out a heavy leather tome and beginning to read.

    “Ruddy Wizards…” Vimes sighs as he turns off to study the last passenger upon the vessel. “So have you received one of these Summons as well?”

    There is no answer as the hooded figure sits with his back to the stern castle holding a well aged longbow in his lap. Reaching a hand into the pack set beside him, producing a folded parchment bearing the seal of the High Council.

    “This came to me guardsman. So I respond to the summons” a low voice emits from the folds of the cloak hood.

    “Ahh… I see, and that is Watch Captain Vimes not Guardsman” Vimes responded “And you are?”

    “Roland” The human face within the shade of the cloak answers.

    “Ahh … A man of few words eh Hunter? Well at least you aren’t one of those ruddy magic fools.” Vimes comments as his gaze sweeps across to the bow of the Misty Maiden. “That just leaves those two as unknowns.”

    “Sisters of Iomedea, both in duty and in family. Holy warriors judging by their armaments.” Roland utters quietly to the fussy Watch Captain. “I may be of quiet disposition yet these eyes are keen and sharp.”

    The Misty Maiden continued her morning voyage across the gently rolling waves, the cool morning breeze bringing the fresh scent of the lake to the air. With a gentle thump the hull of the Maiden bumps against the small travel dock. As the Crew busied themselves with lashing the boat to the dock and lowering the boarding ramp down to the deck. The Captain steps down from the stern castle towards his passengers. “There be a carriage there to take you to the city. Enjoy your travels and your time here at Fal’Morrena.”

    Making their way down the docks to wards the awaiting carriage the Watch Captain trying to scurry the other passengers along as if they were mere guards under his command, of course they are having none of it and make their way without marching to his step.

    “Well now, ladies of the Holy Order. Good to see that there are some well trained members that the council decided to summon.” Vimes boasted as he takes a seat inside the carriage across from the twin sisters.

    Rolling her eyes Nemea scoffs”Don’t get too friendly there old man.” With a shake of her head she laughs, checking to see if her sister is laughing with her, of which she is not. “So for all we have heard is your constant spout of nonsense about your disdain for the more magically inclined.”

    “See here little girl, it is common sense that a group all having received the same summons before the High Council that we will all be tasked with the same objective. As such it is then wise to learn about the allies one has before actual combat begins.” Vimes sighs as he straightened his coat after the carriage bounces over a rather deep rut in the road. “One would have expected better roads at the capital..”

    “Do you not know hot to speak without being condescending?” Venya asks as her eyes move from the window to stare at the Watch Captain. “As for everyone else here I am Venya De Villefort, Paladin of Iomedea as is my sister Nemea.” She performs a small salute with with fist to chest.

    “Anyone ever been here to the Capital before?” Nemea asks bit of a sparkle showing in her eyes. “We have been cooped up at the temple for years. This is exciting to get out and see more than the polished walls.”

    “I have not been back to the guild hall there in years but Fal’Morenna is a triple tiered city. ” the smaller voice of Itzal says, only slightly muffled by the book he is reading. “The lower ring is the Market District where the farmers bring their stock for sale. The second level is the Guild District where you can find craftsmen of types, also where the best inns are. The third tier is the Council District, also where the temples are located Goes without saying that is where the Council of Seven meets. Oh.. and it’s Itzal by the way.”

    “Sounds like a boring level…” Nemea sighed and turned her gaze back outside as the city of Fal’Morenna came into view. The stonewalls surrounded by farmland as the fertile land is being used to best effect as the capital ensures to be able to feed its citizens with minimal imports. As the carriage passed through the first tier gates the Market district comes to view with the dozens of hawkers cries about fresh pies or fruits off the vine, the scent of blood faint upon the breeze suggesting a butcher just down the street.

    The carriage continues up a gentle rise passing many blocks of smaller streets, homes for the shop owners and market workers as well as some of the lower class citizens who call this capital their home. Buildings of solid wooden construction only rarely having a second floor to them and of those most are in fact inns for workers in from the coast.

    Passing up through the second sets of gates to the Guild District the buildings still have their sturdy wooden construction with the majority of the tiled roofs reaching two and sometimes three stories. The smell of charcoal fires and the ring of hammer upon anvil can be heard from across the district between armor crafts, weapon-smiths, and general tool makers. The streets are a little more organized here than in the lower level yet still bustling with the busy morning routine.

    With a distinct change to the sound of the carriage as the third tier of Fal’Morenna is cobblestone streets and much more space here than in the lower levels. Mostly the third “Council” Tier is reserved for diplomats here to visit with the members of the Council of Seven. The large central hall known as the “Hall of Trials” made of marble walls and red clay stone stands before the carriage as it comes to a rest. doors opening as a porter gleefully announces “Welcome to the Hall of Trials. Jewel of the United Kingdoms and home to the Council of Seven.”

    “Right! Fallout everyone, rude to keep the council waiting.” Vimes proclaims as he jumps down from the Carriage to the cobblestones.

    “He sure likes the sound of his own Voice.” Nemea scoffs as she followed after Itzal.

    “As do you dear sister.” Venya chuckles as she steps down placing a golden coin in the hands of the driver holding the door open. “Iomedea’s blessings be upon you lad, thank you for the trip.”

    “Thank you milady!” he replies with a smile and a bow of his head.

    “C’mon now … Ah ruddy hell… You lot can catch up.” Vimes exclaimed as he turned and stormed off to the main doors.

    The tall arched doors of aged oak are pushed open as Vimes flashed the summons to the guards awaiting everyone to catch up to him at the top of the steps. After joining him each at a less hurried pace the group of Itzal, Vimes, Roland, Nemea, and Venya make their way into the temple for the first time.

    This large open room with tall windows and marble pillars is well lit with torch sconces upon the pillars. A red carpet is set forth before the entryway and leads across the halls towards the raised platform where the Seven Members of the High Council sit in their seat of power. The figures upon the seats are as different as the countries that they represent.

    The smallest of the council, a halfling sits in natural colours and an armor suit appearing to be made out of autumn leaves. Collam Willowbark the representative of Faerynch a Kingdom of rolling plains, sparse mountains and the remains of the Quartz Caverns. Faerynch, the Kingdom Collam calls home is the Eastern Country of the Continent of Loc’Lunar.

    A silver furred bipedal anthropomorphic cat sits with her ears twitching independently to each noise made in the grand hall. Of a race known as Catfolk Syren Dross while not wearing any armor more than a harness made of leather attached to a leather kilt. Scars across her arms and face perfectly explain the tall sword leaning against the side of her chair. Representative of the Country of Valencia, secluded up in the mountains of Dissalen. Buried deep in the mountains lies the closely guarded secret of Valencia, the secret of Black Powder.

    Taller than Collam yet still short, a stocky well muscled Dwarf sits clad in bright shining chainmail armor with a talisman of a hammer slung across his chest, a matching warhammer stands beside his chair. Representative of Dranoera from the Northern half of the temperate continent of Vastrova. A land with long mountain ranges, vast forest of Emerald Crystal trees and Sapphire blue lakes. An older and greying Dwarf Martin Dagarkin sits his chair and watches the party approach.

    Remarkably sitting aside the aged dwarf is the representative of Crystilix the Western Kingdom of Loc’Lunar and domain of the Elves, Caiden Silvermarch. Also clad in shining armor with weapons resting against the back of the chair. a lithe yet skilled Elvish fighter. Crystilix is where the massive Lunar Elms known to grow over 800 meters in height.. They also are where the Elves have their capital nestled among the branches.

    One of the two of the strangest members of the council is Magthyra Dawntracker. With a purplish hue to the skin, eyes of pure white, a long tail lashing impatiently around the legs of her chair. A tiefling representing the Land of Tar’Nally, a land of extensive deserts, emerald forests, and smaller mountains along the coast of Vastrova. While more plainly dressed than in armor Magthyra is from untalented.

    Second of the strange characters is a creature known as a Kitsune, or humanoid fox creature. Her yellow eyes vibrant against her dark red fur. Her chair has no back due to the nine separate tails she bears as a strong mark of her clan. Kyomi Moondancer, a dapper dressed woman with a thick belt slung across her chest and waist. Representative of the land of Malhaven upon the southern coast of Dissalen. While appearing unharmed there is a sparkle to her eye that hints at more beneath the surface.

    Lastly sitting center among the seats is Fenrir Greymane, a large Half-Orc showing noi weapons and wearing no visible armor. The representative of Gan’Doren, the sole country of Shaedora and home to both the human kingdom and the political power of the Seven Kingdoms. A landscape as diverse as its people where the lands of the Elves and Orcs shun the ‘half-breeds’, in GanDoren they are welcomed with open arms.

    “We thank you for answering our summons in such a timely manner. These are dark days…” Fenrir Greymane speaks as the group reaches the bottom of the raised dais.

    “The floating mountain of Nethyris is now once again cloaked in shadows.” Syren Dross pipes up. “A shadow which has been claiming any who come into contact with it.”

    Grumbling in agreement Martlin Dagarkin rasps. “Numerous trade ships and caravans have gone missing already. All attempts to locate these missing caravans have recovered the wagons and ships picked clean of drivers, crew, horses, and goods.”

    The musical voice of Kyomi Moondancer sings in the large hall. “And now, we have reports that the Temple of Prismatic Light has barred their doors no longer in contact with the Guild of Divine Light… This is troubling as the Temple is the resting place of the Celestial Skyknights.”

    “The temple going silent and shadows enveloping Nethyris once more are an ill omen… I fear a connection…” Caiden Silvermarch mutters, his hands clasp beneath his chin.

    As if these words had some magical effect the torches in the sconces shudder in a cold breeze bringing a tingling chill to the necks of all those present. Worried looks being passed between Roland and Itzal as they stood to the back of the group. Nemea and Venya catch each others’ eyes as the words of events outside their sheltered temple lives. Vimes is left standing tall and proud with his hands clasped behind his back, chin held high.

    “Hrumph.. I know nothing about this floating mountain. What did you call it … Nether?” Vimes questioned.

    “Nethyris you pathetic fool! Perhaps you should spend less time on your uniform and more time reading the histories Old Man.” A cold voice calls from back at the temple’s main entrance. Standing in the doorway thick shadows spilling down the stairs, creeping along the edges of the Hall of trials as mist begins to curl and lick the polished floor slabs, is the slender figure of a woman. Her billowing silver hair concealing at least half of her pointed ears and smooth ebony shin, red eyes a light as a smirk curls across her lips.

    Standing in a circle around her are ten hollowed eyed warriors clad in torn and rusted chain mail armor, dented steel shields held in one hand and long slightly curved blades gripped in the other. Pale blue light emits from sunken eye sockets on faces devoid of any flesh.

    “Guards! Seize this creature” counselor Greyback commands as he and the council members rise to their feet.

    “Your guards are mere door mice.” The woman cackled as two more shadows emerge from the doorway both dark of skin with the lithe elven form and white hair of the Drow. In unison they toss the bodies of the two guards down the steps. As they hit the floor their heads roll down the hall towards the council.

    As the council members gather their weapons to face these invaders to their seat of power. There is a loud crack as steel strikes the stone floor. Together as if on cue Nemea and Venya pivot to put their backs to the council as they step up to form a front line defense.

    “Protect the Council!” Venya calls as her halberd slams into the stone floor. Nemea following her sister’s lead with shield and mace in hand she clangs them together in a challenge. “Iomedea guides and protects!” she cries out, voice clear in this large hall.

    Behind the two Paladins the small form of Itzal stood eyes fixed upon the invaders, fingers already twitching and drawing symbols in the air before him. To his left Roland stands with bow in hand, arrow drawn to cheek as he looses the first strike, sending an arrow towards the male Drow at the left of the woman steel head and wooden shaft driving deep into his left shoulder.

    “Alright if you want to go right to fighting without even attempting to be diplomatic.” Vimes sighed as he turned to face the doors with the others.

    “They already tool the lives of the guards Vimes, or did you miss that much?” Rolland shouts as he dashes for cover behind a marble pillar a few paces to his left already nock a second arrow for flight.

    “Get them my pets, let their blood spill to the floor.” The leading Drow woman laughs out of pure arrogance. The skeletons spread out advancing upon the defenders, mist and shadows seemingly flowing in behind them as they move. Jaws chattering as the corpses amble into the fray. Swords lashing out towards the twin Paladins yet the blades are either turned aside by shield or shaft else the strikes do not find penetration against the armor the twins have adorned themselves in.

    “Venya! Watch the right. I’ll cover the left. Hit them hard before they spread out too far Wizard!” Nemea calls as she hoists her shield to deflect a strike responding with a vicious blow of her mace to a skeletal head which shatters beneath her strike.

    “I do have a name there Paladin, and that would destroy the hall itself if I release that here.” Itzal shouted in reply before flicking his fingers and uttering a few  arcane words as three glowing darts appear before his small hand before streaking off with a burst of speed streaking around Nemea and slamming into one of the approaching skeletons. Bits of bone blast apart from the impact leaving holes in the rib cage and skulls before it crumples to its knees.

    “Focus on the three at the back, the minions are nothing.” Roland calls out during the frey, as he looses arrows in rapid flights towards the three still standing by the door. Arrows bouncing off of a wall of force occasionally one strikes true leaving the male on the left upon his knees clutching an arrow in his throat.

    “Oh for the love of… I am tired of all this ruddy Magic!” Vimes yells in frustration. As the twins engage the wave of approaching horde, he reaches to his shoulder and tears free his cloak. A pair of leather bandoleers cross his silk shirt covered chest. Dropping his hands to his hips he draws free a pair of strange metal cylinders and aims them at the ebony skinned woman. “Taste my Magic you foul creature!”

    Thunderous roars echo off the walls of the temple flashes of flame spews forth from the devices in his hands followed by twin clouds of smoke. A scream from the male drow still upon his feet as blood bursts from a pair of holes in his chest. The scream gurgles to a close as he falls to his knees slumping down to the ground.

    “Oy! Warn a rat will you next time!” Itzal cries , holding his head in his hands. “These ears are sensitive!”

    “How about you figure out where that damn mist is coming from.” Vimes retorts as he raises his weapons to fire again, this time however there is only a soft metallic ‘click’ from each device. “Oh you got to be kidding me!?”

    Seemingly having recovered from the noise Itzal steadies himself with a wider stance, hands flicker before him as a small red ball the size of a marble appears in front of him. “Now pay attention ‘Watch Captain’ “Itzal says with a strong note of sarcasim as he looks towards the horde. “Burn..”

    The red marble streaks forward to the space between the skeletons and the Woman standing in the mist. As the marble reaches the spot Itzal aimed upon it bursts forth with a loud roar spreading out 20 feet in all directions scorching the walls, carpet, floors, as well as the invaders. Smoke billowing in the area blends and pulls into the mists.

    “What the hell?” Itzal stammers … “Avoid the Mists! They appear to be drawing anything close into them.

    “Well Now…” A voice sounds from the mists, as they clear the form of the woman stands there, her hair partially singed and burnt away. “So… the rat appears to have some intelligence. However my pets have kept you busy long enough.”

    From behind the council, the stained class windows all explode inwards as tendrils of shadow blacker than the Abyss burst forth and coil themselves around each of the members of the council. As they flail and thrash in a attempt to get free the tendrils of shadow begin to pull them out into the darker shadows outside the temple’s walls.

    Hearing the screams of the council members behind her Venya turns from the skeletons grunting in pain as a rusty blade finds its mark driving deep into the back of her left knee where the armor is weakest. Enduring the pain she rushes a few steps forwards the council and takes the holy symbol of Iomedea in her gauntlet-ed fist.

    “In the name of the Inheritor and by her holy light I drive back this vile darkness. Iomedea’s light come forth!” She calls, her voice ringing loud and clear as she addresses the heavens. A blazing golden light envelopes Venya and bursts forth from her causing the shadows to cringe and pull back from her. One of the tendrils gets brushed by the light and with a shriek it drops the council member it had captured. Yet the other tendrils succeed and manage to drag their charges out through the shattered windows and into the darkness beyond.

    “Vimes! Whatever you did, do it again the creature is fleeing!” Roland calls from the side of a support pillar loosing arrow after arrow upon the retreating woman yet his arrows fail to strike true, a arcane shield appearing to encase her form and protect her from harm.

    “The ruddy tumblers are jammed! I’m trying to get them unstuck.” Vimes growls as he kneels upon the floor a tiny tool in one hand attempting to clear the jam from the mechanism.

    As the shadows withdraw from the room and envelope around the creature she smiles. “Weaklings… the council are mine now.” her voice is a laughing whisper as the shadows enclose and swallow her from view before melting down into the ground as the rays of the morning sun poke out back from behind the clouds.

    With the silence now falling upon the Halls of Trials the desolation can be seen in full extent. The hall smoldering and burning with residue from Itzal’s fireball, blood sprays across the white marble walls, and smashed stained glass windows. Yet these pale in comparison to the major fact. The Council of seven has been attacked leaving only one member Martlin Dagarkin alive, breathing shallowly upon the floor of the dais, their former seat of power.

    End of Chapter One.

    by cdnpadawan at October 13, 2018 04:14 AM


    Allan Zou

    Contributing to something I use (Factorio Cheat Sheet)

    For my 4th pull request for Hacktober, I worked on the Factorio Cheat Sheet, a webpage which displays helpful information for Factorio, a game about building factories. (It’s a VERY addicting game, especially for programmers. Don’t play if you like having free time) This is the first time I contributed to something that I actually use and care about, which motivated me with more than just getting a school assignment done.

    Unfortunately for me, the project uses Angular, which I learned about in a previous course but almost completely forgot about. To summarize what it does, it’s a front end JavaScript thing (framework? library? I don’t know the terminology) that splits a webpage into multiple components which get data from each other, instead of having one giant HTML and JS file. This means there’s a lot of importing and exporting between files, which makes it much more complicated to work on than a simple HTML and JS file. One of the worst things about working on this (web development in general, not just Angular) is there is no IDE which checks syntax and give you warnings or errors. Often when there’s a mistake in the code the webpage still loads, but something just doesn’t work, such as data being blank or having the incorrect values.

    An example of error in an HTML file: ZreactorEfficiency a typo, the proper variable name is reactorEfficiency. But Visual Studio Code and Angular don’t tell me that. This is an obvious typo, but imagine if it were a small typo that went unnoticed. The data wouldn’t load and I would have no idea why.

    {{item?.ZreactorEfficiency}}%
    

    Screenshot: The webpage still loads, but the efficiency column is empty. Compare to the screenshot later which shows it working properly.
    CaptureThe most common errors are typos of variable names or data not being imported properly. A proper IDE would tell me when there’s a variable which is never used, or if I’m referring to a variable that hasn’t been declared, or many other errors. Visual Studio Code and Angular have no such functionality. I have to go through each file and manually examine where the error is. Despite how much I hate Angular and web development, I still put in the work and made my contribution to the project.

    My change was in the nuclear power section, where I added a new column which displays the efficiency of a nuclear power plant based on the nuclear reactor configuration. The math is done in the JS file which calculates the efficiency based on how much power a nuclear reactor configuration produces compared to how much it would produce if each reactor were operating individually. A reactor gets a +100% efficiency bonus when directly adjacent to another running reactor, so it’s optimal to have clusters of reactors placed together. Fortunately, I only had to add a few variables in the JS file and a few columns in the HTML file, so I didn’t have to do any complicated Angular stuff.

    When I submitted the pull request, the owner requested changes. The first was that I use an icon instead of just having text, and the second being in the JS file to use a variable which represented the power an individual reactor produces, instead of just hard coding it to be 40 MW. That way, if the amount changes, the code can be updated by changing the variable instead of having to change each hard coded number. I applied the changes and the pull request was approved.

    It was then reverted an hour later because there was an error with the lint tester. I ran the tester and found out it was because there weren’t two whitespaces where there should have been. Despite the inconvenience and pettiness of the reason for the error, I appreciate forcing everyone to use a consistent code formatting so the code doesn’t look like a giant puzzle put together by a bunch of random people. I added the two spaces and sent another pull request since the original was closed. As of this blog post the pull request is still waiting for approval.

    reactorEfficiency = power/(reactors * reactorPower);//before (failed tester)
    reactorEfficiency = power / (reactors * reactorPower);//after (passed tester)

    Screenshot of my addition (efficiency column)

    Capture2

    https://github.com/DDDGamer/factorio-cheat-sheet/issues/72

    https://github.com/DDDGamer/factorio-cheat-sheet/pull/74

    by azou1 at October 13, 2018 01:22 AM

    October 12, 2018


    Volodymyr Klymenko

    Hacktoberfest 2018 #1: Universal Ethereum Payment System iOS App.

    October has come, and while people around the world celebrate Oktoberfest, developers have Hacktoberfest for the whole month! 🎃

    What is Hacktoberfest?

    Hacktoberfest is a month-long celebration of open source software run by DigitalOcean in partnership with GitHub and Twilio.
    ● Hacktoberfest is open to everyone in our global community!
    ● Five quality pull requests must be submitted to public GitHub repositories.
    ● You can sign up anytime between October 1 and October 31. (Hacktoberfest official website)

    The best thing about Hacktoberfest is that first 50,000 developers who submit 5 Pull Requests will get a t-shirt and stickers! 🤩

    As you could notice, I have started making my first steps in open-source development, so Hacktoberfest is a fantastic opportunity to move on and make some more contributions during this month!

    Also, I have been learning Swift since last month, thus, I thought that it would be great to practice the skills I have and learn something new.

    That’s why I started to search for issues in iOS projects on GitHub. After some time, I found several projects to work on. The most interesting one was called DiveLane:

    matterinc/DiveLane

    DiveLane logo from https://github.com/matterinc/DiveLane
    DiveLane — Universal Ethereum Payment System
    Features:
    Let you be free from hard-bonded solution like (Laptop + Chrome + MetaMask + Private key) binding.
    No private key sharing needed! Store it at one place, sign anywhere!
    Full support of EIP-681 (URI scheme) Even more:
    Sign transactions and call arbitrary contract’s methods via deep links (from DiveLane documentation).

    As I understood, the project was created on a hackathon, and now it is in the stage of active development.

    There was an issue opened that asked to add Alamofire library to the project. I didn’t work with Alamofire before, moreover, I didn’t have any experience in adding libraries to the iOS project as I am still new to iOS development. This issue seemed challenging to me due to a lack of experience, however, I decided to challenge myself, and asked maintainers to work on the issue. I was kindly welcomed to contribute by app creators, and I started the work.

    My task was to replace all URLSession methods with Alamofire methods in the project. From my initial research, I found that there were 4 URLSession uses.

    I hadn’t done any networking in Swift before this PR, so I had to learn about URLSession, Alamofire, and why should I use Alamofire instead of native URLSession API.

    URLSession

    The URLSession class and related classes provide an API for downloading content.
    With the URLSession API, your app creates one or more sessions, each of which coordinates a group of related data transfer tasks. For example, if you’re creating a web browser, your app might create one session per tab or window, or one session for interactive use and another for background downloads. Within each session, your app adds a series of tasks, each of which represents a request for a specific URL (following HTTP redirects, if necessary).
    (Apple developer documentation)

    So, basically, this API enables developer to upload and download content via HTTP/HTTPS requests.

    Alamofire

    Alamofire is an HTTP networking library that is built on top of Apple’s URLSession. It is just an elegant way of networking implementation in Swift.

    Alamofire’s elegance comes from the fact it was written from the ground up in Swift and does not inherit anything from its Objective-C counterpart, AFNetworking. (Alamofire Tutorial: Getting Started)

    Why should I use Alamofire instead of native URLSession API?

    Alamofire makes the code cleaner as it removes the need to write boilerplate code.

    Now, let’s go to practice!

    After I forked and set up my local repository, the first thing I tried was building the app in Xcode. However, the build failed, but the error message was quite obvious and it let me know that dependencies are not installed. It was the first problem I faced. Nevertheless, solution was pretty simple. The project uses CocoaPods as a dependency manager, so I installed dependencies by running:

    pod install

    After the dependencies were installed, I was able to build the project.

    Process of creation a wallet.
    1 — Main screen with stored wallets. 2 — Setting tab. 3 — Wallets page in settings.

    Firstly, I had to install Alamofire to the project. I added Alamofire dependency in Podfile (file with all dependencies) by adding this line:

    pod 'Alamofire', '~> 4.7'

    Then, I ran:

    pod install

    Alamofire was successfully installed to the project ✅

    After that, I went through the files that had to be changed (I found four URLSession uses), therefore, I had to replace 4 methods.

    Here is an example of the change I made. Here is the chunk of code using URLSession:

    let task = URLSession.shared.dataTask(with: url) { (data, _, error) in
    if let data = data {
    do {
        let jsonSerialized = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
        if let json = jsonSerialized {
          if let conversionRate = json["USD"] as? Double {
            DispatchQueue.main.async {
               self.conversionRates[tokenName] = conversionRate
               completion(conversionRate)
            }
           } else {
              print("Can't convert to Double")
              DispatchQueue.main.async {
                   completion(0)
              }
           }
    }
    } catch let error as NSError {
              print(error.localizedDescription)
              DispatchQueue.main.async {
              completion(0)
      }
    }
    } else if let error = error {
           print(error.localizedDescription)
           DispatchQueue.main.async {
           completion(0)
      }
    }
    }
    task.resume()

    And I replaced the URLSession API with Alamofire library:

    Alamofire.request(url)
         .responseJSON { response in
               guard response.result.isSuccess else {
                    print(response.result.error!.localizedDescription)
                    DispatchQueue.main.async {
                         completion(0)
                    }
                    return
               }
               guard let value = response.result.value as? [String: Any],
               let conversionRate = value["USD"] as? Double else {
                    print("Can't convert to Double")
                    DispatchQueue.main.async {
                            completion(0)
                    }
                    return
                }
                self.conversionRates[tokenName] = conversionRate
                completion(conversionRate)
    }

    So much better, isn’t it? 🤩

    I did similar job in other classes.

    Next, I tested that the app works in the same way, and it was not really straightforward as there was not some kind of “CONTRIBUTING.md” in the project, so I had to figure out by myself how the app works. It took some time to understand how it works, but it was a good experience as I became more proficient in the iOS project architecture and Swift code.

    Actually, I, also, opened an issue in the project, where I asked the maintainers to add instructions for contributors.

    Finally, I opened my Pull Request, and it was merged to the project! 🎉

    It’s been such a great experience to contribute to this project, here are my outcomes:

    • learned CocoaPods
    • learned Alamofire
    • learned URLSession
    • understood code written by other developers
    • communicated with creators
    • successfully contributed to the project

    by Volodymyr Klymenko at October 12, 2018 06:49 AM


    Julia Yatsenko

    My first experience​ of contributing to Open Source project!

    Since my last my post here a lot of things happened and today I want to tell you about one of them. I created my first issue and made a first pull request in my life!

    I am recently enrolled in an Open Source course in Seneca College and one of the tasks was to create some tests for one of the Filer fs module methods. Filer is a Node-like file system for browsers. It has a lot of methods that’s are alike to Node JS fs module.

    I’ve spent a lot of time doing research on Filer and I’ve found out that there are no tests for fs.ftruncate() method. I’ve decided to file an issue about it. Then, I’ve looked on similar tests in Filer, researched more information about arguments fs.ftruncate() receives and decided to create four tests that check whether this method:

    • should truncate a file,
    • should return an error if the file descriptor is negative,
    • should return an error if the length is negative,
    • should pad a file with zeros when the length is greater than the file size.

    Even though I don’t know Node JS, I implemented these tests quite quickly. I think I spent twice as much time just trying to realize what my test will check than actually writing the code. As no tests for fs.ftruncate() existed before, I also created a new file for these tests and included it in the index.js file by adding a following line:

    require('./spec/fs.ftruncate.spec');

    This step is crucial as all test files should be included in index.js in order to run them. After creating every test I run all tests using the npm package manager, which I installed on my PC. I’ve used the following command: npm run test: manual  which basically build the tests and allow you to run them in browser manually by loading http://localhost:1234. When every single one of my tests was working I made a pull request.

    I’ve also had a lot of fun reviewing someone else pull request. In my opinion, this is a great thing about Open Source because it gives more possibilities for a community to find some mistakes. I’ve decided to review this pull request made by one of the students from my Open Source class. He made two tests for some method called fs.unwatchFile(). He already has got a comment that he did not include his newly created file in the index.js so I made this step on my PC. When I ran it, all of the sudden everything crushed! I’ve checked at his code — everything looked correct. Then, I’ve tried to research and read more about this method and guess what? There wasn’t such a method in Filer! I immediately write him a comment and on the next day a saw in our class discussion on Slack that this method accidentally was forgotten to be implemented and will soon be added to Filer!

    This experience definitely made me feel a valuable part of community and I’m excited to contribute more and more to Open Source projects!

    by yatsenkojulia at October 12, 2018 04:39 AM


    Nathan Misener

    SPO600 Lab 5: Algorithm Selection Lab

    For our SPO600 class my group (Galina, Fahad, Perry) and I looked at various ways of creating a volume application.
    The concept is pretty simple. Songs are a series of frequencies which we capture and record at around 48 thousand samples a second (sample being a numbered representation of the frequency). To adjust the volume we take that frequency and multiply it with a volume factor, the range is 0.00 (silent) to 1.00 (max volume).


    We were given source code (see below) that generates 500,000 random sound samples (about 10 seconds worth of sound), from there we adjust the volume to 75% of max volume. Our task is to take the original code and change it in 2 ways to alter it's efficiency and record the results of using a testing profiler program.

    Change 1: Use a pre-calculated lookup chart instead of multipling with a floating point number.
    Change 2: Use a fixed point value (whole number) instead of multipling with a floating point number then bit shifting it to get the result.



    #include <stdlib.h>
    #include <stdio.h>
    #include <stdint.h>
    #include "vol.h"
    
    // Function to scale a sound sample using a volume_factor
    // in the range of 0.00 to 1.00.
    static inline int16_t scale_sample(int16_t sample, float volume_factor) {
    	return (int16_t) (volume_factor * (float) sample);
    }
    
    int main() {
    
    	// Allocate memory for large in and out arrays
    	int16_t*	in;
    	int16_t*	out;
    	in = (int16_t*) calloc(SAMPLES, sizeof(int16_t));
    	out = (int16_t*) calloc(SAMPLES, sizeof(int16_t));
    
    	int		x;
    	int		ttl;
    
    	// Seed the pseudo-random number generator
    	srand(-1);
    
    	// Fill the array with random data
    	for (x = 0; x < SAMPLES; x++) {
    		in[x] = (rand()%65536)-32768;
    	}
    
    	// ######################################
    	// This is the interesting part!
    	// Scale the volume of all of the samples
    	for (x = 0; x < SAMPLES; x++) {
    		out[x] = scale_sample(in[x], 0.75);
    	}
    	// ######################################
    
    	// Sum up the data
    	for (x = 0; x < SAMPLES; x++) {
    		ttl = (ttl+out[x])%1000;
    	}
    
    	// Print the sum
    	printf("Result: %d\n", ttl);
    
    	return 0;
    
    }

    Here we are scaling the sample in the function called "scale_sample". This code is fairly straight forward, SAMPLES = 500000 which is contained in a header file.

    Here comes the first alteration.


    //Populate the lookup table
    static inline int16_t populate_lookup(int num, float volume_factor){
    	return (int16_t)((num-32768)*volume_factor);
    }
    
    static inline int16_t get_value_from_lookup(int16_t* lookup, int16_t num) {
    	return (int16_t)lookup[32768+num];
    }
    int main() {
    
    	// Allocate memory for large in and out arrays
    	int16_t*	in;
    	int16_t*	out;
    	int16_t*	lookup;
    
    	in = (int16_t*) calloc(SAMPLES, sizeof(int16_t));
    	out = (int16_t*) calloc(SAMPLES, sizeof(int16_t));
    	lookup = (int16_t*) calloc(SAMPLE_SIZE, sizeof(int16_t));
    
    	int		x;
    	int		ttl;
    
    	// Seed the pseudo-random number generator
    	srand(-1);
    
    	// Fill the array with random data
    	for (x = 0; x < SAMPLES; x++) {
    		in[x] = (rand()%65536)-32768;
    	}
    
    	//create the lookup(run-time) for all the possible samples
    	for (x = 0; x < SAMPLE_SIZE; x++) {
    		lookup[x]= populate_lookup(x, 0.75);
    	}
    
    	// ######################################
    	// This is the interesting part!
    	// Scale the volume of all of the samples
    	for (x = 0; x < SAMPLES; x++) {
    		out[x]=get_value_from_lookup(lookup, in[x]);
    	}
    
    	// ######################################
    
    	// Sum up the data
    	for (x = 0; x < SAMPLES; x++) {
    		ttl = (ttl + out[x])%1000;
    	}
    	
    	// Print the sum
    	printf("Result: %d\n", ttl);
    
    	return 0;
    
    }


    The biggest change is removal of the of the "scale_sample function" and the inclusion of the "populate_lookup" and "get_value_from_lookup" functions. "populate_lookup" takes all values from 0 to the maximum random number and multiplies them by 0.75. The idea is we do this multiplication once and store it. We can then look up the value (using "get_value_from_lookup") later without having to calculate it, ideally saving time. For the mostpart the code in main is similar except the loop where we populate the array.

    Let's look at the next change.

    #include <stdlib.h>
    #include <stdio.h>
    #include <stdint.h>
    #include "vol.h"
    
    static inline int16_t scale_sample (int16_t sample, int16_t volume_factor) {
    	return (int16_t)((sample * volume_factor) >> 8);
    }
    
    int main() {
    
    	// Allocate memory for large in and out arrays
    	int16_t*	in;
    	int16_t*	out;
    	in = (int16_t*) calloc(SAMPLES, sizeof(int16_t));
    	out = (int16_t*) calloc(SAMPLES, sizeof(int16_t));
    	
    	int16_t volume_factor = 0.75 * 256;
    	int		x;
    	int		ttl;
    
    	// Seed the pseudo-random number generator
    	srand(-1);
    
    	// Fill the array with random data
    	for (x = 0; x < SAMPLES; x++) {
    		in[x] = (rand()%65536)-32768;
    	}
    
    	// ######################################
    	// This is the interesting part!
    	// Scale the volume of all of the samples
    	for (x = 0; x < SAMPLES; x++) {
    		out[x] = scale_sample(in[x], volume_factor);
    	}
    	// ######################################
    
    	// Sum up the data
    	for (x = 0; x < SAMPLES; x++) {
    		ttl = (ttl+out[x])%1000;
    	}
    
    	// Print the sum
    	printf("Result: %d\n", ttl);
    
    	return 0;
    }


    In this code we create a "volume_factor" variable, which is 0.75 * 256. The concept behind this version is taking the sample, mutiplying it by a large number, then cutting off some of it. The result is a number that is very close to what it would be if it was multiplied by 0.75. Adding 2 whole numbers is way faster than dividing a number or multiplying by a decimal number.


    int16_t volume_factor = 0.75 * 256; //Sets up the volume factor number
    static inline int16_t scale_sample (int16_t sample, int16_t volume_factor) {
    	return (int16_t)((sample * volume_factor) >> 8); //We multiply by the volume factor and then bitshift 8 bits (essentially 256 worth of bits)
    }


    The reason this works is essentially this: lets take a random number: 392, in binary it looks like this: 110001000 Lets drop down to the next line;

    0110001000 //392
    0011000000 //0.75 * 256 = 192
    ************* //Multiply them up 10010011000000000 //Adds up to 75264

    10010011000000000 //Now what we do is discard the last 8 digits on the right
    100100110 //what we are left with is 294.

    Let's check our math. 392 * 0.75 = 294. Not too shabby.

    Time to run some tests.
    To read more, checkout the Test results Here

    October 12, 2018 04:22 AM


    Steven Le

    OSD600 Release 0.2

    Week 1

    In this Release 0.2, I did a lot of research and spent a lot of time on the communication channels of projects that I had wanted to fix and issue and file a pull request for. The prospects were: Tachiyomi: Free and open source manga reader for Android and Luma3ds: Noob-proof (N)3DS “Custom Firmware”.

    Over the first few days I entered the Tachiyomi discord and lurked my way around looking for possible issues to be fixed. I went over to android studio and went through a lot of strife in weird errors that the program would throw onto me. One of the many errors I faced was trying to get the android package (.apk) to be installed onto the virtualized android session. The error itself was too simple to find a sufficient fix. I left it for a couple of days and it just kind of fixed itself. I am unsure what happened but it was interesting.

    Over the couple of days I didn’t get much information for starting up (in android) along with other class obligations I was unable to get Tachiyomi into a state where I could change code and work on issues. Even so during downtime  I made my way over to the issue tracker. The issue tracker was very hard to navigate when it came to readability along with which issue was actually an issue, complaints of current additions and other threads which were not helpful for current issues to be fixed. Along with the troubles of navigating the repository, I did find some actual issues and but they were all way over my scope of knowledge (a common trend so far). Developing in Android is a prospect that I want to pursue but I do not currently possess enough knowledge to not break everything I touch (if it can even run).

    https://github.com/inorichi/tachiyomi

    The last 2 days of the week I took a look at Luma3DS, a project that was running on my Nintendo New-3DS. A couple of years ago I started following this project along with other custom firmwares being developed for the 3DS and hoped that I could make a contribution at a later date when I can. Learning from my mistakes of gauging a project only after you got everything up and running (if it was running), I went straight to the issue tracker and scoped out the issues present and trying to read and understand code. The issue tracker was fairly spammed with miss-informed users who had fringe cases of the software not running properly on their device which took a long time to sift through. Along with the fringe issue cases, I found that most of the current issues were interacting with the processors itself, similarly it is what I am currently learning in my SPO600 class. The problem is that I am currently struggling in that class and reading and understanding the assembly interactions was a painstaking process. The nail on the coffin for the unsuccessful week was that I had lost my 3DS and was unable to find it to even attempt it.

    https://github.com/AuroraWright/Luma3DS

    Prospects for the next week were to just head over to the list of repositories to contribute to and try and fix something small to catch up to the 5 repositories needed for the even we were participating: Hacktoberfest.

    https://hacktoberfest.digitalocean.com/

    Week 2

    This week of work was a lot more productive for me, I managed to get 3 pull requests done. The difficulty of the 3 vary quite a bit and it leaves me a bit bitter that I did not have the time to contribute to the 2 repositories from last week. This was due to my negligence and pressure to put up at least 3 pull requests this week.

    HacktoberMap is a Github repository where contributors added their name, location, the longitude and latitude of the location in order to populate a map. This repository mainly wanted to gauge and help out new people on Github get used to the hacktober event that was both interesting and fast to add/implement.

    https://github.com/abhijitparida/hacktobermap

    The second repository I contributed to was a reference dump for sorting algorithms and I quickly helped out by contributing selection sort using C++.

    https://github.com/naveentata/Sortings-in-different-Languages

    I spent the majority of my time this week contributing to Android-Jetpack Documentation. This was very different than the first 2 repositories that I contributed to earlier in the week. The author wanted to create an all encompassing reference document for getting started with Android related projects. I was tasked with adding Wear OS information in UI components. There was a video to take information but I spent the rest of the time scouring the internet for documentation of implementation and/or downloading example projects.

    I am thankful that although I wasn’t able to contribute to the Tachiyomi project, my android studio was set up enough to let me load up the example projects along with testing out Wear OS implementations.

    A lot of time was also spent on learning the intricacies of markdown as a language. I had tried a couple of online markdown editors, they were amazing to look at but the usage was very unfriendly. A lot of what I expected to be the right syntax was not displaying properly with a lot of time. I begrudgingly downloaded a program by the name of Typora. This editor instead of having 2 panes on the screen (one for coding and one for the preview) it shows you what the preview is when you are coding. It took a little over an hour for me to get completely used to it but afterward it was seamless. The syntax that would give trouble to online editors were easier to use, such as the code block implementation. When inserting a code block it adds the three ` symbols but keeps it in the background, shows you a rectangle to insert your code and at the end prompts for the language. All of this is compared to the online editors guessing whether a block of code was finished, leaking into other parts of the file.

    https://github.com/SyamSundarKirubakaran/Android-Jetpack

    All in all I feel almost content with what I have contributed to, I hope I can find projects in my knowledge range and also difficult.

    by Steven Le at October 12, 2018 12:45 AM


    Ebaad Ali

    Never did I think I’d be coding in assembly

    Ive coded in C more times then I’d like to admit. I know the 4 steps a C compiler takes and about assembly, but after the lengthy projects I’ve coded I didn’t even want to think how the complicated compilation (that’s a nice tongue twister ) code would look like. Assembler is still an interesting topic, so to explore it further I wanted to see how hard it would be to create a simple loop.

    These projects were done in 2 parts. First to print “Loop: 0 ” up until “Loop 9”.  Second to print “Loop: 1 ” until “Loop: 30” while suppressing any leading 0’s. This was done on an Aarch64, and a x86_64 platform to explore the difference in assembler code.

    x86_64 Assembler

    Posting the pictures from my terminal did not look pretty at all, so I copied and pasted the code here so it looks cleaner. I’ve posted comments on the lines but I’ll try to explain it in more details. Here’s a quick guide to the instructions used:

    Note some variables have a $, some have a %, and some have nothing at all.

    the ones with no prefix are user created constants (AKA: Immediate Values)

    the ones prefixed with a $ is a reference to those constants

    and the ones beginning with % means it’s a register

    read: x86_64 cheat sheet

    Project A

    .text
    .globl    _start
    
    start = 0                       /* starting value for the loop index; note that this is a symbol (constant), not a variable */
    max = 10                        /* loop exits when the index hits this number (loop condition is i<max) */
    cvt = 48
    
    _start:        /*    <--   This is a  LABEL    */
        mov     $start,%r15         /* loop index */
    
    loop:
        /* ... body of the loop ... do something useful here ... */
        mov    $len,%rdx  /* stores length of string in rdx */
        mov    $msg,%rsi   /* stores the actual string in rsi */
        mov    $cvt,%r14   /* storing the value 48 in r14 to display appropiate ascii value */
        mov    %r15,%r13   /* move value in r15 to r13   */
        add     %r13,%r14   /*  adding 48 to r13 */
        movb    %r14b,msg+6  /* since were storing a single char, use movb to write 1 byte, and store 6 characters to the right of our msg but only use the lower portion of that register   */
        mov    $1,%rdi      /*  store  status in rdi  and rax  */
        mov    $1,%rax
    
        syscall
    
        inc     %r15                /* increment index */
        cmp     $max,%r15           /* see if we're done */
        jne     loop                /* loop if we're not */
    
        mov     $0,%rdi             /* exit status */
        mov     $60,%rax            /* syscall sys_exit */
        syscall
    
    
    .section .data
    
    msg:     .ascii     "Loop:      \n"
             len = . - msg
    
    

    So the main thing to remember for this is that in order for us to print the actual digit we want displayed we have to add 48 to it to get the appropriate ASCII value. Anything starting with r is a register. Here’s a brief overview of the instructions used:

    Using a,b as parameters 

    mov is an instruction that allows us to move/load registers from a, into b. You can add arguments to this instruction such as movq (64-bits), movd (32-bits), modw (16-bits), modb (8-bits).

    add is an instruction that allows us to add a and b and stores the sum in a. 

    cmp allows us to compare and b and branch to a specific label using “jump” instructions”

    Jump Instructions

    jne (not equal), je (equal), jg (greater), jl (lesser), jmp (jump).

    The first four lines of the loop section is us loading up the registers. they have to be reloaded every increment, hence why its in this section. Register 15 is loaded with the counter, Register 14 with our conversion value, the length of the string in Register D eXtended, and the actual string in the Register Source Index.

    Since you dont want to mess the counter up, we have to copy r15 into another register (r14) , then add cvt to r14.  The next line is just to clean our output a little bit. If I had done mov  %r14,msg+6  it would have displayed our output in a single line. To give each increment its own line we stored the values one bit at a time by using movb, the b argument requires us to state whether we’re talking about the lower half of the register (stated by al  or r_b) which is why you see movb %r14b,msg+6, instead of a regular mov and a “normal” register number.

    syscall  “invokes a software interrupt or exception request which transfers control to the operating system kernel”(CDOT Wiki). To gain some better insight on how they work click on the link for a wiki about it on Seneca’s CDOT wiki.

    so far what I explained was just the first iteration. The last bits of the code is where we actually create the loop where we increment our counter, check the condition, then branch to the appropriate label using a jump command.

    If I haven’t lost you yet, then understanding the rest will be easy. The rest of this will be shorter since most of the things that needed explaining are out of the way.

    Project B

    Once I had that 0-9 printing I had a huge confidence boost and decided to try printing double digits while suppressing leading 0’s. Instead of 00-30 it would display 0-30. Here’s the code:

    .text
    .globl    _start
    
    start = 0     /* starting value for the loop index; note that this is a symbol (constant), not a variable */
    max = 31           /* loop exits when the index hits this number (loop condition is i<max) */
    cvt = 48
    d = 10
    
    _start:
        mov     $start,%r15         /* loop index */
        mov     $0x30, %r11
        mov     $d,%r10   /*loading "10" into r10 */
    loop:
        mov    %r15,%rax /*putting increment into rax because div requires dividend to be in rax */
        mov     $0,%rdx  /* div stores the quotient in rax and the remainder in rdx, this sets rdx to 0 */
        div     %r10      /*rax div 10  */
        mov     %rax,%r9  /* move the quotient to r9 */
    
        mov     %rdx,%r8  /* moving the remainder, which we needed to display 2nd digit */
        add     $cvt,%r8  /* add 48... */
        cmp     $0,%r9b       /* you can compare actual numbers using $ */
        je      print
    
    
        add     $cvt,%r9  /* add 48 to get proper ASCII char to display */
    
    
        movb    %r9b,msg+6
    print:
        movb    %r8b, msg+7
        mov    $msg,%rsi
        mov    $len,%rdx /*  position to display */
        mov    $1,%rdi
        mov    $1,%rax
        syscall
    
        inc     %r15                /* increment index */
        cmp     $max,%r15           /* see if we're done */
        jne     loop                /* loop if we're not */
    
        mov     $0,%rdi             /* exit status */
        mov     $60,%rax            /* syscall sys_exit */
        syscall
    
    
    .section .data
    
    msg:     .ascii     "Loop:      \n"
             len = . - msg
    
    
    

    The trickiest part about this was figuring out how to get the 2nd digit. It’s been a while since I’ve needed to do any math but turns out the solution’s simple. Divide the number by 10 and the remainder is our 2nd digit (magic of computers and the place value system). Actually, it’s not really magic of computers, but think of the decimal representation of our fractions. 3/10 is 0.3 which is actually a quotient of 0 and returning a remainder of 3.

    Luckily the compiler has instructions for operations. Div takes one parameter which is the divisor, and stores the quotient in rax and the remainder in rdx.

    Before performing the division we copy the counter (r15) to rax , and set rdx to 0 so we can store the remainder there. We divided by r10, copied the quotient to r9 and copied the remainder to r8.

    Now I know I said the trickiest part was getting the 2nd digit, but what actually took me the longest to figure out was the suppressing leading 0’s part. Sure 00-30 is good, but it wasn’t good enough. You can’t display your results in a messy way. At first I didn’t think this would be that hard because all I had to do was use cmp to see if the first digit was 0, and if it was only print the 2nd digit. Hours of me trying to get the jump instruction to work as intended until it finally dawned on me I had overlooked that the register I was comparing was loaded with the ASCII value. After copying the quotient to r9, I copied the remainder to r8, and converted r8 to its ASCII value for display. THEN I did the compare, and branched to the print where it would print the 2nd digit if r9 = 0.

    All in all, this was actually pretty fun! Not as complicated as you would think but I’d hate to see what a binary tree or a list would look like in this.

    Aarch64 Assembler

    same projects, different assembler. Not much different but still very different. This time around I kept the code the same for suppressing leading 0’s and just changed the max . Key things to remember for this assembler are:

    r,x,w (0-30) are used for registers. Register ’31’ is one of two registers depending on the instruction context:

    • For instructions dealing with the stack, it is the stack pointer, named rsp
    • For all other instructions, it is a “zero” register, which returns 0 when read and discards data when written – named rzr (xzr, wzr)

    read: Aarch64 cheat sheet

    **registers and immediate values have no prefixes

    the MAIN thing to understand here is that the source and destinations are different from x86_64. Whereas x86_64 has the destination as the 2nd argument, Aarch64 has the destination in the 1st argument. for example:

    add r1,r2,r3    ———–>   r1 = r2 + r3

    That being said, here’s the code:

    
    .text
    .globl    _start
    start = 0       /* starting value for the loop index; note that this is a symbol (constant), not a variable */
    max = 10                /* loop exits when the index hits this number (loop condition is i<max) */
    ten = 10
    
    _start:
            mov     x19, start  /* load start into x19 */
            mov     x22, ten   /* load 10 into x22 */
    
    loop:
            adr     x1, msg       /* load address label of msg into x1 */
            mov     x2, len       /* load length of msg in x2 */
            mov     x0, 1         /* stdout */
            mov     x8, 64
            svc     0
            adr     x23, msg
            add     x19, x19, 1      /* loads x19 with x19 + 1  ( the increment ) */
            udiv    x20, x19, x22    /* unsigned divide the increment by ten  and load into x20 */
            msub    x21, x22, x20, x19 /* x21 = x19 - (x22 * x20)   this formula helps us calculate the remainder */
            cmp     x20, 0   /* see if its 0, because we want to supress leading 0's */
            beq     skip     /* if yes, print second value only */
            add     x20, x20, '0'   /* cvt to ascii */
            strb    w20, [x23,6]  /* stores a single byte to the address pointed by (x23 + (0 * size ) */
    skip:
    /* 2nd digit */
            add     x21, x21, '0'
            strb    w21, [x23,7]
    
    /* loop check */
            cmp     x19, max
            bne     loop
            mov     x0, 0
            mov     x8, 93
            svc     0
    .data
            msg: .ascii  "Loop:  0\n"
            len = . - msg
    
    
    

    the div instruction works different too; we used udiv for unsigned division. On Aarch64 you have to calculate the remainder yourself, again the magic of math:  remainder = dividend – ( divisor * quotient ).  So I used register x21 to store the remainder.

    for details about the rest of the code check out the comments, and if you have any questions drop a comment!

    by ebaadali at October 12, 2018 12:38 AM

    October 11, 2018


    Julia McGeoghan

    The shadow of the ruins looms above, filling you with determination.

    This is the first in a five part series where I write about my first Hacktoberfest experience.

    For context, Hacktoberfest is a month long event where the objective is to contribute to one or more open source projects through five different pull requests. And, if you happen to be among the first 50,000 to do so, you get a free shirt among other things. Nice!

    To start my journey I needed to pick a project and issue to work on. Immediately my mind rushed to big name applications, ones I’ve used before, or ones I’ve noticed and simply liked.

    However as I looked through these projects — and many others like them — I found myself intimidated by the types of reported issues they had, or even lack thereof. I knew that I wanted this first of five issues to be one that was fairly easy to work on, something manageable in a short time-frame. That way I could save the more difficult ones for later in the month, when I had a better grasp of things and the time to spare.

    So I decided to search for an issue through github’s search function . In doing that I came across Zen Audio Player, an application that allows users to listen to youtube audio without the video. It looked very inviting; from the issue I eventually chose I could see that the project had recent activity and was aware of Hacktoberfest.

    So I ‘claimed’ the issue and got to work.

    However, as I made progress, I ran into a setback; the root causes of the problem seemed unrelated to what was outlined in the original post. This ended up being frustrating for two reasons:

    1. Since I’m fairly new to creating pull requests, I often wondered if the errors were a result of me replicating the issue wrong, since they weren’t what was outlined in the original post
    2. The issues were outside the scope of what I thought I needed to know to work on the project, since the error was said to be related to a single dependency and code in the test files, not anything related to the project’s main implementation

    But this is often the nature of software related issues; they can’t always be figured out at a glance. And so, embracing the unexpected, I continued on.

    Through it I learned more about headless browsers. Why the latest dependency isn’t always the greatest choice. How a combination of html’s audio element and an existing libraries can create feature-rich audio players.

    And when I was done I created my pull request, which was merged. But I was a bit disappointed; I hadn’t written any noteworthy code. Sometimes when I look at the things I write I’ll feel some sense of pride in my improvement as a developer, or in the efficiency of how I solved x problem. This was not one of those moments. And the worst part was that it solving this issue wasn’t as straight-forward as it looked either. However, it was reassuring to know that I helped make a project out there that one bit better.

    I want to do more, do better, and normally in this sort of situation a sense of determination would rise from within me to do so; I would decide to take on a more intimidating pull request. I would rise from the ashes, catapulted by sheer grit to overcome any obstacle. To climb the highest mountain, sail the stormiest sea.

    But, for now, I want to get some easier stuff out of the way before trying anything too ambitious. If you want to see if part two was everything I was hoping it’d be, click here.

    by Julia McGeoghan at October 11, 2018 11:27 PM


    Xuan Dinh Truong

    OSD600_Release0.2_Hactoberfect_Post1

    In this Release 0.2, my first issue and pull request was about Minimal-Todo application.  This is a free Android app, so if you are interested in this app, please feel free to Google Play to install and play with it. This is a simple useful reminder app. You can easy make a reminder just a few steps. Also, it has a nice simple design, so it will be easy for anyone to use it.

    First, I downloaded it to my phone and played with it. After that, I have searched for the issues. I saw many people trying to contribute for the language support, so I am interested to contribute on Vietnamese language support and had filed an issue (Add Vietnamese language support #98) and asked for permission to work on it. I followed the instruction on my lab1 to work on this application:

    Unfortunately, my pull request was failed. I asked the app author (Avjinder) about the reason and got his response through email.


    Finally, I got merge for this issue merged .
















    .
















































































    by Dinh Truong (noreply@blogger.com) at October 11, 2018 04:45 PM

    October 10, 2018


    Allan Zou

    Release 0.2 blog post 3 (Codezilla)

    My third issue/pull request was for the Codezilla project. The project is a collection of various algorithms and programs. Unlike the previous one I worked on which was written in Javascript, this project uses many different types of code, and some programs like merge sort are written in multiple languages such as C++ and Java. My pull request was to add a readme file to the linked list folder. The readme I added has a simple description of a linked list and two diagrams I stole got from Wikipedia. Unlike previous times I got images from Wikipedia or whatever I could find on Google images, I looked at the image license and found it was under a public domain license, which means I can do whatever I want with it. I did this because I learned about open source licensing in class, and it might be important.

    Issue: https://github.com/Asiatik/codezilla/issues/326

    Pull request: https://github.com/Asiatik/codezilla/pull/327

    I ended up not working on the project which I mentioned in the previous blog, Active Forks. When I downloaded the project (which was basically an HTML page and a JS file) The search button didn’t do anything when I opened the HTML file. Now when I do it there’s an error that says API rate exceeded, even on my first press. Fortunately, I’ve found a new project that I’ll almost definitely be contributing to (and have already made an issue and pull request): Factorio Cheat Sheet by DDDGamer.

    by azou1 at October 10, 2018 11:22 PM


    Minghan Xu


    Michael Overall

    Sometimes The Setup is Harder Than The Change




    I found myself trying to look for a relatively simple pull request to get warmed up to Hacktoberfest. After a fair bit of poking around, and prodding at an issue in another repo for a library that I had actually used as an end user over the summer, I found an issue that looked relatively straightforward to help me get my foot in the door in a new and unfamiliar repo.

    The issue was to change some styling on a search page to help differentiate clickable menu items from non-interactive headings. The creators of the repo did a good job in providing a screenshot, and working link to running code that illustrated the issue here. They also provided a quick start guide for setting up the coding environment, and some additional tips on working with the virtual machine that comes with the repo.

    The project I aimed to contribute to is LibreCores, a website that hosts open source electronic hardware designs. The project is written in PHP using the Symfony framework. For its development environment, it uses Ansible and Vagrant to launch an Ubuntu virtual machine that runs an NGINX server that updates much of its content live as you make changes to the code.

    In other words, the project has a fairly impressive setup to allow developers to reliably test their code in a highly portable development environment. Portable--that is--if you either have a hardware machine running Ubuntu, or a similar Linux distro, or if you have a hypervisor software that can run a 64 bit virtual machine inside another 64 bit virtual machine. While some offerings from VMWare can allegedly do nested 64 bit VMs, being a VirtualBox user, I seemed to be out of luck. It had dawned on me that my current laptop was a bit short on space to install yet another virtual machine, so out came an old laptop mostly constructed of superglue and the blind optimism of a student too cheap to buy a bigger hard drive.

    After reformatting the hard drive on my plastic lump of thriftiness, and installing a new copy of Ubuntu 18.04, I set out to get the development environment running on my machine. This both was, and was not, straightforward. As mentioned, the main contributors to the LibreCores repo had take the time to set up a decent set of instructions, and they had even taken the care to create a nice bash shell script in the repo to install the bulk of the dependencies (Vagrant, Ansible, VirtualBox and an accompanying Ubuntu image, etc). What was not immediately clear from their instructions, however, was that the LibreCores site uses an API called Algolia to provide search functionality for LibreCores' database of hardware. Algolia allows you to create related schema of objects, and to define how the priority with which they are retrieved in response to certain search keywords. Access to the Algolia API was not provided directly with the repo, and this was what populated the one part of the page that I wanted to change for the issue I was working on.


    The idea was that devs were either supposed to provide their own API secrets and app IDs to allow the app to interface with Algolia (however only user authentication was mentioned in the Quick Start guide). This was easy enough to do so I created a trial Algolia account, copied over the necessary secrets, to the code I was working on, and realized that I had no idea how to get data from the LibreCores code repository over to Algolia. There was documentation that allowed you to run some commands that copied the schema ("Indices") over to Algolia so that data was defined, but if starter data was provided, I had no idea how to get to it, as all the MySQL database the project came with was also empty aside from the table layouts.

    In the end, I remembered that the nice fellow who wrote the original issue had provided a link to a live version of the part of the app I was supposed to look at. While I certainly couldn't make changes to this without far more knowledge in subverting computer security than I'm currently blessed with, I chose to open the developer console in my browser, and steal all that precious JSON that came back as a response from the example search query that example server was running. It was then a (fairly) simple manner of going into Visual Studio code, and taking advantage of their "jump to bracket" hotkey (Ctrl + Shift + \ ) to cut off some of the wrapping JSON and get at the pre-packaged JSON objects I was looking for. These were then loaded into Algolia via my account dashboard through my web browser.

    ...Oh, right... And then I changed about 18 lines of code in 2 files and submitted a pull request.

    by Michael Overall (noreply@blogger.com) at October 10, 2018 06:47 AM


    Victor Kubrak

    Hacktoberfest First Pull Request

    I contributed to Hacktoberfest game. Here is the list of actions that must be done to take part in the game:

    •  I have asked for this issue, and was assigned it
    •  I have properly filled the "Details" section above arrow_up
    •  I didn't modify any test case red_circle
    •  I have implemented the function and all its tests pass white_check_mark
    •  I have added a new test case for someone to implement new
    •  I have created an issue for my new test case speak_no_evil
    •  I've star the repository (or not, all up to you)
    •  And more importantly, I've had fun! beer

    To sum up, you need to solve a problem and to create a new problem that someone else will solve. The idea is that there are always available problems and everyone can start contributing to public repositories.

    The Problem I solved

    issue-527 pull-567

    I wrote a function that takes unknown number of arguments and returns true if it contains any duplicate argument values. Otherwise, returns false (if all arguments are unique).

    The algorithm is very simple:

    1. Go through the array of arguments for (let i=0; i<args.length;i++)
    2. For each argument go through the rest of the array for (let j=i+1; j<args.length;j++)
    3. If found the same argument, return true if (args[i] == args[j]) return true;
    4. If did not find any duplicates, return false return false;
    Full code:

    export const duplicatedArgs = (...args) => {
    for (let i = 0; i < args.length; i++)
    for (let j = i + 1; j < args.length; j++)
    if (args[i] == args[j])
    return true;
    return false;
    };

    Problem I suggested

    I suggested to write a power function. It is recommended that this function
    works faster than O(n).
    Here are tests for power():

    describe('power', () => {
    it('returns 125 for base 5 and power 3', () => {
    expect(power(5, 3)).toEqual(125);
    });

    it('returns -125 for base -5 and power 3', () => {
    expect(power(-5, 3)).toEqual(-125);
    });

    it('returns 1 for base 5 and power 0', () => {
    expect(power(5, 0)).toEqual(1);
    });

    it('returns 5 for base 5 and power 1', () => {
    expect(power(5, 1)).toEqual(5);
    });

    it('returns 1048576 for base 2 and power 20', () => {
    expect(power(2, 20)).toEqual(1048576);
    });
    });

    I recommend everyone to take part in this game, because it suits for your
    first pull request on Hacktoberfest and it's not hard.
    You can also use this game if you need help with some functions: just create
    an issue with function description and someone will write it.😊

    by Victor Kubrak (noreply@blogger.com) at October 10, 2018 04:06 AM


    Andriy Yevseytsev

    Hacktoberfest Part #1 (1st PR of release 0.2 and lab 3)

    It is a beginning of Hacktoberfest in the world...and DPS909  release 0.2 in Seneca College! :)

    Hacktoberfest is a worldwide fest that motivates open source programmers to boost up their skills in the community of contributors. This month-long open source fest is going on in partnership with GitHub. Moreover when you reach 5 pull requests you will be able to get a branded T-shirt!

    In Seneca College we celebrate it as well during our DPS909 course and release 0.2! (As well, first PR of release 0.2 is a Lab 3)

    Pull Request #1 (Lab 3)

    After researching different Hacktoberfest's open source projects on GitHub I decided to take something easy for the first PR. I have found the repository where the owner asked to add a hello world code in any programming language that I know.


    After looking through the repository I have found out that there are no Pascal code and I created the comment in the issue that I will take it:
    After completing the code I created the pull request.

    But owner of repository merged the pascal code that was created by other contributor after my pull request, then owner marked my code as "duplicate" and "invalid".




    I found out this very weird and asked the owned in comments to my pull request why he did it, but unfortunately haven't received any response.

    I hope this situation will teach everybody who enters the open source community to be careful and choose projects that at least seems to be good managed and trusted.


    by Andriy Yevseytsev (noreply@blogger.com) at October 10, 2018 03:59 AM


    Shawn Mathew

    DPS909 0.2 Release – Pull Request 1

    My first pull request was on a new language I have not worked with before called Ruby. Ruby is a dynamic, interpreted, reflective, object-oriented, general-purpose programming language. Ruby supports multiple programming paradigms, including functional, object-oriented, and imperative. It also has a dynamic type system and automatic memory management. I chose to work with Ruby because it was a chance to work with something that I have not worked with before. The following is the issue that was posted that I decided to work on. 

    Fix error character “!” event not found #4

    The program that had to be fixed was not exactly a difficult concept. Using Ruby, the user can enter text into the command line after compiling the program, and that text would be converted into giant text using certain symbols found on the keyboard, like the following. If no text was entered then the string RUBY LETTERS would be displayed.

    HelloWorldOpenSourceRubyLetters

    So the text within the quotes would be read from the command line, then the program would go through each character within the quotes. Each character would be matched with what is stored in the array of characters in the program. An array will be formed containing references to the collection of characters array and each element will displayed beneath the commands. 

    The issue that I chose to work had to do with an exclamation mark. As you can see, when an exclamation mark is included in the string, you get the following error.
    -bash: !": event not found

    HelloWorldFail

    So the first task in fixing this issue was to clone the repository, create a branch, and reference the issue in that branch. After completing all of the necessary tasks for the initial GitHub phase, I studied the program file letters.rb. I learned how the user designed the program and decided which areas of the program that I could change to help fix this error. I thought by manipulating the string from the command line would help but it didn’t. I tried manipulating the user input string, or the string when an exclamation mark is called from the collection of keyboard symbols would work but it did not. So I resorted to the last tool which is used whenever I run into a dead end, which is Google. I looked through different forums to figure out why the exclamation mark was not found. It turns out that the exclamation mark is not allowed in bash. That is not entirely true. The exclamation mark is part of history expansion in bash. What does that mean? History expansion is performed immediately after a complete line is read, before the shell breaks it into words. History expansion is the first stage of processing, even before shell parsing, which is why double quotes don’t protect ! the latter is processed before double quotes. It is handled by the history library, which implements its own parsing, with a few ways of protecting the history operator. By the time the shell’s parser starts handling a string, it’s already been parsed by the history library and history expansion has already taken place. Enclosing characters in double quotes " " preserves the literal value of all characters within the quotes, with the exception of $, `, \, and, when history expansion is enabled, !.

    It turns out that the issue that I took upon myself did not required any code to fix the program because the program did not need any fixing from the beginning. It turns out that all the user has to do is enclose the string in single quotes to avoid the error: -bash: !": event not found

    By using single quotes ' ' the user can escape the history expansion character, but the history expansion character is also treated as quoted if it immediately precedes the closing double quote " " in a double-quoted string. In the following examples, the strings are enclosed in single quotes ' ' and contain exclamation marks. 

    NoProblem

    Since there were no changes that had to be made to the code, I decided to add a character since that was the first issue that was made regarding this repository. The character that I added to the collection of characters was the equals sign =

    Add special characters #1

    The equals sign was simply two lines of underscores and after testing my addition to the program I made sure to add the changed file, commit, push, and finally make the pull request. 

    AEqualAExclamation

    Pull Request – Fix #4 Use ‘ ‘, Add equal #18

    In my pull request I left a description of why the exclamation mark would return an error and I mentioned to use the single quotes ' ' from now on to avoid any further errors. I also made sure to reference the very first issue issue that was filed which was to add special characters since I added the equals sign to the program. 

    After completing this pull request, I feel that I am starting to become more comfortable with GitHub and Open Source in general. It was a bit intimidating at first since GitHub is relatively new to me, and there are so many languages out there that I have not worked with so working on an issue that was created by someone that I don’t know, in a language in which I am inexperienced was a bit terrifying. But after studying the code and doing the research I don’t exactly feel intimidated to take on new tasks in the future and I am confident that I can complete this release on time.

    References

    Bash Reference Manual: History Interaction

    Ruby

    by Shawn at October 10, 2018 03:21 AM


    Alex Kong

    First Hacktoberfest PR: From Docker to a Readme Edit

    For those unaware, Hacktoberfest is a public event with the aim of increasing open source involvement and if you create 5 pull requests during the month of October you will recieve a shirt for your participation.

    For my initial pull request I wanted to look for something related to Docker.

    Quick Docker Intro

    Docker is software that standardizes software by putting it in “containers” which allow it to run on any operating system that can run Docker. Docker creates a virtualization layer above the host operating system which runs a “container” which contains the software and it’s dependencies. This modularizes code so a developer doesn’t need to worry about OS inconsistencies or missing prerequisites on a client machine.

    The Issue

    So through the is:open label:hacktoberfest label I found the issue Use Node 9.x in docker image. So my first order of business was to setup a development environment based on the instructions provided in the Readme. Then I proceeded to verify the facts provided by the issue. Looking at the Dockerfile the code does use the node:slim image with no defined version number so in theory changing that should force a newer version number to be used.

    So I tested the change:

    INTERLUDE!

    As I was waiting for the image to download I decided to look at the contribution guidelines in the README.md.

    This lead me to:

    Yup. That doesn’t look right. Through the search bar I found where the CONTRIBUTING.md was so I decided to create another pull request amending it.

    Now back to my main issue

    Now that everything was up and running I needed to check the version of Node used by the Docker image. I do this by SSH’ing into the Docker image so I can run node -v . To do this I need to run the docker exec command with the -it options which allows for interactivity and allocates a psudo TTY. However before I can do that I need to find my container ID. I do that by executing docker ps

    So now that I have that I can execute docker exec -it 16bf31dd288a /bin/bash

    which makes me enter the bash shell of the Docker image. So now I can run node -v

    Wait a second v9.2.0? That’s not right. The good news is the Node version is version 9 which is the version that the issue wanted BUT it’s not the change I made. But if that’s the case, where did this change come from? Docker should have grabbed the node slim 10.11.0 image so why didn’t it? Let’s take a look the docker-compose.yml which dictates what’s run by docker-compose up .

    That’s odd, so the project uses an image from the alaxalves/front repository. As this is a built image I can’t check what’s inside it so the best I can do for now is to comment on the issue to ask if there is a particular reason why the Dockerfile isn’t used in the current version and if that is a change we should make but until I get an answer there isn’t much I can do.

    by Alex Kong at October 10, 2018 03:01 AM


    Joshua Jadulco

    1st PR for Hacktoberfest 2018

    Introduction

    For my first PR in joining Hacktoberfest 2018, I decided to work on an unknown simple project: https://github.com/DipanshKhandelwal/my-zodiac-sign . It’s a simple website made with HTML5, CSS3, and React.js that will display the corresponding Zodiac sign according to your birthday. Although it is plainly simple and at hindsight seems like an insignificant project, I chose to work on this project for the following reasons:

    • To learn first-hand about React.js code and break it down
    • To brush up my HTML5 and CSS3 skills, particularly when using it for design
    • To gain a glimpse of how other people’s codebase and coding style differ from mine

    The Project

    The project itself is pretty simple and the codebase is composed of three components:

    • the static page that will serve the content which is index.html
    • the CSS3 files that will handle the customizations
    • the JavaScript files which will contain the React.js code

    Since the Issue ( https://github.com/DipanshKhandelwal/my-zodiac-sign/issues/11 ) I was working on was primarily concerned with design, I set out to the CSS3 component and thought it would be an easy task which later turned out to be mostly true – I just had to create CSS3 classes and add customizations to them that will make the UI better and that’s what I did:

    css_changes

    These CSS3 changes are pretty basic but they did what the job is supposed to do, coupled with a minor change in font usage, the results seemed to be satisfactory (in my own estimation):

    Before:

    Before

    After:

    After

    Changes Made

    The changes I’ve made are pretty simple but effective, in my opinion. Text readability is very important in simple web pages – regardless if they’re stylish or not. Everyone should be able what the text on the screen is saying. Another change made is that the date picker form is now below the ‘Birthday’ text – why did I make this change? Because it’s a hassle to align the date picker form up with the ‘Birthday’ text and I didn’t want to customize it (at least for now) and why should I make it complicated if a simple change would be enough?

    I’ve discussed and demonstrated the changes that I’ve made by just using CSS3, but I haven’t discussed yet what changes I’ve made in the React.js code. So now it’s time to discuss it!

    The React.js code used for this website is pretty simple and seemed self-explanatory to me – after all, the syntax might be different in some parts but the concept of what the syntax should be doing remains the same – thus I broke down the code and finally found the parts I should be tinkering with:

    reactjs_code

    The code highlighted and boxed are the changes that I’ve made. Again, pretty simple but it did the job. Since I’ve dissected the code, I also understood the gist of it and possibly thought of a way to accomplish this without using React.js and just using JQuery (which I might later do a blog post about). The React.js code used in this project didn’t really teach me much except give me the gist of how React.js operates – namely that there’s a state mechanism that can be used to indicate changes in the virtual DOM (Document Object Model) and perform operations accordingly with the changes.

     

    by joshj9817 at October 10, 2018 02:53 AM


    Mera Gangapersaud

    Hacktoberfest — Week One

    Hacktoberfest — Week One

    The month of October this year marks the fifth iteration of Hacktoberfest — a month-long celebration of open source software organized by DigitalOcean with Github and Twilio. During this month if you make more than five Pull Requests (PRs) on GitHub you earn a t-shirt. The goal is to support open source software and generate more interest in the community and it’s awesome.

    Hacktoberfest t-shirt (https://blog.github.com/2018-09-24-hacktoberfest-is-back-and-celebrating-its-fifth-year/)

    For my opensource class, we are expected to participate and complete 5 PRs this month. At first, it sounded like we had to dive into the deep end but contributing to open source projects isn’t too difficult especially this month where repository maintainers are expecting a lot of newcomers like myself.

    Before my open source class started I had no idea how to navigate the open source community and how to even begin to think I could contribute. The best thing I learned so far is that I cannot be afraid to ask. Take the initiative to ask questions; ask how to do something; ask for clarification; ask for help; etc.

    My goal this month is to try different things so I can get a better idea of my own preferences because I found when initially looking for issues to work on I didn’t have any preferences to help narrow down my search.

    For my first PR, I found a project that had examples templates for the Hepek project and was written in Scala. Hepek provides templates to make rendering things more simple. The repository I worked in was Hepek-examples. Scala is a language I never worked with before, but I wasn’t worried because, as I said, I wanted something I never worked on before.

    It wasn’t difficult and the issue lived up to the label as a ‘good first issue.’ All I had to do was add a markdown example similar to the other examples that were already there. Although I never used Scala before, I simply looked at the other examples and used the same format to create the markdown example and it helped that the owner clarified a few steps in the issue. My first pull request was thus created on the first of October. I did have to make a few adjustments before it could be merged but nothing major.

    Now that I have successfully contributed to a Scala project I can cross that off my list for this month. I have a few repositories that I’ve starred but, going forward, I want to start narrowing down my choices based on what the project is actually about. If it is in a language I haven’t worked in yet then all the better. And I really want that t-shirt.


    Hacktoberfest — Week One was originally published in MeraG on Medium, where people are continuing the conversation by highlighting and responding to this story.

    by Mera Gangapersaud at October 10, 2018 02:09 AM


    Nathan Misener

    OSD600 Pull Request 2: This Counts?

    That's what I thought when I found out that even this counts as a pull request. When I was working on my first pull request I noticed some files that were not being referenced in any code, and read in the updated readme that they were used for the application when it was a back-end application. The files in particular were index.php, and save.php. I had asked the creator of the repo whether these files were being used and he said "No, Now I have removed the backend. You can delete them if you want."

    I didn't want to change or alter those folders when implimenting new code (see this pull request for more info). Keep that for a seperate issue. Now I wasn't sure whether this counted towards a proper pull request or not, so I asked my classmates and teacher who have more experience in open source development. Here is what they said.

    Sean Prashad: "Consider it like this - if there is "_noise_" in your codebase (ie. unused code, or files in your case), then I as a maintainer would love if someone would open an issue and say "Hey - I noticed that `x`, `y`, and `z` aren't being used anymore - can I open a PR to delete them?"
    In your case, the maintainer already gave you the thumbs up so maybe consider opening an issue then following up with a PR Restructuring a codebase is definitely worthy being a proper pull request!"

    David Humphrey: "Go for it. Removing code/files is an awesome contribution: you're basically removing bugs, and defect surface area."

    I created an issue tag: https://github.com/bhavinjawade/Web-Image-Editor/issues/4
    From there, I removed the files, and pushed the changes. After that I then created a pull request https://github.com/bhavinjawade/Web-Image-Editor/pull/5

    It just goes to show that cleaning and tidying repo's are just as important as fixing bugs, or making enhancements.
    If only cleaning my place was as easy.
    Until next time.

    October 10, 2018 01:22 AM