From Python to C#

The very first language I had learned was Python, and I was planning to stick with Python for as long as I possibly could. Python was the perfect first language to learn as a beginner embarking into this field for the first time.

However, if I want to take full advantage of the opportunities around me, I must learn C#. Therefore, this weekend marks my very first major pivot in my learning journey–learning a new programming language!

This new chapter is making me feel all sorts of things. First, it’s making me feel like I’m growing as a programmer because I’m no longer going to be stuck to one language. Whereas I have a personal appreciation for Python since it’s the point at where I began, I haven’t been able to find many other people or businesses around me who work heavily with Python. A lot of what I have seen has involved other languages, C# for example.

I’ve only just begun an introduction course on C# and already I have so many questions. What helps is that, unlike when I was learning Python, for C# I have something to compare the language to, and real, in-person friends to discuss C# with. It’s an added bonus that my husband needs to improve and learn more C# for his job as well, so we will be learning together.

using System;

namespace Hello World
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

As the tradition continues, I executed my first Hello World program in C#. The very initial “installing everything and get it running” part of learning a new language (and getting it to work) is always the first hump to get passed. I remember installing and setting up Python very clearly for the first time, and the fear that came with needing to redo it on a whole bunch of other systems afterwards.

My very, very first initial impression of C# is that it’s already very visually different than Python. The structure of the code block is much larger to execute that Hello World program than what the equivalent would be in Python. I find that aspect interesting, and hope to learn why C# has a very elongated visual structure. A part of me wonders if this helps programmers find blocks of text in larger program files because of the way the curly braces signal to the eye that the block has concluded. Whereas, for Python, there’s a more linear structure and spacing.

I also learned a helpful nugget from the Programming Throwdown podcast that Python and C-based languages work very well together. That makes me feel very comfortable and optimistic about learning C# as my next programming language!

Time to get back to that introductory course!

Git and GitHub

When I first learned about GitHub, I thought it was just a website. It was very confusing and intimidating. However, I was told by peers the importance of GitHub for programming, and especially because I had found myself at a dead end during an early programming project.

I have a (somewhat embarrassing) first project up on GitHub (which is a perfect example of code that needs to be cleaned up–a fun idea for a future project). However, that first project from years ago was a great introduction to GitHub.

First, Git and GitHub are not the same thing. When I looked up “what does Git stand for?” I stumbled upon an interesting story. Git is actually not a meaningful acronym, instead it was chosen because it was most likely to never be used and mess up someone’s code. The story goes as so:  Torvalds created the software and named it after the British slang word, “Git,” which translates to “a rotten person.” 

GitHub is a website, a service, where people can collaborate and track the history of code. It’s a wonderful space for people to learn and grow. However, it is possible to be proficient in using just the GitHub website without actually working with Git through the terminal, and vice versa.

The goal is to balance usage of both Git and GitHub through the terminal and website. Prior to this post and day of studying, I had mostly just worked on the GitHub website and not the terminal. Having gone through multiple videos so far from the “Git and GitHub for Poets” video series by The Coding Train on Youtube, I’m more familiarized with working in the terminal with Git and GitHub. It’s been an interesting ride, and this is just the beginning!

Link to series playlist: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZF9C0YMKuns9sLDzK6zoiV

Glossary of Important Terms

Here are some notes I took while watching the above tutorials. Hope you find them as helpful as I do!

Git: version control software

GitHub: web service where people can collaborate on open source code and track project history

Repository (or, “repo”): a project; a repository of files. Repository names can’t have spaces so they will include a dash as in: repository-title-example

Commit: a change to a file that is saved in the repository

Commit Hash: a unique identifier for each particular commit

Master Branch: original origin of a repository

Branch: a copy of files for experimentation before a commit is merged to the master branch

Pull Request: a way to ask the collaborators of a repository to approve your changes and merge them into the master branch

Merge: the action of a pull request successfully combining changes into the master branch of a repository

Fork: copying the repository to have under your own account for experimentation without effecting the original core version

Issues: a place to leave a comment about a problem, or to ask a question. Raising an issue means to file a potential bug

Fixes: if you use the word “fixes” in a commit changes title, the issue will be automatically closed

Remote: duplicate instance of a repository that exists on a server. When you say “git push” you need to say “git push __where__”

*Tip on Commit Hash Codes: place the commit hash code in a comment to help link to the issue

Terminal Instructions (via GitHub):

to create a new repository on the command line:

echo "# terminal-practice" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/KIBautista/terminal-practice.git
git push -u origin master

 to push an existing repository from the command line:

git remote add origin https://github.com/KIBautista/terminal-practice.git 
git push -u origin master

Practice Progress

After some trial and error, I was successfully able to push a new file into my GitHub repository through the terminal. It was very cool to see it work! I ran into some trouble shooting errors with getting into the proper place on my desktop for the repository, and for getting the remote to work, but finally, it has worked!

