突突唧之家

我的疑问 & 我的解决方案

1
2
3
4
5
6
7
8
9
10
11
cmake_minimum_required(VERSION 3.17)
project(MPITest)

find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_COMPILER mpicxx)
set(CMAKE_C_COMPILER mpicc)

add_executable(${PROJECT_NAME} main.cpp)

Windows will keep a history of the items you have searched over time. So, each time you type in a search query, you will see a list of recently searched items. You might want to clear this from time to time, especially if you're on a shared PC or if you just want a fresh start. We already showed you how to turn off autocomplete in File Explorer. For even more control over file navigation, here is a look at how to clear recent File Explorer search history or disable it altogether.

阅读全文 »

The following is a step-by-step process as to how you can use wireless internet without taking out your ethernet cable out.

  1. Open Network and Sharing Centre ("Network Status" in Windows 10).
  2. Go to "Change Adapter Settings" ("Change adapter options" in Windows 10).
  3. Go to properties of Local Area Network.
  4. Click on Internet Protocol version 4 and go to its properties.
  5. Click on Advanced. You will see a block checked there by the name of "Automatic Metric".
  6. Uncheck it and then enter 2 in that section.
  7. Now, Do the same for the wireless network but enter 1.

Save the setting, and you'll be able to use Wi-Fi even when your ethernet cable is connected to the LAN.

"Automatic metric" works by prioritizing the connection with the highest link speed. Manually changing the setting means you can specify which connection you want to give priority to. See "An explanation of the Automatic Metric feature for IPv4 routes".

In Chrome & Firefox (+31) you can add CSS in console.log messages:

console.log('%cHello, world!', 'background: red; color: green')

The same can be applied for adding multiple CSS to a command:

console.log('%c<str1> %c<str2>', '<css-for-str1>', '<css-for-str2>')

Chrome Console API Reference: Console API Reference.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}

async function demo() {
console.log('Taking a break...')
await sleep(2000)
console.log('Two seconds later, showing sleep in a loop...')

// Sleep in loop
for (let i = 0; i < 5; i++) {
if (i === 3)
await sleep(2000)
console.log(i)
}
}

demo()

This is it. await sleep(<duration>).

Or as a one-liner:

await new Promise(r => setTimeout(r, 2000))

Note

await can only be executed in functions prefixed with the async keyword, or at the top level of your script in some environments (e.g., the Chrome DevTools console, or Runkit).

await only pauses the current async function

Two new JavaScript features helped write this "sleep" function:

When working with Git, you might encounter a situation where you need to edit a commit message. There are many reasons you would want to make the change, such as fixing a typo, removing sensitive information, or adding additional information.

This guide explains how to change the message of the most recent or older Git commits.

阅读全文 »

引用自:#1963 (comment)

以管理员身份启动 PowerShell 后运行下列命令:

foreach($f in Get-ChildItem $env:LOCALAPPDATA\Packages) {CheckNetIsolation.exe LoopbackExempt -a "-n=$($f.Name)"}

如果只需要少量应用:

CheckNetIsolation.exe LoopbackExempt –a –n=<App Directory>

<App Directory> 替换成出现在 %LOCALAPPDATA%\Packages 目录中的应用目录名即可。

Introduction

In this quick article we'll focus on packaging a Maven project into an executable Jar file.

Usually, when creating a jar file, we want to execute it easily, without using the IDE. To that end, we'll discuss the configuration and pros/cons of using each of these approaches for creating the executable.

Configuration

In order to create an executable jar, we don't need any additional dependencies. We just need to create Maven Java project, and have at least one class with the main method.

In our example, we created Java class named ExecutableMavenJar.

We also need to make sure that our pom.xml contains the following elements:

<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>core-java</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>

The most important aspect here is the type – to create an executable jar, double-check the configuration uses a jar type.

Now we can start using the various solutions.

阅读全文 »

Most of the answers you'll find around the internet will suggest you to either install the dependency to your local repository or specify a "system" scope in the pom and distribute the dependency with the source of your project. But both of these solutions are actually flawed.

Why you shouldn't apply the "Install to Local Repo" approach

When you install a dependency to your local repository it remains there. Your distribution artifact will do fine as long as it has access to this repository. The problem is in most cases this repository will reside on your local machine, so there'll be no way to resolve this dependency on any other machine. Clearly making your artifact depend on a specific machine is not a way to handle things. Otherwise this dependency will have to be locally installed on every machine working with that project which is not any better.

Why you shouldn't apply the "System Scope" approach

The jars you depend on with the "System Scope" approach neither get installed to any repository or attached to your target packages. That's why your distribution package won't have a way to resolve that dependency when used. That I believe was the reason why the use of system scope even got deprecated. Anyway you don't want to rely on a deprecated feature.

阅读全文 »