Friday, December 6, 2019

The Learning Curve

Internal

     Man Programming is not an easy thing. Here I thought I have learned the basics to start creating bigger projects now but nope. Programmers need to keep learning and improving. So for an internal project, I was originally going to work on Update the `.travis.yml` to use Docker's Redis image for all OS platforms - issue #267 but that didn't go well.

    Don't get me wrong if this was possible I would have loved to implement this but the compatibility was just not there!!!! Mac did not support Docker CLI, which is the command-line interface for docker. Docker does have a GUI, graphic user interface, docker but not CLI. To capture the image of Redis from docker in Travis, you would need to go through the CLI in our config files. GUI is not useful because not everyone wants to set up the Docker GUI on their macs and even if they are willing to set it up, the installation process and setting it up for Redis is not the best for our users and is very time-consuming. Plus even if we do install it and set it, we will still need to let all the students know of changing the Travis config file with the new docker part for Redis. With the docker CLI, we wouldn't need to do anything because then we can code all these steps in from the start and make it more efficient and easier to use the planet.

     So those were the problems with mac, it destroyed my will to continue to implement this further because I am a mac owner like many of you but the show must go on. So after a day, I continued research on the windows system and see if we could do dockers Redis image in Travis for devices running windows operating system. At first, when I saw it was possible I was happy because then it's worth implementing for two operating systems, Windows and Linux, in Travis and not just the one, Linux only. After digging a bit more I found out that it is possible but not the way we needed it to run. So for Windows OS, there are docker CLI but they are of older versions and they don't support the newer versions of Redis functionality very well and the docker CLI doesn't support Travis AMD64. But we can get around Travis with running a Linux VM which is running the docker, Tavis and Redis. I came to find this out from a fellow classmate because that's how he had his laptop set up for the telescope project.

     After running into all these problems I didn't think it would be worth it to update the Travis to use docker Redis image. So we closed this issue. After I found a small error nothing big but it was causing an error and run time, issue #419. This issue is about a method that was changed into a function in text-parser.js but the call was not updated in spam-checker.js. Before the fix, the spam-checker.js was called the text-parser run method but after the fix, it's calling the text-parser function. The details are in the pull request which was merged quickly at pull request #425.

     That's my experience with Travis again in release 4. Gotta love Travis and all the other config files and services and operating systems, right? I had fun learning new things and but didn't like hitting the walls at all.

External

   
     For the external, I added some styling, mainly dark more with darkmore.js to the RecogitoJS project, issue #21. Which is an experiment to extract the annotation functionality of Recogito to an independent, client-only JavaScript library. With RecogitoJS, the goal is to bring Recogito-like annotation to any website and enable everyone to build customized annotation applications more easily. So for this, I used a darkmode.js library. It's super easy to implement and customize but the main reason I suggested this is because I loved the half moon half sun label they have as default to toggle the dark mode on and off, pull request #25. I think once we get the planet up and want to add a dark mode, I would suggest darkmode.js library because it takes care of everything for us.



Saturday, November 16, 2019

