teleren/devto huggingface dataset:
Menyelesaikan soal "Simple Array Sum" di HackerRank
Tags: javascript, programming, beginners
Published: 2022-04-08 22:03:08

![Soal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4hzkyn31fotl8v44ghy.jpg)

Pada soal di atas kita diminta untuk membuat fungsi yang digunakan untuk menghitung jumlah dari setiap bilangan bulat yang ada di dalam sebuah array. Kali ini saya akan membagikan cara saya menyelesaikan soal tersebut menggunakan bahasa pemrograman javascript. Berikut kode pemrogramannya:

```javascript
function simpleArraySum(ar) {
    let total = 0;

    for (let i = 0; i < ar.length; i++) {
        total += ar[i];
    }

    return total;
}
```

Kode di atas adalah contoh yang paling umum digunakan di semua bahasa pemrograman. Kalau di javascript, kita bisa membuatnya menjadi lebih pendek dengan memanfaatkan method bawaan array, yaitu reduce. Kita jumlahkan setiap elemen yang ada di dalam array dan memberikan 0 sebagai nilai awal. Berikut kode pemrogramannya:

```javascript
function simpleArraySum(ar) {
    return ar.reduce((previous, current) => previous + current, 0);
}
```

Demikian yang bisa saya bagikan, apabila ada yang perlu dikoreksi atau Anda punya cara lain untuk menyelesaikan soal di atas silahkan share di kolom komentar. 😁
React with TypeScript and Testing App..!
Tags: react, typescript, testing, testdev
Published: 2022-04-08 21:52:09

Hi, devs,
I hope you are well. I trying to build a react app using TypeScript (ES6), React, and Redux. (I am NEW to write test cases for React app). And I would like to write tests case for each and every component (**Automated unit/integration tests and static code checking and formatting**)

here is the visual representation...

![visual representatio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n8xu8z7fs5frj7zedt0l.png)

to write test cases for this application, what should have in mind!

for example what/which area you will cover to write a test case for an **input-field** and **button** components?

HappyCoding...:)
tl8 1.0.0 is out
Tags: tl8, angular
Published: 2022-04-08 21:40:55

---
title: tl8 1.0.0 is out
published: true
date: 2022-04-08 21:38:40 UTC
tags: tl8,angular
canonical_url: 
---

 ![tl8 1.0.0 is out](https://images.unsplash.com/photo-1617360547704-3da8b5363369?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDh8fGJveHxlbnwwfHx8fDE2NDk0NTM0Nzk&ixlib=rb-1.2.1&q=80&w=2000)

I released tl8 last year. It came with a few integration issues. The main one was that I built the application with Electron and embedded a web view to render the application to be translated. Problem: some web apps have security settings or workflows that don't allow for such a rendering.

**With tl8 1.0.0, all Angular apps can be translated.**

It took some time but it's here. The application is available for Mac, Windows and Linux. You can check the home page for more information: [https://tl8.io/](https://tl8.io/).  The web application no longer exists as it would be too much work to maintain it and would need iframes to run and would therefore suffer from the limitations I mentionned above. The journey to get around the limitations of Electron involved several `BrowerViews`. One of them is dedicated to run the target application and doesn't have any limitation regarding the content it can run!

1.0.0 provides a solid user experience that enables you to easily change translations and content in an Angular application. It also comes with some bug fixes.

There are features and improvements planned for the next iteration that will be described in a further blog post.

--

KM
Ever wanted to see what's your service doing?
Tags: javascript, bash, node, rest
Published: 2022-04-08 21:29:10

Have you ever wanted to see what's your service doing? To see what is it requesting and/or sending? Well, I've asked myself these questions a fair number of times, and finally I've pushed myself to create a very little Node.JS application, solving these exact problems. So naturally this will be a very fast and simple post about it.


> It's honestly so simple, it blows my mind how well it's working.


My application is called TestYourService, hosted on GitHub uploaded to NPM, so anyone could see how it is working, or just use it to their hearts content. I won't bother you with more irrelevant information, so let me just show you how to use it...

---

Firstly we need to install it. This can be done by either downloading the executable from GitHub, or (and I recommend this option) install it globally from NPM.

```bash
npm i -g testyourservice
```

Then we can simply call it, again trough the console... Oh and I hope you are running on windows. ;)

