text:
NAME

  brew - The missing package manager for macOS

SYNOPSIS

brew --version

brew <var>command</var> [--verbose|-v] [<var>options</var>] [<var>formula</var>] ...

DESCRIPTION

Homebrew is the easiest and most flexible way to install the UNIX tools Apple
didn't include with macOS.

ESSENTIAL COMMANDS

For the full command list, see the COMMANDS section.

With --verbose or -v, many commands print extra debugging information. Note that these flags should only appear after a command.

install <var>formula</var>

Install <var>formula</var>.

uninstall <var>formula</var>

Uninstall <var>formula</var>.

update

Fetch the newest version of Homebrew from GitHub using git(1).

list

List all installed formulae.

search (<var>text</var>|/<var>text</var>/)

Perform a substring search of formula names for <var>text</var>. If <var>text</var> is
surrounded with slashes, then it is interpreted as a regular expression.
The search for <var>text</var> is extended online to some popular taps.
If no search term is given, all locally available formulae are listed.

COMMANDS

analytics [state]

Display anonymous user behaviour analytics state.
Read more at http://docs.brew.sh/Analytics.html.

analytics (on|off)

Turn on/off Homebrew's analytics.

analytics regenerate-uuid

Regenerate UUID used in Homebrew's analytics.

cat <var>formula</var>

Display the source to <var>formula</var>.

cleanup [--prune=<var>days</var>] [--dry-run] [-s] [<var>formulae</var>]

For all installed or specific formulae, remove any older versions from the
cellar. In addition, old downloads from the Homebrew download-cache are deleted.

If --prune=<var>days</var> is specified, remove all cache files older than <var>days</var>.

If --dry-run or -n is passed, show what would be removed, but do not
actually remove anything.

If -s is passed, scrub the cache, removing downloads for even the latest
versions of formulae. Note downloads for any installed formulae will still not be
deleted. If you want to delete those too: rm -rf $(brew --cache)

command <var>cmd</var>

Display the path to the file which is used when invoking brew <var>cmd</var>.

commands [--quiet [--include-aliases]]

Show a list of built-in and external commands.

If --quiet is passed, list only the names of commands without the header.
With --include-aliases, the aliases of internal commands will be included.

config

Show Homebrew and system configuration useful for debugging. If you file
a bug report, you will likely be asked for this information if you do not
provide it.

deps [--1] [-n] [--union] [--full-name] [--installed] [--include-build] [--include-optional] [--skip-recommended] <var>formulae</var>

Show dependencies for <var>formulae</var>. When given multiple formula arguments,
show the intersection of dependencies for <var>formulae</var>.

If --1 is passed, only show dependencies one level down, instead of
recursing.

If -n is passed, show dependencies in topological order.

If --union is passed, show the union of dependencies for <var>formulae</var>,
instead of the intersection.

If --full-name is passed, list dependencies by their full name.

If --installed is passed, only list those dependencies that are
currently installed.

By default, deps shows required and recommended dependencies for
<var>formulae</var>. To include the :build type dependencies, pass --include-build.
Similarly, pass --include-optional to include :optional dependencies.
To skip :recommended type dependencies, pass --skip-recommended.

deps --tree [<var>filters</var>] (<var>formulae</var>|--installed)

Show dependencies as a tree. When given multiple formula arguments, output
individual trees for every formula.

If --installed is passed, output a tree for every installed formula.

The <var>filters</var> placeholder is any combination of options --include-build,
--include-optional, and --skip-recommended as documented above.

deps [<var>filters</var>] (--installed|--all)

Show dependencies for installed or all available formulae. Every line of
output starts with the formula name, followed by a colon and all direct
dependencies of that formula.

The <var>filters</var> placeholder is any combination of options --include-build,
--include-optional, and --skip-recommended as documented above.

desc <var>formula</var>

Display <var>formula</var>'s name and one-line description.

desc [-s|-n|-d] (<var>text</var>|/<var>text</var>/)

Search both name and description (-s), just the names (-n), or just  the
descriptions (-d) for <var>text</var>. If <var>text</var> is flanked by slashes, it is interpreted
as a regular expression. Formula descriptions are cached; the cache is created on
the first search, making that search slower than subsequent ones.

diy [--name=<var>name</var>] [--version=<var>version</var>]

Automatically determine the installation prefix for non-Homebrew software.

Using the output from this command, you can install your own software into
the Cellar and then link it into Homebrew's prefix with brew link.

The options --name=<var>name</var> and --version=<var>version</var> each take an argument
and allow you to explicitly set the name and version of the package you are
installing.

doctor

Check your system for potential problems. Doctor exits with a non-zero status
if any problems are found.

fetch [--force] [--retry] [-v] [--devel|--HEAD] [--deps] [--build-from-source|--force-bottle] <var>formulae</var>

Download the source packages for the given <var>formulae</var>.
For tarballs, also print SHA-256 checksums.

If --HEAD or --devel is passed, fetch that version instead of the
stable version.

If -v is passed, do a verbose VCS checkout, if the URL represents a VCS.
This is useful for seeing if an existing VCS cache has been updated.

If --force is passed, remove a previously cached version and re-fetch.

If --retry is passed, retry if a download fails or re-download if the
checksum of a previously cached version no longer matches.

If --deps is passed, also download dependencies for any listed <var>formulae</var>.

If --build-from-source is passed, download the source rather than a
bottle.

If --force-bottle is passed, download a bottle if it exists for the
current or newest version of macOS, even if it would not be used during
installation.

gist-logs [--new-issue|-n] <var>formula</var>

Upload logs for a failed build of <var>formula</var> to a new Gist.

<var>formula</var> is usually the name of the formula to install, but it can be specified
in several different ways. See SPECIFYING FORMULAE.

If --new-issue is passed, automatically create a new issue in the appropriate
GitHub repository as well as creating the Gist.

If no logs are found, an error message is presented.

home

Open Homebrew's own homepage in a browser.

home <var>formula</var>

Open <var>formula</var>'s homepage in a browser.

info <var>formula</var>

Display information about <var>formula</var>.

info --github <var>formula</var>

Open a browser to the GitHub History page for formula <var>formula</var>.

To view formula history locally: brew log -p <formula>

info --json=<var>version</var> (--all|--installed|<var>formulae</var>)

Print a JSON representation of <var>formulae</var>. Currently the only accepted value
for <var>version</var> is v1.

Pass --all to get information on all formulae, or --installed to get
information on all installed formulae.

See the docs for examples of using the JSON output:
http://docs.brew.sh/Querying-Brew.html

install [--debug] [--env=(std|super)] [--ignore-dependencies|--only-dependencies] [--cc=<var>compiler</var>] [--build-from-source|--force-bottle] [--devel|--HEAD] [--keep-tmp] [--build-bottle] <var>formula</var>

Install <var>formula</var>.

<var>formula</var> is usually the name of the formula to install, but it can be specified
in several different ways. See SPECIFYING FORMULAE.

If --debug is passed and brewing fails, open an interactive debugging
session with access to IRB or a shell inside the temporary build directory.

If --env=std is passed, use the standard build environment instead of superenv.

If --env=super is passed, use superenv even if the formula specifies the
standard build environment.

If --ignore-dependencies is passed, skip installing any dependencies of
any kind. If they are not already present, the formula will probably fail
to install.

If --only-dependencies is passed, install the dependencies with specified
options but do not install the specified formula.

If --cc=<var>compiler</var> is passed, attempt to compile using <var>compiler</var>.
<var>compiler</var> should be the name of the compiler's executable, for instance
gcc-4.2 for Apple's GCC 4.2, or gcc-4.9 for a Homebrew-provided GCC
4.9.

If --build-from-source or -s is passed, compile the specified <var>formula</var> from
source even if a bottle is provided. Dependencies will still be installed
from bottles if they are available.

If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether --build-from-source was
passed, then both <var>formula</var> and the dependencies installed as part of this process
are built from source even if bottles are available.

If --force-bottle is passed, install from a bottle if it exists for the
current or newest version of macOS, even if it would not normally be used
for installation.

If --devel is passed, and <var>formula</var> defines it, install the development version.

If --HEAD is passed, and <var>formula</var> defines it, install the HEAD version,
aka master, trunk, unstable.

If --keep-tmp is passed, the temporary files created during installation
are not deleted.

If --build-bottle is passed, prepare the formula for eventual bottling
during installation.

install --interactive [--git] <var>formula</var>

Download and patch <var>formula</var>, then open a shell. This allows the user to
run ./configure --help and otherwise determine how to turn the software
package into a Homebrew formula.

If --git is passed, Homebrew will create a Git repository, useful for
creating patches to the software.

irb [--examples]

Enter the interactive Homebrew Ruby shell.

If --examples is passed, several examples will be shown.

leaves

Show installed formulae that are not dependencies of another installed formula.

ln, link [--overwrite] [--dry-run] [--force] <var>formula</var>

Symlink all of <var>formula</var>'s installed files into the Homebrew prefix. This
is done automatically when you install formulae but can be useful for DIY
installations.

If --overwrite is passed, Homebrew will delete files which already exist in
the prefix while linking.

If --dry-run or -n is passed, Homebrew will list all files which would
be linked or which would be deleted by brew link --overwrite, but will not
actually link or delete any files.

If --force is passed, Homebrew will allow keg-only formulae to be linked.

linkapps [--local] [<var>formulae</var>]

Find installed formulae that provide .app-style macOS apps and symlink them
into /Applications, allowing for easier access (deprecated).

Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" .app
bundles that can be relocated. Instead, please consider using brew cask and
migrate formulae using .apps to casks.

If no <var>formulae</var> are provided, all of them will have their apps symlinked.

If provided, --local will symlink them into the user's ~/Applications
directory instead of the system directory.

list, ls [--full-name]

List all installed formulae. If --full-name is passed, print formulae
with fully-qualified names. If --full-name is not passed, any other
options (e.g. -t) are passed to ls which produces the actual output.

list, ls --unbrewed

List all files in the Homebrew prefix not installed by Homebrew.

list, ls [--versions [--multiple]] [--pinned] [<var>formulae</var>]

List the installed files for <var>formulae</var>. Combined with --verbose, recursively
list the contents of all subdirectories in each <var>formula</var>'s keg.

If --versions is passed, show the version number for installed formulae,
or only the specified formulae if <var>formulae</var> are given. With --multiple,
only show formulae with multiple versions installed.

If --pinned is passed, show the versions of pinned formulae, or only the
specified (pinned) formulae if <var>formulae</var> are given.
See also pin, unpin.

log [<var>git-log-options</var>] <var>formula</var> ...

Show the git log for the given formulae. Options that git-log(1)
recognizes can be passed before the formula list.

migrate [--force] <var>formulae</var>

Migrate renamed packages to new name, where <var>formulae</var> are old names of
packages.

If --force is passed, then treat installed <var>formulae</var> and passed <var>formulae</var>
like if they are from same taps and migrate them anyway.

missing [--hide=<var>hidden</var>] [<var>formulae</var>]

Check the given <var>formulae</var> for missing dependencies. If no <var>formulae</var> are
given, check all installed brews.

If --hide=<var>hidden</var> is passed, act as if none of <var>hidden</var> are installed.
<var>hidden</var> should be a comma-separated list of formulae.

options [--compact] (--all|--installed|<var>formulae</var>)

Display install options specific to <var>formulae</var>.

