text:
/*
 * Hibernate OGM, Domain model persistence for NoSQL datastores
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */
package org.hibernate.ogm.demos.ogm101.part3.repo;

import java.util.List;

import javax.enterprise.context.ApplicationScoped;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.hibernate.ogm.demos.ogm101.part3.model.Hike;
import org.hibernate.ogm.demos.ogm101.part3.model.Person;

/**
 * {@link Person} CRUD operations.
 *
 * @author Gunnar Morling
 */
@ApplicationScoped
public class PersonRepository {

	@PersistenceContext
	private EntityManager entityManager;

	public Person create(Person person) {
		entityManager.persist( person );
		return person;
	}

	public Person get(String id) {
		return entityManager.find( Person.class, id );
	}

	public List<Person> getAll() {
		return entityManager.createQuery( "FROM Person p", Person.class ).getResultList();
	}

	public Person save(Person person) {
		return entityManager.merge( person );
	}

	public void remove(Person person) {
		entityManager.remove( person );
		for ( Hike hike : person.getOrganizedHikes() ) {
			hike.setOrganizer( null );
		}
	}
}


text:
<?php

namespace spec\FileModifier\Code\Entities;

use FileModifier\Code\Entities\PHPMethod;
use FileModifier\Code\Factory\CodeFactoryContract;
use Prophecy\Argument;
use spec\FileModifier\Code\Entities\Partials\ClassMemberSpec;
use spec\FileModifier\Code\Entities\Traits\AbstractSpecTrait;
use spec\FileModifier\Code\Entities\Traits\FinalSpecTrait;

/**
 * Class PHPMethodSpec
 *
 * @package spec\FileModifier\Code\Entities
 * @mixin PHPMethod
 */
class PHPMethodSpec extends ClassMemberSpec
{

    use AbstractSpecTrait, FinalSpecTrait;

    function let(CodeFactoryContract $factory)
    {
        $this->beConstructedWith('fooMethod', $factory);
    }

    /**
     * Is a class member
     */
    function it_is_a_class_member()
    {
        $this->shouldHaveType('\FileModifier\Code\Entities\Partials\ClassMember');
    }

    /**
     * Has parameters
     */
    function it_has_parameters()
    {
        $this->parameter('$foo', 'Foo\Bar $bar', '$baz = 0')->shouldReturn($this);
        $this->getParameters()->shouldBe([ '$foo', 'Foo\Bar $bar', '$baz = 0' ]);
    }

    /**
     * Has a definition
     */
    function it_has_a_definition()
    {
        $this->definition('return $this;')->shouldReturn($this);
        $this->getDefinition()->shouldReturn('return $this;');
    }
}

redpajama_set_name: RedPajamaGithub


text:
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Top Baby Names skill, try saying...

* *Alexa, open Top Baby Names*

* *Alexa, ask top baby names for a name*

* *Alexa, tell top baby names to give me a baby name*

Open up this skill to hear one of the top 50 baby names. Maybe one of them will be perfect for you!

***

### Skill Details

* **Invocation Name:** top baby names
* **Category:** null
* **ID:** amzn1.ask.skill.f02a1d1c-84fc-40d2-af44-e014985c6dc6
* **ASIN:** B01KGRBNDY
* **Author:** Sly Software
* **Release Date:** August 17, 2016 @ 02:22:36
* **In-App Purchasing:** No


text:
namespace Common
{
	using System.Text;

	// TODO: (PS) Comment this.
	// Source: http://sites.google.com/site/murmurhash/
	public class MurmurHash2
	{
		#region constants

		private const uint DEFAULT_SEED = 0x9fae34d1;

		// 'm' and 'r' are mixing constants generated offline.
		// They're not really 'magic', they just happen to work well.
		private const uint m = 0x5bd1e995;
		private const int r = 24;

		#endregion constants

		#region fields

		private uint seed;

		#endregion fields

		#region constructors

		public MurmurHash2(uint seed)
		{
			this.seed = seed;
		}

		public MurmurHash2()
			: this(DEFAULT_SEED)
		{
		}

		#endregion constructors

		#region methods

		public uint CombuteHash(string text)
		{
			return CombuteHash(Encoding.UTF8.GetBytes(text));
		}

		public uint CombuteHash(byte[] data)
		{
			uint len = (uint)data.LongLength;

			// Initialize the hash to a 'random' value.
			uint result = this.seed ^ len;
			unsafe
			{
				fixed (byte* fixedDataPointer = data)
				{
					byte* dataPointer = fixedDataPointer;

					// Mix 4 bytes at a time into the hash
					while (len >= 4)
					{
						uint k = *(uint*)dataPointer;

						k *= m;
						k ^= k >> r;
						k *= m;

						result *= m;
						result ^= k;

						dataPointer += 4;
						len -= 4;
					}

					// Handle the last few bytes of the input array
					switch (len)
					{
						case 3:
							result ^= (uint)dataPointer[2] << 16;
							goto case 2;

						case 2:
							result ^= (uint)dataPointer[1] << 8;
							goto case 1;

						case 1:
							result ^= (uint)dataPointer[0];
							result *= m;
							break;
					};
				}
			}

			// Do a few final mixes of the hash to ensure the last few
			// bytes are well-incorporated.
			result ^= result >> 13;
			result *= m;
			result ^= result >> 15;

			return result;
		}

		#endregion methods
	}
}


text:
package org.jpokemon.server.event;

import org.jpokemon.api.PokemonTrainer;
import org.zachtaylor.emissary.WebsocketConnection;

public class PokemonTrainerLogin {
	protected final PokemonTrainer pokemonTrainer;
	protected final WebsocketConnection connection;

	public PokemonTrainerLogin(PokemonTrainer pokemonTrainer, WebsocketConnection connection) {
		this.pokemonTrainer = pokemonTrainer;
		this.connection = connection;
	}

	public PokemonTrainer getPokemonTrainer() {
		return pokemonTrainer;
	}

	public WebsocketConnection getConnection() {
		return connection;
	}
}


text:
package gudusoft.gsqlparser.sql2xml.model;

public class comment_character
{

}


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

<TITLE>
Uses of Interface org.apache.hadoop.io.Writable (Hadoop 0.20.2+320 API)
</TITLE>

<META NAME="date" CONTENT="2010-06-28">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.apache.hadoop.io.Writable

Packages that use Writable

org.apache.hadoop.conf
Configuration of system parameters.

org.apache.hadoop.contrib.index.example

org.apache.hadoop.contrib.index.mapred

org.apache.hadoop.contrib.utils.join

org.apache.hadoop.examples
Hadoop example code.

org.apache.hadoop.fs
An abstract file system API.

org.apache.hadoop.fs.permission

org.apache.hadoop.io
Generic i/o code for use when reading and writing data to the network,
to databases, and to files.

org.apache.hadoop.io.serializer

This package provides a mechanism for using different serialization frameworks
in Hadoop.

org.apache.hadoop.ipc
Tools to help define network clients and servers.

org.apache.hadoop.mapred
A software framework for easily writing applications which process vast
amounts of data (multi-terabyte data-sets) parallelly on large clusters
(thousands of nodes) built of commodity hardware in a reliable, fault-tolerant
manner.

org.apache.hadoop.mapred.join
Given a set of sorted datasets keyed with the same class and yielding equal
partitions, it is possible to effect a join of those datasets prior to the map.

org.apache.hadoop.mapred.lib
Library of generally useful mappers, reducers, and partitioners.

org.apache.hadoop.mapred.lib.aggregate
Classes for performing various counting and aggregations.

org.apache.hadoop.mapreduce

org.apache.hadoop.mapreduce.lib.db
org.apache.hadoop.mapred.lib.db Package

org.apache.hadoop.mapreduce.lib.input

org.apache.hadoop.record
Hadoop record I/O contains classes and a record description language
  translator for simplifying serialization and deserialization of records in a
  language-neutral manner.

org.apache.hadoop.record.meta

org.apache.hadoop.security

org.apache.hadoop.streaming.io

org.apache.hadoop.typedbytes
Typed bytes are sequences of bytes in which the first byte is a type code.

org.apache.hadoop.util
Common utilities.

org.apache.hadoop.util.bloom

Uses of Writable in org.apache.hadoop.conf

Classes in org.apache.hadoop.conf that implement Writable

 class
Configuration

          Provides access to configuration parameters.

Uses of Writable in org.apache.hadoop.contrib.index.example

Classes in org.apache.hadoop.contrib.index.example that implement Writable

 class
LineDocTextAndOp

          This class represents an operation.

