text:
package org.apache.flink.test.checkpointing;

import org.apache.flink.api.common.JobID;
import org.apache.flink.api.common.restartstrategy.RestartStrategies;
import org.apache.flink.api.common.state.ListState;
import org.apache.flink.api.common.state.ListStateDescriptor;
import org.apache.flink.configuration.ReadableConfig;
import org.apache.flink.core.fs.CloseableRegistry;
import org.apache.flink.runtime.checkpoint.CheckpointFailureManager;
import org.apache.flink.runtime.checkpoint.CheckpointOptions;
import org.apache.flink.runtime.client.JobExecutionException;
import org.apache.flink.runtime.execution.Environment;
import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.runtime.state.CheckpointMetadataOutputStream;
import org.apache.flink.runtime.state.CheckpointStorage;
import org.apache.flink.runtime.state.CheckpointStorageAccess;
import org.apache.flink.runtime.state.CheckpointStorageLocation;
import org.apache.flink.runtime.state.CheckpointStreamFactory;
import org.apache.flink.runtime.state.CompletedCheckpointStorageLocation;
import org.apache.flink.runtime.state.DefaultOperatorStateBackend;
import org.apache.flink.runtime.state.DefaultOperatorStateBackendBuilder;
import org.apache.flink.runtime.state.FunctionInitializationContext;
import org.apache.flink.runtime.state.FunctionSnapshotContext;
import org.apache.flink.runtime.state.OperatorStateBackend;
import org.apache.flink.runtime.state.OperatorStateHandle;
import org.apache.flink.runtime.state.SnapshotExecutionType;
import org.apache.flink.runtime.state.SnapshotResources;
import org.apache.flink.runtime.state.SnapshotStrategy;
import org.apache.flink.runtime.state.SnapshotStrategyRunner;
import org.apache.flink.runtime.state.TestingCheckpointStorageAccessCoordinatorView;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
import org.apache.flink.runtime.state.memory.NonPersistentMetadataCheckpointStorageLocation;
import org.apache.flink.runtime.state.testutils.TestCompletedCheckpointStorageLocation;
import org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration;
import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.sink.DiscardingSink;
import org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction;
import org.apache.flink.streaming.api.graph.StreamingJobGraphGenerator;
import org.apache.flink.test.util.MiniClusterWithClientResource;
import org.apache.flink.test.util.TestUtils;
import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.util.FlinkRuntimeException;
import org.apache.flink.util.TestLogger;

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

import javax.annotation.Nonnull;

import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;

import static org.apache.flink.runtime.checkpoint.CheckpointFailureManager.EXCEEDED_CHECKPOINT_TOLERABLE_FAILURE_MESSAGE;
import static org.junit.Assert.fail;

/** Tests to verify end-to-end logic of checkpoint failure manager. */
public class CheckpointFailureManagerITCase extends TestLogger {

    /**
     * Test that checkpoint finalization failure is counted by {@link CheckpointFailureManager} and
     * eventually fails the job. In this test, finalization is failed by throwing an exception from
     * {@link org.apache.flink.runtime.state.CheckpointStorageLocation#createMetadataOutputStream}
     * which should fail the job.
     */
    @Test
    public void testFinalizationFailureCounted() throws Exception {
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.enableCheckpointing(10);
        env.getCheckpointConfig().setCheckpointStorage(new FailingFinalizationCheckpointStorage());
        env.getCheckpointConfig().setTolerableCheckpointFailureNumber(0);
        env.setRestartStrategy(RestartStrategies.noRestart());
        env.fromSequence(Long.MIN_VALUE, Long.MAX_VALUE).addSink(new DiscardingSink<>());
        JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(env.getStreamGraph());
        try {
            TestUtils.submitJobAndWaitForResult(
                    cluster.getClusterClient(), jobGraph, getClass().getClassLoader());
            fail("The job should fail");
        } catch (JobExecutionException jobException) {
            if (!isCheckpointFailure(jobException)) {
                throw jobException;
            }
        }
    }

    @ClassRule
    public static MiniClusterWithClientResource cluster =
            new MiniClusterWithClientResource(
                    new MiniClusterResourceConfiguration.Builder().build());

    @Test(timeout = 20_000)
    public void testAsyncCheckpointFailureTriggerJobFailed() throws Exception {
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.enableCheckpointing(500);
        env.setRestartStrategy(RestartStrategies.noRestart());
        env.setStateBackend(new AsyncFailureStateBackend());
        env.addSource(new StringGeneratingSourceFunction()).addSink(new DiscardingSink<>());
        JobGraph jobGraph = StreamingJobGraphGenerator.createJobGraph(env.getStreamGraph());
        try {
            // assert that the job only execute checkpoint once and only failed once.
            TestUtils.submitJobAndWaitForResult(
                    cluster.getClusterClient(), jobGraph, getClass().getClassLoader());
        } catch (JobExecutionException jobException) {
            if (!isCheckpointFailure(jobException)) {
                throw jobException;
            }
        }
        // assert that the job only failed once.
        Assert.assertEquals(1, StringGeneratingSourceFunction.INITIALIZE_TIMES.get());
    }

    private static class StringGeneratingSourceFunction extends RichParallelSourceFunction<String>
            implements CheckpointedFunction {
        private static final long serialVersionUID = 1L;
        private static final ListStateDescriptor<Long> stateDescriptor =
                new ListStateDescriptor<>("emitted", Long.class);

        private final byte[] randomBytes = new byte[10];

        private ListState<Long> listState;
        private long emitted = 0L;

        private volatile boolean isRunning = true;

        public static final AtomicInteger INITIALIZE_TIMES = new AtomicInteger(0);

        @Override
        public void snapshotState(FunctionSnapshotContext context) throws Exception {
            listState.clear();
            listState.add(emitted);
        }

        @Override
        public void initializeState(FunctionInitializationContext context) throws Exception {
            listState = context.getOperatorStateStore().getListState(stateDescriptor);
            INITIALIZE_TIMES.addAndGet(1);
        }

        @Override
        public void run(SourceContext<String> ctx) throws Exception {
            while (isRunning) {
                ThreadLocalRandom.current().nextBytes(randomBytes);
                synchronized (ctx.getCheckpointLock()) {
                    ctx.collect(new String(randomBytes));
                    emitted += 1;
                }
                Thread.sleep(10);
            }
        }

        @Override
        public void cancel() {
            isRunning = false;
        }
    }

    private static class AsyncFailureStateBackend extends MemoryStateBackend {
        private static final long serialVersionUID = 1L;
        private static final SnapshotStrategy<OperatorStateHandle, SnapshotResources>
                ASYNC_DECLINING_SNAPSHOT_STRATEGY =
                        new SnapshotStrategy<OperatorStateHandle, SnapshotResources>() {
                            @Override
                            public SnapshotResources syncPrepareResources(long checkpointId)
                                    throws Exception {
                                return null;
                            }

                            @Override
                            public SnapshotResultSupplier<OperatorStateHandle> asyncSnapshot(
                                    SnapshotResources syncPartResource,
                                    long checkpointId,
                                    long timestamp,
                                    @Nonnull CheckpointStreamFactory streamFactory,
                                    @Nonnull CheckpointOptions checkpointOptions) {
                                return (closeableRegistry) -> {
                                    throw new Exception("Expected async snapshot exception.");
                                };
                            }
                        };

        @Override
        public OperatorStateBackend createOperatorStateBackend(
                Environment env,
                String operatorIdentifier,
                @Nonnull Collection<OperatorStateHandle> stateHandles,
                CloseableRegistry cancelStreamRegistry) {
            return new DefaultOperatorStateBackendBuilder(
                    env.getUserCodeClassLoader().asClassLoader(),
                    env.getExecutionConfig(),
                    true,
                    stateHandles,
                    cancelStreamRegistry) {
                @Override
                @SuppressWarnings("unchecked")
                public DefaultOperatorStateBackend build() {
                    CloseableRegistry closeableRegistry = new CloseableRegistry();
                    return new DefaultOperatorStateBackend(
                            executionConfig,
                            closeableRegistry,
                            new HashMap<>(),
                            new HashMap<>(),
                            new HashMap<>(),
                            new HashMap<>(),
                            new SnapshotStrategyRunner(
                                    "Async Failure State Backend",
                                    ASYNC_DECLINING_SNAPSHOT_STRATEGY,
                                    closeableRegistry,
                                    SnapshotExecutionType.ASYNCHRONOUS));
                }
            }.build();
        }

        @Override
        public AsyncFailureStateBackend configure(ReadableConfig config, ClassLoader classLoader) {
            return this;
        }
    }

    private static class FailingFinalizationCheckpointStorage implements CheckpointStorage {
        private static final long serialVersionUID = 8134582566514272546L;

        @Override
        public CompletedCheckpointStorageLocation resolveCheckpoint(String externalPointer) {
            return new TestCompletedCheckpointStorageLocation();
        }

        @Override
        public CheckpointStorageAccess createCheckpointStorage(JobID jobId) {
            return new TestingCheckpointStorageAccessCoordinatorView() {
                @Override
                public CheckpointStorageLocation initializeLocationForCheckpoint(
                        long checkpointId) {
                    return new NonPersistentMetadataCheckpointStorageLocation(Integer.MAX_VALUE) {
                        @Override
                        public CheckpointMetadataOutputStream createMetadataOutputStream() {
                            throw new RuntimeException("finalization failure");
                        }
                    };
                }
            };
        }
    }

    private boolean isCheckpointFailure(JobExecutionException jobException) {
        return ExceptionUtils.findThrowable(jobException, FlinkRuntimeException.class)
                .filter(ex -> ex.getMessage().equals(EXCEEDED_CHECKPOINT_TOLERABLE_FAILURE_MESSAGE))
                .isPresent();
    }
}


text:
<?php
require('../../include/config.class.php');
require('../../include/teleinfo.class.php');

$aRet = array();

$oTeleinfo = new Teleinfo();
$iTry = 0;
do{
	if(!$oTeleinfo->load(Config::instance()->teleinfo->file)){
		sleep(1);
	}
}
while(!$oTeleinfo->loaded() && (++$iTry < 5));

if($oTeleinfo->loaded()){
	$aRet['tries'] = $iTry+1;
	$aRet['teleInfo'] = $oTeleinfo->toArray();
	if(isset($aRet['teleInfo']['adresseCompteur']))
		unset($aRet['teleInfo']['adresseCompteur']);
}
else{
	$aRet['error'] = 1;
	$aRet['errorStr'] = "Cannot load teleinfo on: '$sTeleInfoFile' after $sTry tries";
}

