teleren/devto huggingface dataset:
Iterate Through an Array with a For Loop
Tags: javascript, devops, tutorial, beginners
Published: 2021-04-22 21:10:24

A common task in JavaScript is to iterate through the contents of an array. One way to do that is with a for loop.
Remember that arrays have zero-based indexing.
* Example:
```
var arr = [10, 9, 8, 7, 6];
for (var i = 0; i < arr.length; i++) {
   console.log(arr[i]);
}
```
Our condition for this loop is i < arr.length, which stops the loop when i is equal to length. In this case the last iteration is i === 4 i.e. when i becomes equal to arr.length and outputs 6 to the console. Then i increases to 5, and the loop terminates because i < arr.length is false.

* Let's Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total.
```
var myArr = [ 2, 3, 4, 5, 6];
var total = 0

for (var i = 0; i < myArr.length; i++) {
   total += myArr[i];
}
```
```
console.log(total); will display 20
```
#### CODE EXPLANATION:
* i gets a value of 0;
* The subsequent code is executed as long as i is lower than the * length of myArr (which is 5; five numbers but arrays are zero based).
* i is incremented by 1.
* The function adds myArr[i]'s value to total until the condition isn’t met like so:
total + myArr[0] -> 0 + 2 = 2 
total + myArr[1] -> 2 + 3 = 5
total + myArr[2] -> 5 + 4 = 9
total + myArr[3] -> 9 + 5 = 14 
total + myArr[4] -> 14 + 6 = 20
Loops
Tags: javascript, devops, beginners, tutorial
Published: 2021-04-22 21:03:16

#### Iterate with JavaScript While Loops
You can run the same code multiple times by using a loop.

The first type of loop you will learn is called a while loop because it runs while a specified condition is true and stops once that condition is no longer true.
* Example:
```
var myArray = [];

var i = 5;
while(i >= 0) {
  myArray.push(i);
  i--;
}
```
```
console.log(myArray); // will display [ 5, 4, 3, 2, 1, 0 ]
```
In the code example above, the while loop will execute 7 times and 
Add the numbers 5 through 0 (inclusive) in descending order to myArray using a while loop.
We also try getting a while loop to work by pushing values to an array.


#### Iterate with JavaScript For Loops
The most common type of JavaScript loop is called a for loop because it runs for a specific number of times.
* Example:
```
var myArray = [];
for (var i = 1; i <= 5; i++) {
  myArray.push(i);
}
```
```
console.log(myArray); will display [ 1, 2, 3, 4, 5 ]
```
In the following example we initialize with i = 1 and iterate while our condition i <= 5 is true. We'll increment i by 1 in each loop iteration with i++ as our final expression.
we used a for loop to push the values 1 through 5 onto myArray.


#### Iterate Odd Numbers With a For Loop
For loops don't have to iterate one at a time. By changing our final-expression, we can count by odd numbers.

* Example:
```
var myArray = [];
for (var i = 1; i < 10; i += 2) {
  myArray.push(i)
}
```
```
console.log(myArray); will display [ 1, 3, 5, 7, 9 ]
```
Here we push the odd numbers from 1 through 9 to myArray using a for loop.
We start at i = 1 and loop while i < 10. We'll increment i by 2 each loop with i += 2.

#### Count Backwards With a For Loop
A for loop can also count backwards, so long as we can define the right conditions.

In order to decrement by two each iteration, we'll need to change our initialization, condition, and final expression.
* Example:
```
var myArray = [];

for (var i = 9; i > 0; i -= 2) {
  myArray.push(i);
}
```
```
console.log(myArray); will display [9, 7, 5, 3, 1]
```
We start at i = 9 and loop while i > 0. We'll decrement i by 2 each loop with i -= 2. We push the odd numbers from 9 through 1 to myArray using a for loop.
Funciones JavaScript
Tags: javascript, function, guide
Published: 2021-04-22 20:34:25


Antes de comenzar:

> Una de las cosas que nos encontramos al aprender JavaScript son las **Funciones**, en esta guía que esta basada en la guía de w3 schools. Aprenderas lo principal sobre las funciones.



## Funciones JavaScript

Una función de JavaScript es un bloque de código diseñado para realizar una tarea en particular.

Una función de JavaScript se ejecuta cuando "algo" la invoca (la llama).

```
function myFunction(p1, p2) {
  return p1 * p2;   // La función retorna el producto entre p1 y p2
}
```

