text:
package com.redhat.ceylon.tools.fatjar;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.jar.Attributes;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;

import com.redhat.ceylon.cmr.api.ModuleQuery;
import com.redhat.ceylon.cmr.impl.IOUtils;
import com.redhat.ceylon.common.FileUtil;
import com.redhat.ceylon.common.JVMModuleUtil;
import com.redhat.ceylon.common.ModuleSpec;
import com.redhat.ceylon.common.Versions;
import com.redhat.ceylon.common.tool.Argument;
import com.redhat.ceylon.common.tool.Description;
import com.redhat.ceylon.common.tool.Option;
import com.redhat.ceylon.common.tool.OptionArgument;
import com.redhat.ceylon.common.tool.Summary;
import com.redhat.ceylon.common.tool.ToolUsageError;
import com.redhat.ceylon.model.cmr.ArtifactResult;
import com.redhat.ceylon.model.loader.JvmBackendUtil;
import com.redhat.ceylon.tools.moduleloading.ModuleLoadingTool;

@Summary("Generate a Ceylon executable jar for a given module")
@Description("Gerate an executable _fat jar_ which contains the given module and all its run-time"
        + " dependencies, including the Ceylon run-time, which makes that jar self-sufficient and"
        + " executable by `java` as if the Ceylon module was run by `ceylon run`."
)
public class CeylonFatJarTool extends ModuleLoadingTool {

    private List<ModuleSpec> modules;
    private boolean force;
	private File out;
    private final List<String> excludedModules = new ArrayList<>();
    /** The (Ceylon) name of the functional to run, e.g. {@code foo.bar::baz} */
    private String run;

    @Argument(order = 1, argumentName="module", multiplicity="+")
    public void setModules(List<String> modules) {
        setModuleSpecs(ModuleSpec.parseEachList(modules));
    }

    public void setModuleSpecs(List<ModuleSpec> modules) {
        this.modules = modules;
    }

    @OptionArgument(longName = "run", argumentName = "toplevel")
    @Description("Specifies the fully qualified name of a toplevel method or class with no parameters. " +
            "The format is: `qualified.package.name::classOrMethodName` with `::` acting as separator " +
            "between the package name and the toplevel class or method name (defaults to `{module}::run`).")
    public void setRun(String run) {
        this.run = run;
    }

    @Description("Target fat-jar file (defaults to `{name}-{version}.jar`).")
    @OptionArgument(shortName = 'o', argumentName="file")
    public void setOut(File out) {
        this.out = out;
    }

    @OptionArgument(argumentName="moduleOrFile", shortName='x')
    @Description("Excludes modules from the resulting far jat. Can be a module name or " +
            "a file containing module names. Can be specified multiple times. Note that "+
            "this excludes the module from the resulting fat jar, but if your modules require that "+
            "module to be present at runtime it will still be required and may cause your "+
            "application to fail to start if it is not provided at runtime.")
    public void setExcludeModule(List<String> exclusions) {
        for (String each : exclusions) {
            File xFile = new File(each);
            if (xFile.exists() && xFile.isFile()) {
                try (BufferedReader reader = new BufferedReader(new FileReader(xFile))) {
                    String line;
                    while ((line = reader.readLine()) != null) {
                        this.excludedModules.add(line);
                    }
                } catch (IOException e) {
                    throw new ToolUsageError(CeylonFatJarMessages.msg("exclude.file.failure", each),
                            e);
                }
            } else {
                this.excludedModules.add(each);
            }
        }
    }

    @Option(longName="force")
    @Description("Force generation of mlib folder with multiple versions of the same module.")
    public void setForce(boolean force) {
        this.force = force;
    }

    @Override
    public void run() throws Exception {
        String firstModuleName = null, firstModuleVersion = null;
        for (ModuleSpec module : modules) {
            String moduleName = module.getName();
            String version = checkModuleVersionsOrShowSuggestions(
                    getRepositoryManager(),
                    moduleName,
                    module.isVersioned() ? module.getVersion() : null,
                    ModuleQuery.Type.JVM,
                    Versions.JVM_BINARY_MAJOR_VERSION,
                    Versions.JVM_BINARY_MINOR_VERSION,
                    null, null, // JS binary but don't care since JVM
                    null);
            if(version == null)
                return;
            if(firstModuleName == null){
                firstModuleName = moduleName;
                firstModuleVersion = version;
            }
            loadModule(null, moduleName, version);
            if(!force)
                errorOnConflictingModule(moduleName, version);
        }

        File outputJar = applyCwd(out != null ? out : new File(firstModuleName+"-"+firstModuleVersion+".jar"));
        if(outputJar.getParentFile() != null && !outputJar.getParentFile().exists()){
            FileUtil.mkdirs(outputJar.getParentFile());
        }
        if(outputJar.exists()){
            FileUtil.delete(outputJar);
        }
        Set<String> added = new HashSet<>();

        Manifest manifest = new Manifest();
        Attributes mainAttributes = manifest.getMainAttributes();
        String className = JVMModuleUtil.javaClassNameFromCeylon(firstModuleName, run != null ? run : (firstModuleName + "::run"));
        mainAttributes.putValue("Main-Class", className);
        mainAttributes.putValue("Manifest-Version", "1.0");
        mainAttributes.putValue("Created-By", "Ceylon fat-jar for module "+firstModuleName+"/"+firstModuleVersion);
        added.add("META-INF/");
        added.add("META-INF/MANIFEST.MF");

        try(ZipOutputStream zipFile = new JarOutputStream(new FileOutputStream(outputJar), manifest)){
            List<ArtifactResult> staticMetamodelEntries = new ArrayList<>(this.loadedModules.size());
            for(ArtifactResult entry : this.loadedModules.values()){
                // since we even add missing modules there to avoid seeing them twice, let's skip them now
                if(entry == null)
                    continue;
                File file = entry.artifact();
                if(file == null)
                    continue;
                // on duplicate, let's only keep the last version
                SortedSet<String> versions = loadedModuleVersions.get(entry.name());
                if(!versions.isEmpty() && entry.version() != null && !entry.version().equals(versions.last()))
                    continue;
                if(isVerbose()){
                    append(file.getAbsolutePath());
                    newline();
                }
                staticMetamodelEntries.add(entry);

                try(ZipFile src = new ZipFile(file)){
                    Enumeration<? extends ZipEntry> entries = src.entries();
                    while(entries.hasMoreElements()){
                        ZipEntry srcEntry = entries.nextElement();
                        // skip manifests
                        if(skipEntry(srcEntry.getName()))
                            continue;
                        if(!added.add(srcEntry.getName())){
                            // multiple folders is fine
                            if(!srcEntry.isDirectory()){
                                this.append("Warning: duplicate entry "+srcEntry.getName()+" (from "+file+") already added: skipping\n");
                            }
                            continue;
                        }
                        srcEntry.setCompressedSize(-1);
                        zipFile.putNextEntry(srcEntry);
                        if(!srcEntry.isDirectory())
                            IOUtils.copyStream(src.getInputStream(srcEntry), zipFile, true, false);
                    }
                }
            }
            JvmBackendUtil.writeStaticMetamodel(zipFile, added, staticMetamodelEntries, jdkProvider);
            zipFile.flush();
        }
        flush();
    }

    private boolean skipEntry(String name) {
        return name.equals("META-INF/MANIFEST.MF")
                || name.equals("META-INF/INDEX.LIST")
                || name.equals("META-INF/mapping.txt")
                // skip signatures too
                || (name.startsWith("META-INF/")
                        && (name.endsWith(".DSA") || name.endsWith(".RSA") || name.endsWith(".SF")));
    }

    @Override
    protected boolean shouldExclude(String moduleName, String version) {
        return super.shouldExclude(moduleName, version) ||
                this.excludedModules.contains(moduleName);
    }
}


text:
package uk.ac.ebi.biosamples.service;

import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import java.util.List;
import java.util.Optional;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.IanaLinkRelations;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.server.RepresentationModelAssembler;
import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import uk.ac.ebi.biosamples.controller.SampleCurationLinksRestController;
import uk.ac.ebi.biosamples.controller.SampleRestController;
import uk.ac.ebi.biosamples.controller.StructuredDataRestController;
import uk.ac.ebi.biosamples.model.Sample;

/**
 * This class is used by Spring to add HAL _links for {@Link Sample} objects.
 *
 * @author faulcon
 */
@Service
public class SampleResourceAssembler
    implements RepresentationModelAssembler<Sample, EntityModel<Sample>> {

  public static final String REL_CURATIONDOMAIN = "curationDomain";
  public static final String REL_CURATIONLINKS = "curationLinks";
  public static final String REL_CURATIONLINK = "curationLink";

  public SampleResourceAssembler() {}

  private Link getSelfLink(
      String accession,
      Optional<Boolean> legacydetails,
      Optional<List<String>> curationDomains,
      Class controllerClass) {
    UriComponentsBuilder uriComponentsBuilder =
        linkTo(controllerClass, accession).toUriComponentsBuilder();
    if (legacydetails.isPresent() && legacydetails.get()) {
      uriComponentsBuilder.queryParam("legacydetails", legacydetails);
    }
    if (curationDomains != null && curationDomains.isPresent()) {
      if (curationDomains.get().size() == 0) {
        uriComponentsBuilder.queryParam("curationdomain", (Object[]) null);
      } else {
        for (String curationDomain : curationDomains.get()) {
          uriComponentsBuilder.queryParam("curationdomain", curationDomain);
        }
      }
    }
    return Link.of(uriComponentsBuilder.build().toUriString(), IanaLinkRelations.SELF);
  }

  private Link getCurationDomainLink(Link selfLink) {
    UriComponents selfUriComponents =
        UriComponentsBuilder.fromUriString(selfLink.getHref()).build();
    if (selfUriComponents.getQueryParams().size() == 0) {
      return Link.of(selfLink.getHref() + "{?curationdomain}", REL_CURATIONDOMAIN);
    } else {
      return Link.of(selfLink.getHref() + "{&curationdomain}", REL_CURATIONDOMAIN);
    }
  }

  private Link getCurationLinksLink(String accession) {
    return linkTo(
            methodOn(SampleCurationLinksRestController.class)
                .getCurationLinkPageJson(accession, null, null))
        .withRel("curationLinks");
  }

  private Link getCurationLinkLink(String accession) {
    return linkTo(
            methodOn(SampleCurationLinksRestController.class).getCurationLinkJson(accession, null))
        .withRel("curationLink");
  }

  private Link getStructuredDataLink(String accession) {
    return linkTo(methodOn(StructuredDataRestController.class).get(accession))
        .withRel("structuredData");
  }

  public EntityModel<Sample> toModel(
      Sample sample,
      Optional<Boolean> legacydetails,
      Optional<List<String>> curationDomains,
      Class controllerClass) {
    EntityModel<Sample> sampleResource = EntityModel.of(sample);
    sampleResource.add(
        getSelfLink(sample.getAccession(), legacydetails, curationDomains, controllerClass));
    // add link to select curation domain
    sampleResource.add(getCurationDomainLink(sampleResource.getLink(IanaLinkRelations.SELF).get()));
    // add link to curationLinks on this sample
    sampleResource.add(getCurationLinksLink(sample.getAccession()));
    sampleResource.add(getCurationLinkLink(sample.getAccession()));
    sampleResource.add(getStructuredDataLink(sample.getAccession()));
    return sampleResource;
  }

  public EntityModel<Sample> toModel(
      Sample sample, Optional<Boolean> legacydetails, Optional<List<String>> curationDomains) {
    Class controllerClass = SampleRestController.class;
    return toModel(sample, legacydetails, curationDomains, controllerClass);
  }

  public EntityModel<Sample> toModel(Sample sample, Class controllerClass) {
    return toModel(sample, Optional.empty(), Optional.empty(), controllerClass);
  }

  @Override
  public EntityModel<Sample> toModel(Sample sample) {
    Class controllerClass = SampleRestController.class;
    return toModel(sample, controllerClass);
  }
}

