text:
require 'logging_helper'
require 'spec_helper'
require 'liberty_buildpack/container/services_manager'
require 'liberty_buildpack/util/heroku'

module LibertyBuildpack::Services

  describe 'PostgreSQL' do

    include_context 'logging_helper'

    #----------------
    # Helper method to check an xml file agains expected results.
    #
    # @param xml - the name of the xml file file containing the results (server.xml, runtime_vars.xml)
    # @param - expected - the array of strings we expect to find in the xml file, in order.
    #----------------
    def validate_xml(server_xml, expected)
      # Collapse XML into one long String (no cr or lf).
      server_xml_contents_array = File.readlines(server_xml).each(&:strip!)
      server_xml_contents = server_xml_contents_array.join
      # For each String in the expected array, make sure there is a corresponding entry in server.xml
      # make sure we consume all entries in the expected array.
      expected.each do |line|
        expect(server_xml_contents).to include(line)
      end
    end

    describe 'Generate configuration' do

      #----------------------------------------------------------
      # Helper methods to return constants used in checking server.xml contents
      #----------------------------------------------------------
      def get_ds_id
        'postgresql-myDatabase'
      end

      def get_props_id
        'postgresql-myDatabase-props'
      end

      def get_driver_id
        'postgresql-driver'
      end

      def get_lib_id
        'postgresql-library'
      end

      def get_fileset_id
        'postgresql-fileset'
      end

      def get_lib_dir
        '${server.config.dir}/lib'
      end

      def get_jndi
        'jdbc/myDatabase'
      end

      def get_host
        '${cloud.services.myDatabase.connection.host}'
      end

      def get_port
        '${cloud.services.myDatabase.connection.port}'
      end

      def get_user
        '${cloud.services.myDatabase.connection.user}'
      end

      def get_password
        '${cloud.services.myDatabase.connection.password}'
      end

      def get_name
        '${cloud.services.myDatabase.connection.name}'
      end

      def check_variables(root, vcap_services)
        expected_vars = []
        expected_vars << '<variable name=\'cloud.services.myDatabase.connection.name\' value=\'myDb\'/>'
        expected_vars << '<variable name=\'cloud.services.myDatabase.connection.host\' value=\'myHost.com\'/>'
        expected_vars << '<variable name=\'cloud.services.myDatabase.connection.port\' value=\'5432\'/>'
        expected_vars << '<variable name=\'cloud.services.myDatabase.connection.user\' value=\'myUser\'/>'
        expected_vars << '<variable name=\'cloud.services.myDatabase.connection.password\' value=\'myPassword\'/>'
        expected_vars << '<variable name=\'cloud.services.myDatabase.connection.uri\' value=\'postgres://myUser:myPassword@myHost.com:5432/myDb\'/>'

        runtime_vars = File.join(root, 'runtime-vars.xml')
        validate_xml(runtime_vars, expected_vars)
      end

      def check_server_xml_create(root, sm)
        server_xml = File.join(root, 'server.xml')
        server_xml_doc = REXML::Document.new('<server><featureManager/></server>')

        sm.update_configuration(server_xml_doc, true, root)

        File.open(server_xml, 'w') { |file| server_xml_doc.write(file) }

        expected_config = []
        expected_config << '<feature>jdbc-4.1</feature>'
        t1 = "<dataSource id='#{get_ds_id}' jdbcDriverRef='#{get_driver_id}' jndiName='#{get_jndi}' transactional='true' type='javax.sql.ConnectionPoolDataSource'>"
        t2 = "<properties databaseName='#{get_name}' id='#{get_props_id}' password='#{get_password}' portNumber='#{get_port}' serverName='#{get_host}' user='#{get_user}'/>"
        t3 = '</dataSource>'
        expected_config << t1 + t2 + t3
        driver_info = "javax.sql.ConnectionPoolDataSource='org.postgresql.ds.PGConnectionPoolDataSource' javax.sql.XADataSource='org.postgresql.xa.PGXADataSource'"
        expected_config << "<jdbcDriver id='#{get_driver_id}' #{driver_info} libraryRef='#{get_lib_id}'/>"
        expected_config << "<library id='#{get_lib_id}'><fileset dir='#{get_lib_dir}' id='#{get_fileset_id}'/></library>"
        validate_xml(server_xml, expected_config)
      end

      def check_server_xml_update(root, sm)
        driver_info = "javax.sql.ConnectionPoolDataSource='org.postgresql.ds.PGConnectionPoolDataSource' javax.sql.XADataSource='org.postgresql.xa.PGXADataSource'"

        contents = []
        contents << '<server>'
        contents << '<featureManager><feature>jsp-2.2</feature></featureManager>'
        t1 = "<dataSource id='#{get_ds_id}' jdbcDriverRef='myDriver' jndiName='myJndi' transactional='true'>"
        t2 = "<properties databaseName='noName' password='noPassword' portNumber='1111' serverName='noHost' user='noUser'/>"
        t3 = '</dataSource>'
        contents << t1 + t2 + t3
        contents << "<jdbcDriver id='myDriver' libraryRef='myLibrary'/>"
        contents << "<library id='myLibrary'><fileset dir='lib' id='lib-id'/></library>"
        contents << '</server>'

        server_xml_doc = REXML::Document.new(contents.join)
        server_xml = File.join(root, 'server.xml')
        sm.update_configuration(server_xml_doc, false, root)

        File.open(server_xml, 'w') { |file| server_xml_doc.write(file) }

        # check if dataSource properties and library were updated. Other elements should not be updated.
        expected_config = []
        expected_config << '<feature>jsp-2.2</feature>'
        expected_config << '<feature>jdbc-4.1</feature>'
        t1 = "<dataSource id='#{get_ds_id}' jdbcDriverRef='myDriver' jndiName='myJndi' transactional='true' type='javax.sql.ConnectionPoolDataSource'>"
        t2 = "<properties databaseName='#{get_name}' password='#{get_password}' portNumber='#{get_port}' serverName='#{get_host}' user='#{get_user}'/>"
        t3 = '</dataSource>'
        expected_config << t1 + t2 + t3
        expected_config << "<jdbcDriver id='myDriver' #{driver_info} libraryRef='myLibrary'/>"
        expected_config << "<library id='myLibrary'><fileset dir='lib' id='lib-id'/><fileset dir='#{get_lib_dir}'/></library>"
        validate_xml(server_xml, expected_config)
      end

      def run_test(vcap_services)
        Dir.mktmpdir do |root|
          sm = LibertyBuildpack::Container::ServicesManager.new(vcap_services, root, nil)
          check_variables(root, vcap_services)
          check_server_xml_create(root, sm)
          check_server_xml_update(root, sm)
        end
      end

      it 'on Bluemix (postgresql)' do
        vcap_services = {}
        postgresql = {}
        postgresql['name'] = 'myDatabase'
        postgresql['label'] = 'postgresql-9.1'
        postgresql_credentials = {}
        postgresql_credentials['name'] = 'myDb'
        postgresql_credentials['host'] = 'myHost.com'
        postgresql_credentials['hostname'] = 'myHost.com'
        postgresql_credentials['port'] = '5432'
        postgresql_credentials['user'] = 'myUser'
        postgresql_credentials['username'] = 'myUser'
        postgresql_credentials['password'] = 'myPassword'
        postgresql_credentials['uri'] = 'postgres://myUser:myPassword@myHost.com:5432/myDb'
        postgresql['credentials'] = postgresql_credentials
        vcap_services['postgresql-9.1'] = [postgresql]

        run_test(vcap_services)
      end

      it 'on Bluemix (elephantsql)' do
        vcap_services = {}
        elephantsql = {}
        elephantsql['name'] = 'myDatabase'
        elephantsql['label'] = 'elephantsql'
        elephantsql_credentials = {}
        elephantsql_credentials['uri'] = 'postgres://myUser:myPassword@myHost.com:5432/myDb'
        elephantsql['credentials'] = elephantsql_credentials
        vcap_services['elephantsql'] = [elephantsql]

        run_test(vcap_services)
      end

      it 'on Pivotal' do
        vcap_services = {}
        elephantsql = {}
        elephantsql['name'] = 'myDatabase'
        elephantsql['label'] = 'elephantsql'
        elephantsql['tags'] = %w(relational postgresql)
        elephantsql_credentials = {}
        elephantsql_credentials['uri'] = 'postgres://myUser:myPassword@myHost.com:5432/myDb'
        elephantsql['credentials'] = elephantsql_credentials
        vcap_services['elephantsql'] = [elephantsql]

        run_test(vcap_services)
      end

      it 'on Heroku' do
        env = {}
        env['HEROKU_POSTGRESQL_RED_URL'] = 'postgres://myUser:myPassword@myHost.com:5432/myDb'
        env['SERVICE_NAME_MAP'] = 'HEROKU_POSTGRESQL_RED_URL=myDatabase'
        vcap_services = LibertyBuildpack::Util::Heroku.new.generate_vcap_services(env)

        run_test(vcap_services)
      end

    end

    describe 'Override configuration' do

      let(:application_cache) { double('ApplicationCache') }

      it 'should use user defined repository and version' do
        Dir.mktmpdir do |root|
          vcap_services = {}
          elephantsql = {}
          elephantsql['name'] = 'myDatabase'
          elephantsql['label'] = 'elephantsql'
          elephantsql_credentials = {}
          elephantsql_credentials['uri'] = 'postgres://myUser:myPassword@myHost.com:5432/myDb'
          elephantsql['credentials'] = elephantsql_credentials
          vcap_services['elephantsql'] = [elephantsql]

          FileUtils.mkdir(File.join(root, 'cache'))
          index_file = "#{root}/cache/index.yml"
          cached_file = "#{root}/cache/foo.jar.cached"
          File.open(index_file, 'w') do |file|
            file.puts('---')
            file.puts("11.0.0: #{cached_file}")
          end
          FileUtils.cp('spec/fixtures/wlp-stub.jar', cached_file)

          LibertyBuildpack::Util::Cache::DownloadCache.stub(:new).and_return(application_cache)
          application_cache.stub(:get).with(index_file).and_yield(File.open(index_file))
          application_cache.stub(:get).with(cached_file).and_yield(File.open(cached_file))

          ENV['LBP_SERVICE_CONFIG_POSTGRESQL'] = "{driver: { repository_root: #{root}/cache, version: 11.+ }}"

          sm = LibertyBuildpack::Container::ServicesManager.new(vcap_services, root, nil)
          file = File.join(root, 'lib', 'foo.jar')
          expect(File).not_to exist(file)
          sm.install_client_jars([], root)
          expect(File).to exist(file)
        end
      end
    end
  end

