teleren/devto huggingface dataset:
What is the difference between Luos and an embedded OS like ROS? Q&A live
Tags: opensource, microservices, qanda, luos
Published: 2022-09-06 15:45:44

A few days ago, we held our first live Q&A session on Discord, and it was a pleasure to exchange with all of you.

⏩ https://www.luos.io/blog/difference-between-luos-and-embedded-os-like-ros-q-and-a

If you missed it or want to discover it again, we have concatenated all your questions in this article and completed them with precise answers.

This session was organized on **August 10, 2022.**
Redis-穿透、击穿、雪崩
Published: 2022-09-06 15:27:58

## 
一、穿透

1. 查询的key不在redis中，请求就会打到数据库。低频穿透不要紧，要防止高频穿透。

1. 
解决方案一：短暂缓存空对象

- 只能保证db和redis弱一致性

- 如果缓存大量空对象，会占用大量内存；同时redis有LRU/LFU内存淘汰策略，会将有价值的数据淘汰

1. 
解决方案二：Bloom Filter

- 
bloom filter认为这条数据存在，不一定存在于redis中；但bloom filter认为这条数据不存在于redis中，则一定不存在于redis中

## 
二、穿透

1. 
“穿透”是“击穿”的特殊表现形式，热点key被击穿；比如微博的热点事件导致微博瘫痪

1. 
解决方案一：热点key不过期

- 
可能导致db和redis不一致

1. 
解决方案二：分布式锁

- 
热点key在redis查不到，只允许一个request打到db

## 
三、雪崩

1. 
“雪崩”是“穿透”的特殊表现形式，多个热点key失效

1. 
原因：

- 
过期时间比较一致，某个时间同时失效，可以将失效时间设为随机数

- 
redis挂了，可以使用集群

1. 
解决方案一：数据预热，缓存时间随机

- 
项目启动时将db的数据同步到redis，并设置随机值为过期时间

1. 
解决方案二：redis集群
GIT recipes
Tags: git
Published: 2022-09-06 15:21:49

---
title: GIT recipes
published: true
description: Some git recipes
tags: git
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

##How to cherry pick a file from another branch in to current branch?
> `git checkout <other_branch_name> <files/to/grab in/list/separated/by/spaces> -p`

**example:**

```
git checkout mybranch config/important.yml app/models/important.rb -p
```
---
## How to list branches by creation date?
```
git for-each-ref --sort='-authordate'
```
---
## What is the difference between `git fetch` and `git pull`?
1. `git fetch` pull only the meta data from remote. Good to know without actually pulling data locally.
1. `git pull` pulls the difference from remote. So first do a `git fetch` understand the difference and then do the pull only when ready.

---

## How to get the status of all the repositories in a directory?
```
for d in */; do 
    if [ -d "$d/.git" ]; then 
        echo "$d"
        cd "$d"
        git status
        cd ..
    fi 
done
```
The useHistory hook in react router v5 vs the useNavigate hook in react router v6.
Published: 2022-09-06 15:12:34

React Router DOM is an npm package ( npm - node package manager) that enables you to implement dynamic routing in a web app. It allows you to display pages and allow users to navigate them. It is a fully-featured client and server-side routing library for React.

In this article I will be concentrating on the UseNavigate in v6 and the useHistory in v5 react router.

**Basic installation:**
React router dom can be install in react applications using the following package managers.

- npm install react-router-dom

- yarn add react-router-dom

Reacently, a newer version of react router dom was introduced, that is the react-router-dom@v6.
The useNavigate() hook is introduced in the React Router v6 to replace the useHistory() hook. In the earlier version, the useHistory() hook accesses the React Router history object and navigates to the other routers using the push or replace methods. It helps to go to the specific URL, forward or backward pages.

**useHistory**
The _useHistory_ hook gives you access to the history instance that you may use to navigate. 
Below is a code snippet to show the useHistory hook.



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

**useNavigate**
The _useNavigate_ hook returns a function that lets you navigate programmatically.
Below is a code snippet to show the useNavigate hook.


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

As we can see from the code snippets showing the implementation of the _useHistory_ hook in react router v5 and the _useNavigate_ hook in react router v6. 
One can easily conclude that the implementation of the _useNavigate_ which replaces the _useHistory_ is simple to implement, and in the **useNavigate hook** the use of the **(.push )** method is no longer needed.