If --compact is passed, show all options on a single line separated by
spaces.

If --all is passed, show options for all formulae.

If --installed is passed, show options for all installed formulae.

outdated [--quiet|--verbose|--json=<var>version</var>] [--fetch-HEAD]

Show formulae that have an updated version available.

By default, version information is displayed in interactive shells, and
suppressed otherwise.

If --quiet is passed, list only the names of outdated brews (takes
precedence over --verbose).

If --verbose is passed, display detailed version information.

If --json=<var>version</var> is passed, the output will be in JSON format. The only
valid version is v1.

If --fetch-HEAD is passed, fetch the upstream repository to detect if
the HEAD installation of the formula is outdated. Otherwise, the
repository's HEAD will be checked for updates when a new stable or devel
version has been released.

pin <var>formulae</var>

Pin the specified <var>formulae</var>, preventing them from being upgraded when
issuing the brew upgrade command. See also unpin.

postinstall <var>formula</var>

Rerun the post-install steps for <var>formula</var>.

prune [--dry-run]

Remove dead symlinks from the Homebrew prefix. This is generally not
needed, but can be useful when doing DIY installations. Also remove broken
app symlinks from /Applications and ~/Applications that were previously
created by brew linkapps.

If --dry-run or -n is passed, show what would be removed, but do not
actually remove anything.

reinstall <var>formula</var>

Uninstall and then install <var>formula</var>.

search, -S

Display all locally available formulae for brewing (including tapped ones).
No online search is performed if called without arguments.

search [--desc] (<var>text</var>|/<var>text</var>/)

Perform a substring search of formula names for <var>text</var>. If <var>text</var> is
surrounded with slashes, then it is interpreted as a regular expression.
The search for <var>text</var> is extended online to some popular taps.

If --desc is passed, browse available packages matching <var>text</var> including a
description for each.

search (--debian|--fedora|--fink|--macports|--opensuse|--ubuntu) <var>text</var>

Search for <var>text</var> in the given package manager's list.

sh [--env=std]

Start a Homebrew build environment shell. Uses our years-battle-hardened
Homebrew build logic to help your ./configure && make && make install
or even your gem install succeed. Especially handy if you run Homebrew
in an Xcode-only configuration since it adds tools like make to your PATH
which otherwise build systems would not find.

If --env=std is passed, use the standard PATH instead of superenv's.

style [--fix] [--display-cop-names] [<var>files</var>|<var>taps</var>|<var>formulae</var>]

Check formulae or files for conformance to Homebrew style guidelines.

<var>formulae</var> and <var>files</var> may not be combined. If both are omitted, style will run
style checks on the whole Homebrew Library, including core code and all
formulae.

If --fix is passed, style violations will be automatically fixed using
RuboCop's --auto-correct feature.

If --display-cop-names is passed, the RuboCop cop name for each violation
is included in the output.

Exits with a non-zero status if any style violations are found.

switch <var>name</var> <var>version</var>

Symlink all of the specific <var>version</var> of <var>name</var>'s install to Homebrew prefix.

tap

List all installed taps.

tap [--full] <var>user</var>/<var>repo</var> [<var>URL</var>]

Tap a formula repository.

With <var>URL</var> unspecified, taps a formula repository from GitHub using HTTPS.
Since so many taps are hosted on GitHub, this command is a shortcut for
tap <user>/<repo> https://github.com/<user>/homebrew-<repo>.

With <var>URL</var> specified, taps a formula repository from anywhere, using
any transport protocol that git handles. The one-argument form of tap
simplifies but also limits. This two-argument command makes no
assumptions, so taps can be cloned from places other than GitHub and
using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC.

By default, the repository is cloned as a shallow copy (--depth=1), but
if --full is passed, a full clone will be used. To convert a shallow copy
to a full copy, you can retap passing --full without first untapping.

tap is re-runnable and exits successfully if there's nothing to do.
However, retapping with a different <var>URL</var> will cause an exception, so first
untap if you need to modify the <var>URL</var>.

tap --repair

Migrate tapped formulae from symlink-based to directory-based structure.

tap --list-official

List all official taps.

tap --list-pinned

List all pinned taps.

tap-info

Display a brief summary of all installed taps.

tap-info (--installed|<var>taps</var>)

Display detailed information about one or more <var>taps</var>.

Pass --installed to display information on all installed taps.

tap-info --json=<var>version</var> (--installed|<var>taps</var>)

Print a JSON representation of <var>taps</var>. Currently the only accepted value
for <var>version</var> is v1.

Pass --installed to get information on installed taps.

See the docs for examples of using the JSON output:
http://docs.brew.sh/Querying-Brew.html

tap-pin <var>tap</var>

Pin <var>tap</var>, prioritizing its formulae over core when formula names are supplied
by the user. See also tap-unpin.

tap-unpin <var>tap</var>

Unpin <var>tap</var> so its formulae are no longer prioritized. See also tap-pin.

uninstall, rm, remove [--force] [--ignore-dependencies] <var>formula</var>

Uninstall <var>formula</var>.

If --force is passed, and there are multiple versions of <var>formula</var>
installed, delete all installed versions.

If --ignore-dependencies is passed, uninstalling won't fail, even if
formulae depending on <var>formula</var> would still be installed.

unlink [--dry-run] <var>formula</var>

Remove symlinks for <var>formula</var> from the Homebrew prefix. This can be useful
for temporarily disabling a formula:
brew unlink <formula> && <commands> && brew link <formula>

If --dry-run or -n is passed, Homebrew will list all files which would
be unlinked, but will not actually unlink or delete any files.

unlinkapps [--local] [--dry-run] [<var>formulae</var>]

Remove symlinks created by brew linkapps from /Applications (deprecated).

Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" .app
bundles that can be relocated. Instead, please consider using brew cask and
migrate formulae using .apps to casks.

If no <var>formulae</var> are provided, all linked apps will be removed.

If provided, --local will remove symlinks from the user's ~/Applications
directory instead of the system directory.

If --dry-run or -n is passed, Homebrew will list all symlinks which
would be removed, but will not actually delete any files.

unpack [--git|--patch] [--destdir=<var>path</var>] <var>formulae</var>

Unpack the source files for <var>formulae</var> into subdirectories of the current
working directory. If --destdir=<var>path</var> is given, the subdirectories will
be created in the directory named by <var>path</var> instead.

If --patch is passed, patches for <var>formulae</var> will be applied to the
unpacked source.

If --git is passed, a Git repository will be initialized in the unpacked
source. This is useful for creating patches for the software.

unpin <var>formulae</var>

Unpin <var>formulae</var>, allowing them to be upgraded by brew upgrade. See also
pin.

untap <var>tap</var>

Remove a tapped repository.

update [--merge] [--force]

Fetch the newest version of Homebrew and all formulae from GitHub using
git(1) and perform any necessary migrations.

If --merge is specified then git merge is used to include updates
(rather than git rebase).

If --force is specified then always do a slower, full update check even
if unnecessary.

upgrade [<var>install-options</var>] [--cleanup] [--fetch-HEAD] [<var>formulae</var>]

Upgrade outdated, unpinned brews.

Options for the install command are also valid here.

If --cleanup is specified then remove previously installed <var>formula</var> version(s).

If --fetch-HEAD is passed, fetch the upstream repository to detect if
the HEAD installation of the formula is outdated. Otherwise, the
repository's HEAD will be checked for updates when a new stable or devel
version has been released.

If <var>formulae</var> are given, upgrade only the specified brews (but do so even
if they are pinned; see pin, unpin).

uses [--installed] [--recursive] [--include-build] [--include-optional] [--skip-recommended] [--devel|--HEAD] <var>formulae</var>

Show the formulae that specify <var>formulae</var> as a dependency. When given
multiple formula arguments, show the intersection of formulae that use
<var>formulae</var>.

Use --recursive to resolve more than one level of dependencies.

If --installed is passed, only list installed formulae.

By default, uses shows all formulae that specify <var>formulae</var> as a required
or recommended dependency. To include the :build type dependencies, pass
--include-build. Similarly, pass --include-optional to include :optional
dependencies. To skip :recommended type dependencies, pass --skip-recommended.

By default, uses shows usages of <var>formulae</var> by stable builds. To find
cases where <var>formulae</var> is used by development or HEAD build, pass
--devel or --HEAD.

--cache

Display Homebrew's download cache. See also HOMEBREW_CACHE.

--cache <var>formula</var>

Display the file or directory used to cache <var>formula</var>.

--cellar

Display Homebrew's Cellar path. Default: $(brew --prefix)/Cellar, or if
that directory doesn't exist, $(brew --repository)/Cellar.

--cellar <var>formula</var>

Display the location in the cellar where <var>formula</var> would be installed,
without any sort of versioned directory as the last path.

--env

Show a summary of the Homebrew build environment.

--prefix

Display Homebrew's install path. Default: /usr/local

--prefix <var>formula</var>

Display the location in the cellar where <var>formula</var> is or would be installed.

--repository

Display where Homebrew's .git directory is located. For standard installs,
the prefix and repository are the same directory.

--repository <var>user</var>/<var>repo</var>

Display where tap <var>user</var>/<var>repo</var>'s directory is located.

--version

Print the version number of Homebrew to standard output and exit.

DEVELOPER COMMANDS

audit [--strict] [--fix] [--online] [--new-formula] [--display-cop-names] [--display-filename] [<var>formulae</var>]

Check <var>formulae</var> for Homebrew coding style violations. This should be
run before submitting a new formula.

If no <var>formulae</var> are provided, all of them are checked.

If --strict is passed, additional checks are run, including RuboCop
style checks.

If --fix is passed, style violations will be
automatically fixed using RuboCop's --auto-correct feature.

If --online is passed, additional slower checks that require a network
connection are run.

If --new-formula is passed, various additional checks are run that check
if a new formula is eligible for Homebrew. This should be used when creating
new formulae and implies --strict and --online.

If --display-cop-names is passed, the RuboCop cop name for each violation
is included in the output.

If --display-filename is passed, every line of output is prefixed with the
name of the file or formula being audited, to make the output easy to grep.

audit exits with a non-zero status if any errors are found. This is useful,
for instance, for implementing pre-commit hooks.

bottle [--verbose] [--no-rebuild|--keep-old] [--skip-relocation] [--root-url=<var>URL</var>] [--force-core-tap] <var>formulae</var>

Generate a bottle (binary package) from a formula installed with
--build-bottle.

If the formula specifies a rebuild version, it will be incremented in the
generated DSL. Passing --keep-old will attempt to keep it at its
original value, while --no-rebuild will remove it.

If --verbose is passed, print the bottling commands and any warnings
encountered.

If --skip-relocation is passed, do not check if the bottle can be marked
as relocatable.

If --root-url is passed, use the specified <var>URL</var> as the root of the
bottle's URL instead of Homebrew's default.

If --force-core-tap is passed, build a bottle even if <var>formula</var> is not
in homebrew/core or any installed taps.

bottle --merge [--keep-old] [--write [--no-commit]] <var>formulae</var>

Generate a bottle from a formula and print the new DSL merged into the
existing formula.

If --write is passed, write the changes to the formula file. A new
commit will then be generated unless --no-commit is passed.

