text:
package DLX;

import org.junit.Assert;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.stream.IntStream;

public class dancingLinksTest {

    private byte[][] rightDownLinks(columnObject root, byte[][] inMatrix) {
        byte[][] matrix = new byte[inMatrix.length][inMatrix[0].length];

        columnObject j = root.right;
        columnObject n;
        while (!j.equals(root)) {
            n = j.down;
            while (!n.equals(j)) {
                matrix[n.i][n.j] = 1;
                n = n.down;
            }
            j = j.right;
        }

        return matrix;
    }

    private byte[][] leftUpLinks(columnObject root, byte[][] inMatrix) {
        byte[][] outMatrix = new byte[inMatrix.length][inMatrix[0].length];

        columnObject j = root.right;
        columnObject n;
        while (!j.equals(root)) {
            n = j.down;
            while (!n.equals(j)) {
                outMatrix[n.i][n.j] = 1;
                n = n.down;
            }
            j = j.right;
        }

        return outMatrix;
    }

    private boolean testUpDownAndListHeaderHorizontalLinks(columnObject root, byte[][] m) {
        boolean a = Arrays.deepEquals(m, leftUpLinks(root, m));
        boolean b = Arrays.deepEquals(m, rightDownLinks(root, m));

        return a && b;
    }

    private boolean testRightHorizontalLinks(columnObject root, byte[][] m) {
        // iterate over every item in circularly linked list
        // for every columnObject (not ListHeader) element sum row, check that sum from matrix is the same
        columnObject j = root.right;
        columnObject n;
        while (!j.equals(root)) {
            n = j.down;
            while (!n.equals(j)) {

                columnObject k = n.right; // row iterator
                int sum = 1;
                while (!k.equals(n)) {
                    sum++;
                    k = k.right;
                }

                byte[] row = m[n.i];
                int matrixSum = IntStream.range(0, row.length).filter(a -> row[a] == 1).toArray().length;

                if (sum != matrixSum) return false;

                n = n.down;
            }
            j = j.right;
        }
        return true;
    }

    private boolean testLeftHorizontalLinks(columnObject root, byte[][] m) {
        // iterate over every item in circularly linked list
        // for every columnObject (not ListHeader) element sum row, check that sum from matrix is the same
        columnObject j = root.right;
        columnObject n;
        while (!j.equals(root)) {
            n = j.down;
            while (!n.equals(j)) {

                columnObject k = n.left; // row iterator
                int sum = 1;
                while (!k.equals(n)) {
                    sum++;
                    k = k.left;
                }

                byte[] row = m[n.i];
                int matrixSum = IntStream.range(0, row.length).filter(a -> row[a] == 1).toArray().length;

                if (sum != matrixSum) return false;

                n = n.down;
            }
            j = j.right;
        }
        return true;
    }

    private boolean testColumnObjectHorizontalLinks(columnObject root, byte[][] m) {
        boolean a = testRightHorizontalLinks(root, m);
        boolean b = testLeftHorizontalLinks(root, m);

        return a && b;
    }

    private boolean testColumnSizeField(columnObject root) {
        columnObject j = root.right;
        columnObject n;
        while (!j.equals(root)) {
            n = j.down;
            int listHeaderSize = n.columnHead.size;
            int sum = 0;
            while (!n.equals(j)) {
                sum++;
                n = n.down;
            }

            if (listHeaderSize != sum) return false;

            j = j.right;
        }
        return true;
    }

    @Test
    public void testConstructor() throws Exception {
        // Matrix from knuths paper
        byte[][] testMatrix = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {1, 0, 0, 1, 0, 0, 1},
                {0, 1, 1, 0, 0, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 1, 1, 0, 1}
        };

        Object[] listHeaders = new String[]{"0", "1", "2", "3", "4", "5", "6"};

        listHeader root = dancingLinks.createCircularlyLinkedLists(testMatrix, listHeaders);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnSizeField(root));
    }

    @Test
    public void testCreateSecondaryColumn() throws Exception {

        // Matrix from knuths paper
        byte[][] testMatrix = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {1, 0, 0, 1, 0, 0, 1},
                {0, 1, 1, 0, 0, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 1, 1, 0, 1}
        };

        Object[] listHeaders = new String[]{"0", "1", "2", "3", "4", "5", "6"};

        // what output from leftUpLinks and rightDownLinks should look like
        byte[][] matrixSecondaryColumn = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 1, 0, 0, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 0},
                {0, 0, 0, 1, 1, 0, 0}
        };

        listHeader root = dancingLinks.createCircularlyLinkedLists(testMatrix, listHeaders);

        dancingLinks.createSecondaryColumn(root);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, matrixSecondaryColumn));
        Assert.assertTrue(testColumnSizeField(root));
        // horizontal column object links should still be as in original matrix
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, testMatrix));
    }

    @Test
    public void testCoverColumn() throws Exception {
        // Matrix from knuths paper
        byte[][] testMatrix = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {1, 0, 0, 1, 0, 0, 1},
                {0, 1, 1, 0, 0, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 1, 1, 0, 1}
        };

        Object[] listHeaders = new String[]{"0", "1", "2", "3", "4", "5", "6"};

        // what output from leftUpLinks and rightDownLinks should look like
        byte[][] matrixCover = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {0, 0, 0, 0, 0, 0, 0}, // <--
                {0, 1, 1, 0, 0, 1, 0},
                {0, 0, 0, 0, 0, 0, 0}, // <--
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 1, 1, 0, 1}
        };
        //       ^
        //       |
        //     root.right

        listHeader root = dancingLinks.createCircularlyLinkedLists(testMatrix, listHeaders);

        dancingLinks.coverColumn(root.right);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, matrixCover));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, matrixCover));
        Assert.assertTrue(testColumnSizeField(root));

        // cover another column

        // what output from leftUpLinks and rightDownLinks should look like
        byte[][] matrixCover2 = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {0, 0, 0, 0, 0, 0, 0},
                {0, 1, 1, 0, 0, 1, 0},
                {0, 0, 0, 0, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 0, 0, 0, 0} // <--
        };
        //          ^     ^
        //          |     |
        //  root.right   root.right.right.right

        dancingLinks.coverColumn(root.right.right.right);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, matrixCover2));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, matrixCover2));
        Assert.assertTrue(testColumnSizeField(root));

        // cover all

        // what output from leftUpLinks and rightDownLinks should look like
        byte[][] matrixCover3 = new byte[][]{
                {0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0}
        };

        while (!root.right.equals(root)) dancingLinks.coverColumn(root.right);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, matrixCover3));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, matrixCover3));
        Assert.assertTrue(testColumnSizeField(root));
    }

    @Test
    public void testUncoverColumn() throws Exception {

        Random rand = new Random();

        byte[][] testMatrix = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {1, 0, 0, 1, 0, 0, 1},
                {0, 1, 1, 0, 0, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 1, 1, 0, 1}
        };

        Object[] listHeaders = new String[]{"0", "1", "2", "3", "4", "5", "6"};

        listHeader root = dancingLinks.createCircularlyLinkedLists(testMatrix, listHeaders);

        testRightHorizontalLinks(root, testMatrix);

        // cover one column
        columnObject c = root.right;
        dancingLinks.coverColumn(c);
        dancingLinks.uncoverColumn(c);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnSizeField(root));

        // cover two columns
        columnObject c1 = root.right.right.right;
        dancingLinks.coverColumn(c);
        dancingLinks.coverColumn(c1);
        dancingLinks.uncoverColumn(c);
        dancingLinks.uncoverColumn(c1);

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnSizeField(root));

        columnObject[] coveredColumns = new columnObject[listHeaders.length];
        int i = 0;
        columnObject n;
        // cover all the columns randomly
        while (!root.right.equals(root)) {
            n = root;
            int r = rand.nextInt(10);
            int j = 0;
            boolean o = rand.nextBoolean();
            while (j < r) {
                if (o) n = n.right;
                else n = n.left;
                j++;
            }
            if (!n.equals(root)) {
                dancingLinks.coverColumn(n);
                coveredColumns[i] = n;
                i++;
            }
        }

        // uncover in reverse
        for (int k = coveredColumns.length - 1; k > -1; k--) {
            if (coveredColumns[k] != null) {
                dancingLinks.uncoverColumn(coveredColumns[k]);
            }
        }

        Assert.assertTrue(testUpDownAndListHeaderHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnObjectHorizontalLinks(root, testMatrix));
        Assert.assertTrue(testColumnSizeField(root));

    }

    @Test
    public void testDlx() throws Exception {
        // This test sorta sucks. I'm not sure how to fix it at the moment.

        byte[][] testMatrix = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0},
                {1, 0, 0, 1, 0, 0, 1},
                {0, 1, 1, 0, 0, 1, 0},
                {1, 0, 0, 1, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1},
                {0, 0, 0, 1, 1, 0, 1},
                {0, 1, 0, 0, 0, 0, 1} // duplicate row to test that all solutions are actually produced
        };

        Object[] listHeaders = new String[]{"0", "1", "2", "3", "4", "5", "6"};

        ArrayList<Object[]> sol1 = dancingLinks.firstSolution(testMatrix, listHeaders, 0);

        ArrayList<ArrayList<Object[]>> allSol = dancingLinks.allSolutions(testMatrix, listHeaders, 0);

        for (ArrayList<Object[]> i : allSol) {
            System.out.println("sol ========");
            for (Object[] oa : i) {
                System.out.println(Arrays.deepToString(oa));
            }

        }

        Assert.assertTrue(allSol.size() == 2);
        Assert.assertTrue(sol1.size() == 3);

    }

    @Test
    public void testDlxWithSecondaryColumn() throws Exception {

        byte[][] testMatrix1 = new byte[][]{
                {0, 0, 1, 0, 1, 1, 0, 0},
                {1, 0, 0, 1, 0, 0, 1, 0},
                {0, 1, 1, 0, 0, 1, 0, 0},
                {1, 0, 0, 1, 0, 0, 0, 0},
                {0, 1, 0, 0, 0, 0, 1, 0},
                {0, 0, 0, 1, 1, 0, 1, 0},
                {0, 1, 0, 0, 0, 0, 1, 0} // duplicate row to test that all solutions are actually produced
        };

        Object[] listHeaders1 = new String[]{"0", "1", "2", "3", "4", "5", "6", "7"};

        ArrayList<ArrayList<Object[]>> allSol1 = dancingLinks.allSolutions(testMatrix1, listHeaders1, 1);

        for (ArrayList<Object[]> i : allSol1) {
            System.out.println("sol ========");
            for (Object[] oa : i) {
                System.out.println(Arrays.deepToString(oa));
            }

        }

        Assert.assertTrue(allSol1.size() == 2);
    }

    public void printArray(byte[][] m) {
        for (byte[] row : m) {
            System.out.println(Arrays.toString(row));
        }
    }
}


