teleren/devto huggingface dataset:
What are Multi-line Programs in JavaScript
Tags: javascript, codenewbie, programming, beginners
Published: 2022-08-11 18:06:48

You already know how to write simple single-line JavaScript programs that output a line of text to the console. This is an achievement in itself, but real programs contain a significant numbers of lines: from ten and hundreds for small scripts to serveral thousand for large projects. After reading this post, you will be able to write programs that can output several lines of text into the console at once.

## Example

Let's start with an example of such scripts. The following code prints exactly three lines of text, each from a new line:

```JavaScript
console.log("I");
console.log("know");
console.log("JavaScript");
```

A line break can also be done using the symbol `\n`:

```JavaScript
console.log("I\nknow\nJavaScript");
```

The output of these two code samples will be the same:

```Plain Text
I
know
JavaScript
```

Try [running](https://replit.com/languages/javascript) these scripts yourself to see that it works.

## Empty Line

The `console.log` function also allows you to output an empty line without any information in it:

```JavaScript
console.log("I");
console.log();
console.log("know");
console.log();
console.log("JavaScript");
```

Here's the output:

```Plain Text
I

know

JavaScript
```

---

### Let's connect 💜

You can connect with me on [Twitter](https://twitter.com/MrDanishSaleem), [LinkedIn](https://linkedin.com/in/mrdanishsaleem), [GitHub](https://github.com/mrdanishsaleem/), [Discord](https://discord.com/users/890596597610737774/)

---

### Support me 🤝

You can support me on [Buy Me a Coffee](https://www.buymeacoffee.com/mrdanishsaleem)
The morning is wiser than the evening
Tags: devjournal, personal
Published: 2022-08-11 18:04:00

There’s a saying from where I come from that goes like “The morning is wiser than the evening”. I often contemplate about it and try to live by it in my own life.

What I get out of that saying is that making hasty decisions or acting upon an initial surge of negative emotion are often regrettable later on. I see actions triggered by negative emotions as problematic because they tend to have bigger consequences that we don’t really consider at the time.

What I try to do instead is give it some time, think about it, wait for the negative emotion to go away, wait until the morning. It can be challenging sometimes, especially when the decision needs to be made now or the emotions are high. But
But what I have found out ever time is that the morning gives me something which the evening can’t - I wake up “wiser”. With a fresh mind. Things have settled. My mind has had time to process the information. Then, more often than not, it’s easier to make a decision, or the action I was so eager to do is not really worth it anymore.

I believe that this “tool” has helped me avoid many unnecessary conflicts, has helped me in my decision making, and has helped me have a more peaceful life.

---

Photo by <a href="https://unsplash.com/@dartmoordog?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Tim Riesner</a> on <a href="https://unsplash.com/s/photos/morning?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
React And Firebase Issue
Tags: react
Published: 2022-08-11 17:48:40



I am trying to create a login page for my website by using Firebase as the backend service, but, the page is not working as expected. For Example, if a user tried to sign up, then both the 'password' and 'confirm password' must be the same. I have used try catch block for this. But the error is not showing up accordingly. There is no error in the console or anything, But when I click the submit button, no change is there. The Code for my page is given below https://gist.github.com/Letsbuilditnow/d0d1a4ddda70c07213ff4da31e1577ff
Collaboration
Published: 2022-08-11 17:39:03

Quality communication, at its root, is simply the easy exchange of ideas and is pinnacle to creating an effective team. In my new role at Booz Allen Hamilton, a vast majority of training is dedicated to quality communication through the agile scrum methodology. Specifically, the SAFe methodology. We are taught to define our goals/issues, track our progress with these goals, and on a daily basis communicate our progress with the team. Most surprising to me, is the importance of not wasting time during these sync-ups. Most of these meetings are 15 minutes, but no more than 30. Each developer says what they need to say quickly and accurately, and then passes it on to the next. But good communication comes in many forms. 

On our project, we are working with an open-source platform called Backstage. This platform was created by Spotify to solve a communications issue that stagnated the developers efficiency in the quickly growing company. As the company became larger, the ability to share code, tools, docs, etc became exponentially harder. In order to solve this issue, a platform needed to be created where everything across teams could be easily located on a uniform UI. Backstage has increased Spotify's efficiency and significantly lowered their onboarding process to such an extent that many other companies, projects, and software teams (including mine), are migrating their software onto the platform, creating an easier way for developers to communicate and share code. 

Quality communication can be accomplished by adopting the techniques listed above - quality meetings, constant communication, and effective tooling. Quality communication will lead to effective cooperation which will lead to a better product
Live Stream on Scrimba
Published: 2022-08-10 19:58:27


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yo4appmrzqrcttdk3oyo.jpeg)Just finished my second live stream of the week, this time as a guest on Scrimba Youtube Live, and it was an amazing experience!

Despite not feeling great before going live, somehow I got into the flow and had lots of energy during the stream.

I don't remember half of what I said (too excited 😅), but judging from feedback, it was very useful and I dropped lots of insights.

We talked about
🔥 learning to code on your own
🔥 getting your first job in tech
🔥 dealing with lack of confidence as a self-taught dev
🔥 managing your mental state while you are trying to break into tech
🔥 and much more!

All important topics that I love talking about.

Watch the recording if you missed the live stream: https://youtu.be/hUPF-VEcSTM

P.S. DM me if you want to create something together. I'd love to be a guest on your show or give a speech or maybe lead a workshop around the topic of building a career in tech. For more examples of my public speaking, check out this playlist: https://www.youtube.com/playlist?list=PLOuFAJN39xtkVrvAzgIl9A2KFHkuEdDiC
SSO and MFA for open source Grafana via Datawiza | Microsoft 365, Azure AD, Okta, Duo, Google, AWS...
Tags: grafana, okta, azure, mfa
Published: 2022-08-11 17:26:00

https://www.youtube.com/watch?v=vAoI2YT_qjc

Setup Datawiza to enable SSO for users to login to open source Grafana in minutes! Datawiza integrates with any identity provider and MFA (2FA) service, like Microsoft 365 (O365; Azure AD), Cisco Duo, Okta, AWS, Google, Auth0, Ping, ForgeRock, OneLogin, ADFS. It supports both SAML and OIDC (OpenID Connect; OAuth).

Datawiza works with any web apps including:
- Business apps, like Oracle PeopleSoft, E-Business Suite, Siebel, SAP and more.
- Homegrown apps written in any language, like JAVA, PHP, .Net, Python, Go and more. 
- Critical tools like Wordpress, Kibana, Kubernetes, Jenkins, Grafana, SuperSet, AirFlow and more. 

Website: https://www.datawiza.com
Book a Demo: https://calendly.com/datawiza/30min
Join our discord server: https://discord.com/invite/Sn3nbc83Up
Import sample database into AWS RDS MySQL using Shell & Workbench
Tags: mysql, database, tutorial, aws
Published: 2022-08-11 17:02:00

[Bytebase](https://bytebase.com/) open-sourced an Employee sample database for MySQL https://github.com/bytebase/employee-sample-database-mysql with two variations: A Full dataset (~170 MB) including 300024 employee records and a Small dataset (~6 MB) including 10000 employee records.

My task was straightforward - import the small dataset into our AWS instances for demo usage.

To start, I downloaded and unzipped the file.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209792330/CMGLPT1LD.png)


And opened the dataset_small.
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209813974/7XgN7WWBp.png)




## MySQL Shell

I would strictly follow the Installation instructions in Readme.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209941189/dpdlpukG5.png)


