teleren/devto huggingface dataset:
Deep Freeze tutorial for Beginners by a Beginner
Tags: javascript, beginners, tutorial
Published: 2021-10-08 11:03:08

#Deep Freeze tutorial for Beginners by a Beginner

I got into web development just a few months back and a few days ago I came across a interview question asking to write code to deep freeze an object.

But what is freezing an object ???

Freezing an object means preventing new properties from being added to it, existing properties from being removed, prevents changing the enumerability, configurability, or writability of existing properties. Basically freezing an object means we **cannot** add ,delete or change existing properties which otherwise would have been possible in javascript as it is a **dynamic** language.

To freeze objects in javascript we use Object.freeze() method
```
const obj = {
  name: "Hritick",
};

console.log(obj.name); //* Prints -> Hritick

obj.name = "Hritick Jaiswal";
console.log(obj.name);//* Prints -> Hritick Jaiswal
```
But now if we use Object.freeze
```
Object.freeze(obj); //* Freezes the object
console.log(Object.isFrozen(obj)); //* Checks if an object is frozen or not

obj.name = "Hritick"; //* Changing values is ignored
console.log(obj);//* Prints -> { name: 'Hritick Jaiswal' }

obj.surname = "Jaiswal"; //* Adding values is ignored
console.log(obj);//* Prints -> { name: 'Hritick Jaiswal' }

delete obj.name; //* Deleting values is ignored
console.log(obj);//* Prints -> { name: 'Hritick Jaiswal' }
```
Ok great but what the hell is deep freeze and if we have **Object.freeze** and why do we need it.

```
const obj = {
  name: "Hritick",
  address: {
    is: "Kolkata",
  },
};

console.log(obj.address.is);//* Prints -> Kolkata

Object.freeze(obj)

obj.address.is = "Hyderabad"; //! This is allowed
console.log(obj.address.is);//* Prints -> Hyderabad
```
So why did Object.freeze did not work ???

Well Object.freeze **did work** 
It did "freeze" the properties of the object "obj" as the property "address" stores the memory location of the object { is:"Kolkata" } which **cannot** be changed but Object.freeze works on the immediate layer only.

Deep freezing is preventing from such cases. So what should we do ....

```
function deepFreeze(object) {
  if (typeof object !== "object") return;

  for (const value of Object.values(object)) {
    deepFreeze(value);
  }

  Object.freeze(object);
}
```
The above code uses **recursion** to basically freeze every object no matter at what level it is.

And that's it , this is my first post here so if I made any mistakes or anyone has any suggestions **please tell me**
Step by Step Guide on How to Setup Metamask
Published: 2021-10-08 10:53:13

MetaMask is a software cryptocurrency wallet used to interact with the Ethereum blockchain. It allows users to access their Ethereum wallet through a browser extension or mobile app, which can then be used to interact with decentralized applications.

MetaMask allows users to store and manage account keys, broadcast transactions, send and receive Ethereum-based cryptocurrencies and tokens, and securely connect to decentralized applications through a compatible web browser or the mobile app's built-in browser.

In this article, you will learn how to set up MetaMask

i. Visit https://metamask.io/  and click on 'Download Now' at the right hand of the screen

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p8sm9jrq49kt03jmjkk.PNG)

ii. Click on 'Install MetaMask for Chrome'
 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnid7erv7dzgul87imys.png)

iii. Click on the 'Add to Chrome' button at the right-hand corner of the screen

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

And confirm the addition of extension by selecting 'Add Extension'.

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

iv. View MetaMask in the Chrome extensions menu

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

v. Click on 'Get Started' and select 'Create Wallet' at the hand corner of the screen

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

vi. Click on agree
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0gfgcyk5kougkvfkq65w.png)

vii. Enter a password and click 'Create' at the bottom of the screen
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqssu5tlvsszakj3kt0i.png)

ix. Click on 'Next' Secure your wallet
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ufzcoxyrnk5soq1e7sy.png)

xi. View, download and store backup seed phrase

