teleren/devto huggingface dataset:
Set the initial directory of the FolderBrowserDialog to the application's startup path
Tags: csharp, beginners, programming, dotnet
Published: 2023-02-23 02:52:44

In Windows Forms, you can use the FolderBrowserDialog class to display a dialog box that allows the user to select a folder. 
Then, you can set the initial directory of the FolderBrowserDialog to the folder where the program starts by setting the SelectedPath property of the dialog box to the application's startup path.

```csharp
using System.Windows.Forms;

// ...

// Show the Folder Browser dialog
FolderBrowserDialog folderDialog = new FolderBrowserDialog();

// Set the initial directory to the application's startup path.
dialog.SelectedPath = Application.StartupPath;
if (folderDialog.ShowDialog() == DialogResult.OK)
{
    // 선택한 폴더 경로 가져오기
    string selectedPath = folderDialog.SelectedPath;

    // 선택한 경로를 사용하여 파일 다운로드
    // ...
}
```
* This code creates a new instance of the FolderBrowserDialog class, sets its SelectedPath property to the application's startup path, shows the dialog, and gets the result. If the user clicked the OK button, the code gets the selected folder path and uses it for downloading files.

> This article was adapted using ChatGPT and DeepL.
9 core operations you need to perform to achieve your goals as a DevOps Engineer
Tags: devops, operations, programming, cloud
Published: 2023-02-23 02:31:00

Cloud Engineer is responsible for automation and accelerating processes, which helps to increase development velocity and reliability of the system.

Here are 9 core operations that you need to perform to achieve your goals as a DevOps Engineer:


## 1. Application development:
Developing a product that is able to meet all customer requirements and offers a remarkable level of quality.

## 2. Code coverage:
Measurement of the total number of blocks or lines or arcs of the code executed while the automated tests are running.

## 3. Code developing:
Prepare the code base required for the product development.

## 4. Configuration: 
Allowing the product to be used in an optimum way.

## 5. Deployment: 
Installing the software to be used by the end-user.

## 6. Orchestration:
Arrangement of several automated tasks.

## 7. Packaging:
Activities involved when the release is ready for deployment.

## 8. Provisioning:
Ensuring that the infrastructure changes arrive just in time with the code that requires it.