bump-formula-pr [--devel] [--dry-run [--write]] [--audit|--strict] [--mirror=<var>URL</var>] [--version=<var>version</var>] [--message=<var>message</var>] (--url=<var>URL</var> --sha256=<var>sha-256</var>|--tag=<var>tag</var> --revision=<var>revision</var>) <var>formula</var>

Creates a pull request to update the formula with a new URL or a new tag.

If a <var>URL</var> is specified, the <var>sha-256</var> checksum of the new download must
also be specified. A best effort to determine the <var>sha-256</var> and <var>formula</var>
name will be made if either or both values are not supplied by the user.

If a <var>tag</var> is specified, the git commit <var>revision</var> corresponding to that
tag must also be specified.

If --devel is passed, bump the development rather than stable version.
The development spec must already exist.

If --dry-run is passed, print what would be done rather than doing it.

If --write is passed along with --dry-run, perform a not-so-dry run
making the expected file modifications but not taking any git actions.

If --audit is passed, run brew audit before opening the PR.

If --strict is passed, run brew audit --strict before opening the PR.

If --mirror=<var>URL</var> is passed, use the value as a mirror URL.

If --version=<var>version</var> is passed, use the value to override the value
parsed from the URL or tag. Note that --version=0 can be used to delete
an existing version override from a formula if it has become redundant.

If --message=<var>message</var> is passed, append <var>message</var> to the default PR
message.

Note that this command cannot be used to transition a formula from a
URL-and-sha256 style specification into a tag-and-revision style
specification, nor vice versa. It must use whichever style specification
the preexisting formula already uses.

create <var>URL</var> [--autotools|--cmake|--meson] [--no-fetch] [--set-name <var>name</var>] [--set-version <var>version</var>] [--tap <var>user</var>/<var>repo</var>]

Generate a formula for the downloadable file at <var>URL</var> and open it in the editor.
Homebrew will attempt to automatically derive the formula name
and version, but if it fails, you'll have to make your own template. The wget
formula serves as a simple example. For the complete API have a look at
http://www.rubydoc.info/github/Homebrew/brew/master/Formula.

If --autotools is passed, create a basic template for an Autotools-style build.
If --cmake is passed, create a basic template for a CMake-style build.
If --meson is passed, create a basic template for a Meson-style build.

If --no-fetch is passed, Homebrew will not download <var>URL</var> to the cache and
will thus not add the SHA256 to the formula for you.

The options --set-name and --set-version each take an argument and allow
you to explicitly set the name and version of the package you are creating.

The option --tap takes a tap as its argument and generates the formula in
the specified tap.

edit

Open all of Homebrew for editing.

edit <var>formula</var>

Open <var>formula</var> in the editor.

formula <var>formula</var>

Display the path where <var>formula</var> is located.

linkage [--test] [--reverse]  <var>formula</var>

Checks the library links of an installed formula.

Only works on installed formulae. An error is raised if it is run on
uninstalled formulae.

If --test is passed, only display missing libraries and exit with a
non-zero exit code if any missing libraries were found.

If --reverse is passed, print the dylib followed by the binaries
which link to it for each library the keg references.

man [--fail-if-changed]

Generate Homebrew's manpages.

If --fail-if-changed is passed, the command will return a failing
status code if changes are detected in the manpage outputs.
This can be used for CI to be notified when the manpages are out of date.
Additionally, the date used in new manpages will match those in the existing
manpages (to allow comparison without factoring in the date).

pull [--bottle] [--bump] [--clean] [--ignore-whitespace] [--resolve] [--branch-okay] [--tap] [--no-pbcopy] [--no-publish] <var>patch-source</var> [<var>patch-source</var>]

Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
Optionally, installs the formulae changed by the patch.

Each <var>patch-source</var> may be one of:

  ~ The ID number of a PR (pull request) in the homebrew/core GitHub
    repository

  ~ The URL of a PR on GitHub, using either the web page or API URL
    formats. In this form, the PR may be on Homebrew/brew,
    Homebrew/homebrew-core or any tap.

  ~ The URL of a commit on GitHub

  ~ A "http://bot.brew.sh/job/..." string specifying a testing job ID

If --bottle is passed, handle bottles, pulling the bottle-update
commit and publishing files on Bintray.

If --bump is passed, for one-formula PRs, automatically reword
commit message to our preferred format.

If --clean is passed, do not rewrite or otherwise modify the
commits found in the pulled PR.

If --ignore-whitespace is passed, silently ignore whitespace
discrepancies when applying diffs.

If --resolve is passed, when a patch fails to apply, leave in
progress and allow user to resolve, instead of aborting.

If --branch-okay is passed, do not warn if pulling to a branch
besides master (useful for testing).

If --tap is passed, use the git repository of the given tap.

If --no-pbcopy is passed, do not copy anything to the system
clipboard.

If --no-publish is passed, do not publish bottles to Bintray.

release-notes [--markdown] [<var>previous_tag</var>] [<var>end_ref</var>]

Output the merged pull requests on Homebrew/brew between two Git refs.
If no <var>previous_tag</var> is provided it defaults to the newest tag.
If no <var>end_ref</var> is provided it defaults to origin/master.

If --markdown is passed, output as a Markdown list.

tap-new <var>user</var>/<var>repo</var>

Generate the template files for a new tap.

test [--devel|--HEAD] [--debug] [--keep-tmp] <var>formula</var>

Most formulae provide a test method. brew test <var>formula</var> runs this
test method. There is no standard output or return code, but it should
generally indicate to the user if something is wrong with the installed
formula.

To test the development or head version of a formula, use --devel or
--HEAD.

If --debug is passed and the test fails, an interactive debugger will be
launched with access to IRB or a shell inside the temporary test directory.

If --keep-tmp is passed, the temporary files created for the test are
not deleted.

Example: brew install jruby && brew test jruby

tests [--verbose] [--coverage] [--generic] [--no-compat] [--only=<var>test_script</var>[:<var>line_number</var>]] [--seed <var>seed</var>] [--online] [--official-cmd-taps]

Run Homebrew's unit and integration tests. If provided,
--only=<var>test_script</var> runs only <var>test_script</var>_spec.rb, and --seed
randomizes tests with the provided value instead of a random seed.

If --verbose is passed, print the command that runs the tests.

If --coverage is passed, also generate code coverage reports.

If --generic is passed, only run OS-agnostic tests.

If --no-compat is passed, do not load the compatibility layer when
running tests.

If --online is passed, include tests that use the GitHub API.

If --official-cmd-taps is passed, include tests that use any of the
taps for official external commands.

update-test [--commit=<var>commit</var>] [--before=<var>date</var>] [--to-tag] [--keep-tmp]

Runs a test of brew update with a new repository clone.

If no arguments are passed, use origin/master as the start commit.

If --commit=<var>commit</var> is passed, use <var>commit</var> as the start commit.

If --before=<var>date</var> is passed, use the commit at <var>date</var> as the
start commit.

If --to-tag is passed, set HOMEBREW_UPDATE_TO_TAG to test updating
between tags.

If --keep-tmp is passed, retain the temporary directory containing
the new repository clone.

OFFICIAL EXTERNAL COMMANDS

bundle

Bundler for non-Ruby dependencies from Homebrew:
https://github.com/Homebrew/homebrew-bundle

cask

Install macOS applications distributed as binaries:
https://github.com/caskroom/homebrew-cask

services

Integrates Homebrew formulae with macOS's launchctl(1) manager:
https://github.com/Homebrew/homebrew-services

CUSTOM EXTERNAL COMMANDS

Homebrew, like git(1), supports external commands. These are executable
scripts that reside somewhere in the PATH, named brew-<var>cmdname</var> or
brew-<var>cmdname</var>.rb, which can be invoked like brew <var>cmdname</var>. This allows you
to create your own commands without modifying Homebrew's internals.

Instructions for creating your own commands can be found in the docs:
http://docs.brew.sh/External-Commands.html

SPECIFYING FORMULAE

Many Homebrew commands accept one or more <var>formula</var> arguments. These arguments
can take several different forms:

The name of a formula

e.g. git, node, wget.

The fully-qualified name of a tapped formula

Sometimes a formula from a tapped repository may conflict with one in
homebrew/core.
You can still access these formulae by using a special syntax, e.g.
homebrew/dupes/vim or homebrew/versions/node4.

An arbitrary URL

Homebrew can install formulae via URL, e.g.
https://raw.github.com/Homebrew/homebrew-core/master/Formula/git.rb.
The formula file will be cached for later use.

ENVIRONMENT

AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY

When using the S3 download strategy, Homebrew will look in
these variables for access credentials (see
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment
to retrieve these access credentials from AWS).  If they are not set,
the S3 download strategy will download with a public
(unsigned) URL.

BROWSER

If set, and HOMEBREW_BROWSER is not, use BROWSER as the web browser
when opening project homepages.

EDITOR

If set, and HOMEBREW_EDITOR and VISUAL are not, use EDITOR as the text editor.

GIT

When using Git, Homebrew will use GIT if set,
a Homebrew-built Git if installed, or the system-provided binary.

Set this to force Homebrew to use a particular git binary.

HOMEBREW_BOTTLE_DOMAIN

If set, instructs Homebrew to use the given URL as a download mirror for bottles.

HOMEBREW_ARTIFACT_DOMAIN

If set, instructs Homebrew to use the given URL as a download mirror for bottles and binaries.

HOMEBREW_AUTO_UPDATE_SECS

If set, Homebrew will only check for autoupdates once per this seconds interval.

Default: 60.

HOMEBREW_BROWSER

If set, uses this setting as the browser when opening project homepages,
instead of the OS default browser.

HOMEBREW_BUILD_FROM_SOURCE

If set, instructs Homebrew to compile from source even when a formula
provides a bottle. This environment variable is intended for use by
Homebrew developers. Please do not file issues if you encounter errors when
using this environment variable.

HOMEBREW_CACHE

If set, instructs Homebrew to use the given directory as the download cache.

Default: ~/Library/Caches/Homebrew.

HOMEBREW_CURL_VERBOSE

If set, Homebrew will pass --verbose when invoking curl(1).

HOMEBREW_DEBUG

If set, any commands that can emit debugging information will do so.

HOMEBREW_DEBUG_INSTALL

When brew install -d or brew install -i drops into a shell,
HOMEBREW_DEBUG_INSTALL will be set to the name of the formula being
brewed.

HOMEBREW_DEBUG_PREFIX

When brew install -d or brew install -i drops into a shell,
HOMEBREW_DEBUG_PREFIX will be set to the target prefix in the Cellar
of the formula being brewed.

HOMEBREW_DEVELOPER

If set, Homebrew will tweak behaviour to be more relevant for Homebrew
developers (active or budding) e.g. turning warnings into errors.

HOMEBREW_EDITOR

If set, Homebrew will use this editor when editing a single formula, or
several formulae in the same directory.

Note: brew edit will open all of Homebrew as discontinuous files and
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.

HOMEBREW_FORCE_VENDOR_RUBY

If set, Homebrew will always use its vendored, relocatable Ruby 2.0 version
even if the system version of Ruby is >=2.0.

HOMEBREW_GITHUB_API_TOKEN

A personal access token for the GitHub API, which you can create at
https://github.com/settings/tokens. If set, GitHub will allow you a
greater number of API requests. See
https://developer.github.com/v3/#rate-limiting for more information.
Homebrew uses the GitHub API for features such as brew search.

Note: Homebrew doesn't require permissions for any of the scopes.

HOMEBREW_LOGS

