Visual Studio Code Run task on save
In Visual Studio Code, you can configure tasks to run automatically when you save a file using the tasks.json file.
Here is a step-by-step guide for configuring tasks to run on save:
Method 1: Using plugin Trigger Task on Save
You can use the Trigger Task on Save extension.
Configure plugin settings
To set it up, add the following to your .vscode/settings.json:
{
"task.saveBeforeRun":"always",
// task name to run on save action
"triggerTaskOnSave.selectedTask& ...
Boostrap 5 Color Theme Switcher
How to create Color Mode Switch for Bootstrap 5
Bootstrap 5 does not come with a built-in theme switcher but you can easily implement one using Use JavaScript and CSS.
Here’s a simple example of how you can create a Bootstrap 5 color theme selector:
Includes Bootstrap CSS from CDN.
Add an empty <style/> tag with attribute data-bs-theme="light|dark" where you will automatically insert the CSS of the selected theme.
Create a toggle switch using the Bootstrap form toggle component. ...
Include livereload in spring boot web
LiveReload is a tool that automatically reloads your web application whenever you alter the source code or static resources. To integrate LiveReload into a Spring Boot web application, follow these steps:
Add LiveReload Server as a Dependency
Add the LiveReload server as a dependency to your project. If you use Maven, you can include the following dependencies in your pom.xml file:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-de ...
spring Content-Type application/x-www-form-urlencoded;charset=UTF-8 is not supported
Usually, the message “Content-Type ‘application/x-www-form-urlencoded;charset=UTF-8’ is not supported” suggests that there is a problem with the content type that was given in the request header. This issue frequently happens while using an API or web application. The errors log like sample below:
21-06-10 15:32:10.363 ERROR [-nio-8080-exec-8] c.e.pay.common.ResponseErrorHandler :50 - Base Exception caughtorg.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/ ...
How to create dynamic toast with flowbite-react
In this article you will learn of How to create toast with flowbite-react dynamically, see below screenshoots.
Below is an example of how you can create a dynamic toast component in React using flowbite-react.
Create flowbite toast element
save below codes with filename FlowbiteToast.tsx in folder src/component
import { Toast } from 'flowbite-react';
import React from 'react';
import { HiFire } from 'react-icons/hi';
interface FlowbiteToastPro ...
Exported variable has or is using name from external module
In TypeScript, when you have an exported variable that uses a private type from an external module, you may run into issues because private types are not accessible outside of their module.
answers for exported variable that uses a private type from an external module:
Exported variable ‘yourVariable’ has or is using name ‘TypeName’ from external module “module/path” but cannot be named. ts(4023)
TS4023: Exported Variable has or is using name from external module but cannot be named
Exported ...
Enable CORS globally in spring boot
To enable Cross-Origin Resource Sharing (CORS) globally in a Spring Boot application with Spring Security,
you can configure CORS in your security configuration class.
Here’s an example of codes how you can do this:
import java.util.List;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.Aut ...
How to render single post hexo
According my discussion on github I solved how to render single post markdown using HexoJS.
Render existing loaded post
Basically render a single post you need load database, like below:
const hexo = require('hexo')();
// Replace 'my-first-post' with the actual filename of your post (without the file extension).
const postToRender = 'my-first-post';
// Initialize Hexo
hexo.init().then(() => {
// Load the Hexo database
return hexo.load();
}).then(( ...
spring boot with eclipse gradle plugin
Spring Boot DevTools provides a set of tools that can help improve the development experience. One of the features is automatic class reloading, which can be particularly useful during development. Eclipse, on the other hand, has its own set of tools for Java development. To sync compiled classes from the Eclipse Gradle plugin with Spring Boot DevTools, you can follow these general steps:
Ensure Spring Boot DevTools is Configured
Make sure that the spring-boot-devtools dependency is included in ...
auto configure classpath config using eclipse gradle plugin
according this issue about automatically configuring classpath and build settings for an Eclipse project that uses the Gradle build tool. Configuring classpath and build settings in Eclipse for a Gradle project involves a few steps. Here is a framework for auto-configuring the classpath using the Eclipse Gradle plugin:
Install Eclipse Gradle Plugin
activate eclipse plugin each gradle subprojects
Using plugins block
plugins {
id "eclipse"
}
Using native classpath
apply plugi ...