text:
using namespace stim;

CommutingPauliStringIterator::CommutingPauliStringIterator(size_t num_qubits)
    : num_qubits(num_qubits),
      cur_desired_commutators(),
      cur_desired_anticommutators(),
      current(num_qubits),
      next_output_index(0),
      filled_output(0),
      output_buf() {
    if (num_qubits < 1) {
        throw std::invalid_argument("Too few qubits (num_qubits < 1).");
    }
    if (num_qubits >= 64) {
        throw std::invalid_argument("Too many qubits to iterate tableaus (num_qubits > 64).");
    }
    while (output_buf.size() < 64) {
        output_buf.push_back(PauliString(num_qubits));
    }
}

uint64_t CommutingPauliStringIterator::mass_anticommute_check(const PauliStringRef versus) {
    constexpr uint64_t x0 = 0xAAAAAAAAAAAAAAAAUL;
    constexpr uint64_t x1 = 0xCCCCCCCCCCCCCCCCUL;
    constexpr uint64_t x2 = 0xF0F0F0F0F0F0F0F0UL;
    constexpr uint64_t z0 = 0xFF00FF00FF00FF00UL;
    constexpr uint64_t z1 = 0xFFFF0000FFFF0000UL;
    constexpr uint64_t z2 = 0xFFFFFFFF00000000UL;

    uint64_t result = 0;
    if (versus.zs[0])
        result ^= x0;
    if (versus.zs[1])
        result ^= x1;
    if (versus.zs[2])
        result ^= x2;
    if (versus.xs[0])
        result ^= z0;
    if (versus.xs[1])
        result ^= z1;
    if (versus.xs[2])
        result ^= z2;
    if (versus.num_qubits > 3 && !versus.commutes(current)) {
        result ^= -1;
    }
    return result;
}

void CommutingPauliStringIterator::restart_iter_same_constraints() {
    current.xs.u64[0] = 0;
    current.zs.u64[0] = 0;
    next_output_index = 0;
    filled_output = 0;
}

void CommutingPauliStringIterator::restart_iter(
    ConstPointerRange<PauliStringRef> commutators, ConstPointerRange<PauliStringRef> anticommutators) {
    restart_iter_same_constraints();
    cur_desired_commutators = commutators;
    cur_desired_anticommutators = anticommutators;
}

const PauliString *CommutingPauliStringIterator::iter_next() {
    if (next_output_index >= filled_output) {
        load_more();
    }
    if (next_output_index >= filled_output) {
        return nullptr;
    }
    return &output_buf[next_output_index++];
}

void CommutingPauliStringIterator::load_more() {
    next_output_index = 0;
    filled_output = 0;

    uint64_t start_pass_mask = -1;
    if (num_qubits < 2) {
        // Drop bits corresponding to cases where x2 or z2 or x1 or z1 are set.
        start_pass_mask &= 0x0000000000000303UL;
    } else if (num_qubits < 3) {
        // Drop bits corresponding to cases where x2 or z2 are set.
        start_pass_mask &= 0x000000000F0F0F0FUL;
    }

    uint64_t num_bit_strings = 1 << num_qubits;
    while (filled_output == 0 && current.zs.u64[0] < num_bit_strings) {
        uint64_t pass_mask = start_pass_mask;
        if (current.xs.u64[0] == 0 && current.zs.u64[0] == 0) {
            pass_mask &= ~1;  // Don't search the identity.
        }
        for (const auto &p : cur_desired_commutators) {
            pass_mask &= ~mass_anticommute_check(p);
        }
        for (const auto &p : cur_desired_anticommutators) {
            pass_mask &= mass_anticommute_check(p);
        }
        if (pass_mask) {
            for (size_t b = 0; b < 64; b++) {
                if ((pass_mask >> b) & 1) {
                    output_buf[filled_output] = current;
                    output_buf[filled_output].xs.u64[0] |= b & 7;
                    output_buf[filled_output].zs.u64[0] |= (b >> 3) & 7;
                    filled_output++;
                }
            }
        }

        current.xs.u64[0] += 8;
        if (current.xs.u64[0] >= num_bit_strings) {
            current.xs.u64[0] = 0;
            current.zs.u64[0] += 8;
        }
    }
}

TableauIterator::TableauIterator(size_t num_qubits, bool also_iter_signs)
    : also_iter_signs(also_iter_signs), result(num_qubits), cur_k(0) {
    for (size_t k = 0; k < num_qubits; k++) {
        // Iterator for X_k's output.
        pauli_string_iterators.push_back(CommutingPauliStringIterator(num_qubits));
        tableau_column_refs.push_back(result.xs[k]);

        // Iterator for Z_k's output.
        pauli_string_iterators.push_back(CommutingPauliStringIterator(num_qubits));
        tableau_column_refs.push_back(result.zs[k]);
    }

    for (size_t k = 0; k < 2 * num_qubits; k++) {
        auto constraints = constraints_for_pauli_iterator(k);
        pauli_string_iterators[k].cur_desired_commutators = constraints.first;
        pauli_string_iterators[k].cur_desired_anticommutators = constraints.second;
    }
}

TableauIterator::TableauIterator(const TableauIterator &other) : result(0) {
    *this = other;
}

TableauIterator &TableauIterator::operator=(const TableauIterator &other) {
    also_iter_signs = other.also_iter_signs;
    result = other.result;
    cur_k = other.cur_k;
    pauli_string_iterators = other.pauli_string_iterators;

    tableau_column_refs.clear();
    for (size_t k = 0; k < result.num_qubits; k++) {
        tableau_column_refs.push_back(result.xs[k]);
        tableau_column_refs.push_back(result.zs[k]);
    }

    for (size_t k = 0; k < 2 * result.num_qubits; k++) {
        auto constraints = constraints_for_pauli_iterator(k);
        pauli_string_iterators[k].cur_desired_commutators = constraints.first;
        pauli_string_iterators[k].cur_desired_anticommutators = constraints.second;
    }

    return *this;
}

std::pair<ConstPointerRange<PauliStringRef>, ConstPointerRange<PauliStringRef>>
TableauIterator::constraints_for_pauli_iterator(size_t k) const {
    const PauliStringRef *tab_obs_start = &tableau_column_refs[0];
    ConstPointerRange<PauliStringRef> commute_rng = {tab_obs_start, tab_obs_start + k};
    ConstPointerRange<PauliStringRef> anticommute_rng;
    if (k & 1) {
        anticommute_rng.ptr_end = commute_rng.ptr_end;
        commute_rng.ptr_end--;
        anticommute_rng.ptr_start = commute_rng.ptr_end;
    }
    return {commute_rng, anticommute_rng};
}

bool TableauIterator::iter_next() {
    if (result.xs.signs.u64[0] > 0) {
        result.xs.signs.u64[0]--;
        return true;
    }
    if (result.zs.signs.u64[0] > 0) {
        result.zs.signs.u64[0]--;
        result.xs.signs.u64[0] = (uint64_t{1} << result.num_qubits) - uint64_t{1};
        return true;
    }

    while (cur_k != SIZE_MAX) {
        const PauliString *out = pauli_string_iterators[cur_k].iter_next();
        if (out == nullptr) {
            // Exhausted all Paulis strings at this level; go back a level.
            cur_k--;  // At 0 this underflows to SIZE_MAX, exiting the loop.
            continue;
        }

        tableau_column_refs[cur_k] = *out;
        cur_k++;
        if (cur_k == 2 * result.num_qubits) {
            cur_k--;
            if (also_iter_signs) {
                // Okay, look, I admit this is technically wrong. It fails if num_qubits > 64 because
                // not all sign variations are explored. But no one is actually going to be able to finish
                // iterating the tableaus that are actually yielded, so good look demonstrating it's wrong.
                // :P
                result.xs.signs.u64[0] = (uint64_t{1} << result.num_qubits) - uint64_t{1};
                result.zs.signs.u64[0] = (uint64_t{1} << result.num_qubits) - uint64_t{1};
            }
            return true;
        }

        pauli_string_iterators[cur_k].restart_iter_same_constraints();
    }

    return false;
}

void TableauIterator::restart() {
    cur_k = 0;
    pauli_string_iterators[0].restart_iter({}, {});
    result.xs.signs.clear();
    result.zs.signs.clear();
}


text:
using System.IO;
using System.Text;

namespace HaloOnline.Server.Model.UserStorage
{
    public class Preferences
    {
        public int LastReadNewsUnknownValue { get; set; }
        public string LastReadNewsName { get; set; }

        public AbstractData Serialize()
        {
            // TODO: Serialize Preference
            return new AbstractData
            {
                Version = 0,
                Layout = 1,
                Data = new byte[33292]
            };
        }

        public static Preferences Deserialize(AbstractData abstractData)
        {
            MemoryStream dataStream = new MemoryStream(abstractData.Data);
            BinaryReader reader = new BinaryReader(dataStream);
            Preferences preferences = new Preferences();
            dataStream.Position = 32772;
            preferences.ReadLastReadNews(reader);
            return preferences;;
        }

        private void ReadLastReadNews(BinaryReader reader)
        {
            LastReadNewsUnknownValue = reader.ReadInt32();
            LastReadNewsName = ParseString(reader);
        }

