teleren/devto huggingface dataset:
Understanding The Node.js Events Module
Tags: node, interviewquestions, codenewbie, eventemitter
Published: 2021-07-10 20:11:46

---
title: Understanding The Node.js Events Module
published: true
date: 2021-06-24 18:31:43 UTC
tags: nodejs,interviewquestions,codenewbie,eventemitter
canonical_url: https://medium.com/@oaluna/understanding-the-node-js-events-module-67b9820e57ea
---

Breaking down the Events Module for your next interview.

[Continue reading on Medium »](https://medium.com/@oaluna/understanding-the-node-js-events-module-67b9820e57ea?source=rss-be00f566a88f------2)
IT Disaster Recovery Plan Steps
Tags: disaster, recovery
Published: 2021-06-24 18:28:38

What do you do when the server crashes?  Or data is corrupted?  Some technology problem has taken your entire company offline?

Whether you are a system administrator, Chief Technology Officer, or software developer... you hope this will never happen.  But if it does, you better be ready.  Make a mistake during an emergency and the disaster can be 100 times worse.

There are nine steps I have used which work every time, regardless of what kind of IT disaster has happened.  Stop it from getting worse and how to handle it in the most effective and least stressful way.

## What qualifies as a "disaster"?

- Anything that takes your **company** offline so they cannot work
- Your company website or app goes offline so **customers** cannot access it
- Anything that corrupts data
- Security breach and sensitive data stolen

The first thing to realize is there are multiple possible causes for any perceived disaster.  These steps work regardless of what type of disaster and regardless of the cause of the disaster.

For example, if your company website goes offline that could be caused by such a wide variety of reasons and at first you have no idea how big or trivial this is as a "disaster".  Let's say you are working remotely and the director of operations calls you from the Ohio office and says the website is down.  No employees in Ohio can access the website and the director is starting to panic.

Here's a list a few possible causes from trivial to true disaster for this example.

## Possible Causes for Web Server Offline

1. really only the Ohio office has a problem with router or internet access; the rest of world accesses website fine
2. network node in Ohio was cut and traffic using that network lost access; DNS needs to reroute; contact your data center and let them know the details
3. a renegade admin changed everyone's passwords without notifying management
4. the datacenter performed scheduled maintenance and their backup battery failed
5. some developer uploaded a core file or database configuration file and brought down the website
6. server software failure: apache kernel crash, SQL server crash, etc.
7. DDOS attack on your server
8. hackers infiltrated your server and encrypted hard drive for ransom
9. hard drive is full
10. hardware failure at the data center; could be firewall, router, network card, one of the servers, etc.
11. hard drive failure and corruption
12. database corruption
13. and many other possible problems

When the Director of Operations calls and says there is a problem, they have no idea how trivial or terrible the problem is.  It's your job to *keep a level head* and "fix it".

Watch video for the 9 Steps to handle any disaster.

{% youtube j3u0kb77iO4 %}

There is no doubt a disaster is a horrible experience.  But if you handle it well you will be known as a hero later.
I created my own VPN using a free VPS - want to know how?
Tags: vpn, vps, freevpn
Published: 2021-06-24 18:04:18

Hey Guys

a few days ago when I searching for a VPN almost all the VPN pricing look high, so planned to make it my own using a vps. that was very simple ..

here i am sharing u all the things i did

i made a video about how to do it in 6 minutes

will share the link here : https://www.youtube.com/watch?v=Uua61nLMgJ0

u can checkout those and know about how to config the vpn

here i am sharing the link of software and vps service i use

Get Outline: https://getoutline.org/

Get VPS: https://linode.gvw92c.net/YgdYYq (u can get $100 free credit so enjoy)
Looking for Mozilla VPN research participants
Tags: research, ux, security
Published: 2021-06-24 18:03:04

At Mozilla, we are looking to better understand our customers’ experiences with Mozilla VPN, to learn what could improve the product or the service for them. Specifically we are looking for people who:

• Have used Mozilla VPN
• Have cancelled their Mozilla VPN subscription in the past 3–6 months

Participants are asked to take part in a 1-hour interview, scheduled sometime between July 7–14, 2021. As a thank you for your time and feedback, you will receive a $75 Amazon gift card. 

If you are interested in participating, please [fill out this 5-minute survey](https://qsurvey.mozilla.com/s3/vpn-recruiting-sm) and we will reach out to those who qualify with more details. Thank you!
An introduction to common digital marketing jargon for beginners
Tags: digitalmarketing, marketing, onlinemarketing
Published: 2021-06-24 18:02:46

Digital marketing has more than its share of jargon for the individual to learn.

As marketing is all about getting and keeping new customers, I could see we online marketers have an image problem.

A client who was interested in taking his business online pointed the online marketing jargon out to me vividly and asked for an explanation.

He stopped me mid-sentence with the words “speak English geek boy” that was my wake up call.

I'm writing this short guide to digital marketing jargon, to help anyone on the outside of the digital marketing circle get on the inside much quicker.

1) Digital Marketing, is selling any product or service online. It’s this low cost of entry which is attractive in starting your own online business.

2) Joint Ventures, a joint venture is a partnership. Simply put, 2 or more people work together to increase their sales, or to complete a product or service.