I found trying to change my login information through the terminal to be a little convoluted, and I was worried that an incorrect password was the cause of my push updates not going through. However, seeing my text file successfully added on GitHub through the Terminal confirms that the password and login is correct.

I feel more confident now to look around on GitHub for open source projects and contribute to them, which is the goal!

For anyone wishing to learn more, the video series I have found to be incredibly helpful is available for free on YouTube, and it is called “Git and GitHub for Poets” by The Coding Train. I very much appreciate the depth and visual interface used in this videos; they’re very user friendly and great for beginners!

Hacktoberfest 2019!

Image source – https://hacktoberfest.digitalocean.com

Project and Learning Update

Before I get into the Hacktoberfest fun, I wanted to update you on my progress since the last post.

I was in New York visiting family these past few months (I recently moved from NYC to Florida last year) so it’s been a little hectic! Luckily my brain needed the time to process everything I had learned from the previous machine learning course before diving into a new one.

Since then, I’ve began another course on Udemy about Machine Learning and Data Science in Python and R, which is dense but very fascinating! I’ll definitely need to add math for python, and matrix math, to my list of topics to study.

I’ve also connected to an awesome community, Women Who Code organization, which is how I learned about Hacktoberfest, through conversation on the slack channel!

Hacktoberfest Participation

For Hacktoberfest, everyone get’s together and participates in helping open source code by submitting contributions. Open source is another reason why I love this field, because the teamwork is inspiring. In order to do this you need to use GitHub to submit pull requests. Prior to this event, I had some light experience in GitHub but hadn’t gone into too much depth yet. After this event, I now understand how incredibly crucial it is for anyone interested in developing to become proficient. It’s a skill most employers will expect you to have, as a bare minimum. Moreover, GitHub is where a lot of the magic happens.

In order to be considered a full participant of Hacktoberfest and receive a super cool shirt, (dreams!), you need to submit at least four pull requests that adhere to the Hacktoberfest guidelines and rules.

I submitted five pull requests. I felt so happy to see the bar completed! But, my requests had a little clock icon near it, meaning that their eligibility was pending. To this day, a few months later, they’re still pending. However, two of my submissions were unfortunately submitted to ineligible repositories. Since the repository was ineligible, so was my pull request on that repository.

If any of these words confuse you, don’t worry, they confused me too at first. But as a beginner, I loved the freedom of Hacktoberfest. It was a time where everyone was getting together and people knew that beginners would be involved. This gave me more confidence to actually participate by submitting pull requests with less fear.

I’m so incredibly happy to have participated in Hacktoberfest this year, and am excited to see my performance for next year’s event after much more learning. I’m now off to learn, more formally, about GitHub, in preparation!

Happy Coding!

Beginning Python – Course Completed!

A few months ago, I tried a free trial of Team Treehouse and then signed up for one of their basic subscriptions. The subscription let you enroll into a learning track of your choice, and I wanted to start with Python. The Beginning Python track is 9 hours long, but it took me a few months to complete. However, today–right now, I have finally passed a major milestone in my Python learning journey!

Team Treehouse Impressions

As a complete new person to an overwhelmingly intimidating field, I really loved the clean interface and design of Team Treehouse. The videos all seemed to be professional produced as opposed to well-produced home videos from other sites.

At first, even though the quizzes were a surprise, I was really happy to have them. The quizzes were also intimidating, but it helped my brain learn how to comprehend the lingo of this new realm. Also, the payoff of correctly answering a quiz question when you think you’re lost was a nice additional motivator.

Later on in the course, I quickly realized that different teachers teach different subtopics in each track, and some include different quiz methods and teaching methods.

Quizzed Out

Since I’m a stay at home / work at home mother, after a while, the quizzes were a really big disruptor in my learning process and time management. I don’t have the luxury of uninterrupted time or much quiet space. So, sometimes I want to be able to power through retaining as much information as I can during my small gaps in free time. During those moments, I was very frustrated to have a three minute or four minute video followed by multiple quizzes (sometimes five quiz questions / challenges back to back).

I should probably mention that I have years of analyzing my own personal learning process, because before I taught college I had to learn how to teach, and before I could learn how to teach, I had to learn how to learn.

I’m a visual learner. I also tend to have “bursts” of energy or “pockets” of moments where I am ready to dedicate hours to a task or subject. This trait of mine made me and Team Treehouse’s pacing very off-putting after a while

This could also be partly due to the fact that since I’m self-learning, I have my toes dipped in a lot of different areas. Some books I’ve read are ahead of the beginner tract, along with some of the projects I’ve accomplished, yet still a lot of it is new. Moreover, through my troubleshooting and projects, I’ve learned that those are my quizzes. Those stick in my brain and motivate me more.

Moving Forward

I don’t mean for this post to come off as if I am completely hating on Team Treehouse. I really do think that they’re a fantastic resource, and their videos have helped me a lot. As a new beginner, I’m happy that I chose this platform because the quizzes were strict and did help me persevere through some frustrating challenges (which I’m sure is the point, to mimic the life of a developer!).