        private string ParseString(BinaryReader reader)
        {
            byte[] stringBuffer = reader.ReadBytes(32);
            return Encoding.ASCII.GetString(stringBuffer).TrimEnd('\0');
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import pykka

from mopidy import mixer

def create_proxy(config=None):
    return DummyMixer.start(config=None).proxy()

class DummyMixer(pykka.ThreadingActor, mixer.Mixer):
    def __init__(self, config):
        super().__init__()
        self._volume = None
        self._mute = None

    def get_volume(self):
        return self._volume

    def set_volume(self, volume):
        self._volume = volume
        self.trigger_volume_changed(volume=volume)
        return True

    def get_mute(self):
        return self._mute

    def set_mute(self, mute):
        self._mute = mute
        self.trigger_mute_changed(mute=mute)
        return True


text:
angular.module('albums', ['ngResource', 'ui.bootstrap']).
    factory('Albums', function ($resource) {
        return $resource('albums');
    }).
    factory('Album', function ($resource) {
        return $resource('albums/:id', {id: '@id'});
    }).
    factory("EditorStatus", function () {
        var editorEnabled = {};

        var enable = function (id, fieldName) {
            editorEnabled = { 'id': id, 'fieldName': fieldName };
        };

        var disable = function () {
            editorEnabled = {};
        };

        var isEnabled = function(id, fieldName) {
            return (editorEnabled['id'] == id && editorEnabled['fieldName'] == fieldName);
        };

        return {
            isEnabled: isEnabled,
            enable: enable,
            disable: disable
        }
    });

function AlbumsController($scope, $modal, Albums, Album, Status) {
    function list() {
        $scope.albums = Albums.query();
    }

    function clone (obj) {
        return JSON.parse(JSON.stringify(obj));
    }

    function saveAlbum(album) {
        Albums.save(album,
            function () {
                Status.success("Album saved");
                list();
            },
            function (result) {
                Status.error("Error saving album: " + result.status);
            }
        );
    }

    $scope.addAlbum = function () {
        var addModal = $modal.open({
            templateUrl: 'templates/albumForm.html',
            controller: AlbumModalController,
            resolve: {
                album: function () {
                    return {};
                },
                action: function() {
                    return 'add';
                }
            }
        });

        addModal.result.then(function (album) {
            saveAlbum(album);
        });
    };

    $scope.updateAlbum = function (album) {
        var updateModal = $modal.open({
            templateUrl: 'templates/albumForm.html',
            controller: AlbumModalController,
            resolve: {
                album: function() {
                    return clone(album);
                },
                action: function() {
                    return 'update';
                }
            }
        });

        updateModal.result.then(function (album) {
            saveAlbum(album);
        });
    };

    $scope.deleteAlbum = function (album) {
        Album.delete({id: album.id},
            function () {
                Status.success("Album deleted");
                list();
            },
            function (result) {
                Status.error("Error deleting album: " + result.status);
            }
        );
    };

    $scope.setAlbumsView = function (viewName) {
        $scope.albumsView = "templates/" + viewName + ".html";
    };

    $scope.init = function() {
        list();
        $scope.setAlbumsView("grid");
        $scope.sortField = "name";
        $scope.sortDescending = false;
    };
}

function AlbumModalController($scope, $modalInstance, album, action) {
    $scope.albumAction = action;
    $scope.yearPattern = /^[1-2]\d{3}$/;
    $scope.album = album;

    $scope.ok = function () {
        $modalInstance.close($scope.album);
    };

    $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
    };
};

function AlbumEditorController($scope, Albums, Status, EditorStatus) {
    $scope.enableEditor = function (album, fieldName) {
        $scope.newFieldValue = album[fieldName];
        EditorStatus.enable(album.id, fieldName);
    };

    $scope.disableEditor = function () {
        EditorStatus.disable();
    };

    $scope.isEditorEnabled = function (album, fieldName) {
        return EditorStatus.isEnabled(album.id, fieldName);
    };

    $scope.save = function (album, fieldName) {
        if ($scope.newFieldValue === "") {
            return false;
        }

        album[fieldName] = $scope.newFieldValue;

        Albums.save({}, album,
            function () {
                Status.success("Album saved");
                list();
            },
            function (result) {
                Status.error("Error saving album: " + result.status);
            }
        );

        $scope.disableEditor();
    };

    $scope.disableEditor();
}

angular.module('albums').
    directive('inPlaceEdit', function () {
        return {
            restrict: 'E',
            transclude: true,
            replace: true,

            scope: {
                ipeFieldName: '@fieldName',
                ipeInputType: '@inputType',
                ipeInputClass: '@inputClass',
                ipePattern: '@pattern',
                ipeModel: '=model'
            },

            template:
                '
' +
                    '' +
                        '' +
                    '' +
                    '' +
                        '
' +
                            '<input type="{{ipeInputType}}" name="{{ipeFieldName}}" class="{{ipeInputClass}}" ' +
                                'ng-required ng-pattern="{{ipePattern}}" ng-model="newFieldValue" ' +
                                'ui-keyup="{enter: \'save(ipeModel, ipeFieldName)\', esc: \'disableEditor()\'}"/>' +
                            '
' +
                                '<button ng-click="save(ipeModel, ipeFieldName)" type="button" class="btn"></button>' +
                                '<button ng-click="disableEditor()" type="button" class="btn"></button>' +
                            '
' +
                        '
' +
                    '' +
                '
',

            controller: 'AlbumEditorController'
        };
    });


text:
export var logType = {CHAT:0, LOGIN:1, LOGOUT:2, KICKED:3,TIMBA:4};

export class Timba {
	playTime :number = 16;
	betAmount: number = 10;
	maxBetsPerPlayer : number = 50;
	date: Date = new Date();
	log: any[] = [];
	players: any[] = [];
	winners: any;
	executing: boolean = false;
	closed: boolean = false;
	running: boolean = false;
	winnerIndex: number;
	winner: any;
}


text:
node-xvfb: easily start and stop an X Virtual Frame Buffer from your node apps.
-----

### Usage

```javascript
var Xvfb = require('xvfb');
var xvfb = new Xvfb();
xvfb.startSync();

// code that uses the virtual frame buffer here

xvfb.stopSync();
// the Xvfb is stopped
```

or:

```javascript
var Xvfb = require('xvfb');
var xvfb = new Xvfb();
xvfb.start(function(err, xvfbProcess) {
  // code that uses the virtual frame buffer here
  xvfb.stop(function(err) {
    // the Xvfb is stopped
  });
});
```

The Xvfb constructor takes four options:

* displayNum - the X display to use, defaults to the lowest unused display number >= 99 if reuse is false or 99 if reuse is true.
* reuse - whether to reuse an existing Xvfb instance if it already exists on the X display referenced by displayNum.
* timeout - number of milliseconds to wait when starting Xvfb before assuming it failed to start, defaults to 500.
* silent - don't pipe Xvfb stderr to the process's stderr.

### Thanks to

* [kesla](https://github.com/kesla) for https://github.com/kesla/node-headless
* [leonid-shevtsov](https://github.com/leonid-shevtsov) for https://github.com/leonid-shevtsov/headless

both of which served as inspiration for this package.


text:
Here you will find a collection of tools and tips for keeping your application
perform well and contain fewer bugs.

## Angular debug tools in the dev console

Angular provides a set of debug tools that are accessible from any browser's
developer console. In Chrome the dev console can be accessed by pressing
Ctrl + Shift + j.

### Enabling debug tools

By default the debug tools are disabled. You can enable debug tools as follows:

```typescript
import {enableDebugTools} from 'angular2/platform/browser';

bootstrap(Application).then((appRef) => {
  enableDebugTools(appRef);
});
```

### Using debug tools

In the browser open the developer console (Ctrl + Shift + j in Chrome). The
top level object is called `ng` and contains more specific tools inside it.

Example:

```javascript
ng.profiler.timeChangeDetection();
```

## Performance

### Change detection profiler

If your application is janky (it misses frames) or is slow according to other
metrics it is important to find the root cause of the issue. Change detection
is a phase in Angular's lifecycle that detects changes in values that are
bound to UI, and if it finds a change it performs the corresponding UI update.
However, sometimes it is hard to tell if the slowness is due to the act of
computing the changes being slow, or due to the act of applying those changes
to the UI. For your application to be performant it is important that the
process of computing changes is very fast. For best results it should be under
3 milliseconds in order to leave room for the application logic, the UI updates
and browser's rendering pipeline to fit withing the 16 millisecond frame
(assuming the 60 FPS target frame rate).

Change detection profiler repeatedly performs change detection without invoking
any user actions, such as clicking buttons or entering text in input fields. It
then computes the average amount of time it took to perform a single cycle of
change detection in milliseconds and prints it to the console. This number
depends on the current state of the UI. You will likely see different numbers
as you go from one screen in your application to another.

#### Running the profiler

Enable debug tools (see above), then in the dev console enter the following:

```javascript
ng.profiler.timeChangeDetection();
```

The results will be printed to the console.

#### Recording CPU profile

Pass `{record: true}` an argument:

```javascript
ng.profiler.timeChangeDetection({record: true});
```

Then open the "Profiles" tab. You will see the recorded profile titled
"Change Detection". In Chrome, if you record the profile repeatedly, all the
profiles will be nested under "Change Detection".

#### Interpreting the numbers

In a properly-designed application repeated attempts to detect changes without
any user actions should result in no changes to be applied on the UI. It is
also desirable to have the cost of a user action be proportional to the amount
of UI changes required. For example, popping up a menu with 5 items should be
vastly faster than rendering a table of 500 rows and 10 columns. Therefore,
change detection with no UI updates should be as fast as possible. Ideally the
number printed by the profiler should be well below the length of a single
animation frame (16ms). A good rule of thumb is to keep it under 3ms.

#### Investigating slow change detection

So you found a screen in your application on which the profiler reports a very
high number (i.e. >3ms). This is where a recorded CPU profile can help. Enable
recording while profiling:

```javascript
ng.profiler.timeChangeDetection({record: true});
```

Then look for hot spots using
[Chrome CPU profiler](https://developer.chrome.com/devtools/docs/cpu-profiling).

#### Reducing change detection cost

There are many reasons for slow change detection. To gain intuition about
possible causes it would help to understand how change detection works. Such a
discussion is outside the scope of this document (TODO link to docs), but here
are some key concepts in brief.

By default Angular uses "dirty checking" mechanism for finding model changes.
This mechanism involves evaluating every bound expression that's active on the
UI. These usually include text interpolation via `{{expression}}` and property
bindings via `[prop]="expression"`. If any of the evaluated expressions are
costly to compute they could contribute to slow change detection. A good way to
speed things up is to use plain class fields in your expressions and avoid any
kinds of computation. Example:

```typescript
@Component({
  template: '<button [enabled]="isEnabled">{{title}}</button>'
})
class FancyButton {
  // GOOD: no computation, just return the value
  isEnabled: boolean;

  // BAD: computes the final value upon request
  _title: String;
  get title(): String { return this._title.trim().toUpperCase(); }
}
```

Most cases like these could be solved by precomputing the value and storing the
final value in a field.

Angular also supports a second type of change detection - the "push" model. In
this model Angular does not poll your component for changes. Instead, the
component "tells" Angular when it changes and only then does Angular perform
the update. This model is suitable in situations when your data model uses
observable or immutable objects (also a discussion for another time).


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Biblthca Lichenol. 18: 89 (1983)

#### Original name
Lecidea marginiflexa

### Remarks
null


text:
Select a Service to Get Started

<ng-include ng-controller="FormController" src="'views/components/component-form.html'"></ng-include>


text:
package main

import (
	"crypto/x509"
	"fmt"
	"os"
	"os/user"
	"path"
	"time"

	"github.com/Sirupsen/logrus"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"

	"github.com/docker/notary/trustmanager"
)

const configFileName string = "config"
const configPath string = ".docker/trust/"
const trustDir string = "trusted_certificates/"
const privDir string = "private/"
const rootKeysDir string = "root_keys/"

var rawOutput bool
var caStore trustmanager.X509Store
var certificateStore trustmanager.X509Store
var privKeyStore trustmanager.FileStore

func init() {
	logrus.SetLevel(logrus.DebugLevel)
	logrus.SetOutput(os.Stderr)
	// Retrieve current user to get home directory
	usr, err := user.Current()
	if err != nil {
		fatalf("cannot get current user: %v", err)
	}

	// Get home directory for current user
	homeDir := usr.HomeDir
	if homeDir == "" {
		fatalf("cannot get current user home directory")
	}

	// Setup the configuration details
	viper.SetConfigName(configFileName)
	viper.AddConfigPath(path.Join(homeDir, path.Dir(configPath)))
	viper.SetConfigType("json")

	// Find and read the config file
	err = viper.ReadInConfig()
	if err != nil {
		// Ignore if the configuration file doesn't exist, we can use the defaults
		if !os.IsNotExist(err) {
			fatalf("fatal error config file: %v", err)
		}
	}

	// Set up the defaults for our config
	viper.SetDefault("baseTrustDir", path.Join(homeDir, path.Dir(configPath)))

	// Get the final value for the CA directory
	finalTrustDir := path.Join(viper.GetString("baseTrustDir"), trustDir)
	finalPrivDir := path.Join(viper.GetString("baseTrustDir"), privDir)

	// Load all CAs that aren't expired and don't use SHA1
	caStore, err = trustmanager.NewX509FilteredFileStore(finalTrustDir, func(cert *x509.Certificate) bool {
		return cert.IsCA && cert.BasicConstraintsValid && cert.SubjectKeyId != nil &&
			time.Now().Before(cert.NotAfter) &&
			cert.SignatureAlgorithm != x509.SHA1WithRSA &&
			cert.SignatureAlgorithm != x509.DSAWithSHA1 &&
			cert.SignatureAlgorithm != x509.ECDSAWithSHA1
	})
	if err != nil {
		fatalf("could not create CA X509FileStore: %v", err)
	}

	// Load all individual (nonCA) certificates that aren't expired and don't use SHA1
	certificateStore, err = trustmanager.NewX509FilteredFileStore(finalTrustDir, func(cert *x509.Certificate) bool {
		return !cert.IsCA &&
			time.Now().Before(cert.NotAfter) &&
			cert.SignatureAlgorithm != x509.SHA1WithRSA &&
			cert.SignatureAlgorithm != x509.DSAWithSHA1 &&
			cert.SignatureAlgorithm != x509.ECDSAWithSHA1
	})
	if err != nil {
		fatalf("could not create Certificate X509FileStore: %v", err)
	}

	privKeyStore, err = trustmanager.NewKeyFileStore(finalPrivDir)
	if err != nil {
		fatalf("could not create KeyFileStore: %v", err)
	}

}

func main() {
	var NotaryCmd = &cobra.Command{
		Use:   "notary",
		Short: "notary allows the creation of trusted collections.",
		Long:  "notary allows the creation and management of collections of signed targets, allowing the signing and validation of arbitrary content.",
	}

	NotaryCmd.AddCommand(cmdKeys)
	NotaryCmd.AddCommand(cmdTufInit)
	NotaryCmd.AddCommand(cmdTufList)
	cmdTufList.Flags().BoolVarP(&rawOutput, "raw", "", false, "Instructs notary list to output a nonpretty printed version of the targets list. Useful if you need to parse the list.")
	NotaryCmd.AddCommand(cmdTufAdd)
	NotaryCmd.AddCommand(cmdTufRemove)
	NotaryCmd.AddCommand(cmdTufPublish)
	cmdTufPublish.Flags().StringVarP(&remoteTrustServer, "remote", "r", "", "Remote trust server location")
	NotaryCmd.AddCommand(cmdTufLookup)
	cmdTufLookup.Flags().BoolVarP(&rawOutput, "raw", "", false, "Instructs notary lookup to output a nonpretty printed version of the targets list. Useful if you need to parse the list.")
	cmdTufLookup.Flags().StringVarP(&remoteTrustServer, "remote", "r", "", "Remote trust server location")
	NotaryCmd.AddCommand(cmdVerify)

	NotaryCmd.Execute()
}

func fatalf(format string, args ...interface{}) {
	fmt.Printf("* fatal: "+format+"\n", args...)
	os.Exit(1)
}


text:
package io.bootique.cayenne.v41;

import io.bootique.BQRuntime;
import io.bootique.di.BQModule;
import io.bootique.junit5.BQTest;
import io.bootique.junit5.BQTestFactory;
import io.bootique.junit5.BQTestTool;
import org.apache.cayenne.configuration.server.ServerRuntime;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

import static org.junit.jupiter.api.Assertions.*;

@BQTest
public class CayenneStartupListenerIT {

    @BQTestTool
    final BQTestFactory testFactory = new BQTestFactory();

    private BQRuntime runtimeWithCallbacks(CayenneStartupListener... callbacks) {

        BQModule callbacksModule = (binder) -> {
            CayenneModuleExtender extender = CayenneModule.extend(binder);
            Arrays.asList(callbacks).forEach(extender::addStartupListener);
        };

        return testFactory.app()
                .autoLoadModules()
                .module(callbacksModule)
                .createRuntime();
    }

    @Test
    public void testOnSync() {

        TestStartupListener l1 = new TestStartupListener();
        TestStartupListener l2 = new TestStartupListener();

        BQRuntime rt = runtimeWithCallbacks(l1, l2);

        // lazy init... Cayenne stack won't start until someone requests ServerRuntime
        assertFalse(l1.invoked);
        assertFalse(l2.invoked);

        rt.getInstance(ServerRuntime.class);

        assertTrue(l1.invoked);
        assertTrue(l2.invoked);
    }

    static final class TestStartupListener implements CayenneStartupListener {

        boolean invoked;

        @Override
        public void onRuntimeCreated(ServerRuntime runtime) {
            assertNotNull(runtime);
            this.invoked = true;
        }
    }
}


text:
Missing Stage Library

  <ng-include src="'app/home/alerts/error/errorAlert.tpl.html'"></ng-include>

    <ng-include src="'common/administration/enableDPM/restartDPM.tpl.html'"></ng-include>

To install additional libraries, you will need to register with StreamSets.

        <button class="btn btn-primary" ng-click="register()">Register</button>

      You must perform additional steps to install MapR stage libraries. For more information, see MapR Prerequisites.

The stage library for the {{missingStageInfo.definition.label}} stage is not installed.

To use this stage in the pipeline, install the following stage library and restart Data Collector.

    <select class="form-control"
            name="stageLibrary"
            ng-model="selectedLibraryModel.libraryId"
            ng-options="item.libraryId as item.libraryLabel for item in missingStageInfo.libraryList">
    </select>

  <button type="button" class="btn btn-default" ng-click="cancel()"
          ng-if="operationStatus !== 'installing' && operationStatus !== 'restarting'"
          translate="global.form.cancel">Cancel</button>

  <button type="button" class="btn btn-primary" ng-click="install()"
          ng-if="operationStatus === 'incomplete'"
          ng-disabled="registrationNeeded"
          translate="global.form.install">Install</button>

  <button type="button" class="btn btn-primary" ng-click="retry()"
          ng-if="operationStatus === 'complete' && hasErrors()"
          translate="global.form.retry">Retry</button>

  <button type="button" class="btn btn-primary" disabled
          ng-if="operationStatus === 'installing'"
          translate="global.form.installing">Installing...</button>


text:
package org.openecard.gui.swing;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import javax.swing.JFrame;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.openecard.gui.swing.components.PdfComponent;
import org.testng.annotations.Test;

/**
 *
 * @author Tobias Wich
 */
public class TestPdfFrame {

    @Test(enabled = false)
    public void startFrame() throws IOException, InterruptedException, ExecutionException {
	JFrame f = new JFrame();
	f.setSize(800, 600);
	f.setLayout(new BorderLayout());
	f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

	InputStream in = RunGUI.class.getResourceAsStream("/description.pdf");
	PDDocument doc = PDDocument.load(in);
	PdfComponent pdfComp = new PdfComponent(doc);
	pdfComp.setCurrentPage(0);

	f.add(pdfComp, BorderLayout.CENTER);

	CompletableFuture closed = new CompletableFuture();
	f.addWindowListener(new WindowAdapter() {
	    @Override
	    public void windowClosed(WindowEvent e) {
		closed.complete(null);
		super.windowClosed(e);
	    }
	});

	f.setVisible(true);
	closed.get();
    }

}


text:
package uk.gov.hmrc.initrepository.git

import java.nio.file.{Files, Path}

import org.apache.commons.io.FileUtils
import uk.gov.hmrc.initrepository.Log

import scala.util.{Success, Try}

class LocalGitStore(workspace: Path) {

  val gitCommand = Command.run("which git").get.head.trim

  git("--version").map { _.headOption.getOrElse("<no output from git>") }.foreach { version =>
    Log.info(s"using git CLI version $version")
  }

  def lastCommitSha(repoName: String): Try[Option[String]] =
    git("rev-parse HEAD", inRepo = Some(repoName)).map(_.headOption.map(_.trim()))

  def lastCommitUser(repoName: String): Try[Option[String]] =
    git("log --pretty=format:%an", inRepo = Some(repoName)).map(_.headOption.map(_.trim()))

  def lastTag(repoName: String): Try[Option[String]] =
    git("describe --abbrev=0", inRepo = Some(repoName)).map(_.headOption.map(_.trim()))

  def tagAnnotatedCommit(repoName: String, sha: String, tag: String, version: String): Try[Unit] = {
    Log.info(s"creating tag for $repoName, sha : $sha, tagName : $tag, version : $version")
    val versionWithPrefix = "v" + version.stripPrefix("v")
    gitCommandParts(Array("tag", "-a", "-m", "Bootstrap tag", versionWithPrefix), inRepo = Some(repoName)).map { _ =>
      Unit
    }
  }

   def commitFileToRoot(
    repoName: String,
    fileName: String,
    fileContent: String,
    user: String,
    email: String): Try[Unit] = {
    val target: Path = workspace.resolve(repoName).resolve(fileName)
    if (!target.toFile.exists()) {
      target.toFile.createNewFile()
    }

    Files.write(target, fileContent.getBytes("UTF-8"))

    git(s"add .", inRepo = Some(repoName)).flatMap { r =>
      gitCommandParts(
        Array(
          "-c",
          s"user.email=$email",
          "-c",
          s"user.name=$user",
          "commit",
          s"""-madding $fileName"""
        ),
        inRepo = Some(repoName)).map { _ =>
        Unit
      }
    }
  }

  def push(repoName: String): Try[Unit] =
    Command.run(s"$gitCommand push origin master", inDir = Some(workspace.resolve(repoName))).map { _ =>
      Unit
    }

  def pushTags(repoName: String): Try[Unit] =
    Command.run(s"$gitCommand push --tags origin master", inDir = Some(workspace.resolve(repoName))).map { _ =>
      Unit
    }

  def commitCount(repoName: String): Try[Int] =
    git("rev-list HEAD --count", inRepo = Some(repoName)).map(_.head.trim.toInt)

  def gitCommandParts(commandParts: Array[String], inRepo: Option[String] = None): Try[List[String]] = {
    val cwd = inRepo.map(r => workspace.resolve(r)).getOrElse(workspace)
    Command.runArray(gitCommand +: commandParts, inDir = Some(cwd))
  }

  def git(command: String, inRepo: Option[String] = None): Try[List[String]] = {
    val cwd = inRepo.map(r => workspace.resolve(r)).getOrElse(workspace)
    Command.run(s"$gitCommand $command", inDir = Some(cwd))
  }

  def init(name: String, isBare: Boolean = false): Try[Unit] = {
    val bareFlag = if (isBare) "--bare " else ""
    git(s"init $bareFlag$name").map { _ =>
      Unit
    }
  }

  def cloneRepoURL(url: String): Try[Unit] = {
    val name: String = getRepoNameFromUrl(url)
    val targetDir    = workspace.resolve(name)

    Log.info(s"cloning ${url.replaceFirst("\\/\\/(.*@)", "//")} into $targetDir")

    while (targetDir.toFile.exists()) {
      FileUtils.deleteDirectory(targetDir.toFile)
    }

    git(s"clone $url") map { _ =>
      Unit
    }
  }

  def getRepoNameFromUrl(url: String): String = {
    val name = url.split('/').last.stripSuffix(".git")
    name
  }
}


text:
package LabelImage;

import org.bytedeco.javacpp.indexer.UByteRawIndexer;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import static org.bytedeco.javacpp.opencv_core.*;

import static org.bytedeco.javacpp.opencv_highgui.*;
import static org.bytedeco.javacpp.opencv_imgcodecs.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;

/**
 * @author Yao Shi
 */

public class BlurTest {

    public static void main(String [] args) throws IOException {
        String txtPath = "C:\\Users\\Yao\\Desktop\\sample\\tmp.txt";
        readFileNameFromTxt(txtPath);
    }

    private static void readFileNameFromTxt(String txtFile) throws IOException {
        File file = new File(txtFile);
        String abs = file.getParentFile().getAbsolutePath();
        String sCurrentLine;
        BufferedReader br = new BufferedReader(new FileReader(file));

        while ((sCurrentLine = br.readLine()) != null) {
            String path = abs + "\\" + sCurrentLine;
            imgProc(path);
        }
        br.close();
    }

    private static void imgProc(String Path){
        boolean temp = true;
        if(BlurTest.ifBlurry(Path)){
            if(!(new File(Path)).delete())
                System.out.println("Deletion fails.");
        }

    }

    final private static double delta = 10; // Have the limit as 10

    /**
     * @param path The image path
     * @return true for blurry, false for normal
     */
    public static boolean ifBlurry(String path){

        Mat mat = imread(path);
        Mat outGray =  new Mat();
        Mat gray = new Mat();
        int Iij;
        double Iave = 0, Idelta = 0;

        cvtColor(mat,gray,CV_RGB2GRAY);

        //Apply Laplace
        Laplacian(gray,outGray,gray.depth());

        UByteRawIndexer sI = outGray.createIndexer();

        int height = outGray.rows();
        int width = outGray.cols();

         for(int i = 0; i < height; i++){
             for(int j = 0; j < width; j++){
                    Iij = sI.get(i*width+j);
                    Idelta += (Iij - Iave) * (Iij - Iave);
             }

         }
        Idelta = Idelta/(width*height);

        //For testing
        imshow(path,mat);
        moveWindow(path,0, 0);

        if(Idelta < delta) {
            System.out.println("Square difference:" + Idelta );
            System.out.println("Old_OCR.Picture :" + path + " is blurry.");
        }
        /*waitKey(0);
        destroyWindow(path);*/
        return (Idelta < delta);
    }
}


text:
package sdk

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"

	"github.com/mainflux/mainflux/pkg/errors"
)

const (
	usersEndpoint    = "users"
	tokensEndpoint   = "tokens"
	passwordEndpoint = "password"
	membersEndpoint  = "members"
)

func (sdk mfSDK) CreateUser(u User) (string, error) {
	data, err := json.Marshal(u)
	if err != nil {
		return "", err
	}

	url := fmt.Sprintf("%s/%s", sdk.usersURL, usersEndpoint)
	resp, err := sdk.client.Post(url, string(CTJSON), bytes.NewReader(data))
	if err != nil {
		return "", err
	}

	if resp.StatusCode != http.StatusCreated {
		return "", errors.Wrap(ErrFailedCreation, errors.New(resp.Status))
	}

	id := strings.TrimPrefix(resp.Header.Get("Location"), fmt.Sprintf("/%s/", usersEndpoint))
	return id, nil
}

func (sdk mfSDK) User(token string) (User, error) {
	url := fmt.Sprintf("%s/%s", sdk.usersURL, usersEndpoint)
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		return User{}, err
	}

	resp, err := sdk.sendRequest(req, token, string(CTJSON))
	if err != nil {
		return User{}, err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return User{}, err
	}

	if resp.StatusCode != http.StatusOK {
		return User{}, errors.Wrap(ErrFailedFetch, errors.New(resp.Status))
	}

	var u User
	if err := json.Unmarshal(body, &u); err != nil {
		return User{}, err
	}

	return u, nil
}

func (sdk mfSDK) CreateToken(user User) (string, error) {
	data, err := json.Marshal(user)
	if err != nil {
		return "", err
	}

	url := fmt.Sprintf("%s/%s", sdk.usersURL, tokensEndpoint)
	resp, err := sdk.client.Post(url, string(CTJSON), bytes.NewReader(data))
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return "", err
	}

	if resp.StatusCode != http.StatusCreated {
		return "", errors.Wrap(ErrFailedCreation, errors.New(resp.Status))
	}

	var tr tokenRes
	if err := json.Unmarshal(body, &tr); err != nil {
		return "", err
	}

	return tr.Token, nil
}

func (sdk mfSDK) UpdateUser(u User, token string) error {
	data, err := json.Marshal(u)
	if err != nil {
		return err
	}

	url := fmt.Sprintf("%s/%s", sdk.usersURL, usersEndpoint)
	req, err := http.NewRequest(http.MethodPut, url, bytes.NewReader(data))
	if err != nil {
		return err
	}

	resp, err := sdk.sendRequest(req, token, string(CTJSON))
	if err != nil {
		return err
	}

	if resp.StatusCode != http.StatusOK {
		return errors.Wrap(ErrFailedUpdate, errors.New(resp.Status))
	}

	return nil
}

func (sdk mfSDK) UpdatePassword(oldPass, newPass, token string) error {
	ur := UserPasswordReq{
		OldPassword: oldPass,
		Password:    newPass,
	}
	data, err := json.Marshal(ur)
	if err != nil {
		return err
	}

	url := fmt.Sprintf("%s/%s", sdk.usersURL, passwordEndpoint)
	req, err := http.NewRequest(http.MethodPatch, url, bytes.NewReader(data))
	if err != nil {
		return err
	}

	resp, err := sdk.sendRequest(req, token, string(CTJSON))
	if err != nil {
		return err
	}

	if resp.StatusCode != http.StatusCreated {
		return errors.Wrap(ErrFailedUpdate, errors.New(resp.Status))
	}

	return nil
}


text:
import $ from 'jquery'

var template = '
' +
  '' +
  '

' +
  '
' +
  '

' +
  '
' +
  '
' +
  '
' +
  '关闭
' +
  '

' +

  '
' +
  '' +
  '

' +
  '
' +
  '

' +
  '
' +
  '
' +
  '
' +
  '关闭
' +
  '

' +

  '
' +
  '' +
  '

' +
  '
' +
  '

' +
  '
' +
  '
' +
  '
' +
  '取消
' +
  '
' +
  '确定
' +
  '

'

var InfoDialog = {
  init: function () {
    $('body').append(template)
    $('#error-dialog').modal({
      onDeny: function () {
        return true
      }
    })
    $('#info-dialog').modal({
      onDeny: function () {
        return true
      }
    })
    $('#confirm-dialog').modal({
      onDeny: function () {
        return true
      },
      onApprove: function () {
        return true
      }
    })
  },
  error: function (content, title) {
    var dialog = $('#error-dialog')
    if (dialog.size() === 0) {
      InfoDialog.init()
      dialog = $('#error-dialog')
    }
    dialog.find('.header').text(title)
    dialog.find('.content .description p').text(content)
    dialog.modal('show')
  },
  info: function (content, title) {

  },
  confirm: function (content, title, data) {
    var dialog = $('#confirm-dialog')
    if (dialog.size() === 0) {
      InfoDialog.init()
      dialog = $('#confirm-dialog')
    }
    dialog.find('.header').text(title)
    dialog.find('.content .description p').text(content)
    dialog.modal('show')
    return new Promise(
      function (resolve, reject) {
        $('#confirm-dialog').modal({
          onDeny: function () {
            return reject(data)
          },
          onApprove: function () {
            return resolve(data)
          }
        })
      }
    )
  },
  confirmDeleting: function (content, data) {
    return this.confirm(content, '删除确认', data)
  }
}

export default InfoDialog


text:
namespace YAMP.Sets
{
    using System;
    using System.Collections.Generic;
    using YAMP.Converter;
    using YAMP;
    using YAMP.Exceptions;
    using System.Text;
    using System.IO;

    using ISetValueDictionary = System.Collections.Generic.ISet<SetValue.ValueWrap>;

    //SortedSet is NOT implemented in Silverlight. Borrowed implementation from CoreFX.
    using SortedSetValueWrap = YAMPSystem.Collections.Generic.SortedSet<SetValue.ValueWrap>;
    using HashSetValueWrap = System.Collections.Generic.HashSet<SetValue.ValueWrap>;

    using BaseType = YAMP.Value;

    /// <summary>
    /// The SetValue class.
    /// </summary>
    public sealed partial class SetValue : Value, IEquatable<SetValue> //, IFunction, ISetFunction
    {
        #region ctor

        /// <summary>
        /// Creates a new SetValue instance.
        /// </summary>
        public SetValue()
            : this(String.Empty, null, false)
        {
        }

        /// <summary>
        /// Creates a new unsorted instance with a name.
        /// </summary>
        /// <param name="name">The name of the set.</param>
        public SetValue(string name)
            : this(name, null, false)
        {
        }

        /// <summary>
        /// Creates a new instance with a name.
        /// </summary>
        /// <param name="name">The name of the set.</param>
        public SetValue(string name, bool ordered)
            : this(name, null, ordered)
        {
        }

        /// <summary>
        /// Creates a new instance and sets the values.
        /// </summary>
        /// <param name="name">The name ot the set.</param>
        /// <param name="set">The initial values to use.</param>
        public SetValue(string name, ISetValueDictionary set)
            : this(name, set, false)
        {
        }

        /// <summary>
        /// Creates a new instance and sets the values.
        /// </summary>
        /// <param name="name">The name ot the set.</param>
        /// <param name="set">The initial values to use.</param>
        /// <param name="set">Ordered or Unordered set.</param>
        public SetValue(string name, ISetValueDictionary set, bool ordered)
        {
            this._set = CreateSet(ordered, set);
            this.Name = name;
            this.ordered = ordered;
        }

        /// <summary>
        /// Creates a new instance and sets the values.
        /// </summary>
        /// <param name="name">The name ot the set.</param>
        /// <param name="set">The initial values to use.</param>
        /// <param name="set">Ordered or Unordered set.</param>
        public SetValue(string name, bool ordered, ScalarValue[] scalarValues) : this(name)
        {
            this._set = CreateSet(ordered, null);
            this.Name = name;
            this.ordered = ordered;

            for (int i = 0; i < scalarValues.Length; i++)
            {
                _set.Add(new ValueWrap(scalarValues[i]));
            }
        }

        private ISetValueDictionary CreateSet(bool ordered)
        {
            return CreateSet(ordered, null);
        }

        private static ISetValueDictionary CreateSet(bool ordered, ISetValueDictionary source)
        {
            if (source == null)
                return ordered ? (ISetValueDictionary)new SortedSetValueWrap() : (ISetValueDictionary)new HashSetValueWrap();

            return ordered ? (ISetValueDictionary)new SortedSetValueWrap(source) : (ISetValueDictionary)new HashSetValueWrap(source);
        }

        #endregion

        #region Fields

        static readonly String Indentation = "  ";

        readonly ISetValueDictionary _set;
        string _name = string.Empty;
        bool ordered = false;

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the HashSet name.
        /// </summary>
        [StringToStringConverter]
        public String Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public bool Sorted
        {
            get { return ordered; }
            private set { }
        }

        public ISetValueDictionary Set
        {
            get { return _set; }
            private set { }
        }

        #endregion

        #region Serialization

        /// <summary>
        /// Returns a copy of this object value instance.
        /// </summary>
        /// <returns>The cloned object value.</returns>
        public override Value Copy()
        {
            return new SetValue(Name, _set, Sorted);
        }

        /// <summary>
        /// Transforms the instance into a binary representation.
        /// </summary>
        /// <returns>The binary representation.</returns>
        public override Byte[] Serialize()
        {
            var mem = new MemoryStream();
            SerializeString(mem, Name);
            SerializeString(mem, Sorted ? "O" : "U");
            SerializeValueDictionary(mem, _set);

            return mem.ToArray();
        }

        /// <summary>
        /// Transforms a binary representation into a new instance.
        /// </summary>
        /// <param name="content">The binary data.</param>
        /// <returns>The new instance.</returns>
        public override Value Deserialize(Byte[] content)
        {
            var mem = new MemoryStream(content);
            mem.Position = 0;

            string name = DeserializeString(mem);
            string setType = DeserializeString(mem);
            var unit = DeserializeSet(mem, name, setType == "O");
            return unit;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Registers the member operator.
        /// </summary>
        protected override void RegisterOperators()
        {
            Register.BinaryOperator(OpDefinitionsSet.EqOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => new ScalarValue(((SetValue)left) == ((SetValue)right)));

            Register.BinaryOperator(OpDefinitionsSet.StandardNeqOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => new ScalarValue(((SetValue)left) != ((SetValue)right)));
            Register.BinaryOperator(OpDefinitionsSet.AliasNeqOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => new ScalarValue(((SetValue)left) != ((SetValue)right)));

            Register.BinaryOperator(OpDefinitionsSet.UnionOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => SetValue.TUnion(((SetValue)left), new ArgumentsValue(right)));

            Register.BinaryOperator(OpDefinitionsSet.IntersectOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => SetValue.TIntersect(((SetValue)left), new ArgumentsValue(right)));

            Register.BinaryOperator(OpDefinitionsSet.ExceptOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => SetValue.TExcept(((SetValue)left), new ArgumentsValue(right)));

            Register.BinaryOperator(OpDefinitionsSet.ExceptXorOperator, typeof(SetValue), typeof(SetValue),
                (left, right) => SetValue.TExceptXor(((SetValue)left), new ArgumentsValue(right)));
        }

        /// <summary>
        /// Returns the string content of this instance.
        /// </summary>
        /// <param name="context">The context of the invocation.</param>
        /// <returns>The value of the object.</returns>
        public override String ToString(ParseContext context)
        {
            var sb = new StringBuilder();

            sb.AppendLine("{");
            sb.AppendLine(string.Format("Name = {0}, Sorted = {1}, Count = {2}", Name, Sorted, _set.Count));

            foreach (var element in _set)
            {
                //sb.AppendLine();
                sb.Append(element.ToString(context));
            }

            sb.Append("}");
            return sb.ToString();
        }

        #endregion

        #region Helpers

        static String Indent(String value)
        {
            var lines = value.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            return String.Join(Environment.NewLine + Indentation, lines);
        }

        public static void SerializeString(MemoryStream mem, String value)
        {
            var bytes = Encoding.Unicode.GetBytes(value);
            var length = BitConverter.GetBytes(bytes.Length);
            mem.Write(length, 0, length.Length);
            mem.Write(bytes, 0, bytes.Length);
        }

        private void SerializeValueDictionary(MemoryStream mem, ISetValueDictionary set)
        {
            var bytes = BitConverter.GetBytes(set.Count);
            mem.Write(bytes, 0, bytes.Length);

            foreach (var setItem in set)
            {
                setItem.Serialize(mem);
            }
        }

        public static string DeserializeString(MemoryStream mem)
        {
            var buffer = new Byte[4];
            mem.Read(buffer, 0, buffer.Length);
            var length = BitConverter.ToInt32(buffer, 0);
            buffer = new Byte[length];
            mem.Read(buffer, 0, buffer.Length);
            return Encoding.Unicode.GetString(buffer, 0, buffer.Length);
        }

        private SetValue DeserializeSet(MemoryStream mem, string name, bool ordered)
        {
            var buffer = new Byte[sizeof(int)];
            mem.Read(buffer, 0, buffer.Length);
            var count = BitConverter.ToInt32(buffer, 0);

            SetValue ret = new SetValue(name, null, ordered);
            var set = ret._set;

            for (int i = 0; i < count; i++)
            {
                ValueWrap item = new ValueWrap();
                item.Deserialize(mem);

                set.Add(item);
            }

            return ret;
        }

        public override bool Equals(object obj)
        {
            return obj is SetValue && Equals((SetValue)obj);
        }

        /// <summary>
        /// Equality.
        /// </summary>
        /// <param name="l">Set l</param>
        /// <param name="r">Set r</param>
        /// <returns>l == r</returns>
        public static Boolean operator ==(SetValue l, SetValue r)
        {
            if (ReferenceEquals(l, r))
            {
                return true;
            }

            if (ReferenceEquals(l, null) || ReferenceEquals(r, null))
            {
                return false;
            }

            return l.Equals(r);
        }

        /// <summary>
        /// Inequality.
        /// </summary>
        /// <param name="l">Set l</param>
        /// <param name="r">Set r</param>
        /// <returns>l != r</returns>
        public static Boolean operator !=(SetValue l, SetValue r)
        {
            return !(l == r);
        }

        /// <summary>
        /// Equals implementation. Only care on Set's content
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(SetValue other)
        {
            if (ReferenceEquals(other, null))
                return false;

            bool eq = this.Set.SetEquals(other.Set);

            return eq;
        }
        public override int GetHashCode()
        {
            int hash = this.Set.GetHashCode();
            return hash;
        }

        /// <summary>
        /// Adds elements to a set
        /// </summary>
        /// <param name="scalarValues">The array of elements to add</param>
        /// <returns>Number of elements that didn't existed and were added</returns>
        public int AddElements(ScalarValue[] scalarValues)
        {
            int added = 0;
            for (int i = 0; i < scalarValues.Length; i++)
            {
                if (_set.Add(new ValueWrap(scalarValues[i])))
                    added++;
            }
            return added;
        }

        /// <summary>
        /// Removes elements from a set
        /// </summary>
        /// <param name="scalarValues">The array of elements to remove</param>
        /// <returns>Number of elements that didn't existed and were removed</returns>
        public int RemoveElements(ScalarValue[] scalarValues)
        {
            int removed = 0;
            for (int i = 0; i < scalarValues.Length; i++)
            {
                if (_set.Remove(new ValueWrap(scalarValues[i])))
                    removed++;
            }
            return removed;
        }

        #endregion

        #region Nested types

        /// <summary>
        /// Represents one Entry in the Set.
        /// </summary>
        public struct ValueWrap : IEquatable<ValueWrap>, IComparable<ValueWrap>
        {
            private BaseType _id;

            public ValueWrap(BaseType id)
            {
                _id = id;
            }

            public static implicit operator ValueWrap(NumericValue id)  // explicit NumericValue to ValueWrap conversion operator
            {
                return new ValueWrap(id);
            }

            public static implicit operator ValueWrap(Int64 id)  // explicit Int64 to ValueWrap conversion operator
            {
                return new ValueWrap(new ScalarValue(id));
            }

            public static implicit operator ValueWrap(String id)  // explicit String to ValueWrap conversion operator
            {
                return new ValueWrap(new StringValue(id));
            }

            public BaseType ID
            {
                get { return _id; }
                private set { }
            }

            internal void SerializeID(MemoryStream mem, BaseType id)
            {
                SerializeValue(mem, id);
            }

            internal void SerializeValue(MemoryStream mem, Value val)
            {
                SetValue.SerializeString(mem, val.Header);

                var bytes = val.Serialize();
                var bytesLen = BitConverter.GetBytes(bytes.Length);
                mem.Write(bytesLen, 0, bytesLen.Length);
                mem.Write(bytes, 0, bytes.Length);
            }

            internal void Serialize(MemoryStream mem)
            {
                SerializeID(mem, _id);
            }

            internal void DeserializeID(MemoryStream mem)
            {
                _id = DeserializeValue(mem);
            }

            internal Value DeserializeValue(MemoryStream mem)
            {
                string header = SetValue.DeserializeString(mem);

                var buffer = new Byte[sizeof(int)];
                mem.Read(buffer, 0, buffer.Length);
                var len = BitConverter.ToInt32(buffer, 0);

                buffer = new Byte[len];
                mem.Read(buffer, 0, buffer.Length);

                Value val = Value.Deserialize(header, buffer);
                return val;
            }

            internal void Deserialize(MemoryStream mem)
            {
                DeserializeID(mem);
            }

            public override string ToString()
            {
                return ToString(new ParseContext());
            }

            internal string ToString(ParseContext context)
            {
                var sb = new StringBuilder();

                sb.Append(Indentation);
                sb.AppendLine(string.Format("ID = {0}", _id));

                return sb.ToString();
            }

            public override int GetHashCode()
            {
                int hash = _id.GetHashCode();
                return hash;
            }

            public static bool operator ==(ValueWrap x, ValueWrap y)
            {
                return x._id == y._id;
            }

            public static bool operator !=(ValueWrap x, ValueWrap y)
            {
                return !(x == y);
            }

            public override bool Equals(object obj)
            {
                return obj is ValueWrap && Equals((ValueWrap)obj);
            }

            public bool Equals(ValueWrap other)
            {
                bool eq = _id.Equals(other._id);

                return eq;
            }

            public int CompareTo(ValueWrap other)
            {
                Value left = this._id;
                Value right = other._id;

                if (left == null && right == null) return 0;
                if (right == null) return 1;
                if (left == null) return -1;

                if (left is ScalarValue && right is ScalarValue)
                    return (left as ScalarValue).Value.CompareTo((right as ScalarValue).Value);

                if (left is StringValue && right is StringValue)
                    return (left as StringValue).Value.CompareTo((right as StringValue).Value);

                //ScalarValues will always "preceed" strings...
                if (left is ScalarValue && right is StringValue)
                    return -1;
                if (left is StringValue && right is ScalarValue)
                    return 1;

                //Other types cannot be compared...
                throw new ArgumentException("OrderedSet Element is not ScalarValue neither StringValue");
            }
        }
        #endregion

        #region MemberFunctionsHelpers

        /// <summary>
        /// Create a new Set, with the Union of Sets
        /// </summary>
        /// <param name="set">The set</param>
        /// <param name="args">Sets to Union</param>
        /// <returns>The new set</returns>
        internal static SetValue TUnion(SetValue set, ArgumentsValue args)
        {
            string newName = string.Format("({0}", set.Name);

            var newSet = set.Copy() as SetValue;

            int iArgs = 1; //First is "name"
            foreach (var arg in args)
            {
                iArgs++;
                SetValue otherSet = arg as SetValue;
                newName += string.Format("+{0}", otherSet.Name);
                if (!ReferenceEquals(otherSet, null))
                    newSet.Set.UnionWith(otherSet.Set);
                else
                    throw new YAMPArgumentInvalidException("Element is not SetValue", iArgs);
            }
            newName += ")";
            newSet.Name = newName;

            return newSet;
        }

        /// <summary>
        /// Create a new Set, with the Intersection of Sets
        /// </summary>
        /// <param name="set">The set</param>
        /// <param name="args">Sets to Intersect</param>
        /// <returns>The new set</returns>
        internal static SetValue TIntersect(SetValue set, ArgumentsValue args)
        {
            string newName = string.Format("({0}", set.Name);

            var newSet = set.Copy() as SetValue;

            int iArgs = 1; //First is "name"
            foreach (var arg in args)
            {
                iArgs++;
                SetValue otherSet = arg as SetValue;
                newName += string.Format("&{0}", otherSet.Name);
                if (!ReferenceEquals(otherSet, null))
                    newSet.Set.IntersectWith(otherSet.Set);
                else
                    throw new YAMPArgumentInvalidException("Element is not SetValue", iArgs);
            }
            newName += ")";
            newSet.Name = newName;

            return newSet;
        }

        /// <summary>
        /// Create a new Set, with the first Set Except(ed) of the other Sets
        /// </summary>
        /// <param name="set">The set</param>
        /// <param name="args">Sets to Except</param>
        /// <returns>The new set</returns>
        internal static SetValue TExcept(SetValue set, ArgumentsValue args)
        {
            string newName = string.Format("({0}", set.Name);

            var newSet = set.Copy() as SetValue;

            int iArgs = 1; //First is "name"
            foreach (var arg in args)
            {
                iArgs++;
                SetValue otherSet = arg as SetValue;
                newName += string.Format("-{0}", otherSet.Name);
                if (!ReferenceEquals(otherSet, null))
                    newSet.Set.ExceptWith(otherSet.Set);
                else
                    throw new YAMPArgumentInvalidException("Element is not SetValue", iArgs);
            }
            newName += ")";
            newSet.Name = newName;

            return newSet;
        }

        /// <summary>
        /// Create a new Set, with the Symmetric Except(XOR) of all Sets
        /// </summary>
        /// <param name="set">The set</param>
        /// <param name="args">Sets to Except(XOR)</param>
        /// <returns>The new set</returns>
        internal static SetValue TExceptXor(SetValue set, ArgumentsValue args)
        {
            string newName = string.Format("({0}", set.Name);

            var newSet = set.Copy() as SetValue;

            int iArgs = 1; //First is "name"
            foreach (var arg in args)
            {
                iArgs++;
                SetValue otherSet = arg as SetValue;
                newName += string.Format("^{0}", otherSet.Name);
                if (!ReferenceEquals(otherSet, null))
                    newSet.Set.SymmetricExceptWith(otherSet.Set);
                else
                    throw new YAMPArgumentInvalidException("Element is not SetValue", iArgs);
            }
            newName += ")";
            newSet.Name = newName;

            return newSet;
        }

        /// <summary>
        /// Get the number of elements in the Set
        /// </summary>
        /// <param name="set"></param>
        /// <returns>Number of elements in the set</returns>
        internal static ScalarValue TCount(SetValue set)
        {
            if (ReferenceEquals(set, null))
                throw new YAMPArgumentValueException("null", new string[] { "Set" });

            return new ScalarValue(set.Set.Count);
        }

        /// <summary>
        /// Compares two sets
        /// </summary>
        /// <param name="set"></param>
        /// <returns></returns>
        internal static ScalarValue TEquals(SetValue set1, SetValue set2)
        {
            //They should never be null
            if (ReferenceEquals(set1, null) || ReferenceEquals(set2, null))
                return new ScalarValue(false);

            return new ScalarValue(set1.Set.SetEquals(set2.Set));
        }

        public MatrixValue ToMatrix()
        {
            return TToMatrix(this);
        }

        internal static MatrixValue TToMatrix(SetValue set)
        {
            List<ScalarValue> values = new List<ScalarValue>();
            foreach (var el in set.Set)
            {
                if (el.ID is ScalarValue)
                    values.Add(el.ID as ScalarValue);
            }

            MatrixValue matrix = new MatrixValue(values.ToArray(), 1, values.Count);
            return matrix;
        }

        #endregion

        #region MemberFunctions

        [Description("The SetAdd Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class AddFunction : MemberFunction
        {
            [Description("Adds the element to the Set, and returns the set. If Matrix, all its elements will be added")]
            public SetValue Function(Value id)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetAdd");

                if (id is MatrixValue)
                {
                    set.AddElements((id as MatrixValue).ToArray());
                }
                else
                {
                    set.Set.Add(new SetValue.ValueWrap(id));
                }
                return set;
            }
        }

        [Description("The SetAsSort Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class AsSortFunction : MemberFunction
        {
            [Description("Creates a copied sorted Set")]
            public SetValue Function()
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetAsSort");

                var newSet = new SetValue(set.Name, set.Set, true);

                return newSet;
            }
        }

        [Description("The SetAsUnsort Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class AsUnsortFunction : MemberFunction
        {
            [Description("Creates a copied unsorted Set")]
            public SetValue Function()
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetAsUnsort");

                var newSet = new SetValue(set.Name, set.Set, false);

                return newSet;
            }
        }

        [Description("The SetContains Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class ContainsFunction : MemberFunction
        {
            [Description("Determines whether the set contains the given element's id")]
            public ScalarValue Function(Value id)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetContains");

                bool eq = set.Set.Contains(new SetValue.ValueWrap(id));
                return new ScalarValue(eq);
            }
        }

        [Description("The SetCount Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class CountFunction : MemberFunction //, IObjectFunctions
        {
            [Description("Get the number of elements in the Set")]
            public ScalarValue Function()
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetCount");

                return new ScalarValue(set.Set.Count);
            }
        }

        [Description("The SetEquals Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class EqualsFunction : MemberFunction
        {
            [Description("Compares two sets")]
            public ScalarValue Function(SetValue set2)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetEquals");

                bool eq = set.Set.SetEquals(set2.Set);
                return new ScalarValue(eq);
            }
        }

        [Description("The SetExcept Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class ExceptFunction : MemberFunction
        {
            [Description("Create a new Set, with the first Set Except(ed) of the other Sets")]
            [Arguments(0, 0)]
            public SetValue Function(ArgumentsValue args)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetExcept");

                return SetValue.TExcept(set, args);
            }
        }

        [Description("The SetExceptXor Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class ExceptXorFunction : MemberFunction
        {
            [Description("Create a new Set, with the Symmetric Except(XOR) of all Sets")]
            [Arguments(0, 0)]
            public SetValue Function(ArgumentsValue args)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetExceptXor");

                return SetValue.TExceptXor(set, args);
            }
        }

        [Description("The SetIntersect Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class IntersectFunction : MemberFunction
        {
            [Description("Create a new Set, with the Intersection of Sets")]
            [Arguments(0, 0)]
            public SetValue Function(ArgumentsValue args)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetIntersect");

                return SetValue.TIntersect(set, args);
            }
        }

        [Description("The SetIsProperSubsetOf Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class IsProperSubsetOfFunction : MemberFunction
        {
            [Description("Determines whether set1 is a proper subset of set2")]
            public ScalarValue Function(SetValue set2)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetIsProperSubsetOf");

                bool eq = set.Set.IsProperSubsetOf(set2.Set);
                return new ScalarValue(eq);
            }
        }

        [Description("The SetIsProperSupersetOf Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class IsProperSupersetOfFunction : MemberFunction
        {
            [Description("Determines whether set1 is a proper superset of set2")]
            public ScalarValue Function(SetValue set2)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetIsProperSupersetOf");

                bool eq = set.Set.IsProperSupersetOf(set2.Set);
                return new ScalarValue(eq);
            }
        }

        [Description("The SetIsSorted Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class IsSortedFunction : MemberFunction
        {
            [Description("Determines whether set is of Sorted type")]
            public ScalarValue Function()
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetIsSorted");

                bool eq = set.Sorted;
                return new ScalarValue(eq);
            }
        }

        [Description("The SetIsSubsetOf Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class IsSubsetOfFunction : MemberFunction
        {
            [Description("Determines whether set1 is a subset of set2")]
            public ScalarValue Function(SetValue set2)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetIsSubsetOf");

                bool eq = set.Set.IsSubsetOf(set2.Set);
                return new ScalarValue(eq);
            }
        }

        [Description("The SetIsSupersetOf Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class IsSupersetOfFunction : MemberFunction
        {
            [Description("Determines whether set1 is a superset of set2")]
            public ScalarValue Function(SetValue set2)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetIsSupersetOf");

                bool eq = set.Set.IsSupersetOf(set2.Set);
                return new ScalarValue(eq);
            }
        }

        [Description("The SetOverlaps Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class OverlapsFunction : MemberFunction
        {
            [Description("Determines whether the sets overlap over at least one common element")]
            public ScalarValue Function(SetValue set2)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetOverlaps");

                bool eq = set.Set.Overlaps(set2.Set);
                return new ScalarValue(eq);
            }
        }

        [Description("The SetRemove Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class RemoveFunction : MemberFunction
        {
            [Description("Removes the specified element from the Set, and returns the set. If Matrix, all its elements will be removed")]
            public SetValue Function(Value id)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetRemove");

                if (id is MatrixValue)
                {
                    set.RemoveElements((id as MatrixValue).ToArray());
                }
                else
                {
                    set.Set.Remove(new SetValue.ValueWrap(id));
                }
                return set;
            }
        }

        [Description("The SetToMatrix Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class ToMatrixFunction : MemberFunction
        {
            [Description("Create a single row Matrix with all Numeric keys")]
            public MatrixValue Function()
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetToMatrix");

                return SetValue.TToMatrix(set);
            }
        }

        [Description("The SetUnion Object function.")]
        [Kind(PopularKinds.Function)]
        sealed class UnionFunction : MemberFunction
        {
            [Description("Create a new Set, with the Union of Sets")]
            [Arguments(0, 0)]
            public SetValue Function(ArgumentsValue args)
            {
                SetValue set = @this as SetValue;
                if (ReferenceEquals(set, null))
                    throw new YAMPSetsFunctionNotMemberException("SetUnion");

                return SetValue.TUnion(set, args);
            }
        }

        #endregion

    }
}


text:
namespace blink {

class ScriptState;

class PLATFORM_EXPORT ExtensionsRegistry {
 public:
  static ExtensionsRegistry& GetInstance();

  ~ExtensionsRegistry() = default;

  using InstallExtensionFuncType = void (*)(ScriptState*);
  void RegisterBlinkExtensionInstallCallback(InstallExtensionFuncType callback);

  void InstallExtensions(ScriptState* script_state);

 private:
  ExtensionsRegistry() = default;

  Vector<InstallExtensionFuncType> install_funcs_;
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_EXTENSIONS_REGISTRY_H_


text:
package com.redhat.rcm.maven.plugin.buildmetadata.stub;

import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.util.Properties;

import org.apache.maven.model.Build;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;

/**
 * A stub to use with unit tests.
 *
 * @author Robert Reiner
 * @version $Revision: 16727 $
 */
public final class BuildMetaDataProjectStub extends MavenProjectStub
{
  // ********************************* Fields *********************************

  // --- constants ------------------------------------------------------------

  // --- members --------------------------------------------------------------

  /**
   * The base directory of the test.
   */
  private File baseDir;

  // ****************************** Initializer *******************************

  // ****************************** Constructors ******************************

  /**
   * Default constructor.
   */
  public BuildMetaDataProjectStub()
  {
  }

  // ****************************** Inner Classes *****************************

  // ********************************* Methods ********************************

  // --- init -----------------------------------------------------------------

  // --- get&set --------------------------------------------------------------

  /**
   * Returns the properties of the model.
   *
   * @return the properties of the model.
   */
  public Properties getProperties()
  {
    return getModel().getProperties();
  }

  /**
   * Returns the version of the model.
   *

   * {@inheritDoc}
   *
   * @see org.apache.maven.plugin.testing.stubs.MavenProjectStub#getVersion()
   */
  public String getVersion()
  {
    return getModel().getVersion();
  }

  /**
   * Returns the build of the model.
   *

   * {@inheritDoc}
   *
   * @see org.apache.maven.plugin.testing.stubs.MavenProjectStub#getBuild()
   */
  public Build getBuild()
  {
    return getModel().getBuild();
  }

  /**
   * Sets the base directory of the unit test build.
   *
   * @param dir the base directory of the unit test build.
   */
  public void setBasedir(final File dir)
  {
    this.baseDir = dir;
  }

  /**
   * {@inheritDoc}
   *

   * Returns the base directory of the unit test build.
   *

   *
   * @see org.apache.maven.plugin.testing.stubs.MavenProjectStub#getBasedir()
   */
  public File getBasedir()
  {
    return baseDir;
  }

  // --- business -------------------------------------------------------------

  /**
   * Writes the model to the writer.
   *
   * @param writer the writer to write the model to.
   * @throws IOException on any problem writing to the writer.
   */
  public void writeModel(final Writer writer) throws IOException
  {
    final MavenXpp3Writer pomWriter = new MavenXpp3Writer();

    pomWriter.write(writer, getModel());
  }

  // --- object basics --------------------------------------------------------
}


text:
describe( 'Module: ktEventDataService', function() {
  var $scope, $httpBackend;
  var eventDataService;
  var _;

  beforeEach(function() {

    module('ktEventDataService');
    module('ktUnderscoreService');
    inject(function($injector) {
      $httpBackend = $injector.get('$httpBackend');
      $httpBackend.expect('GET', 'http://localhost:2403/calendar-events')
                  .respond({
                            "03/02/2014": ["trumpet lesson", "lunch with jake"],
                            "05/02/2014": ["Club meeting"]
                           });

      eventDataService = $injector.get('eventDataService');
      _ = $injector.get('_');
    });
  });

  describe('populateEventsInCalendar',  function() {
    it('should call promise.then when data is ready', function() {
      var calendarReturned = null;
      var calendar = {};
      var promise = eventDataService.eventsForDates(calendar);
      promise.then(function(data) {
        calendarReturned = data;
      });
      $httpBackend.flush();
      var eventData = calendarReturned.eventData;
      expect(eventData).not.toBe(null);
      expect(_.keys(eventData).length).toBe(2);
      expect(eventData['03/02/2014']).toContain("trumpet lesson");
      expect(eventData['03/02/2014']).toContain("lunch with jake");
      expect(eventData['05/02/2014']).toContain("Club meeting");
    });
  });
});


text:
var AppState = Backbone.Model.extend({
    defaults: function() {
        return {
        	variableProcessor:null,
            isModalOpen:false,
            activeModal: ""
        };
    },

    initialize: function(options) {
    }
});


text:
<?php
/**
 * RedUNIT_Base_Namedparams
 *
 * @file    RedUNIT/Base/Namedparams.php
 * @desc    Test whether you can use named parameters in SQL snippets.
 * @author  Gabor de Mooij and the RedBeanPHP Community
 * @license New BSD/GPLv2
 *
 * (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
 * This source file is subject to the New BSD/GPLv2 License that is bundled
 * with this source code in the file license.txt.
 */
class RedUNIT_Base_Namedparams extends RedUNIT_Base
{
	/**
	 * Test usage of named parameters in SQL snippets.
	 * Issue #299 on Github.
	 *
	 * @return void
	 */
	public function testNamedParamsInSnippets()
	{
		testpack( 'Test whether we can use named parameters in SQL snippets.' );

		R::nuke();
		$book = R::dispense( 'book' );
		$page = R::dispense( 'page' );
		$book->title = 'book';
		R::associate( $book, $page );

		//should not give error like: Uncaught [HY093] - SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters
		$books = R::related( $page, 'book', ' title = :title ', array( ':title' => 'book' ) );

		asrt( count( $books ), 1 );

		//should not give error...
		$books = $page->withCondition( ' title = :title ', array( ':title' => 'book' ) )->sharedBook;

		asrt( count( $books ), 1 );

		//should not give error...
		$links = R::$associationManager->related( $page, 'book', TRUE, ' title = :title ', array( ':title' => 'book' ) );

		asrt( count( $links ), 1 );

		$book2 = R::dispense( 'book' );
		R::associate( $book, $book2 );

		//cross table, duplicate slots?
		$books = R::related( $book2, 'book', ' title = :title ', array( ':title' => 'book' ) );

		asrt( count( $books ), 1 );

		R::nuke();
		$book = R::dispense( 'book' );
		$page = R::dispense( 'page' );
		$book->title = 'book';
		$book->comment = 'comment';
		$page->title = 'page';
		$book->ownPage[] = $page;
		R::store( $book );

		//should also not give error..
		$count = $book->countOwn( 'page' );

		asrt( $count, 1 );

		$book = $book->fresh();

		//should also not give error..
		$count = $book->withCondition( ' title = ? ', array( 'page' ) )->countOwn( 'page' );

		asrt( $count, 1 );

		$book = $book->fresh();

		//should also not give error..
		$count = $book->withCondition( ' title = :title ', array( ':title' => 'page' ) )->countOwn( 'page' );

		asrt( $count, 1 );

		$book = $book->fresh();

		$pages = $book->withCondition( ' title = :title ', array( ':title' => 'page' ) )->ownPage;

		asrt( count( $pages ), 1 );

		//test with duplicate slots...
		$page = reset( $pages );
		$page2 = R::dispense( 'page' );
		$page2->ownPage[] = $page;
		R::store( $page2 );
		$page2 = $page2->fresh();
		$pages = $page2->withCondition( ' title = :title ', array( ':title' => 'page' ) )->ownPage;
		asrt( count( $pages ), 1 );

		//test with find()
		$books = R::$redbean->find( 'book',
				  array(
						'title' => array('book')),
				  ' AND title = :title ', array(':title'=>'book'));

		asrt( count( $books ), 1 );

		$books = R::$redbean->find( 'book',
				  array(
						'title'   => array('book', 'book2'),
						'comment' => array('comment', 'comment2')),
				  ' AND title = :title ', array(':title'=>'book'));

		asrt( count( $books ), 1 );

		//just check numeric works as well...
		$books = R::$redbean->find( 'book',
				  array(
						'title'   => array('book', 'book2'),
						'comment' => array('comment', 'comment2')),
				  ' AND title = ? ', array('book'));

		asrt( count( $books ), 1 );

		//just extra check to verify glue works
		$books = R::$redbean->find( 'book',
				  array(
						'title'   => array('book', 'book2'),
						'comment' => array('comment', 'comment2')),
				  ' ORDER BY id ');

		asrt( count( $books ), 1 );

		//also check with preloader
		$book = $book->fresh();
		R::preload( $book,
				array( 'ownPage' =>
					array( 'page',
						array( ' title = :title ',
							array(':title'=>'page')))));

		asrt( count($book->ownPage), 1 );
	}
}


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

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace tainicom.Aether.Shaders.Components
{
    public partial class InfiniteGridComponent : IDrawable, IGameComponent
    {
        private readonly GraphicsDevice GraphicsDevice;
        private readonly ContentManager _content;

        private VertexBuffer _quadVertexBuffer;
        private IndexBuffer _quadIndexBuffer;
        private InfiniteGridEffect _gridEffect;

        public int DrawOrder { get; set; }
        public bool Visible { get; set; }
        // TODO: Implement IDrawable Events
        public event EventHandler<EventArgs> DrawOrderChanged;
        public event EventHandler<EventArgs> VisibleChanged;

        public Matrix Projection;
        public Matrix View;
        public Matrix EditMatrix;
        public Color Color = Color.FromNonPremultiplied(255, 163, 0, 255);

        public InfiniteGridComponent(GraphicsDevice graphicsDevice, ContentManager content)
        {
            this.GraphicsDevice = graphicsDevice;
            this._content = content;
        }

        public void Initialize()
        {
            this.LoadContent();
        }

        protected void LoadContent()
        {
            _gridEffect = new InfiniteGridEffect(this.GraphicsDevice);

            var vertices = new VertexPositionNormalTexture[4];
            vertices[0].Position = new Vector3(-1f, -1f, 1f);
            vertices[1].Position = new Vector3(+1f, -1f, 1f);
            vertices[2].Position = new Vector3(+1f, +1f, 1f);
            vertices[3].Position = new Vector3(-1f, +1f, 1f);
            vertices[0].Normal = Vector3.Forward;
            vertices[1].Normal = Vector3.Forward;
            vertices[2].Normal = Vector3.Forward;
            vertices[3].Normal = Vector3.Forward;
            vertices[0].TextureCoordinate = new Vector2(0,0);
            vertices[1].TextureCoordinate = new Vector2(0,1);
            vertices[2].TextureCoordinate = new Vector2(1,0);
            vertices[3].TextureCoordinate = new Vector2(1,1);
            short[] indices = new short[] { 0, 1, 2, 2, 3, 0 };
            _quadVertexBuffer = new VertexBuffer(GraphicsDevice, VertexPositionNormalTexture.VertexDeclaration, 4, BufferUsage.None);
            _quadIndexBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.SixteenBits, indices.Length, BufferUsage.None);
            _quadVertexBuffer.SetData(vertices);
            _quadIndexBuffer.SetData(indices);
        }

        protected void UnloadContent()
        {
        }

        public virtual void Draw(GameTime gameTime)
        {
            this.GraphicsDevice.BlendState = BlendState.AlphaBlend;
            this.GraphicsDevice.DepthStencilState = DepthStencilState.None;
            this.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
            this.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

            this._gridEffect.SetDefaultParameters(GraphicsDevice.Viewport, this.Projection, this.View, this.EditMatrix);
            this._gridEffect.DiffuseColor = this.Color.ToVector4();

            this.GraphicsDevice.SetVertexBuffer(_quadVertexBuffer);
            this.GraphicsDevice.Indices = _quadIndexBuffer;

            if (GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            {
                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["HorzLinesATechnique"];
                this._gridEffect.CurrentTechnique.Passes[0].Apply();
                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);

                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["VertLinesATechnique"];
                this._gridEffect.CurrentTechnique.Passes[0].Apply();
                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);

                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["HorzLinesBTechnique"];
                this._gridEffect.CurrentTechnique.Passes[0].Apply();
                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);

                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["VertLinesBTechnique"];
                this._gridEffect.CurrentTechnique.Passes[0].Apply();
                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
            }
            else
            {
                this._gridEffect.CurrentTechnique = this._gridEffect.Techniques["GridTechnique"];
                this._gridEffect.CurrentTechnique.Passes[0].Apply();
                this.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
            }

            return;
        }

    }
}


text:
package model;

import model.subSystems.MovementSystem;

/**
 * Java-Gcode
 * Created by Matthew Wood on 12/05/2017.
 */
public class Printer3D
{
    public static final MovementSystem MOVEMENT_SYSTEM = new MovementSystem();
}


text:
<?php

namespace Tabbi89\Presenter;

/**
 * Trait Presentable
 *
 * Allows to present view specified logic
 *
 * <code>
 * class Foo implements PresentableInterface
 * {
 *     use Presentable;
 *     public function getPresenter()
 *     {
 *         return 'FooPresenter';
 *     }
 *     # ...
 * }
 *
 * class FooPresenter
 * {
 *     public __construct(Foo $foo)
 *     {
 *         $this->foo = $foo;
 *     }
 *
 *      public function getFullName()
 *      {
 *          return $this->foo->getName . $this->foo->getLastName;
 *      }
 * }
 *
 * $foo = new Foo()
 * $fullName = $foo->present()->getFullName();
 * </code>
 *
 * @package Tabbi89\Presenter
 * @author  Tabbi89 <tom@tabbi89.com>
 */
trait Presentable
{
    /**
     * View presenter instance
     *
     * @var mixed
     */
    protected $presenterInstance;

    /**
     * Prepare a new or cached presenter instance
     *
     * @return mixed
     *
     * @throws PresenterNotFoundException
     */
    public function present()
    {
        if (!$this instanceof PresentableInterface || !class_exists($this->getPresenter())) {
             throw new PresenterNotFoundException('Please set the property to correct presenter path or implement presentable interface');
        }

        if (!$this->presenterInstance) {
            $presenter = $this->getPresenter();
            $this->presenterInstance = new $presenter($this);
        }

        return $this->presenterInstance;
    }
}


text:
 .. Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

 ..   http://www.apache.org/licenses/LICENSE-2.0

 .. Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

Changelog
---------

4.2.3
.....

Bug Fixes
~~~~~~~~~

* ``Fix mistakenly added install_requires for all providers (#22382)``

4.2.2
.....

Misc
~~~~~

* ``Add Trove classifiers in PyPI (Framework :: Apache Airflow :: Provider)``

4.2.1
.....

Misc
~~~~

* ``Support for Python 3.10``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):

4.2.0
.....

Features
~~~~~~~~

* ``Return slack api call response in slack_hook (#21107)``

Bug Fixes
~~~~~~~~~

* ``Fix template_fields type to have MyPy friendly Sequence type (#20571)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Fix K8S changelog to be PyPI-compatible (#20614)``
   * ``Fix mypy providers (#20190)``
   * ``Doc: Restoring additional context in Slack operators how-to guide (#18985)``
   * ``Remove ':type' lines now sphinx-autoapi supports typehints (#20951)``
   * ``Update documentation for provider December 2021 release (#20523)``
   * ``Update SlackWebhookHook docstring (#20061)``
   * ``Use typed Context EVERYWHERE (#20565)``
   * ``Update documentation for November 2021 provider's release (#19882)``
   * ``Prepare documentation for October Provider's release (#19321)``
   * ``Add documentation for January 2021 providers release (#21257)``

4.1.0
.....

Features
~~~~~~~~

* ``Restore filename to template_fields (#18466)``

Bug Fixes
~~~~~~~~~

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Static start_date and default arg cleanup for misc. provider example DAGs (#18597)``
   * ``Add Slack operators how-to guide (#18525)``

4.0.1
.....

Misc
~~~~

* ``Optimise connection importing for Airflow 2.2.0``

Bug Fixes
~~~~~~~~~

* ``Fixed SlackAPIFileOperator to upload file and file content. (#17400)``
* ``Fixed SlackAPIFileOperator to upload file and file content (#17247)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Update description about the new ''connection-types'' provider meta-data (#17767)``
   * ``Import Hooks lazily individually in providers manager (#17682)``
   * ``Prepares docs for Rc2 release of July providers (#17116)``
   * ``Prepare documentation for July release of providers. (#17015)``
   * ``Removes pylint from our toolchain (#16682)``

4.0.0
.....

Breaking changes
~~~~~~~~~~~~~~~~

* ``Auto-apply apply_default decorator (#15667)``

.. warning:: Due to apply_default decorator removal, this version of the provider requires Airflow 2.1.0+.
   If your Airflow version is < 2.1.0, and you want to install this provider version, first upgrade
   Airflow to at least version 2.1.0. Otherwise your Airflow package version will be upgraded
   automatically and you will have to manually run ``airflow upgrade db`` to complete the migration.

Bug Fixes
~~~~~~~~~

* ``Fix hooks extended from http hook (#16109)``

.. Below changes are excluded from the changelog. Move them to
   appropriate section above if needed. Do not delete the lines(!):
   * ``Adds interactivity when generating provider documentation. (#15518)``
   * ``Rename the main branch of the Airflow repo to be 'main' (#16149)``
   * ``Prepares provider release after PIP 21 compatibility (#15576)``
   * ``Remove Backport Providers (#14886)``
   * ``Updated documentation for June 2021 provider release (#16294)``
   * ``Fix Sphinx Issues with Docstrings (#14968)``
   * ``Fix docstring formatting on ``SlackHook`` (#15840)``
   * ``Add Connection Documentation for Providers (#15499)``
   * ``More documentation update for June providers release (#16405)``
   * ``Synchronizes updated changelog after buggfix release (#16464)``

3.0.0
.....

Breaking changes
~~~~~~~~~~~~~~~~

* ``Don't allow SlackHook.call method accept *args (#14289)``

2.0.0
.....

Breaking changes
~~~~~~~~~~~~~~~~

We updated the support for ``slack_sdk`` from ``>=2.0.0,<3.0.0`` to ``>=3.0.0,<4.0.0``. In most cases,
this doesn't mean any breaking changes to the DAG files, but if you used this library directly
then you have to make the changes. For details, see
`the Migration Guide <https://slack.dev/python-slack-sdk/v3-migration/index.html#from-slackclient-2-x>`_
for Python Slack SDK.

* ``Upgrade slack_sdk to v3 (#13745)``

1.0.0
.....

Initial version of the provider.


text:
body {
    font-family: serif;
    color: green;
}


text:
#import <iWorkImport/GQDGraphic.h>

#import "GQDNameMappable-Protocol.h"

@class GQDImageBinary;

// Not exported
@interface GQDWebView : GQDGraphic <GQDNameMappable>
{
    GQDImageBinary *mImageBinary;
}

+ (const struct StateSpec *)stateForReading;
- (id)imageBinary;
- (void)dealloc;

@end