teleren/devto huggingface dataset:
Beginner programming Tip
Tags: javascript, react, programming, beginners
Published: 2022-09-12 06:37:43

Hi every one His is **Madhusudhan** Very happy to read my post. without wasting of your time. let us start quickly I am **front-end developer** and also **React.js developer**.   
 
Has I Started learning Programming. I used not learn the topice that much In place of that I used to learn the method like build the project how should be the code structure after few days I am unable to recognize code. That moment I have stopped my self and I have borroowed Time for me and start trying different method to learn. then I realise. What is the problem with me and correct it with learnig topice. I suggest for beginner programmer not do the same mistake which I have done. Last Impotant point Do not doorstep the tutorial cycle. About that mistake and how to stay way from that I will explain next time. 


Thank You 
For Reading Please try to comment 
Madhusudhan
Comments in VsCode!
Tags: vscode, programming, javascript, flutter
Published: 2022-09-12 06:30:41

The "Better Comments" extension for VsCode is amazing to make your comments stand out 👌

Helps to always locate the most important information first 🔥


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/acvguyeuxa2vg45owizj.jpg)
Google action fetching data from an API
Tags: googlecloud, javascript, beginners
Published: 2022-09-12 06:16:17

Now that we have our action triggered programmatically let's see how we can get the response data from an API.

This way, we can make it a bit more interactive.

If you'd like to follow along, please complete the [previous article](https://daily-dev-tips.com/posts/google-actions-via-cloud-function/) first.

## Fetching API data in a google action

The cool part now that we have our action using a function is that we can use all kinds of node goodies.
One of these goodies is the fetch API.

Let's use a placeholder API first, so it's easier to test.

Open up your action and start by adding the fetch API.

```js
const fetch = require('node-fetch');
```

Then inside our greeting function, we should convert it to an async function.

```js
// Previous
app.handle('greeting', (conv) => {});

// New
app.handle('greeting', async (conv) => {});
```

Now that our function is asynchronous, we can await the fetch; since it's direct JSON we can await the JSON conversion as well like this:

```js
app.handle('greeting', async (conv) => {
  const response = await fetch('https://jsonplaceholder.typicode.com/posts/1');
  const text = await response.json();
});
```

And then, we can modify our response card to return this data instead of the static data.

```js
app.handle('greeting', async (conv) => {
  const response = await fetch('https://jsonplaceholder.typicode.com/posts/1');
  const text = await response.json();

  conv.add(
    new Card({
      title: text.title,
      text: text.body,
      image: new Image({
        url: 'https://daily-dev-tips.com/images/logo.png',
        alt: 'Daily Dev Tips logo',
      }),
    })
  );
});
```

You can now save and deploy your function, be sure to wait a minute or so for it to deploy.
Then test your function and see it in action!