header("Content-Type: application/json");
echo json_encode($aRet);

redpajama_set_name: RedPajamaGithub


text:
package org.encog.ml.data.versatile.normalizers;

import org.encog.EncogError;
import org.encog.ml.data.MLData;
import org.encog.ml.data.versatile.columns.ColumnDefinition;

/**
 * Normalize to one-of-n for nominal values. For example, "one", "two", "three"
 * becomes 1,0,0 and 0,1,0 and 0,0,1 etc. Assuming 0 and 1 were the min/max.
 */
public class OneOfNNormalizer implements Normalizer {
	private static final long serialVersionUID = 1L;

	/**
	 * The normalized low.
	 */
	private double normalizedLow;

	/**
	 * The normalized high.
	 */
	private double normalizedHigh;

	/**
	 * Construct the normalizer.
	 * @param theNormalizedLow The normalized low.
	 * @param theNormalizedHigh The normalized high.
	 */
	public OneOfNNormalizer(double theNormalizedLow, double theNormalizedHigh) {
		this.normalizedLow = theNormalizedLow;
		this.normalizedHigh = theNormalizedHigh;
	}

 	@Override
 	public boolean equals(Object obj) {
 		boolean result;

 		if ( obj instanceof OneOfNNormalizer ) {
 			OneOfNNormalizer that = (OneOfNNormalizer) obj;
 			result = Double.valueOf( this.normalizedHigh ).equals( that.normalizedHigh )
 					&& Double.valueOf( this.normalizedLow ).equals( that.normalizedLow );
 		} else {
 			result = false;
 		}

 		return result;
 	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int outputSize(ColumnDefinition colDef) {
		return colDef.getClasses().size();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int normalizeColumn(ColumnDefinition colDef, String value,
			double[] outputData, int outputColumn) {

		for (int i = 0; i < colDef.getClasses().size(); i++) {
			double d = this.normalizedLow;

			if (colDef.getClasses().get(i).equals(value)) {
				d = this.normalizedHigh;
			}

			outputData[outputColumn + i] = d;
		}
		return outputColumn + colDef.getClasses().size();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String denormalizeColumn(ColumnDefinition colDef, MLData data,
			int dataColumn) {
		double bestValue = Double.NEGATIVE_INFINITY;
		int bestIndex = 0;

		for (int i = 0; i < data.size(); i++) {
			double d = data.getData(dataColumn + i);
			if (d > bestValue) {
				bestValue = d;
				bestIndex = i;
			}
		}

		return colDef.getClasses().get(bestIndex);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public int normalizeColumn(ColumnDefinition colDef, double value,
			double[] outputData, int outputColumn) {
		throw new EncogError(
				"Can't use a one-of-n normalizer on a continuous value: "
						+ value);
	}

}


text:
package dx.api

import com.dnanexus.AccessLevel

sealed abstract class DxAccessLevel(javaLevel: AccessLevel, val order: Int)
    extends Ordered[DxAccessLevel] {
  def compare(that: DxAccessLevel): Int = this.order - that.order
  lazy val name: String = javaLevel.name()
}

object DxAccessLevel {
  case object Denied extends DxAccessLevel(AccessLevel.NONE, 1)
  case object View extends DxAccessLevel(AccessLevel.VIEW, 2)
  case object Upload extends DxAccessLevel(AccessLevel.UPLOAD, 3)
  case object Contribute extends DxAccessLevel(AccessLevel.CONTRIBUTE, 4)
  case object Administer extends DxAccessLevel(AccessLevel.ADMINISTER, 5)
  val All: Vector[DxAccessLevel] =
    Vector(Denied, View, Upload, Contribute, Administer).sortWith(_ < _)

  def withName(name: String): DxAccessLevel = {
    All.find(_.name == name) match {
      case Some(level) => level
      case _           => throw new NoSuchElementException(s"No value found for ${name}")
    }
  }

  def withOrder(order: Int): DxAccessLevel = {
    All.find(_.order == order) match {
      case Some(level) => level
      case _           => throw new NoSuchElementException(s"No value found for ${order}")
    }
  }
}


text:
package elsevier;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.pdfbox.cos.COSDocument;
import org.apache.pdfbox.pdfparser.PDFParser;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFTextStripper;

public class pdf_To_word
{
    static int count = 0;
    static String root_folder = "/mnt/Titas/1_QA_MODEL/Documents";
    static void pdftoText(String fileName)throws IOException, Exception
    {
        PDFParser parser = null;
        String parsedText = null;
        PDFTextStripper pdfStripper;
        PDDocument pdDoc = null;
        COSDocument cosDoc = null;
        File file = new File(fileName);
        if (!file.isFile()) {
            System.err.println("File " + fileName + " does not exist.");

        }
        try {
           // System.out.println("hello");
            parser = new PDFParser(new FileInputStream(file));
        } catch (IOException e) {
            System.err.println("Unable to open PDF Parser. " + e.getMessage());
           // return null;
        }
        try {
            parser.parse();
            cosDoc = parser.getDocument();
            pdfStripper = new PDFTextStripper();
            pdDoc = new PDDocument(cosDoc);
            parsedText = pdfStripper.getText(pdDoc);
        } catch (Exception e) {
            System.err.println("An exception occured in parsing the PDF Document." + e.getMessage());
        }
        finally {
            try {
                if (cosDoc != null)
                    cosDoc.close();
                if (pdDoc != null)
                    pdDoc.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        print_to_Text(parsedText);
    }
    static void print_to_Text(String s) throws IOException, Exception
    {
        try
        {
            String output_name = "file"+Integer.toString(count)+".txt";
            String path = root_folder+output_name;
            File file  = new File(path);
            if (!file.exists())
            {
                file.createNewFile();
            }
            FileWriter fw = new FileWriter(file.getAbsoluteFile());
            BufferedWriter bw = new BufferedWriter(fw);
            bw.write(s);
            String dummy = s.toLowerCase();
            String pattern = "reference";
            Search obj = new Search();
            int index = obj.search(dummy,pattern );
            if(index == -1)
            {
                System.out.println("References not found");
                return;
            }
            String temp = s.substring(index,s.length());
            String ref =  "file"+Integer.toString(count)+"reference.txt";
            path = root_folder+ref;
            file = new File(path);
            if (!file.exists())
            {
                file.createNewFile();
            }
            fw = new FileWriter(file.getAbsoluteFile());
            bw = new BufferedWriter(fw);
            bw.write(temp);
            System.out.println(temp);
            bw.close();
        }
        catch (IOException e) {}
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<navigationModel
  ns = "http://schemas.android.com?import=com.android.tools.idea.editors.navigation.model.*">
  <locations
    class = "java.util.ArrayList">
    <statePointEntry>
      <state
        class = "com.android.tools.idea.editors.navigation.model.ActivityState"
        className = "com.sf.elastic.activities.MainActivity_"/>
      <point
        x = "500"
        y = "100"/>
    </statePointEntry>
  </locations>
</navigationModel>


text:
package com.modinfodesigns.property.transform.string;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import java.util.HashMap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Uses Regular Expressions to transform a String. If a pattern is detected, an
 * output pattern is used to create the transformed string.
 *
 * @author Ted Sullivan
 */
public class RegularExpressionStringTransform implements IStringTransform
{
  private transient static final Logger LOG = LoggerFactory.getLogger( RegularExpressionStringTransform.class );

  private String regExprPattern;
  private String outputPattern;

  private String delimiter  = " ";

  private static HashMap<String,Pattern> patternMap = new HashMap<String,Pattern>( );

  @Override
  public String transformString( String inputString ) throws StringTransformException
  {
    LOG.debug( "transformString( )... " );
    Pattern compPat = compilePattern( this.regExprPattern );

    if (compPat != null )
    {
      LOG.debug( "Got compiled pattern for " + regExprPattern );
      Matcher matchedPattern = compPat.matcher( inputString );
      if (matchedPattern != null)
      {
        String output = null;

        if (outputPattern == null)
        {
          StringBuilder sBuilder = new StringBuilder( );
          while( matchedPattern.find( ) )
          {
            String groupPat = matchedPattern.group( );

            sBuilder.append( groupPat );
            sBuilder.append( delimiter );
          }

          output = sBuilder.toString();
        }
        else
        {
          LOG.debug( "replaceAll " + outputPattern );
          output = matchedPattern.replaceAll( outputPattern );
        }

        return output;
      }
      else
      {
        LOG.debug( "no matches for " + regExprPattern );
      }
    }
    else
    {
      LOG.error( "Could not compile " + regExprPattern );
    }

    return inputString;
  }

  private static Pattern compilePattern( String regExpression )
  {
    Pattern pattern;
    synchronized (patternMap)
    {
      pattern = patternMap.get( regExpression );
      if (pattern == null)
      {
        try
        {
          pattern = Pattern.compile( regExpression );
          patternMap.put( regExpression, pattern );
        }
        catch (Exception e)
        {
          LOG.error( "getCompiledPattern got Exception " + e );
        }
      }
    }

    return pattern;
  }

  @Override
  public String transformString(String sessionID, String inputString) throws StringTransformException
  {
    return transformString( inputString );
  }

  public void setRegularExpression( String regExprPattern )
  {
    this.regExprPattern = regExprPattern;
  }

  public void setOutputPattern( String outputPattern )
  {
    this.outputPattern = outputPattern;
  }

  public void setDelimiter( String delimiter )
  {
    this.delimiter = delimiter;
  }
}


text:
package com.letv.mocker.mock.vo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.letv.mocker.framework.util.XStreamCDATA;
import com.letv.mocker.mock.http.Response;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import com.thoughtworks.xstream.annotations.XStreamOmitField;

/**
 * 一条请求对应的mock响应对象
 *
 * */
public class Mock {

	@XStreamAlias("params")
	@XStreamCDATA
	private String params;// 匹配到的请求参数

	@XStreamAlias("proxy")
	private String proxy;// 代理host,若有值则优先把映射到此mock下的请求转发到proxy服务器

	@XStreamAlias("resFileName")
	private String resFileName;// 若proxy无值,则把映射到此mock下的请求返回resFileName文件内容

	@XStreamAlias("statusCode")
	private int statusCode;// 响应状态码

	@XStreamAlias("delay")
	private long delay;// 延时时间(单位毫秒 为空或无节点表示不延时)

	@XStreamImplicit(itemFieldName = "header")
	private List<Header> headers; // 响应头信息

	// 不做持久化的参数
	@XStreamOmitField
	private boolean isMockException;// 是否要mock一条Exception数据
	@XStreamOmitField
	private String resFilePath;// mock响应文件的路径

	public Mock() {
		super();
	}

	public Mock(String params, String resFileName, String proxy,
			Response myResponse) {
		this.params = params;
		this.resFileName = resFileName;
		this.proxy = proxy;

		// 填充mock Response
		if (myResponse != null) {
			List<Header> headers = myResponse.getHeaders();
			if (headers != null && headers.size() > 0) {
				// 注意必须每个mock对象有自己的new headerList,不能直接引用,否则xml持久化出问题!
				this.headers = new ArrayList<Header>();
				for (Header header : headers) {
					this.headers.add(new Header(header.getName(), header
							.getValue()));
				}
			}
			this.statusCode = myResponse.getStatusCode();
		}

	}

	public String getParams() {
		return this.params;
	}

	public void setParams(String params) {
		this.params = params;
	}

	public boolean isMockException() {
		return this.isMockException;
	}

	public void setMockException(boolean isMockException) {
		this.isMockException = isMockException;
	}

	public String getResFileName() {
		return this.resFileName;
	}

	public void setResFileName(String resFileName) {
		this.resFileName = resFileName;
	}

	public String getProxy() {
		return proxy;
	}

	public void setProxy(String proxy) {
		this.proxy = proxy;
	}

	public List<Header> getHeaders() {
		return headers;
	}

	public void setHeaders(List<Header> headers) {
		this.headers = headers;
	}

	public int getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}

	public String getResFilePath() {
		return resFilePath;
	}

	public void setResFilePath(String resFilePath) {
		this.resFilePath = resFilePath;
	}

	public long getDelay() {
		return delay;
	}

	public void setDelay(long delay) {
		this.delay = delay;
	}

	@Override
	public String toString() {
		return "Mock [params=" + params + ", proxy=" + proxy + ", resFileName="
				+ resFileName + ", statusCode=" + statusCode + ", delay="
				+ delay + ", headers=" + Arrays.toString(headers.toArray())
				+ ", isMockException=" + isMockException + ", resFilePath="
				+ resFilePath + "]";
	}
}


text:
Some of the utilities for this project ([tes3lint](Tes3lint), [tes3cmd](Tes3cmd)) are command-line programs written the programming language Perl and need to have Perl installed in order to work. If you are unfamiliar with Perl or with using Perl command-line scripts on Windows, this page will help get you started.

## Download and install Perl

I recommend [strawberry Perl](http://strawberryperl.com/), but ActiveState's Active Perl should work too. The first step is to just download the installer, run it and let it install Perl. These instructions assume you install Strawberry Perl to the default location (C:\strawberry), but you are welcome to install any version of Perl to any location you like, you'll just have to translate the rest of the instructions on this page to suit your choice.

## Open a terminal window

From the Start menu, choose `Start -> Run -> cmd.exe`, this should pop up a window containing a command-line prompt.

## Check that perl is in your PATH
 When you run a command line program in Windows, it uses the environment variable %PATH% to find where the exe lives so it can run it. When you install Strawberry Perl, it is supposed to put itself in your path. You can test this by executing this command line in a terminal window:

    echo %PATH%

You should see the following string somewhere in the output: C:\strawberry\c\bin;C:\strawberry\perl\bin

(The perl.exe lives in C:\strawberry\perl\bin)

If you do not, you may need to restart your system after installing Strawberry Perl. If you still do not see it in your PATH, you can set it from the Control Panel (for XP this would be):

`Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables`

Select the environment variable "Path" (or create one if you have to), then "edit" it and set the value to: `C:\strawberry\c\bin;C:\strawberry\perl\bin`

## Now try running one of the perl utilities

    perl tes3cmd help

If you were successful, this will print out the basic usage for this command. If you were unsuccessful, let's forget about the PATH, and just use the fully qualified pathname for perl:

    C:\strawberry\perl\bin\perl tes3cmd help

# Using a batch file "wrapper" to make the command more convenient

[tes3lint](Tes3lint) comes with some batch files "wrappers" that are intended to give you an idea on how to run the command, and to make it a little easier. Instead of having to type this command:

    perl tes3lint -a .....

You can just type this:

    tes3lintfull ...

Or, you may even want to create your own .bat file to run the command with the command line options you prefer and use that instead.

Let's make a batch file for tes3cmd to dump a plugin as text output. Create a file called dumpplug.bat in notepad containing:

    perl tes3cmd dump %1 > tes3cmd_dump.log
    more tes3cmd_dump.log
    pause

This will run tes3cmd to dump the contents of a plugin in readable (more or less) format, and use the "more" command to show a page at a time. The output is also stored in the file "tes3cmd_dump.log". You may need to substitute the complete path to Perl for "perl" if the perl.exe is not in your PATH. And you may need to substitute the complete path to tes3cmd for "tes3cmd" if it is not in the same directory as your new "dumpplug.bat".

# Using a shortcut for drag and drop

Now, if you are tired of running things from the command line, you can create a shortcut to one of the .bat files mentioned in the previous step. Just select the batch file in the Windows file system explorer, right click and choose "Create Shortcut". Now you can drag a plugin icon onto the shortcut icon, and it will process it and print its output, and you do not have to use the command line.

If you create a shortcut to the batch file you created in the previous step (dumpplug.bat), then all you need to do to generate a dumped output of the plugin is to drag the plugin onto the shortcut icon.

* * *

I hope that gets you started with Perl command line programs!


text:
<?php

namespace App\Entities;

use App\Contracts\GeneratesUniqueHash;
use App\Contracts\HasIdColumn;
use App\Contracts\RelatesToFiles;
use App\Entities\Base\AbstractEntity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Illuminate\Support\Collection;

/**
 * App\Entities\OpenPort
 *
 * @ORM\Entity(repositoryClass="App\Repositories\OpenPortRepository")
 * @ORM\HasLifecycleCallbacks
 */
class OpenPort extends Base\OpenPort implements HasIdColumn, RelatesToFiles, GeneratesUniqueHash
{
    /**
     * @ORM\ManyToMany(targetEntity="File", mappedBy="open_ports")
     */
    protected $files;

    /**
     * OpenPort constructor.
     */
    public function __construct()
    {
        parent::__construct();
        $this->files = new ArrayCollection();
    }

    /**
     * Override the parent setter to always uppercase the input before setting the property with the value
     *
     * @param string $protocol
     * @return Base\OpenPort
     */
    public function setProtocol($protocol)
    {
        return parent::setProtocol(
            strtoupper($protocol)
        );
    }

    /**
     * Override the parent setter to always uppercase the input before setting the property with the value
     *
     * @param string $service_name
     * @return Base\OpenPort
     */
    public function setServiceName($service_name)
    {
        return parent::setServiceName(
            strtoupper($service_name)
        );
    }

    /**
     * @param File $file
     * @return $this
     */
    public function addFile(File $file)
    {
        $this->files[$file->getId()] = $file;

        return $this;
    }

    /**
     * @param File $file
     * @return $this
     */
    public function removeFile(File $file)
    {
        $this->files->removeElement($file);

        return $this;
    }

    /**
     * Convenience method for returning the parent Asset entity
     *
     * @return mixed
     */
    public function getParent()
    {
        return $this->asset;
    }

    /**
     * Convenience method for setting the parent Asset entity
     *
     * @param Base\Asset $asset
     * @return Base\OpenPort
     */
    public function setParent(Base\Asset $asset)
    {
        return parent::setAsset($asset);
    }

    /**
     * @inheritdoc
     * @return string
     */
    public function getHash(): string
    {
        return AbstractEntity::generateUniqueHash($this->getUniqueKeyColumns());
    }

    /**
     * @inheritdoc
     * @return Collection
     */
    public function getUniqueKeyColumns(): Collection
    {
        return collect([
            parent::NUMBER => $this->number,
            parent::ASSET  => $this->asset,
        ]);
    }
}


text:
using System;
using AutoMapper;
using Surpass.Globalization;
using SurpassStandard.Dependency;
using SurpassStandard.Extensions;

namespace Surpass.App.Mappers
{
    [ExportMany]
    public class BaseMapperProfile: Profile
    {
        public BaseMapperProfile()
        {
            // 转换时间时处理时区
            CreateMap<DateTime, string>().ConvertUsing(d => d.ToClientTimeString());
            CreateMap<string, DateTime>().ConvertUsing(s => s.ConvertOrDefault<DateTime>().FromClientTime());
        }
    }
}


text:
project("OpenBoardView" LANGUAGES CXX VERSION "0.3.0")
set(PRETTY_NAME "Open Board View")

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Software for viewing .brd files, intended as a drop-in replacement for the
\"Test_Link\" software.")

# Owner
set(CPACK_PACKAGE_VENDOR "Chloridite")

# Ensure CPack uses the same data as CMake
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})

# Store metadata in the build dir (for CI packaging and other automation)
file(WRITE "${PROJECT_BINARY_DIR}/PROJECT_NAME" "${PROJECT_NAME}")
file(WRITE "${PROJECT_BINARY_DIR}/PROJECT_VERSION" "${PROJECT_VERSION}")

## Install locations
# Allow user to easily discover the install prefix
mark_as_advanced(CLEAR FORCE CMAKE_INSTALL_PREFIX)

if(WIN32)
	# Name the install directory; goes under CMAKE_INSTALL_PREFIX
	set(CPACK_PACKAGE_INSTALL_DIRECTORY
		"${CPACK_PACKAGE_NAME} - ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
	CACHE PATH "Directory created in install prefix to contain instalation")

	# Install binaries in the root of the install directory
	set(INSTALL_BIN_DIR "/" CACHE PATH "Where to place binaries in the instalation")
else()
	set(INSTALL_BIN_DIR "bin" CACHE PATH "Where to place binaries in the instalation")
endif()

# Used for Windows and OSX shortcuts; ${PROJECT_NAME} is a console command,
# "Open Board View" is the pretty text
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} ${PRETTY_NAME})

if(WIN32)
	# WiX MD5 Hash, used for checking whether to upgrade an installed package,
	# or install a new one
	#		hash generated manually using `echo "openboardview" | md5sum` on unix
	#   dashes should be added to form the following pattern:
	#   8-4-4-4-12    XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
	set(CPACK_WIX_UPGRADE_GUID "e10554b8-a9ce-9f67-8a09-68fbc9474a7a"
			CACHE STRING "Dash separated MD5 hash, used by WiX to perform updates.")
	mark_as_advanced(FORCE CPACK_WIX_UPGRADE_GUID)

	# Which packages should we generate when installing "package" target
	# or running CPack without specifying a generator
	set(CPACK_GENERATOR  WIX ZIP CACHE STRING "List of generators to build packages with")
endif()

## Text files (like LICENCE.txt) are added from asset/CMakeLists.txt


text:
/*
 * Code adapted from LuaSocket 2.0.2, originally written by Diego Nehab
 *   http://w3.impa.br/~diego/software/luasocket/
 */

#include "timelib.h"

#include <windows.h>

int loski_opentime(loski_TimeDriver *drv)
{
	return 0;
}

int loski_closetime(loski_TimeDriver *drv)
{
	return 0;
}

lua_Number loski_now(loski_TimeDriver *drv)
{
	FILETIME ft;
	double t;
	GetSystemTimeAsFileTime(&ft);
	/* Windows file time (time since January 1, 1601 (UTC)) */
	t  = ft.dwLowDateTime/1.0e7 + ft.dwHighDateTime*(4294967296.0/1.0e7);
	/* convert to Unix Epoch time (time since January 1, 1970 (UTC)) */
	return (t - 11644473600.0);
}

void loski_sleep(loski_TimeDriver *drv, lua_Number seconds)
{
	Sleep((int)(seconds*1000));
}


text:
<!DOCTYPE html>

	<title>Captura Avance</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

	<link rel="stylesheet" href="/Sistema/css/style.php" media="screen">

            <fieldset>
            	<legend class="text-center header">Detalle Materia</legend>
            	<?= form_open("/avanceprog/recibir2") ?>
<?php
	$Id = array('name'=>'id','id'=>'id','style'=>'visibility:hidden');
	$Mate = array('name'=>'txtMate','id'=>'txtMate','class'=>'texto',' readonly'=>'readonly');
	$Grupo = array('name'=>'txtGrupo','id'=>'txtGrupo','class'=>'texto');
	$Carrera = array('name'=>'txtCarrera','id'=>'txtCarrera','class'=>'texto');
	$Tarjeta = array('name'=>'txtTarjeta','id'=>'txtTarjeta','class'=>'texto',' readonly'=>'readonly');
	$Jefe = array('name'=>'txtJefe','id'=>'txtJefe','class'=>'texto');
	$Fecha = array('name'=>'txtFecha','id'=>'txtFecha','type'=>'date','class'=>'texto','readonly'=>'readonly');
	$options2 = array(
        'Enero-Julio'         => 'Enero-Julio',
        'Agosto-Diciembre'           => 'Agosto-Diciembre',
);
?>
<?php
							foreach ($prueba-> result() as $prueba) {?>
				Materia

					<?= form_input($Mate,$prueba->Materia)?>

				Fecha

					<?= form_input($Fecha,$prueba->Fecha)?>

				Grupo

					<?= form_input($Grupo,$prueba->IDG) ?>

				Carrera

				<?= form_input($Carrera,$prueba->Carrera) ?>

				Numero de Tarjeta

					<?= form_input($Tarjeta,$prueba->Num_Tarjeta) ?>

				Jefe Departamento
					<?= form_input($Jefe,$prueba->NomJefeDto) ?>

				Periodo

					<select name="Periodo" class="materias">
						<option value="Enero-Julio" selected="selected">Enero-Julio</option>
						<option value="Agosto-Diciembre">Agosto-Diciembre</option>
					</select>

				<?= form_input($Id,$IDA) ?>
<?php }
						?>
            </fieldset>

	<button type="button" class="btn btn-danger" onclick="history.back(-1)">Cancelar</button>
	<button  type="submit"  class="btn btn-success">Siguiente</button>

<?= form_close() ?>


text:
require "#{File.dirname(__FILE__)}/abstract_unit"
require 'fixtures/topic'
require 'fixtures/reply'
require 'fixtures/subscriber'
require 'fixtures/movie'
require 'fixtures/keyboard'
require 'fixtures/mixed_case_monkey'

class PrimaryKeysTest < Test::Unit::TestCase
  fixtures :topics, :subscribers, :movies, :mixed_case_monkeys

  def test_integer_key
    topic = Topic.find(1)
    assert_equal(topics(:first).author_name, topic.author_name)
    topic = Topic.find(2)
    assert_equal(topics(:second).author_name, topic.author_name)

    topic = Topic.new
    topic.title = "New Topic"
    assert_equal(nil, topic.id)
    assert_nothing_raised { topic.save! }
    id = topic.id

    topicReloaded = Topic.find(id)
    assert_equal("New Topic", topicReloaded.title)
  end

  def test_customized_primary_key_auto_assigns_on_save
    Keyboard.delete_all
    keyboard = Keyboard.new(:name => 'HHKB')
    assert_nothing_raised { keyboard.save! }
    assert_equal keyboard.id, Keyboard.find_by_name('HHKB').id
  end

  def test_customized_primary_key_can_be_get_before_saving
    keyboard = Keyboard.new
    assert_nil keyboard.id
    assert_nothing_raised { assert_nil keyboard.key_number }
  end

  def test_customized_string_primary_key_settable_before_save
    subscriber = Subscriber.new
    assert_nothing_raised { subscriber.id = 'webster123' }
    assert_equal 'webster123', subscriber.id
    assert_equal 'webster123', subscriber.nick
  end

  def test_string_key
    subscriber = Subscriber.find(subscribers(:first).nick)
    assert_equal(subscribers(:first).name, subscriber.name)
    subscriber = Subscriber.find(subscribers(:second).nick)
    assert_equal(subscribers(:second).name, subscriber.name)

    subscriber = Subscriber.new
    subscriber.id = "jdoe"
    assert_equal("jdoe", subscriber.id)
    subscriber.name = "John Doe"
    assert_nothing_raised { subscriber.save! }
    assert_equal("jdoe", subscriber.id)

    subscriberReloaded = Subscriber.find("jdoe")
    assert_equal("John Doe", subscriberReloaded.name)
  end

  def test_find_with_more_than_one_string_key
    assert_equal 2, Subscriber.find(subscribers(:first).nick, subscribers(:second).nick).length
  end

  def test_primary_key_prefix
    ActiveRecord::Base.primary_key_prefix_type = :table_name
    Topic.reset_primary_key
    assert_equal "topicid", Topic.primary_key

    ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore
    Topic.reset_primary_key
    assert_equal "topic_id", Topic.primary_key

    ActiveRecord::Base.primary_key_prefix_type = nil
    Topic.reset_primary_key
    assert_equal "id", Topic.primary_key
  end

  def test_delete_should_quote_pkey
    assert_nothing_raised { MixedCaseMonkey.delete(1) }
  end
  def test_update_counters_should_quote_pkey_and_quote_counter_columns
    assert_nothing_raised { MixedCaseMonkey.update_counters(1, :fleaCount => 99) }
  end
  def test_find_with_one_id_should_quote_pkey
    assert_nothing_raised { MixedCaseMonkey.find(1) }
  end
  def test_find_with_multiple_ids_should_quote_pkey
    assert_nothing_raised { MixedCaseMonkey.find([1,2]) }
  end
  def test_instance_update_should_quote_pkey
    assert_nothing_raised { MixedCaseMonkey.find(1).save }
  end
  def test_instance_destroy_should_quote_pkey
    assert_nothing_raised { MixedCaseMonkey.find(1).destroy }
  end
end


text:
export const environment = {
  production: false,
  firebase: {
    apiKey: 'AIzaSyBX1h29N8A2ypc_cR6HPw2IlhZ3SprNkPY',
    authDomain: 'dobeerman-movie-quotes.firebaseapp.com',
    databaseURL: 'https://dobeerman-movie-quotes.firebaseio.com',
    projectId: 'dobeerman-movie-quotes',
    storageBucket: 'dobeerman-movie-quotes.appspot.com',
    messagingSenderId: '522977842520'
  }
};


text:
/* Stylesheet specific for IE */

.galleria-thumbnails-list {
	text-align: center;
}

.galleria-thumbnails .galleria-image { /* ie hack */ display: inline; float: none;}

.galleria-info{
	/*0.4 alpha*/
	background:transparent;
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000028,endColorstr=#00000028);
	zoom: 1;
}


text:
/**********************************************************\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: http://www.hprose.com/                 |
|                   http://www.hprose.org/                 |
|                                                          |
\**********************************************************/

/**********************************************************\
 *                                                        *
 * Writer.js                                              *
 *                                                        *
 * hprose Writer for HTML5.                               *
 *                                                        *
 * LastModified: Feb 13, 2017                             *
 * Author: Ma Bingyao <andot@hprose.com>                  *
 *                                                        *
\**********************************************************/

(function (hprose, global, undefined) {
    'use strict';

    var Map = global.Map;
    var BytesIO = hprose.BytesIO;
    var Tags = hprose.Tags;
    var ClassManager = hprose.ClassManager;

    function getClassName(obj) {
        var cls = obj.constructor;
        if (!cls) {
            return 'Object';
        }
        var classname = ClassManager.getClassAlias(cls);
        if (classname) { return classname; }
        if (cls.name) {
            classname = cls.name;
        }
        else {
            var ctor = cls.toString();
            classname = ctor.substr(0, ctor.indexOf('(')).replace(/(^\s*function\s*)|(\s*$)/ig, '');
            if (classname === '' || classname === 'Object') {
                return (typeof(obj.getClassName) === 'function') ? obj.getClassName() : 'Object';
            }
        }
        if (classname !== 'Object') {
            ClassManager.register(cls, classname);
        }
        return classname;
    }

    var fakeWriterRefer = Object.create(null, {
        set: { value: function () {} },
        write: { value: function () { return false; } },
        reset: { value: function () {} }
    });

    function RealWriterRefer(stream) {
        Object.defineProperties(this, {
            _stream: { value: stream },
            _ref: { value: new Map(), writable: true }
        });
    }

    Object.defineProperties(RealWriterRefer.prototype, {
        _refcount: { value: 0, writable: true },
        set: { value: function (val) {
            this._ref.set(val, this._refcount++);
        } },
        write: { value: function (val) {
            var index = this._ref.get(val);
            if (index !== undefined) {
                this._stream.writeByte(Tags.TagRef);
                this._stream.writeString('' + index);
                this._stream.writeByte(Tags.TagSemicolon);
                return true;
            }
            return false;
        } },
        reset: { value: function () {
            this._ref = new Map();
            this._refcount = 0;
        } }
    });

    function realWriterRefer(stream) {
        return new RealWriterRefer(stream);
    }

    function Writer(stream, simple) {
        Object.defineProperties(this, {
            stream: { value: stream },
            _classref: { value: Object.create(null), writable: true },
            _fieldsref: { value: [], writable: true },
            _refer: { value: simple ? fakeWriterRefer : realWriterRefer(stream) }
        });
    }

    function serialize(writer, value) {
        var stream = writer.stream;
        if (value === undefined || value === null) {
            stream.writeByte(Tags.TagNull);
            return;
        }
        switch (value.constructor) {
        case Function:
            stream.writeByte(Tags.TagNull);
            return;
        case Number:
            writeNumber(writer, value);
            return;
        case Boolean:
            writeBoolean(writer, value);
            return;
        case String:
            switch (value.length) {
            case 0:
                stream.writeByte(Tags.TagEmpty);
                return;
            case 1:
                stream.writeByte(Tags.TagUTF8Char);
                stream.writeString(value);
                return;
            }
            writer.writeStringWithRef(value);
            return;
        case Date:
            writer.writeDateWithRef(value);
            return;
        case Map:
            writer.writeMapWithRef(value);
            return;
        case ArrayBuffer:
        case Uint8Array:
        case BytesIO:
            writer.writeBytesWithRef(value);
            return;
        case Int8Array:
        case Int16Array:
        case Int32Array:
        case Uint16Array:
        case Uint32Array:
            writeIntListWithRef(writer, value);
            return;
        case Float32Array:
        case Float64Array:
            writeDoubleListWithRef(writer, value);
            return;
        default:
            if (Array.isArray(value)) {
                writer.writeListWithRef(value);
            }
            else {
                var classname = getClassName(value);
                if (classname === 'Object') {
                    writer.writeMapWithRef(value);
                }
                else {
                    writer.writeObjectWithRef(value);
                }
            }
            break;
        }
    }

    function writeNumber(writer, n) {
        var stream = writer.stream;
        n = n.valueOf();
        if (n === (n | 0)) {
            if (0 <= n && n <= 9) {
                stream.writeByte(n + 0x30);
            }
            else {
                stream.writeByte(Tags.TagInteger);
                stream.writeAsciiString('' + n);
                stream.writeByte(Tags.TagSemicolon);
            }
        }
        else if (isNaN(n)) {
            stream.writeByte(Tags.TagNaN);
        }
        else if (isFinite(n)) {
            stream.writeByte(Tags.TagDouble);
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagSemicolon);
        }
        else {
            stream.writeByte(Tags.TagInfinity);
            stream.writeByte((n > 0) ? Tags.TagPos : Tags.TagNeg);
        }
    }

    function writeInteger(writer, n) {
        var stream = writer.stream;
        if (0 <= n && n <= 9) {
            stream.writeByte(n + 0x30);
        }
        else {
            if (n < -2147483648 || n > 2147483647) {
                stream.writeByte(Tags.TagLong);
            }
            else {
                stream.writeByte(Tags.TagInteger);
            }
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagSemicolon);
        }
    }

    function writeDouble(writer, n) {
        var stream = writer.stream;
        if (isNaN(n)) {
            stream.writeByte(Tags.TagNaN);
        }
        else if (isFinite(n)) {
            stream.writeByte(Tags.TagDouble);
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagSemicolon);
        }
        else {
            stream.writeByte(Tags.TagInfinity);
            stream.writeByte((n > 0) ? Tags.TagPos : Tags.TagNeg);
        }
    }

    function writeBoolean(writer, b) {
        writer.stream.writeByte(b.valueOf() ? Tags.TagTrue : Tags.TagFalse);
    }

    function writeUTCDate(writer, date) {
        writer._refer.set(date);
        var stream = writer.stream;
        var year = ('0000' + date.getUTCFullYear()).slice(-4);
        var month = ('00' + (date.getUTCMonth() + 1)).slice(-2);
        var day = ('00' + date.getUTCDate()).slice(-2);
        var hour = ('00' + date.getUTCHours()).slice(-2);
        var minute = ('00' + date.getUTCMinutes()).slice(-2);
        var second = ('00' + date.getUTCSeconds()).slice(-2);
        var millisecond = ('000' + date.getUTCMilliseconds()).slice(-3);
        stream.writeByte(Tags.TagDate);
        stream.writeAsciiString(year + month + day);
        stream.writeByte(Tags.TagTime);
        stream.writeAsciiString(hour + minute + second);
        if (millisecond !== '000') {
            stream.writeByte(Tags.TagPoint);
            stream.writeAsciiString(millisecond);
        }
        stream.writeByte(Tags.TagUTC);
    }

    function writeDate(writer, date) {
        writer._refer.set(date);
        var stream = writer.stream;
        var year = ('0000' + date.getFullYear()).slice(-4);
        var month = ('00' + (date.getMonth() + 1)).slice(-2);
        var day = ('00' + date.getDate()).slice(-2);
        var hour = ('00' + date.getHours()).slice(-2);
        var minute = ('00' + date.getMinutes()).slice(-2);
        var second = ('00' + date.getSeconds()).slice(-2);
        var millisecond = ('000' + date.getMilliseconds()).slice(-3);
        if ((hour === '00') && (minute === '00') &&
            (second === '00') && (millisecond === '000')) {
            stream.writeByte(Tags.TagDate);
            stream.writeAsciiString(year + month + day);
        }
        else if ((year === '1970') && (month === '01') && (day === '01')) {
            stream.writeByte(Tags.TagTime);
            stream.writeAsciiString(hour + minute + second);
            if (millisecond !== '000') {
                stream.writeByte(Tags.TagPoint);
                stream.writeAsciiString(millisecond);
            }
        }
        else {
            stream.writeByte(Tags.TagDate);
            stream.writeAsciiString(year + month + day);
            stream.writeByte(Tags.TagTime);
            stream.writeAsciiString(hour + minute + second);
            if (millisecond !== '000') {
                stream.writeByte(Tags.TagPoint);
                stream.writeAsciiString(millisecond);
            }
        }
        stream.writeByte(Tags.TagSemicolon);
    }

    function writeTime(writer, time) {
        writer._refer.set(time);
        var stream = writer.stream;
        var hour = ('00' + time.getHours()).slice(-2);
        var minute = ('00' + time.getMinutes()).slice(-2);
        var second = ('00' + time.getSeconds()).slice(-2);
        var millisecond = ('000' + time.getMilliseconds()).slice(-3);
        stream.writeByte(Tags.TagTime);
        stream.writeAsciiString(hour + minute + second);
        if (millisecond !== '000') {
            stream.writeByte(Tags.TagPoint);
            stream.writeAsciiString(millisecond);
        }
        stream.writeByte(Tags.TagSemicolon);
    }

    function writeBytes(writer, bytes) {
        writer._refer.set(bytes);
        var stream = writer.stream;
        stream.writeByte(Tags.TagBytes);
        var n = bytes.byteLength || bytes.length;
        if (n > 0) {
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagQuote);
            stream.write(bytes);
        }
        else {
            stream.writeByte(Tags.TagQuote);
        }
        stream.writeByte(Tags.TagQuote);
    }

