text:
// Copyright 2019 Google LLC
//
// 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
//
//     https://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.

package com.google.sps.data;

import com.google.sps.data.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;

public final class TesterSchedule {

  private static final int DURATION_30_MINUTES = 30;
  private static final int DURATION_90_MINUTES = 90;
  private static final int DURATION_1_HOUR = 60;
  private static final int DURATION_2_HOUR = 120;

  /**
   * Returns a list of times on monday, wednesday, and friday, to be used in section constructors.
   */
  public static List<TimeRange> monWedFri(int hour, int minute, int durationMinutes) {
    TimeRange mon = TimeRange.fromStartDuration(TimeRange.MONDAY, hour, minute, durationMinutes);
    TimeRange wed = TimeRange.fromStartDuration(TimeRange.WEDNESDAY, hour, minute, durationMinutes);
    TimeRange fri = TimeRange.fromStartDuration(TimeRange.FRIDAY, hour, minute, durationMinutes);
    return Arrays.asList(mon, wed, fri);
  }

  /**
   * Returns a list of times on Tuesday and Thursday, to be used in section constructors.
   */
  public static List<TimeRange> tuesThurs(int hour, int minute, int durationMinutes) {
    TimeRange tues = TimeRange.fromStartDuration(TimeRange.TUESDAY, hour, minute, durationMinutes);
    TimeRange thurs = TimeRange.fromStartDuration(TimeRange.THURSDAY, hour, minute, durationMinutes);
    return Arrays.asList(tues, thurs);
  }

  public static Schedule scheduleOne() {
    List<TimeRange> times = monWedFri(10, 30, DURATION_90_MINUTES);
    Section lectureSection = new Section("Ms. Akins", times);
    Section labSection = null;
    ScheduledCourse course1 = new ScheduledCourse("Philosophical Inquiry", "PHIL1001",
        "Philosophy", 4, true, lectureSection, labSection);

    List<TimeRange> times2 = tuesThurs(16, 10, DURATION_2_HOUR);
    Section lectureSection2 = new Section("Prof. Zimmerman", times2);
    List<TimeRange> labTimes2 = tuesThurs(19, 0, DURATION_30_MINUTES);
    Section labSection2 = new Section("TA", labTimes2);
    ScheduledCourse course2 = new ScheduledCourse("Calc III", "MATH246",
        "Mathematics", 2, true, lectureSection2, labSection2);

    Collection<ScheduledCourse> courses = new ArrayList<>();
    courses.add(course1);
    courses.add(course2);
    Schedule schedule = new Schedule(courses);
    return schedule;
  }

  public static Schedule scheduleTwo() {
    List<TimeRange> times = monWedFri(12, 00, DURATION_30_MINUTES);
    Section lectureSection = new Section("Dr. Eggman", times);
    Section labSection = null;
    ScheduledCourse course1 = new ScheduledCourse("Intro to Evil", "EVIL100",
        "Wrongdoing", 1, true, lectureSection, labSection);

    List<TimeRange> times2 = tuesThurs(14, 20, DURATION_1_HOUR);
    Section lectureSection2 = new Section("Prof. Johnson", times2);
    Section labSection2 = null;
    ScheduledCourse course2 = new ScheduledCourse("Intro to Psych", "PSYCH256",
        "Psychology", 3, true, lectureSection2, labSection2);

    Collection<ScheduledCourse> courses = new ArrayList<>();
    courses.add(course1);
    courses.add(course2);
    Schedule schedule = new Schedule(courses);
    return schedule;
  }
}