end


text:
#ifndef _LE_RKM_H_
#define _LE_RKM_H_

/*rkm backup message layout, page unit
offset page 0: the rkm overall message area, include version info,kernel
		banner,etc. reserve 1 pages
offset page 1: current lk buf log information,reserve two pages,8k
offset page 3: last system kernel dmesg log.due to the dmesglog length maybe
		not fix, so it should stay tail. reserve 512k
*/
#define RKM_OVERVIEW_LOG_OFFSET        0
#define RKM_LK_BUF_LOG_OFFSET          1
#define RKM_LAST_KERNEL_LOG_BUF_OFFSET 3

//previous system kernel log_buf message
#define RKM_LOG_BUF_HEADER_TABLE_MAGIC1 0x686d6b72
#define RKM_LOG_BUF_HEADER_TABLE_MAGIC2 0x7461626c
#define RKM_LOG_BUF_HEADER_TABLE_VERSION 1

//uint is page size
#define MAX_RKM_LOG_BUF_LEN 512
#define MAX_RKM_LK_BUF_LEN 2

#define RKM_SCAN_KERNEL_LOG_BUF_START_OFFSET 0xD00000
#define RKM_SCAN_KERNEL_LOG_BUF_END 0x1e00000

typedef struct {
	unsigned int magic1;    //0x686d6b72  "rkmh"
	unsigned int magic2;    //0x7461626c  "lbat"
	unsigned int version;
	unsigned int bss_start;
	unsigned int bss_stop;
	unsigned int log_buf_pa;
	unsigned int log_buf_len;
} rkm_log_buf_header_table_t;

void rkm_int_base_address(char* addr);
int rkm_update_device_tree(void *fdt);

#endif

redpajama_set_name: RedPajamaGithub


text:
using namespace std;

const double PI = 3.14159265358979323846;

Circle::Circle()
{
	radius = 0;
}

Circle::Circle(double rad)
{
	if (rad >= 0)
		radius = rad;
	else
		cout << "Invalid input! Radius cannot be negative";
}

Circle::~Circle()
{
}

double Circle::calculateCircumference()
{
	return 2 * radius * PI;
}

double Circle::calculateCircleArea()
{
	return radius * radius * PI;
}

void Circle::printResults()
{
	cout << "************Circle************" << endl;
	cout << "Radius:" << radius << endl;
	cout << "Circumference:" << calculateCircumference() << endl;
	cout << "Circle area: " << calculateCircleArea() << endl;
	cout << "******************************" << endl;
}


text:
<?php $this->load->view('globals/header'); ?>

      <?php $this->load->view('globals/sidebar'); ?>

            <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Toggle nav</button>

Select your brands !

Right here, you will find all new and hot brands ! Enjoy Yourself!! Try some responsive-range viewport sizes to see it in action.

            <?php foreach ($newBrands as $key => $value): ?>