text:
namespace RDKit {
namespace CIPLabeler {

Edge::Edge(Node *beg, Node *end, Bond *bond)
    : dp_beg{beg}, dp_end{end}, dp_bond{bond} {}

Node *Edge::getOther(const Node *node) const {
  PRECONDITION(node, "bad node")

  if (isBeg(node)) {
    return getEnd();
  } else if (isEnd(node)) {
    return getBeg();
  } else {
    throw std::runtime_error("Not an end-point of this edge!");
  }
}

Node *Edge::getBeg() const { return dp_beg; }

Node *Edge::getEnd() const { return dp_end; }

Bond *Edge::getBond() const { return dp_bond; }

Descriptor Edge::getAux() const { return d_aux; }

bool Edge::isBeg(const Node *node) const { return node == dp_beg; }

bool Edge::isEnd(const Node *node) const { return node == dp_end; }

void Edge::setAux(Descriptor aux) { d_aux = std::move(aux); }

void Edge::flip() { std::swap(dp_beg, dp_end); }

}  // namespace CIPLabeler
}  // namespace RDKit

redpajama_set_name: RedPajamaGithub


text:
class AddActiveToPlans < ActiveRecord::Migration
  def change
    add_column :plans, :active, :boolean, default: true
    Plan.find_by(stripe_id: 'hobby-plan').try(:update_column, :active, false)
  end

  class Plan < ActiveRecord::Base; end
end


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

## Pre-flight Check ----------------------------------------------------------
# Clear the screen and make sure the user understands whats happening.
clear

# NOTICE: To run this in an automated fashion run the script via
#   root@HOSTNAME:/opt/os-ansible-deployment# echo "YES" | bash scripts/upgrade-v10-2-v11.sh

# Notify the user.
echo -e "
This script will perform a v10.x to v11.x upgrade.
Once you start the upgrade there's no going back.

Note, this is an online upgrade and while the
in progress running VMs will not be impacted.
However, you can expect some hiccups with OpenStack
API services while the upgrade is running.

Are you ready to perform this upgrade now?
"

# Confirm the user is ready to upgrade.
read -p 'Enter "YES" to continue or anything else to quit: ' UPGRADE
if [ "${UPGRADE}" == "YES" ]; then
  echo "Running Upgrade from v10.x to v11.x"
else
  exit 99
fi

## Shell Opts ----------------------------------------------------------------
set -e -u -v

## Library Check -------------------------------------------------------------
info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh

## Functions -----------------------------------------------------------------
function get_inv_items(){
  ./scripts/inventory-manage.py -f /etc/openstack_deploy/openstack_inventory.json -l | grep -w ".*$1"
}

function remove_inv_items(){
  ./scripts/inventory-manage.py -f /etc/openstack_deploy/openstack_inventory.json -r "$1"
}

## Main ----------------------------------------------------------------------

# Create new openstack_deploy directory.
if [ -d "/etc/rpc_deploy" ];then
  # Create an archive of the old deployment directory
  tar -czf ~/pre-upgrade-backup.tgz /etc/rpc_deploy
  # Move the new deployment directory bits into place
  mkdir -p /etc/openstack_deploy/
  cp -R /etc/rpc_deploy/* /etc/openstack_deploy/
  mv /etc/rpc_deploy /etc/rpc_deploy.OLD
else
  echo "No /etc/rpc_deploy directory found, thus nothing to upgrade."
  exit 1
fi

# Drop deprecation file.
cat > /etc/rpc_deploy.OLD/DEPRECATED.txt <<EOF
This directory have been deprecated please navigate to "/etc/openstack_deploy"
EOF

# If there is a pip config found remove it
if [ -d "$HOME/.pip" ];then
  tar -czf ~/pre-upgrade-pip-directory.tgz ~/.pip
  rm -rf ~/.pip
fi

# Upgrade ansible in place
./scripts/bootstrap-ansible.sh

# Move the old RPC files to OpenStack files.
pushd /etc/openstack_deploy
  rename 's/rpc_/openstack_/g' rpc_*
popd

# Make the extra configuration directories within the "/etc/openstack_deploy" directory
mkdir -p /etc/openstack_deploy/conf.d
mkdir -p /etc/openstack_deploy/env.d

# Copy over the new environment map
cp etc/openstack_deploy/openstack_environment.yml /etc/openstack_deploy/

# Set the rabbitmq cluster name if its not set to something else.
if ! grep '^rabbit_cluster_name\:' /etc/openstack_deploy/user_variables.yml;then
  echo 'rabbit_cluster_name: rpc' /etc/openstack_deploy/user_variables.yml
fi

# Add some new variables to user_variables.yml
if ! grep '^galera_innodb_log_file_size' /etc/openstack_deploy/user_variables.yml; then
  echo 'galera_innodb_log_file_size: 128M' | tee -a /etc/openstack_deploy/user_variables.yml
fi

# Set the ssl protocol settings.
echo 'ssl_protocol: "ALL -SSLv2 -SSLv3"' | tee -a /etc/openstack_deploy/user_variables.yml

# Cipher suite string from "https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/".
echo 'ssl_cipher_suite: "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS"' | tee -a /etc/openstack_deploy/user_variables.yml

# If monitoring as a service or Rackspace cloud variables are present, rewrite them as rpc-extras.yml
if grep -e '^maas_.*' -e '^rackspace_.*' -e '^elasticsearch_.*' -e '^kibana_.*' -e 'logstash_.*' /etc/openstack_deploy/user_variables.yml;then
python <<EOL
import yaml
with open('/etc/openstack_deploy/user_variables.yml', 'r') as f:
    user_vars = yaml.safe_load(f.read())

# Grab a map of the old rpc maas entries
extra_types = ['maas_', 'rackspace_', 'elasticsearch_', 'kibana_', 'logstash_']
rpc_extras = dict()
for k, v in user_vars.items():
    for i in extra_types:
        if k.startswith(i):
          rpc_extras[k] = v

# Clean up rpc extra variables from user variables
for i in rpc_extras.keys():
    del(user_vars[i])

with open('/etc/openstack_deploy/user_variables.yml', 'w') as fsw:
    fsw.write(
        yaml.safe_dump(
            user_vars,
            default_flow_style=False,
            width=1000
        )
    )

with open('/etc/openstack_deploy/user_extras_variables.yml', 'w') as fsw:
    fsw.write(
        yaml.safe_dump(
            rpc_extras,
            default_flow_style=False,
            width=1000
        )
    )
EOL
  # Populate the secrets file with data that should be secret.
  grep -e 'key\:' -e 'token\:' -e 'password\:' -e 'secret\:' /etc/openstack_deploy/user_extras_variables.yml | tee -a /etc/openstack_deploy/user_extras_secrets.yml

  # Remove secrets from the user_variables file that are now in the secrets file.
  sed -i -e '/key\:/d' -e '/token\:/d' -e '/password\:/d' -e '/secret\:/d' /etc/openstack_deploy/user_extras_variables.yml
fi

# Create secrets file.
touch /etc/openstack_deploy/user_secrets.yml

# Populate the secrets file with data that should be secret.
grep -e 'key\:' -e 'token\:' -e 'swift_hash_path' -e 'password\:' -e 'secret\:' /etc/openstack_deploy/user_variables.yml | tee -a /etc/openstack_deploy/user_secrets.yml

# Remove secrets from the user_variables file that are now in the secrets file.
sed -i -e '/key\:/d' -e '/token\:/d' -e '/swift_hash_path/d' -e '/password\:/d' -e '/secret\:/d' /etc/openstack_deploy/user_variables.yml

# Rename the mysql_root_password to galera_root_password.
sed -i 's/mysql_root_password/galera_root_password/g' /etc/openstack_deploy/user_secrets.yml

# Change the glance swift auth value if set. Done because the glance input variable has changed.
if grep '^glance_swift_store_auth_address\:' /etc/openstack_deploy/user_variables.yml | grep -e 'keystone_service_internaluri' -e 'auth_identity_uri'; then
  sed -i 's/^glance_swift_store_auth_address:.*/glance_swift_store_auth_address: "{{ keystone_service_internalurl }}"/g' /etc/openstack_deploy/user_variables.yml
fi

# Create some new secrets.
cat >> /etc/openstack_deploy/user_secrets.yml <<EOF
glance_profiler_hmac_key:
cinder_profiler_hmac_key:
heat_profiler_hmac_key:
nova_v21_service_password:
EOF

# Create the horizon secret key if not found.
if ! grep '^horizon_secret_key\:' /etc/openstack_deploy/user_secrets.yml;then
  echo 'horizon_secret_key:' | tee -a /etc/openstack_deploy/user_secrets.yml
fi

# Regenerate secrets for the new entries
./scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml

# Ensure any item that was "is_metal: true" and is in the new inventory, is set correctly.
python <<EOL
import yaml
with open('/etc/rpc_deploy.OLD/rpc_environment.yml', 'r') as f:
    environment = yaml.safe_load(f.read())

onmetal = list()
for k, v in environment['container_skel'].items():
    if v.get('is_metal') == True:
        onmetal.append(k)

with open('/etc/openstack_deploy/openstack_environment.yml', 'r') as f:
    os_environment = yaml.safe_load(f.read())

for i in onmetal:
    if i in os_environment['container_skel']:
        os_item = os_environment['container_skel'][i]
        if 'properties' in os_item:
            os_item['properties']['is_metal'] = True
        else:
            properties = os_item['properties'] = dict()
            properties['is_metal'] = True

with open('/etc/openstack_deploy/openstack_environment.yml', 'w') as fsw:
    fsw.write(
        yaml.safe_dump(
            os_environment,
            default_flow_style=False,
            width=1000
        )
    )
EOL

# If OLD ldap bits found in the user_variables file that pertain to ldap upgrade them to the new syntax.
if grep '^keystone_ldap.*' /etc/openstack_deploy/user_variables.yml;then
python <<EOL
import yaml
with open('/etc/openstack_deploy/user_variables.yml', 'r') as f:
    user_vars = yaml.safe_load(f.read())

# Grab a map of the old keystone ldap entries
new_ldap = dict()
for k, v in user_vars.items():
    if k.startswith('keystone_ldap'):
      new_ldap['%s' % k.split('keystone_ldap_')[-1]] = v

# Open user secrets file.
with open('/etc/openstack_deploy/user_secrets.yml', 'r') as fsr:
    user_secrets = yaml.safe_load(fsr.read())

# LDAP variable to instruct keystone to use ldap
ldap = user_secrets['keystone_ldap'] = dict()

# "ldap" section within the keystone_ldap variable.
ldap['ldap'] = new_ldap
with open('/etc/openstack_deploy/user_secrets.yml', 'w') as fsw:
    fsw.write(
        yaml.safe_dump(
            user_secrets,
            default_flow_style=False,
            width=1000
        )
    )