As a prerequisite, MySQL Shell was installed.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209950875/jxD7YGWU7.png)


However, after installation, I still got this error - "MySQL command not found", where was the execution file?


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649210193822/GYQ581n34.png)

I tried to connect to my AWS MySQL instance, and it worked!

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649694269444/GIRL21zDX.png)


Ensure I was under the "dataset_small" folder, then run the following -- succeeded!

![mysql.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649693488518/5faon3ZE2.png)


## MySQL Workbench

As MySQL Workbench was already installed locally, I would try it as well. I connected it to AWS MySQL instance Dev.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209821541/K4wVNSR6q.png)


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209830590/lcxgagNA_.png)

And let's import the data.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209839729/we1AzK5HT.png)


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209848441/Ib4qg_cpH.png)


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209866345/Ml1gvCmyg.png)


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1649209888111/zrAP2VWiI.png)
when you are wrong
Tags: devjournal, beginners
Published: 2022-08-11 16:56:46

Now regarding your life as a whole, there are things where we know when we are wrong.
I always tend to "borrow" good points of view from one aspect in my life and apply it on another.

We've all made mistakes. And we will continue to make mistakes. The only thing we can do about it is HOW OFTEN do you want to keep making mistakes and how big our mistakes will be. It is inevitable, but surrounding ourselves with good professionals and always talking with your superiors. they will help you!
Top 5 sites to practice UX/UI
Tags: ux, productivity, design, uiweekly
Published: 2022-08-11 16:54:00