<?= $value->nom_marque ?>

<?= $value->dscp_marque ?>

<a class="btn btn-default" href="<?=site_url('Info/brands/'.$value->idmarque.'')?>" role="button">View details »

            <?php endforeach ?>

<?php $this->load->view('globals/footer'); ?>


text:
package weld.expressions

import weld.{UnknownType, WeldType, bool}

abstract class BinOp extends BinaryExpr {
  def symbol: String
  override def children: Seq[Expr] = Seq(left, right)
  override def resolved: Boolean = {
    super.resolved && left.dataType == right.dataType && left.dataType != UnknownType
  }

  override def buildDesc(builder: DescBuilder): Unit = {
    builder.append("(").append(left.desc).append(" ").append(symbol).append(" ").append(right.desc).append(")")
  }

  override def dataType: WeldType = left.dataType
}

case class Add(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "+"
  override protected def withNewChildren(left: Expr, right: Expr): Add = copy(left, right)
}

case class Subtract(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "-"
  override protected def withNewChildren(left: Expr, right: Expr): Subtract = copy(left, right)
}

case class Multiply(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "*"
  override protected def withNewChildren(left: Expr, right: Expr): Multiply = copy(left, right)
}

case class Divide(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "/"
  override protected def withNewChildren(left: Expr, right: Expr): Divide = copy(left, right)
}

case class Remainder(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "%"
  override protected def withNewChildren(left: Expr, right: Expr): Remainder = copy(left, right)
}

case class BitwiseAnd(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "&"
  override protected def withNewChildren(left: Expr, right: Expr): BitwiseAnd = copy(left, right)
}

case class BitwiseOr(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "|"
  override protected def withNewChildren(left: Expr, right: Expr): BitwiseOr = copy(left, right)
}

case class Xor(left: Expr, right: Expr) extends BinOp {
  override def symbol: String = "^"
  override protected def withNewChildren(left: Expr, right: Expr): Xor = copy(left, right)
}

abstract class Predicate extends BinOp {
  override def dataType: WeldType = bool
}

case class Equal(left: Expr, right: Expr) extends Predicate{
  override def symbol: String = "=="
  override protected def withNewChildren(left: Expr, right: Expr): Equal = copy(left, right)
}

case class NotEqual(left: Expr, right: Expr) extends Predicate {
  override def symbol: String = "!="
  override protected def withNewChildren(left: Expr, right: Expr): NotEqual = copy(left, right)
}

case class LessThan(left: Expr, right: Expr) extends Predicate {
  override def symbol: String = "<"
  override protected def withNewChildren(left: Expr, right: Expr): LessThan = copy(left, right)
}

case class LessThanOrEqual(left: Expr, right: Expr) extends Predicate {
  override def symbol: String = "<="
  override protected def withNewChildren(left: Expr, right: Expr): LessThanOrEqual = copy(left, right)
}

case class GreaterThan(left: Expr, right: Expr) extends Predicate {
  override def symbol: String = ">"
  override protected def withNewChildren(left: Expr, right: Expr): GreaterThan = copy(left, right)
}

case class GreaterThanOrEqual(left: Expr, right: Expr) extends Predicate {
  override def symbol: String = ">="
  override protected def withNewChildren(left: Expr, right: Expr): GreaterThanOrEqual = copy(left, right)
}

abstract class CombinedPredicate extends Predicate {
  override def resolved: Boolean = {
    left.resolved && right.resolved && left.dataType == bool && right.dataType == bool
  }
}
case class LogicalAnd(left: Expr, right: Expr) extends CombinedPredicate {
  override def symbol: String = "&&"
  override protected def withNewChildren(left: Expr, right: Expr): LogicalAnd = copy(left, right)
}

case class LogicalOr(left: Expr, right: Expr) extends CombinedPredicate {
  override def symbol: String = "||"
  override protected def withNewChildren(left: Expr, right: Expr): LogicalOr = copy(left, right)
}


text:
Series collection

{{d.prompt}}   {{d.value}}

						<object class="videos">

						</object>

					1" ng-click="c.readCollection(item.href)" class="btn btn-info btn-ver">Ver Serie

	1" ng-click="c.buildEditForm(item)" class="btn btn-primary">Editar
	1" ng-click="c.deleteItem(item.href)" class="btn btn-danger">Eliminar


text:
package androidx.car.app.mediaextensions;

import android.os.Bundle;

/**
 * Defines constants for extra keys in {@link android.support.v4.media.MediaMetadataCompat} or
 * {@link androidx.media3.common.MediaMetadata}.
 */
public final class MetadataExtras {

    // Do not instantiate
    private MetadataExtras() {
    }

    /**
     * {@link Bundle} key used in the extras of a media item to indicate that the subtitle of the
     * corresponding media item can be linked to another media item ID.
     *
The value of the extra is set to the media ID of this other item.
     *
     *
NOTE: media1 and media3 apps setting this extra must implement
     * {@link androidx.media.MediaBrowserServiceCompat#onLoadItem} or
     * {@link  androidx.media3.session.MediaLibraryService.Callback#onGetItem} respectively.
     *
NOTE: media apps setting this extra must explicitly set the subtitle property.
     *
See {@link android.support.v4.media.MediaMetadataCompat#METADATA_KEY_DISPLAY_SUBTITLE}
     *
See {@link androidx.media3.common.MediaMetadata#subtitle}
     *
     *
TYPE: String.
     *

     *
 Example:
     *

     *   "Source" MediaItem
     *      + mediaId:                  "Beethoven-9th-symphony"    // ID
     *      + title:                    "9th symphony"              // Track
     *      + subtitle:                 "The best of Beethoven"     // Album
     * ╔════+ subtitleLinkMediaId:      "Beethoven-best-of"         // Album ID
     * ║    + description:              "Beethoven"                 // Artist
     * ║    + descriptionLinkMediaId:   "artist:Beethoven"          // Artist ID
     * ║
     * ║ "Destination" MediaItem
     * ╚════+ mediaId:                  "Beethoven-best-of"         // ID
     *      + title:                    "The best of Beethoven"     // Album
     *      + subtitle:                 "Beethoven"                 // Artist
     *      + subtitleLinkMediaId:      "artist:Beethoven"          // Artist ID
     *

     **/
    public static final String KEY_SUBTITLE_LINK_MEDIA_ID =
            "androidx.car.app.mediaextensions.KEY_SUBTITLE_LINK_MEDIA_ID";