EOL

  # Remove old ldap variables from "user_variables.yml".
  sed -i '/keystone_ldap.*/d' /etc/openstack_deploy/user_variables.yml
fi

# Create the repo servers entries from the same entries found within the infra_hosts group.
if ! grep -R '^repo-infra_hosts\:' /etc/openstack_deploy/user_variables.yml /etc/openstack_deploy/conf.d/;then
  if [ ! -f "/etc/openstack_deploy/conf.d/repo-servers.yml" ];then
python <<EOL
import yaml
with open('/etc/openstack_deploy/openstack_user_config.yml', 'r') as f:
    user_config = yaml.safe_load(f.read())

# Create the new repo servers entries
repo_servers = dict()
o = repo_servers['repo-infra_hosts'] = user_config['infra_hosts']
with open('/etc/openstack_deploy/conf.d/repo-servers.yml', 'w') as fsw:
    fsw.write(
        yaml.safe_dump(
            repo_servers,
            default_flow_style=False,
            width=1000
        )
    )
EOL
  fi
fi

sed -i '/^environment_version.*/d' /etc/openstack_deploy/openstack_user_config.yml

# Remove containers that we no longer need
pushd playbooks
  # Setup all hosts to run lxc
  openstack-ansible lxc-hosts-setup.yml

  # Ensure the destruction of the containers we don't need.
  ansible hosts \
          -m shell \
          -a 'for i in $(lxc-ls | grep -e "rsyslog" -e "nova_api_ec2" -e "nova_spice_console"); do lxc-destroy -fn $i; done'
  # Clean up post destroy
  openstack-ansible lxc-containers-destroy.yml -e container_group="rsyslog_all"
  openstack-ansible lxc-containers-destroy.yml -e container_group="nova_api_ec2"
  openstack-ansible lxc-containers-destroy.yml -e container_group="nova_spice_console"
popd

# Remove the dead container types from inventory
REMOVED_CONTAINERS=""
REMOVED_CONTAINERS+="$(get_inv_items 'rsyslog_container' | awk '{print $2}') "
REMOVED_CONTAINERS+="$(get_inv_items 'nova_api_ec2' | awk '{print $2}') "
REMOVED_CONTAINERS+="$(get_inv_items 'nova_spice_console' | awk '{print $2}') "
for i in ${REMOVED_CONTAINERS};do
  remove_inv_items $i
done

# Create a play to fix all networks in all containers on hosts
cat > /tmp/fix_minor_adjustments.yml <<EOF
- name: Fix minor adjustments
  hosts: "horizon_all"
  gather_facts: false
  user: root
  tasks:
    - name: Create the horizon system user
      user:
        name: "{{ horizon_system_user_name }}"
        group: "{{ horizon_system_group_name }}"
        comment: "{{ horizon_system_comment }}"
        shell: "{{ horizon_system_shell }}"
        system: "yes"
        createhome: "yes"
        home: "{{ horizon_system_user_home }}"
    - name: Fix horizon permissions
      command: >
        chown -R "{{ horizon_system_user_name }}":"{{ horizon_system_group_name }}" "/usr/local/lib/python2.7/dist-packages/static"
      register: horizon_cmd_chown
      failed_when: false
      changed_when: horizon_cmd_chown.rc == 0
  vars:
    horizon_system_user_name: "horizon"
    horizon_system_group_name: "www-data"
    horizon_system_shell: "/bin/false"
    horizon_system_comment: "horizon system user"
    horizon_system_user_home: "/var/lib/{{ horizon_system_user_name }}"
- name: Fix keystone things
  hosts: "keystone_all"
  gather_facts: false
  user: root
  tasks:
    - name: Fix keystone permissions
      command: >
        chown -R "keystone":"keystone" "/var/log/keystone"
      register: keystone_cmd_chown
      failed_when: false
      changed_when: keystone_cmd_chown.rc == 0
EOF

# Create a play to fix host things
cat > /tmp/fix_host_things.yml <<EOF
- name: Fix host things
  hosts: "hosts"
  max_fail_percentage: 100
  gather_facts: false
  user: root
  tasks:
    - name: find containers in /var/lib/lxc
      command: ls -1 /var/lib/lxc
      register: containers
    - name: get the basic container network
      shell: |
        if [ "\$(grep '^lxc.network.name = eth0' /var/lib/lxc/{{ item }}/config)" ];then
          grep '^lxc.network.name = eth0' -A1 -B3 /var/lib/lxc/{{ item }}/config | tee /var/lib/lxc/{{ item }}/eth0.ini
          if [ ! "\$(grep '/var/lib/lxc/{{ item }}/eth0.ini' /var/lib/lxc/{{ item }}/config)" ];then
            echo 'lxc.include = /var/lib/lxc/{{ item }}/eth0.ini' | tee -a /var/lib/lxc/{{ item }}/config
          fi
        fi
      with_items: containers.stdout_lines
    - name: Remove lxc.network from base config
      lineinfile:
        dest: "/var/lib/lxc/{{ item }}/config"
        state: "absent"
        regexp: "^lxc.network"
      with_items: containers.stdout_lines
    - name: Remove add_network_interface.conf entry
      lineinfile:
        dest: "/var/lib/lxc/{{ item }}/config"
        state: "absent"
        regexp: 'add_network_interface\.conf'
      with_items: containers.stdout_lines
    - name: Remove aa_profile entries
      lineinfile:
        dest: "/var/lib/lxc/{{ item }}/config"
        state: "absent"
        regexp: '^lxc.aa_profile'
      with_items: containers.stdout_lines
    - name: Remove old add_network_interface.conf file
      file:
        path: "/var/lib/lxc/{{ item }}/add_network_interface.conf"
        state: "absent"
      failed_when: false
      with_items: containers.stdout_lines
    - name: Ensure services log files are fix
      shell: |
        if [ ! -h "/var/log/{{ item }}" ] && [ -d "/var/log/{{ item }}" ];then
          mv /var/log/{{ item }} /var/log/{{ item }}.old
        else
          # Exit 99 when nothing found to change
          exit 99
        fi
      failed_when: false
      changed_when: log_change.rc == 0
      register: log_change
      with_items:
        - "nova"
        - "neutron"
        - "swift"
EOF

# Create a play for fixing the container networks
# This is cleaning up all old interface files that are from pre kilo.
# The task is set to always succeed because at this point there will be a mix of old
# and new inventory which will have containers that have not been created yet.
cat > /tmp/fix_container_interfaces.yml <<EOF
- name: Fix container things
  hosts: "all_containers"
  max_fail_percentage: 100
  gather_facts: false
  user: root
  tasks:
    - name: Get interface files
      command: ls -1 /etc/network/interfaces.d/
      register: interface_files
      failed_when: false
    - name: Remove old interface files
      file:
        path: "/etc/network/interfaces.d/{{ item }}"
        state: "absent"
      with_items:
        - "{{ interface_files.stdout_lines }}"
      failed_when: false
EOF

# Create a play to send swift rings to the first swift_host
cat > /tmp/fix_swift_rings_locations.yml <<EOF
- name: Send swift rings from localhost to the first swift node
  hosts: "swift_hosts[0]"
  max_fail_percentage: 100
  gather_facts: false
  user: root
  tasks:
    - name: Ensure the swift system user
      user:
        name: "{{ swift_system_user_name }}"
        group: "{{ swift_system_group_name }}"
        comment: "{{ swift_system_comment }}"
        shell: "{{ swift_system_shell }}"
        system: "yes"
        createhome: "yes"
        home: "{{ swift_system_home_folder }}"
    - name: Ensure "/etc/swift/ring_build_files/" exists
      file:
        path: "{{ item }}"
        owner: "{{ swift_system_user_name }}"
        group: "{{ swift_system_group_name }}"
        state: "directory"
      with_items:
        - "/etc/swift"
        - "/etc/swift/ring_build_files"
    - name: "Copy the rings from localhost to swift_host[0]"
      copy:
        src: "{{ item }}"
        dest: "/etc/swift/ring_build_files/"
        mode: "0644"
        owner: "{{ swift_system_user_name }}"
        group: "{{ swift_system_group_name }}"
      with_fileglob:
        - /etc/swift/rings/*.ring.gz
        - /etc/swift/rings/*.builder
      when: >
        inventory_hostname == groups['swift_hosts'][0]
  vars:
    swift_system_user_name: swift
    swift_system_group_name: swift
    swift_system_shell: /bin/bash
    swift_system_comment: swift system user
    swift_system_home_folder: "/var/lib/{{ swift_system_user_name }}"
EOF

pushd playbooks
  # Reconfig haproxy if setup.
  if grep '^haproxy_hosts\:' /etc/openstack_deploy/openstack_user_config.yml;then
    ansible haproxy_hosts \
            -m shell \
            -a 'rm /etc/haproxy/conf.d/nova_api_ec2 /etc/haproxy/conf.d/nova_spice_console'
    openstack-ansible haproxy-install.yml
  fi

  # Run the fix adjustments play.
  openstack-ansible /tmp/fix_minor_adjustments.yml
  # Remove fix container adjustments play
  rm /tmp/fix_minor_adjustments.yml

  # Run the fix host things play
  openstack-ansible /tmp/fix_host_things.yml
  # Remove fix host things play
  rm /tmp/fix_host_things.yml

  # Run the fix for container networks. Forces True as containers may not exist at this point
  openstack-ansible /tmp/fix_container_interfaces.yml || true
  # Remove fix container networks play
  rm /tmp/fix_container_interfaces.yml

  # Send the swift rings to the first swift host if swift was installed in "v10.x".
  if [ "$(ansible 'swift_hosts' --list-hosts)" != "No hosts matched" ] && [ -d "/etc/swift/rings" ];then
    openstack-ansible /tmp/fix_swift_rings_locations.yml
    # Remove fix swift rings locations play
    rm /tmp/fix_swift_rings_locations.yml
  fi

  # Rerun create containers that will update all running containers with the new bits
  openstack-ansible lxc-containers-create.yml

  # With inventory and containers upgraded run the remaining host setup
  openstack-ansible openstack-hosts-setup.yml

  # Now run the infrastructure setup
  openstack-ansible setup-infrastructure.yml

  # Now upgrade the rest of OpenStack
  openstack-ansible setup-openstack.yml
popd


text:
using HomeSeerAPI;
using NullGuard;
using Scheduler.Classes;
using System.Collections.Generic;
using System.Xml.XPath;

namespace Hspi
{
    [NullGuard(ValidationFlags.Arguments | ValidationFlags.NonPublic)]
    internal sealed class WindSpeedDeviceData : ScaledNumberDeviceData
    {
        public WindSpeedDeviceData(string name, XmlPathData pathData) :
            base(name, pathData)
        {
        }

        public override string GetDeviceSuffix(Unit unit)
        {
            return WUWeatherData.GetStringDescription(unit, DeviceUnitType.WinSpeed);
        }

        public override IList<VSVGPairs.VGPair> GraphicsPairs => GetSingleGraphicsPairs("wind.png");

        public override void UpdateDeviceData(IHSApplication HS, DeviceClass device, [AllowNull]XPathNodeIterator value)
        {
            UpdateFirstNodeAsNumber(HS, device, value);
        }
    }
}


text:
<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/maven-v4_0_0.xsd">
    <parent>
        <artifactId>jobx</artifactId>
        <groupId>com.jobxhub</groupId>
        <version>1.2.0-RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>example-oracle</artifactId>
    <packaging>jar</packaging>
    <name>example-oracle</name>

</project>


text:
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".

Replace this with more appropriate tests for your application.
"""

from django.test import TestCase

class ProfileTests(TestCase):
    def test_subscribe(self):
        self.assertEqual(1 + 1, 2)


text:
using ForDinner.API.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ForDinner.Entities.service
{
    public class AssetService : Entities.EntityService<Asset>
    {

        //public AssetService():base(new MongoContext())
        //{
        //}
        public AssetService(MongoContext db)
            : base(db)
        {
        }

        public override void Update(Asset entity)
        {
            throw new NotImplementedException();
        }

    }
}


text:
<?php

class Google_Service_SQLAdmin_DemoteMasterContext extends Google_Model
{
  public $kind;
  public $masterInstanceName;
  protected $replicaConfigurationType = 'Google_Service_SQLAdmin_DemoteMasterConfiguration';
  protected $replicaConfigurationDataType = '';
  public $verifyGtidConsistency;

  public function setKind($kind)
  {
    $this->kind = $kind;
  }
  public function getKind()
  {
    return $this->kind;
  }
  public function setMasterInstanceName($masterInstanceName)
  {
    $this->masterInstanceName = $masterInstanceName;
  }
  public function getMasterInstanceName()
  {
    return $this->masterInstanceName;
  }
  /**
   * @param Google_Service_SQLAdmin_DemoteMasterConfiguration
   */
  public function setReplicaConfiguration(Google_Service_SQLAdmin_DemoteMasterConfiguration $replicaConfiguration)
  {
    $this->replicaConfiguration = $replicaConfiguration;
  }
  /**
   * @return Google_Service_SQLAdmin_DemoteMasterConfiguration
   */
  public function getReplicaConfiguration()
  {
    return $this->replicaConfiguration;
  }
  public function setVerifyGtidConsistency($verifyGtidConsistency)
  {
    $this->verifyGtidConsistency = $verifyGtidConsistency;
  }
  public function getVerifyGtidConsistency()
  {
    return $this->verifyGtidConsistency;
  }
}


