text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Media.Imaging;
using System.Xml.Serialization;
using ManagedLOL.Configuration;
using ManagedLOL.ItemChanger.Items;

namespace ManagedLOL.ItemChanger
{
    /// <summary>
    /// Interaction logic for ItemChanger.xaml
    /// </summary>
    public partial class ItemChanger : Window
    {
        public bool IsClosed { get; private set; }

        private Dictionary<string, string> Champions;

        private string SelectedChampion;

        private string configFolder { get { return SettingsHelper.LolPathItemsCharacters + @"\" + SelectedChampion; } }

        private string configFileClassic { get { return configFolder + @"\RecItemsCLASSIC.ini"; } }

        private string configFileDominion { get { return configFolder + @"\RecItemsODIN.ini"; } }

        private List<ItemControl> itemSlots;
        private List<Item> items;

        //1 = classic, 2 = dominion
        private int Mode = 1;

        public ItemChanger()
        {
            InitializeComponent();
            this.Closed += delegate(object sender, EventArgs args) { IsClosed = true; };
            dockpanel.Visibility = System.Windows.Visibility.Hidden;
            if (SettingsHelper.HasLolPath)
            {
                Champions = new Dictionary<string, string>();
                foreach (string path in Directory.GetFiles(SettingsHelper.LolPathImagesChampions, SettingsHelper.ChampionPortraitSearchPattern))
                {
                    FileInfo file = new FileInfo(path);
                    string name = file.Name.Substring(0, file.Name.IndexOf('_'));
                    Champions.Add(name, path);
                }
                if (Champions.Count == 0)
                {
                    this.Hide();
                    MessageBox.Show("Couldn't load Champons", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    this.Close();
                }

                ddlHero.ItemsSource = Champions;

                if (File.Exists("items.xml"))
                {
                    //TODO parse xml
                    XmlSerializer ser = new XmlSerializer(typeof(List<Item>));
                    FileStream fs = new FileStream("items.xml", FileMode.Open);
                    items = (List<Item>)ser.Deserialize(fs);
                    fs.Close();
                }
                else
                {
                    var result = MessageBox.Show("No items.xml found, should I try to enumerate the items?\n\nNote: not all items might be found, correctly named or duplicated.\nThose that are found might not all work ingame", "Items not found!", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (result == MessageBoxResult.Yes)
                    {
                        items = new List<Item>();
                        foreach (string path in Directory.GetFiles(SettingsHelper.LolPathImagesItems))
                        {
                            FileInfo file = new FileInfo(path);
                            int index = file.Name.IndexOf('_');
                            if (index == -1) continue;
                            string strid = file.Name.Substring(0, index);
                            string name = file.Name.Substring(index + 1, file.Name.Length - file.Extension.Length - index - 1).Replace('_', ' ');
                            int id = 0;
                            if (int.TryParse(strid, out id) && id > 1000)
                            {
                                var item = new Item(id, name, path);
                                items.Add(item);
                            }
                        }
                    }
                    else
                    {
                        this.Close();
                        return;
                    }
                }
                LoadItems();

                itemSlots = new List<ItemControl>();
                for (int i = 0; i < 6; i++)
                {
                    var itemControl = new ItemControl();
                    itemControl.IsMainSlot = true;
                    itemControl.MainSlotNumber = i;
                    itemControl.Item = null;
                    itemSlots.Add(itemControl);
                    wrapItemSlots.Children.Add(itemControl);
                }

                this.Show();
            }
            else
            {
                this.Hide();
                MessageBox.Show("League of Legends Path not Found.\nPlease make sure the settings are correct.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                this.Close();
            }
        }

        private void LoadItems()
        {
            if (items == null) return;
            List<Item> toDisplay = items.Where(x => x.Available == Item.ItemAvailability.Both).ToList();
            switch (Mode)
            {
                case 1:
                    toDisplay.AddRange(items.Where(x => x.Available == Item.ItemAvailability.Classic));
                    break;

                case 2:
                    toDisplay.AddRange(items.Where(x => x.Available == Item.ItemAvailability.Dominion));
                    break;
            }
            if (SelectedChampion == "Viktor") toDisplay.AddRange(items.Where(x => x.Available == Item.ItemAvailability.Viktor));
            wrapItems.Children.Clear();
            foreach (Item item in toDisplay)
            {
                var itemControl = new ItemControl();
                itemControl.Item = item;
                wrapItems.Children.Add(itemControl);
            }
        }

        private void ClearItems()
        {
            if (itemSlots == null) return;
            foreach (ItemControl ic in itemSlots)
            {
                ic.Item = null;
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!SettingsHelper.HasLolPath)
            {
                this.Hide();
                MessageBox.Show("League of Legends Path not Found.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                this.Close();
            }
            if (!Directory.Exists(SettingsHelper.LolPathItemsCharacters))
                Directory.CreateDirectory(SettingsHelper.LolPathItemsCharacters);
        }

        private void ddlHero_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            KeyValuePair<string, string> value = (KeyValuePair<string, string>)ddlHero.SelectedValue;
            lblName.Content = SelectedChampion = value.Key;
            if (File.Exists(SettingsHelper.LolPathImagesChampions + @"\" + SelectedChampion + @"_0.jpg"))
                imgBackground.Source = new BitmapImage(new Uri(SettingsHelper.LolPathImagesChampions + @"\" + SelectedChampion + @"_0.jpg"));
            dockpanel.Visibility = System.Windows.Visibility.Visible;

            LoadConfig(configFileClassic);
            btnSave.IsEnabled = true;
        }

        [DllImport("kernel32")]
        private static extern long WritePrivateProfileString(string section,
        string key,
        string val,
        string filePath);

        [DllImport("kernel32")]
        private static extern int GetPrivateProfileString(string section,
        string key,
        string def,
        StringBuilder retVal,
        int size,
        string filePath);

        private void LoadConfig(string path)
        {
            ClearItems();
            string configFile;
            switch (Mode)
            {
                case 1:
                    configFile = configFileClassic;
                    break;

                case 2:
                    configFile = configFileDominion;
                    break;
                default:
                    return;
            }
            if (File.Exists(configFile))
            {
                int slotId = 0;
                foreach (ItemControl itemControl in itemSlots)
                {
                    slotId++;
                    if (slotId >= 7) break;
                    if (itemControl == null || itemControl.Item == null) continue;
                    StringBuilder SB = new StringBuilder(10);
                    int i = GetPrivateProfileString("ItemSet1", "RecItem" + slotId, "0", SB, 10, configFile);
                    int id = 0;
                    if (int.TryParse(SB.ToString(), out id) && id != 0)
                    {
                        var item = items.FirstOrDefault(x => x.ID == id);
                        itemControl.Item = item;
                    }
                    else
                        itemControl.Item = null;
                }
                btnDelete.IsEnabled = true;
            }
        }

        private void SaveConfig(string path)
        {
            if (!Directory.Exists(configFolder))
                Directory.CreateDirectory(configFolder);

            string configFile;
            switch (Mode)
            {
                case 1:
                    configFile = configFileClassic;
                    break;

                case 2:
                    configFile = configFileDominion;
                    break;
                default:
                    return;
            }
            WritePrivateProfileString("ItemSet1", "SetName", "ManagedLOLSet", configFile);
            int slotId = 0;
            foreach (ItemControl itemControl in itemSlots)
            {
                slotId++;
                if (slotId >= 7) break;
                if (itemControl == null || itemControl.Item == null) continue;
                WritePrivateProfileString("ItemSet1", "RecItem" + slotId, itemControl.Item.ID.ToString(), configFile);
            }
            btnDelete.IsEnabled = true;
        }

        private void DeleteConfig(string path)
        {
            if (File.Exists(configFileClassic))
                File.Delete(configFileClassic);
            if (File.Exists(configFileDominion))
                File.Delete(configFileDominion);
            if (Directory.Exists(configFolder))
                Directory.Delete(configFolder);
            btnDelete.IsEnabled = false;
            ClearItems();
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            SaveConfig(configFileClassic);
        }

        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            DeleteConfig(configFileClassic);
        }

        private void modeButton_Checked(object sender, RoutedEventArgs e)
        {
            ClearItems();
            if (!this.IsLoaded) return;
            ToggleButton tb = sender as ToggleButton;
            if (tb == null) return;
            switch (tb.Name)
            {
                case "btnClassic":
                    btnClassic.IsChecked = true;
                    btnDominion.IsChecked = false;
                    Mode = 1;
                    break;

                case "btnDominion":
                    btnClassic.IsChecked = false;
                    btnDominion.IsChecked = true;
                    Mode = 2;
                    break;
            }
            LoadItems();
        }
    }
}


text:
package org.zstack.sdk;

public class SecurityGroupInventory  {

    public java.lang.String uuid;
    public void setUuid(java.lang.String uuid) {
        this.uuid = uuid;
    }
    public java.lang.String getUuid() {
        return this.uuid;
    }

    public java.lang.String name;
    public void setName(java.lang.String name) {
        this.name = name;
    }
    public java.lang.String getName() {
        return this.name;
    }

    public java.lang.String description;
    public void setDescription(java.lang.String description) {
        this.description = description;
    }
    public java.lang.String getDescription() {
        return this.description;
    }

    public java.lang.String state;
    public void setState(java.lang.String state) {
        this.state = state;
    }
    public java.lang.String getState() {
        return this.state;
    }

    public java.sql.Timestamp createDate;
    public void setCreateDate(java.sql.Timestamp createDate) {
        this.createDate = createDate;
    }
    public java.sql.Timestamp getCreateDate() {
        return this.createDate;
    }

    public java.sql.Timestamp lastOpDate;
    public void setLastOpDate(java.sql.Timestamp lastOpDate) {
        this.lastOpDate = lastOpDate;
    }
    public java.sql.Timestamp getLastOpDate() {
        return this.lastOpDate;
    }

    public java.util.List rules;
    public void setRules(java.util.List rules) {
        this.rules = rules;
    }
    public java.util.List getRules() {
        return this.rules;
    }

    public java.util.Set attachedL3NetworkUuids;
    public void setAttachedL3NetworkUuids(java.util.Set attachedL3NetworkUuids) {
        this.attachedL3NetworkUuids = attachedL3NetworkUuids;
    }
    public java.util.Set getAttachedL3NetworkUuids() {
        return this.attachedL3NetworkUuids;
    }

}

redpajama_set_name: RedPajamaGithub


text:
package com.navercorp.pinpoint.bootstrap.interceptor.scope;

import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor4;
import com.navercorp.pinpoint.bootstrap.interceptor.InterceptorInvokerHelper;
import com.navercorp.pinpoint.bootstrap.logging.PLogger;
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;

/**
 * @author emeroad
 * @author jaehong.kim
 */
public class ExceptionHandleScopedInterceptor4 implements AroundInterceptor4 {
    private final PLogger logger = PLoggerFactory.getLogger(getClass());
    private final boolean debugEnabled = logger.isDebugEnabled();

    private final AroundInterceptor4 interceptor;
    private final InterceptorScope scope;
    private final ExecutionPolicy policy;

    public ExceptionHandleScopedInterceptor4(AroundInterceptor4 interceptor, InterceptorScope scope, ExecutionPolicy policy) {
        if (interceptor == null) {
            throw new NullPointerException("interceptor must not be null");
        }
        if (scope == null) {
            throw new NullPointerException("scope must not be null");
        }
        if (policy == null) {
            throw new NullPointerException("policy must not be null");
        }
        this.interceptor = interceptor;
        this.scope = scope;
        this.policy = policy;
    }

    @Override
    public void before(Object target, Object arg0, Object arg1, Object arg2, Object arg3) {
        final InterceptorScopeInvocation transaction = scope.getCurrentInvocation();

        if (transaction.tryEnter(policy)) {
            try {
                this.interceptor.before(target, arg0, arg1, arg2, arg3);
            } catch (Throwable t) {
                InterceptorInvokerHelper.handleException(t);
            }
        } else {
            if (debugEnabled) {
                logger.debug("tryBefore() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
            }
        }
    }

    @Override
    public void after(Object target, Object arg0, Object arg1, Object arg2, Object arg3, Object result, Throwable throwable) {
        final InterceptorScopeInvocation transaction = scope.getCurrentInvocation();

        if (transaction.canLeave(policy)) {
            try {
                this.interceptor.after(target, arg0, arg1, arg2, arg3, result, throwable);
            } catch (Throwable t) {
                InterceptorInvokerHelper.handleException(t);
            } finally {
                transaction.leave(policy);
            }
        } else {
            if (debugEnabled) {
                logger.debug("tryAfter() returns false: interceptorScopeTransaction: {}, executionPoint: {}. Skip interceptor {}", transaction, policy, interceptor.getClass());
            }
        }
    }
}


text:
<!-- **************************************************************************
#
# Copyright (c) 2012 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#
#   Winston Prakash
#
#************************************************************************** -->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.eclipse.hudson</groupId>
        <artifactId>hudson-parent</artifactId>
        <version> 3.3.4-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>hudson-jetty-war-executable</artifactId>
    <version>3.3.4-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Hudson :: jetty-war-executable</name>

    <description>
        Class needed for Jetty server based executable war
    </description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!--
                    Though JDK 7 is required to build Hudson 3.x,
                    launcher itself is built with source level 1.5
                    so if run with JDK 5 or 6, the launcher class will
                    load but will exit with warning JDK 7 and above is
                    required to run Hudson
                    -->
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>${jetty.server.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.server.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <type>jar</type>
        </dependency>
        <dependency>
            <artifactId>jetty-continuation</artifactId>
            <groupId>org.eclipse.jetty</groupId>
            <type>jar</type>
            <version>${jetty.server.version}</version>
        </dependency>
    </dependencies>

</project>


text:
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import ast
import sys

def main():
    for path in sys.argv[1:] or sys.stdin.read().splitlines():
        with open(path, 'rb') as path_fd:
            lines = path_fd.read().splitlines()

        missing = True
        if not lines:
            # Files are allowed to be empty of everything including boilerplate
            missing = False

        for text in lines:
            if text == b'__metaclass__ = type':
                missing = False
                break

        if missing:
            with open(path) as file:
                contents = file.read()

            # noinspection PyBroadException
            try:
                node = ast.parse(contents)

                # files consisting of only assignments have no need for metaclass boilerplate
                # the most likely case is that of a documentation only python file
                if all(isinstance(statement, ast.Assign) for statement in node.body):
                    missing = False
            except Exception:  # pylint: disable=broad-except
                pass  # the compile sanity test will report this error

        if missing:
            print('%s: missing: __metaclass__ = type' % path)

if __name__ == '__main__':
    main()


text:
%SDMD_RUN An example to demonstrate incrementally updated DMD.
%
%   Run a simple example of incrementally updated DMD on a toy problem to
%   demonstrate the streaming DMD algorithm, as formulated in:
%
%       M.S. Hemati, M.O. Williams, C.W. Rowley,
%       ``Dynamic Mode Decomposition for Large and Streaming Datasets,''
%       Physics of Fluids (2014).
%
%   The example considers an arbitrary n-dimensional dynamical system with
%   two characteristic frequencies.
%
%   A total of m snapshot pairs are measured sequentially and are subject
%   to additive i.i.d. zero-mean Gaussian noise with covariance noise_cov.
%
%   To toggle between streaming and batch-processed DMD modes, toggle the
%   streaming flag between true and false, respectively.  The StreamingDMD
%   Matlab class is used to perform incremental updates to the DMD
%   computation when streaming=true.
%
%   When in streaming mode, to run the direct streaming algorithm set
%   max_rank=0; otherwise, incrementally update DMD with POD truncation,
%   where max_rank denotes the truncation threshold (i.e., the maximum
%   number of retained POD modes).
%
% Tested using Matlab 8.1.0.604 (R2013a) for Mac OSX.
%
% Authors:
%   Maziar S. Hemati
%   Matthew O. Williams
%   Clarence W. Rowley
%
% Created:
%   August 2014.
%
%   see also StreamingDMD
%
% Reference page in Help browser:
%   doc sdmd_run

% set example parameters here
max_rank = 10;      % maximum allowable rank of the DMD operator
                    %   (set to zero for unlimited)
m = 501;            % total number of snapshots to be processed
n = 4000;           % number of states
noise_cov = 1e-4;   % measurement noise covariance
rng(0)              % seed the random number generator
streaming = true;   % true=use streaming DMD, false=use batch-processed DMD

%% define the example system
% random state directions
v1 = randn(n,1);
v2 = randn(n,1);
v3 = randn(n,1);
v4 = randn(n,1);

% characteristic frequencies
f1 = 5.2;
f2 = 1.0;

% sampling time
dt = 1e-2;

dynsys = @(k) v1*cos(2*pi*dt*f1*k) + v2*cos(2*pi*f2*dt*k) + ...
    v3*sin(2*pi*dt*f1*k) + v4*sin(2*pi*f2*dt*k);

get_snapshot = @(k) dynsys(k) + sqrt(noise_cov) * randn(n,1);

%% collect the data

disp('Collecting data')
tic
if ~streaming
    % standard algorithm: batch-processing
    X = zeros(n, m);
    Y = zeros(n, m);
    yk = get_snapshot(0);
    for k = 1:m
        xk = yk;
        yk = get_snapshot(k);
        X(:,k) = xk;
        Y(:,k) = yk;
    end
    [Qx, S, V] = svd(X, 0);
    Ktilde = Qx' * Y * V * pinv(S);
else
    % streaming algorithm
    sdmd = StreamingDMD(max_rank);
    yk = get_snapshot(0);
    for k = 1:m
        xk = yk;
        yk = get_snapshot(k);
        sdmd = sdmd.update(xk, yk);
    end
end
elapsed_time = toc;
fprintf('  Elapsed time: %f seconds\n', elapsed_time)

%% compute DMD spectrum
disp('Computing spectrum')
tic
if ~streaming
    % standard DMD spectrum
    [evecK, evals] = eig(Ktilde);
    evals = diag(evals);
    modes = Qx * evecK;
else
    % streaming algorithm
    [modes, evals] = sdmd.compute_modes();
end
elapsed_time = toc;
fprintf('  Elapsed time: %f seconds\n', elapsed_time)

% calculate corresponding frequencies
fdmd = abs(angle(evals)) ./ (2 * pi * dt);
ydmd = zeros(length(fdmd),1);
for ii = 1:length(fdmd)
    ydmd(ii) = norm(modes(:,ii)).*abs(evals(ii));
end
ydmd = ydmd./max(ydmd);

figure(1)
stem(fdmd,ydmd,'o-')
xlabel('Frequency')
ylabel('Magnitude')


text:
/**
 * @author yoram@ignissoft.com
 */
package com.ignissoft.avalanche.systemObject;

import com.ignissoft.avalanche.AvlApp;
import com.ignissoft.avalanche.AvlAttributesInterface;
import com.ignissoft.avalanche.AvlObject;
import com.ignissoft.trafficGenerator.TrafficException;
import com.ignissoft.trafficGenerator.systemObject.TrafficBaseClass;

public class AvalancheBaseClass extends TrafficBaseClass implements AvalancheClassInterface {

	private String objectName;

	@Override
	public AvlApp getTraffic() {
		return (AvlApp) super.getTraffic();
	}

	public void setAttribute(AvlAttributesInterface attribute, Object value) throws TrafficException {
		getAvlObject().configProperty(attribute, value);
	}

	public void setAttribute(AvlAttributesInterface attribute, AvalancheBaseClass otherClass) throws TrafficException {
		getAvlObject().configProperty(attribute, otherClass.getAvlObject());
	}

	public String getAttribute(AvlAttributesInterface attribute) throws TrafficException {
		return getAvlObject().getProperty(attribute);
	}

	/*
	 * Standard Getters and Setters.
	 */

	@Override
	public String getObjectName() {
		return objectName;
	}

	@Override
	public void setObjectName(String objectName) {
		this.objectName = objectName;
	}

	@Override
	public AvlObject getAvlObject() {
		return (AvlObject)getTgnObject();
	}

}


text:
(*

category:      Test
synopsis:      Basic two reactions with four species in a 1-dimensional
compartment, with a species acting as a boundary condition.
componentTags: Compartment, Species, Reaction, Parameter
testTags:      Amount, BoundaryCondition
testType:      TimeCourse
levels:        2.1, 2.2, 2.3, 2.4, 3.1
generatedBy:   Numeric

The model contains one compartment called "compartment".  There are four
species named S1, S2, S3 and S4 and two parameters named k1 and k2.
Compartment "compartment" is 1-dimensional.  Species S3 is labeled as an
SBML boundary species.  The model contains two reactions defined as:

[{width:30em,margin: 1em auto}|  *Reaction*  |  *Rate*  |
| S1 + S2 -> S3 + S4 | $k1 * S1 * S2 * compartment$  |
| S3 + S4 -> S1 + S2 | $k2 * S3 * S4 * compartment$  |]

The initial conditions are as follows:

[{width:30em,margin: 1em auto}|       |*Value*          |*Units*  |
|Initial amount of S1                |$1.0 \x 10^-3$ |mole                      |
|Initial amount of S2                |$1.5 \x 10^-3$ |mole                      |
|Initial amount of S3                |$2.0 \x 10^-3$ |mole                      |
|Initial amount of S4                |$1.0 \x 10^-4$ |mole                      |
|Value of parameter k1               |$ 6.2 \x 10^3$ |mole^-1^ second^-1^ |
|Value of parameter k2               |$   5 \x 10^3$ |mole^-1^ second^-1^ |
|Length of compartment "compartment" |$            1$ |metre                     |]

The species values are given as amounts of substance to make it easier to
use the model in a discrete stochastic simulator, but (as per usual SBML
principles) their symbols represent their values in concentration units
where they appear in expressions.

*)

newcase[ "00234" ];

addCompartment[ compartment, spatialDimensions-> 1, size -> 1 ];
addSpecies[ S1, initialAmount -> 1.0 10^-3];
addSpecies[ S2, initialAmount -> 1.5 10^-3];
addSpecies[ S3, initialAmount -> 2.0 10^-3, boundaryCondition->True];
addSpecies[ S4, initialAmount -> 1.0 10^-4];
addParameter[ k1, value -> 6.2 10^3 ];
addParameter[ k2, value -> 5 10^3 ];
addReaction[ S1 + S2 -> S3 + S4, reversible -> False,
	     kineticLaw -> k1 * S1 * S2 * compartment ];
addReaction[ S3 + S4 -> S1 + S2, reversible -> False,
	     kineticLaw -> k2 * S3 * S4 * compartment ];

makemodel[]


text:
class AddAllowReservationsOnCfps < ActiveRecord::Migration[5.0]
  def change
    add_column 'cfps', 'enable_registrations', :boolean, default: false
  end
end


text:
HNV Client
==========

.. automodule:: hnv.client
	:members:
	:inherited-members:
.. autoattribute::


text:
/**
 * Individual browserify tasks
 * @see https://github.com/jmreidy/grunt-browserify
 */
module.exports = function(config) {
    return {
        options: {
            transform: [['babelify', {global: true, presets: ['es2015']}]]
        },
        dist: {
            src: config.project.source[1].theme + '<%=theme%>.js',
            dest: config.project.dist[1].theme + config.dist + '.js'
        }
    }
}


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

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

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

# Package apache-airflow-backport-providers-imap

Release: 2020.5.20

**Table of contents**

- [Backport package](#backport-package)
- [Installation](#installation)
- [Compatibility](#compatibility)
- [Provider class summary](#provider-class-summary)
    - [Sensors](#sensors)
        - [Moved sensors](#moved-sensors)
    - [Hooks](#hooks)
        - [Moved hooks](#moved-hooks)
- [Releases](#releases)
    - [Release 2020.5.20](#release-2020520)

## Backport package

This is a backport providers package for `imap` provider. All classes for this provider package
are in `airflow.providers.imap` python package.

**Only Python 3.6+ is supported for this backport package.**

While Airflow 1.10.* continues to support Python 2.7+ - you need to upgrade python to 3.6+ if you
want to use this backport package.

## Installation

You can install this package on top of an existing airflow 1.10.* installation via
`pip install apache-airflow-backport-providers-imap`

## Compatibility

For full compatibility and test status of the backport packages check
[Airflow Backport Package Compatibility](https://cwiki.apache.org/confluence/display/AIRFLOW/Backported+providers+packages+for+Airflow+1.10.*+series)

# Provider class summary

All classes in Airflow 2.0 are in `airflow.providers.imap` package.

## Sensors

### Moved sensors

| Airflow 2.0 sensors: `airflow.providers.imap` package                                                                                | Airflow 1.10.* previous location (usually `airflow.contrib`)                                                                                |
|:------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [sensors.imap_attachment.ImapAttachmentSensor](https://github.com/apache/airflow/blob/master/airflow/providers/imap/sensors/imap_attachment.py) | [contrib.sensors.imap_attachment_sensor.ImapAttachmentSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/imap_attachment_sensor.py) |

## Hooks

### Moved hooks

| Airflow 2.0 hooks: `airflow.providers.imap` package                                                       | Airflow 1.10.* previous location (usually `airflow.contrib`)                                                               |
|:----------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------|
| [hooks.imap.ImapHook](https://github.com/apache/airflow/blob/master/airflow/providers/imap/hooks/imap.py) | [contrib.hooks.imap_hook.ImapHook](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/hooks/imap_hook.py) |

## Releases

### Release 2020.5.20

| Commit                                                                                | Committed   | Subject                                                                                |
|:-----------------------------------------------------------------------------------------------|:------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [00642a46d](https://github.com/apache/airflow/commit/00642a46d019870c4decb3d0e47c01d6a25cb88c) | 2020-05-26  | Fixed name of 20 remaining wrongly named operators. (#8994)                                                                                |
| [1d36b0303](https://github.com/apache/airflow/commit/1d36b0303b8632fce6de78ca4e782ae26ee06fea) | 2020-05-23  | Fix references in docs (#8984)                                                                                |
| [375d1ca22](https://github.com/apache/airflow/commit/375d1ca229464617780623c61c6e8a1bf570c87f) | 2020-05-19  | Release candidate 2 for backport packages 2020.05.20 (#8898)                                                                                |
| [12c5e5d8a](https://github.com/apache/airflow/commit/12c5e5d8ae25fa633efe63ccf4db389e2b796d79) | 2020-05-17  | Prepare release candidate for backport packages (#8891)                                                                                |
| [f3521fb0e](https://github.com/apache/airflow/commit/f3521fb0e36733d8bd356123e56a453fd37a6dca) | 2020-05-16  | Regenerate readme files for backport package release (#8886)                                                                                |
| [92585ca4c](https://github.com/apache/airflow/commit/92585ca4cb375ac879f4ab331b3a063106eb7b92) | 2020-05-15  | Added automated release notes generation for backport operators (#8807)                                                                                |
| [05443c6dc](https://github.com/apache/airflow/commit/05443c6dc8100e791446bbcc0df04de6e34017bb) | 2020-03-23  | Add missing call to Super class in remaining providers (#7828)                                                                                |
| [4d03e33c1](https://github.com/apache/airflow/commit/4d03e33c115018e30fa413c42b16212481ad25cc) | 2020-02-22  | [AIRFLOW-6817] remove imports from `airflow/__init__.py`, replaced implicit imports with explicit imports, added entry to `UPDATING.MD` - squashed/rebased (#7456) |
| [97a429f9d](https://github.com/apache/airflow/commit/97a429f9d0cf740c5698060ad55f11e93cb57b55) | 2020-02-02  | [AIRFLOW-6714] Remove magic comments about UTF-8 (#7338)                                                                                |
| [cf141506a](https://github.com/apache/airflow/commit/cf141506a25dbba279b85500d781f7e056540721) | 2020-02-02  | [AIRFLOW-6708] Set unique logger names (#7330)                                                                                |
| [9a04013b0](https://github.com/apache/airflow/commit/9a04013b0e40b0d744ff4ac9f008491806d60df2) | 2020-01-27  | [AIRFLOW-6646][AIP-21] Move protocols classes to providers package (#7268)                                                                                |


text:
namespace System.ComponentModel
{
    /// <summary>
    /// An InstanceCreationEditor allows the user to create an instance of a particular type of property from a dropdown
    /// Within the PropertyGrid. Usually, the text specified by InstanceCreationEditor.Text will be displayed on the
    /// dropdown from the PropertyGrid as a link or button. When clicked, the InstanceCreationEditor.CreateInstance
    /// method will be called with the Type of the object to create.
    /// </summary>
    public abstract class InstanceCreationEditor
    {
        public virtual string Text => SR.InstanceCreationEditorDefaultText;

        /// <summary>
        /// This method is invoked when you user chooses the link displayed by the PropertyGrid for the InstanceCreationEditor.
        /// The object returned from this method must be an instance of the specified type, or null in which case the editor will do nothing.
        ///
        /// </summary>
        public abstract object CreateInstance(ITypeDescriptorContext context, Type instanceType);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace GCWZeroManager
{
    public class ConfigurationManager
    {
        private static ConfigurationManager instance;
        public static ConfigurationManager Instance
        {
            get
            {
                if (instance == null)
                    instance = new ConfigurationManager();

                return instance;
            }
        }

        private ConfigurationSettings settings;

        private string folder = "gcwzeromanager";
        private string filenameConnections = "connections.xml";
        private string filenameSettings = "settings.xml";

        public ConfigurationSettings Settings
        {
            get { return settings; }
        }

        private ConfigurationManager()
        {
        }

        public string GetSaveFilePath()
        {
            string appDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            return Path.Combine(new string[] { appDataDir, folder });
        }

        public void LoadConnections()
        {
            string dir = GetSaveFilePath();
            string path = Path.Combine(new string[] { dir, filenameConnections });
            if (!File.Exists(path))
            {
                ConnectionManager.Instance.Connections = new ConnectionNodeHolder();
                return;
            }

            var serializer = new XmlSerializer(typeof(ConnectionNodeHolder));
            var stream = new FileStream(path, FileMode.Open);
            var container = serializer.Deserialize(stream) as ConnectionNodeHolder;
            stream.Close();

            ConnectionManager.Instance.Connections = container;
        }

        public void SaveConnections()
        {
            string dir = GetSaveFilePath();
            if (!Directory.Exists(dir))
            {
                // Create directory if it doesn't exist
                Directory.CreateDirectory(dir);
            }

            string path = Path.Combine(new string[] { dir, filenameConnections });

            var serializer = new XmlSerializer(typeof(ConnectionNodeHolder));
            var stream = new FileStream(path, FileMode.Create);
            serializer.Serialize(stream, ConnectionManager.Instance.Connections);
            stream.Close();
        }

        public void LoadSettings()
        {
            string dir = GetSaveFilePath();
            string path = Path.Combine(new string[] { dir, filenameSettings });
            if (!File.Exists(path))
            {
                settings = new ConfigurationSettings();
                return;
            }

            var serializer = new XmlSerializer(typeof(ConfigurationSettings));
            var stream = new FileStream(path, FileMode.Open);
            var container = serializer.Deserialize(stream) as ConfigurationSettings;
            stream.Close();

            settings = container;
        }

        public void SaveSettings()
        {
            string dir = GetSaveFilePath();
            if (!Directory.Exists(dir))
            {
                // Create directory if it doesn't exist
                Directory.CreateDirectory(dir);
            }

            string path = Path.Combine(new string[] { dir, filenameSettings });

            var serializer = new XmlSerializer(typeof(ConfigurationSettings));
            var stream = new FileStream(path, FileMode.Create);
            serializer.Serialize(stream, settings);
            stream.Close();
        }
    }
}


text:
import test from 'ava';
import util from '../../../lib/sweetpack/util';

// test('finds .sweetpack.yml', (t) => {
//
// });

test('returns .sweetpack.yml as the string', (t) => {
  t.snapshot(util.convertYml());
});


text:
require "rails_helper"

RSpec.describe Board::PapersController, type: :routing do
  it { expect(get "/board/papers").to   route_to("board/papers#index") }
end


text:
module SCB
  class DB
    class Variable
      attr_reader :data

      def initialize(data)
        @data = data
      end

      def code
        data["code"]
      end

      def text
        data["text"]
      end

      def values
        data["values"]
      end

      def values_hash
        @values_hash ||= Hash[values.zip(value_texts)]
      end

      def value_texts
        data["valueTexts"]
      end

      def elimination?
        !!data["elimination"]
      end

      def time?
        !!data["time"]
      end
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2020-2021 Equinix, Inc
  ~ Copyright 2014-2021 The Billing Project, LLC
  ~
  ~ The Billing Project licenses this file to you under the Apache License, version 2.0
  ~ (the "License"); you may not use this file except in compliance with the
  ~ License.  You may obtain a copy of the License at:
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.
  -->
<overdueConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:noNamespaceSchemaLocation="https://docs.killbill.io/latest/overdue.xsd">
    <accountOverdueStates>
        <state name="Worst">
            <condition>
                <totalUnpaidInvoiceBalanceEqualsOrExceeds>1000.00</totalUnpaidInvoiceBalanceEqualsOrExceeds>
                <timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
                    <unit>DAYS</unit>
                    <number>10</number>
                </timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
            </condition>
            <externalMessage>You must pay now</externalMessage>
            <blockChanges>true</blockChanges>
            <disableEntitlementAndChangesBlocked>true</disableEntitlementAndChangesBlocked>
            <autoReevaluationInterval>
                <unit>DAYS</unit><number>1</number>
            </autoReevaluationInterval>
        </state>
        <state name="Worse">
            <condition>
                <totalUnpaidInvoiceBalanceEqualsOrExceeds>100.00</totalUnpaidInvoiceBalanceEqualsOrExceeds>
                <timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
                    <unit>DAYS</unit>
                    <number>10</number>
                </timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
            </condition>
            <externalMessage>That starts to be a lot</externalMessage>
            <blockChanges>true</blockChanges>
            <disableEntitlementAndChangesBlocked>true</disableEntitlementAndChangesBlocked>
            <autoReevaluationInterval>
                <unit>DAYS</unit><number>1</number>
            </autoReevaluationInterval>
        </state>
        <state name="ReallyBad">
            <condition>
                <totalUnpaidInvoiceBalanceEqualsOrExceeds>10.00</totalUnpaidInvoiceBalanceEqualsOrExceeds>
                <timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
                    <unit>DAYS</unit>
                    <number>10</number>
                </timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
            </condition>
            <externalMessage>hummmm</externalMessage>
            <blockChanges>true</blockChanges>
            <disableEntitlementAndChangesBlocked>false</disableEntitlementAndChangesBlocked>
            <autoReevaluationInterval>
                <unit>DAYS</unit><number>1</number>
            </autoReevaluationInterval>
        </state>
        <state name="Fixed">
            <condition>
                <totalUnpaidInvoiceBalanceEqualsOrExceeds>1.00</totalUnpaidInvoiceBalanceEqualsOrExceeds>
                <timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
                    <unit>DAYS</unit>
                    <number>10</number>
                </timeSinceEarliestUnpaidInvoiceEqualsOrExceeds>
            </condition>
            <externalMessage>You have unpaid invoices</externalMessage>
            <blockChanges>true</blockChanges>
            <disableEntitlementAndChangesBlocked>false</disableEntitlementAndChangesBlocked>
            <autoReevaluationInterval>
                <unit>DAYS</unit><number>1</number>
            </autoReevaluationInterval>
        </state>
    </accountOverdueStates>
</overdueConfig>


text:
import xml.etree.ElementTree as _ET  # does the attribute decomposition

# This module is used ONLY as a fall-back if lxml is not installed.

# required functionality:
#   DTD().validate(tree)
#   tree=parse()
#   element=tree.getroot()
#   element.attrib[<attribute-name>]
#   element.tag
#   element.find('..') --> parent
#   element.findall('.//'+element_name) --> return list of elements with name

# Note:
#   lxml creates an object of each element once and
#     returns a reference as needed.
#   here, a new copy of a requested element object
#     is returned for each request.

class DTD(object):
    """Dummy DTD validator class: validation will always succeed."""
    def __init__(self, DTD_definition_string):
        self.DTD_definition_string = DTD_definition_string
    def validate(self, tree):
        return True

class _Tree(object):
    def __init__(self, elements, current_position):
        self._elements = elements # we don't mutate elements, don't copy
        self._pos = current_position[:]
        if self._pos[-1]!=0: self._pos.append(0) # pointing at the head
        self._current = self._get_current_element()

    def _get_current_element(self, pos=None):
        """Returns list we are currently pointing to."""
        sub=self._elements
        if pos is None: pos=self._pos
        for idx in pos:
            if idx==0: break # we're pointing at the head element
            sub=sub[idx]
        return sub

    def __eq__(self,other):
        return (self._elements == other._elements) and (self._pos == other._pos)
    def __neq__(self,other):
        return not self.__eq__(other)
    def __len__(self):
        # not used
        return len([child for child in self])
    def __repr__(self):
        # we do not return id(self) since this doesn't help
        #   identifying if two instances point at the same element.
        return '<Element %s at %s>' % (self.tag, repr(self._pos))

    def __getitem__(self, key):
        # not used
        """Parse attribute from string"""
        return self._current[0][1][key]

    def __getattr__(self, name):
        if name == 'tag':
            # return tag name
            return self._current[0][0]
        elif name == 'attrib':
            # return attribute information
            return self._current[0][1]
        raise AttributeError('Unknown attribute %s.' % name)
    def items(self): # used by tostring()
        return list(self._current[0][1].iteritems())

    def _get_tag(self, pos=None):
        if pos is None: pos = self._pos
        if pos[-1] != 0: pos+=[0,]
        return self._get_current_element(pos)[0][0]

    def findall(self, path):
        if not path.startswith('.//'):
            raise NotImplemented('Search path %s is not implemented.' % path)
        tag = path[3:].lower()
        return [element for element in self.getiterator() if element.tag.lower() == tag]

    def find(self, path):
        if path!='..':
            raise NotImplemented('Search path %s is not implemented.' % path)
        if len(self._pos)<2: return None # we're at the root element
        return _Tree(self._elements, self._pos[:-2]+[0])

    def __iter__(self):
        """Iterate over direct children of current level."""
        # Note: not used
        base = self._pos[:-1]
        class _next_item(object):
            def __init__(s, base):
                s._base, s._last_item = base, [0]
            def next(s):
                s._last_item[-1]+=1
                if s._last_item[-1] >= len(self._current):
                    raise StopIteration
                return _Tree(self._elements, s._base+s._last_item)
            def __next__(s): # Python 3
                return s.next()
        return _next_item(base)

    def getchildren(self):
        """Return list of direct children"""
        # Note: not used
        return [child for child in self]

    def getiterator(self):
        """Return iterator that iterates over flattened list of self and all child elements"""
        base = self._pos[:-1]
        class _iterator(object):
            def __init__(s, base):
                s._base = base
                s._last_item = []
            def __iter__(s):
                s._last_item = []
                return s
            def next(s):
                while len(s._last_item)>0:
                    s._last_item[-1]+=1
                    if s._last_item[-1] >= len(self._get_current_element(s._base+s._last_item[:-1])):
                        s._last_item = s._last_item[:-1]
                        if len(s._last_item) == 0: raise StopIteration
                        continue
                    break
                s._last_item+=[0,]
                return _Tree(self._elements, s._base+s._last_item)
            def __next__(s): # Python 3
                return s.next()

        return _iterator(base)

class parse(object):
    def __init__(self, filename=None):
        if filename is not None:
            with open(filename,'rt') as f:
                self._data = f.read()
            # get encoding information and convert rest
            #   to unicode string
            encoding, cont = self._get_encoding()

            try: # Python 2
                # convert data to unicode string
                self._text=self._data[cont:].decode(encoding).strip()
            except AttributeError: # Python 3
                with open(filename,'rt',encoding=encoding) as f:
                    self._data = f.read()
                self._text=self._data[cont:].strip()

            self._text_pointer=None
            self._parse()
            self._current = [0]

    def _get_encoding(self):
        """Extract xml encoding from prolog"""
        start = self._data.lower().find('<?xml ')

        end = self._data.find('?>',start)
        enc='encoding='
        idx=self._data.lower().find(enc,start,end)
        if idx != -1:
            # extract encoding string
            idx+=len(enc)
            sep=self._data[idx]
            idx+=1
            last=self._data.find(sep,idx,end)
            encoding = self._data[idx:last]
        else:
            # assume XML default
            encoding = 'UTF-8'
        self._encoding = u'%s'%encoding
        return self._encoding, end+2

    def _find_next_open(self, start=0):
        """returns -1 if none"""
        return self._text.find('<',start)
    def _find_next_element(self, start=None):
        start=start if start is not None else self._text_pointer if self._text_pointer is not None else 0
        while True:
            check=self._find_next_open(start)
            if self._text[check:check+4] == '<!--':
                # skip comment
                start = self._text.find('-->',check)
                continue
            break
        # element end
        end = self._text.find('>',check)

        # new element start?
        closing = self._text[check+1:check+2]=='/'
        if closing: check += 1 # skip marker

        end_tag=self._text.find(' ',check,end)
        if end_tag == -1: end_tag = end

        tag = self._text[check+1:end_tag]

        singular = self._text[end-1]=='/'

        self._text_pointer = end+1
        attributes = self._text[end_tag+1:end-(1 if singular else 0)].strip() if not closing else u''
        return tag, attributes, closing, singular, end+1

    def _parse(self):
        """Extract elements."""
        # We ignore comments and text between elements.
        self._elements=None
        self._text_pointer = 0
        levels=[[]]
        while self._text_pointer < len(self._text):

            tag, attrib, closing, singular, cont = self._find_next_element()
            type_name = ['opening','closing','singular'][int(closing)+int(singular)*2]

            # use 'xml' to generate attribute dictionary
            attrib = _ET.fromstring(('<d %s />' % attrib).encode('utf-8')).attrib

            if type_name in ('opening','singular'):
                levels.append([])
                levels[-1]+=((tag, attrib),)
            if type_name in ('closing','singular'):
                levels[-2].append(levels[-1])
                levels.pop()

        self._elements=levels[-1][-1]

    def getroot(self):
        return _Tree(self._elements, [0])


text:
'use strict';

var mongoose = require('mongoose');
var crypto = require('crypto');

var User = new mongoose.Schema({
  username: {
    type: String,
    trim: true
  },
  password: {
    type: String,
    default: ''
  },
  salt: {
    type: String
  },
  roles: {
    type: [{
      type: String,
      enum: ['user', 'admin']
    }],
    default: ['user']
  }
});

User.pre('save', function(next) {
  if (this.password) {
    this.salt = crypto.randomBytes(16).toString('base64');
    this.password = this.hashPassword(this.password);
  }

  next();
});

User.methods.hashPassword = function(password) {
  if (this.salt && password) {
    return crypto.pbkdf2Sync(password, new Buffer(this.salt, 'base64'), 10000, 64).toString('base64');
  } else {
    return password;
  }
};

User.methods.authenticate = function(password) {
  return this.password === this.hashPassword(password);
};

module.exports = mongoose.model('User', User);


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

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

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<link rel="stylesheet" type="text/css" href="../../CSS/Contents.css"></link>

<title>Types.ShortGenericType Method (Type, Type[], StringBuilder)</title>

Documentation Project

Types.ShortGenericType Method (Type, Type[], StringBuilder)

Syntax

Collapse All

Generates an abbreviated type name for a generic type definition with the specified
            generic type arguments.

Declaring type: Types

Namespace: Sasa

Assembly: Sasa

Syntax

<col width="100%" />
C#

public static void ShortGenericType (
        Type typ,
        Type[] genericArguments,
        StringBuilder sb
)

Parameters

typ

The generic type definition.

genericArguments

The generic type arguments.

sb

The StringBuilder to which the type string should be written.

Top

Generated by ImmDoc .NET.


text:
if( DEFINED $ENV{TRILINOS_PATH} )
    find_package(Trilinos PATHS $ENV{TRILINOS_PATH}/lib/cmake/Trilinos $ENV{TRILINOS_PATH}/include )
endif()

if( TRILINOS_PATH )
    find_package(Trilinos PATHS ${TRILINOS_PATH}/lib/cmake/Trilinos ${TRILINOS_PATH}/include )
endif()

if( Trilinos_FOUND )

        set( TRILINOS_INCLUDE_DIRS "" )

        list( APPEND TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS} )
        list( APPEND TRILINOS_INCLUDE_DIRS ${Trilinos_TPL_INCLUDE_DIRS} )

        foreach( test_lib ${Trilinos_LIBRARIES} )
          if(NOT ${test_lib} STREQUAL "pytrilinos")
            find_library( ${test_lib}_lib ${test_lib} PATHS  ${Trilinos_LIBRARY_DIRS}  NO_DEFAULT_PATH)
            find_library( ${test_lib}_lib ${test_lib})
            mark_as_advanced( ${test_lib}_lib )
            list( APPEND TRILINOS_LIBRARIES ${${test_lib}_lib} )
          endif()
        endforeach()

        list( APPEND TRILINOS_LIBRARIES ${Trilinos_TPL_LIBRARIES} )

    set( TRILINOS_FOUND TRUE )
	set( TRILINOS_VERSION ${Trilinos_VERSION} )

endif()


text:
class MainController < ApplicationController
  def index
    if params[:sort] == 'downloads'
      @themes = Theme.order(downloads: :desc).page(params[:page]).per(20)
      @sorted_by = "Downloads"
    else
      @themes = Theme.order(stars: :desc).page(params[:page]).per(20)
      @sorted_by = "Stars"
    end
  end

  def pretty_theme_name(name)
    pretty = name.gsub('-', ' ')
    return pretty.titleize
  end

  def pretty_number(num)
    if num > 999
      return (num/1000).to_s + 'k'
    end
    return num
  end

  def repo_link(repo_name)
    return 'https://github.com/' + repo_name
  end

  helper_method :pretty_theme_name
  helper_method :pretty_number
  helper_method :repo_link
end


text:
//
//  QQLrcCell.m
//  QQMusic
//
//  Created by Apple on 16/5/18.
//  Copyright © 2016年 KeenLeung. All rights reserved.
//

#import "QQLrcCell.h"
#import "QQLrcLabel.h"

static NSString * const reuseId = @"lrcCell";

@interface QQLrcCell()

@property (weak, nonatomic) IBOutlet QQLrcLabel *lrcContentLabel;

@end

@implementation QQLrcCell

#pragma mark --------------------------
#pragma mark 重写 set

/** 给子控件赋值*/
- (void)setLrcModel:(QQLrcModel *)lrcModel{
    _lrcModel = lrcModel;

    self.lrcContentLabel.text = lrcModel.lrcStr;
}

/** 设置播放进度*/
- (void)setProgress:(CGFloat)progress{

    _progress = progress;

    self.lrcContentLabel.progress = progress;
}

#pragma mark --------------------------
#pragma mark 创建
+ (instancetype)cellWithTable:(UITableView *)tableView{

    QQLrcCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];

    if (cell == nil) {
        cell = [[NSBundle mainBundle] loadNibNamed:@"QQLrcCell" owner:nil options:nil].firstObject;
    }

    return cell;
}

@end


text:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Clients.Elasticsearch.Mapping;
using Tests.Core.Extensions;
using Tests.Core.ManagedElasticsearch.Clusters;

namespace Tests.Document.Multiple;

public abstract class BulkAllApiTestsBase : IClusterFixture<IntrusiveOperationCluster>
{
	protected BulkAllApiTestsBase(IntrusiveOperationCluster cluster) => Client = cluster.Client;

	protected ElasticsearchClient Client { get; }

	protected static string CreateIndexName() => $"project-copy-{Guid.NewGuid().ToString("N")[8..]}";

	protected static IEnumerable<SmallObject> CreateLazyStreamOfDocuments(int count)
	{
		for (var i = 0; i < count; i++)
			yield return new SmallObject() { Id = i };
	}

	//protected async Task CreateIndexAsync(string indexName, int numberOfShards, TypeMapping mappings = null)
	//{
	//	var result = await Client.IndexManagement.CreateIndexAsync(new Elastic.Clients.Elasticsearch.IndexManagement.CreateIndexRequest(indexName)
	//	{
	//		Settings = new Elastic.Clients.Elasticsearch.IndexManagement.IndexSettings
	//		{
	//			NumberOfReplicas = 0,
	//			NumberOfShards = numberOfShards
	//		},
	//		Mappings = mappings
	//	});

	//	//var result = await Client.IndexManagement.CreateIndexAsync(indexName, s => s
	//	//	.Settings(settings => settings
	//	//		.NumberOfShards(numberOfShards)
	//	//		.NumberOfReplicas(0)
	//	//	)
	//	//	.Map(mappings)
	//	//);

	//	result.Should().NotBeNull();
	//	result.ShouldBeValid();
	//}

	protected static void OnError(ref Exception ex, Exception e, EventWaitHandle handle)
	{
		ex = e;
		handle.Set();
		throw e;
	}

	protected class SmallObject
	{
		public int Id { get; set; }
		public string Number { get; set; }
	}
}


text:
/*
 * Author: Minho Kim (ISKU)
 * Date: February 15, 2018
 * E-mail: minho.kim093@gmail.com
 *
 * https://github.com/ISKU/Algorithm
 * http://codeforces.com/problemset/problem/932/A
 */

import java.util.*;

public class A {
	public static void main(String... args) {
		String line = new Scanner(System.in).next();
		System.out.print(line + new StringBuilder(line).reverse());
	}
}


text:
ALTER TABLE `discovery_discoveryitem` ADD COLUMN `recommendable` boolean NOT null DEFAULT 0;
ALTER TABLE `versions` ADD COLUMN `recommendation_approved` boolean NOT null DEFAULT 0;


text:
class Badge < ActiveRecord::Base
  belongs_to :story
end


text:
package org.efaps.jms;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;

import org.efaps.admin.user.Person;
import org.efaps.admin.user.UserAttributesSet;
import org.efaps.db.Context;
import org.efaps.jaas.LoginHandler;
import org.efaps.util.EFapsException;
import org.efaps.util.RandomUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * TODO comment!
 *
 * @author The eFaps Team
 */
public final class JmsSession
{
    /**
     * Logger for this class.
     */
    private static final Logger LOG = LoggerFactory.getLogger(JmsSession.class);

    /**
     * The map holds all cached Sessions.
     */
    private static final Map<String, JmsSession> CACHE = new HashMap<>();

    /**
     * Timer used to look for expired Session.
     */
    private static final Timer TIMER = new Timer();
    static {
        JmsSession.TIMER.schedule(new ExpireTask(), 0, 1000);
    }

    /**
     * Session timeout in seconds. Default 5 min = 300s.
     */
    private static int SESSIONTIMEOUT = 300;

    /**
     * This instance map stores the Attributes which are valid for the whole
     * session. It is passed on to the Context while opening it.
     *
     * @see #openContext()
     */
    private final Map<String, Object> sessionAttributes = new HashMap<>();

    /**
     * Key to this Session.
     */
    private final String sessionKey;

    /**
     * TimeStamp of the Session creation / last Context opening.
     */
    private Date timeStamp;

    /**
     * Name of the User this Session belongs to.
     */
    private final String userName;

    /**
     * Private Constructor.
     * @param _userName name of the user this Session belong to.
     * @throws EFapsException on error
     */
    private JmsSession(final String _userName)
        throws EFapsException
    {
        this.sessionKey = RandomUtil.randomAlphanumeric(15);
        this.timeStamp = new Date();
        this.userName = _userName;
    }

    /**
     * Getter method for the instance variable {@link #sessionKey}.
     *
     * @return value of instance variable {@link #sessionKey}
     */
    private String getSessionKey()
    {
        return this.sessionKey;
    }

    /**
     * Method to check if a user is checked in.
     *
     * @return true if a user is checked in, else false
     * @see #userName
     */
    public boolean isLogedIn()
    {
        boolean ret = false;
        if (this.userName != null) {
            ret = true;
        }
        return ret;
    }

    /**
     * Method that opens a new Context in eFaps, setting the User, the Locale,
     * the Attributes of this Session {@link #sessionAttributes}.
     * @throws EFapsException on error
     *
     * @see #attach()
     */
    public void openContext()
        throws EFapsException
    {
        if (isLogedIn()) {
            if (!Context.isTMActive()) {
                if (!this.sessionAttributes.containsKey(UserAttributesSet.CONTEXTMAPKEY)) {
                    Context.begin(null, Context.Inheritance.Local);
                    this.sessionAttributes.put(UserAttributesSet.CONTEXTMAPKEY, new UserAttributesSet(this.userName));
                    Context.rollback();
                }
                Context.begin(this.userName, null, this.sessionAttributes, null, null, Context.Inheritance.Local);
                this.timeStamp = new Date();
            }
        }
    }

    /**
     * Method that closes the opened Context {@link #openContext()}, by
     * committing or rollback it.
     * @throws EFapsException on error
     *
     * @see #detach()
     */
    public void closeContext()
        throws EFapsException
    {
        if (isLogedIn()) {
            try {
                if (!Context.isTMNoTransaction()) {
                    if (Context.isTMActive()) {
                        Context.commit();
                    } else {
                        Context.rollback();
                    }
                }
            } catch (final SecurityException e) {
                throw new EFapsException("SecurityException", e);
            } catch (final IllegalStateException e) {
                throw new EFapsException("IllegalStateException", e);
            }
        }
    }

    /**
     * Method to remove the current Session from the Cache.
     */
    public void logout()
    {
        JmsSession.CACHE.remove(getSessionKey());
    }
    /**
     * Getter method for the instance variable {@link #timeStamp}.
     *
     * @return value of instance variable {@link #timeStamp}
     */
    protected Date getTimeStamp()
    {
        return this.timeStamp;
    }

    /**
     * @param _sessionKey   get the Session for a given Key
     * @return if found Session for the given Sessionkey, else null
     */
    public static JmsSession getSession(final String _sessionKey)
    {
        return JmsSession.CACHE.get(_sessionKey);
    }

    /**
     * Login and create a Session.
     *
     * @param _userName         Name of the user to login
     * @param _passwd           Password of the user to login
     * @param _applicationKey   key of the application that requests
     * @return SessionKey if login successful, else null
     * @throws EFapsException on error
     */
    public static String login(final String _userName,
                               final String _passwd,
                               final String _applicationKey)
        throws EFapsException
    {
        String ret = null;
        if (JmsSession.checkLogin(_userName, _passwd, _applicationKey)) {
            final JmsSession session = new JmsSession(_userName);
            JmsSession.CACHE.put(session.getSessionKey(), session);
            ret = session.getSessionKey();
        }
        return ret;
    }

    /**
     * @param _userName         name of the User to login
     * @param _passwd           Password of the User
     * @param _applicationKey   key of the application that requests
     * @return true if login successfull, else false
     */
    private static boolean checkLogin(final String _userName,
                                      final String _passwd,
                                      final String _applicationKey)
    {
        boolean loginOk = false;
        Context context = null;
        try {
            if (Context.isTMActive()) {
                context = Context.getThreadContext();
            } else {
                context = Context.begin(null, Context.Inheritance.Local);
            }
            boolean ok = false;

            try {
                // on a new login the cache for Person is reseted
                Person.initialize();
                final LoginHandler loginHandler = new LoginHandler(_applicationKey);
                final Person person = loginHandler.checkLogin(_userName, _passwd);
                if (person != null && !person.getRoles().isEmpty()) {
                    loginOk = true;
                }
                ok = true;
            } finally {
                if (ok && Context.isTMActive()) {
                    Context.commit();
                } else {
                    if (Context.isTMMarkedRollback()) {
                        JmsSession.LOG.error("transaction is marked to roll back");
                    } else {
                        JmsSession.LOG.error("transaction manager in undefined status");
                    }
                    Context.rollback();
                }
            }
        } catch (final EFapsException e) {
            JmsSession.LOG.error("could not check name and password", e);
        } finally {
            context.close();
        }
        return loginOk;
    }

    /**
     * Setter method for variable {@link #SESSIONTIMEOUT}.
     *
     * @param _sessionTimeout value for variable {@link #SESSIONTIMEOUT}
     */

    protected static void setSessionTimeout(final int _sessionTimeout)
    {
        JmsSession.SESSIONTIMEOUT = _sessionTimeout;
    }

    /**
     * Expire the Session.
     */
    public static class ExpireTask
        extends TimerTask
    {
        @Override
        public void run()
        {
            final Date now = new Date();
            for (final Entry<String, JmsSession> entry : JmsSession.CACHE.entrySet()) {
                if (now.getTime() - entry.getValue().getTimeStamp().getTime() > 1000 * JmsSession.SESSIONTIMEOUT) {
                    entry.getValue().logout();
                }
            }
        }
    }
}


text:
module MessengerClient
  module Message
    Postback = Base.new(:timestamp, :sender, :_postback)
  end
end


text:
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "transport/EtchMessage.h"
#include "serialization/EtchValidatorBoolean.h"
#include "support/EtchRuntime.h"

class MockValueFactory7 : public virtual EtchValueFactory {
public:

  ~MockValueFactory7() {

  }
  MOCK_METHOD2(getType, status_t(capu::uint32_t id, EtchType*& result));

  MOCK_METHOD2(getType, status_t(EtchString& name, EtchType*& result));

  MOCK_METHOD1(addType, status_t(EtchType* type));

  MOCK_METHOD0(lockDynamicTypes, status_t());

  MOCK_METHOD0(unlockDynamicTypes, status_t());

  status_t getMessageId(EtchMessage* msg, capu::int64_t &result) {
    result = 0;
    return ETCH_OK;
  }

  MOCK_METHOD0(get_mf__messageId, EtchField());

  status_t getInReplyToMessageId(EtchMessage* msg, capu::int64_t &result) {
    result = 0;
    return ETCH_OK;
  }
  MOCK_METHOD2(setMessageId, status_t(EtchMessage* msg, capu::int64_t msgid));

  MOCK_METHOD2(setInReplyToMessageId, status_t(EtchMessage* msg, capu::int64_t msgid));

  MOCK_METHOD0(get_mf__inReplyTo, EtchField());

  MOCK_METHOD2(importCustomValue, status_t(EtchStructValue* _struct, capu::SmartPointer<EtchObject> &result));

  MOCK_METHOD2(exportCustomValue, status_t(capu::SmartPointer<EtchObject> value, EtchStructValue*& result));

  MOCK_METHOD0(get_mt__exception, EtchType*());

  MOCK_METHOD2(getCustomStructType, status_t(const EtchObjectType *c, EtchType *& type));

  MOCK_METHOD4(getNativeArrayForComponentType, status_t(const EtchObjectType *objectType,  capu::SmartPointer<EtchNativeArrayBase> &nativeArray, capu::int32_t length, capu::int32_t dim));

  EtchLevel getLevel() {
    return LEVEL_FULL;
  }

  MOCK_METHOD1(setLevel, EtchLevel(EtchLevel level));
private:
  capu::int64_t tmp;
};

class EtchMessageTest
  : public ::testing::Test {
protected:
  virtual void SetUp() {
    mRuntime = new EtchRuntime();
    mRuntime->start();
  }

  virtual void TearDown() {
    mRuntime->shutdown();
    delete mRuntime;
    mRuntime = NULL;

  }
  EtchRuntime* mRuntime;
};

TEST_F(EtchMessageTest, createTest) {
  EtchType *type = new EtchType("test");
  EtchValueFactory *factory = new MockValueFactory7();
  EtchMessage *message = new EtchMessage(type, factory);
  EXPECT_TRUE(message != NULL);
  delete message;
  delete type;
  delete factory;
}

TEST_F(EtchMessageTest, getMessageIdTests) {
  EtchType *type = new EtchType("test");
  EtchValueFactory *factory = new MockValueFactory7();
  EtchMessage *message = new EtchMessage(type, factory);
  EXPECT_TRUE(message != NULL);
  capu::int64_t tmp;
  EXPECT_TRUE(message->getInReplyToMessageId(tmp) == ETCH_OK);
  EXPECT_TRUE(message->getMessageId(tmp) == ETCH_OK);
  delete message;
  delete type;
  delete factory;
}

TEST_F(EtchMessageTest, getTypeTest) {
  EtchField field1("type1");
  EtchField field2("type2");

  //CreateType
  EtchType* comp = new EtchType(90, "comp");

  //fill validators
  capu::SmartPointer<EtchValidator> val1;
  EtchValidatorBoolean::Get(mRuntime, 0, val1);
  capu::SmartPointer<EtchValidator> val2;
  EtchValidatorBoolean::Get(mRuntime, 0, val2);
  comp->putValidator(field1, val1);
  comp->putValidator(field2, val2);

  //Create Value Factory
  EtchValueFactory* factory = new MockValueFactory7();

  //create message
  EtchMessage *sv = new EtchMessage(comp, factory);
  EXPECT_TRUE(sv->getType()->equals(comp));
  delete sv;
  delete factory;
  delete comp;
}

TEST_F(EtchMessageTest, isType) {
  //Type 1
  EtchField field1("type1");
  EtchField field2("type2");

  //CreateType
  EtchType* comp = new EtchType(90, "comp");

  capu::SmartPointer<EtchValidator> val1;
  EtchValidatorBoolean::Get(mRuntime, 0, val1);
  capu::SmartPointer<EtchValidator> val2;
  EtchValidatorBoolean::Get(mRuntime, 0, val2);
  comp->putValidator(field1, val1);
  comp->putValidator(field2, val2);
  //Create Value Factory
  EtchValueFactory* factory = new MockValueFactory7();
  //type 2
  EtchString typeName2("comp2");
  EtchType* comp2 = new EtchType(91, typeName2);

  EtchMessage *sv = new EtchMessage(comp, factory);
  EXPECT_TRUE(sv->isType(comp));
  EXPECT_FALSE(sv->isType(comp2));
  delete sv;
  delete factory;
  delete comp;
  delete comp2;
}

TEST_F(EtchMessageTest, putTest) {
  EtchString fieldtype1("type1");
  EtchString fieldtype2("type2");
  EtchString typeName("comp");

  EtchField field1(fieldtype1);
  EtchField field2(fieldtype2);
  //Create Value Factory
  EtchValueFactory* factory = new MockValueFactory7();
  //CreateType
  EtchType* comp = new EtchType(90, typeName);

  capu::SmartPointer<EtchValidator> val1;
  EtchValidatorBoolean::Get(mRuntime, 0, val1);
  capu::SmartPointer<EtchValidator> val2;
  EtchValidatorBoolean::Get(mRuntime, 0, val2);
  comp->putValidator(field1, val1);
  comp->putValidator(field2, val2);

  EtchMessage *sv = new EtchMessage(comp, factory);

  capu::SmartPointer<EtchObject> object = new EtchBool(true);
  capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
  capu::SmartPointer<EtchObject> object3 = NULL;

  //check the empty struct value
  EXPECT_TRUE(sv->count() == 0);
  //add new element
  EXPECT_TRUE(sv->put(field1, object) == ETCH_OK);
  EXPECT_TRUE(sv->count() == 1);
  //add another element
  EXPECT_TRUE(sv->put(field2, object2) == ETCH_OK);
  EXPECT_TRUE(sv->count() == 2);
  //add a null element and expect a remove operation
  EXPECT_TRUE(sv->put(field1, object3) == ETCH_OK);
  EXPECT_TRUE(sv->count() == 1);

  delete sv;
  delete factory;
  delete comp;
}

TEST_F(EtchMessageTest, getTest) {
  EtchString fieldtype1("type1");
  EtchString fieldtype2("type2");
  EtchField field1(fieldtype1);
  EtchField field2(fieldtype2);
  EtchString typeName("comp");
  EtchType* comp = new EtchType(90, typeName);

  capu::SmartPointer<EtchValidator> val1;
  EtchValidatorBoolean::Get(mRuntime, 0, val1);
  capu::SmartPointer<EtchValidator> val2;
  EtchValidatorBoolean::Get(mRuntime, 0, val2);
  comp->putValidator(field1, val1);
  comp->putValidator(field2, val2);

  //Create Value Factory
  EtchValueFactory* factory = new MockValueFactory7();
  //create struct value
  EtchMessage *sv = new EtchMessage(comp, factory);
  EXPECT_TRUE(0 == sv->count());

  //add element
  capu::SmartPointer<EtchObject> object = new EtchBool(true);
  EXPECT_TRUE(sv->put(field1, object) == ETCH_OK);
  EXPECT_TRUE(sv->count() == 1);

  //add another element
  capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
  EXPECT_TRUE(sv->put(field1, object2) == ETCH_OK);
  EXPECT_TRUE(sv->count() == 1);
  //get element
  EXPECT_TRUE(sv->get(field1, &object) == ETCH_OK);
  EXPECT_TRUE(((EtchBool*) object.get())->get() == false);

  delete sv;
  delete factory;
  delete comp;
}

TEST_F(EtchMessageTest, removeTest) {
  EtchString fieldtype1("type1");
  EtchString typeName("comp");
  EtchField field1(fieldtype1);
  EtchValueFactory* factory = new MockValueFactory7();

  EtchType* comp = new EtchType(90, typeName);

  capu::SmartPointer<EtchValidator> val1;
  EtchValidatorBoolean::Get(mRuntime, 0, val1);
  comp->putValidator(field1, val1);

  EtchMessage *sv = new EtchMessage(comp, factory);
  capu::SmartPointer<EtchObject> object;
  capu::SmartPointer<EtchObject> object2;
  //check the empty struct value
  EXPECT_TRUE(sv->count() == 0);
  EXPECT_TRUE(sv->get(field1, &object) == ETCH_ENOT_EXIST);

  //try to delete non existing element
  EXPECT_TRUE(sv->remove(field1, &object) == ETCH_ERANGE);
  EXPECT_TRUE(sv->count() == 0);
  EXPECT_TRUE(sv->get(field1, &object) == ETCH_ENOT_EXIST);

  //add element
  EtchObject* boolean = new EtchBool(true);
  sv->put(field1, boolean);
  EXPECT_TRUE(sv->count() == 1);
  EXPECT_TRUE(sv->get(field1, &object) == ETCH_OK);
  capu::SmartPointer<EtchBool> ptr = capu::smartpointer_cast<EtchBool> (object);
  EXPECT_TRUE((ptr->get()) == true);

  //delete element
  EXPECT_TRUE(sv->remove(field1, &object2) == ETCH_OK);
  EXPECT_TRUE(sv->count() == 0);
  EXPECT_TRUE(sv->get(field1, &object2) == ETCH_ENOT_EXIST);
  //try to delete non existing element
  EXPECT_TRUE(sv->remove(field1, &object2) == ETCH_ERANGE);
  EXPECT_TRUE(sv->count() == 0);
  EXPECT_TRUE(sv->get(field1, &object2) == ETCH_ENOT_EXIST);
  delete sv;
  delete comp;
  delete factory;
}


text:
Suite( "sortSmallArray" ).setup( function() {

  var BinaryTree = mota.PRIVATE_METHODS.BinaryTree;

  function defaultComparator( a, b ) {
    return a - b;
  }

  var b = new BinaryTree();

  var array = [];

  var func = function() {};

  var obj = function( num ) {
    return { depth: num };
  };

} ).add( "binary tree", function() {

  b.add( obj( 45 ) );
  b.add( obj( 128 ) );

  b.resetAndTraverse( func );

} ).add( "array.sort", function() {

  array.push( 45 );
  array.push( 128 );

  array.sort( defaultComparator );

  for ( var i = 0; i < array.length; i++ ) {
    array[ i ];
  }

} );


text:
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Experimental.Rendering.HDPipeline;

namespace UnityEditor.Experimental.Rendering.HDPipeline
{
    public class SerializedInfluenceVolume
    {
        internal SerializedProperty root;

        internal SerializedProperty shape;
        internal SerializedProperty boxSize;
        internal SerializedProperty boxBlendDistancePositive;
        internal SerializedProperty boxBlendDistanceNegative;
        internal SerializedProperty boxBlendNormalDistancePositive;
        internal SerializedProperty boxBlendNormalDistanceNegative;
        internal SerializedProperty boxSideFadePositive;
        internal SerializedProperty boxSideFadeNegative;
        internal SerializedProperty sphereRadius;
        internal SerializedProperty sphereBlendDistance;
        internal SerializedProperty sphereBlendNormalDistance;

        internal SerializedProperty editorAdvancedModeBlendDistancePositive;
        internal SerializedProperty editorAdvancedModeBlendDistanceNegative;
        internal SerializedProperty editorSimplifiedModeBlendDistance;
        internal SerializedProperty editorAdvancedModeBlendNormalDistancePositive;
        internal SerializedProperty editorAdvancedModeBlendNormalDistanceNegative;
        internal SerializedProperty editorSimplifiedModeBlendNormalDistance;
        internal SerializedProperty editorAdvancedModeEnabled;
        internal SerializedProperty editorAdvancedModeFaceFadePositive;
        internal SerializedProperty editorAdvancedModeFaceFadeNegative;

        public SerializedInfluenceVolume(SerializedProperty root)
        {
            this.root = root;

            shape = root.Find((InfluenceVolume i) => i.shape);
            boxSize = root.Find((InfluenceVolume i) => i.boxSize);
            boxBlendDistancePositive = root.Find((InfluenceVolume i) => i.boxBlendDistancePositive);
            boxBlendDistanceNegative = root.Find((InfluenceVolume i) => i.boxBlendDistanceNegative);
            boxBlendNormalDistancePositive = root.Find((InfluenceVolume i) => i.boxBlendNormalDistancePositive);
            boxBlendNormalDistanceNegative = root.Find((InfluenceVolume i) => i.boxBlendNormalDistanceNegative);
            boxSideFadePositive = root.Find((InfluenceVolume i) => i.boxSideFadePositive);
            boxSideFadeNegative = root.Find((InfluenceVolume i) => i.boxSideFadeNegative);
            sphereRadius = root.Find((InfluenceVolume i) => i.sphereRadius);
            sphereBlendDistance = root.Find((InfluenceVolume i) => i.sphereBlendDistance);
            sphereBlendNormalDistance = root.Find((InfluenceVolume i) => i.sphereBlendNormalDistance);

            editorAdvancedModeBlendDistancePositive = root.FindPropertyRelative("m_EditorAdvancedModeBlendDistancePositive");
            editorAdvancedModeBlendDistanceNegative = root.FindPropertyRelative("m_EditorAdvancedModeBlendDistanceNegative");
            editorSimplifiedModeBlendDistance = root.FindPropertyRelative("m_EditorSimplifiedModeBlendDistance");
            editorAdvancedModeBlendNormalDistancePositive = root.FindPropertyRelative("m_EditorAdvancedModeBlendNormalDistancePositive");
            editorAdvancedModeBlendNormalDistanceNegative = root.FindPropertyRelative("m_EditorAdvancedModeBlendNormalDistanceNegative");
            editorSimplifiedModeBlendNormalDistance = root.FindPropertyRelative("m_EditorSimplifiedModeBlendNormalDistance");
            editorAdvancedModeEnabled = root.FindPropertyRelative("m_EditorAdvancedModeEnabled");
            editorAdvancedModeFaceFadePositive = root.FindPropertyRelative("m_EditorAdvancedModeFaceFadePositive");
            editorAdvancedModeFaceFadeNegative = root.FindPropertyRelative("m_EditorAdvancedModeFaceFadeNegative");

            //handle data migration from before editor value were saved
            if (editorAdvancedModeBlendDistancePositive.vector3Value == Vector3.zero
                && editorAdvancedModeBlendDistanceNegative.vector3Value == Vector3.zero
                && editorSimplifiedModeBlendDistance.floatValue == 0f
                && editorAdvancedModeBlendNormalDistancePositive.vector3Value == Vector3.zero
                && editorAdvancedModeBlendNormalDistanceNegative.vector3Value == Vector3.zero
                && editorSimplifiedModeBlendNormalDistance.floatValue == 0f
                && (boxBlendDistancePositive.vector3Value != Vector3.zero
                    || boxBlendDistanceNegative.vector3Value != Vector3.zero
                    || boxBlendNormalDistancePositive.vector3Value != Vector3.zero
                    || boxBlendNormalDistanceNegative.vector3Value != Vector3.zero))
            {
                Vector3 positive = boxBlendDistancePositive.vector3Value;
                Vector3 negative = boxBlendDistanceNegative.vector3Value;
                //exact advanced
                editorAdvancedModeBlendDistancePositive.vector3Value = positive;
                editorAdvancedModeBlendDistanceNegative.vector3Value = negative;
                //approximated simplified, exact if it was simplified
                editorSimplifiedModeBlendDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);

                positive = boxBlendNormalDistancePositive.vector3Value;
                negative = boxBlendNormalDistanceNegative.vector3Value;
                //exact advanced
                editorAdvancedModeBlendNormalDistancePositive.vector3Value = positive;
                editorAdvancedModeBlendNormalDistanceNegative.vector3Value = negative;
                //approximated simplified, exact if it was simplified
                editorSimplifiedModeBlendNormalDistance.floatValue = Mathf.Max(positive.x, positive.y, positive.z, negative.x, negative.y, negative.z);

                //display old data
                editorAdvancedModeEnabled.boolValue =
                       positive.x != positive.y
                    || positive.x != positive.z
                    || negative.x != negative.y
                    || negative.x != negative.z
                    || positive.x != negative.x;
                Apply();
            }
            if(editorAdvancedModeFaceFadePositive.vector3Value == Vector3.one
                && editorAdvancedModeFaceFadeNegative.vector3Value == Vector3.one
                && (boxSideFadePositive.vector3Value != Vector3.one
                    || boxSideFadeNegative.vector3Value != Vector3.one))
            {
                editorAdvancedModeFaceFadePositive.vector3Value = boxSideFadePositive.vector3Value;
                editorAdvancedModeFaceFadeNegative.vector3Value = boxSideFadeNegative.vector3Value;
                if(!editorAdvancedModeEnabled.boolValue)
                {
                    boxSideFadePositive.vector3Value = Vector3.one;
                    boxSideFadeNegative.vector3Value = Vector3.one;
                }
                Apply();
            }
        }

        public void Apply()
        {
            root.serializedObject.ApplyModifiedProperties();
        }
    }
}


text:
'use strict';

var worker_service_impl = require('./worker_service_impl');

var grpc = require('../../../');
var serviceProto = grpc.load({
  root: __dirname + '/../../..',
  file: 'src/proto/grpc/testing/services.proto'}).grpc.testing;

function runServer(port) {
  var server_creds = grpc.ServerCredentials.createInsecure();
  var server = new grpc.Server();
  server.addProtoService(serviceProto.WorkerService.service,
                         worker_service_impl);
  var address = '0.0.0.0:' + port;
  server.bind(address, server_creds);
  server.start();
  return server;
}

if (require.main === module) {
  Error.stackTraceLimit = Infinity;
  var parseArgs = require('minimist');
  var argv = parseArgs(process.argv, {
    string: ['driver_port']
  });
  runServer(argv.driver_port);
}

exports.runServer = runServer;


text:
package com.target.model;

import java.io.Serializable;
import java.lang.String;
import javax.persistence.*;
import javax.persistence.NamedQueries;

@NamedQueries(value={@NamedQuery(name="pessoa.list", query="select p from Pessoa p"),
@NamedQuery(name="pessoa.listLikeNome", query="select p from Pessoa p where p.nome like :nome")})
@Entity
@NamedQuery(name="pessoa.listByName", query="select p from Pessoa p where p.nome = :name")
public class  Pessoa implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "PESSOA_ID")
	private int id;

	private String rg;
	private String nome;

	public Pessoa() {
		super();
	}
	public Pessoa(String rg, String nome) {
		super();
		this.rg = rg;
		this.nome = nome;
	}

	public int getId() {
		return id;	}

	public void setId(int id) {
		this.id = id;
	}
	public String getRg() {
		return this.rg;
	}
	public void setRg(String rg) {
		this.rg = rg;
	}
	public String getNome() {
		return this.nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
}


text:
lib = File.expand_path File.dirname(__FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'foundational/model/version'
require 'foundational/model/model'


text:
/**
 * @fileoverview Base layer that layers in a story page extend from.
 */

import {Layout} from '../../../src/layout';

/**
 * Base layer template.
 */
export class AmpStoryBaseLayer extends AMP.BaseElement {
  /** @param {!AmpElement} element */
  constructor(element) {
    super(element);
  }

  /** @override */
  isLayoutSupported(layout) {
    return layout == Layout.CONTAINER;
  }

  /** @override */
  buildCallback() {
    this.element.classList.add('i-amphtml-story-layer');
  }
}


text:
module PhonesHelper
end


text:
using System;
using Http.chunk;
using Http.last_chunk;
using Http.trailer_part;
using JetBrains.Annotations;
using Txt.ABNF;
using Txt.ABNF.Core.CRLF;
using Txt.Core;

namespace Http.chunked_body
{
    public sealed class ChunkedBodyLexerFactory : RuleLexerFactory<ChunkedBody>
    {
        static ChunkedBodyLexerFactory()
        {
            Default = new ChunkedBodyLexerFactory(
                chunk.ChunkLexerFactory.Default.Singleton(),
                last_chunk.LastChunkLexerFactory.Default.Singleton(),
                trailer_part.TrailerPartLexerFactory.Default.Singleton(),
                Txt.ABNF.Core.CRLF.NewLineLexerFactory.Default.Singleton());
        }

        public ChunkedBodyLexerFactory(
            [NotNull] ILexerFactory<Chunk> chunkLexerFactory,
            [NotNull] ILexerFactory<LastChunk> lastChunkLexerFactory,
            [NotNull] ILexerFactory<TrailerPart> trailerPartLexerFactory,
            [NotNull] ILexerFactory<NewLine> newLineLexerFactory)
        {
            if (chunkLexerFactory == null)
            {
                throw new ArgumentNullException(nameof(chunkLexerFactory));
            }
            if (lastChunkLexerFactory == null)
            {
                throw new ArgumentNullException(nameof(lastChunkLexerFactory));
            }
            if (trailerPartLexerFactory == null)
            {
                throw new ArgumentNullException(nameof(trailerPartLexerFactory));
            }
            if (newLineLexerFactory == null)
            {
                throw new ArgumentNullException(nameof(newLineLexerFactory));
            }
            ChunkLexerFactory = chunkLexerFactory;
            LastChunkLexerFactory = lastChunkLexerFactory;
            TrailerPartLexerFactory = trailerPartLexerFactory;
            NewLineLexerFactory = newLineLexerFactory;
        }

        [NotNull]
        public static ChunkedBodyLexerFactory Default { get; }

        [NotNull]
        public ILexerFactory<Chunk> ChunkLexerFactory { get; }

        [NotNull]
        public ILexerFactory<LastChunk> LastChunkLexerFactory { get; }

        [NotNull]
        public ILexerFactory<NewLine> NewLineLexerFactory { get; }

        [NotNull]
        public ILexerFactory<TrailerPart> TrailerPartLexerFactory { get; }

        public override ILexer<ChunkedBody> Create()
        {
            var innerLexer = Concatenation.Create(
                Repetition.Create(ChunkLexerFactory.Create(), 0, int.MaxValue),
                LastChunkLexerFactory.Create(),
                TrailerPartLexerFactory.Create(),
                NewLineLexerFactory.Create());
            return new ChunkedBodyLexer(innerLexer);
        }
    }
}


text:
package buffer

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"sort"
	"strings"
	"sync"

	"github.com/mkocikowski/hbuf/message"
	"github.com/mkocikowski/hbuf/segment"
	"github.com/mkocikowski/hbuf/stats"
)

type Consumer struct {
	ID string
	N  int
}

const (
	DefaultBufferMaxBytes     = 1 << 30 // 1GiB
	DefaultBufferMaxSegments  = 16
	DefaultMessageMaxBytes    = 1 << 24 // 16MiB
	DefaultSegmentMaxBytes    = 1 << 26 // 64MiB
	DefaultSegmentMaxMessages = 1 << 16 // number of messages impacts random seek time
)

type Config struct {
	BufferMaxBytes     int64 `json:"buffer_max_bytes"`
	BufferMaxSegments  int   `json:"buffer_max_segments"`
	MessageMaxBytes    int32 `json:"message_max_bytes"`
	SegmentMaxBytes    int64 `json:"segment_max_bytes"`
	SegmentMaxMessages int   `json:"segment_max_messages"`
}

func DefaultConfig() *Config {
	return &Config{
		BufferMaxBytes:     DefaultBufferMaxBytes,
		BufferMaxSegments:  DefaultBufferMaxSegments,
		MessageMaxBytes:    DefaultMessageMaxBytes,
		SegmentMaxBytes:    DefaultSegmentMaxBytes,
		SegmentMaxMessages: DefaultSegmentMaxMessages,
	}
}

var (
	ErrorBufferClosed = fmt.Errorf("buffer closed")
)

type Buffer struct {
	*Config
	ID         string `json:"id"`
	URL        string `json:"url"`
	Tenant     string `json:"tenant"`
	Controller string `json:"-"`
	Path       string `json:"dir"`
	Len        int    `json:"len"`
	sha        []byte
	running    bool
	replicas   map[string]*replica
	consumers  map[string]*Consumer
	segments   []*segment.Segment
	lock       *sync.Mutex
}

func (b *Buffer) Init() error {
	//
	if b.Config == nil {
		b.Config = DefaultConfig()
	}
	b.lock = new(sync.Mutex)
	if err := os.MkdirAll(b.Path, 0755); err != nil {
		return fmt.Errorf("error creating buffer dir: %v", err)
	}
	if err := b.openSegments(); err != nil {
		return fmt.Errorf("error opening segments: %v", err)
	}
	if err := b.loadConsumers(); err != nil {
		return fmt.Errorf("error loading consumers: %v", err)
	}
	b.running = true
	return nil
}

func (b *Buffer) openSegments() error {
	//
	b.segments = make([]*segment.Segment, 0)
	files, _ := ioutil.ReadDir(b.Path)
	segments := make([]string, 0, len(files))
	for _, f := range files {
		if !strings.HasPrefix(f.Name(), "segment_") {
			continue
		}
		segments = append(segments, f.Name())
	}
	if len(segments) == 0 {
		return nil
	}
	sort.Strings(segments)
	for _, f := range segments {
		p := filepath.Join(b.Path, f)
		s, err := segment.Open(p)
		if err != nil {
			return fmt.Errorf("error opening segment %q: %v", p, err)
		}
		b.segments = append(b.segments, s)
	}
	s := b.segments[len(b.segments)-1]
	b.Len = s.First + s.Len()
	m, err := s.Last()
	if err != nil {
		return fmt.Errorf("error getting last message from last segment: %v", err)
	}
	b.sha = m.Sha
	return nil
}

func (b *Buffer) loadConsumers() error {
	//
	b.consumers = make(map[string]*Consumer)
	f := filepath.Join(b.Path, "offsets")
	d, err := ioutil.ReadFile(f)
	if os.IsNotExist(err) {
		return nil
	}
	if err != nil {
		return fmt.Errorf("error reading consumer offsets: %v", err)
	}
	if err := json.Unmarshal(d, &b.consumers); err != nil {
		return fmt.Errorf("error parsing consumer offsets: %v", err)
	}
	return nil
}

func (b *Buffer) saveConsumers() error {
	//
	j, _ := json.Marshal(b.consumers)
	f := filepath.Join(b.Path, "offsets")
	if err := ioutil.WriteFile(f, j, 0644); err != nil {
		return fmt.Errorf("error saving consumer offsets: %v", err)
	}
	return nil
}

func (b *Buffer) Consumers() []byte {
	b.lock.Lock()
	defer b.lock.Unlock()
	j, _ := json.Marshal(b.consumers)
	return j
}

func (b *Buffer) SetReplicas(replicas []string) {
	//
	if b.replicas == nil {
		b.replicas = make(map[string]*replica)
	}
	for _, r := range replicas {
		if _, ok := b.replicas[r]; ok {
			continue
		}
		n := &replica{ID: r, manager: b.Controller, buffer: b}
		n.Init()
		b.lock.Lock()
		b.replicas[r] = n
		b.lock.Unlock()
		log.Printf("set replica %q for buffer %q", n.ID, b.ID)
	}
}

func (b *Buffer) Stop() {
	//
	b.lock.Lock()
	b.running = false
	for _, r := range b.replicas {
		r.Stop()
	}
	for _, s := range b.segments {
		s.Close()
	}
	b.lock.Unlock()
	if err := b.saveConsumers(); err != nil {
		log.Println(err)
	}
	log.Printf("buffer %q stopped", b.ID)
}

func (b *Buffer) Delete() error {
	b.Stop()
	return os.RemoveAll(b.Path)
}

// ---------------------------------------------------------------------

func (b *Buffer) trimSegments() error {
	//
	var s *segment.Segment
	for len(b.segments) > b.BufferMaxSegments {
		s, b.segments = b.segments[0], b.segments[1:]
		s.Close()
		if err := os.Remove(s.Path); err != nil {
			log.Printf("error removing segment file: %v", err)
		}
	}
	return nil
}

func (b *Buffer) addSegment() error {
	//
	if len(b.segments) > 0 {
		b.segments[len(b.segments)-1].Close()
	}
	s, err := segment.New(b.Path, b.Len)
	if err != nil {
		return fmt.Errorf("error creating segment: %v", err)
	}
	b.segments = append(b.segments, s)
	return nil
}

func (b *Buffer) getSegment() (*segment.Segment, error) {
	//
	if len(b.segments) == 0 {
		if err := b.addSegment(); err != nil {
			return nil, err
		}
	}
	s := b.segments[len(b.segments)-1]
	switch {
	case s.Len() >= b.SegmentMaxMessages:
		fallthrough
	case s.SizeB() >= b.SegmentMaxBytes:
		if err := b.addSegment(); err != nil {
			return nil, err
		}
		s = b.segments[len(b.segments)-1]
	}
	if err := b.trimSegments(); err != nil {
		return nil, err
	}
	return s, nil
}

func (b *Buffer) write(m *message.Message) error {
	//
	var err error
	b.lock.Lock()
	defer b.lock.Unlock()
	// "normal" messages don't have their id set ahead of time; they get their
	// id assigned based on the length of the buffer; however replica messages
	// have their id set when sent from the origin, so that if a new replica
	// buffer is being started not at 0 offset, the replica buffer knows what
	// to set the first id to; also, so that it can verify correct ids are sent
	if m.ID == 0 {
		m.ID = b.Len
	}
	if m.ID != b.Len {
		if b.Len != 0 {
			return fmt.Errorf("message id doesn't match current buffer length")
		}
		// starting new buffer not at 0, likely for replication
		b.Len = m.ID
	}
	s, err := b.getSegment()
	if err != nil {
		return err
	}
	m.Sum(b.sha)
	if err := s.Write(m); err != nil {
		return err
	}
	b.Len += 1
	b.sha = m.Sha
	// this signals to replicas that there is data to be syncd
	for _, r := range b.replicas {
		select {
		case r.data <- true:
		default:
		}
	}
	return nil
}

func (b *Buffer) Write(m *message.Message) error {
	b.lock.Lock()
	running := b.running
	b.lock.Unlock()
	if !running {
		return fmt.Errorf("buffer closed")
	}
	err := b.write(m)
	return err
}

// ---------------------------------------------------------------------

func (b *Buffer) read(id int) (*message.Message, error) {
	if len(b.segments) == 0 {
		return nil, segment.ErrorOutOfBounds
	}
	if b.segments[0].First > id {
		// likely the segment containing the message has been trimmed
		return nil, segment.ErrorOutOfBounds
	}
	var i int
	for j, s := range b.segments {
		// TODO: what if the segment containing the message has been deleted?
		if s.First > id {
			break
		}
		i = j
	}
	s := b.segments[i]
	n := id - s.First
	return s.Read(n)
}

func (b *Buffer) Read(id int) (*message.Message, error) {
	if !b.running {
		return nil, fmt.Errorf("buffer not running")
	}
	b.lock.Lock()
	defer b.lock.Unlock()
	return b.read(id)
}

// get the message with specified id, on the next message with higher id (there
// could be a gap say if segments have been trimmed)
func (b *Buffer) next(id int) (*message.Message, error) {
	if len(b.segments) == 0 {
		return nil, segment.ErrorOutOfBounds
	}
	if b.segments[0].First > id {
		// likely the segment containing the message has been trimmed
		id = b.segments[0].First
	}
	var i int
	for j, s := range b.segments {
		if s.First > id {
			break
		}
		i = j
	}
	s := b.segments[i]
	n := id - s.First
	return s.Read(n)
}

func (b *Buffer) Consume(id string) (*message.Message, error) {
	if !b.running {
		return nil, fmt.Errorf("buffer not running")
	}
	b.lock.Lock()
	defer b.lock.Unlock()
	c, ok := b.consumers[id]
	if !ok {
		c = &Consumer{ID: id}
		b.consumers[id] = c
	}
	m, err := b.next(c.N)
	if err == nil {
		c.N = m.ID + 1
		// TODO: optimize this
		// cutting this out improves performance 100x
		b.saveConsumers()
		stats.Stats <- &stats.Stat{Name: "buffer_message_consume_n", Kind: stats.Counter, IntVal: 1}
		stats.Stats <- &stats.Stat{Name: "buffer_message_consume_b", Kind: stats.Counter, IntVal: len(m.Body)}
	}
	return m, err
}