    /**
     * {@link Bundle} key used in the extras of a media item to indicate that the description of the
     * corresponding media item can be linked to another media item ID.
     *
The value of the extra is set to the media ID of this other item.
     *
     *
NOTE: media1 and media3 apps setting this extra must implement
     * {@link androidx.media.MediaBrowserServiceCompat#onLoadItem} or
     * {@link androidx.media3.session.MediaLibraryService.Callback#onGetItem} respectively.
     *
NOTE: media apps setting this extra must explicitly set the description property.
     *
See {@link android.support.v4.media.MediaMetadataCompat#METADATA_KEY_DISPLAY_DESCRIPTION}
     *
See {@link androidx.media3.common.MediaMetadata#description}
     *
     *
TYPE: String.
     *

     *
 Example:
     *

     *   "Source" MediaItem
     *      + mediaId:                  "Beethoven-9th-symphony"    // ID
     *      + title:                    "9th symphony"              // Track
     *      + subtitle:                 "The best of Beethoven"     // Album
     *      + subtitleLinkMediaId:      "Beethoven-best-of"         // Album ID
     *      + description:              "Beethoven"                 // Artist
     * ╔════+ descriptionLinkMediaId:   "artist:Beethoven"          // Artist ID
     * ║
     * ║ "Destination" MediaItem
     * ╚════+ mediaId:                  "artist:Beethoven"          // ID
     *      + title:                    "Beethoven"                 // Artist
     *

     **/
    public static final String KEY_DESCRIPTION_LINK_MEDIA_ID =
            "androidx.car.app.mediaextensions.KEY_DESCRIPTION_LINK_MEDIA_ID";
}


text:
package com.amazonaws.services.iotthingsgraph.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SearchThingsResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * An array of things in the result set.
     *

     */
    private java.util.List<Thing> things;
    /**
     *

     * The string to specify as nextToken when you request the next page of results.
     *

     */
    private String nextToken;

    /**
     *

     * An array of things in the result set.
     *

     *
     * @return An array of things in the result set.
     */

    public java.util.List<Thing> getThings() {
        return things;
    }

    /**
     *

     * An array of things in the result set.
     *

     *
     * @param things
     *        An array of things in the result set.
     */

    public void setThings(java.util.Collection<Thing> things) {
        if (things == null) {
            this.things = null;
            return;
        }

        this.things = new java.util.ArrayList<Thing>(things);
    }

    /**
     *

     * An array of things in the result set.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setThings(java.util.Collection)} or {@link #withThings(java.util.Collection)} if you want to override the
     * existing values.
     *

     *
     * @param things
     *        An array of things in the result set.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public SearchThingsResult withThings(Thing... things) {
        if (this.things == null) {
            setThings(new java.util.ArrayList<Thing>(things.length));
        }
        for (Thing ele : things) {
            this.things.add(ele);
        }
        return this;
    }

    /**
     *

     * An array of things in the result set.
     *

     *
     * @param things
     *        An array of things in the result set.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public SearchThingsResult withThings(java.util.Collection<Thing> things) {
        setThings(things);
        return this;
    }

    /**
     *

     * The string to specify as nextToken when you request the next page of results.
     *

     *
     * @param nextToken
     *        The string to specify as nextToken when you request the next page of results.
     */

    public void setNextToken(String nextToken) {
        this.nextToken = nextToken;
    }

    /**
     *

     * The string to specify as nextToken when you request the next page of results.
     *

     *
     * @return The string to specify as nextToken when you request the next page of results.
     */

    public String getNextToken() {
        return this.nextToken;
    }

    /**
     *

     * The string to specify as nextToken when you request the next page of results.
     *

     *
     * @param nextToken
     *        The string to specify as nextToken when you request the next page of results.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public SearchThingsResult withNextToken(String nextToken) {
        setNextToken(nextToken);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getThings() != null)
            sb.append("Things: ").append(getThings()).append(",");
        if (getNextToken() != null)
            sb.append("NextToken: ").append(getNextToken());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof SearchThingsResult == false)
            return false;
        SearchThingsResult other = (SearchThingsResult) obj;
        if (other.getThings() == null ^ this.getThings() == null)
            return false;
        if (other.getThings() != null && other.getThings().equals(this.getThings()) == false)
            return false;
        if (other.getNextToken() == null ^ this.getNextToken() == null)
            return false;
        if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getThings() == null) ? 0 : getThings().hashCode());
        hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
        return hashCode;
    }

    @Override
    public SearchThingsResult clone() {
        try {
            return (SearchThingsResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
window.addEventListener('load', function() {
    FastClick.attach(document.body);
}, false);


text:
from roomai.games.common import AbstractStatePrivate

class BangStatePrivate(AbstractStatePrivate):
    def __init__(self):
        self.__deck__         = []
        self.__shuffle_deck__ = []
        self.__deal_cards__   = []

    def __get_deck__(self):  return tuple(self.__deck__)
    deck = property(__get_deck__, doc="the deck of this game")

    def __get_deal_cards__(self):  return tuple(self.__deal_cards__)
    deal_cards = property(__get_deal_cards__, doc="the dealed cards of this game")

    def __get_shuffle_deck__(self): return tuple(self.__shuffle_deck__)
    shuffle_deck = property(__get_shuffle_deck__, doc="the shuffle deck is as a tmp deck and used for shuffle")


text:
package com.javarush.task.task33.task3305;

public class RaceBike extends Motorbike {
    private String owner;
    private int age;

    public RaceBike(String name, String owner, int age) {
        super(name);
        this.owner = owner;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public String getOwner() {
        return owner;
    }

    public int getAge() {
        return age;
    }

    @Override
    public String toString() {
        return "RaceBike{" +
                "name='" + name + '\'' +
                ", owner='" + owner + '\'' +
                ", age=" + age +
                '}';
    }
}


text:
<!DOCTYPE html>
<script>
testRunner.waitUntilDone();
</script>
<script src="../resources/picker-common.js"></script>
<input type=date id=date value="2018-01-22" min="2018-01-01" max="2018-12-31">
<script>
openPickerAppearanceOnly(document.getElementById('date'), () => testRunner.notifyDone());
</script>


text:
/* @flow */
import React, { PureComponent } from 'react';

import type { Actions } from '../types';
import Chat from '../chat/Chat';
import MainNavBar from '../nav/MainNavBar';
import SideDrawer from './SideDrawer';
import StreamSidebar from '../nav/StreamSidebar';
import ConversationsContainer from '../conversations/ConversationsContainer';

export default class MainScreen extends PureComponent {
  props: {
    actions: Actions,
    orientation: string,
  };

  state: {
    leftDrawerOpen: boolean,
    rightDrawerOpen: boolean,
  };

  state = {
    leftDrawerOpen: false,
    rightDrawerOpen: false,
  };