Uses of Writable in org.apache.hadoop.contrib.index.mapred

Classes in org.apache.hadoop.contrib.index.mapred with type parameters of type Writable

 interface
ILocalAnalysis<K extends WritableComparable,V extends Writable>

          Application specific local analysis.

 class
IndexUpdateMapper<K extends WritableComparable,V extends Writable>

          This class applies local analysis on a key-value pair and then convert the
 result docid-operation pair to a shard-and-intermediate form pair.

Classes in org.apache.hadoop.contrib.index.mapred that implement Writable

 class
DocumentAndOp

          This class represents an indexing operation.

 class
DocumentID

          The class represents a document id, which is of type text.

 class
IntermediateForm

          An intermediate form for one or more parsed Lucene documents and/or
 delete terms.

 class
Shard

          This class represents the metadata of a shard.

Methods in org.apache.hadoop.contrib.index.mapred that return types with arguments of type Writable

static Class<? extends Writable>
IndexUpdateMapper.getMapOutputValueClass()

          Get the map output value class.

static Class<? extends Writable>
IndexUpdateReducer.getOutputValueClass()

          Get the reduce output value class.

Uses of Writable in org.apache.hadoop.contrib.utils.join

Classes in org.apache.hadoop.contrib.utils.join that implement Writable

 class
TaggedMapOutput

          This abstract class serves as the base class for the values that
 flow from the mappers to the reducers in a data join job.

Methods in org.apache.hadoop.contrib.utils.join that return Writable

abstract  Writable
TaggedMapOutput.getData()

Uses of Writable in org.apache.hadoop.examples

Classes in org.apache.hadoop.examples that implement Writable

static class
MultiFileWordCount.WordOffset

          This record keeps <filename,offset> pairs.

static class
SecondarySort.IntPair

          Define a pair of integers that are writable.

static class
SleepJob.EmptySplit

Method parameters in org.apache.hadoop.examples with type arguments of type Writable

 void
PiEstimator.PiReducer.reduce(BooleanWritable isInside,
       Iterator<LongWritable> values,
       OutputCollector<WritableComparable<?>,Writable> output,
       Reporter reporter)

          Accumulate number of points inside/outside results from the mappers.

Uses of Writable in org.apache.hadoop.fs

Classes in org.apache.hadoop.fs that implement Writable

 class
BlockLocation

 class
ContentSummary

          Store the summary of a content (a directory or a file).

 class
FileChecksum

          An abstract class representing file checksums for files.

 class
FileStatus

          Interface that represents the client side information for a file.

 class
FsStatus

          This class is used to represent the capacity, free and used space on a
 FileSystem.

 class
MD5MD5CRC32FileChecksum

          MD5 of MD5 of CRC32.

Uses of Writable in org.apache.hadoop.fs.permission

Classes in org.apache.hadoop.fs.permission that implement Writable

 class
FsPermission

          A class for file/directory permissions.

 class
PermissionStatus

          Store permission related information.

Uses of Writable in org.apache.hadoop.io

Subinterfaces of Writable in org.apache.hadoop.io

 interface
WritableComparable<T>

          A Writable which is also Comparable.

Classes in org.apache.hadoop.io that implement Writable

 class
AbstractMapWritable

          Abstract base class for MapWritable and SortedMapWritable

 Unlike org.apache.nutch.crawl.MapWritable, this class allows creation of
 MapWritable<Writable, MapWritable> so the CLASS_TO_ID and ID_TO_CLASS
 maps travel with the class instead of being static.

 class
ArrayWritable

          A Writable for arrays containing instances of a class.

 class
BooleanWritable

          A WritableComparable for booleans.

 class
BytesWritable

          A byte sequence that is usable as a key or value.

 class
ByteWritable

          A WritableComparable for a single byte.

 class
CompressedWritable

          A base-class for Writables which store themselves compressed and lazily
 inflate on field access.

 class
DoubleWritable

          Writable for Double values.

 class
FloatWritable

          A WritableComparable for floats.

 class
GenericWritable

          A wrapper for Writable instances.

 class
IntWritable

          A WritableComparable for ints.

 class
LongWritable

          A WritableComparable for longs.

 class
MapWritable

          A Writable Map.

 class
MD5Hash

          A Writable for MD5 hash values.

 class
NullWritable

          Singleton Writable with no data.

 class
ObjectWritable

          A polymorphic Writable that writes an instance with it's class name.

static class
SequenceFile.Metadata

          The class encapsulating with the metadata of a file.

 class
SortedMapWritable

          A Writable SortedMap.

 class
Text

          This class stores text using standard UTF8 encoding.

 class
TwoDArrayWritable

          A Writable for 2D arrays containing a matrix of instances of a class.

 class
UTF8

          Deprecated. replaced by Text

 class
VersionedWritable

          A base class for Writables that provides version checking.

 class
VIntWritable

          A WritableComparable for integer values stored in variable-length format.

 class
VLongWritable

          A WritableComparable for longs in a variable-length format.

Methods in org.apache.hadoop.io with type parameters of type Writable

static

<T extends Writable>

T

WritableUtils.clone(T orig,
      Configuration conf)

          Make a copy of a writable object using serialization to a buffer.

Methods in org.apache.hadoop.io that return Writable

 Writable[][]
TwoDArrayWritable.get()

 Writable[]
ArrayWritable.get()

 Writable
GenericWritable.get()

          Return the wrapped instance.

 Writable
ArrayFile.Reader.get(long n,
    Writable value)

          Return the nth value in the file.

 Writable
SortedMapWritable.get(Object key)

 Writable
MapWritable.get(Object key)

 Writable
MapFile.Reader.get(WritableComparable key,
    Writable val)

          Return the value for the named key, or null if none exists.

 Writable
BloomMapFile.Reader.get(WritableComparable key,
    Writable val)

          Fast version of the
 MapFile.Reader.get(WritableComparable, Writable) method.

 Writable
WritableFactory.newInstance()

          Return a new instance.

static Writable
WritableFactories.newInstance(Class<? extends Writable> c)

          Create a new instance of a class with a defined factory.

static Writable
WritableFactories.newInstance(Class<? extends Writable> c,
            Configuration conf)

          Create a new instance of a class with a defined factory.

 Writable
ArrayFile.Reader.next(Writable value)

          Read and return the next value in the file.

 Writable
SortedMapWritable.put(WritableComparable key,
    Writable value)

 Writable
MapWritable.put(Writable key,
    Writable value)

 Writable
SortedMapWritable.remove(Object key)

 Writable
MapWritable.remove(Object key)

Methods in org.apache.hadoop.io that return types with arguments of type Writable

 Set<Map.Entry<WritableComparable,Writable>>
SortedMapWritable.entrySet()

 Set<Map.Entry<Writable,Writable>>
MapWritable.entrySet()

 Set<Map.Entry<Writable,Writable>>
MapWritable.entrySet()

 SortedMap<WritableComparable,Writable>
SortedMapWritable.headMap(WritableComparable toKey)

 Set<Writable>
MapWritable.keySet()

 SortedMap<WritableComparable,Writable>
SortedMapWritable.subMap(WritableComparable fromKey,
       WritableComparable toKey)

 SortedMap<WritableComparable,Writable>
SortedMapWritable.tailMap(WritableComparable fromKey)

 Collection<Writable>
SortedMapWritable.values()

 Collection<Writable>
MapWritable.values()

Methods in org.apache.hadoop.io with parameters of type Writable

 void
ArrayFile.Writer.append(Writable value)

          Append a value to the file.

 void
MapFile.Writer.append(WritableComparable key,
       Writable val)

          Append a key/value pair to the map.

 void
BloomMapFile.Writer.append(WritableComparable key,
       Writable val)

 void
SequenceFile.Writer.append(Writable key,
       Writable val)

          Append a key/value pair.

static void
WritableUtils.cloneInto(Writable dst,
          Writable src)

          Deprecated. use ReflectionUtils.cloneInto instead.

protected  void
AbstractMapWritable.copy(Writable other)

          Used by child copy constructors.

 Writable
ArrayFile.Reader.get(long n,
    Writable value)

          Return the nth value in the file.

 Writable
MapFile.Reader.get(WritableComparable key,
    Writable val)

          Return the value for the named key, or null if none exists.

 Writable
BloomMapFile.Reader.get(WritableComparable key,
    Writable val)

          Fast version of the
 MapFile.Reader.get(WritableComparable, Writable) method.

 WritableComparable
MapFile.Reader.getClosest(WritableComparable key,
           Writable val)

          Finds the record that is the closest match to the specified key.

 WritableComparable