    function writeString(writer, str) {
        writer._refer.set(str);
        var stream = writer.stream;
        var n = str.length;
        stream.writeByte(Tags.TagString);
        if (n > 0) {
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagQuote);
            stream.writeString(str);
        }
        else {
            stream.writeByte(Tags.TagQuote);
        }
        stream.writeByte(Tags.TagQuote);
    }

    function writeArray(writer, array, writeElem) {
        writer._refer.set(array);
        var stream = writer.stream;
        var n = array.length;
        stream.writeByte(Tags.TagList);
        if (n > 0) {
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagOpenbrace);
            for (var i = 0; i < n; i++) {
                writeElem(writer, array[i]);
            }
        }
        else {
            stream.writeByte(Tags.TagOpenbrace);
        }
        stream.writeByte(Tags.TagClosebrace);
    }

    function writeIntListWithRef(writer, list) {
        if (!writer._refer.write(list)) {
            writeArray(writer, list, writeInteger);
        }
    }

    function writeDoubleListWithRef(writer, list) {
        if (!writer._refer.write(list)) {
            writeArray(writer, list, writeDouble);
        }
    }

    function writeMap(writer, map) {
        writer._refer.set(map);
        var stream = writer.stream;
        var fields = [];
        for (var key in map) {
            if (map.hasOwnProperty(key) &&
                typeof(map[key]) !== 'function') {
                fields[fields.length] = key;
            }
        }
        var n = fields.length;
        stream.writeByte(Tags.TagMap);
        if (n > 0) {
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagOpenbrace);
            for (var i = 0; i < n; i++) {
                serialize(writer, fields[i]);
                serialize(writer, map[fields[i]]);
            }
        }
        else {
            stream.writeByte(Tags.TagOpenbrace);
        }
        stream.writeByte(Tags.TagClosebrace);
    }

    function writeHarmonyMap(writer, map) {
        writer._refer.set(map);
        var stream = writer.stream;
        var n = map.size;
        stream.writeByte(Tags.TagMap);
        if (n > 0) {
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagOpenbrace);
            map.forEach(function(value, key) {
                serialize(writer, key);
                serialize(writer, value);
            });
        }
        else {
            stream.writeByte(Tags.TagOpenbrace);
        }
        stream.writeByte(Tags.TagClosebrace);
    }

    function writeObject(writer, obj) {
        var stream = writer.stream;
        var classname = getClassName(obj);
        var fields, index;
        if (classname in writer._classref) {
            index = writer._classref[classname];
            fields = writer._fieldsref[index];
        }
        else {
            fields = [];
            for (var key in obj) {
                if (obj.hasOwnProperty(key) &&
                    typeof(obj[key]) !== 'function') {
                    fields[fields.length] = key.toString();
                }
            }
            index = writeClass(writer, classname, fields);
        }
        stream.writeByte(Tags.TagObject);
        stream.writeAsciiString('' + index);
        stream.writeByte(Tags.TagOpenbrace);
        writer._refer.set(obj);
        var n = fields.length;
        for (var i = 0; i < n; i++) {
            serialize(writer, obj[fields[i]]);
        }
        stream.writeByte(Tags.TagClosebrace);
    }

    function writeClass(writer, classname, fields) {
        var stream = writer.stream;
        var n = fields.length;
        stream.writeByte(Tags.TagClass);
        stream.writeAsciiString('' + classname.length);
        stream.writeByte(Tags.TagQuote);
        stream.writeString(classname);
        stream.writeByte(Tags.TagQuote);
        if (n > 0) {
            stream.writeAsciiString('' + n);
            stream.writeByte(Tags.TagOpenbrace);
            for (var i = 0; i < n; i++) {
                writeString(writer, fields[i]);
            }
        }
        else {
            stream.writeByte(Tags.TagOpenbrace);
        }
        stream.writeByte(Tags.TagClosebrace);
        var index = writer._fieldsref.length;
        writer._classref[classname] = index;
        writer._fieldsref[index] = fields;
        return index;
    }

    Object.defineProperties(Writer.prototype, {
        serialize: { value: function(value) {
            serialize(this, value);
        } },
        writeInteger: { value: function(value) {
            writeInteger(this, value);
        } },
        writeDouble: { value: function(value) {
            writeDouble(this, value);
        } },
        writeBoolean: { value: function(value) {
            writeBoolean(this, value);
        } },
        writeUTCDate: { value: function(value) {
            writeUTCDate(this, value);
        } },
        writeUTCDateWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeUTCDate(this, value);
            }
        } },
        writeDate: { value: function(value) {
            writeDate(this, value);
        } },
        writeDateWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeDate(this, value);
            }
        } },
        writeTime: { value: function(value) {
            writeTime(this, value);
        } },
        writeTimeWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeTime(this, value);
            }
        } },
        writeBytes: { value: function(value) {
            writeBytes(this, value);
        } },
        writeBytesWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeBytes(this, value);
            }
        } },
        writeString: { value: function(value) {
            writeString(this, value);
        } },
        writeStringWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeString(this, value);
            }
        } },
        writeList: { value: function(value) {
            writeArray(this, value, serialize);
        } },
        writeListWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeArray(this, value, serialize);
            }
        } },
        writeMap: { value: function(value) {
            if (value instanceof Map) {
                writeHarmonyMap(this, value);
            }
            else {
                writeMap(this, value);
            }
        } },
        writeMapWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                if (value instanceof Map) {
                    writeHarmonyMap(this, value);
                }
                else {
                    writeMap(this, value);
                }
            }
        } },
        writeObject: { value: function(value) {
            writeObject(this, value);
        } },
        writeObjectWithRef: { value: function(value) {
            if (!this._refer.write(value)) {
                writeObject(this, value);
            }
        } },
        reset: { value: function() {
            this._classref = Object.create(null);
            this._fieldsref.length = 0;
            this._refer.reset();
        } }
    });

    hprose.Writer = Writer;

})(hprose, hprose.global);