  render() {
    const { actions, orientation } = this.props;
    const { leftDrawerOpen, rightDrawerOpen } = this.state;

    return (
      <SideDrawer
        side="left"
        open={leftDrawerOpen}
        orientation={orientation}
        onOpenStart={() => this.setState({ leftDrawerOpen: true })}
        onClose={() => this.setState({ leftDrawerOpen: false })}
        content={
          <StreamSidebar
            actions={actions}
            onNarrow={newNarrow => {
              actions.doNarrow(newNarrow);
              this.setState({ leftDrawerOpen: false });
            }}
          />
        }>
        <SideDrawer
          side="right"
          open={rightDrawerOpen}
          orientation={orientation}
          onOpenStart={() => this.setState({ rightDrawerOpen: true })}
          onClose={() => this.setState({ rightDrawerOpen: false })}
          content={
            <ConversationsContainer
              onNarrow={newNarrow => {
                actions.doNarrow(newNarrow);
                this.setState({ rightDrawerOpen: false });
              }}
            />
          }>
          <MainNavBar
            onPressPeople={() => this.setState({ rightDrawerOpen: true })}
            onPressStreams={() => this.setState({ leftDrawerOpen: true })}
            cancelEditMessage={actions.cancelEditMessage}>
            <Chat />
          </MainNavBar>
        </SideDrawer>
      </SideDrawer>
    );
  }
}


text:
<title>pcre2_general_context_copy specification</title>

pcre2_general_context_copy man page

Return to the PCRE2 index page.

This page is part of the PCRE2 HTML documentation. It was generated
automatically from the original man page. If there is any nonsense in it,
please consult the man page, in case the conversion went wrong.

SYNOPSIS

#include <pcre2.h>

pcre2_general_context *pcre2_general_context_copy(
  pcre2_general_context *gcontext);

DESCRIPTION

This function makes a new copy of a general context, using the memory
allocation functions in the context, if set, to get the necessary memory.
Otherwise malloc() is used. The result is NULL if the memory cannot be
obtained.

There is a complete description of the PCRE2 native API in the
pcre2api
page and a description of the POSIX API in the
pcre2posix
page.

Return to the PCRE2 index page.


