teleren/devto huggingface dataset:
VS Code Tip of the week: Live Share
Tags: vscodetips, vscodeextensions
Published: 2022-09-28 03:07:47

I hinted at this week's tip a few weeks ago.

{% embed https://dev.to/vscodetips/vs-code-tip-of-the-week-vscodedev-2gcc %}

This week's VS Code tip is the [Live Share](https://code.visualstudio.com/learn/collaboration/live-share) extension pack!

![Live Share commands displayed in VS Code's command palette](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrk6gl11vsobh70klosb.png)

This is an excellent collaborative tool if you want to pair with others. If you've never used it, think Google Docs collaborative mode meets your editor.

![Notification in VS Code stating a Live Share session is beginning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/217w2oh27z64neynkprl.png)

Some notable features:

* All participants being able to modify code
* The person that initiated the Live Share session can also share their local web server. For example, suppose I start an app on http://localhost:3000 while Live Share is running. Participants can navigate to http://localhost:3000 on their machine and see the app we're building out in real-time.
* You can follow where another participant is navigating code
* You can share a terminal session. This is, by default, disabled, so only allow participants access to your terminal session if you trust them.

And [vscode.dev](https://vscode.dev), which I mentioned at the beginning, can be used with Live Share, so someone anywhere on the planet with a browser can collaborate with you.

If you have access to GitHub Codespaces, it'll work there too. I'm not positive, but if you use Gitpod but run it in a container locally in VS Code, you can also use Live Share.

Now go collaborate!
What should I do if I want to call a function after a state change?
Tags: react
Published: 2022-09-28 02:42:35

When I use hooks, I have an object obj that will be modified in multiple places. I just want to call a function that uses obj after a certain modification. If it is called directly, obj is not the latest value. What is the optimal solution？
``` javascript

const [obj, setObj] = useState({})

const funcA = () => {
  ajax(obj)
}

const funcB = (v) => {
  setObj(v)
  funcA()
}
// ...other setObj
```
This is my current code, but there are some bug

``` javascript
const [obj, setObj] = useState({})

const funcA = () => {
  ajax(obj)
}

const funcB = (v) => {
  Object.assign(obj, v)
  setObj({...obj})
  funcA()
}
```
Does React plan to implement a callback api similar to that after setState?
Learning Self in Ruby
Published: 2022-09-28 02:04:27

Today, we will be discussing what does **'self'** means in Ruby and how it can be used in the code?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v7bc6xnodb732u1w1d01.png)


**What is self ?**

- Everything we write in Ruby belongs a particular Object, **'self'** is nothing but an object in ruby.**'self'** is a keyword in Ruby which gives us access to the current object. 

- **'self'** points to the currently executing code in a Object. If your code is executing in Animal class as shown below then **'self'** is that Animal instance.

**Using self in instance method**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/66b3t5sdzidusrizorcm.png)

 - current_instance_animal method returns self which is Animal instance that we created in line number 9
 - Line number 11 proves that 'self' == lion 


**Using self in class method**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99hd35os2gv2sma48my7.png)

- To access a instance method as shown in above figure, we must create an instance of that class and call the method using that instance. 
- To access a class method which is defined using self we do not need to create an instance of that class but can directly call that method using Example.class_method
Pra Exam CH.1-2 RHA134
Tags: cloud, rhaacademy, tjktadb, devsecops
Published: 2022-09-28 01:13:02

**lab 134-ch1**

on servera
1. Create 1000 file with parameter name file is "laporan-xxx.txt" in directory ~/laporan with bash script in directory ~/ (/home/student/) with name script file is createFile.sh

2. fill in each laporan-xxx.txt file with the "Data Ke-xxx"

3. create backupfile using gzip with name is laporan.tar.gz in directory ~/laporan

4. create scheduling jobs every minutes for command copy ~/laporan/laporan.tar.gz to  ~/backupLaporan.tar.gz
open-appsec NGINX WAF makes machine learning friendly using gamification
Tags: cloudnative, nginx, kubernetes, appsec
Published: 2022-09-28 00:31:53