MetaMask provides a unique 12-word Secret Backup Phrase (or “Secret Recovery Phrase”) when you create a crypto wallet as a way to restore your access to your wallet in the case that your computer is lost, stolen, or if data gets corrupted.

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

Store it at a safe and secure place. Then click 'Next'.


xii. Confirm backup seed phrase

You'll have to confirm the seed phrase by clicking the words in the order it was shown previously, and click 'Confirm'.

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

xiii. Congratulations!

You have successfully setup MetaMask and created your first wallet, that was awesome right. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oz3x9e6ajutza7gzd40m.png)
Как избежать избыточного кода DI в ASP.NET Core
Published: 2021-10-08 10:37:48

Воспользуйтесь преимуществами базовых контроллеров, чтобы избежать дублирования кода внедрения зависимостей и обеспечить соблюдение принципа DRY в ASP.NET Core MVC.
Hacktoberfest #1 
Tags: hacktoberfest, opensource, react
Published: 2021-10-08 10:24:32

In the first week of Hacktoberfast, as David recommends to students that choose simple and easy project for Hacktoberfest first PR. Since WEB422 course I do not have chance to use React, I want to improve and use React for Hacktoberfest #1!. Therefore, I decided to choose the React project that called [color-generator-pro](https://github.com/RajMhatre20/color-generator). The [issue](https://github.com/RajMhatre20/color-generator/issues/1) is the project maintainers wants to replace "copy to clipboard" alert right text to the submit button instead of emitting alert on the list of color card that every time card being clicked. 

Since Color-generator-pro is very simple app, the setup is only require to enter `npm i` for installation relevant library and React. For execution, simply enter `npm start` to take a look application and debug on `localhost:3000`. After finishing the set up, I realized the application has used Hooks which I do not have any experience. It also has been awhile to learn React, I have to go React official website for reading a React and Hooks document. 

The fixing the issue was straight forward after I read the document from React website. The change has made as screen shots: 
![Before](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mpqqhdik4zx8jq9bku73.png)
![After](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ph7l9n6wx4fn7lb4sroo.png)
There is two files that I have added:
- **App.js**: main 
- **SingleColor.js**: send the color information to App.js

The code that I have changed are:
**App.js**
- import useEffect from React for controlling componenet after rendering 
- create alert state from different component
- create onCopy state to receive hex color from other components
- create `<section>` right after submit button for alert

**SingleColor.js**
- Remove useState and useEffect
- add 'onCopy' parameter on SingleColor function
- change onClick statement 