text:
package com.Da_Technomancer.crossroads.API.effects.mechArm;

import com.Da_Technomancer.crossroads.entity.EntityArmRidable;
import com.Da_Technomancer.crossroads.tileentities.technomancy.MechanicalArmTileEntity;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;

public class MechArmThrowEntityEffect implements IMechArmEffect{

	private static final double LAUNCH_SPEED = 20D;//blocks/second

	@Override
	public boolean onTriggered(World world, BlockPos pos, double posX, double posY, double posZ, EnumFacing side, EntityArmRidable ent, MechanicalArmTileEntity te){
		if(ent.getPassengers().size() != 0){
			Entity passenger = ent.getPassengers().get(0);
			passenger.dismountRidingEntity();

			//The principle used here is to launch the entity along a line from the arm center to the arm position, with constant speed

			Vec3d vel = new Vec3d(posX - ((double) (te.getPos().getX() + 0.5D)), posY - ((double) (te.getPos().getY() + 1D)), posZ - ((double) (te.getPos().getZ() + 0.5D)));
			vel = vel.normalize().scale(LAUNCH_SPEED);
			passenger.motionX = vel.x;
			passenger.motionY = vel.y;
			passenger.motionZ = vel.z;
			passenger.velocityChanged = true;

//
//			//The principle used here is to calculate the previous arm position, draw a line between the start and end points, and launch the entity along the direction of that line with velocity equal to that necessary to move across that line in 1 tick.
//			double lengthCross = Math.sqrt(Math.pow(MechanicalArmTileEntity.LOWER_ARM_LENGTH, 2) + Math.pow(MechanicalArmTileEntity.UPPER_ARM_LENGTH, 2) - (2D * MechanicalArmTileEntity.LOWER_ARM_LENGTH * MechanicalArmTileEntity.UPPER_ARM_LENGTH * Math.cos(te.angleRecord[2])));
//			double thetaD = te.angleRecord[1] + te.angleRecord[2] + Math.asin(Math.sin(te.angleRecord[2]) * MechanicalArmTileEntity.LOWER_ARM_LENGTH / lengthCross);
//			double holder = -Math.cos(thetaD) * lengthCross;
//
//			double oldPosX = (holder * Math.cos(te.angleRecord[0])) + .5D + (double) te.getPos().getX();
//			double oldPosY = (-Math.sin(thetaD) * lengthCross) + 1D + (double) te.getPos().getY();
//			double oldPosZ = (holder * Math.sin(te.angleRecord[0])) + .5D + (double) te.getPos().getZ();
//
//			passenger.motionX = posX - oldPosX;
//			passenger.motionY = posY - oldPosY;
//			passenger.motionZ = posZ - oldPosZ;
//			passenger.velocityChanged = true;
			return true;
		}
		return false;
	}
}


text:
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'bool'
require 'minitest/autorun'

describe "Testdata" do
  Dir[File.dirname(__FILE__) + '/../../testdata/*.txt'].each do |f|
    expr, vars, result = IO.read(f).split(/\n/)
    it f do
      ast = Bool.parse(expr)
      ast.accept(Bool::Evaluator.new, vars.split(/\s+/)).to_s.must_equal(result)
    end
  end
end


