Friday 29 October 2021

Translated Chinese version of AlphaZero Hacktoberfest

 Introduction

    I grew up playing Chinese chess with my father as well as a physical chess computer program he bought me during the time of Windows 98 came out.  Here is a picture below, a one of a kind physical Chinese chess computer with 32k memory and 16000 moves, with 20 max depth search.  I was only able to beat Master level once at the age of ten, but I am only an intermediate player.


    The lights on the top and bottom will light up indicating where on the board the computer wants to move and you use tactile sensors to press down on the start and end position to finalize a move.  Thus, I was man vs machine ever since a child.  Fast track 16 years, and the team from "openAI" beat the world champion in the game of Go, making history of machine overcoming human intelligence.  During the Hacktoberfest I found no sign of such chess programs, but I did come across the "cchess-zero" repo, which is an attempt to implement alpha zero like chess into Chinese chess.  There have been attempts to remake Alpha zero in the form of Leela chess being the most popular, none made in Chinese chess I have come across.  The problem with this repository is its all written in Chinese and I am very slow at reading Chinese and only understanding partially.  I wanted to incorporate this opportunity with Hacktoberfest and the fact that the repository is under the MIT license, I want to make non-Chinese speaking individuals to access this resource as well and learn from it.  Thus I created an issue for it.

 Translation

    Thus, I took the liberty to translate as much of the two papers and source code to English while maintaining the Chinese text.  I also fixed the broken links as well as the images that are not showing up on Github.  The author mentioned that he doesn't get why the local images are not showing up in markdown, but I know the answer and fixed it.  Since the author has limited knowledge in English as mentioned on his paper, I tried to also translate my pull request as well as what I am trying to do in Chinese as well.  With the help on powerful Chinese to English translators I was able to translate over 600 lines/paragraphs of text in the pull-request.  In the author's original README, he encourages others to share the repository, so it makes sense that being in a popular language such as English will receive more views.

Hacktoberfest

    This issue was self created and not part of Hacktoberfest, so I also did a Hacktoberfest approved translation work on Microsoft's repository at https://github.com/microsoft/Data-Science-For-Beginners with issue and pull request.  This was a quick translation work for a README for Data Science tutorial, so it is what it is.

Thoughts on This Experience

    Overall, the Hacktoberfest is a great way to get real world experience and build confidence in working on other people's code, while respecting the rules and courtesy that you need to show as a representative of Seneca College.  The fact that it is run every year despite the fake pull requests people try to do, means it is valuable to the Open Source communities, to first timers, to veterans, to train future developers.  If I were to do this again,  I would have tried to do more issues in parallel as I have more than two repositories that didn't make it to the four pull requests this month.  The amount you get out of it is how much time and effort you put into it.

Aside

Here is a bonus game between world champion Magnus Calsen (age 8 simulated) and me (NeoLinux) at age 29.


 You can checkout the English Translation version of Chinese Chess Alpha Zero:

https://github.com/ycechungAI/cchess-zero

Thanks for Reading,

Eugene Chung

Thursday 28 October 2021

Lab 6 - Working with Docusauraus

 What is Docusaurus?

It is a website builder tool built by Facebook to allow a user to quickly push documentation and a blog to a website even if you are starting to learn web development.  Moreover, it is powered by markdown, built on React front-end with features like translations, document-versioning, and content search.  It helps developers ease the transition of purely coding to more documentation for the app or website they are building without doing the heavy lifting of building infrastructure.

Installation

The Docusaurus installation and setup was quite simple by running 

    npm init docusaurus@latest [name] [template]

A piece of advice I can give is use yarn to build and install and look at the errors in vs code if you have an issue.  I use the --classic option as recommended and it turned out great.  I did play around and added my own content to see how easy it is to modify the document.  Here is my site published and running on Github.

The blogging feature was interesting and I could have used it over blogger, dev.to and etc.  Here is an example on the same website.

Copying a Feature

I decided to upgrade my markdown feature to use markdown-it instead which will save me a lot of time coding.  I filed an issue #40 and began quickly prototyping an implementation.  I made sure it works and will refactor and file issues as time progresses.