The Big Disaster

     Wow, release three, WHAT A NIGHTMARE. For release three of DPS909 course, we had to submit a minimum of two pull requests; one internal, ran by Seneca, on the project telescope and the second one external any other project that's not the telescope project. For the internal project, telescope, I was working on an issue to set Travis CI up so it runs on Mac, Windows, and Linux and send in a pull request. 
     
     When I was working on travis.yml, file name, I was having a lot of difficulties because I have never worked with Travis before. The good this was Travis had pretty decent documentation so I could set up the Redis server and homebrew as well. Once that was done I tasted my code and to do that I had to make a pull request because when I tried to test it locally it didn't test the travis.yml file since I didn't have my system set up for Travis. So when I looked into how to set it up locally I found a StackOverflow entry explaining all the sets. So I followed them and found out my mac is full, I don't have enough space to set up the docker and Travis so I started deleting unnecessary files and apps that I didn't need and used any more. That gave me four gigabytes of space, not enough, but just enough for me to set Travis and Docker up locally. So I tried setting it up and failed miserably. So I researched a bit more and I started noticing some issues with the performance of my mac because there was not enough space. Then I deleted docker and uninstalled Travis. Following all that I decided to set in a pull request and let the GitHub Travis test my code. Great I got that started and every time I git added, committed and pushed my change to GitHub, it ran Travis. Now I started reading up on Travis syntax, how to configure on travis.yml, looked at other example code on Github for travis.yml and looked on StackOverflow. From all that searching I learned how to add addons for mac, essentially setting up the VM for the Redis server. Then how to run the Redis server on mac with an if statement so when the test runs for windows it doesn't run the server start command that mac would run. Another thing I found out was that services are not supported in mac but are in Linux so when the yml file had the syntax "service: redis-server" it started the server for Linux and that's how I came to find out the server needed to be started manually. After I started them manually with the following commands: "redis-server /usr/local/etc/redis.conf" for mac and "server.exe" for windows. When I did that during the Travis test the servers would start and be in a state to accept a connection but never received the connection. That puzzled me so I asked for help and I found out it would be started during the test so I just needed to install them or so I thought. Following what I thought I understood I removed the server start commands and ran the Travis test again. This time it came out as there is a problem with the asynchronous test function so I thought great I think I set up the system properly because I didn't work on test functions. But turned out during the test the Redis server had not set a default URL. So that makes all the following tests fail. In setting up Travis ci for windows I had one major problem but all the other steps were the same, setting OS as windows, installing Redis for windows and starting it. The major problem was the prettier format. For windows EOL, end of the line, the format was CRLF but Travis needed just LF like how mac and Linux have their EOL ad LF. I had no idea how to set this up. So I searched a bit and found out that this can be turned on and off in git config global core.autocrlf. Then I inserted that line as a "before install" command in and ran Travis. It did nothing. So I searched a bit more and found a code block on StackOverflow to fix the exact same problem I was having. So I took that code block and used it in my yml file and I commented the link right before the code block. Finally, I pushed my code and it got reviewed and merged. Then my prof sets up a new issue to fix why the Travi ci test was failing for all other commits. This scared me a little because did I break the whole system. Turned out I did with my merge. Then he recorded the whole file to fix the fix I should have fixed. Later I found out that the problem was caused because the Redis server was not starting since it didn't a default URL.

     This was a really big mistake I caused and I realized it after. The lesson learned is never messed with setting up the configuration of a system ever again!!!! Nope, I am just joking but what I actually learned was 1.) if a test fails before merging on GitHub you are doing something wrong, take a second, third or even a fourth look and find out why it's not working properly. If you still can't ask for more help and clarification and do a deeper dive into searching. 2.) never push code that fails CI because it will cause huge problems for other developers who are depending on it. 3.) if part of the tests or CI is failing, move that bit to a new pull request against landing everything at once.

     For the external after my confidence in myself failed, I tried to do something simple. So I found a Microsoft project on GitHub called fast-dna which is about "an unopinionated system of components, development tools, and utilities used à la carte or as a suite to build enterprise-grade websites and applications"(fast-dna, line-1). This project is all typescript. Honestly, I choose this project because there is a simple issue I can work on here when the scroll bar should show a number when changed and it was a good way to refresh my memory of typescript. But the second objective failed I couldn't remember anything I learned of typescript. So on the same project, I found another issue of moving a file from once component package to another component. I did that and sent in a pull request but it failed their circle ci test. So now I gotta go back and look at where I am failing. So learning from my previous mistake I have not merged this code yet but I will send in for another review once I solve this problem.

     This release, 3, has been a great learning experience for me in why testing is important and not merging anything that doesn't pass the test. Even with the Microsoft project, I failed the build dependencies so I think it might be due with not changing the path of the file import in some component but I will look at it again. This is one lesson I will never forget moving forward.

Friday, September 27, 2019

Hacktoberfest 2019

Introduction


     For Hacktoberfest 2019 I have decided to work on googles open source issues. The projects that caught my eye to them are blockly-gamebullet-physic SDK and the quickdraw dataset. Blockly-game is a series of educational games that teach programming. It is based on the Blockly library. Bullet-physic SDK is real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning, etc. The Quick Draw Dataset is a collection of 50 million drawings across 345 categories, contributed by players of the game Quick, Draw. All of these projects are handled by Google and run on c++, a language I like to work with.

     My original goal for Hacktoberfest was to learn Python or Dart. Instead, I switched my goals to google because these projects caught my attention. Plus as a beginner, some of the issues these projects have to offer are stuff I can handle but also challenge my self later on. In quickdraw, I saw an issue about adding a heart to the database because it is easy to draw and recognized by everybody, which is something I can handle. On the other hand, we have collision issues with light objects in bullet physic SDK, something a bit out of my comfort zone but I would like to solve.

     Not gonna lie, I am super excited about Hacktoberfest, I cant wait to get started!