### Sintaxis de funciones de JavaScript

Una función de JavaScript se define con la functionpalabra clave, seguida de un nombre , seguido de paréntesis () .

Los nombres de funciones pueden contener letras, dígitos, subrayados y signos de dólar (las mismas reglas que las variables).

Los paréntesis pueden incluir nombres de parámetros separados por comas:

** ( parámetro1, parámetro2, ... ) **

El código a ejecutar, por la función, se coloca entre llaves: {}

```
function name(parameter1, parameter2, parameter3) {
  // Código a ser ejecutado
}
```

Los **parámetros** de la función se enumeran entre paréntesis () en la definición de la función.

Los argumentos de la función son los valores que recibe la función cuando se invoca.

Dentro de la función, los argumentos (los parámetros) se comportan como variables locales.


> Una función es muy similar a un procedimiento o una subrutina, en otros lenguajes de programación.

### Invocación de una Función

El código dentro de la función se ejecutará cuando "algo" invoca (llama) a la función:

- Cuando ocurre un evento (cuando un usuario hace clic en un botón)
- Cuando se invoca (llama) desde el código JavaScript
- Automáticamente (autoinvocado)

### Retorno de Función

Cuando JavaScript llega a una ``return`` declaración, la función dejará de ejecutarse.

Si la función fue invocada desde una declaración, JavaScript "regresará" para ejecutar el código después de la declaración de invocación.

Las funciones a menudo calculan un **valor de retorno** . El valor de retorno se "devuelve" al "llamador":

```
var x = myFunction(4, 3);   

function myFunction(a, b) {
  return a * b;            
}

```

El resultado en x será

```
12
```

### ¿Por qué funciones?

Puede reutilizar el código: defina el código una vez y utilícelo muchas veces.

Puede usar el mismo código muchas veces con diferentes argumentos para producir resultados diferentes

Se subirá mas contenido con respecto a JavaScript, puedes aprender mas siguiendo la guía que proporciona la w3schools.
CloudSniper – Cloud Security Operations
Tags: cloud, security, monitoring
Published: 2021-04-22 20:55:52

Cloud Sniper is a platform designed to manage Cloud Security Operations, intended to respond to security incidents by accurately analyzing and correlating cloud artifacts. It is meant to be used as a Cloud Security Operations platform to detect and remediate security incidents by showing a complete visibility of the company’s cloud security posture.