If set, Homebrew will use the given directory to store log files.

HOMEBREW_MAKE_JOBS

If set, instructs Homebrew to use the value of HOMEBREW_MAKE_JOBS as
the number of parallel jobs to run when building with make(1).

Default: the number of available CPU cores.

HOMEBREW_NO_ANALYTICS

If set, Homebrew will not send analytics. See: http://docs.brew.sh/Analytics.html

HOMEBREW_NO_AUTO_UPDATE

If set, Homebrew will not auto-update before running brew install,
brew upgrade or brew tap.

HOMEBREW_NO_EMOJI

If set, Homebrew will not print the HOMEBREW_INSTALL_BADGE on a
successful build.

Note: Homebrew will only try to print emoji on Lion or newer.

HOMEBREW_NO_INSECURE_REDIRECT

If set, Homebrew will not permit redirects from secure HTTPS
to insecure HTTP.

While ensuring your downloads are fully secure, this is likely
to cause from-source SourceForge, some GNU & GNOME based
formulae to fail to download.

HOMEBREW_NO_GITHUB_API

If set, Homebrew will not use the GitHub API for e.g searches or
fetching relevant issues on a failed install.

HOMEBREW_INSTALL_BADGE

Text printed before the installation summary of each successful build.
Defaults to the beer emoji.

HOMEBREW_SVN

When exporting from Subversion, Homebrew will use HOMEBREW_SVN if set,
a Homebrew-built Subversion if installed, or the system-provided binary.

Set this to force Homebrew to use a particular svn binary.

HOMEBREW_TEMP

If set, instructs Homebrew to use HOMEBREW_TEMP as the temporary directory
for building packages. This may be needed if your system temp directory and
Homebrew Prefix are on different volumes, as macOS has trouble moving
symlinks across volumes when the target does not yet exist.

This issue typically occurs when using FileVault or custom SSD
configurations.

HOMEBREW_VERBOSE

If set, Homebrew always assumes --verbose when running commands.

VISUAL

If set, and HOMEBREW_EDITOR is not, use VISUAL as the text editor.

USING HOMEBREW BEHIND A PROXY

Homebrew uses several commands for downloading files (e.g. curl, git, svn).
Many of these tools can download via a proxy. It's common for these tools
to read proxy parameters from environment variables.

For the majority of cases setting http_proxy is enough. You can set this in
your shell profile, or you can use it before a brew command:

http_proxy=http://<host>:<port> brew install foo

If your proxy requires authentication:

http_proxy=http://<user>:<password>@<host>:<port> brew install foo

SEE ALSO

Homebrew Documentation: https://github.com/Homebrew/brew/blob/master/docs/

brew-cask(1), git(1), git-log(1)

AUTHORS

Homebrew's lead maintainer is Mike McQuaid.

Homebrew's current maintainers are Alyssa Ross, Andrew Janke, Baptiste Fontaine, Alex Dunn, FX Coudert, ilovezfs, Josh Hagins, JCount, Misty De Meo, neutric, Tomasz Pajor, Markus Reiter, Tim Smith, Tom Schoonjans, Uladzislau Shablinski and William Woodruff.

Former maintainers with significant contributions include Xu Cheng, Martin Afanasjew, Dominyk Tiller, Brett Koonce, Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell.

BUGS

See our issues on GitHub:

Homebrew/brew https://github.com/Homebrew/brew/issues

Homebrew/homebrew-core https://github.com/Homebrew/homebrew-core/issues


text:
//
//  CCSAppDelegate.h
//  CCSProject
//
//  Created by xiexu on 13-12-23.
//  Copyright (c) 2013年 Tian Yu CO.,LTD. All rights reserved.
//

#import <UIKit/UIKit.h>
@class CCSViewController;
@class Reachability;
#define APP_DELEGATE ((CCSAppDelegate *)[[UIApplication sharedApplication] delegate])

@interface CCSAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) CCSViewController *m_viewCtrl_root;
/**
 *	@brief	网络判断
 *
 *	判断网络类型
 */
@property(nonatomic,strong)Reachability  *m_reachability_host;
@end

redpajama_set_name: RedPajamaGithub


text:
.btn, input.btn[type="submit"], input.btn[type="button"] {
-moz-border-radius:4px 4px 4px 4px;
background:url("/admin/_images/buttons/bg-btn.gif") repeat-x scroll 0 0 #DDDDDD;
border-color:#DDDDDD #DDDDDD #CCCCCC;
border-style:solid;
border-width:1px;
color:#333333;
cursor:pointer;
font:11px/14px "Lucida Grande",sans-serif;
margin:0;
overflow:visible;
padding:4px 8px 5px;
text-shadow:1px 1px 0 #FFFFFF;
width:auto;
}
.btn::-moz-focus-inner {
border:0 none;
padding:0;
}
.btn-m, input.btn-m[type="submit"], input.btn-m[type="button"] {
-moz-border-radius:5px 5px 5px 5px;
background-position:0 -200px;
font-size:15px;
line-height:20px !important;
padding:5px 15px 6px;
}
.btn-l, input.btn-l[type="submit"], input.btn-l[type="button"] {
-moz-border-radius:6px 6px 6px 6px;
background-position:0 -400px;
font-size:20px;
line-height:26px;
padding:7px 20px 9px;
}
.btn-light {
background-color:#AADDDD !important;
background-image:url("/admin/_images/buttons/bg-btn-light.gif") !important;
border-color:#AADDDD #AADDDD #99CCCC !important;
text-shadow:1px 1px 0 #DDFFFF !important;
}
.btn-dark {
background-color:#5599AA !important;
background-image:url("/admin/_images/buttons/bg-btn-dark.gif") !important;
border-color:#5599AA #5599AA #448899 !important;
color:#FFFFFF !important;
text-shadow:-1px -1px 0 #5599AA !important;
}
.btn-blue {
background-color:#3399DD !important;
background-image:url("/admin/_images/buttons/bg-btn-blue.gif") !important;
border-color:#3399DD #3399DD #2288CC !important;
color:#FFFFFF !important;
font-weight:bold;
text-shadow:-1px -1px 0 #3399DD !important;
}
.btn-chart {
background-color:#99CC22 !important;
background-image:url("/admin/_images/buttons/bg-btn-chart.gif") !important;
border-color:#99CC22 #99CC22 #88BB11 !important;
text-shadow:1px 1px 0 #DDFF66 !important;
}
.btn-mint {
background-color:#BBDDBB !important;
background-image:url("/admin/_images/buttons/bg-btn-mint.gif") !important;
border-color:#BBDDBB #BBDDBB #AACCAA !important;
text-shadow:1px 1px 0 #EEFFEE !important;
}
.btn-green {
background-color:#227722 !important;
background-image:url("/admin/_images/buttons/bg-btn-green.gif") !important;
border-color:#227722 #227722 #116611 !important;
color:#FFFFFF !important;
text-shadow:-1px -1px 0 #227722 !important;
}
.btn-pink {
background-color:#DDAAAA !important;
background-image:url("/admin/_images/buttons/bg-btn-pink.gif") !important;
border-color:#DDAAAA #DDAAAA #CC9999 !important;
text-shadow:1px 1px 0 #FFDDDD !important;
}
.btn-red {
background-color:#AA2222 !important;
background-image:url("/admin/_images/buttons/bg-btn-red.gif") !important;
background-position:0 0;
border-color:#AA2222 #AA2222 #991111 !important;
color:#FFFFFF !important;
text-shadow:-1px -1px 0 #AA2222 !important;
}
.btn:hover, .btn:focus, input.btn[type="submit"]:hover, input.btn[type="submit"]:focus, button.btn:hover, button.btn:focus {
background-position:0 -6px;
border-color:#999999 #999999 #888888;
color:#000000;
text-decoration:none;
}
.btn-light:hover, .btn-light:focus {
border-color:#77AAAA #77AAAA #669999;
}
.btn-dark:hover, .btn-dark:focus {
border-color:#226677 #226677 #115566;
color:#FFFFFF;
}
.btn-blue:hover, .btn-blue:focus {
border-color:#1177BB #1177BB #0066AA;
color:#FFFFFF;
}
.btn-chart:hover, .btn-chart:focus {
border-color:#77AA11 #77AA11 #669900;
}
.btn-mint:hover, .btn-mint:focus, input.btn-mint[type="submit"]:hover, input.btn-mint[type="submit"]:focus, button.btn-mint:hover, button.btn-mint:focus {
border-color:#88AA88 #88AA88 #779977 !important;
}
.btn-green:hover, .btn-green:focus, input.btn-green[type="submit"]:hover, input.btn-green[type="submit"]:focus, button.btn-green:hover, button.btn-green:focus {
background-color:#227722 !important;
border-color:#005500 #005500 #004400 !important;
color:#FFFFFF;
}
.btn-pink:hover, .btn-pink:focus, input.btn-pink[type="submit"]:hover, input.btn-pink[type="submit"]:focus, button.btn-pink:hover, button.btn-pink:focus {
border-color:#AA8888 #AA8888 #997777 !important;
}
.btn-red:hover, .btn-red:focus, input.btn-red[type="submit"]:hover, input.btn-red[type="submit"]:focus, button.btn-red:hover, button.btn-red:focus {
background-color:#AA2222 !important;
border-color:#661111 #661111 #550000 !important;
color:#FFFFFF;
}
.btn-m:hover, .btn-m:focus, input.btn-m[type="submit"]:hover, input.btn-m[type="submit"]:focus, button.btn-m:hover, button.btn-m:focus {
background-position:0 -206px;
}
.btn-l:hover, .btn-l:focus, input.btn-l[type="submit"]:hover, input.btn-l[type="submit"]:focus, button.btn-l:hover, button.btn-l:focus {
background-position:0 -406px;
}
button:active, button.btn:active, input[type="submit"]:active, button.btn-dark:active, button.btn-light:active, .btn:active, .btn-red:active, .btn-green:active {
background-image:none !important;
outline:medium none !important;
text-shadow:none !important;
}
.dbtn, .dbtn:hover, .dbtn:focus, .dbtn:active, button.dbtn:hover, button.dbtn:focus {
background:none repeat scroll 0 0 #EEEEEE;
border-color:#DDDDDD;
color:#AAAAAA;
text-shadow:none;
}
.btn-light.dbtn, .btn-light.dbtn:hover, .btn-light.dbtn:focus, .btn-light.dbtn:active {
background:none repeat scroll 0 0 #DDEEEE;
border-color:#CCDDDD;
color:#99AAAA;
}
.btn-dark.dbtn, .btn-dark.dbtn:hover, .btn-dark.dbtn:focus, .btn-dark.dbtn:active {
background:none repeat scroll 0 0 #AAD5DD;
border-color:#99C5CC;
color:#DDF6F6;
}
.btn-blue.dbtn, .btn-blue.dbtn:hover, .btn-blue.dbtn:focus, .btn-blue.dbtn:active {
background:none repeat scroll 0 0 #BBDDEE;
border-color:#AACCDD;
color:#DDEEFF;
}
.btn-chart.dbtn, .btn-chart.dbtn:hover, .btn-chart.dbtn:focus, .btn-chart.dbtn:active {
background:none repeat scroll 0 0 #DDEEBB;
border-color:#CCDDAA;
color:#AABB99;
}
.btn-mint.dbtn, .btn-mint.dbtn:hover, .btn-mint.dbtn:focus, .btn-mint.dbtn:active {
background:none repeat scroll 0 0 #DDEEDD;
border-color:#CCDDCC;
color:#99AA99;
}
.btn-green.dbtn, .btn-green.dbtn:hover, .btn-green.dbtn:focus, .btn-green.dbtn:active {
background:none repeat scroll 0 0 #AACCAA;
border-color:#99BB99;
color:#DDEEDD;
}
.btn-pink.dbtn, .btn-pink.dbtn:hover, .btn-pink.dbtn:focus, .btn-pink.dbtn:active {
background:none repeat scroll 0 0 #EEDDDD;
border-color:#DDCCCC;
color:#AA9999;
}
.btn-red.dbtn, .btn-red.dbtn:hover, .btn-red.dbtn:focus, .btn-red.dbtn:active {
background:none repeat scroll 0 0 #CCAAAA;
border-color:#BB9999;
color:#EEDDDD;
}
.btn.right {
float:right;
}


