teleren/devto huggingface dataset:
Learning Python- Intermediate course: Day 28, Summary of the week
Tags: learningpython, python, tutorial, programming
Published: 2021-09-18 04:24:16

### Summary of the week

> **[Day 25](https://dev.to/aatmaj/learning-python-intermediate-course-day-25-buttons-entry-and-textboxes-2d0n)** We covered the entry, button and the text widget. The **button** widget is a simple button which executes a action when clicked on. `button=tk.Button(form,text="Press Me",command=cmd)` The **entry widget** is a widget which accepts a single line input (text) from the user. `entry = tk.Entry(parent)`. The value of the text can be obtained using the `get()` function. **Textboxes** are just the same as entry widgets, the only difference is that we can add multiple lines to it. Just replace 'Entry' by 'Text' and you are done! Using the height and width attributes, we can set the number of input characters in each line. for the textbox. `text=TB1.get(1.0, "end-1c")` returns the value of the text.

____

> **[Day 26](https://dev.to/aatmaj/learning-python-intermediate-course-day-26-password-manager-tkinter-17p9)** We practiced the widgets learnt in the previous part by building a password management application. The application consists of two entry widgets and one button widget. In order to hide the password, we can use the show() attribute of the entry widget. `TB1=tk.Entry(form,width = 20,show="*")` This hides the passwords in the widget.

____

> **[Day 27](https://dev.to/aatmaj/learning-python-intermediate-course-day-27-entry-keypress-event-5d15)** We learnt about the keypress event. The keypress event is run when the user presses a key on the entry widget. In this part, we made a spyware application to scan the keys typed into the entry widget. Be sure to check the program later.

____

*Epilogue*- We all know that neither me nor you have ever seen each other. Learning in remote environment is a difficult, and teaching is perhaps even more difficult. Teaching is never a one-way process. When a teacher teaches with pattern, he/she expects that the student must respond back. Either with doubts, remarks or nods of approval. 
But friends, being remote, we cannot interact with each other. The only way we can connect is through the comments below. So I urge everyone to comment on the posts. Currently I am in doubt whether you all are understanding me or not. Should I speed up the pace or maybe explain more clearly? I am not getting any feedback from you. Any doubts, discussions, remarks or even a simple hi from you is a great source of motivation for me. So I look forward to your comments below...😊
> *For those who have not yet made account in Dev.to, you can have a free easy sign-up using your mail or GitHub accounts. I would suggest the budding developers to create your GitHub free account right away. You would require to register sooner or later anyways*

🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
Next day will begin from Tuesday📅
Reviews, Issues, and Tissues.
Published: 2021-09-18 04:01:10

This week in my open source class we had the opportunity to review classmates source code. 

I did really well at not peaking and seeing other classmates code for the release0.1. However, this proved to be a weaker strategy. I ran into more issues by not reading about the issues and difficulties my peers faced. For example, I approached the CLI options completely differently than everyone else. Had I put myself forward and opened a discussion - i believe I would have saved much more time, and created better code to support the feature. 

Reviewing my peers code was very interesting. There were similarities and differences in how we approached the task, coded, and used logic. Some of the issues with the program were already shared with me by the author. This made me realize that my peer had already tested their program thoroughly and were working towards fixing their issues. I went ahead and forked, cloned, and ran the program anyways. 

I reviewed the code and noticed a lot of commented code - similar to mine. The comments were mainly console.logs to save the date and provide actual feedback to what was happening. 

I went ahead and made an issue about this. I also submitted one about the readme which had some typos and could be refined. They can be found here: 
https://github.com/Reza9472/StaticSiteGenerator/issues/1
https://github.com/Reza9472/StaticSiteGenerator/issues/2

I got reviewed by the same peer, and I had actually only posted a skeleton of my work. As you will see from my other blog... I had difficulties deciding an approach. Therefore many of the issues were actually resolved. 

The whole process of reviewing was fairly fun as I was able to analyze and provide feedback where my code had strengths, but I also got feedback on where my code had weaknesses. This was a nice because there were some things that I actually did not take notice of. For a while I forgot to implement the output of an actual html file. I got worked up on the additional features - so seeing the issue there that there was no actual output reminded me!
Build a React accordion widget in 2 minutes
Tags: react, accordion, usestate
Published: 2021-09-18 03:59:11

This is my first post in dev community. Today, I want to share build simple plain accordion using react. This section is really important section of an app or a website, since you have an opportunity to have important questions and answers about your services/product or even your industry and rank better organically in Google.

I hope I'm able to help anyone who wants or needs to build an accordion section for their website or their app.

I'm leaving the URL of the code and styles at the end of the article and also a working demo if you want to check it out.

We will use React useState hooks. Which is enough to accomplish the accordion implementation.

Simple Click event,

```

  const [active, setActive] = useState(-1);
  const accordian = [
    {
      title: 'Accordion 1',
      paras: [
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
      ],
    },
    {
      title: 'Accordion 2',
      paras: [
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
      ],
    },
    {
      title: 'Accordion 3',
      paras: [
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.',
      ],
    },
  ];

  const handleClick = (index) => {
    if (index === active) setActive(-1);
    else setActive(index);
  };
```

Then we have the DOM rendering part of the code using an onClick and ternary operators, like so

```
<ul className="accordian">
        {accordian.map((item, index) => {
          return (
            <li
              key={index}
              onClick={() => handleClick(index)}
              className={index === active ? 'active' : ''}
            >
              <div className="accordian-title">{item.title}</div>
              <div className="accordian-content">
                {item.paras.map((para) => {
                  return <p>{para}</p>;
                })}
              </div>
            </li>
          );
        })}
</ul>
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8iy29rkz1z21i15n6b4i.jpg)

demo link: https://stackblitz.com/edit/react-u5w7ex
Rust Static Site Generator (RSSG Release 0.1.0)
Tags: opensource, rust
Published: 2021-09-18 03:58:52

This assignment was assigned to us with the task of creating a static site generator using any language of choice. The tool converts files from txt format to html files. For this assignment I used Rust :)

# Features

### Version

By using the -v or --version flag the user is able to see the version of rssg

### Help

By using the -h or --help flag user is able to see help information

### Input

The program accepts inputs from the user using the -i or --input flag. Acceptable inputs are files and or folders

### Output
Output is stored in a current directory in folder named dist

### Formated HTML

Paragraphs are outputted in a formatted and clean way 

### Title Substitution

By having the first line as title with 2 empty lines following. A title tag and h1 is generated automatically in the html output

# Demo

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ls1si3ltmz4kxis85cet.png)

is converted to

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxot1qjnvcpnvp7q9fyz.png)
 

#USAGE

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jiekksl0twj6ehxpwl6r.png)

# Github

https://github.com/Antonio-Bennett/rssg
My first experience co-operate with other student in programming
Published: 2021-09-18 03:57:47

#Met Alex

During the SSG development through Release 0.1 in the OSD600 class, the professor gave me the role of working with one of my classmates and reviewing each other's code.

I checked Slack a little late, and while I was looking for a classmate to work with, I was kindly offered to work with Alex Romanova. As I am using the same language, Nodejs, I was very curious and happy, so I had high expectations.

#Co-operate each other

Alex's api is called <strong>NODESSG</strong>, and it is very strongly appealing to itself what function and what language it operates in, and I was curious because it was very similar to my api.

The code brought me another unfamiliarity with my code, and it was a series of amazing experiences. But, very sadly, when both me and Alex ran each other's code, we found a <a href="https://github.com/juuuuuuun/jun-ssg/issues/1">bug</a> where the html content was all in the h1 tag.

This was the biggest challenge for us among many other issues. This is because other problems can be quickly identified and solutions can be applied, but the problem is not easily solved. But, fortunately, my great colleague Alex gave us a clear <a href="https://github.com/juuuuuuun/jun-ssg/issues/1">answer</a> to the problem, and fortunately we went beyond that and can focus on improving the task at hand.

#Experience

In fact, I had a very arrogant thought that if I didn't find out, other students would probably not know, because I had never collaborated with other people before this class, so I had a very arrogant thought. However, through this collaboration, I felt the value of collaboration and the efficiency through collaboration of other collaborators. There is a lot to learn from others. But, unfortunately, I failed to understand and master all the code of my very good collaborator Alex. Because I've seldom done anything like that. However, this is also a valuable experience, so through continuous practice, I will further improve my skills in looking at other people's code and finding things to learn.

As a result, the collaboration was successful and I can say that Alex and I had an enjoyable and informative experience 
(Alex right? (๑˃̵ᴗ˂̵)و).
Fuel Efficiency Estimator
Tags: python, programming, computerscience, functional
Published: 2021-09-18 03:55:15

```python
# feul_efficiency.py
#   This program calculates the feul efficiency of a multi-leg journey.
# by: Scott Gordon

def main():
    print("***** Welcome to Fuel Efficiency Estimator *****")
    print("Hit enter to signal the end of the trip.\n")

    distance, fuel = 0.0, 0.0
    input_str = input("Enter gallons and miles (comma separated): ")
    while input_str != "":
        inputs = input_str.split(",")
        gallons, miles = int(inputs[0]), int(inputs[1])
        print(f"MPG for this leg: {miles/gallons:.1f}")
        distance = distance + miles
        fuel = fuel + gallons
        input_str = input("Enter gallons and miles (comma separated): ")

    print(f"You traveled a total of {distance:.1f} miles on {fuel:.1f} gallons.")
    print(f"The fuel efficiency was {distance/fuel:.1f} miles per gallon.")

if __name__ == '__main__':
    main()
```
Photo by <a href="https://unsplash.com/@sippakorn?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">sippakorn yamkasikorn</a> on <a href="https://unsplash.com/s/photos/gas-station?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
release0.1
Published: 2021-09-18 03:44:47

Where do I start?

What I should have been asking myself was "WHEN do I start?"

Release0.1 has ensured that my summer vacation daze is over and that reality is setting back in... specifically the reality that programming takes more time than I think.

Approaching this project I have never made a CLI tool. I was sure this would be simple. However that's where I want to paste the following quote: 
"Simplicity is the most difficult thing to secure in this world; it is the last limit of experience and the last effort of genius."

My first approach was to create a node file and use scripts to control what functions to run. Then I went to bash. Then I went back to nodejs. Then I was fed up half way and decided to do C++. I don't even finish looking up how to read a file before I say "Let's try Golang". Then I realize all of this is a horrible idea and go back to Nodejs. I see ONE typo that was crashing the whole program. I fix it. I work for 2 hours and get a lot done - I can do this. Suddenly everything starts going wrong...

This guide I was following to help me get started... It's not doing what I need it to. What? 

I start to look through my project and I realize this was a horrible idea. Let's find the guide on "fs" and use that to write the code.

OK! Nice! It's working. Let's do the two implementations.

Uh-Oh! The command line options were not actually working this whole time.

The amount of sadness I felt was massive. I have to start all over... I take 10 minutes and I realize this is what It's going to be. I did not allocate enough time to test and ensure it's good. I start submitting the files on GitHub...

I look at some peers source codes to compare the methods we used. I realize there is a lot I understand now... There's so much I can do with the project once I fix the options feature. There's actually A LOT I can do.

I learned so much just by seeing some of the code from my peers. I think as a complete introvert, I will be stubborn when it comes time to collaborate, but we should have had more discussions. I should have made the time to open conversation. Why was I so stubborn?
Working together in Open Source Projects
Tags: opensource, c
Published: 2021-09-18 03:43:13

## The start
After finishing the features of my command line application tool [shinny-ssg](https://github.com/hphan9/shinny-ssg), I was working with Diana to cross-check the source code of our projects. In general, we have to check for bugs, suggest improvement, and file issues on Github. 
We both use C# and .NetCore 3.1 to create the projects and therefore, the experience was quite exciting and I definitely learned a lot.
It is just a pleasure to work with Diana. I have known her previously from my database and web classese and knew that she is such a hard working and bright girl. In addition, Diana worked at the company which I am now doing the internship at. She has used C# for a long time and have great knowledge about it. This was very evident from her code. 
## The Process
I tested her application [glazed-donut](https://github.com/dbelokon/glazed-donut) with all test cases and her code nailed it. All the features worked as expected and it generated appropriate messages to the users when there were any errors/exception. The only problem I could find about it is in [generateHTML method ](https://github.com/dbelokon/glazed-donut/issues/3), which she should have replaced the `<br\>` with white space. Other than that, just a few minor typos on the read me file, but nothing major. 
When she reviewed my code and tested my app, I appreciated that she really spent the time to check every detail, giving me very sound advice and helped me file bugs which I did not find before. 
First, she mentioned the [naming convention](https://github.com/hphan9/shinny-ssg/issues/1) in C# and explained in details the good practices in the industry. Second, she found a [bug in my Page class](https://github.com/hphan9/shinny-ssg/issues/2) which created an extra `<head> </head>` tag. Third, my [exception handling](https://github.com/hphan9/shinny-ssg/issues/4) was not good enough and she guided me to make it better. 
In the end, I am able to fix most of the issues but I need more time to improve the code and make it flawless. 
## Final Thought
I really appreciated Diana for reviewing my code so thoroughly. I found that testing and reviewing code is great way to learn and improve your knowledge/code design.
Thank you :)
Passing Thought: All code starts to look the same
Published: 2021-09-18 03:40:45

This language, that language... No denying they have their quirks. Just a note here to those that might need it. 

If you're scared of other languages than the one you mainly use, try some others :) 

It's not as scary is it seems.

*All code starts to look the same (in a good way)*
Doing code review
Tags: github, opensource
Published: 2021-09-18 03:30:45

After finishing my static site generation program, I partnered up with [Oliver Pham](https://dev.to/oliverpham) so that we could both review each other's code. 

## Issues with my code: 
A list of issues can be viewed [here](https://github.com/TueNguyen2911/tue-1st-ssg/issues?q=is%3Aissue+is%3Aclosed). 

My program was not perfect in many ways, I expected it to have some flaws which turned out to be true. 

The issues weren't severed, the program still functioned fine, but the HTML files generated had quite a few HTML markdown errors and the `help` command didn't print enough information. After some discussions, Oliver managed to fixed those issues easily, he also caused [a bug](https://github.com/TueNguyen2911/tue-1st-ssg/issues/5)  but quickly patched it up. 

## My contribution to my partner's code
You can take a look at its issues [here](https://github.com/oliver-pham/silkie/issues?q=is%3Aissue+is%3Aclosed)

I was excited to look at his Python code for the same program which is a language I haven't tried. Luckily, Python is not a hard language to jump into and his code was readable. 

The first by I found was that his program couldn't open files encoded in `utf-8` because Windows' default is `Windows-1252`. 

The second bug was caused by the input path having the current path, ex: `./file.txt`, the program couldn't parse the title from such file path. 

Lastly, one of his functions that parses title from the text file(s) was a bit confusing so I shortened it using some regular expressions.

## Conclusion: 
This activity actually gave me more joy and more experience collaborating, I thought it was gonna hard as I was giving away my code for another person to criticize. 

In the end, it motivated me to test his program with a view to returning his help finding fault in my program, I wouldn't have this experience doing solo. Also, getting to actually use Github, making pull requests, talking to other devs, learning more about Python are valuable lessons to me.
Static Site Generator - TextHTMLPress
Tags: opensource, python, pelican
Published: 2021-09-18 03:26:59

This week, to create a static site generator is the goal. I named my generator as TextHTMLPress, and it is a command-line static site generator for generating a complete HTML web site from raw data and files. This tool is written in Python.

To write a tool like this is a challenge to me. I spent time on understanding the idea, reviewing other similar projects' source code. Pelican is one of the open source project I referred to in this project. 

My school has a quite large open source community on Slack for the students to connect and communicate with each other like a professional software developer would do. I found a partner on the Slack, and his project is written in Typescript. 

I found it quite interesting to work with someone who is writing the similar project as you but in a totally different way. We reviewed each other's repo on Github, and provided issues to improve our projects. I think one important thing to work with others is to check your notifications more often.

The biggest challenge to review other's code is that we wrote in different languages. I used modules in Python, and he used packages in Typescript. If we want to understand each other's code, we need to search for the proper usage for those modules and libraries. Of course, the syntax also matters. I rarely use Typescript. so when I just started to review his source code, I found it is a little bit weird for me to understand every steps. 

When I was reviewing his code, I found his README file is a little bit simple for the person who has few experience with the Typescript. So I filed an issue to his repo, and to suggest him to improve his README file.
[README.md Enhancement](https://github.com/BeAmazedVariable/TS-SSG/issues/1)

He also filed me an issue, which is my tool has a conflict between the title and the first paragraph. My title will be treated as a paragraph. To fix this, I need to remove several lines in my code.
[Title/Paragraph Conflict](https://github.com/Qiwen-Yu/TextHTMLPress/issues/1)

After this whole process, I think the ability to review others' source code efficiently could be a really important part when doing the open source project. We need to understand others' thoughts and their way to implement the project.

I think the next step of improving my project is to make my HTML look nicer and responsive. Making proper fonts and style for the HTML.