3) Subscriber List is a list of people who have given permission for the marketer to send them emails which may contain adverts.

This is also known as an opt-in list, because subscribers opt in to receive the emails.

4) Viral Marketing, this little phrase is used to describe a way of increasing your business, or websites reach, by using a “viral technique”.

In real life, a virus spreads out by people contacting one another.

Some clever people realised they could use the power of people sending each other information, and watch information about their own business being spread in the same way as a virus.

5) Niche Marketing, this is the act of selling to a particular group of people.

An example of a niche market is poodle owners. They are dog owners, but will specifically search for information about poodles.

These markets can be profitable because many people do not target directly them so if you have a product tailored to a niche market you have little or no competition.
Tailwind CSS User? Read this!
Tags: tailwindcss, javascript, css, webdev
Published: 2021-06-24 17:30:00

So, if you are like me, a frontend developer who loves to work with Tailwind CSS, then this article may just save you a minute or two in the future. You see folks when I started my journey with Tailwind, I went to the place where all the secrets lie when it comes to any framework or library. And yeah! you guessed it right. The holy documentation. 👨🏻‍💻

I opened the Next.js Tailwind set up guide and found out that that there were a bunch of steps that I needed to perform in order to get started with this beauty. And just like you, I did all the steps and voila! I had Tailwind integrated with my project.

After this, I started reading documentation and found out that the setting up process of Tailwind varies from framework to framework. So now, if you want to use Tailwind with your React.js project after using it with Next.js, the same setup steps won't do the trick.