🌍🤝Catch me on : 
🔴GitHub: [@deepakydv9315](https://github.com/deepakydv9315)
🔴Codepen: [@deepakydv9315](https://codepen.io/deepakydv9315)
🔴Instagram: [@syco_coders](https://www.instagram.com/syco_coders/)

Hey designers hope you are doing great 🤟, In this post I added 5 trending website where you can find some challenges to master your ui/ux skills.

**1. CROWWWN** 🔗[link](https://www.crowwwn.com/)
![crowwwn](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4quwftimb74ex3130j9.png)

---

**2. UPLABS** 🔗[link](https://www.uplabs.com/challenges)
![uplabs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/amei7wjdl78wrkaurd8e.png)

---
 
**3. BRIEFZ**  🔗[link](https://www.briefz.biz/)
![briefz](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cxjwnu9xzsne1snv4t8c.png)
 
---

**4. UXCHALLENGE** 🔗[link](https://www.uxchallenge.co/)
![ux challenge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uodltci8ymk413354zvx.png)
 
---

**5. UXTOOLS** 🔗[link](https://uxtools.co/challenges/)
![ux tools](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62t2b4ba7bp4i8ngib98.png)
 
---
**Comment if you know the best one 🤝**
Testing HTTP handlers in Go
Tags: go, testing, programming
Published: 2022-08-11 12:32:00

## Introduction

In this example, I will create unit tests using the `httptest` library and we will see how to create test coverage for http handlers.

## How to test http handlers in Go?

So we can test any handler http, we need a structure to be able to store the handler response, such as http status code, headers, body, etc.
The package `httptest` provide the structure [`httptest.ResponseRecorder`](https://golang.org/pkg/net/http/httptest/#ResponseRecorder), that's all we need to store the handler response. 

```go
// NewRecorder returns an initialized ResponseRecorder.
func NewRecorder() *ResponseRecorder {
	return &ResponseRecorder{
		HeaderMap: make(http.Header),
		Body:      new(bytes.Buffer),
		Code:      200,
	}
}
```

## The sample API

In our sample API, we have a handler called *`/check-is-prime`*, which checks if a number is prime. 

The code:
{% gist https://gist.github.com/nicolascb/cc5a51002e5a9ac9e737f4bb831376da  file=example_api.go %}


## The first test

The logic of the tests is very simple, for each test we build the HTTP request and then compare the response.

{% gist https://gist.github.com/nicolascb/f1677d22b80af91e31afd6c931ee0065 file=1_handlers_test.go %}

## Adding more tests

Using table design in tests, its easy to add more cases:

```go
{
    name: "must return http.StatusOk and true to prime number (7)",
    args: func(*testing.T) args {
        req, err := http.NewRequest("GET", "/check-is-prime", nil)
        if err != nil {
            t.Fatalf("fail to create request: %s", err.Error())
        }

        q := req.URL.Query()
        q.Add("number", "7")
        req.URL.RawQuery = q.Encode()

        return args{
            req: req,
        }
    },
    wantCode: http.StatusOK,
    wantBody: "true",
},
{
    name: "must return http.StatusOk and false because number (1) is not prime",
    args: func(*testing.T) args {
        req, err := http.NewRequest("GET", "/check-is-prime", nil)
        if err != nil {
            t.Fatalf("fail to create request: %s", err.Error())
        }

        q := req.URL.Query()
        q.Add("number", "1")
        req.URL.RawQuery = q.Encode()

        return args{
            req: req,
        }
    },
    wantCode: http.StatusOK,
    wantBody: "false",
},
```
Complete code:

{% gist https://gist.github.com/nicolascb/d0ca68cd6951fce74f82a14084597869 file=handlers_test.go %}


## Conclusion

Have these utilities in the Go standard library, helps a lot when creating and maintaining our tests.  We saw in practice with the package `httptest`. 

Another important point is to isolate mux creation, this is necessary to call handlers in tests.
Capturando tráfego com tcpdump
Tags: redes, wireshark, tcpdump
Published: 2022-08-11 16:34:00


## Sobre
Tutorial desenvolvido para capturar tráfego de rede com a ferramenta tcpdump.

## AVISO 
-   Não me responsabilizo pelo o uso desses tutoriais/estudos para fins malignos. Esses tutoriais/estudos são voltados para pessoas de interesse na área de Segurança da Informação e Perícia Forense Computacional.

-  Todos esses tutoriais/estudos foram testados em ambientes isolados por mim.

-  Lembrem-se de que usar essas informações para hackear ou invadir dispositivos alheios é CRIME previsto na [Lei 14.155/2021](http://www.planalto.gov.br/ccivil_03/_ato2019-2022/2021/lei/L14155.htm).

## Ambientes usados 
- Maquina Virtual Kali Linux (Atacante)
- Maquina Virtual com Windows (Alvo)


## Instalação
```
$ sudo apt update -y
```
```
$ sudo apt install tcpdump -y
```

## Iniciando captura do tráfego

### Capturar pacotes de host específico
```
$ sudo tcpdump -v host (ipaddress) -w captura.pcap
```

### Capturar pacotes da rede específica
```
$ sudo tcpdump -v net (networkaddress/mask) -w captura.pcap
```

### ou

```
$ tcpdump captura.pcap
```
### Teste
```
$ sudo tcpdump -v host 192.168.15.143 -w capturas.pcap
```
### Recomendação 
- Visualizar com Wireshark ou programas com o mesmo proposito.

### Imagens do tráfego capturado

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8hncnf4ofb3ptt8poh0.jpg)
Back-End Movement no. 1
Published: 2022-08-11 16:04:54

I realized that the back-end of an application can be quite a messy experience. The shear amount of information absorbed is absolutely overwhelming. 

Fortunately, there is a beautiful melody playing in the background as I navigate through the contents of an application.

Sometimes, you can almost hear it. 

This orchestra(we will call it The Back-End symphony) is the heart beat of the front-end experience. The Back-End symphony changes while improving on parts of itself. It never rest till its a well oiled machine. The conductor(myself) gives the implemented technologies a purpose and helps navigate each through a well define path. 

Once assemble, the application can harmonize with its counterparts.

Oh, how I wished this was as simple as stated above. 

Back-End is a nightmare, but a beautiful one. Its a challenge I've been seeking for many years. I realized how much time and effort is needed to just figure out what back-end technologies best suits a particular situation.

This is why I am so interested in computer science.

Its the vagueness of what one technology can do better than the others is what keeps the conversation moving among software engineers. 

Its the innovations and discoveries that were made while keeping the software engineer engaged and interested in the future.

And, I want to be a part of that world. 

Its hard to say what technology I will be focused on in the next year or so. But, whatever it may be, I am ready to take on the challenge.
New video: Live Q&A session on Luos Discord (Wednesday, August 10, 2022)
Tags: opensource, microservices, help, luos
Published: 2022-08-11 16:01:20

🔴 Yesterday, we held our first live Q&A session on Discord and it was a pleasure to exchange with all of you!

If you missed it or want to watch it again, here is the recording:

{% embed https://www.youtube.com/embed/l25YONqrzPk %}
Reading and writing files in NodeJS
Tags: node, javascript, files
Published: 2022-08-11 15:58:59

## 1. Reading file

```js
const fs = require('fs');

fs.readFile("/tmp/test.txt", "utf8", (err, data) => {
  console.log(data);
});
```

- `fs.readFile(` - reads file and returns data in callback function,
- `/tmp/test.txt` - path to text file to read,
- `utf8` - encoding to read text in,
- `console.log(data)` - log date from file to console.

[Open original](https://onelinerhub.com/nodejs/how-to-read-file) or [edit on Github](https://github.com/Onelinerhub/onelinerhub/tree/main/nodejs/how-to-read-file.md).

## 2. Writing file

```js
const fs = require('fs');
fs.writeFile('/tmp/test.txt', 'hi!', (err, data) => {
  console.log(err);
});
```

- `require('fs')` - library to work with file system,
- `/tmp/test.txt` - path of file to write,
- `'hi!'` - Data to write to file,
- `console.log(err)` - if err is not null, something wrong happened,
- `fs.writeFile(` - writes given data to specified file.

[Open original](https://onelinerhub.com/nodejs/how-to-read-write-file) or [edit on Github](https://github.com/Onelinerhub/onelinerhub/tree/main/nodejs/how-to-read-write-file.md).
File Upload in React
Tags: react, webdev, beginners, javascript
Published: 2022-08-11 15:56:43

Working with file upload is one of those things you somehow wind up doing. Here is a small article on doing the same in React
First of all, we need to understand on how **refs** work in React. Ref's act as pointers on DOM elements, like how you would be selecting an element using say

![docuemnt is selector](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9tqpn4fh2ai7sd0ya3iu.png)
and the **useContext** Hook to manage those ref's

In this example, I have created a ref called inputRef that is connected to the input element, each element connected to the ref can a current property on which you can use all the properties supported by that element, in this case value


![ref example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcf5lc0w4c8mvl8qqyfb.png)

lets add the FileType, FormData and fetch API

![file-upload](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y3p2u69wy72eeh2vuukx.png)
I started my dream Open Source project, but this happend...
Tags: programming, opensource, webdev
Published: 2022-08-11 15:37:22

As a developer, I always dreamt of having an open source project that people actually can use and contribute to, so one day I thought why not make it happen in real?

I was initially a Python/Django developer and got to learn React and Next JS, developed 3 web apps with that knowledge, currently in production, actually functioning.

And while going on a trip to Pokhara with one of my developer friends, introduced me to the cool features of Ruby on Rails, that how one can very quickly make SPAs without any hustle, no worries for DB, form submission, authentication/authorization, web sockets and much other stuff. And that actually was true.

After coming back from the trip, I started learning Ruby. As I was from a Python background, learning the very basics of Ruby wasn't that hard.

Then, I started seeking the Rails 7 tutorials, I was surprised that most of the tutorials were pretty latest. But yeah, some tutorials were from like 2015 to 2018.

I used my googling skills to learn Rails and developed some basic web apps with Ruby on Rails, i.e. Todo App and Chat App. Yeah chat app is pretty basic for Rails because the feature called ActionCable/broadcast does the whole WebSocket stuff on its own.

## The idea bombing
After digging some more, I suddenly remembered my dream open source project, and then why not do it with Rails? I started the project, named it, and started developing it. It's Deviser Club (currently in production).

> https://github.com/Bishwas-py/deviser-club

Deviser Club is my new Ruby on Rails open-source project that I've been talking about this long. It's a multi-blogging platform where you can create posts and quick tweets, like, bookmark, publish content and a few more other stuff.

It might have a medium-like look, so you can call it an open-source medium alternative.
So, yeah.

## The first pull request
The first pull request made me feel very precious because the request was from a nicely popular Rails developer, Yaroslav Shmarov.
Till now, I have got 5 pull requests, 12 stars, 2 forks and 1 watch.


## The probable pause
My SAT exams are in coming December, and I really wanna get into preparation for my exam, but this project is so addictive that I am struggling hard to get out. As most of the students here in Nepal have a dream of studying in the USA, so do I. That's why I might have to pause this project for some while. But let's see, what so on.
Laptops Shipped with Linux?
Tags: linux
Published: 2022-08-11 15:25:34

I have been considering getting another laptop specifically for Linux. I know companies like Dell and Lenovo have been selling laptops with Ubuntu pre-installed. The upside is that I can just unpack it and set it up. I'd imagine that companies like Dell and Lenovo ship these laptops with their own software installed similar to the way they do with Windows, so I'm a little hesitant.

Is there any potential for privacy and performance concerns in regard to purchasing a laptop pre-installed with Linux vs purchasing a Windows laptop and installing Linux myself?

I'm open to any recommendations.