teleren/devto huggingface dataset:
Day 46: Sudoku Generator
Tags: 100daysofcode, java
Published: 2021-03-24 00:45:46

```java
public class SudokuGenerator {
    public SudokuGenerator(int dim) {
        int[] topSeed = new int[dim];
        int[] sideSeed = new int[dim - 1];
        
        for (int i = 0; i < topSeed.length; i++) {
            topSeed[i] = i + 1;
        }
        
        shuffle(topSeed);
        
        for (int i = 0; i < sideSeed.length; i++) {
            int seedVal = i + 1;
            if (seedVal == topSeed[0]) sideSeed[i] = dim;
            else sideSeed[i] = i + 1;
        }
        
        shuffle(sideSeed);
        
        int[][] puzzleBuilder = new int[dim][dim];
        
        for (int i = 0; i < topSeed.length; i++) {
            puzzleBuilder[0][i] = topSeed[i];
        }
        
        for (int i = 0; i < sideSeed.length; i++) {
            puzzleBuilder[i + 1][0] = sideSeed[i];
        }
        
        SudokuPuzzle newPuzzle = new SudokuPuzzle(puzzleBuilder);
        
        System.out.println("Seed Puzzle:");
        System.out.println(newPuzzle + "\n");
        
        SudokuSolver ss = new SudokuSolver(newPuzzle);
        
        System.out.println("Generated Puzzle:");
        System.out.println(ss.results());
        
    }
    
    
    
	private int[] shuffle(int[] input) {
        
        int N = input.length;
        
        for (int i = 0; i < (N - 2); i++) {
            int swapIndex = (int) (Math.random() * (N - i)) + i;
            int temp = input[i];
            input[i] = input[swapIndex];
            input[swapIndex] = temp;
        }
        return input;
    }
    
    public static void main(String[] args) {
        int N = 9;        
        SudokuGenerator sg = new SudokuGenerator(N);
        
    }
}
```
Day 005: Blew off another day
Tags: 100daysofcs
Published: 2021-03-24 00:13:57

Lots of busy work today. As the quarter is coming to end, I'm trying to wrap up everything at work. Only worked for 10 minutes or so before getting interrupted and going down another rabbit hole.

But, since you're here: do you know that you can use `vars` instead of calling the `__dict__` method on an instance/class to get a dictionary of all the attributes? Very nifty.
How to get the path to the temporary files directory in Node.js?
Tags: node
Published: 2021-03-24 00:00:00

---
  title: How to get the path to the temporary files directory in Node.js?
  published: true
  tags: Nodejs
  date: Wed Mar 24 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/get-temporary-files-directory-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-549508c896ceae29c7ad7eccee9f151e.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/get-temporary-files-directory-nodejs)
  
To get the path or location to the temporary files directory, you can use the `tmpdir()` method from the `os` module in Node.js.

```js
/* Get path of temporary files directory in Node.js */

// import os module
const os = require("os");

// get temp directory
const tempDir = os.tmpdir(); // /tmp
```

- The method returns the path to the temporary files directory as a `string`.