![Google action calling API](https://cdn.hashnode.com/res/hashnode/image/upload/v1662132536836/PmQSGQ_BC.png)

And that's it. We now added an API call to our Google action!
Pretty cool stuff, if I may say so.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
How to Find The Frequency of Characters in a String or Array
Tags: algorithms, programming, javascript, java
Published: 2022-09-12 05:46:58

In this post I am going to tech you how to find the frequency of characters in a string or array. This is a common question in interviews. I will be explaining the code in **Java** and **JavaScript**. 

## Question prompt 

> Write a function, charFrequency, that takes in a string/array as an argument. The function should return the the frequency of each character in the string/array then return the answer as map or dictionary.  
> You can assume that the input string is non-empty.

**example_00**

```
mostFrequentChar('david'); -> Map={ 'd' => 2, 'a' => 1, 'v' => 1, 'i' => 1 } 
```
**example_01:**

```
mostFrequentChar('bookeeper'); // -> Map= { 'b' => 1, 'o' => 2, 'k' => 1, 'e' => 3, 'p' => 1, 'r' => 1 } 
```

## JavaScript Solution

```
const charFrequency = (str) => {
  
  //create a map to save the characters and save the frequency of each character
  const frequencyMap = new Map();
  //go through each character in the string 'str' 
  for(let char of str)
    {
      //check if our map doesn't contain the current character we are going through
      if(!frequencyMap.has(char))
        {
          //if our map doesn't contain the character we add it and assign the frequency to 1      
          frequencyMap.set(char,1);
        }
      //check if our map does contain the current character 
      else
        {
          // if our map contains the current character we are going to add 1 to the character frequency value
          //example, if we had 'd' => 1, we are going to get the value of 'd' and add 1 to it
          // so 'd' frequency value beacomes 2 
          frequencyMap.set(char,frequencyMap.get(char)+1);
        }
    }
  
  //return the frequencyMap we created 
  return frequencyMap;
}

```

## Java Solution

```
public String frequencySort(String str) {
  //create a map to save the characters and save the frequency of each character
  HashMap<Character,Integer> frequencyMap = new HashMap();
  //go through the string 'str' 
  for(char ch : str.toCharArray())
    {
      //check if our map contains the current character we are going through
      if(!frequencyMap.containsKey(ch))
        {
          //if our map doesn't contain the character we add it and assign the frequency to 1      
          frequencyMap.put(ch,1);
        }
      //check if our map does contain the current character 
      else
        {
          // if our map contains the current character we are going to add 1 to the character frequency value
          //example, if we had 'd' => 1, we are going to get the value of 'd' and add 1 to it
          // so 'd' frequency value beacomes 2 
          frequencyMap.put(ch,frequencyMap.get(ch)+1);
        }
    }
  
  //return the frequencyMap we created 
  return frequencyMap;
}

```
This is how we get the frequency of characters in a string or array. If you have any questions, please let me know in the comments section. Also consider following me on [Twitter](https://twitter.com/Gilfoyleoffical) if you want more content like this.
Make Flash Drive as Read Only Like DVD Drive (CMD)
Published: 2022-09-12 06:13:59

I have an important file on my flash drive and I want to make it read only

My best option is use DISKPART form windows, run this code on CMD
```
DISKPART
```

To check which flash drive listed as disk in windows
```
LIST DISK
```

It should be disk 1 if you have single hardisk attached to computer, disks naming starts from 0 but partition starts from 1
```
SELECT DISK 1
```

Set as read only
```
ATTRIBUTES DISK SET READONLY
```

---

## Reference

- [superuser.com](https://superuser.com/questions/184004/make-a-usb-drive-read-only)
Everything you need to know about Binary
Published: 2022-09-12 06:11:55

## What is binary?
There are only two numbers in the binary number system: 0 and 1. Any number can be counted in binary. To make binary more readable, here is a quick translation of binary numbers into base 10 (decimal) numbers.
0 is equivalent to 0, while 1 is equal to 1. Since it is technically impossible to write anything more than 1, we must start afresh in a new column in order to construct the number 2. we write "10". Similar to how 11 cannot be written as a single number (unless you count in base systems more than 10).
Logic frequently uses binary, where 0 denotes False or Off and 1 denotes True or On.
The process of going from binary to decimal is rather simple. There are two popular methods.

## First method

Write down the decimal number and divide by 2 continually to give a result and a remainder of either a “1” or a “0” until the final result equals 0.
For example , we have number 294.

If we divide each decimal by "2" will give a result plus a reminder. If the decimal number being divided is even then the result will be whole and the remainder will be equal to "0". If the decimal number being divided is even then the result will be whole and the remainder will be equal to "0". If the decimal number is odd then the result will not divide completely and the remainder will be a "1". The binary result is created by sorting all the remainders from least significant bit to most significant bit, starting at the top and ending at the bottom.

## Second method

The study of powers of two is crucial to computer science. Since binary is represented by two integers, a system with three circuits will contain 23 numbers, ranging from 0 to 7.

Two is a power of:

2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192

The list of integers we need to know changes to: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 when we add 1 to produce an odd number.
Let's imagine we wish to express the number 15 in binary. First, we must divide 15 into powers of 2 and 1 so that it may be constructed. The 2 power closest to it that is less than  15 is 8, so we’ll use that. 8 + 4 is 12. 8 + 4 + 2 is 14, so we’re very nearly there! Now we just add a 1. 15 represented as powers of 2 is 8 + 4 + 2 + 1.
 The binary numbers would then ordinarily need to be reversed, but since they are all 1s in this case, we don't need to do that. If we don't read binary with the largest order of magnitude to the left, rather than the lowest, we will end up with the incorrect binary number. The 1 is one position higher than the 0 in binary, just like it is in the number "10," and vice versa.

Decimal to binary conversion is possible using the reverse procedure.
Format Flash Drive as UDF (CMD)
Published: 2022-09-12 06:06:35

UDF is file system for DVD drive, but I want use it for my flash drive :)

Just use this command on CMD

```
format G: /fs:UDF /q
```
change `G` with your flash drive mount directory

---

## Reference

- [www.getusb.info](https://www.getusb.info/how-to-format-a-flash-drive-as-udf-windows-7-10-solution/)
Connect to your Linux EC2 instance using SSH + Visual Studio Code
Tags: vscode, ssh, ec2
Published: 2022-09-12 05:58:02

In this blog post i'll show you how to configure **VS Code** to allow remote development for Linux based EC2 instances hosted on AWS.

On the rare occasion that I need to connect to Linux based EC2 instances, I normally use [Session Manager]( https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html) through the **AWS Management Console** or use the [Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html).

Recently I had to take part in a web development project, the remote development environment ran on an EC2 instance. I had no desire of using the **VI text editor** (that's too hardcore) and preferred to use **VS Code** from my MacBook Pro as it has some pretty useful extensions installed.

# ***Pre-requisites:*** #
<br>

• **AWS Account**
• **Visual Studio Code**

<br>

This blog post assumes the reader has some basic knowledge of **SSH** and is using macOS or a Linux based OS.

To get started you'll need an **SSH Config file**, on macOS it can be located in the **~/.ssh** directory. I've created a new EC2 instance, new key-pair and moved the private key from the **Downloads** directory to the **~/.ssh** directory.

To modify the **config file**, use the below commands:

```
cd ~/.ssh
code config
```

Let's add a new section containing our EC2 details. The section must conform to the below structure:

```
Host {Friendly Name Used for identification}
    HostName {Public DNS of EC2 instance}
    User {username}
    IdentityFile {location of private key}
```
<br>
<br>

![SSH Config](https://adrianthegreat.com/images/SSHConfig.png)


Next you'll need to install the [Remote - SSH]( https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) Extension in VS Code. 

Once installed, you'll notice the **Remote Explorer** icon appear on the **Activity Bar**, select the icon, this will bring the **Primary Side Bar** into view. 

From the dropdown, select **SSH Targets**, a list of SSH Targets will be listed.

Right-click the **SSH target**, you'll be presented with 2 options: **Connect to Host in Current Window** and **Connect to Host in New Window**.

<br>

![Remote Explorer](https://adrianthegreat.com/images/RemoteExplorer.png)

<br>

You will then be prompted to verify the fingerprint. Select **Continue**. 

![SSH Fingerprint](https://adrianthegreat.com/images/Fingerprint.png)


<br>

On the bottom left corner of VS Code, the **Status bar** will indicate the connection status.

<br>

![Session](https://adrianthegreat.com/images/SSHSession.png)

<br>

That concludes this blog post where I showed how to configure **VS Code for Remote Development** for Linux based EC2 instances hosted on AWS.
948 leetcode solution in CPP
Tags: cpp
Published: 2022-09-12 05:51:34

```
class Solution {
 public:
  int bagOfTokensScore(vector<int>& tokens, int power) {
    int ans = 0;
    int score = 0;
    int i = 0;                  // index of smallest token
    int j = tokens.size() - 1;  // index of largest token

    sort(begin(tokens), end(tokens));

    while (i <= j && (power >= tokens[i] || score)) {
      while (i <= j && power >= tokens[i]) {
        // play the smallest face up
        power -= tokens[i++];
        ++score;
      }
      ans = max(ans, score);
      if (i <= j && score) {
        // play the largest face down
        power += tokens[j--];
        --score;
      }
    }

    return ans;
  }
};

```

#leetcode
#challenge
here is the link for the problem: 

https://leetcode.com/problems/bag-of-tokens/
How to Fix a 403 Forbidden Error When Using Search Systems Logs Card
Tags: nocode, workflows, okta, automation
Published: 2022-09-12 18:54:22

---
title: How to Fix a 403 Forbidden Error When Using Search Systems Logs Card
published: true
date: 2022-09-12 05:11:11 UTC
tags: NoCode,Workflows,okta, automation
canonical_url: https://maxkatz.net/2022/08/25/how-to-fix-a-403-forbidden-error-when-using-search-systems-logs-card/
---

[Okta Workflows](https://www.okta.com/platform/workflows/) how-to guides are questions and answers from weekly community [office hours](https://calendly.com/oktaworkflows/group-office-hours-okta-workflows), MacAdmins [Workflows Slack channel](https://www.macadmins.org/), and other places. 

Read all the other how-to guides ⤵️
{% embed https://dev.to/oktaworkflows/all-okta-workflows-how-to-guides-4nl9 %}

On to the question. 

**_How to fix 403 Forbidden error when_ using Search Systems Logs card?**

**Okta – Search Systems Logs** card allows you to search the Okta log by a keyword (and also expression, set in **Options** ):

[![Search Systems Logs card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs.png?w=407)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs.png)
<figcaption>Search Systems Logs card</figcaption>

When a run a flow with this card, you might get a **403 Forbidden** error:

[![403 Forbidden error with Search Systems Logs card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs_error.png?w=498)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs_error.png)
<figcaption>403 Forbidden error with Search Systems Logs card</figcaption>

To fix this error you need to grand an additional scope to the Okta connection.

1. From the **Admin Console** , go to **Applications > Applications**
2. Click on **Okta Workflows OAuth**
3. Open **Okta API Scopes** tab
4. Find **okta.logs.read** scope and click **Grant**
5. For this scope to take affect, you need to reauthorize the connection being used

[![Granding a scope to a connection](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs_grant.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs_grant.png)
<figcaption>Granding a scope to a connection</figcaption>

After you reauthorize, run the flow again. The card is now able to search the logs:

[![Search Systems Logs card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs_success.png?w=624)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_search_logs_success.png)
<figcaption>Search Systems Logs card</figcaption>

🙏🏼 _Thanks to Bryan Barrows ([LinkedIn](https://www.linkedin.com/in/bbarrows89/), [blog](https://dev.to/bryanbarrows)) who helped with this question on [MacAdmins](http://macadmins.org) Slack channel._

* * *

**More resources to help you learn** :

📺 Short how-to [Workflows videos](https://youtube.com/playlist?list=PLIid085fSVdvyK8F4xuk49EchBPmAVNHG) to help you become a better automation builder.

🍭 A collection of helpful [Workflows tips](https://maxkatz.net/okta-workflows-tips/).
Laravel 8 Many To Many Polymorphic Relationship
Tags: laravel, laravel8, polymorphic, relationship
Published: 2022-09-12 04:47:16

In this article, we will see laravel 8 many to many polymorphic relationships. 

Many to many polymorphic relationships are more complicated compared to morph one and morph many relationships.

Many to many polymorphic relationships can use in laravel 6, laravel 7, and laravel 8 and for access, many to many polymorphic relationships use morphToMany() and morphedByMany().

In this example, we will create migration for posts, taggables, and videos and also create model Post, Taggable, and Video. Also, see create records, retrieve records, and attach records.
game online
Tags: games
Published: 2022-09-12 04:06:39

สล็อตออนไลน์ (SLOT ONLINE) คือ เกมเดินพันที่มีพื้นฐานมาจาก เกมตู้สล็อต joker gaming ในบ่อน เป็นเลิศในเกมเสี่ยงดวงที่ได้รับความนิยยมอย่างล้นหลาม โดยที่สล็อตออนไลน์ ได้เงินจริง จะมีเกมอยู่หลายแบบแล้วก็มีวิธีการเล่นที่ไม่เหมือนกัน ขึ้นกับความชื่นชอบและก็ขั้นตอนการเลือกของนักพนันว่าจะแบบไหน [ambbet](https://ambslot.site/) แล้วก็นอกเหนือจากนั้น เกม สล็อตออนไลน์ ยังมีระบบระเบียบ สล็อตโจ๊กเกอร์ ทดสอบเล่นสล็อตออนไลน์ คือระบบที่คุณสามารถเข้าไป  ทดสอบเล่นสล็อต PGSLOT, SLOTXO และ JOKER แบบไม่เสียเงินเสียทองได้อีกด้วย รวมทั้ง เกมสล็อต นั้นมีเกมที่ค่อนข้างจะพนันง่ายยิ่งกว่าเกมอื่นๆแค่เพียงคลิกหมุนสปิน แล้วก็รอคอยลุ้นผลเงินรางวัลก็สามารถพนัน [สล็อต](https://slotgame.casino/)  ได้แล้ว สำหรับเกม สล็อตออนไลน์ SLOT ONLINE เล่นง่าย ได้เงินจริง เป็นเกมพนันที่มีนานาประการต้นแบบ ที่นักปรับปรุงเกม สล็อตออนไลน์แต่ละค่ายนั้นกระทำการวางแบบมา pg slot แล้วก็ขึ้นกับพวกเราว่าจะเลือกเล่น เกมสล็อตออนไลน์ แบบไหน โดยแบบอย่างการเล่นของเกมพนันจำพวกนี้นั้นเป็น ผู้เล่นควรต้องกระทำเพิ่มเงินเข้าไป [slot](https://slotgame.casino/) เพื่อทำลงพนันตามลักษณะของ เกมสล็อต นั้นๆแล้วก็ ขั้นตอนการเล่น เป็น ผู้เล่นจึงควรทำกดหมุนสปินให้ได้รูปหรือเครื่องหมายที่สล็อตออนไลน์ ambslot เกมนั้นได้กำหนดไว้เมื่อหมุนไปได้ตรงตามข้อตกลงของเกมคุณก็จะได้รับเงินรางวัลกลับมา ambbet นอกเหนือจากนั้น เกมพนันสล็อต ถือได้ว่าเกมพนันออนไลน์ที่เล่นง่าย jokergaming ได้เงินไวสุดๆโดยที่ผู้เล่นสามารถกระทำพนัน สล็อตออนไลน์ ได้เงินจริง กับเว็บของพวกเราเว็บไซต์ [SLOT GAME](https://slotservice.net/) ได้ตลอดวัน
SwitchCenter (beta) is now free!
Tags: macos, productivity
Published: 2022-09-12 03:54:38

## SwitchCenter: Next-gen OSX Control 

Hi everyone! We're proud to announce that SwitchCenter beta is now available to download for free! 

SwitchCenter is an alternative to OSX Mission Control. It features predictable and efficient window switching, window controls, widgets, and more.

https://switchcenter.app/
ML.NET, Azure Function, Power Apps – Pro-code | No-code | Low-Code - ES
Tags: machinelearning, dotnet, azurefunctions, spanish
Published: 2022-09-12 03:43:24


![Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uwbk3hegpzf3rukx4jqi.png)
En este fin de semana post mi cumpleaños les quiero compartir esta pequeña prueba de concepto, en la cual quise integrar algunas de mis pasiones ML. NET, Azure Function y Power Apps.

Como primer paso he creado un modelo desde ML.NET con Model Builder seleccionando ¨Select Value prediction Scenario¨, les dejo el link de una publicación en donde te va a explicar paso a paso. ([ML.NET & Model Builder and (Bonus Track) ASP.NET App to consume the model. Enjoy it! 🤟 - DEV Community 👩‍💻👨‍💻](https://github.com/ppiova/STEMsalaries.ML.NET) )

El siguiente objetivo fue poder realizar inferencias y predicciones al modelo desde la nube, para eso utilice Azure Function. Les comparto el link del repositorio de mi GitHub ([ppiova/STEMsalariesAzureFunctions](https://github.com/ppiova/STEMsalariesAzureFunctions/tree/main/STEMsalariesFunction))
Lo único que tienen que hacer es publicar Azure Functions en Azure. (Si lo desean en los comentarios, en un próximo post hago un paso paso como realizarlo).

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

Hasta aquí ya tengo mi modelo de Machine Learning, además esta publicada la function en Azure como una API, utilizando Postman puedo testear y realizar predicciones con mi modelo.

![PostMan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vu3a3shmjy4ajlchphd8.png)
¿Y ahora?, Y ahora para poder llamar esta API publicada en Azure Function he creado un [Custom Connector ](https://docs.microsoft.com/en-us/training/modules/get-started-custom-connector/)que luego lo agregaré en mi Aplicación creada con Power Apps.

Les comparto el link de Github ( [ppiova/PowerAppsSTEMSalaries](https://github.com/ppiova/PowerAppsSTEMSalaries)) en donde encontraran el archivo json para crear el Custom Connector, un archivo xlsx para importarlo en la creación de la lista de SharePoint en donde guardaran las predicciones realizadas y por último nuestra frutilla del postre, haha, la aplicación desarrollada en Power Apps.

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

Eso es todo amigos, si tienen dudas de cómo realizar este proceso, me escriben por mis redes, o en los comentarios.


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

Próximamente además de publicar posts voy a empezar un nuevo proyecto personal en compartir contenido desde mi canal de YouTube. Les dejo el link [Pablito Piova - YouTube](https://www.youtube.com/channel/UCRqittEn8NT15dSInE6sSNg), Suscríbanse! 😊