teleren/devto huggingface dataset:
Swagger in Spring Boot 3.0
Published: 2024-01-06 13:40:26

**Title: How to Install Swagger in Spring Boot 3.0 with Maven**

If you're working on a Spring Boot 3.0 project and want to integrate Swagger for documenting and visualizing your API, follow these simple steps.

First, add the following dependency to your `pom.xml` file:

```xml
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
    <version>2.2.0</version>
</dependency>
```

Then, in your application properties, include the following configuration to sort operations in the Swagger UI:

```properties
springdoc.swagger-ui.operationsSorter=method
```

If you have Spring Security installed, it's crucial to allow Swagger to display. Add specific rules, for example:

```java
return http
    .cors(c -> corsConfigurationSource())
    .csrf(csrf -> csrf.disable())
    .authorizeHttpRequests(auth -> auth
        .requestMatchers("/v3/api-docs")
        .permitAll()
        .requestMatchers("/swagger-ui/**")
        .permitAll()
        .requestMatchers("/v3/api-docs/swagger-config")
        .permitAll()
        .anyRequest()
        .authenticated());
```

For more configuration, create a `SwaggerConfig` class with the following content:

```java
@Bean
public OpenAPI openAPI() {
    return new OpenAPI()
            .addSecurityItem(new SecurityRequirement().addList(token))
            .components(new Components().addSecuritySchemes(tokenApp, createAPIKeyScheme()))
            .info(new Info()
                    .title("Web service API")
                    .description("API Access for applications")
                    .version("1.0.0")
                    .contact(new Contact()
                            .name("EmSolution")
                            .email("info@emsolution.com")
                            .url("www.emsolution.com"))
                    .license(new License().name("License of API")
                            .url("API license URL")));
}

private SecurityScheme createAPIKeyScheme() {
    return new SecurityScheme().type(SecurityScheme.Type.APIKEY)
            .in(SecurityScheme.In.HEADER)
            .name(tokenApp);
}
```

That's it! Now you'll have Swagger integrated into your Spring Boot 3.0 project. Feel free to leave your comments and questions. Cheers!


"Finally, I appreciate your time in reading this article and hope to have your support."




[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnknajs8alqmal0a519q.png)](https://www.buymeacoffee.com/74spqeant)



[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bh5dkn3miqftnivj6htg.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H3BEAVMT4SL9Y)



*Ing. Mauricio Huertas T.*

---
Command Line 101
Published: 2024-01-06 13:35:43


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46q1llkx4u9zzzo255xy.png)📘 Command Line 101: A Comprehensive Guide for Beginners is now available for FREE! 🚀

Unleash the full potential of your computer with this beginner-friendly guide. 🌐 Dive into the world of command line mastery, from navigating directories to scripting automation. 💡

👉 Key Highlights:
- Perfect for absolute beginners
- Hands-on examples and step-by-step instructions
- Elevate your efficiency and problem-solving skills
- Troubleshoot errors like a pro
- Available now on for FREE https://bit.ly/cli-101

📚 Get your copy today for FREE and revolutionize your digital journey! 🚀

#CommandLine #TechEnthusiast #DigitalSkills #Productivity
Swagger en Spring Boot 3.0
Published: 2024-01-06 13:35:16


**Cómo Instalar Swagger en Spring Boot 3.0 con Maven**

Si estás trabajando en un proyecto Spring Boot 3.0 y deseas integrar Swagger para documentar y visualizar tu API, sigue estos pasos sencillos.

Primero, añade la siguiente dependencia a tu archivo `pom.xml`:

```xml
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
    <version>2.2.0</version>
</dependency>
```

Luego, en las propiedades de tu aplicación, incluye la siguiente configuración para ordenar las operaciones en la interfaz de usuario de Swagger:

```properties
springdoc.swagger-ui.operationsSorter=method
```

Si estás utilizando Spring Security, es importante permitir que Swagger se muestre. Añade reglas específicas, por ejemplo:

```java
return http
    .cors(c -> corsConfigurationSource())
    .csrf(csrf -> csrf.disable())
    .authorizeHttpRequests(auth -> auth
        .requestMatchers("/v3/api-docs")
        .permitAll()
        .requestMatchers("/swagger-ui/**")
        .permitAll()
        .requestMatchers("/v3/api-docs/swagger-config")
        .permitAll()
        .anyRequest()
        .authenticated());
```

Si deseas una configuración más detallada, crea una clase `SwaggerConfig` con el siguiente contenido:

