teleren/devto huggingface dataset:
EXEC master..xp_cmdshell Escrevendo em disco com SQL Server
Published: 2020-12-07 19:13:01

IF object_id('tb_teste') is not null BEGIN   DROP TABLE tb_teste   END 

create table tb_teste
(
codigo int identity(1,1) primary key,
texto varchar(200)
)

insert tb_teste values ('João Miguel')
insert tb_teste values ('Maria ')
insert tb_teste values ('João ')
insert tb_teste values ('Ana ')
insert tb_teste values ('Maria ')
insert tb_teste values ('João Pedro')
insert tb_teste values ('Maria Luiza')
insert tb_teste values ('João Miguel')
insert tb_teste values ('Enzo Gabriel')
insert tb_teste values ('João Lucas ')
insert tb_teste values ('João Pedro')
insert tb_teste values ('Pedro Henrique')
insert tb_teste values ('Davi Lucas')
insert tb_teste values ('Davi Lucca')
insert tb_teste values ('João Gabriel')
insert tb_teste values ('Miguel')
insert tb_teste values ('Arthur Miguel')
insert tb_teste values ('Maria Cecilia')
insert tb_teste values ('Maria Eduarda')
insert tb_teste values ('Maria Alice')
insert tb_teste values ('Ana Julia')
insert tb_teste values ('Maria Clara')
insert tb_teste values ('Maria Luiza')
insert tb_teste values ('Maria Julia')
insert tb_teste values ('Ana Laura')
insert tb_teste values ('Ana Clara')
insert tb_teste values ('Maria Vitoria')

IF object_id('tempdb.dbo.#TABLE_Cont') is not null BEGIN   DROP TABLE #TABLE_Cont   END 
CREATE TABLE #TABLE_Cont ( COD_SEQ  [int] IDENTITY(1,1) NOT NULL,
       texto varchar(200)
       )
insert into #TABLE_Cont (texto)
select distinct texto
from tb_teste
order by  texto 


declare @COD_SEQ int
DECLARE @cmd varchar(8000), @var varchar(8000) 

set @var = '< table border=1 >'

