teleren/devto huggingface dataset:
N-Queen - All Possible Placements
Tags: javascript, leetcode
Published: 2022-08-21 07:21:00

This solution is more specific to leet code problem.
If you want only solution for possible option please print board array- or Refer - [N-Queen : Check if possible to place in NxN](https://dev.to/zeeshanali0704/n-queen-check-if-possible-to-place-in-nxn-98c)
```
const N = 4;
let allPossibleArray = [];

function isSafe(board, row, col, N) {
  for (let i = row - 1; i >= 0; i--) if (board[i][col] == 1) return false;

  for (let i = row - 1, j = col - 1; i >= 0 && j >= 0; i--, j--)
    if (board[i][j] == 1) return false;

  for (let i = row - 1, j = col + 1; i >= 0 && j < N; i--, j++)
    if (board[i][j] == 1) return false;

  return true;
}

function solveNQUtil(board, N, row) {
  if (row === N) {
    let tm = [];
    for (let i = 0; i < N; i++) {
      let s = "";
      for (let j = 0; j < N; j++) {
        if (board[i][j] == 1) s += "Q";
        else s += ".";
      }
      tm.push(s);
    }
    allPossibleArray.push(tm);
  }

  for (let col = 0; col < N; col++) {
    if (isSafe(board, row, col, N) == true) {
      board[row][col] = 1;
      solveNQUtil(board, N, row + 1);
      board[row][col] = 0;
    }
  }

  return false;
}

function solveNQ() {
  let board = [
    [0, 0, 0, 0],
    [0, 0, 0, 0],
    [0, 0, 0, 0],
    [0, 0, 0, 0],
  ];
  solveNQUtil(board, N, 0);

  return allPossibleArray;
}

console.log(solveNQ());

```
m1 macのc++でOpenGLを使ってテトリスを作ってみた
Tags: cpp, opengl, glfw, tetris
Published: 2022-08-21 08:09:00

m1 macの、c++とOpenGLで簡易的なテトリスを作りました。

![thumb](https://user-images.githubusercontent.com/89882017/185781360-88bbbada-200b-4027-9e5a-2435e5a6da31.png)

---

## リポジトリ

- https://github.com/web3ten0/cpp-opengl-tetris

---

## 実行してみてる動画

- https://user-images.githubusercontent.com/89882017/185777309-9afa6109-ba77-42e9-bd1e-2e37c981b26a.mp4
- https://www.youtube.com/watch?v=X1YzFl31W7c

---

## 動作環境
- m1 mac

```shell
❯ uname -a
Darwin mac.local 21.6.0 Darwin Kernel Version 21.6.0:
Sat Jun 18 17:05:47 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T8101 arm64

❯ brew config
HOMEBREW_VERSION: 3.5.9
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 13.1.6 build 1316
macOS: 12.5-arm64
CLT: 13.4.0.0.1.1651278267
Xcode: 13.4.1
Rosetta 2: false
```

---

## Install〜実行

### GLFWをインストール

```shell
brwe install glfw
vim ~/.zshrc
# 下記を追加
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
```

### リポジトリをclone

```shell
git clone https://github.com/web3ten0/cpp-opengl-tetris.git
```

### binディレクトリ作成、make、実行

```shell
cd cpp-opengl-tetris
mkdir bin
make
./bin/main
```
Perks Of Learning Solidity !
Tags: blockchain, solidity, web3, webdev
Published: 2022-08-22 08:17:42

Unless you’ve been living under a rock for the past few years, then you’ll know that Web3 and blockchain are being talked about as the future of the internet, Fintech, and more. Heck, **Web3** literally refers to the newest iteration of the internet or ‘Web 3.0’.

Why should we care?

Because being able to understand and work with the underlying **blockchain technology** that powers this change will reap huge rewards down the line, as well as being very lucrative even today.
We don't need to sell monkey pics 🙉 to make money from this technology.

With that in mind, you’ve probably already been looking at a few Web3 focused languages to learn, and one of the forerunners that I recommend is Solidity, an object-oriented, high-level programming language, built for the Ethereum blockchain platform.
Solidity is the perfect next step for Developers with experience in either Python or Javascript, but it’s also relatively easy enough to learn (when following a set training program) that even beginners can pick it up with no prior experience.

Sounds good right?
Well, it gets better! 

Let me list some of the reasons why one should explore this technology.

**Reason #1️ To finally understand those blockchain/crypto/NFT memes!
**

- There’s multiple meta-level memeing happening here! learning Solidity will give you an understanding of blockchain, which is the core foundation of all Web3 technology

**Reason #2️ Solidity is the best introduction to the world of blockchain**

- The Solidity language itself is a high-level (similar to how people talk), so it’s not too complex and was specifically designed for working with blockchains. Fortunately, though, Solidity makes for the perfect entry into this world.

**Reason #3️. Learning Solidity will allow you to create Smart Contracts**

- Of course, the only direct reason to learn Solidity is so you can write smart contracts.

**Reason #4️. Solidity works with the Ethereum Virtual Machine, which is used everywhere! (Even with other independent and layer-2 chains)**

- The EVM or Ethereum Virtual Machine is the software platform developed by Ethereum, that allows Developers to create decentralized applications (DApps).

**Reason #5️. Solidity is the main programming language for DeFi (Decentralized Finance)**

- Solidity powers most DeFi applications, meaning that there is a heap of job opportunities for Solidity Developers in this field.

**Reason #6️. Blockchain Developers are in high job demand + very well paid !!**

- Just being a Software Engineer already puts you in high demand, but Solidity Developers are even rarer.In a recent survey it was found that the best programming languages to learn in 2022 is Solidity and was also the highest-paid language, starting at $112,000 and ramping up to $166,000 USD.

**Reason #7️. Remote work!**

- Decentralized, asynchronous work from any location and for high pay? Yes, please!
Overview of Stripe Treasury
Tags: payments, baas, stripe
Published: 2022-08-22 13:06:00

{% youtube https://youtu.be/2MiMFJ9c4t8& %}

## What you’ll learn

In this livestream, we'll walk through an [example Stripe Treasury application](https://github.com/stripe-samples/treasury-nextjs) that shows how to work with Financial Accounts, Balances, and moving money.

## Who this video is for

This video guide is primarily for developers interested in embedded finance, banking as a service, or Stripe Treasury. 

## How to follow along

If you want to work alongside the video, you’ll need a [Stripe account](https://dashboard.stripe.com/register) and a Node environment to work in. 

## Resources
- [Treasury documentation](https://stripe.com/docs/treasury)
- [Code for the demo](https://github.com/stripe-samples/treasury-nextjs)


## Stay connected

**You can stay up to date with Stripe** **Developer updates** **in a few ways:**

- 📣Follow [@StripeDev](https://twitter.com/stripedev) and [our team](https://twitter.com/i/lists/1459720002567868418) on [Twitter](https://twitter.com/StripeDev)
- 📺 Subscribe to our [Youtube channel](https://www.youtube.com/StripeDevelopers)
- 💬 Join the official [Discord server](https://discord.com/invite/RuJnSBXrQn)
- 📧 Sign up for the [Dev Digest](https://go.stripe.global/dev-digest)
Create Simple Personal Finance App by AppSheet
Tags: lowcode, googleappsheet
Published: 2022-08-23 01:33:00

I will show its change in a few later posts when more data goes in and after fine-tuning the user interface.

![Entry Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ee9sq4ane7msl1r3z1bs.jpg)

![Money Inflows](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sybtaik4ed2zmxdawuym.jpg)

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

![Spending in Calendar View](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sq3j9275j5804mi08upd.jpg)

![Adding New Entry for Spending/Income](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y40oal3at8duai8za1wj.jpg)
With great scale comes great observability
Tags: ecs, observability, microservices
Published: 2022-08-23 07:47:46

---
title: With great scale comes great observability 
published: true
description: How to deploy microservice applications to AWS ECS, identify and troubleshoot issues using distributed tracing.
tags: ecs, observability, microservices
# cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49bf3kduhpbceneymube.png
# Use a ratio of 100:42 for best results.
---

Building on Microservices is a great way to deploy applications that can scale with rapid adoption. Scaling modern microservice applications generates a large amount of logs and metrics data on multiple levels, having the right tools to manage them all is integral to microservices success. Modern architecture needs a new approach and for microservices, distributed tracing brings monitoring into the modern world of observability.

Join us for the live session, 31st of August 9am ET

In this live geek out session, we will get hands on deploying a multi-microservices application to AWS ECS and use distributed tracing to find, track and troubleshoot issues

[Click here to find out more](https://info.lumigo.io/webinar-distributed-tracing-microservices)
HOF in go
Published: 2020-06-10 05:12:19

Higher Order Function คือคุณสมบัติที่ function สามารถรับ parameter หรือคืนค่าเป็น function ได้ ซึ่งจะสัมพันธ์กับเรื่อง First Class Function และสัมพันธ์กับเรื่อง Closure Function และเป็นเรื่องที่ทำให้โปรแกรมเมอร์ที่ไม่คุ้นเคยกับ concept ทำนองนี้ต้องทำความเข้าใจมากพอสมควร

เวลาผมคิดถึงเรื่อง HOF หรือ First-class จำเป็นจะต้องแยกเรื่อง literal ออกไปให้ชัด เพราะถ้าเรามัวแต่ไปจ้องที่รูปร่างหน้าตาของมัน จะทำให้งง ยกตัวอย่างเช่น

```go
func hof(fn func(string) string) {
    ...
}
```

เวลาเจอแบบนี้ ให้มองให้ออกว่า ตรงไหนคือ type โดยให้เทียบกับการประกาศแบบ primitive type ธรรมดาเช่น

```go
func normal(s string) {
    ...
}
```

ให้มองให้ออกว่า `fn func(string) string` ก็เหมือนกับ `s string` การจะทำให้มองสิ่งนี้ง่ายขึ้น เราจึงเห็นการสร้าง type แบบนี้
```go
type doSumethingFunc func(string) string

func hof(fn doSumethingFunc) {
    ...
}
```

ในโลกของ go เราเห็น HOF บ่อยๆเวลาทำ Wrapper หรือ Middleware ยกตัวอย่างเช่น echo MiddlewareFunc จะมีหน้าตาแบบนี้

```go
type HandlerFunc func(Context) error

type MiddlewareFunc func(HandlerFunc) HandlerFunc
```
เวลาจะเขียน middleware เราก็จะเห็นโค้ดหน้าตาแบบนี้

```go
func Middleware(next echo.HandlerFunc) echo.HandlerFunc {
    return func(c echo.Context) error {
        ...
        next(c)
        ...
    }
}
```

วิธีมองให้ดูว่าฟังก์ชั่น Middleware เป็น HOF ที่รับ echo.HandlerFunc เป็น parameter และคือค่าออกเป็นเป็น type เดียวกับที่รับเข้ามา และด้วยเหตุนี้ ปกติใน go ก็มักจะเขียน return ค่าเป็น anonymous function ที่มีหน้าตาตรงกับ return type ซึ่ง `HandlerFunc` ก็คือ `func(Context) error`

ในฟังก์ชั่นนี้ เราสามารถเขียนสิ่งที่ต้องการทำก่อน และหลังการทำงานของ next ซึ่ง next นี่ก็คือ handler ตัวที่ทำงานเป็น business logic หลักที่เราตั้งใจเขียนให้ทำงานจริงๆ เพราะฉะนั้น ไม่ว่าเราจะทำอะไรก็ตามในฟังก์ชั่นนี้จะต้องไม่ลืมสั่งให้มันทำงานตามที่มันควรทำ ซึ่งก็คือ `next(c)` นั่นเอง
axios HTTP request
Tags: axios, node, javascript
Published: 2022-08-23 15:37:11

Hi,

I am making an HTTP request through an azure function to invoke a web service in node.js with axios.

This is what this request looks like :

```
module.exports = async function () {
  const axios = require("axios");
  const data = {
    appUser: "YAMENEDEL",
  };
  const headers = {
    Authorization:
      "Basic WUFNFEWWWRQEQ......",
  };

  {
    axios
      .post(
        "https://tegosGetPutawaysByAppUser?company=grundon",
        data,
        { headers: headers }
      )
      .then((response) => {
        //return (response.data);
        console.log(`Status: ${response.status}`);
        console.log("data: ", response.data);
      })

      .catch((err) => {
        console.error(err);
      });
  }
};
```

when to test this request on postman it will return 200 response and will see the data in my VS code terminal screen but not in the body response of the client. I tried to return data this way but didn't work `return (response.data);`

As you can see below a snippet of the postman request with an empty body response !
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hek0nvzvf3xz0mbjykws.png)

Secondly, in the body for this request I am hardcoding the value of the `appUser`. However, if I want to run this request on postman and pass the JSON value in the body for `appUser` - what changes do I need to do in the code so the param value can pick up what is being passed. I tried the following `appUser: { type: String, default: null }` but it was a failed attempt !
All Okta Workflows How-To Guides
Tags: nocode, okta, workflows, ipaas
Published: 2022-08-23 19:25:00

{% embed https://dev.to/oktaworkflows/how-to-remove-office-365-license-from-a-user-account-after-being-suspended-for-a-certain-time-lmh %}

{% embed https://dev.to/oktaworkflows/how-to-iterate-over-rows-in-a-table-in-okta-workflows-1hfd %}

{% embed https://dev.to/oktaworkflows/how-to-setup-a-workflows-helper-flow-with-for-each-and-streaming-cards-3k96 %}

{% embed https://dev.to/oktaworkflows/how-to-list-users-assigned-to-an-application-and-save-users-into-a-table-24g5 %}

{% embed https://dev.to/oktaworkflows/how-to-delete-multiple-table-rows-1b67 %}

{% embed https://dev.to/oktaworkflows/how-to-run-a-flow-just-once-or-manually-3ppb %}

{% embed https://dev.to/oktaworkflows/how-to-call-an-api-when-its-not-available-from-an-existing-card-connection-4h84 %}

{% embed https://dev.to/oktaworkflows/how-to-create-a-custom-list-filter-in-okta-workflows-27d0 %}

{% embed https://dev.to/oktaworkflows/how-to-create-a-custom-slack-connection-in-okta-workflows-connector-builder-2c1i %}

{% embed https://dev.to/oktaworkflows/how-to-translate-an-okta-user-id-into-a-google-user-id-32ll %}

{% embed https://dev.to/oktaworkflows/how-to-trigger-a-flow-6-ways-to-run-a-flow-97o %}

{% embed https://dev.to/oktaworkflows/how-to-send-an-email-with-an-attachment-from-workflows-4h0 %}

{% embed https://dev.to/oktaworkflows/how-to-read-a-json-path-with-dot-notation-in-workflows-3dlk %}

{% embed https://dev.to/oktaworkflows/how-to-create-flow-or-folder-backup-and-save-it-to-google-drive-4pf %}

{% embed https://dev.to/oktaworkflows/how-to-add-error-handling-to-a-flow-and-continue-execution-when-an-error-occurs-4hl8 %}

{% embed https://dev.to/oktaworkflows/how-to-delete-deactivated-users-in-workflows-2f26 %}

{% embed https://dev.to/oktaworkflows/how-to-handle-an-external-api-call-error-in-workflows-3i6e %}

{% embed https://dev.to/oktaworkflows/how-to-send-a-notification-to-a-group-of-people-based-on-a-department-1m22 %}

{% embed https://dev.to/oktaworkflows/okta-workflows-how-to-retrieve-slack-user-status-and-other-info-using-custom-api-cards-3dg5 %}
Correct way to handle API requests in a useEffect hook
Tags: react, api
Published: 2022-09-15 18:48:29

It is common to issue an asynchronous request to an API in a useEffect hook. Perhaps to fetch some data which is eventually used to update component state. Something like this:

```javascript
const [data, setData] = useState([]);

useEffect(() => {
  axios.get('get/some/data').then(({ data }) => {
    setData(data);
  });
}, []);
``` 
 
It is also common to encounter a situation where the component unmounts before the request is complete. The callback will still be executed if the component unmounts because the request was not cancelled. Consequently, when `setData` is called, this interesting warning pops up in the browser console:

> Warning: Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

## How to fix this
To fix this, the request needs to be cancelled when the component unmounts (in the `useEffect` cleanup function). This can be easily achieved with `axios` as follows:

```javascript
const [data, setData] = useState([]);

useEffect(() => {
  const cancelToken = axios.CancelToken.source();

  axios
    .get('get/some/data', { cancelToken: cancelToken.token })
    .then(({ data }) => {
      setData(data);
    })
    .catch((err) => {
      if (axios.isCancel(err)) {
        // TODO
      }
    });

  return () => {
    cancelToken.cancel();
  };
}, []);
```
This can also be accomplished with `fetch` using `AbortController` as follows:

```javascript
const [data, setData] = useState([]);

useEffect(() => {
  const controller = new AbortController();

  fetch('get/some/data', { signal: controller.signal })
    .then((res) => res.json())
    .then((data) => {
      setData(data);
    })
    .catch((err) => {
      if (err.name === 'AbortError') {
        // TODO
      }
    });

  return () => {
    controller.abort();
  };
}, []);
```
NFT Website - Landing Page w/ Minting Feature using React
Tags: react, nft, web3, programming
Published: 2022-09-16 02:12:15

Hello everyone 👋

I made some tutorials on how to create NFTs some time ago.
Since then, I have been contacted and asked a lot to keep making more tutorials and videos on NFTs.

One of the suggestions was to make an NFT website to showcase NFT collections, so I decided to give that a try and I have finally finished this project. 

I spent a lot of time on it, and the template is even responsive on phones. I see a lot of value in it for people who have an NFT collection that want to showcase.

Some of the technologies used in this template: 👇

**Styled-components**

**HTML & CSS**

**Typewriter-Effect**

**React**

**Web3 Libraries**

[How to implement this template:](https://youtu.be/556KdCQgQ8E)

After implementing this template, you can also deploy the website using your own custom domain by following this tutorial:

[Add custom domain and deploy tutorial:](https://youtu.be/mXqG8bFh9dg)

**Note:**

This template is a front-end UI, meaning it's not connected to databases or anything like that. The main purpose is to showcase your NFTs to users and allow them to mint your NFTs.

Feel free to play around with the template and change whatever you like.

If you want to learn more about programming in general, take a look at my Youtube channel and don't forget to subscribe.

[Youtube Channel](https://www.youtube.com/channel/UChZR16e1XwZXy2yrk_8ymFg) 

[Twitter](https://twitter.com/balt1794)
Add 1 to a number represented as linked list.
Tags: programming, java, amazon, linklist
Published: 2022-09-16 11:47:06

The given problem is of level easy but when you are a beginners it is very hard to solve the problems without reference. So to increase our logical thinking we have to solve at least one problem a day. The problem which is given below is solved by me today.

Problem:- Add 1 to a number represented as linked list.

A number N is represented in Linked List such that each digit corresponds to a node in linked list. You need to add 1 to it.

Example 1:

**Input:
LinkedList: 4->5->6
**Output:** 457 
Example 2:

**Input:**
LinkedList: 1->2->3
**Output:** 124 
Your Task:
Your task is to complete the function addOne() which takes the head of the linked list as the only argument and returns the head of the modified linked list. The driver code prints the number.
Note: The head represents the left-most digit of the number.

Expected Time Complexity: O(N).
Expected Auxiliary Space: O(1).

Constraints:
1 <= N <= 10100   

**Solution.java**


```
class Solution
{
    public static Node addOne(Node head) 
    {  
      Node pre = null;
       while(head!=null){
         Node temp1 = head.next;
         head.next = pre;
         pre = head;
         head= temp1;
     }
         Node temp = pre;
         Node prev = null;
     
     while(temp!=null){
         
         if(temp.data +1 >=10){
             temp.data = 0;
             prev  = temp;
             temp=temp.next;
         }
         else{
             temp.data = temp.data +1;
             break;
         }
     }
     
     if(temp==null){
         Node n = new Node(1);
         prev.next = n;
     }
     Node ans = null;
     
          while(pre!=null){
         Node temp1 = pre.next;
         pre.next = ans;
         ans = pre;
         pre= temp1;
     }
     
     return ans;
    }
}
```

**Github Profile:-** https://github.com/tejas910
The Git Commands I Use Every Day
Tags: git, beginners, programming, javascript
Published: 2022-09-17 12:34:13

## 1. Get all latest changes without merging
Stop pulling code that you think will break! Having `fetch` in your workflow allows you to grab updated code without immediately merging it. Once the code is fetched, you can check it out like any other branch.  When you're satisfied, then you can merge.
```bash
git fetch --all
# git checkout upstream/some-branch
```

## 2. Push upstream regardless of current branch name
Stop typing the branch names especially when they are long branch names.  Just tell git you want to push the current branch to a remote location.  `HEAD` is a key word that tells git to use the current branch.
```bash
git push production head
# git push origin head
# git push github head
```

## 3. Label your stash
This is useful if you stash a lot of code and you want to remember what the stash contains at a glance.
```bash
git stash save -m "my work in progress"
```

## 4. Use a stash from ages ago
Stop undoing stashes with `git pop` to get to an old stash. You can apply a stash that you created ages ago by using the following command.
```bash
# git stash list
git stash apply 3
```

## 5. Checkout the previous branch
This is super helpful when you are working on small features and you want to compare behavior/performance by toggling branches. You don't have to type the names, just use the minus sign.
```bash
git checkout -
```

I like this command so much that I made a quick YouTube shorts video showing it off! 

{% youtube _hrCAigwSOk %}

## 6. Change the base of the branch after doing a checkout
This is useful if you created a new branch but you based it off the wrong branch.  For example, say you wanted to branch from the beta code, but you accidentally branched using the production code.
```bash
git rebase --onto beta production feature
# git rebase newBase oldBase currentBranch
```

## 7. Move uncommitted changes to new/existing branch
```bash
git switch -c new-branch
# git switch existing-branch
```

## Bonus - Fuzzy Checkout
This custom command allows you to quickly switch to another branch without typing the entire name.  This is super useful when you are using a naming convention and you are tired of typing a prefix like `feature/` or `issue/`

```bash
function fc() {
    gco "$(git branch --format='%(refname:short)' | grep $1)"
}
```

If your branch name was called `feature/dropdown-select-color` you could quickly switch branches by doing something like this.

```bash
fc dropdown
```
BackEnd Web Development 2023 Technique
Tags: javascript, webdev, programming, tutorial
Published: 2022-09-17 06:53:40

Hi there, Harry. Here I have visited your Blog/Website which is providing the best information about software and its cracks With patch. I am also in this field working on some projects like this. Please visit my Projects. It's an honour for me. Thank you!
[eviews 13 crack with serial number](https://crackwinx.com/eviews-12-crack-serial-number/)