teleren/devto huggingface dataset:
Web Development Part 2C: Time for another test!
Published: 2019-05-26 22:06:42

---
title: Web Development Part 2C: Time for another test!
published: True
description: 
tags:
cover_image: https://gallery.mailchimp.com/fbd7db24d41cbb15fbb6a072f/images/76567adb-d5bf-4b2b-aa20-ddbbcb8ce243.png
---

It's time to do some work!
We're going to learn how to make a nav bar look nice! Don't forget to use the hashtag #TimTeachesCode on twitter! Remember, you can all contact me whenever you have questions or feedback.

This course is completely free and will be free forever. It takes a bit of time to prepare and support, so if you'd like to contribute, you can do so at https://paypal.me/tevko. Any contribution helps!

This week: Using our new skills to make something.
In the last lesson, we added some CSS to our FAQ page to make it look great!

In this lesson, we're going to take a break from the FAQ page and apply our new skills to a new challenge. We're going to take some raw HTML for a nav item and apply some CSS to make it functional and nice looking.

[Copy (or Fork) the content in this codepen to get started.](https://codepen.io/tevko/pen/joxjZq)

The Rules:
- No Javascript
- You can add HTML, but you can't remove any
- On small screens, a button should appear. Clicking the button should cause the nav to fly out from the left ([like this](https://www.jqueryscript.net/images/Responsive-Off-canvas-Navigation-with-Gooey-Transition-Effect.jpg))
- On large screens, the nav should stick to the top of the screen
- Use the "[checkbox hack](https://css-tricks.com/the-checkbox-hack/)" to enable the fly out nav when the button is clicked.
- Add CSS to not only make it functional, but look nice as well!

A few tips: 
- Don't overdesign. Focus on making the nav work on small screens and with the checkbox hack before anything else!
- This exercise is hard. Take your time and make sure you understand the exercise before you get started. Reach out if you have questions!
- While you may be tempted to add two navs and hide one on small / large screen sizes, don't do it! Duplicate navigations are bad for accessibility!

Homework: 
Reply to the email with a link to the redesigned nav and a brief summary of what you've learned about CSS design. Also include your plans to continue studying CSS and what else you think is possible with the checkbox hack!

Extra points.
Add transitions and keyframe animations to the nav interactions!
30 days of AWS (Day 2)
Tags: aws, challenge, 30daysofaws
Published: 2019-05-26 23:51:24

---
title: 30 days of AWS (Day 2)
published: true
description: 30 days of AWS (Day 2)
tags: AWS, Challenge, 30DaysOfAWS
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xk3wcpnc2h8nk8oy9xh6.png
---

Hello guys! Today I was studying something that I've confused me a lot VPCs.

Basically, this topic was very difficult for me because it's related to network, IPs and connectivity, and to be honest I'm pretty bad on these things.

Today I didn't finish the topic because I needed to watch the videos twice, took a lot of notes, and read the officials docs, but let me share with you what I've learned.

**1. Overview of the network services that AWS provides and Global infrastructure**: Here I read about what is an availability zone? what is an AWS region? and what is a data centre?

*AWS region*: A group of AWS resources located in a specific geographical location. The main Idea is that every customer or user can select a location closest to them, preventing latency.

*Availability zone (Az)*: It's a geographically isolated zone within a region that house AWS resources.  Basically, those are different datacenter.  Multiples Az in each region provides redundancy for AWS resources in that region.

*Datacenter*: It's physical hardware.

**2.  VPC Basics**: from the Amazon Docs "Amazon Virtual Private Cloud (Amazon VPC) enables you to launch AWS resources into a virtual network that you've defined. This virtual network closely resembles a traditional network that you'd operate in your own datacenter, with the benefits of using the scalable infrastructure of AWS." If you wanna read more about press [here](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html).

Here in the course provides one example that let me clarify a lot, the VPC structure first let's see this diagram. 

![Image 1](https://thepracticaldev.s3.amazonaws.com/i/unb7dmko7pi529at6d0d.png)

They say that a VPC is like the internet connection that we have at home something that it's true and I didn't see before, see the image below:

![image 2](https://thepracticaldev.s3.amazonaws.com/i/pd6xpwzz4gl6q3g8o3fv.png)

So if you see, our laptops or mobile phones are like EC2 instances. The firewall is like Network Access Control List (NACL).  The router or switch is like AWS Table Route.  And our modem is like the Internet Gateway (IGW). This comparison is pretty good because if you disconnect one part you won't have internet also you'll be disconnected from the world, the same thing will happen to your app if you will switch off one piece described above.

Ok, so today my progress was slow but I don't care because I'm learning a lot. Tomorrow I will continue studying about VPC World.

Thanks for reading.
How do you keep your environment variable synchronized among your development team.
Tags: env, productivity, discuss
Published: 2019-08-08 11:01:31

---
title: How do you keep your environment variable synchronized among your development team.
published: true
description: env file synchronization
tags: env, productivity, discuss 
---

*The problem :* 

We are working in a team of 10 developers, we are building an API, we are using a lot of environment variables which varies from access keys to apis keys. As you know those variables are not *gitable*.

Each one has a .env file in his local laptop and we are sharing a global sample.env which is also on our Github. 

Sometimes a dev may update his .env file and change his environment variables while working on a feature and forget to update the sample.env file or update the team with the new environment variable.

This leads to some frustrating and useless bug when the other developer is testing the feature. Sometimes you end spending 1 hour on a bug and then discover that it was due to outdated environment variables.


*The question:*

How do you keep the .env file secret but synchronized within the team so that each time we update the environment variable it's updated for every member of the team?

I was thinking about a secret gist file with auto-update when the .env file is updated by any team member.

How do you handle this scenario in your team?
Quick VS Code refactor/productivity trick
Tags: vscode, productivity
Published: 2019-08-08 13:23:44

So I was browsing ***Dev.to*** , like I normally do while waiting for my build process to finish (🐱‍👤) and I saw this post: 

{% link https://dev.to/hexrcs/5-visual-studio-code-tricks-to-boost-your-productivity-27a4 %}

And I thought I would share my one of my favorites.

Often when I need to create an object and as a test or have common values except for a single character I use this flow. It also works in refactoring just pieces of code really fast.

![demo](https://thepracticaldev.s3.amazonaws.com/i/6yh7h8nrs9ek9unt5msa.gif)

Here's an example, let's say i have an array of objects where I want the values to be 'test1', 'test2', 'test3' respectively to each object in the array:

```
const test = 'test';

const objectArray = [
      {
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
      },
      {
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
      },
      {
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
        prop1: 'test`,
      },
      ];
```

In this case you could just use a multi-cursor and type in the numerical value at the end, but here's another way that that helps out when it's not so easy.

You could use the `ctr + h` to replace `test` with `test1`, but that could replace more than what you had intended, like the string variable called `test` above `objArray`.

So here's what I do:

1. Select the block of code using some combination of `shift`, `ctrl` and `arrow keys` that is most appropriate.
2. `alt + l` (this notifies vs code that you intend to only do this operation on the selected block.
3. `ctrl + h` (opens the find/replace dialog box)
4. type in the value to be replaced
5. tab over to type in the value to be replaced
6. `ctrl + enter`. *update: new version of VS Code defaults to `ctrl + alt + enter` but can be changed back in they keyboard shortcuts
7. repeat for the next block

🔥For me, this is quite fast once the pattern becomes natural.

Voila❗ now it should look like the following:

```
const test = 'test';

const objectArray = [
      {
        prop1: 'test1`,
        prop1: 'test1`,
        prop1: 'test1`,
        prop1: 'test1`,
      },
      {
        prop1: 'test2`,
        prop1: 'test2`,
        prop1: 'test2,
        prop1: 'test2,
      },
      {
        prop1: 'test3`,
        prop1: 'test3`,
        prop1: 'test3`,
        prop1: 'test3`,
      },
      ]
```

And your fingers never had to leave the keyboard, cheers! 🍻

If you find this valuable, please leave a comment and follow me on [Dev.to @chiangs](https://dev.to/chiangs) and [Twitter @chiangse](https://twitter.com/chiangse), 🍻 cheers!
About Jay Bradenburg-Nau
Tags: jayaustinbrandenburgnau, jaybrandenburgnau
Published: 2019-08-08 14:30:47

Jay first realized that he wanted to be a therapist at the age of seven while listening to a mental health therapist on the radio. After working for ten years as a youth pastor, Jay earned a Masters Degree in Clinical Mental Health Counseling from Denver Seminary in 2010. Since then he has pastored at large churches in Chicago and Austin, and has worked extensively in clinical settings and private practice. His joy is to walk with men, women, and couples in places of brokenness in order to catalyze wholeness of heart and the journeying with others to a greater capacity to know and be known. Having grown up in Montana he has a huge love of the mountains and outdoors and is passionate about being on the rivers, rafting and boating.
Advanced usage of yum-config-manager with setopts
Tags: centos, mysql, yum, ansible
Published: 2019-08-08 14:41:21

---
title: Advanced usage of yum-config-manager with setopts
published: true
tags: centos,mysql,yum,ansible
canonical_url: https://www.zufallsheld.de/2019/08/08/yum-config-manager/
---

Recently I used the yum-config-manager program from the yum-utils package to add a repository in a CentOS-box.

This is the easy part:

```
# install the yum-config-manager
yum -y install yum-utils

# add the official ansible repository
yum-config-manager --add-repo=https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/
```

What gets added in `/etc/yum.repos.d/` is a file with the following content:

```
[releases.ansible.com_ansible_rpm_release_epel-7-x86_64_]
name=added from: https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/
baseurl=https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/
enabled=1
```

Now how to set for example the gpg-key with this command? That’s trickier.

The man-page for yum says you should use `--setopt` to “set arbitrary config and repo options”. `man yum-config-manager` goes into a little more detail:

```
Set any config option in yum config or repo files. For options
in the global config just use: --setopt=option=value for repo
options use: --setopt=repoid.option=value. The latter form
accepts wildcards in repoid that will be expanded to the
selected sections. If repoid contains no wildcard, it will
automatically be selected; this is useful if you are
addressing a disabled repo, in which case you don't have to
additionally pass it as an argument.
```

So to set the gpg-key for the repository I created before, I had to use this command:

```
yum-config-manager --save --setopt=releases.ansible.com_ansible_rpm_release_epel-7-x86_64_.gpgkey=https://releases.ansible.com/keys/RPM-GPG-KEY-ansible-release.pub
```
Porquê Linux?
Tags: linux, development, ambienteoperacional, desenvolvimento
Published: 2019-08-08 22:43:01

---
title: Porquê Linux?
published: true
description: O sistema operacional do desenvolvedor de software
tags: linux, development, ambiente_operacional, desenvolvimento
---

Para quaisquer linguagens de programação, exceto provavelmente para linguagens mantidas pela e para Apple, o melhor ambiente operacional para a atividade de desenvolvimento de sistemas é o [Linux](https://duckduckgo.com/?q=linux+operating+system&t=ffab). 

O Windows 10 agora permite instalações Linux ([WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10)), tentando convencer aos desenvolvedores que não precisam mais instalar um Linux em dual boot, ou mesmo desinstalar o Windows.

Eu afirmo que, qualquer que seja sua escolha, será uma boa escolha. Se quiser experimentar, não vai faltar [opção](https://www.linux.org/pages/download/). Eu mesmo já usei CentOS, Red Hat, Debian, Ubuntu, entre outros. O Linux suporta a grande maioria dos servidores corporativos atualmente em atividade. Desde a  pequena empresa até os grandes Cloud Providers. Nessas máquinas rodam nossos sistemas.

Desenvolver no mesmo ambiente operacional onde o sistema vai rodar é um importante motivo pelo qual você deve usar esse mesmo ambiente para programar. Além disso, é um ambiente estável, maduro, mais seguro, mais customizável. Enfim, se você não acha que já respondi à pergunta inicial, não perca mais seu tempo.

Minha escolha atual de ambiente operacional para desenvolvimento é o [Xubuntu](https://xubuntu.org/) 18.04.2 LTS, versão desktop. Trata-se de uma distribuição Debian-like, com uma interface gráfica (Xfce) leve e eficiente. A interface gráfica, no meu caso, é a mais simples possível. Faço poucas configurações visuais, embora haja muitas disponíveis. (Fontes e temas são fáceis de configurar, e é onde preciso mexer, com certeza.)

Aí é só instalar seu editor de textos ou IDE preferida, um multiplexador de terminal (você deverá usar bastante no processo de desenvolver, não tem jeito), e você estará pronto para começar. Em breve vou detalhar algumas ferramentas que tornam a vida do desenvolvedor mais fácil. Para instalação de linguagens de programação, por exemplo.
Unit Testing A/B Test Code
Tags: unittesting, webdev, testing, ab
Published: 2019-11-18 15:16:57

---
title: Unit Testing A/B Test Code
published: true
description: There are a few underlying considerations that make how to Unit Testing A/B Test Code a fairly remarkable question.
tags: Unit Testing, WebDev, Testing, AB
series: Front-End Testing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/tl582r2fapl5975lfyx1.png
---

Now, this seems like something that should be pretty straight forward ... testing the test and all that; what-what. But there are a few underlying considerations that make how to Unit Testing A/B Test Code a fairly remarkable question.

## Common Language

While writing this article about testing test code, the language started to get a bit wonky.

Here are the definitions I will use moving forward ...

* **A-TEST CODE** refers to the code that should already exist when it is decided that and A/B Test is needed. The expectation should be that Unit and Integration tests already exist against this code.
* **B-TEST CODE** refers to the code that will be written. Unit and Integration Tests should be written against this code, as well.

This article is focused on the fact that additional tests (Unit and Integration) may need to be created to ensure these two sets of code work together properly with the existence of the other. Having said that ...

* **NEGATIVE-SCENARIOS** should not be confused with Negative Testing which examines ways the code can fail. Negative Scenarios are the inverse of the tests for the alternate scenario (A-TEST CODE <-> B-TEST CODE).

## Overview of Considered Scenarios

Examining the scenarios this way ...

| Will the B-TEST move forward? | General Test Coverage<sup>*</sup> | Negative Scenario Coverage<sup>**</sup> |
| ---------------------------- | --------------------- | ------------------------- |
| Little or no chance | Few or no tests needed | Few or no tests needed |
| Maybe | Key areas | Should have these |
| Very high chance | Complete set of tests needed | Complete set of tests needed |

<sup>\*</sup> These are tests written **against** the B-TEST code, testing the new functionality.
<sup>\*\*</sup> These are tests that should be written as **negative scenarios**, testing for bleed-over of code between A-TEST and B-TEST scenarios. The tests for the alternate area should fail appropriately (B-TEST tests should include the INVERSE of A-TEST tests).

## The Questions

1. There should be test code for both the A-TEST and B-TEST scenarios. The question is how much test coverage should there be for the "new" code?
2. Both scenarios need to be concerned about bleed-over from the other code. Are the negative versions of the other scenarios tests enough?
3. Is there common code between the two scenarios that is covered appropriately (and therefore not included as negative test scenarios)?
A Weird Way to Substring in C++
Tags: c, programming, coding, gamedev
Published: 2019-08-09 21:31:34

---
title: A Weird Way to Substring in C++
published: true
description: A Weird Way to Substring in C++
tags: C++, Programming, Coding, Gamedev
---

```
/*

author:  mike bell 
twitter: @therealdarkmage
date:    Fri Aug 9 5:12 PM
website: https://mikebell.xyz

I was playing around and discovered a weird way to perform a substring on a string in C++.
Take the address of a string and then, using array indexing, add the position to substring from.
Works with constant and arbitrary strings! Cool/weird!
Compiles on current macOS g++ as of this writing.
*/
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
int main() {
    string s = &"Hello, World"[7];
    string ss = &s[2];
    cout << s << endl; // prints "World"
    cout << ss << endl; // prints "rld"
    return 0;
}
```
Do you use Axios or Fetch?
Tags: discuss, axios, javascript, ajax
Published: 2019-08-12 23:09:06

As a lover of all things programming, I send a lot of time exploring why we follow certain conventions. 

More recently, I've been playing around with hosting an API on Heroku. Most of the tutorials used Axios, with no thought to the decision. Several hours later, it's still not clear if 
1) the industry is moving towards using Axios
2) there are certain scenarios where Axios is the best tool
3) it's something else altogether

Would love to hear your thoughts on the two

This[Youtube video](https://www.youtube.com/watch?v=965sASYM220) offers an interesting POV, but he ultimately defaults to Fetch
ArangoDB Tutorial - Getting Started with ArangoDB
Tags: sql, webdev, tutorial, beginners
Published: 2019-08-13 03:34:55

ArangoDB: One engine. One query language. Multiple models.

This course will provide everything you need to get up and running with ArangoDB.

This course introduces you to:
       A brief history of databases
       The basic AQL syntax
       Performing CRUD operations with AQL
       Data modeling
       Indexing
       Joins
       Grouping and Aggregation
       Graphs
       An intro to the Foxx Microservices Framework

The second section (coming soon) of this course covers some more advanced and enterprise features including:
       Smart Joins
       Smart Graphs
       Setting up a cluster environment
       Deployment
       And more 

We hope by the end of this course you will have a better understanding of everything ArangoDB has to offer, what a native multi-model database is, and have the confidence to know when ArangoDB is the best solution for your product.

What you'll learn:
       An overview of everything ArangoDB has to offer.

{% youtube LaLYZt_h118 %}
Another Gksu Alternative For Ubuntu (Xorg)
Tags: ubuntu
Published: 2019-08-13 14:17:52

Back when Debian and Ubuntu [removed the gksu package](https://jeremy.bicha.net/2018/04/18/gksu-removed-from-ubuntu/), which was used to allow elevating your permissions when running graphical applications, the recommendations were:

-   for application developers to use PolicyKit and only use elevated privileges for specific actions
-   for users to take advantage of the gvfs admin backend, by [using the `admin://` prefix](https://www.linuxuprising.com/2018/04/gksu-removed-from-ubuntu-heres.html)

Using `admin://` has an issue on Ubuntu though - it asks for your password twice the first time you use it during a session. This does not happen in Fedora, but it happens in both Ubuntu 18.04 and 19.04.

So what's a good alternative for gksu to use on Ubuntu under its default Xorg session, which doesn't ask for the password twice? An alternative that doesn't depend on the Linux distribution or desktop environment you use (you do need PolicyKit installed), is the following command, which works with any graphical application (GUI) that you want to run with elevated permissions / as root:
```
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS`
```
The command exports your current `$DISPLAY`, `$XAUTHORITY` and `$DBUS_SESSION_BUS_ADDRESS` environment variables, allowing you to run any GUI application as root (with no need of having PolicyKit files for those apps), and without asking for the password twice, like ``admin://`` does on Ubuntu. 

To make it easier to use, since the command is quite long, you can create an alias for this command, called `gksu`.

To make this `gksu` alias for the `pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS` command permanent, add the following to your `~/.bashrc` file:

```
alias gksu='pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS'
```

You can add it to `~/.bashrc` by issuing the following command (run this command only once since it adds this line every time you run it):

```
echo "alias gksu='pkexec env DISPLAY=\$DISPLAY XAUTHORITY=\$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=\$DBUS_SESSION_BUS_ADDRESS'" >> ~/.bashrc
```

After this, source `~/.bashrc`:

```
. ~/.bashrc
```

Now you can run this alias exactly like you'd use the old gksu command.

For example, you can use it to run Gedit (replace with any other GUI text editor you wish) with elevated privileges and edit the /etc/default/grub file:

```
gksu gedit /etc/default/grub
```

Another example - run Nautilus (or some other file manager) and open the system themes folder:

```
gksu nautilus /usr/share/themes
```

For more articles I've written, check out [LinuxUprising.com](https://www.linuxuprising.com/), a Linux & open source blog.
Are you ready for the MongoDB 3.4 EOL?
Tags: sitecore, mongodb
Published: 2019-08-15 11:14:36

---
title: Are you ready for the MongoDB 3.4 EOL?
published: true
tags: sitecore,mongodb
canonical_url: https://jasonstcyr.com/2019/08/13/are-you-ready-for-the-mongodb-3-4-eol/
---

If you are running Sitecore version 8.2.x, you are running MongoDB 3.4. Unfortunately, that also means you are impacted by the announcement by MongoDB that version 3.4 will reach end-of-life in January 2020. You have some options on how you want to fix this and it sort of depends on how much tolerance your organization … [Continue reading Are you ready for the MongoDB 3.4 EOL? →](https://jasonstcyr.com/2019/08/13/are-you-ready-for-the-mongodb-3-4-eol/)