redpajama_set_name: RedPajamaGithub


text:
/*global define*/
/*jslint vars:true*/
define([
    'util/cacheHandler',
    'mongoose',
    'databaseConfig',
    'log'
], function (Cache, mongoose, databaseConfig, log) {
    'use strict';
    var dbconcache = new Cache(databaseConfig.maxConnections,
        function resolve(dbname, callback) {

            var opt = {
                user: databaseConfig.username,
                pass: databaseConfig.password,
                auth: {
                    authdb: databaseConfig.authdb
                }
            };

            var connection = mongoose.createConnection(databaseConfig.host, dbname, databaseConfig.port, opt);

            connection.on('open', function () {
                callback(connection);
            });

            connection.on('error', function (err) {
                log.error(err);
            });
        },
        function dispose(db) {
            db.close();
        });

    return dbconcache;
});


text:
package com.flipkart.lyrics.processor.methods;

import com.flipkart.lyrics.config.Tune;
import com.flipkart.lyrics.model.FieldModel;
import com.flipkart.lyrics.model.MetaInfo;
import com.flipkart.lyrics.model.TypeModel;
import com.flipkart.lyrics.processor.Handler;
import com.flipkart.lyrics.sets.RuleSet;
import com.flipkart.lyrics.specs.MethodSpec;
import com.flipkart.lyrics.specs.Modifier;
import com.flipkart.lyrics.specs.TypeSpec;

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

/**
 * Created by shrey.garg on 26/11/16.
 */
public class ToStringHandler extends Handler {

    public ToStringHandler(Tune tune, MetaInfo metaInfo, RuleSet ruleSet) {
        super(tune, metaInfo, ruleSet);
    }

    @Override
    public void process(TypeSpec.Builder typeBuilder, TypeModel typeModel) {
        if (!tune.isToStringNeeded() || tune.getObjectMethodsStyle() == null) {
            return;
        }

        Map<String, FieldModel> fieldModels = typeModel.getFields();
        List<String> nonStaticFields = fieldModels.entrySet().stream()
                .filter(entry ->
                        (!entry.getValue().isExcludeFromToString() && !Arrays.stream(entry.getValue().getModifiers())
                                .anyMatch(modifier -> modifier.equals(Modifier.STATIC))))
                .map(Map.Entry::getKey)
                .collect(Collectors.toList());

        MethodSpec.Builder toStringBuilder = MethodSpec.methodBuilder("toString")
                .addModifiers(Modifier.PUBLIC)
                .returns(String.class)
                .addAnnotation(Override.class);

        tune.getObjectMethodsStyle().processToString(toStringBuilder, nonStaticFields, metaInfo);

        typeBuilder.addMethod(toStringBuilder.build());
    }
}


text:
module Fog
  module ApplicationGateway
    # Fog Service Class for AzureRM
    class AzureRM < Fog::Service
      requires :tenant_id
      requires :client_id
      requires :client_secret
      requires :subscription_id
      recognizes :environment

      request_path 'fog/azurerm/requests/application_gateway'
      request :create_or_update_application_gateway
      request :delete_application_gateway
      request :list_application_gateways
      request :get_application_gateway
      request :check_ag_exists
      request :update_subnet_id_in_gateway_ip_configuration
      request :update_sku_attributes
      request :start_application_gateway
      request :stop_application_gateway

      model_path 'fog/azurerm/models/application_gateway'
      model :gateway
      collection :gateways
      model :backend_address_pool
      model :backend_http_setting
      model :frontend_ip_configuration
      model :frontend_port
      model :ip_configuration
      model :http_listener
      model :probe
      model :request_routing_rule
      model :ssl_certificate
      model :url_path_map

      # Mock class for Application Gateway Service
      class Mock
        def initialize(_options = {})
          begin
            require 'azure_mgmt_network'
          rescue LoadError => e
            retry if require('rubygems')
            raise e.message
          end
        end
      end

      # Real class for Application Gateway Service
      class Real
        def initialize(options = {})
          begin
            require 'azure_mgmt_network'
          rescue LoadError => e
            retry if require('rubygems')
            raise e.message
          end

          telemetry = "fog-azure-rm/#{Fog::AzureRM::VERSION}"

          options[:environment] = 'AzureCloud' if options[:environment].nil?

          credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret], options[:environment])
          @network_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials, resource_manager_endpoint_url(options[:environment]))
          @network_client.subscription_id = options[:subscription_id]
          @network_client.add_user_agent_information(telemetry)
          @tenant_id = options[:tenant_id]
          @client_id = options[:client_id]
          @client_secret = options[:client_secret]
          @subscription_id = options[:subscription_id]
          @environment = options[:environment]
        end
      end
    end
  end
end


text:
/* Desc: External interfaces for Gazebo
 * Author: Nate Koenig
 * Date: 03 Apr 2007
 */

#ifndef _QUATERNION_HH_
#define _QUATERNION_HH_

#include <math.h>
#include <iostream>
#include <cmath>

#include "math/Helpers.hh"
#include "math/Angle.hh"
#include "math/Vector3.hh"
#include "math/Matrix3.hh"
#include "math/Matrix4.hh"

namespace gazebo
{
  namespace math
  {
  /// \addtogroup gazebo_math
  /// \{

  /// \class Quaternion Quaternion.hh math/gzmath.hh
  /// \brief A quaternion class
  class Quaternion
  {
    /// \brief Default Constructor
    public: Quaternion();

    /// \brief Constructor
    /// \param[in] _w W param
    /// \param[in] _x X param
    /// \param[in] _y Y param
    /// \param[in] _z Z param
    public: Quaternion(const double &_w, const double &_x, const double &_y,
                        const double &_z);

    /// \brief Constructor from Euler angles in radians
    /// \param[in] _roll  roll
    /// \param[in] _pitch pitch
    /// \param[in] _yaw   yaw
    public: Quaternion(const double &_roll, const double &_pitch,
                        const double &_yaw);

    /// \brief Constructor from axis angle
    /// \param[in] _axis the rotation axis
    /// \param[in] _angle the rotation angle in radians
    public: Quaternion(const Vector3 &_axis, const double &_angle);

    /// \brief Constructor
    /// \param[in] _rpy euler angles
    public: Quaternion(const Vector3 &_rpy);

    /// \brief Copy constructor
    /// \param qt Quaternion to copy
    public: Quaternion(const Quaternion &_qt);

    /// \brief Destructor
    public: ~Quaternion();

    /// \brief Equal operator
    /// \param[in] _qt Quaternion to copy
    public: Quaternion &operator =(const Quaternion &_qt);

    /// \brief Invert the quaternion
    public: void Invert();

    /// \brief Get the inverse of this quaternion
    /// \return Inverse quarenion
    public: inline Quaternion GetInverse() const
            {
              double s = 0;
              Quaternion q(this->w, this->x, this->y, this->z);

              // use s to test if quaternion is valid
              s = q.w * q.w + q.x * q.x + q.y * q.y + q.z * q.z;

              if (math::equal(s, 0.0))
              {
                q.w = 1.0;
                q.x = 0.0;
                q.y = 0.0;
                q.z = 0.0;
              }
              else
              {
                // deal with non-normalized quaternion
                // div by s so q * qinv = identity
                q.w =  q.w / s;
                q.x = -q.x / s;
                q.y = -q.y / s;
                q.z = -q.z / s;
              }
              return q;
            }

    /// \brief Set the quatern to the identity
    public: void SetToIdentity();

    /// \brief Return the logarithm
    /// \return the log
    public: Quaternion GetLog() const;

    /// \brief Return the exponent
    /// \return the exp
    public: Quaternion GetExp() const;

    /// \brief Normalize the quaternion
    public: void Normalize();

    /// \brief Set the quaternion from an axis and angle
    /// \param[in] _x X axis
    /// \param[in] _y Y axis
    /// \param[in] _z Z axis
    /// \param[in] _a Angle in radians
    public: void SetFromAxis(double _x, double _y, double _z, double _a);

    /// \brief Set the quaternion from an axis and angle
    /// \param[in] _axis Axis
    /// \param[in] _a Angle in radians
    public: void SetFromAxis(const Vector3 &_axis, double _a);

    /// \brief Set this quaternion from 4 floating numbers
    /// \param[in] _u u
    /// \param[in] _x x
    /// \param[in] _y y
    /// \param[in] _z z
    public: void Set(double _u, double _x, double _y, double _z);

    /// \brief Set the quaternion from Euler angles
    /// \param[in] vec  Euler angle
    public: void SetFromEuler(const Vector3 &_vec);

