teleren/devto huggingface dataset:
Método concat - JavaScript
Tags: javascript, tutorial, webdev, beginners
Published: 2021-03-21 20:09:29


O método **concat** retorna um novo array contendo todos os arrays ou valores passados como argumento.


## **Parâmetros**

**value1 ..., valueN -** Os valores ou arrays para concatenar (unir) ao array retornado.


### Sintaxe

```jsx
nameArray.concat(value1, ..., valueN)
```


## **Retorno**

O método **concat()** retorna um novo array contendo todos os valores passados como parâmetro na ordem dada.


## Exemplo

Unindo dois arrays

```jsx
const names = ["Elian", "Becali"];
const numbers = [1, 2];

const namesAndNumbers = names.concat(numbers);
// namesAndNumbers -> ["Elian", "Becali", 1, 2]
```

<a href="https://www.notion.so/elianbecali/concat-7bc281c3900c49a39be8c609040e510c" target="_blank">Método concat | ![Notion](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c3zw8o5mdagox9ddrbht.png)
</a>
<a href="https://www.youtube.com/watch?v=PHQK7tKZmro" target="_blank">Método concat | 
</a><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czjf1itmrh6dw9ck4qjn.png" width="20" style="display: inline;" />
Draw charts from terminal with psql and termgraph
Tags: postgres, analytics, bash
Published: 2021-03-21 20:08:34

:bulb: Open Data and charting in terminal

As a big fan of both Open Data, PostgreSQL, terminal tricks and data analysis, I wondered what kind of story I could tell on these topics.

Since one year now I feed an Open Data repo with COVID-19 from New-Caledonia :

{% github adriens/covid19-action-plan-nc %}

To "celebrate" this full year of daily datas, I decided to implement something cool around it and thought about the following scenario :

:point_right: The plan

1. Git clone the Open Data COVID cases I feed everyday
2. Load the csv data in the PostgreSQL table with the `COPY` statement
3. Prepare some ready to use reporting views
4. Dump these views as `csv` files
5. Produce charts from the command line, **for the command line** with the help of a great and cool tool called `termgraph` :

{% github mkaz/termgraph %}

Also, to make it available even for non technical people.