text:
package collision

import (
	"github.com/teomat/mater/aabb"
	"github.com/teomat/mater/transform"
	"github.com/teomat/mater/vect"
)

// Convenience wrapper around PolygonShape.
type BoxShape struct {
	// The polygon that represents this box. Do not touch!
	Polygon *PolygonShape
	verts   [4]vect.Vect
	// The width of the box. Call UpdatePoly() if changed.
	Width float64
	// The height of the box. Call UpdatePoly() if changed.
	Height float64
	// The center of the box. Call UpdatePoly() if changed.
	Position vect.Vect
}

// Creates a new BoxShape with given position, width and height.
func NewBox(pos vect.Vect, w, h float64) *Shape {
	shape := new(Shape)
	box := &BoxShape{
		Polygon:  &PolygonShape{},
		Width:    w,
		Height:   h,
		Position: pos,
	}

	hw := w / 2.0
	hh := h / 2.0
	box.verts = [4]vect.Vect{
		{-hw, -hh},
		{-hw, hh},
		{hw, hh},
		{hw, -hh},
	}

	poly := box.Polygon
	poly.SetVerts(box.verts[:], box.Position)

	shape.ShapeClass = box
	return shape
}

// Recalculates the internal Polygon with the Width, Height and Position.
func (box *BoxShape) UpdatePoly() {
	hw := box.Width / 2.0
	hh := box.Height / 2.0
	box.verts = [4]vect.Vect{
		{-hw, -hh},
		{-hw, hh},
		{hw, hh},
		{hw, -hh},
	}

	poly := box.Polygon
	poly.SetVerts(box.verts[:], box.Position)
}