Pull Request 1 -TicTacToe


     For my first hacktoberfest entry I decided to work on something I was familiar with and help me settle in with this challenge, a tic-tac-toe game developed in java. The author of this repository was having some problems with win conditions for a vertical line. He created an issue for it and I helped him out and sent in a pull request. I have made tic-tac-toe when I was first learning to program from scratch, which is a block-based visual programming language. I thought I made it before this issue should be easy to solve and the fact that I am pretty knowledgeable working in java environment I was super sure ill have this issue don’t in 5 min. But I thought wrong. Finding the bug took some time to find but since all the files and variable names made sense it didn’t take too long like some projects I saw on GitHub where their file names and variable name were like “a, b, culm, z, zz”.  Also, the part of understanding the logic of the code and how everything works together and writing code that fits the author's coding style took some time to. The issue was fairly simple to fix because there was a fatal flaw in his check conditions, so once I fixed that the game ran smoothly. Another thing that caught me off guard was instead of using a window and using some graphics to display the game in java, the author decided to show all that in the terminal with was a pain to work with. This is because every time you chose to put a markdown you have to enter in the column and row number then it creates a new grid with the mark on it, This I found very irritating. Other than that I was very happy with this project is the first project I decided to work on as hacktoberfest entry.


Pull Request 2 – Quiz-Game


     For the second entry in hacktoberfest I decided to work on a quiz game built in java. I know I decided to switch my original goal and work on google based projects but in the end my drive to learn a new language took over and I started learning python. This quiz game was a great step towards my learning process. This game is simple enough that once I learned a bit of python I was able to follow what was going on in the code. At first, it was hard to understand of course, just like any new thing you attempt is hard, so I decided to sit down and learn python3 for 2 weeks. I used codecademy and stackoverflow to learn python3. Then I went back and the quiz code was easier to understand and understood that the author kept the coding were simple because they could have used more advanced techniques to do half their coding. The issue I solved in this game was a documentation and consistency issue in the game. The phrases that repeated in the game like “Enter your Choice”, “Enter Choice” or “Enter answer”, I decided to change all that and make it all the same as ““Enter your Choice” followed by the valid inputs so it looks like this in the end “Enter your Choice [a, b, c, d, e]: ”. I had to add in the valid answers because the game did not handle the wrong input very well all the time. Once I went and fixed all the documentation errors in the program I sent in a pull request. This issue helped me understand python better because if you can read and edit code in a certain language it will help you write code in that language as well.


Pull Request 3 – Algorithms


     For the third entry in hacktoberfest I decided to work on writing programs in python even if they are small ones. So, I came across this repository that has algorithms in c++ and python. The author had an issue open for mathematical algorithms in python so I took a crack at it. The author had a lot of the c++ algorithms done but the python ones very few and even those were done by other contributors so I decided to work on the factorial one. The program I wrote takes two inputs from the user than calculates the factorial in a while loop in a try and catch block to handle invalid input and prints the output of the calculations. After I wrote the code I sent in a pull request to merge it with their repositor. The thing I had a lot of problems with when I was writing was with the spacing and blocking everything. Since there are no brackets I got lost a lot when I was tiring to read my code since I couldn’t tell if it was the end of the if statement or loop. Other than that I had fun writing the program and it was so easy to write and run compared to doing it in c++ in visual studios.


Pull Request 4 - Algorithms


     For the fourth entry in hacktoberfest I decided to continue working on the same repository as pull request 3, Algorithms. This time around I sent in an issue to work on another one of the mathematical algorithms, highest common factor, and lowest common multiple. Same thing as PR3 it took two inputs and printed the output. What is different in this one is that I create two functions that I call upon and print what they return instead of just doing the calculation and printing out the variable value. After I wrote the code I sent in a pull request to merge it with their repositor. The thing that I had difficulties with this code was the actual logic for calculating the HCF&LCM. This is middle school math and I forgot about it totally so to remind me of how they work was the hardest. Other than that I enjoy working with python because it is so convenient and easy to use. It’s almost like coding by speaking.


Conclusion


     In the end, this was very fun and a great experience for me. I loved learning and working with python and I will continue to learn more about it in the near future. I know I didn't stick to the original projects that I planned on working on but I do not regret one bit of that. I will attempt solving some issues in those repositories in the near future as well. Also, I will attempt hacktoberfest next year as well since I enjoyed learning new things very much.

Monday, September 23, 2019