With the new feature, it now translates all relevant markdown into proper html.  Before I have header, italics and adding individual markdown features, now I have it all with one library added.  Next steps will be to add other file types such as CHM, RDF, MAN-pages, XML and etc.  I filed issues for RDF and MAN-pages first to start.  To get people involved, I will add a comment to accept pull request and look for opportunities such as Hacktoberfest to add the project there.


Thanks for Reading.

Cheers,  

Eugene Chung


Friday 22 October 2021

Yet Another Successful Hacktoberfest Pull Request

 At the beginning, I joined the official discord channel for Hacktoberfest and found the Manim project interesting.  It was basically a way to convert code into video demonstration of mathematical animations of objects, equations and various graphics.  Here is an example of generated gifs from code.


Manim ex2

You can find documentation on how to use Manim on their website.  I worked on the issue-1172 for my second pull request.  The challenge of this repository is getting it setup on my computer.  The instructions is widely different for different platforms and there is a medium learning curve to setup.  I just need to be aware of the documentation requirements and where they would like their documentation to occur and reiterate commits accordingly.

Their workflow is the most sophisticated I have seen.  They test python code within custom build environment for different versions of python and those tests must pass for your code to be checked.  This is a large project as there are over a thousand commits already in the repository.  I would like to thank @Darylgolden for answering my questions and reviewing my code.

The whole experience feels like real development work.  I enjoyed working on this repository and I have another open issue that are not among the four submitted for release 2.0 and that I will leave for later because I need to understand their python code and tests.


Friday 15 October 2021

Deadlines and the Backup plan in Hacktoberfest

Deadlines for Week 2 Hacktoberfest

In week 2 of Hacktoberfest, my original pull request is delayed due to slower than normal communication, not because there are little people or issues to work with but rather the project has too many issues and pull request and there is a backlog.  Doing things in parallel with multiple issues saved me.

The Backup

 This pull request is originally planned for next week, because I will be busy with midterms and such.  However I got the chance to finish the code and I have tested it in the repo prompts-ai.  This repository has caught my interest because I knew the individual from a OpenAI Hackathon back in April.  As you know I am a machine learning enthusiast and the latest GPT-3 model has been on my hobby bucket list for some time.

The Changes

I noticed this code has 100+ stars in less than a year, but it actually doesn't build nor run properly due to outdated packages.  It is made in Typescript, in which is a programming language I have not touched this term, but would like to add to my growing list of programming languages used this term including Q#, C#, Javascript, python, etc.

I made a lot of changes to package.json shown in the picture below.

 

I touched over ten files some of which are minor changes but most noteworthy fix is the spread operator fix

As well as improvements to include the new Codex model.

Running Example

Here it can give the cords to the lyrics of the given song.

Running localhost:3000

Here is a fully humanized Chatbot in which i gave only 2 lines of input.


Conclusion