while (SELECT COUNT(*) FROM #TABLE_Cont) > 0 --Inicio do while
BEGIN
      
 SELECT @COD_SEQ = MAX(COD_SEQ) FROM #TABLE_Cont 

    select   @var = @var + '< tr >< td >' + texto  + '< /td >< /tr >'  from #TABLE_Cont WHERE COD_SEQ = @COD_SEQ

    delete #TABLE_Cont WHERE COD_SEQ = @COD_SEQ

END
   set @var = @var + '< /table >'


SET @cmd = 'echo "' + @var + '" > C:\inetpub\wwwroot\tb_teste.html';
print @cmd
EXEC master..xp_cmdshell @cmd ;
Ask Octopus - Can I host the Octopus Server in Docker?
Tags: octopus, devops, docker
Published: 2020-12-07 19:12:05

---
title: Ask Octopus - Can I host the Octopus Server in Docker?
published: true
description: One of our recent frequently asked questions has been about hosting an Octopus Server in Docker? Can you do it? What do you need to know? Find out in this Ask Octopus!
tags: octopus,devops,docker
series: Ask Octopus
---

One of our recent frequently asked questions has been about hosting an Octopus Server in Docker? Can you do it? What do you need to know? Find out in this Ask Octopus!

{% youtube 3KplO0-VSEA %}

Other resources:
 - https://octopus.com/docs/installation/octopus-in-container

Do you have a question about how to use Octopus? Email advice@octopus.com and someone from our team will get you an answer. You might even see it in a future episode.

Join our community slack at https://octopus.com/slack
Discord channel for JS lovers.
Tags: javascript, tc39, react
Published: 2020-12-07 19:10:45

Hello guys I'm opening up a Discord channel for all who are fascinated by full-stack development and specially for those who are in love with JAVASCRIPT. If you are one of them you are most welcome. Please mention y/n in the comments so that I could share you the link.
Thanks for reading 🙂.

Here is the link- https://discord.gg/v8rFBgubpM
How many open source maintainers are there?
Tags: opensource
Published: 2020-12-07 18:39:09

There's a highly interesting post by Ben Frederickson, titled [Why GitHub won't help you with hiring](https://www.benfrederickson.com/github-wont-help-with-hiring/).

It makes some very good arguments against _requiring_ a strong GitHub profile for job applicant screening. The main argument is that most great developers don't have one. I think the best argument against it is that unless you hire people to work on open source code, requiring them to have a track record of contributions to open source software is hypocritical.

However, it's not my point. My point is that his analysis is hinting at the true size of the open source developer community, and it's not as large as it seems.

From the GitHub archive data, he got these figures:

* Only 17% of GitHub users pushed any code in the last year
* Only 7.4% of GitHub users pushed more than 10 times
* Only 1.4% of GitHub users pushed more than 100 times
* Only 0.15% of GitHub users pushed more than 500 times

As of 2020, GitHub is the largest code hosting platform with about 40M users.

Now, let's convert Ben's relative numbers to absolute values: 

* Only 560 000 people pushed more than 100 times.
* Only 2 960 000 people pushed more than 10 times.

So, if you somehow bring them all together, the community of people who ever made some code dumps or drive-by contributions is about as large as the populations of Amsterdam, Athens, or Chicago.

The people who actively maintain projects could fill a city like Dresden or Las Vegas.

That's compared to 40M registered accounts. It's hard to tell how many of those accounts are duplicates, or how many programmers are in the world.

Now, let's make an incredibly conservative estimate: most accounts are duplicates and there are 10M programmers in the world. It means only one in three ever helped an open source projects, and one in five maintains a project of some kind.

And that's when almost every programmer depends on at least some open source code for their daily work.

I think this leaves no open questions about whether companies should allow employees work on open source in their paid time, or whether we should advocate for participation. The answers to all those questions is "yes".
Transformando varias linhas em uma linha só
Tags: sqlserver
Published: 2020-12-07 18:37:24

CREATE DATABASE DB
GO

USE DB
GO

DROP TABLE IF EXISTS PESSOA
GO

CREATE TABLE PESSOA
(
        COD_PESSOA INT IDENTITY PRIMARY KEY,
        NOME_PESSOA VARCHAR(50),
        SOBRENOME_PESSOA VARCHAR(50)
)
GO

INSERT PESSOA 
VALUES ('HUGUINHO','PATO'), ('ZEZINHO','PATO'), ('LUIZINHO','PATO')
GO

CREATE TABLE TELEFONE
(
 COD_TELEFONE  INT IDENTITY PRIMARY KEY,
 NUMERO_TELEFONE VARCHAR(25),
 TIPO_TELEFONE VARCHAR(10),
 COD_PESSOA INT REFERENCES PESSOA
)
GO

INSERT TELEFONE
 VALUES ('1234-5678','FIXO',1), ('999999999','CELULAR',1), ('333666999','CELULAR',2), ('222444666','CELULAR',2) 
 GO


 --NOME DE TODAS AS PESSOAS
  -- SOMENTE TELEFONE CELULAR
  --VAI EXISTIR NOME DUPLICADO NA LISTA
  SELECT 
    * 
  FROM PESSOA P left JOIN TELEFONE T
  ON P.COD_PESSOA = T.COD_PESSOA
  and T.TIPO_TELEFONE = 'CELULAR'
GO


---------Exemplo antigo
  SELECT 
    P.*,
    cel1.NUMERO_TELEFONE1,
    cel2.NUMERO_TELEFONE2,
    FIXO1.NUMERO_TELEFONE3
  FROM 
   PESSOA P 
  left join 
     (select 
       COD_PESSOA,
       max(NUMERO_TELEFONE) NUMERO_TELEFONE1
     from 
        TELEFONE T
     where  T.TIPO_TELEFONE = 'CELULAR'
     group by COD_PESSOA)cel1
  on 
    p.COD_PESSOA = cel1.COD_PESSOA
  left join 
       (select 
       COD_PESSOA,
       min(NUMERO_TELEFONE) NUMERO_TELEFONE2
     from 
        TELEFONE T
     where  T.TIPO_TELEFONE = 'CELULAR'
     group by COD_PESSOA)cel2
  on
   p.COD_PESSOA = cel2.COD_PESSOA
  left join 
       (select 
       COD_PESSOA,
       min(NUMERO_TELEFONE) NUMERO_TELEFONE3
     from 
        TELEFONE T
     where  T.TIPO_TELEFONE = 'FIXO'
     group by COD_PESSOA)FIXO1
  on
  p.COD_PESSOA = FIXO1.COD_PESSOA


--exemplo novo
  select 
    * 
  FROM PESSOA P
  cross apply
  (SELECT 
    t.NUMERO_TELEFONE + ','
  FROM  TELEFONE t
  where TIPO_TELEFONE = 'CELULAR' 
   and P.COD_PESSOA = t.COD_PESSOA
  FOR XML path ('')) resultado/*Nome da tabela*/ (NUMERO_TELEFONE/*Nome do campo*/)
Conceitos básicos de programação orientada a objetos (POO)
Tags: poo, programming, webdev
Published: 2020-12-07 18:21:46

É um método de desenvolvimento de software que reúne um conjunto de componentes para resolução do problema. Esses componentes são OBJETOS.

Segundo Melo (2004, p.15), um objeto é qualquer coisa, em forma concreta ou abstrata, que exista física ou apenas conceitualmente no mundo real.

Por exemplo: cliente, professor, caneta, carro.
Sendo que esses objetos possuem características e comportamentos.

## Classes

Uma classe é uma abstração de um conjunto de objetos que possuem os mesmos tipos, características e comportamentos.

    class Livro {
	    titulo: string
	    autor: string
	}

Temos uma Classe do objeto Livro, com os seus atributos (características), título e autor, ambos do tipo string.

Uma Classe possui também pode possuir métodos.

## Métodos

São as atividades que uma instância de uma classe pode executar. Quando ele é chamado, então se executa um conjunto de instruções que foram previamente programadas dentro desse método.

    class Livro {
	    titulo: string
	    autor: string
	    adicionarLivro(){
		//cadastro de novo livro
		}
	}

Nem todos os atributos e métodos devem ser visíveis para todos, então temos a…

## Visibilidade

Serve para indicar o seu nível de acessibilidade.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6ufi4dcgyuslr7h69ja5.png)