Github First Actual Experience

     Wow-what an experience getting full hands-on first Github project. Last lecture class in DSP909, I learned some git commands which I had a lot of fun playing around with, messing stuff up and finally getting to the destination which I originally set out to reach. I will talk about that later on. On the first release out of the four for the course, we had to 1. fix a bug on one of our classmates lab_2 programs which we wrote and pushed to GitHub last week and 2. add a new feature to another classmates lab_2 program and get it pushed to Github.

     I was excited to do this but 1 thing I didn't keep in mind that my professor told me to never to do in this course at the beginning of the course year was to keep the release work for last minute because they take time to complete. When I started working on it I had problems finding other classmates bugs because lab_2 was very simple, creating a notepad. After a while, my friends suggested trying to open the notepad in different browsers and see if that helped me find a bug. At the end that was a bust. So I decided to take a more general approach to this and see if I could enhance someone's notepad to make it look better and function more efficiently. At last, I found a notepad like that. One of the biggest problems with the notepad I found was I didn't know where the text area was because there was no placeholder to tell the user where to type their notes or a border during their text field.
When I first opened the notepad I kid not, I clicked on the screen like 4 times before I found the text box so I put in an issue with the creator of the notepad and asked to fix the problem. After that, I went ahead and added a border and apparently the code had a preassigned text to the text box at the start of opening the notepad but it wasn't showing up so I fixed that problem by taking it out and placing a placeholder in the div of the text field and placed in a pull request. After last weeks struggles with javascript I remembered a lot more of how to work with javascript this time around. So I was really grateful for that.

    The second part of this release was a lot easier than the first part. Adding a new feater to a simple notepad program I found easy because originally there weren't that many features added so you can add anything as long as what I added did not break the whole, notepad program. So I decided to add a save button for the paranoid that didn't trust in the autosave functionality and clear button for the people who want to start over. Along with that, I added a clear short cut, ctrl+c since the notepad had a save shortcut, ctrl+s. It's only fair that there should be a clear shortcut if there is a save shortcut right? So I started with putting an issue in with the creator and the creator was thrilled with it and replied instantly. So I added the feature and submitted and a pull request so he can merge it with the master branch and he did. This was a lot less time consuming than finding a bug fix.

     On a sided note from the release I tried out the following git commands on the terminal:
               - git inti
               - git status
               - git show
               - git diff
               - git rm
               - git checkout
These commands gave me a lot of difficulties trying to figure out what was going on. At one point I was trying to override a .git file from another git staging and it was not fun. Also, I was thinking of cloning the same repository from git again because this was giving me a lot of problems but I remembered that I can undo almost anything on git and I browsed for while on google. After I was able to reverse my staging to the local working directory and everything was fine or so I think it is fine.

Wednesday, September 18, 2019

NotePad

Note Pad a simple but can be a complex program. I have recently created a notepad program, a very basic one. All it does is, it allows the user to type in whatever they feel like and autosave the page every 2 seconds. So upon refreshing the page whatever the user typed in is still visible, didn't delete itself. Along with that I have added 2 buttons, save and clear. For the users who don't know about the autosave, they can press the save button to save their text and the clear button if the user wants to start over for whatever reason.

I haven't touched web programming in a long time now and I forgot most of the syntax or how to do something. So for this lab, I looked a lot of what I need on W3Schools.com. They have a lot of tutorial for HTML, CSS, javascript and more. Also, the good thing about this website is that it has interactive examples. So you can run a snippet of code and play around with it to get a feel of how it works and how you can incorporate it with your project.

All in all, this was a good refresher lab for web development.

Monday, September 9, 2019

Open Source Real Time Voice Cloning

     Today I was talking to some friends while playing ping pong and we were talking about voice cloning so we don't have to always respond to our moms calls for chores. Instead, we can clone our dad's voice and playback a recording that tells our mom to let the kids enjoy and do our thing. That got me thinking and I searched if anything like this was available or being working on Github to do as my first assignment on for Topic in Open Source Development course I am taking this semester. Luckily there is. I found a repository that uses deep learning framework that allows creating a numerical representation of a voice from a few seconds of audio. Which later is used in a condition for text-to-speech resulting in a cloned voice to say what you enter into a text box.

     I was drawn to this the second I came by it but I was a bit against choosing this as my topic for my assignment since it was done in python. It makes sense to do it in python because of deep learning and useability but I have never used python before at all. So this could be a problem for me. In turn, I thought about killing two birds with one stone, learning python, semesters gonna be crazy busy now and work on something I like.