teleren/devto huggingface dataset:
How to Restore Default Configuration in Visual Studio Code
Tags: visualstudiocode, configuration, defaults
Published: 2023-08-22 05:05:19

How to Restore Default Configuration in Visual Studio Code

How to Restore Default Configuration in Visual Studio Code
----------------------------------------------------------

Visual Studio Code (VS Code) is a popular code editor among software developers due to its simplicity and extensive customization options. However, sometimes you may find yourself in a situation where you want to revert back to the default configuration of VS Code. This article will guide you on how to restore the default settings in VS Code.

### Method 1: Resetting User Settings

If you have made customizations to your user settings and want to revert them, follow these steps:

1.  Open VS Code.
2.  Click on the gear icon in the lower-left corner to open the _Settings_ menu.
3.  In the search bar at the top, type `reset settings` and select the _Preferences: Open Workspace Settings_ option.
4.  On the right side, you will see a list of settings. Click on the three-dot icon (`...`) next to the setting you want to reset and select _Reset Setting_.
5.  Repeat step 4 for each setting you want to reset.
6.  To reset all settings, click on the three-dot icon in the top-right corner and select _Reset All Settings_.
7.  VS Code will prompt you to confirm the reset. Click _Yes_.
8.  Restart VS Code for the changes to take effect.

### Method 2: Reinstalling VS Code

If you want to completely start fresh with VS Code, you can uninstall and reinstall the application. This will remove all customizations and restore the default configuration. Follow these steps:

1.  Uninstall VS Code from your computer.
2.  Visit the official VS Code website ([https://code.visualstudio.com/](https://code.visualstudio.com/)).
3.  Download the latest version of VS Code for your operating system.
4.  Install the downloaded file.
5.  Once the installation is complete, open VS Code.
6.  VS Code will now have the default configuration.

By following these methods, you can easily restore the default configuration in Visual Studio Code. Whether you want to undo a few customizations or start fresh, these steps will help you achieve that. Remember to back up any important settings or extensions before proceeding with the reset.

#### References:

*   Visual Studio Code Official Website: [https://code.visualstudio.com/](https://code.visualstudio.com/)
Laravel 10 Import and Export CSV and Excel Files
Tags: laravel, import, csv, php
Published: 2023-08-22 05:05:06

In today's data-driven world, as a Laravel developer, the need to import and export data in different file formats is a common requirement for web applications. With the release of Laravel 10, I now have even more capabilities at my disposal when it comes to handling CSV and Excel files.

These file formats are widely used for data exchange, making it crucial for me to understand how to handle them effectively within my Laravel applications.

In this article, I will explore the process of importing and exporting CSV and Excel files using Laravel 10. I will walk through the necessary steps and demonstrate how Laravel's features and supporting packages can streamline these tasks.

By the end of this article, I will have a solid understanding of how to handle CSV and Excel files within my Laravel applications, empowering me to seamlessly import and export data with confidence.

In particular, I will be leveraging the popular maatwebsite/excel plugin to facilitate the seamless importing and exporting of CSV and Excel files.

In this article, I will guide you through the process of utilizing Laravel 10 in conjunction with the maatwebsite/excel plugin to handle CSV and Excel files effectively.

We will explore the necessary steps and demonstrate how this combination of Laravel and the maatwebsite/excel plugin can simplify the import and export processes.

So, whether I need to import large datasets from external sources or export data for reporting or analysis, the capabilities of Laravel 10 will enable me to accomplish these tasks efficiently and effortlessly.

Join me as I dive into the power of Laravel 10 for importing and exporting CSV and Excel files.
can't open whatapp in flutter
Published: 2023-08-22 04:41:45

i used below code.

var whatsappAndroid = Uri.parse("whatsapp://send?phone=$whatsappPhno");
    if (await canLaunchUrl(whatsappAndroid)) {
      await launchUrl(whatsappAndroid);
    } else {
      ScaffoldMessenger.of(context).showSnackBar(
        const SnackBar(
          content: Text("WhatsApp is not installed on the device"),
        ),
      );
    }
but still not open whatsapp.
please help me.. it urgent
thanks
Concatenate new array
Tags: javascript, programming, tutorial, interview
Published: 2023-08-22 04:18:27

**Implement a function that takes an array and additional arrays and/or values as arguments and returns a new array by concatenating them together.**

**Example**

```
function customConcat(array, ...values) {

}

var array = [1];
console.log(customConcat(array, 2, [3], [[4]]));
// [1, 2, 3, [4]]
```

**Solution**

```
function customConcat(array, ...values) {
  return array.concat(...values)
}

var array = [1];
console.log(customConcat(array, 2, [3], [[4]]));
// [1, 2, 3, [4]]
```
Making a Multiplayer WEB RPG - Part 6: Don't forget to congratulate yourself
Tags: babylonjs, colyseus, gamedev
Published: 2023-08-22 04:15:28

Demo: https://t5c.onrender.com
Github: https://github.com/oriongunning/t5c

---

Hi All,

This one is short, and is more of a pat on my back type of post :)

Anyway, I've finished the roadmap that I set earlier in April this year and to recap what has been added since: 
- Items can now be dropped, picked up, used and equipped.
- AI has been massively improved and can IDLE, PATROL, CHASE, ATTACK, etc, and have patrol behaviours (in a area, in a radius, on a path)
- Player & AI can also move up or down stairs and are not limited to a 2D plane anymore.
- Players can teleport to different scenes
- Standardized players & enemies characters/animations using the amazing Kay Kit assets
- Added a new character screen UI (mage/knight class + color variants)
- Lots of performance improvements and tweaks

I know there is way more to do/improve, however I'm rather proud of what I accomplished in a few months and wanted to share it to your (ruthless) constructive comments. 

---

King of the castle shot
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crly8lfel9ffc5nq5d16.png)

The full player UI
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qn2ne9lgx7s4a4zb6apt.png)

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

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

