teleren/devto huggingface dataset:
Sherlock and Array - Javascript Solution
Published: 2022-07-11 09:16:47

function balancedSums(arr) {
    let leftsum=0;
    let sum=0;
    // Write your code here
    for (let i=0; i<arr.length; i++){
        sum+=arr[i];
    }
    for (let i=0; i<arr.length; i++){
        sum-=arr[i];
        if (sum===leftsum){
            return "YES";
        }
        leftsum+=arr[i];

    }
    return "NO";
}
Natural languages vs. programming languages
Tags: programming, beginners, language, computerscience
Published: 2022-07-11 09:09:07

A language is a means (and a tool) for expressing and recording thoughts. There are many languages all around us. Some of them require neither speaking nor writing, such as body language; it's possible to express your deepest feelings very precisely without saying a word.

Another language you use each day is your mother tongue, which you use to manifest your will and to ponder reality. Computers have their own language, too, called **machine** language, which is very rudimentary.

A computer, even the most technically sophisticated, is devoid of even a trace of intelligence. You could say that it is like a well-trained dog - it responds only to a predetermined set of known commands.

The commands it recognizes are very simple. We can imagine that the computer responds to orders like "take that number, divide by another and save the result".

A complete set of known commands is called an **instruction list**, sometimes abbreviated to **IL**. Different types of computers may vary depending on the size of their ILs, and the instructions could be completely different in different models.

Note: machine languages are developed by humans.

No computer is currently capable of creating a new language. However, that may change soon. Just as people use a number of very different languages, machines have many different languages, too. The difference, though, is that human languages developed naturally.

Moreover, they are still evolving, and new words are created every day as old words disappear. These languages are called **natural languages**.

Thanks for reading my article carefully.
To encourage me continue work, please follow me on Dev.to and Github.

https://dev.to/levintech
https://github.com/levintech
💬 Do you have a CFP idea? At Front-End Foxes 🦊, we are looking for you!
Tags: community, news, career, talk
Published: 2022-07-11 09:05:02


<p>On September 13th, Front-End Foxes Day will happen, a day full of talk and we are looking forward to getting your proposal!</p><br />

<h2> 🦊What are Front-End Foxes?</h2>
<p>In case you don't know, Front-End Foxes is an initiative founded by <a href="https://www.linkedin.com/in/jenlooper/" target="_blank">Jen Looper</a>, that creates and hosts workshops to teach front-end technologies to under-represented people in a cool and fun way. We offer self-driven code labs completed in a workshop format in groups with mentoring by conference-goers and speakers who volunteer to help.</p><br />

<h2> 🗓️About the event </h2>
<p>The event is fully remote and will happen on September 13th. There will be 2 formats:</p>
<ul><li> Lightning talks: are 10 minutes in length and can be on technical or 'soft' topics</li>
<li>Full talks: are 30 minutes with 10 minutes of Q&A</li>
</ul><br />

<h2>💖Requirements for Speaking at the Conference </h2>
<p>As our community is focused on empowering women, you need to be or identify yourself as a woman to give a talk. However, anyone can join as a viewer!</p><br />

<h2>✨Submit Your Talk Proposals! </h2>
<p>You can apply <a href="https://docs.google.com/forms/d/e/1FAIpQLSfIrNiyXdsJABvBaSk576kmCGw1ss8zI5xcxrgmD9uEHADNRQ/viewform">here</a> - hurry, the CFP will close soon! 😊</p><br />


<h2> ❤️Share is much appreciated </h2>
<p>We aim that the talks will help to share knowledge as much as possible, so if you know someone that has a cool topic let them know about our CFP!</p><br />


![Cute fox gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0p7alwkn2ygxzo2kihh.gif)



Seen you soon!
Keep url clean
Published: 2022-07-11 09:01:38

We liked to use url params such as utm source, ref and custom one. But leaving it like that makes the url lenght quite long for example Searching on google then clicking on a particular content google will highlight it for you to see it easily but it append a data in the url like:

http://mrepol742.github.io/webvium#:~:text=webvium

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

Also utm like http://mrepol742.github.io/?utm_source=dev.to&utm_medium=blog

And personally it wasnt look cool.