text:
<?php

namespace Ojstr\JournalBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Issue
 */
class Issue {

    /**
     * @var integer
     */
    private $id;

    /**
     * @var integer
     */
    private $journalId;

    /**
     * @var string
     */
    private $volume;

    /**
     * @var string
     */
    private $number;

    /**
     * @var string
     */
    private $title;

    /**
     * @var string
     */
    private $description;

    /**
     * @var string
     */
    private $year;

    /**
     * @var \DateTime
     */
    private $datePublished;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set journalId
     *
     * @param integer $journalId
     * @return Issue
     */
    public function setJournalId($journalId) {
        $this->journalId = $journalId;
        return $this;
    }

    /**
     * Get journalId
     *
     * @return integer
     */
    public function getJournalId() {
        return $this->journalId;
    }

    /**
     * Set volume
     *
     * @param string $volume
     * @return Issue
     */
    public function setVolume($volume) {
        $this->volume = $volume;
        return $this;
    }

    /**
     * Get volume
     *
     * @return string
     */
    public function getVolume() {
        return $this->volume;
    }

    /**
     * Set number
     *
     * @param string $number
     * @return Issue
     */
    public function setNumber($number) {
        $this->number = $number;
        return $this;
    }

    /**
     * Get number
     *
     * @return string
     */
    public function getNumber() {
        return $this->number;
    }

    /**
     * Set title
     *
     * @param string $title
     * @return Issue
     */
    public function setTitle($title) {
        $this->title = $title;
        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle() {
        return $this->title;
    }

    /**
     * Set description
     *
     * @param string $description
     * @return Issue
     */
    public function setDescription($description) {
        $this->description = $description;
        return $this;
    }

    /**
     * Get description
     *
     * @return string
     */
    public function getDescription() {
        return $this->description;
    }

    /**
     * Set year
     *
     * @param string $year
     * @return Issue
     */
    public function setYear($year) {
        $this->year = $year;
        return $this;
    }

    /**
     * Get year
     *
     * @return string
     */
    public function getYear() {
        return $this->year;
    }

    /**
     * Set datePublished
     *
     * @param \DateTime $datePublished
     * @return Issue
     */
    public function setDatePublished($datePublished) {
        $this->datePublished = $datePublished;
        return $this;
    }

    /**
     * Get datePublished
     *
     * @return \DateTime
     */
    public function getDatePublished() {
        return $this->datePublished;
    }

}


text:
/*****************************************************************************\
*                     EFSL - Embedded Filesystems Library                     *
*                     -----------------------------------                     *
*                                                                             *
* Filename : ioman_small.c                                                    *
* Release  : 0.3 - devel                                                      *
* Description : The IO Manager receives all requests for sectors in a central *
*               allowing it to make smart decision regarding caching.         *
*               The IOMAN_NUMBUFFER parameter determines how many sectors     *
*               ioman can cache. ioman also supports overallocating and       *
*               backtracking sectors.                                         *
*               This is the small version of IOMan, for systems with limited  *
*               resources. It features only one fixed buffer, and has         *
*               simplified operation                                          *
*                                                                             *
* This program is free software; you can redistribute it and/or               *
* modify it under the terms of the GNU General Public License                 *
* as published by the Free Software Foundation; version 2                     *
* of the License.                                                             *
*                                                                             *
* This program is distributed in the hope that it will be useful,             *
* but WITHOUT ANY WARRANTY; without even the implied warranty of              *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
* GNU General Public License for more details.                                *
*                                                                             *
* As a special exception, if other files instantiate templates or             *
* use macros or inline functions from this file, or you compile this          *
* file and link it with other works to produce a work based on this file,     *
* this file does not by itself cause the resulting work to be covered         *
* by the GNU General Public License. However the source code for this         *
* file must still be made available in accordance with section (3) of         *
* the GNU General Public License.                                             *
*                                                                             *
* This exception does not invalidate any other reasons why a work based       *
* on this file might be covered by the GNU General Public License.            *
*                                                                             *
*                                                    (c)2006 Lennart Yseboodt *
*                                                    (c)2006 Michael De Nil   *
\*****************************************************************************/

#include "ioman_small.h"

esint8 ioman_init(IOManager *ioman, Interface *iface, euint8* bufferarea)
{
	ioman->iface=iface;
	ioman_reset(ioman);
	return(0);
}
/*****************************************************************************/

void ioman_reset(IOManager *ioman)
{
	ioman->sector=ioman->status=ioman->itptr=0;
	ioman->stack.sector=ioman->stack.status=0;

	ioman_setError(ioman,IOMAN_NOERROR);

}
/*****************************************************************************/

void ioman_setAttr(IOManager *ioman,euint8 attribute,euint8 val)
{
	if(val){
		ioman->status|=1<<attribute;
	}else{
		ioman->status&=~(1<<attribute);
	}
}
/*****************************************************************************/

euint8 ioman_getAttr(IOManager *ioman,euint8 attribute)
{
	return(ioman->status&(1<<attribute));
}
/*****************************************************************************/

euint8* ioman_getSector(IOManager *ioman,euint32 address, euint8 mode)
{
	if(address==ioman->sector){
		if(mode==IOM_MODE_READWRITE)ioman_setWritable();
		return(ioman->bufptr);
	}

}

esint8 ioman_readSector(IOManager *ioman,euint32 address,euint8* buf)
{
	esint8 r;

	if(buf==0){
		return(-1);
	}

	r=if_readBuf(ioman->iface,address,buf);

	if(r!=0){
		ioman_setError(ioman,IOMAN_ERR_READFAIL);
		return(-1);
	}
	return(0);
}
/*****************************************************************************/

esint8 ioman_writeSector(IOManager *ioman, euint32 address, euint8* buf)
{
	esint8 r;

	if(buf==0)return(-1);

	r=if_writeBuf(ioman->iface,address,buf);

	if(r<=0){
		ioman_setError(ioman,IOMAN_ERR_WRITEFAIL);
		return(-1);
	}
	return(0);
}
/*****************************************************************************/


text:
<?php declare(strict_types = 1);

namespace Contributte\Middlewares;

use Contributte\Middlewares\Exception\InvalidStateException;
use Contributte\Psr7\Psr7Response;
use Contributte\Psr7\Psr7ServerRequest;
use Nette\Application\AbortException;
use Nette\Application\ApplicationException;
use Nette\Application\BadRequestException;
use Nette\Application\InvalidPresenterException;
use Nette\Application\IPresenter;
use Nette\Application\IPresenterFactory;
use Nette\Application\Request as ApplicationRequest;
use Nette\Application\Response as ApplicationResponse;
use Nette\Application\Responses\ForwardResponse;
use Nette\Application\UI\Presenter;
use Nette\Routing\Router;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Throwable;

class PresenterMiddleware implements IMiddleware
{

	/** @var int */
	public static $maxLoop = 20;

	/** @var IPresenterFactory */
	protected $presenterFactory;

	/** @var Router */
	protected $router;

	/** @var ApplicationRequest[] */
	protected $requests = [];

	/** @var IPresenter */
	protected $presenter;

	/** @var string|null */
	protected $errorPresenter;

	/** @var bool */
	protected $catchExceptions = true;

	public function __construct(IPresenterFactory $presenterFactory, Router $router)
	{
		$this->presenterFactory = $presenterFactory;
		$this->router = $router;
	}

	public function setErrorPresenter(string $errorPresenter): void
	{
		$this->errorPresenter = $errorPresenter;
	}

	public function setCatchExceptions(bool $catch): void
	{
		$this->catchExceptions = $catch;
	}

	public function getPresenter(): IPresenter
	{
		return $this->presenter;
	}

	/**
	 * @return ApplicationRequest[]
	 */
	public function getRequests(): array
	{
		return $this->requests;
	}

	/**
	 * Dispatch a HTTP request to a front controller.
	 *
	 * @param Psr7ServerRequest|ServerRequestInterface $psr7Request
	 * @param Psr7Response|ResponseInterface           $psr7Response
	 */
	public function __invoke(ServerRequestInterface $psr7Request, ResponseInterface $psr7Response, callable $next): ResponseInterface
	{
		if (!($psr7Request instanceof Psr7ServerRequest)) {
			throw new InvalidStateException(sprintf('Invalid request object given. Required %s type.', Psr7ServerRequest::class));
		}

		if (!($psr7Response instanceof Psr7Response)) {
			throw new InvalidStateException(sprintf('Invalid response object given. Required %s type.', Psr7Response::class));
		}

		$applicationResponse = null;

		try {
			$applicationResponse = $this->processRequest($this->createInitialRequest($psr7Request));
		} catch (Throwable $e) {
			$errorPresenter = $this->errorPresenter;
			if (!$this->catchExceptions || $errorPresenter === null) {
				throw $e;
			}

			try {
				// Create a new response with given code
				$psr7Response = $psr7Response->withStatus($e instanceof BadRequestException ? ($e->getCode() !== 0 ? $e->getCode() : 404) : 500);
				// Try resolve exception via forward or redirect
				$applicationResponse = $this->processException($e, $errorPresenter);
			} catch (Throwable $e) {
				// No fallback needed
			}

			throw $e;
		}

		$psr7Response = $psr7Response->withApplicationResponse($applicationResponse);

		return $next($psr7Request, $psr7Response);
	}

	public function processRequest(ApplicationRequest $request): ApplicationResponse
	{
		process:
		if (count($this->requests) > self::$maxLoop) {
			throw new ApplicationException('Too many loops detected in application life cycle.');
		}

		$this->requests[] = $request;

		if (!$request->isMethod($request::FORWARD) && strcasecmp($request->getPresenterName(), (string) $this->errorPresenter) !== 0) {
			throw new BadRequestException('Invalid request. Presenter is not achievable.');
		}

		try {
			$this->presenter = $this->presenterFactory->createPresenter($request->getPresenterName());
		} catch (InvalidPresenterException $e) {
			throw count($this->requests) > 1 ? $e : new BadRequestException($e->getMessage(), 0, $e);
		}

		$response = $this->presenter->run(clone $request);

		if ($response instanceof ForwardResponse) {
			// phpcs:ignore
			$request = $response->getRequest();
			goto process;
		}

		return $response;
	}

