teleren/devto huggingface dataset:
7 Command Prompts for Windows you must know
Tags: console, terminal, programming
Published: 2022-05-21 12:36:07

It continues to exist and is a very underrated tool on Windows: Command Prompt.
There are a lot of commands that you should know because they are useful for your daily activities and are more quick than a lot of UI interfaces.

I choose seven of the most useful command prompts.

## Ipconfig
This command shows the IP Address of your computer.
If you want to renew your IP Address, you can launch the command **ipconfig /release** and then **ipconfig /renew** .
With the parameter /flushdns you are goingo to refresh your DNS address.

![Ipconfig](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8c2txngawafidk9gm2yt.png)
 
## Netstat
This command shows the active open ports and the related IP Address.

![Netstat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1cr5l82i6l78smkpjevu.png)
 
## Ping & PathPing
The command ping sends four test packets (four by default) to the specified address or IP Address.
If you are able to communicate with the remote address, you see the time of the roundtrip.

![Ping](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0d6r3a7rwry39u6eugp4.png)

The pathping command is very similar but it shows all the information about the route of the packages.

![Pathping](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyfsu3p6726f3jf51508.png)
 
## Tracert
This command in very similar to the Pathping but it shows how much time each hops needs to be performed.

![Tracert](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yhkpyklrexwje10ztt8.png) 
 
## Shutdown
I think this command doesn't need any introduction.
By default it shutdowns your computer, but if you add the parameter /r, it restarts your computer.

## Tasklist && Taskkill
This command provides a list of the current processes running on your PC.

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

If you want to kill a running task, you can use the command taskkill -pid followed by the process ID that you can find the in previous command.

## Cls
Clear the command prompt screen. It useful if you want to restart from scratch after a lot of commands.

## Conclusion
There are much more commands that you can use from the Command Prompt.
These are just the most common which I use everyday a lot of time.
Write your favorite command in the commands and I will update the post. 😉
ESLint and Prettier
Tags: coding, eslint, prettier, webdev
Published: 2022-05-21 12:30:17

Hello amazing folks!🙂

Let's discuss something interesting today.

Let's understand what and why about `Eslint` and `Prettier`.

Imagine working over a project with more than `10 developers` to achieve a vision 🧑‍💻. After **3 months** you realize how messy things are now 🤒. 

![Frustrated Face](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mj74p02ozzzvvttsvo3u.png)

Funny part is even the person who wrote the code is confused in their own code 😂.

Want to avoid such scenario ? 😶

Form a structure which everyone will follow while writing their codes to make it easily understandable by everyone ✌. Sounds easy right ? But will everyone follow those things that seriously 🤔!

![Thinking Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zy3tw9t303ngh4atxxq.png)

Think about someone getting added to the team. The person is a little freedom lover and mostly forgets to follow those set of rules. 😐

Hmm... code getting messed slowly right ?

Ya that's what `Eslint` and `Prettier` comes into play 😃. `Eslint` and `Prettier` are used to format the whole codebase into some set of rules.


> Like there should not be any console log while pushing any code to production . Mainly done to ensure there is no printing of sensitive data on the logs.

Want to have a peak on how it looks ? 

```
{
    "semi": true,
    "tabWidth": 2,
    "printWidth": 100,
    "singleQuote": true,
    "trailingComma": "none",
    "jsxBracketSameLine": true
}
```

Here's a peak of the configuration of the `Prettier` . You can see there are rules which can be made true based on your need.