```java
@Bean
public OpenAPI openAPI() {
    return new OpenAPI()
            .addSecurityItem(new SecurityRequirement().addList(token))
            .components(new Components().addSecuritySchemes(tokenApp, createAPIKeyScheme()))
            .info(new Info()
                    .title("Web service API")
                    .description("API de acceso a aplicaciones")
                    .version("1.0.0")
                    .contact(new Contact()
                            .name("EmSolucion")
                            .email("info@emsolucion.com")
                            .url("www.emsolucion.com"))
                    .license(new License().name("Licencia de API")
                            .url("URL de la licencia de la API")));
}

private SecurityScheme createAPIKeyScheme() {
    return new SecurityScheme().type(SecurityScheme.Type.APIKEY)
            .in(SecurityScheme.In.HEADER)
            .name(tokenApp);
}
```

¡Listo! Ahora tendrás Swagger integrado en tu proyecto Spring Boot 3.0. No dudes en dejar tus comentarios y preguntas. ¡Saludos!

"Finalmente, agradezco tu tiempo al leer este artículo y espero contar con tu apoyo."


[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntlvw041xuism6uoseft.png)](https://www.buymeacoffee.com/74spqeant)



[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7aoq4tqwpkm0svi24c3l.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H3BEAVMT4SL9Y)



*Ing. Mauricio Huertas T.*
Listen To Your Code
Tags: programming, development, agile, softwareengineering
Published: 2024-01-06 13:30:54

I see a lot of programmers move so fast from story to story they forget to listen to the code. They’re too busy programming to create small quiet periods after landing changes to reflect on the state of the code. And that’s too bad, because it is a very useful technique to purposefully step back and listen to what the code has to say, instead of rushing through to work on the next task.

## Listen?
I mean set aside a bit of unstructured time to just… go through the code, follow its threads of logic, sense the clumps of structure. Maybe some test-files aren’t really clear, what could simplify them? Maybe some domain-language has leaked through its abstractions, is a refactor in order? Maybe some subsystems are unnecessarily coupled, and it’s time to tease them apart? Creating this quiet moment is a time to play around with the code-structure, maybe try to decouple some intertwined portions, or restructure sections for better flow. It’s a time to strive for equilibrium, to sense areas that are complex and angry compared to the simpler and calm systems that surround them. By focusing on the architecture and robustness of the code, we can prune and refine it to improve its maintainability.
I personally like to put on music for this, because it softens my cognition a bit which surfaces the “feel” of the code, which lets me more easily identify some of the rough edges.

So next time, after a story is done, consider if now is that opportunity to explore the code, to ensure the newly implemented features are not just operational but also understandable and optimized and fits in with the whole. Set the rigid flow of user stories and tickets aside for a moment, and just… take a stroll. Imagine what could be, and try it out 🌱
Concatenating Python Dictionaries
Tags: python, dict
Published: 2024-01-06 13:12:27

When I'm working with Django I often like to create a base context which is a Python dict for a set of views and initially define them outside of each view. Within each view, instead of creating a new context, I prefer to update the context.

So, with Python, you can combine two dictionaries in a couple of different ways. Here are two methods:

Using update() Method:

You can think of dictionaries in Python like collections of information. Let's say you have two dictionaries, each with some details:

Dictionary 1: It contains information about a person named Sarah, like her age (15) and the number of books she has (3).

Dictionary 2: Now, you want to add more information to Dictionary 1, like Sarah's new age (16) and the fact that she got a new bicycle.

When you use the update() method, it's like taking the information from Dictionary 2 and adding it to Dictionary 1:

```python
dict1 = {'app_name': 'MyApp', 'def_page_title': 'Welcome to MyApp'}
dict2 = {'objects': MyModel.objects.filter(is_active=True)}

dict1.update(dict2)

print(dict1)
```

The result will be:

```
{
    'app_name': 'MyApp',
    'def_page_title': 'Welcome to MyApp',
    'objects': MyModel.objects.filter(is_active=True)
}
```

Using the Unpacking Operator (**):

You can also use the ** operator.

Let's use a simple example.

Imagine you have two sets of information about a person named David:

Set 1: It mentions David's favorite color (blue) and the number of pets he has (2 cats).

Set 2: Now, you want to combine Set 1 and Set 2 into a single set of information.

You can do this using the unpacking operator (**), which creates a new set of information by putting together everything from both sets:

```python
set1 = {'color': 'blue', 'pets': '2 cats'}
set2 = {'color': 'green', 'hobby': 'playing chess'}

combined_set = {**set1, **set2}

print(combined_set)
```

The result will be:

```
{'color': 'green', 'pets': '2 cats', 'hobby': 'playing chess'}
```

In both cases, you're adding or merging information to create a more complete set of details, just like updating or combining facts about a person. Both ways work the same. But for me using {...}.update({...}) seems more readable.
Prototype to Learn
Published: 2024-01-06 11:09:41

| 🔴 **Disclaimer**: This post is enhanced with AI assistance.|
|--------------|

> Prototyping is a learning experience. Its value lies not in the code you produce, but in the lessons you learn. ~ Tip #21 from the book "The Pragmatic Programmer"

---

Not lines of code, nor pixels bright,
But paths explored, a guiding light.
The prototype, a sketch in haste,
Unveils the flaws, makes choices taste.

Like sculptor chipping roughened stone,
Each iteration finds its tone.
A twist, a turn, a shift of view,
Reveals the bug, the better way, it's true.

Don't chase perfection, polished gleam,
Embrace the mess, the changing stream.
For in the sandbox, quick and free,
The hidden truths come clear to see.

So prototype, with eager hand,
Let curiosity take command.
Fail fast, fail often, that's the key,
Unravel secrets, set your code free.

For lines of code are just the shell,
It's what they teach that makes it swell.
A journey inward, line by line,
Discovering where brilliance truly shines.

So prototype, dear engineer,
And watch your knowledge disappear,
Replaced by wisdom, sharp and keen,
The lessons learned, a code unseen.

---

|✍ **Powered by**: *Google Bard*|
|--------------|
Mastering React: Best Practices for Cleaner and More Efficient Code
Tags: react, bestpractice, webdev
Published: 2024-01-06 12:59:06

এই আর্টিক্যাল এ আমরা React এর কিছু best practice নিয়ে কথা বলবো ।


## 1. Destructuring and Spread Operator for Props:


React component এ একাধিক prop রিসিভ করলে আমরা সেগুলো destructure করে ইউজ করলে কোড এর readability and efficiency বেড়ে যায় ।

```
const MyComponent = ({ prop1, prop2, prop3, ...restProps }) => {
  // Component logic here
  return <ChildComponent {...restProps} />;
};

```

এই example এ, ফাংশন প্যরামিটার এ props destructure করে নেয়ার কারনে সহজেই আমরা বুঝতে পারি এই কম্পোনেন্টটি কি কি props এর উপর dependent.

## 2. Conditional Rendering with Ternary Operators:

আমরা যখন কন্ডিশনালি কোন কম্পনেন্ট রেন্ডার করি তখন if-else statement ইউজ না করে আমরা ternary ইউজ করতে পারি, এতে আমাদের কোড অনেক ক্লিন এবং রিডেবল হবে ।

```
const MyComponent = ({ isLoggedIn }) => {
  return isLoggedIn ? <UserDashboard /> : <Login />;
};

```

এই example এ, ইউজার যখন লগিন করা থাকবে তখন আমরা UserDashboard এবং যখন লগিন না থাকবে তখন Login কম্পনেন্ট কে রেন্ডার করব ternary operator ইউজ করে ।

## 3. React Fragments for Cleaner JSX:

আমরা যখন একটা কম্পনেন্ট এ আরও কিছু child component ইউজ করি তখন সেগুলো একটা wrapper div দিয়ে wrap না করে আমরা react fragments ইউজ করে আমাদের কোড আরো বেশি ক্লিন এবং রিডেবল করে ফেলতে পারি ।

```
const MyComponent = () => (
  <>
    <Header />
    <MainContent />
    <Footer />
  </>
);

```

## 4. PropTypes and Default Props:

একটা component যে props গুলো রিসিভ করে সেগুলোর টাইপ ডিক্লেয়ার করে দেয়ার মাধ্যমে আর ডিফল্ট props সেট করে আমরা development স্টেজ এই আমাদের এরর গুলো ডিটেক্ট এবং হ্যান্ডল করে ফেলতে পারি । এতে আমাদের development টাইম অনেক কমে আসে ।

```
import PropTypes from 'prop-types';

const MyComponent = ({ name, age }) => {
  // Component logic here
};

MyComponent.propTypes = {
  name: PropTypes.string.isRequired,
  age: PropTypes.number,
};

MyComponent.defaultProps = {
  age: 25,
};

```

এছাড়াও এরকম আরো অনেক বেস্ট প্র্যক্টিস আছে যা ফলো করে আমরা আমাদের আমাদের কোড বেজ কে ক্লিন, রিডেবল এবং Efficient করতে পারি । ধন্যবাদ ।
Content Mode | IOS Swift
Tags: ios, swift, beginners, braziliandevs
Published: 2024-01-06 12:47:40

In this article we will talk about the ways in which elements can be worked with within a view, the value of this property by default comes as .scaleToFill.

We use this property when we want to implement resizable controls. For example, instead of having to redraw every time, we use content mode so that the element adapts as necessary.

## .scaleToFill

- Fills the entire view, so it can lose proportion
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wg380f9rkmyy7sraadw.png)