	/**
	 * @throws ApplicationException
	 * @throws BadRequestException
	 */
	public function processException(Throwable $e, string $errorPresenter): ApplicationResponse
	{
		$args = [
			'exception' => $e,
			'request' => end($this->requests) !== false ? end($this->requests) : null,
		];

		if ($this->presenter instanceof Presenter) {
			try {
				$this->presenter->forward(':' . $errorPresenter . ':', $args);
			} catch (AbortException $foo) {
				return $this->processRequest($this->presenter->getLastCreatedRequest());
			}
		}

		return $this->processRequest(new ApplicationRequest($errorPresenter, ApplicationRequest::FORWARD, $args));
	}

	/**
	 * @throws BadRequestException
	 */
	protected function createInitialRequest(Psr7ServerRequest $psr7Request): ApplicationRequest
	{
		$netteRequest = $psr7Request->getHttpRequest();
		$parameters = $this->router->match($netteRequest);
		$presenter = $parameters[Presenter::PRESENTER_KEY] ?? null;

		if ($presenter === null) {
			throw new InvalidStateException('Missing presenter in route definition.');
		}

		if ($parameters === null || !is_string($presenter)) {
			throw new BadRequestException('No route for HTTP request.');
		}

		try {
			$this->presenterFactory->getPresenterClass($presenter);
		} catch (InvalidPresenterException $e) {
			throw new BadRequestException($e->getMessage(), 0, $e);
		}

		unset($parameters[Presenter::PRESENTER_KEY]);
		return new ApplicationRequest(
			$presenter,
			$netteRequest->getMethod(),
			$parameters,
			$netteRequest->getPost(),
			$netteRequest->getFiles(),
			[ApplicationRequest::SECURED => $netteRequest->isSecured()]
		);
	}

}


text:
#ifndef JPETTMESSAGEHANDLER_H
#define JPETTMESSAGEHANDLER_H
#include "TMessageHandler.h"

class JPetTMessageHandler : public TMessageHandler
{
public:
  JPetTMessageHandler();
  ~JPetTMessageHandler();
#ifndef __CINT__
  Bool_t Notify() override;
#else
  Bool_t Notify();
#endif
};

#endif /* !JPETTMESSAGEHANDLER_H */


text:
<?php

use ChurchCRM\dto\SystemURLs;

//Set the page title
$sPageTitle = gettext("Unsupported Two Factor Authentication Configuration");
require SystemURLs::getDocumentRoot() . '/Include/Header.php';
?>

 <?= gettext("Unable To Begin Two Factor Authentication Enrollment") ?>

<?= gettext("Two factor authentication requires ChurchCRM administrators to configure a few parameters").":" ?>

<?= gettext("System configuration ") . " bEnable2FA " . gettext("Must be set to 'true'") ?>

<?= gettext("Include/Config.php must define an encryption key for storing 2FA secret keys in the database by setting a value for") ?>: $TwoFASecretKey

<?php require SystemURLs::getDocumentRoot() . '/Include/Footer.php';  ?>


text:
package com.bq.corbel.resources.rem.dao;

import com.bq.corbel.resources.rem.model.ResourceUri;
import com.google.gson.JsonObject;

public interface ResmiOrder {
    void addNextOrderInRelation(ResourceUri uri, JsonObject relationJson);

    void moveRelation(ResourceUri uri, RelationMoveOperation relationMoveOperation);

}


text:
package org.lanternpowered.server.item.behavior.simple;

import org.lanternpowered.server.behavior.Behavior;
import org.lanternpowered.server.behavior.BehaviorContext;
import org.lanternpowered.server.behavior.ContextKeys;
import org.lanternpowered.server.behavior.pipeline.BehaviorPipeline;
import org.lanternpowered.server.block.LanternBlockType;
import org.lanternpowered.server.block.behavior.types.PlaceBlockBehavior;

@SuppressWarnings("ConstantConditions")
public class InteractWithBlockItemBehavior extends InteractWithBlockItemBaseBehavior {

    @Override
    protected boolean place(BehaviorPipeline<Behavior> pipeline, BehaviorContext context) {
        final LanternBlockType blockType = (LanternBlockType) context.getContext(ContextKeys.ITEM_TYPE).get().getBlock().get();
        context.addContext(ContextKeys.BLOCK_TYPE, blockType);
        return context.process(blockType.getPipeline().pipeline(PlaceBlockBehavior.class),
                (context1, behavior1) -> behavior1.tryPlace(pipeline, context1)).isSuccess();
    }
}


text:
namespace aura {
class Window;
}

namespace gfx {
class Point;
class Size;
}

namespace views {
class MenuRunner;
class Widget;
}

namespace ash {
namespace internal {

class WorkspaceControllerTestHelper;
class WorkspaceEventFilter;
class WorkspaceLayoutManager;
class WorkspaceManager;

// WorkspaceController acts as a central place that ties together all the
// various workspace pieces: WorkspaceManager, WorkspaceLayoutManager and
// WorkspaceEventFilter.
class ASH_EXPORT WorkspaceController :
      public aura::WindowObserver,
      public ui::SimpleMenuModel::Delegate {
 public:
  explicit WorkspaceController(aura::Window* viewport);
  virtual ~WorkspaceController();

  void ToggleOverview();

  // Returns the workspace manager that this controller owns.
  WorkspaceManager* workspace_manager() {
    return workspace_manager_.get();
  }

  // Shows the menu allowing you to configure various aspects of workspaces.
  void ShowMenu(views::Widget* widget, const gfx::Point& location);

  // Sets the size of the grid.
  void SetGridSize(int grid_size);

  // aura::WindowObserver overrides:
  virtual void OnWindowPropertyChanged(aura::Window* window,
                                       const void* key,
                                       intptr_t old) OVERRIDE;

  // ui::SimpleMenuModel::Delegate overrides:
  virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
  virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
  virtual void ExecuteCommand(int command_id) OVERRIDE;
  virtual bool GetAcceleratorForCommandId(
      int command_id,
      ui::Accelerator* accelerator) OVERRIDE;

 private:
  friend class WorkspaceControllerTestHelper;

  enum MenuItem {
    MENU_CHANGE_WALLPAPER,
  };

  aura::Window* viewport_;

  scoped_ptr<WorkspaceManager> workspace_manager_;

  // Owned by the window its attached to.
  WorkspaceLayoutManager* layout_manager_;

  // Owned by |viewport_|.
  WorkspaceEventFilter* event_filter_;

#if !defined(OS_MACOSX)
  scoped_ptr<views::MenuRunner> menu_runner_;
#endif

  DISALLOW_COPY_AND_ASSIGN(WorkspaceController);
};

}  // namespace internal
}  // namespace ash

#endif  // ASH_WM_WORKSPACE_CONTROLLER_H_


text:
// Copyright 2012, Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Author: api.anash@gmail.com (Anash P. Oommen)

using Google.Api.Ads.Common.Lib;

using System;
using System.Collections.Generic;
using System.Text;

// Disable deprecation warnings for AuthTokenCache class.
#pragma warning disable 612, 618

namespace Google.Api.Ads.Common.Tests.Mocks {
  /// <summary>
  /// Mock class for AuthTokenCache.
  /// </summary>
  class MockAuthTokenCache : AuthTokenCache {
    /// <summary>
    /// Adds an auth token to cache.
    /// </summary>
    /// <param name="service">The ClientLogin service for which this auth token
    /// is generated.</param>
    /// <param name="email">The login email.</param>
    /// <param name="password">The login password.</param>
    /// <param name="token">The auth token.</param>
    /// <returns>
    /// The auth token.
    /// </returns>
    public string AddToken(string service, string email, string password, string token) {
      return AddToken(service, email, token);
    }

    /// <summary>
    /// Gets an auth token from cache.
    /// </summary>
    /// <param name="service">The ClientLogin service for which this auth token
    /// is generated.</param>
    /// <param name="email">The login email.</param>
    /// <param name="password">The login password.</param>
    /// <returns>
    /// The auth token, or null if the cache doesn't have a token.
    /// </returns>
    public string GetToken(string service, string email, string password) {
      return GetToken(service, email);
    }

    /// <summary>
    /// Adds an auth token to cache.
    /// </summary>
    /// <param name="service">The ClientLogin service for which this auth token
    /// is generated.</param>
    /// <param name="email">The login email.</param>
    /// <param name="token">The auth token.</param>
    /// <returns>
    /// The auth token.
    /// </returns>
    public string AddToken(string service, string email, string token) {
      return token;
    }

    /// <summary>
    /// Gets an auth token from cache.
    /// </summary>
    /// <param name="service">The ClientLogin service for which this auth token
    /// is generated.</param>
    /// <param name="email">The login email.</param>
    /// <returns>
    /// The auth token, or null if the cache doesn't have a token.
    /// </returns>
    public string GetToken(string service, string email) {
      return null;
    }

    /// <summary>
    /// Invalidates an auth token.
    /// </summary>
    /// <param name="token">The auth token.</param>
    public void InvalidateToken(string token) {
    }

    /// <summary>
    /// Clears the cache.
    /// </summary>
    public void Clear() {
    }
  }
}

#pragma warning restore 612, 618


text:
package org.imirsel.nema.dao;

import java.util.List;

import org.imirsel.nema.model.MirexSubmission;
import org.imirsel.nema.model.Profile;
import org.imirsel.nema.model.MirexTask;
import org.imirsel.nema.model.User;

/**
 * Data Access Object of Mirex Submissions
 * @author gzhu1
 */
public interface MirexSubmissionDao extends GenericDao<MirexSubmission,Long>{

        /**
         * Get all submissions from a particular user
         */
	public List<MirexSubmission> getSubmissions(User user);

        /**
         * Get all submissions from a particular user
         */
	public List<MirexSubmission> getSubmissions(Profile contributor);

        /**
         * Get all submissions of a particular task
         */
	public List<MirexSubmission> getSubmissions(MirexTask task);

        /**
         * Get all submissions with certain submission hashcode
         */
	public List<MirexSubmission> findByHashcodeBeginning(String string);

}


text:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nucleo.Presentation;

namespace Nucleo.Web.Services
{
	[TestClass]
	public class ViewWebService_1Test
	{
		protected class TestModel { }
		[PresenterBinding(typeof(TestPresenter))]
		protected class TestView : ViewWebService<TestModel>
		{
			public TestView() { }
		}

		protected class TestPresenter : BasePresenter<TestView>
		{
			public TestPresenter(TestView view) : base(view) { }
		}

		[TestMethod]
		public void GettingAndSettingModelWorksOK()
		{
			var model = new TestModel();
			var view = new TestView { Model = model };

			Assert.AreEqual(model, view.Model);
		}
	}
}


text:
tunnelled_group = "224.168.2.9"
tunnelled_port = 2500

##########################################################################
#
# TCP Server to multicast components
#
# This needs work - largely because whilst it detunnels data correctly,
# I'm pretty certain it's not tunneling data from the outside world
# correctly.
#

def AdHocSpecificDetupledMulticastTransceiver(destination_group, destination_port):
   class klass(_Axon.Component.component):
      def main(self):
         transceiver = Multicast_transceiver("0.0.0.0", destination_port, destination_group, destination_port)
         detupler = detuple(1)

         self.link((transceiver,"outbox"), (detupler,"inbox"))
         self.link((detupler,"outbox"), (self,"outbox"), passthrough=2)
         self.link((self,"inbox"), (transceiver,"inbox"), passthrough=1)

         self.addChildren(transceiver, detupler)
         yield _Axon.Ipc.newComponent(*(self.children))