// Returns ShapeType_Box. Needed to implemet the ShapeClass interface.
func (box *BoxShape) ShapeType() ShapeType {
	return ShapeType_Box
}

// Recalculates the transformed vertices, axes and the bounding box.
func (box *BoxShape) update(xf transform.Transform) aabb.AABB {
	return box.Polygon.update(xf)
}

// Returns true if the given point is located inside the box.
func (box *BoxShape) TestPoint(point vect.Vect) bool {
	return box.Polygon.TestPoint(point)
}


text:
#ifndef ATOM_INCLUDED
#define ATOM_INCLUDED

#define NBUCKETS 2048

struct atom {
	struct atom *link;
	int len;
	void *value;
	char *str;
};

extern struct atom **atom_new();
extern       int   atom_length(struct atom **buckets, const char *str);
extern struct atom *atom_put   (struct atom **buckets, const char *str, int len);
extern struct atom *atom_string(struct atom **buckets, const char *str);
extern struct atom *atom_int   (struct atom **buckets, long n);
extern void atom_free(struct atom **buckets);
#endif


text:
<?php namespace Devise\Pages\Fields;

use Mockery as m;

class DvsMagicModeTest extends \DeviseTestCase
{
	public function test_it_starts_disabled()
	{
		$DvsMagicMode = new DvsMagicMode;
		assertFalse($DvsMagicMode->enabled());
		assertTrue($DvsMagicMode->disabled());
	}