```bash
testyourservice-win
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wuvtpuxkpvo6659kqpi6.png)
 
Now all that is left to do is to use the fucking thig!

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

With all that said, I hope my little tool helps you trough this magical journey called "Developing a service"!

---

And just for the curios ones, here is the main peace of code, should you try to create something like that on your own. :)

```js

var http = require('http');

console.log("\x1b[31m", "testyourservice running on port 1025")

http.createServer(function (req, res) {

    console.log("\x1b[37m", req.method + " -> " + req.url);

    if (req.method == "POST") {
        req.on('data', chunk => {
            console.log(`Data chunk available: ${chunk}`)
        })
    }

    res.statusCode = 200;
    res.end();
}).listen(1025);

```
Treeprofile.com
Published: 2022-04-08 21:24:51

Treeprofile.com is a up coming website that let users have there own custom profiles. Like treeprofile.com/p/YOUR_NAME

Like you can add all your socials medias, website, custom avatars. The site is brandnew.

If this sound something for you, then I think you should check it out.

Get started today: [treeprofile.com](https://www.treeprofile.com)

Treeprofile is created with:

**Node.js** **EJS** **MongoDB** **Moment.js** **yourid.js** **google-oauth2**

Hope you will give it a change!
Use Tailwind CSS in existing Bootstrap project without crash classes
Published: 2022-04-08 21:16:25

Just add prefix 'tw' in 'tailwind.config.js'

like this

```
module.exports = {
  prefix: 'tw-',
  content: [
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

```

now you can use Tailwind CSS class with prefix 'tw' without crash with bootstrap classes

Example use:
tw-bg-red-400
tw-p2

you can change 'tw' prefix with another prefix that you want.
Resolvendo exercícios do JSchallenger - (Javascript Basics #2)
Published: 2022-04-08 20:51:11

O que deve ser feito aqui?

- Escrever uma função que receba dois valores (`a` e `b`)
- Essa função deve retornar `true` se o valor e o tipo forem os mesmos, o que significa que devemos usar os operadores de estrita igualdade.

### Só para lembrar:

Operadores de igualdade `==` consideram apenas os valores.
Operadores de estrita igualdade `===` consideram valores e tipos.

```javascript
function myFunction(a, b) {
    return a === b
}
```

### Resultados

```javascript
myFunction(2, 3) // false
myFunction(3, 3) // true
myFunction(1, '1') // false
myFunction('10', '10') // true
```

Para quem quiser resolver o desafio, o ***link*** está aqui:

[Comparison operators, strict equality](https://jschallenger.com/javascript-basics/comparison-strict-equality)

Gostou? Até a próxima anotação! :)
Resolvendo os exercícios do JSchallenger (Javascript Basics - #1)
Tags: javascript, jschallenge, jsbasics
Published: 2022-04-08 20:34:23

Os desafios dessa página aparecem em forma de funções, com parâmetros os quais devem ser retornados.

O que deve ser feito aqui?

- Escrever uma função que retorne dois números (`a` e `b`) como argumentos
- Somar `a` com `b`
- Retornar o resultado

```javascript
function myFunction(a, b) {
    return a + b
}
```

Sempre haverá casos de testes para comprovar a lógica usada para resolver o problema.

```javascript
myFunction(1,2) // 3
myFunction(1,10) // 11
myFunction(99,1) // 100
```

Para quem quiser resolver o desafio, o ***link*** está aqui:

[Sum two numbers](https://jschallenger.com/javascript-basics/sum-two-numbers-javascript)

Gostou? Até a próxima anotação!
Resolvendo os exercícios do JSchallenger - Introdução
Tags: javascript, jschallenger, series
Published: 2022-04-08 20:24:37

Nessa página vou colocar aqui TODOS os exercícios resolvidos do JSchallenger.

## Do que se trata?!?!
É uma página criada por um desenvolvedor alemão para resolver exercícios com o Javascript. Os desafios estão dividos em categorias:

- Basics (conceitos básicos)
- Arrays (vetores)
- Objects (objetos)
- Dates (manipular datas)
- Sets (mais avançado)

Todos os exercícios resolvidos aparecerão aqui, com uma breve explicação.
Para quem tiver interesse, o link está aqui:

[JSchallenger](https://www.jschallenger.com/)

Gostou? Até a próxima anotação? 😎
Are you getting your sleep?
Published: 2022-04-08 20:00:43


When you are at work, or in class, and you are feeling a bit tired, unfocused, and yawning every couple minutes. Did you get your sleep?
Sleep being important for your daily life is an understatement, and not getting enough sleep can cause serious detrimental effect to your mind and body.

**How much sleep is enough?** On average, 7-9 hours of sleep is enough to be energized and ready for the next day. Enough to get all the benefits of being well rested, including increased mental and physical performance. With better problem solving and memory, why wouldn't you get your 8 hours? Well, it's not always that easy. 

With a busy schedule, with school, work, hobbies, and many other facets of life, you may be hard pressed to find the time to get a healthy sleep schedule. Maybe you end up staying up late into the night studying for an upcoming exam, or out partying with friends. While this is fine every once in a while, there are many times where events like these change your sleep schedule for the worse, causing you to miss out on your required sleep.

**What will happen to me when I don't get my sleep?** There are many negative effects to not getting enough sleep, these include,

- Slowed thinking
- Reduced attention span
- Worsened memory
- Poor decision-making
- Lack of energy

Constant lack of sleep can even attribute to the following:
- Higher risk of Cardiovascular disease
- Higher risk of type two diabetes
- Immunodeficiency

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

**How can I avoid these?** The first and foremost, a healthy sleep schedule can help avoid all these symptoms, although if you have trouble sleeping there are a few things to try out.
- Make sure you bedroom is quiet and dark, or you can also try some white noise
- Remove electronic devices out of the bedroom, and try to stay off of them right before going to bed
- Get some exercise, being physically active during the day can help you fall asleep more easily at night.

Getting a healthy sleep schedule is extremely important in maintaining a healthy lifestyle, and allows you to make the most of your day!
ZK vs Optimistic Rollups
Tags: blockchain, web3, ethereum, layer2
Published: 2022-04-08 20:00:35

---
title: ZK vs Optimistic Rollups
published: true
description: 
tags: blockchain, web3, ethereum, layer2
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7eo82wawren1bmz250ql.png
---

Los Rollups son la mejor solución que tenemos hoy para mitigar costos de gas y rapidez en el blockchain. En este video veremos qué son los Optimistic y ZK Rollups. Haremos una comparación entre ambos, pros y cons, y también veremos qué se viene a futuro para los Rollups y Layer 2.

{% youtube 70Zw8grQKCU %}

**¡Gracias por ver este video!**

Sígueme en dev.to y en [Youtube](https://www.youtube.com/c/FilosofiaCodigo) para todo lo relacionado al desarrollo en Blockchain en Español.
Top 3 Tutorials of the Week #5
Tags: webdev, programming, tutorial, python
Published: 2022-04-08 19:48:58

It's that time of the week again where we give our love to our top 3 Casts of the week on [CodeCast](codecast.io)! This week, we have some great videos in store for you, so let's get right into it.

## [OOP with TypeScript: Constructor Functions](https://www.codecast.io/casts/oGrLoddY5w79-oop-with-typescript-constructor-functions?_ga=2.75780886.2095173347.1649092830-2146326382.1646946127) by [@shahzaibkamal](https://www.codecast.io/users/shahzaibkamal?_ga=2.75780886.2095173347.1649092830-2146326382.1646946127)

![Constructor Functions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ychmu5s16vzt3kfldbbq.png)

Constructor functions are an important skill to learn in TypeScript and this is one of two Casts that Shahzaib has made covering the topic!

## [CSS Injection](https://www.codecast.io/casts/gDrpM44a5z4R-web-security-with-python-defacing-pages-with-css-injection?_ga=2.110859014.2095173347.1649092830-2146326382.1646946127) by [@jesusvilla](https://www.codecast.io/users/kauress?_ga=2.69433875.2095173347.1649092830-2146326382.1646946127)

![CSS Injection](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqbn2la299p1gzgjx19e.png)

Cybersecurity has become and incredibly important topic and a skill all developer should have in at least the most basic form. In this Cast, Jesus goes over injection in CSS and the vulnerabilities it can cause.

## [Recipe App: Click Event](https://www.codecast.io/casts/kEN59eaw5yo6-build-a-recipe-app-with-spoonacular-api-part-six?_ga=2.69433875.2095173347.1649092830-2146326382.1646946127) by ‍@kauresss 

![Click Events](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7af5vyqwkfh5tqmwcv3j.png)

Jannat continues her Spoonacular API Series on building a recipe App, and in this instalment, she goes over working with click events.

Be sure to follow us here and [everywhere](https://linktr.ee/codecastapp) to stay up to date with our latest features!
Do you do any programming in the weekend?
Tags: discuss, watercooler, programming
Published: 2022-04-08 19:21:58

Do you guys do any programming in the weekend, whether for work, for learning, or just for fun?

I used to think I needed to practice programming in the weekend or at least use the time to do freelance work. Now I try not to do any programming in the weekend unless I actually feel like I want to do it. It helped me focus on other aspects of my life and do other things that make me happy.
Top Online SideHustle Ideas You can start now to earn money
Tags: tutorial, beginners, finance, busines
Published: 2022-04-08 19:11:59


Beginning a side hustle is an incredible method for expanding your income, taking care of your obligation, put something aside for large buys. Be that as it may, observing the best side hustle in light of your abilities and experience can be a remarkable undertaking.

Side Hustle Ideas to start and earn moneyThe following are side hustle ideas you can start Immediately 😊👇👇👇
Monetise your skills: You can make money by monetising your skills. Skills like writing. teaching any course you know like Mathematics, English etc
By copying and pasting: You can make money by copying and pasting, to achieve this you need google news i.e where you get the information, then paste on Spinbot which will transform your written words into different words but the same meaning. Then you register with eating well which: will pay you for those articles you wrote.
Sell and Rent: This is another way to make money online by selling and renting used items online. Free platforms to use to generate traffic includes Facebook, Instagram, Twitter and other social media.
Partner with Smile.com.ng: You can partner with smile to make more money. I use this platform and it has helped me a lot. I generate traffics from Facebook and other social media. Watch the video above to know and don't forget to drop your comment.
First Post (Testing)
Tags: django
Published: 2022-04-08 18:57:13

Content
**Bold**
_Italic_

1. List

- List

## Head

> Quote

`Code here
Python code?
    indentation`

```
code block
excellent !!!
    no tabs, only space for indentation
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2b3gizob0ezezzburq6n.png)
Wow! I can upload an image...


well, some more stuff!
Coding Interviews in VR
Tags: interview, faang, coding, codinginterview
Published: 2022-04-08 18:26:23

Anyone interested in doing a mock coding interview in VR?
If you have an Oculus Quest 2, I would be glad to conduct a white-board style coding interview with you in VR. I worked at FB for 4 years, and I promise to conduct a solid interview and deliver detailed feedback after.

My only ask is that I'm allowed to record the interview. You can remain completely anonymous behind a fake name and avatar.

## Context

I run a [youtube channel](https://www.youtube.com/channel/UCfotE5RL1pfhIZ0fv2kAN9Q) that creates coding interview content.
A Day in the Life of a Software Engineer at Microsoft in Vancouver
Tags: productivity, career, devjournal, motivation
Published: 2022-04-08 18:25:43

I've been wanting to make a video of my day as a developer for years now. Finally I have taken the time to make it! This is a REAL look at my life with my family, living in Vancouver/Richmond and working at Microsoft. I also work on my [side project](https://github.com/DustinBrett/daedalOS) in the evening.

{% youtube fLALPAri2oA %}
Function Friday – More Math
Tags: development, flow, functionfriday, powerautomate
Published: 2022-04-12 16:11:16

---
title: Function Friday – More Math
published: true
date: 2022-04-08 18:00:00 UTC
tags: Development,flow,FunctionFriday,PowerAutomate
canonical_url: https://barretblake.dev/2022/04/function-friday-more-math/?utm_source=rss&utm_medium=rss&utm_campaign=function-friday-more-math
---

I previously covered some of the base math functions available. This time I’ll cover the math functions that are related to working with arrays of numbers. This includes the max, min, rand, and range functions.

### max & min

These two functions work the exact same way. The max function returns the largest number in an array of numbers, and the min function returns the smallest number in an array of numbers. The format is as follows:

```
max(number1, number2, number3, ....)
max([number1, number2, number3, ....])
min(number1, number2, number3, ....)
min([number1, number2, number3, ....])
```

The numbers can be of any type (integer, float or a mixture) and the [] brackets are optional if you’re passing in a literal array. You can also pass in a single array variable. The result will be a single number which is either the largest or smallest number respectively.

For example:

```
max(2.1, 4, 6.4, 8) //returns 8
min(2.1, 4, 6.4, 8) //returns 2.1
```

### Range

The range function will allow you to generate an array of integers. The format is as follows:

```
range(startingNumber, numberCount)
```

The startingNumber is the number at which you want to start the array. And the numberCount is the number of items to add to the array. Each number added will be one higher than the last. Only integer numbers are supported, and not float numbers.

For example:

```
range(5,5) //will return [5,6,7,8,9]
range(11,7) //will return [11,12,13,14,15,16,17]
```

### rand

The rand function will return a random integer number between two provided numbers, inclusive of the starting number and exclusive of the ending number. The format is as follows:

```
rand(startingValue, endingValue)
```

Only integer numbers are supported and not float numbers.

Example:

```
rand(1,5) //will return 1, 2, 3, or 4
rand(21,28) //will return 21, 22, 23, 24, 25, 26, or 27
```

The post [Function Friday – More Math](https://barretblake.dev/2022/04/function-friday-more-math/) first appeared on [Barret Codes](https://barretblake.dev).
ML Model
Published: 2022-04-08 17:37:45

The model is the core component of machine learning, and ultimately what we are trying to build. A model might estimate how old a person is from a photo, predict what you might like to see on social media, or decide where a robotic arm should move to. In our scenario, we want to build a model that can estimate the best boot size for a dog based on their harness size.

Models can be built in lots of ways. For example, a traditional model that simulates how an airplane flies is built by people, using knowledge of physics and engineering. Machine learning models are special—rather than being edited by people so that they work well, machine learning models are shaped by data they learn from experience.

How to think about models
A model can be thought of as a function that accepts data as an input and produces an output. More specifically, a model uses input data to estimate something else. For example, in our scenario, we want to build a model that is given a harness size, and estimates boot size

Note that harness size and dog boot size are data, they are not part of the model. Harness size is our input, Dog boot size is the output.

Models are often simple code
Models are often not meaningfully different from simple functions you are already familiar with. Like other code, they contain logic and parameters. For example, the logic might be “multiply the harness size by parameter_1”.

If parameter_1 here was 2.5, our model would multiply harness size by 2.5 and return the result:

Selecting a model
There are many model types, some simple and some complex.

Like all code, simpler models are often the most reliable and easy to understand, whilst complex models can potentially perform impressive feats. Which kind of model should be chosen depends on your goal. For example, medical scientists often work with models that are relatively simple because they are reliable and intuitive. By contrast, AI-based robots typically rely on very complex models.

The first step in machine learning is selecting the kind of model that you would like to use. This means we are choosing a model based on its internal logic. For example, we might select a two-parameter model to estimate dog boot size from harness size.

Notice how we have selected a model based on how it works logically, but not based on its parameter values. In fact, at this point the parameters have not yet been set to any particular value.

Parameters are discovered during training
Parameter values are not selected by the human designer. Instead, parameter values are set to an initial guess, and then adjusted during an automated learning process called training.

Given our selection of a two-parameter model (above), we now provide random guesses for our parameters.

These random parameters will mean the model isn’t good at estimating boot size, so we perform training. During training, these parameters are automatically changed to two new values that give better results.

Diagram showing a model with 1.5 and 4 as the parameters.

Exactly how this process works is something we will progressively explain throughout your learning journey.
Kubernetes cluster and what happens when we deploy a POD.
Tags: kubernetes, docker, containers
Published: 2022-04-08 17:35:24

My blog on what comprises a Kubernetes cluster and what happens when we give a command to create a deployment. Role of various components of Kubernetes control plane and worker node

([Link to the article](https://belowthemalt.com/2022/04/08/kubernetes-cluster-process-flow-of-a-pod-creation/))