text:
![](https://github.com/loveencounterflow/soba/raw/master/art/soba-logo.png)

- [soba](#soba)

> **Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*

soba
====

socket-based communication, inter-process and client / server


text:
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
	<File path="Classes/EC2ImportKeyPairRequestMarshaller.html">

		<Token>
			<TokenIdentifier>//apple_ref/occ/cl/EC2ImportKeyPairRequestMarshaller</TokenIdentifier>
			<Abstract type="html">Import Key Pair Request Marshaller</Abstract>
			<DeclaredIn>EC2ImportKeyPairRequestMarshaller.h</DeclaredIn>

			<NodeRef refid="633"/>
		</Token>

	</File>
</Tokens>


text:
<?php

// no direct access
defined('_JEXEC') or die('Restricted access');

?>

	<?php if ($this->checkPosition('media')) : ?>

<?php echo $this->renderPosition('media'); ?>

	<?php endif; ?>

	<?php if ($this->checkPosition('title')) : ?>

<?php echo $this->renderPosition('title'); ?>

	<?php endif; ?>

	<?php if ($this->checkPosition('description')) : ?>

<?php echo $this->renderPosition('description', array('style' => 'block')); ?>

	<?php endif; ?>

	<?php if ($this->checkPosition('links')) : ?>

<?php echo $this->renderPosition('links'); ?>

	<?php endif; ?>

<?php if ($this->checkPosition('article')) : ?>

<?php echo $this->renderPosition('article'); ?>

<?php endif;


text:
$( document ).ready( function () {

	$( "#formEquipment" ).validate( {
		rules: {
			type: 				{ required: true },
			truck: 				{ required: true },
			hour: 				{ required: true, number: true, maxlength:10 },
			quantity: 			{ number: true, maxlength:10 },
			description: 		{ required: true }
		},
		errorElement: "em",
		errorPlacement: function ( error, element ) {
			// Add the `help-block` class to the error element
			error.addClass( "help-block" );
			error.insertAfter( element );

		},
		highlight: function ( element, errorClass, validClass ) {
			$( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
		},
		unhighlight: function (element, errorClass, validClass) {
			$( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
		},
		submitHandler: function (form) {
			return true;
		}
	});

	$("#btnSubmitEquipment").click(function(){

		if ($("#formEquipment").valid() == true){

				//Activa icono guardando
				$('#btnSubmitEquipment').attr('disabled','-1');
				$("#div_error").css("display", "none");
				$("#div_load").css("display", "inline");

				$.ajax({
					type: "POST",
					url: base_url + "workorders/save/saveEquipment",
					data: $("#formEquipment").serialize(),
					dataType: "json",
					contentType: "application/x-www-form-urlencoded;charset=UTF-8",
					cache: false,

					success: function(data){

						if( data.result == "error" )
						{
							$("#div_load").css("display", "none");
							$('#btnSubmitEquipment').removeAttr('disabled');
							return false;
						}

						if( data.result )//true
						{
							$("#div_load").css("display", "none");
							$('#btnSubmitEquipment').removeAttr('disabled');

							var url = base_url + "workorders/" + data.controlador + "/" + data.idRecord;
							$(location).attr("href", url);
						}
						else
						{
							alert('Error. Reload the web page.');
							$("#div_load").css("display", "none");
							$("#div_error").css("display", "inline");
							$('#btnSubmitEquipment').removeAttr('disabled');
						}
					},
					error: function(result) {
						alert('Error. Reload the web page.');
						$("#div_load").css("display", "none");
						$("#div_error").css("display", "inline");
						$('#btnSubmitEquipment').removeAttr('disabled');
					}

				});

		}//if
	});
});


text:
package bead01;

@SuppressWarnings("serial")
public class InvalidValueException extends RuntimeException {

	public InvalidValueException () {

    }
}


text:
OC.L10N.register(
    "files",
    {
    "Storage is temporarily not available" : "Espace de stockage temporairement indisponible",
    "Storage invalid" : "Support de stockage non valable",
    "Unknown error" : "Erreur Inconnue ",
    "All files" : "Tous les fichiers",
    "File could not be found" : "Ce fichier n'a pu être trouvé.",
    "Home" : "Mes fichiers",
    "Close" : "Fermer",
    "Favorites" : "Favoris",
    "Upload timeout for file \"{file}\"" : "Expiration du téléversement du fichier \"{file}\"",
    "Unknown error \"{error}\" uploading file \"{file}\"" : "Erreur inconnue \"[error}\" lors du téléversement du fichier \"{file}\"",
    "Could not create folder \"{dir}\"" : "Impossible de créer le dossier \"{dir}\"",
    "Upload cancelled." : "Envoi annulé.",
    "The file {file} already exists" : "Le fichier [fichier] existe déjà",
    "Processing files..." : "Traitement des fichiers ...",
    "Unable to upload {filename} as it is a directory or has 0 bytes" : "Impossible d'envoyer {filename} car il s'agit d'un répertoire ou d'un fichier de taille nulle",
    "Not enough free space, you are uploading {size1} but only {size2} is left" : "Espace libre insuffisant : vous tentez d'envoyer {size1} mais seulement {size2} sont disponibles",
    "You don't have permission to upload or create files here" : "Vous n'avez pas la permission d'ajouter des fichiers ici",
    "Target folder \"{dir}\" does not exist any more" : "Le dossier de destination « {dir} » n'existe plus",
    "Target folder does not exist any more" : "Le dossier cible n'existe plus",
    "The file {file} is currently locked, please try again later" : "Le fichier [fichier] est actuellement bloqué, veuillez réessayer plus tard ",
    "Not enough free space" : "Pas assez d'espace libre",
    "Uploading..." : "Téléversement en cours…",
    "..." : "...",
    "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} sur {totalSize} ({bitrate})",
    "Error when assembling chunks, status code {status}" : "Erreur lors de l'assemblage d'un bloc, code {status}",
    "File upload is in progress. Leaving the page now will cancel the upload." : "L'envoi du fichier est en cours. Quitter cette page maintenant annulera l'envoi du fichier.",
    "Actions" : "Actions",
    "Download" : "Télécharger",
    "Rename" : "Renommer",
    "Delete" : "Supprimer",
    "Disconnect storage" : "Déconnecter ce support de stockage",
    "Unshare" : "Ne plus partager",
    "Could not load info for file \"{file}\"" : "Impossible de charger les informations pour le fichier \"{file}\"",
    "Files" : "Fichiers",
    "Details" : "Détails",
    "Select" : "Sélectionner",
    "Pending" : "En attente",
    "Unable to determine date" : "Impossible de déterminer la date",
    "Invalid path" : "Chemin non valide",
    "This operation is forbidden" : "Cette opération est interdite",
    "This directory is unavailable, please check the logs or contact the administrator" : "Ce répertoire n'est pas disponible. Consultez les logs ou contactez votre administrateur",
    "group" : "groupe",
    "Remote share" : "Partage distant",
    "via" : "via",
    "Could not move \"{file}\", target exists" : "Impossible de déplacer \"{file}\", la cible existe",
    "Could not move \"{file}\"" : "Impossible de déplacer \"{file}\"",
    "{newName} already exists" : "{newName} existe déjà",
    "Could not rename \"{fileName}\", it does not exist any more" : "Impossible de renommer \"{file}\", il n'existe plus",
    "The name \"{targetName}\" is already used in the folder \"{dir}\". Please choose a different name." : "Le nom \"{targetName}\" est déjà utilisé dans le dossier \"{dir}\". Merci de choisir un nom différent.",
    "Could not rename \"{fileName}\"" : "Impossible de renommer \"{fileName}\"",
    "Could not create file \"{file}\"" : "Impossible de créer le fichier \"{file}\"",
    "Could not create file \"{file}\" because it already exists" : "Impossible de créer le fichier \"{file}\" car il existe déjà",
    "Could not create folder \"{dir}\" because it already exists" : "Impossible de créer le dossier \"{dir}\" car il existe déjà",
    "Error deleting file \"{fileName}\"." : "Erreur à la suppression du fichier \"{fileName}\".",
    "No entries in this folder match {filter}" : "Aucun fichier dans ce dossier ne correspond à {filter}",
    "Name" : "Nom",
    "Size" : "Taille",
    "Modified" : "Modifié",
    "_%n folder_::_%n folders_" : ["%n dossier","%n dossiers"],
    "_%n file_::_%n files_" : ["%n fichier","%n fichiers"],
    "{dirs} and {files}" : "{dirs} et {files}",
    "_including %n hidden_::_including %n hidden_" : ["inclure %n caché","inclure %n cachés"],
    "_Uploading %n file_::_Uploading %n files_" : ["Téléversement de %n fichier","Téléversement de %n fichiers"],
    "New" : "Nouveau",
    "Unknown user" : "Utilisateur inconnu",
    "This resource is locked. Click to see more details." : "cette ressource est vérouillée, cliquer pour plus de détails",
    "\"{name}\" is an invalid file name." : "\"{name}\" n'est pas un nom de fichier valide.",
    "File name cannot be empty." : "Le nom de fichier ne peut être vide.",
    "File name cannot contain \"/\"." : "Le nom du fichier ne peut pas comporter le caractère \"/\".",
    "\"{name}\" has a forbidden file type/extension." : "Le type de fichier/l'extension de \"{name}\" est incorrect/e.",
    "Storage of {owner} is full, files can not be updated or synced anymore!" : "L'espace de stockage de {owner} est plein. Les fichiers ne peuvent plus être mis à jour ou synchronisés!",
    "Your storage is full, files can not be updated or synced anymore!" : "Votre espage de stockage est plein, les fichiers ne peuvent plus être ajoutés ou synchronisés !",
    "Storage of {owner} is almost full ({usedSpacePercent}%)" : "L'espace de stockage de {owner} est presque plein ({usedSpacePercent}%)",
    "Your storage is almost full ({usedSpacePercent}%)" : "Votre espace de stockage est presque plein ({usedSpacePercent}%)",
    "_matches '{filter}'_::_match '{filter}'_" : ["correspond à '{filter}'","correspondent à '{filter}'"],
    "Path" : "Chemin",
    "_%n byte_::_%n bytes_" : ["%n octet","%n octets"],
    "Favorited" : "Marqué comme favori",
    "Favorite" : "Favoris",
    "Private link:  Only people who have access to the file/folder can use it. Use it as a permanent link for yourself or to point others to files within shares" : "Lien privé : seules les personnes ayant accès à ce fichier/dossier peuvent l'utiliser. Utilisez le en tant que lien permanent pour vous-même ou pour désigner des fichiers dans les partages aux autres utilisateurs.",
    "Folder" : "Dossier",
    "New folder" : "Nouveau dossier",
    "{newname} already exists" : "{newname} existe déjà",
    "Upload" : "Chargement",
    "An error occurred while trying to update the tags" : "Une erreur est survenue lors de la mise à jour des étiquettes",
    "A new file or folder has been created" : "Un nouveau fichier ou répertoire a été créé",
    "A file or folder has been changed" : "Un fichier ou un répertoire a été modifié",
    "Limit notifications about creation and changes to your favorite files (Stream only)" : "Limiter les notifications à ce qui concerne la création et la modification de vos fichiers favoris (Flux uniquement)",
    "A file or folder has been deleted" : "Un fichier ou un répertoire a été supprimé",
    "A file or folder has been restored" : "Un fichier ou un répertoire a été restauré",
    "You created %1$s" : "Vous avez créé %1$s",
    "%2$s created %1$s" : "%2$s a créé %1$s",
    "%1$s was created in a public folder" : "%1$s a été créé dans un dossier public",
    "You changed %1$s" : "Vous avez modifié %1$s",
    "%2$s changed %1$s" : "%2$s a modifié %1$s",
    "You deleted %1$s" : "Vous avez supprimé %1$s",
    "%2$s deleted %1$s" : "%2$s a supprimé %1$s",
    "You restored %1$s" : "Vous avez restauré %1$s",
    "%2$s restored %1$s" : "%2$s a restauré %1$s",
    "Changed by %2$s" : "Modifié par %2$s",
    "Deleted by %2$s" : "Supprimé par %2$s",
    "Restored by %2$s" : "Restauré par %2$s",
    "You don't have permissions to access this file/folder - Please contact the owner to share it with you." : "Vous n'êtes pas autorisé à accéder à ce fichier/dossier. Merci de contacter le propriétaire afin qu'il le partage avec vous.",
    "Upload (max. %s)" : "Envoi (max. %s)",
    "Settings" : "Paramètres",
    "Show hidden files" : "Afficher les fichiers cachés",
    "WebDAV" : "WebDAV",
    "Use this address to access your Files via WebDAV" : "Utilisez cette adresse pour accéder à vos fichiers par WebDAV",
    "No files in here" : "Aucun fichier",
    "Upload some content or sync with your devices!" : "Déposez du contenu ou synchronisez vos appareils !",
    "No entries found in this folder" : "Aucune entrée trouvée dans ce dossier",
    "Select all" : "Tout sélectionner",
    "Upload too large" : "Téléversement trop volumineux",
    "The files you are trying to upload exceed the maximum size for file uploads on this server." : "Les fichiers que vous essayez d'envoyer dépassent la taille maximale d'envoi permise par ce serveur.",
    "No favorites" : "Aucun favori",
    "Files and folders you mark as favorite will show up here" : "Les fichiers et dossiers ajoutés à vos favoris apparaîtront ici",
    "Text file" : "Fichier texte",
    "New text file.txt" : "Nouveau fichier texte.txt"
},
"nplurals=2; plural=(n > 1);");


text:
/**
  * Wrapper code to invoke the Application demonstrator.
  *
  * @author H W Yau
  * @version $Revision: 1.19 $ $Date: 1999/02/16 19:10:02 $
  */

// initialize and run the application and process the results
// no particular data structure which can be shared

public class CallAppDemo {
    public int size;
    int datasizes[] = {10000,60000};
    int input[] = new int[2];
    AppDemo ap = null;

    public void initialise () {
    	// # of time steps
      input[0] = 1000;
      // data size
      input[1] = datasizes[size];

      String dirName="Data";
      String filename="hitData";
      ap = new AppDemo(dirName, filename, (input[0]),(input[1]));
      //ap.initSerial();
      ap.initParallel();
    }

    public void runiters () {
      //ap.runSerial();
    	ap.runParallel();
    }
    public void presults () {
      //ap.processSerial();
      ap.processParallel();
    }

}


text:
package com.amazonaws.services.xray.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.xray.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * SamplingStatisticSummary JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SamplingStatisticSummaryJsonUnmarshaller implements Unmarshaller<SamplingStatisticSummary, JsonUnmarshallerContext> {

    public SamplingStatisticSummary unmarshall(JsonUnmarshallerContext context) throws Exception {
        SamplingStatisticSummary samplingStatisticSummary = new SamplingStatisticSummary();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("RuleName", targetDepth)) {
                    context.nextToken();
                    samplingStatisticSummary.setRuleName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("Timestamp", targetDepth)) {
                    context.nextToken();
                    samplingStatisticSummary.setTimestamp(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));
                }
                if (context.testExpression("RequestCount", targetDepth)) {
                    context.nextToken();
                    samplingStatisticSummary.setRequestCount(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("BorrowCount", targetDepth)) {
                    context.nextToken();
                    samplingStatisticSummary.setBorrowCount(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("SampledCount", targetDepth)) {
                    context.nextToken();
                    samplingStatisticSummary.setSampledCount(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return samplingStatisticSummary;
    }

    private static SamplingStatisticSummaryJsonUnmarshaller instance;

    public static SamplingStatisticSummaryJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new SamplingStatisticSummaryJsonUnmarshaller();
        return instance;
    }
}


text:
#pragma once

#include <vector>
#include <string>
#include <sstream>

template<typename T>
std::string toString(T val ) { // not terribly efficient, but works...
   std::ostringstream myostringstream;
   myostringstream << val;
   return myostringstream.str();
}

std::vector<std::string> split(const std::string &str, const std::string &separator = " " );
std::string trim( const std::string &target );
/*
class ExtendedString : public string {
public:
   ExtendedString( const string& origstring ) {
      *this = origstring;
   }
   ExtendedString( const char * origstring ) {
      *this = origstring;
   }
   vector<ExtendedString> split( string separator ) const {
      vector<ExtendedString> splitstring;
      ExtendedString str = *this;
      int start = 0;
      int npos = str.find(separator);
      while (npos != (int)str.npos ) {
         splitstring.push_back( str.substr(start, npos-start) );
         start = npos + 1;
         npos = str.find(separator, start);
      }
      splitstring.push_back( str.substr( start ) );
      return splitstring;
   }
   ExtendedString trim() const {
      return ::trim(*this);
   }
};
*/
inline double atof( std::string stringvalue ) {
   return atof(stringvalue.c_str());
}
inline double atoi( std::string stringvalue ) {
   return atoi(stringvalue.c_str());
}

// returns empty string if off the end of the number of available tokens
inline std::string getToken( std::string targetstring, int tokenIndexFromZero, std::string separator = " " ) {
   std::vector<std::string> splitstring = split( targetstring, separator );
   if( tokenIndexFromZero < splitstring.size() ) {
      return splitstring[tokenIndexFromZero];
   } else {
      return "";
   }
}

inline std::string toLower(std::string in ) {
   int len = in.size();
   char buffer[len + 1];
   for( int i = 0; i < len; i++ ) {
      char thischar = in[i];
      thischar = tolower(thischar);
      buffer[i] = thischar;
   }
   buffer[len] = 0;
   return std::string(buffer);
}


text:
require "spec_helper"
require "yaml"

RESPONSE_FILE = "spec/dpn/client/response_file.yml"
httpclient_resp = YAML::load(File.read(RESPONSE_FILE))

describe DPN::Client::Response do
  before(:all) { WebMock.disable! }
  let(:response) { DPN::Client::Response.new(httpclient_resp) }
  let(:json) { httpclient_resp.body }

  http_success_codes = ([200, 201, 202, 203] +
      [204, 205, 206, 207, 208, 226]).freeze

  http_failure_codes = ([100, 101, 102] +
      [300, 301, 302, 303, 304, 305, 307, 308] +
      [400, 401, 402, 403, 404, 405, 406, 407] +
      [408, 409, 410, 411, 412, 413, 414, 415] +
      [416, 417, 421, 422, 423, 424, 426, 428] +
      [429, 431, 500, 501, 502, 503, 504, 505] +
      [506, 507, 508, 510, 511]).freeze

  describe "#status" do
    it "returns 200" do
      expect(response.status).to eql(200)
    end

    it "is immutable" do
      expect {
        response.status = 301
      }.to raise_error(NoMethodError)

    end
  end

  describe "#body" do
    it "is a hash with symbols as keys" do
      expect(response.body).to be_a(Hash)
      response.body.keys do |key|
        expect(key).to be_a(Symbol)
      end
    end

    it "is immutable" do
      expect {
        response.body = "new body"
      }.to raise_error(NoMethodError)
    end
  end

  describe "#json" do
    it "returns the body as json" do
      expect(response.json).to eql(json)
    end
  end

  describe "#to_json" do
    it "returns the body as json" do
      expect(response.to_json).to eql(json)
    end
  end

  describe "#to_s" do
    it "returns the body as json" do
      expect(response.to_s).to eql(json)
    end
  end

  describe "#ok?" do
    http_success_codes.each do |code|
      it "is true when status==#{code}" do
        response.instance_variable_set(:@status, code)
        expect(response.ok?).to be true
      end
    end

    http_failure_codes.each do |code|
      it "is false when status==#{code}" do
        response.instance_variable_set(:@status, code)
        expect(response.ok?).to be false
      end
    end
  end

  describe "#success?" do
    http_success_codes.each do |code|
      it "is true when status==#{code}" do
        response.instance_variable_set(:@status, code)
        expect(response.success?).to be true
      end
    end

    http_failure_codes.each do |code|
      it "is false when status==#{code}" do
        response.instance_variable_set(:@status, code)
        expect(response.success?).to be false
      end
    end

  end

  describe "#[]" do
    it "returns the correct value" do
      expect(response[:first_key]).to eql("first_value")
    end
  end

  describe "#keys" do
    it "returns all the keys" do
      expect(response.keys.sort).to eql([:first_key, :second_key].sort)
    end
  end

end


text:
Capturing images from webcam and converting to rgb24. Linux only (v4l2)

## Installation
```javascripts
npm install linuxcam
```

## Usage

```javascript
var cam = require('linuxcam');
cam.start("/dev/video0", 320, 240);
var frame = cam.frame(); // Buffer
```

The buffer contains rgb24 data and you can convert it using jpeg-fresh module.

```javascript
var Jpeg = require('jpeg-fresh').Jpeg;
var jpeg = new Jpeg(frame.data, frame.width, frame.height, 'rgb');
var jpeg_image = jpeg.encodeSync(); // Buffer
```

## Simple live streaming example with SocketIO

```javascript
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var cam = require('linuxcam');
var Jpeg = require('jpeg-fresh').Jpeg;

cam.start("/dev/video0", 320, 240);

function update(socket) {
  var frame = cam.frame();
  var jpeg = new Jpeg(frame.data, frame.width, frame.height, 'rgb');
  var jpeg_frame = jpeg.encodeSync();
  socket.emit("frame", jpeg_frame.toString('base64'));
  setTimeout(function() {
    update(socket);
  }, 40);
}

io.on('connection', function(socket){
  socket.on('error', function(err){
    console.log("ERROR: "+err);
  });
  update(socket);
});

http.listen(9639, function(){
  console.log('listening on *:9639');
});
```
## Client
```html
<!DOCTYPE html>
<html>
  <head>
    <script src="https://cdn.socket.io/socket.io-1.3.5.js"></script>
  <head>
  <body>
    <canvas id="canvas" width="320" height="240"></canvas>
    <script>
      socket = io("http://localhost:9639");
      var canvas = document.getElementById("canvas");
      var ctx = canvas.getContext("2d");

      var image = new Image();
      image.onload = function() {
        ctx.drawImage(image, 0, 0, 320, 240);
      };

      socket.on('frame', function (frame) {
        image.src = "data:image/jpeg;base64," + frame;
      });
    </script>
  </body>
</html>

```

## MIT license


text:
<?php

namespace NextFlowTest\Math\Action;

use InvalidArgumentException;
use NextFlow\Math\Action\ModuloAction;
use NextFlow\Php\Variable\IntegerVariable;
use PHPUnit_Framework_TestCase;

class ModuloActionTest extends PHPUnit_Framework_TestCase
{
    public function testCreateSockets()
    {
        $action = new ModuloAction();

        $this->assertCount(4, $action->getSockets());
        $this->assertNotNull($action->getSocket(ModuloAction::SOCKET_LFT));
        $this->assertNotNull($action->getSocket(ModuloAction::SOCKET_OUTPUT));
        $this->assertNotNull($action->getSocket(ModuloAction::SOCKET_RESULT));
        $this->assertNotNull($action->getSocket(ModuloAction::SOCKET_RGT));
    }

    public function testCalculateValue()
    {
        $lftVariable = new IntegerVariable(10);
        $rgtVariable = new IntegerVariable(3);
        $resultVariable = new IntegerVariable();

        $action = new ModuloAction();
        $action->bind(ModuloAction::SOCKET_LFT, $lftVariable);
        $action->bind(ModuloAction::SOCKET_RGT, $rgtVariable);
        $action->bind(ModuloAction::SOCKET_RESULT, $resultVariable);
        $action->execute();

        $this->assertSame(1, $resultVariable->getValue());
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testCalculateValueNoLft()
    {
        $rgtVariable = new IntegerVariable(123);
        $resultVariable = new IntegerVariable();

        $action = new ModuloAction();
        $action->bind(ModuloAction::SOCKET_RGT, $rgtVariable);
        $action->bind(ModuloAction::SOCKET_RESULT, $resultVariable);
        $action->execute();
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testCalculateValueNoRgt()
    {
        $lftVariable = new IntegerVariable(123);
        $resultVariable = new IntegerVariable();

        $action = new ModuloAction();
        $action->bind(ModuloAction::SOCKET_LFT, $lftVariable);
        $action->bind(ModuloAction::SOCKET_RESULT, $resultVariable);
        $action->execute();
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testCalculateValueNoResult()
    {
        $lftVariable = new IntegerVariable(123);
        $rgtVariable = new IntegerVariable(123);

        $action = new ModuloAction();
        $action->bind(ModuloAction::SOCKET_LFT, $lftVariable);
        $action->bind(ModuloAction::SOCKET_RGT, $rgtVariable);
        $action->execute();
    }
}