    /// \brief Return the rotation in Euler angles
    /// \return This quaternion as an Euler vector
    public: Vector3 GetAsEuler() const;

    /// \brief Convert euler angles to quatern.
    /// \param[in]
    public: static Quaternion EulerToQuaternion(const Vector3 &_vec);

    /// \brief Convert euler angles to quatern.
    /// \param[in] _x rotation along x
    /// \param[in] _y rotation along y
    /// \param[in] _z rotation along z
    public: static Quaternion EulerToQuaternion(double _x,
                                                double _y,
                                                double _z);

    /// \brief Get the Euler roll angle in radians
    /// \return the roll
    public: double GetRoll();

    /// \brief Get the Euler pitch angle in radians
    /// \return the pitch
    public: double GetPitch();

    /// \brief Get the Euler yaw angle in radians
    /// \return the yaw
    public: double GetYaw();

    /// \brief Return rotation as axis and angle
    /// \param[in] _axis rotation axis
    /// \param[in] _angle ccw angle in radians
    public: void GetAsAxis(Vector3 &_axis, double &_angle) const;

    /// \brief Scale a Quaternionion
    /// \param[in] _scale Amount to scale this rotation
    public: void Scale(double _scale);

    /// \brief Addition operator
    /// \param[in] _qt quaternion for addition
    /// \return this quaternion + _qt
    public: Quaternion operator+(const Quaternion &_qt) const;

    /// \brief Addition operator
    /// \param[in] _qt quaternion for addition
    /// \return this quaternion + qt
    public: Quaternion operator+=(const Quaternion &_qt);

    /// \brief Substraction operator
    /// \param[in] _qt quaternion to substract
    /// \return this quaternion - _qt
    public: Quaternion operator-(const Quaternion &_qt) const;

    /// \brief Substraction operator
    /// \param[in] _qt Quaternion for substraction
    /// \return This quatern - qt
    public: Quaternion operator-=(const Quaternion &_qt);

    /// \brief Multiplication operator
    /// \param[in] _qt Quaternion for multiplication
    /// \return This quaternion multiplied by the parameter
    public: inline Quaternion operator*(const Quaternion &_q) const
            {
              return Quaternion(
                  this->w*_q.w - this->x*_q.x - this->y*_q.y - this->z*_q.z,
                  this->w*_q.x + this->x*_q.w + this->y*_q.z - this->z*_q.y,
                  this->w*_q.y - this->x*_q.z + this->y*_q.w + this->z*_q.x,
                  this->w*_q.z + this->x*_q.y - this->y*_q.x + this->z*_q.w);
            }

    /// \brief Multiplication operator
    /// \param[in] _f factor
    /// \return quaternion multiplied by _f
    public: Quaternion operator*(const double &_f) const;

    /// \brief Multiplication operator
    /// \param[in] _qt Quaternion for multiplication
    /// \return This quatern multiplied by the parameter
    public: Quaternion operator*=(const Quaternion &qt);

    /// \brief Vector3 multiplication operator
    /// \param[in] _v vector to multiply
    public: Vector3 operator*(const Vector3 &_v) const;

    /// \brief Equal to operator
    /// \param[in] _qt Quaternion for comparison
    /// \return True if equal
    public: bool operator ==(const Quaternion &_qt) const;

    /// \brief Not equal to operator
    /// \param[in] _qt Quaternion for comparison
    /// \return True if not equal
    public: bool operator!=(const Quaternion &_qt) const;

    /// \brief Unary minus operator
    /// \return negates each component of the quaternion
    public: Quaternion operator-() const;

    /// \brief Rotate a vector using the quaternion
    /// \param[in] _vec vector to rotate
    /// \return the rotated vector
    public: inline Vector3 RotateVector(const Vector3 &_vec) const
            {
              Quaternion tmp(0.0, _vec.x, _vec.y, _vec.z);
              tmp = (*this) * (tmp * this->GetInverse());
              return Vector3(tmp.x, tmp.y, tmp.z);
            }

    /// \brief Do the reverse rotation of a vector by this quaternion
    /// \param[in] _vec the vector
    /// \return the
    public: Vector3 RotateVectorReverse(Vector3 _vec) const;

    /// \brief See if a quatern is finite (e.g., not nan)
    /// \return True if quatern is finite
    public: bool IsFinite() const;

    /// \brief Correct any nan
    public: inline void Correct()
            {
              if (!finite(this->x))
                this->x = 0;
              if (!finite(this->y))
                this->y = 0;
              if (!finite(this->z))
                this->z = 0;
              if (!finite(this->w))
                this->w = 1;

              if (math::equal(this->w, 0.0) &&
                  math::equal(this->x, 0.0) &&
                  math::equal(this->y, 0.0) &&
                  math::equal(this->z, 0.0))
              {
                this->w = 1;
              }
            }

    /// \brief Get the quaternion as a 3x3 matrix
    public: Matrix3 GetAsMatrix3() const;

    /// \brief Get the quaternion as a 4x4 matrix
    /// \return a 4x4 matrix
    public: Matrix4 GetAsMatrix4() const;

    /// \brief Return the X axis
    /// \return the vector
    public: Vector3 GetXAxis() const;

    /// \brief Return the Y axis
    /// \return the vector
    public: Vector3 GetYAxis() const;

    /// \brief Return the Z axis
    /// \return the vector
    public: Vector3 GetZAxis() const;

    /// \brief Round all values to _precision decimal places
    /// \param[in] _precision the precision
    public: void Round(int _precision);

    /// \brief Dot product
    /// \param[in] _q the other quaternion
    /// \return the product
    public: double Dot(const Quaternion &_q) const;

    /// \brief Spherical quadratic interpolation
    /// given the ends and an interpolation parameter between 0 and 1
    /// \param[in] _ft the interpolation parameter
    /// \param[in] _rkP the beginning quaternion
    /// \param[in] _rkA first intermediate quaternion
    /// \param[in] _rkB second intermediate quaternion
    /// \param[in] _rkQ the end quaternion
    /// \param[in] _shortestPath when true, the rotation may be inverted to
    /// get to minimize rotation
    public: static Quaternion Squad(double _fT, const Quaternion &_rkP,
                const Quaternion &_rkA, const Quaternion &_rkB,
                const Quaternion &_rkQ, bool _shortestPath = false);

    /// \brief Spherical linear interpolation between 2 quaternions,
    /// given the ends and an interpolation parameter between 0 and 1
    /// \param[in] _ft the interpolation parameter
    /// \param[in] _rkP the beginning quaternion
    /// \param[in] _rkQ the end quaternion
    /// \param[in] _shortestPath when true, the rotation may be inverted to
    /// get to minimize rotation
    public: static Quaternion Slerp(double _fT, const Quaternion &_rkP,
                const Quaternion &_rkQ, bool _shortestPath = false);

    /// \brief Attributes of the quaternion
    public: double w;

    /// \brief Attributes of the quaternion
    public: double x;

    /// \brief Attributes of the quaternion
    public: double y;

    /// \brief Attributes of the quaternion
    public: double z;

    /// \brief Stream insertion operator
    /// \param[in] _out output stream
    /// \param[in] _q quaternion to output
    /// \return the stream
    public: friend  std::ostream &operator<<(std::ostream &_out,
                const gazebo::math::Quaternion &_q)
    {
      Vector3 v(_q.GetAsEuler());
      _out << v.x << " " << v.y << " " << v.z;
      return _out;
    }

    /// \brief Stream extraction operator
    /// \param[in] _in input stream
    /// \param[in] _q Quaternion to read values into
    /// \return The istream
    public: friend std::istream &operator>>(std::istream &_in,
                                             gazebo::math::Quaternion &_q)
    {
      Angle r, p, y;

      // Skip white spaces
      _in.setf(std::ios_base::skipws);
      _in >> r >> p >> y;

      _q.SetFromEuler(Vector3(*r, *p, *y));

      return _in;
    }
  };
  /// \}
  }
}
#endif


text:
/*  =========================================================================
    Author: Leonardo Citraro
    Company:
    Filename: test_performance.cpp
    Last modifed:   29.12.2016 by Leonardo Citraro
    Description:    Test of the HOG feature

    =========================================================================
    https://lear.inrialpes.fr/people/triggs/pubs/Dalal-cvpr05.pdf
    =========================================================================
*/
#include "HOG.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <algorithm>
#include <memory>
#include <functional>
#include <chrono>

template<typename TimeT = std::chrono::milliseconds>
struct measure
{
    template<typename F, typename ...Args>
    static typename TimeT::rep run(F&& func, Args&&... args)
    {
        auto start = std::chrono::steady_clock::now();
        std::forward<decltype(func)>(func)(std::forward<Args>(args)...);
        auto duration = std::chrono::duration_cast<TimeT>(std::chrono::steady_clock::now() - start);
        return duration.count();
    }
};

template<size_t N>
struct mean_stddev {
    template<typename F, typename ...Args>
    static auto run(F&& func, Args&&... args){
        std::array<double, N> buffer;
        for(auto& buf : buffer)
            buf = std::forward<decltype(func)>(func)(std::forward<Args>(args)...);
        auto sum = std::accumulate(std::begin(buffer), std::end(buffer), 0.0);
        auto mean = sum/buffer.size();
        std::array<double, N> diff;
        std::transform(std::begin(buffer), std::end(buffer), std::begin(diff), [mean](auto x) { return x - mean; });
        auto sq_sum = std::inner_product(std::begin(diff), std::end(diff), std::begin(diff), 0.0);
        auto stddev = std::sqrt(sq_sum/buffer.size());
        return std::make_pair(mean,stddev);
    }
};

