teleren/devto huggingface dataset:
Shamanic way to deal with errors
Tags: beginners, help
Published: 2023-03-20 08:48:13

[Original post.](https://aidas.site/blog/shamanic-way-to-deal-with-errors/)

*Disclaimer: due to my limited English vocabulary I used the word "shaman" as a metaphor only. The usage of "shaman" in this article has nothing to do with the true meaning of the word.*

Unless you have some masochistic tendencies, I bet you hate errors the same as I do. No fun is fun under the buggy Sun, right? And solving them might be like beating one's head against the wall. From my experience, things might get clearer when we compare them to one of those warm late spring days: you're walking in a blooming park, laughing with your friends and bursting with the joyful energy enriched by the Sun, when suddenly you step into... (for the lack of a better word) ...*shaman*.

Occasional shaman
-----------------

1.  Don't freak out. I know it sounds silly, but the first step is to stay calm. When you step into shaman, you don't want anybody to notice. So when seeing an error, don't freak out and rationally evaluate what happened.
2.  Make sure it's an error. Just like after stepping into shaman we double-check that it really happened, we should also confirm that the error (i.e. unintended behaviour) is present and it's not the usual flow of the program. However, a single confirmation is enough - we don't have to constantly check and curse that shaman is there - it's not going to disappear by itself. Unless...
3.  ...it's an error, which is non-repetitive. Just like shamans are changing their places unpredictably, some errors are one-time glitches which may disappear after simply retrying the same action.
4.  Restart the system.

    *Good old rain refreshes the day,*
    *As little shamans get drifted away.*
    *(author unknown)*

    Sometimes it happens that the program or the internet, or simply your computer gets tired. Restart it. Restart the program, router, computer or whatever isn't working. You won't believe how many times this solves the issue without further investigation.
5.  Check if a newer version of the program is available. Sometimes simply upgrading your device will do it.
6.  If a program is freshly installed and doesn't work as expected, you may try reinstalling it. It might be that during the installation process something went wrong.
7.  On the other hand, if the program/app/OS is on your machine for a long time and/or has lots of stuff installed, you may also want to reinstall it or at least remove old, unused stuff. Likewise, if shaman is laying there for days and you're constantly stepping into it, the simplest solution might be to simply remove it.
8.  Warning note: unless you have an ancient soviet machine, the old way of fixing, i.e. punching and kicking most probably won't work. I won't even mention what would happen with a shaman if you...
9.  Perform a complete scan for viruses & other malware. Maybe somebody's putting the shamans there intentionally?

[More techniques...](https://aidas.site/blog/shamanic-way-to-deal-with-errors/)
if (!var) - What does it mean exactly? Let's Explore with TypeScript
Published: 2023-03-20 08:39:40

if (!variable) What does it mean exactly? I think there's no need to explain much about this. This piece of code show us enough.

```ts
const nameof = (n: any) : string => Object.keys({n})[0];

const valueOrType = (n: any) : any => {
  if (n === undefined)
    return 'undefined';

  if (n === null)
    return 'null';

  if (n === '')
    return 'empty string';
}

const isFalsy = (n: any) : boolean => !n ? true : false;
const logInputIsFalsy = (inp: any) => console.log(`[${nameof(inp)}] - value : [${valueOrType(inp)}] - is ${isFalsy(inp) ? 'falsy' : 'not falsy'}`);

logInputIsFalsy('');
logInputIsFalsy(null);
logInputIsFalsy(undefined);
logInputIsFalsy(false);
logInputIsFalsy(0);
logInputIsFalsy('word');
logInputIsFalsy(1);
```

Console outputs:

- "[n] - value : [empty string] - is falsy"
- "[n] - value : [null] - is falsy"
- "[n] - value : [undefined] - is falsy"
- "[n] - value : [false] - is falsy"
- "[n] - value : [0] - is falsy"
- "[n] - value : [word] - is not falsy"
- "[n] - value : [1] - is not falsy"
hey
Published: 2023-03-20 08:33:22

I want to show my pages by country in javaScript I want to show my web pages in dubaie and frach and India so what do I need to do in code if I am in dubaie so I can only access the page for duabaie, not an india page I can not acess if I am in india so I can only access page in India, can any one help me to do a code in javascript please give me the code and example for it
5 Top Websites for Learning Frontend Development
Published: 2023-03-20 08:27:38

👨‍💻 Are you interested in learning frontend development? Whether you're a complete beginner or you have some programming experience, there are plenty of resources available online to help you learn this valuable skill. In this blog, we'll take a look at some of the best websites to learn front-end development for free.

1️⃣ Codecademy: Codecademy is an excellent website to start learning front-end development. They offer interactive courses on HTML, CSS, and JavaScript that cover everything from the basics to advanced topics. The courses are designed to be hands-on, so you'll be writing code from the very beginning. The best part is that you can access most of the courses for free, and their paid subscription gives you access to more advanced features.

2️⃣ FreeCodeCamp: FreeCodeCamp is a nonprofit organization that provides free coding courses for beginners and advanced learners. They offer a full curriculum for front-end development, including HTML, CSS, JavaScript, React, and more. The courses are project-based, which means you'll be building real-world applications as you learn. You can also earn certifications by completing their curriculum, which can help you land a job in the tech industry.

3️⃣ W3Schools: W3Schools is a well-known website for learning web development. They offer comprehensive tutorials on HTML, CSS, JavaScript, and many other programming languages. The tutorials are easy to follow and include interactive examples that you can try out yourself. Additionally, W3Schools has a vast library of reference materials that you can use as a quick reference while coding.

4️⃣ Mozilla Developer Network (MDN): The Mozilla Developer Network is a comprehensive resource for web developers. They offer tutorials, articles, and reference materials on HTML, CSS, JavaScript, and other web development topics. Their documentation is highly regarded in the industry for its accuracy and completeness. The best part is that everything on the site is completely free.

5️⃣ Udacity: Udacity is an online learning platform that offers a range of courses, including front-end development. They offer both free and paid courses, and their paid courses come with more advanced features like personalized feedback and career coaching. Udacity's courses are project-based, so you'll be building real-world applications as you learn. They also offer a nanodegree program in frontend development, which can help you land a job in the industry.

These are just a few of the best websites to learn frontend development for free. There are plenty of other resources available online, so don't be afraid to explore and find what works best for you. With dedication and practice, you'll be on your way to becoming a front-end developer in no time!💻

--
**Connect with Me: **
Instagram: [@i_am_rafikadir](https://instagram.com/i_am_rafikadir)
Days_9 Casting Spells on Your Code
Published: 2023-03-20 08:26:22

If statements support more than ==. They support inequality symbols as well. Remember those <, >, and = signs you used in math way back when? Well they are back again, but this time they look a bit different.
`1. equal --> 5 == 5`
`2. not equal --> 3 != 5`
`3. greater than --> 5 > 3`
`4. greater than or equal to --> 5 >= 3`
`5. less than --> 3 < 5`
`6. less than or equal to --> 3 <= 5`

```
#Nesting Dolls Code
#
#19 MARCH 2023

def exercise_1():
  MyScore = int(input("Your Score: "))
  if MyScore > 1000:
    print("Winner!!!")
  else:
    print("Try again😭")

def exercise_2():
  myPI = float(input("What is PI to 3dp? "))
  if myPI == 3.142:
    print("It's Number ", myPI)
  else:
    print("Try again")
def exercise_3():
  score = int(input("What was your score on the test? "))
  if score >= 80:
    print("Not too shabby")
  elif score > 70:
    print("acceptable")
  else:
    print("Dude, you need to study more!")
def call():
  exercise_1()
  exercise_2()
  exercise_3()
  
call()
```
Web scraping, web crawling | CrawlMagic
Tags: webscraping, python, dataextraction, programming
Published: 2023-03-20 08:12:26

We are [crawlmagic](https://www.crawlmagic.com/) team, we provide bulk data across internet. Also we offer web scraping bot, web crawling bot, and web automation.

Top listed on G2: [CrawlMagic](https://www.g2.com/products/crawl-magic-solutions-web-scraping-services/)
Simple Steps to Connect Flask App with MongoDB in an Ubuntu Machine
Published: 2023-03-20 08:05:52

To connect MongoDB with Flask in an Ubuntu machine, follow these steps:

Install the pymongo package:

```
pip install pymongo
```

Install Flask-PyMongo package:

```
pip install Flask-PyMongo
```

In your Flask app, add the following code to create a connection to your MongoDB:

```

from flask_pymongo import PyMongo

app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/myDatabase"
mongo = PyMongo(app)

```

Note: Replace "myDatabase" with the name of your database.

Use the mongo object to interact with the database. For example, to insert a document into a collection, use the following code:

```

myCollection = mongo.db.myCollectionName
myCollection.insert_one({"name": "John", "age": 30})


```
Note: Replace "myCollectionName" with the name of your collection.

That's it! Now you can use Flask and MongoDB together in your Ubuntu machine.
How to connect to remote database using ip address
Published: 2023-03-20 07:54:49

1. SSH into the server.
2. mysql -u root -p
3. enter password
4. SHOW GRANTS FOR 'username'@'localhost';
5. GRANT ALL PRIVILEGES ON *.* TO 'username'@'ip_address' IDENTIFIED BY 'password';
6. FLUSH PRIVILEGES;
7. Try to connect database using mysql client
Dịch Vụ Chuyển Văn Phòng Trọn Gói Giá Rẻ Chuyên Nghiệp TpHCM
Published: 2023-03-20 08:05:22

https://vanchuyen24h.vn Dịch vụ chuyển văn phòng trọn gói uy tín và chuyên nghiệp✔️ giúp bạn tiết kiệm thời gian và công sức khi chuyển đến địa điểm mới✔️ Chúng tôi sẽ đảm bảo việc vận chuyển và lắp đặt đồ đạc của bạn được hoàn thành một cách nhanh chóng✔️ an toàn và hiệu quả✔️ Hãy liên hệ 08.28.137.138 để biết thêm chi tiết✔️✔️✔️
hotro@vanchuyen24h.vn
39 Đường N8, KDC Jamona City Đào Trí, Phường Phú Thuận, Quận 7, TP.HCM, Việt Nam
0828137138
https://heylink.me/vanchuyen24h
https://boosty.to/vanchuyen24h
https://velog.io/@vanchuyen24h
https://pbase.com/vanchuyen24h/vanchuyen24h
https://app.bountysource.com/people/114743-vanchuyen24hvn
https://plaza.rakuten.co.jp/vanchuyen24h
Anotación @JsonUnwrapped
Tags: java, spring, jackson, spanish
Published: 2023-03-20 08:00:00

La anotación `@JsonUnwrapped` es una anotación de la biblioteca Jackson para Java que se **utiliza para indicar una propiedad no debe estar anidada en la estructura JSON resultante,** sino que debe estar a nivel superior.

Por ejemplo, supongamos que tenemos una clase `Person` que tiene una propiedad `Address` que también es una clase con sus propias propiedades. Si queremos serializar un objeto `Person` en JSON, la estructura resultante sería algo así como:

```json
{
    "name": "Juan",
    "address": {
        "street": "Calle 123",
        "city": "Ciudad de México",
        "state": "CDMX"
    }
}
```
Sin embargo, si queremos que las propiedades de `Address` estén en el mismo nivel que las propiedades de `Person`, podemos utilizar la anotación `@JsonUnwrapped` en la propiedad `Address`. La clase `Person` se vería así:

```java
public class Person {

    private String name;

    @JsonUnwrapped
    private Address address;
}

public class Address {

    private String street;

    private String city;

    private String state;
}
```
Al serializar un objeto `Person` utilizando esta clase, la estructura resultante sería:

```json
{
    "name": "Juan",
    "street": "Calle 123",
    "city": "Ciudad de México",
    "state": "CDMX"
}
```
Como podemos ver, las propiedades de `Address` se desempaquetaron y se incluyeron **en el mismo nivel que las propiedades de `Person`**.

En resumen, la anotación `@JsonUnwrapped` es una herramienta que puede ser útil en situaciones en las que queremos una estructura JSON más simple o para facilitar la integración con otros sistemas que esperan una estructura JSON específica.
Understanding the Broker Pattern in Event-Driven Architecture
Tags: eventdriven, architecture, discuss, tutorial
Published: 2023-03-20 08:00:00

## What is the Broker Pattern?
The Broker Pattern is a design pattern used in Event-Driven Architecture (EDA) to decouple event publishers and event subscribers by introducing a broker as an intermediary between them. The broker receives events from publishers and distributes them to the relevant subscribers based on their interests and subscriptions.

## Advantages of using the Broker Pattern
The Broker Pattern offers several advantages in event-driven systems, including improved scalability, flexibility, and reliability. By decoupling event publishers and subscribers, the broker pattern allows for easy scaling of the system as it grows. Additionally, it enables subscribers to receive only the events they are interested in, reducing network traffic and improving performance. Finally, the broker can act as a buffer, storing events until subscribers are ready to receive them, ensuring reliable delivery.

## Implementing the Broker Pattern
To implement the Broker Pattern, a broker component must be introduced into the event-driven system. The broker should be responsible for receiving events from publishers and distributing them to subscribers. The broker can use a variety of techniques to determine which events to distribute to which subscribers, such as topic-based routing or content-based routing. In addition, the broker can provide features such as filtering, enrichment, and transformation to enhance the functionality of the system.

## Best practices for using the Broker Pattern
When using the Broker Pattern in Event-Driven Architecture, it is important to follow best practices to ensure the system's reliability, scalability, and performance. Some best practices include designing the system for high availability, using message acknowledgments to ensure reliable delivery, monitoring and managing the broker's performance, and designing the system for fault tolerance.

In conclusion, the Broker Pattern is a powerful design pattern used in Event-Driven Architecture to decouple event publishers and subscribers and provide a scalable, flexible, and reliable system. By following best practices and designing the system with scalability and fault tolerance in mind, the Broker Pattern can help organizations build robust event-driven systems.

What do you think of the **Broker Pattern** and how it can help you decouple event publishers and subscribers? Have you used this pattern in your own event-driven systems, and if so, what benefits have you observed? Share your thoughts and experiences in the comments below!
Best group chat apps
Tags: apps, rtc
Published: 2023-03-20 07:48:27

It might be subjective to determine what are the best group chat software. Some may respond based on the number of users, but others may prefer the feature quality. However, there are definitely a few apps that we all have used at least once.

Below is a summary of the top ten group chat apps that ruled the market in 2023:

**1- Whatsapp**

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

WhatsApp is the software that deserves to be named the finest group chat app for friends and teams. With over 2.4 billion users worldwide, it has consistently topped the most-used app rankings. This group chat program enables you to create groups and share anything such as audio, video, images, documents, contacts, locations, and more.

It also supports group voice and video calls. WhatsApp is also completely free, with no hidden costs. It also offers a business-specific app called WhatsApp Business.

Android, iOS, KaiOS, Windows, macOS, and Web are all supported platforms.

**2- Messenger on Facebook**

Facebook Messenger is a messaging application that allows you to interact with your Facebook friends. Because Facebook is the most popular social media network on the planet, Facebook Messenger is a widely used messaging app. 


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

It allows you to have group chats with your friends as well as audio and video conferencing. You may also freely swap media like as videos, images, papers, and so on.

It's also a fully free group chat application. The downside is that typical communications are not encrypted end-to-end. To keep your discussion secret, you must begin private talks.

Platforms supported include web, Android, iOS, Windows, and macOS.

**3- Discord**

It is a group chat tool that is particularly popular among gamers and online groups. Discord members may connect via text, audio, and video chats. Users may construct servers about any topic, activity, or corporation with this program. Users may build channels on the server to exchange media and make voice and video chats.

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

Discord is an excellent group video chat service that allows for high-quality video and audio calls. Moreover, users may define roles and permissions for individuals inside a server or channel.

Platforms supported include web, Android, iOS, Windows, macOS, and Linux.

Check out the post below for the remainder of the top ten best group chat apps list, and visit the [ZEGOCLOUD blog](https://www.zegocloud.com/blog) to discover more about RTC applications and technologies.


https://www.zegocloud.com/blog/group-chat-apps
React Ref: Everything You Need to Know in Simple Terms
Tags: react, javascript, webdev
Published: 2023-03-20 07:41:33

So, imagine you're at a party and you see this cute person across the room that you want to talk to. But, there's a problem: they're surrounded by a bunch of other people and you can't get to them.

> In this article, we will explore everything you need to know about React ref, including what it is, how it works, and how you can use it to enhance your React applications.

### What is React Ref?

React Ref is a feature in React that provides a way to access and manipulate the DOM elements directly. `Refs` allow developers to refer to a specific element or component in their code, even when that element is not in the current scope of the component.

Well, `React Ref` is like having a VIP pass that lets you skip the line and go straight to the cute person. In this case, the cute person is an element in your React component, and the other people are all the other elements surrounding it.

### How does React Ref work?

`React Ref` works by creating a reference to a specific element in the DOM. This reference is created using the `ref` attribute in the JSX code, which is then attached to the element you want to refer to.

### Using React Ref

But, how do you get this VIP pass? It's easy! You just need to create a reference to the element you want to access using the `useRef()` hook in a component:

```jsx 
import React, { useRef } from 'react';

function MyComponent() {
  const myRef = useRef(null);

  return (
    <div ref={myRef}>
      Hello, world!
    </div>
  );
}
```

Now, you have a reference to the `div` element and you can access its properties and methods by calling `myRef.current`. For example, if you want to change the color of the text to blue, you can do this:

```js
myRef.current.style.color = 'blue';
```
### Forwarding React Ref

But, what if you want to pass this VIP pass to another component? Well, you can use the `forwardRef()` function to forward the reference from the parent component to the child component. It's like giving your friend your VIP pass so they can also talk to the cute person!

```jsx
import React, { useRef, forwardRef } from 'react';

const ChildComponent = forwardRef((props, ref) => (
  <div ref={ref}>
    I'm the child component!
  </div>
));

function ParentComponent() {
  const myRef = useRef(null);

  return (
    <div>
      <ChildComponent ref={myRef} />
      <button onClick={() => myRef.current.style.color = 'red'}>
        Make it red!
      </button>
    </div>
  );
}
```

Now, you have access to the `div` element in the child component from the parent component. And, when you click the button, the text color will change to red!

### Conclusion

So, that's `React Ref`. It's like having a VIP pass to the cute person you want to talk to at a party, and being able to pass it to your friends too!

> In this article, we have explored everything you need to know about `React Ref`, including what it is, how it works, and how to use it. By using `React Ref` in your applications, you can enhance the user experience and create more dynamic and responsive UIs.

Keep building! 🚀
Testing the Waters: A Comedic Take on TDD with React Testing Library
Published: 2023-03-20 07:30:00

Test-Driven Development (TDD) is a software development process that emphasizes writing tests before writing the actual code. This process helps developers to build high-quality, well-designed software that is easy to maintain and less prone to bugs. In this article, we will cover the process of setting up TDD with Jest on a modal component.

Jest is a popular JavaScript testing library that makes it easy to write and run tests. It is well-suited for TDD and provides a wide range of features for testing React components, including snapshot testing and mocking.

Here are the steps to set up TDD with Jest on a modal component:

1. **Install React & Testing library** : Projects created with `Create React App` have out of the box support for React Testing Library.

2. Create a simple **modal component**.

```javascript
import React from 'react';

const Modal = ({isOpen, onClose}) => {
  return (
    <div>
      {isOpen && (
        <div>
          <p>This is a modal</p>
          <button onClick={onClose}>Close</button>
        </div>
      )}
    </div>
  );
};

export default Modal;
```

3. **Create a test file**: Create a new file in the same directory as your modal component and call it `Modal.test.js`. This is where you will write your tests.

4. **Write your first test**: To write your first test, you will need to import the modal component and Jest's render method. The render method will allow you to render the component in a testing environment and interact with it.

```javascript
import React from 'react';
import { render } from '@testing-library/react';
import Modal from './Modal';

describe('Modal', () => {
  it('renders the modal when it is open', () => {
    const { getByText } = render(<Modal isOpen />);
    expect(getByText('This is a modal')).toBeInTheDocument();
  });
});
```

5. **Run the test**: To run the test, you can use the following command in your terminal:

```bash
npm run test
```

6. **Write additional tests**: Now that you have a basic test in place, you can write additional tests to cover all the functionality of your modal component. For example, you can write a test to ensure that the modal is not rendered when it is not open, or that the close button works as expected.

7. **Implement the modal component**: With your tests in place, you can now implement the modal component with confidence. As you write the code, you can run the tests to ensure that everything works as expected.

---

By following these steps, you will have set up TDD with Jest on your modal component. This process will help you to write better, more maintainable code and reduce the risk of bugs. Additionally, as your component evolves, you can continue to write tests to ensure that it continues to work as expected.

And that's it ! See U next level Doobs !