teleren/devto huggingface dataset:
Will cross-browser testing still be relevant in 2021?
Tags: testing, webdev, javascript
Published: 2020-12-07 11:22:24

If you're a developer, most of your time is spent on building and improving functionalities. 

It's easy to forget that not everyone is using Chrome.

I recently spotted a major cross-browser bug on LinkedIn.

This is how the **Interests** section looks like on Chrome:

![Linkedin Chrome](https://dev-to-uploads.s3.amazonaws.com/i/nz4oa06nxldd8zxzn3bt.png)

And this is how it looks like on Firefox:

![Linkedin Firefox](https://dev-to-uploads.s3.amazonaws.com/i/xd7yqn1aaroa6uw9m8fu.png)

It gets worse if you click on the **See all** button.

Chrome: 

![Chrome](https://dev-to-uploads.s3.amazonaws.com/i/4retmkj827sxaj4k5hfk.png)

Firefox:

![Firefox](https://dev-to-uploads.s3.amazonaws.com/i/71secy8kv0c22vmr3de3.png)

You'll find plenty of articles online about how LinkedIn has a complex workflow with scalable technologies to deliver to best experience for their users. 

Not even the latest and most scalable frontend technologies can prevent cross-browser issues from appearing.

Nowadays, it's a lot easier to [build automated tests](https://endtest.io/guides/docs/how-to-create-web-tests/) than it was 5 years ago.

A defect like the one I just showed you could have been easily prevented with a simple [automated visual test](https://endtest.io/guides/docs/computer-vision/).
NGINX ModSecurity WAF
Tags: security, webdev, spanish
Published: 2020-11-17 15:57:00

Incluso cuando comprendes de seguridad, es difícil crear aplicaciones seguras, especialmente cuando se trabaja bajo las presiones tan comunes en la empresa actual. El firewall de aplicaciones web NGINX ModSecurity (WAF) protege las aplicaciones contra ataques sofisticados de capa 7 que, de lo contrario, podrían provocar que los atacantes se apoderen de los sistemas, pérdida de datos confidenciales y tiempo de inactividad. El WAF de NGINX ModSecurity se basa en el software de código abierto ModSecurity ampliamente utilizado.

<h2>¿Por qué NGINX ModSecurity WAF?</h2>

*Probado en batalla*: utilizado por más de un millón de sitios web, ModSecurity es el nombre más confiable en seguridad de aplicaciones.

*Flexible*: NGINX ModSecurity WAF es un software de código abierto que se puede implementar en cualquier entorno: bare metal, nube pública, nube privada, nube híbrida, máquinas virtuales y contenedores.

*Rentable*: cumplimiento de PCI a una fracción del costo de los WAF de hardware.

<h2>Features</h2>

<h3>Layer 7 Attack Protection</h3>

Detecta y detiene una amplia gama de ataques de Capa 7:

- Inyección de SQL (SQLi), secuencias de comandos entre sitios (XSS) e inclusión de archivos locales (LFI), que en conjunto representan más del 90% de los ataques conocidos de Capa 7.

- Falsificación de solicitudes entre sitios (CSRF), inclusión remota de archivos (RFI), ejecución remota de código (RCE) y violaciones del protocolo HTTP.

- Otros vectores de ataque comunes, detectados por sus propias reglas personalizadas basadas en expresiones regulares.

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

<h3>IP Reputation</h3>

Bloquea automáticamente el tráfico de direcciones IP maliciosas conocidas:

- Busca direcciones IP en la base de datos de Project Honey Pot en tiempo real y niega el acceso a los usuarios denegados.

- Almacena en caché los resultados de las búsquedas durante un máximo de 24 horas para mejorar el rendimiento.

- Configura su propio "honey pot" de direcciones IP maliciosas y contribuya a la comunidad.

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

<h3>Audit Logging</h3>

Obtiene registros detallados para auditoría y visibilidad:

- Información detallada sobre todas las transacciones, incluidas solicitudes, respuestas y detalles sobre qué reglas se activaron.

- Registro de sistema remoto para archivado y análisis centralizado.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b00dk1mheq6g930ylana.png)
PHP Date/Time Cheat Sheet
Tags: php, beginners
Published: 2020-12-07 11:12:24





PHP uses the standard UNIX timestamp, which is the number of seconds since the start of January 1, 1970.

Date/Time appear in different parts of our application, be it a blog application, membership or forum website and so on.

The table below shows the different ways we can format date/time in PHP.

|format | description | value  |
|--|--|--|
| z | day of the year | 01 to 365  |
| N | day of the week from Monday to Sunday | 1 to 7 |
| j | day of the month with no leading zero | 1 to 31  |
| S | Suffix for the day of the month | st, nd, rd or th |
| d | two digit day of the month with leading zero | 01 to 31  |
| D | three letters day of the week| Mon to Sun |
| l | full names of the day of the week| Sunday to Saturday |
| W | number of the week of the year | 01 to 52  |
| y| year in two digit| 00 to 99|
| Y | year in four digit | 0000 to 9999 |
| t | number of days in a specific month | 28 to 31  |
| F | full name of the month | January to December|
| m | number of the month with leading zero | 01 to 12|
| M | names of the month in three letters | Jan to Dec|
n | number of the month with no leading zero | 1 to 12  |
| w| day of the week from Sunday to Saturday| 0 to 6|
| i | minutes with leading zero| 00 to 59|
| s | Seconds | 00 t0 59|
| A | uppercase | AM to PM |
| a | lowercase | am to pm |
| g | 12-hour format with no leading zero| 1 to 12|
| G | 24-hour format with no leading zero | 0 to 23|
| h| 12-hour format with leading zero| 01 to 12|
| H | 24-hour format with leading zero| 00 to 23 |

For further reading check out [the PHP date/time documentation](https://www.php.net/manual/en/function.date.php)

Original article posted on my [blog](https://judithoiku.tech/2020-php-date-time-cheat-sheet/)
Back to 2014: Grab to and resize div, Pure Css.
Tags: codepen
Published: 2020-12-07 11:07:35

Phew Im revisiting my Junior codepen's for fun to maybe give them a little critical analysis.

Produced way back in 2014, I wrote:

> I have found a way to re-size elements on a page without the use of javascript! (and very little markup).

> probably works okay in chrome but untested on anything else as yet. I will imporve it

> This is a BETA and will need a little work to become [modern] cross browser supported but it is absolutely possible.

{% codepen https://codepen.io/acronamy/pen/dPPvdg %}

I still cant spell!

Anyway the idea here is to hack resizing textarea's to allow them to push div's around. Other than not being compatible with other browsers who's user agent stylesheet dictates where the grab handles work, I still think this is a smart way to solve a problem.

Bravo junior me.
Advent of code - Day 6
Tags: javascript, typescript, adventofcode
Published: 2020-12-07 10:52:27

Are you participating in the [Advent of code](http://adventofcode.com) this year?

If you don't know what the advent of code is, it's a website where you'll find a daily challenge (every day it gets harder). It's a really fun event, you should participate!

I try to solve the exercises using either JavaScript or TypeScript and will share my solutions daily (with one day delay so no one can cheat!). I only share the solution for the second part.

For day #6, I got super motivated. I stayed awake until the challenge release (6am in my timezone), so I could maybe manage to get ranked!

After 7 minutes, I submitted the part 1 (pretty good score IMO!)... Only to realise that most of the top 100 took less than a minute! I have no idea how they do this, but I'm still happy with my performance.

Anyway, here is my solution for day #6:
```ts
input
  .split(/\r?\n\r?\n/)
  .map((group) => group.split("\n"))
  .map((group) => group.filter(Boolean).map((answers) => answers.split("")))
  .map((group) => {
    const record: Record<string, number> = {};
    group.map((answers) => {
      answers.map((answer) => {
        record[answer] = record[answer] + 1 || 1;
      });
    });
    return Object.keys(record).filter((x) => record[x] === group.length)
      .length;
  })
  .reduce((acc, v) => acc + v, 0);
```

Feel free to share yours in the comments!

________________________

Photo by [Markus Spiske](https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText)
Playstation 3 Proxy for custom firmware version validation in Python
Tags: playstation, python
Published: 2020-12-19 22:15:36

---
title: Playstation 3 Proxy for custom firmware version validation in Python
published: true
date: 2020-12-07 10:50:08 UTC
tags: playstation,Python
canonical_url: https://daniele.tech/2020/12/playstation-3-proxy-for-custom-firmware-version-validation-in-python/
---

A simple proxy for Linux to use with Playstation 3 to specify the firmware version and still use the online PSN services.

The post [Playstation 3 Proxy for custom firmware version validation in Python](https://daniele.tech/2020/12/playstation-3-proxy-for-custom-firmware-version-validation-in-python/) appeared first on [Daniele Mte90 Scasciafratte](https://daniele.tech/eng).
Terminal colors in C/C++
Tags: c, cpp
Published: 2020-12-07 10:44:32

When developing cross-platform terminal applications or using terminal output for logging or debugging, it's useful to color the output in order to not lose the overview.

This article shows how to color the terminal output on various platforms.

## Linux

On Linux, you can change the current foreground and background color by writing special character sequences into the output. Write the [ESC](https://en.wikipedia.org/wiki/Escape_character#ASCII_escape_character) escape character (octal `"\033"`, hex `\x1b`), followed by an opening square bracket `[`. The color definition will follow next, termniated by a lowercase `m`.

The color definition is a series of numbers, separated by semicolons. In order to make the text color red (number 31), you can write `"\033[31m"` which will make any following output red. If you want yellow text (33) on blue background (44), you write `"\033[31;44m"`. To reset everything back to the default colors, you write `"\033[0m"`.

```cpp
#include <stdio.h>

void main() {
  printf("\033[31mred text\n");
  printf("\033[33;44myellow on blue\n");
  printf("\033[0mdefault colors\n");
}
```

The [terminal-colors.d manual](https://man7.org/linux/man-pages/man5/terminal-colors.d.5.html) gives you an overview over the available codes.

## Windows

On Windows, coloring the terminal output, works a bit different. Instead of writing special character sequences into the output, you have to call special functions from the windows library. `#include <windows.h>` in order to access the Windows functions. This provides the [`SetConsoleTextAttribute()`](https://docs.microsoft.com/en-us/windows/console/setconsoletextattribute) function that can be used to color the text. You also need to get a handle to the stdout console using `GetStdHandle(STD_OUTPUT_HANDLE)`.

The following code shows how to color the text red and yellow on blue background:

```cpp
#include <stdio.h>
#include <windows.h>

void main() {
  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

  SetConsoleTextAttribute(hConsole,
    FOREGROUND_RED);
  printf("red text\n");

  SetConsoleTextAttribute(hConsole,
    FOREGROUND_RED | FOREGROUND_GREEN | BACKGROUND_BLUE);
  printf("yellow on blue\n");
}
```

Unlike Linux, where each foreground and background color has an individual number, you work with the red, green and blue channels on Windows. As you can see with yellow, it's a combination of red and green for example.

You can check available color values [here](https://docs.microsoft.com/en-us/windows/console/console-screen-buffers#character-attributes).
The Cookbook: Getting started with R
Tags: r, feature, devops, community
Published: 2020-12-07 10:43:22

---
title: "The Cookbook: Getting started with R"
created_at: Monday 7 Dec 2020 15:00:00 EDT
author: Montana Mendy
layout: post
permalink: 2020-12-07-r
category: news
excerpt_separator: <!-- more --> 
tags:
  - r
  - feature
  - devops
  - community
---

Some of the most downloaded R packages are built on Travis CI. In this cookbook, you'll see how easy it just is to setup Travis CI in an existing R project.

<!-- more -->


# Getting started with R 

Let's assume you have a file called `basic_operations.R`, and it reads something like this:
```R
add <- function(a, b){
  result <- a + b
  return(result)
}


subtract <- function(a, b){
  result <- a - b
  return(result)
}

divide <- function(numerator, denominator){
  if(denominator == 0){
    stop("Nah")
  }
  else {
    result <- numerator / denominator
    return(result)
  }
}
```

## Implementing Travis CI 

Now, you want to have automated testing. Thankfully there's Travis CI! Let's start off with the `.travis.yml` file: 

```yaml
language: R
cache: packages
warnings_are_errors: false
```

## Unit Tests 

For unit tests, we want to use something called `testthat`. Let's say we named our whole project `sampleR`. Your initial `testthat.R` file would look similar to this:

```R
library(testthat)
library(sampleR)

test_check("sampleR")
```

In your `tests` directory, you'll notice `/tests/testthat` and let's say you have a file in there entitled `test-basic_operations.R`, and it goes as follows: 

```R
test_that("addition works", {

  a <- runif(1)
  b <- runif(1)
  
  expect_equal(a + b, add(a, b))
  
  a <- -1 * runif(1)
  b <- runif(1)
  
  expect_equal(a + b, add(a, b))
})

test_that("subtraction works", {

  a <- runif(1)
  b <- runif(1)
  
  expect_equal(a - b, subtract(a, b))
 
  a <- -1 * runif(1)
  b <- runif(1)
  
  expect_equal(a - b, subtract(a, b))
})

test_that("division errors if zero", {
  expect_error(divide(1, 0), "Nah")
})

test_that("division works", {
 
  a <- runif(1)
  b <- runif(1)
  
  expect_equal(a / b, divide(a, b))
  
  a <- -1 * runif(1)
  b <- runif(1)
  
  expect_equal(a / b, divide(a, b))
})
```

You can see in this unit test, we are testing if `division`, `addition`, and `subtraction` passes the unit test. 

## Finishing up 

At this point, you're all set, and ready for your `R` project to build. Last but not least, there are alternative ways to get packages when building out your `.travis.yml`. For example if I wanted to get packages from GitHub, it would look something like this:

```yaml
r_github_packages: r-lib/testthat
```
The other alternative is to use `CRAN`. This is how it would look grabbing your package from `CRAN`: 

```yaml
r_packages:
  - testthat
```

Slight variants, but just different methods on getting the same package. It just comes down to your own approach and method.
run npm update without sudo
Tags: npm, ubuntu
Published: 2020-12-07 10:41:27

Hello, 

When I run `npm update` or `npm install` it asks me the permission  : 

````
 npm update
npm WARN checkPermissions Missing write access to /data/www/helloworls.com/node_modules/sass
npm WARN checkPermissions Missing write access to /data/www/helloworls.com/node_modules
npm WARN checkPermissions Missing write access to /data/www/helloworls.com/node_modules/laravel-mix/node_modules
npm WARN checkPermissions Missing write access to /data/www/helloworls.com/node_modules/watchpack-chokidar2/node_modules
npm WARN checkPermissions Missing write access to /data/www/helloworls.com/node_modules/webpack-dev-server/node_modules
npm WARN The package bootstrap is included as both a dev and production dependency.
npm WARN The package vue is included as both a dev and production dependency.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /data/www/helloworls.com/node_modules/sass
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/data/www/helloworls.com/node_modules/sass'
npm ERR!  { [Error: EACCES: permission denied, access '/data/www/helloworls.com/node_modules/sass']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/data/www/helloworls.com/node_modules/sass\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/data/www/helloworls.com/node_modules/sass' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mabdellaoui/.npm/_logs/2020-12-07T10_35_21_993Z-debug.log

````

should I change some permissions ?
Flutter crossAxisAlignment vs mainAxisAlignment
Tags: flutter, dart, firebase, android
Published: 2020-12-07 10:29:54


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

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


## For Row:
mainAxisAlignment = Horizontal Axis
crossAxisAlignment = Vertical Axis

## For Column:
mainAxisAlignment = Vertical Axis
crossAxisAlignment = Horizontal Axis


These two pictures are clear to show the meaning of MainAxisAlignment and CrossAxisAlignment.

When you use a Row, its children are laid out in a row, which is **horizontally**. So a Row's main axis is horizontal. Using **mainAxisAlignment** in a Row lets you align the row's children horizontally (e.g. left, right). The cross axis to a Row's main axis is vertical. So using crossAxisAlignment in a Row lets you define, how its children are aligned vertically.

In a Column, it's the opposite. The children of a column are laid out **vertically**, from top to bottom (per default). So its main axis is vertical. This means, using **mainAxisAlignment** in a Column aligns its children vertically (e.g. top, bottom) and **crossAxisAlignment** defines how the children are aligned horizontally in that Column.

### Row/Column are associated to an axis:

**Horizontal for Row**
**Vertical for Column**

**mainAxisAlignment** is how items are aligned on that axis. 

**crossAxisAlignment** is how items are aligned on the other axis.
Join WhiteHat Jr and fly to USA
Published: 2020-12-07 10:22:26

Friends any school students are there who want to learn coding, Here is the best way to learn it @WhiteHat Jr. Use my referral link to get 10% discount. If you have intense love in coding they also provide a chance to visit silicon valley in USA.

My referral link : https://whjr.co/w57sU
[Solved] adb install successfully but can't open the app on Huawei phone
Tags: adb, apk, huawei, android
Published: 2020-12-07 10:15:44

## Issue

You installed the apk successfully to your huawei phone via `adb install`:

```
adb install xxx.apk
Performing Streamed Install
Success
```

But after the installation you can't open it as the open button is disabled, nor can you find or search it in your phone.

## Analyse

There is a private space feature in huawei phone, and you turned it on.

## Solution

Go to settings/privacy, you'll see the private space. Switch into that space and you can find the app.

Or you can delete the private space totally to avoid this issue in the future.

![Private Space](https://dev-to-uploads.s3.amazonaws.com/i/szj617bxgx01uu86n2rj.jpeg)
Rails - Run Default Scope on All queries
Tags: rails, activerecord
Published: 2020-12-07 10:11:19

In a recent release candidate of Rails 6.1 (RC2) I have found a small but useful change in the active record library.

Consider a multi-tenant rails application, where everything was under the umbrella of the Organization.

default_scope used to run on all **select** and **insert** queries.

Previously:

    class User < ApplicationRecord
      default_scope -> { where(organization_id: Current.organization.id) }
    end

Now, Rails has the ability to run this default_scope on **select**, **insert**, **delete** and **update** queries by just adding **all_queries: true**

    class User < ApplicationRecord
      default_scope -> { where(organization_id: Current.organization.id) }, all_queries: true
    end
Deploy AWS Lambda with Docker container images in ECR.
Tags: aws, docker, serverless, awshero
Published: 2020-12-07 09:59:20

Using the AWS Cloud Development Kit, deploying an AWS Lambda function using Docker container images is pure gold. The installation of dependencies for Lambda functions always stressed me out. Regardless of using Node.js or Python, managing dependencies for AWS Lambda was never fun.

[AWS CDK Construct: Lambda Fleet for Dockerfile on sbstjn.com](https://sbstjn.com/blog/aws-cdk-lambda-fleet-multiple-docker-images-container/)
Free SaaS Landing Page
Tags: css, design, freebie, tailwindcss
Published: 2020-12-07 09:53:25

Beautiful, designed landing page for your SaaS. It comes in a dark and light version. The landing page is made with Tailwind CSS and optimized for mobile, tablet and desktop use. Icons included in these designs are from the awesome heroicons library.

Build with Tailwind CSS version 2.x

Grab your free copy here:
[Download Now](https://www.themes.dev/library/tailwindcss-saas-landing-page/)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4886n0rdch1ofewq98i5.png)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mvlw8amdafevk342dub5.png)
Twitter API v2: Hide Replies with Twitter-Stream.py
Tags: twitter, twitterapi, python
Published: 2020-12-07 09:51:48

[Twitter-Stream.py](https://github.com/saadmanrafat/twitter-stream.py) now supports `Hide Replies`. Set the environment variables as shown below. If you currently are not in possession of a [developers.twitter.com](https://developers.twitter.com) account. Check out this [list of apps](https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/apps) curated by Twitter. You can use these [applications](https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/apps) to hide conversations. 

## Usage

```bash
~$ mkdir twitterStream && cd twitterStream
~$ pipenv install twitter-stream.py # or use pip3
~$ pipenv shell
(twitter-stream) ~$ export $API_KEY=API_KEY
(twitter-stream) ~$ export $API_KEY_SECRET=API_KEY_SECRET
(twitter-stream) ~$ export $ACCESS_TOKEN=ACCESS_TOKEN
(twitter-stream) ~$ export $ACCESS_TOKEN_SECRET=ACCESS_TOKEN_SECRET
(twitter-stream) ~$ touch stream.py
(twitter-stream) ~$ tree
├── Pipfile
└── Pipfile.lock
└── stream.py
0 directories, 3 files

```
Enter the `URL` of the `reply` to your tweet you want to hide. The authorized user should be making the API call. 
```python
from twitter_stream import hide_replies

response = hide_replies(
    tweet: str = 'https://twitter.com/saadmanrafat_/status/1328288598106443776',
    hidden: dict = {"hidden": True} # or {"hidden": False} to unhide
)
print(response)
```

OUTPUT: 
```json
 {
   "data": {
     "hidden": true 
   }
}
```

[Twitter-Stream.py](https://github.com/saadmanrafat/twitter-stream.py) also supports `FilteredStream`, `SampledStream`, `RecentSearch`, `TweetLookUp`, and `UserLookUp`. To get more insights into other API endpoints. Visit the [examples](https://github.com/saadmanrafat/twitter-stream.py/tree/master/examples) folder and our documentations [twitivity.dev](http://twitivity.dev/docs/).
<hr>

`docs`   : [twitivity.dev/docs](https://twitivity.dev/docs)
`github` : https://github.com/saadmanrafat/twitter-stream.py
`mail`   : mail@twitivity.dev
`twitter`: [@twitivitydev](https://twitter.com/twitivitydev)
`report an issue`: [Issues](https://github.com/twitivity/twitter-stream.py/issues)