See the above code live in [repl.it](https://replit.com/@melvin2016/temporary-files-directory-in-nodejs#index.js).

### Feel free to share if you found this useful 😃.

---
tsParticles 1.24.1 released
Tags: showdev, javascript, typescript, html
Published: 2021-03-23 23:56:00

# tsParticles 1.24.1

## Release Notes

### New Features
- Added autoPlay option to emitters
- Added drift (numeric or min/max object)
- Added min/max alternative object to move.speed, size.value, opacity.value and rotate.value particles options

### Bug Fixes
- Emitter play/pause were not working fine from container
- Confetti fixed oval rotation

---

## Confetti shape
I made an article some days ago about this new shape

{% link https://dev.to/matteobruni/how-to-create-beautiful-confetti-animations-with-tsparticles-193 %}

## CodePen demos

You can find all the demos on CodePen [here](https://codepen.io/collection/DPOage)

---

### Related projects

#### jQuery

If you want to use tsParticles with jQuery checkout [this repository](https://github.com/matteobruni/jquery-particles)

#### VueJS

If you want to use tsParticles with VueJS checkout [this repository](https://github.com/matteobruni/particles.vue)

#### ReactJS

If you want to use tsParticles with ReactJS checkout [this repository](https://github.com/matteobruni/react-tsparticles)

##### 3rd Party

A 3rd-party component is available too, read more [here](https://github.com/Wufe/react-particles-js)

#### Preact

If you want to use tsParticles with Preact checkout [this repository](https://github.com/matteobruni/preact-particles)

#### Angular CLI

If you want to use tsParticles with Angular CLI (actually v9) checkout [this repository](https://github.com/matteobruni/ng-particles)

---

## Useful links

Checkout the demos here: <https://particles.matteobruni.it>

Do you want to replace the old, outdated and abandoned `particles.js`?

**You're in the right place!**

---

## GitHub repo
<https://github.com/matteobruni/tsparticles>

{% github matteobruni/tsparticles %}

If you like this project support it with a star 🌟

##npm
<https://www.npmjs.com/package/tsparticles>

##yarn
<https://yarnpkg.com/package/tsparticles>

##jsDelivr
<https://www.jsdelivr.com/package/npm/tsparticles>

## CDNJS
<https://cdnjs.com/libraries/tsparticles>

---

Feel free to contribute to the project!
NPM - too much of a good thing?
Tags: javascript, npm, healthydebate
Published: 2021-03-23 22:23:32

(cover pic [unsplash](https://unsplash.com/@henleydesign?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText))
A thought occurred to me today when I was considering [an article by Eric Normand](https://purelyfunctional.tv/issues/purelyfunctional-tv-newsletter-418-clojures-buzz/) on the different moods or "buzz" that languages generate in the dev community. His discussion point is that JavaScript generates enormous interest, obvious activity and "buzz", whilst a language like Clojure is used extensively but not talked about.

His take was that this is just fine, as Clojure is used by many for building apps (front and backend along with enterprise tools) - but it is very stable and therefore doesn't automatically generate "buzz" about itself... There are few changes to shout about and discuss.

The thought that occurred to me was actually that maybe the JavaScript community generates _too much_ buzz, and spends _too much_ time developing new libraries on npm. If we just got on with the libraries we already have and spend less time gold-plating things and learning new stuff we'd have more energy to spend creating more and better quality products.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69n0w8zf55r6gr769jua.jpg)
(pic [unsplash](https://unsplash.com/@teveir?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText))

There is indeed a lot to be said for an active community and the potential for an existing library out of the thousands to solve your problem very specifically.

As an example, perhaps the differences between Vue and React or Svelte (Angular and this or that) don't really warrant their on-going segregation of the resulting apps and dev communities? Is it actually, overall, less efficient and resulting in lower-quality apps over time?

(this might be a bad example, as I don't really want to discuss the merits of frameworks per se, but use their existence as an example that applies to npm in general)

I *know* that it can be argued that one or the other library/framework/whatever is better in certain circumstances than the others - but is that *really* true and do you *really* gain sufficient benefit compared to the effort of complicated build processes, maintenance, updates and on-boarding of new staff? Not to say the opportunity cost from barriers to knowledge sharing between teams using different libraries/frameworks regarding architectures and domain solutions.

Perhaps if there was less "buzz" and more "do" in the JavaScript community, we'd have higher quality engineering and more apps?
Babel v7 error: "Cannot read property 'bindings' of null"
Published: 2021-03-23 22:06:29

Hi there!

I'm Arisa, a freelance Full Stack Developer living in Germany🇩🇪

I'm developing [Lilac](https://note.com/frontendlifeinde/m/m9b8feda1d547), an online school with hands-on Frontend e-books and tutoring👩‍💻

# Who is this article for?

- Anyone migrating Babel v7
- Anyone fails the test with an error below (Jest)
- Anyone needs to maintain an old project for about 2-3 years like this one

# What was the error?

![gif](https://media.giphy.com/media/BQ5bczxIvu1bi/giphy.gif)

Here's the troublemaker I had👇

```
TypeError: Cannot read property 'bindings' of null
```

Yup, this mister was annoying as it was because test error was showing me that all the tests were failing because of one line with null value returns.

But the value which my test was pointing out had returned value when I debug.

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

![gif](https://media.giphy.com/media/26gYQrLSkPkPTnSOQ/giphy.gif)

Phew...!

Gotta stop blaming loop😑

Here is my environment.

```javascript
  "devDependencies": {
    "@babel/preset-env": "^7.13.12",
    "babel-core": "^6.26.3",
    "babel-jest": "^26.0.1",
    "babel-preset-env": "^1.7.0",
    "css-loader": "^3.5.3",
    "eslint": "5.16.0",
    "eslint-config-airbnb": "^18.1.0",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.20.0",
    "jest": "^26.0.1",
    "jest-localstorage-mock": "^2.4.2",
    "node-sass": "^4.14.1",
    "sass-loader": "^8.0.2",
    "style-loader": "^1.2.1",
    "webpack": "^4.43.0",
    "webpack-cli": "^4.5.0",
    "webpack-dev-server": "^3.11.0"
  },
  "dependencies": {
    "moment": "^2.24.0"
  }
```

# A solution

Change your `.babelrc` config from this below

```javascript
// 🙅‍♀️ not working
{
    "presets": [
      "env"
    ]
}
```

to this👇

```javascript
// 🙆‍♀️ works
{
  "presets": [
    ["@babel/preset-env"]
  ]
}
```

And install `@babel/preset-env` as devDependencies.

```shell
$ yarn add --dev @babel/preset-env
```

All set.

Run a test again, it won't fail if you wrote the test correctly👍

Hope this blog post was something you were looking for!

# Sources

- [babel/babel (GitHub repo)](https://github.com/babel/babel/tree/master/packages/babel-preset-env)
- [env preset breaks on class in v7 alpha 20
#6186](https://github.com/babel/babel/issues/6186)
- [Upgrade to Babel 7: Cannot read property 'bindings' of null](https://stackoverflow.com/questions/52092739/upgrade-to-babel-7-cannot-read-property-bindings-of-null)
100 Bytes Of Wisdom: Day 2^5
Tags: career, journey, advice
Published: 2021-03-23 22:00:03

---
title: 100 Bytes Of Wisdom: Day 2^5
published: true
description: Bytes of Wisdom is a new project by Sam Jarman that brings together snippets of advice for software engineers
tags: career, journey, advice
//cover_image: https://direct_url_to_image.jpg
---

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

Having a voice in a team is crucially important. There are plenty of times when you should speak your voice. Be heard, and let others know your opinion or expertise. Equally, there are times to shut up and listen. To acknowledge you're going out of your lane and to just listen and learn. I got this really quite wrong a lot early in my career and it's something I'm constantly monitoring (boy, am I a chatterbox!).  

This is really only one of those things a trusted peer or manager can help you with. However, if you're unsure where you're at, try to stay silent in your next group meeting. See if anyone asks for your opinion, or if you learn something from someone else who is now able to speak. Like I was, you might be surprised at the outcome.


Heads up: As with any terse bit of advice, there will be exceptions of course, and subtleties and nuance that can't possibly be captured in a Byte of Wisdom. This has been what I've experienced, I'd love to hear yours in the comments too!

You can catch up with all the other bytes at http://bytesofwisdom.com/
JS Objects: Destructure, Rename,  & Default all in 1 Line
Tags: javascript
Published: 2021-03-23 14:43:58

Suppose we have objects `car` and `motorcycle` defined as follows:
```javascript
const car = {
  make: "Tesla",
  weight: 3500
};

const motorcycle = {
  make: "Harley",
  registered_to: "John Smith"
};
```
<br />

### Destructuring
From the Object `car`, we can extract the value `"Tesla"` under the key `make`, and assign it to local variable `make` like so:
```javascript
let { make } = car;
console.log(make); // prints "Tesla"
```
But note that the syntax `{ make }` under the hood is actually shorthand for `{ make: make }`. Which leads us to...
<br />

### Renaming 
What if we want to take the value of `"Tesla"` under the key `make`, but assign it to a different variable, say `manufacturer`?
```javascript
let { make: manufacturer } = car;
console.log(manufacturer); // prints "Tesla"
```
<br />

### Default
From our definition of the `motorcycle` object, notice how there was no `weight` key-value pair defined. What if we were to try to assign a default value of `1000` to the `motorcycle`'s weight, and assign it as the `weight` variable?
```javascript
let { weight = 1000 } = motorcycle;
console.log(weight); // prints 1000
```

But if `weight` was defined like in the `car` object, we are simply doing a destructure on `car`.
```javascript
let { weight = 1000 } = car;
console.log(weight); // prints 3500
```

### All-in-one
Now, suppose we want to take `car` and `motorcycle`'s `registered_to` values, and store them in a variable `owner`, and to have the value default to `"Jane Doe"` if the key is missing. We can combine all 3 above techniques together in one line.
```javascript
let { registered_to: owner = "Jane Doe" } = car;
console.log(owner); // prints "John Doe"

let { registered_to: owner = "Jane Doe" } = motorcycle;
console.log(owner); // prints "John Smith"
```

I hope this helps. I believe these one-liner approaches are what we call **syntactic sugar**. Please practice clean and readable code when applicable.
Thoughts on Selenium 101 Certification from LambdaTest
Tags: testing, certification, java, career
Published: 2021-03-23 21:37:15

## Introduction

[LambdaTest](https://www.lambdatest.com/) created their different [Certifications](https://www.lambdatest.com/certifications/) delivering them at free cost! They have a [detailed announcement](https://www.lambdatest.com/blog/lambdatest-certifications-learning-hub/) on their blog.

I took the Selenium 101 exam and I passed. I will share my thought with you.

## My thoughts

First of all, I don’t believe that much about certifications that don’t have a way to make you practice it.

I do recommend for everyone who wants to take testing/quality paid certifications like ISTQB or related the following: invest your time and money into courses, books, and practicing the tech skills most of the open positions in the market required. It will worth your time, money, and dedication.

I’m not telling you to give up your current focus on those certifications if you have. I truly believe you will learn something valuable. My main concern is regarding the experience you can have from different sources and get prepared for your dream job.

### What about the LambdaTest certification?

I would say it worth your time. I liked it because:

* there are multiple-choice questions
* there is an assignment task
* it’s free!

### Part 1: Multiple choice questions

You need to select the correct questions regarding a topic. The same procedure that all certification has. There are some questions I think don’t belong/fit into the Selenium knowledge base like questions about Apache POI and Excel files, regexp, and Selenium 1.

I might consider the Selenium 1 questions valid for those that have legacy code wrote down in these versions, but I would say it’s unusual.

### Part 2: Assignment task

I loved this one. They will give you a web app link and the e2e scenario to automate. A real e2e scenario.

There’s only one thing I think is not that valid to reproduce, which is a download part, but you might see a weird requirement from your PO to test if the PDF report can be download (!!!).

You must deliver the assignment task in a “short” period, so get prepared.
Btw, it should be functional and run because they will do it!

I would say to deliver the assignment in a functional way rather than the most beautiful code you can create with some design patterns. The focus is to show that you know how to automate an e2e scenario.

### Are you ready?

Are you ready to give it a try? If you are an experienced engineer you can “play” with the assignment and even learn something new. If you are learning Selenium this is a good way to validate your knowledge.
Create A File Structure For React Components Using Xargs Command
Tags: zsh, cli
Published: 2021-03-23 21:33:40

---
title: Create A File Structure For React Components Using Xargs Command
published: true
description: Quickly create JSX files that have the same filename as their containing folders
tags: zsh, cli
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z93tfil78ltlnukt1x1r.png
series: Command Line Interface
---


When I need to quickly knock up a bunch of React components, I like to use my command line. This is how I create a directory structure, where each element has its own folder. Let's say I want something like this:
```bash
my-web-app/src
├── App
│   └── App.jsx
├── CtaButton
│   └── CtaButton.jsx
├── CurrencyBar
│   └── CurrencyBar.jsx
├── Discount
│   └── Discount.jsx
├── DomainForm
│   └── DomainForm.jsx
├── DomainInput
│   └── DomainInput.jsx
├── Header
│   └── Header.jsx
├── RadioButton
│   └── RadioButton.jsx
└── Results
    └── Results.jsx
```

I'd go to the `src` folder: 
```bash
cd my-web-app/src
```

Create all folders: 
```bash
md App CtaButton CurrencyBar Discount DomainForm DomainInput Header RadioButton Results
```

And then run the following command to create all the JSX files within their folders, keeping the same name as the folders.
```bash
find . -type d | xargs -I{} basename {} | xargs -I_ touch _/_.jsx
```

> *Cover image: Variegated Aerialist, Emma Plunkett Art © 2019*
Day 335 : Taking Notes
Tags: hiphop, code, coding, lifelongdev
Published: 2021-03-23 21:24:30

_liner notes_:
- Professional : It was a heads down and work type of day. Had a couple of meetings, but other than that, I worked on updating a tutorial. Rewrote some code samples, reordered some steps and changed some text. I was also taking notes on how the other supported platforms like iOS and Android. Did a pull request to the repo so that a preview site would be deployed. Walked through the tutorial and everything still worked. Going to try it again tomorrow with fresh eyes.

- Personal : Today was a much nicer day than yesterday. It was sunny and warm. Didn't do as many laps around the park because of meetings and focusing on the tutorial, but the couple of times I did, it was really pleasant. Will try to get another one in before I leave for the night.

![Countryside of Campagna, Italy with rolling green hills with houses and fields on them.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6wijkp1fiwz3pv2t7lv.jpg)

Last night, made some progress on the video recorder for the dashboard of my side project. I can select from a list of devices on the computer the user is using to record the video. Next, I want to get the actual recording to work and then get the video uploaded to the storage space. Hopefully I can get that done tonight. So I went to watch the new episode of "Attack on Titan" last night. Loaded up the application and saw that the latest 2 episodes were still set to the premium level. I've been using the free tier which means I have to wait a week for the latest version. Usually no problem, but I really wanted to watch the episode. haha So I signed up for the lowest paid tier. There's a trial period so I'll check it out some more. Going to go through some tracks for this week's radio show.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube IsipDHxg2tI %}
Threadpool, Thread
Tags: csharp, threadpool, thread, dotnet
Published: 2021-03-23 20:49:05

Hello hello
Today I want to talk about Thread Threadpool and the type of Threads in .Net.
**What is a thread pool?**
Before talking about Threadpool, I have a question, Do you know about Thread??
So first let me talk about Thread.
A thread controls the flow of an executable program. By default, a program has one thread called Main
Thread. Main Thread starts when control enters in the Main method and it terminates when the Main method returns.
If the execution of a program is controlled by more than one thread, it’s called a Multithreaded

Application. Such a program increases the performance and response time of an application.
A thread can be created by using System.Threading.Thread class. A thread can only be manipulated on a method. For example, MainThread needs the Main method to control the flow of a program.
Thread Pool
The cost of instantiating a managed thread is higher than reusing a free thread. In .NET, a thread pool is helpful to reuse the free threads. A thread pool is a collection of background threads created by a system and are available to perform any task when required.
When a program requires an extra thread, it is more efficient to use available free threads from a thread pool because it can save the cost of creating a thread. And when a thread completes its execution, it can go back to the thread pool so other programs can reuse the same thread again.
**Limitation of Thread Pool**
• It is hard to tell when a thread of a thread pool has finished its execution.
• There is no “Start” method, so we cannot tell when a thread of a thread pool has started its execution because it is being managed by the system.
• It can’t manage a thread that returns a value.

As you see, I talked about the background thread.

We have two types of Thread, **Background and Foreground Thread**
There are two kinds of threads in C#, i.e., Foreground thread and Background thread. By default, in C# all threads are initialized as foreground thread. An application cannot terminate its execution until all its foreground threads are completed.
A background thread is almost identical to a foreground thread. The one difference is that, if the Main Thread has completed its execution and the background thread is the only thread remaining in the application, the Main Thread will terminate the application and not wait for the background thread to be completed.
🆔 Identity, Unlocked... Explained: Season 2, Ep. 2
Tags: identity, security
Published: 2021-03-23 20:24:39

🛡 In this episode of Identity. Unlocked, principal architect at Auth0 and podcast host, Vittorio Bertocci, invites guest Filip Skokan to have a conversation about a few three-letter extensions to OAuth (which, incidentally, would also fit well in a pirate incantation!): PAR, RAR, and JAR.

[Read more...](https://auth0.com/blog/identity-unlocked-explained-season-2-ep-2/?utm_source=facebookgroup&utm_medium=sc&utm_campaign=identity_unlocked)