teleren/devto huggingface dataset:
JavaScript Introduction
Tags: javascript
Published: 2022-01-28 04:02:05

**What is JavaScript?**
•	JavaScript initially used for “make web pages dynamic”.
•	JavaScript is one of the scripting languages which is dynamic computer programming language to make web pages for browser.
•	JavaScript is lightweight interpreted programming language.
•	JavaScript is not platform dependent. For example- we can write code in one machine and run to another machine. It’s work fine.
•	JavaScript makes static HTML web pages into dynamic web pages.
•	JavaScript was first released in 1996, alongside initial support for CSS and extensions to HTML.
•	The recent JavaScript ecosystem has many libraries and frameworks.

**Why we should learn JavaScript?**
•	To become successful front-end developer and software engineer.
•	JavaScript is used for web application and mobile application.
•	Most popular programming language in the word.
•	A great supply of JavaScript jobs.
•	Its super popular.
•	JavaScript supports your coding style.

**Features in JavaScript**
•	JavaScript is case-sensitive language.
•	JavaScript used looping statement.
•	JavaScript provide validation for user input.
•	JavaScript handling date and time. For example-
•	The JavaScript says, “Good Night, isn’t it? Or “Good Morning”, depending on the current time. It also tells you today’s date.
•	Good night, isn’t it? Today is Wednesday, 20 February 2019.
•	JavaScript performing simple calculations.
•	JavaScript is platform independent.
What is The Neighbourhood
Tags: community, friends, computerscience, intro
Published: 2022-01-28 04:01:24

I've been interested in building a community for my fellow computer science people for as long as I remember. I guess it all started when I was nominated to be president of the computer club in high school. I really like being part of a community. Something of our own.

Later I tried many times to build this community in university and even after dropping out of university. But nothing seems to work. Finally I opened up a chat group with my friends in Facebook messenger and started sharing thoughts there.

## It doesn't have to be great

I had grand plans. Doing open source projects together. Making the community viral. Even setting up mentoring schemes. But none of that worked out because I really didn't have the time to do these things. But it ended up being this amazing place where I have people I know, sort of like neighbours, where I can talk when I get frustrated or when I am excited or when I need advice. And now I realise I like this just the way it is.

And that is a short introduction to The Neighbourhood.
Getting started with Git day 03 :).
Tags: git, github, programming, productivity
Published: 2022-01-28 03:54:11

In day 3 I have learned git merge's:
- Fast forward merge:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2i5x7qymxo1vgqogt42u.png)

- Recursive merge:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/31m5gmynuh13751jcerg.png)

> And I also learned about conflicts during merge. and how to resolve that conflict.
Web Scraping with Python and Selenium.
Tags: python, webscraping, data, selenium
Published: 2022-01-28 03:51:19

