teleren/devto huggingface dataset:
Science Papers About Online Privacy
Published: 2022-01-18 18:09:54


* [Leaking privacy and shadow profiles in online social networks](https://www.science.org/doi/10.1126/sciadv.1701172)
* [Privacy and human behavior in the age of information](https://www.cmu.edu/dietrich/sds/docs/loewenstein/PrivacyHumanBeh.pdf)
* [Online Privacy Concerns Among Social Networks' Users](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.844.211&rep=rep1&type=pdf)
* [The Future of Privacy | Pew Research Center](https://www.pewresearch.org/internet/2014/12/18/future-of-privacy/)
* [A computer science expert on the data privacy crisis | The University of Chicago Magazine](https://mag.uchicago.edu/law-policy-society/computer-science-expert-data-privacy-crisis)
* [Your guide to better online security in 2022](https://www.popsci.com/diy/online-security-best-practices/)
* [NPTEL :: Computer Science and Engineering - NOC:Privacy and Security in Online Social Media](https://nptel.ac.in/courses/106/106/106106146/)
* [German Data Privacy Commissioner Sounds Alarm Over 'Upload Filter Oligopoly' * TorrentFreak](https://torrentfreak.com/german-data-privacy-commissioner-sounds-alarm-over-upload-filter-oligopoly-190301/)
Faster and simple Http and WebSocket Server for Ruby
Tags: ruby, webdev
Published: 2022-01-18 18:04:06

---
title: Faster and simple Http and WebSocket Server for Ruby
published: true
description: Fast WebSocket and Http/Https server using an native extension with C API from uNetworking/uWebSockets
tags: ruby,webdev
---

## uWebSockets for Ruby - uWebSockets.rb
I started to implement uWebSockets C API wrapper and a Ruby version a few days ago.
I got some good performance results (about 5x agoo in using techempower benchmarks for plaintext), for now i just implemented http/https apis but i will implement websockets this week and write some documentation (only linux support, mac should works fine as well, but i will add windows and mac tests and support too)

I will be glad for some feedback and help for testing in the near future https://github.com/cirospaciari/uWebSockets.rb

### Overly simple hello world app
```ruby
require "uws"

UWS::App.new()
.get("/", lambda {|response, request| response.end("Hello World uWS from Ruby!")})
.listen(8082, lambda {|config| puts "Listening on port #{config.port}" })
.run()
```

### Gemfile

```gem
gem 'uws', git: 'https://github.com/cirospaciari/uWebSockets.rb.git', branch: 'main', submodules: true
```

### Run
```bash
bundle exec ruby ./hello_world.rb
```

## SSL version sample
```ruby
require "uws"

UWS::SSLApp.new({
    key_file_name: "./misc/key.pem",
    cert_file_name: "./misc/cert.pem", 
    passphrase: "1234"
})
.get("/", lambda {|response, request| response.end("Hello World uWS from Ruby!")})
.listen(8082, lambda {|config| puts "Listening on port #{config.port}" })
.run()
```
How-to setup a HA/DR database in AWS? [8 - Multiple instances in multiple regions]
Tags: aws, terraform, sre, devops
Published: 2022-01-18 17:40:28

In this part of the serie, we will see how to create **in one Terraform script** and in a single execution, how to create elements in multiple regions.

This kind of tips is really helpful if you want to create at once all your infra and/or if you want to setup some disaster recovery.

---

## How to do it?
To do it, it's pretty simple. We have 2 steps to follow :
- declare multiple providers
- declare which provider we want to use for each resource

### Declare multiple providers
In your current script to create something on AWS, you should have an **AWS Provider** with the **region** where it should be created.

So, copy/paste this block for all your regions. Then add an alias to each of them to be able to differentiate them.

```terraform
provider "aws" {
  alias  = "frankfurt"
  region = "eu-central-1"
}

provider "aws" {
  alias  = "sydney"
  region = "ap-southeast-2"
}
```

---

### Declare which provider we want to use for each resource
In each resource you have, add the **provider** parameter to link each of them to the correct provider.

```terraform
resource "aws_rds_cluster_instance" "test_frankfurt" {
  provider = aws.frankfurt
  ...
}

resource "aws_rds_cluster_instance" "test_sydney" {
  provider = aws.sydney
  ...
}
```

---

And that's it! You are now able to deploy your complete infra on multiple regions at once!

I hope it will help you! 🍺

And see you soon for the next part of this serie. 😀


---

## Serie link
- **1 - Start** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-1-1ko7
- **2 - Definitions** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-2-definitions-93p
- **3 - Simple database** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-3-simple-database-a9o
- **4 - HA Database** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-4-ha-database-4kek
- **5 - DR database** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-5-dr-database-278b
- **6 - Create from snapshot** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-6-create-from-snapshot-2mbf
- **7 - Dynamic Terraform backend definition** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-7-dynamic-terraform-backend-definition-3aga
- **8 - Multiple instances in multiple regions** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-8-multiple-instances-in-multiple-regions-210d
- **9 - Generate a random value** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-9-generate-a-random-value-5g8a

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
How-to setup a HA/DR database in AWS? [7 - Dynamic Terraform backend definition]
Tags: aws, sre, terraform, devops
Published: 2022-01-18 17:40:20

In this post we will see something which can be really useful to use the same script in multiple environment or for multiple projects without modifying the code!

---

To do this magic trick, we will define dynamically the backend that we will use to store the terraform state.

## Backend declaration
First, we need to declare in the script which kind of backend we want to use.

In our example, it will be with **AWS S3**.
```terraform
terraform {
  ...
  backend "s3" {}
  ...
}
```

---

## Dynamic magic
So to have a dynamic backend definition, you have to add declare some parameters as options of the **terraform init** command.

### Backend parameters
- **bucket** : Name of the S3 bucket where you want to store the Terraform state.
- **key** : Path of the Terraform state file in the S3 bucket. Generally it is this parameter who will be updated to ensure you that each terraform state is located in a different place.
- **region** : Region where the bucket is
- **encrypt** : A boolean to know if you want to encrypt the file *(if you have a doubt, set it to true)*

### Command option
To give the backend parameters, you have to way to do it :
- declare a parameter with a key=value

> -backend-config='bucket=test'

- declare a tfvars file which contains some/all the configurations

> -backend-config='configs/configs_backend.tfvars'

---

Then you just have to give the right parameters when using the terraform commands, and you will be able to define multiple infra with one script!

---

I hope it will help you! 🍺

And see you soon for the next part of this serie. 😀



---

## Serie link
- **1 - Start** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-1-1ko7
- **2 - Definitions** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-2-definitions-93p
- **3 - Simple database** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-3-simple-database-a9o
- **4 - HA Database** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-4-ha-database-4kek
- **5 - DR database** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-5-dr-database-278b
- **6 - Create from snapshot** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-6-create-from-snapshot-2mbf
- **7 - Dynamic Terraform backend definition** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-7-dynamic-terraform-backend-definition-3aga
- **8 - Multiple instances in multiple regions** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-8-multiple-instances-in-multiple-regions-210d
- **9 - Generate a random value** : https://dev.to/adaendra/how-to-setup-a-hadr-database-in-aws-9-generate-a-random-value-5g8a

---

<center><h3>You want to support me?</h3></center>
<a href="https://www.buymeacoffee.com/mxguilbert7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Get last element of array in JavsScript
Tags: javascript, webdev, beginners, programming
Published: 2022-01-18 17:31:02

Whatever the programming language you code in ,I am sure you will be playing with arrays every day. So today we will be looking at options we can get the last element of an array in Javascript.

METHOD 1:INDEXING

When You know the lenght of the array:

Say we have the following array

var myArr = ['Apple', 'Orange', 3, 4, 'Football', 'Cricket'];
So as we know that arrays are zero-indexed in programming, which means that the first element is placed at zero position(Dont tell this to your non-programmer friend). So we just need to count the number of element in the array, which is six(6) in our case so

```
console.log(myArr[5])
```
will print the last element('cricket') for us. Easy Right. Now let's buckle up for the hard part.

METHOD 2:USING length FUNCTION

If the array is uncountable for human or coming as function argument than we can use javascript length function to get the last element. This will be like

```
console.log(myArr[myArr.length - 1])
```
myArr.length will give us the array lenght and 1 less from lenght will give the index of last element of the array.

METHOD 3: USING .pop() FUNCTION

We can get the last element of array with .pop() function like this

```
let last =myArr.pop()
console.log(last)
```
But there is a problem with this function as our array will be reduced to five items now as last element is popup out by the function. But if you were to use the array in your code again, you can have a copy of the array.

```
let myArray2 = myArr
let last =myArr.pop()
```
So now myArray2 have all the elements of original array and you can perform any task you want.
Configuring Git/GitHub
Tags: tutorial, github, git, gettingstarted
Published: 2022-01-18 17:13:41

This will be a blog in two parts the first one  Configuring Git/GitHub and the second Understanding more about Git/GitHub Commands which will be released soon. Lets gets get started!

but first you might ask what is the difference between local repository and remote repository?

The local repository is on your machine (git) and the remote repository is on the cloud (github). okay now lets get started.

#### Install git


Git generally comes pre-installed with most operating systems, but you can check by running git version in the terminal. If this gives you an error or does not come back with a version number, you'll need to install Git. You can install it using Homebrew.

1) Open the "Terminal" 
2) Type `brew install git` and press `<Enter>`
3) Close the "Terminal"
4) Reopen the "Terminal" 
5) Type `git --version` and press `<Enter>`

If you see a message starting with "git version...", continue below.

#### Create a GitHub Account

To work on and get credit for for your work, you will need to sign up for a GitHub account if you don’t already have one.
[Github signup webpage](https://github.com/join)

#### Configure Git and GitHub

Git is the tool that we’ll use to download and upload the work that we do. To use Git without signing in every time, you can create a Secure Shell (SSH) key and associate that to your GitHub account. This step will ask you to do work both in your browser and your terminal.

1. Open the "Terminal"
2. Type `git config --global color.ui true` and press `<Enter>`
3. Type `git config --global user.name` + `<Space>` + your name and press `<Enter>` (Note: this should be your full name, not your GitHub username, in quotes.)
4. Type `git config --global user.email` + `<Space>` + the email address you used to sign up to GitHub and press `<Enter>`
5. Type `ssh-keygen` and press `<Enter>`
6. For each prompt do not type anything, just continue to press `<Enter>`
7. Type `cat ~/.ssh/id_rsa.pub | pbcopy ` and press `<Enter>`. This will copy your SSH key to your clipboard
8. Open the [GitHub New SSH key form](https://github.com/settings/ssh/new)(Note: you need to be logged in to GitHub to access that link.)
9. Type "My personal Mac" in the "Title" input field
10. Paste what’s on your clipboard from step seven in the "Key" input field
11. Click "Add SSH Key"

Hopefully this post will help some of you get started with Git/Github.
Why Load Balancing Is Important
Tags: devops, programming, backend
Published: 2022-01-18 16:52:50

### INTRODUCTION


Modern high-traffic websites must handle hundreds of thousands, if not millions of the concurrent user or client requests when returning accurate text, images, video, or device data in a timely and consistent manner. As a result of this amount of requests, such websites might lag and eventually crash. The use of load balancers can prevent such events from occurring.

A load balancer is a system that distributes network or application traffic through several servers by acting as a reverse proxy. With a load balancer,
- User requests or network load are distributed through many servers in an optimal manner.
- Allows you to add or remove servers as needed, depending on demand.
- Sends requests to only online repositories, ensuring high availability and reliability.

#### So, what is Load balancing? 

Load balancing is the process of evenly spreading incoming network traffic among a collection of backend servers, often referred to as a server farm or server pool. As the name implies, it is a process of balancing the load on a server, and load in this context refers to requests.

Some several techniques or algorithms can be utilized depending on their use. Some of them are:
1. Least connection: This approach takes the actual server load into account. The latest request is forwarded to the site that has the fewest pending requests at any given time.

2. Hash: Requests are distributed based on a key you choose, such as the client's IP address or the file URL.

3. IP Hash: The client's IP address is used to decide which server will receive the message.

#### Why is load balancing important?

1. Load balancing improves service availability and helps prevent downtimes. 
2. To maximize the use of resources and reduce the response time.
3. A load balancer prevents the entire network from failing if a server from a server cluster fails.
4. A load balancer helps to manage traffic flow on a website.
5. Add flexibility to the network. For example, a site can be upgraded without downtime while using load balancers.
6. It improves scalability.
7. Load balancers improve the capacity of existing servers.

In conclusion, it is good practice to use and advisable to use load balancers if you plan on having a high-traffic website or application.
How to run GUI apps trough WSL?
Tags: wsl, linux, tutorial, bash
Published: 2022-01-18 16:49:22

Hi, guys today I will show you how to run GUI apps through **WSL**. As you know by default **WSL 1** offers just a terminal of the selected Linux distro but in **WSL 2** there are some changes and you are going to be able to run GUI applications through WLS 2 directly in windows. Without further due let's hop into the topic.

### Note: If you have wsl 1 installed skip to step 2, otherwise follow the steps as it is.

## 1. Installing **WSL**.
In case to install the **WSL** (windows subsystem for Linux), you will need administrator permissions on your machine. After that, you will have to open the windows PowerShell as administrator and activate the wsl feature. To that just paste this command in ht PowerShell and hit enter.
```PowerShell
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
```
If the command has been executed successfully restart your machine and continue to step 2.

## 2. Enabling Virtual Machine Feature and installing **WSL 2** version.
After everyone has **WSL** installed, in case to switch to **WSL 2** you will need to enable A special built-in virtual machine for **wsl 2**. To do that just paste this into your PowerShell (opened as administrator)
```PowerShell
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
```
After you have enabled the virtual machine feature, it is time to install the **WSL** version 2. To do that, download the latest kernel update [here](https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi). It is an official Microsoft executable, that you can run just by double-clicking after you install it. It is time for the final step - Running GUI apps through **WSL** on windows.

## 3. Running GUI apps through **WSL**.
We are almost finished this is the last step to do, I promise. To be able to run any graphical app through **WSL** you will need a graphics card driver in addition. You can download the special driver for either [GeForce](https://developer.nvidia.com/51006-gameready-win11-win10-dch-64bit-international) or [Quadro](https://developer.nvidia.com/51006_quadro_win11_win10-dch_64bit_international) series graphics cards. Wait for it to download, then install it by double-clicking. After it is installed it is good to practice rebooting your machine. After you have it rebooted you can install any application on your WSL Linux Distro, for example, "Firefox".
```Bash
sudo apt install firefox
```
After the installation is completed you can simply run the application, in our case, it is firefox so we are going to run it by typing in the command line `firefox`. Wait for it for some time because it is the first launch and if everything has been set up as it should, you should be prompted with the firefox application directly on your windows screen, running through **WSL**. 
Congratulations you have successfully set up **WSL 2** and enabled GUI on trough **WSL**. 🎉🎺🎉

If you have any questions, just leave a comment, I will answer as soon as possible.
Starting Week 1
Tags: javascript, beginners, flatiron
Published: 2022-01-18 16:41:16

What a week!  After living my whole life around code, today marks the first seven days of actually dedicating time and resources to learning code full time.  It is exhausting.

I'm loving every console.log('Hello World') and fetch request. Week one of the 15 week Flatiron Software Engineering course got me through DOM manipulation and JSON parsing. 

Finishing week 1 on JSON data felt like a good place: there is something magical about a nicely formatted data set. 

I expect that I'll have more data-related posts in the future, for now I'll leave with something I was thinking about while walking the dog this weekend:

Array and frame of reference within in a delimited space: If we are shifting and unshifting data around in an array, in relationship a single piece of data what are we doing?  Are we moving the data around within the array, or are we shifting the array's frame of reference. This question arises for me when thinking about shifting data around in an array as if it were a playing board (tetris or chess for example).  If I move a piece one slot left, is the piece moving or are we moving the whole frame of reference for the array.  

Would a more efficient way would be to swap positions for the data with the element next to it rather than actually moving all the data around it?

More to come, specific examples.  For now, on to week 2 and our first code challenge.
Paracetamol.js💊| #18: ¿Qué imprime este código JavaScript?
Tags: javascript, beginners, webdev, spanish
Published: 2022-01-18 16:40:55

## **¿Qué imprime este código JavaScript?**

```js
String.prototype.giveLydiaPizza = () => {
  return "Just give Lydia pizza already!";
};

const name = "Lydia";

name.giveLydiaPizza();
```

-     A: "Just give Lydia pizza already!"
-     B: `TypeError: not a function`
-     C: `SyntaxError`
-     D: `undefined`

Respuesta en el primer comentario.

---
How To View Detailed Information About PHP With phpinfo() Function
Tags: php, phpinfo, beginners, tips
Published: 2022-01-18 16:40:53

When we develop PHP web applications and sites, often we need to get information like available modules, environment variables, server information. In order to get these pieces of information, we can simply use the `phpinfo()` built-in PHP function.

## View All PHP Information

First, create a PHP file and add the following code.

```
<?php
    phpinfo();
?>
```

Place that file in your web server document root directory (Ex: www) and access it from your web browser. It will display all the information about your PHP installation.

## View Specific Information About PHP

By default, `phpinfo()` PHP function displays all the information. But we can narrow it down to specific categories like general information, configurations, modules, environment variables and etc. For that, we need to pass an additional parameter to the `phpinfo()` function.

```
<?php
    phpinfo(INFO_VARIABLES);
?>
```

- **INFO_GENERAL** - system information, build date, `php.ini` configuration file path.
- **INFO_CONFIGURATION** - information about PHP directives such as display_errors, file_uploads, log_errors, post_max_size, upload_max_filesize, upload_tmp_dir and etc.
- **INFO_MODULES** - information about loaded modules such as bcmath, curl, gd, hash, json, mbstring, mysqli, openssl, PDO, pgsql, session, sockets, sqlite3, xdebug, OPcache, zip and etc.
- **INFO_VARIABLES** - information about the server such as DOCUMENT_ROOT, REQUEST_URI, REQUEST_METHOD, HTTP_USER_AGENT and cookie information. These are available in `$_SERVER` and `$_COOKIE` variables.

The complete list is available at [PHP Documentation](https://www.php.net/manual/en/function.phpinfo.php).

## CLI Version Of phpinfo()

Instead of editing files and accessing them using a web browser, you can even obtain the above-mentioned information by using the CLI. For that, open a terminal window and run the following command. It will display about PHP in the terminal.

```
php -i
```

If you need, you can even narrow down and filter the output by using the `grep` command with `-i` (ignore case) flag like below. So it will only display information related to `xdebug`.

```
php -i | grep -i 'xdebug'
```

Feel free to visit [devtonight.com](https://devtonight.com?utm_source=dev&utm_medium=questions&utm_campaign=how-to-view-detailed-information-about-php-with-phpinfo-function) for more related content.
Paracetamol.js💊| #17: ¿Qué imprime este código JavaScript?
Tags: javascript, webdev, spanish, beginners
Published: 2022-01-18 16:39:30

## **¿Qué imprime este código JavaScript?**

```js
const obj = { a: "one", b: "two", a: "three" };
console.log(obj);
```


-     A: `{ a: "one", b: "two" }`
-     B: `{ b: "two", a: "three" }`
-     C: `{ a: "three", b: "two" }`
-     D: `SyntaxError`

Respuesta en el primer comentario.

---