However, for myself, I have decided to take a pause in my membership with Team Treehouse and move on over to try Udemy.

Udemy Impressions

First, I love the freedom of Udemy. I can skip forward in a course if I want and from what I can tell–there are no quizzes! I will say that Udemy is more attractive to me now because I am more experienced in this realm and have already personally decided to stick with this learning journey. However, if I was a new person and unsure, I think that Udemy’s platform could be potentially intimidating and perhaps give new students too much freedom to get in over their head.

What it really comes down to is personal preference and situation. For my personal situation, I’m excited to have the freedom to be able to utilize my time as best as possible, at my own speed. That will be a big plus for me!

Onto the next goal!

Raspberry Pi Project Progress— LCD Screen PT 3

To catch you up on parts one and two: setting up the LCD screen I had with a pin adapter (to use only 4 instead of 16) was trickier than anticipated. Most of the code I was using had been with the 16 pins in mind and not my particular setup with the extension board. So, I was stuck for a few days with one “dead end” of an error code.

After a much needed break, I processed all that I had learned, read, and tested during my previous attempts. This morning I didn’t intend to mess around with the Raspberry Pi, but after taking a few classes on Team Treehouse, I felt inspired to give it another go.

With a fresh mind, I decided to go back to the original source I was following for my particular kit and setup. The reason why I hadn’t used this code in the first place was because it was for a more complicated program than what I was trying to setup. But then I went back to the instructions and tried to setup the more complicated program. Although that still didn’t run, it did help me create a must-needed file for my setup.

Then, after trial and error of various forms of code, I noticed that the LCD screen began to blink. The blinking matched up to the code of five seconds. Finally, I had received some sign that the communication between the components was working. But, the screen was too bright and there was no text. Then, I remembered from all of my reading the previous days from various sources and forum responses that the nob on the back of the LCD screen needs to be adjusted sometimes. So, I adjusted it, and black text boxes appeared. One step closer!

Finally, I looked at the code for the more complicated program and started deleting the stuff that I didn’t think I needed. After more trial and error of deleting, altering, and re-entering code, the LCD screen finally lit up with the famous words: Hello World!

But it wasn’t perfect. There were some strings of code running across the screen that shouldn’t have been there. After I finally isolated the code that ended up working and saving a new file, I tested it again to see if the fix was complete. After a couple of more trial and errors, unpinning and re-pinning the wires…it finally worked!

Here were the main issues:

  • This setup required a code specifically for the GPIO extension board and ic2 connection. Out of all the sources I had researched online, none had the exact address specifications that this required except for the example code in the ultimate beginner kit tutorial book.
  • This here was the key factor in getting the code to run:

PCF8574_address = 0x27  # I2C address of the PCF8574 chip.
PCF8574A_address = 0x3F  # I2C address of the PCF8574A chip.
# Create PCF8574 GPIO adapter.
try:
mcp = PCF8574_GPIO(PCF8574_address)
except:
try:
mcp = PCF8574_GPIO(PCF8574A_address)
except:
print (‘I2C Address Error !’)
exit(1)

  • I had also created another file titled PCF8574.py with code from GitHub by Freenove.
  • Another step that was important were these imports:

from PCF8574 import PCF8574_GPIO
from Adafruit_LCD1602 import Adafruit_CharLCD

Admittedly, my best friend was FaceTiming me as I was doing this, and when the code ran the second time across the LCD screen I was so happy to share that moment with someone. I screamed in excitement and showed my friend the words across the screen, and she called over her daughter to see as well.

Small backstory: My best friend’s daughter is incredibly smart, and a Minecraft Master, so I’ve been trying to pass on the coding bug to her through Minecraft. I sent her the whole code of Minecraft and told her to just read it and see if it made any sense. When she came over to the screen to see the Raspberry Pi, I showed her the code and explained what the experiment was and how it worked.

But we all know that seeing is believing. So I told Sammy that I would make the screen say her name. A couple of clicks later, the screen displayed “Hello Sammy!” and I showed it to her. She was elated with a big smile, as if I had performed a magic trick!

What a rewarding moment. I had imagined what the moment would be like when I got this to work, I had even accepted the fact that it may not work, and that I would have to try a different route completely, but I never expected it all to have unfolded in such a beautiful way.

I think what made this time different than the previous was that I wasn’t going by too many forums or outside advice. I just used the one code from the direct source, all I had learned from, and tried to get it to work from there the way I wanted. And it did!

Through this project I realized my pattern for learning will be exactly this: study through online sources like Team Treehouse and Udemy, and then take “breaks” with Raspberry Pi projects. The back and forth of the two helps me not rush through the online programs too fast. I don’t want to just pretend like I’ve learned this, I want to really learn this, and therefore I want to pace it in a way that truly allows my brain to digest all of the new information.

I ended the fun project by sharing the news with my friend and the forum I had gone to help for in the previous attempt. I’ve never really been an active forum member before, but I see now how some online communities can be really comforting and helpful!

Now, onto the next project!