text:
namespace SimilatiryMeasures.ItemItem
{
    public class DeviationObject
    {
        public int Id1 { get; set; }
        public int Id2 { get; set; }
        public int AmountOfRatings { get; set; }
        public double Deviation { get; set; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Package org.apache.solr.schema (Solr 4.8.0 API)</title>
<meta name="date" content="2014-04-24">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
org.apache.solr.schema

Packages that use org.apache.solr.schema

Package
Description

org.apache.solr.core

Core classes implementin Solr internals and the management of SolrCores

org.apache.solr.handler

Concrete implementations of SolrRequestHandler

org.apache.solr.handler.component

SearchComponent implementations for
use in SearchHandler

org.apache.solr.parser

Solr native variant of the Lucene Classic QueryParser

org.apache.solr.request

APIs and classes for dealing with Solr requests

org.apache.solr.response

API and implementations of QueryResponseWriter for formating Solr request responses

org.apache.solr.response.transform

APIs and implementations of DocTransformer for modifying documents in Solr request responses

org.apache.solr.rest

  Solr RESTful APIs via Restlet.

org.apache.solr.rest.schema

  Provides RESTful API access to the Solr Schema using Restlet.

org.apache.solr.schema

IndexSchema and FieldType implementations for powering schema.xml

org.apache.solr.search

APIs and classes for parsing and processing search requests

org.apache.solr.search.function

Solr implementations of ValueSource for function queries.

org.apache.solr.search.grouping.distributed.command

Internal classes used to implement distributed result grouping

org.apache.solr.search.grouping.distributed.shardresultserializer

Internal classes used to implement distributed result grouping

org.apache.solr.search.similarities

Factories for various built-in Lucene ranking models.

org.apache.solr.update

APIs and classes for managing index updates

org.apache.solr.update.processor

UpdateRequestProcessorFactory APIs and implementations for use in UpdateRequestProcessorChains

org.apache.solr.util

Common utility classes used throughout Solr

Classes in org.apache.solr.schema used by org.apache.solr.core

Class and Description

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

Classes in org.apache.solr.schema used by org.apache.solr.handler

Class and Description

FieldType

Base class for all field types used by an index schema.

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

Classes in org.apache.solr.schema used by org.apache.solr.handler.component

Class and Description

FieldType

Base class for all field types used by an index schema.

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.parser

Class and Description

FieldType

Base class for all field types used by an index schema.

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

Classes in org.apache.solr.schema used by org.apache.solr.request

Class and Description

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.response

Class and Description

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.response.transform

Class and Description

FieldType

Base class for all field types used by an index schema.

Classes in org.apache.solr.schema used by org.apache.solr.rest

Class and Description

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

Classes in org.apache.solr.schema used by org.apache.solr.rest.schema

Class and Description

FieldType

Base class for all field types used by an index schema.

Classes in org.apache.solr.schema used by org.apache.solr.schema

Class and Description

AbstractSpatialFieldType

Abstract base class for Solr FieldTypes based on a Lucene 4 SpatialStrategy.

AbstractSpatialPrefixTreeFieldType

AbstractSubTypeFieldType

An abstract base class for FieldTypes that delegate work to another FieldType.

BCDIntField

Deprecated.

this class will be removed in 5.0 - use TrieIntField instead

CoordinateFieldType

A CoordinateFieldType is the base class for FieldTypes that have semantics
 related to items in a coordinate system.

CopyField

CopyField contains all the information of a valid copy fields in an index.

DateField

Deprecated.

this class will be removed in 5.0 - use TrieDateField instead

DateValueFieldType

Marker interface for Date-valued field types.

DoubleValueFieldType

Marker interface for double-valued field types.

ExchangeRateProvider

Interface for providing pluggable exchange rate providers to @CurrencyField

FieldProperties

FieldType

Base class for all field types used by an index schema.

FloatValueFieldType

Marker interface for float-valued field types.

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

IndexSchema.DynamicCopy

IndexSchema.DynamicField

IndexSchema.DynamicReplacement

IndexSchema.DynamicReplacement.DynamicPattern

IndexSchemaFactory

Base class for factories for IndexSchema implementations

IntValueFieldType

Marker interface for int-valued field types.

LongValueFieldType

Marker interface for long-valued field types.

ManagedIndexSchema

Solr-managed schema - non-user-editable, but can be mutable via internal and external REST API requests.

ManagedIndexSchemaFactory

Factory for ManagedIndexSchema

NumericValueFieldType

Marker interface for numeric-valued field types.

PreAnalyzedField.ParseResult

This is a simple holder of a stored part and the collected states (tokens with attributes).

PreAnalyzedField.PreAnalyzedParser

Parse the input and return the stored part and the tokens with attributes.

PrimitiveFieldType

Abstract class defining shared behavior for primitive types
 Intended to be used as base class for non-analyzed fields like
 int, float, string, date etc, and set proper defaults for them

SchemaAware

An interface that can be extended to provide a callback mechanism for
 informing an IndexSchema instance of changes to it, dynamically
 performed at runtime.

SchemaField

Encapsulates all information about a Field in a Solr Schema

SimilarityFactory

A factory interface for configuring a Similarity in the Solr
 schema.xml.

SpatialQueryable

Indicate that the implementing class is capable of generating a Query against spatial resources.

StrField

TrieField

Provides field types to support for Lucene's IntField, LongField, FloatField and
 DoubleField.

TrieField.TrieTypes

Classes in org.apache.solr.schema used by org.apache.solr.search

Class and Description

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.search.function

Class and Description

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.search.grouping.distributed.command

Class and Description

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.search.grouping.distributed.shardresultserializer

Class and Description

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.search.similarities

Class and Description

SimilarityFactory

A factory interface for configuring a Similarity in the Solr
 schema.xml.

Classes in org.apache.solr.schema used by org.apache.solr.update

Class and Description

FieldType

Base class for all field types used by an index schema.

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

SchemaField

Encapsulates all information about a Field in a Solr Schema

Classes in org.apache.solr.schema used by org.apache.solr.update.processor

Class and Description

FieldType

Base class for all field types used by an index schema.

Classes in org.apache.solr.schema used by org.apache.solr.util

Class and Description

IndexSchema

IndexSchema contains information about the valid fields in an index
 and the types of those fields.

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

          Copyright © 2000-2014 Apache Software Foundation.  All Rights Reserved.


text:
def _addMethod(fldName, clsName, verb, methodMaker, dict):
    """Make a get or set method and add it to dict."""
    compiledName = _getCompiledName(fldName, clsName)
    methodName = _getMethodName(fldName, verb)
    dict[methodName] = methodMaker(compiledName)

def _getCompiledName(fldName, clsName):
    """Return mangled fldName if necessary, else no change."""
    # If fldName starts with 2 underscores and does *not* end with 2 underscores...
    if fldName[:2] == '__' and fldName[-2:] != '__':
        return "_%s%s" % (clsName, fldName)
    else:
        return fldName

def _getMethodName(fldName, verb):
    """'_salary', 'get'  => 'getSalary'"""
    s = fldName.lstrip('_') # Remove leading underscores
    return verb + s.capitalize()

def _makeGetter(compiledName):
    """Return a method that gets compiledName's value."""
    return lambda self: self.__dict__[compiledName]

def _makeSetter(compiledName):
    """Return a method that sets compiledName's value."""
    return lambda self, value: setattr(self, compiledName, value)

class Accessors(type):
    """Adds accessor methods to a class."""
    def __new__(cls, clsName, bases, dict):
        for fldName in dict.get('_READ', []) + dict.get('_READ_WRITE', []):
            _addMethod(fldName, clsName, 'get', _makeGetter, dict)
        for fldName in dict.get('_WRITE', []) + dict.get('_READ_WRITE', []):
            _addMethod(fldName, clsName, 'set', _makeSetter, dict)
        return type.__new__(cls, clsName, bases, dict)

if __name__ == "__main__":

    class Employee:
        __metaclass__ = Accessors
        _READ_WRITE = ['name', 'salary', 'title', 'bonus']
        def __init__(self, name, salary, title, bonus=0):
            self.name = name
            self.salary = salary
            self.title = title
            self.bonus = bonus
    b = Employee('Joe Test', 40000, 'Developer')
    print 'Name:', b.getName()
    print 'Salary:', b.getSalary()
    print 'Title:', b.getTitle()
    print 'Bonus:', b.getBonus()
    b.setBonus(5000)
    print 'Bonus:', b.getBonus()

    class ReadOnly:
        __metaclass__ = Accessors
        _READ = ['__data']
        def __init__(self, data):
            self.__data = data
    ro = ReadOnly('test12345')
    print 'Read-only data:', ro.getData()

    class WriteOnly:
        __metaclass__ = Accessors
        _WRITE = ['_data']
        def __init__(self, data):
            self._data = data
    wo = WriteOnly('test67890')
    print 'Write-only data:', wo._data
    wo.setData('xzy123')
    print 'Write-only data:', wo._data


text:
package iso20022

// Key encryption key (KEK), encrypted with a previously distributed asymmetric public key.
type KeyTransport3 struct {

	// Version of the cryptographic key.
	Version *Number `xml:"Vrsn,omitempty"`

	// Transport key or key encryption key (KEK) for the recipient.
	RecipientIdentification *CertificateIdentifier1 `xml:"RcptId"`

	// Algorithm to encrypt the key encryption key (KEK).
	KeyEncryptionAlgorithm *AlgorithmIdentification7 `xml:"KeyNcrptnAlgo"`

	// Encrypted key encryption key (KEK).
	EncryptedKey *Max3000Binary `xml:"NcrptdKey"`
}

func (k *KeyTransport3) SetVersion(value string) {
	k.Version = (*Number)(&value)
}

func (k *KeyTransport3) AddRecipientIdentification() *CertificateIdentifier1 {
	k.RecipientIdentification = new(CertificateIdentifier1)
	return k.RecipientIdentification
}

func (k *KeyTransport3) AddKeyEncryptionAlgorithm() *AlgorithmIdentification7 {
	k.KeyEncryptionAlgorithm = new(AlgorithmIdentification7)
	return k.KeyEncryptionAlgorithm
}

func (k *KeyTransport3) SetEncryptedKey(value string) {
	k.EncryptedKey = (*Max3000Binary)(&value)
}


text:
layout: post
microblog: true
audio:
photo:
date: 2011-04-21 23:03:31 -0600
guid: http://craigmcclellan.micro.blog/2011/04/22/t61294034173427712.html
---
Tonight's @NBCCommunity was one of the best ever, but the 100th episode of 30 Rock was weird.


text:
var express = require('express');
var _ = require('lodash');

function factory (services) {
  return createApi(services.switches);
}

module.exports = exports = factory;

function createApi(switches) {

  var app = express();

  app.get('/', function (req, res) {
    var all = _.mapValues(
      switches.getAllInstances(),
      function(sw) { return sw.get(); }
    );
    res.json(all);
  });

  app.get('/:id', function (req, res) {
    var id = req.params.id;
    var sw = switches.getInstance(id);
    res.json(mapSwitch(sw));
  });

  app.put('/:id', function (req, res) {
    var id = req.params.id;
    var sw = switches.getInstance(id);
    sw.set(req.body);
    res.json(mapSwitch(sw));
  });

  return app;
}

function mapSwitch(s) {
  return s.get();
}


text:
package com.qvdev.apps.readerkid.facebook;

public class FacebookConfig {

    public static final String FACEBOOK_CLIENT_ID = "client_id";

    public static final String FB_APP_SIGNATURE = "signature";

}


text:
require 'test_helper'

class AccessLogsHelperTest < ActionView::TestCase
end


text:
id: v1-hash-datatype
title: Hash
url: /v1/datatypes/hash
version: v1
---

The digest result of a hashing algorithm. When serialised as a string it MUST
be in hexadecimal.

***
**EXAMPLE:**

For example, the SHA2-256 digest for `foo` represented in hexadecimal is:

```
2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
```

***


text:
<?php if(!isset($RUN)) { exit(); } ?>

<?php echo EMAIL ?> :

<input class='form-control input-medium' type="text" id="txtEmail" name="txtEmail" value="<?php echo $p_account ?>" />

<input class='btn green' type="button" id="btnAdd" name="btnAdd" value="<?php echo SAVE ?>" class="btn" onclick="SaveEmail()" />


text:
package endtoend.java.infer;

import static org.hamcrest.MatcherAssert.assertThat;
import static utils.matchers.ResultContainsNoErrorInMethod.doesNotContain;

import org.junit.BeforeClass;
import org.junit.Test;

import java.io.IOException;

import utils.InferException;
import utils.InferResults;

public class IntegerClassTest {

  public static final String SOURCE_FILE =
      "infer/tests/codetoanalyze/java/infer/IntegerExample.java";

  public static final String NULL_DEREFERENCE = "NULL_DEREFERENCE";

  private static InferResults inferResults;

  @BeforeClass
  public static void loadResults() throws IOException {
    inferResults = InferResults.loadInferResults(IntegerClassTest.class, SOURCE_FILE);
  }

  @Test
  public void test()
      throws InterruptedException, IOException, InferException {
    assertThat(
        "Results should not contain NPE errors",
        inferResults,
        doesNotContain(
            NULL_DEREFERENCE,
            SOURCE_FILE,
            "testIntegerEquals"
        )
    );
  }

}


text:
from django.shortcuts import render

from vehicles.context_processor import global_context_processor
from .forms import ContactForm
from dynamic_preferences.registries import global_preferences_registry
# import settings so send_mail can have access to email settings
from django.conf import settings
from django.core.mail import send_mail
from django.contrib import messages

def contact_page(request):
    form = ContactForm(request.POST or None)
    if request.method == 'POST':
        if form.is_valid():
            data = form.cleaned_data
            sender_name = data['name']
            sender_email = data['email']
            sender_phone = data['phone']
            sender_message = data['query']
            email_subject = data['topic']
            message_to_send = (
                "Name: {0}\n"
                "Email: {1}\n"
                "Phone: {2}\n"
                "Enquiry:\n{3}").format(
                sender_name,
                sender_email,
                sender_phone,
                sender_message
            )
            # instanciate a manager for global preferences
            global_preferences = global_preferences_registry.manager()
            # get default email address from global preferences
            send_to_email = global_preferences.get(
                'general__default_email', None)
            # if for some reason, the email from global preferences is None
            # then get default from settings
            if not send_to_email:
                send_to_email = settings.DEFAULT_EMAIL_ADDRESS
            # email the details
            # send_mail(subject, message, from, to, fail_silently)
            from_email = settings.SERVER_EMAIL or 'info@globaltrademotors.com'
            send_mail(
                email_subject,
                message_to_send,
                from_email, [send_to_email],
                fail_silently=True
            )
            messages.success(
                request,
                "Thank you getting in touch! We'll get back to you shortly."
            )
            form = ContactForm()
        else:
            for key, error in form.errors.items():
                messages.info(request, error.as_data()[0].message)
    form = form.__class__
    context = global_context_processor(locals())

    return render(request, "contact_page.html", context)


text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) MASSIVE ART WebServices GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Bundle\DocumentManagerBundle\Tests\Unit\Command;

use Prophecy\Argument;
use Sulu\Bundle\DocumentManagerBundle\Command\InitializeCommand;
use Sulu\Bundle\DocumentManagerBundle\Initializer\Initializer;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Tester\CommandTester;

class InitializeCommandTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var mixed
     */
    private $questionHelper;

    /**
     * @var mixed
     */
    private $initializer;

    public function setUp()
    {
        $this->questionHelper = $this->prophesize(QuestionHelper::class);
        $this->initializer = $this->prophesize(Initializer::class);
        $this->command = new InitializeCommand(
            $this->initializer->reveal(),
            $this->questionHelper->reveal()
        );
    }

    /**
     * It should initialize the workspace.
     */
    public function testInitialize()
    {
        $this->initializer->initialize(Argument::type(OutputInterface::class), false)
            ->shouldBeCalled();
        $this->exec();
    }