In a [previous blog](https://dev.to/openappsec/kubernetes-ingress-security-using-machine-learning-4hlp) we explained how [open-appsec](https://www.openappsec.io), an open source WAF project, is using machine-learning to preemptively block attacks against Web Apps & APIs.

Machine learning is often a black-box which is difficult to understand and track. open-appsec uses [gamification](https://en.wikipedia.org/wiki/Gamification) in order to demonstrate the learning progress.

We developed a system that uses human understandable terms to describe the progress of learning as well as explanation as to what is needed in order to reach the next level.

![open-appsec machine learning levels](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0dt32g881bri271fgtp.png)

Depending on amount and variance of traffic the machine learning engine will reach a stage where it has observed a sufficient amount of web requests to understand how the application is used. The faster this stage is reached, the faster detection is accurate and it is recommended to move to Prevent mode.

When the learning level becomes Graduate, it is recommended to change the  Mode to Prevent. Graduate level ensures very good level of accuracy (e.g. low amount of false positives).  To reach Master or PhD level is is necessary to configure Trusted Sources. The Phd level is the highest level, which means that more learning is less likely going to improve the model further.

![open-appsec machine learning gamification](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7keah48q3gsh7q2zvr5.png)

To speed up the learning period the Contextual Machine Learning engine proposes tuning suggestions. The administrator can review the tuning suggestions and help the engine reach even better accuracy, a Machine Learning process also known as supervised learning.

We get nice feedbacks from users saying that this allows them to understands the status and what they are expected to do no next.

For additional details see [here](https://docs.openappsec.io/how-to/track-learning-and-move-from-learn-detect-to-prevent).
My first command-line tool!
Tags: opensource, beginners, javascript, tooling
Published: 2022-09-28 00:27:22

## Hello everyone!

Today, I want to present to you my first command-line tool that I have been working on in the last three days. 

It was part of the course work. However, we were only presented with the requirements. So, no implementation instructions were given.

To be honest, at first, I was so scared. I usually feel alright with figuring the things out along the way, but this project was entirely new. It was focusing on the creation of the command-line tool for static site generation, which I have never done before. I was also never a fan of web development, so it pushed me out of my comfort zone. 

However, closer to the end, I realized that I was thinking about implementing the features that I have not been asked to do. I got sucked into the project and truly cared about its development. I wanted to improve it as much as I can. Suddenly, it became so interesting...


So, here it is, my baby [SSGulnur](https://github.com/gulyapulya/SSGulnur)!


**SSGulnur** is a **s**tatic **s**ite **g**enerator command-line tool created by me, **G**ulnur. It allows you to transform txt files into html pages in a matter of seconds. You can also specify the output folder or a stylesheet of your choice.

Below you can see the details:

For the installation, node is required. First clone this repository to your local machine, then navigate to the cloned directory in your terminal and run npm to install globally `npm install -g`.

Usage.

`ssgulnur -v | --version` displays the tool's name and current version.

`ssgulnur -h | --help` displays a help guide with all instructions.

`ssgulnur -i | --input <source>`

* Source can be a single file or folder which can also contain sub-folders. 
* For file names with spaces, please use quotation marks. For example: `ssgulnur -i "Example file path.txt"`.
* For each provided file an html file will be generated. By default, all html files will be placed into the `./dist` folder.
* All titles need to be the first line in the file followed by two blank lines. Otherwise, it will be considered as part of the story.
* Different options are available: 
   * `-o \| --output`|`<folder>` Allows to specify an output folder name. If exists, will be used, if not, gets created. <br>Cannot be a file. By default, `./dist`.
   * `-s \| --stylesheet`|`<url>` Allows to specify a particular stylesheet to use for html styling. For example, https://cdn.jsdelivr.net/npm/water.css@2/out/water.css

### Examples

* `ssgulnur -i "Example file path.txt"`
* `ssgulnur --input exampleFolderPath --output exampleOutputFolderPath`

You can find the source code here: https://github.com/gulyapulya/SSGulnur.

TADAAAA!

![Tadaa](https://tenor.com/view/done-tada-magic-hi-whatsup-gif-14894614.gif)
How To Write A User Story
Tags: javascript, webdev, programming, tutorial
Published: 2022-09-28 00:14:12

###Introduction:
One of the difficulties in developing a software application is determining and meeting the needs of the end user. This problem is easily solved by writing a user's story, which allows us to understand the end user's point of view. This article defines a user story, the benefits of writing one, and how to write one.


###What is a user story:
User stories are agile software development tools used to explain a software feature written from the end user's perspective in an easy-to-understand format.
They are not written in detail and should not be big or small.
They only explain how a particular type of work will add value to the end user, who can be either colleagues or external users. They are written down on index cards, sticky notes, and project management software.


###Benefits of the User Story:
Some of the benefits of the user story include but are not limited to these:
- It helps the teams deliver high-quality content.
- It enables collaboration with team members.
- It helps in improving transparency.
- It reduces risk by giving clarity to the requirement of the user.
- It helps in supporting iterative development.
- It  helps focuses on vocal communication


###How to write a user story: 
User stories capture the most critical aspects of a requirement:
- Who is it aimed at?
- What does it expect of the system?
- Why is it valuable (optional)?

They are written in this format:
As a [role], [i want to] [so that]
The “role” refers to the user that would interact with the system
The “want to” represents the behavior of the system and is peculiar to each story.
“So that” explains the benefit of the story.
As an example:
As a manager, I want to be able to track my team’s progress so that I can record our successes and failures.
 
###Conclusion:
User stories can be understood by anyone and keep you from becoming entangled in technical jargon. It develops each proposed idea for new functionality from the point of view of real users.
Is Your Python For-loop Slow? Use NumPy Instead
Tags: python, programming, beginners, productivity
Published: 2022-09-28 00:12:19

Speed is always a concern for developers — especially for data-savvy work.

As developers, the easiest way to scale up things is using a for-loop. But there are drawbacks to using them for large numerical computations. 

This post compares how for-loops perform in such workloads with vectorized alternatives. 

[Is Your Python For-loop Slow? Use NumPy Instead](https://towardsdatascience.com/numpy-vectorization-speed-ffdab5deb402?sk=c6f7809aafb6cb4155853ac5d155d775)
React js
Published: 2022-09-28 00:08:29

Hey fellow engineers, I'm new and just starting my journey! My assignment was to get over Imposter Syndrome. To due so I was told to create a post to be more involved in the Software Development community. So this is my post. I was also told to google a topic and tell what I've learned. The topic I've decided to google was React Js. What I've learned is that React Js is an open-source javaScript framework created by Facebook, and that is used for building interactive user interfaces and web applications. My finding also thought me that React Js is more efficient that Vanilla javaScript. So my next post will probably be about Vanilla javaScript as I deep dive more into that and just get more familiar with the language and if it's the same or similar to javaScript.
Which comes first? Manual testing or continuous delivery?
Tags: continuousdelivery, qa, regressiontesting, greenfield
Published: 2022-10-24 16:12:33

---
title: Which comes first? Manual testing or continuous delivery?
published: true
date: 2022-09-28 00:00:00 UTC
tags: continuousdelivery,qa,regressiontesting,greenfield
canonical_url: https://jhall.io/archive/2022/09/28/which-comes-first-manual-testing-or-continuous-delivery/
cover_image: https://jhall.io/images/bn-must-be-this-tall.jpg
---

A few months ago I was talking to a CTO who told me his team wasn’t yet mature enough to graduate from manual QA to [continuous delivery](https://jhall.io/glossary/#cde).

I’ve heard similar arguments from many teams. It often takes the form of “We’re just not ready yet for continuous delivery.”

But here’s the thing…

Doing manual QA testing well requires a lot more effort, a lot more time, and indeed, a lot more _maturity_, than doing continuous delivery well.

When I’m coaching teams on greenfield projects, I always advise them to set up continuous delivery _long_ before investing in test engineers. In fact, for greenfield projects, I always advise setting up continuous delivery [before even writing code](https://jhall.io/posts/dancing-skeletons/).

None of this is to say that manual testing is a problem. It can be done very well, and it can have a tremendous impact on the quality of a project. But most teams use their testers very poorly, having them do rote regression testing. This is a huge waste! It’s a waste of time—computers are thousands of times faster at regression testing than humans can ever be. It’s a waste of talent—humans get bored doing rote tasks, computer’s don’t. And it’s a waste of business potential—imagine putting those testers to work doing things that only humans can do, and that improve the quality of your product in better ways!

If you’re at the greenfield stage of a project, I emplore you to invest in continuous delivery as step 0. Then work on building a product. Then get some highly skilled testers to help you explore how to improve your product.

If you’re not at the greenfield stage, and you’re already stuck in the cycle of manual regression testing, now is a great time to start improving! The [Lean CD Seminar](https://jhall.io/leancdseminar/) starts next week, and will help kick-start your continuous delivery journey, or your money back!

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Started working on Space Invaders
Tags: beginners, python, practice, programming
Published: 2022-09-27 23:07:30

Today was a little difficult. I began working on my first project creating ay first game. A lot of “def” functions were being used to structure the code for the game. Although I remember the fundamentals..it was kinda uneasy building today due to barely understanding my code..sometimes I makes me question if it’s worth it. I wonder if I’m even blogging correctly…anyways I will continue tomorrow.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95873lgddp7leys3hkb4.jpeg)
Usando o ApacheBench (ab) para testes de carga simples
Tags: apachebench, api, test, load
Published: 2022-09-27 23:07:12

## O que é Apache Bench ?
É uma ferramenta de benchmarking que mede o desempenho de um servidor web enviando varias solicitações HTTP e registrando métricas de latência e sucesso. 
O ApacheBench pode ajudá-lo a determinar quanto tráfego seu servidor HTTP pode sustentar antes que o desempenho diminua e definir linhas de base para tempos de resposta típicos.

## Como instalar ?
Nos servidores Mac e Linux ele vem instalado por padrão no pacote básico do sistema. 
No windows é necessário baixar e instalar 
link para [download](https://www.apachelounge.com/download/)
após a instalação é possível encontrar o executável na pasta 
apache\bin

![Windonws](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdmhg17b7locks9k89w3.png)

## Executando os testes

Aqui temos alguns argumentos aceitos: 

![Arumentos](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3759abo8f13g3hvnwdtg.png)


Basta executar o seguinte comando 
` ab -n 100 -c 10 https://www.google.com/`

Ao executar a instrução recebemos a métrica abaixo contendo algumas informações como: tempo de requisição, porcentagem de sucesso e etc.

![Resultado](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xl03ytwer05swpncq56g.png)
(Free Course) Linux For Cloud & DevOps Engineers
Tags: devops, linux, beginners, aws
Published: 2022-09-27 22:59:56

Download Link:

Mega - https://mega.nz/file/kWh3QIDB#T15yfzpTAMCEzpRsZfm2-_57IM96UBUGSlIBNO8f0PI

Google Drive - https://drive.google.com/file/d/1ub563S07yQ1m4hwd-nYUJTqP0os6ssIy/view?usp=sharing



- **Requirements**

Basic computer knowledge

**- Description**

As you all know, in the current IT market, Linux became a pre-request to learn most of the trending technologies. The IT industry also uses Linux as its base Operating System in most cases. Hence this course helps you to understand how Linux works from the basics. Once you learn and complete this course, you can be able to
Fulfill your regular tasks on the Linux server
Quickly start learning trending technologies like AWS, Azure, GCP, DevOps, Python, BigData, DataScience, etc..
During this course, we are going to cover various concepts like

1. - what is an operating system
2. - How Linux works
3. - Linux Basic commands
4. - how to edit a file
5. - how to read information from a file
6. - creating a file or directory
7. - managing files and directories
8. - system management
9. - networking
10. - port numbers
11. - software management
12. - services like http, ssh, telnet and etc
13. - process management
14. - Archiving files or directories
15. - crontab and its examples
16. - link files
17. - File permissions like read, write and execute
18. - grep command
19. - sed command
20. - find command cp, mv, find, cd, diff, chmod, chown, file, hostname ping, get, ifconfig, telnet, curl, yum, ps -ef, kill, fg, bg, top, ip addr, gzip, gunzip, tar, crontab, scp, ln, find, date, cal, uptime, whoami, finger, user, id, man, username, who, ls, cat, less, more, head, tail, page, touch, nano, vi, rm, mkdir, rmdir,


**- Who this course is for:**

Any IT professional who wants to learn Linux basics quickly
People who don't know why to start their DevOps journey.
How To: generate CSR, Self-signed and CA certificat
Tags: security, certificat, ssl, tls
Published: 2022-09-27 22:52:56


> Please make sure you have `openssl` installed on your machine, or: 
```
Ubuntu: apt-get install openssl
Redhat: yum install -y  openssl
```

## CSR (Certificate Signing Request)

Before you can order an SSL certificate, it is recommended that you generate a CSR from your server.

To avoid the repetition of openssl cli for each domain, The below script allow you to generate CSR and Key with only pass the domain name as an agr:

This script w'll generate two files: 
- `.csr` : TO be sent to CertProvider for purchase your SSL certificate.
- `.key` : Private key used by the server to encrypt and package data for verification by clients.

```
$ vi csr-key-generator.sh
---
#!/usr/bin/env bash
DOMAIN=$1
if [ -z "$1" ]; then 
    echo "USAGE: $0 domain.com"
    exit
fi

# CSR Attributs, there is a possibility for CertProvider can change information(company, locality..) before issue the certificate.

SUBJ="
C=MA
ST=ST
O=My Company
localityName=City
commonName=$DOMAIN
organizationalUnitName=IT
emailAddress=admin@domain.com
"

# Generate CSR & Private Key
openssl genrsa -out "$DOMAIN.key" 2048
openssl req -new -subj "$(echo -n "$SUBJ" | tr "\n" "/")" -key "$DOMAIN.key" -out "$DOMAIN.csr"

echo "done! enjoy"
```

Add execution ability to the shell file, and run it: 
```
$ chmod +x csr-key-generator.sh
$ ./csr-key-generator.sh domain.com
output: done! enjoy
$ ls
domain.com.csr domain.com.key
```

## CA (certificate authority)
CA is an entity responsible for issuing digital certificates to verify identities on the internet.

```
$ openssl req -x509 -sha256 -days 356 -nodes  
    \ -newkey rsa:2048 
    \ -subj "/CN=root.com/C=MA/L=Locality"
    \ -keyout rootCA.key -out rootCA.crt
```

## Self-signed certificate

To-way: 
```
## Use previous CSR,Key: 
 
$ openssl x509 -req -days 365 -in domain.com.csr 
  \ -signkey domain.com.key -out domain.com.crt

[OR]
## Use previous CA:

$ vi extCert.conf
--- 
subjectAltName = DNS:*.domain.com

$ openssl x509 -req -in domain.com.csr 
  \ -CA rootCA.crt -CAkey rootCA.key -CAcreateserial
  \ -out demo.domain.com.crt -days 365 -sha256 
  \ -extfile extCert.conf
```

Review the certificate
```
$ openssl x509 -in domain.com.crt -text -noout
```

{% embed https://dev.to/ysellami/rhel-ubuntu-useful-command-433f %}
Day 7 I4G 10DaysofCodeChallenge
Published: 2022-09-27 22:51:59

Problem: UTF-8 Validation
Category: Medium
Given an integer array data representing the data, return whether it is a valid UTF-8 encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).

A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:

For a 1-byte character, the first bit is a 0, followed by its Unicode code.
For an n-bytes character, the first n bits are all one's, the n + 1 bit is 0, followed by n - 1 bytes with the most significant 2 bits being 10.


For UTF-8 we are going to check 4 bytes long that n=1,2,3,4..
    1          |   0xxxxxxx
            2          |   110xxxxx 10xxxxxx
            3          |   1110xxxx 10xxxxxx 10xxxxxx
            4          |   11110xxx 10xxxxxx 10xxxxxx 
10xxxxxx

Example

Input: data = [197,130,1]
Output: true
Explanation: data represents the octet sequence: 11000101 10000010 00000001.
It is a valid utf-8 encoding for a 2-bytes character followed by a 1-byte character.
Solution
For Each interger in the input array
1.Convert to 8 bits binary representation.
For the integer 197 = 11000101 

Check for n = 1,2,3 conditions.
and return the result.

[Problem](https://leetcode.com/problems/utf-8-validation/)
[Solution Implementation](https://github.com/ismaelsadeeq/I4G_coding_challenge/blob/main/utf8.py)