int main(int argc, char* argv[]) {

    auto function = [](const int n_threads){
        cv::Mat image = cv::imread("00001665.jpg", CV_8U);

        // Retrieve the HOG from the image
        size_t cellsize = 5;
        size_t blocksize = cellsize*2;
        size_t stride = cellsize;
        size_t binning = 9;
        HOG hog(blocksize, cellsize, stride, binning, HOG::GRADIENT_UNSIGNED, HOG::L2hys);
        hog.process(image);

        cv::Size window(50,100);

        #pragma omp parallel num_threads(n_threads)
        {
            #pragma omp for collapse(2)
            for(int x=0; x<image.cols-window.width; x += cellsize){
                 for(int y=0; y<image.rows-window.height; y += cellsize){
                    cv::Rect r = cv::Rect(x,y, window.width, window.height);
                    auto hist = hog.retrieve(r);

                    // do something with hist ...

                }
            }
        }
    };

    auto res = mean_stddev<3>::run([&](){return measure<>::run(function,1);});
    std::cout << "Time elapsed (n_threads=1): " << res.first << "(+-" << res.second << ") [ms]\n";
    res = mean_stddev<3>::run([&](){return measure<>::run(function,2);});
    std::cout << "Time elapsed (n_threads=2): " << res.first << "(+-" << res.second << ") [ms]\n";
    res = mean_stddev<3>::run([&](){return measure<>::run(function,4);});
    std::cout << "Time elapsed (n_threads=4): " << res.first << "(+-" << res.second << ") [ms]\n";
    res = mean_stddev<3>::run([&](){return measure<>::run(function,8);});
    std::cout << "Time elapsed (n_threads=8): " << res.first << "(+-" << res.second << ") [ms]\n";

    return 0;

}

// Tested on an Intel quad-core hyperthreading i7-4700MQ 2.4GHz 64 bits architecture

/*
 * Using HOG::none
 *
    Time elapsed (n_threads=1): 407(+-18.5472) [ms]
    Time elapsed (n_threads=2): 277.667(+-1.88562) [ms]
    Time elapsed (n_threads=4): 164(+-5.09902) [ms]
    Time elapsed (n_threads=8): 141(+-6.37704) [ms]
*/

/*
 * Using HOG::L2hys
 *
    Time elapsed (n_threads=1): 1088(+-4.08248) [ms]
    Time elapsed (n_threads=2): 635.667(+-2.62467) [ms]
    Time elapsed (n_threads=4): 382.333(+-18.8031) [ms]
    Time elapsed (n_threads=8): 347.333(+-3.39935) [ms]
*/


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ui-form xmlns="http://www.efaps.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.efaps.org/xsd http://www.efaps.org/xsd/eFaps_1.0.xsd">
    <uuid>e1227eb9-d521-4118-9ac7-05c273d3ca77</uuid>
    <file-application>eFapsApp-Payroll</file-application>
    <file-revision>$Rev: 5319 $</file-revision>
    <definition>
        <version-expression>(version==latest)</version-expression>
        <name>Payroll_AdvanceCreateForm</name>
        <field name="date">
            <property name="Attribute">Date</property>
            <property name="ModeEdit">EDITABLE</property>
            <property name="ModeCreate">EDITABLE</property>
        </field>
        <field character="Heading" name="payslipHeading">
            <property name="ModeCreate">READONLY</property>
            <property name="Level">2</property>
            <property name="Label">Payroll_PayslipCreateMassiveForm.payslipHeading.Label</property>
        </field>
        <field character="Target" name="paymentTable">
            <property name="ModeCreate">EDITABLE</property>
            <property name="ModeView">NONE</property>
            <property name="ModeEdit">NONE</property>

Payroll_AdvanceTable

            <evaluate program="org.efaps.esjp.common.uitable.MultiPrint">
                <property name="Type">Payroll_Advance</property>
            </evaluate>
        </field>
    </definition>
</ui-form>


text:
"""
This file contains the operations to perform database consistency checking
on two databases.
"""

from mysql.utilities.common.tools import check_python_version

# Check Python version compatibility
check_python_version()

import os
import re
import sys

from mysql.utilities.exception import UtilError, FormatError
from mysql.utilities.command.dbcompare import database_compare
from mysql.utilities.common.ip_parser import parse_connection
from mysql.utilities.common.dbcompare import DEFAULT_SPAN_KEY_SIZE
from mysql.utilities.common.pattern_matching import REGEXP_OBJ_NAME
from mysql.utilities.common.tools import check_connector_python
from mysql.utilities.common.messages import (PARSE_ERR_DB_PAIR,
                                             PARSE_ERR_DB_PAIR_EXT,
                                             PARSE_ERR_DB_MISSING_CMP,
                                             PARSE_ERR_SPAN_KEY_SIZE_TOO_LOW)
from mysql.utilities.common.options import (add_difftype, add_verbosity,
                                            check_verbosity,
                                            add_changes_for, add_reverse,
                                            add_format_option,
                                            add_character_set_option,
                                            add_ssl_options, get_ssl_dict,
                                            setup_common_options,
                                            check_password_security)
from mysql.utilities.common.sql_transform import (is_quoted_with_backticks,
                                                  remove_backtick_quoting,
                                                  quote_with_backticks)

# Constants
NAME = "MySQL Utilities - mysqldbcompare "
DESCRIPTION = "mysqldbcompare - compare databases for consistency"
USAGE = "%prog --server1=user:pass@host:port:socket " + \
        "--server2=user:pass@host:port:socket db1:db2"
PRINT_WIDTH = 75

# Check for connector/python
if not check_connector_python():
    sys.exit(1)

if __name__ == '__main__':
    # Setup the command parser
    parser = setup_common_options(os.path.basename(sys.argv[0]),
                                  DESCRIPTION, USAGE, server=False)

    # Connection information for the source server
    parser.add_option("--server1", action="store", dest="server1",
                      type="string", default="root@localhost:3306",
                      help="connection information for first server in "
                           "the form: <user>[:<password>]@<host>[:<port>]"
                           "[:<socket>] or <login-path>[:<port>][:<socket>].")

    # Connection information for the destination server
    parser.add_option("--server2", action="store", dest="server2",
                      type="string", default=None,
                      help="connection information for second server in "
                           "the form: <user>[:<password>]@<host>[:<port>]"
                           "[:<socket>] or <login-path>[:<port>][:<socket>].")

    # Add character set option
    add_character_set_option(parser)

    # Output format
    add_format_option(parser, "display the output in either grid (default), "
                              "tab, csv, or vertical format", "grid")

    # Add skips
    parser.add_option("--skip-checksum-table", action="store_true",
                      dest="no_checksum_table",
                      help="skip CHECKSUM TABLE step in data consistency "
                           "check.")

    parser.add_option("--skip-object-compare", action="store_true",
                      dest="no_object_check",
                      help="skip object comparison step.")

    parser.add_option("--skip-row-count", action="store_true",
                      dest="no_row_count",
                      help="skip row count step.")

    parser.add_option("--skip-diff", action="store_true",
                      dest="no_diff",
                      help="skip the object diff step.")

    parser.add_option("--skip-data-check", action="store_true",
                      dest="no_data",
                      help="skip data consistency check.")

    # Skip check of table options.
    parser.add_option("--skip-table-options", action="store_true",
                      dest="skip_tbl_opts",
                      help="skip check of all table options (e.g., "
                           "AUTO_INCREMENT, ENGINE, CHARSET, etc.).")

    # Add display width option
    parser.add_option("--width", action="store", dest="width",
                      type="int", help="display width",
                      default=PRINT_WIDTH)

    # run-all-tests mode
    parser.add_option("-a", "--run-all-tests", action="store_true",
                      dest="run_all_tests",
                      help="do not abort when a diff test fails")

    # Add compact option for resulting diff
    parser.add_option("-c", "--compact", action="store_true",
                      dest="compact", help="compact output from a diff.")

    # turn off binlog mode
    parser.add_option("--disable-binary-logging", action="store_true",
                      default=False, dest="toggle_binlog",
                      help="turn binary logging off during operation if "
                           "enabled (SQL_LOG_BIN=1). Note: may require SUPER "
                           "privilege. Prevents compare operations from being "
                           "written to the binary log.")

    # add the span key option
    parser.add_option(
        "--span-key-size", action="store", default=DEFAULT_SPAN_KEY_SIZE,
        type="int", dest="span_key_size",
        help="changes the size of the key used for compare table contents. A "
             "higher value can help to get more accurate results comparing "
             "large databases, but may slow the algorithm. Default value is "
             "{0}.".format(DEFAULT_SPAN_KEY_SIZE)
    )

    # add the use indexes option
    parser.add_option(
        "--use-indexes", action="store", type="string", default='',
        dest="use_indexes",
        help="for each table, indicate which index to use as if were a "
             "primary key (each of his columns must not allow null values)."
    )

    # Add verbosity and quiet (silent) mode
    add_verbosity(parser, True)

    # Add difftype option
    add_difftype(parser, True)

    # Add the direction (changes-for)
    add_changes_for(parser)

    # Add show reverse option
    add_reverse(parser)

    # Add ssl options
    add_ssl_options(parser)

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check security settings
    check_password_security(opt, args, "# ")

    # Warn if quiet and verbosity are both specified
    check_verbosity(opt)

    # check unique keys
    ukey_regexp = re.compile(r'(?:(?:;){{0,1}}{0}\.{0})'
                             ''.format(REGEXP_OBJ_NAME))

    db_idxes_l = None

    # Split the table names considering backtick quotes
    if opt.use_indexes:
        grp = ukey_regexp.findall(opt.use_indexes)
        if not grp:
            parser.error("Can't parse the specified --use-indexes argument {0}"
                         "".format(opt.use_indexes))
        db_idxes_l = []
        for table, index in grp:
            table_uc = (table if is_quoted_with_backticks(table)
                        else quote_with_backticks(table))
            index_uc = (index if is_quoted_with_backticks(index)
                        else quote_with_backticks(index))
            db_idxes_l.append((table_uc, index_uc))

    # Set options for database operations.
    options = {
        "quiet": opt.quiet,
        "verbosity": opt.verbosity,
        "difftype": opt.difftype,
        "run_all_tests": opt.run_all_tests,
        "width": opt.width,
        "no_checksum_table": opt.no_checksum_table,
        "no_object_check": opt.no_object_check,
        "no_diff": opt.no_diff,
        "no_row_count": opt.no_row_count,
        "no_data": opt.no_data,
        "format": opt.format,
        "toggle_binlog": opt.toggle_binlog,
        "changes-for": opt.changes_for,
        "reverse": opt.reverse,
        "span_key_size": opt.span_key_size,
        "skip_table_opts": opt.skip_tbl_opts,
        "charset": opt.charset,
        "use_indexes": db_idxes_l,
        "compact": opt.compact
    }

    # Add ssl options to options instead of connection.
    options.update(get_ssl_dict(opt))

    # Parse server connection values
    server2_values = None
    try:
        server1_values = parse_connection(opt.server1, None, options)
    except FormatError:
        _, err, _ = sys.exc_info()
        parser.error("Server1 connection values invalid: %s." % err)
    except UtilError:
        _, err, _ = sys.exc_info()
        parser.error("Server1 connection values invalid: %s." % err.errmsg)

    if opt.server2:
        try:
            server2_values = parse_connection(opt.server2, None, options)
        except FormatError:
            _, err, _ = sys.exc_info()
            parser.error("Server2 connection values invalid: %s." % err)
        except UtilError:
            _, err, _ = sys.exc_info()
            parser.error("Server2 connection values invalid: %s." % err.errmsg)

    # Check for arguments
    if len(args) == 0:
        parser.error(PARSE_ERR_DB_MISSING_CMP)

    if opt.span_key_size and opt.span_key_size < DEFAULT_SPAN_KEY_SIZE:
        parser.error(
            PARSE_ERR_SPAN_KEY_SIZE_TOO_LOW.format(
                s_value=opt.span_key_size, default=DEFAULT_SPAN_KEY_SIZE))
    # Operations to perform:
    # 1) databases exist
    # 2) check object counts
    # 3) check object differences
    # 4) check row counts among the tables
    # 5) check table data consistency

    res = True
    check_failed = False
    arg_regexp = re.compile(r'{0}(?:(?:\:){0})?'.format(REGEXP_OBJ_NAME))
    for db in args:
        # Split the database names considering backtick quotes
        grp = arg_regexp.match(db)
        if not grp:
            parser.error(PARSE_ERR_DB_PAIR.format(db_pair=db,
                                                  db1_label='db1',
                                                  db2_label='db2'))
        parts = grp.groups()
        matched_size = len(parts[0])
        if not parts[1]:
            parts = (parts[0], parts[0])
        else:
            # add 1 for the separator ':'
            matched_size = matched_size + 1
            matched_size = matched_size + len(parts[1])
        # Verify if the size of the databases matched by the REGEX is equal
        # to the initial specified string. In general, this identifies the
        # missing use of backticks.
        if matched_size != len(db):
            parser.error(PARSE_ERR_DB_PAIR_EXT.format(db_pair=db,
                                                      db1_label='db1',
                                                      db2_label='db2',
                                                      db1_value=parts[0],
                                                      db2_value=parts[1]))

        # Remove backtick quotes (handled later)
        db1 = remove_backtick_quoting(parts[0]) \
            if is_quoted_with_backticks(parts[0]) else parts[0]
        db2 = remove_backtick_quoting(parts[1]) \
            if is_quoted_with_backticks(parts[1]) else parts[1]

        try:
            res = database_compare(server1_values, server2_values,
                                   db1, db2, options)
            print
        except UtilError:
            _, e, _ = sys.exc_info()
            print("ERROR: %s" % e.errmsg)
            sys.exit(1)

        if not res:
            check_failed = True

        if check_failed and not opt.run_all_tests:
            break

    if not opt.quiet:
        print
        if check_failed:
            print("# Database consistency check failed.")
        else:
            sys.stdout.write("# Databases are consistent")
            if (opt.no_object_check or opt.no_diff or
               opt.no_row_count or opt.no_data or opt.skip_tbl_opts):
                sys.stdout.write(" given skip options specified")
            print(".")
        print("#\n# ...done")

    if check_failed:
        sys.exit(1)

    sys.exit()


