teleren/devto huggingface dataset:
How To Use LocalStorage
Tags: javascript, programming, webdev, beginners
Published: 2022-12-20 20:25:49


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

Welcome again, reader, to another entry in my blog where I attempt to demystify and explain a technical topic. I'm going to concentrate on `localStorage` this time.

**What is LocalStorage?**
In the simplest terms, `localStorage` is a feature of the browser that enables us to save data inside the browser. With one very significant exception, it functions quite similarly to `sessionStorage`. Even when you exit the browser window, data stored in `localStorage` will continue to exist in the browser. The information kept in `sessionStorage`, on the other hand, will be erased when the user closes the browser window.

**What kind of data can be kept in localStorage?**
Key-value pairs are used to store data in `localStorage`. I want to make one very crucial point: `localStorage` can only be used to store strings. An object from an array will be automatically transformed into a string if you attempt to store it. Use the `JSON.parse()` method if you want to change the string back to its original data type.

**How do we communicate with localStorage?**
We can interact with localStorage using a number of inbuilt ways. The capabilities of each of these techniques are listed in detail below.

`localStorage.setItem()`

Two arguments are expected by this method. Both the first and the second are pieces of information you want to store. Since `localStorage` may only hold strings, both arguments must be strings. I've provided an example below to assist you understand my perspective.

```
localStorage.setItem("name", "Kelvin Sowah")
```

The name key and its value are essentially stored in `localStorage` by the code above.

`localStorage.getItem()`

This method's objective is to fetch data from `localStorage`. The key of the value you wish to obtain from `localStorage` is the only input this function expects.

```
localStorage.getItem("name")
```

The value corresponding to the key of `name` will be returned by the code example above. It will return `"Kelvin Sowah"` in our case.

`localStorage.removeItem()`

The method's name implies that you can use it to delete a single set of key-value pairs from `localStorage`. One parameter, which might be any of the keys in `localStorage`, is required by the method.

`localStorage.removeItem("name")`

Now, there shouldn't be any data with the key `name` in our `localStorage`.

`localStorage.clear()`

In contrast to the previous method, this one completely clears the `localStorage`.

I appreciate you reading my brief but enlightening blog. Hopefully, you now have a clearer idea of what `localStorage` is and know how to use it.
10 LIVROS QUE VOU LER EM 2022
Published: 2022-12-20 20:19:34

1 HACKING APIS
2 API SECURITY IN ACTION
3 JAVA SECRETO
4 PRACTICAL IOT HACKING
5 MOBILE APP REVERSE ENGINEERING
6 SQL INJECTION STARTEGIES
7ANDROID SECURITY INTERNALS
8 ANDROID HACKERS HAND BOOK
9 SERVERLESS SECURITY
10 ANDROID APPS SECURITY: MITIGATE HACKING, ATTACKS AND SECURITY BREACHES
#java #iot #sql #reverseengineering #androidapps #hacking #android #security
Understanding JavaScript Promises
Published: 2022-12-20 20:14:44

A promise is like a special kind of present. Imagine you're 5 years old and you really want a new toy. You ask your mom for a new toy and she says, "I promise I'll get you a new toy, but it might take some time to find the perfect one. In the meantime, you can do other things and play with your other toys."

In this situation, your mom's promise is like a special kind of present that she's going to give you in the future. You might not have the toy right now, but you know that your mom will get it for you eventually.

A JavaScript Promise is a special kind of object that helps you deal with something called "asynchronous code." Asynchronous code is code that takes some time to run, like when you are waiting for a website to load or a file to download.

Promises make it easier to work with asynchronous code by giving you a way to say "when this task is finished, do this thing." For example, you might have a Promise that says "when the file finishes downloading, log a message to the console."

To use a Promise, you first need to create one. You can do this by calling the Promise constructor and passing it a function that has two arguments: `resolve` and `reject`. The `resolve` function is called when the asynchronous task is successfully completed, and the `reject` function is called if there is an error.

Here's an example of a Promise that waits for a file to download:

```
const downloadPromise = new Promise((resolve, reject) => {
  // Start the download
  const file = startDownload();

  // Wait for the download to finish
  file.on('finish', () => {
    // The download was successful, so call resolve
    resolve();
  });

  file.on('error', (error) => {
    // There was an error, so call reject
    reject(error);
  });
});
```

Once you have created a Promise, you can use its `then` method to specify what should happen when the asynchronous task is completed. The `then` method takes two arguments: a function to call if the Promise is resolved, and a function to call if the Promise is rejected.

Here's an example of using the `then` method with the `downloadPromise` from above:

```
downloadPromise.then(
  () => {
    console.log('The download was successful!');
  },
  (error) => {
    console.log(`There was an error: ${error}`);
  }
);
```
What language we should choose for our project? And where we should be searching?
Tags: api, backend
Published: 2022-12-20 20:07:46