## .scaleAspectFit

- Adjusts the content to fit the view while maintaining the aspect ratio, any remaining area is transparent
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlplq00ftyrovwsdfmj6.png)

## .scaleAspectFill

- It fills the view while maintaining the proportion, but the element may go beyond the limits of the view.

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

## .center

- Centers the content and maintains the same proportions

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

## .top

- Aligns and centers the content at the top of the view

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

## .bottom

- Aligns and centers the content at the bottom of the view

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

## .left

- Aligns and centers the content on the left side of the view

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

## .right

- Aligns and centers the content on the right side of the view

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

## .topLeft

- Aligns content to the left at the top of the view

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

## .topRight

- Aligns content to the right at the top of the view

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

## .bottomLeft

- Aligns content to the left at the bottom of the view

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

## .bottomRight

- Aligns content to the right at the bottom of the view

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

## .redraw

- Indicates that the view needs to be redrawn every time the size is changed, we use this when the content of the view depends on the view

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


Thanks for read this article!
Made a shopping cart web app using HTML, CSS and Javascript
Tags: webdev, javascript, programming, 100daysofcode
Published: 2024-01-06 12:32:55

erent items, and the total amount along with the items is displayed on the cart page. The website is dynamic and allows editing the choice of items both on the store and on the cart page.