         while 1:
            self.pause()
            yield 1
   return klass

class Multicast_Tunnel_EndPoint(_Axon.Component.component):
   def main(self):
      import random
      clientServerTestPort=1500

      server=SimpleServer(protocol=AdHocSpecificDetupledMulticastTransceiver(tunnelled_group, tunnelled_port),
                           port=clientServerTestPort)

      self.addChildren(server)
      yield _Axon.Ipc.newComponent(*(self.children))

      while 1:
         self.pause()
         yield 1

##########################################################################
#
# Multicast to TCP Client components
#
# This looks correct, but needs validation.
#
# Listens on a multicast address, sends all data received over a TCP
# connection to an endpoint. Any data received over the TCP connection is
# retransmitted over the multicast group. This essentially forms a NAT for
# the multicast session.
#
# This will be more generally useful as software we can just give people for
# bypassing the lack of multicast deployment over the internet. (Hmm...
# Thinking about it, this also relieves the more general issues with routing
# since explicit network joins in this manner mean that not everyone needs WAN
# based multicast enabled)
#
# In a fun way this will also allow companies to join a BBC multicast
# group...
#
class detuple(Axon.Component.component):
   def __init__(self, index):
      super(detuple, self).__init__()
      self.index = index

   def main(self):
      while 1:
         if self.dataReady("inbox"):
            tuple=self.recv("inbox")
            self.send(tuple[self.index], "outbox")
         yield 1

def tunnel_start():
   from Axon.Scheduler import scheduler

   from Kamaelia.Internet.Multicast_transceiver import Multicast_transceiver