text:
module Buildozer
  module Model
    class Package
      attr_accessor :name,
                    :architecture,
                    :provides, :depends,
                    :includes

      def initialize(options)
        @name = options.fetch(:name)
        @architecture = options.fetch(:architecture, :auto)

        @provides = options.fetch(:provides, [])
        @depends = options.fetch(:depends, [])

        @includes = options.fetch(:includes, [])
      end
    end
  end
end


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Http, BaseRequestOptions } from '@angular/http';
import { MockBackend } from '@angular/http/testing';

import { SharedModule } from '../shared/shared.module';
import { HomeComponent } from './home.component';

xdescribe('HomeComponent', () => {
  let component: HomeComponent;
  let fixture: ComponentFixture<HomeComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
        imports: [
          SharedModule
        ],
        declarations: [HomeComponent],
        providers: [
          MockBackend,
          BaseRequestOptions,
          {
            provide: Http,
            useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => {
              return new Http(backend, defaultOptions);
            },
            deps: [MockBackend, BaseRequestOptions]
          }
        ]
      })
      .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(HomeComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>jar</packaging>
    <artifactId>fluent-registry-repository-sql2o</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>com.github.cybortronik</groupId>
        <artifactId>fluent-registry-repository-parent</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>com.github.cybortronik</groupId>
            <artifactId>fluent-registry-bean</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>com.github.cybortronik</groupId>
            <artifactId>fluent-registry-repository</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.sql2o</groupId>
            <artifactId>sql2o</artifactId>
            <version>1.5.4</version>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>${guice.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.12</version>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-guice</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.jolokia</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker-maven-plugin.version}</version>

                <configuration>
                    <skip>${skip-integration-test-data-creation}</skip>
                    <images>
                        <image>
                            <alias>registry-db</alias>
                            <name>${db-image.name}</name>
                            <run>
                                <namingStrategy>alias</namingStrategy>
                                <ports>
                                    <port>15432:3306</port>
                                </ports>
                                <volumes>
                                    <bind>
                                        <volume>${db-image.volume}</volume>
                                    </bind>
                                </volumes>
                                <wait>
                                    <log>mysqld: ready for connections.</log>
                                    <time>20000</time>
                                </wait>
                                <log>
                                </log>
                            </run>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                            <goal>build</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <excludes>
                        <exclude>**/*FeaturesRunner.java</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>integration-test</phase>
                        <configuration>
                            <excludes>
                                <exclude>none</exclude>
                            </excludes>
                            <includes>
                                <include>**/*FeaturesRunner.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
images:
description:
draft: true
---


text:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <PreferenceCategory android:title="@string/pref_sync_notification_category_label">
        <ListPreference
            android:key="@string/pref_sync_interval_key"
            android:title="@string/pref_sync_interval_label"
            android:entries="@array/pref_sync_interval_options"
            android:entryValues="@array/pref_sync_interval_values"
            android:defaultValue="@string/pref_sync_interval_default_value" />

        <CheckBoxPreference
            android:title="@string/pref_enable_notifications_label"
            android:key="@string/pref_enable_notifications_key"
            android:summaryOff="@string/pref_enable_notifications_false"
            android:summaryOn="@string/pref_enable_notifications_true"
            android:defaultValue="@string/pref_enable_notifications_default" />

    </PreferenceCategory>
</PreferenceScreen>


text:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("AssemblyInfo")]
[assembly: AssemblyDescription("Queries the AssemblyInfo of a .NET assembly and formats the output")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Saggio Technologies LLC")]
[assembly: AssemblyProduct("AssemblyInfo")]
[assembly: AssemblyCopyright("Copyright © 2014 Saggio Technologies LLC")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("81cbbb24-06ef-4a54-bec0-cd2183b8d48a")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyFileVersion("0.2.*")]


text:
GUICalulatrice::GUICalulatrice(QWidget *parent) :
    QDialog(parent),
    membre_(),
    ui(new Ui::GUICalulatrice)
{
    ui->setupUi(this);

//    ui->bouton_chiffre_5->setShortcut(QKeySequence( Qt::Key_5 ));
//    ui->bouton_parenthese_ouvrante->setShortcut(QKeySequence( Qt::Key_BracketLeft ));
//    ui->bouton_parenthese_fermante->setShortcut(QKeySequence( Qt::Key_BracketRight ));
//    ui->bouton_chiffre_6->setShortcut(QKeySequence( Qt::Key_6 ));
//    ui->bouton_soustraction->setShortcut(QKeySequence( Qt::Key_Minus ));
//    ui->bouton_addition->setShortcut(QKeySequence( Qt::Key_Plus ));
//    ui->bouton_resultat->setShortcut(QKeySequence( Qt::Key_Equal ));
}

//
// Mode d'affichage
//
void GUICalulatrice::on_bouton_fraction_clicked(void)
{
    membre_.setAfficherFraction(!membre_.getAfficherFraction());

    if(membre_.getAfficherFraction())
    {
        ui->bouton_fraction->setText("x/y");
        ui->formatAffichageNombreReel->setText("Fraction");
        //ui->affichageResultat->setText("Fraction");
    }
    else
    {
        ui->bouton_fraction->setText("x.yz");
        ui->formatAffichageNombreReel->setText("Virgule");
        //ui->affichageResultat->setText("Virgule");
    }
}

//
// Operation liant avec le nombre suivant
//
void GUICalulatrice::on_bouton_addition_clicked(void)
{
    // Enregistrer la saisie realisee dans membre_
    enregistrerNombre();

    // Enregistrer la prochaine operation
    oper_ = Membre::operation_addition;

    //ui->affichageResultat->setText("addition");
    //ui->affichageResultat->insertPlainText("+");
    afficherMembre();
}

void GUICalulatrice::on_bouton_soustraction_clicked()
{
    // Enregistrer la saisie realisee dans membre_
    enregistrerNombre();

    // Enregistrer la prochaine operation
    oper_ = Membre::operation_soustraction;

    //ui->affichageResultat->insertPlainText("-");
    afficherMembre();
}

void GUICalulatrice::on_bouton_multiplication_clicked()
{
    // Enregistrer la saisie realisee dans membre_
    enregistrerNombre();

    // Enregistrer la prochaine operation
    oper_ = Membre::operation_multiplication;

    //ui->affichageResultat->insertPlainText("*");
    afficherMembre();
}

void GUICalulatrice::on_bouton_division_clicked()
{
    // Enregistrer la saisie realisee dans membre_
    enregistrerNombre();

    // Enregistrer la prochaine operation
    oper_ = Membre::operation_division;

    //ui->affichageResultat->insertPlainText("/");
    afficherMembre();
}

void GUICalulatrice::on_bouton_parenthese_ouvrante_clicked()
{
    // Enregistrer parenthese ouvrante
    membre_.ouvrirParenthese(oper_);

    // Reinitialise la saisie des decimales et du nombre
    oper_ = Membre::operation_Aucune;
    saisieNumerateur_ = 0;
    saisieDenominateur_ = 1;
    saisieDecimales_ = false;
    saisieVide_ = true;

    //ui->affichageResultat->insertPlainText("(");
    afficherMembre();
}

void GUICalulatrice::on_bouton_parenthese_fermante_clicked()
{
    // Enregistrer la saisie realisee dans membre_
    enregistrerNombre();

    // Enregistrer parenthese ouvrante
    membre_.fermerParenthese();

    // Reinitialise la saisie des decimales et du nombre
    oper_ = Membre::operation_Aucune;
    saisieNumerateur_ = 0;
    saisieDenominateur_ = 1;
    saisieDecimales_ = false;
    saisieVide_ = true;

    //ui->affichageResultat->insertPlainText(")");
    afficherMembre();
}

//
// Fin de l'operation : resultat
//
void GUICalulatrice::on_bouton_resultat_clicked()
{
    if (Membre::operation_Aucune != oper_)
    {
        // Enregistrer la saisie realisee dans membre_
        enregistrerNombre();
        // Enregistrer la prochaine operation
        oper_ = Membre::operation_Aucune;

        // Afficher l'operation complete a resoudre
        std::cout << membre_ << std::endl;
        afficherResultat();
    }
    else
    {
        // Resoudre l'operation
        membre_.simplifier();

        //ui->affichageResultat->setText("resultat");
        //afficherMembre();
        afficherResultat();
    }
}

//
// Saisie du nombre courant
//
void GUICalulatrice::on_bouton_inverse_clicked()
{
    ui->affichageResultat->setText("inverse");
}

void GUICalulatrice::on_bouton_effacer_clicked()
{
    //ui->affichageResultat->setText("effacer");
    ui->affichageResultat->clear();

    membre_.vider();
    oper_ = Membre::operation_Aucune;
    saisieNumerateur_ = 0;
    saisieDenominateur_ = 1;
    saisieDecimales_ = false;
    saisieVide_ = true;
}

void GUICalulatrice::on_bouton_oppose_clicked()
{
    ui->affichageResultat->setText("oppose");
}

void GUICalulatrice::on_bouton_virgule_clicked()
{
    if (!saisieDecimales_)
    {
        saisieDecimales_ = true;
    }

    ui->affichageResultat->setText("virgule");
}

// Enregistrer la saisie realisee dans membre_
void GUICalulatrice::enregistrerNombre()
{
    if( 0!=saisieNumerateur_ || !saisieVide_)
    {
        // Appliquer l'attribut "oper" comme operation sur le membre
        // Si "oper==operation_Aucune", initialiser le membre avec la saisie
        switch (oper_)
        {
        case Membre::operation_Aucune:
            if (membre_.isEmpty())
            {
                membre_ = ZFraction(saisieNumerateur_, saisieDenominateur_);
            }
            else
            {
                // 1er nombre d'une parenthese
                membre_.operator_aucuneOperation( ZFraction(saisieNumerateur_, saisieDenominateur_) );
            }
            break;
        case Membre::operation_addition:
            membre_ += ZFraction(saisieNumerateur_, saisieDenominateur_);
            break;
        case Membre::operation_soustraction:
            membre_ -= ZFraction(saisieNumerateur_, saisieDenominateur_);
            break;
        case Membre::operation_multiplication:
            membre_ *= ZFraction(saisieNumerateur_, saisieDenominateur_);
            break;
        case Membre::operation_division:
            membre_ /= ZFraction(saisieNumerateur_, saisieDenominateur_);
            break;
            //default:
            //    break;
        }
        // Reinitialise la saisie des decimales et du nombre
        saisieDecimales_ = false;
        saisieVide_ = true;
        saisieNumerateur_ = 0;
        saisieDenominateur_ = 1;
    }
}

void GUICalulatrice::afficherMembre()
{
    std::string aMembre, aOper;

    if(plainText_)
    {
        aMembre = membre_.afficherPlainText();
        ui->affichageResultat->setText( QString::fromUtf8( aMembre.data(), aMembre.size() ) );

        // Move cursor into end of line
        QTextCursor cursor = ui->affichageResultat->textCursor();
        cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
        ui->affichageResultat->setTextCursor(cursor);

        aOper = Membre::afficherOperationPlainText(oper_);
        ui->affichageResultat->insertPlainText( QString::fromUtf8( aOper.data(), aOper.size() ) );
        //ui->affichageResultat->append( QString::fromUtf8( aOper.data(), aOper.size() ) );
    }
    else
    {
        aMembre = membre_.afficherHTML(true);
        ui->affichageResultat->setHtml( QString::fromUtf8( aMembre.data(), aMembre.size() ) );

        // Move cursor into end of line
        QTextCursor cursor = ui->affichageResultat->textCursor();
        cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
        ui->affichageResultat->setTextCursor(cursor);

        aOper = Membre::afficherOperationHTML(oper_);
        ui->affichageResultat->insertHtml( QString::fromUtf8( aOper.data(), aOper.size() ) );
        //ui->affichageResultat->append( QString::fromUtf8( aOper.data(), aOper.size() ) );
    }
}

std::string GUICalulatrice::afficherMembrePlainText()
{
    std::string out;
    out = membre_.afficherPlainText();
    out += Membre::afficherOperationPlainText(oper_);
    return out;
}

void GUICalulatrice::afficherResultat()
{
    std::string aMembre;

    if(plainText_)
    {
        aMembre = membre_.afficherPlainText();
        ui->affichageResultat->append( "\n" + QString::fromUtf8( aMembre.data(), aMembre.size() ) );
    }
    else
    {
        aMembre = membre_.afficherHTML(true);
        ui->affichageResultat->append( "<br/>\n" + QString::fromUtf8( aMembre.data(), aMembre.size() ) );
    }
}

std::string  GUICalulatrice::afficherResultatPlainText()
{
    std::string out;
    out = membre_.afficherPlainText();
    return out;
}

ZFraction GUICalulatrice::getResultat() const
{
    return membre_.getResultat();
}

void GUICalulatrice::on_bouton_chiffre_9_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 9;
    if(saisieDecimales_)
    {
        saisieDenominateur_ *= 10;
    }

    ui->affichageResultat->insertPlainText("9");
}