MapFile.Reader.getClosest(WritableComparable key,
           Writable val,
           boolean before)

          Finds the record that is the closest match to the specified key.

 void
SequenceFile.Reader.getCurrentValue(Writable val)

          Get the 'value' corresponding to the last read 'key'.

 boolean
SequenceFile.Reader.next(Writable key)

          Read the next key in the file into key, skipping its
 value.

 Writable
ArrayFile.Reader.next(Writable value)

          Read and return the next value in the file.

 boolean
MapFile.Reader.next(WritableComparable key,
     Writable val)

          Read the next key/value pair in the map into key and
 val.

 boolean
SequenceFile.Reader.next(Writable key,
     Writable val)

          Read the next key/value pair in the file into key and
 val.

 Writable
SortedMapWritable.put(WritableComparable key,
    Writable value)

 Writable
MapWritable.put(Writable key,
    Writable value)

 void
GenericWritable.set(Writable obj)

          Set the instance that is wrapped.

 void
ArrayWritable.set(Writable[] values)

 void
TwoDArrayWritable.set(Writable[][] values)

static byte[]
WritableUtils.toByteArray(Writable... writables)

          Convert writables to a byte array

Method parameters in org.apache.hadoop.io with type arguments of type Writable

static long
MapFile.fix(FileSystem fs,
    Path dir,
    Class<? extends Writable> keyClass,
    Class<? extends Writable> valueClass,
    boolean dryrun,
    Configuration conf)

          This method attempts to fix a corrupt MapFile by re-creating its index.

static long
MapFile.fix(FileSystem fs,
    Path dir,
    Class<? extends Writable> keyClass,
    Class<? extends Writable> valueClass,
    boolean dryrun,
    Configuration conf)

          This method attempts to fix a corrupt MapFile by re-creating its index.

static Writable
WritableFactories.newInstance(Class<? extends Writable> c)

          Create a new instance of a class with a defined factory.

static Writable
WritableFactories.newInstance(Class<? extends Writable> c,
            Configuration conf)

          Create a new instance of a class with a defined factory.

 void
MapWritable.putAll(Map<? extends Writable,? extends Writable> t)

 void
MapWritable.putAll(Map<? extends Writable,? extends Writable> t)

 void
SortedMapWritable.putAll(Map<? extends WritableComparable,? extends Writable> t)

Constructors in org.apache.hadoop.io with parameters of type Writable

ArrayWritable(Class<? extends Writable> valueClass,
              Writable[] values)

TwoDArrayWritable(Class valueClass,
                  Writable[][] values)

Constructor parameters in org.apache.hadoop.io with type arguments of type Writable

ArrayFile.Writer(Configuration conf,
                 FileSystem fs,
                 String file,
                 Class<? extends Writable> valClass)

          Create the named file for values of the named class.

ArrayFile.Writer(Configuration conf,
                 FileSystem fs,
                 String file,
                 Class<? extends Writable> valClass,
                 SequenceFile.CompressionType compress,
                 Progressable progress)

          Create the named file for values of the named class.

ArrayWritable(Class<? extends Writable> valueClass)

ArrayWritable(Class<? extends Writable> valueClass,
              Writable[] values)

BloomMapFile.Writer(Configuration conf,
                    FileSystem fs,
                    String dirName,
                    Class<? extends WritableComparable> keyClass,
                    Class<? extends Writable> valClass,
                    SequenceFile.CompressionType compress,
                    CompressionCodec codec,
                    Progressable progress)

Uses of Writable in org.apache.hadoop.io.serializer

Methods in org.apache.hadoop.io.serializer that return types with arguments of type Writable

 Deserializer<Writable>
WritableSerialization.getDeserializer(Class<Writable> c)

 Serializer<Writable>
WritableSerialization.getSerializer(Class<Writable> c)

Method parameters in org.apache.hadoop.io.serializer with type arguments of type Writable

 Deserializer<Writable>
WritableSerialization.getDeserializer(Class<Writable> c)

 Serializer<Writable>
WritableSerialization.getSerializer(Class<Writable> c)

Uses of Writable in org.apache.hadoop.ipc

Methods in org.apache.hadoop.ipc that return Writable

 Writable
RPC.Server.call(Class<?> protocol,
     Writable param,
     long receivedTime)

abstract  Writable
Server.call(Class<?> protocol,
     Writable param,
     long receiveTime)

          Called for each call.

 Writable[]
Client.call(Writable[] params,
     InetSocketAddress[] addresses)

          Deprecated. Use Client.call(Writable[], InetSocketAddress[], Class, UserGroupInformation) instead

 Writable[]
Client.call(Writable[] params,
     InetSocketAddress[] addresses,
     Class<?> protocol,
     UserGroupInformation ticket)

          Makes a set of calls in parallel.

 Writable
Client.call(Writable param,
     InetSocketAddress address)

          Deprecated. Use Client.call(Writable, InetSocketAddress, Class, UserGroupInformation) instead

 Writable
Client.call(Writable param,
     InetSocketAddress addr,
     Class<?> protocol,
     UserGroupInformation ticket)

          Make a call, passing param, to the IPC server running at
 address which is servicing the protocol protocol,
 with the ticket credentials, returning the value.

 Writable
Client.call(Writable param,
     InetSocketAddress addr,
     UserGroupInformation ticket)

          Deprecated. Use Client.call(Writable, InetSocketAddress, Class, UserGroupInformation) instead

 Writable
Server.call(Writable param,
     long receiveTime)

          Deprecated. Use Server.call(Class, Writable, long) instead

Methods in org.apache.hadoop.ipc with parameters of type Writable

 Writable
RPC.Server.call(Class<?> protocol,
     Writable param,
     long receivedTime)

abstract  Writable
Server.call(Class<?> protocol,
     Writable param,
     long receiveTime)

          Called for each call.

 Writable[]
Client.call(Writable[] params,
     InetSocketAddress[] addresses)

          Deprecated. Use Client.call(Writable[], InetSocketAddress[], Class, UserGroupInformation) instead

 Writable[]
Client.call(Writable[] params,
     InetSocketAddress[] addresses,
     Class<?> protocol,
     UserGroupInformation ticket)

          Makes a set of calls in parallel.

 Writable
Client.call(Writable param,
     InetSocketAddress address)

          Deprecated. Use Client.call(Writable, InetSocketAddress, Class, UserGroupInformation) instead

 Writable
Client.call(Writable param,
     InetSocketAddress addr,
     Class<?> protocol,
     UserGroupInformation ticket)

          Make a call, passing param, to the IPC server running at
 address which is servicing the protocol protocol,
 with the ticket credentials, returning the value.

 Writable
Client.call(Writable param,
     InetSocketAddress addr,
     UserGroupInformation ticket)

          Deprecated. Use Client.call(Writable, InetSocketAddress, Class, UserGroupInformation) instead

 Writable
Server.call(Writable param,
     long receiveTime)

          Deprecated. Use Server.call(Class, Writable, long) instead

Constructor parameters in org.apache.hadoop.ipc with type arguments of type Writable

Client(Class<? extends Writable> valueClass,
       Configuration conf)

          Construct an IPC client with the default SocketFactory

Client(Class<? extends Writable> valueClass,
       Configuration conf,
       SocketFactory factory)

          Construct an IPC client whose values are of the given Writable
 class.

Server(String bindAddress,
       int port,
       Class<? extends Writable> paramClass,
       int handlerCount,
       Configuration conf)

Server(String bindAddress,
       int port,
       Class<? extends Writable> paramClass,
       int handlerCount,
       Configuration conf,
       String serverName)

          Constructs a server listening on the named port and address.

Uses of Writable in org.apache.hadoop.mapred

Subinterfaces of Writable in org.apache.hadoop.mapred

 interface
InputSplit

          Deprecated. Use InputSplit instead.

Classes in org.apache.hadoop.mapred that implement Writable

 class
ClusterStatus

          Status information on the current state of the Map-Reduce cluster.

 class
Counters

          Deprecated. Use Counters instead.

static class
Counters.Counter

          Deprecated. A counter record, comprising its name and value.

static class
Counters.Group

          Deprecated. Group of counters, comprising of counters from a particular
  counter Enum class.

 class
FileSplit

          Deprecated. Use FileSplit
  instead.

 class
JobConf

          Deprecated. Use Configuration instead

 class
JobProfile

          A JobProfile is a MapReduce primitive.

 class
JobQueueInfo

          Class that contains the information regarding the Job Queues which are
 maintained by the Hadoop Map/Reduce framework.

 class
