teleren/devto huggingface dataset:
JS Basic String Methods
Tags: javascript, webdev, tutorial, beginners
Published: 2022-07-11 15:47:46

Here is a list of few basic string methods:

- **Length**, check length of a string 
```js
const myString = "I love coding";
console.log(myString.length);
```
- **Trim**, remove whitespaces at the beginning and at the end of string.
```js
const myString = "  I love coding  ";
console.log(myString.length); // 17
console.log(myString.trim()); // "I love coding"
console.log(myString.trim().length); // 13
```
- **Split**, convert a string to an array.
```js
const myString = "I love coding";
const arr = myString.split(" ");
console.log(arr);
// ['I', 'love', 'coding'];
```
- **Includes**, returns true if a string contains a particular string. In other case return false.
```js
const myString = "I love coding";
if(myString.includes("coding")) {
 console.log('yes');
} else {
 console.log('no');
}
// yes
```
- **Char At**, get the character at a specific position in a string.
```js
const myString = "I love coding";
const myChar = myString.charAt(7);
console.log(myChar); // c
```
- **Slice**, extract a part of a particular string.
```js
const myString = "I love coding";
const text = myString.slice(2,6);
console.log(text); // love
```
- **To lower case**, convert the string to lowercase letters.
```js
const myString = "I LOVE CODING";
console.log(myString.toLowerCase());
// i love coding
```
- ** To upper case**, convert the string to uppercase letters.
```js
const myString = "I love coding";
console.log(myString.toUpperCase());
// I LOVE CODING
```
- **Replace**, returns a new string with a text replaced by different text.
```js
const myString = "I love coding";
const replacedSring = myString.replace('coding', 'programming');
console.log(replacedString);
// I love programming
```
- **Concat**, concat string arguments to a particular string.
```js
const myString = "I love coding";
const newString = "& designing";
const concatedString = myString.concat(' ', newString);
// I love coding & designing
```
- **Starts with**, returns true if a string starts with a particular string.
```js
const myString = "I love coding";
myString.startsWith('coding') ? (console.log('yes')) : console.log('no'));
// no
```
- **Ends with**, returns true if ends with a particular string.
```js
const myString = "I love coding";
myString.endsWith('coding') ? (console.log('yes')) : console.log('no'));
// yes
```

I hope you find these functions helpful. You can also share more functions in the comment section.

Thank You.
Shortest C# program to display IP addresses in a range.
Tags: csharp, algorithms
Published: 2022-07-11 15:47:00


Just for fun, I tried to write the shortest code to take two IP addresses from the command line and list the IP addresses between them.

This doesn't check for errors or broadcast addresses or anything of the like, hence the "fun" part.

If you can make this shorter please show your skills in the comments.

This is written in C# 10 with top level statements enabled, so it is a complete programs.

```
uint p(string b) => BitConverter.ToUInt32(b.Split(".").Reverse().Select(byte.Parse).ToArray());

for (var ip = p(args[0]); ip <= p(args[1]); ip++)
    Console.WriteLine(string.Join(".", BitConverter.GetBytes(ip).Reverse()));
```
Defining my path
Tags: beginners, goals, productivity
Published: 2022-07-11 15:46:25

Dev community,

I first had interest in tech (coding) about 3 years ago, then I had started learning HTML and python through Youtube videos and some coding apps. I made a post earlier in March, which talked about documenting my learning journey which would in turn make me accountable and more consistent with practicing.
Well, that didn't turn out so good cause I have not made any reasonable progress so far.
I've been thinking...probably this tech field isn't for me because I have tried every method I know of, even paid for courses.
But deep down, I still have interest in building a career in the tech field and also work on great projects.
I believe someone here would have a different perspective and probably enlighten me on a better way to go about this.
Thank you in advance.
Best Online Communities For Engineers
Tags: devops, management, career, leadership
Published: 2022-07-11 15:40:21

The world of tech and software development evolves fast. New frameworks and libraries emerge all the time, and that's why it's important to stay in tune with what's happening in the industry otherwise  you could end up feeling left behind—and that's no good for anyone!

To make that less of a challenge, it is essential to not go at it alone. Having a group of people with the same interests, ambitions, and goals as you, will not only help you progress a lot faster by interacting and learning with people above your level, but it will also provide you an opportunity to give back to the community.

