diff --git a/blog/2024-03-15/Dobavlenie-yarlyka-udalyonnogo-oblaka-YAndeks.Disk-v-Dolphin.png b/blog/2024-03-15/Dobavlenie-yarlyka-udalyonnogo-oblaka-YAndeks.Disk-v-Dolphin.png
deleted file mode 100644
index 83e470dc7..000000000
Binary files a/blog/2024-03-15/Dobavlenie-yarlyka-udalyonnogo-oblaka-YAndeks.Disk-v-Dolphin.png and /dev/null differ
diff --git a/blog/2024-03-15/GUI-YD-tools-dlya-sredy-KDE.png b/blog/2024-03-15/GUI-YD-tools-dlya-sredy-KDE.png
deleted file mode 100644
index 8fea696b3..000000000
Binary files a/blog/2024-03-15/GUI-YD-tools-dlya-sredy-KDE.png and /dev/null differ
diff --git a/blog/2024-03-15/Integratsiya-YAndeks.Disk-s-fajlovym-meneddzherom-vvod-adresa-i-avtorizatsiya.png b/blog/2024-03-15/Integratsiya-YAndeks.Disk-s-fajlovym-meneddzherom-vvod-adresa-i-avtorizatsiya.png
deleted file mode 100644
index b6c1debe7..000000000
Binary files a/blog/2024-03-15/Integratsiya-YAndeks.Disk-s-fajlovym-meneddzherom-vvod-adresa-i-avtorizatsiya.png and /dev/null differ
diff --git a/blog/2024-03-15/Punkty-kontekstnogo-menyu-dlya-YAndeks.Disk-v-Dolphin.png b/blog/2024-03-15/Punkty-kontekstnogo-menyu-dlya-YAndeks.Disk-v-Dolphin.png
deleted file mode 100644
index 1a7bd9dd1..000000000
Binary files a/blog/2024-03-15/Punkty-kontekstnogo-menyu-dlya-YAndeks.Disk-v-Dolphin.png and /dev/null differ
diff --git a/blog/2024-03-15/prompt-engineering-guide.md b/blog/2024-03-15/prompt-engineering-guide.md
index 759a1cfde..aaba48902 100644
--- a/blog/2024-03-15/prompt-engineering-guide.md
+++ b/blog/2024-03-15/prompt-engineering-guide.md
@@ -7,6 +7,8 @@ date: 2020-12-21 15:34:11
Prompt Engineering is a process of creating a prompt that is used to guide the user through a series of steps to achieve a specific goal. It is a powerful tool that can help users complete complex tasks with ease and efficiency. In this guide, we will walk you through the process of creating an effective prompt that will help you achieve your desired outcome.
+
+
## Step 1: Define the Goal
The first step in creating an effective prompt is to define the goal you want to achieve. This could be anything from completing a task, learning a new skill, or solving a problem. By clearly defining the goal, you can create a prompt that guides the user towards that goal.
@@ -15,7 +17,6 @@ The first step in creating an effective prompt is to define the goal you want to
Once you have defined the goal, the next step is to identify the steps required to achieve that goal. Break down the goal into smaller, manageable steps that the user can follow to reach the desired outcome. This will help the user understand what they need to do and how to do it.
-
## Step 3: Design the Prompt
With the goal and steps identified, it's time to design the prompt. The prompt should be clear, concise, and easy to follow. Use simple language and provide clear instructions to guide the user through each step. You can use visual cues, such as arrows or icons, to help the user navigate the prompt.
@@ -30,4 +31,4 @@ Once you have tested the prompt and made any necessary adjustments, it's time to
## Conclusion
-Creating an effective prompt is a valuable skill that can help you guide users through complex tasks and achieve your desired outcomes. By following these steps, you can create a prompt that is clear, concise, and easy to follow, helping users complete tasks with ease and efficiency. Happy prompting!
\ No newline at end of file
+Creating an effective prompt is a valuable skill that can help you guide users through complex tasks and achieve your desired outcomes. By following these steps, you can create a prompt that is clear, concise, and easy to follow, helping users complete tasks with ease and efficiency. Happy prompting!
diff --git a/blog/Building RESTful CRUD API in springboot/images/image01.png b/blog/Building RESTful CRUD API in springboot/images/image01.png
deleted file mode 100644
index 7f0770caf..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image01.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/images/image02.png b/blog/Building RESTful CRUD API in springboot/images/image02.png
deleted file mode 100644
index d2e2e4a7b..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image02.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/images/image03.png b/blog/Building RESTful CRUD API in springboot/images/image03.png
deleted file mode 100644
index ce737d082..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image03.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/images/image04.png b/blog/Building RESTful CRUD API in springboot/images/image04.png
deleted file mode 100644
index 534cc13c0..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image04.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/images/image05.png b/blog/Building RESTful CRUD API in springboot/images/image05.png
deleted file mode 100644
index 8fb10e191..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image05.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/images/image06.png b/blog/Building RESTful CRUD API in springboot/images/image06.png
deleted file mode 100644
index 5e82e9593..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image06.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/images/image07.png b/blog/Building RESTful CRUD API in springboot/images/image07.png
deleted file mode 100644
index 6e0332893..000000000
Binary files a/blog/Building RESTful CRUD API in springboot/images/image07.png and /dev/null differ
diff --git a/blog/Building RESTful CRUD API in springboot/index.md b/blog/Building RESTful CRUD API in springboot/index.md
deleted file mode 100644
index cadf6a642..000000000
--- a/blog/Building RESTful CRUD API in springboot/index.md
+++ /dev/null
@@ -1,571 +0,0 @@
----
-title: 'Building a RESTful CRUD API with Spring Boot: A step by step guide'
-sidebar_label: Springboot-REST-API-CRUD
-authors: [dharshibalasubramaniyam]
-tags: [springboot, rest-api]
-date: 2024-06-25
-hide_table_of_contents: true
----
-
-## What is RESTFUL API?
-- In the realm of modern web development, RESTful APIs have become a cornerstone for building scalable, efficient, and maintainable web applications.
-
-- In the world of computers and the internet, applications communicate with each other using a set of rules.
-
-- RESTful APIs (Application Programming Interfaces) are act as intermediaries between different software applications (client and server), allowing them to communicate and share data with each other over the internet.
-
-- *Representational State Transfer (REST)*: This is a style of building software systems that use standard HTTP methods (like GET, POST, PUT, DELETE) to perform operations on resources (like data stored in a database). It emphasizes simplicity, scalability, and flexibility.
-
-- *API (Application Programming Interface)*: Think of an API as a set of rules and protocols that allow different software applications to talk to each other. It defines how different parts of software systems can interact and exchange data.
-
-- So, when we say a *“RESTful API”*, we’re talking about a set of rules and conventions that govern how applications communicate with each other over the internet using standard HTTP methods.
-
-## Why spring boot?
-- Among the myriad of frameworks available for building RESTful APIs, Spring Boot stands out as a robust and developer-friendly option for Java developers.
-
-- Spring Boot makes it simple for developers to create web applications without getting bogged down in complex configuration.
-
-- With Spring Boot, you can quickly build and deploy applications, which is great for trying out ideas or making changes fast.
-
-- It comes with many useful tools and features ready to use, like handling data, security, and more, saving you time and effort.
-
-- Spring Boot can easily connect with other tools and libraries, making it flexible for different needs.
-Motive of this article
-
-- In this comprehensive guide, we’ll delve into the process of creating a RESTful CRUD (Create, Read, Update, Delete) API for managing user data using Spring Boot and MySQL. We’ll cover everything from project setup to testing, demonstrating best practices and essential techniques along the way. By the end of this tutorial, you’ll have a solid understanding of how to architect, develop RESTful APIs using Spring Boot.
-
-- Without further ado, let’s embark on this journey of building a RESTful user CRUD API with Spring Boot.
-
-### To build a Spring Boot project, you’ll need a few prerequisites:
-
-- Java Development Kit (JDK): Spring Boot applications are typically written in Java, so you’ll need to have the JDK installed on your system. Spring Boot supports Java 8 and newer versions, so make sure you have a compatible JDK installed.
-
-- Integrated Development Environment (IDE): While you can build Spring Boot applications using a simple text editor and command-line tools, using an IDE can greatly enhance your productivity. Popular choices include IntelliJ IDEA, Eclipse, and Spring Tool Suite (STS).
-
-- Build Tool: Spring Boot projects are typically built using either Maven or Gradle. Maven is more commonly used, but Gradle offers some advantages in terms of flexibility and performance. Choose whichever build tool you’re more comfortable with.
-
-- Understanding of Java: While you don’t need to be an expert, it’s beneficial to have a basic understanding of Java programming.
-
-- Database Knowledge (Optional): Having some knowledge of database concepts and SQL can be beneficial. Spring Boot supports various databases, including MySQL, PostgreSQL, MongoDB, and more.
-
-## Step 1: Setting up project.
-
-- Visit spring initializer and fill in all the details accordingly and at last click on the GENERATE button. Extract the zip file and import it into your IDE.
-
- 
-
-### 1.1. Add below dependencies in pom.xml file.
-
-```
-
- // we'll use this dependency to create RESTful API endpoints,
- // handle HTTP requests (GET, POST, PUT, DELETE), and return JSON responses.
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- // we'll use this dependency to interact with a database,
- // define JPA entities (data models), perform CRUD operations,
- // and execute custom database queries.
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- // we'll use this dependency to establish a connection to
- // our MySQL database, execute SQL queries, and manage database transactions.
-
- mysql
- mysql-connector-java
- 8.0.33
- runtime
-
-
- // we'll use Lombok annotations (such as @Data, @Getter, @Setter)
- // in our Java classes to automatically generate common methods,
- // making your code cleaner and more concise.
-
- org.projectlombok
- lombok
- true
-
-
- // we'll use this dependency to annotate your Java model classes
- // with validation constraints (e.g., @NotBlank, @NotNull, @Size)
- // and automatically validate request data in your RESTful API endpoints.
-
- org.springframework.boot
- spring-boot-starter-validation
-
-
-
-```
-
-
-### 1.2. Update application.properties file
-
-```
-spring.jpa.hibernate.ddl-auto=update
-spring.datasource.url=jdbc:mysql://localhost:3306/usercrud
-spring.datasource.username=your localhost username
-spring.datasource.password=your localhost password
-spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-```
-
-## Step 2: Create project structure.
-
-- Create below folder structure inside src folder. We’ll travel through each file one by one.
-
- 
-
-## Step 3: Create User Model
-
-- Models define the structure and attributes of the data entities that the application manages.
-
-- For example, a User model might include attributes like id, username, email, and password.
-
-- Models often include annotations or custom logic to validate the data before it is persisted to the database. For example, you might use annotations like `@NotBlank`, `@Email`, or `@Size` to enforce constraints on the data.
-
-- Models are typically mapped to database tables using Object-Relational Mapping (ORM) frameworks like Hibernate in Spring Boot applications. They define the structure of the database tables and establish relationships between entities.
-
-```java
-// User.java
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@Entity
-@Table(uniqueConstraints = {
- @UniqueConstraint(columnNames = "username"),
- @UniqueConstraint(columnNames = "email")
-})
-public class User {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
-
- @NotBlank
- @Size(min=3, max = 20)
- private String username;
-
- @NotBlank
- @Email
- private String email;
-
- @NotBlank
- @Size(min=10, max = 10)
- private String phone;
-
- private LocalDateTime regDateAndTime;
-
-}
-```
-
-## Step 4: Create DTO classes
-
-- DTOs (Data Transfer Objects) play a crucial role in Spring Boot CRUD applications by providing a flexible and efficient mechanism for transferring data between layers (Client and Server), optimizing performance, encapsulating business logic, ensuring compatibility, and enhancing security and privacy.
-
-```java
-// ApiResponseDto.java
-
-@Data
-@AllArgsConstructor
-public class ApiResponseDto {
- private String status;
- private T response;
-
-}
-
-// ApiResponseStatus.java
-
-public enum ApiResponseStatus {
- SUCCESS,
- FAIL
-}
-
-// UserRegistrationDTO.java
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class UserRegistrationDTO {
-
- @NotBlank(message = "Username is required!")
- @Size(min= 3, message = "Username must have atleast 3 characters!")
- @Size(max= 20, message = "Username can have have atmost 20 characters!")
- private String userName;
-
- @Email(message = "Email is not in valid format!")
- @NotBlank(message = "Email is required!")
- private String email;
-
- @NotBlank(message = "Phone number is required!")
- @Size(min = 10, max = 10, message = "Phone number must have 10 characters!")
- @Pattern(regexp="^[0-9]*$", message = "Phone number must contain only digits")
- private String phone;
-
-}
-```
-
-## Step 5: Create Exception classes
-
-- Custom exceptions help to improve the clarity and maintainability of the code by providing specific error handling for common scenarios encountered in a CRUD application.
-- They allow developers to handle exceptional cases gracefully and communicate errors effectively.
-
-```java
-// UserNotFoundException.java
-
-// This exception is thrown when attempting to retrieve a user from the database, but the user does not exist.
-public class UserNotFoundException extends Exception{
- public UserNotFoundException(String message) {
- super(message);
- }
-}
-
-
-// UserAlreadyExistsException.java
-
-// This exception is thrown when attempting to create a new user, but a user with the same identifier (e.g., username, email) already exists in the database.
-public class UserAlreadyExistsException extends Exception{
- public UserAlreadyExistsException(String message) {
- super(message);
- }
-}
-
-
-// UserServiceLogicException.java
-
-// This exception serves as a generic exception for any unexpected errors or business logic violations that occur within the user service layer.
-public class UserServiceLogicException extends Exception{
- public UserServiceLogicException() {
- super("Something went wrong. Please try again later!");
- }
-}
-```
-
-## Step 6: Create User Repository Interface
-
-- Repository interfaces abstract the details of data access. Instead of directly interacting with data storage mechanisms (such as databases), you define repository interfaces to declare methods for common CRUD (Create, Read, Update, Delete) operations.
-
-- JpaRepository is a part of Spring Data JPA and provides CRUD (Create, Read, Update, Delete) operations for the User entity.
-
-- The first generic parameter User specifies the entity class that this repository manages, implying that User is an entity class.
-
-- The second generic parameter Integer specifies the type of the primary key of the User entity.
-
-```java
-// UserRepository.java
-
-@Repository
-public interface UserRepository extends JpaRepository {
-
- // Developers can define methods in repository interfaces with custom query keywords,
- // and Spring Data JPA automatically translates them into appropriate SQL queries.
- User findByEmail(String email);
-
- User findByUsername(String userName);
-
- List findAllByOrderByRegDateTimeDesc();
-
-}
-```
-
-- By extending JpaRepository, UserRepository inherits methods for performing various database operations such as saving, deleting, finding, etc., without needing to write these methods explicitly. These methods are provided by Spring Data JPA based on the naming convention of the methods in the repository interface.
-
-## Step 7: Create User Service class
-
-- Service classes in Spring Boot CRUD applications serve as the backbone for implementing business logic, managing transactions, abstracting data access, centralizing business rules, promoting reusability, and handling errors effectively.
-
-- By placing business logic within service classes, you centralize the rules governing your application’s behavior. This makes it easier to maintain and modify the behavior of your application without having to hunt down logic scattered across different parts of the codebase.
-
-```java
-@Service
-public interface UserService {
-
- ResponseEntity> registerUser(UserDetailsRequestDto newUserDetails)
- throws UserAlreadyExistsException, UserServiceLogicException;
-
- ResponseEntity> getAllUsers()
- throws UserServiceLogicException;
-
- ResponseEntity> updateUser(UserDetailsRequestDto newUserDetails, int id)
- throws UserNotFoundException, UserServiceLogicException;
-
- ResponseEntity> deleteUser(int id)
- throws UserServiceLogicException, UserNotFoundException;
-
-}
-```
-
-```java
-@Component
-@Slf4j
-public class UserServiceImpl implements UserService{
-
- @Autowired
- private UserRepository userRepository;
-
- @Override
- public ResponseEntity> registerUser(UserDetailsRequestDto newUserDetails)
- throws UserAlreadyExistsException, UserServiceLogicException {
-
- // logic to register user
- }
-
- @Override
- public ResponseEntity> getAllUsers() throws UserServiceLogicException {
- // logic to get all users
- }
-
- @Override
- public ResponseEntity> updateUser(UserDetailsRequestDto newUserDetails, int id)
- throws UserNotFoundException, UserServiceLogicException {
- // logic to update user
- }
-
- @Override
- public ResponseEntity> deleteUser(int id) throws UserServiceLogicException, UserNotFoundException {
- // logic to delete user
- }
-}
-```
-
-- Now let’s see how we can implement each of the methods in UserServiceImpl separately.
-
-```java
-@Override
-public ResponseEntity> registerUser(UserDetailsRequestDto newUserDetails)
- throws UserAlreadyExistsException, UserServiceLogicException {
-
- try {
- if (userRepository.findByEmail(newUserDetails.getEmail()) != null){
- throw new UserAlreadyExistsException("Registration failed: User already exists with email " newUserDetails.getEmail());
- }
- if (userRepository.findByUsername(newUserDetails.getUserName()) != null){
- throw new UserAlreadyExistsException("Registration failed: User already exists with username " newUserDetails.getUserName());
- }
-
- User newUser = new User(
- newUserDetails.getUserName(), newUserDetails.getEmail(), newUserDetails.getPhone(), LocalDateTime.no()
- );
-
- // save() is an in built method given by JpaRepository
- userRepository.save(newUser);
-
- return ResponseEntity
- .status(HttpStatus.CREATED)
- .body(new ApiResponseDto<>(ApiResponseStatus.SUCCESS.name(), "New user account has been successfully created!"));
-
- }catch (UserAlreadyExistsException e) {
- throw new UserAlreadyExistsException(e.getMessage());
- }catch (Exception e) {
- log.error("Failed to create new user account: " + e.getMessage());
- throw new UserServiceLogicException();
- }
-}
-```
-
-```java
-@Override
-public ResponseEntity> getAllUsers() throws UserServiceLogicException {
- try {
- List users = userRepository.findAllByOrderByRegDateTimeDesc();
-
- return ResponseEntity
- .status(HttpStatus.OK)
- .body(new ApiResponseDto<>(ApiResponseStatus.SUCCESS.name(), users)
- );
-
- }catch (Exception e) {
- log.error("Failed to fetch all users: " + e.getMessage());
- throw new UserServiceLogicException();
- }
-}
-```
-
-```java
-@Override
-public ResponseEntity> updateUser(UserDetailsRequestDto newUserDetails, int id)
- throws UserNotFoundException, UserServiceLogicException {
- try {
- User user = userRepository.findById(id).orElseThrow(() -> new UserNotFoundException("User not found with id " + id));
-
- user.setEmail(newUserDetails.getEmail());
- user.setUsername(newUserDetails.getUserName());
- user.setPhone(newUserDetails.getPhone());
-
- userRepository.save(user);
-
- return ResponseEntity
- .status(HttpStatus.OK)
- .body(new ApiResponseDto<>(ApiResponseStatus.SUCCESS.name(), "User account updated successfully!")
- );
-
- }catch(UserNotFoundException e){
- throw new UserNotFoundException(e.getMessage());
- }catch(Exception e) {
- log.error("Failed to update user account: " + e.getMessage());
- throw new UserServiceLogicException();
- }
- }
-```
-
-```java
-@Override
-public ResponseEntity> deleteUser(int id) throws UserServiceLogicException, UserNotFoundException {
- try {
- User user = userRepository.findById(id).orElseThrow(() -> new UserNotFoundException("User not found with id " + id));
-
- userRepository.delete(user);
-
- return ResponseEntity
- .status(HttpStatus.OK)
- .body(new ApiResponseDto<>(ApiResponseStatus.SUCCESS.name(), "User account deleted successfully!")
- );
- } catch (UserNotFoundException e) {
- throw new UserNotFoundException(e.getMessage());
- } catch (Exception e) {
- log.error("Failed to delete user account: " + e.getMessage());
- throw new UserServiceLogicException();
- }
-}
-```
-
-:::note
-- The `@Service` annotation is used to indicate that a class is a service component in the Spring application context.
-
-- The `@Component` annotation is a generic stereotype annotation used to indicate that a class is a Spring component. Components annotated with @Component are candidates for auto-detection when using Spring's component scanning feature.
-
-- The `@Autowired` annotation is used to automatically inject dependencies into Spring-managed beans. When Spring encounters a bean annotated with @Autowired, it looks for other beans in the application context that match the type of the dependency and injects it.
-
-- The `@Slf4j` annotation is not a standard Spring annotation but rather a Lombok annotation used for logging.
-:::
-
-## Step 8: Create controller
-
-- A controller class in a Spring Boot application is responsible for handling incoming HTTP requests and returning appropriate HTTP responses.
-
-- It serves as an entry point for processing client requests and often delegates the actual business logic to service classes.
-
-- A controller class is typically annotated with @RestController or @Controller.
-Inside the controller class, you define methods that handle specific HTTP requests. These methods are annotated with `@RequestMapping`, `@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, or other similar annotations to specify the HTTP method and the URL path that the method should respond to.
-
-- Each method in the controller class represents a particular endpoint of the REST API.
-
-- Controller classes often rely on service classes to perform business logic. Dependencies on these service classes are typically injected using the @Autowired annotation or constructor injection.
-
-- Controller methods return the response to the client. This can be done by returning a ResponseEntity object to have more control over the response status code, headers, and body.
-
-```java
-@RestController
-@RequestMapping("/users")
-public class UserController {
-
- @Autowired
- public UserService userService;
-
- @PostMapping("/new")
- public ResponseEntity> registerUser(@Valid @RequestBody UserDetailsRequestDto userDetailsRequestDto) throws UserAlreadyExistsException, UserServiceLogicException {
- return userService.registerUser(userDetailsRequestDto);
- }
-
- @GetMapping("/get/all")
- public ResponseEntity> getAllUsers() throws UserServiceLogicException {
- return userService.getAllUsers();
- }
-
- @PutMapping("/update/{id}")
- public ResponseEntity> updateUser(@Valid @RequestBody UserDetailsRequestDto userDetailsRequestDto, @PathVariable int id)
- throws UserNotFoundException, UserServiceLogicException {
- return userService.updateUser(userDetailsRequestDto, id);
- }
-
- @DeleteMapping("/delete/{id}")
- public ResponseEntity> deleteUser(@PathVariable int id)
- throws UserNotFoundException, UserServiceLogicException {
- return userService.deleteUser(id);
- }
-
-}
-```
-
-:::note
-
-- The `@PathVariable` annotation is used to extract values from the URI template of the incoming request. E.g., updateUser method.
-
-- The `@RequestParam` annotation is used to extract query parameters from the URL of the incoming request.
-
-- The `@RequestBody` annotation is used to extract the request body of the incoming HTTP request. It binds the body of the request to a method parameter in a controller method, typically for POST, PUT, and PATCH requests. E.g., registerUser method.
-:::
-
-## Step 9: Create Exception Handler class
-
-- Exception handlers in Spring Boot applications are used to handle exceptions thrown during the processing of HTTP requests.
-
-- They allow you to centralize error handling logic and provide custom responses to clients when errors occur.
-
-- `@RestControllerAdvice` annotation is used to indicate that the class contains advice that applies to all controllers. This advice will be applied globally to handle exceptions thrown from any controller in the application.
-
-- To create an exception handler, you annotate a method within a controller class with @ExceptionHandler and specify the type(s) of exceptions it can handle.
-
-```java
-// UserServiceExceptionHandler.java
-
-@RestControllerAdvice
-public class UserServiceExceptionHandler {
-
- @ExceptionHandler(value = UserNotFoundException.class)
- public ResponseEntity> UserNotFoundExceptionHandler(UserNotFoundException exception) {
- return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ApiResponseDto<>(ApiResponseStatus.FAIL.name(), exception.getMessage()));
- }
-
- @ExceptionHandler(value = UserAlreadyExistsException.class)
- public ResponseEntity> UserAlreadyExistsExceptionHandler(UserAlreadyExistsException exception) {
- return ResponseEntity.status(HttpStatus.CONFLICT).body(new ApiResponseDto<>(ApiResponseStatus.FAIL.name(), exception.getMessage()));
- }
-
- @ExceptionHandler(value = UserServiceLogicException.class)
- public ResponseEntity> UserServiceLogicExceptionHandler(UserServiceLogicException exception) {
- return ResponseEntity.badRequest().body(new ApiResponseDto<>(ApiResponseStatus.FAIL.name(), exception.getMessage()));
- }
-
- @ExceptionHandler(value = MethodArgumentNotValidException.class)
- public ResponseEntity> MethodArgumentNotValidExceptionHandler(MethodArgumentNotValidException exception) {
-
- List errorMessage = new ArrayList<>();
-
- exception.getBindingResult().getFieldErrors().forEach(error -> {
- errorMessage.add(error.getDefaultMessage());
- });
- return ResponseEntity.badRequest().body(new ApiResponseDto<>(ApiResponseStatus.FAIL.name(), errorMessage.toString()));
- }
-
-}
-```
-
-## Step 10: Run your application and test with postman/frontend😊.
-
-Register user failed: User details invalid!
-
-
-
-Register user successful
-
-
-
-
-Retrieve all users
-
-
-
-
-Update the details of John
-
-
-
-Delete user john
-
-
-
-Hey guys, that’s it. We have successfully developed rest crud API for a user management system.
diff --git a/blog/from-ftp-client-to-github-action.md b/blog/from-ftp-client-to-github-action.md
index 7f5fc45ef..5f099de58 100644
--- a/blog/from-ftp-client-to-github-action.md
+++ b/blog/from-ftp-client-to-github-action.md
@@ -1,6 +1,6 @@
---
title: "CI evolution: From FTP client to GitHub Action"
-author: Ajay Dhangar
+authors: [ajay-dhangar]
tags: [ftp, sftp, GitHub Action, ftp deploy]
date: 2024-03-15 11:37:46
decription: The evolution of remote file management
diff --git a/blog/sed-normalize-md-file-with-regex.md b/blog/sed-normalize-md-file-with-regex.md
index fbda35899..65cce2d6e 100644
--- a/blog/sed-normalize-md-file-with-regex.md
+++ b/blog/sed-normalize-md-file-with-regex.md
@@ -1,6 +1,6 @@
---
title: "Sed: Normalize markdown file with Regex"
-author: ajay-dhangar
+authors: [ajay-dhangar]
tags: [sed, regex, web clipper]
date: 2024-03-15 14:37:46
description: How to normalize markdown file with Regex
diff --git a/docs/WebSocket-for-realtime.md b/docs/WebSocket-for-realtime.md
deleted file mode 100644
index 411425783..000000000
--- a/docs/WebSocket-for-realtime.md
+++ /dev/null
@@ -1,136 +0,0 @@
----
-id: websockets-for-real-time-communication
-title: WebSockets for Real-Time Communication
-sidebar_label: Web Sockets
----
-
-## Introduction
-
-WebSockets are a powerful technology for enabling real-time communication between clients and servers...
-
-**Purpose:** WebSocket is a protocol that provides full-duplex communication channels over a single TCP connection. Unlike HTTP, WebSocket enables continuous two-way communication between the client and the server.
-
-**Connection:** WebSocket allows for long-lived connections that can send data both from the client to the server and vice versa. Once established, a WebSocket connection remains open until either the client or server decides to close it.
-
-**Usage:** WebSocket is particularly useful for real-time applications where low-latency communication is critical, such as online gaming, financial trading platforms, chat applications, live sport score updates, and collaborative editing tools.
-
-## Difference between HTTP & Websocket
-**Connection Nature:** HTTP is stateless and request-response based, while WebSocket provides full-duplex communication with a persistent connection.
-
-**Communication Overhead:** HTTP requests are heavier in terms of header information compared to WebSocket, which maintains a lightweight header after the initial handshake.
-
-**Usage Scenarios:** HTTP is suitable for scenarios where data exchange is initiated by the client in a request-response fashion (like fetching web pages or making API calls). WebSocket is ideal for applications requiring real-time, bi-directional communication with low latency.
-
-## WebSocket API
-
-The WebSocket API provides methods and events for establishing and managing WebSocket connections...
-
-## WebSocket Protocol
-
-Unlike HTTP, WebSockets provide full-duplex communication over a single, long-lived connection...
-
-## Implementing WebSockets
-
-### Using WebSocket in Node.js
-
-```javascript
-// Example Node.js WebSocket server
-// Example Node.js WebSocket server
-
-const WebSocket = require('ws');
-
-// Create a WebSocket server instance
-const wss = new WebSocket.Server({ port: 8080 });
-
-// WebSocket server listening event
-wss.on('listening', () => {
- console.log('WebSocket server is listening on port 8080');
-});
-
-// WebSocket connection event
-wss.on('connection', (ws) => {
- console.log('A new client connected');
-
- // Send a welcome message to the client
- ws.send('Welcome to the WebSocket server!');
-
- // WebSocket message event
- ws.on('message', (message) => {
- console.log(`Received message => ${message}`);
-
- // Broadcast the received message to all clients
- wss.clients.forEach((client) => {
- if (client.readyState === WebSocket.OPEN) {
- client.send(`Broadcast: ${message}`);
- }
- });
- });
-
- // WebSocket close event
- ws.on('close', () => {
- console.log('Client disconnected');
- });
-
- // WebSocket error event
- ws.on('error', (error) => {
- console.error(`WebSocket error: ${error}`);
- });
-});
-
-// Handle WebSocket server errors
-wss.on('error', (error) => {
- console.error(`WebSocket server error: ${error}`);
-});
-```
-
-Client-Side Example:
-To interact with this WebSocket server from a client, you would typically use JavaScript in a web browser:
-
-```html
-
-
-
-
- WebSocket Client
-
-
-
-
WebSocket Client
-
-
-
-
-```
-## When to Use HTTP/REST Instead:
-
-**Stateless Operations:** If your application involves primarily stateless operations (like retrieving data from a database or serving static resources), HTTP/REST is more appropriate.
-
-**Caching and Proxies:** HTTP has built-in support for caching and works seamlessly with proxies, making it suitable for content delivery networks (CDNs) and distributed systems.
-
-**Compatibility:** HTTP endpoints are easier to integrate with existing infrastructure and can be accessed from a wide range of clients (browsers, mobile apps, etc.).
-
-## Conclusion
-While HTTP/REST is excellent for many types of client-server interactions and resource fetching, WebSocket is indispensable for real-time applications and scenarios where low-latency, bidirectional communication is necessary. Choosing between them depends on the specific requirements and nature of your application.
diff --git a/docs/javascript/data-types/primitive-types/number.md b/docs/javascript/data-types/primitive-types/number.md
index e69de29bb..ed5bda720 100644
--- a/docs/javascript/data-types/primitive-types/number.md
+++ b/docs/javascript/data-types/primitive-types/number.md
@@ -0,0 +1,344 @@
+---
+id: number
+title: Numbers in JavaScript
+sidebar_label: Number
+sidebar_position: 3
+tags: [javascript, data type, primitive type, number]
+description: Learn about the number data type in JavaScript, how to create number values, and common operations with number values.
+---
+
+
+
+Numbers are a crucial part of any programming language, and JavaScript is no exception. In JavaScript, numbers are used to perform calculations, manipulate data, and handle various operations. This tutorial will walk you through everything you need to know about numbers in JavaScript, from basic concepts to advanced usage.
+
+## What Is a Number in JavaScript?
+
+In JavaScript, the `number` data type represents numeric values, including integers and floating-point numbers. Numbers in JavaScript are used to perform arithmetic operations, store numerical data, and represent quantities in various contexts.
+
+Here are some key points about numbers in JavaScript:
+
+- Numbers can be positive, negative, or zero.
+- Numbers can be integers (whole numbers) or floating-point numbers (numbers with decimal points).
+- JavaScript uses the `number` data type to represent all numeric values, regardless of whether they are integers or floating-point numbers.
+- Numbers in JavaScript are stored as 64-bit floating-point values using the [IEEE 754 standard](https://en.wikipedia.org/wiki/IEEE_754).
+- JavaScript provides built-in functions and operators for performing arithmetic operations, comparisons, and other operations with numbers.
+
+**Example:**
+
+```javascript title="app.js"
+let integerNumber = 42; // Integer number
+let floatingPointNumber = 3.14; // Floating-point number
+
+console.log(integerNumber); // Output: 42
+console.log(floatingPointNumber); // Output: 3.14
+```
+
+In the example above, `integerNumber` is an integer value (`42`), and `floatingPointNumber` is a floating-point value (`3.14`). Both values are stored as `number` data types in JavaScript.
+
+## Types of Numbers in JavaScript
+
+### 1. Integers
+
+Integers are whole numbers without any decimal points. In JavaScript, integers can be positive, negative, or zero. The `number` data type in JavaScript can represent integer values within a certain range.
+
+**Example:**
+
+```javascript title="app.js"
+let positiveInteger = 42; // Positive integer
+let negativeInteger = -10; // Negative integer
+let zero = 0; // Zero
+
+console.log(positiveInteger); // Output: 42
+console.log(negativeInteger); // Output: -10
+console.log(zero); // Output: 0
+```
+
+### 2. Floating-Point Numbers
+
+Floating-point numbers are numbers with decimal points. In JavaScript, floating-point numbers can represent fractional values, scientific notation, and other real numbers. The `number` data type in JavaScript can represent floating-point values with a certain precision.
+
+**Example:**
+
+```javascript title="app.js"
+let pi = 3.14159; // Pi (π) approximation
+
+console.log(pi); // Output: 3.14159
+```
+
+### 3. Scientific Notation
+
+JavaScript supports scientific notation for representing very large or very small numbers. Scientific notation uses the `e` character to denote the exponent of a number.
+
+**Example:**
+
+```javascript title="app.js"
+let largeNumber = 5e6; // 5 million, equivalent to 5 * 10^6
+let smallNumber = 5e-6; // 0.000005, equivalent to 5 * 10^-6
+
+console.log(largeNumber); // Outputs: 5000000
+console.log(smallNumber); // Outputs: 0.000005
+```
+
+In the examples above, `5e6` represents `5` multiplied by `10` raised to the power of `6` (i.e., `5,000,000`), and `5e-6` represents `5` multiplied by `10` raised to the power of `-6` (i.e., `0.000005`).
+
+## Number Precision
+
+JavaScript numbers are precise up to 15 digits. Beyond this, precision may be lost, and the results of calculations might not be what you expect.
+
+**Example:**
+
+```javascript title="app.js"
+let preciseNumber = 0.1 + 0.2;
+console.log(preciseNumber); // Outputs: 0.30000000000000004
+```
+
+In the example above, adding `0.1` and `0.2` results in `0.30000000000000004` due to the limited precision of JavaScript numbers.
+
+## Special Numeric Values
+
+JavaScript provides special numeric values to represent exceptional cases, such as `Infinity`, `-Infinity`, and `NaN` (Not-a-Number).
+
+### 1. Infinity
+
+The `Infinity` value represents positive infinity in JavaScript. It is used to denote a value that exceeds the upper limit of representable numbers.
+
+**Example:**
+
+```javascript title="app.js"
+let positiveInfinity = Infinity;
+
+console.log(positiveInfinity); // Output: Infinity
+console.log(positiveInfinity + 1); // Output: Infinity
+```
+
+### 2. -Infinity
+
+The `-Infinity` value represents negative infinity in JavaScript. It is used to denote a value that exceeds the lower limit of representable numbers.
+
+**Example:**
+
+```javascript title="app.js"
+let negativeInfinity = -Infinity;
+
+console.log(negativeInfinity); // Output: -Infinity
+console.log(negativeInfinity - 1); // Output: -Infinity
+```
+
+### 3. NaN (Not-a-Number)
+
+The `NaN` value represents a special "not-a-number" value in JavaScript. It is used to denote the result of an invalid mathematical operation, such as dividing zero by zero.
+
+**Example:**
+
+```javascript title="app.js"
+let notANumber = NaN;
+
+console.log(notANumber); // Output: NaN
+console.log(0 / 0); // Output: NaN
+```
+
+## Number Methods
+
+JavaScript provides built-in methods for working with numbers. These methods can be used to perform various operations, such as rounding numbers, converting numbers to strings, and generating random numbers.
+
+Here are some common number methods in JavaScript:
+
+### 1. `toFixed()`
+
+The `toFixed()` method formats a number using fixed-point notation with a specified number of decimal places.
+
+**Example:**
+
+```javascript title="app.js"
+let number = 3.14159;
+let formattedNumber = number.toFixed(2);
+
+console.log(formattedNumber); // Output: 3.14
+```
+
+### 2. `toString()`
+
+The `toString()` method converts a number to a string representation.
+
+**Example:**
+
+```javascript title="app.js"
+let number = 42;
+
+console.log(number.toString()); // Output: "42"
+```
+
+### 3. `parseInt()`
+
+The `parseInt()` function parses a string and returns an integer.
+
+**Example:**
+
+```javascript title="app.js"
+let number = parseInt("42");
+
+console.log(number); // Output: 42
+```
+
+### 4. `parseFloat()`
+
+The `parseFloat()` function parses a string and returns a floating-point number.
+
+**Example:**
+
+```javascript title="app.js"
+let number = parseFloat("3.14");
+
+console.log(number); // Output: 3.14
+```
+
+### 5. `Math.random()`
+
+The `Math.random()` function generates a random floating-point number between 0 (inclusive) and 1 (exclusive).
+
+**Example:**
+
+```javascript title="app.js"
+let randomNumber = Math.random();
+
+console.log(randomNumber); // Output: A random number between 0 and 1
+```
+
+### 6. `toPrecision()`
+
+The `toPrecision()` method formats a number to a specified precision.
+
+**Example:**
+
+```javascript title="app.js"
+let number = 123.456;
+
+console.log(number.toPrecision(2)); // Output: 1.2e+2
+```
+
+### 7. `isNaN()`
+
+The `isNaN()` function checks if a value is `NaN` (Not-a-Number).
+
+**Example:**
+
+```javascript title="app.js"
+console.log(isNaN(123)); // Outputs: false
+console.log(isNaN("abc")); // Outputs: true
+```
+
+### 8. `isFinite()`
+
+The `isFinite()` function checks if a value is a finite number.
+
+**Example:**
+
+```javascript title="app.js"
+console.log(isFinite(42)); // Outputs: true
+console.log(isFinite(Infinity)); // Outputs: false
+```
+
+### 9. `Number()`
+
+The `Number()` function converts a value to a number.
+
+**Example:**
+
+```javascript title="app.js"
+let str = "123";
+let num = Number(str);
+
+console.log(num); // Outputs: 123
+```
+
+## Common Arithmetic Operations with Numbers
+
+JavaScript provides arithmetic operators for performing basic arithmetic operations with numbers. Here are some common arithmetic operations you can perform with numbers in JavaScript:
+
+### 1. Addition (`+`)
+
+The addition operator (`+`) is used to add two numbers together.
+
+**Example:**
+
+```javascript title="app.js"
+let num1 = 10;
+let num2 = 20;
+let sum = num1 + num2;
+
+console.log(sum); // Output: 30
+```
+
+### 2. Subtraction (`-`)
+
+The subtraction operator (`-`) is used to subtract one number from another.
+
+**Example:**
+
+```javascript title="app.js"
+let num1 = 20;
+let num2 = 10;
+let difference = num1 - num2;
+
+console.log(difference); // Output: 10
+```
+
+### 3. Multiplication (`*`)
+
+The multiplication operator (`*`) is used to multiply two numbers.
+
+**Example:**
+
+```javascript title="app.js"
+let num1 = 5;
+let num2 = 6;
+let product = num1 * num2;
+
+console.log(product); // Output: 30
+```
+
+### 4. Division (`/`)
+
+The division operator (`/`) is used to divide one number by another.
+
+**Example:**
+
+```javascript title="app.js"
+let num1 = 20;
+let num2 = 5;
+let quotient = num1 / num2;
+
+console.log(quotient); // Output: 4
+```
+
+### 5. Modulus (`%`)
+
+The modulus operator (`%`) is used to find the remainder of the division of two numbers.
+
+**Example:**
+
+```javascript title="app.js"
+let num1 = 10;
+let num2 = 3;
+let remainder = num1 % num2;
+
+console.log(remainder); // Output: 1
+```
+
+### 6. Exponentiation (`**`)
+
+The exponentiation operator (`**`) is used to raise one number to the power of another.
+
+**Example:**
+
+```javascript title="app.js"
+let base = 2;
+let exponent = 3;
+let result = base ** exponent;
+
+console.log(result); // Output: 8
+```
+
+## Conclusion
+
+Numbers are an essential part of JavaScript programming, used for calculations, data manipulation, and various operations. In this tutorial, you learned about the `number` data type in JavaScript, different types of numbers, special numeric values, number precision, number methods, and arithmetic operations with numbers. Understanding numbers in JavaScript will help you work with numeric data effectively and efficiently in your JavaScript applications.
diff --git a/src/components/AdsComponent/index.tsx b/src/components/AdsComponent/index.tsx
index a13256669..6d077663f 100644
--- a/src/components/AdsComponent/index.tsx
+++ b/src/components/AdsComponent/index.tsx
@@ -1,21 +1,33 @@
-import React from "react";
+import React, { useEffect } from "react";
import Head from "@docusaurus/Head";
const AdsComponent = () => {
+ useEffect(() => {
+ try {
+ (window.adsbygoogle = window.adsbygoogle || []).push({});
+ }
+ catch (err) {
+ console.error(err);
+ }
+ }, []);
return (
-
-
-
-
-
+ <>
+
+
+
+
+ >
);
};
diff --git a/src/database/blogs/index.tsx b/src/database/blogs/index.tsx
index 30315267a..d1cc9e94e 100644
--- a/src/database/blogs/index.tsx
+++ b/src/database/blogs/index.tsx
@@ -9,14 +9,6 @@ interface Blog {
const blogs: Blog[] = [
{
id: 1,
- title: "Building RESTful CRUD API in springboot",
- image: "img/blogs/image01.png",
- description:
- " RESTful APIs have become a cornerstone for building scalable, efficient, and maintainable web applications.",
- slug: "Building RESTful CRUD API in springboot",
- },
- {
- id: 2,
title: "Getting started with Microservices",
image: "/assets/images/image01-736d71e3db56657987594b3b11459b5d.png",
description:
@@ -24,7 +16,7 @@ const blogs: Blog[] = [
slug: "getting-started-with-microservices",
},
{
- id: 3,
+ id: 2,
title: "Cryptography and Its Use in Cyber Security",
image: "/img/blogs/introduction-to-cryptography-and-cyber-security.jpg",
description:
@@ -32,7 +24,7 @@ const blogs: Blog[] = [
slug: "introduction-to-cryptography-and-cyber-security",
},
{
- id: 4,
+ id: 3,
title: "Getting started with Mern",
image: "/img/blogs/mern.jpg",
description:
@@ -40,7 +32,7 @@ const blogs: Blog[] = [
slug: "getting-started-with-mern",
},
{
- id: 5,
+ id: 4,
title: "Getting started with Vite",
image: "/img/blogs/react-and-vite.jpg",
description:
@@ -48,7 +40,7 @@ const blogs: Blog[] = [
slug: "getting-started-with-vite",
},
{
- id: 6,
+ id: 5,
title: "Dockerizing a Rust application with Multi-Stage Builds",
image: "/img/blogs/rust-docker.png",
description:
@@ -56,7 +48,7 @@ const blogs: Blog[] = [
slug: "dockerizing-a-rust-application-with-multi-stage-builds",
},
{
- id: 7,
+ id: 6,
title: "Git Best Practices: Commit Often, Perfect Later, Publish Once",
image: "/img/svg/coding.svg",
description:
@@ -64,7 +56,7 @@ const blogs: Blog[] = [
slug: "git-best-practicies",
},
{
- id: 8,
+ id: 7,
title: "Mastering Data Structures in Python",
image: "/img/svg/programming.svg",
description:
@@ -72,7 +64,7 @@ const blogs: Blog[] = [
slug: "Mastering Data Structures in Python",
},
{
- id: 9,
+ id: 8,
title: "Automating Tasks with Python",
image: "/img/svg/progress.svg",
description:
@@ -80,7 +72,7 @@ const blogs: Blog[] = [
slug: "automating-tasks-with-python",
},
{
- id: 10,
+ id: 9,
title: "A Beginner’s Guide to the Top 5 React Hooks",
image: "/img/svg/react.svg",
description:
@@ -88,7 +80,7 @@ const blogs: Blog[] = [
slug: "Beginner’s Guide to the Top 5 React Hooks",
},
{
- id: 11,
+ id: 10,
title: "DOM manipulation in JavaScript",
image: "/img/svg/javascript_frameworks.svg",
description:
@@ -96,7 +88,7 @@ const blogs: Blog[] = [
slug: "DOM manipulation in JavaScript",
},
{
- id: 12,
+ id: 11,
title: "CI evolution: From FTP client to GitHub Action",
image: "/img/svg/dev_productivity.svg",
description:
@@ -104,7 +96,7 @@ const blogs: Blog[] = [
slug: "from-ftp-client-to-github-action",
},
{
- id: 13,
+ id: 12,
title: "Getting Started with PostgreSQL",
image: "/img/svg/educator.svg",
description:
@@ -112,7 +104,7 @@ const blogs: Blog[] = [
slug: "Getting started with PostgreSQL",
},
{
- id: 14,
+ id: 13,
title: "Getting Started with NextJS",
image: "/img/svg/next_js.svg",
description:
@@ -120,7 +112,7 @@ const blogs: Blog[] = [
slug: "Getting-started-with-nextJS",
},
{
- id: 15,
+ id: 14,
title: "Comprehensive Documentation on Linux Development and Cybersecurity",
image: "/img/svg/developer_activity.svg",
description:
diff --git a/static/img/blogs/image01.png b/static/img/blogs/image01.png
deleted file mode 100644
index 7f0770caf..000000000
Binary files a/static/img/blogs/image01.png and /dev/null differ