突突唧之家

我的疑问 & 我的解决方案

Open terminal and edit /etc/mysql/mysql.conf.d/mysqld.cnf. Underneath the [mysqld] section, add:

lower_case_table_names = 1

Restart MySQL:

sudo service mysql restart

Then check it here:

mysqladmin -u root -p variables

If you have any local changes, they will be lost. With or without --hard option, any local commits that haven't been pushed will be lost. If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected.

First, run a fetch to update all origin/<branch> refs to latest:

git fetch --all

Then, reset the current branch:

git reset --hard origin/<branch>

Explanation

git fetch downloads the latest from remote without trying to merge or rebase anything.

Then the git reset resets the master branch to what you just fetched. The --hard option changes all the files in your working tree to match the files in origin/<branch>.

Uncommitted Changes

Uncommitted changes, however (even staged), will be lost. Make sure to stash and commit anything you need. For that you can run the following:

git stash

Then to reapply these uncommitted changes:

git stash pop

Try to put reference immediately below picture like this:

\begin{frame}
\includegraphics[width=\linewidth]{example-image}\\[-1ex]
{\tiny Source: \cite{foo12}}
\end{frame}

Use find.

To see exactly which files you will remove:

find . -name "*.bak" -type f

To count the number of files:

find . -name "*.bak" -type f | wc -l

To delete these files:

find . -name "*.bak" -type f -delete

Make sure that -delete is the last argument in your command. If you put it before the -name "*.bak" argument, it will delete everything.

Position Independent Code means that the generated machine code is not dependent on being located at a specific address in order to work.

E.g., jumps would be generated as relative rather than absolute.

Pseudo-assembly:

  • PIC: This would work whether the code was at address 100 or 1000

    100: COMPARE REG1, REG2
    101: JUMP_IF_EQUAL CURRENT+10
    ...
    111: NOP
  • Non-PIC: This will only work if the code is at address 100

    100: COMPARE REG1, REG2
    101: JUMP_IF_EQUAL 111
    ...
    111: NOP

If your code is compiled with -fPIC, it's suitable for inclusion in a library. The library must be able to be relocated from its preferred location in memory to another address, there could be another already loaded library at the address your library prefers.

When building a binary or library, specifying the rpath, i.e.

-Wl,-rpath,<path/to/lib>

tells the linker where to find the required library at runtime.

In the case of rpath, it makes no sense to use a relative path, since a relative path will be relative to the current working directory, NOT relative to the directory where the binary/library was found. So it simply won't work for executables found in $PATH or libraries in pretty much any case.

Instead, you can use the $ORIGIN "special" path to have a path relative to the executable with -Wl,-rpath,'$ORIGIN'. Note that you need quotes around it to avoid having the shell interpret it as a variable, and if you try to do this in a Makefile, you need $$ to avoid having make interpret the $ as well.

You normally want to pass two arguments to the linker (-rpath and the actual path argument), thus the comma between them. GNU ld will accept it as either two arguments or a single argument with an =, so either can work. Other linkers, e.g., Solaris, only accept it as two arguments.

Use the set -e builtin:

#!/bin/bash

set -e
# Any subsequent(*) commands which fail will cause the shell script to exit immediately

Alternatively, you can pass -e on the command line:

bash -e my_script.sh

You can also disable this behavior with set +e.

You may also want to employ all or some of the the -e -u -x and -o pipefail options like so:

set -euxo pipefail

-e exits on error, -u errors on undefined variables, and -o (for option) pipefail exits on command pipe failures.

The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test following the if or elif reserved words, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command's return value is being inverted with !.

Try mkdir -p:

mkdir -p foo

Note that this will also create any intermediate directories that don't exist; for instance,

mkdir -p foo/bar/baz

will create directories foo, foo/bar, and foo/bar/baz if they don't exist.

Some implementation like GNU mkdir include mkdir --parents as a more readable alias, but this is not specified in POSIX/Single Unix Specification. It is also not available on many common platforms like macOS, various BSDs, and various commercial Unixes, so it should be avoided.

According to MPI_AllReduce man page and MPI doc MPI_IN_PLACE can be used to specify the same buffer for sendbuf and recvbuf as long as you are working inside the same group.

The call would look like:

// Some operations to calculate `rho` for each process.
double rho[1024] = ...;

MPI_Allreduce(MPI_IN_PLACE, rho, 1024, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);