Link to the web app: https://shopping-cart-app-with-html-css-and-javascript.vercel.app/index.html

We have unique IDs of the shopping items whose details are stored in a `js` file, which behaves as a key for identifying the quantity, price, etc of the item which the user selects. Javascript is used to generate a loop which renders the details based on the HTML template designed.

Associated cards are dynamically programmed to identify specific elements, and results are rendered using the document object model (DOM). User’s selections are saved in the browser memory so that they reload after refresh.

Link to the source code: https://github.com/Harshitnitw/shopping-cart-app-with-HTML--CSS-and-Javascript

Thanks to Freecodecamp and the instructor Joy Shaheb for providing the learning opportunity. Associated tutorial: https://youtu.be/cT_ZYrS3tKc

It was delightful for me to be able to apply my own ideas to reduce redundancy, avoid unused code and apply alternative techniques to load the pages faster, to improve upon the tutor’s project, which enhanced my learning experience manyfolds!
Quang Khải
Published: 2024-01-06 12:31:31

Tác giả Quang Khải - Ceo nhà cái 69vn là một đạt thành công to lớn trong lĩnh vực công nghệ và đặc biệt là ngành giải trí trực truyến. Hiện nay ông đang là CEO của nhà cái 979vn một trong những website cá cược hàng đầu trên thế giới.
Bran: 979vn
Địa chỉ: 18/26 Tống Văn Hên, Phường 15, Tân Bình, Thành phố Hồ Chí Minh, Việt Nam
Postcode: 72109
SDT: 09453077421
Email: 979vncomco@gmail.com
Website: https://979vn.com.co/tac-gia-quang-khai/
#tacgiaquangkhai #authorquangkhai #ceoquangkhai #quangkhai
 
Social Links:

https://www.pinterest.com/quangkhai979vn/

https://twitter.com/quangkhai979vn

https://www.reddit.com/user/quangkhai979vn

https://www.quora.com/profile/Quangkhai979vn

https://www.producthunt.com/@quangkhai979vn

https://vimeo.com/quangkhai979vn

https://foursquare.com/quangk2217436/list/quangkhai979vn

https://www.youtube.com/@quangkhai979vn/about

https://www.goodreads.com/user/show/173883448-quang-kh-i

https://soundcloud.com/quangkhai979vn

https://www.twitch.tv/quangkhai979vn

https://flipboard.com/@quangkhai979vn/

https://en.gravatar.com/hutchinsonronald583

https://dribbble.com/quangkhai979vn/about

https://www.kickstarter.com/profile/quangkhai979vn/about

https://www.blogger.com/profile/08519720935946973444

https://quangkhai979vn.blogspot.com/

https://quangkhai979vn.tumblr.com/