## 9. Unit testing:
Meant for testing individual units or components.


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

Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with [me](https://calendly.com/pragyanatvade).

If you want to learn more in DevOps and Backend space, [follow me](https://dev.to/pragyanatvade).

If you want to connect, reach out to me on [Twitter](https://twitter.com/pragyanatvade) and [LinkedIn](https://www.linkedin.com/in/pragyanatvade/).
How do I make an HTTP request in Javascript?
Tags: javascript, programming
Published: 2023-02-23 02:28:21

You can make an HTTP request in Javascript using the built-in XMLHttpRequest object or the newer fetch API.

Using XMLHttpRequest:

Here's an example of how to make an HTTP GET request using XMLHttpRequest:

```
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://example.com/api/data');
xhr.onload = () => {
  if (xhr.status === 200) {
    console.log(xhr.responseText);
  } else {
    console.error('Request failed. Returned status of ' + xhr.status);
  }
};
xhr.send();
```

Using fetch:

Here's an example of how to make an HTTP GET request using the fetch API:

```
fetch('https://example.com/api/data')
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok');
    }
    return response.json();
  })
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error('There was a problem with the fetch operation:', error);
  });

```
Both methods support other HTTP methods like POST, PUT, and DELETE by changing the first parameter of open() to the desired HTTP method.
Building CereBrum: A News Summary App Powered by AI and Extractive Summarization
Tags: ai, productivity, mobile, programming
Published: 2023-02-23 01:56:04

Staying up-to-date with the latest news can be a challenge, especially when there's so much information out there. As a news consumer myself, I often found myself feeling overwhelmed by the amount of content I had to sift through just to stay informed. That's why I created CereBrum, a news summary app that uses artificial intelligence and extractive summarization to extract the most important information from news articles and provide users with accurate and easy-to-read news summaries.

But what is extractive summarization? Simply put, Extractive summarization is a technique that extracts the most relevant sentences or phrases from a news article to create a summary. This ensures that the summary is accurate and provides a complete overview of the article. And by combining AI with extractive summarization, I was able to create a powerful news summary app that would help users stay informed without feeling overwhelmed. With CereBrum, users can easily browse and read news summaries on various topics, from technology and business to sports and entertainment.

I spent countless hours researching and developing the algorithms for CereBrum. I tested and refined the app until I was confident that it provided high-quality news summaries that anyone could use. And finally, after months of hard work, CereBrum was ready to be launched.

I developed CereBrum with the aim of creating a platform that would make it easy for users to stay informed. And I'm pleased to say that the app is now available on the Google Play Store.


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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59jpyqzmoohcxdjr6yo1.jpg)

While CereBrum is currently only available on Android, I am working hard to bring it to the Apple App Store as well. In the meantime, I encourage Android users to give CereBrum a try. And if you do, please let me know what you think. Your feedback will help me continue to improve the app and make it even better for users.

https://play.google.com/store/apps/details?id=com.cerebrum

Thank you for reading, and happy reading with CereBrum.
Javascript structuredClone
Tags: javascript, webdev, beginners, programming
Published: 2023-02-23 01:38:26


The `structuredClone` method allows you to **deep clone** a object including its keys and values.

```javascript
const person = {
    name: 'Paul G. Reynolds',
    skills: ['javascript','react','ember','vue']
    dob: new Date('1995-11-25')
}

const person2 = structuredClone(person);
person2.name = 'Brad T. Kennedy';

console.log(person.name); //Paul G. Reynolds
console.log(person2.name); //Brad T. Kennedy
```

As you see in the above code altering `person2.name` did not alter `person.name`.

You might think we can achieve this by using javascript spread operator.

```javascript
const person2 = {
   ...person
}
```
But, the problem is `skills` is an array altering `person2.skills` will alter `person.skills` too.

In such case you can think we can also use,

```javascript
person2 = JSON.parse(JSON.stringify(person))
//{"name":"Paul G. Reynolds","skills":["javascript","react","ember","vue"],"dob":"1995-11-25T00:00:00.000Z"}
```
Here the problem is `dob` is a Date object it will loose it's properties and become string value.

Previously we need to use lot of workarounds like this to achieve deep cloning now we have a built in method `structuredClone`.  

One thing to keep in mind when using `structuredClone` is, that it only works on structured objects. If you try to clone an unstructured object, you will get an error. For example:

```javascript
const func = () => {
  console.log('Hello, world!');
};

const func2 = structuredClone(func); // Error!
```

In this example, we tried to clone a function object using `structuredClone` method, but it will raise an error because functions are not structured objects.


### Supported browsers
| Chrome | Edge | Firefox | Safari |
|--------|------|---------|--------|
| 98     | 98   | 94      | 15.4   | 

Source: [MDN](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility)


### Conclusion
The `structuredClone` method in JavaScript is a powerful tool for making exact copies of  objects. 

----

If you read until the end leave a like and share your thoughts in the comment section

<center> Happy coding </center> 

----

Checkout full spec: [MDN StructuredClone](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)
 
Names generated from [https://www.fakenamegenerator.com/](https://www.fakenamegenerator.com/)
Hello World
Tags: webdev, gamedev, beginners, womenintech
Published: 2023-02-23 01:34:50

Hello everyone! I'm Purple and I'm excited to be here.

I've been a web developer for over five years and a gamer for life. I've recently decided to transition into game development, and I'm excited to share my journey with the world.

To get an understanding of my background, here is a combination of my skillset and toolkit:

- JavaScript / TypeScript
- React / Angular / Ember
- Next.js
- Python 3
- Jest / Jasmine
- HTML
- CSS / Tailwind CSS
- Git / GitHub / Bitbucket
- SQL / Oracle / MongoDB
- AWS / Azure
- Java
- C#
- Atlassian (Jira, Confluence, Trello)
- Microsoft Outlook
- Slack
- Google Docs
- IntelliJ / WebStorm
- VS Code
- Visual Studio

I'll be posting once per week to share my progress, including the code for games I've made. I expect the first handful of games to be text-based. 😆

If you're also learning Game Dev, leave a comment! Let's build a supportive community and learn together.

Take care!
RTK Query Data Fetching
Tags: webdev, beginners, react, tutorial
Published: 2023-02-23 01:34:30

## Overview

https://redux-toolkit.js.org/rtk-query/overview

RTK Query is a powerful data fetching and caching library built on top of Redux Toolkit (RTK), which is a popular library for building scalable and maintainable React-Redux applications.

RTK Query simplifies the process of fetching data from APIs by providing a set of hooks that abstract away the details of making HTTP requests and managing the state of the data. It also provides a caching layer that reduces the number of network requests, improves the performance of the application, and minimizes the impact of network failures.

RTK Query also comes with many advanced features like optimistic updates, pagination, polling, and deduplication, which makes it easy to handle complex scenarios when fetching data from APIs.

Overall, RTK Query is an excellent library for managing data in React-Redux applications, and it can significantly reduce the amount of boilerplate code needed to handle data fetching and caching.

## Example

Here's a simple example that demonstrates how to use RTK Query to fetch data from an API:

First, you need to install the necessary packages:

```bash
npm install @reduxjs/toolkit rtk-query react-query
```

Next, you can define a new API endpoint using the `createApi` function from RTK Query. This function takes an object with two properties: `baseQuery` and `endpoints`.

```javascript
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';

const API_URL = 'https://jsonplaceholder.typicode.com';

const api = createApi({
  reducerPath: 'api',
  baseQuery: fetchBaseQuery({ baseUrl: API_URL }),
  endpoints: (builder) => ({
    getUsers: builder.query({
      query: () => '/users',
    }),
  }),
});
```

In this example, we're creating a new API endpoint called `getUsers`, which retrieves a list of users from the `https://jsonplaceholder.typicode.com/users` API endpoint.

Next, you can use the `useQuery` hook provided by RTK Query to fetch data from the API:

```javascript
import { useQuery } from '@reduxjs/toolkit/query/react';

function UserList() {
  const { data, error, isLoading } = useQuery('users', api.getUsers);

  if (isLoading) {
    return <div>Loading...</div>;
  }

  if (error) {
    return <div>Error: {error.message}</div>;
  }

  return (
    <ul>
      {data.map((user) => (
        <li key={user.id}>{user.name}</li>
      ))}
    </ul>
  );
}
```

In this example, we're using the `useQuery` hook to fetch data from the `getUsers` endpoint. The `useQuery` hook returns an object with three properties: `data`, `error`, and `isLoading`. If `isLoading` is `true`, we show a loading message. If `error` is not null, we show an error message. Otherwise, we render a list of users.

That's a basic example of how to use RTK Query to fetch data from an API in a React application. Of course, there are many more features and options available in RTK Query, depending on your needs.
What is a Microservice architecture?
Published: 2023-02-23 01:30:00

In the old days everything was monolithic, a program was entirely contained in the space of a single file.

In the microservice concept, software becomes the coordination of a myriad of small Web services that have one key feature: each is incredibly specialized in doing one thing.

Goodbye centralized database, goodbye complex authentication management, the main goal of this architecture is to break down the overall problem into a myriad of completely isolated subproblems. And when I say isolated I mean isolated in every possible way.

Not only must functionality be precisely delineated, but it is also critical to isolate the data itself by making sure that each service can control its own database.

But it is not enough, to call itself a web service, even the deployment itself must be isolated from everything else.

Absolute isolation in order to divide the complexity and create an incredible parallelism of work between development teams: each team engaged in the development of its own small microservice.

Some might argue that creating development parallelism would result in difficult coordination between the parties since Web services do not have unlike a ‘SOA architecture a document that guarantees interoperability. wrong! today many tools exist to create a perfect description of rest services and perhaps generate documentation and skeleton at the same time.

Want to go overboard? think what can be done with such magnificently isolated objects: Create small computers inside which a small webservice with its dbase lives in perfect autonomy.

Absolute isolation is not only logical but also physical.

But that is still not all. We are in the age of virtualization, and so today we may not limit ourselves to hardware isolation but opt for service virtualization in order to completely overcome physical limitations and forget about installations and configurations to create perfectly isolated and monstrously stable deployments.

Also isolated from the operating system
Reactive DDD
Tags: architecture, eventdriven, microservices, reactiveddd
Published: 2023-02-23 01:23:29

There are two ways to decompose and integrate distributed systems. One is **easy**, and the other one is **better**. The easy way to do things is **orchestrated or declarative**. The basic idea of an orchestrated system is that one entity tells another entity what to do. The other way to organize your services is through **choreography and/or reactivity**. Choreography solves the problems we face in declarative systems, like high coupling and low cohesion.

> "Changes in downstream services may not disrupt upstream services."

Reactive DDD (Domain-Driven Design) is an approach to software development that combines principles from Domain-Driven Design and Reactive Programming to build highly extensible, scalable, and resilient systems. Reactive DDD focuses on modeling the domain's behavior in distributed, event-driven, inherently reactive systems.

Subdomain decomposition is an essential part of DDD, and in Reactive DDD, the subdomains are decomposed to support Choreographed event-driven architectures. **Each subdomain is responsible for managing its own state, and changes to that state are communicated through events**.

**Event-Sourcing** is the most efficient/appropriate persistence strategy here, given the eventual nature of the design. But it's subject to another post.

In an **eventual and unpredictable environment** about when an event occurs, how often the broker will deliver it, and in what order the subscriber will process it, Reactive DDD can help ensure that the system remains responsive and resilient by modeling such "uncertainties."

By modeling the domain as a set of reactive components that communicate through events, the system can be designed to handle large volumes of requests, maintain consistency and reliability, and gracefully recover from failures.

Reactive DDD is a modern and trendy approach becoming increasingly popular for building complex distributed systems. It provides a way to decompose a domain into smaller, more manageable pieces and design them to support a reactive architecture. This can lead to more responsive, scalable, and resilient systems and can better handle the demands of an eventual environment.

---

If you're interested in modeling uncertainty with Reactive Domain-Driven Design (DDD), here are a few resources that might be helpful:

- "Modeling Uncertainty with Reactive DDD" (article) by InfoQ: https://lnkd.in/dC7rS3WW
- "Reactive DDD—When Concurrent Waxes Fluent" (presentation) by InfoQ: https://lnkd.in/d-QNA6-d
- "Vaughn Vernon Uses Reactive DDD to Model Uncertainty in Microservices" (news article) by InfoQ: https://lnkd.in/dNJj7qkP
- "Vaughn Vernon: Reactive Domain-Driven Design" (news article) by InfoQ: https://lnkd.in/dhdiHdHE
Hello Dev.to Community, Here's My Introduction!
Tags: beginners
Published: 2023-02-23 01:13:30

Hey everyone, I'm excited to be joining the Dev.to community! My name is RONiB, and I'm a web developer with 6 in HTML5, CSS3, ES6 Bootstrap, PHP and WordPress.

I'm passionate about Web Development, and I'm always eager to learn new things and expand my skills. I'm particularly interested in JS, and I love collaborating with other developers to solve problems and build great websites.

I'm hoping to use this platform to share my experiences and insights, as well as learn from others in the community. I'm looking forward to engaging with other developers, learning new things, and contributing to the conversation here on Dev.to.

In my spare time, I enjoy watching movies and music, and I also love playing football.

I'm excited to get started here on Dev.to, and I can't wait to see what this community has in store!
How to set the data obtained by useQuery to the default values of useForm?
Published: 2023-02-23 01:02:54

hello awesome developers !

How to set the data obtained by useQuery to the default values of useForm?

without like this?

title: data.title 
can i do this?

  const { register, handleSubmit, watch, reset } = useForm<EstimateRequireForm>(
    {
      // mode: "onSubmit",
      // estimatePk, title, product, manager, email, phone_number, content, estimate_require_completion, memo
      defaultValues: {
        title: estimateData?.title,
        product: estimateData?.product,
        email: estimateData?.email,
        manager: estimateData?.manager,
        phone_number: estimateData?.phone_number,
        content: estimateData?.content,
        estimate_require_completion: estimateData?.estimate_require_completion,
        memo: estimateData?.memo,
      },
    }
  );

  useEffect(() => {
    reset({});
  }, [estimateData]);
Notes about a NodeJS program I wrote at work - 22nd Feb, 2023.
Tags: node
Published: 2023-02-23 01:01:32

The NodeJS program is about preparing data and sending a POST request to an API external to this app. The app receives a response from the request for further processing. An aspect of this app is making the POST request at a regular interval, for example every 6 hours. Finally, I needed to log the API calls to a file.

In this post I discuss, in brief, the various libraries used to accomplish the task.

## How to make a job run every _n_ hours? 

I used a cron task scheduler library, the [node-cron](https://www.npmjs.com/package/node-cron). The scheduler code looked like this:

```
const cron = require("node-cron");
const CRON = "0 0 */6 * * *";
cron.schedule(CRON, async () => {
    console.log("Making the API request.");
    // ...
});
```

---

## How to make a POST request using form data?

For this functionality, I used the [form-data](https://www.npmjs.com/package/form-data) library. This allowed sending form data with an uploaded file and also set custom headers. For example, creating the form data:

```
const FormData = require("form-data");
const formData = new FormData();
formData.append("mydata", "some data");
formData.append("myfile", fs.createReadStream("abc.xyz"));
const options = { method: "POST", body: formData, headers: { myhdr: "hdr value" } };
```

Send the request and receive a response using [node-fetch](https://www.npmjs.com/package/node-fetch) using the earlier created form data:

```
const fetch = require("node-fetch");
const resp = await fetch("http://www.example.com/someapi", options);
const json_data = await resp.json();
// Do something with the response data here ...
```

An aspect to note is that the functionality (or similar) of the `fetch` npm package is the implementation in NodeJS 17.x [fetch](https://nodejs.org/docs/latest-v17.x/api/globals.html#fetch).

---

## What logger?

The logging needed to be both in the console as well as to a file. The logged message included a timestamp too. I used the [winston](https://www.npmjs.com/package/winston) logging library. The logger code looked like this:

```
const winston = require("winston");
const logger = winston.createLogger({
    level: "info",
    format: winston.format.combine(winston.format.timestamp(), winston.format.json()),
    transports: [
        new winston.transports.File({ filename: "log_file_name.log" }),
        new winston.transports.Console(),  
    ],
});

logger.info({ message: "Logger started" });
```

---

## Conclusion:

I had used various libraries to accomplish a task. I note that the logging is the most common task and an important aspect of developing apps.

---
Frontend TIPS!
Published: 2023-02-23 00:56:44

As a self-taught frontend developer, building a strong portfolio is crucial to landing your first job or freelance gig. In this post, I'll share some tips on how to create a portfolio that showcases your skills and stands out to potential employers.

Showcase your best work - It's better to have a few high-quality projects in your portfolio than a large quantity of mediocre ones. Choose projects that you're proud of and that demonstrate your skills in HTML, CSS, JavaScript, and other relevant technologies.

Explain your process - When adding projects to your portfolio, be sure to explain your thought process and the challenges you faced along the way. Employers want to see that you can problem-solve and work through challenges.

Highlight your skills - Be sure to highlight the specific skills you used in each project, such as responsive design, accessibility, or use of a particular framework or library. This helps employers understand your level of proficiency in different areas.

Keep it organized - Organize your portfolio in a way that is easy to navigate and visually appealing. Use clear headings and categories, and consider using a simple, clean design that showcases your work without distracting from it.

Get feedback - Before finalizing your portfolio, get feedback from other developers or mentors. They may be able to offer suggestions for improvement or help you identify areas where you can showcase your skills even more effectively.

By following these tips, you'll be well on your way to building a strong frontend portfolio as a self-taught developer. Good luck and happy coding!

#frontenddevelopment #selftaughtdeveloper #portfoliotips #jobsearch #webdevelopment