Levels can be vertical now, woot
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2w6kf3nbf8xs16mcc22.png)

New Dungeon scene
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2lr61r2z9302jb7wm2xh.png)

Updated Character Creator Scene (class + color)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ibh8ljoct3w709z36om0.png)

Updated Character Selection Screen
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygixt0svgl51bkhqsjgg.png)
Why Isn't the Token Being Saved in the Cookie?
Tags: webdev, react, beginners, programming
Published: 2023-08-22 04:10:33

In web development, we occasionally come across issues that are puzzling and time-consuming to solve. One such issue that I recently faced involved JWT tokens not being stored in cookies for specific users. I invested several days trying to resolve this issue and eventually found a solution. In this blog post, I will share the details of the problem and the steps I took to resolve it.

## Problem:

In my web application, I utilized JWT (JSON Web Token) for user authentication. After a successful login, the server would send a JWT token to the client, which was supposed to be stored in a cookie. However, for certain users, the token was not being stored in the cookie. The perplexing part was that this issue only occurred for specific users and was not consistent across all users.

## Investigation:

I began by examining the server's response headers for the problematic users. To my astonishment, the "Set-Cookie" header was present, and a token was indeed being sent. Nonetheless, the token was not appearing in the browser's cookie storage. After a deeper investigation, I noticed that the problematic users had an unusually long token compared to other users.

The following code was creating tokens that were too long, causing the problem:


## Root Cause:

It became clear that the issue stemmed from the token's size. For the problematic users, the JWT token was too large to be stored in a cookie. Browsers impose a limit on the maximum size of a cookie, and the token was exceeding this limit. This occurred because the token payload for these users contained a large amount of data, making the token exceptionally lengthy.

```javascript
const payload = {
  firstName: userInfo.firstName,
  lastName: userInfo.lastName,
  email,
  id: userInfo._id,
  followers: userInfo.followers,
  userIcon: userInfo.userIcon,
  following: userInfo.following,
  bio: userInfo.bio,
};

const token = await signToken(payload, secret);
```



## Solution:

To address the problem, I modified the token generation logic to include only essential information in the payload. By reducing the amount of data in the token, I was able to ensure that the token's size remained within the limits imposed by browsers. After implementing this change, the tokens were successfully stored in the cookies for all users.

I revised it to the following:
```javascript
const payload = {
  id: userInfo._id,
  email,
};

const token = await signToken(payload, secret);
```


This issue underscored the importance of considering the size of data being sent in tokens and cookies. By including only essential information in the token and ensuring that its size stays within the browser's limits, I was able to avert this problem in the future. I hope that sharing my experience will be helpful to others facing similar challenges.
There & Back Again... Part I
Tags: beginners, codeforgood, codenewbie, coding
Published: 2023-08-22 03:55:30

The year was 2017. I handed in my resignation in early June, stepping away from my non-technical government position after 8 very long years. At the end of June, I hopped in my car with my two small children. We drove to Northern Minnesota to be with family and to finalize plans for a move to Salt Lake City. 

On a Saturday evening in late July, we pulled in to the garage of our new house. The next three years would be pivotal in my life. My wife at the time had accepted a position that allowed me to become a stay-at-home dad and take a long fresh breath of air. I was 30 years old when I moved to Utah; it's a strange age at which to sit down and try and figure out what to do with your life.

Almost exactly one year later, in July of 2018, tragedy hit my extended family when my Grandmother passed away. I was thankful to be with her during her last days and to say goodbye. Soon after she passed, I was given a portion of inheritance that turned out to be enough for me to invest in a new computer. My goal: to become a developer.