void GUICalulatrice::on_bouton_chiffre_8_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 8;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("8");
}

void GUICalulatrice::on_bouton_chiffre_7_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 7;
    saisieDecimales_ && (saisieDenominateur_*=10);

    ui->affichageResultat->insertPlainText("7");
}

void GUICalulatrice::on_bouton_chiffre_6_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 6;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("6");
}

void GUICalulatrice::on_bouton_chiffre_5_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 5;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("5");
}

void GUICalulatrice::on_bouton_chiffre_4_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 4;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("4");
}

void GUICalulatrice::on_bouton_chiffre_3_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 3;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("3");
}

void GUICalulatrice::on_bouton_chiffre_2_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 2;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("2");
}

void GUICalulatrice::on_bouton_chiffre_1_clicked()
{
    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 1;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("1");
}

void GUICalulatrice::on_bouton_chiffre_0_clicked()
{
    // Pour detecter le cas particulier d'operation sans nombre
    // Absence de saisie : "Numerateur==0 && saisieVide"
    saisieVide_ = false;

    saisieNumerateur_ *= 10;
    saisieNumerateur_ += 0;
    saisieDecimales_ && (saisieDenominateur_ *= 10);

    ui->affichageResultat->insertPlainText("0");
}

GUICalulatrice::~GUICalulatrice()
{
    delete ui;
}

void GUICalulatrice::plainText(bool pt)
{
    plainText_ = pt;
}


text:
#include <graphene/chain/ticket_object.hpp>

#include <graphene/chain/ticket_evaluator.hpp>

#include <graphene/chain/database.hpp>
#include <graphene/chain/exceptions.hpp>
#include <graphene/chain/hardfork.hpp>

#include <graphene/protocol/ticket.hpp>

namespace graphene { namespace chain {

void_result ticket_create_evaluator::do_evaluate(const ticket_create_operation& op)
{ try {
   const database& d = db();
   const auto block_time = d.head_block_time();

   FC_ASSERT( HARDFORK_CORE_2103_PASSED(block_time), "Not allowed until hardfork 2103" );

   return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) }

object_id_type ticket_create_evaluator::do_apply(const ticket_create_operation& op)
{ try {
   database& d = db();
   const auto block_time = d.head_block_time();
   const auto maint_time = d.get_dynamic_global_properties().next_maintenance_time;

   ticket_version version = ( HARDFORK_CORE_2262_PASSED(maint_time) ? ticket_v2 : ticket_v1 );

   d.adjust_balance( op.account, -op.amount );

   const auto& new_ticket_object = d.create<ticket_object>([&op,block_time,version](ticket_object& obj){
      obj.init_new( block_time, op.account, op.target_type, op.amount, version );
   });

   // Note: amount.asset_id is checked in validate(), so no check here
   d.modify( d.get_account_stats_by_owner( op.account ), [&op,&new_ticket_object](account_statistics_object& aso) {
      aso.total_core_pol += op.amount.amount;
      aso.total_pol_value += new_ticket_object.value;
   });

   return new_ticket_object.id;
} FC_CAPTURE_AND_RETHROW( (op) ) }

void_result ticket_update_evaluator::do_evaluate(const ticket_update_operation& op)
{ try {
   database& d = db();

   _ticket = &op.ticket(d);

   FC_ASSERT( _ticket->account == op.account, "Ticket is not owned by the account" );

   FC_ASSERT( _ticket->current_type != lock_forever, "Can not to update a ticket that is locked forever" );

   FC_ASSERT( static_cast<uint64_t>(_ticket->target_type) != op.target_type, "Target type does not change" );

   if( op.amount_for_new_target.valid() )
   {
      // Note: amount.asset_id is checked in validate(), so no check here
      FC_ASSERT( *op.amount_for_new_target <= _ticket->amount, "Insufficient amount in ticket to be updated" );
   }

   return void_result();
} FC_CAPTURE_AND_RETHROW( (op) ) }

generic_operation_result ticket_update_evaluator::do_apply(const ticket_update_operation& op)
{ try {
   database& d = db();
   const auto block_time = d.head_block_time();
   const auto maint_time = d.get_dynamic_global_properties().next_maintenance_time;

   ticket_version version = ( HARDFORK_CORE_2262_PASSED(maint_time) ? ticket_v2 : ticket_v1 );

   generic_operation_result result;

   share_type old_value = _ticket->value;
   share_type delta_value;

   // To partially update the ticket, aka splitting
   if ( op.amount_for_new_target.valid() && *op.amount_for_new_target < _ticket->amount )
   {
      const auto& new_ticket_object = d.create<ticket_object>([&op,this,block_time,version](ticket_object& obj){
         obj.init_split( block_time, *_ticket, op.target_type, *op.amount_for_new_target, version );
      });

      result.new_objects.insert( new_ticket_object.id );

      d.modify( *_ticket, [&op,version](ticket_object& obj){
         obj.adjust_amount( -(*op.amount_for_new_target), version );
      });
      delta_value = new_ticket_object.value + _ticket->value - old_value;
   }
   else // To update the whole ticket
   {
      d.modify( *_ticket, [&op,block_time,version](ticket_object& obj){
         obj.update_target_type( block_time, op.target_type, version );
      });
      delta_value = _ticket->value - old_value;
   }
   result.updated_objects.insert( _ticket->id );

   if( delta_value != 0 )
   {
      const auto& stat = d.get_account_stats_by_owner( op.account );
      d.modify( stat, [delta_value](account_statistics_object& aso) {
         aso.total_pol_value += delta_value;
      });
   }

   // Do auto-update now.
   // Note: calling process_tickets() here won't affect other tickets,
   //       since head_block_time is not updated after last call,
   //       even when called via a proposal this time or last time
   generic_operation_result process_result = d.process_tickets();
   result.removed_objects.insert( process_result.removed_objects.begin(), process_result.removed_objects.end() );
   result.updated_objects.insert( process_result.updated_objects.begin(), process_result.updated_objects.end() );
   for( const auto& id : result.new_objects )
      result.updated_objects.erase( id );
   for( const auto& id : result.removed_objects )
      result.updated_objects.erase( id );

   return result;
} FC_CAPTURE_AND_RETHROW( (op) ) }

} } // graphene::chain