https://www.behance.net/quangkhai979vn

https://about.me/quangkhai979vn/

https://www.instapaper.com/p/quangkhai979vn

https://sites.google.com/view/quangkhai979vn/

https://band.us/@quangkhai979vn

https://data.world/quangkhai979vn

https://www.blackhatworld.com/members/quangkhai979vn.1862478/#about

https://www.designspiration.com/quangkhai979vn/

http://www.socialbookmarkssite.com/user/quangkhai979vn/

https://replit.com/@quangkhai979vn

https://pxhere.com/en/photographer/4159852

https://osf.io/789be/

https://www.bigpictureclasses.com/users/quangkhai979vn

https://public.tableau.com/app/profile/quangkhai979vn

https://forums.goha.ru/member.php?u=1517649

https://www.chordie.com/forum/profile.php?id=1828062

https://roomstyler.com/users/quangkhai979vn

https://quangkhai979vn.contently.com/

https://www.penname.me/@quangkhai979vn

http://egamingsupply.com/forum/member.php/66879-quangkhai979vn

https://gitee.com/quangkhai979vn

https://dev.to/quangkhai979vn
Building Custom Middleware in FastAPI | Princewill Inyang
Tags: python, programming, news, datascience
Published: 2024-01-06 12:26:21

This week pip Trends [newsletter](https://newsletter.piptrends.com/p/building-custom-middleware-in-fastapi) is out. Interesting things are covered this week, Some of them: Pandas Pivot: An In-Depth Guide to When and How to Use It, PyPy has moved to Git, GitHub
Disappoint Hackers - Add SSL Certificates to your Website
Published: 2024-01-06 12:18:41

To obtain SSL certificates for `www.realmigo.tech` and `realmigo.tech` using Let's Encrypt, you can use Certbot. Certbot simplifies the process of obtaining and renewing SSL certificates. Here's a step-by-step guide:

### Prerequisites:
1. Ensure that your domain's DNS records point to the correct IP address.
2. Make sure that your server is reachable on ports 80 and 443.

### Steps:

1. **Install Certbot:**
   Install Certbot on your server. The commands might vary depending on your operating system. For example, on Ubuntu, you can use:

   ```bash
sudo apt update
sudo apt install certbot
sudo apt install python3-certbot-nginx
   ```

2. **Obtain SSL Certificates:**
   Run Certbot to obtain SSL certificates for both `www.realmigo.tech` and `realmigo.tech`:

   ```bash
sudo certbot certonly --nginx -d realmigo.tech -d www.realmigo.tech
   ```

   This command will use Certbot in standalone mode and perform the necessary steps to prove domain ownership.

3. **Configure Nginx to Redirect HTTP to HTTPS (Optional but recommended):**
   Create an Nginx configuration file for your application, specifying the SSL certificate paths. Create a new file, for example, `/etc/nginx/sites-available/your-app`, and add the following content:

   ```nginx
   server {
       listen 80;
       server_name realmigo.tech www.realmigo.tech;
       return 301 https://$host$request_uri;
   }

   server {
       listen 443 ssl;
       server_name realmigo.tech www.realmigo.tech;

       ssl_certificate /etc/letsencrypt/live/realmigo.tech/fullchain.pem;
       ssl_certificate_key /etc/letsencrypt/live/realmigo.tech/privkey.pem;

       # Additional SSL configurations go here

       location / {
           proxy_pass http://localhost:your_app_port;
           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection 'upgrade';
           proxy_set_header Host $host;
           proxy_cache_bypass $http_upgrade;
       }
   }
   ```

   Replace `your_app_port` with the actual port where your application is running.
**Create a Symbolic Link:**
   Create a symbolic link to enable the Nginx site:

   ```bash
sudo ln -s /etc/nginx/sites-available/your-app /etc/nginx/sites-enabled/
   ```
   
4. **Test Nginx Configuration and Restart Nginx:**
   Check the Nginx configuration for syntax errors:

   ```bash
   sudo nginx -t
   ```

   If there are no errors, restart Nginx:

   ```bash
   sudo service nginx restart
   ```

5. **Automatic Renewal:**
   Set up a cron job to automatically renew the Let's Encrypt certificates:

   ```bash
   sudo crontab -e
   ```

   Add the following line to run the renewal process twice daily:

   ```
   0 */12 * * * certbot renew --quiet
   ```

   Save and exit the editor.

Now, your site should be accessible over HTTPS at `https://www.realmigo.tech` and `https://realmigo.tech`. Make sure to customize the Nginx configuration according to your application's needs.