I had spent almost a year going back and forth on my future professional plans. Before leaving Chicago I had considered bootcamps or even completing another degree. But when my new machine showed up, my plans were solidified. I decided that I would take as much time as it required to teach myself. I wanted to be a developer.

Now, in August 2023, I want to start another journey. One of reflection, and hopefully one of inspiration for others who are a bit earlier on. My path may look immensely different, or it might be strangely similar. But it's the sharing that matters... that helps build the community. I've benefited greatly from others in this vast yet tight-knit community. And now, it's time to begin an attempt at giving back.
Dev Services for Kubernetes
Tags: quarkus, java, cloud, kubernetes
Published: 2023-08-22 03:27:07


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pr1ibfh9t055rb4k9cje.png)Developing applications based on Kubernetes often involves headache-inducing tasks for setting up clusters and API servers. However, with the introduction of Dev Services for Kubernetes (An Endless Joy!), these tasks have become simpler and more efficient. 

#**Automatic Initialization of Kubernetes Cluster**#

One of the greatest advantages is its ability to automatically start a Kubernetes API server in development mode, eliminating the need to manually start a cluster. This is particularly valuable during development and testing phases, where agility is essential. The application is automatically configured to communicate with the API server provided by Dev Services.

#**Easy Activation and Deactivation**#

Enabling and disabling Dev Services for Kubernetes is straightforward, thanks to its configurable properties. The tool is enabled by default but can be disabled using the property: 
`quarkus.kubernetes-client.devservices.enabled`, set to false. This flexibility allows you to tailor the environment according to the specific project requirements.

#**Cluster Sharing**#

Dev Services for Kubernetes offers a service discovery mechanism that allows multiple Quarkus applications in development mode to share a single Kubernetes cluster. This is particularly useful in scenarios where resources need to be optimized and shared among different applications. The sharing mechanism is enabled by default in development mode and can be deactivated using the property:
`quarkus.kubernetes-client.devservices.shared=false`.

To enable multiple shared clusters, you can configure the property :
`quarkus.kubernetes-client.devservices.service-name` with a specific name for the cluster. This ensures that Dev Services finds the desired cluster or creates a new one if necessary. The default service name is "kubernetes".

#**Flexible Cluster Configuration**#

Dev Services for Kubernetes offers three different "flavors" of Kubernetes clusters, each supporting different versions of the Kubernetes API. This allows you to choose the most suitable configuration for your project. Through the properties:
`quarkus.kubernetes-client.devservices.flavor` and `quarkus.kubernetes-client.devservices.api-version`, you can configure the cluster flavor and API version.

For example, to start only a Kubernetes API server, you can use the flavor api-only with the property: `quarkus.kubernetes-client.devservices.flavor=api-only`.

 If a more complete cluster is needed that can run Pods, flavors like k3s or kind can be chosen. Keep in mind that these flavors require running in Docker privileged mode.

In summary, Dev Services for Kubernetes offers several significant advantages to simplify the development of Kubernetes-based applications. From the automatic cluster initialization to flexible environment configuration, this tool contributes to development agility and efficiency. Take this experience to your team and enhance your work process.

Luis De Llamas
Building ETL/ELT Pipelines For Data Engineers.
Tags: snowflake, dbt, airflow, dataengineering
Published: 2023-08-22 03:07:11

## Introduction:
When it comes to processing data for analytical purposes, ETL (Extraction, Transformation, Load) and ELT (Extract, Load, Transform) pipelines play a pivotal role. In this article, we will delve into the definitions of these two processes, explore their respective use cases, and provide recommendations on which to employ based on different scenarios.

## Defining ETL and ELT:
ETL, which stands for Extraction, Transformation, and Load, involves the extraction of data from various sources, transforming it to meet specific requirements, and then loading it into a target destination. On the other hand, ELT, or Extract, Load, Transform, encompasses the extraction of raw data, loading it into a target system, and subsequently transforming it as needed. Both ETL and ELT serve the purpose of preparing data for advanced analytics.

## ETL Process Utilization:
ETL pipelines are often used in situations involving legacy systems, where data engineers respond to ad hoc business requests and intricate data transformations. This process ensures that data is refined before being loaded into the target system, enhancing its quality and relevance.
![ETL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e89mmkvep27mzxiga9sx.png)


## ELT Process Preference:
ELT pipelines have gained preference due to their swifter execution compared to ETL pipelines. Additionally, the setup costs associated with ELT are lower, as analytics teams do not need to be involved from the outset, unlike ETL where their early engagement is required. Furthermore, ELT benefits from heightened security measures within the data warehouse itself, whereas ETL necessitates engineers to layer security measures.

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

### Exploring a Practical ETL Pipeline Project:
To gain hands-on experience in Data Engineering, cloud technologies, and data warehousing, consider working on the project "Build an ETL Pipeline with DBT, Snowflake, and Airflow." This project provides a solid foundation and equips you with valuable skills that stand out in the field. The tools employed in this project are:

- DBT (Data Build Tool) for ETL processing.
- Airflow for orchestration, building upon knowledge from a previous article.
- Snowflake as the data warehouse.



[Build an ETL Pipeline with DBT, Snowflake and Airflow](https://bit.ly/3KOGNhT)



## Conclusion

In conclusion, we have gained a comprehensive understanding of ETL and ELT pipelines, including their distinctive use cases. By considering the scenarios outlined here, you can make informed decisions about which approach suits your data processing needs. As a recommendation, engaging in the mentioned project will undoubtedly enhance your expertise in Data Engineering, cloud technologies, and data warehousing. Embark on this journey to stand out and continue your learning in this dynamic field. 

Happy learning!
Different types of hosting
Tags: hosting
Published: 2023-08-22 02:30:41

[Shared hosting](https://www.hostagle.com/shared-hosting/ ) - It provides multiple clients access to a single web server’s resources, and is ideal for people with small scale website’s, it’s also cheap and economical 

Dedicated hosting - It provides a client complete access to an entire web server’s resources even letting them customize the operating system and software as well as configure the entire server. It is ideal for people with large scale businesses.

VPS hosting (virtual private server) - This type of hosting lies between shared hosting and dedicated hosting, since a client is separately allocated a section of a web server’s resources reserved entirely for them. Like dedicated hosting you can customize your operating system and software but at a more affordable price compared to dedicated hosting. It is ideal for people with large blogs, Medium sized or Ecommerce sites.

Cloud hosting - It provides the client multiple web servers to host their website, Even if one server is down the other servers take over without affecting the website’s performance. They also have much more flexibility for scaling up or down depending on the demand compared to dedicated hosting, however it does not offer the level of customization for servers as much as dedicated hosting does. It's ideal for large scale Ecommerce websites.  

Reseller hosting - It’s a hosting service provided by certain individuals or organizations who buy web hosting resources from hosting providers and sell it to clients through reseller websites as their own service and can set different prices on their packages.   

Free hosting - It provides the minimum and most basic resources to host a website, with limited features, storage and security. It's ideal for people who want to practice developing a new website design or just want to work on a personal project. However some providers give a free trial and after it expires you have to pay to continue using the services. 

To learn more about our pricing of different hosting services visit hostagle
How to configure the authorize attribute for a simpler role-based authentication
Published: 2023-08-22 02:15:07

The authorize attribute in ASP.NET is quite powerful. You can use it for simple authentication, or you can use it for role-based authentication or policy-based authentication by specifying the supplying roles or policies as parameters.

Depending on the size and scope of a project, you might only need a role-based access control without authorization policy. Also, you might want a resource to be accessible for multiple roles.

The way that authorize attribute is structured is that you need to pass a string to specify the role or policy. You may use constants to prevent hard coding it, but you still need to constantly concatenate a comma "," to add more roles.

With a mix of a lookup dictionary, enums, and inheritance, you can create a custom strongly typed authorize attribute for role-based access control.

First, define your roles in a role helper class like so:
```C#
public class RolesHelper
    {
        public static readonly Dictionary<Role, string> RolesDict = new()
        {
            { Role.FullAdmin, "FullAdmin" }
            { Role.ReadOnly, "ReadOnly" },
        };
    }
    public enum Role
    {
        FullAdmin,
        ReadOnly
    }
}
```

In the code above, we first defined the roles in an enum and then created a lookup dictionary.

** You might be able to simplify that further in the future when c# adds support for discriminated unions by assigning string values directly to enums.

Now its time  to implement the custom authorize attribute class like so:
```C#
public class CustomRoleAuthorizationAttribute : AuthorizeAttribute
    {
        public CustomRoleAuthorizationAttribute(params Role[] roles)
        {
            List<string> rolesFromDict = new();
            foreach (Role role in roles)
            {
                if (RolesHelper.RolesDict.TryGetValue(role, out string? roleFromDict))
                {
                    rolesFromDict.Add(roleFromDict);
                }
            }
            Roles = string.Join(",", rolesFromDict);
        }
    }
```
Let's go through the code. We first inherit from the Authorize attribute class. We then create the constructor. In the constructor, we pass the list of roles using the `params` keyword.


Side note: what is `params`?
You may recall this keyword if you started building a console application and you might have seen it in the main method. By using this keyword, you can send any number of roles that you want, without creating and putting them into an array first.


The `params` keyword is important as the attributes are evaluated at the runtime, and we cannot instantiate an array to pass to them (we still can instantiate an object inside an attribute).

We would then loop through the roles and check the dictionary to get the string value of it. Finally, we assign the Roles property to those string values, joined by commas ",".

I hope you find this useful. Thanks for reading!