It's possible to remove the url parameters by using replaceState from window.historu as follows:
{% embed https://gist.github.com/mrepol742/cd8a35f18626f4b730569077e7bae73c.js %}

what it does is to replace the current url using the window.location.pathname leaving with clean and easy to read url.
What the "in" keyword in Swift Closures means
Tags: swift
Published: 2022-07-11 08:46:08

Ever since I started programming in Swift if found the `in` keyword for closures a bit weird. It doesn't make much sense to me.
For example:
```Swift
names.sorted(by: { (s1: String, s2: String) -> Bool in 
    return s1 > s2 
} )
```

Today I found this explanation by Joe Groff, one of the original Swift engineers:

https://forums.swift.org/t/history-why-does-closure-syntax-use-the-keyword-in/21885

**TL/DR:
There is no real meaning in `in`. It was chosen for a lack of a better keyword.**

I personally think about `in` as an abbreviation for `input`, because that at least makes sense when the return type is inferred like here:

```Swift
names.sorted(by: { s1, s2 in return s1 > s2 } )
```
#TestCulture 🦅 Episode 8 - Different types of tests
Tags: testing, beginners, agile, devops
Published: 2022-07-11 08:42:35

When it comes to types of tests, we can separate 𝚊𝚞𝚝𝚘𝚖𝚊𝚝𝚎𝚍 tests and 𝚖𝚊𝚗𝚞𝚊𝚕 tests. Here, we are going to cover both types of tests.

𝗨𝗻𝗶𝘁 𝘁𝗲𝘀𝘁𝘀. They allow to test each component of an application individually, and validate ✅ the quality of the code and the performance of a module.

𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲 𝘁𝗲𝘀𝘁𝘀. They validate the capacity of servers and networks to support high access loads.

𝗜𝗻𝘁𝗲𝗴𝗿𝗮𝘁𝗶𝗼𝗻 𝘁𝗲𝘀𝘁𝘀. They validate the various modules integration and their final operating environment. They highlight gaps problems between the different programs. 🔩

𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝗮𝗹 𝘁𝗲𝘀𝘁𝘀. They verify the good application conformity with the initial specifications. These tests are based on functional specifications, but also on technical specifications. 🛠️

𝗥𝗲𝗴𝗿𝗲𝘀𝘀𝗶𝗼𝗻 𝘁𝗲𝘀𝘁𝘀. They verify that the modifications have not altered the functioning of the application.

𝗖𝗼𝗻𝗳𝗶𝗴𝘂𝗿𝗮𝘁𝗶𝗼𝗻 𝘁𝗲𝘀𝘁𝘀. They study the impact of operating environments on its functioning.

𝗜𝗻𝘀𝘁𝗮𝗹𝗹𝗮𝘁𝗶𝗼𝗻 𝘁𝗲𝘀𝘁𝘀. They check all aspects related to the installation, but also to the documentation. 📋

𝗛𝗠𝗜 𝘁𝗲𝘀𝘁𝘀. They check if the 𝖌𝖗𝖆𝖕𝖍𝖎𝖈 𝖈𝖍𝖆𝖗𝖙𝖊𝖗 has been respected during the development. They check the visual presentation and also the navigation.

𝗟𝗼𝗮𝗱 𝘁𝗲𝘀𝘁𝘀. These non-functional tests determine how the software application behaves when used by multiple users simultaneously.

𝗔𝗰𝗰𝗲𝗽𝘁𝗮𝗻𝗰𝗲 𝘁𝗲𝘀𝘁𝘀. Acceptance testing verifies that a system meets its business requirements. They can also measure system performance and reject changes if objectives are not met. 💭

𝗘𝘅𝗽𝗹𝗼𝗿𝗮𝘁𝗼𝗿𝘆 𝘁𝗲𝘀𝘁𝘀. Very precise, they discover errors ❌ that are difficult to spot when a manual test is performed.

𝗦𝗺𝗼𝗸𝗲 𝘁𝗲𝘀𝘁𝘀. They reveal serious failures that may reject 𝘢 𝘧𝘶𝘵𝘶𝘳𝘦 𝘷𝘦𝘳𝘴𝘪𝘰𝘯 of the application. 🔜
They assess whether the main software functions appear to be working properly.

𝗔𝗱𝗺𝗶𝘀𝘀𝗶𝗼𝗻 𝘁𝗲𝘀𝘁. When a smoke test is used to determine whether a computer program should be subjected to further, more refined testing, it may be called an admission test.

𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆 𝘁𝗲𝘀𝘁𝘀. They reveal flaws in the security mechanisms of an information system that protect data and maintain functionality as intended. However, this does not mean that there are no flaws.

𝗣𝗲𝗻𝘁𝗲𝘀𝘁𝗶𝗻𝗴. Ethical hacking technique that consists in testing 𝘵𝘩𝘦 𝘷𝘶𝘭𝘯𝘦𝘳𝘢𝘣𝘪𝘭𝘪𝘵𝘺 of a computer system, an application or a website by detecting flaws that could be exploited by a hacker or a malware. 🕵️

Here is a non-exhaustive list of the types of tests that exist. Do you have others in mind?

Thread [on Twitter](https://twitter.com/agilitest/status/1519693067384725505?s=20&t=nY2ughzLoLDW-1zj1zIJXg).

-----
📚 𝕊𝕠𝕦𝕣𝕔𝕖𝕤:
🎴 https://agilitest.com/cards/exploratory-testing
🎴 https://agilitest.com/cards/security-tests
📰 https://agilitest.com/blog/load-testing-pay-attention-to-this
🌐 https://atlassian.com/continuous-delivery/software-testing/types-of-software-testing
🌐 https://geeksforgeeks.org/types-software-testing/
how to insert data without duplicated
Published: 2022-07-11 08:16:15

in this article i want to show you an sql script that with use it , duplicate fields not inserted and ignored . 

insert ignore into table(filed1,field2) values ('value1','value2') 

translated from [نرم افزار حسابداری ](https://irangig.com)
Avoid creating repeated records in a table
You can use a UNIQUE index or a PRIMARY KEY on the table with appropriate fields to avoid creating duplicate records.

Next, we will examine an example. In the table below, there is no index or PRIMARY KEY, and therefore it is possible to create duplicate records for first_name and last_name.

CREATE TABLE person_tbl (
   first_name CHAR(20),
   last_name CHAR(20),
   sex CHAR(10)
);
To avoid creating multiple records with the same first and last name in this table, a PRIMARY KEY can be added to its definition. Thus, it is necessary that indexed columns are non-null, because PRIMARY KEY does not allow creating null values.

CREATE TABLE person_tbl (
   first_name CHAR(20) NOT NULL,
   last_name CHAR(20) NOT NULL,
   sex CHAR(10),
   PRIMARY KEY (last_name, first_name)
);
With a unique index on a table, if you insert a record into the table that is a duplicate of a record in the column or columns on which the index is defined, it will normally result in an error.

NSERT IGNORE command
In this case, the INSERT IGNORE command can be used instead of the INSERT command. If a record is not a duplicate of an existing record, then MySQL will insert it normally; But if it is a duplicate, then the IGNORE keyword tells MySQL to ignore it without issuing any errors.

In the example below, no error is generated and duplicate records are not inserted in the table at the same time.

mysql> INSERT IGNORE INTO person_tbl (last_name, first_name)
   -> VALUES( 'Jay', 'Thomas');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT IGNORE INTO person_tbl (last_name, first_name)
   -> VALUES( 'Jay', 'Thomas');
Query OK, 0 rows affected (0.00 sec)
REPLCAE command
REPLCAE command can be used instead of INSERT command. If the record is new, it will be inserted as when using the INSERT command; But if it is duplicate, the new record replaces the previous record.

mysql> REPLACE INTO person_tbl (last_name, first_name)
   -> VALUES( 'Ajay', 'Kumar');
Query OK, 1 row affected (0.00 sec)

mysql> REPLACE INTO person_tbl (last_name, first_name)
   -> VALUES( 'Ajay', 'Kumar');
Query OK, 2 rows affected (0.00 sec)
INSERT IGNORE and REPLACE commands should be chosen depending on the behavior we want to have with duplicate records. The INSERT IGNORE command keeps the previous record and ignores the new record. The REPLCAE command inserts the new duplicate version and deletes the old version.

Another way to require uniqueness is to add a UNIQUE index to the table instead of a PRIMARY KE:

CREATE TABLE person_tbl (
   first_name CHAR(20) NOT NULL,
   last_name CHAR(20) NOT NULL,
   sex CHAR(10)
   UNIQUE (last_name, first_name)
);
Counting and identifying duplicates
Getting Started with Tailwind CSS
Tags: webdev, javascript, programming, tailwindcss
Published: 2022-07-11 08:05:54

Hello people, in today's story I have covered a youtube video on getting started with tailwind css. I am using Next.js for the project setup with react as the language but you can choose any of the framework of your choice. 

[Here is the video link](https://www.youtube.com/watch?v=Tmm75GmyRvw)

Hope you will like the video, until next time, have a good day people.

Our website [iHateReading](www.ihatereading.in) || [Youtube](https://www.youtube.com/channel/UC6I-Tz6QwYbJpoIK7l0NtXA) || [Twitter](https://twitter.com/treyvijay)
Change logo on login page in WordPress
Tags: wordpress
Published: 2022-07-11 08:02:00

Do you want to change logo on WordPress login page? Open `functions.php` file and add this code:

{% gist https://gist.github.com/texe/dae0251d9b453951c8edc19d1df39976 %}

From now your logo will appear on WordPress' login page. It's small but very nice change. But the url still redirects to https://wordpress.com. I hear the question in your head: how to change this url to my website? Very easy:

{% gist https://gist.github.com/texe/0b77d96e6f40b9d573ca9f6022ef07ba %}

Of course change the link `https://madlon.eu` to your website.

------

*It would be great if you will comment or follow me on social media*:

[![Chris Texe Twitter](https://madlon.eu/wp-content/uploads/sites/21/TwitterTexeButton.webp)](https://twitter.com/TexeChris)

[![Chris Texe LinkedIn](https://madlon.eu/wp-content/uploads/sites/21/LinkedInTexeButton.webp)](https://www.linkedin.com/in/texe/)

Also you can visit my websites:

- [Linux blog](https://varlock.net)
- [Web Agency website](https://madlon.eu)
use a new metric: IDEUcl
Tags: help
Published: 2022-07-11 08:01:33

To properly quantify the quality of a tracker, I would like to have an idea of the proportion of the ground truth trajectory that a tracker is able to cover. for this I will implement the new ideucl metric in js mentioned in [the Tracking Pedestrian Heads in Dense Crowd](https://arxiv.org/pdf/2103.13516.pdf) research paper which can distinguish which trackers are more efficient at tracking more ground truth pedestrian paths.

but the research sheet is not too detailed, someone who has already worked with this metric can explain to me the calculation of the denominatuer (page 4-5)
A Fun Programming Joke To Start Your Day
Tags: jokes, dailydeveloperjokes
Published: 2022-07-11 08:00:24

---
title: "A Fun Programming Joke To Start Your Day"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258922d1b9.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
I’ve been hearing news about this big boolean.

Huge if true.
 -->
DDD is (mostly) superstitious rubbish
Tags: discuss
Published: 2022-07-11 07:53:44

Domain Driven Design is one of the most complex things a software developer can learn. It's basically a formal ruleset for communication and software development design, based upon a non-existent language, inventing words for fun, and redefining the meaning of other words and sentences - All in an attempt at pleasing the ego of some senior developer such that he can shine in front of others who don't know the _"lingo"_.

> DDD is the result you get when you put 500 high functioning Aspies into the same room, all of whom are chemically cleansed of communication skills and social skills, and asks them to reinvent the rules for communication

I once had a colleague of mine who almost quit his job because of his senior manager telling him _"you're not following the rules of DDD in your class hierarchies"_. I wish it was me he had complained about, at which point I'd answer ...

> Sorry, I don't have time for DDD, I am too busy creating WORKING SOFTWARE!

DDD is basically the modern priesthood's means to communicate with each other, such that they should easily recognise each other, and become capable of nodding at each others, almost the same way monks and priests have a _"new speak language"_ to facilitate for communication, making them feel _"special"_ being a part of a _"secret society of enlightened beings"_. However, like all superstition it's mostly rubbish from A to Z.

Misunderstand me correctly, there are a couple of nice ideas in DDD, such as bounded context, allowing you to declare a vocabulary, ensuring people are speaking about the _same thing_ as they are discussing software development problems. However, for the most parts it's mostly rubbish new speak, and you're better off simply leaving it alone.

I once had a colleague that spent 10 years of his life learning DDD. Seriously, if you need 10 years to teach yourself how to talk about software, and implement software, maybe you should rethink your software development tools? Just sayin' ...

If you want to have software development tools where applying DDD is not even possible in theory, to completely eliminate the debate, feel free to play around with our Low-Code software development platform. Link below ^_^

* [Create a CRUD app in seconds](https://aista.com?secret=devto)

> Sorry Sir, we can't do DDD because our software development platform doesn't allow us to implement it ^_^

That'll typically _"end the debate"_ about DDD ... ;)
Deploying Prometheus Image to Azure Container Registry Using Azure CLI
Tags: azure, prometheus, tutorial, docker
Published: 2022-07-11 07:35:25

> Less Talk , More Code


**Goal :**

- Create Prometheus Image to Azure Container Registry using Azure CLI

**Result** 
> 

- Private Container Image rather than Public Docker Hub Image.

**Script**

```
$ResourceGroupName	= "suryarg"
$LocationName		= "eastus2"
$ACRName			= "suryacr"
$ACRUrl 			= "$ACRName.azurecr.io"

#Create a resource group
az group create --name $ResourceGroupName --location $LocationName

#Create a container registry
az acr create --resource-group $ResourceGroupName --name $ACRName --sku Basic --admin-enabled true


#Log in to Azure Container Registry
az acr login --name $ACRName


#First Pull latest Prometheus Image from DockerHub
docker pull prom/prometheus:latest

#Then Push into Azure Container Registry
docker tag prom/prometheus:latest $ACRUrl/prometheus:SuryaLatest
docker push $ACRUrl/prometheus:SuryaLatest
```

**Result**


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


![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/di561ri7cpjbndjzzyi3.png)
Java New String Methods – From Java 8 To Java 17
Tags: java, java8, java11, string
Published: 2022-07-11 07:30:13

Strings are the most used data type in Java. Almost every application in Java makes use of strings. That’s why strings are treated with special attention in Java. From time to time, new methods are added to String class so that working with strings becomes effortless and simple. join() in Java 8, chars() and codePoints() in Java 9, isBlank(), lines(), repeat(), strip(), stripLeading() and stripTrailing() in Java 11, indent(), transform(), describeConstable() and resolveConstantDesc() in Java 12, formatted(), stripIndent() and translateEscapes() in Java 15 are some new Java string methods.

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

See more at https://javaconceptoftheday.com/java-new-string-methods-with-examples/
# Day 1 | How to resolve it?
Tags: javascript
Published: 2022-07-11 07:27:08

## The Problem

```js
var greeting = 'My name is ${name}, age ${age}, I am a ${job.jobLevel} ${job.jobName}.';
var employee = {
  name: 'XiaoMing',
  age: 11,
  job: {
    jobName: 'designer',
    jobLevel: 'senior'
  }
}

var result = greeting.render(employee);
console.log(result); // My name is XiaoMing, age 11, I am a senior designer.
```

## The solution

This is my solution: 

```js
// my solution
String.prototype.render = function (options) {
  return this.replace(/(?:\$\{)([\.\w]+)(?:\})/g, (match, $1) => {
    if ($1.includes('.')) {
      var p = $1.split('.');
      return p.reduce((p, n) => p[n], options);
    }
    return options[$1];
  })
}
```

And the other one:

```js
String.prototype.render = function (options) {
    with(options) {
        return eval('`' + this + '`')
    }
}
```

## Tips:
This is my first article, so, be kind with me.
If you see some improvement that can be made, please, let me know in the comments.
If you liked this article, please, motivate-me in the comments.

Thank you for reading ❤️ !
Getting started with linked list
Tags: javascript, node, react, programming
Published: 2022-07-11 07:15:18

A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers as shown in the image above.
In simple terms, a linked list consists of nodes where each node contains a data field and a reference to the next node in the list. the linked list is way different from the array data structures because in linked list the list only knows about the head and tail node while each element only knows about the next element after them.

## Implementation of LinkedList in Javascript

We are going to implement append: to add values at the end of the list, prepend: to add values at the beginning of the list, find value: to search the list for a particular value, delete: to remove a value from the list, insert after: to insert a value just after a specified value, print values: to view all the values of the linked list.


![vscode workspace for the implementation of linked list](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yexupg2mtpba0j3ylxx.png)

insert after and print all values


![vscode workspace for the implementation of linked list](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4bau49zb9ual40i04tt.png)

thanks for your time, I have more post liked this to help you understand data structures, please keep checking.
Create charts in your React app.
Published: 2022-07-11 07:09:32

In this case, we will use Billboard.js which is a JavaScript chart interface based on D3.js. The library supports a wide range of chart types such as area, bar, line, gauge, scatter, candlestick, polar, pie, and etc.

**INSTALLATION**
of from the terminal inside your project folder, run either  the below:

```
npm i billboard.js
yarn add billboard.js
```

**USAGE**
Locate the section where you want to render the chart inside your component:

```
import {bb, area, bar, zoom} from "billboard.js";

class Welcome extends React.Component {

// generate the chart
generate = () => {
var chart = bb.generate({
    bindto: "#chart-area",
    data: {
      // for ESM import usage, import 'line' module and execute it as
      // type: line(),
      type: "line",
      columns: [
          ["data1", 30, 200, 100, 400, 150, 250] // or you can load data from an API
      ]
    },
    zoom: {
      // for ESM import usage, import 'zoom' module and execute it as
      // enabled: zoom()
      enabled: true
    }
});
}
  render() {
    return <div id="chart-area"></div>
  }
}

```