I hope you find this helpful.❤️

Got questions? Send me a message.

Kindly follow me on the following platforms👏
[Linkedin](https://linkedin.com/in/simicodes)
[Twitter](https://twitter.com/simicodes)
[Medium](https://medium.com/@simeonoffiong/)
[DEV](https://dev.to/simicodes/)
[Facebook](https://facebook.com/simicodes)
[Instagram](https://instagram.com/simicodes)
Technical sophistication series(1) – Introduction
Tags: tutorial, beginners, java, codenewbie
Published: 2022-09-06 15:10:24

How do Techies become sophisticated? You may wonder. This post isn't about glasses, big sweatshirts or loosely packed hair. Familiarity with hard skills, such as text editors and the Unix command line, isn't also what this post is about. It is more about the skills and attitude needed to be regarded as not just a techie, but a sophisticated one.

These set of skills are referred to as soft skills. They make problem-solving easier and make your work faster, and are not always included in learning paths. You would wonder why such skills aren't taught easily? Well, soft skills and attitude are particularly difficult to teach.

A best way to illustrate a technical sophistication skill is this flowchart from [xkcd](https://xkcd.com/)

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

In this series, we will discuss as many of these skills as possible. One of which is **debugging**.

You are on your way to getting sophisticated! See you in the next article!
Arrow Function | JavaScript ES6.
Tags: javascript, react, reactnative, webdev
Published: 2022-09-06 14:35:38

Let's take a look at the normal js function.
```
function myName(name){
    console.log(name);
}
myName("Sujith")
```
The above function can be written in arrow function as,
```
const myName = (name) => {
    console.log(name)
}
myName("Sujith")
```
In arrow function we assign the function body to a variable, and we pass the arguments through the parenthesis between `=` and `=>`
eg:`= (name) =>`
And the body of the arrow function comes in between the curly braces `{}`.We can use return keyword to return a value in the function.

**Arrow function with one argument.**
```
const myName = name => {
    console.log(name)
}
myName("Sujith")
```
If an arrow function is having only one argument, then we can exclude the parenthesis while passing the argument.`= name =>`

**Arrow function with single statement.**
```
const myNumber = nbr => nbr * 5

console.log(myNumber(5))
```
If an arrow function has only a single statement to return or execute, then we can exclue the `{}` and write them as `=> nbr * 5`. It automatically returns that statement after `=>` and we don't need to use return keyword.
gyroscope
Tags: gyroscope, sensor
Published: 2022-09-06 14:35:26

**what is gyroscope?**
A gyroscope is a device used for measuring or maintaining orientation and angular velocity.

It is a spinning wheel or disc in which the axis of rotation (spin axis) is free to assume any orientation by itself. 

When rotating, the orientation of this axis is unaffected by tilting or rotation of the mounting, according to the conservation of angular momentum.

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

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msjx5972d69rkl0jz9je.gif)
_We now showing A gyroscope in operation, showing the freedom of rotation in all three axes. The rotor will maintain its spin axis direction regardless of the orientation of the outer frame._
The Most Hidden Feature of JavaScript ✍️
Tags: javascript, webdev, tutorial
Published: 2022-09-06 14:22:44

Think you know JavaScript? **Think again.** 🤔

Let me tell you something about a string's `replace()` method... **you can pass a function into it.**

What does this mean? I'll show you.

## Video Tutorial

If you want to see my video tutorial on this feature, feel free to watch it below 👇

{% youtube 4uquFErCClk %}

## Passing a Function into the `replace()` method

Most of you know how the `replace()` method works: you pass in a string or regular expression to **find** alongside a **replacement** value.

For example, let's replace all numbers with the phrase "NUMBER":

```js
const myString = "Order Number: 4 2 8 3";
const result = myString.replace(/\d/g, "NUMBER");

// result == "Order Number: NUMBER NUMBER NUMER NUMBER"
```

Pretty simple. But here's where it gets interesting 👇

You can also pass in a **function** as the replacement value. The return value of that function is what gets used as the actual "replacement".

Let's see the same example as above, this time with a function instead:

```js
const myString = "Order Number: 4 2 8 3";
const result = myString.replace(/\d/g, match => {
    return "NUMBER";
});

// result == "Order Number: NUMBER NUMBER NUMER NUMBER"
```

This produces the same result. But why would you want to use this technique? Well, you can add some logic 😎

Now, let's only replace numbers greater than **3** with the phrase "NUMBER":

```js
const myString = "Order Number: 4 2 8 3";
const result = myString.replace(/\d/g, match => {
    if (Number(match) > 3) {
        return "NUMBER";
    }

    return match;
});

// result == "Order Number: NUMBER 2 NUMER 3"
```

As you may have noticed, the first argument to the replacement function is the *match*, which refers to each match (in our case, number) found using the first argument to the `replace()` method.

I hope this technique can reduce some complexity in your regular expressions 😉

Enjoy!

## [Enrol Now 👉 JavaScript DOM Crash Course](https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1)
If you're learning web development, you can find a complete course on the JavaScript DOM at the link below 👇
[https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1](https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1)

![Course Thumbnail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lw2eqe1t53rcuse5vl82.jpg)
let & const | JavaScript ES6.
Tags: javascript, react, webdev, beginners
Published: 2022-09-06 14:06:01


let and const are used to create variable in js.

let is same as var in old js. let allows us to create variables where its values can be changed.
eg:-
```
let myName = "Sujith";
myName = "Ajith";
```
The above code would give the result as Ajith because we have reassigned a new value to the variable myName.

const is used to create a variable where its value cannot be changed or reassigned after initial assignment.

```
const myName = "Sujith";
myName = "Ajith";
```
The above code would give us the following error.
`TypeError: Assignment to constant variable.`
Horizontal and Vertical Scaling In Databases
Published: 2022-09-06 14:05:03

Scaling alters size of a system. In the scaling process, I either compress or expand the system to meet the expected needs. The scaling operation can be achieved by adding resources to meet the smaller expectation in the current system, or by adding a new system in the existing one, or both. 
Types of Scaling: 

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

Scaling can be categorised into 2 types: 
1. Vertical Scaling: When new resources are added in the existing system to meet the expectation, it is known as vertical scaling. 
Consider a rack of servers and resources that comprises of the existing system. (as shown in the figure). Now when the existing system fails to meet the expected needs, and the expected needs can be met by just adding resources, this is considered as vertical scaling. **Vertical scaling is based on the idea of adding more power(CPU, RAM) to existing systems, basically adding more resources.** Vertical scaling is not only easy but also cheaper than Horizontal Scaling. It also requires less time to be fixed. 

2. Horizontal Scaling: When new server racks are added in the existing system to meet the higher expectation, it is known as horizontal scaling. 
Consider a rack of servers and resources that comprises of the existing system. (as shown in the figure). **Now when the existing system fails to meet the expected needs, and the expected needs cannot be met by just adding resources, we need to add completely new servers**. This is considered as horizontal scaling.
Horizontal scaling is based on the idea of adding more machines into our pool of resources
Horizontal scaling is difficult and also costlier than Vertical Scaling. It also requires more time to be fixed.

**Difference between Horizontal and Vertical Scaling:** 
 **Horizontal Scaling**
- When new server racks are added in the existing system to meet the higher expectation, it is known as horizontal scaling.
- It expands the size of the existing system horizontally.
- It is easier to upgrade.
- It is difficult to implement
- It is costlier, as new server racks comprises of a lot of resources
- It takes more time to be done

**Vertical Scaling**
- When new resources are added in the existing system to meet the expectation, it is known as vertical scaling
- It expands the size of the existing system vertically.
- It is harder to upgrade and may involve downtime.
- It is easy to implement
- It is cheaper as we need to just add new resources
- It takes less time to be done
Video: Power Automate – Starting with a Template
Tags: development, video, flow, powerautomate
Published: 2022-09-07 12:27:25

---
title: Video: Power Automate – Starting with a Template
published: true
date: 2022-09-06 14:00:00 UTC
tags: Development,Video,flow,PowerAutomate
canonical_url: https://barretblake.dev/2022/09/video-power-automate-starting-with-a-template/?utm_source=rss&utm_medium=rss&utm_campaign=video-power-automate-starting-with-a-template
---

A new video this week. I delve into how quickly you can create a Power Automate flow using one of the thousands of provided templates.

https://youtu.be/cjMJvRuHAsc

The post [Video: Power Automate – Starting with a Template](https://barretblake.dev/2022/09/video-power-automate-starting-with-a-template/) first appeared on [Barret Codes](https://barretblake.dev).
Why you will see the error "Loading chunk \d+ failed"
Tags: webpack, javascript, webdev
Published: 2022-09-06 13:55:08

I know of the following reasons why chunks cannot be downloaded:

- **network errors**: inspect the network in the browser dev tools to find out more information about the errors.

- **resources not found**: they don't exist in the correct directory (output > publicPath). Try access the resource/asset via its URL in the browser to see if it exists.

- **package corruption**: something is wonky with the `node_modules`. In my case, I manipulated my modules locally to avoid having to push to npm on each change. This caused corruption which resulted in chunks that did exist in the output path were deemed not found. To rectify this, delete the modules and re-install.

- **duplicate styled-components**: https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page

```bash
rm -rf node_modules
npm install # or `npm i` for short
```
Link: Trello Board Full of Companies Who Do Mob/Ensemble Programming
Published: 2022-09-06 13:49:51

---
title: Link: Trello Board Full of Companies Who Do Mob/Ensemble Programming
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

Massive MASSIVE set of links in a Trello board to companies who do mob/ensemble programming.

https://trello.com/b/EFSFnE4W/companies-that-mob-ensemble-program
Choosing a stack
Published: 2022-09-06 13:45:02

For our umbrella project we had the choice of what tech stack to use. To begin with I wanted to see what tech stack my host company would be using, but since I still don't have a project that was ruled out. The only other tech stack I have used is React/Django but I wanted to try something different.

When talking with my parter he mentioned the MERN stack(MongoDB, Express, React, Node). It seems to be one of the more popular stacks so it had to be a good choice, plus plenty of online resources on the it. It was a pretty easy choice because I don't know enough to understand why a certain stack is better for a problem than others. So just picking something popular seemed the way to go.

I'm excited to work with a different stack. It will be a fun challenge to understand the difference of working with MERN compared to the previous stack I used. I know some javascript and React, but I have no experience with everything else in the stack. This makes for a fun and interesting time with the umbrella project.

Now that the stack is chosen and everything is hooked up. It's finally time to get to work on it!
Odd Even List - I
Tags: javascript, leetcode
Published: 2022-09-06 13:38:40

```js
var oddEvenList = function(head) {
    if (!head || !head.next) return head;
    let oddNode = head;
    const evenHead = head.next;
    let evenNode = head.next;
    
    while(evenNode?.next) {
        oddNode.next = evenNode.next;
        oddNode = oddNode.next;
        evenNode.next = oddNode.next;
        evenNode = evenNode.next;
    }
    
    oddNode.next = evenHead;
    
    return head;
};

```
How to Build a Successful On-Demand Delivery App – The Ultimate Guide!
Tags: android, mobile
Published: 2022-09-06 13:23:10

Almost everyone interacts with each other, their businesses, and their world through mobile apps, and a [Mobile App Development Company](https://www.sufalamtech.com/mobile-application-development) plays a key role in this. Therefore, strong mobile apps are essential for providing maximum security when it comes to access control.

On-demand delivery services such as Uber, Airbnb, Zomato, and DoorDash have revamped the world. On-demand delivery services, which have been popular worldwide for several years, have emerged as the market’s new face.

By providing immediate access to whatever people need, whenever they need it, the on-demand financial system has exceeded traditional business models.

Who wouldn't want the convenience and freedom of being able to get anything and everything from the comfort of their own home? 

You will learn everything you need to know about creating an on-demand delivery app in this article. Let us walk you through everything you need to know about developing an on-demand delivery app.

Read More: https://bit.ly/3cPzo4d

**Related Article:** [How Can Mobile App Development Trends 2023 Improve Your Business?](https://dev.to/omdevsinhgohil/how-can-mobile-app-development-trends-2023-improve-your-business-1ki8)
solidity 101
Tags: web3, solidity, blockchain
Published: 2022-09-06 13:23:06

- Data types

- Variables

- Constants

- Immutables

## Data types
Mainly we have 4 types of data types in solidity language.

- boolean
- uint
- int
- address <br>

### boolean: 
As we know we can specify a variable is true or false.

### uint:
Its stands for unsigned integers. we can specify only a non negative integers. <br/>
uint can have a range of sizes like uint8, uint16 ... uint256
uint8 = 0 to 2**8-1. same goes with others.

### int:
As we know we can specify an integer and negative numbers are allowed for int type. like uint here also we can specify a range of different sizes.

### address:
address holds a 20 byte value which is the size of a ethereum address. additionally we can specify as `address payable` which can transfer or send fund to the address.


```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

contract ExampleDataType {

 bool public boo = true;
 uint public age = 27;
 int public num = -3;
 address public addr = 0x8CA434018A6d.....;

}

```

## Variables
Variables are containers where we store some data. we have three type of variables.

- state
- local
- global <br/>

### state:
State variables are declared inside a function and not stored in the blockchain.

### local:
Local variables are declared outside of the function and stored in the blockchain.

### global:
Global variables provides information about the blockchain.

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

contract ExampleVariable {

  string public name = "jon doe"; // state variable.

  function changeName() public {
     uint pin = 500082;  // local variable
     address sender = msg.sender; // global variable
  }

}
```

## constants
constants are variables that can not be modified. Their value is hard coded and using constants we can save gas.

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

contract ExampleConstants {

   address public constant ADDR = 0xee3445e...;
   uint256 public constant MAX_NFT = 1000

}
```

## Immutable
immutable variables are like constants. Value of immutable variables can be set inside the constructor but can not be modified afterwords.

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

contract ExampleConstants {

   address public immutable MY_ADDRESS;
   
   constructor() {
       MY_ADDRESS = msg.sender;
   }

}
```
https://github.com/bibhu-padhy/learn-web3
Cumulocity alarm to a Service Now incident
Tags: servicenow, iot, integration, tutorial
Published: 2022-10-21 10:09:25

---
title: Cumulocity alarm to a Service Now incident
published: true
date: 2022-09-06 13:17:23 UTC
tags: servicenow, iot, integration, tutorial
canonical_url: https://tech.forums.softwareag.com/t/cumulocity-alarm-to-a-service-now-incident/263398
---

 

## Introduction

This article describes the step-by-step process of creating an incident in ServiceNow when an Alarm is created for a device in Cumulocity IoT.

## Pre-requisite

- Working [Service Now](https://www.servicenow.com/) account
- Working [Cumulocity tenant](https://www.softwareag.cloud/site/product/cumulocity-iot.html#/)
- Working [webMethods.io](http://webmethods.io/)Integration cloud tenant.

## Steps to follow

1. Login to [webMethods.io](http://webmethods.io/)Integration tenant.
2. Create a new project or choose an existing project.
3. Click on Import icon on the top right corner to import the workflow into your project.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/b/d/bd538c299fc2bc8206d5648b1f9fcdaca3b8d5d5_2_690x261.png)
4. Select the archive file “CumulocityAlarm\_ServiceNow.zip” shared in the article.
5. The workflow name and description are preloaded.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/f/0/f03e308e4eafd4089d25a3503f8393f9fbeda0a7_2_690x292.png)
6. Add the account information for Service Now or select an existing account from the project.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/6/2/625bdac8ddccd645a994b03a55ae712f6cb3fa1f_2_690x336.png)
7. Add the account information for Cumulocity or select an existing account from the project.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/c/d/cd1dc01458243351bd7eb4740d6dc0aae27c69f7_2_690x326.png)
8. Once the accounts are selected import the workflow.
9. Click on “Import” to import the workflow into your project. The flow should get imported and enabled.
10. Review the mappings and modify if needed.
![image](https://aws1.discourse-cdn.com/techcommunity/optimized/3X/a/5/a5357ab774ecd694ed032a3008b0759d31d2a853_2_690x378.png)
11. Test the workflow.
12. You can login to cumulocity and trigger an alarm and test the flow end to end.

## Next steps

Review other [global Presales articles here](https://tech.forums.softwareag.com/tag/global-presales).

## Useful links | Relevant resources

[Shopify Customer to a New Contact in MS Dynamics - Knowledge base - webMethods - Software AG Tech Community & Forums](https://tech.forums.softwareag.com/t/shopify-customer-to-a-new-contact-in-ms-dynamics/259594/3)

[Read full topic](https://tech.forums.softwareag.com/t/cumulocity-alarm-to-a-service-now-incident/263398)