I decided to implement it on [Katacoda](https://www.katacoda.com/devops-labs/courses/postgresql/covid-psql), so everyone can enjoy it from any web browser and look like a kind of `hacker` :sunglasses:

:cinema: Demo

{% youtube kXwSfVa1yBA %}
Let's introduce ourselves
Tags: java, ddd, oop
Published: 2021-03-21 20:01:50

Hi there all!

I'm Luca from a not that big city in the north of Italy, Trento. I'm an ordinary computer scientist loving work with **Java** and dig into *object-oriented concepts* (such as object thinking), patterns and principles about *Domain-Driven Design*. My experience as a developer started during Commodore 64 days when I recorded my first personal diary application on a tape (good times!) with Basic. Then I had to learn other technologies and programming languages at High School, University and job.
However, when I have to learn design principles and patterns, I always choose Java because of three aspects:

 * *Philosophy*, Java is traditionalist, takes time to have some language syntax upgrade because of retro-compatibility, but frankly? I don't care. I am always able to do anything I need with it;
 * *Nostalgia*, Java was my programming language during my Univerisity days, since Merlin (codename for version 1.4.0) and when I'm coding with it, I feel like I'm in one of the best days of my life;
 * *History*, how Java changed OOP; the rise and fall of Sun Microsystems; Oracle vs. Google; the paper about «generics» written by Odersky; OpenJDK; etc.

I could say other things about Java, OpenJDK, object-oriented paradigm, history and so on, but I prefer to let the blog speak for me with my posts (if I can keep a pace).

Oh, wait! As you can see on the top, I will always put a movie reference to these three: **Blade Runner**, **Excalibur** and **Clash of the Titans** (because I like reading sci-fi, Arthurian cycle and most of all, mythology).

See you next time!

![Duke tumbles](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m9foogq87dvcegodv3ag.png)
Auto login with Laravel on development
Tags: laravel, php
Published: 2021-03-21 19:45:46

In development could be annoying to add credentials when we are showing or testing the ui in the browser all the time, here a little tip:

### Add a User seeder with your development user

`database/seeders/UserSeeder.php`

```php
User::factory()->create([
    'name' => 'your name',
    'email' => 'your@email.com'
]);
```

You can add alternatively a password but it is not necessary, the default user factory adds a password for all users as string "password" so you can stay with this for all development users.

### Add a route

`routes/web.php`

```php
Route::get('/dev-login', function() {
    abort_unless(app()->environment('local') ,403);

    auth()->login(User::first());

    return redirect()->to('/');
})->name('dev-login');
```

### Add a link on your login view

```php
<a href="{{ route('dev-login') }}">Dev Login</a>
```

### Auto login using AuthServiceProvider

You can also set a default authenticated user with this code in AuthServiceProvider:

```php
public function boot()
{
    if($this->app->environment('local')) {
        $this->app['auth']->setUser(new User([
            'name' => 'John Doe',
            'email' => 'john@doe.com'
        ]));
    }
}
```

## If you are working with Jetstream

The dashboard and other pages use some middlewares with current team id, so you must need to create a user with a personal team first and pass the user as the authenticated user


On a UserSeeder or DatabaseSeeder class

```php
User::factory()->withPersonalTeam()->create();
```

Then migrate & seed the database:

```
php artisan migrate:fresh --seed
```

Then modify a little bit the AuthServiceProvider:

```php
public function boot()
{
    if($this->app->environment('local')) {
        $this->app['auth']->setUser(User::first());
    }
}
```
Getting clients through content marketing - but what do I post about?
Tags: freelance, marketing, webdev
Published: 2021-03-21 19:26:08

Have you heard that "content marketing" is a great way to get clients to come to you?  

It's true - content marketing works for positioning you as someone who knows what you're talking about.  They just need to look at your track record of blog posts, Youtube videos or podcasts to see that you're an expert.  

But the next question leads on pretty quickly.  

"What do I post about?"

The way I do it is to look at the questions that my ideal clients are asking, then I write posts answering them.  

The other day I posted about someone whose contract was coming to an end but the client wanted them to "hang around".  Personally, I've never been in that situation, but I know what I would do if it happened to me - so that's what my post was.  
And weirdly, it was really popular on LinkedIn, getting lots of engagement and a whole discussion thread started.  Something I totally wasn't expecting.  

In order to make this work, I had to find the questions that people are asking.  And a side-effect of this is I started to notice patterns in what people are struggling with.  

For me, I noticed a lot of freelancers and consultants believing that the client holds all the power in their relationship - if the client says jump, you have to ask how high.  

But I believe that's not true.  

You're an expert.  They hired you because you know things that they don't.  And if the client isn't treating you correctly, then you should walk away.  

You deserve better.  

So my content marketing does double duty.  

It shows off my expertise - here's a common question, here's the answer.  

And it also shows off my philosophy - if you're a freelancer who wants to redefine the relationship you have with your clients, then I'm the person you want to be talking to.  

So how about you?  

What questions are your clients asking?  Are you showcasing your expertise by answering them?
Twilio Camp
Published: 2021-03-21 19:05:26

Our "Intro to Javascript" Bit Camp was launched in December 2020, in partnership with Twilio. Through this camp, we hope to create more open-source education over the world. Javascript is a broad language and we aim to help students take their first step in the world of web development and programming.

Bit Camps are open-source hands-on learning experiences where students get exposure to rising technologies and industry culture through our carefully catered programs and one-on-one mentorships. Bit Project aims to give students the power to light their creativity and pave their future paths.

In this program, students learn through a  miniature game called "TwilioQuest" which teaches them about Javascript in a fun and simple manner. Students have weekly live stream sessions which are led by instructors and sometimes Margaret Staples, who is a Developer at TwilioQuest. We help students develop their thinking process through various review sessions, live coding demonstrations, and home reviews every week.

"Margaret is very knowledgeable and inspiring. She helps explain different topics and gives the students a different perspective." - Instructor at BitCamp

Students are also given the opportunity to actively interact with their assigned Twilio mentors starting around week 3.

Towards the end of the program, students work on a clock project using Javascript, HTML, and CSS. They get to explore different functions to make their projects customizable and unique. Initially, students have very limited exposure to programming but by the end of this program, they get inspired to explore more about Javascript.

In the future, our goal is to have a wide variety of projects and expand our curriculum to better cater to students to want to go deeper into Javascript and web development languages.
Prerender all the Things.
Published: 2021-03-21 18:41:13

In this Post I want to cover what prerendering is, and how you can use it in Netlify.

Let's go! 🌘

## What is prerendering?
When you hava a React, Angular or Vue App, most of the time, it is client-side rendered.

The client receives an empty HTML shell, and loads the content via JavaScript.

Search Engines normally don't execute JavaScript when they index a page.
That changed in recent years with Google, but still, you can't really rely on them to render your application properly.

{% youtube FDJmm9ETCHs %}

This is where prerendering comes into play.
The server recieves a request.
It checks the user agent, if it's a normal browser user agent, the server responds with the HTML Shell.

But if it is a Search Engine Crawler that requests the page, the Server responds with a prerendered HTML file.
TIL: The smart difference between infinite for loops that work and those that break
Tags: todayilearned, go, tricks
Published: 2021-03-21 18:33:41

---
title: TIL: The smart difference between infinite for loops that work and those that break
published: true
description: Discovering the terminating statement
tags: todayilearned, go, tricks 
//cover_image: https://direct_url_to_image.jpg
---
Consider this Go function with an infinite __for__ loop:

```go
func exampleA() int {
	for {
		/* do something */
		return 1
	}
}
```

Take a moment to reflect on this question: Does this code break at compilation time?

If you think: "well yes, there is a missing return before the function closes; take as example the following code where a break is introduced before the return. How could this function work?"; I would agree that your statement and example is correct and that `exampleB` would indeed get a _missing return_ message from the compiler

```go
func exampleB() int {
	for {
		break
		return 1
	}
}
```

However you may very well be surprised to discover that, if you leave the function `exampleA` unaltered, without the missing return at the end, and test it somewhere (for example in [Go's Playground](https://play.golang.org]) it will compile and execute without complaining.

How is it possible?

An infinite `for` statement without a break inside is considered by the compiler as a __terminating statement__, a statement that is located at the end of a list of statement and that blocks the execution of any further statements within the same block.

Which means that the following example also works despite the absence of any return statement.

```go
func exampleC() int {
	for {}
}
```

The infinite `for` loop with no breaks is not the only terminating statement present in Go; for more details please consult [this section](https://golang.org/ref/spec#Terminating_statements) of the golang reference spec.

Hope this was helpful, thanks a lot for your time reading it!
Note: graphql-go Tutorial
Tags: graphql, go
Published: 2021-03-21 18:05:47

I did `graphql-go Tutorial` and had a little trouble. Therefore I share my note. 

### Getting started

https://www.howtographql.com/graphql-go/1-getting-started/

`validation failed: packages.Load` error occured.
To fix it, setup go module.

```sh
% cd <project dir>
% go mod init
% go get github.com/99designs/gqlgen

# This module is needed.
% go get github.com/vektah/gqlparser/v2

%gqlgen init
```

### Database

https://www.howtographql.com/graphql-go/4-database/

`server.go` needs `go-chi`.

```sh
% go get github.com/go-chi/chi
```

### Testing query and mutation.

We can test on browser UI which URL is `http://localhost:8080`.

### Codes
https://github.com/takakd/graphql-go-tutorial
LeetCode Add Two Numbers
Tags: cpp, go, leetcode, algorithms
Published: 2021-03-21 18:00:46

---
title: LeetCode Add Two Numbers
published: true
description: LeetCode Add Two Numbers represented using LinkedList in C++ and Golang.
tags: #cpp #golang #leetcode #algorithms
---

https://alkeshghorpade.me/post/leetcode-add-two-numbers-linked-list
Get character code (ASCII code)
Tags: javascript, webdev, codenewbie, beginners
Published: 2021-03-21 17:54:05

```js
const char = "a";
const charCode = char.charCodeAt(0);
console.log(charCode); // 97
```

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
NestJS Crash Course: Everything you need to know! | NodeJS Tutorial 2021
Tags: showdev, javascript, nestjs, node
Published: 2021-03-21 17:53:50

---
title: NestJS Crash Course: Everything you need to know! | NodeJS Tutorial 2021
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/evxcy6vrk6g5ww28p6mi.jpg
published: true
description: In this video I walk you through the Nestjs framework and its fundamentals!
tags: showdev, javascript, nestjs, node
---

[In this video](https://youtu.be/2n3xS89TJMI) I walk you through a crash course of one the **best** Node.js frameworks: NestJS! 

If you're completely new to Nest and are looking to understand the fundamentals, this is for you!

### Topics covered include:
- Starting a project
- CRUD
- Modules, controllers, services, pipes
- Using the CLI to generate everything
- Request body, query params, url params
- Validation
- 3-layer architecture and dependency injection
- Swagger (Open API) documentation
... and more!

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

## You can watch here:

{% youtube 2n3xS89TJMI %}
Day 34
Tags: 100daysofcode, programming, javascript
Published: 2021-03-21 17:51:33

Day 34/100 of #100DaysOfCode

codewars | Primitive vs Reference - What's the difference - JavaScript

Hours coded: 3
Lines of code: 143
Keystrokes: 2268

via @software_hq's #vscode extension https://www.software.com/100-days-of-code
Windows Notifier for Covid Stats | Rookie Week of Python Day 02
Tags: python, beginners, programming, windows
Published: 2021-03-21 17:37:11

In this article we will be creating a simple windows alert application that pulls data from a rest API. We will be using our program to pull live Covid-19 statistics and push them to the screen

# Windows Notifier Application 
What will we need are the python requests and the win10toast libraries. They can be installed by the follow `pip install` commands in your preferred command terminal.
`pip install requests`
`pip install win10toast`

Now to import the libraries we will simply use the `import` statements
```python
import requests;
from win10toast import ToastNotifier;
import datetime;
```

We will first check the connection to our rest API with a `try` & `except` block. We will store the output from our API in a variable named *data*

```python
try:
    data = requests.get("http://corona-rest-api.herokuapp.com/Api/pakistan")
except:
    print("You are not connected to a network. Please check internet connection.")
    data = None
```

If the API returns some data then our *data* variable will not be null and we can use an `if` statement with the following variable declarations.
```python
if data is not None:
    getData = data.json()
    covidPK = getData["Success"]
```

Declare a variable named *title* to hold the title string and use the `format()` finction to place the date and time.
```python
title ="""Covid Pakistan / {}""".format(datetime.date.today())
```

Similarly declare a variable for the message body and use the `covidPK` variable to pull the appropriate data from the API.
```python
message="""In Pakistan Covid-19 Cases: {}, Deaths: {}, Recovered: {}, Cases Today: {}""".format(covidPK["cases"],covidPK["deaths"],covidPK["recovered"],covidPK["todayCases"])
```

Now assign the `win10toast()` function to a variable of your choosing like so.
```python
toaster = ToastNotifier()
```

Finally, push the values to the windows alert message. Use `icon_path` to point to an `.ico` format file which will act as the icon for the notification. Use `duration` to define the time in seconds for how long the alert will stay visible on screen.
```python
toaster.show_toast(title, message, icon_path="E:\Software\Python 3\Python Projects/covid-icon.ico", duration=10)
```

### Output
If everything worked out fine, you should get the following output on your screen.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q76annvmro7buier5gjr.png)

You can also check out the code on it's GitHub repo [here](https://github.com/thehannankhan/Covid-Stats-Windows-Alert). Thank you for reading. Don't forget to check in tomorrow for more, cheers!
WHO CARES ABOUT CODING STANDARDS? 
Tags: codereview, standard
Published: 2021-03-21 17:34:48



Have you had to read code 
written by another programmer.??

Or you had to add a feature to a software 
written by someone else... 

When going through the code, were there things you wish 
the other programmers had done 
that would have made things easier for you?

Well, thats the reason for coding standards.

You probably wished, he had named his variables better. 
That for once, the variable name was actually doing 
what it says it's doing.

Oh, whitespace, whitespace, whitespace.
Couldn't they have applied more of those while writing.
They just had to cram every line of code together.

I know it can be nerve wrecking.

So if you dont take coding standards serious, and you wish 
the others had written better code... then this is for you.

Maybe if you just decide to follow these standards, 
programmers you work with will write better code too.
Some ACI resources
Published: 2021-03-21 17:19:36

<sub>Photo by <a href="https://unsplash.com/@adamsky1973">Adam Nieścioruk</a> on <a href="/s/photos/small-robot">Unsplash</a>
  </sub>

- [AzBest practices for Azure Container Instances (ACI) with GitHub Actions](https://www.youtube.com/watch?v=jkEkeTW1QeE)
- [Azure: Automate hosting a Windows Container inside VNET](https://blog.gripdev.xyz/2021/03/17/azure-automate-hosting-a-windows-container-inside-vnet/)


Hope this helps !
What is Document Signing Certificate? Importance of Documents Signing
Published: 2021-03-21 17:14:37

 DOCUMENT SIGNING CERTIFICATE AND ITS IMPORTANCE

Digital signing certificates enable the digitally signing of Adobe, Microsoft office, and other types of documents. This will ensure the marking of visual trust indicators that verifies the publisher’s identity. This will also indicate that the document has not been altered.

 

Different documents authenticate at the time of document signing certification such as legal documents, invoices, engineering plans, and diagrams, diplomas, etc. This will help in secure and efficient electronic transmission of official papers. The digital signing reduces the cost of printing and maintaining paper files.

 

BRIEF HISTORY OF DOCUMENT SIGNING

The document signing certificate is the first-ever human document. Since a long time ago, people are using paper records, scrawling notes on walls, stone tablets, parchment, etc. In the present time, people are more engage in digital records and communicate via digital tools. With time the standardized languages and documents authentication methods have been developed.

 

In 1069, El Cid a nobleman of Spanish put his mark on military documents by signing his name and enabled that those who received it would able to identify that he genuinely writes it. This is one of the earliest records in the history of a notable person that used a handwritten signature for validating a document. The primary means of substantiating documents are written signatures.

 

In 1996 United Nations officially recognized digital signatures and because of the modern computerized world signatures have gone digital. The digital signature makes the work easy. People can sign emails, documents, and all other files through digital media. This not only improves efficiency but also authenticates documents which are the most secure method in human history.

Complete Article
[What is Document Signing Certificate?](https://comparecheapssl.com/what-is-document-signing-certificate-importance-of-documents-signing/)