    /**
     * It should ask for confirmation and purge the workspace.
     */
    public function testPurgeWorkspace()
    {
        $this->initializer->initialize(Argument::type(OutputInterface::class), true)
            ->shouldBeCalled();
        $this->questionHelper->ask(
            Argument::type(InputInterface::class),
            Argument::type(OutputInterface::class),
            Argument::type(ConfirmationQuestion::class)
        )->willReturn(true);

        $this->exec([
            '--purge' => true,
        ]);
    }

    /**
     * It should abort if user does not confirm.
     */
    public function testPurgeWorkspaceAbort()
    {
        $this->initializer->initialize(Argument::type(OutputInterface::class), Argument::any())
            ->shouldNotBeCalled();
        $this->questionHelper->ask(
            Argument::type(InputInterface::class),
            Argument::type(OutputInterface::class),
            Argument::type(ConfirmationQuestion::class)
        )->willReturn(false);

        $this->exec([
            '--purge' => true,
        ]);
    }

    /**
     * It should not ask if --force is used.
     */
    public function testForceNoAsk()
    {
        $this->initializer->initialize(Argument::type(OutputInterface::class), true)
            ->shouldBeCalled();
        $this->questionHelper->ask(
            Argument::type(InputInterface::class),
            Argument::type(OutputInterface::class),
            Argument::type(ConfirmationQuestion::class)
        )->shouldNotBeCalled();

        $this->exec([
            '--purge' => true,
            '--force' => true,
        ]);
    }

    private function exec(array $args = [])
    {
        $tester = new CommandTester($this->command);
        $tester->execute($args);

        return $tester;
    }
}


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

<testcase>
   <info>

This test checks fo:change-bar-* on table elements.

   </info>
   <fo>
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <fo:layout-master-set>
            <fo:simple-page-master page-height="145mm" page-width="210mm" margin="10mm"
               master-name="master">
               <fo:region-body column-count="2" column-gap="10mm"/>
            </fo:simple-page-master>
         </fo:layout-master-set>
         <fo:page-sequence master-reference="master">
            <fo:flow flow-name="xsl-region-body">

               <fo:table change-bar-style="solid" change-bar-color="red" change-bar-offset="2mm"
                  change-bar-width="0.3mm">
                  <fo:table-header>
                     <fo:change-bar-begin change-bar-class="headerRow" change-bar-offset="0.1mm"
                        change-bar-color="green"/>
                     <fo:table-row>
                        <fo:table-cell id="header-row1-col1">
                           <fo:block>header-row1-col1</fo:block>
                        </fo:table-cell>
                        <fo:table-cell id="header-row1-col2">
                           <fo:block>header-row1-col2</fo:block>
                        </fo:table-cell>
                     </fo:table-row>
                     <fo:change-bar-end change-bar-class="headerRow"/>
                     <fo:table-row>
                        <fo:change-bar-begin change-bar-class="headerCell" change-bar-color="blue"/>
                        <fo:table-cell id="header-row2-col1">
                           <fo:block>header-row2-col1</fo:block>
                        </fo:table-cell>
                        <fo:change-bar-end change-bar-class="headerCell"/>
                        <fo:table-cell id="header-row2-col2">
                           <fo:change-bar-begin change-bar-class="headerCellBlock"
                              change-bar-offset="1mm"/>
                           <fo:block>header-row2-col2</fo:block>
                           <fo:change-bar-end change-bar-class="headerCellBlock"/>
                        </fo:table-cell>
                     </fo:table-row>
                  </fo:table-header>
                  <fo:change-bar-begin change-bar-class="footer"/>
                  <fo:table-footer>
                     <fo:table-row>
                        <fo:change-bar-begin change-bar-class="footerRow" change-bar-offset="3mm"
                           change-bar-color="green"/>
                        <fo:table-cell id="footer-row1-col1">
                           <fo:block>footer-row1-col1</fo:block>
                        </fo:table-cell>
                        <fo:change-bar-end change-bar-class="footerRow"/>
                        <fo:table-cell id="footer-row1-col2">
                           <fo:block>footer-row1-col2</fo:block>
                        </fo:table-cell>
                     </fo:table-row>
                     <fo:table-row>
                        <fo:table-cell id="footer-row2-col1">
                           <fo:block>footer-row2-col1</fo:block>
                        </fo:table-cell>
                        <fo:table-cell id="footer-row2-col2">
                           <fo:block>footer-row2-col2</fo:block>
                        </fo:table-cell>
                     </fo:table-row>
                  </fo:table-footer>
                  <fo:change-bar-end change-bar-class="footer"/>
                  <fo:table-body>
                     <fo:change-bar-begin change-bar-class="bodyRow"/>
                     <fo:table-row>
                        <fo:table-cell id="body-row1-col1">
                           <fo:block>body-row1-col1</fo:block>
                        </fo:table-cell>
                        <fo:table-cell id="body-row1-col2">
                           <fo:block>body-row1-col2</fo:block>
                        </fo:table-cell>
                     </fo:table-row>
                     <fo:change-bar-end change-bar-class="bodyRow"/>
                     <fo:table-row>
                        <fo:change-bar-begin change-bar-class="bodyCell" change-bar-offset="0.1mm"
                           change-bar-color="blue"/>
                        <fo:table-cell id="body-row2-col1">
                           <fo:block>body-row2-col1</fo:block>
                        </fo:table-cell>
                        <fo:change-bar-end change-bar-class="bodyCell"/>
                        <fo:table-cell id="body-row2-col2">
                           <fo:change-bar-begin change-bar-class="bodyCellBlock"
                              change-bar-offset="1mm"/>
                           <fo:block>body-row2-col2</fo:block>
                           <fo:change-bar-end change-bar-class="bodyCellBlock"/>
                        </fo:table-cell>
                     </fo:table-row>
                  </fo:table-body>
               </fo:table>
            </fo:flow>
         </fo:page-sequence>
      </fo:root>
   </fo>
   <checks>

      <eval expected="(solid,#008000,850)" xpath="//block[@prod-id='header-row1-col1']/block[1]/block[1]/@border-start"/>
      <eval expected="-1133" xpath="//block[@prod-id='header-row1-col1']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#008000,850)" xpath="//block[@prod-id='header-row1-col2']/block[1]/block[1]/@border-start"/>
      <eval expected="-1133" xpath="//block[@prod-id='header-row1-col2']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#0000ff,850)" xpath="//block[@prod-id='header-row2-col1']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='header-row2-col1']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='header-row2-col2']/block[1]/block[1]/@border-start"/>
      <eval expected="-3684" xpath="//block[@prod-id='header-row2-col2']/block[1]/block[1]/@left-offset"/>

      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='body-row1-col1']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='body-row1-col1']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='body-row1-col2']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='body-row1-col2']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#0000ff,850)" xpath="//block[@prod-id='body-row2-col1']/block[1]/block[1]/@border-start"/>
      <eval expected="-1133" xpath="//block[@prod-id='body-row2-col1']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='body-row2-col2']/block[1]/block[1]/@border-start"/>
      <eval expected="-3684" xpath="//block[@prod-id='body-row2-col2']/block[1]/block[1]/@left-offset"/>

      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='footer-row1-col1']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='footer-row1-col1']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#008000,850)" xpath="//block[@prod-id='footer-row1-col1']/block[1]/block[2]/@border-start"/>
      <eval expected="-9353" xpath="//block[@prod-id='footer-row1-col1']/block[1]/block[2]/@left-offset"/>
      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='footer-row1-col2']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='footer-row1-col2']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='footer-row2-col1']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='footer-row2-col1']/block[1]/block[1]/@left-offset"/>
      <eval expected="(solid,#ff0000,850)" xpath="//block[@prod-id='footer-row2-col2']/block[1]/block[1]/@border-start"/>
      <eval expected="-6519" xpath="//block[@prod-id='footer-row2-col2']/block[1]/block[1]/@left-offset"/>
   </checks>
</testcase>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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.jbb.domain</groupId>
        <artifactId>domain-api</artifactId>
        <version>DEV-SNAPSHOT</version>
    </parent>

    <artifactId>jbb-board-api</artifactId>

    <name>jBB Board API</name>
    <description>API for board features</description>

</project>


text:
package org.lwjgl.opengles;

import javax.annotation.*;

import java.nio.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * Native bindings to the QCOM_extended_get2 extension.
 *
 *
This extension enables instrumenting the driver for debugging of OpenGL ES applications.

 */
public class QCOMExtendedGet2 {

    static { GLES.initialize(); }

    protected QCOMExtendedGet2() {
        throw new UnsupportedOperationException();
    }

    // --- [ glExtGetShadersQCOM ] ---

    public static native void nglExtGetShadersQCOM(long shaders, int maxShaders, long numShaders);

    public static void glExtGetShadersQCOM(@Nullable @NativeType("GLuint *") IntBuffer shaders, @Nullable @NativeType("GLint *") IntBuffer numShaders) {
        if (CHECKS) {
            checkSafe(numShaders, 1);
        }
        nglExtGetShadersQCOM(memAddressSafe(shaders), remainingSafe(shaders), memAddressSafe(numShaders));
    }

    // --- [ glExtGetProgramsQCOM ] ---

    public static native void nglExtGetProgramsQCOM(long programs, int maxPrograms, long numPrograms);

    public static void glExtGetProgramsQCOM(@Nullable @NativeType("GLuint *") IntBuffer programs, @Nullable @NativeType("GLint *") IntBuffer numPrograms) {
        if (CHECKS) {
            checkSafe(numPrograms, 1);
        }
        nglExtGetProgramsQCOM(memAddressSafe(programs), remainingSafe(programs), memAddressSafe(numPrograms));
    }

    // --- [ glExtIsProgramBinaryQCOM ] ---

    @NativeType("GLboolean")
    public static native boolean glExtIsProgramBinaryQCOM(@NativeType("GLuint") int program);

    // --- [ glExtGetProgramBinarySourceQCOM ] ---

    public static native void nglExtGetProgramBinarySourceQCOM(int program, int shadertype, long source, long length);

    public static void glExtGetProgramBinarySourceQCOM(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLchar *") ByteBuffer source, @Nullable @NativeType("GLint *") IntBuffer length) {
        if (CHECKS) {
            checkSafe(length, 1);
        }
        nglExtGetProgramBinarySourceQCOM(program, shadertype, memAddress(source), memAddressSafe(length));
    }

    /** Array version of: {@link #glExtGetShadersQCOM ExtGetShadersQCOM} */
    public static void glExtGetShadersQCOM(@Nullable @NativeType("GLuint *") int[] shaders, @Nullable @NativeType("GLint *") int[] numShaders) {
        long __functionAddress = GLES.getICD().glExtGetShadersQCOM;
        if (CHECKS) {
            check(__functionAddress);
            checkSafe(numShaders, 1);
        }
        callPPV(shaders, lengthSafe(shaders), numShaders, __functionAddress);
    }