After I have made change mentioned above, I have commit to fork repo, create [PR](https://github.com/RajMhatre20/color-generator/pull/2), and ask project maintainer for reviewing the code. However, there is a bug that the `setTimeOut()` and `clearTimeOut`functions do not work properly. When the color card being clicked, the alert should persist 3 seconds. However, the change that I have made does not persist alert for 3 seconds. If multiple color cards being click in 3 seconds, the previous clicked card alert should suspend and prior clicked card should persist 3 seconds. 

First time I faced this issue, it was so bizarre why the previous clicked card alert is not suspended. So I have to find that store previous state of the timer. In the React document, the `preValue` allows me to detect previous state of timer. So that I can compare the current timer and previous timer that I can suspend previous timer. I tried to solve this issue for researching on Stack Overflow and React blog. However, the reading document on official React website helps me to understand what is issue and solve the issue.
Hacktoberfest Beginners and Advanced Repos to Contribute to
Tags: hacktoberfest, beginners, python, opensource
Published: 2021-10-08 10:11:21

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

👋🏻 Hi everyone, and Happy *Hacktoberfest*! 

This is my repos ready for the *Hacktoberfest*:

## **Python**

### **PyStateMachine**

*** Beginners ***

> A Python implementation of simply configurable State Machines.
 
{% github ZigRazor/PyStateMachine %}


### **LogParser**

*** Beginners ***

> A Log Parser, that create structured data from log files.

{% github ZigRazor/LogParser%}


## **C++**

### **CXXGraph** 

*** Advanced ***

> Header-Only C++ library for Graph Representation and Algorithms with a simple interface.
 
{% github zigrazor/CXXGraph %}


### **CXXAutomata**

*** Intermediate ***

> A C++ Library to which implements the structures and algorithms for finite automata, pushdown automata, and Turing machines. 

{% github zigrazor/CXXAutomata %}


### **CXXLog**

*** Beginners ***

> A C++ HeaderOnly Logging Utilities 

{% github zigrazor/CXXLog %}


If you need some instructions on how to contribute or how to approch to the repo or more in general to the Open Source, do not hesitate to open an issue on the repository or write to me at email : zigrazor@gmail.com .


Happy Coding! 💻
Does business need a good code?
Tags: codequality, cleancode, programming, productivity
Published: 2021-10-08 09:59:16

*Photo by [Markus Spiske](https://unsplash.com/@markusspiske?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/code-javascript?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)*

We developers enjoy a good code. We know what is GoF, SOLID, KISS, YAGNI and dozens of these abbreviations. We read a lot of books, we attend meetups and large conventions, we debate on social media. But... Does business we work for really need all of these?

## Why business needs a code in the first place?
Business needs a code to solve business problems, and that seems obvious. However, I believe it’s very important to internalize this. The whole thing of writing a code is solving business problems. This means that speaking of a good vs bad code is senseless without regarding a business.

## What is a good code from programmers perspective?
There’s dozens of different ways to tell a good code from bad one, but if I’d be asked to put it in one sentence, I’d say:

> *A good code is a code which is easy to understand.*

Yes, it’s that simple. There are a lot of techniques to achieve this, but the purpose is the same: make a code as clear as possible. With such a code a lot of things become easy:

* Implement new features: it’s easy to read, so it’s also easy to extend
* Fix bugs: it’s easy to understand and to find where a problem is
* Move to a cloud: system-dependent parts are separated from other logic, so it’s clear which code needs to be rewritten
* Optimize: all tradeoffs and bottlenecks are explicit

## So does business need all these good things?
Let’s try to rewrite these “good things” into a business language. A good code allows the following:

* Launch new products in reasonable time
* Keep product quality high
* Reduce operation costs
* Reduce cloud or hardware costs

So the answer to the main question is:
> *If a business needs quick launches, quality products, and optimal costs, it needs a good code. Otherwise it doesn’t need it.*

## When the business may not need a good code?
It’s perfectly fine to have quick and dirty solution in some cases:

* Hypothesis check
* Prototype
* Very small and short project

But here comes another hard problem: recognize a moment when it’s not a prototype anymore but a product. That’s the time to deliver the first refactoring 😉

_____
*Thanks for reading this. Have you ever explained the business the value of a good code? Did you succeed?*
AI & Machine Learning Toolkit Bundle
Tags: machinelearning, deeplearning, ai, programming
Published: 2021-10-08 09:42:17

![AI & Machine Learning Toolkit Bundle](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ayw6w8z9trkek7glja5.jpg)

**[AI & Machine Learning Toolkit Bundle](https://www.humblebundle.com/books/ai-machine-learning-toolkit-books?partner=indiekings)**

Morgan & Claypool believe that Artificial Intelligence is being integrated and discussed in areas as diverse as politics and healthcare. At the same time, enrollment in computer science has never been higher and students are flocking to AI courses. To help start your journey in this field, Humble Bundle teamed up to provide you with books like Introduction to Graph Neural Networks, Introduction to Semi-Supervised Learning, and Adversarial Machine Learning.

Your purchase of this bundle helps support Save the Children, which exists to help every child reach their full potential, working in 100+ countries to ensure children stay safe, healthy and keep learning!

This bundle launched on October 7th, at 11:00 am PST and lasts through October 28th, 2021.

Pay what you want and support charity!
Method to Setup the Amped Wireless Extender
Tags: security
Published: 2021-10-08 09:40:47


The days we had no choice but to make all our connections with wire, are far gone. Technology has made it a lot easier. With a few technical tips, you will know how to complete the <a href="https://setupampedwirelesscom.com/amped-wireless-extender-setup.php">amped wireless setup</a>. The wireless setup can be seen as very difficult but with the proper expert tips, you will get it done.
JavaScript & Web Development Bundle
Tags: javascript, webdev, programming, beginners
Published: 2021-10-08 09:39:57

![JavaScript & Web Development Bundle](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r429cpuimhcq83j5slvv.jpg)

**[JavaScript & Web Development Bundle](https://www.humblebundle.com/software/javascript-software?partner=indiekings)**

Learn JavaScript thanks to Zenva in the latest Humble Bundle! Access courses like Responsive Admin Pages with Semantic UI, Marker-Based Games with AR.js for Beginners, and Build 3D Web Apps with Babylon.js.

Your purchase of this bundle helps support Code.org, who aims to encourage people, particularly school students in the United States, to learn computer science.

Additionally, this bundle benefits Khan Academy in their work to provide a free, world-class education for anyone, anywhere.

This bundle launched on October 7, at 11:00 am PST and lasts through October 28, 2021.

Pay what you want and support charity!
mixmello - create remixed versions of your Spotify playlists. Open source.
Tags: react, javascript, webdev, opensource
Published: 2021-10-08 09:36:47

Introducing mixmello, a free, open source application to create remixed or acoustic versions of your favourite Spotify playlists.

Web: [mixmello.com](https://www.mixmello.com)
GitHub: [github](https://github.com/alexgurr/mixmello)


### Stack
**Frontend**: react@latest -- design & logo by me from scratch
**Backend**: none
**APIs**: [Spotify](https://developer.spotify.com/documentation/web-api/)
**Authentication**: Spotify [OAuth pkce](https://oauth.net/2/pkce/) 


### Things I Learned
*Making an app that uses the Spotify API is more work than you think!*

- Spotify's public API has some questionable decisions, including limits on resources but no search functionality. This means you have to chain paginated requests to get items and make a local search.

- Their development checking team means business. **Make sure you read the partner guidelines before build**. You get one evaluation per day and the turnaround is slow. 

- If you use any metadata from their API, including art, titles, tracks etc. you must add a *Open In Spotify* button.

- pkce is by far the easiest way of authenticating client-side with their API

**Open to feedback, suggestions, PRs and any questions you might have!**

Like my article and want more? Come and follow me on [medium](https://medium.com/@alexgurr).
[Python] How to Reverse array using recursive function
Tags: python, beginners, programming, algorithms
Published: 2021-10-08 09:32:19

In this article we are going to cover up how we can reverse an array or string using recursive function.

Before Writing any code let's explore about what recursive method is:


What is Recursion?
Recursion is a process in which a function calls itself as a subroutine. This allows the function to be repeated several times, since it calls itself during its execution. Functions that incorporate recursion are called recursive functions.

Recursion is often seen as an efficient method of programming since it requires the least amount of code to perform the necessary functions. However, recursion must be incorporated carefully, since it can lead to an infinite loop if no condition is met that will terminate the function.

So now you guys have idea about what recursion is.

How will be the flow of the code will going to be means algorithm
1. we are going to use depth way to get the each value of array 
   from ending to beginning.
2. Handling the indexes to don't get bounce error from it(index 
   not exists kind) via adding if condition
3. directly appending each index to a array variable.
4. Begin process again from 1 means calling function to iterate 
   until 2 step not get it wants.

Code:
``` ```
arr = [10, 23, 12, 1, 2, 65, 89, 8, 5, 90]
def recursion(arr,depth):
  str = [] # step 1
  if depth == -1: #step 2
    return str

  str.append(arr[depth]) #step 3
  n = recursion(arr,depth-1) #step 4 
  if len(n) > 0:
    str.extend(n)

  return str

r = recursion(arr,len(arr)-1)
print(r)
```

Output:
```
[90, 5, 8, 89, 65, 2, 1, 12, 23, 10]
```

You can checkout this to know how to reverse array also in golang and javascript
https://kdsingh4.blogspot.com/2021/10/recursive-how-to-reverse-array-or.html
Working with Next.js + Headless CMS 👨‍💻
Tags: webdev, vscode, nextjs, jamstack
Published: 2021-10-08 09:27:46


_This article was originally published on [my newsletter](https://www.tuomokankaanpaa.com/newsletter) last week. I publish previous week's newsletter here on the blog. If you want to read these as soon as they are published, [sign up](https://www.tuomokankaanpaa.com/newsletter) for the newsletter!_

Ahoy,

Last week I talked about my top 5 features in Visual Studio Code. After publishing that video, I actually ran into a website that lists a bunch (35 to be exact) of useful, but kind of unknown, features in VS Code.

The website is [vscodecandothat.com](http://vscodecandothat.com/). I highly recommend checking it out if you use VS Code.

This weeks [Youtube video](https://www.youtube.com/watch?v=qinZQstIpqY) is also about vscodecandothat website. In the video I go over some of the features they have listed, that I found really helpful and cool!

{% youtube qinZQstIpqY %}
[📹 View on Youtube](https://www.youtube.com/watch?v=qinZQstIpqY)

## What I worked on / learned this week?

One of the things was the Next.js blog application I mentioned [last week](https://tuomokankaanpaa.com/blog/best-vs-code-features-learning-material-ui). I tried to make it look a bit better, but I still think that it needs some work on that front 🙈

Other thing I did was working on setting up a headless CMS as a datasource for the application. I started the application off with just static data in a Javascript file, but the goal is to have it use a headless CMS as a datasource.

Implementing a headless CMS was pretty interesting and cool thing to explore. While working on it, I realised in practice how great it is to use technologies like Jamstack and Next.js.

Swapping the datasource required some modifications on the existing application, like renaming few variables and adding the data as props instead of just direct import statement, but other than that it didn't require much work and it was surprisingly easy to swap the datasource.

So at the end, I got a raw version of the blog with headless CMS working.

As I mentioned in the last week's email, I am planning on shooting a video about the whole process. I think I will do two part video. First part showing how to code the blog and second part to show how to add headless CMS to the mix.

What do you think? Hit the reply button and let me know if that is something you'd like to see.

That's it for this week!

Cheers,
Tuomo
locker
Published: 2021-10-08 09:11:35

Tủ Sắt Locker & Lock 12 ngăn được làm bằng sắt, sơn tĩnh điện. Là loại tủ sắt tiện dụng đối với văn phòng công ty, siêu thị và khu công nghiệp.
#tủ_locker #tủ_sắt_locker #locker #tu_sat_locker #tu_locker #tủ_locker_sắt #tủ_nhân_viên #tu_locker_sat #tủ_locker_giá rẻ #tu_locker_gia_re #tủ_cá_nhân_locker #tủ_sắt_nhiều_ngăn #tủ_đựng_đồ_nhân_viên
Website:
<a href="https://lockernlock.vn/danh-muc-san-pham/tu-locker/">tủ cá nhân locker</a>
<a href="https://www.strava.com/athletes/91281438">tu locker gia re</a>
<a href="https://www.sqlservercentral.com/forums/user/lockersecure">tủ cá nhân locker</a>
<a href="https://dribbble.com/lockersecure/about">tủ sắt nhiều ngăn</a>
<a href="https://www.tripadvisor.com/Profile/securel2021">tủ đựng đồ nhân viên</a>
Woods Wion Setup
Tags: news
Published: 2021-10-08 09:05:01

Fast and smart devices are taking over now. The <a href="https://www.wionconnect.com/">Woods Wion</a> is one of those smart devices that are promoting easy and smart time usage. You can remotely take control of your devices as long as they are connected to the Wion app. Make functional arrangements around your house with this device.
<a href="https://www.wionconnect.com/">Wion Outdoor Wifi Outlet</a>