Other
Miscellaneous notes that don't fit elsewhere.
Google AdSense
In a localhost development environment, this error is normal:
Failed to load resource: the server responded with a status of 403 ()
JavaScript
Double negation (!!)
!! coerces a value to a boolean:
!!null // false
!!undefined // false
!!{} // true
!![] // true
React
# Check the React version
npm view react version
npm
npm update --save $Package_Name
npm up $Package_Name@latest
Gradle
Source folder inside lib in an Eclipse Gradle project
The New Gradle Project dialog invokes the Gradle init task with the hard-coded
argument --type java-library, and the project layout differs for Gradle
versions above 6.6.1. Using gradle init, remove the include in
settings.gradle and move everything from src to the root path.
Could not run phased build action
Delete C:\Users\$USER\.gradle.
Ignore JUnit 4 in Gradle and Maven
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
Track down which dependency pulls it in:
./gradlew dependencyInsight --dependency "junit:junit" --configuration "testCompileClasspath"
Or exclude it in one place:
/* for all the configurations */
configurations {
all {
/* only junit 5 should be used */
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
/* for particular test configurations */
configurations {
testCompile {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testRuntime {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
Windows
Taskbar locked at double height after upgrading from Windows 10
Reset the taskbar config:
reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\IrisService /f && shutdown -r -t 0
VS Code
CMake settings:
"cmake.cmakePath": "C:\\tc\\cmake-3.24.3-windows-x86_64\\bin\\cmake.exe",
"cmake.generator": "MinGW Makefiles",
"cmake.mingwSearchDirs": [
"${env:SystemDrive}\\tc\\mingw64\\bin"
]
Debugging error: AttributeError: module '__main__' has no attribute 'xxx'.
Tailwind CSS
Setting up Tailwind on Windows with VS Code (win-node-env may already be
installed):
npm install -g win-node-env
"build:tailwind-dev": "npx tailwind -i src/style.css -o dist/css/style.css --watch",
"build:tailwind-prod": "NODE_ENV=production postcss src/style.css -o dist/css/style.min.css"
MUI
AppBar -> display: flex, flex-direction: column
Toolbar -> display: flex, flex-direction: row
Button -> display: inline-block
Eclipse
Set the code-template language to English in eclipse.ini:
-Duser.language=en_US
Rename a project
Right click project -> Refactor -> Rename project
pom.xml -> <artifactId> and <finalName>
Web project: Right click project -> Properties -> Web Project Settings -> Context root
Right click project -> Maven -> Update Project -> Force Update of Snapshots/Releases -> OK