    /** Array version of: {@link #glExtGetProgramsQCOM ExtGetProgramsQCOM} */
    public static void glExtGetProgramsQCOM(@Nullable @NativeType("GLuint *") int[] programs, @Nullable @NativeType("GLint *") int[] numPrograms) {
        long __functionAddress = GLES.getICD().glExtGetProgramsQCOM;
        if (CHECKS) {
            check(__functionAddress);
            checkSafe(numPrograms, 1);
        }
        callPPV(programs, lengthSafe(programs), numPrograms, __functionAddress);
    }

    /** Array version of: {@link #glExtGetProgramBinarySourceQCOM ExtGetProgramBinarySourceQCOM} */
    public static void glExtGetProgramBinarySourceQCOM(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLchar *") ByteBuffer source, @Nullable @NativeType("GLint *") int[] length) {
        long __functionAddress = GLES.getICD().glExtGetProgramBinarySourceQCOM;
        if (CHECKS) {
            check(__functionAddress);
            checkSafe(length, 1);
        }
        callPPV(program, shadertype, memAddress(source), length, __functionAddress);
    }

}


text:
package generated.zcsclient.admin;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for unloadMailboxRequest complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="unloadMailboxRequest">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="account" type="{urn:zimbraAdmin}name"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "unloadMailboxRequest", propOrder = {
    "account"
})
public class testUnloadMailboxRequest {

    @XmlElement(required = true)
    protected testName account;

    /**
     * Gets the value of the account property.
     *
     * @return
     *     possible object is
     *     {@link testName }
     *
     */
    public testName getAccount() {
        return account;
    }

    /**
     * Sets the value of the account property.
     *
     * @param value
     *     allowed object is
     *     {@link testName }
     *
     */
    public void setAccount(testName value) {
        this.account = value;
    }

}


text:
<?php

/** Zend_Pdf_Color */
require_once 'Zend/Pdf/Color.php';

/** Zend_Pdf_Element_Numeric */
require_once 'Zend/Pdf/Element/Numeric.php';

/** Zend_Pdf_Element_Array */
require_once 'Zend/Pdf/Element/Array.php';

/** Zend_Pdf_Resource_Font */
require_once 'Zend/Pdf/Resource/Font.php';

/**
 * Style object.
 * Style object doesn't directly correspond to any PDF file object.
 * It's utility class, used as a container for style information.
 * It's used by Zend_Pdf_Page class in draw operations.
 *
 * @package    Zend_Pdf
 * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Pdf_Style
{
    /**
     * Fill color.
     * Used to fill geometric shapes or text.
     *
     * @var Zend_Pdf_Color|null
     */
    private $_fillColor = null;

    /**
     * Line color.
     * Current color, used for lines and font outlines.
     *
     * @var Zend_Pdf_Color|null
     */

    private $_color;

    /**
     * Line width.
     *
     * @var Zend_Pdf_Element_Numeric
     */
    private $_lineWidth;

    /**
     * Array which describes line dashing pattern.
     * It's array of numeric:
     * array($on_length, $off_length, $on_length, $off_length, ...)
     *
     * @var array
     */
    private $_lineDashingPattern;

    /**
     * Line dashing phase
     *
     * @var float
     */
    private $_lineDashingPhase;

    /**
     * Current font
     *
     * @var Zend_Pdf_Resource_Font
     */
    private $_font;

    /**
     * Font size
     *
     * @var float
     */
    private $_fontSize;

    /**
     * Create style.
     *
     * @param Zend_Pdf_Style $anotherStyle
     */
    public function __construct($anotherStyle = null)
    {
        if ($anotherStyle !== null) {
            $this->_fillColor          = $anotherStyle->_fillColor;
            $this->_color              = $anotherStyle->_color;
            $this->_lineWidth          = $anotherStyle->_lineWidth;
            $this->_lineDashingPattern = $anotherStyle->_lineDashingPattern;
            $this->_lineDashingPhase   = $anotherStyle->_lineDashingPhase;
            $this->_font               = $anotherStyle->_font;
            $this->_fontSize           = $anotherStyle->_fontSize;
        }
    }

    /**
     * Set fill color.
     *
     * @param Zend_Pdf_Color $color
     */
    public function setFillColor(Zend_Pdf_Color $color)
    {
        $this->_fillColor = $color;
    }

    /**
     * Set line color.
     *
     * @param Zend_Pdf_Color $color
     */
    public function setLineColor(Zend_Pdf_Color $color)
    {
        $this->_color = $color;
    }

    /**
     * Set line width.
     *
     * @param float $width
     */
    public function setLineWidth($width)
    {
        $this->_lineWidth = new Zend_Pdf_Element_Numeric($width);
    }

    /**
     * Set line dashing pattern
     *
     * @param array $pattern
     * @param float $phase
     */
    public function setLineDashingPattern($pattern, $phase = 0)
    {
        if ($pattern === Zend_Pdf_Page::LINE_DASHING_SOLID) {
            $pattern = array();
            $phase   = 0;
        }

        $this->_lineDashingPattern = $pattern;
        $this->_lineDashingPhase   = new Zend_Pdf_Element_Numeric($phase);
    }

    /**
     * Set current font.
     *
     * @param Zend_Pdf_Resource_Font $font
     * @param float $fontSize
     */
    public function setFont(Zend_Pdf_Resource_Font $font, $fontSize)
    {
        $this->_font = $font;
        $this->_fontSize = $fontSize;
    }

    /**
     * Modify current font size
     *
     * @param float $fontSize
     */
    public function setFontSize($fontSize)
    {
        $this->_fontSize = $fontSize;
    }

    /**
     * Get fill color.
     *
     * @return Zend_Pdf_Color|null
     */
    public function getFillColor()
    {
        return $this->_fillColor;
    }

    /**
     * Get line color.
     *
     * @return Zend_Pdf_Color|null
     */
    public function getLineColor()
    {
        return $this->_color;
    }

    /**
     * Get line width.
     *
     * @return float
     */
    public function getLineWidth()
    {
        $this->_lineWidth->value;
    }

    /**
     * Get line dashing pattern
     *
     * @return array
     */
    public function getLineDashingPattern()
    {
        return $this->_lineDashingPattern;
    }

    /**
     * Get current font.
     *
     * @return Zend_Pdf_Resource_Font $font
     */
    public function getFont()
    {
        return $this->_font;
    }

    /**
     * Get current font size
     *
     * @return float $fontSize
     */
    public function getFontSize()
    {
        return $this->_fontSize;
    }

    /**
     * Get line dashing phase
     *
     * @return float
     */
    public function getLineDashingPhase()
    {
        return $this->_lineDashingPhase->value;
    }

    /**
     * Dump style to a string, which can be directly inserted into content stream
     *
     * @return string
     */
    public function instructions()
    {
        $instructions = '';

        if ($this->_fillColor !== null) {
            $instructions .= $this->_fillColor->instructions(false);
        }

        if ($this->_color !== null) {
            $instructions .= $this->_color->instructions(true);
        }

        if ($this->_lineWidth !== null) {
            $instructions .= $this->_lineWidth->toString() . " w\n";
        }

        if ($this->_lineDashingPattern !== null) {
            $dashPattern = new Zend_Pdf_Element_Array();

            foreach ($this->_lineDashingPattern as $dashItem) {
                $dashElement = new Zend_Pdf_Element_Numeric($dashItem);
                $dashPattern->items[] = $dashElement;
            }

            $instructions .= $dashPattern->toString() . ' '
                           . $this->_lineDashingPhase->toString() . " d\n";
        }

        return $instructions;
    }

}


text:
package coyote.commons.network.http.auth;

import java.util.Map;

import coyote.commons.network.http.HTTPSession;

/**
 * Interface to a component capable of providing authentication (AuthN) and
 * authorization (AuthZ) processing.
 *
 *
The process normally involves checking if the connection is secure (e.g.
 * SSL) if the resource is annotated to only require secure connections. Next
 * the provider is called to check authentication and establish the username
 * and groups for the request. Finally, authorization is performed by checking
 * if the session is a member of one of the given set of groups.
 */
public interface AuthProvider {
  public static final String USERNAME = "username";
  public static final String PASSWORD = "password";
  public static final String USERGROUPS = "usergroups";

  /**
   * Perform authentication of the identity represented in the given session.
   *
   *
It is also generally expected that the authentication operation will
   * populate the session with user name and groups so as to perform
   * subsequent role based access control (RBAC) on the group names
   * associated with the use in this session. Also, if the Auth annotation
   * specifies that Authentication is not required for the resource, the
   * existence of a user name is probably expected to indicate the session
   * represents a logged-in user and that additional processing may be enabled.
   *
   * @param session the session to authenticate
   *
   * @return true if the data in the given session represents an
   *         authenticated user in the system, false if otherwise.
   */
  boolean isAuthenticated(HTTPSession session);

  /**
   * Perform authorization processing on the given session to determine if the
   * associated identity is a member of the given groups.
   *
   * @param session the session to authorize
   * @param groups a comma delimited list of groups
   *
   * @return true if the session is authenticated and a member of one of the
   *         specified groups, false otherwise.
   */
  boolean isAuthorized(HTTPSession session, String groups);

  /**
   * Check to see if the session is using SSL/TLS.
   *
   * @param session the session to validate
   *
   * @return true if the session is using secure, encrypted connection, false
   *         otherwise.
   */
  boolean isSecureConnection(HTTPSession session);

  /**
   * This is a generic utility method to authenticate a set of credentials and
   * populate the given session with the results (username and group list).
   *
   *
This is useful for other components (like login responders) to perform
   * authentication with credentials gathered external to the HTTP request.
   *
   * @param session the HTTP session to authenticate
   * @param credentials the map of credentials (e.g. username and password) to
   *        authenticate.
   *
   * @return true if the authentication was successful, false otherwise.
   */
  boolean authenticate(HTTPSession session, Map<String, String> credentials);

}


text:
package org.efaps.esjp.humanresource.listener;

import org.efaps.admin.program.esjp.EFapsApplication;
import org.efaps.admin.program.esjp.EFapsListener;
import org.efaps.admin.program.esjp.EFapsUUID;

/**
 * This class must be replaced for customization, therefore it is left empty.
 * Functional description can be found in the related "<code>_base</code>"
 * class.
 *
 * @author The eFaps Team
 * @version $Id: Department.java 6164 2011-02-14 02:40:16Z jan@moxter.net $
 */
@EFapsUUID("e6a5fa49-e3cd-48ce-94b0-f41700874474")
@EFapsApplication("eFapsApp-HumanResource")
@EFapsListener
public class OnContact
    extends OnContact_Base
{

}


text:
package com.alibaba.druid.proxy.jdbc;