Data is vital for informed decision making because it provides reliable insights. However, we need to source the data before we can use it for analysis. Web scraping is a one method that can be used to leverage the large amount of data available on the web by extracting specific information from a website using selectors. 
For a better understanding of selectors you can check [this resource](https://web.dev/learn/css/selectors/). 

**_Selenium_**

Selenium is a tool used for automating web browsers and functions on various browsers, OS and can be used in different languages.
For this project, I will use selenium and the Chrome browser.
You need to have the chrome web driver which can be downloaded [here](https://chromedriver.chromium.org/downloads) depending on your chrome version.

We are going to scrape PURPINK which is a Kenyan online gift shop.

**_Scraping_**
Import selenium for browser automation and for locating elements on the website. 
Import Options to run chrome in headless mode meaning you can launch the browser without creating a browser window.
```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
```
Specify the path of the chrome webdriver and the website URL.

```python
options = Options()
options.add_argument("--headless")  # prevents opening browser window
options = options
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)

driver.get("https://www.purpink.co.ke/collections/her")
```
Inspect elements on the website to retrieve the name and price of each product and write the results to a csv file.

```python
product_names = driver.find_elements_by_class_name("product-thumbnail__title")
product_prices = driver.find_elements_by_class_name("money")

filename = "purpink.csv"
headers = ("Brand,Price(Ksh) \n")
f = open(filename, "w")
f.write(headers)

for (product, price) in zip(product_names, product_prices):
    firstPrice = price.text.strip("KSh").split(",")
    finalPrice = "".join(firstPrice)
    f.write(product.text + "," + finalPrice + "\n")

```
The whole project can be achieved by

```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless")  # prevents opening browser window
options = options
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)

driver.get("https://www.purpink.co.ke/collections/her")

product_names = driver.find_elements_by_class_name("product-thumbnail__title")
product_prices = driver.find_elements_by_class_name("money")

filename = "purpink.csv"
headers = ("Brand,Price(Ksh) \n")
f = open(filename, "w")
f.write(headers)

for (product, price) in zip(product_names, product_prices):
    firstPrice = price.text.strip("KSh").split(",")
    finalPrice = "".join(firstPrice)
    f.write(product.text + "," + finalPrice + "\n")
```
   
The code and csv results can be found on my [github](https://github.com/wanguiwaweru/WebScrape).
Today I have attempted 5 java programming exercises 😊.
Tags: java, beginners, news, programming
Published: 2022-01-28 03:47:55

11. Write a Java program to print the area and perimeter of a circle. 

12. Write a Java program that takes three numbers as input to calculate and print the average of the numbers. 

13. Write a Java program to print the area and perimeter of a rectangle

14. Write a Java program to print an flag on the screen. 

15. Write a Java program to swap two variables.

---
> Exercise from w3resourse

---
I am new to programming. I will be happy if you can give some advice..
**have a great day**
Twyman's Law
Tags: datascience, analytics
Published: 2022-01-28 03:21:07

Has something like this ever happened to you?

> You see something crazy on a dashboard - your website traffic doubled today out of nowhere!

> You rule out the usual suspects - no front page of reddit, 	Barack Obama didn't tweet about you. Something else must be going on.

> You changed a button color this morning, could that be it?

> Maybe people really like purple and are sharing links to your site with all of their friends!  Or maybe Google decided to rank your site higher in search results because it looks so much nicer now!

> Either way, you're about to be rich! Time to start looking on Zillow for the next house you're going to buy.

> Wait a minute, you decide to double check that button color change you made earlier. 

> Oh crap! You notice a typo that's making every page view event fire twice!

> Your traffic didn't actually double. The tracking was just broken!

> Next time, $10M mansion, next time.

If this sounds at all familiar, you aren't alone.

[**Twyman's Law**](https://en.wikipedia.org/wiki/Twyman%27s_law) states that the more unusual or interesting a piece of data, the more likely that it's false.

It's in the same vein as "extraordinary claims require extraordinary evidence."

So next time you discover something amazing in your data, your first thought should be "why is this data wrong?" and not "which Hawaiian island am I going to retire to?"
I Made My First RPG in Python
Tags: rpg, python, digitalcrafts, beginners
Published: 2022-01-28 03:06:20

To start, I don't know if playing an RPG in the terminal on your computer will fulfill the full RPG experience. However, building this game in python allowed me to dissect the process of how more complex RPG games are constructed. 

The overall goal of my game is to win a battle against the enemy, Vivian, so that the user can make it to their interior design interview and get the job! The user can choose which character they would like to be during their battle against Vivian. I created a class to make each character and give them their own attributes, such as their own name, starting health level, strength level, and attack options. All characters and their attributes are displayed by invoking a function that I created to print the character menu. From there, the user can input which character they would like to be and the game will continue with that character. Once the user is in the battle with Vivian, they can choose which attack option(s) to use against her and the game will continue until a winner is chosen. I made this possible by creating a game loop that allows the user to attack Vivian and for Vivian to attack back until either one of their health levels reach 0 or below.

If the user does not put in the correct information, the game will not continue until they have provided a choice from the options that are given. This is where I had the most trouble in my code. At one point I thought I was finished creating my game until I did a few test runs and noticed that when I put in the wrong information, the game would not continue as I wanted it to. Having to go back into my code and fix these errors ultimately led to me finding a more efficient way to write my code. For example, initially, I had a lot of repeated code, so when an error would happen, I would have to go back to each repeated line of code and change it in order to find the issue. I quickly realized how inefficient this was and found a way to eliminate the repeated lines by taking some code out of loops and making some information dynamic. Ultimately, I removed approximately 200 lines of code from my file and the game worked even better than it did originally (after I fixed the errors, of course)!

Overall, I had a lot of fun making this RPG! My favorite part of creating the game was that the whole process felt as if I was playing a coding game in Python. I would be coding along and then **BAM**, I was battling a while loop or else statement that wasn't executing properly. Each time I solved an issue in my code and got it working the way I wanted it to, I would do a mini dance to celebrate my victory (for my cat's eyes only)! 

If given more time, I would expand this game into an interior design game that gives the users a certain amount of money and the ability to shop/design for different characters. But, that's for another day!

If you'd like to test my game, here's the link to my [github repository](https://github.com/ciaracloud/python1).
Demystifying Props in React Components
Published: 2022-01-28 02:56:00

This tutorial aims at two things about **props**.

- The purpose of **props** in react component

- How to use **props** in react component

First of all let understand the purpose of **props** in react components. Basically, **props** is a way of passing data from parent component to child component in a react application.

I believe that's simple and easy to understand and achieve since react is a one-way data flow library. ie. data is passed from parent to child.

Now, how do we pass data from child to parent in a react application if the need arises. The answer to the question above is simple, **props**.

To better understand my answer, let look at a scenario using the code below.


![child component without click](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y801xt7g1pcvgo9050cd.PNG)_child component_


![parent component without state](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d370yzf6t2f7rq0qqf7h.PNG)_parent component_



Now if we consider the two component above, how do we then show the age of the child component inside the parent component ?.
This is what I mean by my previous question ie. **How do we pass data from the child component to the parent component ?**

The answer still remains as before ie. **props**. Let see how to accomplish that in our previous code examples.


![child component with onclick](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uh3j1x5scdogq3z4xewz.PNG)_child component_



![parent component with state](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1a9rhb5qamymmyc91ce.PNG)_parent component_


Comparing the parent and child component, we can conclude that, to pass the age value from the child component to the parent component, react makes use of what I termed as **"functional 
 props"**. This simply means a **prop** which is a function.

The age from the child component must be passed as an argument to the functional prop inside of the child component. This is what is happening in the child component with respect to the **showAge** functional **prop**.

As the age which is a state in the child component is passed as an argument to the **showAge** prop, it is then received inside the parent component through a function and then displayed in it **JSX** below.

_I hope you learn a lot about props and how data is passed from parent to child and vice versa in react component_
Card Swipe Animation Material Design
Tags: codepen
Published: 2022-01-28 02:03:18

<p>Card swipe animation based on this Dribbble: <a href="https://dribbble.com/shots/1721120-Keynote-animation-recreation" target="_blank">https://dribbble.com/shots/1721120-Keynote-animation-recreation</a></p>

{% codepen https://codepen.io/Moiety/pen/vwmsj %}
MY PROGRAMMING - HOW DO I GET INTO IT
Published: 2022-01-28 01:27:08


                 I was an ordinary student in a school close to my house, as it was a CBSE school I got a very good opportunity to study. I got fair experience in English. I had no idea about coding and programming kinds of stuff until the 2020 lockdown stricken. I got more time spent in social media and I saw different challenges of coding and hackathons etc. I joined one hackathon for fun and I got into their discord server, I found children younger than me are experts in many languages and I don't even know what is a computer language or skill is by that time. I got into a group with children of my own age and they actually asked me my skills. I was so ashamed of their reply to my answers. i left that meeting and started searching for this stuff and what they actually do. I searched all around and found so many results and tutorials for various languages. there was no access to a computer for me by then but tried to learn basics on my android phone with some tutorial videos I found on YouTube.
 
I got passed from 10th in 2021, after getting admission to a technical high school, my parents bought me a laptop. now I'm learning what real programming is. I got help from my cousin, who is in the IT field, friends, many social media, and YouTube itself for me to improve my skills. I'm not a great programmer now but know C language, C++, and Python Basics.
 
I'm pretty sure that now my only goal is to become a Developer.
 
                                                                                                            - GODLY
Day 518 : Loop
Tags: hiphop, code, coding, lifelongdev
Published: 2022-01-28 01:09:28

_liner notes_:
- Professional : Had quite a bit of meetings today. I got up a little earlier to start working on the demo project. Got a bunch of Web Components integrated and added some more functionality. While I was doing that, my coding partner was working on how to deploy the application. During one of our meetings, we got a chance to demo it. It worked for the most part. Got a lot of good feedback. Spent the rest of the day adding another Web Component and work on converting another one to use a UI library. This last one is the biggest one so I left it for last on purpose. haha.

- Personal : Last night, I worked on the demo application since I knew I would be in a lot of meetings today. I did get to sneak in some coding on my side project. I set up the loop so that it will automatically go from one point of the map to the next in the list. Went to bed pretty early.

![Overhead of a beach in Big Sur, CA, USA with large rock formations coming up out the ocean right next to the shore.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ttbocxqt7gzj0l5o0m80.jpg)

Going to see if I can knock out that last Web Component for the demo project so I can take it a little easier tomorrow and work on the radio show during the day. Oh and I attached the arm thing to my van frame and screwed on the projector and aligned it to show the screen. Looks pretty good. Looking forward to watching movies and anime on it.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube zpnyVtP4znM %}
Best practice for starting with python in VSC?
Tags: python, vscode, testing, lint
Published: 2022-01-28 00:45:49

Hi, I would like to ask for your recommendation about coding in Python, mainly with VSC. I have time coding, but "never" that serious; now, I want to do it like it should be. I have read several Python standards but I have some doubts mainly in Linting, Testing, Virtuals Environments, and Docstrings. I have find some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension.

**Linting**

I was reading about linting [here](https://realpython.com/python-code-quality/) and found several Linters for Python, before that I was using the only one I knew, Flake8. Now, I believe I will switch to Pylama (which has all from Flake8) with Bandit. Both of them are supported in the Python Official Extension by VSC, so I don't know if some knows an argument that will improve the use of both of them. Or if another extension is better to use them both.

I don't like that much code formatting, I feel like it causes more trouble when it changes things

**Testing**

I have little experience with test and I have only use the unittest, but reading [here](https://realpython.com/python-testing/) I believe Pytest is far more complete, should I change to it?

A "basic" test extension is installed with Python Official Extension from VSC, but I don't know if there are better extensions for this. I supposse it is compatible with unittest, pytest and nose. What I don't is how to do test in several Python version with VSC, I believe is a good practice, but I don't know if I must have installed all the other python's versions to do this.

**Virtual Environments**

I know VSC let you have at least 1 virtual environment but I don't know if I can have a venv for each folder (different projects but same workspace) without me changing it manually every time. Maybe is better to have a workspace from each project in this case?

Also, I don't know if I should use pyenv or venv to create the environment, their differences so far seems meaningless to me. I know that you can create conda environments too, but I have never done it, and VSC supports it. Maybe there is good extension for this, I don't trust the ones I have found yet.

**Docstrings**

I use the Numpy format, which is in the Python Official Extension, I complement this with Python Type Hint to write better documentation in my code. I don't think there is another extension that can help me to document my code.

Well, I know I might be asking for a lot, but I have read about it on my own, so I needed someone else's recommendation for this. Thanks for your help.
[BTY] Day 4: Read through a MLops case study in real scenario
Published: 2022-01-28 00:44:50


**From business context:**
![Business Context](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0467l9e4snaotseq4vgf.png)

**Turn to an ML System as follows:**

_The data process in a bond scoring ML system_
![The data process in a bond scoring ML system](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adqq7t6kn6avwi0dltkn.png)

_The training and inference pipeline for a bond risk model_
![The training and inference pipeline for a bond risk model.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgdtdp8jbiknmiw0fn03.png)
 

I like the wrapping up section of the author:

>  The best advice I give to companies now is to be proactive about tooling portability. Upgrades to MLOps tooling are going to happen every 18 months to 3 years because there are too many stages of MLOps for one tool to be the jack of all trades and the best in breed practices are evolving. Being able to quickly adapt to the right ensemble of tools for your team and your organization will accelerate the adoption of ML in your organization, and ensure ML can provide convincing value to stakeholders.

Read it here: https://alexchung1.medium.com/case-study-of-mlops-in-a-hedge-fund-from-zero-to-30m-f524b05788ff
#27 - Your order, please CodeWars Kata (6 kyu)
Tags: javascript, webdev, tutorial, 100daysofcode
Published: 2022-01-28 00:37:11

##Instructions

Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.

Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).

If the input string is empty, return an empty string. The words in the input String will only contain valid consecutive numbers.

**Examples**

> "is2 Thi1s T4est 3a"  -->  "Thi1s is2 3a T4est"

> "4of Fo1r pe6ople g3ood th5e the2"  -->  "Fo1r the2 g3ood 4of th5e pe6ople"

> ""  -->  ""

---

##My solution:

```javascript
function order(words){
  let arr = words.split(' ')
  let r = []
  
  arr.forEach(word=>{
    let x = word.split('')
    let num = x.find(el=>parseInt(el))
    r.push([word,parseInt(num)]) 
  })
  
  r.sort((a,b)=>a[1]-b[1]).map(x=> x.splice(1,1))
  return r.join(' ')
}
```
---

##Explanation
First I spliited the words string, and I made a variable "r" with an empty array.

> let arr = words.split(' ')
> let r = []

---

After that I looped the splitted words array with a .forEach(), 

-Inside of that loop I splitted the word that is being iterated
> let x = word.split('')

-I extracted the number of it, finding in the splitted word the element that can be parseInted

> let num = x.find(el=>parseInt(el))

-And then I just pushed to the "r" array an array with the word and the number inside of it

> r.push([word,parseInt(num)]) 

I would get something like this:

> [ [ 'is2', 2 ], [ 'Thi1s', 1 ], [ 'T4est', 4 ], [ '3a', 3 ] ]

---

Then I sorted the "r" array, but using the 1st index of the array, so I sort it by the numbers inside of the arrays with the words, and then when it is sorted I just spliced the numbers inside every array, so I would get something like this:

> [ [ 'Thi1s' ], [ 'is2' ], [ '3a' ], [ 'T4est' ] ]

At the end I just returned "r" but joined with spaces, so I get a string like this:

> "Thi1s is2 3a T4est"

---

**What do you think about this solution? 👇🤔**

[My Github](https://github.com/Cesardlr)
[My twitter](https://twitter.com/cesar__dlr)
[Solve this Kata](https://www.codewars.com/kata/55c45be3b2079eccff00010f)