text:
module Lita
  module Handlers
    class ShouldI < Handler
      route(/\Ashould I (.+) or (.+)\?\z/, :should_i, command: true, help: {
        "should I _firstthing_ or _lastthing_ ?" => " Robot chooses _firstthing_ or _lastthing_"
      })

      def should_i(response)
        option = build_response response.matches.first
        response.reply "You should #{option}."
      end

      private
      def build_response(matches)
        transform_person matches.sample
      end

      def transform_person(phrase)
        [
          [/\sme\b/i    , ' you'],
          [/\smine\b/i  , ' yours'],
          [/\smy\b/i    , ' your'],
          [/\syou\b/i   , ' me'],
          [/\syour\b/i  , ' my'],
          [/\syours\b/i , ' mine']
        ]
        .select { |transform| phrase =~ transform.first }
        .map    { |transform| phrase.gsub!(transform.first, transform.last) }
        phrase
      end
    end

    Lita.register_handler(ShouldI)
  end
end


text:
class RawPymlParser : public IPymlParser
{
	PymlItemStr pymlItem;

public:
	RawPymlParser();

	void consume(std::string::iterator start, std::string::iterator end);
	const IPymlItem* getParsed();
};


text:
package org.apache.ignite.examples;

//import org.apache.ignite.examples.misc.client.memcache.*;

import org.junit.Ignore;

/**
 * MemcacheRestExample multi-node self test.
 */
@Ignore("https://issues.apache.org/jira/browse/IGNITE-711")
public class MemcacheRestExamplesMultiNodeSelfTest extends MemcacheRestExamplesSelfTest {
    // TODO: IGNITE-711 next example(s) should be implemented for java 8
    // or testing method(s) should be removed if example(s) does not applicable for java 8.
    /** {@inheritDoc} */
//    @Override protected void beforeTest() throws Exception {
//        for (int i = 0; i < RMT_NODES_CNT; i++)
//            startGrid("memcache-rest-examples-" + i, MemcacheRestExampleNodeStartup.configuration());
//    }
}


text:
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
#endif

#if wxUSE_DATEPICKCTRL

#include "wx/datectrl.h"
#include "wx/app.h"
#include "wx/intl.h"
#include "wx/dynlib.h"

#define _WX_DEFINE_DATE_EVENTS_
#include "wx/dateevt.h"

#include "wx/msw/wrapwin.h"
#include "wx/msw/wrapcctl.h"
#include "wx/msw/private.h"

// apparently some versions of mingw define these macros erroneously
#ifndef DateTime_GetSystemtime
    #define DateTime_GetSystemtime DateTime_GetSystemTime
#endif

#ifndef DateTime_SetSystemtime
    #define DateTime_SetSystemtime DateTime_SetSystemTime
#endif

IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl)

// ============================================================================
// implementation
// ============================================================================

// ----------------------------------------------------------------------------
// helpers for wxDateTime <-> SYSTEMTIME conversion
// ----------------------------------------------------------------------------

static inline void wxFromSystemTime(wxDateTime *dt, const SYSTEMTIME& st)
{
    dt->Set(st.wDay,
            wx_static_cast(wxDateTime::Month, wxDateTime::Jan + st.wMonth - 1),
            st.wYear,
            0, 0, 0);
}

static inline void wxToSystemTime(SYSTEMTIME *st, const wxDateTime& dt)
{
    const wxDateTime::Tm tm(dt.GetTm());

    st->wYear = (WXWORD)tm.year;
    st->wMonth = (WXWORD)(tm.mon - wxDateTime::Jan + 1);
    st->wDay = tm.mday;

    st->wDayOfWeek =
    st->wHour =
    st->wMinute =
    st->wSecond =
    st->wMilliseconds = 0;
}

// ----------------------------------------------------------------------------
// wxDatePickerCtrl creation
// ----------------------------------------------------------------------------

bool
wxDatePickerCtrl::Create(wxWindow *parent,
                         wxWindowID id,
                         const wxDateTime& dt,
                         const wxPoint& pos,
                         const wxSize& size,
                         long style,
                         const wxValidator& validator,
                         const wxString& name)
{
    // although we already call InitCommonControls() in app.cpp which is
    // supposed to initialize all common controls, in comctl32.dll 4.72 (and
    // presumably earlier versions 4.70 and 4.71, date time picker not being
    // supported in < 4.70 anyhow) it does not do it and we have to initialize
    // it explicitly
    static bool s_initDone = false; // MT-ok: used from GUI thread only
    if ( !s_initDone )
    {
        if ( wxApp::GetComCtl32Version() < 470 )
        {
            wxLogError(_("This system doesn't support date picker control, please upgrade your version of comctl32.dll"));

            return false;
        }

#if wxUSE_DYNLIB_CLASS
        INITCOMMONCONTROLSEX icex;
        icex.dwSize = sizeof(icex);
        icex.dwICC = ICC_DATE_CLASSES;

        wxDynamicLibrary dllComCtl32(_T("comctl32.dll"), wxDL_VERBATIM);

        typedef BOOL (WINAPI *ICCEx_t)(INITCOMMONCONTROLSEX *);
        wxDYNLIB_FUNCTION( ICCEx_t, InitCommonControlsEx, dllComCtl32 );

        if ( pfnInitCommonControlsEx )
        {
            (*pfnInitCommonControlsEx)(&icex);
        }

        s_initDone = true;
#endif
    }

    // use wxDP_SPIN if wxDP_DEFAULT (0) was given as style
    if ( !(style & wxDP_DROPDOWN) )
        style |= wxDP_SPIN;

    // initialize the base class
    if ( !CreateControl(parent, id, pos, size, style, validator, name) )
        return false;

    // create the native control
    if ( !MSWCreateControl(DATETIMEPICK_CLASS, wxEmptyString, pos, size) )
        return false;

    if ( dt.IsValid() || (style & wxDP_ALLOWNONE) )
        SetValue(dt);

    return true;
}

WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
{
    WXDWORD styleMSW = wxDatePickerCtrlBase::MSWGetStyle(style, exstyle);

    // although MSDN doesn't mention it, DTS_UPDOWN doesn't work with
    // comctl32.dll 4.72
    if ( wxApp::GetComCtl32Version() > 472 && (style & wxDP_SPIN) )
        styleMSW |= DTS_UPDOWN;
    //else: drop down by default

#ifdef DTS_SHORTDATECENTURYFORMAT
    if ( style & wxDP_SHOWCENTURY )
        styleMSW |= DTS_SHORTDATECENTURYFORMAT;
    else
#endif // DTS_SHORTDATECENTURYFORMAT
        styleMSW |= DTS_SHORTDATEFORMAT;

    if ( style & wxDP_ALLOWNONE )
        styleMSW |= DTS_SHOWNONE;

    return styleMSW;
}

// TODO: handle WM_WININICHANGE

// ----------------------------------------------------------------------------
// wxDatePickerCtrl geometry
// ----------------------------------------------------------------------------

wxSize wxDatePickerCtrl::DoGetBestSize() const
{
    const int y = GetCharHeight();

    wxSize best(DEFAULT_ITEM_WIDTH, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
    CacheBestSize(best);
    return best;
}

// ----------------------------------------------------------------------------
// wxDatePickerCtrl operations
// ----------------------------------------------------------------------------

void wxDatePickerCtrl::SetValue(const wxDateTime& dt)
{
    wxCHECK_RET( dt.IsValid() || HasFlag(wxDP_ALLOWNONE),
                    _T("this control requires a valid date") );

    SYSTEMTIME st;
    if ( dt.IsValid() )
        wxToSystemTime(&st, dt);
    if ( !DateTime_SetSystemtime(GetHwnd(),
                                 dt.IsValid() ? GDT_VALID : GDT_NONE,
                                 &st) )
    {
        wxLogDebug(_T("DateTime_SetSystemtime() failed"));
    }
}

wxDateTime wxDatePickerCtrl::GetValue() const
{
    wxDateTime dt;
    SYSTEMTIME st;
    if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID )
    {
        wxFromSystemTime(&dt, st);
    }

    return dt;
}

void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2)
{
    SYSTEMTIME st[2];

    DWORD flags = 0;
    if ( dt1.IsValid() )
    {
        wxToSystemTime(&st[0], dt1);
        flags |= GDTR_MIN;
    }

    if ( dt2.IsValid() )
    {
        wxToSystemTime(&st[1], dt2);
        flags |= GDTR_MAX;
    }

    if ( !DateTime_SetRange(GetHwnd(), flags, st) )
    {
        wxLogDebug(_T("DateTime_SetRange() failed"));
    }
}

bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const
{
    SYSTEMTIME st[2];

    DWORD flags = DateTime_GetRange(GetHwnd(), st);
    if ( dt1 )
    {
        if ( flags & GDTR_MIN )
            wxFromSystemTime(dt1, st[0]);
        else
            *dt1 = wxDefaultDateTime;
    }

    if ( dt2 )
    {
        if ( flags & GDTR_MAX )
            wxFromSystemTime(dt2, st[1]);
        else
            *dt2 = wxDefaultDateTime;
    }

    return flags != 0;
}

// ----------------------------------------------------------------------------
// wxDatePickerCtrl events
// ----------------------------------------------------------------------------

bool
wxDatePickerCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
    NMHDR* hdr = (NMHDR *)lParam;
    switch ( hdr->code )
    {
        case DTN_DATETIMECHANGE:
            NMDATETIMECHANGE *dtch = (NMDATETIMECHANGE *)hdr;
            wxDateTime dt;
            if ( dtch->dwFlags == GDT_VALID )
                wxFromSystemTime(&dt, dtch->st);

            wxDateEvent event(this, dt, wxEVT_DATE_CHANGED);
            if ( GetEventHandler()->ProcessEvent(event) )
            {
                *result = 0;
                return true;
            }
    }

    return wxDatePickerCtrlBase::MSWOnNotify(idCtrl, lParam, result);
}

#endif // wxUSE_DATEPICKCTRL


text:
/**
 * BillingCap.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.dfp.axis.v201308;

public class BillingCap implements java.io.Serializable {
    private java.lang.String _value_;
    private static java.util.HashMap _table_ = new java.util.HashMap();

    // Constructor
    protected BillingCap(java.lang.String value) {
        _value_ = value;
        _table_.put(_value_,this);
    }

    public static final java.lang.String _NO_CAP = "NO_CAP";
    public static final java.lang.String _CAPPED_CUMULATIVE = "CAPPED_CUMULATIVE";
    public static final java.lang.String _UNKNOWN = "UNKNOWN";
    public static final BillingCap NO_CAP = new BillingCap(_NO_CAP);
    public static final BillingCap CAPPED_CUMULATIVE = new BillingCap(_CAPPED_CUMULATIVE);
    public static final BillingCap UNKNOWN = new BillingCap(_UNKNOWN);
    public java.lang.String getValue() { return _value_;}
    public static BillingCap fromValue(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        BillingCap enumeration = (BillingCap)
            _table_.get(value);
        if (enumeration==null) throw new java.lang.IllegalArgumentException();
        return enumeration;
    }
    public static BillingCap fromString(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        return fromValue(value);
    }
    public boolean equals(java.lang.Object obj) {return (obj == this);}
    public int hashCode() { return toString().hashCode();}
    public java.lang.String toString() { return _value_;}
    public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumSerializer(
            _javaType, _xmlType);
    }
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new org.apache.axis.encoding.ser.EnumDeserializer(
            _javaType, _xmlType);
    }
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(BillingCap.class);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201308", "BillingCap"));
    }
    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

}


text:
Learning-JavaScript-Design-Patterns-Example
===========================================

Learning JavaScript Design Patterns Example


text:
en: ploter
pl: ploter GPS
layout: dict_word
date: 2013-12-29
cat: navigation
---
<!-- TODO: opis -->


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

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkEntity">

  <!-- INSERT IDENTITY LINK -->

  <insert id="insertIdentityLink" parameterType="org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkEntity">
    insert into ${prefix}ACT_RU_IDENTITYLINK (ID_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_DEF_ID_, REV_)
    values (#{id, jdbcType=VARCHAR},
            #{type, jdbcType=VARCHAR},
            #{userId, jdbcType=VARCHAR},
            #{groupId, jdbcType=VARCHAR},
            #{taskId, jdbcType=VARCHAR},
            #{processDefId, jdbcType=VARCHAR},
            1
           )

  </insert>

  <!-- IDENTITY LINK DELETE -->

  <delete id="deleteIdentityLink" parameterType="string">
    delete from ${prefix}ACT_RU_IDENTITYLINK where ID_ = #{id}
  </delete>

  <delete id="deleteIdentityLinkByProcDef" parameterType="string">
    delete from ${prefix}ACT_RU_IDENTITYLINK where PROC_DEF_ID_ = #{id}
  </delete>

  <!-- IDENTITY LINK RESULTMAP -->

  <resultMap id="identityLinkResultMap" type="org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkEntity">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="type" column="TYPE_" jdbcType="VARCHAR" />
    <result property="userId" column="USER_ID_" jdbcType="VARCHAR" />
    <result property="groupId" column="GROUP_ID_" jdbcType="VARCHAR" />
    <result property="taskId" column="TASK_ID_" jdbcType="VARCHAR" />
    <result property="processDefId" column="PROCESS_DEF_ID_" jdbcType="VARCHAR" />
  </resultMap>

  <!-- IDENTITY LINK SELECT -->

  <select id="selectIdentityLink" parameterType="string" resultMap="identityLinkResultMap">
    select * from ${prefix}ACT_RU_IDENTITYLINK where ID_ = #{id}
  </select>

  <select id="selectIdentityLinksByTask" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="identityLinkResultMap">
    select * from ${prefix}ACT_RU_IDENTITYLINK where TASK_ID_ = #{parameter}
  </select>

  <select id="selectIdentityLinksByProcessDefinition" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="identityLinkResultMap">
    select * from ${prefix}ACT_RU_IDENTITYLINK where PROC_DEF_ID_ = #{parameter}
  </select>

  <select id="selectIdentityLinkByTaskUserGroupAndType" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="identityLinkResultMap">
    select *
    from ${prefix}ACT_RU_IDENTITYLINK
    where TASK_ID_ = #{parameter.taskId}
      <if test="parameter.userId != null">
        and USER_ID_ = #{parameter.userId}
      </if>
      <if test="parameter.groupId != null">
        and GROUP_ID_ = #{parameter.groupId}
      </if>
      <if test="parameter.type != null">
        and TYPE_ = #{parameter.type}
      </if>
  </select>

  <select id="selectIdentityLinkByProcessDefinitionUserAndGroup" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="identityLinkResultMap">
    select *
    from ${prefix}ACT_RU_IDENTITYLINK
    where PROC_DEF_ID_ = #{parameter.processDefinitionId}
      <if test="parameter.userId != null">
        and USER_ID_ = #{parameter.userId}
      </if>
      <if test="parameter.groupId != null">
        and GROUP_ID_ = #{parameter.groupId}
      </if>
  </select>

</mapper>


text:
package com.zz.startup.test.service;

import com.zz.startup.entity.User;
import com.zz.startup.repository.UserDao;
import com.zz.startup.service.UserService;
import com.zz.startup.test.BaseServiceTest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

public class UserServiceTest extends BaseServiceTest {

    @Autowired
    UserService userService;

    @Autowired
    UserDao userDao;

    @Test
    public void test_deleteUser() {
        List<User> users = userService.findAll();
        userService.deleteBatch(users);
    }

    @Test
    public void test_createUser() {
        User user = new User();
        user.setUsername("admin2");
        user.setPlainPassword("111111");
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());

        userService.createUser(user);
    }

    @Test
    public void test_user_role() {
        int insert = userDao.insertUserRole(1L, 3L);
        int delete = userDao.deleteRole(1L, 3L);

        System.out.println(insert);
        System.out.println(delete);
    }

    @Test
    public void test_native_api() {
        User user = userDao.findById(1L);
        System.out.println(user);
    }
}


text:
public class Test {
    public static class OtherTest {

    }
}


text:
"""
Support for Envisalink sensors (shows panel info).

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.envisalink/
"""
import logging
from homeassistant.components.envisalink import (EVL_CONTROLLER,
                                                 PARTITION_SCHEMA,
                                                 CONF_PARTITIONNAME,
                                                 EnvisalinkDevice,
                                                 SIGNAL_KEYPAD_UPDATE)

DEPENDENCIES = ['envisalink']
_LOGGER = logging.getLogger(__name__)

def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    """Perform the setup for Envisalink sensor devices."""
    _configured_partitions = discovery_info['partitions']
    for part_num in _configured_partitions:
        _device_config_data = PARTITION_SCHEMA(
            _configured_partitions[part_num])
        _device = EnvisalinkSensor(
            _device_config_data[CONF_PARTITIONNAME],
            part_num,
            EVL_CONTROLLER.alarm_state['partition'][part_num],
            EVL_CONTROLLER)
        add_devices_callback([_device])

class EnvisalinkSensor(EnvisalinkDevice):
    """Representation of an Envisalink keypad."""

    def __init__(self, partition_name, partition_number, info, controller):
        """Initialize the sensor."""
        from pydispatch import dispatcher
        self._icon = 'mdi:alarm'
        self._partition_number = partition_number
        _LOGGER.debug('Setting up sensor for partition: ' + partition_name)
        EnvisalinkDevice.__init__(self,
                                  partition_name + ' Keypad',
                                  info,
                                  controller)

        dispatcher.connect(self._update_callback,
                           signal=SIGNAL_KEYPAD_UPDATE,
                           sender=dispatcher.Any)

    @property
    def icon(self):
        """Return the icon if any."""
        return self._icon

    @property
    def state(self):
        """Return the overall state."""
        return self._info['status']['alpha']

    @property
    def device_state_attributes(self):
        """Return the state attributes."""
        return self._info['status']

    def _update_callback(self, partition):
        """Update the partition state in HA, if needed."""
        if partition is None or int(partition) == self._partition_number:
            self.update_ha_state()


text:
module EndecaOnDemand
  class Client

    include EndecaOnDemand::PP

    def inspect_attributes; [ :api, :default_options ]; end

    ## fields ##

    attr_reader :api, :default_options, :query

    def initialize(api, default_options = {})
      @api, @default_options = api, default_options.dup.recurse(&:symbolize_keys)
    end

    ## associations ##

    def query(options = {})
      @query = nil if options.present?
      @query ||= EndecaOnDemand::Query.new(self, options)
    end

    ##

  end
end