(+) publico -> a classe atual e todas as outras tem acesso.

(-) privada -> somente a classe atual tem acesso.

(#) protegido -> a classe atual e todas suas sub-classses tem acesso.

## Herança
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6u9sioogqjoalru7zd3d.gif)

A herança permite que as classes compartilhem atributos e métodos. Significa que os objetos da subclasse podem ser utilizados em qualquer local em que a superclasse ocorra, mas não vice-versa. A subclasse herda as propriedades da classe-mãe. A vantagem de se utilizar herança é a reutilização de código.

## Polimorfismo

Ocorre quando uma subclasse redefine um método existente na superclasse, ou seja, quando temos os métodos sobrescritos (overriding).

    class Mamifero {
	    //SuperClasse
	    locomoverSe() {
		// A ser implementado em alguma subclasse. 
	     }
     }

SubClasses herdam e sobrescrevem o método citado da seguinte forma:

SubClasse Macaco:

    locomoverSe() {
     pulandoDeGalhoEmGalho; 
    }
SubClasse Baleia:

    locomoverSe() {
     nadando;
    }
Angular In Depth - Part 1
Tags: angular, webdev
Published: 2020-12-07 18:15:58

### Exploring core concepts of Angular in depth

This series of Angular in depth will cover all the following features part by part :

- Basic Understanding of Angular and features
- Custom components with @Component
- Components @Input and @Output, event Emitters
- ngFor
- ngIf
- ngClass
- ngStyle
- ngSwitch
- Built-In Pipes
- Async Pipe
- Custom Pipes
- @Injectable and Custom Services
- HTTP Client - GET POST PUT DELETE

This article concentrates on key features of Angular and basics setup to start with any application.

We will build an example application throughout the whole series and understanding all core features

## Basic Understanding of Angular and features

### Things required to start Angular development

- Understanding on HTML, CSS, Typescript
- Node installed in system