   class Multicast_Tunnel_StartPoint((Axon.Component.component):
      def main(self):

        multicast_tunnel_endpoint = "132.185.0.0"
        multicast_tunnel_endport = 2500
        local_multicast_group = "224.168.2.9"
        local_multicast_port = 1600

        multicast_receiver = Multicast_transceiver("0.0.0.0", local_multicast_port, local_multicast_group, local_multicast_port)
        detupler = detuple(1)
        tunnel_client=TCPClient(multicast_tunnel_endpoint, multicast_tunnel_endport)

        self.link((multicast_receiver,"outbox"), (detupler,"inbox"))
        self.link((detupler,"outbox"), (tunnel_client,"inbox"))
        self.link((tunnel_client,"outbox"), (multicast_receiver,"inbox"))

        self.addChildren(multicast_receiver, detupler, tunnel_client)
        yield Axon.Ipc.newComponent(*(self.children))
        while 1:
           yield 1

   harness = Multicast_Tunnel_StartPoint()
   harness.activate()
   scheduler.run.runThreads(slowmo=0)

if __name__=="__main__":
    tunnel_start()


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>TrayAlive: include/Ping.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Classes

Files

File List

File Members

include/Ping.h File Reference
#include <winsock2.h>

#include <windows.h>

#include "PingException.h"

Include dependency graph for Ping.h:

<map name="include/Ping.h_map">
<area href="PingException_8h.html" shape="rect" coords="171,102,302,126" alt="">
</map>

This graph shows which files directly or indirectly include this file:

<map name="include/Ping.hdep_map">
<area href="Ping_8cpp.html" shape="rect" coords="187,6,291,30" alt="">
<area href="TrayAlive_8cpp.html" shape="rect" coords="171,54,307,78" alt="">
</map>

Go to the source code of this file.

Classes

class  	CPing

Detailed Description

Definition in file Ping.h.
<address style="align: right;">Generated on Sun Jan 21 11:34:10 2007 for TrayAlive by

 1.4.7 </address>


text:
import { range as staticRange } from '../../observable/range';
declare module '../../Observable' {
    namespace Observable {
        let range: typeof staticRange;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <link rel="help" href="http://www.w3.org/TR/css-device-adapt/#syntax" />


text:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Composite Definition with Inner Configured Definition with no Type Test</title>

Composite Definition with Inner Configured Definition with no Type Test

	open
	/tiles-test/index.jsp

	clickAndWait
	link=Velocity: Test Insert Definition that contains another definition inside using JSP tags without types

	assertTextPresent
	This is a composite definition with tags.

	assertTextPresent
	This is the header

	assertTextPresent
	This is an inner definition with tags.

	assertTextPresent
	This is the header

	assertTextPresent
	This is a body


text:
[![CI Status](http://img.shields.io/travis/zhang.wenhai/NPDispatcher.svg?style=flat)](https://travis-ci.org/zhang.wenhai/NPDispatcher)
[![Version](https://img.shields.io/cocoapods/v/NPDispatcher.svg?style=flat)](http://cocoapods.org/pods/NPDispatcher)
[![License](https://img.shields.io/cocoapods/l/NPDispatcher.svg?style=flat)](http://cocoapods.org/pods/NPDispatcher)
[![Platform](https://img.shields.io/cocoapods/p/NPDispatcher.svg?style=flat)](http://cocoapods.org/pods/NPDispatcher)

NPDispatcher is a task dispatcher library for iOS and Mac OS X, It can limit max count of running tasks at the same time.

Choose NPDispatcher for your next project, you'll be happy you did!

## Example Project

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements
| NPDispatcher Version | Minimum iOS Target  | Minimum OS X Target  | Minimum watchOS Target  | Minimum tvOS Target  |                                   Notes                                   |
|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:|
| 1.x | iOS 8 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required.

## Installation with CocoaPods

[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like NPDispatcher in your projects.You can install it with the following command:
```bash
$ gem install cocoapods
```
> CocoaPods 0.39.0+ is required to build NPDispatcher 1.0.1.

#### Podfile

To integrate NPDispatcher into your Xcode project using CocoaPods, specify it in your `Podfile`:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'NPDispatcher', '~> 1.0.1'
end
```

Then, run the following command:

```bash
$ pod install
```

## Usage
#### NPTask
> NPTask is a carrier for task, distinguish the task with Identifier. create the task with following method and start it.

``` Objective-C
+ (id)taskWithIdentifier:(NSUInteger)identifier dataObject:(id)data;
- (id)initWithIdentifier:(NSUInteger)identifier dataObject:(id)data;
```
``` Objective-C
- (void)start;
```

And when the task complete, you can commit(success) or fail it.
``` Objective-C
- (void)commit;
- (void)fail:(NSError *)error;
```

#### NPDispatcher
> NPDispatcher is the manager of task running and pending.

> 1 . initial it. set max count of the running tasks at the same time and new task dispatched call back.

``` Objective-C
+ (NPDispatcher *)dispatcherWithMaxTaskCount:(NSUInteger)maxCount taskArrivedCallBack:(NPTaskArrivedCallBack)callBack;
- (NPDispatcher *)initWithMaxTaskCount:(NSUInteger)maxCount taskArrivedCallBack:(NPTaskArrivedCallBack)callBack;
```
> 2 . add tasks.

``` Objective-C
- (void)addTask:(NPTask *)task;
- (void)addTasks:(NSArray<NPTask *> *)tasks;
- (void)insertTask:(NPTask *)task atIndex:(NSInteger)index;
```

> 3 . remove task when complete.

``` Objective-C
- (void)removeTask:(NPTask *)task;
```
> 4 . cancel not start tasks if not necessary to execute.

``` Objective-C
- (NSArray<NPTask *> *)cancelNotStartTasks;
```

### Usage Example
> 1 .Import
``` Objective-C
#import <NPDispatcher/NPDispatcher.h>
```
> 2 . Define
``` Objective-C
@property (nonatomic, strong) NPDispatcher *dispatcher;
```
> 3 . Initial
``` Objective-C
__weak typeof(self)weakSelf = self;
_dispatcher = [NPDispatcher dispatcherWithMaxTaskCount:5 taskArrivedCallBack:^(NSArray<NPTask *> *tasks) {
    NSUInteger taskCount = tasks.count;
    for (NSUInteger index = 0; index < taskCount; index ++) {
        NPTask *task = [tasks firstObject];
        //If Success
        [task commit];
        //If Fail
        [task fail:[NSError errorWithDomain:@"NPDispatcher" code:-1 userInfo:@{@"error" : @"I`m uncareful failed."}]];
    }
    if (tasks.count == 0) {
        NSLog("All of task is complete.");
    }
}];
```
> 4 . Add Tasks
``` Objective-C
NSMutableArray<NPTask *> *testTasks = [NSMutableArray arrayWithCapacity:10];
for (int index = 0; index < 10; index ++) {
    //1. Create task
    NPTask *task = [NPTask taskWithIdentifier:index dataObject:nil];
    //2. Start task
    [task start];
    //3. Set success call back
    task.successCallBack = ^(NPTask *t) {
        NSLog(@"task %lu success.", t.identifier);
        //6. Remove complete task from dispatcher
        [weakSelf.dispatcher removeTask:t];
    };
    //4. Set failed call back
    task.failedCallBack = ^(NPTask *t, NSError *error) {
        NSLog(@"task %lu failed:%@.", t.identifier, t.error.description);
        //6. Remove complete task from dispatcher
        [weakSelf.dispatcher removeTask:t];
    };
    [testTasks addObject:task];
}
//5. Add tasks
[_dispatcher addTasks:testTasks];
```

## Author

zhang.wenhai, zhang_mr1989@163.com

## License

NPDispatcher is available under the MIT license. See the LICENSE file for more info.


text:
#ifndef itkHistogramThresholdImageFilter_h
#define itkHistogramThresholdImageFilter_h

#include "itkImageToImageFilter.h"
#include "itkImageToHistogramFilter.h"
#include "itkHistogram.h"
#include "itkHistogramThresholdCalculator.h"

namespace itk
{

/**
 * \class HistogramThresholdImageFilter
 * \brief Threshold an image using a HistogramThresholdCalculator
 *
 * This filter creates a binary thresholded image that separates an
 * image into foreground and background components. The filter
 * computes the threshold using a user provided HistogramThresholdCalculator and
 * applies that threshold to the input image using the
 * BinaryThresholdImageFilter.
 *
 * The filter also has the option of providing a mask, in which case
 * the histogram and therefore the threshold is computed from the
 * parts of the mask with values indicated by MaskValue. The output
 * image is, by default, masked by the same image. This output
 * masking can be disabled using SetMaskOutput(false). Note that there
 * is an inconsistency here. The MaskImageFilter (used internally)
 * masks by non zero values, where as the MaskedImageToHistogramFilter
 * uses explicit values. If this does not match your usage then the
 * output masking will need to be managed by the user.
 *
 * \author Richard Beare. Department of Medicine, Monash University,
 * Melbourne, Australia.
 * \author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France.
 *
 * This implementation was taken from the Insight Journal paper:
 * https://www.insight-journal.org/browse/publication/811
 *
 * \ingroup Multithreaded
 * \ingroup ITKThresholding
 */

template <typename TInputImage, typename TOutputImage, typename TMaskImage = TOutputImage>
class ITK_TEMPLATE_EXPORT HistogramThresholdImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
{
public:
  ITK_DISALLOW_COPY_AND_MOVE(HistogramThresholdImageFilter);

  /** Standard Self type alias */
  using Self = HistogramThresholdImageFilter;
  using Superclass = ImageToImageFilter<TInputImage, TOutputImage>;
  using Pointer = SmartPointer<Self>;
  using ConstPointer = SmartPointer<const Self>;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Runtime information support. */
  itkTypeMacro(HistogramThresholdImageFilter, ImageToImageFilter);

  using InputImageType = TInputImage;
  using OutputImageType = TOutputImage;
  using MaskImageType = TMaskImage;

  /** Image pixel value type alias. */
  using InputPixelType = typename InputImageType::PixelType;
  using OutputPixelType = typename OutputImageType::PixelType;
  using MaskPixelType = typename MaskImageType::PixelType;

  /** Image related type alias. */
  using InputImagePointer = typename InputImageType::Pointer;
  using OutputImagePointer = typename OutputImageType::Pointer;
  using MaskImagePointer = typename MaskImageType::Pointer;

  using InputSizeType = typename InputImageType::SizeType;
  using InputIndexType = typename InputImageType::IndexType;
  using InputImageRegionType = typename InputImageType::RegionType;
  using OutputSizeType = typename OutputImageType::SizeType;
  using OutputIndexType = typename OutputImageType::IndexType;
  using OutputImageRegionType = typename OutputImageType::RegionType;
  using MaskSizeType = typename MaskImageType::SizeType;
  using MaskIndexType = typename MaskImageType::IndexType;
  using MaskImageRegionType = typename MaskImageType::RegionType;

  using ValueType = typename NumericTraits<InputPixelType>::ValueType;
  using ValueRealType = typename NumericTraits<ValueType>::RealType;
  using HistogramType = Statistics::Histogram<ValueRealType>;
  using HistogramPointer = typename HistogramType::Pointer;
  using HistogramConstPointer = typename HistogramType::ConstPointer;
  using HistogramSizeType = typename HistogramType::SizeType;
  using HistogramMeasurementType = typename HistogramType::MeasurementType;
  using HistogramMeasurementVectorType = typename HistogramType::MeasurementVectorType;
  using CalculatorType = HistogramThresholdCalculator<HistogramType, InputPixelType>;
  using CalculatorPointer = typename CalculatorType::Pointer;

  using HistogramGeneratorType = Statistics::ImageToHistogramFilter<InputImageType>;
  using HistogramGeneratorPointer = typename HistogramGeneratorType::Pointer;

  /** Image related type alias. */
  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
  static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
  static constexpr unsigned int MaskImageDimension = MaskImageType::ImageDimension;

  /** Set and Get the mask image */
  itkSetInputMacro(MaskImage, TMaskImage);
  itkGetInputMacro(MaskImage, TMaskImage);

  /** Set the input image */
  void
  SetInput1(const TInputImage * input)
  {
    this->SetInput(input);
  }

  /** Set the marker image */
  void
  SetInput2(const TMaskImage * input)
  {
    this->SetMaskImage(input);
  }

  /** Set the "outside" pixel value. The default value
   * NumericTraits<OutputPixelType>::ZeroValue(). */
  itkSetMacro(OutsideValue, OutputPixelType);

  /** Get the "outside" pixel value. */
  itkGetConstMacro(OutsideValue, OutputPixelType);

  /** Set the "inside" pixel value. The default value
   * NumericTraits<OutputPixelType>::max() */
  itkSetMacro(InsideValue, OutputPixelType);

  /** Get the "inside" pixel value. */
  itkGetConstMacro(InsideValue, OutputPixelType);

  /** Set the number of histogram bins */
  itkSetMacro(NumberOfHistogramBins, unsigned int);
  itkGetConstMacro(NumberOfHistogramBins, unsigned int);

  /** Does histogram generator compute min and max from data?
   * Default is true for all but char types */
  itkSetMacro(AutoMinimumMaximum, bool);
  itkGetConstMacro(AutoMinimumMaximum, bool);
  itkBooleanMacro(AutoMinimumMaximum);

  /** Do you want the output to be masked by the mask used in
   * histogram construction. Only relevant if masking is in
   * use. Default is true. */
  itkSetMacro(MaskOutput, bool);
  itkGetConstMacro(MaskOutput, bool);
  itkBooleanMacro(MaskOutput);

  /** The value in the mask image, if used, indicating voxels that
  should be included. Default is the max of pixel type, as in the
  MaskedImageToHistogramFilter */
  itkSetMacro(MaskValue, MaskPixelType);
  itkGetConstMacro(MaskValue, MaskPixelType);

  /** Get the computed threshold. */
  itkGetConstMacro(Threshold, InputPixelType);

  /** Set/Get the calculator to use to compute the threshold */
  itkSetObjectMacro(Calculator, CalculatorType);
  itkGetModifiableObjectMacro(Calculator, CalculatorType);

#ifdef ITK_USE_CONCEPT_CHECKING
  // Begin concept checking
  itkConceptMacro(OutputEqualityComparableCheck, (Concept::EqualityComparable<OutputPixelType>));
  itkConceptMacro(InputOStreamWritableCheck, (Concept::OStreamWritable<InputPixelType>));
  itkConceptMacro(OutputOStreamWritableCheck, (Concept::OStreamWritable<OutputPixelType>));
  // End concept checking
#endif

protected:
  HistogramThresholdImageFilter();
  ~HistogramThresholdImageFilter() override = default;
  void
  PrintSelf(std::ostream & os, Indent indent) const override;

  void
  GenerateInputRequestedRegion() override;
  void
  GenerateData() override;

  void
  VerifyPreconditions() ITKv5_CONST override
  {
    Superclass::VerifyPreconditions();
    if (m_Calculator.IsNull())
    {
      itkExceptionMacro(<< "No threshold calculator set.");
    }
  }

private:
  /** Set up the histogram generator. */
  void
  SetUpHistogramGenerator(HistogramGeneratorPointer histogramGenerator);

  OutputPixelType   m_InsideValue;
  OutputPixelType   m_OutsideValue;
  InputPixelType    m_Threshold;
  MaskPixelType     m_MaskValue;
  CalculatorPointer m_Calculator;
  unsigned int      m_NumberOfHistogramBins{ 256 };
  bool              m_AutoMinimumMaximum;
  bool              m_MaskOutput{ true };
};

} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#  include "itkHistogramThresholdImageFilter.hxx"
#endif

#endif


text:
function setHeater(state) {
  $.post('/control/heater', {state: state});
}
function setFan(state) {
  $.post('/control/fan', {state: state});
}

function populateProfileSelector() {
  if ($('#profile-display').length > 0) {
    $.getJSON('/profiles', function(profiles) {
      $.each(profiles, function(i, profile) {
        $('#profile-selector').append('<option value="'+profile+'">'+profile+'</option>');
      });
      // Force draw display with default selected profile:
      window.selected_profile = $('#profile-selector').val();
      drawProfileDisplay();
    });
    // Setup redraw on profile change:
    $('#profile-selector').change(function () {
      window.selected_profile = $('#profile-selector').val();
      drawProfileDisplay();
    });
  }
}

function drawProfileDisplay() {
  /* One-time draw of window.profile. */
  if ($('#profile-display').length == 0) return;
  $.getJSON('/profiles/'+window.selected_profile, function(profile) {
    var data = [];
    window.phase_marks = [];
    var time = 0;
    time_step_s = window.time_step/1000.0
    $.each(window.phases, function (i, phase) {
      $.each(profile[phase], function (i, temp) {
        data.push([time*time_step_s,temp]);
        time += 1;
      });
      window.phase_marks.push({color: '#000', lineWidth: 1,
                               xaxis: {from: time*time_step_s-time_step_s/2,
                                       to: time*time_step_s-time_step_s/2}});
    });
    // Store the profile data series so we don't have to recalcuate for each
    // real-time update when running:
    window.profile_map = data;
    window.plot = $.plot('#profile-display', [{data: data, color: '#3333dd'}],
                                {series: {lines: {show: true}},
                                 grid: {markings: phase_marks,
                                        hoverable: true,
                                        mouseActiveRadius: 15},
                                 yaxis: {min: 0, max: 300, tickSize: 20},
                                 xaxis: {tickSize: 20}});
  });
}

function drawRealtimeDisplay() {
  $.getJSON('/realtime-data', function(realtime_data) {
      window.plot.setData([{data: window.profile_map, color: '#3333dd'},
                                {data: realtime_data, color: '#ee3333'}]);
      window.plot.draw();
  });
}

function enableReflowControls() {
  /* Enables all reflow controls. */
  $('#profile-selector').removeAttr('disabled');
  $('#start-reflow').removeAttr('disabled');
  $('#clear-plot').removeAttr('disabled');
  $('#heater-on').removeAttr('disabled');
  $('#heater-off').removeAttr('disabled');
  $('#fan-on').removeAttr('disabled');
  $('#fan-off').removeAttr('disabled');
}

function disableReflowControls() {
  /* Disables all controls that should not be enabled when reflowing. */
  $('#profile-selector').attr('disabled', 'disabled');
  $('#start-reflow').attr('disabled', 'disabled');
  $('#clear-plot').attr('disabled', 'disabled');
  $('#heater-on').attr('disabled', 'disabled');
  $('#heater-off').attr('disabled', 'disabled');
  $('#fan-on').attr('disabled', 'disabled');
  $('#fan-off').attr('disabled', 'disabled');
}

function startReflow() {
  $.post('/control/start',function (response) {
    disableReflowControls();
    window.oven_running = true;
  });
}

function stopReflow() {
  $.post('/control/stop', function(response) {
    enableReflowControls();
    window.oven_running = false;
  });
}

function updatePage() {
  if ($('#heater-state').length > 0) {
    $.getJSON('/control/heater', function(state) {
      $('#heater-state').html(state);
      if (state == 'on') {
        $('#heater-state').css("color", "#dd3333");
      } else {
        $('#heater-state').css("color", "#3333dd");
      }
    });
  }
  if ($('#fan-state').length > 0) {
    $.getJSON('/control/fan', function(state) {
      $('#fan-state').html(state);
    });
  }
  if ($('#temperature').length > 0) {
    $.getJSON('/control/temperature', function(temp) {
	$('#temperature').html(temp.toFixed(2)+"°C");
    });
  }

  if ($('#reflow-phase').length > 0) {
    $.getJSON('/current-phase', function(phase) {
      if (!phase) {
        phase = 'Not running';
        $('#reflow-phase').css("color", "#dd3333");
      } else {
        phase = {'pre_soak' : 'Pre-soak',
                     'soak' : 'Soak',
                  'ramp_up' : 'Ramp up',
                     'peak' : 'Peak',
		     'cool' : 'Cool'}[phase];
        $('#reflow-phase').css("color", "#000000");
      }
      $('#reflow-phase').html(phase);
    });
  }

  if (window.oven_running == true) {
    drawRealtimeDisplay();
    $.getJSON('/status', function(status) {
      if (status == 'off') {
        stopReflow();
        //$.getJSON('/error', function(error) {
        //  alert("Reflow aborted!:"+error);
        //});
      }
    });
  }
}

$(document).ready(function() {
  // Grab a couple values and set as globals for using in calculations:
  $.getJSON('/phases', function(phases) {
    window.phases = phases;
  });
  $.getJSON('/time-step', function(time_step) {
    window.time_step = time_step;
  });

  $.getJSON('/status', function(status) {
    if (status == 'on') {
      window.oven_running = true;
      disableReflowControls();
    }
    else window.oven_running = false;
  });

  window.oven_temperature = [];

  populateProfileSelector();
  drawProfileDisplay();
  updatePage();
  setInterval(function() { updatePage(); }, 500);
});