teleren/devto huggingface dataset:
Rust Concurrency: Synchronizing Access to Shared State
Tags: rust, concurrency, tutorial, programming
Published: 2023-02-03 10:22:12

Rust's built-in concurrency model, based on message-passing and thread ownership, makes it easy to write concurrent and parallel code that is both safe and efficient. However, when multiple threads need to access and modify shared state, we need to take extra care to ensure that the data remains consistent and that the access is properly synchronized.

One common way to synchronize access to shared state in Rust is to use a `Mutex`. A `Mutex` is a type that allows only one thread to hold the lock at a time, and blocks other threads that try to acquire the lock until it is released. To use a `Mutex`, we first need to create an instance of it, wrapping the shared state:

```rust
let shared_state = Mutex::new(0);
```

Then, to access or modify the shared state, we need to acquire the lock by calling the `lock` method:

```rust
let mut state = shared_state.lock().unwrap();
*state += 1;
```

The `lock` method returns a `LockResult` which contains a `MutexGuard` that holds the lock and allows access to the shared state. We need to call `unwrap` to get the actual `MutexGuard` and thus access the shared state.

When we're done with the shared state, the lock is automatically released when the `MutexGuard` goes out of scope.

It's important to keep in mind that while the `Mutex` provides a way to synchronize access to shared state, it can also lead to performance issues if used excessively or improperly. So, it's best practice to use it as little as possible and only when necessary.

In conclusion, Rust's `Mutex` is a powerful tool that allows us to synchronize access to shared state, but it's important to use it judiciously to maintain good performance and avoid deadlocks.

---