Turns out I really hate when I have to spend an extra minute or two to get started with something. So like any other developer, I used my magic prowess to automate the crap out of it. And voila! Here comes the era of [new-tailwind-app](https://github.com/msaaddev/new-tailwind-app).

## ⚡️ new-tailwind-app

So, [new-tailwind-app](https://github.com/msaaddev/new-tailwind-app) is a zero-configuration cross-platform tool that can integrate Tailwind with six different kinds of web frameworks using a single command. Yeah! I know. Magic, right?!

All you need to do is have Node installed in your computer and from there I got you covered. Just run the following in your terminal, and you are good to go:

```sh
npx new-tailwind-app@latest 
```

You can see all the supported frameworks by typing the following command in the terminal.


```sh
# see all the features you get with the CLI
npx new-tailwind-app@latest --help
```

[![help](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29w06vuc9duejlapvy9u.png)](https://github.com/msaaddev/new-tailwind-app)


And that's a wrap, folks! If you find this tool useful, don't forget to [star](https://github.com/msaaddev/new-tailwind-app) it. Now go ahead and utilise the power of open-source to do good and save yourself some time. 

Cheerios 🤞🏻
Migrando Class para Function component
Published: 2021-06-24 17:26:33

Em algum momento de nossas vidas teremos de refatorar os Class Components que empurramos para debaixo do tapete. O objetivo deste artigo é te auxiliar nesse processo.

**Chamarei o Class Component de CC e os Function Component de FC para facilitar única e exclusivamente a minha vida.** *Tá passada?*

Com FC e hooks nós podemos cobrir todas as funcionalidades de um CC como:

1. Para o state do CC, temos o useState hook
2. CC ciclo de vida, temos o useEffect hook
3. Bonus: melhor abstração com custom hooks (Falarei mais sobre isso no futuro)

Como você faria para refatorar o código abaixo usando hooks e FC?

```
class App extends React.Component {

  state = {
    value: localStorage.getItem("info") || ""
  };

  componentDidUpdate() {
    localStorage.setItem("info", this.state.value);
  }

  onChange = event => {
    this.setState({ value: event.target.value });
  };

  render() {
    const { value } = this.state;
    return (
      <div>
        <input value={value} type="text" onChange={this.onChange} />
        <p>{value}</p>
      </div>
    );
  }
}
```
Com certeza você já descobriu como fazer esse refactor, certo? Vou escrever abaixo o código que você pensou, só para deixar registrado. 

```
const App = () => {
  const val = localStorage.getItem("info") || "";
  const [value, setValue] = useState(val);
  const onChange = event => setValue(event.target.value);

  useEffect(() => localStorage.setItem("info", value), [value]);

  return (
    <div>
      <input value={value} type="text" onChange={onChange} />
      <p>{value}</p>
    </div>
  );
};
```

Substituímos o setState pelo useState e o componentDidUpdate pelo useEffect. Diminuimos as linhas de código e mantivemos todas as funcionalidades!

Mas dá pra irmos além. Nosso objetivo é tornar o nosso código reutilizável para evitar o famoso retrabalho. Como podemos fazer isso? Por criarmos um **custom hook**

```
const usePersistentStorage = key => {
  const val = localStorage.getItem(key) || "";
  const [value, setValue] = useState(val);

  useEffect(() => localStorage.setItem(key, value), [key, value]);

  return [value, setValue];
};

```

Agora é só utilizarmos o hook usePersistentStorage no nosso App component.

```
const App = () => {
  const [value, setValue] = usePersistentStorage("info");

  const onChange = event => setValue(event.target.value);

  return (
    <div>
      <input value={value} type="text" onChange={onChange} />
      <p>{value}</p>
    </div>
  );
};
```

Agora temos apenas 10 linhas de código e ainda poderemos usar o usePersistentStorage em N lugares.
Quick Notes on No-Code and Pricing
Tags: nocode, opinion
Published: 2021-06-28 20:05:27

---
title: Quick Notes on No-Code and Pricing
published: true
date: 2021-06-24 17:16:57 UTC
tags: NoCode,Opinion,Nocode
canonical_url: https://maxkatz.org/2021/06/24/quick-notes-on-no-code-and-pricing/
---

Parabola is one of my favorite no-code tools. I wrote numerous [no-code articles and tutorials](https://maxkatz.org/category/no-code/) about Parabola. I also [used Parabola in videos](https://youtube.com/playlist?list=PLSAWywyhniCOpvlFSfUWVNAbclc2-1Kne) I recorded.

Back in March or April Parabola updated its pricing. This is how the new (current) pricing looks:

[![Parabola pricing](https://katzmax.files.wordpress.com/2021/06/parabola-pricing.png?w=1024)](https://katzmax.files.wordpress.com/2021/06/parabola-pricing.png)<figcaption>Parabola pricing table</figcaption>

I don’t have a screenshot of the old pricing. I do remember that with old pricing you could start with as little as $5-$10 per month. They still had a free plan but the first paid one was around $10 or so.

This is interesting because the increase is significant (to $80). My opinion – this makes sense. As no-code companies mature they need to make money and move up market. When you charge $5 or $10 a month – it’s not sustainable in the long run, it’s hard to make money unless you have millions of customers. I believe we will see more price increases in the no-code space.

What do you think?
Speaking at a Twitter Space
Tags: twitterspaces, content, devrel, community
Published: 2021-06-24 17:15:59

Have you seen Twitter Spaces before? It is a relatively new way to have live audio conversations with a group of people on Twitter.

@eddiejaoude invited me to speak at "Creating content like a pro" on Twitter Spaces.

I was a little anxious because the share button content was just to a "reminder" to join. I am so used to having a link to some actual call.

So when the clock stroke 17:30 there I was ready to click at the top of twitter space on the twitter app on my android phone.

I clicked to request speaker privileges and Eddie promptly accepted it. If at any time I no longer want this privilege I can click on the gear and select "switch to listening".

I started exploring the UI and seeing if I could...perhaps speak on the chat? There is no chat! Oh but there are reactions, ok that is familiar! There are live captions which is also great for accessibility!

The very first seconds I thought to myself: how does it work? How will I know when it's my turn to talk? How will I know I am not speaking over someone else?

To my good surprise Eddie started guiding us, asking us to introduce ourselves and whenever there was a question from the audience, Eddie would promptly keep track of the speakers who unmuted themselves and get back to them after the other speaker gave their response.

I must say I enjoyed this type of interaction because even if you are a "speaker" it is a conversation so I could learn a lot from the others as well!
Balm for WSL2 Woes
Published: 2021-06-24 17:12:03

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

So, I did a [thing](https://github.com/bmrussell/FixWsl2) to work around WSL2 networking going to hell in a handcart when connecting to my work VPN.

It's not pretty, but works in a pinch when you need to run `apt install` to grab a quick utility. Linux is just so much better for Getting Stuff Done when you need to hack something up with a bunch of command line tools that someone else has probably already written.

Really Microsoft need to sort this as I'd imagine it's a fairly common scenario.

How do other devs get round this?

{% tag wsl %} {% tag windows %} {% tag linux %} {% tag powershell %}
Form validations
Tags: go, gin
Published: 2021-06-24 17:06:09

As we saw in previous section, our handlers are working as expected when we pass valid data. But what about not valid data? Or missing data? Let's test this. First, let's remove (or just comment) `Password: passwordValue` from our `submitHandler()` inside of `assets/src/components/Auth/AuthForm.js`. This way, our backend will send only Username, without Password. Let's now create new account again. We can see in browser dev tools that only Username is sent, but request returned status OK, we got JWT and user is created without password. Of course, we don't want that. That's why we need to add form validations.

![Without form validations](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ksc5ua4clrzf1inx1ho.png)

Fortunately, adding validations is easy. Inside of `internal/store/users.go` where User struct is defined, just add these tags:

```go
type User struct {
  Username string `binding:"required,min=5,max=30"`
  Password string `binding:"required,min=7,max=32"`
}
```

This tells Gin what fields are required, as well what minimum and maximum allowed lengths are. Gin uses [go-playground/validator](https://github.com/go-playground/validator), so all supported validators and tags can be found [here](https://pkg.go.dev/github.com/go-playground/validator#hdr-Baked_In_Validators_and_Tags).

If we try to sign up or sign in again using modified version of `AuthForm` without sending Password field, we will get error.

![With form validations](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/218zlldex2cvl8uvt8v1.png)

Now we can revert `AuthForm.js` to original state to send Password field again, and everything should work. You can also try to sign up or sign in with too short or too long username/password to verify that `min` and `max` validations are also working as expected.
7 steps to crack your next coding Interview
Tags: coding, computerscience, programming, interview
Published: 2021-06-24 17:02:25

## Here are 7 Golden steps to follow to improve your chances of cracking the coding interview 💡

### 1. Clarify the question with the interviewer. ✔

Make sure you correctly understand the question before you even try and implement it.

### 2. Confirm the format of the input and the output. ✔

Understanding the input and output format can help visualize the problem better. It can also help in coming up with a solution to the problem.

### 3. Use test cases and run through a quick example. ✔

Running through an example clarifies with the interviewer that you have understood the problem well. It also gives you an example to test your code once you've completed coding your solution.

###4. Brainstorm your approach with the interviewer. ✔

This helps the interviewer know what you're thinking and also correct you if you're on the wrong track. If you're stuck you can think of the various Data Structures that could help solve the problem and move ahead from there.

### 5. Discuss the Runtime analysis with your interviewer. ✔

If your solution is not the most optimal one, your interviewer will hint at there being a more optimal approach. You must discuss the time and space complexity of your solution.

### 6. Start coding your solution. ✔

Remember to TALK ALOUD while coding. Your interviewer can't read your mind. Hence, it is important to keep explaining what you're doing to make sure the interview understands your code as well.

### 7. Debug your code. ✔

Once you have coded your solution, go through it entirely to make sure your code does not have any bugs. Use the example test case in (3) and run that through your code. You must also test your code with certain edge cases, to make sure it won't break.


Next time you prepare for an interview, follow this 7 step process and it will improve your chances of landing that dream job of yours. 🚀

---
If you liked this article and would like to read similar work, be sure to follow me on [Twitter](https://twitter.com/RahilSarvaiya) where I’ll post updates about publishing my latest articles. 

Please feel free to share your thoughts on this article in the comments section. If you guys have any suggestions regarding this article or on any other interview tips, I would love to know.
How to Use AsyncImage in SwiftUI 3
Tags: swift, swiftui, ios
Published: 2021-06-24 17:01:25

---
title: How to Use AsyncImage in SwiftUI 3
published: true
description: 
tags: #swift #swiftui #ios 
//cover_image: https://direct_url_to_image.jpg
---

<!-- wp:paragraph -->
<p>Recently Apple has announced <strong><a href="https://developer.apple.com/documentation/swiftui/asyncimage?changes=__5">AsyncImage</a></strong> at WWDC 2021. This makes loading images from a URL very easy in SwiftUI projects supporting iOS 15 and above. Let's take a look at an example below. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If we want to load an image from a URL, all we need to do is add the following line of code.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>AsyncImage(url: https://i1.wp.com/swifttom.com/wp-content/uploads/2019/10/img_8186-2.jpg?resize=338%2C452&amp;ssl=1)</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>That's it! This is all the work we have to do to load an image from a URL! The only problem here is the URL image will most likely take up the whole screen because we didn't set the image modifiers. We also would want some sort of placeholder image while the URL image loads. No worries, <meta charset="utf-8"><strong><a href="https://developer.apple.com/documentation/swiftui/asyncimage?changes=__5">AsyncImage</a></strong> has us covered. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>By adding initializers to our <meta charset="utf-8"><strong><a href="https://developer.apple.com/documentation/swiftui/asyncimage?changes=__5">AsyncImage</a></strong>, we can have a placeholder while the image is loading and style our image once is has loaded.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>            AsyncImage(
                url:https://i1.wp.com/swifttom.com/wp-content/uploads/2019/10/img_8186-2.jpg?resize=338%2C452&amp;ssl=1,
                content: { image in
                    image.resizable()
                         .scaledToFit()
                         .frame(maxWidth: 100, maxHeight: 100)
                },
                placeholder: {
                    ProgressView()
                }
            )</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>In the example above we have added a <strong>content</strong> parameter to our <strong><a href="https://developer.apple.com/documentation/swiftui/asyncimage?changes=__5">AsyncImage</a></strong>. This allows us to set the image modifiers to give our image styling. We also added a <strong>placeholder</strong> parameter which allows us to show a view as a placeholder until our image has loaded. In the example above we are using a <strong><a href="https://developer.apple.com/documentation/swiftui/progressview/">ProgressView</a></strong> as our placeholder until the image loads.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I hope you find this useful in your next SwiftUI 3 projects! Happy coding!! 🌁📸🤳</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->