Even though this project might not be merged in time or be counted as Hacktoberfest, it signficantly helps me develop the next big GPT-3 template to further the process of singularity.  This was a worthwhile project in which I made my own opportunity. (issue#9)  The code is very well written and it is very structured.



OSD600 - Lab 5 Refactoring CMD-SSG

 Introduction

This week we are refactoring our beloved open source SSG program  We learned to use the git commands git rebase as well as git commit --amend to rewrite history on a branch and to add/change our git message as well as the command git merge in the end.  Refactoring is a technique for improving the structure and maintainability of your code without altering its behaviour. I made several refactoring changes.

Refactoring

 1. created a new helper.js file to add all functionality of generating .html from .txt and .md files

 2. exported the functions checkInput, convertToHtml, displayError as new or existing functions to make the code cleaner.  "checkInput" does input checking of what the user enters, "displayError" is a function specific to displaying error codes and convertToHtml is an existing function to generate the final html files.  

 3. refactor some variables names that are not up to standard like test1 and test2 such as the following image.


Additions

4. I added support for output folder command with -o or --output as well for better use.

5. added a config.json test file and made changes to README.md

Time for Some Squashing

git rebase main -i

and...

git commit --amend

then... the commit message 6a0e543

 

* extracted helper functions to new file to make code more modular

* Extract error codes into single use function

* Renamed test and test2 variables

* refactor/fix code for output

Ta Da... git push origin main

Conclusion

This week has been a truly busy week for me, but I did not overlook the fact that what I learned here this week will change the way I view, code or experience Git and Github.  I no longer feel like a novice at Git or have began to shed my fear of it.  I still make mistakes, but I know how to fix things now.

Thanks for Reading guys.

Friday 8 October 2021

OSD600 - Lab 4 Git Remote

STEP 1: Pick a Repository and File an Issue

 In this lab we are suppose to work on another repository of our beloved SSG.  This time I wanted to work with C# so I found Minsu Kim's repo

STEP 2: Work on Topic Branch

I created an issue and forked his repository as well as creating a branch called issue-16.

Unfortunately, there a bugs in the program in which I ignored for the time being.  I was suppose to add --config, or -c support while reading a Json file to avoid the hassle of typing all the commands out.

For instance,

is equivalent to appending --input "./examples" --output "web"  to the console while only writing -c "<filename>.json".  This saves a lot of time and effort to run different tests.  I find working in a different language helps to getting me job ready for anything the employer throws at me.  I believe we are not limited by the tools or languages we use but how well we understand and execute them.
 
In addition to the lab requirements,  I added support for Linux for his code because I saw that Minsu's code only works in Windows.   I learned that it is important to get started ASAP for letting people know my repository is available to be worked on for this lab as well.  Overall it was a good experience.

STEP 3/4: Collaborate and complete the feature

I created a draft pull request very early on to let Minsu know I am doing well and working away at his repository.  After a few bug fixes I was able to push my code and commit my feature update.

Step 5: Reviewing and Testing via Remotes

As I waited for the pull request from Ritik Bheda, I told him to just do a early pull request so I can continue working on this part.
 
I used the command: 
    git remote add ritik https://github.com/ritikbheda/cmd-ssg.git
 
then
    git fetch ritik
 
which fetches his issue-38 branch

Then I did 
     git checkout -b issue-38 ritik/issue-38
 
which creates my own local copy of his branch on my computer

I proceed to test the code, then I will do a merge to main branches once it is complete. Overall I expanded the use of git a lot with this lab as well as beginning to understand the intracetcies of git and Github.

STEP 6: Merging

$ git checkout main
$ git merge ritik/issue-38
$ git push origin/main
 

Cheers,

Thanks for Reading

Thursday 7 October 2021

[OSD600] First Hacktoberfest issue

Introduction

 As I was looking for a quick readme fix at the start of Hacktoberfest, I came across Microsoft's Quantum project, which piqued my interest further.  I looked at the issue number 432 and made a pull request 556

What I learned in this first pull request

I am also working on another issue in this project and hope to update the status.  What I learned is that big companies like Microsoft is careful in its documentation and licensing when working with their code.  I had to sign rights over to Microsoft for changes that were made before I can complete a pull request.  That is interesting that there is a dominant legal aspect to open source that was mentioned by David.  Although it is not the focus of this course it is how the world works.

Final Comments

I also like the collaborative effort put into open source as not all changes need to be fixed by me and the person more or less in change give helpful hints and direction to where the project is going.  I worked with the code a bit and found it interesting on how Q#, the new language used by Microsoft is so new and cutting edge.

My Quantum Repo

Friday 1 October 2021

Lab 3 - Merge Conflict and Resolution

        During Lab 3, we were suppose to continue working on our command line tool by implementing at least two features, but having to merge both changes at the same time which simulates the idea of multiple developers working on the same code.  Thus, the idea of merging is the main focus on this lab.  I made the following changes to my repo:

  • Add Support for Horizontal Rule in Markdown to HTML conversion,  issue #29
  • Exit codes for the command line tool for all possible cases, issue #28

Issue #29

  • Main change is added the following code to lib/parser/markdown.js


  • Added lab3.md and modified exampletest1.md for testing purposes
  • Other changes is fixing the current settings and undo some changes to previous commits

Issue #28

  • main code changes involved with adding error messages and putting them within proper conditions


The following are the merged changes

  • Issue # 29 9129099 merged to main branch
  • Issue # 28 090ed1d merged to main branch

        There were conflict with index.js file which I choose the correct code to commit.  The lab was a good experience of merging various code that had touched the same file and I am sure I will run into more difficult merges in the future.  Overall, I enjoyed the experience of this Lab.

Hacktoberfest here I come !




What I learned from Project 1 of Udacity's Data Science with Python bootcamp

Introduction As part of the project I completed successfully, I used SQL to explore a database related to movie rentals. SQL queries was ran...