Whether you’re in the early, middle or late stages of your career,  joining a community can be a great way to ensure success in this career path. 

Communities brings industry and academia experts together to give engineers and technicians around the world a platform to network, learn and collaborate online or face to face. Peer to peer networking opportunities then fosters real connections in the engineering community.

I'm interested in learning more about some online communities related to tech blogging and engineering leadership in general. Are you active in any community? Please let me know in the comments


Based on that criteria, Here's a list of my top 2 Engineering communities  (that I’m also a member of that you could also be a part of )

[Lohika[Re:think] Community](https://community.lohika.com/login?returnTo=https%3A%2F%2Fcommunity.lohika.com%2Fhome), an online community platform for events, resources and discussions on technology, innovation and leadership.

**Benefits**

- Participate in 1:1 chats and join discussions about  scaling teams, engineering leadership and more.
- Attend live events, view on-demand videos, read articles and connect with like-minded peers. 
- Explore videos and articles about web3, engineering leadership, angel investing and more.. 

Visit now, then click “Sign In” to create an account https://community.lohika.com/public/learn 


**[ELC]**(https://elc.community/) - Home for engineering leaders
ELC is a peer community for all engineering leaders, regardless of role or tenure to gain outside perspectives and discuss real challenges with trusted peers. It's a place where you can get support and support others.


**Benefits**
- 1:1 Conversation
- Discover and attend events on topics relevant to your interests.
- Use “Channels” to join discussions on interesting topics with other community members.
- Knowledge hub: One can Explore the expansive library of videos and podcasts.
Music Monday — What are you listening to? (July 11)
Tags: watercooler, discuss, music
Published: 2022-07-11 15:07:38

_cover image source: [ThunderStomp Threadz](https://giphy.com/thunderstompthreadz)_

In this weekly series, folks can chime in and drop links to whatever it is they've been listening to recently + browse others suggestions.

If you like talking about music, consider following the org [#music discussions](https://dev.to/music-discussions) for more conversations about music!

{% embed https://dev.to/music-discussions %}

Also noteworthy, my friend @duxtech has a Spanish speaking version of this series [here](https://dev.to/duxtech/series/17890) in case you'd like to chime in there as well. 🙌

***

So, what have y'all been listening to today? _Note: you can embed a link to your song on most platforms using the following syntax `{% embed https://... %}`._

I look forward to listening to y'all's suggestions! 👂 🎶
Why is a bitcoin transaction stuck?
Tags: devops, webdev, programming
Published: 2022-07-11 15:01:18


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8445mkhkcw470993u1sa.png)
The block has a limited size of 1 megabyte, and all unconfirmed (not yet included in the block) transactions are stored in the mempool (the memory of the bitcoin node).

With a large number of unconfirmed transactions, miners try to choose transfers with the largest network commission and with the smallest size to earn more. Transactions with a smaller network fee remain unprocessed until the network load gets down.
The second most common reason for the UnConfirmed status is the presence of previously unconfirmed transfers. Typically, transactions need to be confirmed one by one. New transactions will not enter the block until the incoming coins are confirmed.

**Why can transactions get lost?**

Bitcoin nodes have different settings. Some delete transactions that have not been confirmed within 1-3 days. Some do not accept transactions with too low network commissions. For example, if the mempool is full and it already has more than 50 MB of unprocessed records, and the average network commission is 30 satoshi per byte, then the node may not accept transactions with a commission of 1 satoshi per byte.
Also, if a transaction has a large number of inputs or outputs and it can take a significant room in the block, and it brings little profit to the miners, then the miners can simply decline to accept it until the mempool is completely unloaded.
You can observe a different number of unconfirmed transactions because of the node settings in different blockchain explorers. 

**How to speed up a transaction confirmation?**
If the transfer is not displayed in all blockchain explorers, then it is better to resend the transaction. To do this, copy the transaction hash or raw transaction (raw tx), as appropriate, and rebroadcast it manually using the following forms:
https://blockchair.com/broadcast
https://live.blockcypher.com/btc/pushtx/
https://blockstream.info/tx/push
https://bitpay.com/insight/#/ALL/mainnet/broadcast-tx

There are also paid and free accelerators that use a variety of request APIs to broadcast a transaction:
https://pubtx.com/
https://www.viabtc.com/tools/txaccelerator/
https://btcnitro.com/
https://www.bitcoinjumper.com/
https://pushtx.btc.com/

**What to do next time?**
Use RBF (replace-by-fee) so you can replace your old transaction with a new one with a high network commission.
Use SegWit, which is a protocol with a transaction signature moved outside. This allows the transaction size to be reduced, allowing more transactions to be in a block. Miners are more willing to take SegWit transactions than heavy legacy ones.
Taproot and Schnorr signature. At the moment, hardly anyone supports it, but it is a more secure and flexible protocol, with an even lower network commission. This is a new stage of network scaling.
Try to split heavy transactions with many outputs into several separate ones, or periodically combine coins into larger ones.
Always check and set the current network commission.
How to use the contenteditable attribute in Vue 3
Tags: javascript, typescript, vue, html
Published: 2022-07-11 14:55:57

Since I'm unemployed, I'm working on a side project in Vue 3 / TypeScript, so I keep myself up-to-date in frontend development.

Lastly, even if I've 15 years of full-stack experience, I encountered the `contenteditable` HTML attribute that I didn't know anything about (man there's so much to know in HTML/CSS today).

> For those who don't know about it neither, it's an attribute that makes the target tag editable by a simple click: everything is handled natively by the browser itself!

In my application, I had a title that I needed to make editable and I implemented the behaviour by replacing the title by an input when it was clicked. Then I put a `v-model` attribute on it, and hid the input when the enter button is pressed (and then displayed the title again in place). I already thought when I coded this that it was a bit cumbersome... So I was really intrigued when I met this `contenteditable` UFO (well, it's not flying per say, but you understood).

I managed to quickly update my code and tested how the thingy worked.

```vue
<script setup lang="ts">
  import { ref } from 'vue'

  const title = ref('My title')
  const titleElement = ref(null)

  function validate(event : Event) {
    (event.target as HTMLInputElement).blur()
    title.value = titleElement.value.innerText.trim()
  }
  
  defineExpose({ titleElement })
</script>

<template>
  <div ref="titleElement" contenteditable spellcheck="false" @keydown.enter="validate">
    {{ title }}
  </div>
</template>
```

Well... It seems that is all we need 😅🦄

It's clearly better now without the complexity of dealing the edition by ourselves!

Here's the [playable snippet](https://sfc.vuejs.org/#eNpdkk1P8zAMx7+KlctaaaT3qkPPc5gEEtw49pK17hZI0yhxNlDV747TFAQc0ibxL37527P475y8RhS1aELntSMISNGBUfZ8aAWFVty3FkCPbvIEM3gc9nBT1F1ggcFPI+z4/a61ieomGwhIk0E4JLTYPX/k8678AxwNjmhp42w0honEDNF2pCcLV2V0rwgLvCawhmP6lzAnCiBfS1L+jAQqwMPL89OjdZE216U8meiLNTDkoJJ9xpTbzxTypdTWon/Bd3bp9ZifLemTVo+Dtnh8d1PAYv5dwbKiaa26FKtxD0UJh3tQBj3lqxynZLqpstgsLR8IR2e4zlXoptfXpEgS/0eQViTtiHfYa1InFjg4NKa7YPfG7KBMQIb+veFHP92sTKRnw5eIWx8B5i17WNbimooDsqmpvtMQe5HbfTcqJ1/DZHk8VtHbzcBTUX+1gUNE9l7z5kLkQl1VYejSUL0GOflzxTvpoyU9osQw3p38dAvo2XErNo0XsXwC0APhCA==) if you want to have fun with it!

If you have any questions, don't hesitate to ask them in the comment section 😉

---

Photo by <a href="https://unsplash.com/@thoughtcatalog?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Thought Catalog</a> on <a href="https://unsplash.com/s/photos/pencil-man?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
How to automate a multi-channel functional test scenario?
Tags: testing, webdev, devops, agile
Published: 2022-07-11 14:51:00

For any company with a software development activity, **Agile development method** means functional test automation.

Why? Because the fast pace of agile development sprints leads to a growing need for non-regression tests. Therefore the **automation of functional tests** is absolutely essential to process this **growing mass of tests** to be performed.


## Advantages of Agilitest for automation

Choosing a test automation solution is a crucial choice that involves the long-term business processes related to software validation. Agilitest stands out from the competition by several fundamental aspects: **ergonomics** and ease of creating a test when you are not a developer, **interoperability** of tests between different actors of a project thanks to the open standard ATS (ActionTestScript), or even the **compatibility with web, mobile, desktop and webservice applications.**

It is this latter asset that we will develop in this article, because it is not all about being able **to test different technologies** on several platforms, you must also be able **to test them together in the same test scenario.** And that's where things get tough.


## Tests of several technologies

In Agilitest jargon, **the opening of a channel** consists in implementing the **possibility of interacting with the system **tested by submitting to it the **automated actions** which must be carried out in the same way as a manual tester...

Read full article [here](https://www.agilitest.com/blog/automate-scenario-test-multi-channel).
Obtain Memory VM - Powershell
Tags: powershell, script, memory, vm
Published: 2022-07-11 14:47:47

This script returns the memory that the VM contains.


```scss

[CmdletBinding()]
    param(
        [Parameter(ValueFromPipelineByPropertyName=$true)][alias("DNSHostName","Name")]$ComputerName = '.',
        [PSCredential]$Credential
    )
    
    BEGIN {}
    
    PROCESS  {
        Foreach ($Comp in $ComputerName) {
            $param = @{
                'ComputerName' = $Comp
                'ErrorVariable' = 'WmiRequestError'
            }
            if($Credential -and ($Comp -notin @($env:COMPUTERNAME,'.'))){$param.Credential = $Credential}
                
            try{
                $PerfOS_Memory = Get-WmiObject -Class Win32_PerfRawData_PerfOS_Memory @param
                $PhysicalMemory = Get-WmiObject -Class Win32_PhysicalMemory @param
                $TotalPhysicalMemory = ($PhysicalMemory | Measure-Object -Sum -Property Capacity).Sum
            } Catch {$WmiRequestError; break}
            
            if($PerfOS_Memory -and !$WmiRequestError){
            
                [pscustomobject][ordered]@{
                    'ComputerName' = $PerfOS_Memory.PSComputerName
                    'AvailableGB' = [System.Math]::Round(($PerfOS_Memory.AvailableBytes/1gb),2)
                    'inUseGB' = [System.Math]::Round(($TotalPhysicalMemory/1gb - $PerfOS_Memory.AvailableBytes/1gb),2)
                    'CacheGB' = [System.Math]::Round(($PerfOS_Memory.CacheBytes/1gb),2)
                    'CommittedGB' = [System.Math]::Round(($PerfOS_Memory.CommittedBytes/1gb),2)
                    'CommitLimitGB' = [System.Math]::Round(($PerfOS_Memory.CommitLimit/1gb),2)
                    'PoolPagedMB' = [System.Math]::Round(($PerfOS_Memory.PoolPagedBytes/1mb),2)
                    'PoolNonpagedMB' = [System.Math]::Round(($PerfOS_Memory.PoolNonpagedBytes/1mb),2)
                    'TotalPhysicalMemory' = [System.Math]::Round(($TotalPhysicalMemory/1gb),2)
                    'ModuleSize' = ($PhysicalMemory | Group-Object -Property Capacity | % {[string]$($_.Count.ToString() + ' x ' + ($_.Name / 1GB).ToString() + 'GB')}) -join ', '
                }
            }
            $PerfOS_Memory = $Null
            $PhysicalMemory = $Null
            $TotalPhysicalMemory = $Null
            $WmiRequestError = $Null
            
        }
        
    }
    
    END {}
```
Paracetamol.js💊| #164: Explica este código JavaScript
Tags: javascript, programming, spanish, webdev
Published: 2022-07-11 14:42:22

## **<center>Explica este código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
let pais = "bolivia";
pais[0] = "B";
console.log(pais);
```

A. `Bolivia`
B. `bolivia`
C. `olivia`
D. `SyntaxError: pais is not defined`

Respuesta en el primer comentario.

---
Paracetamol.js💊| #163: Explica este código JavaScript
Tags: javascript, webdev, spanish, programming
Published: 2022-07-11 14:41:33

## **<center>Explica este código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const libro = {
  isbn:"596-84661-4158",
  titulo:"El principito",
  [Symbol("paginas")]: 100,
}

console.log(Object.keys(libro));
console.log({...libro})
```

A. `["isbn", "titulo"]`, `{ Symbol("paginas"): 100 }`
B. `["isbn", "titulo"]`,  `{ isbn: 596-84661-4158, titulo: "El principito" }`
C. `["isbn", "titulo"]`, `{ isbn: 596-84661-4158, titulo: "El principito", Symbol("paginas"): 100 }`
D. `Ninguno de los anteriores`

Respuesta en el primer comentario.

---
Netenv Project
Tags: go, sideprojects, env, programming
Published: 2022-07-11 14:22:33

Hi. I created a project called **netenv**.

It's a simple, network-based environment variable loader.

**GitHub:** [https://github.com/aligoren/netenv](https://github.com/aligoren/netenv)

I'm looking for to new ideas or contributions. Actually, I'm still learning Golang. So, it would be nice if you give me feedback.

## What does this project do?

This project allows you to share different environment files of a project you specify and the variables in these files from a single server to all connected networks. You can also create an exclude list, and restrict access to the network with the allowed IP.

This is not a web API. It works over TCP just like Redis.

It can be configured like that;

**netenv.yml**

```yaml
global:
  addr: ":8080"
  auth:
    enabled: true # set this true if you want to use authentication
    username: admin
    password: admin
    iplist:
      - 0.0.0.0
      - 127.0.0.1

envfiles:
  project1:
    default: dev
    environments:
      dev:
        path: /home/ali/pyt/test.env
        excludes:
          - MYSQL_USERNAME
  project2:
    default: dev
    environments:
      dev:
        path: /home/YOUR_USER/pyt/project2_dev.env
      stage:
        path: /home/YOUR_USER/pyt/project2_stage.env
      prod:
        path: /home/YOUR_USER/pyt/project2_prod.env
```

Let's say we have a python file to connect this server like that;

```python
import socket

HOST = "127.0.0.1"  # The server's hostname or IP address
PORT = 8080  # The port used by the server

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    # s.sendall(b"echo\n")
    # s.sendall(b"auth:admin:admin:echo\n")
    # s.sendall(b"auth:admin:admin:file$project1:env$dev:var$name,TEST,MYSQL_USERNAME\n")
    s.sendall(b"auth:admin:admin:file$project1:env$dev:var$*\n")
    # s.sendall(b"auth:admin:admin:file$project1:env$dev:var$TEST\n")
    # s.sendall(b"auth:admin:admin:file$project2:env$prod:var$name\n")
    # s.sendall(b"file$project2:env$prod:var$name\n")
    #s.sendall(b"echo\n")
    data = s.recv(1024)

print(f"Received: {data.decode('utf-8')}")
```

I don't know are there any projects like that. If there is a project like that, please let me know. I can stop to develop this project.

Have a nice day!
Input forms challenge from rpachallenge.com with ServiceNow RPA
Tags: servicenow, rpa
Published: 2022-07-11 14:03:03

Out of fun I tried myself at the [rpachallenge.com](https://www.rpachallenge.com/) 'Input From' challenge (first one).

The challenge is to fill out a web form with data from an excel. The twist is, that every time you submit the form, the position of the field on the form change.

To bypass that problem we just need to identify the input tag with another attribute ng-reflect-name.

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

The hole bot process is pretty simple, open the excel and then make a loop from row two to eleven and get all the row value with the 'GetRowValues' action. To fill out the fields we have a method on the chrome connector called 'SetFields' where we can set all the input fields from the excel. Last step is to use the click method on the submit button, thats it.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fjsxixvu2ti1k31jjgfw.png)
Basics / Code Organization for embedded
Tags: luos, embedded, opensource, microservices
Published: 2022-07-11 14:00:55

Because Luos engine allows you to manage your features as shareable blocks of code, we’ve organized the code in a specific way that makes it easy to integrate and share your project packages with as little friction as possible.

⏩ https://www.luos.io/docs/luos-technology/basics/orga

Discover in this documentation the basics of the Luos technology.

#luos #technology #opensource #microservices #edge #embedded


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