	public function test_it_enables()
	{
		$DvsMagicMode = new DvsMagicMode;
		$DvsMagicMode->enable(true);
		assertTrue($DvsMagicMode->enabled());
		assertFalse($DvsMagicMode->disabled());
	}

	public function test_it_disables()
	{
		$DvsMagicMode = new DvsMagicMode;
		$DvsMagicMode->disable(true);
		assertFalse($DvsMagicMode->enabled());
		assertTrue($DvsMagicMode->disabled());
	}
}


text:
from django.core.management.base import BaseCommand
from optparse import make_option
import daemon
import daemon.pidfile
from signal import SIGTSTP, SIGTERM, SIGABRT
import sys, os, subprocess
import time
from jukebox.jukebox_core import api

class Command(BaseCommand):
    daemon = None
    proc = None
    mpg123 = None

    option_list = BaseCommand.option_list + (
        make_option(
            "--start",
            action="store_true",
            dest="start",
            help="Start mpg123 playback"
        ),
        make_option(
            "--stop",
            action="store_true",
            dest="stop",
            help="Stop mpg123 playback"
        ),
    )

    def handle(self, *args, **options):
        # check if mpg123 is available
        fin, fout = os.popen4(["which", "mpg123"])
        self.mpg123 = fout.read().replace("\n", "")
        if not len(self.mpg123):
            print "mpg123 is not installed"
            return

        pidFile = os.path.dirname(
            os.path.abspath(__file__)
        ) + "/../../daemon.pid"

        if options["start"]:
            if os.path.exists(pidFile):
                print "Daemon already running, pid file exists"
                return

            pid = daemon.pidfile.TimeoutPIDLockFile(
                pidFile,
                10
            )

            print "Starting jukebox_mpg123 daemon..."
            self.daemon = daemon.DaemonContext(
                uid=os.getuid(),
                gid=os.getgid(),
                pidfile=pid,
                working_directory=os.getcwd(),
                detach_process=True,
                signal_map={
                    SIGTSTP: self.shutdown,
                    SIGABRT: self.skipSong
                }
            )

            with self.daemon:
                print "Register player"
                pid = int(open(pidFile).read())
                players_api = api.players()
                players_api.add(pid)

                self.play()

        elif options["stop"]:
            if not os.path.exists(pidFile):
                print "Daemon not running"
                return

            print "Stopping daemon..."
            pid = int(open(pidFile).read())
            os.kill(pid, SIGTSTP)

            print "Unregister player " + str(pid)
            players_api = api.players()
            players_api.remove(pid)
        else:
            self.print_help("jukebox_mpg123", "help")

    def play(self):
        songs_api = api.songs()
        while 1:
            if self.proc is None:
                song_instance = songs_api.getNextSong()

                if not os.path.exists(song_instance.Filename):
                    print "File not found: %s" %  song_instance.Filename
                    continue

                print "Playing " + song_instance.Filename
                self.proc = subprocess.Popen(
                    [self.mpg123, song_instance.Filename]
                )
            else:
                if not self.proc.poll() is None:
                    self.proc = None
            time.sleep(0.5)

    def shutdown(self, signal, action):
        if not self.proc is None:
            os.kill(self.proc.pid, SIGTERM)

        if not self.daemon is None:
            self.daemon.close()
        sys.exit(0)

    def skipSong(self, signal, action):
        if not self.proc is None:
            os.kill(self.proc.pid, SIGTERM)


text:
package io.netty.handler.codec.http.multipart;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.util.internal.PlatformDependent;
import org.junit.Test;

import java.io.File;
import java.io.FileOutputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.UUID;

import static io.netty.util.CharsetUtil.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

/**
 * {@link AbstractDiskHttpData} test cases
 */
public class AbstractDiskHttpDataTest {

    @Test
    public void testGetChunk() throws Exception {
        TestHttpData test = new TestHttpData("test", UTF_8, 0);
        try {
            File tmpFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp");
            tmpFile.deleteOnExit();
            FileOutputStream fos = new FileOutputStream(tmpFile);
            byte[] bytes = new byte[4096];
            PlatformDependent.threadLocalRandom().nextBytes(bytes);
            try {
                fos.write(bytes);
                fos.flush();
            } finally {
                fos.close();
            }
            test.setContent(tmpFile);
            ByteBuf buf1 = test.getChunk(1024);
            assertEquals(buf1.readerIndex(), 0);
            assertEquals(buf1.writerIndex(), 1024);
            ByteBuf buf2 = test.getChunk(1024);
            assertEquals(buf2.readerIndex(), 0);
            assertEquals(buf2.writerIndex(), 1024);
            assertFalse("Arrays should not be equal",
                    Arrays.equals(ByteBufUtil.getBytes(buf1), ByteBufUtil.getBytes(buf2)));
        } finally {
            test.delete();
        }
    }

    private static final class TestHttpData extends AbstractDiskHttpData {

        private TestHttpData(String name, Charset charset, long size) {
            super(name, charset, size);
        }

        @Override
        protected String getDiskFilename() {
            return null;
        }

