run `nvm use` automatically every time there's a .nvmrc file on the directory

Question: How to configure my shell so that nvm use run automatically every time there's a .nvmrc file on the directory and use the latest version or a global config when there's no .nvmrc file?
Comment: This use case is now documented in the **official nvm documentation** under [**Deep Shell Integration**](https://github.com/creationix/nvm#deeper-shell-integration). You can also see [my answer](https://stackoverflow.com/a/51349399/3966682) for the `bash` shell.
Comment: not an answer to the question asked, but a (better) solve for the problem: use https://asdf-vm.com/ instead of nvm. Don't forget [configuring](https://github.com/asdf-vm/asdf-nodejs/blob/master/README.md#configuration) `legacy_version_file = yes` and `ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY`
Answer: If you use zsh (z shell):

Calling 'nvm use' automatically in a directory with a .nvmrc file
Put this into your $HOME/.zshrc to call nvm use automatically whenever you enter a directory that contains an .nvmrc file with a string telling nvm which node to use:

# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

More info: https://github.com/creationix/nvm#zsh
Comment: This worked really well for me, but caused a performance hit to `cd`, since it runs every time you change directories. I added `[[ -a .nvmrc ]] || return` to the first line of load-nvmrc(), and that significantly improved the performance of it
Comment: @Belgabad It's more performant, because with your line the script won't check for `.nvmrc` in parent directories and it also won't go back to the default `node` version when you `cd` out of the project dir.
Comment: If you're using `Powerlevel10k` don't forget to add `--silent` after `nvm use` to avoid console output warnings during zsh initialization
Comment: it'd have been nice to have it check the version again when I checkout different branches in git on the same directory
Comment: @Belgabad where are you adding that line? before the `local` lines?
Comment: Anyone else get the follow output every time nvm use is executed? `sed: 8: "
            s#/Users/j ...": unterminated regular expression`
Answer: If you use bash you can add this to your ~/.bashrc file:
_nvmrc_hook() {
  if [[ $PWD == $PREV_PWD ]]; then
    return
  fi

  PREV_PWD=$PWD
  [[ -f ".nvmrc" ]] && nvm use
}

if ! [[ "${PROMPT_COMMAND:-}" =~ _nvmrc_hook ]]; then
  PROMPT_COMMAND="_nvmrc_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
fi

Comment: This broke direnv for me.
Comment: This is my preferred method. Thanks a ton for posting this!
Comment: @JohnOpincar I think because it blew away the old `$PROMPT_COMMAND`. Try this for the last line instead: `export PROMPT_COMMAND="$PROMPT_COMMAND; enter_directory"`
Comment: I suggested an edit based on direnv code that doesn't overwrite previous `PROMPT_COMMAND`
Answer: Excellent answer from @devius.
I just extended it so it can revert to the default version when leaving a directory with .nvmrc to another without it.
~/.bashrc:
#
# Run 'nvm use' automatically every time there's
# a .nvmrc file in the directory. Also, revert to default
# version when entering a directory without .nvmrc
#
enter_directory() {
if [[ $PWD == $PREV_PWD ]]; then
    return
fi

PREV_PWD=$PWD
if [[ -f ".nvmrc" ]]; then
    nvm use
    NVM_DIRTY=true
elif [[ $NVM_DIRTY = true ]]; then
    nvm use default
    NVM_DIRTY=false
fi
}

export PROMPT_COMMAND="$PROMPT_COMMAND; enter_directory"

Following @doug-barbieri's suggestion, the script below will not change node back to the default version if there's no .nvmrc file in the current directory but there is one in the parent sub-directory.
~/.bashrc:
enter_directory() {
  if [[ $PWD == $PREV_PWD ]]; then
    return
  fi

  if [[ "$PWD" =~ "$PREV_PWD" && ! -f ".nvmrc" ]]; then
    return
  fi

  PREV_PWD=$PWD
  if [[ -f ".nvmrc" ]]; then
    nvm use
    NVM_DIRTY=true
  elif [[ $NVM_DIRTY = true ]]; then
    nvm use default
    NVM_DIRTY=false
  fi
}

The trick is here:
if [[ "$PWD" =~ "$PREV_PWD" && ! -f ".nvmrc" ]]; then
  return
fi

It checks if the PWD contains PREV_PWD. For example, if /home/user1/a/b contains /home/user1/a.

This can be extended to work with Starship (even on Git Bash for Windows not WSL) as well using the starship_precmd_user_func
set_win_title() {
  BASEPWD=$(basename "$PWD")
  echo -ne "\033]0;  $BASEPWD \a" < /dev/null
  if [[ $PWD == $PREV_PWD ]]; then
    return
  fi

  if [[ "$PWD" =~ "$PREV_PWD" && ! -f ".nvmrc" ]]; then
    return
  fi

  PREV_PWD=$PWD
  if [[ -f ".nvmrc" ]]; then
    nvm use
    NVM_DIRTY=true
  elif [[ $NVM_DIRTY = true ]]; then
    nvm use default
    NVM_DIRTY=false
  fi
}
starship_precmd_user_func="set_win_title"
eval "$(starship init bash)"

Comment: Fixed by using `VERSION=$(cat .nvmrc); nvm use $VERSION`
Comment: This doesn't work for me because if I happen to change to a sub-directory of the current project, it reverts to the default. So the detection needs to be a little smarter, looking up the directory tree for the first instance of `.nvmrc`.
Comment: Using bash on windows this returns `node v.0.0 (64-bit) is not installed.` even though the .nvmrc file has `9.3`.
Comment: I should also say that's using nvm-for-windows which is an entirely different beast. But with the above script + modification it works a treat. +1
Comment: Instead of `export PROMPT_COMMAND=enter_directory` I think it should be `export PROMPT_COMMAND="$PROMPT_COMMAND; enter_directory"` to prevent clobbering the variable if it is set.
Comment: Also, if you move `PREV_PWD=$PWD` to the end of the function, you can change the second condition to `elif [[ $NVM_DIRTY = true ]] || [[ -z $PREV_PWD ]]; then` and then it will invoke `nvm use` when first starting a new terminal session before doing `cd`.
Comment: I had problems with the semicolor in `export PROMPT_COMMAND="$PROMPT_COMMAND; enter_directory"` and used `export PROMPT_COMMAND="$PROMPT_COMMAND; enter_directory"` instead. It works for me
Answer: I just found out about Automatic Version Switching for Node.js https://github.com/wbyoung/avn, you can use that.
npm install -g avn avn-nvm avn-n
avn setup

You can also follow this thread
https://github.com/creationix/nvm/issues/110
Comment: This is depressing.. is there no limit to the tool stack depth? node → npm → nvm → avn, and back up. *sigh* I'll play ball, but my passion is waning with each hack. (and thanks for the link, of course, gabo.)
Comment: Unfortunately, [avn is no longer maintained](https://github.com/wbyoung/avn/issues/109), and @hraban objection is valid - also, `nvm` doesn't depend on `npm/node` by design, so throwing in another tool that requires `node` seems unwise. IMO direnv, per [R. Haluk Öngör's answer](https://stackoverflow.com/a/62095070/9238801) is the best way. direnv is shell agnostic, with few dependencies (and more importantly, doesn't depend on the tools it's supposed to manage) and is much more general while still usable and safe.
Comment: None of the comments at the mentioned thread worked with bash for me. Maybe they're all for MacOS. For something that works in Ubuntu check my answer below.
Answer: This answer is taken from the official nvm documentation.
Put the following at the end of your $HOME/.bashrc:
find-up () {
    path=$(pwd)
    while [[ "$path" != "" && ! -e "$path/$1" ]]; do
        path=${path%/*}
    done
    echo "$path"
}

cdnvm(){
    cd "$@";
    nvm_path=$(find-up .nvmrc | tr -d '[:space:]')

    # If there are no .nvmrc file, use the default nvm version
    if [[ ! $nvm_path = *[^[:space:]]* ]]; then

        declare default_version;
        default_version=$(nvm version default);

        # If there is no default version, set it to `node`
        # This will use the latest version on your machine
        if [[ $default_version == "N/A" ]]; then
            nvm alias default node;
            default_version=$(nvm version default);
        fi

        # If the current version is not the default version, set it to use the default version
        if [[ $(nvm current) != "$default_version" ]]; then
            nvm use default;
        fi

        elif [[ -s $nvm_path/.nvmrc && -r $nvm_path/.nvmrc ]]; then
        declare nvm_version
        nvm_version=$(<"$nvm_path"/.nvmrc)

        # Add the `v` suffix if it does not exists in the .nvmrc file
        if [[ $nvm_version != v* ]]; then
            nvm_version="v""$nvm_version"
        fi

        # If it is not already installed, install it
        if [[ $(nvm ls "$nvm_version" | tr -d '[:space:]') == "N/A" ]]; then
            nvm install "$nvm_version";
        fi

        if [[ $(nvm current) != "$nvm_version" ]]; then
            nvm use "$nvm_version";
        fi
    fi
}
alias cd='cdnvm'

This is an improvement over:

@Gabo Esquivel's answer - because you won't have to switch to another tool (avn)
@devius's and @Adriano P's answers - which do not deal with situations where you are within a project

This alias would search 'up' from your current directory in order to detect a .nvmrc file. If it finds it, it will switch to that version; if not, it will use the default version.
Comment: Note that the code from the official nvm documentation has been further updated. The problem with it is it is not compatible with `autojump`. So I think it is preferable to use the `PROMPT_COMMAND` approach above for that aspect. Here's what I mean: https://weston.ruter.net/2022/05/19/auto-nvm-use/
Comment: Appears a little slow but I really like this option
Comment: @BossmanT By 'appears a little slow', do you mean you would guess it's slow from looking at what it does, or you actually found it slow to run?
Comment: @callum only from observing it running in my bash environment, no time trials were ran for it however, its about a fraction of a second slower, not anything significant of course
Comment: I couldn't detect any lag. Running `cd` isn't something you're ever likely to do in large batches, so I don't think it matters unless the lag is noticeable to a human.
Comment: Thank you @d4nyll, this is really useful, added to my dotfiles
Answer: I tried many solutions for this and nothing worked the way I wanted, so I wrote my own:
ZSH function to auto-switch to correct Node version
As far as I know, this is the only one that meets all the following criteria:

guarantees you are always on the right version by searching up the directory tree to find the closest .nvmrc (just like nvm use);
can handle any valid .nvmrc format;
clearly warns you if no installed version satisfies the .nvmrc,
assumes you want default if there is no .nvmrc anywhere up the tree;
is completely silent and fast if you are already on the correct Node version.
Comment: Great solution!
I'm using it as it's quite fast, and also avoids overhead of keep calling nvm use
Answer: When you swim with the fish shell, here is how to run nvm use whenever there is a .nvmrc in the directory:
# TODO: save this as `$HOME/.config/fish/conf.d/use_nvmrc.fish`

# HOW IT WORKS
# `nvm use` whenever .nvmrc is present in $PWD when using fish shell
# when traveling deeper, use the parent .nvmrc unless otherwise set
# also go back to default nvm when leaving the nvmrc-specified zone

function set_nvm --on-event fish_prompt
    # runs whenever the fish_prompt event occurs
    # if the current directory hasn't changed, do nothing
    string match -q $PWD $PREV_PWD; and return 1

    # if the current directory is within the previous one where we found an nvmrc
    # and there is no subsequent .nvmrc here, do nothing, we are in the same repo
    string match -eq $PREV_PWD $PWD; and not test -e '.nvmrc'; and return 1

    # if we clear those checks, keep track of where we are
    set -g PREV_PWD $PWD

    if test -e '.nvmrc'

        # if we find .nvmrc, run nvm use
        nvm use

        # and remember that we used that node
        set NVM_DIRTY true

    else if not string match $NVM_DIRTY true

        # if we have set nvm and have stepped out of that repo
        # go back to default node, if not already on it
        not string match -eq (nvm current) (nvm alias default); and nvm use default

        # and clear the flag
        set NVM_DIRTY
    end
end

Comment: This still uses system version if you cd directly into subdirectory without explicitly cd'ing into parent directory with `.nvmrc` file first.
Answer: Yet another solution using direnv. Direnv comes with OS X and many distros so no installation is needed.
Add these two lines to your .zshenv or .bash_profile depending on which shell you use:

export NVM_DIR="$HOME/.nvm" # You probably have this line already
export NODE_VERSIONS="${NVM_DIR}/versions/node"
export NODE_VERSION_PREFIX="v"

Add an .envrc file to the project root with the contents
set -e
use node

Finally cd to your directory. (Don't forget to source .zshenv)
direnv will ask you to allow load config.
Type direnv allow and voila!
Note that direnv doesn't support fancy constructs like lts/* in .nvrmc. On the positive side, direnv supports a bunch of runtimes like node, php, go, pyhton, ruby etc. allowing us to use a single tool to solve path issues.
Comment: Thanks, but I don't think direnv is included by default on MacOS
Comment: Definitely not. `direnv` doesn't come with MacOs as of 12.5.1
Answer: There is now offical docs on how to do this really well, see deeper-shell-integration at https://github.com/nvm-sh/nvm#deeper-shell-integration
Comment: This answer needs to bubble up to the top. The official https://github.com/nvm-sh/nvm repo should be the source of truth, with best solutions constantly updated through pull requests. StackOverflow isn't great for something like this which is expected to change over time.
Answer: Bash version (to put in $HOME/.bashrc), with these features:

not using a cd alias (it allows to change directories in other ways, for example starting your terminal directly in another directory)
finds .nvmrc in upper directories (using nvm_find_nvmrc)
doesn't call nvm use if not needed

call_nvm_use_if_needed() {
  NEW_NVMRC="$(nvm_find_nvmrc)"
  if [[ "$NEW_NVMRC" != "$CURRENT_NVMRC" ]]; then
    if [[ -z "$NEW_NVMRC" ]]; then
      nvm use default
    else
      nvm use
    fi
    CURRENT_NVMRC="$NEW_NVMRC"
  fi
}

PROMPT_COMMAND="call_nvm_use_if_needed; ${PROMPT_COMMAND}"

Comment: doesn't seem to respect new folders after a CD on osx big sur
Answer: For those on Apple Silicon (M1) Macs, you may have noticed NVM tries and fails to compile Node versions <16 from source on nvm install. Here's an update to @Rotareti's and @Reynke's answer that uses Rosetta to install the x86_64 version for Node < 16 while installing the native ARM version for Node >= 16, as Node 16 is the earliest version to support Apple Silicon.
Once installed, you can nvm use from either native or rosetta terminals to use the right version, so only the nvm install portion of the original function changes.
Replace /opt/homebrew/opt/nvm/nvm.sh with the path to your nvm installation.
~/.zshrc
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      # check if we're in a native (ARM) terminal
      if [[ $(uname -p) == "arm" ]]; then
        local nvmrc_remote_version=$(nvm version-remote "$(cat "${nvmrc_path}")")

        if printf '%s\n%s\n' v16.0.0 "${nvmrc_remote_version}" | sort -VC; then
          # arm and node >= v16; install native node
          nvm install
        else
          # arm and node < v16; install x64 node using rosetta
          arch -x86_64 zsh -c '. "/opt/homebrew/opt/nvm/nvm.sh"; nvm install'
          nvm use
        fi
      else
        # not arm
        nvm install
      fi
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version default)" ]; then
    echo "Reverting to nvm default version"
    nvm use default
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

Answer: This version will preserve cd performance
autoload -U add-zsh-hook
use_nvmrc_version_automatically() {
  if [[ -f .nvmrc ]]; then
    echo ".nvmrc FOUND now INSTALLING and USING $(cat .nvmrc)"
    nvm install $(cat .nvmrc) && nvm use $(cat .nvmrc)
  fi
}
add-zsh-hook chpwd use_nvmrc_version_automatically
use_nvmrc_version_automatically

Answer: If you use zsh (z shell):
I load nvm in a different way that's faster, but it means nvm_find_nvmrc is not available so @Rotareti solution wasn't working for me.
I found any easy way to fix: simply call nvm use without params since it already handles the logic of looking for an .nvmrc file itself and uses the default version if not found.
# ~/.zshrc

# DEFAULT NVM CONFIG
#export NVM_DIR="$HOME/.nvm"
#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
#[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# Add the following lines before all other OH MY ZSH config
# FASTER WAY TO CONFIGURE NVM ON STARTUP - OTHERWISE IT'S REALLY SLOW
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
export PATH="$NVM_DIR/versions/node/v$(<$NVM_DIR/alias/default)/bin:$PATH"
alias nvm="unalias nvm; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; nvm $@"

# USE NVM VERSION IF .NVMRC FOUND, OTHERWISE USE DEFAULT
nvm use &>/dev/null

Altogether, I find this to be a really fast solution, that saves me the pain of typing nvm use.
I'd like to avoid nvm use when there's no .nvmrc file available, but loading time is quite low on my computer as it stands and I rarely need a terminal without Node - so this works for me for now.
Update: Added instructions on where to place suggested script
Comment: this doesn't update when changing folder on Big Sur
Comment: @MildFuzz Do you mean when you open a new terminal from a different location? If that's what you mean you need to add the suggested script to your .zshrc file before all the rest of zsh config.
Answer: For zsh users, you should try zsh-nvm:

Zsh plugin for installing, updating, and loading nvm

Suppose you are using antigen, you can turn on auto use like this:
export NVM_AUTO_USE=true
antigen bundle lukechilds/zsh-nvm

zsh-nvm also supports lazy load nvm, which dramatically reduced the startup  time of zsh
% time (source "$NVM_DIR/nvm.sh")
( source "$NVM_DIR/nvm.sh"; )  0.58s user 0.37s system 109% cpu 0.874 total

% time (_zsh_nvm_lazy_load)
( _zsh_nvm_lazy_load; )  0.01s user 0.01s system 168% cpu 0.012 total

Answer: I use this zsh configuration framework called Oh My Zsh. It's a very active repository with regular updates. Try it and I'm sure you will love it. Oh, and it has the automatic .nvmrc feature built-in so it's as simple as installing the package thru npm!
https://github.com/robbyrussell/oh-my-zsh
Comment: I don't think this functionality is build in
Comment: It actually has it these days: if `NVM_AUTOLOAD` is set to `1`, the plugin will automatically load a node version when if finds a `.nvmrc` file in the current working directory indicating which node version to load. See: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/nvm
Answer: Extending on @Adriano P answer, I'd propose this version that is less general (only works if .nvmrc is set on a git repository root), but works in cases when we navigate to elsewhere in project than its root:
_enter_dir() {
    local git_root
    git_root=$(git rev-parse --show-toplevel 2>/dev/null)

    if [[ "$git_root" == "$PREV_PWD" ]]; then
        return
    elif [[ -n "$git_root" && -f "$git_root/.nvmrc" ]]; then
        nvm use
        NVM_DIRTY=1
    elif [[ "$NVM_DIRTY" == 1 ]]; then
        nvm use default
        NVM_DIRTY=0
    fi
    PREV_PWD="$git_root"
}

export PROMPT_COMMAND=_enter_dir
#export PROMPT_COMMAND="$PROMPT_COMMAND;_enter_dir"  # use this if PROMPT_COMMAND already defined

Answer: For someone still facing the above issue the README for nvm has this section which would be helpful
https://github.com/creationix/nvm#deeper-shell-integration
Personally I prefer editing the .bashrc (https://github.com/creationix/nvm#automatically-call-nvm-use) over other solutions.
Answer: I've actually used Rotareti's solution for a while, before wanting to use the lts version if there is no .nvmrc (which was actually what the author asked originally).
So I worked on it a little and all it required was a few replaced/added lines:
# Load right version of NVM
autoload -U add-zsh-hook
load-nvmrc() {
  local node_version="$(nvm version)"
  local nvmrc_path="$(nvm_find_nvmrc)"

  if [ -n "$nvmrc_path" ]; then
    local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

    if [ "$nvmrc_node_version" = "N/A" ]; then
      nvm install
    elif [ "$nvmrc_node_version" != "$node_version" ]; then
      nvm use
    fi
  elif [ "$node_version" != "$(nvm version-remote --lts)" ]; then
    if [[ "$(nvm ls)" != *"$(nvm version-remote --lts)"* ]]; then
      echo "New lts version available. Installing..."
      nvm install --lts
    fi
    echo "Reverting to node lts version"
    nvm use --lts
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

Answer: The only time I run node outside a docker container is for tests and scripts. So I just set my yarn alias to use whatever node version is in .nvmrc.
This doesn't affect your shell performance when switching directories, it will throw on a missing node version, it only runs if necessary, and it respects your default node version in every other directory unless .nvmrc is present.
# append this to your .zshrc file:

# use whatever nvm version is in .nvmrc
use_nvmrc() {

    # check that file exists
    if [[ -f .nvmrc ]]; then

        # get desired and current version
        rc_v=$(cat .nvmrc)
        n_v=$(node -v)

        # if the versions are not the same use the desired version
        if [ $rc_v != $n_v ]; then
            nvm use $rc_v
        fi

    fi

}

# overwrite yarn alias
alias yarn="use_nvmrc && yarn"

Note: this is expecting that you use the same version format as node in your .nvmrc file. So when setting the version use node -v > .nvmrc to make sure it's correct.
Answer: For users of Windows, zsh and coreybutler's nvm-windows, this slightly modified script adapted from the answer above could come in handy at the end of your .zshrc:
autoload -U add-zsh-hook
load-nvmrc() {
  if [ -f ".nvmrc" ]; then
    local required_version=$(cat .nvmrc | cut -c2-)
    local current_version=$(node -v)
    echo "Required Node version: $required_version"
    local is_available_already=$(nvm ls | grep -c "$required_version")
    if [[ $required_version != $current_version && $is_available_already -lt 1 ]]; then
        echo "Required version $required_version not installed, installing..."
        nvm install $required_version
    fi
    nvm use $required_version
  fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc

Answer: I found working solution its given on official docs of NVM
https://github.com/nvm-sh/nvm#nvmrc

.nvmrc
You can create a .nvmrc file containing a node version number (or any other string that nvm understands; see nvm --help for details) in the project root directory (or any parent directory). Afterwards, nvm use, nvm install, nvm exec, nvm run, and nvm which will use the version specified in the .nvmrc file if no version is supplied on the command line.

For example, to make nvm default to the latest 5.9 release, the latest LTS version, or the latest node version for the current directory:
$ echo "5.9" > .nvmrc

$ echo "lts/*" > .nvmrc # to default to the latest LTS version

$ echo "node" > .nvmrc # to default to the latest version

Put the following at the end of your $HOME/.bashrc:
    cdnvm() {
    command cd "$@" || return $?
    nvm_path="$(nvm_find_up .nvmrc | command tr -d '\n')"

    # If there are no .nvmrc file, use the default nvm version
    if [[ ! $nvm_path = *[^[:space:]]* ]]; then

        declare default_version
        default_version="$(nvm version default)"

        # If there is no default version, set it to `node`
        # This will use the latest version on your machine
        if [ $default_version = 'N/A' ]; then
            nvm alias default node
            default_version=$(nvm version default)
        fi

        # If the current version is not the default version, set it to use the default version
        if [ "$(nvm current)" != "${default_version}" ]; then
            nvm use default
        fi
    elif [[ -s "${nvm_path}/.nvmrc" && -r "${nvm_path}/.nvmrc" ]]; then
        declare nvm_version
        nvm_version=$(<"${nvm_path}"/.nvmrc)

        declare locally_resolved_nvm_version
        # `nvm ls` will check all locally-available versions
        # If there are multiple matching versions, take the latest one
        # Remove the `->` and `*` characters and spaces
        # `locally_resolved_nvm_version` will be `N/A` if no local versions are found
        locally_resolved_nvm_version=$(nvm ls --no-colors "${nvm_version}" | command tail -1 | command tr -d '\->*' | command tr -d '[:space:]')

        # If it is not already installed, install it
        # `nvm install` will implicitly use the newly-installed version
        if [ "${locally_resolved_nvm_version}" = 'N/A' ]; then
            nvm install "${nvm_version}";
        elif [ "$(nvm current)" != "${locally_resolved_nvm_version}" ]; then
            nvm use "${nvm_version}";
        fi
    fi
}

alias cd='cdnvm'
cdnvm "$PWD" || exit


Determining the modulus of a complex number from equation

Question: $|2z+3|=|z+6|$ where $z$ is a complex number represents a circle with center $(0,0)$ and radius $3$. It is fairly easy to prove it by letting $z=x+iy$ and we get the standard equation of circle in cartesian form. But is there any way we can deduce $|z|=3$ without exploiting $z=x+iy$ e.g in cartesian form? The reason being the cartesian calculation is a tad bit tedious. So it will be helpful if someone suggests a clever way of manipulating this.
Answer: Instead of working with the modulus directly, you can start with the two expressions $2z+3$ and $z+6$ and multiply each by their complex conjugate. Then you get:
$$4|z^2|  + 12|z| +9 = |z^2| +12 |z| + 36$$
Simplifying leads to: $$|z^2| = 9$$
Answer: $$|2z+3|=|z+6| \implies |2z+3|^2=|z+6|^2$$
$$ \implies (2z+3)(2z+3)^*=(z+6)(z+6)^* \implies (2z+3)(2z^*+3)=(z+6)(z^*+6)$$
$$\implies 4zz^*+6(z+z^*)+9 = zz^* + 6(z+z^*) + 36$$
$$\implies 3zz^* = 27 \implies 3|z|^2 = 27\implies |z|=3$$


How can we differentiate a "completed working paper" from "incomplete working paper"?

Question: There are many governmental or non-profit or for-profit research institutes in economics or finance. I see working papers and discussion papers which were cited many times. Although 3-4 years passed, the authors probably did not consider publishing it in a journal. So, what makes a "working paper" a "completed paper" ? Without publishing it in a journal how can we know that it is really an incomplete piece of work or actually complete work but has to be named as "working paper" because of the "environment that paper available"
Is it possible to have a "final draft of working paper" without publishing it in a journal?
Answer: In practice it is very hard to determine when a paper is done. So there is no easy answer other than read the paper, and make up your own mind whether you consider it complete.


Best way to store date/time into core data

Question: For each course I am storing the day of the week the class the user has...and the start and end time and room no.
What would be the best approach in terms of data type, Like for storing time?? so that when I pull it out I can display it e.g 1:00 PM.
Thanks!
Answer: Use a date attribute in your managed object model for each time you want to store. See the section on "Dates and Times" in the  Core Data Programming Guide.
Comment: This page has gone stale, what did it say?
Answer: If its an actual date e.g. Tuesday, December 15th 2010 1:00pm CST, then you can use a data attribute.
However, if it's just a generic time of day e.g. any given Wednesday at 1:00pm, the you will need to create attributes to hold the day, the time and meridian as strings and or numbers.
I would recommend creating a entity in the model just for this information and then setting a relationship to it.
Pseudocode:
DayAndTimeEntity{
    weekdayName = sting;
    timeOfDay = string or number; //use a number if you need to do calculations
    isAM = BOOL;
}

in use, "any Monday at 1:00pm" would look like:
aDayAndTimeEntityInstance{
    weekdayName = "Monday";
    timeOfDay = "1:00"
    isAM = NO;
}

Then set a relationship to any other entities that need to store this time. You can elaborate on the basic idea as needed.
Answer: Date Type should work


RTS game engine for iOS/iPhone

Question: Anyone know any free or non-free RTS engine that can be used for iOS game development?
Answer: I don't know of an engine dedicated to RTS, but there's always Unity3D. Runs on both iOS and win.
If you plan on iPhone/Pad development it's going to cost quite a bit though. That being said, Unity is quite awesome!
Comment: Even at the highest cost, $4,500 (Pro, iOS Pro, and Android Pro) is not all that expencive for the level of polish on the Engine... that said, it is quite steep for a start-up and/or hobby game.
Answer: Glest uses OpenGL.  You could port it to the iPhone.

RTS game engine for iOS/iPhone


long position on futures

Question: Now I am opening a long position of 1000000 USD on euro futures at a spot FX rate of $1.2568/€. Technically, this means that I am taking a credit of €795,671.55 (2dp) from my broker and immediately am exchanging that amount to 1000000 USD. Therefore, I now have 1000000 USD available in a virtual space but I owe my broker €795,671.55. Is this correct?
Answer: This is a futures trade ? If so there are no payments of euros or dollars except for the payment (or receipt) of daily variation margin to the exchange via your broker.  If this is CME futures those payments will be in USD and will represent the dollar gain or loss on your trade.  This will be automatically debited  and credited from your account.
Answer: You dont owe your broker anything. It was a spot deal and you exchanged your USD for the EUR equivalent. When you want to convert it back to your account ccy (USD), you will then convert back the EUR for the USD at whatever the prevailing spot rate is.

long position on futures


Can peripheral devices be damaged by sending wrong signals?

Question: I read somewhere that once monitors could be damaged by sending wrong signals and it was used as a plus point by the hackers.I want to ask that today,is there any way hardware can get damaged by the signals?
Answer: It depends on the hardware.
In general, these days, the answer is no.
Even in the way back when, it was all a bit of a beat-up. It used to be the case before multisync monitors that you needed to match monitor and video card - if they were wrong then the monitor would not sync. (Video signals in particular are all over the place, depending on resolution (width AND height) and frame rate.
These days all monitors / screens seem to auto-sync, and in any event the liklihood of damage was always pretty small. If the signals were electrically incompatible then perhaps damage might have resulted, but thats why all the different types of sub-systems use different connectors.
The other things you might need to consider are the common USB, serial, etc ports. In general these are designed to be tolerant of connecting up all manner of strange things without damage. And likewise, software can drive those ports without damage to the hardware as well. (The days of dodgy hardware that could in some cases cause large currents to flow if for example you did input and output at the same time on a parallel port - those days are gone about a decade or more ago).
Pretty much the only thing you need to be concerned about is things like probing hardware. For example, probing a serial port is fraught with danger. You might send down a magic sequence of bytes to see if your favourite device is attached (for example, your remote controlled car controller). Trouble is, that same sequence of bytes MIGHT cause some other device to malfunction or do something "weird". So for example, probing for your remote controlled car controller MIGHT do something horrible to the attached nuclear reactor controller that was attached. Now this is pretty unlikely but it can't be ruled out.
Example: years ago Windows NT used to probe for mice on serial ports, and I had a bunch of development equipment attached to a serial port spewing out all kinds of junk which was nice in a serial terminal program. But on machine boot about once a month windows would interpret this stuff as being a mouse, and happily run with 2 mouse feeds. The cursor would take off across the machine which acted like it had a ghost in it. Figuring out that turning off my hardware-system-under-development fixed it... that took a couple of hours!
Summary: In general you can't damage hardware that is plugged up and compatible. You might get strange things happening but the chances of actual DAMAGE (and smoke and flames, etc, or big repair bills) is small.
All that said, when something does not fit, perhaps its that way for a reason. Putting the wrong type of RAM in (and pushing REALLY HARD to make it go) is not a good move. Likewise I have seen the "D" connector used for a serial port plugged in 180 degress rotated. THAT TOOK SOME PUSHING. If things are connected that are meant to be connected, you should not do too much harm.
(And finally, as a guy once told me: if you can break it that easily, it was not designed right.)
Comment: That's a good answer - the only thing I'd add is that some low-level hard disk (SSD?) probing could result in some nasty outcomes such as corrupting the low-level format, and I'd imagine that with a bit of (bad) luck, probing some specialist hardware might hit upon some diagnostic modes that could cause incorrect operation that might result in damage to things such as stepper motors (scanners/printers), but the risk should be very low - as per your last sentence!
Comment: @linker3000:What are low level hard disks?
Comment: Hi - with the brackets out of the way that reads 'low-level hard disk probing' as in: 'probing hard disks using low-level function calls or direct hardware access'.
Comment: Yes, I agree with all of the above. If you probe disk controllers and the like then nasty things might happen. Generally still not to the hardware in terms of letting out the smoke, but it might make your data hard to recover.
Comment: And one final comment on that point. With some Flash memory IC's you can destroy them with improper erase or write processing. (I once did this on very early and expensive Flash IC's.) Modern flash EPROMs tend to have built in timers and such like to stop this kind of shooting-yourself-in-the-foot.


Dependency Xvfb missing error on npm run

Question: On running the command npm run test on ubuntu WSL-2 Windows 11. I get the following error:

firstname.lastname@example.com test
cypress run
It looks like this is your first time using Cypress: 9.7.0
Your system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required
dependencies installed.

Error: spawn Xvfb ENOENT

Platform: linux-x64 (Ubuntu - 20.04) Cypress Version: 9.7.0
I am not sure how to go about resolving this error. Any ideas?

Some Attempts:
sudo apt-get install libg
tk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

[sudo] password for ron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgtk2.0-0 is already the newest version (2.24.32-4ubuntu4).
libgtk2.0-0 set to manually installed.
libxss1 is already the newest version (1:1.2.3-1).
libxss1 set to manually installed.
libxtst6 is already the newest version (2:1.2.3-1).
xauth is already the newest version (1:1.1-0ubuntu1).
xauth set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgl1-mesa-dri : Depends: libglapi-mesa (= 20.2.6-0ubuntu0.20.04.1) but 21.2.6-0ubuntu0.1~20.04.2 is to be installed
 libqt5svg5 : Depends: libqt5widgets5 (>= 5.12.8+dfsg~) but it is not going to be installed
 xvfb : Depends: libgl1 but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Comment: `apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb`? as per the link?
Comment: I resolved the error by installing each library in a separate apt-get install command. For some it gave the same error. The command `sudo aptitude install ` resolved it along with `sudo apt-get update`
Answer: I faced same issue on Rocky Linux 8, and installing xorg-x11-server-Xvfb dnf package helped
dnf install -y chromium xorg-x11-server-Xvfb


Cleaning chicken with corn starch?

Question: YouTube recently started recommending Chinese cooking videos.  This particular cook has a curious habit of rubbing cornstarch all over the chicken breasts before washing them off.  Is there an advantage to cleaning chicken with cornstarch? Or perhaps an alternate explanation? Some people have suggested it's for tenderizing or velveting but those aren't particularly satisfying answers.
Comment: Hi, and welcome to SA! Have a look at the [Tour](https://cooking.stackexchange.com/tour) and [Help Center](https://cooking.stackexchange.com/help) when you get a chance.
Answer: Some asian cultures clean meats with flour and/or cornstarch to remove the game-y smell from it. Since it's being washed off, I don't think it for the velveting.
Answer: The closed captioning on the video stated that the chicken in the recipe has to be 'kneaded' for two minutes. This does suggest that this step is meant to tenderize the chicken. Cornstarch in principle does nothing to aid that process. However, cornstarch is excellent at absorbing liquid, which leads me to believe it's there to catch any liquids coming out of the chicken due to the tenderizing.
This is little more than a hunch, though, and does not really explain why the chicken could not be washed after tenderizing without using cornstarch.

Cleaning chicken with corn starch?


What is the rationale for Greek Orthodox's erection of a wall between the congregates and the altar?

Question: Other Christian religions (e.g. Lutheran, Catholic, Baptist, et al.) leave access  to the altar open for their congregations.  Is there a special theological reason the the different approach by the Greek Orthodox churches? Or is it a cultural tradition to separate it from the Western church religions?
Answer: The chancel was also originally screened off in Roman Catholic churches, but under Protestant influences the barriers were eventually done away there also.
In the ancient Church the altar was understood to have taken the place of the Holy of Holies. Screening the altar follows from Jewish tradition, where the Holy of Holies was covered by a veil (Exodus 27) and could be accessed only by the priests (Hebrews 9:7). See On the Divine Liturgy by written by Germanus, Patriarch of Constantinople in the 8th century.
Answer: What is the rationale for Greek Orthodox's erection of a wall between the congregates and the altar?
The altar area is and has always been considered the most sacred physical portion of a church, whether in a Catholic or Orthodox church.
Thus, just as the Temple in Jerusalem had the Holy of Holies, the Orthodox separated the sacred sanctuary of their churches from the rest of their churches with an iconostasis.

The iconostasis (icon wall or icon stand) is the wall before the altar. It represents a threshold into the most holy space; and so on it we see icons depicting the most holy figures. First and foremost is, Jesus Christ. On either side of him are the figures most significant to him in his earth life: the Virgin Mary and St. John the Baptist. The icon beside the Virgin Mary's is the icon of the saint or life event of the Church (ours is the Dormition Tis Theotokou). Above the doorway to the altar is an icon depicting the last supper, and around it are icons of the holy apostles. - The Greek Orthodox Church

This is the traditional set up of Orthodox Churches.
This is not the same thing of the chancel found in larger Roman Catholic Churches and cathedrals. The Chanel was originally to separate choirs in larger churches, cathedrals and basilicas from the rest of the congregation. The average Roman Catholic parish church never had a Chanel erected within their church constructions, because smaller parishes never had large choirs. By contrary, all Orthodox Churches has maintained the usage of the iconostasis in their churches.


'Unnamed VM' could not read or update the virtual machine configuration because access was denied: General access denied error (0x80070005).

Question: Today I have added a host to scvmm. And later all VMs on the host are failed to restart and the following error is thrown:

Error (12700) VMM cannot complete the host operation on the serverName
  server because of the error: 'VMName' could not initialize. (Virtual
  machine ID DDEA27BF-EBCA-49D6-B0BC-F89D83B1FCA4)
'VMName' could not create or access saved state file
  D:\Hyper-V\VMName\Virtual
  Machines\DDEA27BF-EBCA-49D6-B0BC-F89D83B1FCA4\DDEA27BF-EBCA-49D6-B0BC-F89D83B1FCA4.vsv. (Virtual machine ID DDEA27BF-EBCA-49D6-B0BC-F89D83B1FCA4) Unknown
  error (0x8006)
Recommended Action Resolve the host issue and then try the operation
  again.
Answer: Later we follow the "Hyper-V virtual machine may not start, and you receive a "'General access denied error' (0x80070005)" error message" to successfully resolve the issue.
Solution is to grant each VM to access its VM files and directories.
icacls <Path of .vhd or .avhd file> /grant "NT VIRTUAL MACHINE\<Virtual Machine ID from step 1>":(F)

To grant permission to virtual machine folder and its children:
icacls "D:\Hyper-V\Virtual Machine" /grant "NT VIRTUAL MACHINE\DDEA27BF-EBCA-49D6-B0BC-F89D83B1FCA4":(OI)(CI)F

Answer: I encountered this error on start-up of my VM after I had changed out a drive on my server. The new drive had the same letter assigned as the previous drive and all the files had been copied over, including my VM folder that contained the .vhd file. I executed the icacls command as given in Amitabha's answer, but this did not resolve the issue for me.
I then read somewhere that the group Authenticated Users should have full access to the folder containing the virtual machine configuration files. So I add the security group Authenticated Users in the security tab of my VM folder properties and gave this group full control rights. After doing this my VM started correctly.


How to use NHibernate ICriteria API to query by properties on a subclass of an associated object

Question: Example:
Client object has a collection of Action objects which records a history of actions performed against the client.  Action is abstract and has several subclasses  e.g. SystemAction, CorrespondenceAction etc.
I have a client search screen which has many optional search criteria, so using the criteria API is the obvious choice.  Some of the search criteria relate to properties on the Action subclasses.  E.g. Addressee on CorrespondenceAction.
Is it possible to use NHibernate ICriteria API to query on properties of the event subclasses?  What mechanism do I use (detached sub queries perhaps?)
Answer: Yes. Create DetachedCriteria for each search criteria that the user can specify and then add them to your CreateCriteria call.


Trading stock items in Team Fortress 2

Question: If you go to the steam marketplace, and you apply the normal filter, you immediately see that the first items are stock items, or the items that you start with. How does a player get those items in trade-able form?
Answer: According to the wiki page on the Normal quality, there exist a minority of items with the Normal quality that aren't supposed to be, and/or have the kill-counting abilities of Strange weapons. It seems that that's what you're seeing on the market.
Answer: Those "stock" items are the result of players applying Name Tags or Description Tags to stock items.
When that is done so, instead of modifying the stock item, a replica of the stock is created with the properties applied to it "changed name, changed description".
Comment: ...except when you apply a tag to a stock item, it gets turned into a unique item.  Which as @Blahmastah points out, has a different color.
Comment: Why do these go for over 300 dollars, though, if it is just tags. And how do they look the same. (different qualities have colored edges.)and how does it become sell-able on the market.

Trading stock items in Team Fortress 2


Canon AE-1 mirror stuck but can wind film and take photos

Question: My Canon AE-1 camera's mirror is getting stuck in the up position after taking a photo. I can wind the film with the lever and the mirror goes back down but once I take a photo, the mirror stays in the up position. Does anyone know how to fix this? I also just put in a brand new battery so that is not an issue.
Answer: Sounds like a mechanical issue, and like the mirror is getting locked. You might need to replace the mirror bumper. I would suggest getting it professionally serviced.
Is your film still winding after the mirror gets stuck? If not, there might be something (a piece of plastic for example) that has broken off and gotten stuck in the winding mechanism.
Hope this helps!


Is there something like the Wubi installer for Linux Mint?

Question: I want to use Linux Mint. I would like to know if there is something like the Wubi installer for Linux Mint? I searched on the Linux Mint website, but I couldn't find anything.
Answer: Yes, there is a Wubi for Linux Mint. And it works- at least on my Windows XP and with Linux Mint 15.
You will need the .iso and a program like Power ISO. You just open the .iso file with Power ISO and search for mint4win.exe. Open that as admin and the rest is the same as with Wubi.
Answer: You can do that easily. You'll need an extra ubuntu or lubuntu ISO image. Extract Wubi.exe from the ISO file and put the ISO file and the Wubi.exe at drive C. Then run Wubi and install Ubuntu.
After it finishes installation don't restart your computer. Goto C://Ubuntu/install/boot, then replace these 3 files:
VMLINUZ INITRD.LZ MD5SUM with the same files from MINT (or any othr Linux  you want to install) ISO file (look inside CASPER folder). Lastly replace the installation.iso file with your MINT.ISO file.
Now restart your computer and install MINT instead of Ubuntu
Watch this video : https://www.youtube.com/watch?v=Jtzm4DOdrKw
A Step by Step Guide to install any linux distro inside Windows using WUBI
Answer: Wow, someone actually used that thing!
I would not expect there to be. Ubuntu markets itself for the new Linux user and takes every opportunity to make the switch easier. Mint is not Ubuntu, they take what they like of the Ubuntu fork and make the rest less Ubuntu. I know of no TP Wubi...
Also, even with Wubi it is going away. Partially because it does not work with new PCs.

Wubi does not work on any new PC with the Windows 8 logo or using UEFI
  firmware. Please use a 64-bit flavour of Ubuntu, installed directly to
  its own partition instead. For more information see
  https://help.ubuntu.com/community/UEFI  If you upgraded to Windows 8
  and are using BIOS firmware, Wubi does work, but do not enable
  hybrid-sleep on Windows 8.
Answer: I have found a solution on my own, you can find here my project.


Difference between ĉar and pro

Question: It seems as though there is a lot of confusion over this topic. What is the difference between ĉar and pro? In what case would I use each word?
Answer: pro is a preposition so it should be followed by a noun.
ĉar is a conjunction so it can be followed by a complete phrase.
Both of them indicate that the thing following it is the cause of the thing preceding it. For example:

Mi ne iris eksteren pro la malvarmo.
Mi ne iris eksteren ĉar estas malvarme.

In this case the two phrases are saying more or less the same thing except that in the first case the idea is being expressed as a noun (la malvarmo) and in the second it is a complete phrase (estas malvarme). It would be incorrect to interchange the two words for these sentences:

✖ Mi ne iris eksteren ĉar la malvarmo ✖
✖ Mi ne iris eksteren pro estas malvarme ✖

Note however it is possible and quite common to use pro with a phrase by making it act like a noun by adding tio ke:

Mi ne iris eksteren pro tio ke estas malvarme.
Answer: ĉar = Because - I walk because I want to be in shape.
pro = Because of - I have energy because of a healthy diet.
Answer: My rule of thumb is that is that when "due to" works in place of "because [of]", then it's pro. Otherwise, ĉar.
Try it with the example sentences others gave, so e.g. "pro la malvarmo" is "due to the cold", thus pro is right, but "pro estas malvarme" would be "due to it's cold", which is wrong, thus use ĉar there instead.

Difference between ĉar and pro


Cannot search for answers on closed questions

Question: If I search for closed:yes is:answer, I got the same number of results as searching for closed:yes. Is there any way to search for answers on closed questions? Am I not using the correct syntax for searching?
Comment: Not sure what exactly you are trying to search for, but doesn't [closed:yes answers:1](https://stackoverflow.com/search?q=closed%3Ayes+answers%3A1) get you what you want?
Comment: What @yivi said would be my suggestion as well but if you add additional search terms you would still be searching in questions only.
Comment: How I think it works: Questions and Answers are just Posts. Closed:yes would translate into `where closeddate is not null`. Answers don't have their closeddate set when the question gets closed. You end up with just questions. An implementation quirk seems to be that once you selected questions it refuses to take into account answers. I guess that is how Elastic wants it ...
Answer: Your search indeed will never return useful results, because you told the search engine you only want to search for answers by setting is:answer. But answers can't be closed (only questions can), so there are no answers with closed:yes. So instead, the is:answer operator is ignored, as if the search used is:question instead.
That's because closed:... is only useful for question searches. You can find closed questions with at least one answer instead, by combining closed:yes with the answers:... operator, which accepts a range; answers:1... would find questions with 1 or more answers that are closed:
closed:yes answers:1... finds more than 750k closed questions with answers.
answers:1 is equivalent to answers:1...; if you wanted to find closed questions with exactly one answer, use answers:1...1:
closed:yes answers:1...1 results in a little over 418k closed questions with a single answer.
You could combine either with the isanswered:yes and / or hasaccepted:yes operators; these limit question results to posts with at least one upvoted answer and questions with an answer that has been marked as accepted, respectively.
You can't otherwise search for the content of answers that were posted on a closed question.
Comment: For content search [SEDE](https://data.stackexchange.com/stackoverflow/query/1380511?search=loop&tag=apache-spark) is an option but you have to restrict the search scope to a tag.
Answer: A similar question turned up recently on cross validated meta here, and it linked to this question here.
There is a comment by rene, that mentions a SEDE search, but I thought it might be nice to also have it in an answer. The following two scripts allow you to search for answers on closed questions of specific users: this and this.

The search prompt on the main websites is not gonna be able to process a search like that. The searches of this type use an inner join of two selections of the data tables. The search prompt is only able to process a search of the type 'select stuff from some table where some conditions apply'. This is a search for rows in a table where the 'some conditions' only apply to each specific row (like in an Excel spreadsheet you filter rows based on contents in the cells). With an inner join operation the rows are augmented with additional information about connections from rows in other selections or tables.


How do I uninstall an app from my Mac?

Question: I know I'm a bit silly here, and I've just recently switched from Windows to Mac. All I would do on a PC is press Win+X and then the F key to get to "Programs and Features" window, and search for the app from the list and then uninstall them. So I was wondering if there is anything similar on Mac as well.
Comment: https://www.howtogeek.com/231496/how-to-uninstall-applications-on-a-mac-everything-you-need-to-know/
Answer: For most apps, it's easy as navigating to your Applications folder in the Finder, then dragging the application to the Trash icon in your Dock. You can also right-click and select 'Move to Trash', or hit ⌘-delete.
I should also add, many apps store your settings and data in a different directory which doesn't get deleted simply by deleting the app in the Applications folder. This is both good and bad. If you ever reinstall the app, all your settings and data will still be in place. Keeping these extra files around doesn't really do macOS any harm. Although if you're concerned about removing EVERYTHING for a particular app, it can be tough to make sure you get everything. There are various utilities that make this a bit easier, one I've used in the past is AppZapper.
If you're curious, these files are usually in ~/Library/Application Support and ~/Library/Preferences.
Comment: With some exceptions, the items that are left behind are completely ignored by the system and don't impact performance or anything else. If an app was purchased through the App Store, it's definitely sufficient to put it in the Trash. If not, I suggest Googling or checking the developer's website for uninstall instructions. There may be an uninstaller app, or you may be guided to move additional files to the trash.
Answer: sudo rm -rf /Applications/youapp.app

Comment: Putting `sudo rm -rf` in the hands of a new user is like handing a small child a loaded gun.
Comment: I agree 100% with @Tetsujin Also, if the OP has only just recently switched to a Mac, there's a better than average chance of them using either El Capitan or Sierra, in which case the Terminal command wouldn't work without first disabling SIP.

How do I uninstall an app from my Mac?


insufficient privileges error though i logged in as system admin

Question: In full copy sandbox, I created a custom object(Contracts__c)  which has lookup to another custom object(Inventory__c). When from Contracts__c i try to create Inventory__c from the related list & save the record i get insufficient privileges error. Though i logged in as system admin
Comment: Since you get the error when you hit the save button and not when the page is displayed, I would assume the issue could be in a trigger. Are there any triggers on this custom object? If yes, is the trigger trying to access something using either a hard coded value or a value from a custom setting?
Answer: have faced a similar issue previously. as the new page is opening for the object it implies permission for objects is available. however either via trigger or workflow some action like field update is being performed for which permission is not available.


Troubleshooting connections between strips of WS2811 Addressable RGB LEDs

Question: I'm hoping for help troubleshooting a light array I built for my son's room. I strung together 8 strips of WS2811 addressable RGB LEDs (30 per strip). I soldered all the strings together, and tested them prior to mounting. Whole strand lit up beautifully. Then, I mounted them onto his desk, and now the first strip lights, and only the first LED of the second strand lights and that one LED is significantly dimmer.
No problem, I think, one of the connections just came loose. But it doesn't seem as though I have any bad solders, and jiggling the wires around doesn't really cause any change in the lone weak LED on the second strip.

I put a multimeter on the end of the first, well-behaved, strip. No value reading across +5V and Gnd. But no reading wouldn't explain how the second strip has one light with some small amount of juice.
I mounted onto the painted wood surface using the adhesive on the back of the strips, and the back does have the exposed copper pads. I figured that the paint on the wood would be sufficiently insulating, but could there be voltage drop from the mounting?
I'm running this with an ESP32, and have a dedicated 5V 2A power supply powering the LEDs.

I'm sure it's a bad solder, but without getting any reading from the good strip's +5V and GND, I'm a little confused. Also, there's clearly some current moving on since the second strip is lighting up a little bit. I'd like to troubleshoot it before I have to unmount the whole dang thing and redo the wiring.
Thanks!
Answer: Definitely a cold solder on the ground pad. Not sure why I got no reading on the multimeter, but whatever.


Attempting to connect to VPN

Question: I use NordVPN. I clicked VPN Connections -> Configure VPN -> Add -> Import a saved VPN configuration file -> entered my username and passwrd and imported cacrt file but every time I try to connect it says timed out :( Any help please?
Answer: Start with basic network troubleshooting. Check IP address, verify VPN server has opened ports TCP 1723 and GRE, verify server has VPN account set up. Can you ping this IP address from terminal?
Answer: If UFW firewall is enabled, look at /var/log/ufw.log with text editor. Go to bottom of file and see if vpn ip address is being blocked. If so, add rule to ufw allowing in from that ip address.

Attempting to connect to VPN


Merge [cameras] and [digital-cameras]

Question: I noticed that we have both cameras and digital-cameras in our inventory of tags.  I don't believe they are both necessary... I propose synonymizing them.  The only kind of camera broadly used today is the digital camera, and in the world of IoT, if someone is speaking about a camera, it will definitely be a digital camera.
Comment: Especially in terms of IoT, it needs to connect to some network, which makes it rather digital.
Answer: I copied cameras into digital-cameras. No tag synonym is warranted; text completion will help the user find the correct tag.
cam → digital-cameras
Comment: @Aurora0001 Ah, yes. The tags specified in the retag-request are wrong (or were changed).
Comment: Looks like they were always wrong - there are no edits on the questions to pluralise the tags (although I could have sworn when I looked that they **did** exist)
Comment: Sorry, my bad.  Yes, the issue was pluralization.  Thanks!
Comment: What about [cameras] (http://iot.stackexchange.com/questions/tagged/cameras) and [digital-cameras] (http://iot.stackexchange.com/questions/tagged/digital-cameras)? Shouldn't these be synonymised as the OP requests?
Answer: No.  It's unfortunate that this action appears to already have been taken, as it was probably mistaken.
"digital-camera" tends to refer devices that are specifically alternative to film cameras, which generally means handheld and human operated.  These would only infrequently be on-topic in an IoT context, and having lots of occurrences of that tag in external searches is likely to attract questions about general point-and-shoot camera support that have nothing to do with IoT.
In contrast, the kinds of cameras that are on topic in an IoT setting - streaming, recording, recognizing - while implicitly digital are essentially never referred to with that adjective.  Adding it is quite unnatural.

Merge [cameras] and [digital-cameras]


How would you clean/prepare a flexible/magnetic mat (e.g. Ender 5) as compared to a glass bed?

Question: I have started printing about a month ago on an Ender 5 (using mostly PLA but recently also PETG) and it seems it's about time to give the print bed a more thorough cleaning than what I usually do after most prints. I'm using the flexible magnetic mat that came with the printer which has a slightly rough surface, but all of the cleaning suggestions I found so far either did not mention the bed material or were specifically for glass beds.
Can/should I use stuff like acetone or rubbing alcohol on this? Or should I stick to warm soap water?
I have had some fairly decent results with spectacle cleaning tissues but that will only remove grease, not filament residue.
Also, I am occasionally having some first layer adhesion issues (especially with the PETG or when printing things with a circular base) and I was wondering whether common suggestions like glue sticks or hairspray to prepare the bed for printing  can also be applied to the flex mat?
Answer: I have the WhamBam system which uses a PEX layer over flex steel (which sticks to a magnetic sheet on the printer bed). To clean old material off, I use a "brass sponge" intended for cleaning soldering iron tips to remove the old plastic, then give it a wipe with a paper towel with some isopropyl alchohol (I have 99.99 anhydrous on hand as I use that for cleaning printed circuit boards as well).
The brass sponge is fairly soft, does a good job of grabbing the old plastic without tearing up the PEX layer.
Comment: Would steel wool do the trick? I have some fairly fine grade stuff to hand.
Comment: Try it on a small spot in a corner, see how it looks.
Answer: Just about every reference I've seen for non-glass beds is to stay away from acetone. Denatured alcohol is likely a safe bet for beds with surfaces that are not impenetrable. If you can identify the bed material, you'll have a better shot at getting a definitive answer.
If you have filament residue, you won't get it clear without some mechanical effort, unless you had an adhesive layer between the bed and the filament. Even a plastic scraper can be effective in clearing the debris.
Comment: The denatured alcohol in our area is not dyed, which means such an additive is not a problem in that respect. The other additive can be methanol, which evaporates at nearly the same temperature, leaving nothing behind, if properly swabbed. The research I've done shows some countries use a colorant, which may leave a residue that could be cleaned with isopropyl alcohol.
Comment: I think I read somewhere that methylated spirits leaves a residue - should I avoid it?


Custom template for all woo commerce categories

Question: I am new with Woo commerce and want to know that how i can create template that will work for all Woo commerce categories. I am able to find out answer that are working for specific to any category (taxonomy-product_cat-SLUG.php) but i want this for all categories.
I have already copied template folder of Woo commerce plugin in my theme but i am not able to locate category template.
I will appreciate your help.
Thank you!
Answer: I am able to locate that file in my theme.
For categories woocommerce.php in root directory of my theme is working and i am able to complete my task.
Thank you!
Answer: Looks like you were looking for archive.php. You have edit archive.php or use hooks to modify all category pages. Copy plugins/woocommerce/templates/archive.php to themes/yourtheme/woocommerce/archive.php. Not sure how woocommerce.php is working for your.


Voltage drop for aluminum wire to detached garage

Question: I have been trying to use the voltage drop calculators but it seems like they give a different answer than the last one. Distance from breaker box in the house to the sub panel in the detached garage is going to be approximately 130 feet, 100 amps, 220 volt. Trying to figure out if I should use 2/0 or 4/0 aluminum wire. Any advice would be appreciated.
Answer: Going only 130 feet, you do not need to up-size wire for voltage drop. The usual #1 Al will suffice for 100A breaker.
Any plan requires a 125% derating of the expected load.  For instance, if you actually intended to pull 100A as a regular, frequent load, you would need  125A to be provisioned, i.e. A 125A breaker and wire.  By extension, the 100A breaker is sized to support 80A of frequent load.
Now there are a couple ways those voltage drop calc's get you. #1 is they prod you for the breaker value, not the practical load - 100A not 80A.  You should enter 80A.    #2 is that they are rather obsessed with 3% as a "very hard maximum" possible voltage drop.  That's not supported by Code; Code wants to see 8% among all voltage drops.   Definitely use a number larger than 3%, like 5-6%, and see what the result is.  Very often, you find the actual number works out to 3.34% or something, and it's just not worth paying a lot more over 0.34%.
By my math, 4/0 aluminum would support a 200A feed breaker.  However, it will not fit on a 100A feed breaker.


Hiding active workbook programmatically in Excel

Question: I'm working on a VBA project based in a workbook. The code opens a new workbook and calls an external API which downloads and inserts a bunch of data in multiple worksheets of this new workbook. I deactivated Screen Updating (Application.Screenupdating = False) so initially the screen stays focused on the original workbook while the API downloads data on the other workbook in the background. However, the screen switches to the new workbook once the API inserts data. How can I prevent this from happening? Thanks!
Answer: Hiding the active workbook is possible with
ActiveWorkbook.Windows(1).Visible = False

You may need to replace ActiveWorkbook with an appropriate reference if the workbook in question is not the active one and/or add a loop like For i = 1 To ActiveWorkbook.Windows.Count if the workbook has multiple windows.
Comment: +1 This method is simple to use and you can simply run it again with "True" once the code has finished executing
Answer: You could try using the ShowWindow API function:
Public Declare Function ShowWindow Lib "user32.dll" _
    (ByVal HWND As Long, ByVal nCmdShow As Long) As Long

Const SW_HIDE as Long = 0
Const SW_SHOW as Long = 5

ShowWindow otherWorkbookApplication.Hwnd, SW_HIDE

'Your code here

ShowWindow otherWorkbookApplication.Hwnd, SW_SHOW

Or alternatively, the LockWindowUpdate API function (thanks to Chip Pearson, http://www.cpearson.com/excel/vbe.aspx):
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal ClassName As String, ByVal WindowName As String) As Long

Private Declare Function LockWindowUpdate Lib "user32" _
    (ByVal hWndLock As Long) As Long

Sub EliminateScreenFlicker()
    Dim VBEHwnd As Long

    On Error GoTo ErrH:

    Application.VBE.MainWindow.Visible = False

    VBEHwnd = FindWindow("wndclass_desked_gsk", _
        Application.VBE.MainWindow.Caption)

    If VBEHwnd Then
        LockWindowUpdate VBEHwnd
    End If

    '''''''''''''''''''''''''
    ' your code here
    '''''''''''''''''''''''''

    Application.VBE.MainWindow.Visible = False
ErrH:
    LockWindowUpdate 0&
End Sub

Comment: "ShowWindow " API is better, because it will not have any side effect, compare to "ActiveWorkbook.Windows(1).Visible = False". In my test, once a Workbook is saved with ".Windows(1).Visible = False", it need to set Visible back to True before you can view the data.
Comment: Note that Chip Pearson's code uses FindWindow to get the handle of the VB Editor. You could ignore the FindWindow part and just use the Hwnd property of the application object of your target workbook as the argument to LockWindowUpdate. I've left it there so you have both alternatives.
Answer: You either need to save and close the target workbook, or select the original workbook before screenupdating is turned back on.
Answer: Sub HidePERSONAL()
Dim i
On Error Resume Next 'in case something crazy happens
For i = 1 To Windows.Count
'Debug.Print Windows(i).Visible
'Debug.Print Windows(i).Caption
If Windows(i).Caption = "PERSONAL.XLSB" Then
Windows(i).Visible = False
On Error GoTo 0
Exit For
End If
Next i
End Sub


Invest in both PPF and VPF

Question: Is one allowed to invest in both VPF (Voluntary Provident Fund) and PPF (Public Provident Fund) in the same financial year and is there a limit on the same?
Answer: With respect to investment there is limit of Rs.1.5 lakh/financial year for PPF. There is no limit on VPF. However, you may also want to look into the tax exemption aspect of investing in these as there are separate limits on those as well.
For e.g., even if you invest the full Rs.1.5 lakh in PPF you will only get a maximum tax deduction of Rs.1.5 lakh on you annual income under section 80C which also includes multiple other investment options including EPF due to which the total investment amount will not get the tax deduction.
However, they are good investment options if you are only looking for secure investment options with high post-tax yield.

Invest in both PPF and VPF


Which is better to use "Your Plan" or "Current Plan"? in subscribed product

Question: Which of the two is more effective and not confusing for the subscribes.
Comment: Both descriptions indicate a currently subscribed plan. Can you elaborate on why you think confusion could occur for subscribed users?
Comment: Yeah, but the psychology behind it... how will the audience react to it, or which of the two is more direct?
Comment: I'm not sure what you want to know. Specific user response to either option will depend on your particular target audience. If you want to know, test it. There's no psychology behind this, other than the 'calling something yours works better', which only testing will show, as it doesn't *always* work.
Answer: Using "Current Plan" or better yet "Active Plan" gives a clear indication on what is active. It also makes writing FAQs simpler as the voice/tone of writing is always neutral.
A friend used to go nuts writing FAQs when the sentence would phrase like "Open your My Account".
"Click on Your Account" still sounds better, but the tone of the interface is that Ownership of the system is with the developer/company, not with the user. Like Amazon says "Abhishek's Account". To correct this and make user feel at home, early stage UI used to use "My " instead of "Your ..".
"Active/Current" is better.
Comment: ok, this cleared my mind. Very nice analogy... :) Thank you.
Comment: @LyleTanciano writing your thanks is not necessary here, please just use the voting options against answers to express your appreciation.
Comment: @JonW oh, ok, I'm new... I voted but it said reputations under 15 doesn't show the votes given but recorded.
Comment: If its clear and satisfactory, you can also accept the answer, which will close the thread.
Answer: Abhishek Thakkar's answer gives good reasoning why you might prefer "Active Plan" or "Current Plan" over "Your Plan" (principally the problems of talking of "Your Plan" in help text). I'll try to provide some other points to consider, although because you give very little context in your question, these are somewhat speculative.

Competitive Market with "Fickle" Users
In the UK at least, the "energy market" (suppliers of gas and electricity) is very competitive, with suppliers constantly vying to get consumers to switch their plans. One particularly common phrase is "Who is your current supplier". If you're in such a market, using "Current Plan" may invoke thoughts of non-permanence; that both the plan and the supplier of that plan can be changed at will. I feel "Active Plan" (or "Your Plan" or "My Plan") carry fewer such connotations.
To a lesser degree, banks and mobile-providers also try to get consumers to switch to their offerings, so the same may apply.

If you're not in such a cut-throat market – you are less afraid of the user switching to an alternative provider but more concerned about the particular plan of yours that they have chosen – then it depends somewhat on the nature of the plans and how easy/often it is for the user to switch between them.

Selecting Between Alternate Price/Benefit Plans
If your product offers graduated plans (e.g. "Basic", "Advanced" and "Premium"), where (generally) each subsequent plan costs more but offers more benefits to the user, then I'd probably favour "Current Plan". Typically, users will select the level that suits them best when they first sign-up and often stay on that plan for an extended period. (Reasons for changing include realising they need more features or starting with a low-cost entry point until they're happy with your service at which point they may upgrade).
In such circumstances, I'd probably favour "Current Plan" over "Active Plan" (see next point for some reasons).
Selecting Between Multiple Plans/Profiles
One of my interpretations of "Active Plan" is in contrast to "Inactive Plan(s)". That is, where a user might have multiple plans or profiles configured at the same time, and they can switch which one is "Active" at any given time. If this is the sort of situation you are in, then "Active Plan" would be the ideal choice.

I realise this last connotation may be peculiar to me (coming from quite a technical background), and may not have the same effect for everyone. Which brings me to my last point:
The Importance of A/B Testing
All the advice you get from here (or elsewhere) can only be general in nature. You have a specific product, with specific users. The only way to truly work out what is best for you and your users is to carry out A/B Testing where you present some users with one label (e.g. "Your Plan") and other users with another (e.g. "Current Plan") and see which "works best" for the greatest number (either through analysis of their on-site behaviour [how and where they click] and/or through a survey/questionnaire of their reactions).
Comment: Both information @Abhishek Thakkar and you have given are helpful... In my case, I am working on multiple plans that can be changed anytime, not the graduated plans.


What does "past exam papers were not made available for the multiple choice examination" mean?

Question: What does "past exam papers were not made available for the multiple choice examination" mean? Does it mean the past exam paper will not be on this exam and it is not worth looking at it? Or the past exam result will not be taken into account for this coming exam?
Answer: It means neither of these things.
To 'make something available' is to provide access to it so that you can use it. In many institutions the texts of previous examinations are made available for students to review so that they will have some idea of what sort of questions are asked and will know what they need to study.
In this case it appears that although other parts of old exams (short-answer and essay questions) were made available for students, the old multiple-choice exams were not--probably because designing a good multiple-choice exam is very time-consuming and the examiners didn't want to have to write an entire new set of questions and answers for the current exams.


My Baba Ghanoush is too watery

Question: I tried cooking Baba Ghanoush for the first time and though tasty I didn't quite get the expected results.
It was watery instead of creamy like the ones I had had.
I used equal parts of eggplant and tahini and a bit of lemon juice and garlic.
Now I wonder if I used too much eggplant or I didn't cook the eggplant enough as it was like a sponge full of water when I cut it.
How much time and at which temperature should I bake the eggplant? Or is there some external sign to know it's ready to be used for Baba ganoush? To me it looked and tasted "well done" as it was.
Comment: Did you roast the eggplant?
Answer: Sounds like you didn't roast sufficiently or not sufficiently hot. The outside should be really charred, and the inside will be not so watery.
Comment: Thanks for the advice! I will try baking it more next time.
Comment: It's definitely that.  Eggplants have a ton of water in them.
Answer: I slice my aubergines in half lengthwise and prick both the skin and cut sides many times with a knife.  Then grill them on a slightly oiled baking sheet, turning them over half way through.  The slashes let more of the juices out.  The skin should be very black and you can scoop the flesh away from the skin with a teaspoon.
Answer: I leave my eggplant whole but prick it all over. I then roast it for about 55 minutes on 170 degrees c. You should turn it over about half way through the cooking process. Once cooked, you can remove the skin. As the previous writers said, the skin should be very black and wrinkly. Another alternative is to cook the eggplant on a BBQ grill (reduce the cooking time slightly) although this is only best if you have a lid. This will give the eggplant a smokier taste.
I haven't added tahini before, as I tend to make a Persian version where I combine the eggplant with Greek Yoghurt, salt and a couple of cloves of crushed garlic. The ratio is about 1.5 cups of cooked eggplant to 500ml yoghurt but this depends on your taste.
Comment: Thanks for the tips and I am looking forward to try the Persian version!
Answer: When you say that you added tahina, was that a prepared tahina or straight sesame paste?
The paste will set-up even a very watery aubergine (why pour off any juice?).

My Baba Ghanoush is too watery


94 photos and 463 MB

Question: I have an iPhone 4s 16 GB. I realized my photos took up a lot of space so I put most of them on my USB drive. I only kept 94 of them on my phone. But they still take up 463 MB of data. I looked at each photo on my laptop and they all took up between 100 and 600 KB each. There's ONE photo that takes up 3 MB but that's it. The rest are only a few hundred KB. I tried using that Phonecleaner thing and it did nothing. Also restarting my phone. Plus I have nothing saved to icloud or any shared photos or anything synced from my computer (I've never even signed into iCloud. EVER.). Just my normal album. 94 photos. Is there a reason why it's taking up so much storage space with so little photos?
Answer: Are there any photos in your "Recently Deleted" album? These still count towards your photos storage.
Try signing into iCloud and uploading the photos to iCloud Photo Library (enable at Settings > iCloud > Photos). The size of your iCloud Photo Library (Settings > iCloud > Manage Storage) should represent the size of the photos on your phone.
Some people have suggested performing a hard shut down (hold Power and Home buttons for 5 seconds until screen goes black) to reset Storage usage info.
Comment: I always clear out my recently deleted, even if I only deleted a single photo. And like I said, i've done the shut down thing. Plus, like I said, I already saw the size of the photos.

Unless you mean put the photos in iCloud. Though does that free up space on my phone? I've never used it so I don't know.
Comment: Okay... Now I deleted ALL OF MY PHOTOS and put them on my USB. but it still says that Photos and videos take up 426 MB. and I reset the phone as well... So... what do I do now?

94 photos and 463 MB


Joomla Search Engine Friendly URLs issue on IIS7

Question: I have Joomla 1.5.9 running with php 5.2.8, mySQL 5.1.31 on IIS7 on a vista 64 dev box. I have both SEO Settings "Search Engine Friendly URLs" and "Use Apache mod_rewrite" working correctly.
I'm also setting up a hosted site (with www.mochahosting.com). They use slightly older versions of the same software: Joomla 1.5.5, php 5.2.6, mySQL 5.0.4x. They also use IIS7, but running on Windows 32.
I can't get either of the SEO settings to work on the hosted site (I have gotten the SEO settings to work on my local machine, with pretty much the same configuration). Let's start with "Search Engine Friendly URLs" only to keep things simple.
Also, I don't yet have a domain name, so I use a hosts file alias to get to the site. I don't expect anyone to go through that trouble to answer my question, so I'll just describe the issue and hope I do a good enough job that people can understand what's going on. I'll use http://nodomainyet.com/joomla156_mx as the base URL (i.e., the joomla home page) for the purpose of this question. Yes, this does imply that Joomla is installed in a subdirectory -- I'm not sure if this is a problem or not (it's not a problem on my dev box).
On to the problem.
Turning on "Search Engine Friendly URLs" causes http://nodomainyet.com/joomla156_mx to generate a 404 ("Component not found"). In the 404 error page there is a link that goes to  http://nodomainyet.com/joomla156_mx/index.php -- and that link works. If I turn off "Search Engine Friendly URLs" then both http://nodomainyet.com/joomla156_mx and http://nodomainyet.com/joomla156_mx/index.php work. So it seems that turning on "Search Engine Friendly URLs" causes the "automatic redirecting" of http://nodomainyet.com/joomla156_mx to http://nodomainyet.com/joomla156_mx/index.php to stop working...
Now, if I go to http://nodomainyet.com/joomla156_mx/index.php and from there navigate to the various main menu links (I'm only using the default joomla site that gets installed with a new Joomla instance), then everything works fine. It's just going to http://nodomainyet.com/joomla156_mx that doesn't work. It's worth noting that the "home" link that's in the main menu goes to http://nodomainyet.com/joomla156_mx by default.
I've compared the output of phpinfo on the host to that of my dev box and couldn't see any differences that would cause this issue...
Turning on the second SEO setting -- "Use Apache mod_rewrite" -- does not solve the problem (one would think that it might, since the purpose of that setting is to get rid of index.php in the URL).
The "Search Engine Friendly URLs" usually seems pretty trivial to get to work -- it doesn't require a web.config and rewrite rules... I'm not sure what could possibly cause it to go wrong.

Update - 2009-03-03
I thought maybe it was a bad idea to only turn on the first SEO setting ("Search Engine Friendly URLs") from ("Use Apache mod_rewrite") (even though I can just turn on "Search Engine Friendly URLs" by itself on my local machine and it works fine). So I tried a few more experiments
I thought perhaps the problem was that URL rewriting wasn't setup properly in IIS7 on the host. I did the (first) test file described in http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module and that worked -- so that means URL rewriting is working.
Then I thought perhaps the problem is that the rewrite rules that one sees everywhere for Joomla on IIS7 need to be rewritten to take into account the subdirectory. Like I said above, the SEO settings are working fine on my local machine. Joomla is also installed in a subdirectory, and everything is working fine. Nevertheless, I tried to modify the rewrite rule from
<rewrite>
    <rules>
        <rule name="Imported Rule 1" enabled="true">
            <match url="(.*)" ignoreCase="false" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
                <add input="{SCRIPT_NAME}" negate="true" pattern="^/index.php" ignoreCase="false" />
                <add input="{SCRIPT_NAME}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
            </conditions>
            <action type="Rewrite" url="index.php" />
        </rule>
    </rules>
</rewrite>

to
<rewrite>
    <rules>
        <rule name="Imported Rule 1" enabled="true">
            <match url="(.*)" ignoreCase="false" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
                <add input="{SCRIPT_NAME}" negate="true" pattern="^/joomla156mx/index.php" ignoreCase="false" />
                <add input="{SCRIPT_NAME}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
            </conditions>
            <action type="Rewrite" url="joomla156mx/index.php" />
        </rule>
    </rules>
</rewrite>

(i.e., prepending the directory name to the condition and action). That didn't make a difference. Now, I'm completely new to rewrite rules so I might have screwed up something.
I guess I find it kind of suspicious that there is no redirect rule; meaning if I copy & paste a 're-written' URL, does't something have to tell the server that is a made-up URL, and it should be redirected to a real URL? But, again, this is all working fine on my local box with plain old rewrite rules, so I may be barking at the wrong tree.
Thanks for the help!
Answer: The last steps on this page walk through Enabling Search Engine Friendly URLs.

By default Joomla uses query string
  parameters for all the links URLs it
  generates for your web site. This
  behavior can be changed by enabling
  what is called "Search Engine Friendly
  URLs" in Joomla. However, this feature
  relies on the URL rewriting
  functionality to be available on the
  web server. IIS 6.0 does not have URL
  rewriting capabilities, so you could
  use one of the third party URL
  rewriting products, such as
  ISAPI_Rewrite or Ionics ISAPI Rewrite
  Filter. IIS 7.0 has URL rewriting
  support, which can be enabled by
  installing Microsoft URL Rewrite
  Module for IIS 7.0. The following
  instructions describe how URL Rewrite
  Module for IIS 7.0 can be used to
  enable Clean URLs in Joomla.
  First, you will need to download and install Microsoft URL Rewrite Module. Once it has been installed, create and open a web.config file located in C:\inetpub\wwwroot\Joomla folder. Paste the following XML code into this file.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Security Rule" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
            <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
            <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
          </conditions>
          <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
        </rule>
        <rule name="SEO Rule">
          <match url="(.*)" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
            <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
            <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
 </system.webServer>
</configuration>

Save the web.config file and then open web browser and logon to the Joomla administrator console at http://localhost/joomla/administrator/ . Once logged on, go to Site --> Global Configuration menu configure SEO settings as below:
Search Engine Friendly URLs - Yes
Use Apache mod_rewrite - Yes
Add suffix to URLs - No
Save configuration by clicking on "Apply" and then browse to http://localhost/joomla/ . You will see that now all links in Joomla pages have URLs without query string parameters and if you click on any of these links the server will return correct response:
Comment: Thanks for the answer. However, I've already followed similar instructions on both my local machine and on the hosted site; it's working on my local machine but not the hosted site... So I need a bit more details on how to diagnose this on the hosted site.
Answer: It turns out the problem was that the hosting company wasn't using FastCGI to run php. Even if it says "Server API = CGI/FastCGI" when running phpinfo(), that is NOT ENOUGH to guarantee that fastcgi is being used.
What's wrong with using CGI or ISAPI? They both have issues with the php variable _SERVER["REQUEST_URI"] , which joomla SEO uses.
See my other question for how to figure out for sure if FastCGI is being used or not: How to know for sure if FastCGI is being used to run php scripts
Answer: I have a website www.carooolglobal.com, all the features work fine with all the SEO setting set to No.
If i set any of the SEO settings to Yes, and perform a search from search form left side on home page, it is showing the results on index.php properly.but when i click on the name link from the search result, it should open the profile of the person in pop up window, but pop window shows
You may not be able to visit this page because of:
an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.
Please try one of the following pages:
Home Page
If difficulties persist, please contact the System Administrator of this site.
I am clueless
Regards
Kislay
Answer: I'm not sure if this was covered yet, I looked but I'm good a missing things.
If you're have problems with your search engine friendly links, go into your folder where joomla is installed, and rename your htaccess.txt file to .htaccess
This should solve the 404 problem.
Comment: `.htaccess` is not used by IIS7


Magento 2 Default category shows on menu even though I have "Include in Menu" disabled

Question: Ever since I did a setup:upgrade I've been having some issues with the Admin not doing what it's supposed to do, particularly on the Catalog > Categories section.

As you can see, on the backend I'm not including it on the menu.

But it still shows up regardless.
I'm able to remove the other categories (although sometimes, for some reason, all of them except Default get removed and it's hard to get them back) but no matter what I do the Default category won't go away.
Answer: please also set Anchor to No as per below image.