teleren/devto huggingface dataset:
Create Rock-Paper-Scissor Game in Python
Tags: python, beginners, tutorial, programming
Published: 2022-06-02 05:44:32

**First Import Library "random"
with:**

```
import random
```

**Set Default Score with:**

```
user_wins= 0
computer_wins= 0
```
**Give Options:**

```
options= ["Rock", "Paper", "Scissor"]

```
**If Users want to quit:**

```
while True:
    user_input= input("Enter Rock, Paper, or Scissors or Q to Quit: ")
    if user_input == "q" or user_input == "Q":
        break

```
**What will Happen when user enters Rock, Paper or Scissor:**

```
    if user_input not in options:
        continue
    random_number= random.randint(0,2)
    # rock: 0, paper: 1, scissor: 2
    computer_pick= options[random_number]
    print("Computer picked: ", computer_pick + "\n" "You picked: ", user_input)

    if user_input == "Rock" and computer_pick == "Scissor":
        print("You win!")
        user_wins += 1

    elif user_input == computer_pick:
        print("It's a tie!")
        
    elif user_input == "Paper" and computer_pick == "Rock":
        print("You win!")
        user_wins += 1

    elif user_input == "Scissor" and computer_pick == "Paper":
        print("You win!")
        user_wins += 1

    else:
        print("You lose!")
        computer_wins += 1
```
**Print the final score:**