[CloudSniper ](https://kali-linuxtr.net/cloudsniper-cloud-security-operations)
Top 5 DEV Comments of the Past Week
Tags: bestofdev
Published: 2021-04-22 20:51:45

---
title: Top 5 DEV Comments of the Past Week
published: true
description: 
tags: bestofdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvjh80kv1nr41sw6wxke.png
---

_This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag._

---

We love a good [dev joke](https://dev.to/technoglot/what-s-the-best-dev-joke-or-pun-you-know-jei) and this one @jmdejager commented takes the cake!  

{% devcomment 1dfi4 %}


Now this is definitely a [win](https://dev.to/devteam/what-was-your-win-this-week-53nb)! So glad to see some folks in our community are getting vaccinated 😭 Congrats, @yoursunny!

{% devcomment 1dg9l %}


Sometimes, all you need are some [VS Code Shortcuts](https://dev.to/simonpaix/10-useful-vs-code-shortcuts-you-should-know-42m), and @equiman offers some really useful ones! Thanks for the tips 😊

{% devcomment 1df8m %}

Okay, okay, only one more [dev joke](https://dev.to/technoglot/what-s-the-best-dev-joke-or-pun-you-know-jei), I promise. But this one @hugekontrast commented really deserves to be highlighted! Pure genius. 

{% devcomment 1dglk %}


We all [miss travel](https://dev.to/xenoxdev/where-do-you-like-to-travel-the-most-3ef0), and luckily pics like these make the wanderlust ease up. Thanks for the addition, @manpreet!

{% devcomment 1dkbk %}



See you next week for more great comments ✌
How to get a job out of a failed job interview
Tags: reactnative, career, 5days5blogposts
Published: 2021-04-22 20:44:11

#####To the point!
On a job interview listen carefully what the team you are supposed to join struggles with. What kind of problem they're currently solving.
Then if they say no to you, you can just say thanks and tell them 
>Hey, I'm good at this one you're dealing with, let me do this for you as a side project, show me the code and I will estimate it.

#####Now I will give you some context how it worked in my case.

I suck. I totally suck at job interviews. Maybe I'm smart (oh the hell with it it's my blog, I can even say I'm very smart!). But I don't talk much, I'm kind of a typical introvert programmer. And as you may already know it's better to talk at job interviews.

So these guys were looking for someone who talks. They said
>Sorry Piotr, you are very smart but you didn't say much at the interview, you had no energy and stuff. We're looking for a guy who can talk and has the energy.

And then I said
>Thanks for the interview! Listen guys, you said you're struggling with upgrading your app. I did this many times and I can help you just with this one if you want. Just let me know if that sounds interesting.

#####Success
It turned out this did sound interesting to them, we've discussed the details and I've got a nice side project instead.
Flipping Pallets: Buying Amazon Return Pallets For Sale
Tags: palletsmarket, pallets, amazonecommerce, ecommerce
Published: 2022-05-04 14:51:27

---
title: Flipping Pallets: Buying Amazon Return Pallets For Sale
published: true
date: 2021-04-22 20:24:45 UTC
tags: palletsmarket,pallets,amazonecommerce,ecommerce
canonical_url: https://medium.com/@stojay008/flipping-pallets-buying-amazon-return-pallets-for-sale-451bfa394892
---

7 Big Tips When Buying Pallets From Amazon!

[Continue reading on Medium »](https://medium.com/@stojay008/flipping-pallets-buying-amazon-return-pallets-for-sale-451bfa394892?source=rss-7a0eddc3a9a5------2)
How to Create a User Sign Up and Login System in PHP and MySQL Database Localhost
Tags: php, database, mysql, webdev
Published: 2021-04-22 20:09:57

Related Quries:
**How to create a user registration form?**
**How to code a signup form using php and MySQL Database?**
**How do I create a login and registration for my website?**
**How to create a database registration form in MySQL?**
**How can I know my PHP username and password?**

##Description!##
The task is to create and design a sign-up and sign in system in which if the user enters details, the HTML form data are inserted into our MySQL server database. 

See Project in action: [Click Here](https://www.hmawebdesign.com/projects/mysql/)   

First of all you have to crete the following the php files:

**1-  index.php**    This file for Sign up form
**2-  linkDB.php**    This will contain MYSQL data base connection php code
**3-  server.php**      This file will contain all server side PHP and MYSQL database code
**4-  LoggedInPage.php**     After the successfully logged the user in, will redirect to this pag
**5- login.php**    Contain the login form html code

##Approach##

First task is that we have to create our MySQL server Database and a Table according to our requirements. We connect our MySQL server Database using PHP mysqli_connect() function which takes four arguments, i.e. our “servername”, “username”, “password” and “database”

**Full Video Toturial**

{% youtube Dfe5reEFQI0 %}


-------------------------------------------------
- Please have a look at my website for more details!
         https://hmawebdesign.com
- Place an order for any Web Development work!
         https://www.fiverr.com/haaddison1?up_rollout=true

--------------------------------------------------

Suggested Videos:

10 Input Types in HTML Every Web Developer Must Know in 2021 | HTML5 Input Types Tutorials
https://youtu.be/8qBPKXRUOnk

How to  Design a Responsive HTML Email Template from Scratch 2021 | Create HTML Newsletter
https://youtu.be/c8GwsCZcBIc

How to Send Email to Client Using PHP Mail Function | Sending Email in PHP 2021 Tutorial
https://youtu.be/DeqOVJ-aXkg

$_POST | What is the Post Variable in PHP | How to Use Post Variables in PHP 2021
https://youtu.be/HO-TrXY4a1A

How to Define Variables in PHP | How to Create PHP Variables | (PHP tutorial-3) - 2021
https://youtu.be/bfqAa0Gm3YY

How to Start First PHP Web Project on Local Server/Localhost PHP Tutorial-2
https://youtu.be/18I7U4-nJb0

How to Start Web Project with Microsoft Visual Studio 2021 | Visual Studio Project
https://youtu.be/MLzuQ_pH9Ew

How to Get Start PHP Hello World Page on Live Web Server  |  PHP Tutorial - 1
https://youtu.be/Uc7uLD7Ur6M
------------------------------------------------------------------
Contact me through social media for web development work:

- Fiverr             https://www.fiverr.com/haaddison1?up_rollout=true
-  witter:          https://twitter.com/HmaWebdesign
- Facebook:    https://web.facebook.com/HmaWebdesign
- LinkedIn:      https://www.linkedin.com/in/engrmianayub/
- Instagram     https://www.instagram.com/hmawebdesign/
WPRecon – Vulnerability recognition tool in CMS WordPress
Tags: wordpress, php, security, vulnerability
Published: 2021-04-22 19:53:11

For you to compile wprecon you will need to have the golang compiler installed. And for that you will access the official website of golang and will download and install it. Here!

Once downloaded and installed you will download wprecon directly from github with the command:

go get github.com/blackbinn/wprecon;
cd $(go env GOPATH)/src/github.com/blackbinn/wprecon;
make build.

[wprecon](https://kali-linuxtr.net/wprecon-vulnerability-recognition-tool-in-cms-wordpress)
:Goarch! WASM
Tags: webassembly, go, web, javascript
Published: 2021-04-22 19:51:52

---
title: :Goarch! WASM
published: true
description: Build browser libraries with Go 
tags: wasm, golang, go, web, javascript
cover_image: https://d2eip9sf3oo6c2.cloudfront.net/series/covers/000/000/130/full/EGH_banner_WebAssembly_Final.png?1496436364
---

*cover image source: egghead.io* 

## The tools

*Getting started*
```go
import “syscall/js”
```

```console
$ GOARCH=wasm GOOS=js go build ...
```

*Setting values*
```go
js.Global()
js.Global().Set(“varname”, js.ValueOf(x))
```

*Console logging*
```go
println()
```

*Expose **callbacks***
```go
Js.Global().Set(“ftname”, js.NewCallback(f))
```

*Interoperability*
```go
func f(i []js.Value) {
  // f(a), i[0]=a
  // f(a,b), i[0]=a, i[1]=b
  // ...
}
```

## Illustrations

***to be continued***
Loading JS scripts [A]synchronously
Tags: async, defer, dynamic, javascript
Published: 2021-04-22 19:37:42


![load-stript-3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nefplqon9rrkshgjl6iz.png)
The image above shows the regular flow when we place a `<script>` in a HTML document. The whole process happens **synchronously**. The steps are:
1. HTML parsing starts
2. HTML parsing **pauses** when a `<script>` is found
3. `<script>` is loaded
4. `<script>` is executed
5. Finally the HTML parsing is **resumed**

For this reason, a common practice is to place all the `<script>` at the bottom of the page, after all the HTML elements are parsed. This is fine, it makes total sense (as long as you are dealing with small files). But let's say you will load a large JS file to a page, such as a library, e.g. In this scenario, although all the HTML is ready, the JavaScript-related functionality will only be available when the JS file is downloaded and executed.
The good news is that there are some surprisingly easy-to-implement alternatives to this approach.

## Loading JS scripts asynchronously

### `async` attribute

![load-stript-2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjfgddm595sgcw1v9a2x.png)
 
By placing the `async` attribute in a `<script>` tag, the script will be downloaded without pausing the HTML, but as soon as it finishes downloading, it runs (blocking the HTML parsing while doing so). This approach is very suitable for displaying ads in your page, e.g.

### `defer` attribute

![load-stript-1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yruuj2271js548yrz6bb.png)

This is how you get an actual asynchronous JS loading. The `defer` attribute uses a more "polite" approach towards the HTML document, as it downloads the script, but waits until the HTML parsing is done before running it. 

> When a pack of wolves is traveling, the older members lead the way, as they move more slowly, which causes the rest of the pack to move at their pace.

What does this have to do with JS loading?

The bigger advantage to using `defer` is that once the HTML is parsed, the JS scripts will potentially be in a queue, ready to be executed, in the same order as they were inserted in the document. You might want to place the bigger files above the smaller ones (as they take longer to download). Also, by doing so, feel free to place your `<scripts>` is the `<header>` of the document, so their download will begin as early as possible!

## Loading JS scripts dynamically

Another interesting option is loading a script conditionally, let's say by a click of a button. You can add an `eventListener` to the button, and use something like the following:

```javascript
let script = document.createElement('script');
script.src = "my-script.js";
document.body.append(script);
```
 
### Thanks for the time reading this!
Follow me:
[LinkedIn](https://www.linkedin.com/in/costa86/) | [Dev.to](https://dev.to/costa86) | [Buy me a coffee](https://www.buymeacoffee.com/costa86) | [GitHub](https://github.com/costa86)
Build an awesome GitHub's profile README
Tags: github, profile, readme
Published: 2021-04-22 19:33:22

GitHub released a [new feature](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme) that allows users to create a portfolio using a `README` in a special repository with same name as the username and display it in the user's profile like the cover picture of this post. This article explains how to create that repo step by step and add some tips and tricks that you can use to tweak your own.

## How do I create a profile README?
As I've mentioned before, the profile README is created when the user creates a new repository with the same name as its username. For example, my GitHub username is charly3pins so I created a new repository named `charly3pins`. The steps are the following:

1. Create a new repository with the same name as your GitHub username going [here](https://github.com/new). Tick the `Add a README file option`.
![create repo](https://charly3pins.dev//images/github-profile-readme/new-repo.png)
2. Open the generated README.md and you will see the following template:
![repo template](https://charly3pins.dev//images/github-profile-readme/repo-template.png)
3. Uncomment the comments and add some content like text, GIFs, images, emojis, etc. Whatever you want and Markdown accepts it's okay... Sky is the limit! 🚀 Check out [this](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf) Markdown Cheatsheet if you need to brush up on Markdown syntax.
4. Commit your new README. Note that the changes must be in `master` or `main` branch, otherwise will not be visible on your profile until you merge the changes in one of those branches.
5. Push changes to GitHub (if you made changes locally).

## Be creative

You can check my [GitHub profile](https://github.com/charly3pins) and the [repo](https://github.com/charly3pins/charly3pins) that hosts my README. I've added my dynamic GitHub stats using [this](https://github.com/anuraghazra/github-readme-stats) repo, there are a lot of more information that you can add in your profiles. Also I've used [this](https://shields.io/) site to make the badges displayed for the social networks and the technologies and tools. 

My recommendation is to check check [this](https://github.com/abhisheknaiidu/awesome-github-profile-readme) repo to see a lot of GitHub profiles and get some inspiration.

Feel free to comment here or contact me in my social networks for any comment, question or suggestion.
Day 63
Tags: 100daysofcode, programming
Published: 2021-04-22 19:17:44

Day 63/100 of #100DaysOfCode  

Today, I have started learning React JS from [Learn with Sumit](https://www.youtube.com/c/LearnwithSumit). [Sumit Saha
](https://www.linkedin.com/in/sumitanalyzen/) is one of my favorite instructors. And problem-solving on codewars using JavaScript.

Hours coded: 1.4 + 1
Lines of code: 155
Keystrokes: 1217
🦏 Mozilla Rhino JS makes me scream 😱
Tags: javascript, java, node
Published: 2021-04-22 19:14:45

Rhino is not JavaScript in my book.

Ouch that's a bold claim, what is it then?

Pure disparity, kidding let's dive in.

Before node.js was a twinkle in Ryan Dhal (the man who by extension paid for my house and car) we have had several efforts to bring JavaScript to the server side and most notably Java.

Java has always had a wired fetish for JavaScript either by trying to replace it in the browser or even run it on the serverside, like it was trying to swap places 🤷‍♂️ yes that's right Mozilla created Rhino JS 🦏 way back when.

Rhino is basically a JavaScript engine which has interoperability with Java, aka your airquote "JavaScript" can access Java and do Java things... Except time moves on, we have node now and a thriving ecosystem, in fact time has move on again, deno is billed to be the next big thing, but Rhino what's that?

Well let's dig into the issues other than its obsolete.
Rhino was supposed to be replaced by nashorn the **ES6** compliant Java based engine... But somehow that was scrapped and Rhino as things go In Java land, un-deprecated itself!

~~Rhino has no active maintenance and yet~~ plenty of active projects including any product using Adobe experience manager CMS running this ticking timebomb

You can't even hire js engineers because the have be as old as me and know es5 really well and a bit of ES6 but maybe 2% of it plus Java, it's useless.

What is scripting historicaly speaking? It's hiring non programmers to write Lua for c, it's inventing a language to handle higher level operations without compiling, it's an easier way to extend a subset of your program, does Rhino do this? No because java inside JavaScript isn't flawless, it introduces such awful situations as Java String casting to String, if you hadn't been bitten by this error, you would have no idea why your perfectly normal looking program doesn't work. But even debugging is a pain!!

Graal VM you are much more up to the job with your node.js running Java directly, I employee you, don't use Rhino, use Graal VM and enjoy a polyglot stack that everyone will enjoy.

...😂🦏😬