Hello!

We are getting together for a new project, to build a 2-way API connectivity tool for programmers experimenting with new forms of e-commerce, and merchants operating across a range of e-commerce platforms. We would be grateful for any programming language choosing tips. We are looking for an experienced Full-stack/API Engineer to join our small team, to help us move fast and build a low latency and highly secure data exchange. Ideally someone that’s experienced in backend engineering and building scalable API products, but to also know Javascript, because of our frontend work which is underway. We are not sure which language would be the best for our backend in this case. We have created [this post](https://nofluffjobs.com/job/senior-full-stack-eng-for-api-product-hedless-remote-o0ffuwzc) already. Could anyone help suggest where else we could post this requirement to find a knowledgable programmer to join us with this project?

Have a nice day everyone!
How I went from zero to $1.5 a day with just organic content
Published: 2022-12-20 19:12:43

I've been providing services for major news portals for a few years now, moving from the technical part of the sites - mostly WordPress, to the content and monetization part via Google Adsense.

At the end of a beautiful day, closing a contract with a client, I remember a strong partner in portugal in content monetization and I called her to participate in the meeting with the client, which had just ended.

the indignation
And in just 10 minutes, we closed a contract worth more than 6 figures, referring to 4 months of advertising on the portal. (wow, too interesting. I added an absurd amount of value to the customer)

I was hammering myself, too much too much, because I put money in for customers, and for me, what else could I be doing? That's when I decided to create the [Diário Momento](https://diariomomento.com.br/).

With a focus on trending articles, journalists focused on Google Trends, more specifically on [Hot Trends](https://trends.google.com/trends/hottrends/visualize?pn=p18&nrow=4&ncol=4), we launched the portal on August 1, 2022.

Today, with a lot of organic content, including automatic content (which people say penalizes, but we came to the conclusion that if it's content that adds value to the user, it being automatic isn't bad at all), we're managing to reach the average US $1.5 per day. In a 100% organic portal, with articles based on originality and focus on factual facts.

Ahhh, there's a detail. The placement of Google Adsense ad banners made us jump from US$0.40 RPM to over US$2.50. RPM is revenue per thousand page impressions.

We are still at the beginning. Give me 10 years. hahahha

And soon we will make a post in Diário Momento talking a little more about TabNews.
How To Add External Scripts in NextJS
Tags: javascript, webdev, nextjs
Published: 2022-12-20 19:52:11

**Introduction**

When working with ReactJS only if we needed to add an external script it's quite easy we can just add a script tag in the main index.html file and then it works most of the time but then when it comes to NextJS, there is no HTML file we can add the script to, so how do we add it? So let us dive into the solution.

**How To Fix it**
Using a normal script tag in the Head component will give warnings and won't work so instead, we use a component that is built into NextJS which is the Script Component. This component mimics the behavior of the script tag and you do not have to add it to the head you can add it to any page component to use it, and we can import it from NextJS using this format

``` 
import Script from "next/script"
```
it has props which are existing attributes on the normal script tag example
```
import Script from "next/script";
import SomeComponent from "next/script";

const HomePage=()=>{
  return (
     <div>
       <Script 
        type="text/javascript" 
        id="hs-script-loader" 
        async 
        defer 
        src="//link-to-external-js"
       />
      <SomeComponent/>
     </div>
   )
}

export Homepage
```

so the Javascript can now be loaded on the page and you can be able to use the javascript functions and variables.
To know more about this component you can visit this link [https://nextjs.org/docs/api-reference/next/script](https://nextjs.org/docs/api-reference/next/script)

Thanks For Reading 😊😊😊😊😊
Why is char[] preferred over String for passwords in Java ?
Tags: java, programming, security, password
Published: 2022-12-20 19:47:06

In Java, it is generally considered more secure to use a char[] array to store passwords than to use a String object. This is because String objects are immutable, which means that they cannot be modified once they are created. This means that if a String object containing a password is stored in memory, it cannot be securely erased or overwritten, and it may remain accessible to attackers even after it is no longer needed.

In contrast, a char[] array is mutable, which means that its contents can be modified and erased. This means that a password stored in a char[] array can be securely erased or overwritten as soon as it is no longer needed, reducing the risk of the password being accessed by attackers.

Additionally, String objects are often stored in the string pool, which is a shared area of memory where String objects are stored for efficient reuse. This means that multiple references to the same String object may exist in the string pool, and the password may be accessible through any of these references. A char[] array, on the other hand, is not stored in the string pool, so it is less likely to be accessed by attackers.

{% embed https://youtu.be/lP6P_NvJIjA %}

Overall, the mutability and non-pooling behavior of char[] make it a more secure choice for storing passwords than String, which is why it is generally preferred in Java.
All the Boxing Equipment you need to train
Tags: boxing, equipment, ufc, boxingtraining
Published: 2022-12-20 19:38:52

## Fundamental Boxing Equipment for Amateurs: What to Get and Why?
**What Gear Do You Want for Boxing?**


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

Considering that you came to this article, we expect you are keen on figuring out what hardware you want to begin boxing. Simply relax. We take care of you, as you can track down replies to every one of your inquiries here and where to purchase your gear.

To begin [Boxing](https://denarysports.com/all-the-boxing-equipment-you-need-to-train/), you want these Gear: boxing gloves, shoes, Headgear, Hand Wraps, Crotch Security, mouth watchman, and bounce Rope.


When you begin boxing, you first need to track down a Gym centre. Most exercise centres will have a proper setup of gear recorded previously. If you can, it’s better, more agreeable and clean to have your boxing gear.

## The Fundamental Hardware For Boxing Beginners

### Boxing Gloves

The gloves for novices is a seriously discussed subject, and numerous assets have been composed on the point. Momentarily, there are two boxing gloves for beginners: pack gloves (or preparing gloves) and rivalry or fighting gloves.

You’ll have to place assets into a fair arrangement of pack gloves. These are made to shield your hands while you beat a heavy pack, so it’s ideal to be modest here, or you’ll buy one more pair after a portion of a month. The Bytomic Entertainer 3.0 Carbon Boxing Gloves are an incredibly touchy expense choice.

[...Readmore](https://denarysports.com/all-the-boxing-equipment-you-need-to-train/)
Arbitrum JSON RPC Node testers needed ! You get lots of free cool stuff!
Tags: webdev, web3, blockchain, rpc
Published: 2022-12-20 19:32:29

We at [chainnodes.org](https://www.chainnodes.org/) are looking for startups, companies and solo developers to test out our **SUPER LOW LATENCY** Arbitrum JSON RPC nodes.

What you get?

- Technical support above and beyond our project from TOP Web3 developers

- Unlimited archival data + unlimited access to JSON RPC APIs for FREE for 2-3 months  + huge discounts in the future 

- All debug and trace APIs are supported
Receivers!
Published: 2022-12-20 19:26:24

We are working on uplink receiver design now, and there's lots of things we've decided, and still a bunch of things that need to be decided. 

The channel is 100 kHz, the signal is ~40 kHz wide, the residual doppler (this is for space) is +/- 12 kHz, and channels are uncoordinated.
For all Web3 Devs out there! You can now get Polygon, Ethereum, Optimism APIs for free or affordable 🤑
Tags: web3, blockchain, blockchaindev, dapp
Published: 2022-12-20 19:14:57

**I want to introduce [Chainnodes.org](https://www.chainnodes.org/)**

What is Chainnodes.org?

Reliable and Affordable Web3 Infrastructure. Ethereum, Polygon, Optimism and other APIs for Developers & Decentralized Apps

With Chainnodes.org  you get affordable access to the Web3 world. Ethereum, Polygon, Optimism, BSC, Arbitrum APIs

**Features:**

🔵 It takes literally 40 seconds to get your Ethereum, Polygon, Optimism APIs

🔵 Low Latency (<100ms)

🔵 We support all debug and trace APIs (like  trace_block ). Even on the free plan!

🔵 High Speed Block Execution (~50ms)

🔵 High Rate Limits (up to 500 RPS)

🔵 >  99.99% Uptime

🔵 ALL Requests are Archival. No limits on archival requests

🔵Anonymity as you can pay with crypto and we do not store your data
 
🔵The best FREE PLAN OUT THERE with 12.5M archival requests
How To classify cars using Tensorflow , Resnet50 and Python ?
Published: 2022-12-20 19:14:55

Hi,

This is a Tensorflow tutorial that enables you to classify cars images using a transfer learning process.
In this tutorial, We will install the relevant Python libraries , and use  Resnet50 model , and learn how to classify and detect objects in images.

The link for the video tutorial is here : [https://bit.ly/3BJvKmK]
I also shared the Python code in the video description.

Moreover, I recommend This graphics card: NVIDIA GeForce RTX 3060 Ti . I am using it to train my Tensorflow models.
Perfect results and performance: [https://amzn.to/3mTa7HX] 


Enjoy

Eran

#Python #Cnn #TensorFlow
Use locals with Terraform
Tags: terraform, cloud, cloudnative, cloudskills
Published: 2022-12-20 19:00:00

Locals are like variables another tool to avoid hard coding values in terraform scripts and keep the code DRY.

The scope of locals is restricted to the current module and can yield

- a hard value like a string, integer etc.
- an expression

Locals cannot be passed through the CLI or environment and represent a more permanent, constant value or expression in your code.

## Create Locals

Locals can be defined in the `locals` block and used in the same module.

```jsx
locals {
  uuidv4 = "4c67baa1-f139-45c0-85d4-451e615ece9a"
  bucket_name = "my-fancy-bucket-${uuidv4}"
}
```

### Use Locals With Ternary Operator

Locals can be used together with the Ternary operator to assign a conditional value to a local variable.

This can be e.g. useful if you want to differentiate the instance count of EC2 instances in a development vs. production environment.

```jsx
locals {
  ec2_count = var.stage == "production" ? 3 : 1
}

resource "aws_instance" "my_instance" {
  ami           = "ami-005e54dee72cc1d00"
  instance_type = "t2.micro"

  count = local.ec2_count
}
```
You are not bad at problem-solving as you think, you are just on the right path (Motivated Speech For Developers)👌
Tags: webdev, beginners, programming, productivity
Published: 2022-12-20 18:36:21

Problem-Solving skill is one of the most essential skills that you must have to apply for jobs in programming, all the interviews ask you to solve a problem using one of the programming languages you know.

if it is your first time on that path, you may find it difficult a little bit… but by the time, you will master it, all the professional developers have passed through that road at first but later, they managed to master Problem-Solving.

---

## The Key of Problem-Solving Mastery :

So what do if you feel that you are getting stuck too much in solving problems whatever the language you use :

- For each problem I couldn't solve, I try hard to think of a solution even if that solution is 100 lines of code that's fine.

- if I can't find one, the last step is searching for the solution on Google…

- Search for the solution, read it, and then try to remember and write it, do not just read the solution and quit, that's a bad habit for the developers' community and most junior developers do that wrong attitude.

---

so do not think of yourself that you are bad in problem-solving as you couldn't solve one, that's fine we all have faced that and by knowing the solution and understanding it and its logic, we improve our logical thinking by that.

And last but not least, repetition, repetition  is beneficial for any junior developer, try to solve the previous problems that you got stuck in solving again, or maybe try solving them with another programming language, it doesn't matter anyway but it is a solution of Boredom.

Thanks for reading and I hope you become a master in problem-solving…

support for more and better posts ❤️
CodePen Designs - 6 : LEGO Preloader
Tags: codepen, codependesigns, css, design
Published: 2022-12-20 17:45:38

### We are excited to introduce our new series that will explore the best design ideas from the Codepen community. 

We will be publishing these each day and hope you find them insightful and inspiring as we showcase some of the most talented designers in this space.

---


#### Codepen Design - 6

<p>A LEGO-themed preloader concept of a tower seemingly in endless progress. The idea is based on a <a href="https://twitter.com/concinnus/status/1602287175113900032">GIF by CONNCINUS</a>.</p>

{% codepen https://codepen.io/jkantner/pen/BaPaoGm %}


---
## For more information

1. Check my GitHub profile
[https://github.com/amitSharma7741](https://github.com/amitSharma7741)

2. Check out my Fiver profile if you need any freelancing work
[https://www.fiverr.com/amit_sharma77](https://www.fiverr.com/amit_sharma77)

3. Check out my Instagram
[https://www.instagram.com/fromgoodthings/](https://www.instagram.com/fromgoodthings/)

4. Linktree
[https://linktr.ee/jonSnow77](https://linktr.ee/jonSnow77)

5. Check my project

- EVSTART: Electric Vehicle is the Future
[https://evstart.netlify.app/](https://evstart.netlify.app/)
-  News Website in react
 [https://newsmon.netlify.app/](https://newsmon.netlify.app/)
-  Hindi jokes API
 [https://hindi-jokes-api.onrender.com/](https://hindi-jokes-api.onrender.com/)


---
---
A Class (not a collection of objects)
Tags: class, programming
Published: 2022-12-20 17:03:27

One day I got a call from my friend asking me the meaning of a class for which I instantly answered that the class is a ‘collection of objects’. Well, you know what I was wrong, this lead me here to tell my fellow mates that class is not a collection of objects.
Before going into programming meaning of a class, let’s see what a class is in real world.
A class is a set of things having some property or attribute in common, for example, apple, orange, grapes known as fruits in general but has its own identity, attribute and behavior.
Similar in programming too, Class is a template/blueprint to create objects, which are instance of that class used in object-oriented programming. Well, everyone has this assumption of class being a collection of objects which is totally wrong because an object can be instantiated through class and with one class you can create many objects of same type thus an object becomes instance of a class but not the other way round. There are many data structures designed to hold a collection of objects such as arrays and lists but definitely not class.
This example gives you a clear picture on what a class is and why It cannot be an object.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qdv6tio2uerrxtl5j8kj.jpg)
 
A class has some set of rules called as methods and some values known as data members. Both data and methods are defined automatically in a class when an object is created. Hence one can make as many objects as they want based on class. In the above example Human (the template) is created first and then the objects of human can be created based on the template and each object must have the data and methods.