Want to read more 👉 [https://prettier.io/docs/en/index.html](https://prettier.io/docs/en/index.html)

```
{
    "rules": {
        "semi": ["error", "always"],
        "quotes": ["error", "double"]
    }
}
```

A small peak of `Eslint` , you can set types as warning or error. Forcing developers to follow a proper structure of coding.

I know ! I know !

Many people will think _why force some rules while coding to developers. Let them code freely without any rules and restrictions_ 🤔.


![Why?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90eqethev42rq62wtfmn.png)

I also used to believe the same !

But when I was working over a project with other developers, I **understood how difficult it becomes when you have to read others messy code** 🙍‍♂‍. 

I know maybe it's sometimes painful but it's worthed. As clean coding is always tough for developer but when the project becomes large it becomes very easy for new developers and the existing developers to work on it 😉.

![Let's rock it](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4o0uoer6b34knv277ea.png)

I would say. Just try it , I can give you guarantee you will fall love with it 👍.

And at last I want to say 👇

Keep coding #️⃣ , keep rocking 🚀
Simple Snake Game -Written In Svelte
Tags: javascript, svelte, webdev, beginners
Published: 2022-05-21 12:28:13

You can fork this simple snake game hosted on GitHub, and then the job's done.

## Deployed: 🤯
https://goysif.csb.app/

## Version Control + Documentation 🤐
https://github.com/JavascriptDon/SimpleSnakeGame

## License: 📝
This project is under the MIT License (MIT). See the LICENSE for more information.

## Contributions:
Contributions are always welcome...

🔹 Fork the repository
🔹 Improve current program by
🔹 improving functionality
🔹 adding a new feature
🔹 bug fixes
🔹 Push your work and Create a Pull Request
importing data problem because of i18next
Tags: react
Published: 2022-05-21 12:14:14

Hi guys, I have my constants.js script and TimeLine.js script. I want to import data from the constant.js to the TimeLine.js, but I want to use i18next library. How can I translate my constant.js data with i18next? 

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

I know that I can't do that like on the screenshot above. But I don't realy know how to solve this problem in a proper way.

Here below is my TimeLine.js script.

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

Can I solve the problem in that way? 

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

If yes, that I don't know how to import it in TimeLine.js script.

Thanks in advance for your help!
A Useful Custom Function to Debug Firestore Security Rules
Tags: firestore, firebase
Published: 2022-05-21 11:57:52

Firestore security rules provide a function [`debug`](https://firebase.google.com/docs/reference/rules/rules.debug#debug), which logs the given value to `firestore-debug.log` (only when using the Firestore Emulator; it's no-op in production). But it just prints the value, with no information on its context. When your security rule doesn't work as expected, you might wrap every suspicious expression with `debug` and then struggle to figure out the correspondence between each log entires and the plenty calls to `debug`.

What if there's a function to log custom messages that explain why the request is denied? Like:

```js

allow get: if
  // logs "not admin" if the user's role is not admin
  assert(request.auth.role == "admin", "not admin") &&
  // logs "email is not verified" if email_verified is false
  assert(request.auth.email_verified, "email is not verified");
```

Actually, you can implement this `assert` function! The definition is:

```js
function assert(condition, message) {
  return condition || debug(message) && false;
}
```

When `condition` is truthy, it just returns `condition`. Otherwise, it logs `message` to `firestore-debug.log` and returns `false`.

I hope this function helps you debug your security rules!
Error when update @adonisjs/ally version 2.1.3 to 4.1.3
Tags: javascript, adonisjs
Published: 2022-05-21 11:27:46

After I updated @adonisjs/ally version from 2.1.3 to 4.1.3 and then I got error Cannot find module 'Model. I comment AllyProvider line and run again, It's not error but I can't login both facebook and google. I'm not sure, I do something wrong. (I use adonis 4.1.0) Thank for your suggestion. I spend many time for update adonisjs ally version to 4.1.3

**Error that I got**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e794yt8vh465vm3x6bsm.png)

**I comment access provider ally in app.js**

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

**In my package.json**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/faydsy89c15s0qz91gtv.png)
Css is Not Rendering On React App
Published: 2022-05-21 11:04:52

Hi , I am learning React Js from it's official docs . As the official docs says , the CSS code , the square box for tic tac toe is not rendering on localhost frontend although I have put the CSS code in that file properly.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sz7gyagyjoer0r216i2r.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rsstqozjnrvmeofyo5o9.png)
how to find programmer friend ?
Published: 2022-05-21 10:50:21

Hello
i am programmer not pro and not beginner.
my favorite programming language is javascript typescript dart and java.

**i like find programmer ** for discuss about programming and other topic about technology.

my name is iliya and im 21 years old.

is there anyone help me ?

email: ilidevloper@gmail.com
telegram ID: ili145
Variables
Published: 2022-05-21 10:40:03

integer o'zgaruvchi doim butun son Z to'plam
float kasr son

`cout`-council output
`cin`-council input

int + int = int
int + float = float

\n- endline qisqartirmasi stringni ichida 1 qator tawidi

`%`- qoldiqli bo'lish

//- kommentga olish

cin dan keyin >> 
cout dan keyin <<

`char`- belgi character,harflarni o'qiydi;
faqat bittagina belgini sig'diradi.
 - char a;
  cin >> a;
  cout << char(a - 32);
shu yerda kichik harf kiritsak katta harf chiqarib beradi.
O'zgaruvchilar
Published: 2022-05-21 10:38:27

## 

> integer   doim butun son Z to'plam
> float     kasr son
> True 1
> False 0
> input output stream <iostream>
> cout council output
> cin  council input
> endl( "...\n" endline qator tugaganini bildiradi 
> Alt+Shift+Down 
> String " " 
> stringni ichiga olib yozsek matn db qabul qiladi
> // bu belgi komentariya izoh qoldirish
> \ bu slash 
> cin  dan kegin >>
> cout dan keyin <<



#include <iostream>

using namespace std;

int main()
{
int a;
cin >> a; // cin kiritilgan o'zgaruvchilani shartida nima berilgan bo'lsa misol hozir int ga moslab ko'radi mos kelsa oladi

cout << "a\n";  

return 0;
} javob a



#include <iostream>

using namespace std;

int main()
{
int a = 10, b = 3 ;
float c = 2.9 ;  
cout << a/c ;

return 0;
}  javob 3.44828

_**_#include <iostream>

using namespace std;

int main()
{
int a = 10 , b = 3;
cout << a % b;   // % bu berilgan sonni hisoblab qoldig'ini oladi

return 0;
} javob 1_**_





#include <iostream>

using namespace std;

int main()
{
  int a,b ;
  cin >> a >> b ;
  cout << " a * b = " << a * b;

  return 0;
}  
javobga  30 73 ni kiritaman 
a * b = 2190



**CHAR belgi character
 faqat bitta belgini sig'diradi**


#include <iostream>

using namespace std;

int main()
{
  char a , b ;  // char __ o'zgaruvchining turi ; 
                  a, b ___ o'zgaruvchining nomi
  cin >> a >> b ;
  cout << a << b;

  return 0;
} 




**#include <iostream>

using namespace std;

int main()
{
  char a;
  cin >> a;
  cout << char(a-32);

  return 0;
}
javob 
c kiritsam
C (katta C kelb chqdi)
**
React Important concepts you should know
Published: 2022-05-21 10:30:24

React important concepts can help you write cleaner code, better code, and optimize performance. in this article, I will share five React best practices you should know of.

####  1. Use Higher-order Components (HOCs)
A higher-order component is an advanced technique in React that is used for supercharging and reusing components. it takes a component as its argument and returns something else



```javascript
const EnhancedComponent = higherOrderComponent(WrappedComponent);
```



> Whereas a component transforms props into UI, a higher-order component transforms a component into another component.

#### 2. Properly understanding The UseEffect Hook
This is one of the important things because if you do not understand this you will not get anywhere in React. I can't emphasize enough the dangers of this hook, you should properly understand this hook and how it relates to the `usestate` hook so you won't get a lot of infinite loops. I like to think of this hook as middleware that runs after the component has been rendered initially, I could talk more about it but that's the article for another day follow me if you want to read that.

#### 3. Lazy loading images in React
Multiple images can severely affect the performance of any application, To compact this, we avoid loading all the images at once. With lazy loading, we can wait until each of the images is about to appear in the viewport before we render them in the DOM.

#### 4. Code-splitting in React using dynamic `import()`
By default, React apps render their final bundle in one giant file, the good side of this is that it reduces the HTTP Request we might be making for different files, but as your app grows bigger the file size increases this becomes a serious problem. With code-splitting, React allows us to split a large bundle file into multiple chunks using dynamic import() followed by lazy loading these chucks when we need them with React.lazy

#### 5. Build Custom Hooks
we have a bunch of important hooks available to us by default for us to use, but to extend the component logic further it is important we build custom hooks. Custom React hooks are an essential tool that let you add special, unique functionality to your React applications.

#### 6. Bouns 
it also important to understand the following:

1.  [Custom Hooks](https://reactjs.org/docs/hooks-custom.html)
2. [React's rules of hooks](https://reactjs.org/docs/hooks-rules.html)
3. [React Fragments](https://reactjs.org/docs/fragments.html)
4. [React context and context API](https://reactjs.org/docs/context.html)
5. [React portal](https://reactjs.org/docs/portals.html)
6. [JSX Rules](https://medium.com/nerd-for-tech/jsx-rules-in-react-a-javascript-framework-4b0ab66fdbf9)
7. [Refs and DOM](https://reactjs.org/docs/refs-and-the-dom.html)

#### In conclusion
Those are the important concepts I think you should understand. if enjoy it leave a reaction and follow me for more peace.
LimeSurvey HelloWorld Plugin
Tags: php, yii, limesurvey
Published: 2022-05-21 09:23:50

The following code is needed to run a simple command on the command line within LimeSurvey.
Your folder structure under `upload/plugins` should be like this:

- HelloWorld
  - config.xml
  - HelloWorld.php

```xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <metadata>
        <name>HelloWorld</name>
        <type>plugin</type>
        <lastUpdate>2022-05-21</lastUpdate>
        <author>My Name</author>
        <authorEmail>My Email Address</authorEmail>
        <authorUrl>MY Homepage</authorUrl>
        <license></license>
        <version>1.0.0</version>
        <description><![CDATA[This Plugin does some magic on the command line]]></description>
    </metadata>

    <compatibility>
        <version>5.0</version>
        <version>4.0</version>
        <version>3.0</version>
    </compatibility>
</config>
```

```php
class HelloWorld extends PluginBase
{
    protected $storage = 'LimeSurvey\PluginManager\DbStorage';
    static protected $description = 'HelloWorld';
    static protected $name = 'HelloWorld';

    /**
     * subscribe to all needed events
     * @see https://manual.limesurvey.org/Plugin_events
     */
    public function init()
    {
        /** @see https://manual.limesurvey.org/Direct_(command) */
        $this->subscribe('direct');
    }

    /**
     * php application/commands/console.php plugin --target=HelloWorld
     */
    public function direct()
    {
        $event = $this->getEvent();
        $target = $event->get('target');
        if ($target != get_class()) return;

        echo 'HELLO WORLD' . PHP_EOL;
        exit;
    }

}
```

In LimeSurvey's PluginManager `scan files`, install and activate the plugin.
Then on the command line run: 
`php application/commands/console.php plugin --target=HelloWorld`

And hopefully you can see: Hello World

Bye!
Why JS Ecosystem is a MESS?
Tags: javascript, webdev, beginners, programming
Published: 2022-05-21 10:16:01

Every month, GitHub dependabot notifications force you to upgrade some dependency or another, so what could possibly go wrong? At least, that's what I thought.

After the upgrade, the project refused to build with the error 
`Syntax Error: TypeError: eslint.CLIEngine is not a constructor.`

Really? A syntax error in a tiny project that was building just fine before the upgrade, and that too, not in the little code I wrote, but in the tooling?

I don't recall any language's environment being "modernized" in this way, becoming so absurdly intricate that one would mistake it for a joke. Naturally, the symptoms were visible with the [leftpad](https://www.infoworld.com/article/3047177/how-one-yanked-javascript-package-wreaked-havoc.html).

With each upgrade, I'm sick of seeing breaking changes in WIP projects.

Is this something I'm experiencing alone?

What are your thoughts on the matter? 
I'd be delighted to hear it.

Please share your views on this.
Python - How To Play Mp3 File
Tags: python
Published: 2022-05-21 10:09:59

This tutorial explains how we can play mp3 files with Python using packages like pygame, vlc, playsound and webbrowser.

Play Mp3 Files With Python Using the playsound Package
One simple way to play an mp3 file using Python is with the help of playsound library. It can be used to play both .mp3 and .wav files.

import playsound playsound.playsound('sample.mp3') 
It plays the sample.mp3 file placed in the current working directory. If the .mp3 is placed in any other directory, make sure you pass the path of the mp3 file relative to the current working directory.

If you don’t have the playsound package installed on your system, you can install it with the command:

pip install playsound 
Play Mp3 Files With Python Using the pygame Package
pygame is a collection of modules that provide access to hardware components of the system like sound, mouse, keyboard, and so on. We can use this package to play mp3 files in Python.

import pygame pygame.mixer.init() pygame.mixer.music.load('sample.mp3') pygame.mixer.music.play() 
This code snippet plays the sample.mp3 file in the current working directory. If you face a problem playing mp3 files using pygame, you can convert the mp3 file into .wav format.

If you don’t have pygame package installed on your system, you can install it with the command.

pip install pygame 
Play Mp3 Files With Python Using the vlc Package
We can also use the vlc package to play mp3 files in Python.

import vlc p = vlc.MediaPlayer("sample.mp3") p.play() 
This code snippet plays the sample.mp3 file in the current working directory.

If you don’t have vlc package installed on your system, you can install it with the command:

pip install python-vlc 
Play Mp3 Files With Python Using webbrowser Package
import webbrowser webbrowser.open("sample.mp3") 
The code snippet will open a tab in browser window and play the sample.mp3 file in the current working directory.

Play Mp3 Files With Python Using the os Package
We can use music players on our system to play mp3 files through Python. For this purpose, we take help of os module.

The native media players vary across different operating systems. Hence, the code for one platform might not work on another.

We use the following code snippet for the Linux platform to play mp3 files using the os package in Python.

import os  os.system("mpg123 " + "sample.mp3") 
If you don’t have mpg123 installed on your Linux system, you can install it using the following command:

sudo apt install mpg123 
For macOS, we use the following code snippet to play an mp3 file using os package in Python.

import os  os.system("afplay " + "sample.mp3") 

[dzchoice](https://www.dzchoice.com/)
Conditional Statements 2
Tags: programming, beginners, tutorial, python
Published: 2022-05-21 10:05:48

In the last lesson I discussed conditional statements using the if-else keywords, but what is you want to create a nested if statements so different variables can produce different results
You can then use the if...elif...else or as is can also be called nested if statement.
So rather then writing code like
Code:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6gkmd6vsemwkz657iduc.png)
 
Output:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyhumiiqtvpmo7hgzhcg.png)
Here's how to write it:
Code:

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

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

An example of a practical application of this is a code I wrote in the GPA calculator post.

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

Here it shows different outputs for different conditions fulfilled. 
NOTE:You can also use boolean operations in and if else statement an example is 

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


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

Hope you enjoyed this lesson, thanks for reading, like, share, comment, next post will be available next week.
Roast the code #1 | Rock Paper Scissors
Tags: typescript, fun, roastthecode, watercooler
Published: 2022-05-21 09:56:45

Hey there! 👋

I'm starting a new series called "Roast the Code", where I will share some code, and let YOU roast and improve it.

There's not much more to it, just be polite and constructive, this is an exercise so we can all learn together.

Now then, head over to the repo and roast as hard as you can!!

{% github https://github.com/nombrekeff/rock-paper-scissors %} 

> If you want your code to be roasted on the series, please contact me in the comments or send my a PM here on DEV. And I will share it in a future instalment of the series!