```
print("You won: ", user_wins, "times.")
print("Computer won: ", computer_wins, "times.")
if user_wins > computer_wins:
    print("You are the winner!")
elif user_wins < computer_wins:
    print("Computer is the winner!")
else:
    print("It's a tie!")
print ("Thanks for playing!")
```
**Check out full code here: [Source Code](https://github.com/MrKrishnaAgarwal/Rock-Paper-Scissor)**

**Output:**

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

_Keep Coding & Keep Learning
Stay Tuned for more!_
aspect-ratio in css
Tags: css, webdev, programming, discuss
Published: 2022-06-02 05:24:35


## Usage :

Ther is a property in css called aspect-ratio
for example you have a video on your website its dimensions is <u>16:9</u> in the mobile media you have to resize it so it probably will lose its dimensions, so we can do that

`video {
  aspect-ratio: 16 / 9;
}`

now you can resize it as you want!

## My Question :

- My Question here is there any prefixes for this property ?
- I have searched a lot and i really want to know!
📢 IT'S HAPPENING! Aviyel is Now LIVE on product hunt!
Tags: startup, discuss, opensource, nft
Published: 2022-06-02 05:08:48


### BIG Announcement📣: Aviyel Rewards platform is live on Product Hunt Right NOW!!

Aviyel Rewards Platform, one of our most aniticipated and most awaited features, has finally live on product hunt right now!! 🐱💜

![Product Hunt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/699h5iqauosh9m31lxp8.png) 

We are building Aviyel as a full spectrum OS for open source projects to analyze, motivate and engage with the community. For community leaders, our community dashboard provides a single unified interface with the most comprehensive data points for analyzing community activities across platforms. Our events platform is ideal for open source community gatherings, roadmap discussions, office hours, and more. We also have a seamless collaborative content creation platform to share and exchange knowledge. All of this is clubbed with contributions ( both code and non-code ) across various multiple platforms through our rewards platform.

Aviyel's main goal is to educate people about the advantages of using open source software and to build bridges between various groups in the open source community.

## WE'RE HAVING SOME AMAZING GIVEAWAYS!

We'll send amazing gifts and surprises 🎁🎁 to the top 30 active fans/voters if we win Product of the Day on [Product Hunt](https://www.producthunt.com/posts/aviyel-rewards). There are only a few hours left, so upvote and provide your feedback as soon as possible!


Here is the link: [https://www.producthunt.com/posts/aviyel](https://www.producthunt.com/posts/aviyel)

Aren't you pumped? We can't wait to celebrate this milestone with you!
My first Blog - How to write 8log🙂🙂
Tags: blogging
Published: 2022-06-02 05:08:10

## Let's start today's blog with the topic How to write Blog🔥

`Blogging` is the best way to share your skill, experience, knowledge, mistake and many other things you have been learned throughout your journey to the new comers in your field. It help a lot to the beginners what to do and how to do and overcome you mistake.

Today's world🌎 is advancing beyond we think. Small contribution to this world make one step far in advancement. The best way to do such thing is Blogging so place your finger in keyword and just write.

This is also my first blog giving you the knowledge How to write Blog?? sound weird😄.
But Giving you little much knowledge which helps you little bit that's sound better🙂.

I wouldn't give you the best tip and do many mistake and You laugh😂 on it and you avoid mistake done by me. That's the thing I want. In this way, Mistake is passed as knowledge. This is the beauty of Blogging🙂.

There are some tips that I will follow throughout my blogging journey. They are:

## 1. Just start to write anything that you think

Starting to write is toughest, make it as easy as possible. I also hesitate to write but overcoming this fear I started it. To be honest, If you started to write blog , you will stop at the end of your blog. Something you will stop when brain stop to think what to write then you must take break and relaxed automatically new ideas will born as the word for your blog.

## 2. Title is everything
We should name your blog in a descriptive and helpful way which makes reader to attract towards your blog.

## 3. Unique voice
Always be unique to write. Rather than copying other write simple which makes feeling of **This blog is written by me**. Get inspired by other content creator but don't forget what you are and who you are!

## 4. Try to read your blog as reader
Assume that you are reader and think🧐 what you want from this blog and write it.
It help a lot to find the mistake and you can easily refactor it.

## 5. Consistently in blogging
Blogging is the skill which is improved when we write blog again and again. 
It increases your productivity, perspective and confidence when you are consistent 
in blogging. Sharing my opinion, This is also my first blog I don't know what will be in future but there is a **will** to do something today.


## Summary
Blogging is the skill of sharing and gaining the knowledge. It help you to be what you want. New ideas and concept are born automatically in this field. Just it need practice like as other work. In blogging, Our improvement are easily detectable. It gives awesome refreshment when we read our blog.


Thanks for reading🔥
Giving your precious time to read it. `Its awesome😎`
Anyone on Twitter? Let's connect!
Tags: discuss, personalbranding
Published: 2022-06-02 04:17:55

---
title: Anyone on Twitter? Let's connect!
published: true
description: 
tags: discuss, personalBranding
//cover_image: https://direct_url_to_image.jpg
---

I feel like this community is more active for me than on Twitter. So I post here to ask if there is anyone here also on Twitter, let's connect!

My account: [@vietmle_](https://twitter.com/vietmle_)
JS Interview Question #3 (Polyfill for array.flat())
Tags: javascript
Published: 2022-06-02 04:15:53


Read more articles in [Think1s](https://think1s.com)

```javascript 
const arr = [2, 3, 4, [5, [6, 7, [8, 9]]]];
  function flatArray(arr, depth = 1) {
    return depth > 1
      ? arr.reduce((acc, curr) => {
          acc = acc.concat(
            Array.isArray(curr) ? flatArray(curr, depth - 1) :curr);
          return acc;
        }, [])
      : arr;
  }
  console.log(flatArray(arr, Infinity));
```

Click here [Object flattening](https://www.think1s.com/2022/02/javascript-qa-series-3.html)

Read more articles in [Think1s](https://think1s.com)
Complex datatypes in Django
Tags: django, python, sql, object
Published: 2022-06-02 03:59:05

I have to show which doors in a building people can open with their keys.  There are 4 tables I have to get through to do it.  The ORM is just not cutting through it (or it does but it takes a minute for some folks with master keys to load all of the doors).

So my options are:
1. Create calls to StoredProcedures and let the DB engine do it's thing faster.
2. Create database views and let the DB do it's thing faster.
3. Other ideas?

We already have and use Triggers, StoredProcedures and Views in the database, so there is no prescient precedence to do things any particular way.
4 Steps to evaluate if a process can be automated
Published: 2022-06-02 03:20:15

An [RPA](https://www.uipath.com/rpa/robotic-process-automation) developer must know how to quickly identify if a process fits for automation.

There are to many sets of criteria to take into account but let's keep it simple and try to figure it out with 4 steps.

**1. Rule based:** The decision made (including the data interpretation) in the process can be captured in a pre-defined logic. The exception rate is either low or can be included as well in the business logic.

**2. Repetitive Process:** We can find 4 types of processes
    

- Manual and non-repetitive: the process steps are performed by humans and can be different every time the process is executed.
 

- Manual and repetitive: the steps in the process are performed by the user, and at least some of them are the same every time.
 

- Semi-automated & repetitive: some of the repetitive steps have already been automated (using macros, Outlook rules, and so on).

- Automated: there are processes that have been already automated using other technologies than RPA.

Processes that need to stay manual or are non-repetitive, due to the high exception rate or factors that cannot be integrated in a business logic, aren't good candidates for automation.

**3. Standard Input:** This set of criteria determines how hard it is to automate a process:

- Number of Screens: RPA works by programming the robot to perform tasks at screen level (when the screen changes, the logic has to be taught). The higher the number of screens, the more elements have to be captured and configured prior to the process automation.

- Types of applications: Some applications are more easily automated (such as the Office suite or browsers), others heavily increase the automation effort (Mainframe, for example). And the more different applications there are, the number of screens will increase, as well (see previous point).

- Business Logic Scenarios: An automation's complexity increases with the number of decision points in the business logic. Basically, each one could multiply by two times the number of scenarios.

- Types and numbers of inputs: As previously stated, standard input is desirable. Yet there are cases in which one standard input (such as an invoice) has to be configured for each supplier that will be affected by the automation. Moreover, non-standard input can be of different complexity grades, with free text being the most complex.

**4. Stable:** Processes that have been the same for a certain period of time and no changes are expected within the next months are good candidates for automation, provided they meet the other criteria as well.

By using these 4 steps to evaluate processes we can have an idea of the automation potential and complexity.
web3 - metamask api study(1)
Published: 2022-06-02 03:18:25


I'm trying to implement the feature that recognizes metamask wallet, and ultimately connects with the application so that the user can simply sign up or login with metamask login. Just like how opensea sign up / login works. 

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

- metamask api: https://docs.metamask.io/guide/getting-started.html#basic-considerations, https://docs.metamask.io/guide/ethereum-provider.html#table-of-contents

## 1. Original Code

I was following this code in the README.md of [MetaMask/detect-provider](https://github.com/MetaMask/detect-provider)

Initially, I'm working on HTML/Javascript mode (not nodejs yet) to test simple functions first. And the repo README's sample HTML code was giving an error.

## 2. error

```
await is only valid in async functions and the top level bodies of modules 
```

## 3. Solution

[Fix - Await is only valid in async function Error in NodeJS](https://bobbyhadz.com/blog/node-await-is-only-valid-in-async-function#:~:text=The%20error%20%22await%20is%20only,directly%20enclosing%20function%20as%20async%20.)

As it explained in the blog, the error occurred because it was using top level await without setting. It required to change `type= module` in `package.json` or script tag.

So the HTML code in the README.md should be like below

```
<script src="https://unpkg.com/@metamask/detect-provider/dist/detect-provider.min.js"></script>
<script type="module">
  const provider = await detectEthereumProvider()

  if (provider) {
    // handle provider
  } else {
    // handle no provider
  }
</script>
```
How to Create a Download Button Using React
Tags: webdev, css, javascript, frontend
Published: 2022-11-14 14:35:07

---
title: How to Create a Download Button Using React
published: true
date: 2022-06-02 03:09:54 UTC
tags: webdevelopment,css,javascript,frontend
canonical_url: https://thelearning.dev/how-to-download-files-on-button-click-reactjs
---

#### A guide on creating a download button using React.

![](https://cdn-images-1.medium.com/max/1024/0*xqyPKaWSUKLDpS3l)

When I was building [100 Ideas](https://100ideas.in), I wanted to give users an option to export their content in a text file. It was super simple. This post is an attempt to share that knowledge and log it for the future. Assuming you already know the basics of React, let's begin.

#### Create a Button

```
<div className="btnDiv">
     <button id="downloadBtn" value="download">Download</button>
</div>
```

#### Add Event Handler

```
const downloadTxtFile = () => {
    console.log("download logic goes here")
}

<div className="btnDiv">
     <button id="downloadBtn" onClick={downloadTxtFile} value="download">Download</button>
</div>
```

Next, we need to hook an event handler to the button's onClick event. Let's do that and see if everything works.

#### Add Download Logic

To download a file, we need four things.

1. The content that's supposed to go into the file
2. The file object
3. A link to download the file object
4. Finally, simulate that the user clicking the link

```
const downloadTxtFile = () => {
    // text content
    const texts = ["line 1", "line 2", "line 3"]

// file object
    const file = new Blob(texts, {type: 'text/plain'});

// anchor link
    const element = document.createElement("a");
    element.href = URL.createObjectURL(file);
    element.download = "100ideas-" + Date.now() + ".txt";

// simulate link click
    document.body.appendChild(element); // Required for this to work in FireFox
    element.click();
}
```

**Notes**

1. Date.now() is to add the timestamp to file downloads
2. The file blob doesn't add a newline to the texts automatically. You can use [texts.join('\n')] to add a new line

_Originally published at_ [_https://thelearning.dev_](https://thelearning.dev/how-to-download-files-on-button-click-reactjs)_._

* * *
Extract dates from HTML
Published: 2022-06-02 02:41:17

Olá,

vou ensinar uma forma de extrair dados de uma classe em HTML usando JavaScript.

Lembrando que ainda estou estudando e essa é uma maneira que encontrei para fixar meus estudos.

Digamos que você deseja retornar o IMC de um paciente, porém só tem os dados de peso e altura (que é o que você precisa para calcular o IMC).

Primeiro, você deverá, como boas práticas, criar um arquivo separado para o JS. Para isso, você deve utilizar o comando:

 <script src = "nameOfArchive.js"></script>

 no final de sua classe body.


Após criar o arquivo separado para o JavaScript, vamos buscar os dados que você deseja trabalhar.

Vamos trabalhar só com um paciente, o id dele será #first-patient no entanto.

Para fazermos a busca do paciente em JavaScript, devemos usar o DOM ()
Web3 Solidity + JavaScript 32 hour course recap #6
Published: 2022-06-02 02:38:00

timestamp 1:58:55-2:23:32

Due to poor management skills, I wound up starting my daily lessons after my bedtime yesterday.

Which is a shame because this was when things were starting to get interesting and I wrote my first Solidity contract!

It was also one of those things where I said, "Well, I will stop after the first commercial break." and then there wasn't a commercial for the entire hour.

So, we used the [Remix IDE](https://remix.ethereum.org) in the browser. Although I downloaded the remix extension for VS code, but I couldn't figure out how to actually compile or run it locally.

We spent some time going over types, and made our first function.

There are a couple of important tabs in Remix, but overall this was an engaging and important study session!
Thoughts About Tech Of The Day After Tomorrow
Tags: discuss
Published: 2022-06-02 02:29:52

*(2022.06.02)*
>💭 There are <mark>‎‎⠀too much⠀</mark> (`apps`, `frameworks`, `languages`, `libraries`, `tools`...) to choose.
Would it be <mark>⠀less and unified⠀</mark> ?

What I mean, of course, is that those stuff do pretty much the same thing. Their most obvious difference are the name, owners, target audience.

---
How to target resources on Terraform
Tags: devops, terraform, aws, azure
Published: 2022-06-02 02:08:39

[Terraform Target](https://www.bitslovers.com/terraform-target/)

1. How can we target resources on Terraform?
2. How to Target a Module
3. When to avoid using Target on your Terraform code

Thanks for reading! [Terraform Target](https://www.bitslovers.com/terraform-target/)
Terraform Random Password
Tags: devops, terraform, aws, azure
Published: 2022-06-02 02:02:45

[Terraform Random Password](https://www.bitslovers.com/terraform-random-password/)

When you are creating your Infrastructure as Code with Terraform you don't need to rely on another language to generate secure passwords.

Let's see different approaches to generating random strings using simple resources on Terraform.

Here the article [Terraform Random Password](https://www.bitslovers.com/terraform-random-password/)
Releasing MineTrax 1.0.0-alpha! A Web Suite for Minecraft Servers.
Tags: minecraft, laravel, javascript, opensource
Published: 2022-06-02 01:32:53

Finally after 1 year of work and 6 months of procrastination on my hobby project I am finally releasing it.

Check out here: https://minetrax.github.io

It is not complete! There are lot of features and improvements I want to do but currently I am in the drained out phase and probably feedbacks might help in it.

### What is MineTrax?
MineTrax is a web suite & analytics tool for your minecraft servers. Using it you can improve your server engagement by providing a unified dashboard for players to visit and view their player data, or you can keep everything private and use it only for analytics, choice is yours.
There are skills you need to develop outside of textbooks and leetcode when studying for programming interviews
Published: 2022-06-02 01:22:25

Which is why you need to supplement your studying with mock interviews.

Practicing mock Interviews can help calm your nerves, get you used to explaining your thought process, and get comfortable with the interview process🕺

Check out one of our VR mock interviews (LC 20) to get an idea of what to expect when you sign up for a mock - [https://www.youtube.com/watch?v=8OIq7G7w_30&t=1s](https://www.youtube.com/watch?v=8OIq7G7w_30&t=1s)

### Other Mock Interview Resources:

[Why mock interviews are important](https://fangprep.substack.com/p/why-mock-coding-interviews-are-important?s=w)

[How to get value out of your mock interviews](https://fangprep.substack.com/p/how-to-prepare-for-a-mock-interview?s=w)  

### Join the Community:

Looking for a study partner or community of people to hold you accountable? Hackpack is a hyperactive community of engineers all studying for programming interviews.

Apply Here: https://www.hackpack.io/

[Big Tech Interview Newsletter](https://fangprep.substack.com/)
ArchLinux & CUPS
Tags: printer, archlinux
Published: 2022-06-02 00:23:45

It has been a long time since I posted something.
One big reason I had to stick with Windows at work was printing stuff. I got a brand new mini PC with 16GB with Windows 11.

I decided to dual boot with Arch Linux (ArchLabs) because I had to install it quickly. I am using i3 with it.

To install your wireless printer:

For quickness I installed YAY as my installer

1. In terminal: yay cups or just sudo pacman -S cups
2. add yourself to the lp group;
   a. sudo su
   b. usermod -aG lp {username}
   c. exit
3. sudo systemctl enable cups.service
4. sudo systemctl start cups.service
5. reboot
6. download the driver by searching through the AUR repo.
7. Go to browser and type in "localhost:631" without the quotes
8. Find printer
9. Add the printer
10. change the connection to ipp://ip.addr.of.printer/ipp or

lpd://ip.addr.of.printer/queue/ <~ this one seems to be working better.

That's it.

It took me a long time to get this figured out.

If you don't know how to get the address of your printer, I would suggest go to the printer and print a report of the printer, the newer printers typically has the network information. If that doesn't work, go to your modem/router admin page to find it that way.

I also post this for my future self.
CRAN Checks API and Badges
Tags: r, cran
Published: 2023-02-21 17:34:27

---
title: CRAN Checks API and Badges
published: true
date: 2022-06-02 00:00:00 UTC
tags: r,cran
canonical_url: https://recology.info/2022/06/cran-checks-badges/
---

## TL;DR

1. In 6 months (end of November 2022) the CRAN Checks API [https://cranchecks.info/](https://cranchecks.info/) will be gone
2. You can still get badges at [https://badges.cranchecks.info](https://badges.cranchecks.info)
3. You can use the new badges like:

```
[![cran checks](https://badges.cranchecks.info/worst/dplyr.svg)](https://cran.r-project.org/web/checks/check_results_dplyr.html)

```

Find more details at [https://github.com/sckott/cchecksbadges](https://github.com/sckott/cchecksbadges)

## Sunsetting the CRAN Checks API

If you contribute an R package to [CRAN](https://cloud.r-project.org/), you may use badges from the CRAN checks API at [https://cranchecks.info/](https://cranchecks.info/). The CRAN Checks API has been operating [since about September 2017](https://dev.to/sckott/cranchecks-an-api-for-cran-check-results-pb6-temp-slug-3604313) (I think).

The API has a number of routes, but really people only use the badges.

Given this usage pattern, and not wanting to pay for a server anymore, I’ve decided to make the badges available on a static endpoint that doesn’t cost me anything. There are costs of course - but they’re on Github and Netlify (thanks y’all!).

## The new static site version

The static site is created using GitHub Actions.

For a static site you need to create files for any route you want to support - so the code for the static site creates 19 routes x No. of CRAN packages = approx. 360,000 svg files.

The badges will be updated once a day - the same schedule as the API.

I had to use Netlify because Github pages (as far as I know) doesn’t provide ssl certs for custom domains and my domain host doesn’t provide free Lets Encrypt certs - whereas Netlify does.

Some example routes you can look at

[https://badges.cranchecks.info/summary/taxize.svg](https://badges.cranchecks.info/summary/taxize.svg)[https://badges.cranchecks.info/worst/dplyr.svg](https://badges.cranchecks.info/worst/dplyr.svg)[https://badges.cranchecks.info/flavor/r-devel-linux-x86\_64-fedora-clang/DT.svg](https://badges.cranchecks.info/flavor/r-devel-linux-x86_64-fedora-clang/DT.svg)

If you find any issues with the badges at [https://badges.cranchecks.info](https://badges.cranchecks.info) [open an issue](https://github.com/sckott/cchecksbadges/issues).