        @Override
        protected String getPrefix() {
            return null;
        }

        @Override
        protected String getBaseDirectory() {
            return null;
        }

        @Override
        protected String getPostfix() {
            return null;
        }

        @Override
        protected boolean deleteOnExit() {
            return false;
        }

        @Override
        public HttpData copy() {
            return null;
        }

        @Override
        public HttpData duplicate() {
            return null;
        }

        @Override
        public HttpData retainedDuplicate() {
            return null;
        }

        @Override
        public HttpData replace(ByteBuf content) {
            return null;
        }

        @Override
        public HttpDataType getHttpDataType() {
            return null;
        }

        @Override
        public int compareTo(InterfaceHttpData o) {
            return 0;
        }
    }
}


text:
package sun.jvm.hotspot.debugger.cdbg;

import java.util.*;

public interface TemplateType extends Type {
  public int  getNumTemplateArguments();
  public Type instantiate(Type[] arguments);
  public Type instantiate(List/*<Type>*/ arguments);
}


text:
package com.google.cloud.contactcenterinsights.v1.samples;

// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_string_sync]
import com.google.cloud.contactcenterinsights.v1.CalculateStatsResponse;
import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient;
import com.google.cloud.contactcenterinsights.v1.LocationName;

public class SyncCalculateStatsString {

  public static void main(String[] args) throws Exception {
    syncCalculateStatsString();
  }

  public static void syncCalculateStatsString() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (ContactCenterInsightsClient contactCenterInsightsClient =
        ContactCenterInsightsClient.create()) {
      String location = LocationName.of("[PROJECT]", "[LOCATION]").toString();
      CalculateStatsResponse response = contactCenterInsightsClient.calculateStats(location);
    }
  }
}
// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_string_sync]


text:
package net.linkedbuildingdata.ifc.convert.ifc2rdf.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import net.linkedbuildingdata.ifc.data.model.IfcModel;
import net.linkedbuildingdata.ifc.data.schema.IfcSchema;

import org.apache.log4j.Logger;

/**
 * Exports IFC schemas and models to binary files .
 *
 * @author Nam Vu
 *
 */
public class Ifc2BinaryFileExportUtil {

	private static final Logger logger = Logger.getRootLogger();

	public static void exportSchemaToBinaryFile(IfcSchema schema, String filePath) throws IOException {
		logger.info(String.format("Exporting schema to a binary file '%s' (%,d types)", filePath, schema.getAllTypeInfos().size()));
		FileOutputStream fileOutputStream = null;
		ObjectOutputStream objectOutputStream = null;
		try {
			fileOutputStream = new FileOutputStream(filePath);
			objectOutputStream = new ObjectOutputStream(fileOutputStream);
			objectOutputStream.writeObject(schema);
			logger.info(
					String.format("Exporting schema has been completed successfully (%,d bytes)", new File(filePath).length()));
		} catch (IOException e) {
			logger.error("Error exporting schema", e);
			throw e;
		} finally {
			if (fileOutputStream != null) {
				fileOutputStream.close();
				if (objectOutputStream != null) {
					objectOutputStream.close();
				}
			}
		}

	}

	public static IfcSchema importSchemaFromBinaryFile(String filePath) throws Exception {
		logger.info(String.format("Importing schema from a binary file '%s'", filePath));
		FileInputStream fileInputStream = null;
		try {
			fileInputStream = new FileInputStream(filePath);
			ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
			IfcSchema schema = (IfcSchema)objectInputStream.readObject();
			logger.info(
					String.format("Importing schema has been completed successfully (%,d types)", schema.getAllTypeInfos().size()));
			return schema;
		} catch (IOException | ClassNotFoundException e) {
			logger.error("Error exporting schema", e);
			throw e;
		} finally {
			if (fileInputStream != null) {
				fileInputStream.close();
			}
		}

	}

	public static void exportModelToBinaryFile(IfcModel model, String filePath) throws IOException {
		logger.info(String.format("Exporting model to a binary file '%s' (%,d entities)", filePath, model.getEntities().size()));
		FileOutputStream fileOutputStream = null;
		ObjectOutputStream objectOutputStream = null;
		try {
			fileOutputStream = new FileOutputStream(filePath);
			objectOutputStream = new ObjectOutputStream(fileOutputStream);
			objectOutputStream.writeObject(model);
			logger.info(
					String.format("Exporting model has been completed successfully (%,d bytes)", new File(filePath).length()));
		} catch (IOException e) {
			logger.error("Error exporting model", e);
			throw e;
		} finally {
			if (fileOutputStream != null) {
				fileOutputStream.close();
				if (objectOutputStream != null) {
					objectOutputStream.close();
				}
			}
		}

	}

	public static IfcModel importModelFromBinaryFile(String filePath) throws Exception {
		logger.info(String.format("Importing model from a binary file '%s'", filePath));
		FileInputStream fileInputStream = null;
		try {
			fileInputStream = new FileInputStream(filePath);
			ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
			IfcModel model = (IfcModel)objectInputStream.readObject();
			logger.info(
					String.format("Importing model has been completed successfully (%,d entities)", model.getEntities().size()));
			return model;
		} catch (IOException | ClassNotFoundException e) {
			logger.error("Error exporting model", e);
			throw e;
		} finally {
			if (fileInputStream != null) {
				fileInputStream.close();
			}
		}

	}

}


text:
<?php

declare(strict_types=1);

namespace LauLamanApps\IzettleApi\Client\Product;

use DateTime;
use LauLamanApps\IzettleApi\API\Product\Discount;
use LauLamanApps\IzettleApi\API\Product\DiscountCollection;
use LauLamanApps\IzettleApi\Client\Universal\ImageBuilderInterface;
use Money\Currency;
use Money\Money;
use Ramsey\Uuid\Uuid;

final class DiscountBuilder implements DiscountBuilderInterface
{
    private $imageBuilder;

    public function __construct(ImageBuilderInterface $imageBuilder)
    {
        $this->imageBuilder = $imageBuilder;
    }

    /**
     * @return Discount[]
     */
    public function buildFromJson(string $json): array
    {
        $products = [];
        $data = json_decode($json, true);
        foreach ($data as $product) {
            $products[] = $this->build($product);
        }

        return $products;
    }

    public function buildFromArray(array $discounts): DiscountCollection
    {
        $discountCollection = new DiscountCollection();

        foreach ($discounts as $discount) {
            $discountCollection->add($this->build($discount));
        }

        return $discountCollection;
    }

    private function build(array $product): Discount
    {
        return Discount::create(
            Uuid::fromString($product['uuid']),
            $product['name'],
            $product['description'],
            $this->imageBuilder->buildFromArray($product['imageLookupKeys']),
            $product['amount'] ? new Money($product['amount']['amount'], new Currency($product['amount']['currencyId'])) : null,
            $product['percentage'] ? (float) $product['percentage'] : null,
            $product['externalReference'],
            $product['etag'],
            new DateTime($product['updated']),
            Uuid::fromString($product['updatedBy']),
            new DateTime($product['created'])
        );
    }
}


text:
<?php

namespace MTD\AsistenciaBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Asistencia
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="MTD\AsistenciaBundle\Entity\AsistenciaRepository")
 */