JobStatus

          Describes the current status of a job.

 class
MultiFileSplit

          Deprecated. Use CombineFileSplit instead

 class
TaskCompletionEvent

          This is used to track task completion events on
 job tracker.

 class
TaskReport

          A report on the state of a task.

 class
TaskStatus

          Describes the current status of a task.

 class
TaskTrackerStatus

          A TaskTrackerStatus is a MapReduce primitive.

static class
TaskTrackerStatus.ResourceStatus

          Class representing a collection of resources on this tasktracker.

Methods in org.apache.hadoop.mapred with type parameters of type Writable

static

<K extends WritableComparable,V extends Writable>

Writable

MapFileOutputFormat.getEntry(MapFile.Reader[] readers,
         Partitioner<K,V> partitioner,
         K key,
         V value)

          Get an entry from output generated by this class.

Methods in org.apache.hadoop.mapred that return Writable

static

<K extends WritableComparable,V extends Writable>

Writable

MapFileOutputFormat.getEntry(MapFile.Reader[] readers,
         Partitioner<K,V> partitioner,
         K key,
         V value)

          Get an entry from output generated by this class.

Methods in org.apache.hadoop.mapred that return types with arguments of type Writable

 RecordWriter<WritableComparable,Writable>
MapFileOutputFormat.getRecordWriter(FileSystem ignored,
                JobConf job,
                String name,
                Progressable progress)

static Class<? extends Writable>
SequenceFileAsBinaryOutputFormat.getSequenceFileOutputValueClass(JobConf conf)

          Get the value class for the SequenceFile

Uses of Writable in org.apache.hadoop.mapred.join

Classes in org.apache.hadoop.mapred.join with type parameters of type Writable

 class
ArrayListBackedIterator<X extends Writable>

          This class provides an implementation of ResetableIterator.

 interface
ComposableInputFormat<K extends WritableComparable,V extends Writable>

          Refinement of InputFormat requiring implementors to provide
 ComposableRecordReader instead of RecordReader.

 interface
ComposableRecordReader<K extends WritableComparable,V extends Writable>

          Additional operations required of a RecordReader to participate in a join.

 class
CompositeRecordReader<K extends WritableComparable,V extends Writable,X extends Writable>

          A RecordReader that can effect joins of RecordReaders sharing a common key
 type and partitioning.

 class
CompositeRecordReader<K extends WritableComparable,V extends Writable,X extends Writable>

          A RecordReader that can effect joins of RecordReaders sharing a common key
 type and partitioning.

 class
MultiFilterRecordReader<K extends WritableComparable,V extends Writable>

          Base class for Composite join returning values derived from multiple
 sources, but generally not tuples.

 class
OverrideRecordReader<K extends WritableComparable,V extends Writable>

          Prefer the "rightmost" data source for this key.

 interface
ResetableIterator<T extends Writable>

          This defines an interface to a stateful Iterator that can replay elements
 added to it directly.

static class
ResetableIterator.EMPTY<U extends Writable>

 class
StreamBackedIterator<X extends Writable>

          This class provides an implementation of ResetableIterator.

 class
WrappedRecordReader<K extends WritableComparable,U extends Writable>

          Proxy class for a RecordReader participating in the join framework.

Classes in org.apache.hadoop.mapred.join that implement Writable

 class
CompositeInputSplit

          This InputSplit contains a set of child InputSplits.

 class
TupleWritable

          Writable type storing multiple Writables.

Methods in org.apache.hadoop.mapred.join that return Writable

 Writable
TupleWritable.get(int i)

          Get ith Writable from Tuple.

Methods in org.apache.hadoop.mapred.join that return types with arguments of type Writable

 Iterator<Writable>
TupleWritable.iterator()

          Return an iterator over the elements in this tuple.

Constructors in org.apache.hadoop.mapred.join with parameters of type Writable

TupleWritable(Writable[] vals)

          Initialize tuple with storage; unknown whether any of them contain
 "written" values.

Uses of Writable in org.apache.hadoop.mapred.lib

Methods in org.apache.hadoop.mapred.lib that return types with arguments of type Writable

static Class<? extends Writable>
MultipleOutputs.getNamedOutputValueClass(JobConf conf,
                         String namedOutput)

          Deprecated. Returns the value class for a named output.

Uses of Writable in org.apache.hadoop.mapred.lib.aggregate

Classes in org.apache.hadoop.mapred.lib.aggregate with type parameters of type Writable

 class
ValueAggregatorCombiner<K1 extends WritableComparable,V1 extends Writable>

          This class implements the generic combiner of Aggregate.

 class
ValueAggregatorJobBase<K1 extends WritableComparable,V1 extends Writable>

          This abstract class implements some common functionalities of the
 the generic mapper, reducer and combiner classes of Aggregate.

 class
ValueAggregatorMapper<K1 extends WritableComparable,V1 extends Writable>

          This class implements the generic mapper of Aggregate.

 class
ValueAggregatorReducer<K1 extends WritableComparable,V1 extends Writable>

          This class implements the generic reducer of Aggregate.

Uses of Writable in org.apache.hadoop.mapreduce

Classes in org.apache.hadoop.mapreduce that implement Writable

 class
Counter

          A named counter that tracks the progress of a map/reduce job.

 class
CounterGroup

          A group of Counters that logically belong together.

 class
ID

          A general identifier, which internally stores the id
 as an integer.

 class
JobID

          JobID represents the immutable and unique identifier for
 the job.

 class
TaskAttemptID

          TaskAttemptID represents the immutable and unique identifier for
 a task attempt.

 class
TaskID

          TaskID represents the immutable and unique identifier for
 a Map or Reduce Task.

Uses of Writable in org.apache.hadoop.mapreduce.lib.db

Classes in org.apache.hadoop.mapreduce.lib.db that implement Writable

static class
DataDrivenDBInputFormat.DataDrivenDBInputSplit

          A InputSplit that spans a set of rows

static class
DBInputFormat.DBInputSplit

          A InputSplit that spans a set of rows

static class
DBInputFormat.NullDBWritable

          A Class that does nothing, implementing DBWritable

Uses of Writable in org.apache.hadoop.mapreduce.lib.input

Classes in org.apache.hadoop.mapreduce.lib.input that implement Writable

 class
CombineFileSplit

          A sub-collection of input files.

Uses of Writable in org.apache.hadoop.record

Classes in org.apache.hadoop.record that implement Writable

 class
Record

          Abstract class that is extended by generated classes.

Uses of Writable in org.apache.hadoop.record.meta

Classes in org.apache.hadoop.record.meta that implement Writable

 class
RecordTypeInfo

          A record's Type Information object which can read/write itself.

Uses of Writable in org.apache.hadoop.security

Classes in org.apache.hadoop.security that implement Writable

 class
UnixUserGroupInformation

          An implementation of UserGroupInformation in the Unix system

 class
UserGroupInformation

          A Writable abstract class for storing user and groups information.

Uses of Writable in org.apache.hadoop.streaming.io

Methods in org.apache.hadoop.streaming.io with parameters of type Writable

 void
RawBytesInputWriter.writeKey(Writable key)

 void
RawBytesInputWriter.writeValue(Writable value)

Uses of Writable in org.apache.hadoop.typedbytes

Classes in org.apache.hadoop.typedbytes that implement Writable

 class
TypedBytesWritable

          Writable for typed bytes.

Methods in org.apache.hadoop.typedbytes that return Writable

 Writable
TypedBytesWritableInput.read()

 Writable
TypedBytesWritableInput.readWritable()

 Writable
TypedBytesWritableInput.readWritable(Writable writable)

Methods in org.apache.hadoop.typedbytes that return types with arguments of type Writable

 Class<? extends Writable>
TypedBytesWritableInput.readType()

Methods in org.apache.hadoop.typedbytes with parameters of type Writable

 Writable
TypedBytesWritableInput.readWritable(Writable writable)

 void
TypedBytesWritableOutput.write(Writable w)

 void
TypedBytesWritableOutput.writeWritable(Writable w)

Uses of Writable in org.apache.hadoop.util

Methods in org.apache.hadoop.util with parameters of type Writable

static void
ReflectionUtils.cloneWritableInto(Writable dst,
                  Writable src)

          Deprecated.

Uses of Writable in org.apache.hadoop.util.bloom

Classes in org.apache.hadoop.util.bloom that implement Writable

 class
BloomFilter

          Implements a Bloom filter, as defined by Bloom in 1970.

 class
CountingBloomFilter

          Implements a counting Bloom filter, as defined by Fan et al.

 class
