text:
[![gocryptfs](Documentation/gocryptfs-logo.png)](https://nuetzlich.net/gocryptfs/)
[![CI](https://github.com/rfjakob/gocryptfs/actions/workflows/ci.yml/badge.svg)](https://github.com/rfjakob/gocryptfs/actions/workflows/ci.yml)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/rfjakob/gocryptfs)](https://goreportcard.com/report/github.com/rfjakob/gocryptfs)
[![Latest release](https://img.shields.io/github/release/rfjakob/gocryptfs.svg)](https://github.com/rfjakob/gocryptfs/releases)
[![Homebrew version](https://img.shields.io/homebrew/v/gocryptfs.svg)](https://formulae.brew.sh/formula/gocryptfs#default)

An encrypted overlay filesystem written in Go.
Official website: https://nuetzlich.net/gocryptfs ([markdown source](https://github.com/rfjakob/gocryptfs-website/blob/master/docs/index.md)).

![Folders side-by-side animation](Documentation/folders-side-by-side.gif)

gocryptfs is built on top the excellent
[go-fuse](https://github.com/hanwen/go-fuse) FUSE library.
This project was inspired by EncFS and strives to fix its security
issues while providing good performance
([benchmarks](https://nuetzlich.net/gocryptfs/comparison/#performance)).
For details on the security of gocryptfs see the
[Security](https://nuetzlich.net/gocryptfs/security/) design document.

All tags from v0.4 onward are signed by the *gocryptfs signing key*.
Please check [Signed Releases](https://nuetzlich.net/gocryptfs/releases/)
for details.

Current Status
--------------

gocryptfs has reached version 1.0 on July 17, 2016. It has gone through
hours and hours of stress (fsstress, extractloop.bash) and correctness
testing (xfstests). It is now considered ready for general consumption.

The old principle still applies: Important data should have a backup.
Also, keep a copy of your master key (printed on mount) in a safe place.
This allows you to access the data even if the gocryptfs.conf config
file is damaged or you lose the password.

The security of gocryptfs has been audited in March 3, 2017. The audit
is available [here (defuse.ca)](https://defuse.ca/audits/gocryptfs.htm).

Platforms
---------

Linux is gocryptfs' native platform.

Beta-quality macOS support is available, which means most things work
fine but you may hit an occasional problem. Check out
[ticket #15](https://github.com/rfjakob/gocryptfs/issues/15) for the history
of macOS support but please create a new ticket if you hit a problem.

For Windows, an independent C++ reimplementation can be found here:
[cppcryptfs](https://github.com/bailey27/cppcryptfs)

A standalone Python tool that can decrypt files & file names is here:
[gocryptfs-inspect](https://github.com/slackner/gocryptfs-inspect)

Installation
------------
Precompiled binaries that work on all x86_64 Linux systems are available
for download from the github releases page. The `fuse` package from your
distribution must be installed for mounting to work.

gocryptfs is also available as a package in most distributions. Examples:

* Debian, Ubuntu: `apt install gocryptfs`
* Fedora: `dnf install gocryptfs`
* Arch: `pacman -S gocryptfs`
* MacPorts: `port install gocryptfs`

See the [Quickstart](https://nuetzlich.net/gocryptfs/quickstart/) page for more info.

Testing
-------

gocryptfs comes with is own test suite that is constantly expanded as features are
added. Run it using `./test.bash`. It takes about 1 minute and requires FUSE
as it mounts several test filesystems.

The `stress_tests` directory contains stress tests that run indefinitely.

In addition, I have ported `xfstests` to FUSE, the result is the
[fuse-xfstests](https://github.com/rfjakob/fuse-xfstests) project. gocryptfs
passes the "generic" tests with one exception, results:  [XFSTESTS.md](Documentation/XFSTESTS.md)

A lot of work has gone into this. The testing has found bugs in gocryptfs
as well as in the go-fuse library.

Compile
-------

Install Go 1.13 or higher:

* Debian/Ubuntu: `apt install golang`
* Fedora: `dnf install golang`

Then, download the source code and compile:

	$ git clone https://github.com/rfjakob/gocryptfs.git
	$ cd gocryptfs
	$ ./build-without-openssl.bash

This will compile a static binary that uses the Go stdlib crypto backend.

If you want to use the OpenSSL crypto backend (faster on
old CPUs lacking AES-NI), you have to install a few dependencies:

* Debian/Ubuntu: `apt install libssl-dev gcc pkg-config`
* Fedora: `dnf install openssl-devel gcc pkg-config`

Then, run:

	$ ./build.bash

Use
---

	$ mkdir cipher plain
	$ ./gocryptfs -init cipher
	$ ./gocryptfs cipher plain

See the [Quickstart](https://nuetzlich.net/gocryptfs/quickstart/) page for more info.

The [MANPAGE.md](Documentation/MANPAGE.md) describes all available command-line options.

Use: Reverse Mode
-----------------

    $ mkdir cipher plain
    $ ./gocryptfs -reverse -init plain
    $ ./gocryptfs -reverse plain cipher

Graphical Interface
-------------------

The [SiriKali](https://mhogomchungu.github.io/sirikali/) project supports
gocryptfs and runs on Linux and OSX.

[cppcryptfs](https://github.com/bailey27/cppcryptfs) on Windows provides
its own GUI.

Stable CLI ABI
--------------

If you want to call gocryptfs from your app or script, see
[CLI_ABI.md](Documentation/CLI_ABI.md) for the official stable
ABI. This ABI is regression-tested by the test suite.

Storage Overhead
----------------

* Empty files take 0 bytes on disk
* 18 byte file header for non-empty files (2 bytes version, 16 bytes random file id)
* 32 bytes of storage overhead per 4kB block (16 byte nonce, 16 bytes auth tag)

[file-format.md](Documentation/file-format.md) contains a more detailed description.

Performance
-----------

Since version 0.7.2, gocryptfs is as fast as EncFS in the default mode,
and significantly faster than EncFS' "paranoia" mode that provides
a security level comparable to gocryptfs.

On CPUs without AES-NI, gocryptfs uses OpenSSL through a thin wrapper called `stupidgcm`.
This provides a 4x speedup compared to Go's builtin AES-GCM
implementation. See [CPU-Benchmarks](https://github.com/rfjakob/gocryptfs/wiki/CPU-Benchmarks)
for details, or run `gocryptfs -speed` to see the encryption performance of your CPU.
Example for a CPU with AES-NI:

```
$ ./gocryptfs -speed
gocryptfs v2.2.0-beta1-5-g52b0444-dirty; go-fuse v2.1.1-0.20210825171523-3ab5d95a30ae; 2021-09-14 go1.17.1 linux/amd64
cpu: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz; with AES acceleration
AES-GCM-256-OpenSSL              862.79 MB/s
AES-GCM-256-Go                   997.71 MB/s    (selected in auto mode)
AES-SIV-512-Go                   159.58 MB/s
XChaCha20-Poly1305-OpenSSL   729.65 MB/s
XChaCha20-Poly1305-Go            843.97 MB/s    (selected in auto mode)
```

You can run `./benchmark.bash` to run gocryptfs' canonical set of
benchmarks that include streaming write, extracting a linux kernel
tarball, recursively listing and finally deleting it. The output will
look like this:

```
$ ./benchmark.bash
Testing gocryptfs at /tmp/benchmark.bash.xFD: gocryptfs v2.0; go-fuse v2.1.1-0.20210508151621-62c5aa1919a7; 2021-06-06 go1.16.5 linux/amd64
WRITE: 262144000 bytes (262 MB, 250 MiB) copied, 0,698174 s, 375 MB/s
READ:  262144000 bytes (262 MB, 250 MiB) copied, 0,268916 s, 975 MB/s
UNTAR: 8,970
MD5:   4,846
LS:    1,851
RM:    2,367
```

Changelog
---------

#### v2.3, 2022-08-28
* Add **`-longnamemax`** flag to `-init` ([#499](https://github.com/rfjakob/gocryptfs/issues/499)).
  Can be used to work around file or path length restrictions on online storage.
  See the [man page](https://github.com/rfjakob/gocryptfs/blob/master/Documentation/MANPAGE.md#-longnamemax)
  for details.
* Support for [`NO_COLOR`](https://no-color.org/) env variable ([#617](https://github.com/rfjakob/gocryptfs/issues/617))
* Fix `-force_owner` not not affecting socket files ([#629](https://github.com/rfjakob/gocryptfs/issues/629)
* MacOS: fix inaccessible `gocryptfs.conf` in reverse mode ([commit](https://github.com/rfjakob/gocryptfs/commit/c9e4e4f74150d2734496e90a4c442a17b79f52c1))
* Raise ctlsock operation timeout from 1 to 10 seconds ([#683](https://github.com/rfjakob/gocryptfs/issues/683))

#### v2.2.1, 2021-10-20
* Fix `-force_owner` only taking effect after 2 seconds ([#609](https://github.com/rfjakob/gocryptfs/issues/609)).
  This was a regression introduced in v2.0.
* MacOS: Fix build.bash failure with error `date: illegal option -- -` when `SOURCE_DATE_EPOCH` is set
  ([#570](https://github.com/rfjakob/gocryptfs/issues/570))
* `-init`: suggest xchacha on CPUs without AES acceleration ([commit](https://github.com/rfjakob/gocryptfs/commit/e8e35982845f36e714b915350eaf6855487aa0e8))
* `-info`: add contentEncryption to output

#### v2.2.0, 2021-09-25
* **`-deterministic-names`: new option for `-init`**, both for reverse and forward mode.
   Disables file name randomisation & `gocryptfs.diriv` files
   ([#151](https://github.com/rfjakob/gocryptfs/issues/151), [#402](https://github.com/rfjakob/gocryptfs/issues/402), [#592](https://github.com/rfjakob/gocryptfs/pull/592))
   * New feature flag! You need gocryptfs v2.2 or higher to mount a filesystem that uses this flag.
* **`-xchacha`: new option for `-init`** (forward mode only). Selects XChaCha20-Poly1305 for content encryption.
  Gives *much* better performance on CPUs without AES acceleration
  ([#452](https://github.com/rfjakob/gocryptfs/issues/452)).
   * New feature flag! You need gocryptfs v2.2 or higher to mount a filesystem that uses this flag.
   * Test with `gocryptfs -speed` what is fastest for your CPU, or read [here](https://github.com/rfjakob/gocryptfs/issues/452#issuecomment-908559414)
* Rewrite [OpenSSL backend](https://pkg.go.dev/github.com/rfjakob/gocryptfs/v2/internal/stupidgcm)
  for better performance on AES-GCM-256-OpenSSL and XChaCha20-Poly1305-OpenSSL
* `-serialize_reads`: get rid of delay logic by taking advantage of the kernel flag
  `FUSE_CAP_ASYNC_READ`
  ([go-fuse commit](https://github.com/hanwen/go-fuse/commit/15a8bb029a4e1a51e10043c370970596b1fbb737),
  [gocryptfs commit](https://github.com/rfjakob/gocryptfs/commit/a99051b32452c9a781efe248c0014b65d4abddf7))
* Make obsolete `-devrandom` flag a no-op ([commit](https://github.com/rfjakob/gocryptfs/commit/61ef6b00a675456ee05d40f1ce44d693bc4be350))
* Make `-forcedecode` flag a no-op ([commit](https://github.com/rfjakob/gocryptfs/commit/d023cd6c95fcbc6b5056ba1f425d2ac3df4abc5a))
* Fix reverse mode sometimes remapping most inode numbers to >281474976710656 ([commit](https://github.com/rfjakob/gocryptfs/commit/c9b825c58a9f996379108926754513bca03bb306))
* This version will be called v2.2.0 (instead of v2.2) to comply with
  the [Go module versioning](https://golang.org/doc/modules/version-numbers) convention.
  Later releases will also follow the convention.

#### v2.1, 2021-08-18
* `-fido2`: do not request PIN on `gocryptfs -init` fixing `FIDO_ERR_UNSUPPORTED_OPTION` with YubiKey
  ([#571](https://github.com/rfjakob/gocryptfs/issues/571))
* `-sharedstorage`: present stable inode numbers, fixing getcwd failures
  ([#584](https://github.com/rfjakob/gocryptfs/issues/584))
* `-badname`: make it possible to access content of invalid file names ([#568](https://github.com/rfjakob/gocryptfs/pull/568)).
  Thanks @DerDonut!
* Implement recursive `gocryptfs.diriv` caching to fix exponential runtime with deep directories
  ([commit](https://github.com/rfjakob/gocryptfs/commit/84e702126ac4f017e12150532bfaed675dee2927)])
* Implements fsync on directories ([#587](https://github.com/rfjakob/gocryptfs/issues/587))
* `-reverse`: implement `-one-file-system` ([#475](https://github.com/rfjakob/gocryptfs/issues/475))
* `-reverse`: allow exclude-all-but ([#588](https://github.com/rfjakob/gocryptfs/issues/588))
  * Example: `gocryptfs -reverse -exclude-wildcard '*' -exclude-wildcard '!/my-important-files' /home/user /mnt/user.encrypted`
* macOS: Fix `panic: using reserved ID 1` on ExFAT ([#585](https://github.com/rfjakob/gocryptfs/issues/585))
* Switch to `pflag` cli parsing library to support flags and arguments in any order
  ([#590](https://github.com/rfjakob/gocryptfs/issues/590))
* Drop support for Go 1.11 & Go 1.12 ([commit](https://github.com/rfjakob/gocryptfs/commit/a5f88e86d186cdbc67e1efabd7aacf389775e027))
  * You must have Go 1.13 or newer now

#### v2.0.1, 2021-06-07
* Fix symlink creation reporting the wrong size, causing git to report it as modified
  ([#574](https://github.com/rfjakob/gocryptfs/issues/574))

#### v2.0, 2021-06-05
* Fix a few [issues discovered by xfstests](https://github.com/rfjakob/fuse-xfstests/wiki/results_2021-05-19)
  * Biggest change: rewrite SEEK_HOLE / SEEK_DATA logic (now emulates 4k alignment)

#### v2.0-beta4, 2021-05-15
* **Make ACLs *actually* work (pass `-acl` to enable)** ([#536](https://github.com/rfjakob/gocryptfs/issues/536))
* Blocklist `RENAME_EXCHANGE` and `RENAME_WHITEOUT` (broken as discovered by [fuse-xfstest/gocryptfs-2019-12](https://github.com/rfjakob/fuse-xfstests/tree/gocryptfs-2019-12))

#### v2.0-beta3, 2021-04-24
* MANPAGE: Split options into sections acc. to where they apply ([#517](https://github.com/rfjakob/gocryptfs/issues/517))
* `-idle`: count cwd inside the mount as busy ([#533](https://github.com/rfjakob/gocryptfs/issues/533))
* Make `gocryptfs.diriv` and `gocryptfs.xxx.name` files world-readable to make encrypted backups easier
  when mounting via [/etc/fstab](Documentation/MANPAGE.md#fstab) ([#539](https://github.com/rfjakob/gocryptfs/issues/539))
* Make it work with MacFUSE v4.x ([#524](https://github.com/rfjakob/gocryptfs/issues/524))
* **Disable ACL encryption**, it causes a lot of problems ([#543](https://github.com/rfjakob/gocryptfs/issues/543),
  [#536](https://github.com/rfjakob/gocryptfs/issues/536))
  * Old encrypted ACLs are reported by `gocryptfs -fsck` but otherwise ignored
  * This fixes inheritance, but does not yet enforce them correctly
* Include `gocryptfs-xray` in binary releases ([#496](https://github.com/rfjakob/gocryptfs/issues/496))
* go-fuse: track *most recent* parent. This improves robustness when the filesystem is modified behind
  the back of gocryptfs. Helps both with `-sharedstorage` and also without.
  ([commit 1](https://github.com/hanwen/go-fuse/commit/c3186132bf8b7a04b5e5bc27489d88181f92e4e0),
  [commit 2](https://github.com/hanwen/go-fuse/commit/a90e1f463c3f172a7690a6449fe5955a180dfec3),
  [#549](https://github.com/rfjakob/gocryptfs/issues/549))
* Add directory fd caching for 2x - 3x speed boost in small file ops compared to v2.0-beta2
  ([performance numbers](https://github.com/rfjakob/gocryptfs/blob/5cb1e55714aa92a848c0fb5fc3fa7b91625210fe/Documentation/performance.txt#L73))

#### v2.0-beta2, 2020-11-14
* Improve [performance](Documentation/performance.txt#L69)
* Fix [GETATTR panic](https://github.com/rfjakob/gocryptfs/issues/519#issuecomment-718790790) in reverse mode

#### v2.0-beta1, 2020-10-15
* **Switch to the improved go-fuse [v2 API](https://pkg.go.dev/github.com/hanwen/go-fuse/v2@v2.0.3/fs)**
  * This is a big change, a lot of code has been reorganized or rewritten
    to fit the v2 API model.
  * Please test & report bugs
  * No changes to the on-disk format
  * File descriptor caching is not yet implemented,
    causing a slowdown. Caching will be implemented for v2.0 final.
* **Add support for FIDO2 tokens (`-fido2`, [#505](https://github.com/rfjakob/gocryptfs/pull/505))**
* Add `-encrypt-paths` / `-decrypt-paths` functionality to `gocryptfs-xray`
  ([#416](https://github.com/rfjakob/gocryptfs/issues/416))
* Accept multiple `-passfile`s
  ([#288](https://github.com/rfjakob/gocryptfs/issues/288))
* Make `-masterkey=stdin` work together with `-passwd`
  ([#461](https://github.com/rfjakob/gocryptfs/issues/461))
* Fix `Unknown opcode 2016` crash on Google Cloud
  ([go-fuse #276](https://github.com/hanwen/go-fuse/issues/276),
  [gocryptfs commit ec74d1d](https://github.com/rfjakob/gocryptfs/commit/ec74d1d2f4217a9a337d1db9902f32ae2aecaf33))

#### v1.8.0, 2020-05-09
* Enable ACL support ([#453](https://github.com/rfjakob/gocryptfs/issues/453))
  * **Warning 2021-02-07**: This feature is incomplete! Do not use ACLs before gocryptfs v2.0 final!
    Reading and writing ACLs works, but they are not enforced or inherited ([#542](https://github.com/rfjakob/gocryptfs/issues/542))
* Ignore `.nfsXXX` temporary files
  ([#367](https://github.com/rfjakob/gocryptfs/issues/431))
* Handle inode number collisions from multiple devices
  ([#435](https://github.com/rfjakob/gocryptfs/issues/435))
* Drop `-nonempty` for fusermount3
  ([#440](https://github.com/rfjakob/gocryptfs/pull/440))
* Reverse mode: improve inode number mapping and max=1000000000000000000 limitation
  ([#457](https://github.com/rfjakob/gocryptfs/issues/457))
* Enable `--buildmode=pie` ([#460](https://github.com/rfjakob/gocryptfs/pull/460))
* Migrate from dep to Go Modules
  ([commit cad711993](https://github.com/rfjakob/gocryptfs/commit/cad711993d67dd920f9749a09414dbbba6ab8136))
* go mod: update dependencies
  ([commit b23f77c](https://github.com/rfjakob/gocryptfs/commit/b23f77c8ead0dbb5ed59dd50e94f13aacf7dbaf1))
* `gocryptfs -speed`: add XChaCha20-Poly1305-Go
  ([#452](https://github.com/rfjakob/gocryptfs/issues/452))
* Respect `GOMAXPROCS` environment variable
  ([commit ff210a06f](https://github.com/rfjakob/gocryptfs/commit/ff210a06fb3097eecd5668ddb3ace9c76873eb00)
* Completely remove Trezor-related code (commit 1364b44ae356da31e24e5605fe73a307e9d6fb03)
  * Has been disabled since v1.7 due to issues a third-party module.
  * Please use FIDO2 instead (gocryptfs v2.0)

#### v1.7.1, 2019-10-06
* Support wild cards in reverse mode via `--exclude-wildcard`
  ([#367](https://github.com/rfjakob/gocryptfs/pull/367)). Thanks @ekalin!
* Create `gocryptfs.diriv` files with 0440 permissions to make it easier to
  share an encrypted folder via a network drive
  ([#387](https://github.com/rfjakob/gocryptfs/issues/387)).
  Note: as a security precaution, the owner must still manually
  `chmod gocryptfs.conf 0440` to allow mounting.
* Allow the `nofail` option in `/etc/fstab`
* `-passwd` can now change the `-scryptn` parameter for existing filesystems
  ([#400](https://github.com/rfjakob/gocryptfs/issues/400))
* Fix `-idle` unmounting the filesystem despite recent activity
  ([#421](https://github.com/rfjakob/gocryptfs/issues/421))
* **Fix a race condition related to inode number reuse
  ([#363](https://github.com/rfjakob/gocryptfs/issues/363))**.
  It could be triggered by concurrently creating and deleting files and can lead to data loss
  in the affected file. This bug was found by the automated tests on Travis
  and was very hard to trigger locally.
* tests: use /var/tmp instead of /tmp by default
  ([commit 8c4429](https://github.com/rfjakob/gocryptfs/commit/8c4429408716d9890a98a48c246d616dbfea7e31))

#### v1.7, 2019-03-17
* **Fix possible symlink race attacks in forward mode** when using allow_other + plaintextnames
  * If you use *both* `-allow_other` *and* `-plaintextnames`, you should upgrade.
    Malicious users could trick gocryptfs into modifying files outside of `CIPHERDIR`,
	or reading files inside `CIPHERDIR` that they should not have access to.
  * If you do not use `-plaintextnames` (disabled per default), these attacks do
    not work as symlinks are encrypted.
  * Forward mode has been reworked to use the "\*at" family of system calls everywhere
    (`Openat/Unlinkat/Symlinkat/...`).
  * As a result, gocryptfs may run slightly slower, as the caching logic has been
    replaced and is very simple at the moment.
  * The possibility for such attacks was found during an internal code review.
* Reverse mode: fix excluded, unaccessible files showing up in directory listings
  ([#285](https://github.com/rfjakob/gocryptfs/issues/285),
  [#286](https://github.com/rfjakob/gocryptfs/issues/286))
* gocryptfs-xray: add `-aessiv` flag for correctly parsing AES-SIV format files
  ([#299](https://github.com/rfjakob/gocryptfs/issues/299))
* Ensure that standard fds 0,1,2 are always initialized
  ([#320](https://github.com/rfjakob/gocryptfs/issues/320)).
  Prevents trouble in the unlikely case that gocryptfs is called with
  stdin,stdout and/or stderr closed.
* `-extpass` now can be specified multiple times to support arguments containing spaces
  ([#289](https://github.com/rfjakob/gocryptfs/issues/289))
* Drop Fstatat, Mkdirat, Syslinkat, Fchownat, Unlinkat, Renameat, Openat emulation of MacOS
  and instead use native functions (thanks @slackner !)
* Use `Setreuid` to robustly set the owner with allow_other (@slackner,
  ([commit](https://github.com/rfjakob/gocryptfs/commit/03b9d65cce53fb95b7d489ecd03d0853b9b923fb)))
* Pack the rendered man page into the source code archive for user convenience
  ([issue 355](https://github.com/rfjakob/gocryptfs/issues/355))
* Disable Trezor support again (commit 16fac26c57ba303bf60266d24c17f5243e5ea376)
  * Trezor support has been broken since Sept 2018 due to issues
    in a third-party module ([#261](https://github.com/rfjakob/gocryptfs/issues/261))

#### v1.6.1, 2018-12-12
* Fix "Operation not supported" chmod errors on Go 1.11
  ([#271](https://github.com/rfjakob/gocryptfs/issues/271))

#### v1.6, 2018-08-18
* **Add `-e` / `-exclude` option** for reverse mode
  ([#235](https://github.com/rfjakob/gocryptfs/issues/235),
  [commit](https://github.com/rfjakob/gocryptfs/commit/ec2fdc19cf9358ae7ba09c528a5807b6b0760f9b))
* Add support for the Trezor One HSM [PR#247](https://github.com/rfjakob/gocryptfs/pull/247), thanks @xaionaro!
  * Use `./build.bash -tags enable_trezor` to compile with Trezor support
  * Then, use `gocryptfs -init -trezor` to create a filesystem locked with a physical Trezor device.
  * Note 2021-01-31: Support was removed again in gocryptfs v1.7. Please use `-fido2` in gocryptfs v2.0.
* Only print master key once, on init
  ([#76](https://github.com/rfjakob/gocryptfs/issues/76),
  [commit](https://github.com/rfjakob/gocryptfs/commit/6d64dfe8f7acd8e9ca4a659d26318e442c2db85a))
* Fall back to buffered IO even when passed `O_DIRECT`
  ([commit](https://github.com/rfjakob/gocryptfs/commit/893e41149ed353f355047003b89eeff456990e76))

#### v1.5, 2018-06-12
* **Support extended attributes (xattr)** in forward mode
  ([#217](https://github.com/rfjakob/gocryptfs/issues/217)). Older gocryptfs versions
  will ignore the extended attributes.
* **Add `-fsck` function**
  ([#191](https://github.com/rfjakob/gocryptfs/issues/191))
* Fix clobbered timestamps on MacOS High Sierra
  ([#229](https://github.com/rfjakob/gocryptfs/issues/229))
* Add `-masterkey=stdin` functionality
  ([#218](https://github.com/rfjakob/gocryptfs/issues/218))
* Accept `-dev`/`-nodev`, `suid`/`nosuid`, `-exec`/`-noexec`,
  `-ro`/`-rw` flags to make mounting via `/etc/fstab` possible.
  Thanks @mahkoh! ([#233](https://github.com/rfjakob/gocryptfs/pull/233),
  [commit](https://github.com/rfjakob/gocryptfs/commit/53d6a9999dd0e4c31636d16179f284fff35a35d9),
  [commit](https://github.com/rfjakob/gocryptfs/commit/10212d791a3196c2c8705a7a3cccdeb14a8efdbe))
* Fix a `logger` path issue on SuSE
  [#225](https://github.com/rfjakob/gocryptfs/issues/225)
* Stop printing the help text on a "flag provided but not defined"
  error ([commit](https://github.com/rfjakob/gocryptfs/commit/5ad26495fc86527bbfe75ac6b46528d49a373676))

#### v1.4.4, 2018-03-18
* Overwrite secrets in memory with zeros as soon as possible
  ([#211](https://github.com/rfjakob/gocryptfs/issues/211))
* Fix Getdents problems on i386 and mips64le
  ([#197](https://github.com/rfjakob/gocryptfs/issues/197),
  [#200](https://github.com/rfjakob/gocryptfs/issues/200))
* Make building with gccgo work
  ([#201](https://github.com/rfjakob/gocryptfs/issues/201))
* MacOS: fix `osxfuse: vnode changed generation` / `Error code -36` issue in go-fuse
  ([#213](https://github.com/rfjakob/gocryptfs/issues/213),
  [commit](https://github.com/hanwen/go-fuse/commit/a9ddcb8a4b609500fc59c89ccc9ee05f00a5fefd))
* Fix various test issues on MacOS

#### v1.4.3, 2018-01-21
* **Fix several symlink race attacks** in connection with reverse mode
  and allow_other. Thanks to @slackner for reporting and helping to fix
  the issues:
  * Fix symlink races in reverse mode
    ([issue #165](https://github.com/rfjakob/gocryptfs/issues/165))
  * Fix symlink races in connection with `-allow_other`
    ([issue #177](https://github.com/rfjakob/gocryptfs/issues/177))
* Fix problems with special names when using `-plaintextnames`
  ([issue #174](https://github.com/rfjakob/gocryptfs/issues/174))
* Add `-devrandom` command-line option
  ([commit](https://github.com/rfjakob/gocryptfs/commit/f3c777d5eaa682d878c638192311e52f9c204294))
* Add `-sharedstorage` command-line option
  ([commit](https://github.com/rfjakob/gocryptfs/commit/e36a0ebf189a826aaa63909c5518c16356f5f903),
  [issue #156](https://github.com/rfjakob/gocryptfs/issues/156))
* MacOS: let OSXFuse create the mountpoint if it does not exist
  ([issue #194](https://github.com/rfjakob/gocryptfs/issues/194))

#### v1.4.2, 2017-11-01
* Add `Gopkg.toml` file for `dep` vendoring and reproducible builds
  ([issue #142](https://github.com/rfjakob/gocryptfs/issues/142))
* MacOS: deal with `.DS_Store` files inside CIPHERDIR
  ([issue #140](https://github.com/rfjakob/gocryptfs/issues/140))
* Reverse mode: fix ENOENT error affecting names exactly 176 bytes long
  ([issue #143](https://github.com/rfjakob/gocryptfs/issues/143))
* Support kernels compiled with > 128 kiB FUSE request size (Synology NAS)
  ([issue #145](https://github.com/rfjakob/gocryptfs/issues/145),
  [commit](https://github.com/rfjakob/gocryptfs/commit/4954c87979efaf5b8184efccc7d9a38c21e4209b))
* Fix a startup hang when `$PATH` contains the mountpoint
  ([issue #146](https://github.com/rfjakob/gocryptfs/issues/146))

#### v1.4.1, 2017-08-21
* **Use memory pools for buffer handling** (
  [3c6fe98](https://github.com/rfjakob/gocryptfs/commit/3c6fe98),
  [b2a23e9](https://github.com/rfjakob/gocryptfs/commit/b2a23e9),
  [12c0101](https://github.com/rfjakob/gocryptfs/commit/12c0101))
  * On my machine, this **doubles** the streaming read speed
    (see [performance.txt](https://github.com/rfjakob/gocryptfs/blob/v1.4.1/Documentation/performance.txt#L38))
* Implement and use the getdents(2) syscall for a more efficient
  OpenDir implementation
  ([e50a6a5](https://github.com/rfjakob/gocryptfs/commit/e50a6a5))
* Purge masterkey from memory as soon as possible
  ([issue #137](https://github.com/rfjakob/gocryptfs/issues/137))
* Reverse mode: fix inode number collision between .name and .diriv
  files
  ([d12aa57](https://github.com/rfjakob/gocryptfs/commit/d12aa57))
* Prevent the logger from holding stdout open
  ([issue #130](https://github.com/rfjakob/gocryptfs/issues/130))
* MacOS: make testing without openssl work properly
  ([ccf1a84](https://github.com/rfjakob/gocryptfs/commit/ccf1a84))
* MacOS: specify a volume name
  ([9f8e19b](https://github.com/rfjakob/gocryptfs/commit/9f8e19b))
* Enable writing to write-only files
  ([issue #125](https://github.com/rfjakob/gocryptfs/issues/125))

#### v1.4, 2017-06-20
* **Switch to static binary releases**
  * From gocryptfs v1.4, I will only release statically-built binaries.
    These support all Linux distributions but cannot use OpenSSL.
  * OpenSSL is still supported - just compile from source!
* Add `-force_owner` option to allow files to be presented as owned by a
  different user or group from the user running gocryptfs. Please see caveats
  and guidance in the man page before using this functionality.
* Increase open file limit to 4096 ([#82](https://github.com/rfjakob/gocryptfs/issues/82)).
* Implement path decryption via ctlsock ([#84](https://github.com/rfjakob/gocryptfs/issues/84)).
  Previously, decryption was only implemented for reverse mode. Now both
  normal and reverse mode support both decryption and encryption of
  paths via ctlsock.
* Add more specific exit codes for the most common failure modes,
  documented in [CLI_ABI.md](Documentation/CLI_ABI.md)
* Reverse mode: make sure hard-linked files always return the same
  ciphertext
  ([commit 9ecf2d1a](https://github.com/rfjakob/gocryptfs/commit/9ecf2d1a3f69e3d995012073afe3fc664bd928f2))
* Display a shorter, friendlier help text by default.
* **Parallelize file content encryption** by splitting data blocks into two
  threads ([ticket#116](https://github.com/rfjakob/gocryptfs/issues/116))
* Prefetch random nonces in the background
  ([commit 80516ed](https://github.com/rfjakob/gocryptfs/commit/80516ed3351477793eec882508969b6b29b69b0a))
* Add `-info` option to pretty-print infos about a filesystem.

#### v1.3, 2017-04-29
* **Use HKDF to derive separate keys for GCM and EME**
  * New feature flag: `HKDF` (enabled by default)
  * This is a forwards-compatible change. gocryptfs v1.3 can mount
   filesystems created by earlier versions but not the other way round.
* **Enable Raw64 filename encoding by default (gets rid of trailing `==` characters)**
  * This is a forwards-compatible change. gocryptfs v1.3 can mount
   filesystems created by earlier versions but not the other way round.
* Drop Go 1.4 compatibility. You now need Go 1.5 (released 2015-08-19)
  or higher to build gocryptfs.
* Add `-serialize_reads` command-line option
  * This can greatly improve performance on storage
    that is very slow for concurrent out-of-order reads. Example:
    Amazon Cloud Drive ([#92](https://github.com/rfjakob/gocryptfs/issues/92))
* Reject file-header-only files
  ([#90 2.2](https://github.com/rfjakob/gocryptfs/issues/90),
  [commit](https://github.com/rfjakob/gocryptfs/commit/14038a1644f17f50b113a05d09a2a0a3b3e973b2))
* Increase max password size to 2048 bytes ([#93](https://github.com/rfjakob/gocryptfs/issues/93))
* Use stable 64-bit inode numbers in reverse mode
  * This may cause problems for very old 32-bit applications
    that were compiled without Large File Support.
* Passing "--" now also blocks "-o" parsing

#### v1.2.1, 2017-02-26
* Add an integrated speed test, `gocryptfs -speed`
* Limit password size to 1000 bytes and reject trailing garbage after the newline
* Make the test suite work on [Mac OS X](https://github.com/rfjakob/gocryptfs/issues/15)
* Handle additional corner cases in `-ctlsock` path sanitization
* Use dedicated exit code 12 on "password incorrect"

#### v1.2, 2016-12-04
* Add a control socket interface. Allows to encrypt and decrypt filenames.
  For details see [backintime#644](https://github.com/bit-team/backintime/issues/644#issuecomment-259835183).
  * New command-line option: `-ctlsock`
* Under certain circumstances, concurrent truncate and read could return
  an I/O error. This is fixed by introducing a global open file table
  that stores the file IDs
  ([commit](https://github.com/rfjakob/gocryptfs/commit/0489d08ae21107990d0efd0685443293aa26b35f)).
* Coalesce 4kB ciphertext block writes up to the size requested through
  the write FUSE call
  ([commit with benchmarks](https://github.com/rfjakob/gocryptfs/commit/024511d9c71558be4b1169d6bb43bd18d65539e0))
* Add `-noprealloc` command-line option
  * Greatly speeds up writes on Btrfs
    ([#63](https://github.com/rfjakob/gocryptfs/issues/63))
    at the cost of reduced out-of-space robustness.
  * This is a workaround for Btrfs' slow fallocate(2)
* Preserve owner for symlinks an device files (fixes bug [#64](https://github.com/rfjakob/gocryptfs/issues/64))
* Include rendered man page `gocryptfs.1` in the release tarball

#### v1.1.1, 2016-10-30
* Fix a panic on setting file timestamps ([go-fuse#131](https://github.com/hanwen/go-fuse/pull/131))
* Work around an issue in tmpfs that caused a panic in xfstests generic/075
  ([gocryptfs#56](https://github.com/rfjakob/gocryptfs/issues/56))
* Optimize NFS streaming writes
  ([commit](https://github.com/rfjakob/gocryptfs/commit/a08d55f42d5b11e265a8617bee16babceebfd026))

#### v1.1, 2016-10-19
* **Add reverse mode ([#19](https://github.com/rfjakob/gocryptfs/issues/19))**
  * AES-SIV (RFC5297) encryption to implement deterministic encryption
    securely. Uses the excellent
    [jacobsa/crypto](https://github.com/jacobsa/crypto) library.
    The corresponding feature flag is called `AESSIV`.
  * New command-line options: `-reverse`, `-aessiv`
  * Filesystems using reverse mode can only be mounted with gocryptfs v1.1
    and later.
  * The default, forward mode, stays fully compatible with older versions.
    Forward mode will keep using GCM because it is much faster.
* Accept `-o foo,bar,baz`-style options that are passed at the end of
  the command-line, like mount(1) does. All other options must still
  precede the passed paths.
  * This allows **mounting from /etc/fstab**. See
    [#45](https://github.com/rfjakob/gocryptfs/issues/45) for details.
  * **Mounting on login using pam_mount** works as well. It is
    [described in the wiki](https://github.com/rfjakob/gocryptfs/wiki/Mounting-on-login-using-pam_mount).
* To prevent confusion, the old `-o` option had to be renamed. It is now
  called `-ko`. Arguments to `-ko` are passed directly to the kernel.
* New `-passfile` command-line option. Provides an easier way to read
  the password from a file. Internally, this is equivalent to
  `-extpass "/bin/cat FILE"`.
* Enable changing the password when you only know the master key
  ([#28](https://github.com/rfjakob/gocryptfs/issues/28))

#### v1.0, 2016-07-17
* Deprecate very old filesystems, stage 3/3
  * Filesystems created by v0.6 can no longer be mounted
  * Drop command-line options `-gcmiv128`, `-emenames`, `-diriv`. These
    are now always enabled.
* Add fallocate(2) support
* New command-line option `-o`
  * Allows to pass mount options directly to the kernel
* Add support for device files and suid binaries
  * Only works when running as root
  * Must be explicitly enabled by passing "-o dev" or "-o suid" or "-o suid,dev"
* Experimental Mac OS X support. See
  [ticket #15](https://github.com/rfjakob/gocryptfs/issues/15) for details.

#### v0.12, 2016-06-19
* Deprecate very old filesystems, stage 2/3
  * Filesystems created by v0.6 and older can only be mounted read-only
  * A [message](https://github.com/rfjakob/gocryptfs/blob/v0.12/internal/configfile/config_file.go#L120)
    explaining the situation is printed as well
* New command line option: `-ro`
  * Mounts the filesystem read-only
* Accept password from stdin as well ([ticket #30](https://github.com/rfjakob/gocryptfs/issues/30))

#### v0.11, 2016-06-10
* Deprecate very old filesystems, stage 1/3
  * Filesystems created by v0.6 and older can still be mounted but a
    [warning](https://github.com/rfjakob/gocryptfs/blob/v0.11/internal/configfile/config_file.go#L120)
    is printed
  * See [ticket #29](https://github.com/rfjakob/gocryptfs/issues/29) for details and
    join the discussion
* Add rsync stress test "pingpong-rsync.bash"
  * Fix chown and utimens failures that caused rsync to complain
* Build release binaries with Go 1.6.2
  * Big speedup for CPUs with AES-NI, see [ticket #23](https://github.com/rfjakob/gocryptfs/issues/23)

#### v0.10, 2016-05-30
* **Replace `spacemonkeygo/openssl` with `stupidgcm`**
  * gocryptfs now has its own thin wrapper to OpenSSL's GCM implementation
    called `stupidgcm`.
  * This should fix the [compile issues](https://github.com/rfjakob/gocryptfs/issues/21)
    people are seeing with `spacemonkeygo/openssl`. It also gets us
    a 20% performance boost for streaming writes.
* **Automatically choose between OpenSSL and Go crypto** [issue #23](https://github.com/rfjakob/gocryptfs/issues/23)
  * Go 1.6 added an optimized GCM implementation in amd64 assembly that uses AES-NI.
    This is faster than OpenSSL and is used if available. In all other
    cases OpenSSL is much faster and is used instead.
  * `-openssl=auto` is the new default
  * Passing `-openssl=true/false` overrides the autodetection.
* Warn but continue anyway if fallocate(2) is not supported by the
  underlying filesystem, see [issue #22](https://github.com/rfjakob/gocryptfs/issues/22)
  * Enables to use gocryptfs on ZFS and ext3, albeit with reduced out-of-space safety.
* [Fix statfs](https://github.com/rfjakob/gocryptfs/pull/27), by @lxp
* Fix a fsstress [failure](https://github.com/hanwen/go-fuse/issues/106)
  in the go-fuse library.

#### v0.9, 2016-04-10
* **Long file name support**
  * gocryptfs now supports file names up to 255 characters.
  * This is a forwards-compatible change. gocryptfs v0.9 can mount filesystems
   created by earlier versions but not the other way round.
* Refactor gocryptfs into multiple "internal" packages
* New command-line options:
  * `-longnames`: Enable long file name support (default true)
  * `-nosyslog`: Print messages to stdout and stderr instead of syslog (default false)
  * `-wpanic`: Make warning messages fatal (used for testing)
  * `-d`: Alias for `-debug`
  * `-q`: Alias for `-quiet`

#### v0.8, 2016-01-23
* Redirect output to syslog when running in the background
* New command-line option:
  * `-memprofile`: Write a memory allocation debugging profile the specified
    file

#### v0.7.2, 2016-01-19
* **Fix performance issue in small file creation**
  * This brings performance on-par with EncFS paranoia mode, with streaming writes
    significantly faster
  * The actual [fix](https://github.com/hanwen/go-fuse/commit/c4b6b7949716d13eec856baffc7b7941ae21778c)
    is in the go-fuse library. There are no code changes in gocryptfs.

#### v0.7.1, 2016-01-09
* Make the `build.bash` script compatible with Go 1.3
* Disable fallocate on OSX (system call not available)
* Introduce pre-built binaries for Fedora 23 and Debian 8

#### v0.7, 2015-12-20
* **Extend GCM IV size to 128 bit from Go's default of 96 bit**
  * This pushes back the birthday bound to make IV collisions virtually
    impossible
  * This is a forwards-compatible change. gocryptfs v0.7 can mount filesystems
    created by earlier versions but not the other way round.
* New command-line option:
  * `-gcmiv128`: Use 128-bit GCM IVs (default true)

#### v0.6, 2015-12-08
* **Wide-block filename encryption using EME + DirIV**
  * EME (ECB-Mix-ECB) provides even better security than CBC as it fixes
    the prefix leak. The used Go EME implementation is
    https://github.com/rfjakob/eme which is, as far as I know, the first
    implementation of EME in Go.
  * This is a forwards-compatible change. gocryptfs v0.6 can mount filesystems
    created by earlier versions but not the other way round.
* New command-line option:
  * `-emenames`: Enable EME filename encryption (default true)

#### v0.5.1, 2015-12-06
* Fix a rename regression caused by DirIV and add test case
* Use fallocate to guard against out-of-space errors

#### v0.5, 2015-12-04
* **Stronger filename encryption: DirIV**
  * Each directory gets a random 128 bit file name IV on creation,
    stored in `gocryptfs.diriv`
  * This makes it impossible to identify identically-named files across
    directories
  * A single-entry IV cache brings the performance cost of DirIV close to
    zero for common operations (see performance.txt)
  * This is a forwards-compatible change. gocryptfs v0.5 can mount filesystems
    created by earlier versions but not the other way round.
* New command-line option:
  * `-diriv`: Use the new per-directory IV file name encryption (default true)
  * `-scryptn`: allows to set the scrypt cost parameter N. This option
    can be used for faster mounting at the cost of lower brute-force
    resistance. It was mainly added to speed up the automated tests.

#### v0.4, 2015-11-15
* New command-line options:
  * `-plaintextnames`: disables filename encryption, added on user request
  * `-extpass`: calls an external program for prompting for the password
  * `-config`: allows to specify a custom gocryptfs.conf path
* Add `FeatureFlags` gocryptfs.conf parameter
  * This is a config format change, hence the on-disk format is incremented
  * Used for ext4-style filesystem feature flags. This should help avoid future
    format changes. The first user is `-plaintextnames`.
* On-disk format 2

#### v0.3, 2015-11-01
* **Add a random 128 bit file header to authenticate file->block ownership**
  * This is an on-disk-format change
* On-disk format 1

#### v0.2, 2015-10-11
* Replace bash daemonization wrapper with native Go implementation
* Better user feedback on mount failures

#### v0.1, 2015-10-07
* First release
* On-disk format 0


text:
CLASS({
  package: 'foam.graphics',
  name: 'ImageCView',
  extendsModel: 'foam.graphics.CView',

  properties: [
    {
      name: 'src',
      label: 'Source'
    },
    'width',
    'height'
  ],

  methods: {
    initCView: function() {
      this.SUPER();
      this.image_ = new Image();
      this.image_.onload = function() {
        this.view.paint();
      }.bind(this);
      this.image_.src = this.src;
      this.view.paint();
    },

    transform: function() {
      if ( this.width && this.image_.width )
        this.scaleX = this.width / this.image_.width;
      if ( this.height && this.image_.height )
        this.scaleY = this.height / this.image_.height;

      this.SUPER();
    },
    paintSelf: function() {
      this.canvas.drawImage(this.image_, 0, 0);
    }
  }
});

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Modeling — OSIM 0.1 documentation</title>

    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Circuit System Equations" href="Modeling/CircuitSystemEquations.html" />
    <link rel="prev" title="Welcome to OSIM's documentation!" href="index.html" />

  <link rel="stylesheet" href="_static/custom.css" type="text/css" />

  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

Modeling¶

The Modeling-Layer is the fundamental part of the mathematical description of an analog curcuit. Therefor exist two again

Circuit System Equations

Components

OSIM.Modeling.AbstractComponents.Component module

Related Topics

Documentation overview

Previous: Welcome to OSIM’s documentation!

Next: Circuit System Equations

This Page

Show Source

Quick search

    <form class="search" action="search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

      ©2017, Tim Maiwald.

      |
      Powered by Sphinx 1.5.4
      & Alabaster 0.7.9

      |
      Page source


text:
/*
 Longest Substring Without Repeating Characters  QuestionEditorial Solution  My Submissions
Total Accepted: 162775
Total Submissions: 720494
Difficulty: Medium
Given a string, find the length of the longest substring without repeating characters.

Examples:

Given "abcabcbb", the answer is "abc", which the length is 3.

Given "bbbbb", the answer is "b", with the length of 1.

Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring.

Hide Company Tags Amazon Adobe Bloomberg Yelp
Hide Tags Hash Table Two Pointers String
Hide Similar Problems (H) Longest Substring with At Most Two Distinct Characters
*/
public class Solution {
    public int lengthOfLongestSubstring(String s) {
        if(s==null || s.length()==0) return 0;
        if(s.length()==1)return 1;

        HashMap<Character, Integer> map = new HashMap<Character, Integer>();
        int max=0;
        for (int i=0, j=0; i<s.length(); ++i){
            if (map.containsKey(s.charAt(i))){
                j = Math.max(j,map.get(s.charAt(i))+1);
            }
            map.put(s.charAt(i),i);
            max = Math.max(max,i-j+1);
        }
        return max;

    }
}


text:
<?xml version="1.0" encoding="utf-8"?>

<WebWorksHelpSettings version="5.0" xmlns="urn:WebWorks-Help-Settings-Schema">
  <Common>
    <Cookies daystoexpire="30" enable="true" id="F0E3BF8D50631D13" />
    <Accessible value="false" />
    <SeeAlso showbook="false">
      <Size width="250" />
      <Indent value="17" />
      <Title>

        <Colors foreground="#FFFFFF" background="#999999" />
      </Title>

      <Colors foreground="#003399" background="#FFFFFF" border="#666666" />
    </SeeAlso>
    <NavigationBar>
      <SyncContents enable="true" />
      <Previous enable="false" />
      <Next enable="false" />
      <RelatedTopics enableicon="true" enableinline="true">
        <Title>

          <Colors foreground="#FFFFFF" background="#999999" />
        </Title>
        <Inline>

          <Colors foreground="#003366" />
        </Inline>

        <Colors foreground="#003399" background="#FFFFFF" border="#666666" />
        <Size width="250" />
      </RelatedTopics>
      <Email enable="false" address="" />
      <Print enable="true" />
      <Bookmark enable="false" />
      <PDF enable="false" />
    </NavigationBar>
    <Tabs>
      <DefaultColors foreground="#666666" />
      <SelectedColors foreground="#FFFFFF" />
    </Tabs>
    <Panels>
      <HoverText enable="true">

        <Colors foreground="#000000" background="#FFFFCC" border="#999999" />
        <Size width="150" />
      </HoverText>
      <Contents enable="true" />
      <Index enable="true" />
      <Search enable="true">
        <Results showrank="true" />
        <Highlighting enable="true">
          <Colors foreground="#FFFFFF" background="#333399" />
        </Highlighting>
      </Search>
      <Favorites enable="true" />
    </Panels>
    <Popups>
      <Colors foreground="#000000" background="#FFFFCC" border="#999999" />
      <Size width="200" />
    </Popups>
  </Common>
  <Implementations>
    <JavaScript>

      <Indent value="17" />
      <AnchorColors highlight="#CCCCCC" enabled="#315585" disabled="black" />
      <Tabs>

      </Tabs>
      <Panels>
        <Contents />
        <Index>
          <SectionNavigation threshold="500" separator=" - ">

            <CurrentColor value="black" />
            <AnchorColors highlight="#CCCCCC" enabled="#315585" disabled="#999999" />
          </SectionNavigation>
        </Index>
        <Search resultsbybook="true" />
        <Favorites />
      </Panels>
    </JavaScript>
  </Implementations>
</WebWorksHelpSettings>


text:
title: Ban ecosystem, meme, platform
date: 2013-06-04T09:24:03.000Z
layout: quote
latitude: '53.5688116'
longitude: '-1.7908556'
altitude: '0'
---
> 90% of most technology debates can be repaired just by banning three words "ecosystem," "meme," "platform." How do we fix the remaining 10%?

-- Evgeny Morozov


text:
class CPieChartWnd;

/////////////////////////////////////////////////////////////////////////////
// CViewPrintPreview view

class CViewPrintPreview : public CView
{
protected:
	CViewPrintPreview();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CViewPrintPreview)

// Attributes
public:
	CGridCtrl *m_pCtrl;
  CChartCtrl* m_pChartCtrl;
  CPieChartWnd* m_pPieCtrl;
	CFrameWnd *m_pOldFrame;

// Operations
public:
	virtual void OnFilePrintPreview();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CViewPrintPreview)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CViewPrintPreview();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
	//{{AFX_MSG(CViewPrintPreview)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_VIEWPRINTPREVIEW_H__137FC880_1607_11D3_9317_8F51A5F9742F__INCLUDED_)


text:
package mil.nga.giat.geowave.analytic.param;

import java.util.Arrays;
import java.util.Set;

import mil.nga.giat.geowave.analytic.PropertyManagement;
import mil.nga.giat.geowave.analytic.partitioner.Partitioner;

import org.apache.commons.cli.Option;

public class PartitionParameters
{
	public enum Partition
			implements
			ParameterEnum {
		PARTITION_DISTANCE(
				Double.class),
		MAX_MEMBER_SELECTION(
				Integer.class),
		PARTITIONER_CLASS(
				Partitioner.class);

		private final Class<?> baseClass;

		Partition(
				final Class<?> baseClass ) {
			this.baseClass = baseClass;
		}

		@Override
		public Class<?> getBaseClass() {
			return baseClass;
		}

		@Override
		public Enum<?> self() {
			return this;
		}
	}

	public static final void fillOptions(
			final Set<Option> options,
			final Partition[] params ) {
		if (contains(
				params,
				Partition.PARTITIONER_CLASS)) {
			options.add(PropertyManagement.newOption(
					Partition.PARTITIONER_CLASS,
					"pc",
					"Index Identifier for Centroids",
					true));
		}
		if (contains(
				params,
				Partition.MAX_MEMBER_SELECTION)) {
			options.add(PropertyManagement.newOption(
					Partition.MAX_MEMBER_SELECTION,
					"pms",
					"Maximum number of members selected from a partition",
					true));
		}
		if (contains(
				params,
				Partition.PARTITION_DISTANCE)) {
			options.add(PropertyManagement.newOption(
					Partition.PARTITION_DISTANCE,
					"pd",
					"Partition Distance",
					true));
		}
	}

	private static boolean contains(
			final Partition[] params,
			final Partition option ) {
		return Arrays.asList(
				params).contains(
				option);
	}
}


text:
package backup.store.local;

import java.io.File;

import org.apache.commons.configuration.Configuration;

import backup.BackupConstants;
import backup.integration.MiniClusterTestBase;

public class LocalBackupStoreMiniClusterTest extends MiniClusterTestBase {

  private final File tmp = new File("./target/tmp");
  private final File backup = new File(tmp, "backup");

  @Override
  protected void setupBackupStore(Configuration conf) {
    backup.mkdirs();
    conf.setProperty(BackupConstants.DFS_BACKUP_STORE_KEY, "backup.store.local.LocalBackupStore");
    conf.setProperty(LocalBackupStoreConstants.DFS_BACKUP_LOCALBACKUPSTORE_PATH, backup.getAbsolutePath());
  }

  @Override
  protected String testArtifactId() {
    return "local-backup-store";
  }

  @Override
  protected String testGroupName() {
    return "hdfs-backup";
  }

  @Override
  protected String testVersion() {
    return "1.0-SNAPSHOT";
  }

}


text:
package net.sf.jColtrane.annotations.methods;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import net.sf.jColtrane.factory.BeforeElementConditionsFactory;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
@ConditionFactoryAnnotation(BeforeElementConditionsFactory.class)
public @interface BeforeElement {
	String tag()default "";
	String uri() default "";
	String localName() default "";
	int elementDeep();
	ContainAttribute[] attributes()default {@ContainAttribute};
}


text:
import { getTags } from '@/services/tags';
import template from './tags-list.html';

class TagsList {
  constructor() {
    // An array of objects that with the name and count of the tagged items
    this.allTags = [];
    // A set of tag names
    this.selectedTags = new Set();
    getTags(this.tagsUrl).then((tags) => {
      this.allTags = tags;
    });
  }
  toggleTag($event, tag) {
    if ($event.shiftKey) {
      // toggle tag
      if (this.selectedTags.has(tag)) {
        this.selectedTags.delete(tag);
      } else {
        this.selectedTags.add(tag);
      }
    } else {
      // if the tag is the only selected, deselect it, otherwise select only it
      if (this.selectedTags.has(tag) && this.selectedTags.size === 1) {
        this.selectedTags.clear();
      } else {
        this.selectedTags.clear();
        this.selectedTags.add(tag);
      }
    }

    if (this.onTagsUpdate) {
      this.onTagsUpdate(this.selectedTags);
    }
  }
}

export default function init(ngModule) {
  ngModule.component('tagsList', {
    template,
    bindings: {
      tagsUrl: '@',
      onTagsUpdate: '=',
    },
    controller: TagsList,
  });
}


text:
#include "cstring.h"

#include <algorithm>
#include <ios>
#include <string>
#include <unordered_set>

#include "hash.h"

namespace {
enum class table_entry_flags {
    none,
    no_need_copy = 1 << 0,
    require_destruction = 1 << 1,
    inplace = 1 << 2,
};

inline table_entry_flags operator&(table_entry_flags l, table_entry_flags r) {
    return static_cast<table_entry_flags>(static_cast<int>(l) & static_cast<int>(r));
}

inline table_entry_flags operator|(table_entry_flags l, table_entry_flags r) {
    return static_cast<table_entry_flags>(static_cast<int>(l) | static_cast<int>(r));
}

// cache entry, ordered by string length
class table_entry {
    std::size_t m_length = 0;
    table_entry_flags m_flags = table_entry_flags::none;

    union {
        const char* m_string;
        char m_inplace_string[sizeof(const char*)];
    };

 public:
    // entry ctor, makes copy of passed string
    table_entry(const char* string, std::size_t length, table_entry_flags flags)
        : m_length(length) {
        if ((flags & table_entry_flags::no_need_copy) == table_entry_flags::no_need_copy) {
            // No need to copy object, it's view of string, string literal or string allocated
            // on heap and wrapped with cstring.
            // Inherit require_destruction flag here, because string can be allready
            // allocated on heap and wrapped with cstring object, so cstring owns the string now

            m_flags = flags & table_entry_flags::require_destruction;
            m_string = string;
            return;
        }

        if (length < sizeof(const char*)) {
            // String with length less than size of pointer store directly
            // in pointer, that hint allows reduce stack fragmentation.
            // We can make such optimization because std::unordered_set never
            // moves objects in memory on new element insert
            std::memcpy(m_inplace_string, string, length);
            m_inplace_string[length] = '\0';
            m_flags = table_entry_flags::inplace;
        } else {
            // Make copy of string elseware
            auto copy = new char[length + 1];
            std::memcpy(copy, string, length);
            copy[length] = '\0';
            m_string = copy;

            // destruction required, because we own copy of string
            m_flags = table_entry_flags::require_destruction;
        }
    }

    // table_entry moveable only
    table_entry(const table_entry&) = delete;

    table_entry(table_entry&& other) : m_length(other.m_length), m_flags(other.m_flags) {
        // this object for internal usage only, length will never be accessed
        // if object was moved, so do not zero other.m_length here

        if (is_inplace()) {
            std::memcpy(m_inplace_string, other.m_inplace_string, sizeof(m_inplace_string));
        } else {
            m_string = other.string();
            other.m_string = nullptr;
        }
    }

    ~table_entry() {
        if ((m_flags & table_entry_flags::require_destruction) ==
            table_entry_flags::require_destruction) {
            // null pointer checked in operator delete [], so we don't need
            // to check it explicitly

            delete[] m_string;
        }
    }

    std::size_t length() const { return m_length; }

    const char* string() const {
        if (is_inplace()) {
            return m_inplace_string;
        }

        return m_string;
    }

    bool operator==(const table_entry& other) const {
        return length() == other.length() && std::memcmp(string(), other.string(), length()) == 0;
    }

 private:
    bool is_inplace() const {
        return (m_flags & table_entry_flags::inplace) == table_entry_flags::inplace;
    }
};
}  // namespace

namespace std {
template <>
struct hash<table_entry> {
    std::size_t operator()(const table_entry& entry) const {
        return Util::Hash::murmur(entry.string(), entry.length());
    }
};
}  // namespace std

namespace {
std::unordered_set<table_entry>& cache() {
    static std::unordered_set<table_entry> g_cache;

    return g_cache;
}

const char* save_to_cache(const char* string, std::size_t length, table_entry_flags flags) {
    if ((flags & table_entry_flags::no_need_copy) == table_entry_flags::no_need_copy) {
        return cache().emplace(string, length, flags).first->string();
    }

    // temporary table_entry, used for searching only. no need to copy string
    auto found = cache().find(table_entry(string, length, table_entry_flags::no_need_copy));

    if (found == cache().end()) {
        return cache().emplace(string, length, flags).first->string();
    }

    return found->string();
}

}  // namespace

void cstring::construct_from_shared(const char* string, std::size_t length) {
    str = save_to_cache(string, length, table_entry_flags::none);
}

void cstring::construct_from_unique(const char* string, std::size_t length) {
    str = save_to_cache(string, length,
                        table_entry_flags::no_need_copy | table_entry_flags::require_destruction);
}

void cstring::construct_from_literal(const char* string, std::size_t length) {
    str = save_to_cache(string, length, table_entry_flags::no_need_copy);
}

size_t cstring::cache_size(size_t& count) {
    size_t rv = 0;
    count = cache().size();
    for (auto& s : cache()) rv += sizeof(s) + s.length();
    return rv;
}

cstring cstring::newline = cstring("\n");
cstring cstring::empty = cstring("");

bool cstring::startsWith(const cstring& prefix) const {
    return size() >= prefix.size() && memcmp(str, prefix.str, prefix.size()) == 0;
}

bool cstring::endsWith(const cstring& suffix) const {
    return size() >= suffix.size() &&
           memcmp(str + size() - suffix.size(), suffix.str, suffix.size()) == 0;
}

cstring cstring::before(const char* at) const { return substr(0, at - str); }

cstring cstring::substr(size_t start, size_t length) const {
    if (size() <= start) return cstring::empty;
    std::string s = str;
    return s.substr(start, length);
}

cstring cstring::replace(char c, char with) const {
    char* dup = strdup(c_str());
    for (char* p = dup; *p; ++p)
        if (*p == c) *p = with;
    return cstring(dup);
}

cstring cstring::replace(cstring search, cstring replace) const {
    if (search.isNullOrEmpty() || isNullOrEmpty()) return *this;

    std::string s_str = str;
    std::string s_search = search.str;
    std::string s_replace = replace.str;

    size_t pos = 0;
    while ((pos = s_str.find(s_search, pos)) != std::string::npos) {
        s_str.replace(pos, s_search.length(), s_replace);
        pos += s_replace.length();
    }
    return cstring(s_str);
}

cstring cstring::indent(size_t amount) const {
    std::string spaces = "";
    for (size_t i = 0; i < amount; i++) spaces += " ";
    cstring spc = cstring("\n") + spaces;
    return cstring(spaces) + replace("\n", spc);
}

// See https://stackoverflow.com/a/33799784/4538702
cstring cstring::escapeJson() const {
    std::ostringstream o;
    for (size_t i = 0; i < size(); i++) {
        char c = get(i);
        switch (c) {
            case '"':
                o << "\\\"";
                break;
            case '\\':
                o << "\\\\";
                break;
            case '\b':
                o << "\\b";
                break;
            case '\f':
                o << "\\f";
                break;
            case '\n':
                o << "\\n";
                break;
            case '\r':
                o << "\\r";
                break;
            case '\t':
                o << "\\t";
                break;
            default: {
                if ('\x00' <= c && c <= '\x1f') {
                    o << "\\u" << std::hex << std::setw(4) << std::setfill('0')
                      << static_cast<int>(c);
                } else {
                    o << c;
                }
            }
        }
    }
    return cstring(o.str());
}

cstring cstring::toUpper() const {
    std::string st = str;
    std::transform(st.begin(), st.end(), st.begin(), ::toupper);
    cstring ret = cstring::to_cstring(st);
    return ret;
}

cstring cstring::capitalize() const {
    std::string st = str;
    st[0] = ::toupper(st[0]);
    cstring ret = cstring::to_cstring(st);
    return ret;
}


text:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import workspace
import scipy.sparse

class NetDefNode():

    def __init__(self, name, optype, p=None, op=None):
        self.name = name
        self.optype = optype
        self.ops = {}
        self.prev = {}
        self.insertInput(p)
        self.visited = False
        self.op = op

    def insertInput(self, p):
        """
        Insert input of this op
        also maintain the output of previous op
        p: a node or a list of node
        """
        if isinstance(p, list):
            for i in p:
                self.prev[i.name] = i
                i.ops[self.name] = self
        elif isinstance(p, NetDefNode):
            self.prev[p.name] = p
            p.ops[self.name] = self

    def deleteInput(self, p):
        if isinstance(p, NetDefNode):
            del self.prev[p.name]
            del p.ops[self.name]

def maskNallocate(weight_name):
    """
    Combine mask and weights
    create wcsr, iw, jw, return their names
    """
    w = workspace.FetchBlob(weight_name)
    w_csr = scipy.sparse.csr_matrix(w)
    wcsr = w_csr.data
    iw = w_csr.indptr
    jw = w_csr.indices
    workspace.FeedBlob(weight_name + "wcsr", wcsr)
    workspace.FeedBlob(weight_name + "iw", iw)
    workspace.FeedBlob(weight_name + "jw", jw)
    return weight_name + "wcsr", weight_name + "iw", weight_name + "jw"

def transFCRelu(cur, id2node, name2id, ops, model):
    """
    Add trans before and after this FC_Prune->(Relu)->FC_Prune chain.
    """
    # 1. add trans before the start of this chain
    # assuming that cur is a FC_Prune, and it has only one input
    pre = cur.prev.itervalues().next()
    # Create a node /op and insert it.
    # TODO(wyiming): check whether it is correct here
    current_blob = model.Transpose(cur.op.input[0], cur.op.input[0] + "_trans")
#     print model.net.Proto()
    trans_op = model.net.Proto().op[-1]
    trans_node = NetDefNode(trans_op.output[0], "Transpose", pre, trans_op)
    trans_node.visited = True
    pre_new = trans_node

    # 2. use while loop to visit the chain
    while True:
        # breakup with the parent
        cur.deleteInput(pre)
        if not (cur.optype == "FC_Prune" or cur.optype == "Relu"):
            print("Reaching the end of the chain")
            break
        if len(cur.ops) > 1:
            print("A FC/Relu giving more than 1 useful outputs")
        if cur.optype == "FC_Prune":
            op = cur.op
            wcsr, iw, jw = maskNallocate(op.input[1])
            bias_name = op.input[3]
            # TODO(wyiming): create a new Op here
            current_blob = model.FC_Sparse(current_blob,
                                           cur.op.output[0] + "_Sparse",
                                           wcsr, iw, jw, bias_name)
            sps_op = model.net.Proto().op[-1]
            sps_node = NetDefNode(cur.op.output[0] + "_Sparse",
                                  "FC_Sparse",
                                  pre_new, sps_op)
            sps_node.visited = True
            pre_new = sps_node
        if cur.optype == "Relu":
            op = cur.op
            current_blob = model.Relu(current_blob, current_blob)
            rel_op = model.net.Proto().op[-1]
            rel_node = NetDefNode(str(current_blob), "Relu",
                                  pre_new, rel_op)
            rel_node.visited = True
            pre_new = rel_node

        cur.visited = True
        pre = cur
        flag = False
        for _, temp in cur.ops.iteritems():
            if temp.optype == "Relu" or temp.optype == "FC_Prune":
                flag = True
                cur = temp
        if not flag:
            # assume that there is only 1 output that is not PrintOP
            cur = cur.ops.itervalues().next()
            cur.deleteInput(pre)
            print("No FC/RElu children")
            print(cur.op.type)
            break
    # 3. add trans after this chain like 1.
    current_blob = model.Transpose(current_blob, pre.op.output[0])
    trans_op = model.net.Proto().op[-1]
    trans_node = NetDefNode(str(current_blob), "Transpose", pre_new, trans_op)
    trans_node.visited = True
    cur.insertInput(trans_node)
    print(cur.prev)
    print(trans_node.ops)

def Prune2Sparse(cur, id2node, name2id, ops, model):
    # Assume that FC and Relu takes in only 1 input;
    # If not raise warning
    if not cur.visited and cur.optype == "FC_Prune":
        transFCRelu(cur, id2node, name2id, ops, model)

    cur.visited = True
    for name, n in cur.ops.iteritems():
        Prune2Sparse(n, id2node, name2id, ops, model)

def net2list(net_root):
    """
    Use topological order(BFS) to print the op of a net in a list
    """
    bfs_queue = []
    op_list = []
    cur = net_root
    for _, n in cur.ops.iteritems():
        bfs_queue.append(n)
    while bfs_queue:
        node = bfs_queue[0]
        bfs_queue = bfs_queue[1:]
        op_list.append(node.op)
        for _, n in node.ops.iteritems():
            bfs_queue.append(n)

    return op_list

def netbuilder(model):
    print("Welcome to model checker")
    proto = model.net.Proto()
    net_name2id = {}
    net_id2node = {}
    net_root = NetDefNode("net_root", "root", None)

    for op_id, op in enumerate(proto.op):
        if op.type == "Print":
            continue
        op_name = '%s/%s (op#%d)' % (op.name, op.type, op_id) \
                  if op.name else '%s (op#%d)' % (op.type, op_id)
        # print(op_name)
        op_node = NetDefNode(op_name, op.type, op=op)
        net_id2node[op_id] = op_node

        if_has_layer_input = False
        for input_name in op.input:
            if input_name not in net_name2id:
                # assume that un_occured name are non_layers
                # TODO: write a non-layer checker and log it
                continue
            op_node.insertInput(net_id2node[net_name2id[input_name]])
            if_has_layer_input = True

        if not if_has_layer_input:
            op_node.insertInput(net_root)

        for output_name in op.output:
            net_name2id[output_name] = op_id

    return net_root, net_name2id, net_id2node


text:
<!DOCTYPE html>

  <title>Popcorn Module: Timeline-Sources</title>
  <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">

Popcorn Module: player

  <audio id="audioElement" src="../../test/italia.ogg"></audio>
  <video id="videoElement" src="../../test/trailer.ogv"></video>


text:
.. _userguide_info:

Learning More
=============

Hopefully this User Guide gets you started with the basics of using Bokeh.

For detailed information about all modules, classes, models, and objects,
consult the :ref:`refguide`. If you are interested in learning how to build
and develop Bokeh, or for information about how to create a new language
binding, see the :ref:`devguide`.

To see ready-made examples of how you might use Bokeh with your own data,
check out the :ref:`gallery` on the main documentation site, as well as
the `Bokeh NBViewer Gallery`_.

For questions and technical assistance, come join the `Bokeh mailing list`_.

Visit the `Bokeh GitHub repository`_ and try the examples.

Be sure to follow us on Twitter `@bokehplots <Twitter_>`_, as well as on
`Vine`_, and `Youtube`_!

.. _Bokeh GitHub repository: https://github.com/bokeh/bokeh
.. _Bokeh mailing list: https://groups.google.com/a/continuum.io/forum/#!forum/bokeh
.. _Bokeh NBViewer Gallery: http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/index.ipynb
.. _Twitter: http://twitter.com/BokehPlots
.. _Vine: https://vine.co/bokehplots
.. _YouTube: https://www.youtube.com/channel/UCK0rSk29mmg4UT4bIOvPYhw


text:
/// <reference path="../../typings/angularjs/angular-route.d.ts" />
/// <reference path="../../typings/businessforms/businessforms.d.ts" />

namespace Palvelutori {
    class ListTestEntityController {
        $onInit() {
        }
    }
    // Create components
    app.component("ptListTestEntities", {
        bindings: {
            items: '<'
        },
        templateUrl: ()=> getUrl('/TestPage/ListTestEntity'),
        controller: ListTestEntityController
    });

    // Configure route
    app.config(function ($routeProvider: angular.route.IRouteProvider) {
        $routeProvider.when('/list/testEntity', {
            template: '<pt-list-test-entities items="$resolve.testEntities"></pt-list-test-entities>',
            resolve: {
                testEntities: function (bfDataService: BusinessForms.BFDataService, $location: ng.ILocationService) {
                    return bfDataService.query('testEntities');
                }
            }
        });
    });
}


text:
package ch.thn.objectdebugger.ui;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.WeakHashMap;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.border.Border;
import javax.swing.tree.DefaultTreeCellRenderer;

import ch.thn.objectdebugger.ObjectNodeValue;
import ch.thn.objectdebugger.ui.ObjectEventDemoList.ObjectEventDemoListCellRenderer;
import ch.thn.util.tree.ListTreeNode;

/**
 *
 * @author Thomas Naeff (github.com/thnaeff)
 *
 */
public class ObjectEventTreeCellRenderer extends DefaultTreeCellRenderer implements MouseListener {
	private static final long serialVersionUID = -1596390738443801320L;

	private static WeakHashMap<Object, JLabel> labels = new WeakHashMap<>();

	private static final Border borderActive = BorderFactory.createLineBorder(Color.green.darker());
	private static final Border borderInactive = BorderFactory.createLineBorder(Color.white);

	private JTree tree = null;

	/**
	 *
	 *
	 * @param tree
	 */
	public ObjectEventTreeCellRenderer(JTree tree) {
		this.tree = tree;
	}

	@Override
	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean selected, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {

		@SuppressWarnings("unchecked")
		ObjectNodeValue node = ((ListTreeNode<ObjectNodeValue>)value).getNodeValue();

		JLabel l = null;

		if (node == null) {
			return new JLabel();
		}

		if (!labels.containsKey(node.getObject())) {
			l = new JLabel(value.toString());
			l.setFont(l.getFont().deriveFont(Font.PLAIN));
		} else {
			l = labels.get(node.getObject());
		}

		//l.setToolTipText(node.getObject().toString());

		if (selected) {
			l.setOpaque(true);
			l.setBackground(ObjectEventDemoListCellRenderer.cSelected);
		} else {
			l.setBackground(null);
		}

		if (node.getObject() instanceof Component) {
			labels.put(node.getObject(), l);

			((Component)node.getObject()).addMouseListener(this);
		}

		return l;
	}

	@Override
	public void mouseClicked(MouseEvent e) {
	}

	@Override
	public void mouseEntered(MouseEvent e) {

		if (labels.containsKey(e.getSource())) {
			JLabel l = labels.get(e.getSource());

			l.setBorder(borderActive);

			//Is repainting the whole tree necessary?
			tree.invalidate();
			tree.repaint();
		}

	}

	@Override
	public void mouseExited(MouseEvent e) {

		if (labels.containsKey(e.getSource())) {
			JLabel l = labels.get(e.getSource());

			l.setBorder(borderInactive);

			//Is repainting the whole tree necessary?
			tree.invalidate();
			tree.repaint();
		}

	}

	@Override
	public void mousePressed(MouseEvent e) {
	}

	@Override
	public void mouseReleased(MouseEvent e) {
	}

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Cutlass: nv_std::is_volatile< T > Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Cutlass

CUDA Templates for Linear Algebra Subroutines and Solvers

nv_std

is_volatile

List of all members

nv_std::is_volatile< T > Struct Template Reference

std::is_volatile

#include <nv_std.h>

Inheritance diagram for nv_std::is_volatile< T >:

  <map id="nv_5Fstd::is_5Fvolatile_3C_20T_20_3E_map" name="nv_5Fstd::is_5Fvolatile_3C_20T_20_3E_map">
<area href="structnv__std_1_1integral__constant.html" title="std::integral_constant " alt="nv_std::integral_constant< value_t, V >" shape="rect" coords="0,0,235,24"/>
</map>

Additional Inherited Members

 Public Types inherited from nv_std::integral_constant< value_t, V >

typedef value_t 	value_type

typedef integral_constant< value_t, V > 	type

 Public Member Functions inherited from nv_std::integral_constant< value_t, V >

CUTLASS_HOST_DEVICE 	operator value_type () const

CUTLASS_HOST_DEVICE const value_type 	operator() () const

 Static Public Attributes inherited from nv_std::integral_constant< value_t, V >

static const value_t 	value = V

The documentation for this struct was generated from the following file:

nv_std.h

<address class="footer">
Generated on Fri Apr 20 2018 16:16:55 for Cutlass by

 1.8.14
</address>


text:
#include "../Include/Boost.h"
#include "Types.h"

#include <boost/filesystem.hpp>
#include <vector>
#include <iostream>

using namespace boost::filesystem;
using namespace std;

vector<string> ListDir(path p) {
	vector<string> direct;

	if (is_directory(p)) {
		for (auto && x : directory_iterator(p)) {
			if (is_directory(x)) {
				std::string dir = x.path().filename().string();
				direct.push_back(dir.append("/"));
			} else {
				direct.push_back(x.path().filename().string());
			}
		}
	} else if (is_regular_file(p)) {
		direct.push_back("That path is a file.");
		//cout << p << " is a file.";
	} else {
		direct.push_back("That path does not exist!");
		//cout << p << " does not exist!";
	}

	/*for (uint i = 0; i < direct.size(); i++) {
		cout << direct[i] << '\n';
	}*/

	return direct;
}


text:
#### Conta API Unit Test Setup
```JavaScript
describe('API: My Api', function () {
    'use strict';

    var resource = 'resource',
        searchArray = ['propertyName']; // Remove if no searchArray

    var api;

    beforeEach(function () {
        module('conta.api');

        inject(function ($injector) {
            api = $injector.get('myApi');
        });
    });

    it('should exist', function () {
        expect(api).toBeTruthy();
    });

    /**
     * If you change something here you MUST add unit tests for it
     */
    it('should expose a valid public api', function () {
        var expectedPublicApi = {
            myFunction: 'function',
            myString: 'string',
            myBoolean: 'boolean'
        };

        window.testHelper.verifyApi(expectedPublicApi, api);
    });

    it('should have the correct resource', function () {
        expect(api.resource).toEqual(resource);
    });

    // Remove if no searchArray
    it('should have the correct searchArray', function () {
        expect(api.searchArray).toEqual(searchArray);
    });

    describe('myFunction(parameter1, parameter2)', function () {

    });
});
```


text:
package com.uw.android310.lesson8.activity;

import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.uw.android310.lesson8.R;
import com.uw.android310.lesson8.model.Image;
import com.uw.android310.lesson8.service.ImageService;

import butterknife.Bind;
import butterknife.ButterKnife;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

public class MainActivity extends AppCompatActivity {
    public static final String TAG = MainActivity.class.getSimpleName();

    @Bind(R.id.results) TextView mResultTextView;
    @Bind(R.id.imageview) ImageView mResultImageView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ButterKnife.bind(this);

        handleIntent(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        setIntent(intent);
        handleIntent(intent);
    }

    private void handleIntent(Intent intent) {
        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String query = intent.getStringExtra(SearchManager.QUERY);

            // Get image data from Imgur
            new ImageService(this).execute(query, new UiCallback());

            // TODO: Enable deep linking to images
        } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
            Uri data = intent.getData();
            Log.d(TAG, data.getPath());
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);

        // Get the SearchView and set the searchable configuration
        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();

        // Assumes current activity is the searchable activity
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default

        return true;
    }

    private class UiCallback implements Callback<Image> {

        @Override
        public void success(Image imageResponse, Response response) {
            // Load image
            Picasso.with(getApplicationContext())
                    .load(imageResponse.data.link)
                    .fit()
                    .into(mResultImageView);

            // Reset results
            mResultTextView.setText(null);
        }

        @Override
        public void failure(RetrofitError error) {
            //Assume we have no connection, since error is null
            if (error == null) {
                Log.e(TAG, "No internet connection.");
            } else {
                mResultTextView.setText("No image with specified ID");
            }
        }
    }
}


text:
namespace vast {
namespace io {

/// For an output stream, this value holds the default size in bytes of an
/// uncompressed data block, which is exposed to users via next(). When a
/// block fills up, it will be flushed (i.e., compressed) into the underlying
/// stream.
/// For an input stream, this value represents the buffer size of the scratch
/// space to decompress into.
static size_t const uncompressed_block_size = 64 << 10;

/// An input stream that read from a compressed input source.
class compressed_input_stream : public input_stream {
public:
  bool next(void const** data, size_t* size) override;
  void rewind(size_t bytes) override;
  bool skip(size_t bytes) override;
  uint64_t bytes() const override;

protected:
  /// Constructs a compressed input stream from an input stream.
  /// @param source The input stream to read from.
  compressed_input_stream(input_stream& source);

  /// Decompresses a block of data.
  /// @param source The compressed block of data.
  /// @param source_size The size of *source*.
  /// @returns The number of bytes written from *source* into *sink*.
  virtual size_t uncompress(void const* source, size_t size) = 0;

  std::vector<uint8_t> compressed_;
  std::vector<uint8_t> uncompressed_;

private:
  size_t rewind_bytes_ = 0;
  size_t valid_bytes_ = 0;
  size_t total_bytes_ = 0;
  coded_input_stream source_;
};

/// Factory function to create a ::compressed_input_stream for a given
/// compression method.
/// @param method The compression method to use.
/// @param source The underlying stream to read from.
std::unique_ptr<compressed_input_stream>
make_compressed_input_stream(compression method, input_stream& source);

/// An output stream that compresses data written to it.
class compressed_output_stream : public output_stream {
public:
  bool next(void** data, size_t* size) override;
  void rewind(size_t bytes) override;
  bool flush() override;
  uint64_t bytes() const override;

protected:
  /// Constructs a compressed output stream from an output stream.
  ///
  /// @param sink The output stream to write to.
  ///
  /// @param block_size The size of the uncompressed scratch space which will
  /// be compressed when it fills up or when calling flush().
  compressed_output_stream(output_stream& sink, size_t block_size = 0);

  /// Retrieves a bound on the compressed size of uncompressed data.
  /// @param output The size in bytes of the data.
  /// @returns The maximum number of bytes data of size *output* requires.
  virtual size_t compressed_size(size_t output) const = 0;

  /// Compresses a block of data.
  /// @param sink The sink receiving the compressed data.
  /// @param sink_size The size of *sink*.
  /// @returns The number of bytes written from *source* into *sink*.
  virtual size_t compress(void* sink, size_t sink_size) = 0;

protected:
  std::vector<uint8_t> uncompressed_;
  size_t valid_bytes_ = 0;

private:
  std::vector<uint8_t> compressed_;
  size_t total_bytes_ = 0;
  coded_output_stream sink_;
};

/// Factory function to create a ::compressed_output_stream for a given
/// compression method.
/// @param method The compression method to use.
/// @param sink The underlying stream to write into.
std::unique_ptr<compressed_output_stream>
make_compressed_output_stream(compression method, output_stream& sink);

/// A compressed input stream that uses null compression.
class null_input_stream : public compressed_input_stream {
public:
  null_input_stream(input_stream& source);
  size_t uncompress(void const* source, size_t size) override;
};

/// A compressed output stream that uses null compression.
class null_output_stream : public compressed_output_stream {
public:
  null_output_stream(output_stream& sink, size_t block_size = 0);

  ~null_output_stream();
  size_t compressed_size(size_t output) const override;
  size_t compress(void* sink, size_t sink_size) override;
};

/// A compressed input stream using LZ4.
class lz4_input_stream : public compressed_input_stream {
public:
  lz4_input_stream(input_stream& source);
  size_t uncompress(void const* source, size_t size) override;
};

/// A compressed output stream using LZ4.
class lz4_output_stream : public compressed_output_stream {
public:
  lz4_output_stream(output_stream& sink);
  ~lz4_output_stream();
  size_t compressed_size(size_t output) const override;
  size_t compress(void* sink, size_t sink_size) override;
};

#ifdef VAST_HAVE_SNAPPY
/// A compressed input stream using Snappy.
class snappy_input_stream : public compressed_input_stream {
public:
  snappy_input_stream(input_stream& source);
  size_t uncompress(void const* source, size_t size) override;
};

/// A compressed output stream using Snappy.
class snappy_output_stream : public compressed_output_stream {
public:
  snappy_output_stream(output_stream& sink);
  ~snappy_output_stream();
  size_t compressed_size(size_t output) const override;
  size_t compress(void* sink, size_t sink_size) override;
};
#endif // VAST_HAVE_SNAPPY

} // namespace io
} // namespace vast

#endif


text:
<?php

function lostpass_post(&$a) {

	$loginame = notags(trim($_POST['login-name']));
	if(! $loginame)
		goaway(z_root());

	$r = q("SELECT * FROM account WHERE account_email = '%s' LIMIT 1",
		dbesc($loginame)
	);

	if(! $r) {
		notice( t('No valid account found.') . EOL);
		goaway(z_root());
	}

	$aid = $r[0]['account_id'];
	$email = $r[0]['account_email'];

	$hash = random_string();

	$r = q("UPDATE account SET account_reset = '%s' WHERE account_id = %d",
		dbesc($hash),
		intval($aid)
	);
	if($r)
		info( t('Password reset request issued. Check your email.') . EOL);

	$email_tpl = get_intltext_template("lostpass_eml.tpl");
	$message = replace_macros($email_tpl, array(
			'$sitename' => get_config('system','sitename'),
			'$siteurl' =>  $a->get_baseurl(),
			'$username' => sprintf( t('Site Member (%s)'), $email),
			'$email' => $email,
			'$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $hash
	));

	$subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');

	$res = mail($email, $subject ,
			$message,
			'From: Administrator@' . $_SERVER['SERVER_NAME'] . "\n"
			. 'Content-type: text/plain; charset=UTF-8' . "\n"
			. 'Content-transfer-encoding: 8bit' );

	goaway(z_root());
}

function lostpass_content(&$a) {

	if(x($_GET,'verify')) {
		$verify = $_GET['verify'];

		$r = q("SELECT * FROM account WHERE account_reset = '%s' LIMIT 1",
			dbesc($verify)
		);
		if(! $r) {
			notice( t("Request could not be verified. (You may have previously submitted it.) Password reset failed.") . EOL);
			goaway(z_root());
			return;
		}

		$aid = $r[0]['account_id'];
		$email = $r[0]['account_email'];

		$new_password = autoname(6) . mt_rand(100,9999);

		$salt = random_string(32);
		$password_encoded = hash('whirlpool', $salt . $new_password);

		$r = q("UPDATE account SET account_salt = '%s', account_password = '%s', account_reset = '', account_flags = (account_flags & ~%d) where account_id = %d",
			dbesc($salt),
			dbesc($password_encoded),
			intval(ACCOUNT_UNVERIFIED),
			intval($aid)
		);

		if($r) {
			$tpl = get_markup_template('pwdreset.tpl');
			$o .= replace_macros($tpl,array(
				'$lbl1' => t('Password Reset'),
				'$lbl2' => t('Your password has been reset as requested.'),
				'$lbl3' => t('Your new password is'),
				'$lbl4' => t('Save or copy your new password - and then'),
				'$lbl5' => 'get_baseurl() . '/login">' . t('click here to login') . '.',
				'$lbl6' => t('Your password may be changed from the Settings page after successful login.'),
				'$newpass' => $new_password,
				'$baseurl' => $a->get_baseurl()

			));

			info("Your password has been reset." . EOL);

			$email_tpl = get_intltext_template("passchanged_eml.tpl");
			$message = replace_macros($email_tpl, array(
			'$sitename' => $a->config['sitename'],
			'$siteurl' =>  $a->get_baseurl(),
			'$username' => sprintf( t('Site Member (%s)'), $email),
			'$email' => $email,
			'$new_password' => $new_password,
			'$uid' => $newuid ));

			$subject = email_header_encode( sprintf( t('Your password has changed at %s'), get_config('system','sitename')), 'UTF-8');

			$res = mail($email,$subject,$message,
				'From: ' . 'Administrator@' . $_SERVER['SERVER_NAME'] . "\n"
				. 'Content-type: text/plain; charset=UTF-8' . "\n"
				. 'Content-transfer-encoding: 8bit' );

			return $o;
		}

	}
	else {
		$tpl = get_markup_template('lostpass.tpl');

		$o .= replace_macros($tpl,array(
			'$title' => t('Forgot your Password?'),
			'$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'),
			'$name' => t('Email Address'),
			'$submit' => t('Reset')
		));

		return $o;
	}

}


text:
package com.mitchellbosecke.pebble.extension.core;

import com.mitchellbosecke.pebble.extension.Function;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplate;
import com.mitchellbosecke.pebble.utils.OperatorUtils;
import java.util.List;
import java.util.Map;

public class MaxFunction implements Function {

  @Override
  public List<String> getArgumentNames() {
    return null;
  }

  @Override
  public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context,
      int lineNumber) {
    Object min = null;

    int i = 0;

    while (args.containsKey(String.valueOf(i))) {

      Object candidate = args.get(String.valueOf(i));
      i++;

      if (min == null) {
        min = candidate;
        continue;
      }
      if (OperatorUtils.gt(candidate, min)) {
        min = candidate;
      }

    }
    return min;

  }

}


text:
shared_examples 'variable list' do
  it 'shows list of variables' do
    page.within('.js-ci-variable-list-section') do
      expect(first('.js-ci-variable-input-key').value).to eq(variable.key)
    end
  end

  it 'adds new secret variable' do
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('key')
      find('.js-ci-variable-input-value').set('key value')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    # We check the first row because it re-sorts to alphabetical order on refresh
    page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
      expect(find('.js-ci-variable-input-key').value).to eq('key')
      expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key value')
    end
  end

  it 'adds empty variable' do
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('key')
      find('.js-ci-variable-input-value').set('')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    # We check the first row because it re-sorts to alphabetical order on refresh
    page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
      expect(find('.js-ci-variable-input-key').value).to eq('key')
      expect(find('.js-ci-variable-input-value', visible: false).value).to eq('')
    end
  end

  it 'adds new protected variable' do
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('key')
      find('.js-ci-variable-input-value').set('key value')
      find('.ci-variable-protected-item .js-project-feature-toggle').click

      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    # We check the first row because it re-sorts to alphabetical order on refresh
    page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
      expect(find('.js-ci-variable-input-key').value).to eq('key')
      expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key value')
      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
    end
  end

  it 'reveals and hides variables' do
    page.within('.js-ci-variable-list-section') do
      expect(first('.js-ci-variable-input-key').value).to eq(variable.key)
      expect(first('.js-ci-variable-input-value', visible: false).value).to eq(variable.value)
      expect(page).to have_content('*' * 20)

      click_button('Reveal value')

      expect(first('.js-ci-variable-input-key').value).to eq(variable.key)
      expect(first('.js-ci-variable-input-value').value).to eq(variable.value)
      expect(page).not_to have_content('*' * 20)

      click_button('Hide value')

      expect(first('.js-ci-variable-input-key').value).to eq(variable.key)
      expect(first('.js-ci-variable-input-value', visible: false).value).to eq(variable.value)
      expect(page).to have_content('*' * 20)
    end
  end

  it 'deletes variable' do
    page.within('.js-ci-variable-list-section') do
      expect(page).to have_selector('.js-row', count: 2)

      first('.js-row-remove-button').click

      click_button('Save variables')
      wait_for_requests

      expect(page).to have_selector('.js-row', count: 1)
    end
  end

  it 'edits variable' do
    page.within('.js-ci-variable-list-section') do
      click_button('Reveal value')

      page.within('.js-row:nth-child(1)') do
        find('.js-ci-variable-input-key').set('new_key')
        find('.js-ci-variable-input-value').set('new_value')
      end

      click_button('Save variables')
      wait_for_requests

      visit page_path

      page.within('.js-row:nth-child(1)') do
        expect(find('.js-ci-variable-input-key').value).to eq('new_key')
        expect(find('.js-ci-variable-input-value', visible: false).value).to eq('new_value')
      end
    end
  end

  it 'edits variable with empty value' do
    page.within('.js-ci-variable-list-section') do
      click_button('Reveal value')

      page.within('.js-row:nth-child(1)') do
        find('.js-ci-variable-input-key').set('new_key')
        find('.js-ci-variable-input-value').set('')
      end

      click_button('Save variables')
      wait_for_requests

      visit page_path

      page.within('.js-row:nth-child(1)') do
        expect(find('.js-ci-variable-input-key').value).to eq('new_key')
        expect(find('.js-ci-variable-input-value', visible: false).value).to eq('')
      end
    end
  end

  it 'edits variable to be protected' do
    # Create the unprotected variable
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('unprotected_key')
      find('.js-ci-variable-input-value').set('unprotected_value')

      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    # We check the first row because it re-sorts to alphabetical order on refresh
    page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do
      find('.ci-variable-protected-item .js-project-feature-toggle').click

      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    # We check the first row because it re-sorts to alphabetical order on refresh
    page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do
      expect(find('.js-ci-variable-input-key').value).to eq('unprotected_key')
      expect(find('.js-ci-variable-input-value', visible: false).value).to eq('unprotected_value')
      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
    end
  end

  it 'edits variable to be unprotected' do
    # Create the protected variable
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('protected_key')
      find('.js-ci-variable-input-value').set('protected_value')
      find('.ci-variable-protected-item .js-project-feature-toggle').click

      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('true')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
      find('.ci-variable-protected-item .js-project-feature-toggle').click

      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
    end

    click_button('Save variables')
    wait_for_requests

    visit page_path

    page.within('.js-ci-variable-list-section .js-row:nth-child(1)') do
      expect(find('.js-ci-variable-input-key').value).to eq('protected_key')
      expect(find('.js-ci-variable-input-value', visible: false).value).to eq('protected_value')
      expect(find('.js-ci-variable-input-protected', visible: false).value).to eq('false')
    end
  end

  it 'handles multiple edits and deletion in the middle' do
    page.within('.js-ci-variable-list-section') do
      # Create 2 variables
      page.within('.js-row:last-child') do
        find('.js-ci-variable-input-key').set('akey')
        find('.js-ci-variable-input-value').set('akeyvalue')
      end
      page.within('.js-row:last-child') do
        find('.js-ci-variable-input-key').set('zkey')
        find('.js-ci-variable-input-value').set('zkeyvalue')
      end

      click_button('Save variables')
      wait_for_requests

      expect(page).to have_selector('.js-row', count: 4)

      # Remove the `akey` variable
      page.within('.js-row:nth-child(2)') do
        first('.js-row-remove-button').click
      end

      # Add another variable
      page.within('.js-row:last-child') do
        find('.js-ci-variable-input-key').set('ckey')
        find('.js-ci-variable-input-value').set('ckeyvalue')
      end

      click_button('Save variables')
      wait_for_requests

      visit page_path

      # Expect to find 3 variables(4 rows) in alphbetical order
      expect(page).to have_selector('.js-row', count: 4)
      row_keys = all('.js-ci-variable-input-key')
      expect(row_keys[0].value).to eq('ckey')
      expect(row_keys[1].value).to eq('test_key')
      expect(row_keys[2].value).to eq('zkey')
      expect(row_keys[3].value).to eq('')
    end
  end

  it 'shows validation error box about duplicate keys' do
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('samekey')
      find('.js-ci-variable-input-value').set('value1')
    end
    page.within('.js-ci-variable-list-section .js-row:last-child') do
      find('.js-ci-variable-input-key').set('samekey')
      find('.js-ci-variable-input-value').set('value2')
    end

    click_button('Save variables')
    wait_for_requests

    expect(all('.js-ci-variable-list-section .js-ci-variable-error-box ul li').count).to eq(1)

    # We check the first row because it re-sorts to alphabetical order on refresh
    page.within('.js-ci-variable-list-section') do
      expect(find('.js-ci-variable-error-box')).to have_content(/Validation failed Variables have duplicate values \(.+\)/)
    end
  end
end


text:
package com.jayway.jsonpath;

public interface DocumentContext extends ReadContext, WriteContext {
}