import java.sql.NClob;

public interface NClobProxy extends ClobProxy, NClob {

    NClob getRawNClob();
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Text;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Core.Tooling;

namespace Cake.Common.Tools.GitVersion
{
    /// <summary>
    /// The GitVersion runner.
    /// </summary>
    public sealed class GitVersionRunner : Tool<GitVersionSettings>
    {
        private ICakeLog _log;

        /// <summary>
        /// Initializes a new instance of the <see cref="GitVersionRunner"/> class.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="environment">The environment.</param>
        /// <param name="processRunner">The process runner.</param>
        /// <param name="globber">The globber.</param>
        /// <param name="log">The log.</param>
        public GitVersionRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner,
            IGlobber globber, ICakeLog log)
            : base(fileSystem, environment, processRunner, globber)
        {
            _log = log;
        }

        /// <summary>
        /// Runs GitVersion and processes the results.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns>A task with the GitVersion results.</returns>
        public GitVersion Run(GitVersionSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            if (settings.OutputType != GitVersionOutput.BuildServer)
            {
                var jsonString = string.Empty;

                Run(settings, GetArguments(settings), new ProcessSettings { RedirectStandardOutput = true },
                process => jsonString = string.Join("\n", process.GetStandardOutput()));

                var jsonSerializer = new DataContractJsonSerializer(typeof(GitVersion));

                using (var jsonStream = new MemoryStream(Encoding.UTF8.GetBytes(jsonString)))
                {
                    return jsonSerializer.ReadObject(jsonStream) as GitVersion;
                }
            }

            Run(settings, GetArguments(settings));

            return new GitVersion();
        }

        private ProcessArgumentBuilder GetArguments(GitVersionSettings settings)
        {
            var builder = new ProcessArgumentBuilder();

            if (settings.OutputType.HasValue)
            {
                switch (settings.OutputType.Value)
                {
                    case GitVersionOutput.Json:
                        builder.Append("/output");
                        builder.Append("json");
                        break;
                    case GitVersionOutput.BuildServer:
                        builder.Append("/output");
                        builder.Append("buildserver");
                        break;
                }
            }

            if (!string.IsNullOrWhiteSpace(settings.ShowVariable))
            {
                builder.Append("/showvariable");
                builder.Append(settings.ShowVariable);
            }

            if (!string.IsNullOrWhiteSpace(settings.UserName))
            {
                builder.Append("/u");
                builder.AppendQuoted(settings.UserName);

                builder.Append("/p");
                builder.AppendQuotedSecret(settings.Password);
            }

            if (settings.UpdateAssemblyInfo)
            {
                builder.Append("/updateassemblyinfo");

                if (settings.UpdateAssemblyInfoFilePath != null)
                {
                    builder.AppendQuoted(settings.UpdateAssemblyInfoFilePath.FullPath);
                }
            }

            if (settings.RepositoryPath != null)
            {
                builder.Append("/targetpath");
                builder.AppendQuoted(settings.RepositoryPath.FullPath);
            }
            else if (!string.IsNullOrWhiteSpace(settings.Url))
            {
                builder.Append("/url");
                builder.AppendQuoted(settings.Url);

                if (!string.IsNullOrWhiteSpace(settings.Branch))
                {
                    builder.Append("/b");
                    builder.Append(settings.Branch);
                }
                else
                {
                    _log.Warning("If you leave the branch name for GitVersion unset, it will fallback to the default branch for the repository.");
                }

                if (!string.IsNullOrWhiteSpace(settings.Commit))
                {
                    builder.Append("/c");
                    builder.AppendQuoted(settings.Commit);
                }

                if (settings.DynamicRepositoryPath != null)
                {
                    builder.Append("/dynamicRepoLocation");
                    builder.AppendQuoted(settings.DynamicRepositoryPath.FullPath);
                }
            }

            if (settings.LogFilePath != null)
            {
                builder.Append("/l");
                builder.AppendQuoted(settings.LogFilePath.FullPath);
            }

            return builder;
        }

        /// <summary>
        /// Gets the name of the tool.
        /// </summary>
        /// <returns>The name of the tool.</returns>
        protected override string GetToolName()
        {
            return "GitVersion";
        }

        /// <summary>
        /// Gets the possible names of the tool executable.
        /// </summary>
        /// <returns>The tool executable name.</returns>
        protected override IEnumerable<string> GetToolExecutableNames()
        {
            return new[] { "GitVersion.exe" };
        }
    }
}


text:
/**
 * Call this function when the user re-sizes the window. Then, the first time the window width becomes too small
 * to hold the main content (<1185px), re-size the help panel to 250px instead of 275px. The second time the
 * width becomes too small (<978px), change the panel to just be static, full-width, and get rid of the
 * scrolling for the panel if it's there. When the window again becomes >=978px, change the panel back.
 */
function updateSidebarForWindowSize() {
    var w = document.documentElement.clientWidth;
    var smallWindowWidth = 978;
    var mediumWindowWidth = 1186;
    var expandedPanelHeight = 500;
    var smallPanelWidth = 250;
    var mediumPanelWidth = 275;
    var scrollbarWidth = 15;
    var panel = document.getElementById("help-panel");
    if (w < smallWindowWidth) {
        $("#help-panel").addClass("not-sidebar").removeClass("sidebar").removeClass("stuck-sidebar");
        $("#help-panel").addClass("not-scrollable").removeClass("scrollable");
        panel.style.width = "auto";
    } else {
        var changedToFixed = $("#help-panel").hasClass("not-sidebar");
        $("#help-panel").addClass("sidebar").removeClass("not-sidebar").removeClass("stuck-sidebar");
        panel.style.width = w < mediumWindowWidth ? smallPanelWidth + "px" : mediumPanelWidth + "px";
        updateSidebarForScrollState();
        if (changedToFixed) {
            if (panel.offsetHeight >= expandedPanelHeight) {
                $("#help-panel").addClass("scrollable").removeClass("not-scrollable");
                panel.style.width = panel.offsetWidth + scrollbarWidth + "px";
            } else {
                $("#help-panel").addClass("not-scrollable").removeClass("scrollable");
            }
        }
    }
}

/*
 * Call this function whenever the user scrolls. If the user scrolls so that the panel, remaining fixed (sidebar),
 * would go into the filler below, change the panel's position to absolute (stuck-sidebar).
 */
function updateSidebarForScrollState() {
    if (document.readyState === "complete") {
        var panelDistanceFromTop = 95;
        var footerHeight = document.getElementById("footer-container").offsetHeight;
        var infoFooterHeight = document.getElementById("info-footer").offsetHeight;
        var fillerHeight = document.getElementsByClassName("filler")[0].offsetHeight;
        var panel = document.getElementById("help-panel");
        if (!$("#help-panel").hasClass("not-sidebar")) {
            var panelRect = panel.getBoundingClientRect();
            var yOffset = document.body.clientHeight - footerHeight - infoFooterHeight - fillerHeight
                    - panelRect.height - panelDistanceFromTop;
            if (window.pageYOffset > yOffset) {
                panel.style.top = "" + yOffset + "px";
                $("#help-panel").addClass("stuck-sidebar").removeClass("sidebar").removeClass("not-sidebar");
            } else if (window.pageYOffset < yOffset) {
                panel.style.top = panelDistanceFromTop + "px";
                $("#help-panel").addClass("sidebar").removeClass("stuck-sidebar").removeClass("not-sidebar");
            }
        }
    }
}

window.addEventListener("resize", updateSidebarForWindowSize);
window.addEventListener("scroll", updateSidebarForScrollState);

$(document).ready(function() {
    updateSidebarForWindowSize();
});


text:
package com.mycompany;

import io.milton.http.Range;
import io.milton.http.exceptions.BadRequestException;
import io.milton.http.exceptions.NotAuthorizedException;
import io.milton.resource.ICalResource;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author brad
 */
public class TEvent extends TResource implements ICalResource {

    private static final Logger log = LoggerFactory.getLogger( TEvent.class );
    private String iCalData;

    public TEvent( TFolderResource parent, String name ) {
        super( parent, name );
    }

    @Override
    protected Object clone( TFolderResource newParent, String newName ) {
        TEvent e = new TEvent( (TCalendarResource) newParent, newName );
        e.setiCalData( iCalData );
        return e;
    }

    @Override
    public void sendContent( OutputStream out, Range range, Map<String, String> params, String contentType ) throws IOException, NotAuthorizedException, BadRequestException {
        out.write( iCalData.getBytes("UTF-8") );
    }

    @Override
    public String getContentType( String accepts ) {
        return "text/calendar";
    }

    @Override
    public String getICalData() {
        return iCalData;
    }

    public void setiCalData( String iCalData ) {
        this.iCalData = iCalData;
    }
}


text:
package org.apache.polygene.manual.recipes.createEntity;

import org.apache.polygene.api.entity.EntityBuilder;
import org.apache.polygene.api.injection.scope.Structure;
import org.apache.polygene.api.unitofwork.UnitOfWork;
import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;

// START SNIPPET: carFactoryMixin2
// START SNIPPET: carFactoryMixin1
public class CarEntityFactoryMixin
    implements CarEntityFactory
{

    // END SNIPPET: carFactoryMixin1
    @Structure
    UnitOfWorkFactory unitOfWorkFactory;

    // END SNIPPET: carFactoryMixin2
// START SNIPPET: carFactoryMixin3
    public CarEntityFactoryMixin( @Structure UnitOfWorkFactory unitOfWorkFactory )
    {
    }

    // END SNIPPET: carFactoryMixin3
// START SNIPPET: create
    public Car create( Manufacturer manufacturer, String model )
    {
        UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
        EntityBuilder<Car> builder = uow.newEntityBuilder( Car.class );

        Car prototype = builder.instance();
        prototype.manufacturer().set( manufacturer );
        prototype.model().set( model );

        return builder.newInstance();
    }
// END SNIPPET: create
}


text:
class PlacesController < ApplicationController
  def index
    @places = Place.includes(:place_content).page(params[:page])
    @places = pretty_format(@places) if params[:pp] == '1'

    render json: @places
  end

  def show
    @place = Place.find_by!(external_id: params[:id])

    render json: @place
  end

  def create
    @place = Place.new place_params

    if @place.invalid?
      render json: @place.errors, status: :bad_request
      return
    end

    @place.save!

    render json: @place
  end

  def update
    @place = Place.find_by!(external_id: params[:id])

    @place.assign_attributes place_params

    if @place.invalid?
      render json: @place.errors, status: :bad_request
      return
    end

    @place.save!

    render json: @place
  end

  def destroy
    @place = Place.find_by!(external_id: params[:id])
    @place.destroy

    render json: nil
  end

  private

  def place_params
    params.permit %i(name)
  end
end


text:
package eleme.openapi.sdk.api.protocol;

public class ErrorPayload {
    private String code;
    private String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}