DynamicBloomFilter

          Implements a dynamic Bloom filter, as defined in the INFOCOM 2006 paper.

 class
Filter

          Defines the general behavior of a filter.

 class
Key

          The general behavior of a key that must be stored in a filter.

 class
RetouchedBloomFilter

          Implements a retouched Bloom filter, as defined in the CoNEXT 2006 paper.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2009 The Apache Software Foundation


text:
package main

import (
	"flag"
	"os"
	"os/signal"
	"syscall"
	"time"

	"go-common/app/job/main/credit/conf"
	"go-common/app/job/main/credit/http"
	"go-common/app/job/main/credit/service"
	"go-common/library/log"
)

var (
	srv *service.Service
)

func main() {
	flag.Parse()
	if err := conf.Init(); err != nil {
		log.Error("conf.Init() error(%v)", err)
		panic(err)
	}
	log.Init(conf.Conf.Xlog)
	defer log.Close()
	log.Info("credit-job start")
	http.Init(conf.Conf)
	signalHandler()
}

func signalHandler() {
	var ch = make(chan os.Signal, 1)
	signal.Notify(ch, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
	for {
		si := <-ch
		switch si {
		case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
			log.Info("get a signal %s, stop the consume process", si.String())
			srv.Close()
			time.Sleep(2 * time.Second)
			return
		case syscall.SIGHUP:
		default:
			return
		}
	}
}


text:
require 'statisk/commands/build'
require 'statisk/commands/clean'
require 'statisk/commands/deploy'
require 'statisk/commands/init'
require 'statisk/commands/new'
require 'statisk/commands/serve'

# module Statisk
#   module CLI

#     @usage = %Q{ Usage:
#     statisk serve \tbuild and serve your site
#     statisk init \tcreate a new site
#     statisk build \tbuild your site
#     statisk clean \tcleans your built site
#     statisk deploy \tdeploy your site

#  Create content:
#     statisk new:post \tcreate a new post
#     statisk new:page \tcreate a new page
#     statisk new:draft \tcreate a new draft

#  Options:
#     -v, --version \tshow the version
#     -h, --help \t\tshow this message
#     }

#     @banner = %Q{
#  statisk -- a stupidly simple, no-nonsense static site generator
#     }

#     def self.execute
#       @options = {}

#       opts = OptionParser.new do |opts|

#         opts.banner = @banner

#         opts.on('-p', '--prod', 'Set production settings') do
#           @options[:production] = true
#         end

#         opts.on('-v', '--version', 'Show the version of Statisk') do
#           puts "Statisk #{Statisk::VERSION}"
#           exit
#         end

#         opts.on('-h', '--help', 'Help') do
#           puts @banner
#           puts @usage
#           exit
#         end

#         opts.parse!
#       end

#       if ARGV.empty?
#         puts "\n you must specify a command\n"
#         puts @usage
#         exit
#       else
#         case ARGV.first
#         when 'init'
#           Statisk::CLI::Init.new
#         when 'serve'
#           puts 'serve'
#         when 'build'
#           puts 'build'
#         when 'clean'
#           puts 'clean'
#         when 'deploy'
#           puts 'deploy'
#         when 'new:post'
#           Statisk::CLI::NewPost.new
#         when 'new:page'
#           puts 'new page'
#         when 'new:draft'
#           puts 'new draft'
#         end
#       end
#     end
#   end
# end


text:
module Pos.Chain.Txp.Toil
       ( module           Pos.Chain.Txp.Toil.Failure
       , module           Pos.Chain.Txp.Toil.Logic
       , module           Pos.Chain.Txp.Toil.Monad
       , module           Pos.Chain.Txp.Toil.Types
       , module           Pos.Chain.Txp.Toil.Utxo
       ) where

import           Pos.Chain.Txp.Toil.Failure
import           Pos.Chain.Txp.Toil.Logic
import           Pos.Chain.Txp.Toil.Monad
import           Pos.Chain.Txp.Toil.Types
import           Pos.Chain.Txp.Toil.Utxo


text:
package org.locationtech.geowave.analytic.mapreduce.operations.options;

import org.junit.Assert;
import org.junit.Test;
import org.locationtech.geowave.analytic.PropertyManagement;
import org.locationtech.geowave.analytic.param.GlobalParameters;

public class PropertyManagementConverterTest {

  @Test
  public void testConverter() throws Exception {
    final PropertyManagement propMgmt = new PropertyManagement();
    final PropertyManagementConverter conv = new PropertyManagementConverter(propMgmt);

    final DBScanOptions opts = new DBScanOptions();
    opts.setGlobalBatchId("some-value");

    conv.readProperties(opts);

    Assert.assertEquals("some-value", propMgmt.getProperty(GlobalParameters.Global.BATCH_ID));
  }
}


text:
package org.apache.geode.management.internal.cli.commands;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;

import java.util.HashMap;
import java.util.Map;

import javax.management.ObjectName;

import org.junit.Test;
import org.mockito.Mockito;

import org.apache.geode.management.DistributedSystemMXBean;

public class DiskStoreCommandsUtilsTest {
  private final String memberName = "memberONe";
  private final String diskStoreName = "diskStoreOne";

  @Test
  public void diskStoreBeanAndMemberBeanDiskStoreExists() throws Exception {
    Map<String, String[]> memberDiskStore = new HashMap<>();
    memberDiskStore.put(memberName, new String[] {diskStoreName});
    ObjectName objectName = new ObjectName("");

    DistributedSystemMXBean distributedSystemMXBean = Mockito.mock(DistributedSystemMXBean.class);
    doReturn(memberDiskStore).when(distributedSystemMXBean).listMemberDiskstore();
    doReturn(objectName).when(distributedSystemMXBean).fetchDiskStoreObjectName(any(), any());

    assertThat(
        DiskStoreCommandsUtils.diskStoreBeanAndMemberBeanDiskStoreExists(distributedSystemMXBean,
            memberName, diskStoreName)).isTrue();
  }

  @Test
  public void diskStoreBeanExistsAndMemberDiskStoreNotFound() throws Exception {
    Map<String, String[]> memberDiskStore = new HashMap<>();
    memberDiskStore.put(memberName, new String[] {});
    ObjectName objectName = new ObjectName("");

    DistributedSystemMXBean distributedSystemMXBean = Mockito.mock(DistributedSystemMXBean.class);
    doReturn(memberDiskStore).when(distributedSystemMXBean).listMemberDiskstore();
    doReturn(objectName).when(distributedSystemMXBean).fetchDiskStoreObjectName(any(), any());

    assertThat(
        DiskStoreCommandsUtils.diskStoreBeanAndMemberBeanDiskStoreExists(distributedSystemMXBean,
            memberName, diskStoreName)).isFalse();
  }

  @Test
  public void diskStoreBeanNotFoundAndMemberDiskStoreExists() throws Exception {
    Map<String, String[]> memberDiskStore = new HashMap<>();
    memberDiskStore.put(memberName, new String[] {diskStoreName});

    DistributedSystemMXBean distributedSystemMXBean = Mockito.mock(DistributedSystemMXBean.class);
    doReturn(memberDiskStore).when(distributedSystemMXBean).listMemberDiskstore();
    doThrow(new Exception("not found")).when(distributedSystemMXBean)
        .fetchDiskStoreObjectName(any(), any());

    assertThat(
        DiskStoreCommandsUtils.diskStoreBeanAndMemberBeanDiskStoreExists(distributedSystemMXBean,
            memberName, diskStoreName)).isFalse();
  }

  @Test
  public void diskStoreBeanExistsMemberDiskStoreIsNull() throws Exception {
    ObjectName objectName = new ObjectName("");

    DistributedSystemMXBean distributedSystemMXBean = Mockito.mock(DistributedSystemMXBean.class);
    doReturn(null).when(distributedSystemMXBean).listMemberDiskstore();
    doReturn(objectName).when(distributedSystemMXBean).fetchDiskStoreObjectName(any(), any());

    assertThat(
        DiskStoreCommandsUtils.diskStoreBeanAndMemberBeanDiskStoreExists(distributedSystemMXBean,
            memberName, diskStoreName)).isFalse();
  }

  @Test
  public void diskStoreBeanExistsMemberDiskStoreContainsNullArray() throws Exception {
    Map<String, String[]> memberDiskStore = new HashMap<>();
    memberDiskStore.put(memberName, null);
    ObjectName objectName = new ObjectName("");

    DistributedSystemMXBean distributedSystemMXBean = Mockito.mock(DistributedSystemMXBean.class);
    doReturn(memberDiskStore).when(distributedSystemMXBean).listMemberDiskstore();
    doReturn(objectName).when(distributedSystemMXBean).fetchDiskStoreObjectName(any(), any());

    assertThat(
        DiskStoreCommandsUtils.diskStoreBeanAndMemberBeanDiskStoreExists(distributedSystemMXBean,
            memberName, diskStoreName)).isFalse();
  }

  @Test
  public void diskStoreBeanExistsMemberDiskStoreNamesHasNullValues() throws Exception {
    Map<String, String[]> memberDiskStore = new HashMap<>();
    memberDiskStore.put(memberName, new String[] {null, null});
    ObjectName objectName = new ObjectName("");

    DistributedSystemMXBean distributedSystemMXBean = Mockito.mock(DistributedSystemMXBean.class);
    doReturn(memberDiskStore).when(distributedSystemMXBean).listMemberDiskstore();
    doReturn(objectName).when(distributedSystemMXBean).fetchDiskStoreObjectName(any(), any());

    assertThat(
        DiskStoreCommandsUtils.diskStoreBeanAndMemberBeanDiskStoreExists(distributedSystemMXBean,
            memberName, diskStoreName)).isFalse();
  }
}


text:
namespace r {

pipeline::pipeline()
    : m_scale(1.0f, 1.0f, 1.0f)
    , m_time(0.0f)
    , m_delta(0.0f)
{
    m_rotate = m::mat4::rotate(m::vec3::origin);
}

void pipeline::setScale(const m::vec3 &scale) {
    m_scale = scale;
}

void pipeline::setWorld(const m::vec3 &world) {
    m_world = world;
}

void pipeline::setRotate(const m::mat4 &rotate) {
    m_rotate = rotate;
}

void pipeline::setRotation(const m::quat &rotation) {
    m_rotation = rotation;
}

void pipeline::setPosition(const m::vec3 &position) {
    m_position = position;
}

void pipeline::setPerspective(const m::perspective &p) {
    m_perspective = p;
}

void pipeline::setTime(float time) {
    m_time = time;
}

void pipeline::setDelta(float delta) {
    m_delta = delta;
}

const m::mat4 pipeline::world() const {
    return m::mat4::translate(m_world) * m_rotate * m::mat4::scale(m_scale);
}

const m::mat4 pipeline::view() const {
    m::vec3 target, up;
    m_rotation.getOrient(&target, &up, nullptr);
    return m::mat4::lookat(target, up) * m::mat4::translate(-m_position);
}

const m::mat4 pipeline::projection() const {
    return m::mat4::project(m_perspective);
}

const m::perspective &pipeline::perspective() const {
    return m_perspective;
}

const m::vec3 &pipeline::position() const {
    return m_position;
}

const m::quat &pipeline::rotation() const {
    return m_rotation;
}

float pipeline::time() const {
    return m_time;
}

float pipeline::delta() const {
    return m_delta;
}

}


text:
'use strict';
const path = require('path');
const test = require('tap').test;
const execa = require('execa');
const arrify = require('arrify');

const cwd = path.join(__dirname, '..');
const profileScript = path.join(cwd, 'profile.js');
const fixtureDir = path.join(cwd, 'test/fixture');

function fixture(file) {
	// Add .js extension
	file = /\.[a-z]{1,6}$/.test(file) ? file : `${file}.js`;
	return path.relative(cwd, path.join(fixtureDir, file));
}

function run(files) {
	return execa(process.execPath, [profileScript].concat(arrify(files).map(x => fixture(x))), {cwd});
}

test('runs the profiler and throws an error when invoked without files to run', t => {
	t.plan(1);
	run()
		.catch(err => {
			t.ok(/Specify a test file/.test(err.stderr));
			t.end();
		});
});

test('exits normally when tests pass', t => {
	t.plan(1);
	run('es2015')
		.catch(err => {
			t.fail(err);
		})
		.then(() => {
			t.pass();
			t.end();
		});
});

test('exits with a non-zero exit code when one test fails', t => {
	t.plan(1);
	run('one-pass-one-fail')
		.then(() => {
			t.fail();
		})
		.catch(err => {
			t.true(Boolean(err.code));
			t.end();
		});
});

test('exits with a non-zero exit code when there is an uncaught exception', t => {
	t.plan(1);
	run('uncaught-exception')
		.then(() => {
			t.fail();
		})
		.catch(err => {
			t.true(Boolean(err.code));
			t.end();
		});
});


text:
package org.servicelayer.models;

public class TypeNamePredomain {
	private String name;
	private int id;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	//planets, materials, Pins(?), Schematics(?)
}


text:
import Cycle from '@cycle/xstream-run';
import {Stream} from 'xstream';
import {div, button, h1, h4, a, makeDOMDriver} from '@cycle/dom';
import {makeHTTPDriver, Response} from '@cycle/http';
import {DOMSource} from '@cycle/dom/xstream-typings';
import {HTTPSource} from '@cycle/http/xstream-typings';

interface UserData {
  id: number,
  name: string,
  username: string,
  email: string,
  address: {
    street: string,
    suite: string,
    city: string,
    zipcode: string,
    geo: {
      lat: string,
      lng: string,
    }
  },
  phone: string,
  website: string,
  company: {
    name: string,
    catchPhrase: string,
    bs: string,
  }
}

function main(sources: {DOM: DOMSource, HTTP: HTTPSource}) {
  const getRandomUser$ = sources.DOM.select('.get-random').events('click')
    .map(() => {
      const randomNum = Math.round(Math.random() * 9) + 1;
      return {
        url: 'http://jsonplaceholder.typicode.com/users/' + String(randomNum),
        category: 'users',
        method: 'GET'
      };
    });

  const user$ = sources.HTTP.select('users')
    .flatten()
    .map(res => res.body)
    .startWith(null)
    .compose(s => <Stream<UserData>> s);

  const vtree$ = user$.map(user =>
    div('.users', [
      button('.get-random', 'Get random user'),
      user === null ? null : div('.user-details', [
        h1('.user-name', user.name),
        h4('.user-email', user.email),
        a('.user-website', {attrs: {href: user.website}}, user.website)
      ])
    ])
  );

  return {
    DOM: vtree$,
    HTTP: getRandomUser$
  };
}

Cycle.run(main, {
  DOM: makeDOMDriver('#main-container'),
  HTTP: makeHTTPDriver()
});


text:
package auth

import (
	"github.com/MG-RAST/Shock/shock-server/conf"
	"github.com/MG-RAST/Shock/shock-server/user"
	"sync"
	"time"
)

type cache struct {
	sync.RWMutex
	m map[string]cacheValue
}

type cacheValue struct {
	expires time.Time
	user    *user.User
}

func (c *cache) lookup(header string) *user.User {
	v, ok := c.get(header)
	if ok {
		if time.Now().Before(v.expires) {
			return v.user
		} else {
			c.delete(header)
		}
	}
	return nil
}

func (c *cache) get(header string) (v cacheValue, ok bool) {
	c.RLock()
	defer c.RUnlock()
	v, ok = c.m[header]
	return
}

func (c *cache) delete(header string) {
	c.Lock()
	defer c.Unlock()
	delete(c.m, header)
	return
}

func (c *cache) add(header string, u *user.User) {
	c.Lock()
	defer c.Unlock()
	c.m[header] = cacheValue{
		expires: time.Now().Add(time.Duration(conf.AUTH_CACHE_TIMEOUT) * time.Minute),
		user:    u,
	}
	return
}


text:
/*
 * GET home page.
 */

exports.index = function(req, res){
  res.render('index', { title: 'Internegocios' })
};


text:
// SMSLib for Java v3
// A Java API library for sending and receiving SMS via a GSM modem
// or other supported gateways.
// Web Site: http://www.smslib.org
//
// Copyright (C) 2002-2012, Thanasis Delenikas, Athens/GREECE.
// SMSLib is distributed under the terms of the Apache License version 2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.smslib;

import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import org.smslib.crypto.KeyManager;

/**
 * Class representing an outbound encrypted message.
 */
public class OutboundEncryptedMessage extends OutboundBinaryMessage {
	private static final long serialVersionUID = 2L;

	public OutboundEncryptedMessage(String myRecipient, byte[] dataBytes)
			throws SMSLibException, InvalidKeyException,
			IllegalBlockSizeException, BadPaddingException,
			NoSuchPaddingException, NoSuchAlgorithmException {
		setRecipient(myRecipient);
		KeyManager km = KeyManager.getInstance();
		setDataBytes(km.encrypt(myRecipient, dataBytes));
	}
}


text:
import time  # noqa
import uuid  # noqa
from datetime import datetime, timedelta
from random import random  # noqa
from typing import Any, Optional

import dateutil  # noqa
from pendulum import DateTime

from airflow.macros import hive  # noqa

def ds_add(ds: str, days: int) -> str:
    """
    Add or subtract days from a YYYY-MM-DD

    :param ds: anchor date in ``YYYY-MM-DD`` format to add to
    :param days: number of days to add to the ds, you can use negative values

    >>> ds_add('2015-01-01', 5)
    '2015-01-06'
    >>> ds_add('2015-01-06', -5)
    '2015-01-01'
    """
    if not days:
        return str(ds)
    dt = datetime.strptime(str(ds), "%Y-%m-%d") + timedelta(days=days)
    return dt.strftime("%Y-%m-%d")

def ds_format(ds: str, input_format: str, output_format: str) -> str:
    """
    Takes an input string and outputs another string
    as specified in the output format

    :param ds: input string which contains a date
    :param input_format: input string format. E.g. %Y-%m-%d
    :param output_format: output string format  E.g. %Y-%m-%d

    >>> ds_format('2015-01-01', "%Y-%m-%d", "%m-%d-%y")
    '01-01-15'
    >>> ds_format('1/5/2015', "%m/%d/%Y",  "%Y-%m-%d")
    '2015-01-05'
    """
    return datetime.strptime(str(ds), input_format).strftime(output_format)

def datetime_diff_for_humans(dt: Any, since: Optional[DateTime] = None) -> str:
    """
    Return a human-readable/approximate difference between two datetimes, or
    one and now.

    :param dt: The datetime to display the diff for
    :param since: When to display the date from. If ``None`` then the diff is
        between ``dt`` and now.
    :rtype: str
    """
    import pendulum

    return pendulum.instance(dt).diff_for_humans(since)


text:
import { Component } from '@angular/core';
import { NgClass, NgStyle} from '@angular/common';
import { FileUploader, FileDropDirective, FileSelectDirective} from 'ng2-file-upload/ng2-file-upload';
import { Http, Response, URLSearchParams, Headers, RequestOptions } from '@angular/http';
import { Constants, NotifyService,OrgUnitService } from '../shared';

@Component({
  selector: 'file-upload',
  templateUrl: './fileupload.component.html',
  providers: [ OrgUnitService, NotifyService ]
})
export class FileUploadComponent {

  //public uploader:FileUploader = new FileUploader({url: ''});;
  public hasBaseDropZoneOver:boolean = false;
  public hasAnotherDropZoneOver:boolean = false;
  private DHIS2URL: string;
  private importedData: any[] = [];

  constructor(
      private constant: Constants,
      private http: Http
      ){
      this.DHIS2URL = this.constant.ROOTURL;
      //this.uploader = new FileUploader({url: this.DHIS2URL});
  }
  public fileOverBase(e:any):void {
    this.hasBaseDropZoneOver = e;
  }

  public fileOverAnother(e:any):void {
    this.hasAnotherDropZoneOver = e;
  }
  getFile(event){
      this.importedData = this.getUploadedFile(event);

  }
  getUploadedFile(event) {
        let textData = [];
        let files = event.srcElement.files;
        if(files[0].name.includes(".csv"))
        {
           let input = event.target;
           let reader = new FileReader();

           reader.onload = function(){
             let csvData = reader.result;
             let allTextLines = csvData.split(/\r\n|\n/);
             let headers = allTextLines[0].split(',');
             let lines:any  = [];

             for (let i = 0; i < allTextLines.length; i++) {
              // split content based on comma
              let data = allTextLines[i].split(',');
              if (data.length == headers.length) {
                let tarr = [];
                for (let j = 0; j < headers.length; j++) {
                  tarr.push(data[j]);
                }
                lines.push(tarr);
              }

            }
            textData = lines;
          };

          reader.readAsText(input.files[0]);
          //this.http.post("localhost:5000/setData", text)
      }
      return textData;
    }

}


text:
#include "ThinClientPoolHADM.hpp"

#include <geode/SystemProperties.hpp>

#include "ExpiryHandler_T.hpp"
#include "TcrConnectionManager.hpp"
#include "util/exception.hpp"

namespace apache {
namespace geode {
namespace client {
const char* ThinClientPoolHADM::NC_Redundancy = "NC Redundancy";
ThinClientPoolHADM::ThinClientPoolHADM(const char* name,
                                       std::shared_ptr<PoolAttributes> poolAttr,
                                       TcrConnectionManager& connManager)
    : ThinClientPoolDM(name, poolAttr, connManager),
      m_theTcrConnManager(connManager),
      m_redundancySema(0),
      m_redundancyTask(nullptr),
      m_servermonitorTaskId(-1) {
  m_redundancyManager = std::unique_ptr<ThinClientRedundancyManager>(
      new ThinClientRedundancyManager(
          &connManager, poolAttr->getSubscriptionRedundancy(), this));
}

void ThinClientPoolHADM::init() {
  // Pool DM should only be inited once.
  ThinClientPoolDM::init();

  startBackgroundThreads();
}

void ThinClientPoolHADM::startBackgroundThreads() {
  auto& props = m_connManager.getCacheImpl()
                    ->getDistributedSystem()
                    .getSystemProperties();

  m_redundancyManager->initialize(m_attrs->getSubscriptionRedundancy());
  //  Call maintain redundancy level, so primary is available for notification
  //  operations.
  GfErrType err = m_redundancyManager->maintainRedundancyLevel(true);

  ACE_Event_Handler* redundancyChecker =
      new ExpiryHandler_T<ThinClientPoolHADM>(
          this, &ThinClientPoolHADM::checkRedundancy);
  const auto redundancyMonitorInterval = props.redundancyMonitorInterval();

  m_servermonitorTaskId =
      m_connManager.getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask(
          redundancyChecker, std::chrono::seconds(1), redundancyMonitorInterval,
          false);
  LOGFINE(
      "ThinClientPoolHADM::ThinClientPoolHADM Registered server "
      "monitor task with id = %ld, interval = %ld",
      m_servermonitorTaskId, redundancyMonitorInterval.count());

  if (ThinClientBaseDM::isFatalClientError(err)) {
    if (err == GF_CACHE_LOCATOR_EXCEPTION) {
      LOGWARN(
          "No locators were available during pool initialization with "
          "subscription redundancy.");
    } else {
      throwExceptionIfError("ThinClientPoolHADM::init", err);
    }
  }

  m_redundancyManager->startPeriodicAck();
  m_redundancyTask =
      std::unique_ptr<Task<ThinClientPoolHADM>>(new Task<ThinClientPoolHADM>(
          this, &ThinClientPoolHADM::redundancy, NC_Redundancy));
  m_redundancyTask->start();
}

GfErrType ThinClientPoolHADM::sendSyncRequest(TcrMessage& request,
                                              TcrMessageReply& reply,
                                              bool attemptFailover,
                                              bool isBGThread) {
  GfErrType err = GF_NOERR;

  int32_t type = request.getMessageType();

  if ((type == TcrMessage::EXECUTECQ_MSG_TYPE ||
       type == TcrMessage::STOPCQ_MSG_TYPE ||
       type == TcrMessage::CLOSECQ_MSG_TYPE ||
       type == TcrMessage::CLOSECLIENTCQS_MSG_TYPE ||
       type == TcrMessage::GETCQSTATS_MSG_TYPE ||
       type == TcrMessage::MONITORCQ_MSG_TYPE ||
       type == TcrMessage::EXECUTECQ_WITH_IR_MSG_TYPE ||
       type == TcrMessage::GETDURABLECQS_MSG_TYPE)) {
    if (m_destroyPending) return GF_NOERR;
    reply.setDM(this);
    err = sendSyncRequestCq(request, reply);
  } else {
    err = ThinClientPoolDM::sendSyncRequest(request, reply, attemptFailover,
                                            isBGThread);
  }
  return err;
}

bool ThinClientPoolHADM::registerInterestForHARegion(
    TcrEndpoint* ep, const TcrMessage* request, ThinClientHARegion& region) {
  return (region.registerKeys(ep, request) == GF_NOERR);
}

GfErrType ThinClientPoolHADM::sendSyncRequestRegisterInterestEP(
    TcrMessage& request, TcrMessageReply& reply, bool attemptFailover,
    TcrEndpoint* endpoint) {
  return ThinClientBaseDM::sendSyncRequestRegisterInterest(
      request, reply, attemptFailover, nullptr, endpoint);
}

GfErrType ThinClientPoolHADM::sendSyncRequestRegisterInterest(
    TcrMessage& request, TcrMessageReply& reply, bool attemptFailover,
    ThinClientRegion* region, TcrEndpoint* endpoint) {
  return m_redundancyManager->sendSyncRequestRegisterInterest(
      request, reply, attemptFailover, endpoint, this, region);
}

GfErrType ThinClientPoolHADM::sendSyncRequestCq(TcrMessage& request,
                                                TcrMessageReply& reply) {
  return m_redundancyManager->sendSyncRequestCq(request, reply, this);
}

bool ThinClientPoolHADM::preFailoverAction() { return true; }

bool ThinClientPoolHADM::postFailoverAction(TcrEndpoint*) {
  m_connManager.triggerRedundancyThread();
  return true;
}

void ThinClientPoolHADM::redundancy(std::atomic<bool>& isRunning) {
  LOGFINE("ThinClientPoolHADM: Starting maintain redundancy thread.");
  while (isRunning) {
    m_redundancySema.acquire();
    if (isRunning && !m_connManager.isNetDown()) {
      m_redundancyManager->maintainRedundancyLevel();
      while (m_redundancySema.tryacquire() != -1) {
        ;
      }
    }
  }
  LOGFINE("ThinClientPoolHADM: Ending maintain redundancy thread.");
}

int ThinClientPoolHADM::checkRedundancy(const ACE_Time_Value&, const void*) {
  m_redundancySema.release();
  return 0;
}

void ThinClientPoolHADM::destroy(bool keepAlive) {
  LOGDEBUG("ThinClientPoolHADM::destroy");
  if (!m_isDestroyed && !m_destroyPending) {
    checkRegions();

    if (m_remoteQueryServicePtr != nullptr) {
      m_remoteQueryServicePtr->close();
      m_remoteQueryServicePtr = nullptr;
    }

    stopPingThread();

    sendNotificationCloseMsgs();

    m_redundancyManager->close();

    m_destroyPendingHADM = true;
    ThinClientPoolDM::destroy(keepAlive);
  }
}

void ThinClientPoolHADM::sendNotificationCloseMsgs() {
  if (m_redundancyTask) {
    if (m_servermonitorTaskId >= 0) {
      m_connManager.getCacheImpl()->getExpiryTaskManager().cancelTask(
          m_servermonitorTaskId);
    }
    m_redundancyTask->stopNoblock();
    m_redundancySema.release();
    m_redundancyTask->wait();
    m_redundancyTask = nullptr;
    m_redundancyManager->sendNotificationCloseMsgs();
  }
}

GfErrType ThinClientPoolHADM::registerInterestAllRegions(
    TcrEndpoint* ep, const TcrMessage* request, TcrMessageReply* reply) {
  GfErrType err = GF_NOERR;
  GfErrType opErr = GF_NOERR;

  std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
  for (std::list<ThinClientRegion*>::iterator itr = m_regions.begin();
       itr != m_regions.end(); itr++) {
    if ((opErr = (*itr)->registerKeys(ep, request, reply)) != GF_NOERR) {
      if (err == GF_NOERR) {
        err = opErr;
      }
    }
  }
  return err;
}

bool ThinClientPoolHADM::checkDupAndAdd(std::shared_ptr<EventId> eventid) {
  return m_redundancyManager->checkDupAndAdd(eventid);
}

void ThinClientPoolHADM::processMarker() {
  // also set the static bool m_processedMarker for makePrimary messages
  m_redundancyManager->m_globalProcessedMarker = true;
}

void ThinClientPoolHADM::acquireRedundancyLock() {
  m_redundancyManager->acquireRedundancyLock();
}

void ThinClientPoolHADM::releaseRedundancyLock() {
  m_redundancyManager->releaseRedundancyLock();
}

std::recursive_mutex& ThinClientPoolHADM::getRedundancyLock() {
  return m_redundancyManager->getRedundancyLock();
}

GfErrType ThinClientPoolHADM::sendRequestToPrimary(TcrMessage& request,
                                                   TcrMessageReply& reply) {
  return m_redundancyManager->sendRequestToPrimary(request, reply);
}

bool ThinClientPoolHADM::isReadyForEvent() const {
  return m_redundancyManager->isSentReadyForEvents();
}

void ThinClientPoolHADM::addRegion(ThinClientRegion* theTCR) {
  std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
  m_regions.push_back(theTCR);
}
void ThinClientPoolHADM::addDisMessToQueue(ThinClientRegion* theTCR) {
  std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
  if (m_redundancyManager->allEndPointDiscon()) {
    theTCR->receiveNotification(TcrMessage::getAllEPDisMess());
  }
}
void ThinClientPoolHADM::removeRegion(ThinClientRegion* theTCR) {
  std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
  for (std::list<ThinClientRegion*>::iterator itr = m_regions.begin();
       itr != m_regions.end(); itr++) {
    if (*itr == theTCR) {
      m_regions.erase(itr);
      return;
    }
  }
}

void ThinClientPoolHADM::readyForEvents() {
  auto& sysProp = m_connManager.getCacheImpl()
                      ->getDistributedSystem()
                      .getSystemProperties();
  if (!sysProp.autoReadyForEvents()) {
    init();
  }

  auto&& durable = sysProp.durableClientId();
  if (!durable.empty()) {
    m_redundancyManager->readyForEvents();
  }
}

void ThinClientPoolHADM::netDown() {
  ThinClientPoolDM::netDown();

  {
    std::lock_guard<decltype(m_endpointsLock)> guard(m_endpointsLock);
    for (auto&& currItr : m_endpoints) {
      currItr.second->setConnectionStatus(false);
    }
  }

  m_redundancyManager->netDown();
}

void ThinClientPoolHADM::pingServerLocal() {
  auto& mutex = m_redundancyManager->getRedundancyLock();
  std::lock_guard<decltype(mutex)> guard(mutex);
  ThinClientPoolDM::pingServerLocal();
}

void ThinClientPoolHADM::removeCallbackConnection(TcrEndpoint* ep) {
  m_redundancyManager->removeCallbackConnection(ep);
}

void ThinClientPoolHADM::sendNotConMesToAllregions() {
  std::lock_guard<decltype(m_regionsLock)> guard(m_regionsLock);
  for (std::list<ThinClientRegion*>::iterator it = m_regions.begin();
       it != m_regions.end(); it++) {
    (*it)->receiveNotification(TcrMessage::getAllEPDisMess());
  }
}

std::shared_ptr<TcrEndpoint> ThinClientPoolHADM::createEP(
    const char* endpointName) {
  return std::make_shared<TcrPoolEndPoint>(
      endpointName, m_connManager.getCacheImpl(), m_connManager.m_failoverSema,
      m_connManager.m_cleanupSema, m_redundancySema, this);
}

}  // namespace client
}  // namespace geode
}  // namespace apache


text:
namespace net
{
  class CException : public core::CException
  {
    using core::CException::CException;

    public:
    CException(const char* file, int line) : core::CException("", file, line)
    {
      CError err;
      std::stringstream ss;
      ss << err;
      mMessage = ss.str();
    }
  };
}

#endif // __cexception_hpp__


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01.MathExpression
{
    class MathExpression
    {
        static void Main(string[] args)
        {
            double n = double.Parse(Console.ReadLine());
            double m = double.Parse(Console.ReadLine());
            double p = double.Parse(Console.ReadLine());

            double mod = (int)m % 180;
            double result = (((n * n) + (1 / (m * p)) + 1337) / (n - (p * 128.523123123))) + Math.Sin(mod);
            Console.WriteLine("{0:0.000000}", result);
        }
    }
}


text:
using Castle.Windsor;

namespace TestUnium.Sessioning
{
    public interface ISessionContext
    {
        IWindsorContainer Container { get; set; }
    }
}


text:
<!doctype html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>BOS Merchant</title>
  <link href='http://fonts.googleapis.com/css?family=Titillium+Web:200,300' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
  <link rel="icon" type="image/png" href="img/logo.png">
  <link rel="stylesheet" type="test/css" href="css/bos.css">
  <link rel="stylesheet" type="test/css" href="css/bootstrap.min.css">

        <form class="form-inline">

              Merchant Bitcoin Address

Paste

              <input type="text" class="form-control input-size" ng-model="saleAmount" placeholder="Bitcoin Address">

Sale

</form>

      <qr class="qr" text="saleQr()" type-number="typeNumber" correction-level="correctionLevel" size="size" input-mode="inputMode" image="image"></qr>