teleren/devto huggingface dataset:
PHPDF no DEV.TO!
Tags: php
Published: 2020-02-07 20:48:29


Fala pessoal, o PHPDF acaba de lançar mais um canal para interagir com a comunidade.

Criamos nossa canal na plataforma DEV.TO para publicar os posts da comunidade, falar sobre nossos encontros e como não poderia ficar de fora falar sobre PHP!!

Sigam a conta do PHPDF no DEV.TO que vamos publicar muito conteúdo legal!
Generating shorter aliases from .gitconfig file
Tags: git, alias, bash, zsh
Published: 2020-02-07 20:43:40

---
title: Generating shorter aliases from .gitconfig file
published: true
tags: git, alias, bash, zsh
series: git aliases
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/w474a8dxhrlde4yqb0s8.png
---

In previous articles I showed how to configure `aliases` in your `~/.gitconfig` file.

As you might have noticed you need to type `git alias` which might be inconvenient. Even if you make an `alias g=git` you have to remember to type <kbd>space</kbd> between `g` and `alias`.

To make things easier we can automatically generate shell aliases from the `.gitconfig` file:
{% gist https://gist.github.com/gko/c68dc17db3db7aeeb6a510c7c4b8319d %}

here we grep all the `git` config values from `alias` section and get the `alias` name with `sed`. Then we check that alias `g` + alias name doesn't already exist and set it.

Now, if you had for instance alias `a = add` you can type both `g a` and `ga`.

That's it.
Hello !
Tags: help, css, html
Published: 2020-02-07 20:05:36

Hello folks ,
My names Barry and I am a self-taught !
I need your help tho ,so lets get to the main point ,shall we - I was working on my site (HTML,CSS) and I wanted to insert text and a photo. I inserted them but the text is under the picture(I want it to be in the right side of the picture). May anyone help me solve this problem ?
How to Use JavaScript Arrays - Crash Course [Video]
Tags: javascript, arrays, tutorial, beginners
Published: 2020-02-07 19:31:30

In this [video](https://youtu.be/70QO8Qf6Qwk), we take a crash course on how to use JavaScript arrays to store a list of items, access individual items of an array by their index, and loop through an array to access all or some of the elements of an array. We end by learning how to manipulate an array to change a specific element at an index, push items onto an array, and remove items from an array in JavaScript.

Storing data is an important part of programming; accessing that data is also important. In many cases, you'll have to store data as a list, array for the sake of efficiency when accessing, transferring, and manipulating that data later in your program.

{% youtube 70QO8Qf6Qwk %}

My LinkedIn profile: https://www.LinkedIn.com/in/LincolnWDaniel
My website: http://www.LincolnWDaniel.com
1Liner Blog: https://www.1Liner.dev
How to use Variables in JavaScript [Video]
Tags: javascript, variables, tutorial, beginners
Published: 2020-02-07 19:29:20

In this [video](https://youtu.be/YrWYUhruUIQ), we learn how to define mutable and immutable variables (and constants) using the "let" and "const" keywords in JavaScript.

Variables are a foundational piece to any programming language. Defining variables in your JavaScript code  will allow you to store data that you can access and manipulate at a later point in your program.

{% youtube YrWYUhruUIQ %}
Why?
Tags: webdev, watercooler
Published: 2020-02-07 19:15:21

I believe that the way to think in development is really simple, just ask why?

I am committing this code, why?
I don't understand why this is like that?
Why do I need to learn this framework?
Why do I love this framework?
Why you should love this framework! < 🙄
Why don't we do this?
Why do we do that?
Whyyyy!!!

So irritating no? Well actually this is the root of imposters syndrome, you didn't speak up, we measure ourselves at levels of title, I am a junior senior, it's wrong, talk about why you feel this way. What you don't understand, you ask why as soon as your gut starts itching, you will find that actually that is a contribution and you may actually already have the knowledge to comprehend the intent.

If you space out the whys, you probably aren't irritating anyone. You need to ask yourself why as well. The above sample of FAQ's will help you break your own long held beliefs. 

I am entering a rebirth in my career, understanding the advanced stuff it bothered me that the basics in my knowledge are frequently wrong. I know I know where to ask. I can see where I went wrong and slowly I am building my early knowledge back up. But why? Because okay, cmon, I don't know all the answers!

Lastly if anyone tells you to Google it, ask why won't they share thier experiences? Google is not people. But then again, maybe they don't know, you should ask why together.

I hope you agree or disagree, tell me why!
I made a horrible abomination from something nice...
Tags: phaser, gamedev
Published: 2020-02-07 19:04:14

---
title: I made a horrible abomination from something nice...
published: true
description: 
tags: phaser,gamedev
---

Emanuele Feronato does amazing work and below is another example of this.

https://www.emanueleferonato.com/2020/02/03/pixel-based-physics-engine-with-html5-example-powered-by-phaser

It is a cool thing that does bouncing ball physics.

I made an abomination of it really. I added more balls.

https://codepen.io/tonetheman/pen/OJVPXWM

Not really any point... just something fun on a Friday.
A Better Way to Loop Over an Array
Tags: productivity, webdev, refactorit, computerscience
Published: 2020-02-07 17:06:22

When you need to loop over an array in JavaScript do you default to the trusty for loop? Even got yourself a quick keyboard macro to create your for loop? You're in good company, I do the same. Something like the following is my habitual goto when looping over an array of data:

![image](https://cdn-images-1.medium.com/max/800/0*uUkiTfKHaSKUsSN1.png?)

But there's a better way. the forEach method on arrays not only lets you deal with this pattern in a more functional way, it's just prettier (no relation to prettier :)

![image](https://cdn-images-1.medium.com/max/800/0*rOkNK5dcT050_sav.png?)

But what if you need the index? what if you're going to display that as well, like in the following?

![image](https://cdn-images-1.medium.com/max/800/0*Cyd-Zvjiqy4aTmXf.png?)

Well, no problem. foreach has you covered there. The second parameter to the foreach is the current index.

![image](https://cdn-images-1.medium.com/max/800/0*5C6J0RBBapPHAlZg.png?)

Finally, foreach allows you to separate out your iteration function from the iteration itself and create code that is extremely readable.

![image](https://cdn-images-1.medium.com/max/800/0*dMohAqq3RchZLSL4.png?)

You CAN do this with a for loop, but it's not nearly as readable:

![image](https://cdn-images-1.medium.com/max/800/0*fZZ0M7iecrqCgpRn.png?)

One final note. The forEach function also uses a 3rd parameter which is the array itself, in case you need to use the entire array in your processing function.

![image](https://cdn-images-1.medium.com/max/800/0*Zi9ulOM-f-VOcRft.png?)

Now it's time to actually LEARN something. Without practice, tomorrow you'll only remember about 15% of what you just read. Want to learn all of it? That requires actually PRACTICING what I just showed you.

This StackBlitz project has several different for loops that need to be turned into more readable foreach functions. It'll take you a couple minutes to complete, but by the time you're done you'll actually feel comfortable using forEach in your own coding, and can finally drop that less effective for loop.

Happy coding!

Signup for my newsletter at [here.](https://is-tracking-link-api-prod.appspot.com/api/v1/click/4616255200034816/5570275139911680)
Visit Us: [thinkster.io](https://thinkster.io/) | Facebook: @gothinkster | Twitter: @GoThinkster
Hello!
Tags: beginners, writing
Published: 2020-02-07 18:33:39

<p>Hello everyone, my name is Stefan and this is my first post on Dev! I am currently a M.S. student at Penn State University pursuing my degree in Informatics with a focus on data and information visualization. I graduated from Penn State in May 2019 with a B.S. in Security and Risk Analysis. While I may not be a developer by trade, I am always looking to explore different topics, issues and technologies as a way to develop a wide knowledge base about the world around me or to incorporate different ideas into my own work.</p>

<p>In my next few posts, I hope to provide a glimpse into the projects I have been working on. I believe that reflecting on and putting the successes and struggles I encounter into writing will be a useful exercise in developing my own thoughts.</p>

<p>I’m looking forward to meeting and interacting with the diverse group of individuals on the Dev platform, feel free to say hi!</p>

-Stefan
This may be corny, but.. Thanks Brad
Tags: todayilearned
Published: 2020-02-07 18:30:32

TIL, Brad Traversy is active and huge thanks!

Crazy! Brad Traversy saw my post and reacted. Legitimately uplifting considering all the no responses that I’ve received in the last however long I’ve been looking for an opportunity for a dev gig!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4fts291qrtrh2rg59azg.jpeg)


#The little things count

Little wins are key to success. To keep you riding the gravy train we call life. Make sure you celebrate and cherish every accomplishment.

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

It may have only been a year and 4 months since I started learning. However, learning while working full-time as a manager in a non I.T setting which has enough ups and downs, being a full-time dad/husband isn’t easy. But I’m so proud of where I’ve gotten too since I started.

I hope the journey for everyone else out there is going great and stay motivated all!

If you haven’t checked it out, his new Vanilla JavaScript course is out and it’s extremely worth the time.

https://www.udemy.com/course/web-projects-with-vanilla-javascript/


Allan
Best JavaScript charting library for time series?
Tags: javascript, help
Published: 2020-02-07 18:16:48

Hi everyone,

I would like to ask you. What's the best JS interactive charting library for time series? I'm searching for something that has an interactive and great design (Open-source ideally). For now, I'm using Python and Plotly, but I need a better solution for the website.  

Thank you so much. O:-)
👨‍💻How To Pretend You Are An Awesome Developer 😏| funny (Sketch)
Tags: uxdesigner, developer, funny, jokes
Published: 2020-02-07 18:03:13

This is supposed to be a funny video, I don't want to offend anyone or anything.

[How To Pretend You Are An Awesome UX Designer](https://dev.to/eleftheriabatsou/how-to-pretend-you-are-an-awesome-ux-designer-funny-part-1-4fbp)
[When You're Dating A UX Designer 🤦‍♀️😱](https://dev.to/eleftheriabatsou/when-your-dating-a-ux-designer-funny-sketch-285e/)

Enjoy :)



--
**Thank you for taking the time to watch my video.**

*Would you like to get me a coffee?!☕️
You can do that here → paypal.me/eleftheriabatsou
But If you can’t, that’s ok too 😍.*

It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.
[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/eleftheriabatsou/)
What every relational database developer needs to know about NoSQL
Tags: discuss, beginners, javascript, database
Published: 2020-02-07 18:02:53

I'm 41 and I don't really understand NoSQL. 

I never have. I have a relational database background. When I came up, understanding how to [normalize data](https://en.wikipedia.org/wiki/Database_normalization) was an essential part of application development. So was SQL. I have built a lot of Crystal Reports (dark times) and I can INNER JOIN like it's nobody's business. 

NoSQL has always seemed like a toy to me. And a bad toy at that. Data is de-normalized, repetitive, and, frankly, chaotic. It is quite literally the opposite of everything I have ever learned about how to structure data. It feels like I'm telling my children to play in the street.

What I have failed to understand this whole time, is that relational databases were solving a problem that doesn't exist anymore: the cost of storage. Storage is cheap, which means we can use different database types to make our systems much, much faster. 

It also means that you are going to need to unlearn everything you know about relational databases. NoSQL is not hard to understand, but you do have to let go of the rules that you were taught about how data should _always_ be structured. 

My friend [Steve Faulkner](https://twitter.com/southpolesteve) on the Azure Cosmos DB team pointed me to an excellent video from Ignite. This session takes a relational database, and moves it into a NoSQL one, walking you though how the concepts do and don't map across. 

[Data modelling and partitioning in Azure Cosmos DB: What every relational database user needs to know](https://myignite.techcommunity.microsoft.com/sessions/79932)

It's extremely well done, and probably the best presentation I've ever seen on this topic. In addition, you'll get a great intro to new concepts like Partition Keys that don't exist in relational systems, but allow you to do pretty remarkable things in a NoSQL one.

If you come from a relational database background, so much of this will seem wrong. It's OK. Let go of what you know, and I think you'll find NoSQL absolutely fascinating.
What (not?) to do in your new tech role
Tags: career, webdev
Published: 2020-02-07 17:59:23

Recently on the Salted Bytes podcast we discussed what to do (and NOT) to do in your first few days at a new dev role. 

Some of this advice was very applicable to most jobs:

* "Get to know people"
* "Always join in the first few social events after you start"
* "Find and cherish your mentors"

For developers though, whether in your first role or your twentieth, we had  some very industry-specific tips:

* **Don't cling dogmatically to your old tooling or coding style** - it may be familiar but you need to learn the way things are done in your new place of work - it's very likely they've arrived at their stack for compelling reasons, which are worth hearing out, and respecting. One you've done that, if you still feel duty bound to evangelise your new colleagues on your perspective on tabs v space, go right ahead. 

* **Get to know people outside of your immediate team.** This can give you invaluable insight into your new role, either from top level strategy and culture or from the low to ground must know info like how the holiday calendar works and how to claim expenses. (most companies should absolutely cover this in your orientation, but let's be honest, it's not always thorough).

* **Be curious, and ask the obvious question.** There's a great deal of pride, and conversely, imposter syndrome permeating software development. Don't be afraid to ask even the most humbling of questions: better now than 5 months down the line. There are myriad paths into development careers, not all of them computer-science based, and sometimes you'll encounter knowledge gaps that you didn't even know existed. Swallow that pride and ask the obvious question - clarity trumps assumption every day of the week. 

James & I covered more tips & tricks on the Salted Bytes podcast. Why not go check it out?

https://dev.to/salted-bytes-podcast
https://saltedbytes.rocks

Till next time

Chris
Wizar devlog 03: WIP on a circular multi level menu
Tags: react, sproutch, ux
Published: 2020-02-07 17:47:13

This week, I have refactored a complex UI component. It is a circular menu with multiple levels. It will be extensively used in Wizar for contextual menu.

It is part of my cross platform UI library: [Sproutch](https://github.com/dagatsoin/sproutch) which runs on web and React Native with the same code base (thanks to [ReactXP](https://microsoft.github.io/reactxp/)

Here are some features of the component:
- infinite level
- the children always spread where space are available (so no child out of screen)
- nodes open on long press
- user does not lift its finger to open the next node. All navigation is on sliding
- you can revert to a previous node by sliding on it (it will close the old branch and reopen a new branch)
- user selects the final leaf by releasing the touch on it.
- you can use it with a mouse (just click to open/close/select)
- you have access to the complete path, hovered node, and other informations while the user navigates (still WIP)

This is a gif of the result. It is not ideal because I can't show the touch dummy with my app. But I hope you get the idea.

![React and React Native circular menu from Sproutch UI library](https://i.imgur.com/Tq8zZRR.gif)
Cuantas personas de Mexico o LATAM hay aqui en Dev.to
Tags: mexico, latam, coderos
Published: 2020-02-07 17:33:12

Que tal raza, me preguntaba cuantas personas de Mexico y LATAM hay posteando aqui en Dev; 

//Seudocode
if (Eres de Mexico || Eres de LATAM) {
¿ En que lenguaje programas y en que te especializas ?
}
What was your win this week?
Tags: discuss, weeklyretro
Published: 2020-02-07 17:29:48

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

👋👋👋👋

Looking back on your week -- what was something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄

![](https://media.giphy.com/media/sTczweWUTxLqg/giphy.gif)
Quitting 9-5 job to learn web dev technologies?
Tags: beginners, career, discuss
Published: 2020-02-07 17:27:58

I am struggling to make progress learning front end technologies while having a full time job. Although I can work couple of hours after work and on weekends I am not satisfied with the progress I make.

Would love to hear your opinion and experiences on ditching the full time job and focus only on web development.
Any tips, thoughts, stories would be very appreciated.
The Three Rules of Snakes: A Management Metaphor from Netscape's James Barksdale
Tags: management, productivity, discuss
Published: 2020-02-07 17:20:17

I stumbled across [this anecdote from former Netscape CEO James Barksdale](https://hbr.org/2014/06/dont-play-with-dead-snakes-and-other-management-advice). I'm sure this concept is not without its defects, but it is an interesting way to think about things for software teams.

> Well, when we were first getting started at Netscape, and I was the old man working with Marc and all of his 18-year-old buddies, it seemed like they used to love to have get-together meetings to discuss problems that could have easily been resolved at the base level. They could have just taken care of it.

> So, the first rule of snakes is, if you see a snake, which is a problem — I had to explain that to one lady who accused me of not liking snakes — you kill it. You don’t shoot it, by the way, you kill it. It’s hard to shoot a snake. Anyway, you kill it. Just take care of it.

> The second rule is, once it’s taken care of, don’t keep having debates about it, which is don’t play with dead snakes. And one time, Marc may remember, I cut off the heads of a bunch of little rubber snakes and threw them out in the audience of Netscapers. They loved that and stuck them on their cubicle walls to remind them. Just keep moving forward. Even if you’re wrong, just keep moving. We were so anxious to get products out the door, and we were at lightning speed, thanks to Marc and his folks, we just wanted to keep moving. So, don’t play with dead snakes.

> And the last point, which is to me the most important and salient: all opportunities start out looking like a snake. If it wasn’t a problem, there is no opportunity. Because opportunities come from solving problems. So, kill it, don’t play with it, and then they all look like snakes in the beginning. The great business successes have all come from solving some seemingly insurmountable problem. Or non-obvious problem.

I'm not one for killing animals, but I do find this interesting otherwise. We definitely have a similar principle at DEV articulated as "solve the problem at hand", where we look to kill the snake in front of us, not find the solution for killing all future snakes we might encounter.

This is also portrayed in [this classic XKCD](https://xkcd.com/974/)...

![](https://imgs.xkcd.com/comics/the_general_problem.png)

What are your thoughts on this metaphor's applicability?
Enviando Mensagens
Tags: apachekafka, kafka, brailizandevs, microsservicos
Published: 2020-02-07 17:09:55

---
title: Enviando Mensagens
published: true
description: Exemplo de como enviar uma mensagem para um broker Kafka
tags: ApacheKafka, Kafka, BrailizanDevs, Microsservicos
series: Entendendo o Kafka
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/g87dtn83anqssn9yw4q6.jpg
---

Enviar mensagens no Kafka é bastante simples.

# Instanciando um Producer

Para configurar, é preciso basicamente apenas 3 parametros:

* **BOOTSTRAP_SERVERS**: Conjunto de pares IP:PORTA para acessar o cluster. Por exemplo, `kafka-1:9092,kafka-2:9092` irá acessar o cluster que contem os duas instâncias `kafka-1:9092` e `kafka-2:9092`
* **KEY_SERIALIZER_CLASS**: É a classe que fará a serialização da Chave. O que é e como é usada a chave, vamos explicar posteriormente. Deve ser uma implementação da interface `org.apache.kafka.common.serialization.Serializer`.
* **VALUE_SERIALIZER_CLASS**: É a class que fará a serialização do Valor. Não há mensagem sem um valor. Deve ser uma implementação da interface `org.apache.kafka.common.serialization.Serializer`.

{% gist https://gist.github.com/vepo/1468c5a3af73aff7e0fc78ae296ca589 %} 

Pronto, configurado o _Producer_, basta criar o objeto `ProducerRecord`, que irá associar mensagem/chave/tópico, e enviar ela.

No código acima, eu criei um simples cliente que lê todas as mensagens do STDIN e envia para o tópico em questão.

# Recomendações

* O envio é assíncrono, verifique se a mensagem foi realmente enviada e tente novamente caso negativo. Normalmente o cliente Kafka já faz algumas tentativas.
* Particione tipos de mensagens por chave, a ordem das entregas de mensagens só é garantida para mensagens com mesma chave.

# Conclusão

O envio de mensagens Kafka é simples e descomplicado, mas mesmo assim deve ser feito de forma cuidadosa para se garantir a entrega. Tendo a entrega da mensagem garantida, é certo que teremos o recebimento dela garantido.

Mais informações sobre Chave serão dadas quando formos falar de ordenação.

# Referências

Todos os códigos estão no repositório [vepo/kafka-articles](https://github.com/vepo/kafka-articles)