class Asistencia
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="fecha", type="date")
     */
    private $fecha;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="hora_ingreso_mañana", nullable=true, type="time")
     */
    private $horaIngresoManana;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="hora_salida_mañana", nullable=true, type="time")
     */
    private $horaSalidaManana;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="hora_ingreso_tarde", nullable=true, type="time")
     */
    private $horaIngresoTarde;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="hora_salida_tarde", nullable=true, type="time")
     */
    private $horaSalidaTarde;

    /**
     * @var string
     *
     * @ORM\Column(name="actividad", type="text", nullable = true)
     */
    private $actividad;

    /**
     * @var string
     *
     * @ORM\Column(name="total_horas_normales", nullable=true, type="string", length=50)
     */
    private $totalHorasNormales;

    /**
     * @var string
     *
     * @ORM\Column(name="total_horas_extras", nullable=true, type="string", length=50)
     */
    private $totalHorasExtras;

    /**
     * @var boolean
     *
     * @ORM\Column(name="activo", type="boolean")
     */
    private $activo;

    /**
     * @var boolean
     *
     * @ORM\Column(name="cobrado", nullable = true, type="boolean")
     */
    private $cobrado;

    /**
     * @var boolean
     *
     * @ORM\Column(name="feriado", nullable = true, type="boolean")
     */
    private $feriado;

    /**
     * @ORM\OneToMany(targetEntity="\MTD\AsistenciaBundle\Entity\Asistencia_Proyecto", mappedBy="asistencia")
     */
    private $asistenciaProyecto;

    /**
     * @var float
     *
     * @ORM\Column(name="psgh", nullable = true, type="float")
     */
    private $psgh;

    /**
     * @ORM\OneToMany(targetEntity="\MTD\AsistenciaBundle\Entity\Falta", mappedBy="asistencia")
     */
    private $falta;

    public function __construct()
    {
        $this->asistenciaProyecto = new ArrayCollection();
        $this->falta = new ArrayCollection();
    }
    /**
     * Add falta
     *
     * @param \MTD\AsistenciaBundle\Entity\Falta $falta
     *
     * @return Asistencia
     */
    public function addFalta(\MTD\AsistenciaBundle\Entity\Falta $falta)
    {
        $this->falta[] = $falta;

        return $this;
    }

    /**
     * Remove falta
     *
     * @param \MTD\AsistenciaBundle\Entity\Falta $falta
     */
    public function removeFalta(\MTD\AsistenciaBundle\Entity\Falta $falta)
    {
        $this->falta->removeElement($falta);
    }

    /**
     * Get falta
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getFalta()
    {
        return $this->falta;
    }

    /**
     * Add asistenciaProyecto
     *
     * @param \MTD\AsistenciaBundle\Entity\Asistencia_Proyecto $asistenciaProyecto
     *
     * @return Asistencia
     */
    public function addAsistenciaProyecto(\MTD\AsistenciaBundle\Entity\Asistencia_Proyecto $asistenciaProyecto)
    {
        $this->asistenciaProyecto[] = $asistenciaProyecto;

        return $this;
    }

    /**
     * Remove asistenciaProyecto
     *
     * @param \MTD\AsistenciaBundle\Entity\AsistenciaProyecto $asistenciaProyecto
     */
    public function removeAsistenciaProyecto(\MTD\AsistenciaBundle\Entity\Asistencia_Proyecto $asistenciaProyecto)
    {
        $this->asistenciaProyecto->removeElement($asistenciaProyecto);
    }

    /**
     * Get asistenciaProyecto
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getAsistenciaProyecto()
    {
        return $this->asistenciaProyecto;
    }

    /**
     * @ORM\ManyToOne(targetEntity="\MTD\AsistenciaBundle\Entity\Configuracion", inversedBy="asistencia")
     * @ORM\JoinColumn(name="id_configuracion", referencedColumnName="id")
     * @return integer
     */
    private $configuracion;
    public function setConfiguracion(\MTD\AsistenciaBundle\Entity\Configuracion $configuracion)
    {
        $this->configuracion = $configuracion;
    }

    public function getConfiguracion()
    {
        return $this->configuracion;
    }

    /**
     * @ORM\ManyToOne(targetEntity="\MTD\ReclutamientoBundle\Entity\Empleado", inversedBy="asistencia")
     * @ORM\JoinColumn(name="id_empleado", referencedColumnName="id")
     * @return integer
     */
    private $empleado;
    public function setEmpleado(\MTD\ReclutamientoBundle\Entity\Empleado $empleado)
    {
        $this->empleado = $empleado;
    }

    public function getEmpleado()
    {
        return $this->empleado;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set fecha
     *
     * @param \DateTime $fecha
     *
     * @return Asistencia
     */
    public function setFecha($fecha)
    {
        $this->fecha = $fecha;

        return $this;
    }

    /**
     * Get fecha
     *
     * @return \DateTime
     */
    public function getFecha()
    {
        return $this->fecha;
    }

    /**
     * Set horaIngresoManana
     *
     * @param \DateTime $horaIngresoManana
     *
     * @return Asistencia
     */
    public function setHoraIngresoManana($horaIngresoManana)
    {
        $this->horaIngresoManana = $horaIngresoManana;

        return $this;
    }

    /**
     * Get horaIngresoManana
     *
     * @return \DateTime
     */
    public function getHoraIngresoManana()
    {
        return $this->horaIngresoManana;
    }

    /**
     * Set horaSalidaManana
     *
     * @param \DateTime $horaSalidaManana
     *
     * @return Asistencia
     */
    public function setHoraSalidaManana($horaSalidaMañana)
    {
        $this->horaSalidaManana = $horaSalidaMañana;

        return $this;
    }

    /**
     * Get horaSalidaManana
     *
     * @return \DateTime
     */
    public function getHoraSalidaManana()
    {
        return $this->horaSalidaManana;
    }

    /**
     * Set horaIngresoTarde
     *
     * @param \DateTime $horaIngresoTarde
     *
     * @return Asistencia
     */
    public function setHoraIngresoTarde($horaIngresoTarde)
    {
        $this->horaIngresoTarde = $horaIngresoTarde;

        return $this;
    }

    /**
     * Get horaIngresoTarde
     *
     * @return \DateTime
     */
    public function getHoraIngresoTarde()
    {
        return $this->horaIngresoTarde;
    }

    /**
     * Set horaSalidaTarde
     *
     * @param \DateTime $horaSalidaTarde
     *
     * @return Asistencia
     */
    public function setHoraSalidaTarde($horaSalidaTarde)
    {
        $this->horaSalidaTarde = $horaSalidaTarde;

        return $this;
    }

    /**
     * Get horaSalidaTarde
     *
     * @return \DateTime
     */
    public function getHoraSalidaTarde()
    {
        return $this->horaSalidaTarde;
    }

    /**
     * Set actividad
     *
     * @param string $actividad
     *
     * @return Asistencia
     */
    public function setActividad($actividad)
    {
        $this->actividad = $actividad;

        return $this;
    }

    /**
     * Get actividad
     *
     * @return string
     */
    public function getActividad()
    {
        return $this->actividad;
    }

    /**
     * Set totalHorasNormales
     *
     * @param string $totalHorasNormales
     *
     * @return Asistencia
     */
    public function setTotalHorasNormales($totalHorasNormales)
    {
        $this->totalHorasNormales = $totalHorasNormales;

        return $this;
    }

    /**
     * Get totalHorasNormales
     *
     * @return string
     */
    public function getTotalHorasNormales()
    {
        return $this->totalHorasNormales;
    }

    /**
     * Set totalHorasExtras
     *
     * @param string $totalHorasExtras
     *
     * @return Asistencia
     */
    public function setTotalHorasExtras($totalHorasExtras)
    {
        $this->totalHorasExtras = $totalHorasExtras;

        return $this;
    }

    /**
     * Get totalHorasExtras
     *
     * @return string
     */
    public function getTotalHorasExtras()
    {
        return $this->totalHorasExtras;
    }

    /**
     * Set psgh
     *
     * @param float $psgh
     *
     * @return Asistencia
     */
    public function setPsgh($psgh)
    {
        $this->psgh = $psgh;

        return $this;
    }

    /**
     * Get psgh
     *
     * @return float
     */
    public function getPsgh()
    {
        return $this->psgh;
    }

    /**
     * Set activo
     *
     * @param boolean $activo
     *
     * @return Asistencia
     */
    public function setActivo($activo)
    {
        $this->activo = $activo;

        return $this;
    }

    /**
     * Get activo
     *
     * @return boolean
     */
    public function getActivo()
    {
        return $this->activo;
    }

    /**
     * Set feriado
     *
     * @param boolean $feriado
     *
     * @return Asistencia
     */
    public function setFeriado($feriado)
    {
        $this->feriado = $feriado;

        return $this;
    }

    /**
     * Get feriado
     *
     * @return boolean
     */
    public function getFeriado()
    {
        return $this->feriado;
    }

    /**
     * Set cobrado
     *
     * @param boolean $cobrado
     *
     * @return Asistencia
     */
    public function setCobrado($cobrado)
    {
        $this->cobrado = $cobrado;

        return $this;
    }

    /**
     * Get cobrado
     *
     * @return boolean
     */
    public function getCobrado()
    {
        return $this->cobrado;
    }
}


text:
package edu.cmu.minorthird.ui;

import edu.cmu.minorthird.classify.experiments.CrossValSplitter;
import edu.cmu.minorthird.classify.experiments.RandomSplitter;
import edu.cmu.minorthird.classify.sequential.CRFLearner;
import edu.cmu.minorthird.classify.sequential.CollinsPerceptronLearner;
import edu.cmu.minorthird.classify.sequential.SegmentCRFLearner;
import edu.cmu.minorthird.classify.sequential.SegmentCollinsPerceptronLearner;
import edu.cmu.minorthird.text.learn.BeginContinueEndUniqueReduction;
import edu.cmu.minorthird.text.learn.InsideOutsideReduction;
import edu.cmu.minorthird.text.learn.SegmentAnnotatorLearner;
import edu.cmu.minorthird.text.learn.SequenceAnnotatorLearner;

/**
 * Defines the list of classes that can be selected by an instance of UIMain.
 */

/* package */class SelectableTypes{

	public static final Class<?>[] CLASSES=
			new Class[]{
					//
					// bunches of parameters
					//
					CommandLineUtil.BaseParams.class,
					CommandLineUtil.OnlineBaseParams.class,
					CommandLineUtil.SaveParams.class,
					CommandLineUtil.ClassificationSignalParams.class,
					CommandLineUtil.TrainClassifierParams.class,
					CommandLineUtil.TestClassifierParams.class,
					CommandLineUtil.TestExtractorParams.class,
					CommandLineUtil.LoadAnnotatorParams.class,
					CommandLineUtil.SplitterParams.class,
					CommandLineUtil.ExtractionSignalParams.class,
					CommandLineUtil.TrainExtractorParams.class,
					CommandLineUtil.TestClassifierParams.class,
					CommandLineUtil.TrainTaggerParams.class,
					CommandLineUtil.TaggerSignalParams.class,
					CommandLineUtil.MixupParams.class,
					CommandLineUtil.OnlineSignalParams.class,
					CommandLineUtil.MultiClassificationSignalParams.class,
					CommandLineUtil.EditParams.class,
					CommandLineUtil.AnnotatorOutputParams.class,
					//
					// main routines
					//
					ApplyAnnotator.class,
					TestExtractor.class,
					TrainClassifier.class,
					TrainExtractor.class,
					TestClassifier.class,
					TrainTestClassifier.class,
					TrainTestExtractor.class,
					TrainTestTagger.class,
					OnlineLearner.class,
					RunMixup.class,
					TrainMultiClassifier.class,
					TestMultiClassifier.class,
					TrainTestMultiClassifier.class,
					DebugMixup.class,
					EditLabels.class,
					//
					// recommended classification learners
					//
					Recommended.KnnLearner.class,
					Recommended.NaiveBayes.class,
					Recommended.VotedPerceptronLearner.class,
					Recommended.SVMLearner.class,
					Recommended.DecisionTreeLearner.class,
					Recommended.BoostedDecisionTreeLearner.class,
					Recommended.BoostedStumpLearner.class,
					Recommended.MaxEntLearner.class,
					Recommended.OneVsAllLearner.class,
					Recommended.MostFrequentFirstLearner.class,
					Recommended.CascadingBinaryLearner.class,
					Recommended.TweakedLearner.class,
					//
					// recommended sequence learners
					//
					Recommended.VPTagLearner.class,
					//
					// recommended annotator learners
					//
					Recommended.VPHMMLearner.class,
					Recommended.VPCMMLearner.class,
					Recommended.MEMMLearner.class,
					Recommended.SVMLearner.class,
					Recommended.VPSMMLearner.class,
					Recommended.VPSMMLearner2.class,
					Recommended.VPCMMLearner.class,
					Recommended.MEMMLearner.class,
					Recommended.SVMCMMLearner.class,
					Recommended.CRFAnnotatorLearner.class,
					Recommended.SemiCRFAnnotatorLearner.class,
					SequenceAnnotatorLearner.class,
					SegmentAnnotatorLearner.class,
					//
					// to make parameters visible...
					//
					SegmentCRFLearner.class,
					CRFLearner.class,
					SegmentCollinsPerceptronLearner.class,
					CollinsPerceptronLearner.class,
					//
					// reductions from annotator-learning to tagging
					//
					InsideOutsideReduction.class,
					BeginContinueEndUniqueReduction.class,
					//
					// recommend feature extractors
					//
					Recommended.DocumentFE.class,Recommended.TokenFE.class,
					Recommended.MultitokenSpanFE.class,
					//
					// splitters
					//
					CrossValSplitter.class,RandomSplitter.class};
}