> At [ISAB](https://isab.run/?utm_source=dev-to-08cfc3a0), we believe in providing valuable and informative content to help developers and technology enthusiasts grow in their respective fields. That's why we decided to share our latest article with the community on [DEV Community](https://dev.to/), to reach a wider audience and engage with a passionate group of developers and tech enthusiasts.
>
> We would like to invite you to take a look at our website [ISAB News & Updates](https://isab.run/?utm_source=dev-to-08cfc3a0) for more content like this. [Our platform](https://isab.run/paste/?utm_source=dev-to-08cfc3a0) is dedicated to providing the latest and greatest in technology, coding, and software development. Our goal is to provide a space for learning, growth, and inspiration for all those who visit us.
>
> Whether you're just starting out or a seasoned veteran in the tech industry, we believe there's always room for growth and learning. With that in mind, we invite you to visit our website and see for yourself what we have to offer.
>
> Thank you for taking the time to read this article, and we hope to see you soon at [ISAB](https://isab.run/?utm_source=dev-to-08cfc3a0)!
Logto v1.0.0-rc.0: User auth with RBAC
Tags: showdev, webdev, opensource, node
Published: 2023-02-03 10:08:26

[Logto](https://logto.io/) is an open-source auth solution with comprehensive features and modern dev experience.

---

Please welcome our first release candidate! Logto is just a few steps away from general availability.

## 🔒 Role-Based Access Control

We are excited to introduce our latest addition to our product, Role-Based Access Control (RBAC). This powerful feature gives administrators the ability to assign specific roles and permissions to users, ensuring they only have access to the resources and functions they need to do their job.

With RBAC, administrators can:

- Define permissions across APIs
- Create custom roles with specific permissions
- Assign roles to users and manage their roles
- Easily manage and update permissions
- Securely validate permissions to protect APIs

Logto takes a major step forward in security and control with easy access management and authorization of sensitive info, ensuring only authorized users have the right to access. This aligns with our vision to provide an open-source identity solution with features for authentication and authorization, and packed with all the features you need.

> **Note**
> If you are using Logto SDKs, please upgrade to the latest version to take advantage of RBAC.

Check out our [RBAC recipe](https://docs.logto.io/docs/recipes/rbac/) for a step-by-step guide. Give it a try and let us know what you think!

## 🏄 Streamlined social sign-in flow

💡 Logto now detects a trusted email (or phone number) from the social account during social sign-in.

- If the email (or phone number) has been registered: Automatically connect the social identity to the existing user account with a single click.
- If the email (or phone number) is not registered: Automatically sync the user profile with the social-provided email (or phone number) if and only if it is marked as a required user profile.

## 🔢 Send and verify verification codes via Management API

The new Management APIs allow you to reuse connectors to dynamically send and verify verification codes for various purposes, such as validating identity before a user updates their profile or performs a dangerous action.

- Call `/api/verification-code` to send verification code to a given email or phone
- Call `/api/verification-code/verify` to verify the code against a given email or phone

## ↩️ Rollback database alteration state

In case of any issues with the database, you can now use the `logto db alteration rollback [target]` command to roll back all database schemas to a previous version, for example `logto db alteration rollback v1.0.0-beta.19`.
What is Babel ?
Tags: webdev, javascript, beginners, programming
Published: 2023-02-03 10:06:57

Babel is a JavaScript compiler that allows developers to write code in the latest version of JavaScript and then compiles it to an earlier version to ensure maximum compatibility across all browsers and platforms. Babel enables developers to use features that are not yet supported by the majority of browsers and also to make use of features from the latest ECMAScript specifications.
What is STARZ and How to Activate STARZ.
Tags: howto, webdev, beginners
Published: 2023-02-03 10:04:29

STARZ is a TV network and streaming service in the United States that creates programming that is both fashionable and informative. STARZ has presented us with a number of excellent television shows, some of which include American Gods, Black Sails, Power, and Spartacus. You are able to access the streaming service on a wide variety of devices virtually anywhere in the world. In this article, we are going to demonstrate how to activate STARZ on a wide variety of different devices.
!

## 
**How to activate STARZ**

To activate STARZ, you will need a premium subscription or to be participating in the free trial that is provided for a period of one week before you are required to commit to purchasing a subscription. To add the channel to the service of your choosing, you will need a login, therefore creating one is the first thing you will need to do.

Here is the proceedure to [Activate STARZ](https://www.alltechslot.com/activate-starz-on-any-device/)
What is an entertainment hyper-realism pathology?
Tags: news, discuss
Published: 2023-02-03 10:01:54

Hello,

What are the consequences (the particular ones) that the career of being a developer may cause to your health, yeah, your mental health?

A pathology a merely know it to exists, but, yet I do, because I suffer a bit from it, here is what it is, ... it is that when you take digital information, for something so clearly 100% real, in any ways, that when you're just watching a movie, you can't fix your mindset to remember you're looking at actor inside a computer or TV screen, but rather you feel like if there would be real people surrounding your comfortable interactions zone sometimes leaving it to something less pleasant like when you see a psychopath in a movie and yet you slightly begin to show hate upon this character even more amazingly, you start fighting it (but for sure, nobody's fighting anything real through the screen) yet you become tempted to get in a kind of friction with the temperament of various actors role.

And this mess just got way further sometimes, I bet it is because when you're a video game player, you have to react to anything even once seen, being digital and with it, the up-coming increasingly overwhelming social interactions (that said, constantly increasing over the day, in average over the week...) It can even become worse!

Do you suffer from hyper-realism of digital entities?
Advantages of JSX
Tags: webdev, javascript, react, opensource
Published: 2023-02-03 10:01:41

JSX offers several advantages including:

Improved readability: JSX makes it easier to read and understand the structure of the components in a codebase.

Reusability: JSX makes it easy to reuse components, leading to more modular and maintainable code.

Better debugging: JSX provides clear and concise error messages, making it easier to debug code.

Enhanced expressiveness: JSX allows developers to express the structure of their components in a more concise and intuitive way.

Better performance: JSX can be compiled to JavaScript, which is faster than interpreting it dynamically, leading to better performance.

Improved integration with other tools: JSX works seamlessly with other tools such as React and Babel, making it easier to integrate into modern web development workflow.
C# arrays using Distinct
Tags: beginners, programming, tutorial, csharp
Published: 2023-02-03 09:55:11

```
int[] nums = new int[] { 1, 4, 5, 2, 3, 5, 6 };
//unique values
var unique = nums.Distinct();
```
There is a array of integers as an example above. The Distinct() command will shorten the integer array by removing any duplicate values and returning a shortened array. The duplicate value (5) will be removed and the resulting array will be {1, 4, 2, 3, 5, 6}

Note: The array will not be sorted yet, only the duplicate values removed. To sort the array, you can chain a call to OrderBy() at the end of Distinct().

Question:
Can you specify which values in an integer array, you want to apply Distinct to?

```
var selectedDistinct = nums.Where(x => x >= 3).Select(x => x).Distinct();

```
The code above will shorten nums to only values that are greater or equal to 3 and then apply Distinct() to that shortened result.
Monoliths
Tags: systems, architecture, beginners, tutorial
Published: 2023-02-03 09:50:04

Monoliths are self-contained independent applications that are built as a single unit. It doesn’t work just for a single problem but cares for each step of the business need required on the application.

## Modular Monoliths

Further, we have modular monoliths where we build and deploy a single application. It breaks the code into independent modules for each feature required in the system. The good thing about modular monoliths is that it reduces the dependencies of a module since they can improve a particular module without affecting the other.

However, if the modular monoliths are implemented correctly, it helps lessen the complexity that grows as time goes by and the system grows consequently.

## Distributed Monolith

Moving on, there is distributed monolith that resembles the microservice architecture in many ways. But the difference is that the monolithic application is tightly coupled. Choosing microservices over monoliths is better but when we might get the monoliths while we still go for the [microservices](https://dev.to/pragyasapkota/microservices-21oe).

Let’s see some ways we know that our [microservice](https://dev.to/pragyasapkota/microservices-21oe) is the distributed monolith.

- Tightly coupled system.
- [Scaling](https://dev.to/pragyasapkota/scaling-3dfh) is difficult.
- Dependency between the services.
- Shares the same resources as the database.
- Low-latency communication is needed.

The main purpose for the use of microservices instead of monoliths is to have [scalability](https://dev.to/pragyasapkota/scaling-3dfh) in a loosely coupled application where every service is independent. With the distributed monolith, the complexity is increased since all the services depend on one another.

## Advantages of monoliths

- Developing is simple and easy.
- Communication is fast and reliable.
- Debugging is easy.
- Easy monitoring and testing.
- [ACID transactions](https://dev.to/pragyasapkota/relational-database-43l4) are supported.

## Disadvantages of monoliths

- If the codebase grows larger, maintenance might be difficult.
- The application redeploys each time there is an update.
- The applications are hard to extend because of the tightly coupled feature.
- It requires a commitment to a particular technology stack.
- A single bug can cause the whole system failure — no reliability.
- Might be a nightmare if we need to scale or adopt new technologies.

{% embed https://github.com/pragyaasapkota/System-Design-Concepts %}

**_I hope this article was helpful to you._**

**_Please don’t forget to follow me!!!_**

**_Any kind of feedback or comment is welcome!!!_**

**_Thank you for your time and support!!!!_**

**_Keep Reading!! Keep Learning!!!_**
Docker compose For Wordpress
Tags: docker, containerapps, word, compose
Published: 2023-02-03 09:45:04

## Wordpress

![Wordpress Docker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ai19zjwmya5wggsqfmj.png)

### How to use this image :

1.Clone or download all files from  [GitHub Page](https://github.com/zakery1369/wordpress/)
2.Download Wordpress from [Wordpress Downloads](https://wordpress.org/download/)
3.Extract Wordpress.zip to the following directory:
```
/var/www/html/wp
```
4.Run the command below :
```
docker-compose up -d
```
5.Open up your web browser, and proceed to the following address to start the installation ( Remember that my configuration will start the server at port 80, in case you want to change the hostname/port, proceed to the next section to customize this image )

```
127.0.0.1
```
6.If see 404 ERROR :
```
chmod 777 -R var/
```
7.In the Database settings, adjust the following :
```
Database Name = wordpress
Username = wp
Password = 147258369
Database Host = mysql
Table Prefix = wp_
```


### Customize this image :

#### Use domain with SSL and change Nginx configurations
in the files downloaded from this [GitHub Page](https://github.com/zakery1369/wordpress)
1.In this directory, uncomment the lines in the ``wp.conf`` and replace your domain with **example.com**
```
/nginx/conf.d/wp.conf
```
2.Following the guides from [Letsencrypt](https://letsencrypt.org/getting-started/) (certbot), copy the privkey.pem and fullchain.pem to the following directory. (Remember that from the previous step, the cert files names should correspond with these config file) :
```
/nginx/conf.d/certs
```
3.In case you want to configure your Nginx, you can find the config file in the following directory :
```
/nginx/nginx.conf
```

### Change mysql configurations :
1.Customize your configs in the following file :
```
/mysql/my.cnf
```
2.Change the mysql environment variables in the docker-compose.yml file :
```
environment:
        MYSQL_ROOT_PASSWORD: 147258369
        MYSQL_DATABASE: wordpress
        MYSQL_USER: wp
        MYSQL_PASSWORD: 147258369
```
### Change php-fpm configurations :
Add your customized configurations in these files :
```
/php-fpm/php.ini-development
/php-fpm/php.ini-production
/php-fpm/www.conf
/php-fpm/php.ini
```

### Exposing external port :
Edit docker-compose.yml to change the exposed ports :
``` 
ports:
     - 80:80
     - 443:443
```
Why AI Can't Replace the Magic of Software Engineering: A Tale of Two Tech Titans
Tags: softwareengineering, ai, automation, techtrends
Published: 2023-02-03 09:42:14

AI and software engineering are two peas in a pod. While AI is like the cool, tech-savvy cousin who always knows the latest gadgets and trends, software engineers are like the steady, reliable uncle who always gets the job done. And just like you can't replace your uncle with your cool cousin, AI can't replace software engineers.

Software engineers are the masterminds behind the software we use every day. They are the ones who take the concept of a software solution and turn it into a reality. They have the skills and expertise to design, develop, and maintain complex software systems, taking into account factors like user experience, security, scalability, and more. It's like they have a magical ability to understand the needs of both businesses and users, and they use their powers to create software that solves real-world problems.

AI, on the other hand, is the tech-savvy cousin who can automate routine tasks, making software engineers' lives a little easier. Think of AI as the ultimate sidekick who can help with code refactoring, testing, and debugging. It's like having a personal robot that does all the boring stuff, freeing up software engineers to focus on the fun stuff.

But even the coolest sidekicks need guidance from their superhero mentors. AI algorithms are only as good as the data they are trained on, and software engineers are the ones who curate and clean this data. They make sure that AI systems are working as intended and that they are providing accurate results. Without software engineers, AI would be like a superhero without a suit – it might look cool, but it wouldn't be as effective.

In conclusion, AI and software engineering are two sides of the same coin. AI can't replace software engineers, just like a sidekick can't replace a superhero. Software engineers and AI complement each other, working together to create software solutions that are both intelligent and user-friendly. So, let's give a round of applause to the steady, reliable uncles (software engineers) and the cool, tech-savvy cousins (AI) of the tech world!
Three js: Scene, Camera and Renderer
Tags: threejs, webgl, javascript, webdev
Published: 2023-02-03 09:35:09

From what I can gather , there are 3 necessary components that make Three.js function and these are: 
1. Scene
2. Camera
3. Renderer

To understand what I scene is, you can take movie scenes as an example. The scene is where all the objects are displayed, where they are positioned and what they look like.

A Renderer is what it's name implies and they allow the 3D graphics to be displayed. Webgl is the default renderer.

Cameras determine the way in which the scene is going to be viewed. This can be a perspective view, orthographic view etc.

As I delve deeper into uncovering the world of 3D graphics in Javascript, I am sure that I will encounter very interesting topics that will challenge me. Till next time...
Lazy Loading in ReactJS: Improving User Experience and Performance
Published: 2023-02-03 09:34:07

Lazy loading is a technique in web development that delays the loading of certain elements on a page until they are needed. This can significantly improve the initial loading time of a web page and provide a better user experience. In ReactJS, lazy loading can be achieved through the use of the "lazy" function from the "react" package.

**Why Lazy Loading is Important**

In today's fast-paced world, users expect websites to load quickly. If a website takes too long to load, users are likely to leave and never come back. Lazy loading can help to reduce the initial loading time of a web page by only loading the elements that are necessary for the user to see. This can result in a faster, more responsive website and a better user experience.

**How to Implement Lazy Loading in ReactJS**

Implementing lazy loading in ReactJS is a simple process. The "lazy" function is used to delay the loading of a component until it is needed. The "lazy" function takes a function as an argument that returns the component to be loaded.

**Here is an example of lazy loading in ReactJS:**

```
import React, { lazy, Suspense } from 'react';

const MyComponent = lazy(() => import('./MyComponent'));

function App() {
  return (
    <div>
      <Suspense fallback={<div>Loading...</div>}>
        <MyComponent />
      </Suspense>
    </div>
  );
}

export default App;
```

_In this example, the "MyComponent" component is loaded lazily using the "lazy" function. The "Suspense" component is used to provide a fallback UI while the component is loading._
5 Essential Steps for Freelancers to Clarify the Scope of a Project
Published: 2023-02-03 09:27:30


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



**Five tips for freelancers to clarify the scope of a project:**

**Ask questions:** Before accepting a project, ask your client as many questions as necessary to understand the details of the work that needs to be done.

**Get it in writing:** Ensure that the scope of work, deadline, budget and other key details are clearly documented and agreed upon by both parties in writing.

**Define the deliverables:** Make sure that the client has a clear understanding of what will be delivered, when it will be delivered, and how it will be delivered.

**Set clear boundaries: **Clarify with your client what is included in the project scope and what is not. This will help avoid any confusion or disagreements down the line.

**Regular communication:** Maintain regular communication with your client to ensure that the project stays on track and to address any changes in the scope of work as they arise.
it's important to emphasize the consequences of not following these steps in order to avoid any potential losses and ensure a successful project outcome. If the scope of work is not clearly defined, **freelancers risk not being fully compensated for their work and potentially losing money.** Furthermore, if the project is not completed on time, this can result in loss of reputation and future opportunities.

**Additionally**, if a client requests something outside of the original scope of work, it's important to remind them that any additional work will require additional compensation and should be kept separate from the original scope of work. Maintaining clear boundaries and adhering to the agreed upon scope of work is crucial for a successful project outcome and to protect the interests of both the freelancer and the client.



Freelance ProjectManagement ScopeOfWork Communication Boundaries AvoidLosses


🌎🙂😎 Let's Connect!
My Twitter: [@muzeyrozcan](https://twitter.com/muzeyrozcan)
[My Substack ](https://muzeyr.substack.com/)(here I will publish more in-depth articles)
Google’s OSS-Fuzz will add JavaScript in 2023 - Fuzzing Weekly CW5
Tags: security, testing, fuzzing, opensource
Published: 2023-02-03 09:24:11

OSS-Fuzz announced to add JavaScript support in 2023:
https://security.googleblog.com/2023/02/taking-next-step-oss-fuzz-in-2023.html

Reachable Coverage: Estimating Saturation in Fuzzing: 
https://mboehme.github.io/paper/ICSE23.Effectiveness.pdf

Google Boosts Bounties for Open-Source Flaws Found Via Fuzzing:
https://www.theregister.com/2023/02/01/google_fuzz_rewards/

https://www.fuzztesting.io/fuzzing-weekly