text:
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt.

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Sce.Atf.Controls.PropertyEditing
{
    ///
    /// Grid control with check boxes for properties
    public partial class GridControlShowHidePropertiesDialog : Form
    {
        ///
        /// Constructor
        /// <param name="gridView">GridView for instance</param>
        public GridControlShowHidePropertiesDialog(GridView gridView)
        {
            m_gridView = gridView;
            InitializeComponent();
        }

        private void GridControlShowHidePropertiesDialog_Load(object sender, EventArgs e)
        {
            Dictionary<string, bool> userVisibility = m_gridView.GetColumnUserHiddenStates();

            int index = 0;
            foreach (KeyValuePair<string, bool> entry in userVisibility)
            {
                // Load the list with show and hide checkbox values
                PropertiesListBox.Items.Add(entry.Key);
                PropertiesListBox.SetItemChecked(index++, !entry.Value);
            }
        }

        private void OK_Click(object sender, EventArgs e)
        {
            Dictionary<string, bool> userVisibility = new Dictionary<string, bool>();

            // get the checked state from the control
            int index = 0;
            foreach (string item in PropertiesListBox.Items)
            {
                userVisibility.Add(item, !PropertiesListBox.GetItemChecked(index++));
            }

            m_gridView.SetColumnUserHiddenStates(userVisibility);

            m_gridView.Invalidate();

            Close();
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private GridView m_gridView;
    }
}

redpajama_set_name: RedPajamaGithub


text:
[![Build Status](https://travis-ci.org/jonruttan/delexe.svg)](https://travis-ci.org/jonruttan/delexe)
[![Greenkeeper badge](https://badges.greenkeeper.io/jonruttan/delexe.svg)](https://greenkeeper.io/)

Read in JSON/CSON tokens from a TextMate-style lexical analyser and render the tokens with rendering modules written in a TextMate-style syntax.

Companion to the [Textlex](https://github.com/jonruttan/textlex) lexical analyser project.

Based on code converted from the [Highlights](https://github.com/atom/highlights) project.

### Installing

```sh
npm install delexe
```

### Using

Run `delexe -h` for full details about the supported options.

To convert a JSON token file to tokenized HTML run the following:

```sh
delexe tokens.json -o file.html
```

Now you have a `file.html` file that has a big `<pre>` tag with a `<div>` for
each line with `<span>` elements for each token's scope.

Then you can compile an existing Atom theme into a stylesheet with the
following:

```sh
git clone https://github.com/atom/atom-dark-syntax
cd atom-dark-syntax
npm install -g less
lessc --include-path=stylesheets index.less atom-dark-syntax.css
```

Now you have an `atom-dark-syntax.css` stylesheet that can be combined with
the `file.html` file to generate some nice looking code.

Check out the [examples](https://jonruttan.github.io/delexe/examples) to see
it in action.

Check out [atom.io](https://atom.io/packages) to find more themes.

Some popular themes:
  * [atom-dark-syntax](https://github.com/atom/atom-dark-syntax)
  * [atom-light-syntax](https://github.com/atom/atom-light-syntax)
  * [solarized-dark-syntax](https://github.com/atom/solarized-dark-syntax)
  * [solarized-light-syntax](https://github.com/atom/solarized-light-syntax)

#### Using in code

To convert a JSON token string to tokenized HTML run the following:

```js
var Delexe = require('delexe');
var renderer = new Delexe();
var fileTokens = [
  [
    {
      "value": "var",
      "scopes": [
        "source.js",
        "storage.modifier.js"
      ]
    },
    {
      "value": " hello ",
      "scopes": [
        "source.js"
      ]
    },
    {
      "value": "=",
      "scopes": [
        "source.js",
        "keyword.operator.js"
      ]
    },
    {
      "value": " ",
      "scopes": [
        "source.js"
      ]
    },
    {
      "value": "'",
      "scopes": [
        "source.js",
        "string.quoted.single.js",
        "punctuation.definition.string.begin.js"
      ]
    },
    {
      "value": "world",
      "scopes": [
        "source.js",
        "string.quoted.single.js"
      ]
    },
    {
      "value": "'",
      "scopes": [
        "source.js",
        "string.quoted.single.js",
        "punctuation.definition.string.end.js"
      ]
    },
    {
      "value": ";",
      "scopes": [
        "source.js",
        "punctuation.terminator.statement.js"
      ]
    }
  ]
];

var text = renderer.renderSync({
  fileTokens: fileTokens
});

console.log(text);

var html = renderer.renderSync({
  scopeName: 'text.html.plain',
  fileTokens: fileTokens
});

console.log(html);
```

Outputs:

```
var hello = 'world';
```

```html
<pre class="editor editor-colors">
  <div class="line">
    <span class="source js">
      <span class="storage modifier js">var</span>
       hello
      <span class="keyword operator js">=</span>

      <span class="string quoted single js">
        <span class="punctuation definition string begin js">'</span>
        world
        <span class="punctuation definition string end js">'</span>
      </span>
      <span class="punctuation terminator statement js">;</span>
    </span>
  </div>
</pre>
```

### Developing

* Clone this repository `git clone https://github.com/jonruttan/delexe`
* Update the submodules by running `git submodule update --init --recursive`
* Run `npm install` to install the dependencies, compile the CoffeeScript, and
  build the grammars
* Run `npm test` to run the specs

:green_heart: Pull requests are greatly appreciated and welcomed.


text:
<?php

namespace League\OAuth1\Client\Signature;

class PlainTextSignature extends Signature implements SignatureInterface
{
    /**
     * {@inheritDoc}
     */
    public function method()
    {
        return 'PLAINTEXT';
    }

    /**
     * {@inheritDoc}
     */
    public function sign($uri, array $parameters = array(), $method = 'POST')
    {
        return $this->key();
    }
}


text:
// import '@ngrx/core/add/operator/select'; // moved this to src/vendor.browser.ts
// import 'rxjs/add/operator/switchMap';
// import 'rxjs/add/operator/let';
// import { Observable } from 'rxjs/Observable';

/**
 * The compose function is one of our most handy tools. In basic terms, you give
 * it any number of functions and it returns a function. This new function
 * takes a value and chains it through every composed function, returning
 * the output.
 *
 * More: https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch5.html
 */
import { compose } from '@ngrx/core/compose';

/**
 * storeLogger is a powerful metareducer that logs out each time we dispatch
 * an action.
 *
 * A metareducer wraps a reducer function and returns a new reducer function
 * with superpowers. They are handy for all sorts of tasks, including
 * logging, undo/redo, and more.
 */
import { storeLogger } from 'ngrx-store-logger';

/**
 * combineReducers is another useful metareducer that takes a map of reducer
 * functions and creates a new reducer that stores the gathers the values
 * of each reducer and stores them using the reducer's key. Think of it
 * almost like a database, where every reducer is a table in the db.
 *
 * More: https://egghead.io/lessons/javascript-redux-implementing-combinereducers-from-scratch
 */
import { combineReducers } from '@ngrx/store';

/**
 * @ngrx/router-store keeps the router in sync with @ngrx/store. To connect the
 * two, we need to use the routerReducer.
 */
import { routerReducer, RouterState } from '@ngrx/router-store';

/**
 * Every reducer module's default export is the reducer function itself. In
 * addition, each module should export a type or interface that describes
 * the state of the reducer plus any selector functions. The `* as`
 * notation packages up all of the exports into a single object.
 */
// import searchReducer, * as fromSearch from './search';
// import booksReducer, * as fromBooks from './books';
// import collectionReducer, * as fromCollection from './collection';
import { usersReducer, IUsersState } from '../users/_shared/_model';
import { errorsReducer } from './_errors';
import { IErrorsState } from './_errors/_errors.commons';

/**
 * As mentioned, we treat each reducer like a table in a database. This means
 * our top level state interface is just a map of keys to inner state types.
 */
export interface AppState {
  router: RouterState;
  // search: fromSearch.SearchState;
  // books: fromBooks.BooksState;
  // collection: fromCollection.CollectionState;
  users: IUsersState;
  errors: IErrorsState;
}

/**
 * Because metareducers take a reducer function and return a new reducer,
 * we can use our compose helper to chain them together. Here we are
 * using combineReducers to make our top level reducer, and then
 * wrapping that in storeLogger. Remember that compose applies
 * the result from right to left.
 */
export default compose(storeLogger(), combineReducers)({
  router: routerReducer,
  // search: searchReducer,
  // books: booksReducer,
  // collection: collectionReducer,
  users: usersReducer,
  errors: errorsReducer
});

/**
 * A selector function is a map function factory. We pass it parameters and it
 * returns a function that maps from the larger state tree into a smaller
 * piece of state. This selector simply selects the `books` state.
 *
 * Selectors are used with the `let` operator. They take an input observable
 * and return a new observable. Here's how you would use this selector:
 *
 * ```ts
 * class MyComponent {
 * 	constructor(state$: Observable<AppState>) {
 * 	  this.booksState$ = state$.let(getBooksState());
 * 	}
 * }
 * ```
 */
//  export function getBooksState() {
//   return (state$: Observable<AppState>) => state$
//     .select(s => s.books);
// }

/**
 * Every reducer module exports selector functions, however child reducers
 * have no knowledge of the overall state tree. To make them useable, we
 * need to make new selectors that wrap them.
 *
 * Once again our compose function comes in handy. From right to left, we
 * first select the books state then we pass the state to the book
 * reducer's getBooks selector, finally returning an observable
 * of search results.
 */
//  export function getBookEntities() {
//    return compose(fromBooks.getBookEntities(), getBooksState());
//  }

//  export function getBook(id: string) {
//    return compose(fromBooks.getBook(id), getBooksState());
//  }

//  export function hasBook(id: string) {
//    return compose(fromBooks.hasBook(id), getBooksState());
//  }

//  export function getBooks(bookIds: string[]) {
//    return compose(fromBooks.getBooks(bookIds), getBooksState());
//  }

/**
 * Just like with the books selectors, we also have to compose the search
 * reducer's and collection reducer's selectors.
 */
// export function getSearchState() {
//  return (state$: Observable<AppState>) => state$
//    .select(s => s.search);
// }

// export function getSearchBookIds() {
//   return compose(fromSearch.getBookIds(), getSearchState());
// }

// export function getSearchStatus() {
//   return compose(fromSearch.getStatus(), getSearchState());
// }

// export function getSearchQuery() {
//   return compose(fromSearch.getQuery(), getSearchState());
// }

/**
 * Some selector functions create joins across parts of state. This selector
 * composes the search result IDs to return an array of books in the store.
 */
// export function getSearchResults() {
//   return (state$: Observable<AppState>) => state$
//     .let(getSearchBookIds())
//     .switchMap(bookIds => state$.let(getBooks(bookIds)));
// }

// export function getCollectionState() {
//   return (state$: Observable<AppState>) => state$
//     .select(s => s.collection);
// }

// export function getCollectionLoaded() {
//   return compose(fromCollection.getLoaded(), getCollectionState());
// }

// export function getCollectionLoading() {
//   return compose(fromCollection.getLoading(), getCollectionState());
// }

// export function getCollectionBookIds() {
//   return compose(fromCollection.getBookIds(), getCollectionState());
// }

// export function isBookInCollection(id: string) {
//   return compose(fromCollection.isBookInCollection(id), getCollectionState());
// }

// export function getBookCollection() {
//   return (state$: Observable<AppState>) => state$
//     .let(getCollectionBookIds())
//     .switchMap(bookIds => state$.let(getBooks(bookIds)));
// }


text:
import acres from 'google-maps-markup/utils/acres';
import { module, test } from 'qunit';

module('Unit | Utility | acres');

// Replace this with your real tests.
test('it works', function(assert) {
  var input = {
    value: 60000,
    unit: 'sq. ft.',
    measurementType: 'Area'
  };
  var result = acres(input);

  assert.deepEqual(result, {
    value: 1.37741,
    unit: 'ac.',
    measurementType: input.measurementType
  });
});


text:
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
#endif

namespace DirectX
{
    class Mouse
    {
    public:
        Mouse();
        Mouse(Mouse&& moveFrom);
        Mouse& operator= (Mouse&& moveFrom);
        virtual ~Mouse();

        enum Mode
        {
            MODE_ABSOLUTE = 0,
            MODE_RELATIVE,
        };

        struct State
        {
            bool    leftButton;
            bool    middleButton;
            bool    rightButton;
            bool    xButton1;
            bool    xButton2;
            int     x;
            int     y;
            int     scrollWheelValue;
            Mode    positionMode;
        };

        class ButtonStateTracker
        {
        public:
            enum ButtonState
            {
                UP = 0,         // Button is up
                HELD = 1,       // Button is held down
                RELEASED = 2,   // Button was just released
                PRESSED = 3,    // Buton was just pressed
            };

            ButtonState leftButton;
            ButtonState middleButton;
            ButtonState rightButton;
            ButtonState xButton1;
            ButtonState xButton2;

            ButtonStateTracker() { Reset(); }

            void __cdecl Update( const State& state );

            void __cdecl Reset();

        private:
            State lastState;
        };

        // Retrieve the current state of the mouse
        State __cdecl GetState() const;

        // Resets the accumulated scroll wheel value
        void __cdecl ResetScrollWheelValue();

        // Sets mouse mode (defaults to absolute)
        void __cdecl SetMode(Mode mode);

#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) && defined(WM_USER)
        void __cdecl SetWindow(HWND window);
        static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);
#endif

#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
        void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
#ifdef __cplusplus_winrt
        void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
        {
            // See https://msdn.microsoft.com/en-us/library/hh755802.aspx
            SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
        }
#endif
        static void __cdecl SetDpi(float dpi);
#endif

        // Singleton
        static Mouse& __cdecl Get();

    private:
        // Private implementation.
        class Impl;

        std::unique_ptr<Impl> pImpl;

        // Prevent copying.
        Mouse(Mouse const&) DIRECTX_CTOR_DELETE
        Mouse& operator=(Mouse const&) DIRECTX_CTOR_DELETE
    };
}


text:
/*
 * ShowstatInData.java
 *
  */

package elektra;

/**
 *
 * @author Rolfs
 */
public class ShowstatInData
{
    private String strSession;
    private String strVersion;
    private String strEncryption;
    private String strCompression;
    private String strSysID;
    private String strClientID;
    private String strSelectParam;
    private String strOutputType;
    private String strEventNumber;
    private String strShowNumber;

  /** Creates a new instance of CancelInData */
  public ShowstatInData()
  {
    setSession("");
    setVersion("");
    setEncryption("");
    setCompression("");
    setSysID("");
    setClientID("");
    setSelectParam("0");
    setOutputType("0");
    setEventNumber("0");
    setShowNumber("0");
  }

  public void setSession(String a)
  {
    this.strSession = a;
  }
  public void setVersion(String a)
  {
    this.strVersion = a;
  }
  public void setEncryption(String a)
  {
    this.strEncryption = a;
  }
  public void setCompression(String a)
  {
    this.strCompression = a;
  }
  public void setSysID(String a)
  {
    this.strSysID = a;
  }
  public void setClientID(String a)
  {
    this.strClientID = a;
  }
  public void setSelectParam(String a)
  {
    this.strSelectParam = a;
  }
  public void setOutputType(String a)
  {
    this.strOutputType = a;
  }
  public void setEventNumber(String a)
  {
    this.strEventNumber = a;
  }
  public void setShowNumber(String a)
  {
    this.strShowNumber = a;
  }

  //-----------------------------------------------
  public String getSession()
  {
    return this.strSession;
  }
  public String getSysID()
  {
    return this.strSysID;
  }
  public String getClientID()
  {
    return this.strClientID;
  }
  public String getSelectParam()
  {
    return this.strSelectParam;
  }
  public String getOutputType()
  {
    return this.strOutputType;
  }
  public String getEventNumber()
  {
    return this.strEventNumber;
  }
  public String getShowNumber()
  {
    return this.strShowNumber;
  }
}


text:
using System;
using System.Data.Odbc;
using System.Threading.Tasks;
using Nvents.Services;
using Xunit;

namespace Nvents.Tests
{
	public class CombinationServiceTests
	{
	    private readonly CombinationService service;

        [Fact]
        public void AllServicesStarted()
        {
            foreach (IService srv in service.Services)
                Assert.True(srv.IsStarted, "All Services weren't started");
        }

		[Fact]
		public void CanPublishCombinationEvent()
		{
		    int count = 0;
		    int expectedCount = service.Services.Count;
            service.DuplicateSuppression = DuplicateSuppressionOption.None;
			service.Subscribe<FooEvent>(e => count++);

            Test.WaitFor(() => count == expectedCount, TimeSpan.FromSeconds(1), () =>
				service.Publish(new FooEvent()));

            Assert.True(count == expectedCount, String.Format("FooEvent was not raised {0} times", expectedCount));
		}

        [Fact]
        public void CanFilterDuplicateEventWhenUnqiueOnly()
        {
            int count = 0;
            service.DuplicateSuppression = DuplicateSuppressionOption.UseEquals;
            service.Subscribe<UniqueEvent>(e => count++);

            Test.WaitFor(() => count == 2, TimeSpan.FromSeconds(1), () =>
                service.Publish(new UniqueEvent { ID = Guid.NewGuid()}));

            Assert.True(count == 1, "UniqueEvent was raised more than once");
        }

        [Fact]
        public void CanFilterDuplicateEventWhenSuppressAll()
        {
            int count = 0;
            service.DuplicateSuppression = DuplicateSuppressionOption.All;
            service.Subscribe<FooEvent>(e =>
            {
                if (e != null)
                    count++;
            });

            Test.WaitFor(() => count == 2, TimeSpan.FromSeconds(1), () =>
                service.Publish(new FooEvent()));

            Assert.True(count == 1, "UniqueEvent was raised more than once");
        }

        [Fact]
        public void CanFilterDuplicateEventWhenSuppressAllAndMultipleSubscriptions()
        {
            int count = 0;
            service.DuplicateSuppression = DuplicateSuppressionOption.All;
            service.Subscribe<UniqueEvent>(_=>{});
            service.Subscribe<FooEvent>(e =>
            {
                if (e != null)
                    count++;
            });

            Test.WaitFor(() => count == 2, TimeSpan.FromSeconds(1), () =>
                service.Publish(new FooEvent()));

            Assert.True(count == 1, "UniqueEvent was raised more than once");
        }

        [Fact]
        public void ExpiresOldUniqueEvents()
        {
            int count = 0;
            service.UniqueCheckTimeLimit = TimeSpan.FromMilliseconds(10);
            service.DuplicateSuppression = DuplicateSuppressionOption.UseEquals;

            service.Subscribe<UniqueEvent>(e => count++);

            UniqueEvent nvent = new UniqueEvent { ID = Guid.NewGuid() };
            Test.WaitFor(() => false, TimeSpan.FromSeconds(.1), () => service.Publish(nvent));
            Test.WaitFor(() => count==2, TimeSpan.FromSeconds(1), () => service.Publish(nvent));

            service.UniqueCheckTimeLimit = TimeSpan.FromMinutes(1);
            Assert.True(count == 2, String.Format("UniqueEvent was not raised second time after cache expiration"));
        }

        public CombinationServiceTests()
        {
            service = new CombinationService(
                new DummyService(), new DummyService());
            service.Start();
        }
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Folia geobot. phytotax. bohemoslov. 10(3): 327 (1975)

#### Original name
Usnea tanzanica Motyka

### Remarks
null


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE LIMES SYSTEM "limes.dtd">
<LIMES>
	<PREFIX>
		<NAMESPACE>http://data.ign.fr/def/geofla#</NAMESPACE>
		geofla
	</PREFIX>
	<PREFIX>
		<NAMESPACE>http://data.ign.fr/id/geofla/</NAMESPACE>
		geoign
	</PREFIX>
	<PREFIX>
		<NAMESPACE>http://geovocab.org/geometry#</NAMESPACE>
		geom
	</PREFIX>
	<PREFIX>
     <NAMESPACE>http://www.w3.org/ns/locn#</NAMESPACE>
     locn
    </PREFIX>
	<PREFIX>
		<NAMESPACE>http://www.opengis.net/ont/geosparql#</NAMESPACE>
		geos
	</PREFIX>
	<PREFIX>
		<NAMESPACE>http://linkedgeodata.org/ontology/</NAMESPACE>
		lgdo
	</PREFIX>
	<PREFIX>
      <NAMESPACE>http://www.geonames.org/ontology#</NAMESPACE>
      gn
    </PREFIX>
	<SOURCE>
		<ID>bano2RDF</ID>
		<ENDPOINT>http://eventmedia.eurecom.fr/sparql</ENDPOINT>
		<VAR>?x</VAR>
		<PAGESIZE>5000</PAGESIZE>
		<RESTRICTION>?x a locn:Address</RESTRICTION>
		<RESTRICTION>?x locn:postalCode ?code</RESTRICTION>
		<RESTRICTION>FILTER(regex(str(?code), '750'))</RESTRICTION>
		<PROPERTY>locn:geometry/geos:asWKT RENAME polygon</PROPERTY>
		<TYPE>SPARQL</TYPE>
	</SOURCE>
	<TARGET>
		<ID>linkedgeodata</ID>
		<ENDPOINT>http://linkedgeodata.org/sparql</ENDPOINT>
		<VAR>?y</VAR>
		<PAGESIZE>5000</PAGESIZE>
		<RESTRICTION>?y a lgdo:Restaurant</RESTRICTION>
		<PROPERTY>geom:geometry/geos:asWKT RENAME polygon</PROPERTY>
		<TYPE>SPARQL</TYPE>
	</TARGET>

	<METRIC>hausdorff(x.polygon, y.polygon)</METRIC>
	<ACCEPTANCE>
		<THRESHOLD>0.97</THRESHOLD>
		<FILE>bano750xx-lgdRestaurant_verynear.nt</FILE>
		<RELATION>lgdo:near</RELATION>
	</ACCEPTANCE>
	<REVIEW>
		<THRESHOLD>0.95</THRESHOLD>
		<FILE>bano750xx-lgdRestaurant_near.nt</FILE>
		<RELATION>lgdo:near</RELATION>
	</REVIEW>
	<EXECUTION>Simple</EXECUTION>
	<OUTPUT>TAB</OUTPUT>
</LIMES>


text:
using System;
using System.Reflection;

namespace Enigma.Reflection.Emit
{
    public class ILStaticMethod
    {
        private readonly ILExpressed _il;
        private readonly MethodInfo _method;

        public ILStaticMethod(ILExpressed il, MethodInfo method)
        {
            if (!method.IsStatic)
                throw new ArgumentException("Static method is required");

            _il = il;
            _method = method;
        }

        public void Invoke(params ILCodeParameter[] parameters)
        {
            _il.Snippets.InvokeMethod(_method, parameters);
        }

        public ILCodeParameter AsParameter(params ILCodeParameter[] parameters)
        {
            return new CallMethodILCode(_method, parameters);
        }

    }
}


text:
<?php

/**
 * SpaceApprovalRequestDeclinedNotification
 *
 * @todo Move to space module
 * @package humhub.modules_core.space.notifications
 * @since 0.5
 */
class SpaceApprovalRequestDeclinedNotification extends Notification {

    public $webView = "space.views.notifications.approvalRequestDeclined";
    public $mailView = "application.modules_core.space.views.notifications.approvalRequestDeclined_mail";

    public static function fire($approverUserId, $requestor, $workspace) {

        // Send Notification to owner
        $notification = new Notification();
        $notification->class = "SpaceApprovalRequestDeclinedNotification";
        $notification->user_id = $requestor->id;
        $notification->space_id = $workspace->id;

        $notification->source_object_model = "User";
        $notification->source_object_id = $approverUserId;

        $notification->target_object_model = "Space";
        $notification->target_object_id = $workspace->id;

        $notification->save();
    }

    public function redirectToTarget() {

        $space = $this->getTargetObject();
        Yii::app()->getController()->redirect($space->getUrl());
    }

}

?>


text:
package org.apache.derby.impl.store.access.heap;

import org.apache.derby.iapi.error.StandardException;

import org.apache.derby.iapi.services.cache.ClassSize;

import org.apache.derby.iapi.services.io.ArrayInputStream;
import org.apache.derby.iapi.services.io.CompressedNumber;
import org.apache.derby.iapi.services.io.StoredFormatIds;

import org.apache.derby.iapi.services.sanity.SanityManager;

import org.apache.derby.iapi.store.raw.RecordHandle;
import org.apache.derby.iapi.store.raw.ContainerHandle;

import org.apache.derby.iapi.types.DataType;
import org.apache.derby.iapi.types.DataValueDescriptor;
import org.apache.derby.iapi.types.RowLocation;

import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.IOException;

/**
 * A heap row location represents the location of a row in the heap.
 *

 * It is implementad as a wrapper around a raw store record handle.
 *
 * @derby.formatId ACCESS_HEAP_ROW_LOCATION_V1_ID
 *
 * @derby.purpose   Object used to store the location of a row within a Heap table.
 *            One of these is stored in every row of a btree secondary index
 *            built on a heap base table.
 *
 * @derby.upgrade   The type of the btree determines the type of rowlocation stored.
 *            In current btree implementations only one type of rowlocation can
 *            be stored per tree, and it's type is stored in the format id
 *            array stored in the Conglomerate object.
 *
 * @derby.diskLayout
 *     page number(CompressedNumber.writeLong())
 *     record id(CompressedNumber.writeInt())
 **/

public class HeapRowLocation extends DataType implements RowLocation
{
	/**
	The HeapRowLocation simply maintains a raw store record handle.
	**/
    private long         pageno;
    private int          recid;
	private RecordHandle rh;

    private static final int BASE_MEMORY_USAGE = ClassSize.estimateBaseFromCatalog( HeapRowLocation.class);
    private static final int RECORD_HANDLE_MEMORY_USAGE
    = ClassSize.estimateBaseFromCatalog( org.apache.derby.impl.store.raw.data.RecordId.class);

    public int estimateMemoryUsage()
    {
        int sz = BASE_MEMORY_USAGE;

        if( null != rh)
            sz += RECORD_HANDLE_MEMORY_USAGE;
        return sz;
    } // end of estimateMemoryUsage

	public String getTypeName() {
		return "RowLocation";
	}

	public void setValueFromResultSet(java.sql.ResultSet resultSet, int colNumber,
		boolean isNullable) {
	}

	public DataValueDescriptor getNewNull() {
		return new HeapRowLocation();
	}

	public Object getObject() {
		return null;
	}

	public DataValueDescriptor cloneValue(boolean forceMaterialization) {
		return new HeapRowLocation(this);
	}

    /**
     * Recycle this HeapRowLocation object.
     *
     * @return this object reset to its initial state
     */
    public DataValueDescriptor recycle() {
        pageno = 0L;
        recid = 0;
        rh = null;
        return this;
    }

	public int getLength() {
		return 10;
	}

	public String getString() {
		return toString();
	}

	/*
	** Methods of Orderable (from RowLocation)
	**
	** see description in
	** protocol/Database/Storage/Access/Interface/Orderable.java
	**
	*/

	public boolean compare(int op,
						   DataValueDescriptor other,
						   boolean orderedNulls,
						   boolean unknownRV)
	{
		// HeapRowLocation should not be null, ignore orderedNulls
		int result = compare(other);

		switch(op)
		{
		case ORDER_OP_LESSTHAN:
			return (result < 0); // this < other
		case ORDER_OP_EQUALS:
			return (result == 0);  // this == other
		case ORDER_OP_LESSOREQUALS:
			return (result <= 0);  // this <= other
		default:

            if (SanityManager.DEBUG)
                SanityManager.THROWASSERT("Unexpected operation");
			return false;
		}
	}

	public int compare(DataValueDescriptor other)
	{
		// REVISIT: do we need this check?
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(other instanceof HeapRowLocation);

		HeapRowLocation arg = (HeapRowLocation) other;

		// XXX (nat) assumption is that these HeapRowLocations are
		// never null.  However, if they ever become null, need
		// to add null comparison logic.
        //
        // RESOLVE - change these to be state based
        /*
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(getRecordHandle() != null);
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(arg.getRecordHandle() != null);
        */

		long myPage     = this.pageno;
		long otherPage  = arg.pageno;

		if (myPage < otherPage)
			return -1;
		else if (myPage > otherPage)
			return 1;

		int myRecordId      = this.recid;
		int otherRecordId   = arg.recid;

		if (myRecordId == otherRecordId)
			return 0;
		else if (myRecordId < otherRecordId)
			return -1;
		else
			return 1;
	}

	/*
	** Methods of HeapRowLocation
	*/

	HeapRowLocation(RecordHandle rh)
	{
		setFrom(rh);
	}

	public HeapRowLocation()
	{
        this.pageno = 0;
        this.recid  = RecordHandle.INVALID_RECORD_HANDLE;
	}

	/* For cloning */
	private HeapRowLocation(HeapRowLocation other)
	{
		this.pageno = other.pageno;
		this.recid = other.recid;
		this.rh = other.rh;
	}

	public RecordHandle getRecordHandle(ContainerHandle ch)
        throws StandardException
	{
		if (rh != null)
			return rh;

		return rh = ch.makeRecordHandle(this.pageno, this.recid);
	}

	void setFrom(RecordHandle rh)
	{
        this.pageno = rh.getPageNumber();
        this.recid  = rh.getId();
		this.rh = rh;
	}

	//public void setFrom(long pageno, int recid)
	//{
    //    this.pageno = pageno;
    //    this.recid  = recid;
	//}

	/*
	 * InternalRowLocation interface
	 */

    /**
     * Return a RecordHandle built from current RowLocation.
     *

     * Build a RecordHandle from the current RowLocation.  The main client
     * of this interface is row level locking secondary indexes which read
     * the RowLocation field from a secondary index row, and then need a
     * RecordHandle built from this RowLocation.
     *

     * The interface is not as generic as one may have wanted in order to
     * store as compressed a version of a RowLocation as possible.  So
     * if an implementation of a RowLocation does not have the segmentid,
     * and containerid stored, use the input parameters instead.  If the
     * RowLocation does have the values stored use them and ignore the
     * input parameters.
     *

     * Example:
     *

     * The HeapRowLocation implementation of RowLocation generated by the
     * Heap class, only stores the page and record id.  The B2I conglomerate
     * implements a secondary index on top of a Heap class.  B2I knows the
     * segmentid and containerid of it's base table, and knows that it can
     * find an InternalRowLocation in a particular column of it's rows.  It
     * uses InternalRowLocation.getRecordHandle() to build a RecordHandle
     * from the InternalRowLocation, and uses it to set a row lock on that
     * row in the btree.
     *
	 * @return The newly allocated RecordHandle.
     *
     * @param segmentid     The segment id to store in RecordHandle.
     * @param containerid   The segment id to store in RecordHandle.
     *
	 * @exception  StandardException  Standard exception policy.
     **/
    /*public RecordHandle getRecordHandle(
    TransactionManager   tran,
    long                 segmentid,
    long                 containerid)
        throws StandardException
    {
        return(
            this.getRecordHandle(
                tran.getRawStoreXact(), segmentid, containerid));
    }
*/

	/*
	 * Storable interface, implies Externalizable, TypedFormat
	 */

	/**
		Return my format identifier.

		@see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId
	*/
	public int getTypeFormatId() {
		return StoredFormatIds.ACCESS_HEAP_ROW_LOCATION_V1_ID;
	}

    public boolean isNull()
    {
        return false;
    }

	public void writeExternal(ObjectOutput out)
        throws IOException
    {
        // Write the page number, compressed
        CompressedNumber.writeLong(out, this.pageno);

        // Write the record id
        CompressedNumber.writeInt(out, this.recid);
    }

	/**
	  @exception java.lang.ClassNotFoundException A class needed to read the
	  stored form of this object could not be found.
	  @see java.io.Externalizable#readExternal
	  */
	public void readExternal(ObjectInput in)
        throws IOException, ClassNotFoundException
    {
        this.pageno = CompressedNumber.readLong(in);

        this.recid  = CompressedNumber.readInt(in);

		rh = null;
    }
	public void readExternalFromArray(ArrayInputStream in)
        throws IOException, ClassNotFoundException
    {
        this.pageno = in.readCompressedLong();

        this.recid  = in.readCompressedInt();

		rh = null;
    }

    public void restoreToNull()
    {
		if (SanityManager.DEBUG)
			SanityManager.THROWASSERT("HeapRowLocation is never null");
    }
	protected void setFrom(DataValueDescriptor theValue)  {
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(theValue instanceof HeapRowLocation,
                    "Should only be set from another HeapRowLocation");
        HeapRowLocation that = (HeapRowLocation) theValue;
        this.pageno = that.pageno;
        this.recid = that.recid;
        this.rh = that.rh;
	}
	/*
	**		Methods of Object
	*/

	/**
		Implement value equality.

		MT - Thread safe
	*/
	public boolean equals(Object ref)
    {

		if ((ref instanceof HeapRowLocation))
        {
            HeapRowLocation other = (HeapRowLocation) ref;

            return(
                (this.pageno == other.pageno) && (this.recid == other.recid));
        }
        else
        {
			return false;
        }

	}

	/**
		Return a hashcode based on value.

		MT - thread safe
	*/
	public int hashCode()
    {
		return ((int) this.pageno) ^ this.recid;
	}

    /*
     * Standard toString() method.
     */
    public String toString()
    {
        String string =
           "(" + this.pageno + "," + this.recid + ")";
        return(string);
    }
}


text:
package org.gwtbootstrap3.client.shared.event;

import com.google.gwt.event.shared.EventHandler;

/**
 * @author Sven Jacobs
 */
public interface ModalShowHandler extends EventHandler {
    void onShow(final ModalShowEvent evt);
}


text:
AutomationBrowserTracker::AutomationBrowserTracker(
    IPC::Message::Sender* automation)
    : AutomationResourceTracker<Browser*>(automation) {
}

AutomationBrowserTracker::~AutomationBrowserTracker() {}

void AutomationBrowserTracker::AddObserver(Browser* resource) {
  registrar_.Add(this, NotificationType::BROWSER_CLOSED,
                 Source<Browser>(resource));
}

void AutomationBrowserTracker::RemoveObserver(Browser* resource) {
  registrar_.Remove(this, NotificationType::BROWSER_CLOSED,
                    Source<Browser>(resource));
}


text:
package org.red5.io.webm;

import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import org.red5.io.matroska.ConverterException;
import org.red5.io.matroska.dtd.Tag;
import org.red5.io.matroska.parser.TagCrawler;
import org.red5.io.matroska.parser.TagHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Class able to parse webm Tags from file
 *
 */
public class WebmReader implements Closeable {
	private static Logger log = LoggerFactory.getLogger(WebmReader.class);

	private FileInputStream fis = null;
	private final TagConsumer processor;
	private TagCrawler crawler;

	/**
	 * Constructor
	 *
	 * @param file - file to be read
	 * @param processor - handler for the tags found
	 * @throws FileNotFoundException - will be thrown if file not found
	 */
	public WebmReader(File file, TagConsumer processor) throws FileNotFoundException {
		fis = new FileInputStream(file);
		this.processor = processor;

		final TagHandler valueTagHandler = new TagHandler() {
			@Override
			public void handle(Tag tag, InputStream input) throws IOException, ConverterException {
				//log.debug("Tag found: " + tag.getName());
				tag.parse();
				WebmReader.this.processor.consume(tag);
			}
		};

		final TagHandler masterTagHandler = new TagHandler() {
			@Override
			public void handle(Tag tag, InputStream input) throws IOException, ConverterException {
				//log.debug("Tag found: " + tag.getName());
				WebmReader.this.processor.consume(tag);
			}
		};

		crawler = new TagCrawler() {
			@Override
			public TagHandler createSkipHandler() {
				return valueTagHandler;
			}
		};

		// we don't parse all compound tags
		crawler.addHandler("EBML", masterTagHandler);
		crawler.addHandler("CRC32", masterTagHandler);
		crawler.addHandler("Segment", masterTagHandler);
		crawler.addHandler("SeekHead", masterTagHandler);
		crawler.addHandler("Seek", masterTagHandler);
		crawler.addHandler("Info", masterTagHandler);
		crawler.addHandler("Tracks", masterTagHandler);
		crawler.addHandler("TrackEntry", masterTagHandler);
		crawler.addHandler("Video", masterTagHandler);
		crawler.addHandler("Audio", masterTagHandler);
		crawler.addHandler("ContentEncodings", masterTagHandler);
		crawler.addHandler("ContentEncoding", masterTagHandler);
		crawler.addHandler("ContentCompression", masterTagHandler);
		crawler.addHandler("ContentEncryption", masterTagHandler);
		crawler.addHandler("Cluster", masterTagHandler);
		crawler.addHandler("BlockGroup", masterTagHandler);
		crawler.addHandler("BlockAdditions", masterTagHandler);
		crawler.addHandler("BlockMore", masterTagHandler);
		crawler.addHandler("Slices", masterTagHandler);
		crawler.addHandler("TimeSlice", masterTagHandler);
		crawler.addHandler("Cues", masterTagHandler);
		crawler.addHandler("CuePoint", masterTagHandler);
		crawler.addHandler("CueTrackPositions", masterTagHandler);
		crawler.addHandler("CueReference", masterTagHandler);
		crawler.addHandler("Tags", masterTagHandler);
		crawler.addHandler("Tag", masterTagHandler);
		crawler.addHandler("Targets", masterTagHandler);
		crawler.addHandler("SimpleTag", masterTagHandler);
		crawler.addHandler("Chapters", masterTagHandler);
		crawler.addHandler("EditionEntry", masterTagHandler);
		crawler.addHandler("ChapterAtom", masterTagHandler);
		crawler.addHandler("ChapterTrack", masterTagHandler);
		crawler.addHandler("ChapterDisplay", masterTagHandler);
		crawler.addHandler("Attachments", masterTagHandler);
		crawler.addHandler("AttachedFile", masterTagHandler);
	}

	/**
	 * will process given file and send all tags found to the consumer
	 *
	 * @throws IOException - in case of any exception during reading and/or consumeng
	 * @throws ConverterException - in case of any error during conversions
	 */
	public void process() throws IOException, ConverterException {
		crawler.process(fis);
	}

	/**
	 * Will close all opened resources
	 */
	@Override
	public void close() throws IOException {
		if (fis != null) {
			try {
				fis.close();
				fis = null;
			} catch (Throwable th) {
				//no-op
			}
		}
	}
}


text:
<refentry xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          version="5.0" xml:id="glossary.collection">
<refmeta>
<refentrytitle>glossary.collection</refentrytitle>
<refmiscinfo class="other" otherclass="datatype">string</refmiscinfo>
</refmeta>
<refnamediv>
<refname>glossary.collection</refname>
<refpurpose>Name of the glossary collection file</refpurpose>
</refnamediv>

<refsynopsisdiv>
<src:fragment xml:id="glossary.collection.frag">
<xsl:param name="glossary.collection">https://cdn.docbook.org/resources/latest/xml/glossary.xml</xsl:param>
</src:fragment>
</refsynopsisdiv>

<refsection><info><title>Description</title></info>

<para>Glossaries maintained independently across a set of documents
are likely to become inconsistent unless considerable effort is
expended to keep them in sync. It makes much more sense, usually, to
store all of the glossary entries in a single place and simply
<quote>extract</quote> the ones you need in each document.</para>

<para>That's the purpose of the
<parameter>glossary.collection</parameter> parameter. To setup a global
glossary <quote>database</quote>, follow these steps:</para>

<refsection><info><title>Setting Up the Glossary Database</title></info>

<para>First, create a stand-alone glossary document that contains all of
the entries that you wish to reference. Make sure that each glossary
entry has an ID.</para>

<para>Here's an example glossary:</para>

<informalexample>
<programlisting>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE glossary
  PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<glossary>
<glossaryinfo>
<editor><firstname>Eric</firstname><surname>Raymond</surname></editor>
<title>Jargon File 4.2.3 (abridged)</title>
<releaseinfo>Just some test data</releaseinfo>
</glossaryinfo>

<glossdiv><title>0</title>

<glossentry>
<glossterm>0</glossterm>
<glossdef>
<para>Numeric zero, as opposed to the letter `O' (the 15th letter of
the English alphabet). In their unmodified forms they look a lot
alike, and various kluges invented to make them visually distinct have
compounded the confusion. If your zero is center-dotted and letter-O
is not, or if letter-O looks almost rectangular but zero looks more
like an American football stood on end (or the reverse), you're
probably looking at a modern character display (though the dotted zero
seems to have originated as an option on IBM 3270 controllers). If
your zero is slashed but letter-O is not, you're probably looking at
an old-style ASCII graphic set descended from the default typewheel on
the venerable ASR-33 Teletype (Scandinavians, for whom /O is a letter,
curse this arrangement). (Interestingly, the slashed zero long
predates computers; Florian Cajori's monumental "A History of
Mathematical Notations" notes that it was used in the twelfth and
thirteenth centuries.) If letter-O has a slash across it and the zero
does not, your display is tuned for a very old convention used at IBM
and a few other early mainframe makers (Scandinavians curse <emphasis>this</emphasis>
arrangement even more, because it means two of their letters collide).
Some Burroughs/Unisys equipment displays a zero with a <emphasis>reversed</emphasis>
slash. Old CDC computers rendered letter O as an unbroken oval and 0
as an oval broken at upper right and lower left. And yet another
convention common on early line printers left zero unornamented but
added a tail or hook to the letter-O so that it resembled an inverted
Q or cursive capital letter-O (this was endorsed by a draft ANSI
standard for how to draw ASCII characters, but the final standard
changed the distinguisher to a tick-mark in the upper-left corner).
Are we sufficiently confused yet?</para>
</glossdef>
</glossentry>

<glossentry>
<glossterm>1TBS</glossterm>
<glossdef>
<para role="accidence">
<phrase role="pronounce"></phrase>
<phrase role="partsofspeach">n</phrase>
</para>
<para>The "One True Brace Style"</para>
<glossseealso>indent style</glossseealso>
</glossdef>
</glossentry>

<!-- ... -->

</glossdiv>

<!-- ... -->

</glossary></programlisting>
</informalexample>

</refsection>

<refsection><info><title>Marking Up Glossary Terms</title></info>

<para>That takes care of the glossary database, now you have to get the entries
into your document. Unlike bibliography entries, which can be empty, creating
<quote>placeholder</quote> glossary entries would be very tedious. So instead,
support for <parameter>glossary.collection</parameter> relies on implicit linking.</para>

<para>In your source document, simply use <tag>firstterm</tag> and
<tag>glossterm</tag> to identify the terms you wish to have included
in the glossary. The stylesheets assume that you will either set the
<tag class="attribute">baseform</tag> attribute correctly, or that the
content of the element exactly matches a term in your glossary.</para>

<para>If you're using a <parameter>glossary.collection</parameter>, don't
make explicit links on the terms in your document.</para>

<para>So, in your document, you might write things like this:</para>

<informalexample>
<programlisting><para>This is dummy text, without any real meaning.
The point is simply to reference glossary terms like <glossterm>0</glossterm>
and the <firstterm baseform="1TBS">One True Brace Style (1TBS)</firstterm>.
The <glossterm>1TBS</glossterm>, as you can probably imagine, is a nearly
religious issue.</para></programlisting>
</informalexample>

<para>If you set the <parameter>firstterm.only.link</parameter> parameter,
only the terms marked with <tag>firstterm</tag> will be links.
Otherwise, all the terms will be linked.</para>

</refsection>

<refsection><info><title>Marking Up the Glossary</title></info>

<para>The glossary itself has to be identified for the stylesheets. For lack
of a better choice, the <tag class="attribute">role</tag> is used.
To identify the glossary as the target for automatic processing, set
the role to <quote><literal>auto</literal></quote>. The title of this
glossary (and any other information from the <tag>glossaryinfo</tag>
that's rendered by your stylesheet) will be displayed, but the entries will
come from the database.
</para>

<para>Unfortunately, the glossary can't be empty, so you must put in
at least one <tag>glossentry</tag>. The content of this entry
is irrelevant, it will not be rendered:</para>

<informalexample>
<programlisting><glossary role="auto">
<glossentry>
<glossterm>Irrelevant</glossterm>
<glossdef>
<para>If you can see this, the document was processed incorrectly. Use
the <parameter>glossary.collection</parameter> parameter.</para>
</glossdef>
</glossentry>
</glossary></programlisting>
</informalexample>

<para>What about glossary divisions? If your glossary database has glossary
divisions <emphasis>and</emphasis> your automatic glossary contains at least
one <tag>glossdiv</tag>, the automic glossary will have divisions.
If the <tag>glossdiv</tag> is missing from either location, no divisions
will be rendered.</para>

<para>Glossary entries (and divisions, if appropriate) in the glossary will
occur in precisely the order they occur in your database.</para>

</refsection>

<refsection><info><title>Formatting the Document</title></info>

<para>Finally, when you are ready to format your document, simply set the
<parameter>glossary.collection</parameter> parameter (in either a
customization layer or directly through your processor's interface) to
point to your global glossary.</para>

<para>A relative path in the parameter is interpreted in one
of two ways:</para>
<orderedlist numeration="loweralpha">
  <listitem>
    <para>If the parameter <literal>glossterm.auto.link</literal>
    is set to zero, then the path is relative to the file containing
    the empty <tag>glossary</tag> element in the document.</para>
  </listitem>
  <listitem>
    <para>If the parameter <literal>glossterm.auto.link</literal>
    is set to non-zero, then the path is relative to the file containing
    the first inline <tag>glossterm</tag> or
    <tag>firstterm</tag> in the document to be linked.</para>
  </listitem>
</orderedlist>
<para>Once the collection file is opened by the first instance described
above, it stays open for the current document
and the relative path is not reinterpreted again.</para>

<para>The stylesheets will format the glossary in your document as if
all of the entries implicilty referenced appeared there literally.</para>
</refsection>

<refsection><info><title>Limitations</title></info>

<para>Glossary cross-references <emphasis>within the glossary</emphasis> are
not supported. For example, this <emphasis>will not</emphasis> work:</para>

<informalexample>
<programlisting><glossentry>
<glossterm>gloss-1</glossterm>
<glossdef><para>A description that references <glossterm>gloss-2</glossterm>.</para>
<glossseealso>gloss-2</glossseealso>
</glossdef>
</glossentry></programlisting>
</informalexample>

<para>If you put glossary cross-references in your glossary that way,
you'll get the cryptic error: <computeroutput>Warning:
glossary.collection specified, but there are 0 automatic
glossaries</computeroutput>.</para>

<para>Instead, you must do two things:</para>

<orderedlist>
<listitem>
<para>Markup your glossary using <tag>glossseealso</tag>:</para>

<informalexample>
<programlisting><glossentry>
<glossterm>gloss-1</glossterm>
<glossdef><para>A description that references <glossterm>gloss-2</glossterm>.</para>
<glossseealso>gloss-2</glossseealso>
</glossdef>
</glossentry></programlisting>
</informalexample>
</listitem>

<listitem>
<para>Make sure there is at least one <tag>glossterm</tag> reference to
<glossterm>gloss-2</glossterm> <emphasis>in your document</emphasis>. The
easiest way to do that is probably within a <tag>remark</tag> in your
automatic glossary:</para>

<informalexample>
<programlisting><glossary role="auto">
<remark>Make sure there's a reference to <glossterm>gloss-2</glossterm>.</remark>
<glossentry>
<glossterm>Irrelevant</glossterm>
<glossdef>
<para>If you can see this, the document was processed incorrectly. Use
the <parameter>glossary.collection</parameter> parameter.</para>
</glossdef>
</glossentry>
</glossary></programlisting>
</informalexample>
</listitem>
</orderedlist>
</refsection>

</refsection>
</refentry>


text:
package ml.alternet.parser.step6;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import ml.alternet.parser.ast.Expression;

/**
 * The user data model is a tree of expressions.
 *
 * @author Philippe Poulard
 */
public interface StringExpression extends Expression<String, Map<String,Number>> {

    /**
     * A calc expression embeds a numeric expression.
     *
     * @see Calc
     * @see NumericExpression
     *
     * @author Philippe Poulard
     */
    class CalcExpression implements StringExpression {

        NumericExpression expression;

        public CalcExpression(NumericExpression expression) {
            this.expression = expression;
        }

        @Override
        public String eval(Map<String, Number> context) {
            Number n = this.expression.eval(context);
            // remove trailing .0
            if (n.longValue() == n.doubleValue()) {
                return "" + n.longValue();
            } else {
                return "" + n;
            }
        }

        @Override
        public String toString() {
            return '{' + expression.toString() + '}';
        }

    }

    class TextExpression implements StringExpression {

        String text;

        public TextExpression(String text) {
            this.text = text;
        }

        @Override
        public String eval(Map<String, Number> context) {
            return this.text;
        }

    }

    class ValueTemplateExpression implements StringExpression {

        List<StringExpression> expressions;

        public ValueTemplateExpression(List<StringExpression> expressions) {
            this.expressions = expressions;
        }

        @Override
        public String eval(Map<String, Number> context) {
            return this.expressions.stream()
                .map(e -> e.eval(context))
                .collect(Collectors.joining());
        }

    }

}


text:
using UnityEngine;
using System.Collections;

namespace BehaviorDesigner.Runtime
{
    [System.Serializable]
    public class SharedQuaternion : SharedVariable<Quaternion>
    {
        public override string ToString() { return mValue.ToString(); }
        public static implicit operator SharedQuaternion(Quaternion value) { return new SharedQuaternion { mValue = value }; }
    }
}


text:
'''
from string import maketrans   # Required to call maketrans function.

intab = "aeiou"
outtab = "12345"
trantab = maketrans(intab, outtab)

str = "this is string example....wow!!!";
print str.translate(trantab);
'''


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core"
	xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:wsa="http://cxf.apache.org/ws/addressing" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:pol="http://cxf.apache.org/policy" xmlns:condbean="http://dnetlib.eu/springbeans/condbean"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://dnetlib.eu/springbeans/condbean http://dnetlib.eu/springbeans/condbean.xsd">

<!-- CXF bus with logging. Please set the log level of org.apache.cxf.interceptor to FATAL to hide the logging of EVERY incoming and outgoing messages. -->
	<cxf:bus>
		<cxf:outInterceptors>
			<ref bean="outCxfLoggingInterceptor" />
		</cxf:outInterceptors>
		<cxf:inInterceptors>
			<ref bean="inCxfLoggingInterceptor" />
		</cxf:inInterceptors>
	</cxf:bus>

	<bean id="outCxfLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
	<bean id="inCxfLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" />

	<!-- <cxf:bus> -->
		<!--		<cxf:inInterceptors>-->
		<!--
			<bean id="logInbound"
			class="org.apache.cxf.interceptor.LoggingInInterceptor" />
		-->
		<!--
			<bean id="logOutbound"
			class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
		-->
		<!--			</condbean:cond>-->
		<!--		</cxf:inInterceptors>-->

<!-- 		<cxf:features> -->
<!--			 <wsa:addressing />-->

<!--			<cxf:logging />-->

			<!--  <pol:policies ignoreUnknownAssertions="true"/> -->
<!-- 		</cxf:features> -->
<!-- 	</cxf:bus> -->

	<http:conduit name="*.http-conduit">
		<http:client AllowChunking="true" Connection="Keep-Alive" />
	</http:conduit>
</beans>


text:
int P23::MetaTrader4::Manager::ClrWrapper::SymbolChange(P23::MetaTrader4::Manager::Contracts::SymbolProperties^ symbolProperties)
{
	return _manager->Manager->SymbolChange(Convert(symbolProperties));
}


text:
package org.neo4j.ogm.persistence.session.events;

import static org.assertj.core.api.Assertions.*;

import java.util.Date;
import java.util.Random;

import org.junit.Test;
import org.neo4j.ogm.domain.cineasts.annotated.Knows;
import org.neo4j.ogm.session.event.Event;
import org.neo4j.ogm.session.event.PostSaveEvent;
import org.neo4j.ogm.session.event.PreSaveEvent;

/**
 * @author vince
 */
public class RelationshipEntityTest extends EventTestBaseClass {

    @Test
    public void shouldNotFireEventsIfObjectHasNotChanged() {

        session.save(folder);
        assertThat(eventListener.count()).isEqualTo(0);
    }

    @Test
    public void shouldFireEventsWhenUpdatingRelationshipEntity() {

        Random r = new Random();
        knowsJL.setSince((new Date((long) (1293861599 + r.nextDouble() * 60 * 60 * 24 * 365))));

        session.save(knowsJL);

        assertThat(eventListener.captured(knowsJL, Event.TYPE.PRE_SAVE)).isTrue();
        assertThat(eventListener.captured(knowsJL, Event.TYPE.POST_SAVE)).isTrue();

        assertThat(eventListener.count()).isEqualTo(2);
    }

    @Test
    public void shouldFireEventsWhenDeletingRelationshipEntity() {

        session.delete(knowsJL);

        assertThat(eventListener.captured(knowsJL, Event.TYPE.PRE_DELETE)).isTrue();
        assertThat(eventListener.captured(knowsJL, Event.TYPE.POST_DELETE)).isTrue();

        assertThat(eventListener.captured(jim, Event.TYPE.PRE_SAVE)).isTrue();
        assertThat(eventListener.captured(jim, Event.TYPE.POST_SAVE)).isTrue();

        assertThat(eventListener.captured(lee, Event.TYPE.PRE_SAVE)).isTrue();
        assertThat(eventListener.captured(lee, Event.TYPE.POST_SAVE)).isTrue();

        assertThat(eventListener.count()).isEqualTo(6);
    }

    @Test
    public void shouldFireEventsWhenCreatingRelationshipEntity() {

        Knows knowsBS = new Knows();

        knowsBS.setFirstActor(bruce);
        knowsBS.setSecondActor(stan);

        bruce.getKnows().add(knowsBS);

        session.save(bruce);

        assertThat(eventListener.captured(knowsBS, Event.TYPE.PRE_SAVE)).isTrue();
        assertThat(((PreSaveEvent) eventListener.get(knowsBS, Event.TYPE.PRE_SAVE)).isNew()).isTrue();
        assertThat(eventListener.captured(knowsBS, Event.TYPE.POST_SAVE)).isTrue();
        assertThat(((PostSaveEvent) eventListener.get(knowsBS, Event.TYPE.POST_SAVE)).wasNew()).isTrue();
        assertThat(eventListener.captured(bruce, Event.TYPE.PRE_SAVE)).isTrue();
        assertThat(((PreSaveEvent) eventListener.get(bruce, Event.TYPE.PRE_SAVE)).isNew()).isFalse();
        assertThat(eventListener.captured(bruce, Event.TYPE.POST_SAVE)).isTrue();
        assertThat(((PostSaveEvent) eventListener.get(bruce, Event.TYPE.POST_SAVE)).wasNew()).isFalse();
        assertThat(eventListener.captured(stan, Event.TYPE.PRE_SAVE)).isTrue();
        assertThat(((PreSaveEvent) eventListener.get(stan, Event.TYPE.PRE_SAVE)).isNew()).isFalse();
        assertThat(eventListener.captured(stan, Event.TYPE.POST_SAVE)).isTrue();
        assertThat(((PostSaveEvent) eventListener.get(stan, Event.TYPE.POST_SAVE)).wasNew()).isFalse();

        assertThat(eventListener.count()).isEqualTo(6);
    }
}


text:
import org.opencv.core.*;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

import javax.swing.*;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;

class MatMaskOperationsRun {

    public void run() {

    //! [laod_image]
        Mat I = Imgcodecs.imread("../data/lena.jpg");
        if(I.empty())
            System.out.println("Error opening image");
    //! [laod_image]

        Image img = toBufferedImage( I );
        displayImage("Input Image" , img, 0, 200 );

        double t = System.currentTimeMillis();

        Mat J = sharpen(I, new Mat());

        t = ((double)System.currentTimeMillis() - t)/1000;
        System.out.println("Hand written function times passed in seconds: " + t);

        Image img2 = toBufferedImage( J );
        displayImage("Output Image" , img2, 400, 400 );

        Mat K = new Mat();
    //![kern]
        Mat kern = new Mat( 3, 3, CvType.CV_8S );
        int row = 0, col = 0;
        kern.put(row ,col, 0, -1, 0, -1, 5, -1, 0, -1, 0 );
    //![kern]

        System.out.println("kern = \n" + kern.dump());

        t = System.currentTimeMillis();

    //![filter2D]
        Imgproc.filter2D(I, K, I.depth(), kern );
    //![filter2D]

        t = ((double)System.currentTimeMillis() - t)/1000;
        System.out.println("Built-in filter2D time passed in seconds:      " + t);

        Image img3 = toBufferedImage( J );
        displayImage("filter2D Output Image" , img3, 800, 400 );
    }

    //! [basic_method]
    public static double saturateCastUchar(double x) {
        return x > 255.0 ? 255.0 : (x < 0.0 ? 0.0 : x);
    }

    public Mat sharpen(Mat myImage, Mat Result)
    {
      //! [8_bit]
        myImage.convertTo(myImage, CvType.CV_8U);
      //! [8_bit]

      //! [create_channels]
        int nChannels = myImage.channels();
        Result.create(myImage.size(),myImage.type());
      //! [create_channels]

      //! [basic_method_loop]
        for(int j = 1 ; j < myImage.rows()-1; ++j)
        {
            for(int i = 1 ; i < myImage.cols()-1; ++i)
            {
                double sum[] = new double[nChannels];

                for(int k = 0; k < nChannels; ++k) {

                    double top = -myImage.get(j - 1, i)[k];
                    double bottom = -myImage.get(j + 1, i)[k];
                    double center = (5 * myImage.get(j, i)[k]);
                    double left = -myImage.get(j , i - 1)[k];
                    double right = -myImage.get(j , i + 1)[k];

                    sum[k] = saturateCastUchar(top + bottom + center + left + right);
                }

                Result.put(j, i, sum);
            }
        }
      //! [basic_method_loop]

      //! [borders]
        Result.row(0).setTo(new Scalar(0));
        Result.row(Result.rows()-1).setTo(new Scalar(0));
        Result.col(0).setTo(new Scalar(0));
        Result.col(Result.cols()-1).setTo(new Scalar(0));
      //! [borders]

        return Result;
    }
    //! [basic_method]

    public Image toBufferedImage(Mat m) {
        int type = BufferedImage.TYPE_BYTE_GRAY;
        if ( m.channels() > 1 ) {
            type = BufferedImage.TYPE_3BYTE_BGR;
        }
        int bufferSize = m.channels()*m.cols()*m.rows();
        byte [] b = new byte[bufferSize];
        m.get(0,0,b); // get all the pixels
        BufferedImage image = new BufferedImage(m.cols(),m.rows(), type);
        final byte[] targetPixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
        System.arraycopy(b, 0, targetPixels, 0, b.length);
        return image;
    }

    public void displayImage(String title, Image img, int x, int y)
    {
        ImageIcon icon=new ImageIcon(img);
        JFrame frame=new JFrame(title);
        JLabel lbl=new JLabel(icon);
        frame.add(lbl);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocation(x, y);
        frame.setVisible(true);
    }
}

public class MatMaskOperations {
    public static void main(String[] args) {

        // Load the native library.
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        new MatMaskOperationsRun().run();
    }
}


text:
@implementation CBCTVEditorViewController

@synthesize delegate = _delegate;

- (void) openEditorForCell:(CBCell*)cell
			  inController:(CBConfigurableTableViewController*)controller {
	_cell = cell;
	_controller = controller;
}

@end


text:
shared_examples 'requires authorization' do
  let(:user) {create :user}
  before do
    sign_out admin_user
    sign_in user
    action
  end

  it 'redirects to root path' do
    expect(response).to redirect_to root_path
  end

  it 'sets flash[:alert]' do
    expect(flash[:alert]).to_not be_nil
  end
end


text:
<?php

use Eloquent\Phony\Test\Phony;

// setup
$stub = Phony::stub(
    function ($animal) {
        throw new RuntimeException(strtoupper($animal));
    }
)->setLabel('label')->forwards();
try {
    $stub('aardvark');
} catch (RuntimeException $e) {
}
try {
    $stub('bonobo');
} catch (RuntimeException $e) {
}

// verification
$stub->times(3)->threw();


text:
// Type definitions for js-combinatorics v0.5.4
// Project: https://github.com/dankogai/js-combinatorics
// Definitions by: Vasya Aksyonov <https://github.com/outring>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace __Combinatorics {

    interface IGenerator<T> {

        /**
         * Returns the element or undefined if no more elements are available.
         */
        next():T;

        /**
         * Applies the callback function for each element.
         */
        forEach(f:(item:T) => void):void;

        /**
         * Returns an array that is the output of calling the callback function separately on each element.
         */
        map<TResult>(f:(item:T) => TResult):TResult[];

        /**
         * Returns an array of elements that return `true` for the filter function.
         */
        filter(predicate:(item:T) => boolean):T[];

        /**
         * Returns an array of all elements.
         */
        toArray():T[];

        /**
         * Returns the total number of elements to be generated. This equals the result of calling
     * `generator.toArray().length` but it is precalculated without actually generating any elements.
         * Handy when doing setup for a potentially long-running loop.
         */
        length:number;

    }

    interface IPredictableGenerator<T> extends IGenerator<T> {

        /**
         * Returns the nth element (indexed from 0).
         */
        nth(n:number):T;

    }

    interface ICartesianProductGenerator<T> extends IPredictableGenerator<T> {

        /**
         * Arguments are integer coordinates.
         * Arguments can be out of bounds but it returns `undefined` in such cases.
         */
        get(...coordinates:number[]):T;
    }

    /**
     * Calculates m P n
     */
    function P(m:number, n:number):number;

    /**
     * Calculates m C n
     */
    function C(m:number, n:number):number;

    /**
     * Calculates n!
     */
    function factorial(n:number):number;

    /**
     * Returns the factoradic representation of `n` in an array, in
   * least significant order.
     * See http://en.wikipedia.org/wiki/Factorial_number_system
     */
    function factoradic(n:number):number[];

    /**
     * Generates the power set of `a`.
     */
    function power<T>(a:T[]):IPredictableGenerator<T[]>;

    /**
     * Generates the combination of `a` with `n` elements.
     * `n` defaults to the length of `a`.
     */
    function combination<T>(a:T[], n?:number):IGenerator<T[]>;

    /**
     * Generates the combination of `a` with `n` elements, which
     * also supports larger sets of elements.
     * When `n` is ommited, the length of the array is used.
     * Somewhat slower than `combination()`
     */
    function bigCombination<T>(a:T[], n?:number):IGenerator<T[]>;

    /**
     * Generates the permutation of `a` with `n` elements.
     * `n` defaults to the length of `a`.
     */
    function permutation<T>(a:T[], n?:number):IGenerator<T[]>;

    /**
     * Generates the permutation of the combination of `a`.
     * Equivalent to `permutation(combination(a))`, but more efficient.
     */
    function permutationCombination<T>(a:T[]):IGenerator<T[]>;

    /**
     * Generates `n`-digit "numbers" where each digit is an element in array.
     * Note this "number" is in the least significant order.
     * `n` defaults to the length of `a`.
     */
    function baseN<T>(a:T[], n?:number):IPredictableGenerator<T[]>;

    /**
     * Generates the cartesian product of the arrays. All arguments must be arrays with more than one element.
     */
    function cartesianProduct<T1>(a1:T1[]):ICartesianProductGenerator<[T1]>;
    function cartesianProduct<T1, T2>(a1:T1[], a2:T2[]):ICartesianProductGenerator<[T1, T2]>;
    function cartesianProduct<T1, T2, T3>(a1:T1[], a2:T2[], a3:T3[]):ICartesianProductGenerator<[T1, T2, T3]>;
    function cartesianProduct<T1, T2, T3, T4>(a1:T1[], a2:T2[], a3:T3[], a4:T4[]):ICartesianProductGenerator<[T1, T2, T3, T4]>;
    function cartesianProduct<T1, T2, T3, T4, T5>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5]>;
    function cartesianProduct<T1, T2, T3, T4, T5, T6>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6]>;
    function cartesianProduct<T1, T2, T3, T4, T5, T6, T7>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7]>;
    function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8]>;
    function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8, T9>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
    function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[], a10:T10[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
    function cartesianProduct(...a:any[][]):ICartesianProductGenerator<any[]>;

    const VERSION:string;

}

export = __Combinatorics;
export as namespace Combinatorics;


text:
/**
 * The command line interface for interacting with the Protractor runner.
 * It takes care of parsing command line options.
 *
 * Values from command line options override values from the config.
 */
'use strict';

var util = require('util');
var path = require('path');
var child = require('child_process');
var argv = require('optimist').
    usage('Usage: protractor [options] [configFile]\n' +
        'The [options] object will override values from the config file.\n' +
        'See the reference config for a full list of options.').
    describe('help', 'Print Protractor help menu').
    describe('version', 'Print Protractor version').
    describe('browser', 'Browsername, e.g. chrome or firefox').
    describe('seleniumAddress', 'A running seleium address to use').
    describe('seleniumServerJar', 'Location of the standalone selenium jar file').
    describe('seleniumPort', 'Optional port for the selenium standalone server').
    describe('baseUrl', 'URL to prepend to all relative paths').
    describe('rootElement', 'Element housing ng-app, if not html or body').
    describe('specs', 'Comma-separated list of files to test').
    describe('exclude', 'Comma-separated list of files to exclude').
    describe('verbose', 'Print full spec names').
    describe('stackTrace', 'Print stack trace on error').
    describe('params', 'Param object to be passed to the tests').
    describe('framework', 'Test framework to use. jasmine or mocha.').
    alias('browser', 'capabilities.browserName').
    alias('name', 'capabilities.name').
    alias('platform', 'capabilities.platform').
    alias('platform-version', 'capabilities.version').
    alias('tags', 'capabilities.tags').
    alias('build', 'capabilities.build').
    alias('verbose', 'jasmineNodeOpts.isVerbose').
    alias('stackTrace', 'jasmineNodeOpts.includeStackTrace').
    string('capabilities.tunnel-identifier').
    check(function(arg) {
      if (arg._.length > 1) {
        throw 'Error: more than one config file specified';
      }
      if (process.argv.length < 3 || arg.help) {
        throw '';
      }
    }).
    argv;

if (argv.version) {
  util.puts('Version ' + require(path.join(__dirname, '../package.json')).version);
  process.exit(0);
}

// WebDriver capabilities properties require dot notation, but optimist parses
// that into an object. Re-flatten it.
var flattenObject = function(obj) {
  var prefix = arguments[1] || '';
  var out = arguments[2] || {};
    for (var prop in obj) {
      if (obj.hasOwnProperty(prop)) {
        typeof obj[prop] === 'object' ?
            flattenObject(obj[prop], prefix + prop + '.', out) :
            out[prefix + prop] = obj[prop];
      }
    }
  return out;
};

if (argv.capabilities) {
  argv.capabilities = flattenObject(argv.capabilities);
}

/**
 * Helper to resolve comma separated lists of file pattern strings relative to
 * the cwd.
 *
 * @private
 * @param {Array} list
 */
var processFilePatterns_ = function(list) {
  var patterns = list.split(',');
  patterns.forEach(function(spec, index, arr) {
    arr[index] = path.resolve(process.cwd(), spec);
  });
  return patterns;
};

if (argv.specs) {
  argv.specs = processFilePatterns_(argv.specs);
}
if (argv.excludes) {
  argv.excludes = processFilePatterns_(argv.excludes);
}

// Run the launcher
require('./launcher').init(argv);


text:
"use strict";

exports.mobile_deactivate_section = function () {
    const $settings_overlay_container = $("#settings_overlay_container");
    $settings_overlay_container.find(".right").removeClass("show");
    $settings_overlay_container.find(".settings-header.mobile").removeClass("slide-left");
};

function two_column_mode() {
    return $("#settings_overlay_container").css("--single-column") === undefined;
}

class SettingsPanelMenu {
    constructor(opts) {
        this.main_elem = opts.main_elem;
        this.hash_prefix = opts.hash_prefix;
        this.curr_li = this.main_elem.children("li").eq(0);

        this.main_elem.on("click", "li[data-section]", (e) => {
            const section = $(e.currentTarget).attr("data-section");

            this.activate_section_or_default(section);

            // You generally want to add logic to activate_section,
            // not to this click handler.

            e.stopPropagation();
        });
    }

    show() {
        this.main_elem.show();
        const section = this.current_tab();
        if (two_column_mode()) {
            // In one column mode want to show the settings list, not the first settings section.
            this.activate_section_or_default(section);
        }
        this.curr_li.trigger("focus");
    }

    hide() {
        this.main_elem.hide();
    }

    current_tab() {
        return this.curr_li.data("section");
    }

    li_for_section(section) {
        const li = $("#settings_overlay_container li[data-section='" + section + "']");
        return li;
    }

    set_key_handlers(toggler) {
        keydown_util.handle({
            elem: this.main_elem,
            handlers: {
                left_arrow: toggler.maybe_go_left,
                right_arrow: toggler.maybe_go_right,
                enter_key: () => this.enter_panel(),
                up_arrow: () => this.prev(),
                down_arrow: () => this.next(),
            },
        });
    }

    prev() {
        this.curr_li.prevAll(":visible:first").trigger("focus").trigger("click");
        return true;
    }

    next() {
        this.curr_li.nextAll(":visible:first").trigger("focus").trigger("click");
        return true;
    }

    enter_panel() {
        const panel = this.get_panel();
        const sel = "input:visible,button:visible,select:visible";
        const panel_elem = panel.find(sel).first();

        panel_elem.trigger("focus");
        return true;
    }

    activate_section_or_default(section) {
        popovers.hide_all();
        if (!section) {
            // No section is given so we display the default.

            if (two_column_mode()) {
                // In two column mode we resume to the last active section.
                section = this.current_tab();
            } else {
                // In single column mode we close the active section
                // so that you always start at the settings list.
                exports.mobile_deactivate_section();
                return;
            }
        }

        this.curr_li = this.li_for_section(section);

        this.main_elem.children("li").removeClass("active");
        this.curr_li.addClass("active");

        const settings_section_hash = "#" + this.hash_prefix + section;
        hashchange.update_browser_history(settings_section_hash);

        $(".settings-section").removeClass("show");

        settings_sections.load_settings_section(section);

        this.get_panel().addClass("show");

        ui.reset_scrollbar($("#settings_content"));

        const $settings_overlay_container = $("#settings_overlay_container");
        $settings_overlay_container.find(".right").addClass("show");
        $settings_overlay_container.find(".settings-header.mobile").addClass("slide-left");

        settings.set_settings_header(section);
    }

    get_panel() {
        const section = this.curr_li.data("section");
        const sel = "[data-name='" + section + "']";
        const panel = $(".settings-section" + sel);
        return panel;
    }
}
exports.SettingsPanelMenu = SettingsPanelMenu;

exports.initialize = function () {
    exports.normal_settings = new SettingsPanelMenu({
        main_elem: $(".normal-settings-list"),
        hash_prefix: "settings/",
    });
    exports.org_settings = new SettingsPanelMenu({
        main_elem: $(".org-settings-list"),
        hash_prefix: "organization/",
    });
};

exports.show_normal_settings = function () {
    exports.org_settings.hide();
    exports.normal_settings.show();
};

exports.show_org_settings = function () {
    exports.normal_settings.hide();
    exports.org_settings.show();
};

exports.set_key_handlers = function (toggler) {
    exports.normal_settings.set_key_handlers(toggler);
    exports.org_settings.set_key_handlers(toggler);
};

window.settings_panel_menu = exports;


text:
date: 2017-08-07 00:00:00
modified: 2017-08-07 00:00:00
title: Setting up a Windows VM lab for kernel debugging
tags: windows,kernel,debug,virtualbox
author: hugsy
cover: assets/images/win-kernel-debug/win8-setup-kernel-mode.png
category: tutorial

This is the first on a series of posts on Windows kernel debugging and
exploitation.

In this part, we'll cover in details how to get everything setup using Linux as
host, VirtualBox as hypervisor and Windows virtual images from [Modern.IE](http://modern.ie).

__*Note*__: there is nothing ground-breaking here, those posts are mostly notes and
reminders for the future. [Other people](https://hshrzd.wordpress.com/2017/05/28/starting-with-windows-kernel-exploitation-part-1-setting-up-the-lab/) did a fantastic job covering the same
topic, so you might probably be more interested into reading those 😁

I like working on a Linux host, so using [VirtualKD](https://virtualkd.sysprogs.org)
isn't an option. So my setup is:

  - Debian testing x64 as host
  - [VirtualBox](https://www.virtualbox.org) as hypervisor
  - A
  [Windows 7 x64 VM](https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/) acting
  as debugger.
  - And 2 debuggees:
    1. Windows 7 x86 VM (using UART as debugging medium)
    2. Windows 8.1 x64 VM (using Network as debugging medium)

As a comodity, I've created a
[`Vagrantfile`](https://github.com/hugsy/modern.ie-vagrant) to simplify the VM
creation process using [`Vagrant`](https://vagrantup.com). You can create a new
Windows VM like this

```bash
$ git clone https://github.com/hugsy/modern.ie-vagrant Windows7
$ cd Windows7
$ FIRSTBOOT=1 vagrant up --provision
```

and go grab a coffee ☕

## Preparing the Debugger VM

Once the VM is created and Windows properly installed, edit the VM settings in
VirtualBox to do the following:

  * In the "Serial Ports" tab, enable one port. You can use any "Port Number"
    you want, just remember it, as you'll need to specify it to WinDBG the
    Win7 debuggee is ready. Select `Host Pipe` as "Port Mode" and enter a local
    path in the "Path/Address" field (for example `/tmp/win7-kd-pipe`). This
    pipe will be the relay VirtualBox will use to communicate between the
    debugger and debuggee through UART. Last, make sure the "Connect to existing
    pipe/socket" is **unchecked**.

![image_alt](/assets/images/win-kernel-debug/dbg-uart-settings.png)

  * in the "Network" tab, on top of the the default NAT-ed network created by
    VirtualBox, add and enable another adapter as Host-Only. Then link it to an
    existing interface on the host (for example `vboxnet0`).

![image_alt](/assets/images/win-kernel-debug/dbg-network-settings.png)

Now the debugger is ready, you need to install WinDBG as the kernel debugger. A
quick way, is to use [`Chocolatey`](https://chocolatey.org/) in an administrator prompt to install it
as such:

```
C:\> @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
<chocolatey is being installed...>
C:\> choco install -y --force windbg
```

Although this won't install the very latest WinDBG, this approach is convenient
to going through downloading and installing the SDK from MS
website. Additionally, you can script it to install more tools useful for
later (`python`, `ConEmu`, `HxD` etc.)

## Setup UART debugging on the Windows 7 target

**Note**: All is described
[here](https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/boot-parameters-to-enable-debugging).

All OS can be kernel-debugged via Serial Port (or UART). Although this method is
universal, it is also the slowest.

To enable it, start the Windows 7 debuggee VM, open a `cmd.exe` as
Administrator, and add another entry to the boot loader
using `bcdedit` utility:

```
C:\> bcdedit /copy {current} /d "Windows 7 with kernel debug via COM"
```

Then enable debug mode on new entry UUID:
```
C:\> bcdedit /debug {UUID-RETURNED-BY-FORMER-COMMAND} on
```

![image_alt](/assets/images/win-kernel-debug/win7-bcdedit-enable-debug.png)

Now instruct Windows serial communication as debugging medium, and use the
"fastest" baudrate (i.e 115200 symbols/sec). Since we'll only use serial
debugging for this VM, we can use the `bcdedit /dbgsettings` global switch.

```
C:\> bcdedit /dbgsettings serial debugport:1 baudrate:115200
```

*Note*: if we wanted to set debug settings specific to one entry of the boot
loader, we would've used `bcdedit /set` instead. For instance:

```
C:\> bcdedit /set {UUID-RETURNED-BY-FORMER-COMMAND} debugtype serial
```

Now, shutdown the VM and go to its settings on VirtualBox (**Machine** ->
**Settings**) and in the "Serial Ports" tab, enable one port and bind it to
`COM1` (since we used the `debugport:1` above with `bcdedit`), and select `Host
Pipe` as Port Mode. Last provide a path to file in the `Path/Address` field, for
example `/tmp/win7-kd-pipe`.

![image_alt](/assets/images/win-kernel-debug/win7-vbox-settings.png)

The tickbox `Connect to existing pipe/socket` means that the debuggee will
always have to be started **after** the debugger VM, or VirtualBox will throw an
error.

### Running the debugging session

#### On the debugger

Start the debugger VM first and prepare WinDBG for kernel-mode debugging
(Ctrl-K) by selecting COM as debug vector:

![image_alt](/assets/images/win-kernel-debug/win7-windbg-option.png)

WinDBG will then wait for communications on COM1.

```
Microsoft (R) Windows Debugger Version 6.3.9600.17298 X86
Copyright (c) Microsoft Corporation. All rights reserved.

Opened \\.\com1
Waiting to reconnect...

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*c:\syms*http://msdl.microsoft.com/download/symbols
```

#### On the debuggee

Start the debuggee, and when the boot loader menu shows up, select the entry
named `Windows 7 with kernel debug via COM`.

![image_alt](/assets/images/win-kernel-debug/win7-boot-manager.png)

As you see Windows already indicates that this entry will be in debug mode. And
when you press Enter, the debugger VM will be attached to the debuggee.

![image_alt](/assets/images/win-kernel-debug/win7-debug-session.png)

You're now debugging the Windows 7 x86 VM kernel!! But as you'll see, Serial
Port debugging will drastically slow down all operations on the debuggee. This
is why projects like VirtualKD came to life, but personnally, if the target VM
is a Windows 8+, my favorite kernel debugging method is Network based, as
detailed below.

## Setup Network kernel debugging for the Windows 8+ target

**Note**: All is described
[here](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/setting-up-a-network-debugging-connection).

IMHO, this method is the best and fastest method to debug Windows kernel, but it
has 2 constraints:

  1. you must use a compatible network adapter (not so much a problem for
    VirtualBox or VMware)
  1. the debuggee **must** be running Windows 8 or later.

When preparing the VM, make sure to add an extra Network Card as Host-Only, and
linked to the same interface as the one specified on the host
(i.e. `vboxnet0`). **Important note**: in the "Advanced" section, select one of
the Intel Pro card (preferably PRO/1000 MT Desktop). The reason for that is that
[Windows network kernel debugging does not work with all network controllers](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/supported-ethernet-nics-for-network-kernel-debugging-in-windows-8-1).

Boot the VM, and then open the "Device Manager" (Control Panel ->
System -> Advanced system settings -> on the Hardware tab). Expand "Network
adapters" and select the 2nd device's properties menu. On the new window, the
"Location" field will be required to assignate this interface for debugging:

![image_alt](/assets/images/win-kernel-debug/win8-network-controller-properties.png)

This indicates us the bus parameters we will need to provide `bcdedit` later on,
with the format `<BusNumber>:<DeviceNumber>:<FunctionNumber>` (in this case
`0.8.0`).

Now open an administrator prompt and use `bcdedit` utility to create a
new entry to the boot manager like we did on Windows 7, and enable the debug
mode for it. But unlike Windows 7, now we have to setup the network properties:

```
C:\> bcdedit /dbgsettings net hostip:ip.of.debugger.vm port:50000 key:Kernel.Debugging.Is.Fun
C:\> bcdedit /set {dbgsettings} busparams <BusNumber>.<DeviceNumber>.<FunctionNumber>
```

![image_alt](/assets/images/win-kernel-debug/win8-setup-kernel-mode.png)

### Running the debugging session

#### On the debugger

Start the debugger VM first and prepare WinDBG for kernel-mode debugging
(Ctrl-K) by selecting NET as debug vector, and set the Port and Key adequately.
WinDBG will then be waiting for new connection:

```
Microsoft (R) Windows Debugger Version 6.3.9600.17336 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Using NET for debugging
Opened WinSock 2.0
Waiting to reconnect...
```

#### On the debuggee

Start the VM. When the boot loader menu shows up, select the one with the
network kernel mode enabled

![image_alt](/assets/images/win-kernel-debug/win8-boot-loader.png)

The debugger will show some activity immediately. Note that execution of the
debuggee will not stop, so you may hit Ctrl-Break at any time to force an
interruption:

![image_alt](/assets/images/win-kernel-debug/win8-success.png)

In this post, we've presented 2 techniques for kernel debugging, depending on
the Windows version targeted. Some other techniques exist (FireWire, USB
debugging) but they are slightly harder to put in place.

The next post will cover more of Windows kernel exploitation 101 by going
through some vulnerabilities on
the
[HEVD driver](https://github.com/hacksysteam/HackSysExtremeVulnerableDriver).

Cheers ✌


text:
<?php

/**
 * @namespace
 */
namespace PopTest\Cache;

use Pop\Loader\Autoloader;
use Pop\Cache\Cache;
use Pop\Cache\Adapter\Sqlite;

// Require the library's autoloader.
require_once __DIR__ . '/../../../src/Pop/Loader/Autoloader.php';

// Call the autoloader's bootstrap function.
Autoloader::factory()->splAutoloadRegister();

class SqliteTest extends \PHPUnit_Framework_TestCase
{

    public function testConstructor()
    {
        $this->assertInstanceOf('Pop\Cache\Cache', Cache::factory(new Sqlite(__DIR__ . '/../tmp/cache.sqlite'), 30));
    }

    public function testSetAndGetLifetime()
    {
        $c = Cache::factory(new Sqlite(__DIR__ . '/../tmp/cache.sqlite'), 30);
        $c->setLifetime(30);
        $this->assertEquals(30, $c->getLifetime());
    }

    public function testSetAndGetTable()
    {
        $c = Cache::factory(new Sqlite(__DIR__ . '/../tmp/cache.sqlite'), 30);
        $c->adapter()->setTable('pop_cache');
        $this->assertEquals('pop_cache', $c->adapter()->getTable());
    }

    public function testCacheDir()
    {
        $this->setExpectedException('Pop\Cache\Adapter\Exception');
        $c = Cache::factory(new Sqlite(__DIR__ . '/../test/cache.sqlite'), 30);
    }

    public function testSaveAndLoad()
    {
        $str = 'This is my test variable. It contains a string.';
        $c = Cache::factory(new Sqlite(__DIR__ . '/../tmp/cache.sqlite', 'pop_cache', true), 30);
        $this->assertContains('cache.sqlite', $c->adapter()->getDb());
        $this->assertEquals('pop_cache', $c->adapter()->getTable());
        $c->save('str', $str);
        $val = $c->load('str');
        $this->assertEquals($str, $val);
        $val .= '-new';
        $c->save('str', $val);
        $this->assertEquals($val, $c->load('str'));
        $c->remove('str');
        $c->clear();
    }

    public function testDelete()
    {
        $c = Cache::factory(new Sqlite(__DIR__ . '/../tmp/cache.sqlite'), 30);
        $c->adapter()->delete();
        $this->assertFalse(file_exists(__DIR__ . '/../tmp/cache.sqlite'));
    }

}


text: - Fix dependencies


text:
[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg
[travis-url]: https://travis-ci.org/feross/is-buffer
[npm-image]: https://img.shields.io/npm/v/is-buffer.svg
[npm-url]: https://npmjs.org/package/is-buffer
[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg
[downloads-url]: https://npmjs.org/package/is-buffer
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer))

[![saucelabs][saucelabs-image]][saucelabs-url]

[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg
[saucelabs-url]: https://saucelabs.com/u/is-buffer

## Why not use `Buffer.isBuffer`?

This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)).

It's future-proof and works in node too!

## install

```bash
npm install is-buffer
```

## usage

```js
var isBuffer = require('is-buffer')

isBuffer(new Buffer(4)) // true

isBuffer(undefined) // false
isBuffer(null) // false
isBuffer('') // false
isBuffer(true) // false
isBuffer(false) // false
isBuffer(0) // false
isBuffer(1) // false
isBuffer(1.0) // false
isBuffer('string') // false
isBuffer({}) // false
isBuffer(function foo () {}) // false
```

## license

MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org).


text:
class FakeShellOut
  # Class to stub Chef::Mixin::ShellOut#shell_out status result.
  class FakeShellOutStatus
    def initialize(status)
      @status = status
    end
  end

  attr_reader :status, :stdout

  def initialize
    and_return_status(true)
    and_return_stdout('')
  end

  def and_return_status(status)
    @status = FakeShellOutStatus.new(status)
    self
  end

  def and_return_stdout(stdout)
    @stdout = stdout
    self
  end
end

def stub_shell_out(cmd)
  output = FakeShellOut.new
  allow_any_instance_of(Chef::Mixin::ShellOut).to receive(:shell_out)
    .with(cmd)
    .and_return(output)
  output
end

def data_file(file)
  data_dir = ::File.join(::File.dirname(__FILE__), '..', 'data')
  ::IO.read(::File.join(data_dir, file))
end


text:
require 'rubygems'
require 'bundler/setup'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'chek'

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
end


text:
@interface UdeskShareTransitioningDelegateImpl : NSObject <UIViewControllerTransitioningDelegate>

@property (nonatomic, assign) BOOL interactive;
@property (nonatomic, strong) UIPercentDrivenInteractiveTransition <UIViewControllerAnimatedTransitioning> *interactiveTransitioning;

- (void)finishTransition;
@end