[Download | Node.js](https://nodejs.org/en/download/)

- install angular cli to scaffold application

```bash
npm install -g @angular/cli
```

## Take a tour of the example application

Lets take a tour on example application "Crazy developers" together by exploring all Angular topics one by one

### Create new Angular application using Angular CLI

```bash
ng new crazydevelopersapp
```

- *`ng :`* referring to angular CLI
- *`new  :`* is the keyword to create new angular application
- *`crazydevelopersapp :`* application name

If project needs to be created in existing folder

```bash
ng new *crazydevelopersapp* --directory ./
```

CLI asks to enable routing choose yes and choose SCSS for stylesheets. folder structure after scaffolding the template looks like this


![Untitled.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607364309080/MCbojGVs6.png)

## Okay now Why Angular ?

**we will see main features of Angular Core with an example**

- **custom HTML content**: You can create your own custom HTML content and extend application functionality.

**app-root** is the custom HTML Tag for app component html


![Untitled 1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607364333899/VGcGI8f5a.png)

- separating data or the model of the application from view template

    below example shows title in html tag is a variable consists of string "crazydeveloper" in component.ts

   
![Untitled 2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607364346698/4dWG1M4ye.png)

- component based architecture co ordinates between view and data


![Untitled 3.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607364368755/DLlrZD8BB.png)

- built in change detection mechanism which is completely transparent which synchronizes with view

- Updating of data in secure way

We will discuss on components, @Input, @Output and Event emitter in our next article.

For latest news on Angular core and other technical articles. follow me on 

[In-Depth Angular - Medium](https://medium.com/in-depth-angular)

[CodeWithAbi](https://codewithabi.hashnode.dev/)

Other than technical follow me on instagram

https://www.instagram.com/abi_aradhya/
todo, blog
Tags: beginners, react, javascript
Published: 2020-12-07 18:13:31

> _“Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.”_
_-Thomas A. Edison_

Here is the place I am currently at.  Feeling a bit lost and distraught.  Although I have read a lot of documentation and watched tutorial videos, when it comes down to "freehand" writing my code to create something, I feel like the person in the image, standing at the entrance of the daunting maze.

Still, I understand that this is part of the process and my determination refuses to let me cave in and see this project through.

I started late and decided to try something "simple" like a to-do list.  As a consequence of starting so late, my to-do list transitioned into a blog application.  I've added React bootstrap to add styling and utilize the components.  I have created a card so far complete with an image and a brief description of the post's main idea.  I've also added a button that I want to give the function of expanding the full post.  I'm not exactly sure how to do this so far but I am determined to succeed somehow.
Solving day 7 of Advent of Code 2020 in JavaScript
Tags: challenge, adventofcode, javascript, video
Published: 2020-12-07 17:57:27

---
title: Solving day 7 of Advent of Code 2020 in JavaScript
published: true
description: JavaScript walkthrough of Advent of Code 2020 (day 7)
tags: challenge, AdventOfCode, javascript, video
series: Advent of Code 2020 in Javascript
---

{% youtube 9YEtwD1ebiU %}
Remote team building: online scavenger/treasure hunt (without the bullshit)
Tags: remote, tutorial, teambuilding, game
Published: 2020-12-07 17:30:35

This post exists because I spent the last 30 minutes trying to find a post that only teaches you to play scavenger hunt online for remote team building, without the 30 paragraphs of bullshit no one is interested in.

1. **Pick a letter** or theme
2. Give everybody a couple minutes to **find as many items starting with that letter** or corresponding to the theme as possible
3. Go through each person's items, each unique item (that the person has but nobody else has it) gives them a point
4. The person with the most points wins
How do you stay motivated to keep building code?
Tags: discuss, watercooler, webdev, video
Published: 2020-12-07 17:29:30

---
title: How do you stay motivated to keep building code?
published: true
description: sometimes it's hard to keep working, how do you keep up that energy?
tags: discuss, watercooler, webdev, video
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/gk0liel066x71hg2h8am.jpg
---

*cover image by [Berend Eikelenboom](https://commons.wikimedia.org/w/index.php?curid=84583786)*


Sometimes it's hard to keep working, how do you keep up that energy?

{% youtube GlRNvgJ2dZg %}
What is website accessibility and why should we implement it?
Tags: webdev, test
Published: 2020-12-07 17:12:53

Website accessibility - it means that the site's content is available, and its functionality can be consumed by people with disabilities in an equally satisfactory way as people who do not have a disability.

Obviously, web accessibility is important because it's the law. Not complying with this leaves your company vulnerable to a lawsuit. 

Digital content should be consumable and usable by all people.
Default Function Parameters
Tags: javascript, webdev
Published: 2020-12-07 17:12:25

We always have to validate if the arguments passed in a function have a value or they are `undefined` but, do we really?

## Introduction

In my last post, I talked about [Destructuring Assignment In A Function Parameter][prev post] and why it is handy when you have optional parameters in a function and don't want to pass `undefined` or `null`.

With that been said, what if you have a function where all the parameters are required? Again, since ES2015 (aka ES6) this can be easily implemented. Let's dive in.

## Use Case

If you take a Tip Calculator project as an example, you probably will need always the same parameters:

1. Bill Amount.
2. Number of People.
3. Service Quality.

The function you'll need would look like this 👇

```javascript
function calculateTip(totalBill, numOfPeople, serviceQuality) {
  // Your validation here
  // Your code here
}

console.log(calculateTip(50, 2 , 0.2))
// 5.00
```

Inside the function, you'll have to do all the calculations **AND** all the validation; plus, most of the time I go with the same friend (2 people) and leave the standard tip (20%).

In this case, the only parameter that will be changing all the time will be the bill amount.

So, let's give `numOfPeople` and `serviceQuality` a default parameter:

```javascript
function calculateTip(totalBill, numOfPeople = 2, serviceQuality = 0.2) {
  // Your code here
}

console.log(calculateTip(50))
// 5.00
console.log(calculateTip(75))
// 7.50
```

Now, just when someone else is joining, or we want to leave a different tip percentage, it will be necessary to pass the rest of the arguments.

## Conclusion

You don't really need to check if the argument in a function is `undefined`, you can create a default value for it.

When a different value is provided, the default value will be overwritten.


> If you found it useful, please like, subscribe, and share the knowledge.

> You might like what I share on [my Twitter][Twitter profile] too.


[Twitter profile]: https://twitter.com/eligarlo
[prev post]: https://blog.eligarlo.dev/destructuring-assignment-in-a-function-parameter
Calling Child Component Function From Parrent Component ( forwardRef and useImperativeHandle)
Tags: react, javascript
Published: 2020-12-07 16:53:26

For calling functions from parent component that are declared in child component we are using [React.forwardRef](https://reactjs.org/docs/react-api.html#reactforwardref) and [React.useImperativeHandle](https://reactjs.org/docs/hooks-reference.html#useimperativehandle) hooks from React. 

**React.ForwardRef**

React.forwardRef creates a React component that forwards the ref attribute it receives to another component below in the tree. 

React.forwardRef accepts a rendering function as an argument. React will call this function with **props** and **ref** as **two arguments.** This function should return a React node.

```javascript
const CustomButton = React.forwardRef((props, ref) => (
  <div ref={ref}>
    {props.children}
  </div>
));

// You can now get a ref directly to the DOM button:
const ref = React.createRef();
<CustomButton ref={ref}>Click me!</CustomButton>;

```

**React.useImperativeHandle**

*useImperativeHandle* customizes the instance value that is exposed to parent components when using ref. As always, imperative code using refs should be avoided in most cases. useImperativeHandle should be used with forwardRef:

```javascript

useImperativeHandle(ref,
    () => {
        yourFunction: () => {
        //function content
         } 
    });
```

**EXAMPLE:**

Create a parent component first, with a button to call a function from child component that we will create in few moments.

```javascript
import React from 'react'
export default function ParentComponent() {
    return (
        <React.Fragment>
          <h1>Parent Component</h1>  
          <button onClick={()=>{ }}>
            Call Child Component Function
          </button>
        </React.Fragment>
    )
}
const ChildComponent = () => {}
```

Now, we are creating a child component using **forwardRef** and render component in the parent with a ref created with Reac.useRef. Now, the function **childComponentFunction()** is stored in **.current** property of ref and we can use it anywhere in the parent component.

```javascript
import React, { forwardRef, useImperativeHandle, useRef } from 'react'

//Parent Component
export default function ParentComponent() {
    const childRef = useRef();
    return (
        <React.Fragment>
            <h1>Parent Component</h1>
            <button onClick={() => { 
            childRef.current.childComponentFunction()
            }}
            >
               Call Child Component Function
            </button>
         <ChildComponent ref={childRef} />
        </React.Fragment>
     )
}

//Child Component
const ChildComponent = forwardRef((props, ref) => {
    useImperativeHandle(
        ref,
        () => ({
            childComponentFunction() {
                alert("Child component function called")
            }
         }),
     )
     return (
         <h3>Child Component</h3>
     )
})
```
My Social Media Data
Tags: lis160
Published: 2020-12-07 16:37:26



![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/11har31ol1ibimhglvap.png)

Tech companies are not impartial third parties - all content is highly curated toward the user. If that content was limited to things like hobbies and interests it would be ideal, however that content includes things like news, scientific reports and political propaganda.

Because political propaganda is curated in this way causes people to become highly polarized. One person could be inundated with a specific perspective on their feed, and they may not know that other people don't have the same online experience. Another effect are "echo chambers" of people only interacting with people of the same opinion, leading to users who don't understand the perspective of the other side.

Another issue is that this business model allows for the rapid propagation of fake news which in the worst case scenario could affect someone's health, especially during the current pandemic.