text:
#ifndef __CPU_O3_SCOREBOARD_HH__
#define __CPU_O3_SCOREBOARD_HH__

#include <iostream>
#include <utility>
#include <vector>

#include "base/trace.hh"
#include "config/the_isa.hh"
#include "cpu/o3/comm.hh"
#include "debug/Scoreboard.hh"

/**
 * Implements a simple scoreboard to track which registers are
 * ready. This class operates on the unified physical register space,
 * because the different classes of registers do not need to be distinguished.
 * Registers being part of a fixed mapping are always considered ready.
 */
class Scoreboard
{
  private:
    /** The object name, for DPRINTF.  We have to declare this
     *  explicitly because Scoreboard is not a SimObject. */
    const std::string _name;

    /** Scoreboard of physical integer registers, saying whether or not they
     *  are ready. */
    std::vector<bool> regScoreBoard;

    /** The number of actual physical registers */
    unsigned numPhysRegs;

  public:
    /** Constructs a scoreboard.
     *  @param _numPhysicalRegs Number of physical registers.
     *  @param _numMiscRegs Number of miscellaneous registers.
     */
    Scoreboard(const std::string &_my_name,
               unsigned _numPhysicalRegs);

    /** Destructor. */
    ~Scoreboard() {}

    /** Returns the name of the scoreboard. */
    std::string name() const { return _name; };

    /** Checks if the register is ready. */
    bool getReg(PhysRegIdPtr phys_reg) const
    {
        assert(phys_reg->flatIndex() < numPhysRegs);

        if (phys_reg->isFixedMapping()) {
            // Fixed mapping regs are always ready
            return true;
        }

        bool ready = regScoreBoard[phys_reg->flatIndex()];

        if (phys_reg->isZeroReg())
            assert(ready);

        return ready;
    }

    /** Sets the register as ready. */
    void setReg(PhysRegIdPtr phys_reg)
    {
        assert(phys_reg->flatIndex() < numPhysRegs);

        if (phys_reg->isFixedMapping()) {
            // Fixed mapping regs are always ready, ignore attempts to change
            // that
            return;
        }

        DPRINTF(Scoreboard, "Setting reg %i (%s) as ready\n",
                phys_reg->index(), phys_reg->className());

        regScoreBoard[phys_reg->flatIndex()] = true;
    }

    /** Sets the register as not ready. */
    void unsetReg(PhysRegIdPtr phys_reg)
    {
        assert(phys_reg->flatIndex() < numPhysRegs);

        if (phys_reg->isFixedMapping()) {
            // Fixed mapping regs are always ready, ignore attempts to
            // change that
            return;
        }

        // zero reg should never be marked unready
        if (phys_reg->isZeroReg())
            return;

        regScoreBoard[phys_reg->flatIndex()] = false;
    }

};

#endif


text:
<BroadcastMonitor>
  <updated>2015-08-03T15:50:11</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-03T15:48:03</startTime>
    <itemId>1000080510:1240945</itemId>
    <titleId>190154441</titleId>
    <itemCode>JFX1138-0039</itemCode>
    <itemReference>JFX1138-0039</itemReference>
    <titleName>What A Difference A Day Made</titleName>
    <artistName>Dinah Washington</artistName>
    <albumName></albumName>
    <CategoryCode>737</CategoryCode>
    <CategoryName>JAZZ</CategoryName>
    <itemDuration>150</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-03T15:50:29</startTime>
    <itemId>1000080510:1240946</itemId>
    <titleId>216123699</titleId>
    <itemCode>09212</itemCode>
    <itemReference></itemReference>
    <titleName>Do It</titleName>
    <artistName>Tuxedo</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>253</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>

redpajama_set_name: RedPajamaGithub


text:
package org.fizmo.dropwizard.guice;

import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.Stage;
import com.google.inject.TypeLiteral;
import com.google.inject.servlet.GuiceFilter;
import com.sun.jersey.api.core.ResourceConfig;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
import com.sun.jersey.spi.container.servlet.WebConfig;
import com.yammer.dropwizard.ConfiguredBundle;
import com.yammer.dropwizard.config.Bootstrap;
import com.yammer.dropwizard.config.Configuration;
import com.yammer.dropwizard.config.Environment;
import com.yammer.metrics.core.HealthCheck;

import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static com.google.common.collect.ImmutableList.of;

public class GuiceBundle<T> implements ConfiguredBundle<T> {

    private final Iterable<Module> modules;
    private final Optional<Injector> parentInjector;

    private static final Key<Set<HealthCheck>> healthChecksKey = Key.get(new TypeLiteral<Set<HealthCheck>>() {});

    private GuiceBundle(final Iterable<Module> modules, final Optional<Injector> parentInjector) {
        this.modules = modules;
        this.parentInjector = parentInjector;
    }

    @Override
    public void initialize(final Bootstrap<?> bootstrap) {

    }

    @Override
    public void run(final T configuration, final Environment environment)
    {
        final Iterable<Module> configedModules = configureModules(configuration, modules);
        final DropwizardModule<T> dwModule = new DropwizardModule<T>(configuration, environment);

        final Injector injector = parentInjector.or(Guice.createInjector())
                .createChildInjector(Iterables.concat(of(dwModule), configedModules));

        environment.addFilter(injector.getInstance(GuiceFilter.class), "*");

        // Support Module definition of health checks
        if (!injector.findBindingsByType(healthChecksKey.getTypeLiteral()).isEmpty()) {
            final Set<HealthCheck> healthChecks = injector.getInstance(healthChecksKey);
            for (HealthCheck hc : healthChecks) {
                environment.addHealthCheck(hc);
            }
        }

    }

    private Iterable<Module> configureModules(final T config, final Iterable<Module> modules)
    {
        final List<Module> configedModules = Lists.newArrayList();

        for (Module m : modules)
        {
            if (m instanceof ConfiguredModule<?>)
            {
                // TODO: reflection to pre-validate if it's got the right type parameter
                final ConfiguredModule<T> cm = (ConfiguredModule<T>) m;
                configedModules.add(cm.withConfiguration(config));
            }
            else
            {
                configedModules.add(m);
            }
        }

        return configedModules;
    }

    private static abstract class AbstractBuilder<T extends AbstractBuilder> {
        private final List<Module> modules;

        protected AbstractBuilder() {
            modules = new LinkedList<Module>();
        }

        protected abstract T self();

        protected abstract Optional<Injector> injector();

        public T withModules(Module module)
        {
            modules.add(module);
            return self();
        }

        public T withModules(Module module1, Module module2, Module... otherModules)
        {
            modules.add(module1);
            modules.add(module2);
            Collections.addAll(modules, otherModules);
            return self();
        }

        public T withModules(Iterable<Module> newModules)
        {
            for (Module m : newModules)
                modules.add(m);
            return self();
        }

        protected Collection<Module> modules() {
            return modules;
        }

        public <CT extends Configuration> GuiceBundle<CT> build(){
            return new GuiceBundle<CT>(modules(), injector());
        }
    }

    public static class ParentedBuilder extends AbstractBuilder<ParentedBuilder> {
        private final Injector parentInjector;

        ParentedBuilder(Injector parentInjector) {
            this.parentInjector = parentInjector;
        }

        @Override
        protected ParentedBuilder self() { return this; }

        @Override
        protected Optional<Injector> injector() {
            return Optional.of(parentInjector);
        }
    }

    public static class StagedBuilder extends AbstractBuilder<StagedBuilder> {

        private final Stage stage;

        StagedBuilder(Stage stage) {
            this.stage = stage;
        }

        @Override
        protected StagedBuilder self() { return this; }

        @Override
        protected Optional<Injector> injector() {
            return Optional.of(Guice.createInjector(stage));
        }
    }

    public static class Builder extends AbstractBuilder<Builder> {
        protected Builder self() { return this; }

        public ParentedBuilder withParent(Injector parentInjector) {
            return new ParentedBuilder(parentInjector).withModules(modules());
        }

        public StagedBuilder withStage(Stage stage) {
            return new StagedBuilder(stage).withModules(modules());
        }

        @Override
        protected Optional<Injector> injector() {
            return Optional.absent();
        }
    }

}


text:
<?php
namespace Hyphper\Test;

class SettingsFrameTest extends FrameTest
{
    protected $serialized =  "\x00\x00\x24\x04\x01\x00\x00\x00\x00" .   // Frame header
                             "\x00\x01\x00\x00\x10\x00" .               // HEADER_TABLE_SIZE
                             "\x00\x02\x00\x00\x00\x00" .               // ENABLE_PUSH
                             "\x00\x03\x00\x00\x00\x64" .               // MAX_CONCURRENT_STREAMS
                             "\x00\x04\x00\x00\xFF\xFF" .               // INITIAL_WINDOW_SIZE
                             "\x00\x05\x00\x00\x40\x00" .               // MAX_FRAME_SIZE
                             "\x00\x06\x00\x00\xFF\xFF";                // MAX_HEADER_LIST_SIZE

    protected $settings = [
        \Hyphper\Frame\SettingsFrame::HEADER_TABLE_SIZE => 4096,
        \Hyphper\Frame\SettingsFrame::ENABLE_PUSH => 0,
        \Hyphper\Frame\SettingsFrame::MAX_CONCURRENT_STREAMS => 100,
        \Hyphper\Frame\SettingsFrame::INITIAL_WINDOW_SIZE => 65535,
        \Hyphper\Frame\SettingsFrame::MAX_FRAME_SIZE => 16384,
        \Hyphper\Frame\SettingsFrame::MAX_HEADER_LIST_SIZE => 65535
    ];

    public function testSettingsFrameHasOnlyOneFlag()
    {
        $f = new \Hyphper\Frame\SettingsFrame();
        $flags = $f->parseFlags(0xFF);
        $this->assertEquals([\Hyphper\Frame\Flag::ACK => \Hyphper\Frame\Flag::ACK], $flags->getIterator());
    }

    public function testSettingsFrameSerializesProperly()
    {
        $f = new \Hyphper\Frame\SettingsFrame();
        $f->parseFlags(0xFF);
        $f->setSettings($this->settings);

        $s = $f->serialize();
        $this->assertEquals($this->serialized, $s);
    }

    public function testSettingsFrameWithSettings()
    {
        $f = new \Hyphper\Frame\SettingsFrame(['settings' => $this->settings]);
        $this->assertEquals($this->settings, $f->getSettings());
    }

    public function testSettingsFrameWithoutSettings()
    {
        $f = new \Hyphper\Frame\SettingsFrame();
        $this->assertEquals([], $f->getSettings());
    }

    public function testSettingsFrameWithAck()
    {
        $f = new \Hyphper\Frame\SettingsFrame(['flags' => [\Hyphper\Frame\Flag::ACK => \Hyphper\Frame\Flag::ACK]]);
        $this->assertTrue($f->getFlags()->hasFlag(\Hyphper\Frame\Flag::ACK));
    }

    /**
     * @expectedException \Hyphper\Frame\Exception\InvalidFrameException
     * @expectedExceptionMessage Settings must be empty if ACK flag is set.
     */
    public function testSettingsFrameAckAndSettings()
    {
        new \Hyphper\Frame\SettingsFrame([
            'settings' => $this->settings,
            'flags' => [\Hyphper\Frame\Flag::ACK => \Hyphper\Frame\Flag::ACK]
        ]);
    }

    public function testSettingsFrameParsesProperly()
    {
        $f = $this->decodeFrame($this->serialized);

        $this->assertInstanceOf(\Hyphper\Frame\SettingsFrame::class, $f);
        $this->assertEquals([\Hyphper\Frame\Flag::ACK => \Hyphper\Frame\Flag::ACK], $f->getFlags()->getIterator());
        $this->assertEquals($this->settings, $f->getSettings());
        $this->assertEquals(36, $f->getBodyLen());
    }

    /**
     * @expectedException \Hyphper\Frame\Exception\InvalidFrameException
     */
    public function testSettingsFramesNeverHaveStreams()
    {
        new \Hyphper\Frame\SettingsFrame(['stream_id' => 1]);
    }

    /**
     * @expectedException \Hyphper\Frame\Exception\InvalidFrameException
     * @expectedExceptionMessage Invalid SETTINGS body
     */
    public function testShortSettingsFrameErrors()
    {
        $this->decodeFrame(substr($this->serialized, 0, -2));
    }
}


text:
angular.module('app', ['ngResource', 'gint.ui']);

angular.module('app').controller('mainController', [
  '$scope', function($scope) {

    $scope.testText = 'This is the gint-ui test-suite';
    $scope.startUpload = function() {
      console.log('broadcast start-file-upload');
      $scope.$broadcast("start-file-upload");
    };
  }
]);

angular.module('app').config([
  '$locationProvider', function($locationProvider) {
    $locationProvider.html5Mode(true).hashPrefix('!');
  }
]);

angular.bootstrap(document, ['app']);


text:
package org.pentaho.di.job.entries.getpop;

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Message;
import javax.mail.Flags.Flag;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import javax.mail.MessagingException;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.logging.LogLevel;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.job.Job;
import org.pentaho.di.utils.TestUtils;

public class JobEntryGetPOPTest {

  @Mock
  MailConnection mailConn;
  @Mock
  Job parentJob;
  @Mock
  Message message;

  JobEntryGetPOP entry = new JobEntryGetPOP();

  @Before
  public void before() throws IOException, KettleException, MessagingException {
    MockitoAnnotations.initMocks( this );

    Mockito.when( parentJob.getLogLevel() ).thenReturn( LogLevel.BASIC );
    entry.setParentJob( parentJob );
    entry.setSaveMessage( true );

    Mockito.when( message.getMessageNumber() ).thenReturn( 1 );
    Mockito.when( message.getContent() ).thenReturn( createMessageContent() );
    Mockito.when( mailConn.getMessage() ).thenReturn( message );

    Mockito.doNothing().when( mailConn ).openFolder( Mockito.anyBoolean() );
    Mockito.doNothing().when( mailConn ).openFolder( Mockito.anyString(), Mockito.anyBoolean() );

    Mockito.when( mailConn.getMessagesCount() ).thenReturn( 1 );
  }

  private Object createMessageContent() throws IOException, MessagingException {
    MimeMultipart content = new MimeMultipart();
    MimeBodyPart contentText = new MimeBodyPart();
    contentText.setText( "Hello World!" );
    content.addBodyPart( contentText );

    MimeBodyPart contentFile = new MimeBodyPart();
    File testFile = TestUtils.getInputFile( "GetPOP", "txt" );
    FileDataSource fds = new FileDataSource( testFile.getAbsolutePath() );
    contentFile.setDataHandler( new DataHandler( fds ) );
    contentFile.setFileName( testFile.getName() );
    content.addBodyPart( contentFile );

    return (Object) content;
  }

  /**
   * PDI-10942 - Job get emails JobEntry does not mark emails as 'read' when load emails content.
   *
   * Test that we always open remote folder in rw mode, and after email attachment is loaded email is marked as read.
   * Set for openFolder rw mode if this is pop3.
   *
   * @throws KettleException
   * @throws MessagingException
   */
  @Test
  public void testFetchOneFolderModePop3() throws KettleException, MessagingException {
    entry.fetchOneFolder( mailConn, true, "junitImapFolder", "junitRealOutputFolder", "junitTargetAttachmentFolder",
        "junitRealMoveToIMAPFolder", "junitRealFilenamePattern", 0, Mockito.mock( SimpleDateFormat.class ) );
    Mockito.verify( mailConn ).openFolder( true );
    Mockito.verify( message ).setFlag( Flag.SEEN, true );
  }

  /**
   * PDI-10942 - Job get emails JobEntry does not mark emails as 'read' when load emails content.
   *
   * Test that we always open remote folder in rw mode, and after email attachment is loaded email is marked as read.
   * protocol IMAP and default remote folder is overridden
   *
   * @throws KettleException
   * @throws MessagingException
   */
  @Test
  public void testFetchOneFolderModeIMAPWithNonDefFolder() throws KettleException, MessagingException {
    entry.fetchOneFolder( mailConn, false, "junitImapFolder", "junitRealOutputFolder", "junitTargetAttachmentFolder",
        "junitRealMoveToIMAPFolder", "junitRealFilenamePattern", 0, Mockito.mock( SimpleDateFormat.class ) );
    Mockito.verify( mailConn ).openFolder( "junitImapFolder", true );
    Mockito.verify( message ).setFlag( Flag.SEEN, true );
  }

  /**
   * PDI-10942 - Job get emails JobEntry does not mark emails as 'read' when load emails content.
   *
   * Test that we always open remote folder in rw mode, and after email attachment is loaded email is marked as read.
   * protocol IMAP and default remote folder is NOT overridden
   *
   * @throws KettleException
   * @throws MessagingException
   */
  @Test
  public void testFetchOneFolderModeIMAPWithIsDefFolder() throws KettleException, MessagingException {
    entry.fetchOneFolder( mailConn, false, null, "junitRealOutputFolder", "junitTargetAttachmentFolder",
            "junitRealMoveToIMAPFolder", "junitRealFilenamePattern", 0, Mockito.mock( SimpleDateFormat.class ) );
    Mockito.verify( mailConn ).openFolder( true );
    Mockito.verify( message ).setFlag( Flag.SEEN, true );
  }

  /**
   * PDI-11943 - Get Mail Job Entry: Attachments folder not created
   *
   * Test that the Attachments folder is created when the entry is
   * configured to save attachments and messages in the same folder
   *
   * @throws IOException
   */
  @Test
  public void testCreateSameAttachmentsFolder() throws IOException {
    File attachmentsDir = new File( TestUtils.createTempDir() );
    attachmentsDir.deleteOnExit();

    entry.setCreateLocalFolder( true );
    entry.setSaveAttachment( true );
    entry.setOutputDirectory( attachmentsDir.getAbsolutePath() );
    entry.setDifferentFolderForAttachment( false );

    String outputFolderName = "";
    String attachmentsFolderName = "";
    try {
      outputFolderName = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT );
      attachmentsFolderName = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS );
    } catch ( Exception e ) {
      fail( "Could not create folder " + e.getLocalizedMessage() );
    }

    assertTrue( "Output Folder should be a local path", !Const.isEmpty( outputFolderName ) );
    assertTrue( "Attachment Folder should be a local path", !Const.isEmpty( attachmentsFolderName ) );
    assertTrue( "Output and Attachment Folder should match", outputFolderName.equals( attachmentsFolderName ) );
  }

  /**
   * PDI-11943 - Get Mail Job Entry: Attachments folder not created
   *
   * Test that the Attachments folder is created when the entry is
   * configured to save attachments and messages in different folders
   *
   * @throws IOException
   */
  @Test
  public void testCreateDifferentAttachmentsFolder() throws IOException {
    File outputDir = new File( TestUtils.createTempDir() );
    File attachmentsDir = new File( TestUtils.createTempDir() );

    entry.setCreateLocalFolder( true );
    entry.setSaveAttachment( true );
    entry.setOutputDirectory( outputDir.getAbsolutePath() );
    entry.setDifferentFolderForAttachment( true );
    entry.setAttachmentFolder( attachmentsDir.getAbsolutePath() );

    String outputFolderName = "";
    String attachmentsFolderName = "";
    try {
      outputFolderName = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT );
      attachmentsFolderName = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS );
    } catch ( Exception e ) {
      fail( "Could not create folder: " + e.getLocalizedMessage() );
    }

    assertTrue( "Output Folder should be a local path", !Const.isEmpty( outputFolderName ) );
    assertTrue( "Attachment Folder should be a local path", !Const.isEmpty( attachmentsFolderName ) );
    assertFalse( "Output and Attachment Folder should not match", outputFolderName.equals( attachmentsFolderName ) );
  }

  /**
   * PDI-11943 - Get Mail Job Entry: Attachments folder not created
   *
   * Test that the Attachments folder is not created when the entry is
   * configured to not create folders
   *
   * @throws IOException
   */
  @Test
  public void testFolderIsNotCreatedWhenCreateFolderSettingIsDisabled() throws IOException {
    File outputDir = new File( TestUtils.createTempDir() );
    File attachmentsDir = new File( TestUtils.createTempDir() );
    // The folders already exist from TestUtils.  Delete them so they don't exist during the test
    outputDir.delete();
    attachmentsDir.delete();

    entry.setCreateLocalFolder( false );
    entry.setSaveAttachment( true );
    entry.setOutputDirectory( outputDir.getAbsolutePath() );
    entry.setDifferentFolderForAttachment( true );
    entry.setAttachmentFolder( attachmentsDir.getAbsolutePath() );

    try {
      entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT );
      fail( "A KettleException should have been thrown" );
    } catch ( Exception e ) {
      if ( e instanceof KettleException ) {
        assertTrue( "Output Folder should not be created",
          BaseMessages.getString( JobEntryGetPOP.class,
            "JobGetMailsFromPOP.Error.OutputFolderNotExist", outputDir.getAbsolutePath() ).equals(
              Const.trim( e.getMessage() ) ) );
      } else {
        fail( "Output Folder should not have been created: " + e.getLocalizedMessage() );
      }
    }
    try {
      entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS );
      fail( "A KettleException should have been thrown" );
    } catch ( Exception e ) {
      if ( e instanceof KettleException ) {
        assertTrue( "Output Folder should not be created",
          BaseMessages.getString( JobEntryGetPOP.class,
            "JobGetMailsFromPOP.Error.AttachmentFolderNotExist", attachmentsDir.getAbsolutePath() ).equals(
              Const.trim( e.getMessage() ) ) );
      } else {
        fail( "Attachments Folder should not have been created: " + e.getLocalizedMessage() );
      }
    }
  }

  /**
   * PDI-14305 - Get Mails (POP3/IMAP) Not substituting environment variables for target directories
   *
   * Test that environment variables are appropriately substituted when creating output and attachment folders
   */
  @Test
  public void testEnvVariablesAreSubstitutedForFolders() {
    // create variables and add them to the variable space
    String outputVariableName = "myOutputVar";
    String outputVariableValue = "myOutputFolder";
    String attachmentVariableName = "myAttachmentVar";
    String attachmentVariableValue = "myOutputFolder";
    entry.setVariable( outputVariableName, outputVariableValue );
    entry.setVariable( attachmentVariableName, attachmentVariableValue );

    // create temp directories for testing using variable value
    String tempDirBase = TestUtils.createTempDir();
    File outputDir = new File( tempDirBase, outputVariableValue );
    outputDir.mkdir();
    File attachmentDir = new File( tempDirBase, attachmentVariableValue );
    attachmentDir.mkdir();

    // set output and attachment folders to path with variable
    String outputDirWithVariable = tempDirBase + File.separator + "${" + outputVariableName + "}";
    String attachmentDirWithVariable = tempDirBase + File.separator + "${" + attachmentVariableName + "}";
    entry.setOutputDirectory( outputDirWithVariable );
    entry.setAttachmentFolder( attachmentDirWithVariable );

    // directly test environment substitute functions
    assertTrue( "Error in Direct substitute test for output directory",
            outputDir.toString().equals( entry.getRealOutputDirectory() ) );
    assertTrue( "Error in Direct substitute test for  attachment directory",
            attachmentDir.toString().equals( entry.getRealAttachmentFolder() ) );

    // test environment substitute for output dir via createOutputDirectory method
    try {
      String outputRes = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_OUTPUT );
      assertTrue( "Variables not working in createOutputDirectory: output directory",
              outputRes.equals(outputDir.toString() ) );
    } catch ( Exception e ) {
      fail( "Unexpected exception when calling createOutputDirectory for output directory" );

    }

    // test environment substitute for attachment dir via createOutputDirectory method
    try {
      String attachOutputRes = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS );
      assertTrue( "Variables not working in createOutputDirectory: attachment with options false",
              attachOutputRes.equals( outputDir.toString() ) );
      // set options that trigger alternate path for FOLDER_ATTACHMENTS option
      entry.setSaveAttachment( true );
      entry.setDifferentFolderForAttachment( true );
      String attachRes = entry.createOutputDirectory( JobEntryGetPOP.FOLDER_ATTACHMENTS );
      assertTrue( "Variables not working in createOutputDirectory: attachment with options true",
              attachRes.equals( outputDir.toString() ) );
    } catch ( Exception e ) {
      fail( "Unexpected exception when calling createOutputDirectory for attachment directory" );
    }
  }
}


text: LEARNER::base_learner* autolink_setup(vw& all);


text:
function formSubmit(id) {
  var dataString = "";
  var showMsj = false;
  var emailInvalid = false;

  $("#formContent" + id + " tr").each(function (idx, el) {
    if ($(this).attr("recordtype") != null) {
      var required = $(this).attr("required") == undefined ? 0 : 1;
      var recordname = String($(this).attr("recordname"));
      var recordtype = Number($(this).attr("recordtype"));
      var label = "";
      var borderReq = "2px solid #FF6262"; var borderNormal = "2px solid #E7B500";

      if (recordtype == 1 || recordtype == 2) { //text & hidden
        var control = $(this).find("input[type='text']");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        label = "txt_" + escape(String($(this).find("input[type='text']").attr("placeholder"))) + getRandom();
        dataString += "&" + label.replace(/ /g, "|") + "=" + $(this).find("input[type='text']").val();
      } else if (recordtype == 3) { //checkbox
        label = "chk_" + escape(String($(this).find("label").html())) + getRandom();
        if ($(this).find("input[type='checkbox']").attr("campaign") != undefined) {
          dataString += "&" + label.replace(/ /g, "|") + "=" + $(this).find("input[type='checkbox']").is(':checked') + "^" + String($(this).find("input[type='checkbox']").attr("campaign"));
        } else {
          dataString += "&" + label.replace(/ /g, "|") + "=" + $(this).find("input[type='checkbox']").is(':checked');
        }
      } else if (recordtype == 4) { //combo
        label = "ddl_" + escape(String($(this).find("label").html())) + getRandom();
        var obj = $(this).find("select option:selected");

        if (required == 1 && $(this).find("select").val() == "") { $(this).find("select").css("border", borderReq); showMsj = true; } else { $(this).find("select").css("border", borderNormal) }
        if (obj.attr("campaign") != undefined) {
          dataString += "&" + label.replace(/ /g, "|") + "=" + obj.val() + "^" + obj.attr("campaign");
        } else {
          dataString += "&" + label.replace(/ /g, "|") + "=" + obj.val();
        }

        if (obj.attr("mylist") != undefined) {
          dataString += "^" + obj.attr("mylist");
        }

      } else if (recordtype == 5) { //radio
        var control = $(this).find("input[type='radio']:checked");
        if (required == 1 && control.attr("id") == undefined) { $(this).find("input[type='radio']").css("border", borderReq); showMsj = true; } else { $(this).find("input[type='radio']").css("border", borderNormal) }
        label = "rbn_" + escape(String($(this).find("label").html())) + getRandom();
        if ($(this).find("input[type='radio']:checked").attr("id") != undefined) {
          if ($(this).find("input[type='radio']:checked").attr("campaign") != undefined) {
            dataString += "&" + label.replace(/ /g, "|") + "=" + $(this).find("input[type='radio']:checked").parent().find("label").html() + "^" + $(this).find("input[type='radio']:checked").attr("campaign");
          } else {
            dataString += "&" + label.replace(/ /g, "|") + "=" + $(this).find("input[type='radio']:checked").parent().find("label").html();
          }

          if (control.attr("mylist") != undefined) {
            dataString += "^" + obj.attr("mylist");
          }

        } else {
          dataString += "&" + label.replace(/ /g, "|") + "=";
        }
      } else if (recordtype == 6) { //textarea
        var control = $(this).find("textarea");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        label = "txt_" + escape(String($(this).find("textarea").attr("placeholder"))) + getRandom();
        dataString += "&" + label.replace(/ /g, "|") + "=" + $(this).find("textarea").val();
      } else if (recordtype == 7) { //phone number
        if (required == 1 && $(this).find("select").val() == "") { $(this).find("select").css("border", borderReq); showMsj = true; } else { $(this).find("select").css("border", borderNormal) }
        if (required == 1 && $(this).find(".sfx-phone").val() == "") { $(this).find(".sfx-phone").css("border", borderReq); showMsj = true; } else { $(this).find(".sfx-phone").css("border", borderNormal) }
        dataString += "&phonenumber=" + $(this).find("select").val() + "^" + $(this).find(".sfx-area").val() + "^" + $(this).find(".sfx-phone").val();
      } else if (recordtype == 8) { //address
        if (required == 1 && $(this).find("select").val() == "") { $(this).find("select").css("border", borderReq); showMsj = true; } else { $(this).find("select").css("border", borderNormal) }
        if (required == 1 && $(this).find("input[type='text']").val() == "") { $(this).find("input[type='text']").css("border", borderReq); showMsj = true; } else { $(this).find("input[type='text']").css("border", borderNormal) }
        dataString += "&address=" + $(this).find("select").val() + "^" + $(this).find("input[type='text']").val();
      } else if (recordtype == 9) { //city
        if (required == 1 && $(this).find("input[type='text']").val() == "") { $(this).find("input[type='text']").css("border", borderReq); showMsj = true; } else { $(this).find("input[type='text']").css("border", borderNormal) }
        dataString += "&city=" + $(this).find("input[type='text']").val();
      } else if (recordtype == 10) { //state/province/country
        if ($(this).find("input[type='radio']:checked").val() == 1) {
          if (required == 1 && $(this).find(".sfx-state").val() == "0") { $(this).find(".sfx-state").css("border", borderReq); showMsj = true; } else { $(this).find(".sfx-state").css("border", borderNormal) }
          dataString += "&state=" + $(this).find(".sfx-state").val();
        } else {
          if (required == 1 && $(this).find(".sfx-country").val() == "0") { $(this).find(".sfx-country").css("border", borderReq); showMsj = true; } else { $(this).find(".sfx-country").css("border", borderNormal) }
          if (required == 1 && $(this).find("input[type='text']").val() == "") { $(this).find("input[type='text']").css("border", borderReq); showMsj = true; } else { $(this).find("input[type='text']").css("border", borderNormal) }
          dataString += "&country=" + $(this).find(".sfx-country").val() + "&state=" + $(this).find("input[type='text']").val();
        }
      } else if (recordtype == 11) { //zip code
        if (required == 1 && $(this).find("input[type='text']").val() == "") { $(this).find("input[type='text']").css("border", borderReq); showMsj = true; } else { $(this).find("input[type='text']").css("border", borderNormal) }
        dataString += "&zipcode=" + $(this).find("input[type='text']").val();
      } else if (recordtype == 12) { //names
        if (required == 1 && $(this).find(".sfx-firstname").val() == "") { $(this).find(".sfx-firstname").css("border", borderReq); showMsj = true; } else { $(this).find(".sfx-firstname").css("border", borderNormal) }
        if (required == 1 && $(this).find(".sfx-lastname").val() == "") { $(this).find(".sfx-lastname").css("border", borderReq); showMsj = true; } else { $(this).find(".sfx-lastname").css("border", borderNormal) }
        dataString += "&firstname=" + $(this).find(".sfx-firstname").val() + "&lastname=" + $(this).find(".sfx-lastname").val();
      } else if (recordtype == 13) { //timezone
        var control = $(this).find("select");
        if (required == 1 && control.val() == "0") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&timezone=" + $(this).find("select").val();
      } else if (recordtype == 14) { //businessphone
        var control = $(this).find("input[type='text']");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&businessphone=" + $(this).find("input[type='text']").val();
      } else if (recordtype == 25) { //phone mobile
        var control = $(this).find(".sfx-phone");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&phonemobile=" + $(this).find(".sfx-area").val() + "^" + $(this).find(".sfx-phone").val();
      } else if (recordtype == 26) { //mobile provider
        var control = $(this).find("select");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&mobileprovider=" + $(this).find("select").val();
      } else if (recordtype == 27) { //company
        var control = $(this).find("input[type='text']");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&company=" + $(this).find("input[type='text']").val();
      } else if (recordtype == 28) { //phone bussines
        var control = $(this).find(".sfx-phone");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&phonebusiness=" + $(this).find(".sfx-area").val() + "^" + $(this).find(".sfx-phone").val();
      } else if (recordtype == 29) { //phone fax
        var control = $(this).find(".sfx-phone");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&phonefax=" + $(this).find(".sfx-area").val() + "^" + $(this).find(".sfx-phone").val();
      } else if (recordtype == 30) { //phone home
        var control = $(this).find(".sfx-phone");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&phonehome=" + $(this).find(".sfx-area").val() + "^" + $(this).find(".sfx-phone").val();
      } else if (recordtype == 31) { //phone other
        var control = $(this).find(".sfx-phone");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&phoneother=" + $(this).find(".sfx-area").val() + "^" + $(this).find(".sfx-phone").val();
      } else if (recordtype == 32) { //job title
        var control = $(this).find("input[type='text']");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        dataString += "&jobtitle=" + $(this).find("input[type='text']").val();
      } else if (recordtype == 0) { //email
        var control = $(this).find("input[type='text']");
        if (required == 1 && control.val() == "") { control.css("border", borderReq); showMsj = true; } else { control.css("border", borderNormal) }
        var email = $(this).find("input[type='text']").val();
        if (isValidEmail(email)) {
          dataString += "&email=" + email;
        } else {
          control.css("border", borderReq);
          emailInvalid = true;
        }
      } else if (recordtype == 34) { //name only
        if (required == 1 && $(this).find(".sfx-firstname").val() == "") { $(this).find(".sfx-firstname").css("border", borderReq); showMsj = true; } else { $(this).find(".sfx-firstname").css("border", borderNormal) }
        dataString += "&firstname=" + $(this).find(".sfx-firstname").val() + "&lastname=Unknown";
      }
    }
  });

  dataString = dataString.substring(1, dataString.length);

  $("#form" + id + " #__data").val(dataString);

  if (showMsj) {
    $("#form" + id).find(".sfx-required").show();
    $("#form" + id).find(".sfx-required").find("TD").text("Please Fill Required Fields");
    $("#form" + id).find(".sfx-privacy").parent().hide();
  } else if (emailInvalid) {
    $("#form" + id).find(".sfx-required").show();
    $("#form" + id).find(".sfx-required").find("TD").text("Email is invalid");
    $("#form" + id).find(".sfx-privacy").parent().hide();
  } else {
//    alert(dataString);
//    return;

    $("#form" + id).submit();
  }
}

function changeTypeState(id, opt) {
  var obj = $("#divCustomField" + id)
  if (opt == 1) {
    obj.find(".sfx-country").css("display", "none");
    obj.find("input[type='text']").css("display", "none");
  } else {
    obj.find(".sfx-country").css("display", "block");
    obj.find("input[type='text']").css("display", "block");
  }
}

function isValidEmail(email) {
  var emailReg = /^([\da-z_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
  if (!emailReg.test(email.toLowerCase())) {
    return false;
  } else {
    return true;
  }
}
function getRandom() {
  return Math.floor((Math.random() * 9999) + 1);
}
$(function () {
  var delay = new Number($("#__delay").val())

  if ($("#__formtype").val() == "3") {
    window.setTimeout(function () {
      $(".fancybox-link").fancybox(
      {
        openEffect: "none",
        minHeight: 300,
        helpers: {
          overlay: null
        }
      }).trigger("click");

    }, delay * 1000)
  } else if ($("#__formtype").val() == "6") {
    var effect = $("#__formtypehover").val()

    if (effect == "1") {
      window.setTimeout(function () {
        $(".fancybox-link").fancybox({ openEffect: "none", minHeight: 300 }).trigger("click");
      }, delay * 1000)
    } else if (effect == "2") {
      window.setTimeout(function () {
        $(".fancybox-link").fancybox({ openEffect: "fade", minHeight: 300 }).trigger("click");
      }, delay * 1000)
    } else if (effect == "3") {
      window.setTimeout(function () {
        $(".fancybox-link").fancybox({ openMethod: "dropIn", openEffect: "up", openSpeed: 1000, minHeight: 300 }).trigger("click");
      }, delay * 1000)
    } else if (effect == "4") {
      window.setTimeout(function () {
        $(".fancybox-link").fancybox({ openMethod: "dropIn", openEffect: "down", openSpeed: 1000, minHeight: 300 }).trigger("click");
      }, delay * 1000)
    } else if (effect == "5") {
      window.setTimeout(function () {
        $(".fancybox-link").fancybox({ openMethod: "dropIn", openEffect: "left", openSpeed: 1000, minHeight: 300 }).trigger("click");
      }, delay * 1000)
    } else if (effect == "6") {
      window.setTimeout(function () {
        $(".fancybox-link").fancybox({ openMethod: "dropIn", openEffect: "right", openSpeed: 1000, minHeight: 300 }).trigger("click");
      }, delay * 1000)
    }

  }
});


text:
<div id="test" onClick={func} class={variable}>
  1
</div>;


text:
<?php

namespace Iyzipay\Request\Subscription;

use Iyzipay\JsonBuilder;
use Iyzipay\Request;

class SubscriptionUpdatePricingPlanRequest extends Request
{
    private $name;
    private $pricingPlanReferenceCode;
    private $trialPeriodDays;

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getPricingPlanReferenceCode()
    {
        return $this->pricingPlanReferenceCode;
    }

    public function setPricingPlanReferenceCode($pricingPlanReferenceCode)
    {
        $this->pricingPlanReferenceCode = $pricingPlanReferenceCode;
    }

    public function getTrialPeriodDays ()
    {
        return $this->trialPeriodDays ;
    }

    public function setTrialPeriodDays ($trialPeriodDays)
    {
        $this->trialPeriodDays = $trialPeriodDays;
    }

    public function getJsonObject()
    {
        return JsonBuilder::fromJsonObject(parent::getJsonObject())
            ->add("locale", $this->getLocale())
            ->add("conversationId", $this->getConversationId())
            ->add("pricingPlanReferenceCode", $this->getPricingPlanReferenceCode())
            ->add("name", $this->getName())
            ->add("trialPeriodDays", $this->getTrialPeriodDays())
            ->getObject();
    }
}


text:
package org.dcm4chee.xds.repository.mbean;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamSource;

import junit.framework.TestCase;

import org.dcm4che2.data.Tag;
import org.dcm4che2.net.Association;
import org.dcm4che2.net.DimseRSP;
import org.dcm4chee.xds.repository.XDSDocumentWriter;
import org.dcm4chee.xds.repository.XDSDocumentWriterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

public class DocumentSendTest extends TestCase {

    private static final XDSDocumentWriterFactory fac =  XDSDocumentWriterFactory.getInstance();

	private DocumentSendCfg dcmCfg = new DocumentSendCfg();
	private StgCmtSCU stgCmtScu = new StgCmtSCU(dcmCfg);

    private static Boolean skipRemoteTests;

    private static Logger log = LoggerFactory.getLogger(DocumentSendTest.class);

    public static void main(String[] args) {
        junit.textui.TestRunner.run(DocumentSendTest.class);
    }

    public DocumentSendTest(String arg0) {
        super(arg0);
    }

    public void setUp() throws IOException {
    	Store2Dcm.getMime2CuidMap().put("default", Store2Dcm.ENCAPSULATED_DOCUMENT_STORAGE_CUID);
    	if ( skipRemoteTests == null ) {
	    	skipRemoteTests = new Boolean( !checkStoreSCP() );
	    	if ( ! skipRemoteTests.booleanValue() ) {
	    		setUpTestFile("large.txt", 10240);//10MB
	    	} else {
	    		log.warn("DocumentSend Tests are disabled! Check your configuration to enable this tests!");
	    		promptBasicDicomConfig();
	    	}
    	}
    }

    private boolean checkStoreSCP() {
    	DocumentSend send = null;
        try {
        	send = getDocumentSend();
            Association assoc = send.open();
            DimseRSP rsp = assoc.cecho();
            rsp.next();
            int status = rsp.getCommand().getInt(Tag.Status);
            log.info("CECHO status:"+status);
            return status == 0;
        } catch (Exception e) {
            log.info("ERROR: Failed to establish association! Skip DocumentSend Tests!", e);
            return false;
        } finally {
        	if ( send != null )
        		send.close();
        }
	}

	private void setUpTestFile(String fn, int sizeInKB) throws IOException {
    	File dir = locateFile("test.pdf").getParentFile();// to get directory
    	File f = new File(dir, fn);
		if (!f.exists()) {
			String buf = "abcdefghijklmnopqrstuvwxyz+ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789";//64 chars
			BufferedWriter bw = new BufferedWriter(new FileWriter(f));
			for ( int i = 0, len=sizeInKB << 4  ; i < len ; i++ ) { //64*16=1KB
				bw.write(buf);
			}
			bw.close();
		}
	}

	public final void testSendDocumentSimple() throws IOException, ParserConfigurationException, SAXException,TransformerException, NoSuchAlgorithmException {
    	if ( skipRemoteTests.booleanValue() ) return;
        File docFile = locateFile("test.doc");
        File submFile = locateFile("test1_subm.xml");
        File xslFile = locateFile("testsend_subm.xsl");
        FileInputStream submStream = new FileInputStream( submFile);

        sendDocument(null, docFile, xslFile, submStream, false);
    }
    public final void testSendDocumentAndStgCmt() throws IOException, ParserConfigurationException, SAXException,TransformerException, NoSuchAlgorithmException {
    	if ( skipRemoteTests.booleanValue() ) return;
        File docFile = locateFile("test.doc");
        File submFile = locateFile("test1_subm.xml");
        File xslFile = locateFile("testsend_subm.xsl");
        FileInputStream submStream = new FileInputStream( submFile);

        sendDocument(null, docFile, xslFile, submStream, true);
    }
    public final void testSendDocumentPDF() throws IOException, ParserConfigurationException, SAXException,TransformerException, NoSuchAlgorithmException {
    	if ( skipRemoteTests.booleanValue() ) return;
        File docFile = locateFile("test.pdf");
        File submFile = locateFile("pdf_subm.xml");
        File xslFile = locateFile("testsend_subm.xsl");
        FileInputStream submStream = new FileInputStream( submFile);

        sendDocument(null, docFile, xslFile, submStream, false);
    }

    public final void testSendDocumentLarge() throws IOException, ParserConfigurationException, SAXException,TransformerException, NoSuchAlgorithmException {
    	if ( skipRemoteTests.booleanValue() ) return;
        File docFile = locateFile("large.txt");
        File submFile = locateFile("test1_subm.xml");
        File xslFile = locateFile("testsend_subm.xsl");
        FileInputStream submStream = new FileInputStream( submFile);

        sendDocument(null, docFile, xslFile, submStream, false);
    }

	private void sendDocument(File xmlFile, File docFile, File xslFile,
			FileInputStream submStream, boolean stgCmt) throws FileNotFoundException,
			ParserConfigurationException, SAXException, IOException,
			TransformerException {
		DocumentSend send = null;
		try {
	        if ( stgCmt ) {
	        	stgCmtScu.setRequestStgCmt(true);
	        	stgCmtScu.setStgCmtSynchronized(true);
	        	stgCmtScu.setStgCmtTimeout(10000);
	        }
			XDSDocumentWriter docWriter = fac.getDocumentWriter( docFile );
	        Store2Dcm store = new Store2Dcm(xmlFile, docWriter, new StreamSource(submStream), xslFile);
	        send = getDocumentSend();
	        byte[] hash = send.sendDocument(store);
	        if ( hash != null && stgCmtScu != null && stgCmtScu.isRequestStgCmt() ) {
	        	log.debug("+++ call startStgCmtListener +++");
	        	stgCmtScu.startStgCmtListener();
	        	log.debug("+++ after call startStgCmtListener +++");
	        	String tuid = stgCmtScu.requestStgCmt(send.getActiveAssociation(), store.getSOPClassUID(), store.getSOPInstanceUID());
	        	log.info("StgCmt TransactionUID:"+tuid);
	            if (tuid != null) {
	            	if ( stgCmtScu.isStgCmtSynchronized() ) {
	                    log.info("StgCmt Synchronized! Waiting for Storage Commitment Result..");
	                    try {
	                        if ( stgCmtScu.waitForStgCmtResult(store) != null ) {
		                        log.debug("+++ store after wait:"+store);
	                        } else {
	                			log.warn("Wait for StgCmt Response timed out! Check your configuration!");
	                			log.warn("This failure will be ignored!!! (commit the storage anyway)");
	                			promptBasicDicomConfig();
	                			store.setCommitted(true);
	                        }
	                        if (!store.isCommitted()) {
	                        	hash = null;
	                        }
	                    } catch (InterruptedException e) {
	                        log.error("ERROR:" + e.getMessage());
	                    }
	            	}
	            } else if (stgCmtScu.isStgCmtSynchronized() ) {
	            	hash = null; //StgCmt request failed --> error
	            } else {
	            	//retry
	            }
	        	stgCmtScu.stopStgCmtListener();
	        }
	        assertNotNull("Send Document failed!",hash);
		} finally {
			if ( send != null )
				send.close();
		}
	}

	private DocumentSend getDocumentSend() throws IOException {
		DocumentSend docsender = new DocumentSend(dcmCfg);
		dcmCfg.setCallingAET("DOC_SEND_TEST");
		dcmCfg.setCalledAET("DCM4CHEE");
		dcmCfg.setRemoteHost("localhost");
		dcmCfg.setRemotePort(11112);
		dcmCfg.setLocalHost("localhost");
		dcmCfg.setLocalPort(11114);
		return docsender;
	}

    private static File locateFile(String name) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        return new File(cl.getResource(name).toString().substring(5));
    }

    private void promptBasicDicomConfig() {
    	log.info("Dicom Configuration:");
		log.info("StoreSCP and StgCmtSCP AET:"+this.dcmCfg.getCalledAET()+"( host:"+dcmCfg.getRemoteHost()+" port:"+dcmCfg.getRemotePort()+")");
		log.info("StgCmtSCU AET:"+this.dcmCfg.getCallingAET()+"( host:"+dcmCfg.getLocalHost()+" port:"+dcmCfg.getLocalPort()+")");
    }
}


text:
Welcome to the Arena Serving Job Guide! This guide covers how to use the ``arena cli`` to manage the serving job. This page outlines the most common situations and questions that bring readers to this section.

## Who should use this guide?

If you want to use arena to manage serving jobs, this guide is for you. we have included detailed usages for managing serving jobs.

## Manage The Serving Jobs

* How to [list all serving jobs](common/list_jobs.md).
* How to [attach the serving job](common/attach_job.md).
* How to [get the serving job details](common/get_job.md).
* How to [get the serving job logs](common/get_job_logs.md).
* How to [delete the serving jobs](common/delete_jobs.md).

## Tensorflow Serving Job Guide

* I want to [submit a tensorflow serving job with enabled istio](tfserving/serving.md).
* I want to [submit a tensorflow serving job with enabled gpushare mode](tfserving/gpushare.md).
* I want to [submit a tensorflow serving job which uses gpus](tfserving/gpu.md).
* I want to [submit a tensorflow serving job with prometheus](tfserving/monitor.md).
* I want to [update a tensorflow serving job after deployed](tfserving/update-serving.md).

## Custom Serving Job Guide

* I want to [submit a custom serving job which uses gpus](customserving/gpu.md).
* I want to [update a custom serving job after deployed](customserving/update-serving.md).

## KFServing Job Guide

* I want to [submit a kfserving job whose type is custom](kfserving/custom.md).

## Seldon Core Serving Job Guide

* I want to [submit a seldon core job with pre-packaged model server](seldon-core/pre-packaged-model-server.md).

## Nvidia Triton Serving Job Guide

* I want to [submit a nvidia triton serving job which use gpus](triton/serving.md).
* I want to [update a nvidia triton serving job after deployed](triton/update-serving.md).


text:
using System.Text;

namespace com.google.zxing.client.result
{

	/// <summary>
	/// @author Sean Owen
	/// </summary>
	public sealed class TelParsedResult : ParsedResult
	{

	  private readonly string number;
	  private readonly string telURI;
	  private readonly string title;

	  public TelParsedResult(string number, string telURI, string title) : base(ParsedResultType.TEL)
	  {
		this.number = number;
		this.telURI = telURI;
		this.title = title;
	  }

	  public string Number
	  {
		  get
		  {
			return number;
		  }
	  }

	  public string TelURI
	  {
		  get
		  {
			return telURI;
		  }
	  }

	  public string Title
	  {
		  get
		  {
			return title;
		  }
	  }

	  public override string DisplayResult
	  {
		  get
		  {
			StringBuilder result = new StringBuilder(20);
			maybeAppend(number, result);
			maybeAppend(title, result);
			return result.ToString();
		  }
	  }

	}
}


text:
require 'coveralls'

Coveralls.wear!

require File.join(File.dirname(__FILE__), '..', 'ip.rb')

require 'sinatra'
require 'rack/test'

set :environment, :test
set :run, false
set :raise_errors, true
set :logging, false

def app
  Sinatra::Application
end

RSpec.configure do |config|
  config.include Rack::Test::Methods
end


text:
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.

#ifndef PXS_ARTICULATION_HELPER_H
#define PXS_ARTICULATION_HELPER_H

#include "PxcArticulation.h"
#include "PxcSpatial.h"

namespace physx
{

struct PxcArticulationSolverDesc;
struct PxcSolverConstraintDesc;
struct PxsBodyCore;
struct PxsArticulationJointCore;

class PxcConstraintBlockStream;
class PxcRigidBody;
class PxsConstraintBlockManager;

struct PxcSolverConstraint1DExt;

namespace Cm
{
	class EventProfiler;
}

struct PxcArticulationJointTransforms
{
	PxTransform		cA2w;				// joint parent frame in world space
	PxTransform		cB2w;				// joint child frame in world space
	PxTransform		cB2cA;				// joint relative pose in world space
};

class PxcArticulationHelper
{
public:
	static PxU32	computeUnconstrainedVelocities(const PxcArticulationSolverDesc& desc,
												   PxReal dt,
												   PxcConstraintBlockStream& stream,
												   PxcSolverConstraintDesc* constraintDesc,
												   PxU32& acCount,
												   Cm::EventProfiler& profiler,
												   PxsConstraintBlockManager& constraintBlockManager);

	static void		updateBodies(const PxcArticulationSolverDesc& desc,
							 	 PxReal dt);

	static void		getImpulseResponse(const PxcFsData& matrix,
									   PxU32 linkID,
									   const PxcSIMDSpatial& impulse,
									   PxcSIMDSpatial& deltaV);

	static PX_FORCE_INLINE
			void	getImpulseResponse(const PxcFsData& matrix,
									   PxU32 linkID,
									   const Cm::SpatialVector& impulse,
									   Cm::SpatialVector& deltaV)
	{
		getImpulseResponse(matrix, linkID, reinterpret_cast<const PxcSIMDSpatial&>(impulse), reinterpret_cast<PxcSIMDSpatial&>(deltaV));
	}

	static void		getImpulseSelfResponse(const PxcFsData& matrix,
										   PxU32 linkID0,
										   const PxcSIMDSpatial& impulse0,
										   PxcSIMDSpatial& deltaV0,
										   PxU32 linkID1,
										   const PxcSIMDSpatial& impulse1,
										   PxcSIMDSpatial& deltaV1);

	static void		flushVelocity(PxcFsData& matrix);

	static void		saveVelocity(const PxcArticulationSolverDesc& m);

	static PX_FORCE_INLINE
			PxcSIMDSpatial getVelocityFast(const PxcFsData& matrix,PxU32 linkID)
	{
		return getVelocity(matrix)[linkID];
	}

	static void		getDataSizes(PxU32 linkCount, PxU32 &solverDataSize, PxU32& totalSize, PxU32& scratchSize);

	static void		initializeDriveCache(PxcFsData &data,
										 PxU16 linkCount,
										 const PxsArticulationLink* links,
										 PxReal compliance,
										 PxU32 iterations,
										 char* scratchMemory,
										 PxU32 scratchMemorySize);

	static void		applyImpulses(const PxcFsData& matrix,
								  PxcSIMDSpatial* Z,
								  PxcSIMDSpatial* V);

private:
	static PxU32	getLtbDataSize(PxU32 linkCount);
	static PxU32	getFsDataSize(PxU32 linkCount);

	static void		prepareDataBlock(PxcFsData& fsData,
									 const PxsArticulationLink* links,
									 PxU16 linkCount,
									 PxTransform* poses,
								 	 PxcFsInertia *baseInertia,
									 PxcArticulationJointTransforms* jointTransforms,
									 PxU32 expectedSize);

	static void		setInertia(PxcFsInertia& inertia,
							   const PxsBodyCore& body,
							   const PxTransform& pose);

	static void		setJointTransforms(PxcArticulationJointTransforms& transforms,
									   const PxTransform& parentPose,
									   const PxTransform& childPose,
									   const PxsArticulationJointCore& joint);

	static void		prepareLtbMatrix(PxcFsData& fsData,
									 const PxcFsInertia* baseInertia,
									 const PxTransform* poses,
									 const PxcArticulationJointTransforms* jointTransforms,
									 PxReal recipDt);

	static void		prepareFsData(PxcFsData& fsData,
								  const PxsArticulationLink* links);

	static PX_FORCE_INLINE PxReal getResistance(PxReal compliance);

	static void		createHardLimit(const PxcFsData& fsData,
									const PxsArticulationLink* links,
									PxU32 linkIndex,
									PxcSolverConstraint1DExt& s,
									const PxVec3& axis,
									PxReal err,
									PxReal recipDt);

	static void		createTangentialSpring(const PxcFsData& fsData,
										   const PxsArticulationLink* links,
										   PxU32 linkIndex,
										   PxcSolverConstraint1DExt& s,
										   const PxVec3& axis,
										   PxReal stiffness,
										   PxReal damping,
										   PxReal dt);

	static PxU32 setupSolverConstraints(PxcFsData& fsData, PxU32 solverDataSize,
													PxcConstraintBlockStream& stream,
													PxcSolverConstraintDesc* constraintDesc,
													const PxsArticulationLink* links,
													const PxcArticulationJointTransforms* jointTransforms,
													PxReal dt,
													PxU32& acCount,
													PxsConstraintBlockManager& constraintBlockManager);

	static void		computeJointDrives(PxcFsData& fsData,
									   Vec3V* drives,
									   const PxsArticulationLink* links,
									   const PxTransform* poses,
									   const PxcArticulationJointTransforms* transforms,
									   const Mat33V* loads,
									   PxReal dt);

};

}

#endif


text:
  <meta charset="utf-8">
  <title>Mocha Tests</title>
  <link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
  <link rel="stylesheet" href="../lib/client/vendor/bootstrap.css/bootstrap.min.css" />


text:
gSystem->Load("libSTAT");
TStatToolkit stat;
Int_t npoints;
Double_t chi2;
TVectorD vec;
TMatrixD mat;

TObjArray * array = AliTPCCalibViewerGUI::ShowGUI("laserTree.root");
AliTPCCalibViewerGUI * viewer = (AliTPCCalibViewerGUI*)array->At(0);
TTree * tree = viewer->GetViewer()->GetTree();
TFile fp("/data/calib/CalibTreePulser_run33834_Cside.root");
tree->AddFriend(treePulser,"P.");

tree->SetAlias("dt","(sector%36>30)*2+(sector<36)*0.3");
tree->SetAlias("T","T0_100_220.fElements-P..StandardTime0.fElements");
tree->SetAlias("Tm","T0_100_220_Median.fElements");
tree->SetAlias("Q","Q_100_220.fElements");
tree->SetAlias("Qm","Q_100_220_Median.fElements");

tree->SetAlias("Qcut","abs(Q/Qm-2)<1.4&&Q>6&&Q<200");
tree->SetAlias("Tcut","abs(T-Tm)<2");

TString strSector="";
{
  for (Int_t isec=54;isec<71;isec+=1){
    if (isec!=64) {
      strSector+="(sector==";
      strSector+=isec;
      strSector+=")++";
      strSector+="(lx.fElements-195.)*(sector==";
      strSector+=isec;
      strSector+=")++";
      strSector+="((lx.fElements-195)^2)*(sector==";
      strSector+=isec;
      strSector+=")++";
    }
  }
}

TCut cutA="Tcut&&Qcut&&sector%36>17";

TString *strFitG =stat.FitPlane(tree,"T+dt","gx.fElements++gy.fElements",cutA,chi2,npoints,vec,mat);

TString *strFitGL =stat.FitPlane(tree,"T+dt","lx.fElements++ly.fElements++gx.fElements++gy.fElements",cutA,chi2,npoints,vec,mat);

TString *strFitGL2 =stat.FitPlane(tree,"T+dt","lx.fElements++ly.fElements++gx.fElements++gy.fElements++lx.fElements^2++ly.fElements^2",cutA,chi2,npoints,vec,mat);

TString *strFitGLA =stat.FitPlane(tree,"T+dt",strSector+"lx.fElements++ly.fElements++gx.fElements++gy.fElements++lx.fElements^2++ly.fElements^2",cutA,chi2,npoints,vec,mat);

tree->SetAlias("tfitG",strFitG->Data())
tree->SetAlias("tfitGL",strFitGL->Data())
tree->SetAlias("tfitGL2",strFitGL2->Data())
tree->SetAlias("tfitGLA",strFitGLA->Data())


text:
package org.sagebionetworks.repo.manager.discussion;

import static org.junit.Assert.*;

import java.util.UUID;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sagebionetworks.repo.manager.NodeManager;
import org.sagebionetworks.repo.manager.UserManager;
import org.sagebionetworks.repo.model.EntityType;
import org.sagebionetworks.repo.model.Node;
import org.sagebionetworks.repo.model.UserInfo;
import org.sagebionetworks.repo.model.AuthorizationConstants.BOOTSTRAP_PRINCIPAL;
import org.sagebionetworks.repo.model.auth.NewUser;
import org.sagebionetworks.repo.model.dbo.persistence.DBOCredential;
import org.sagebionetworks.repo.model.dbo.persistence.DBOTermsOfUseAgreement;
import org.sagebionetworks.repo.model.discussion.Forum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:test-context.xml" })
public class ForumManagerImplAutowiredTest {
	@Autowired
	public NodeManager nodeManager;
	@Autowired
	public UserManager userManager;
	@Autowired
	public ForumManager forumManager;

	private UserInfo adminUserInfo;
	private UserInfo userInfo;
	private String projectId;

	@Before
	public void before() {
		DBOTermsOfUseAgreement tou = new DBOTermsOfUseAgreement();
		tou.setAgreesToTermsOfUse(Boolean.TRUE);

		adminUserInfo = userManager.getUserInfo(BOOTSTRAP_PRINCIPAL.THE_ADMIN_USER.getPrincipalId());
		UserInfo.validateUserInfo(adminUserInfo);

		DBOCredential cred = new DBOCredential();
		cred.setSecretKey("");
		NewUser nu = new NewUser();
		nu.setEmail(UUID.randomUUID().toString() + "@test.com");
		nu.setUserName(UUID.randomUUID().toString());
		userInfo = userManager.createUser(adminUserInfo, nu, cred, tou);
		userInfo.getGroups().add(BOOTSTRAP_PRINCIPAL.CERTIFIED_USERS.getPrincipalId());

		Node newNode = new Node();
		newNode.setName("project");
		newNode.setNodeType(EntityType.project);
		projectId = nodeManager.createNewNode(newNode, userInfo);
	}

	@After
	public void cleanup() {
		nodeManager.delete(adminUserInfo, projectId);
		userManager.deletePrincipal(adminUserInfo, userInfo.getId());
	}

	@Test
	public void testGetNonExistingForum() {
		Forum dto = forumManager.getForumByProjectId(userInfo, projectId);
		assertNotNull(dto);
		assertNotNull(dto.getId());
		assertEquals(dto.getProjectId(), projectId);
	}

}


text:
    <java-class-file name="D:\Experiments\Analisi di Sopravvivenza\Progetto16715\ProgettiDaAnalizzare\jhotdraw\JHotDraw 7.4.1\JHotDraw 7.4.1\Source\jhotdraw7\src\main\java\org\jhotdraw\draw\tool\Tool.java">
        <package-decl name="org.jhotdraw.draw.tool"/>
            <method name="activate" visibility="public">
            </method>
            <method name="deactivate" visibility="public">
            </method>
            <method name="addToolListener" visibility="protected">
            </method>
            <method name="removeToolListener" visibility="protected">
            </method>
            <method name="draw" visibility="protected">
            </method>
            <method name="editDelete" visibility="public">
            </method>
            <method name="editCut" visibility="public">
            </method>
            <method name="editCopy" visibility="public">
            </method>
            <method name="editDuplicate" visibility="public">
            </method>
            <method name="editPaste" visibility="public">
            </method>
            <method name="getToolTipText" visibility="public">
            </method>
            <method name="supportsHandleInteraction" visibility="public">
            </method>
    </java-class-file>


text:
package com.twitter.util

import com.fasterxml.jackson.databind.MappingJsonFactory
import org.apache.thrift.TBase
import org.apache.thrift.protocol._
import org.apache.thrift.transport.TIOStreamTransport
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, InputStream}

trait ThriftSerializer extends StringEncoder {
  def protocolFactory: TProtocolFactory

  def toBytes(obj: TBase[_, _], bufSize: Int): Array[Byte] = {
    val baos = new ByteArrayOutputStream(bufSize)
    obj.write(protocolFactory.getProtocol(new TIOStreamTransport(baos)))
    baos.toByteArray
  }

  def toBytes(obj: TBase[_, _]): Array[Byte] = {
    toBytes(obj, 32) // default initial size of ByteArrayOutputStream
  }

  def fromInputStream(obj: TBase[_, _], stream: InputStream): Unit =
    obj.read(protocolFactory.getProtocol(new TIOStreamTransport(stream)))

  def fromBytes(obj: TBase[_, _], bytes: Array[Byte]): Unit =
    fromInputStream(obj, new ByteArrayInputStream(bytes))

  def toString(obj: TBase[_, _], bufSize: Int): String = encode(toBytes(obj, bufSize))

  def toString(obj: TBase[_, _]): String = encode(toBytes(obj))

  def fromString(obj: TBase[_, _], str: String): Unit = fromBytes(obj, decode(str))
}

/**
 * A thread-safe [[ThriftSerializer]] that uses `TSimpleJSONProtocol`.
 */
class JsonThriftSerializer extends ThriftSerializer {
  override def protocolFactory: TProtocolFactory = new TSimpleJSONProtocol.Factory

  override def fromBytes(obj: TBase[_, _], bytes: Array[Byte]): Unit = {
    val binarySerializer = new BinaryThriftSerializer
    val newObj = new MappingJsonFactory().createParser(bytes).readValueAs(obj.getClass)
    binarySerializer.fromBytes(obj, binarySerializer.toBytes(newObj.asInstanceOf[TBase[_, _]]))
  }
}

/**
 * A thread-safe [[ThriftSerializer]] that uses `TBinaryProtocol`.
 *
 * @note an implementation using `com.twitter.finagle.thrift.Protocols.binaryFactory`
 *       instead of this is recommended.
 */
class BinaryThriftSerializer extends ThriftSerializer with Base64StringEncoder {
  override def protocolFactory: TProtocolFactory = new TBinaryProtocol.Factory
}

/**
 * A thread-safe [[ThriftSerializer]] that uses `TCompactProtocol`.
 */
class CompactThriftSerializer extends ThriftSerializer with Base64StringEncoder {
  override def protocolFactory: TProtocolFactory = new TCompactProtocol.Factory
}


text:
NSString const *onePasswordExtensionEnabledKey = @"au.com.timoliver.webviewcontroller.onepassword.enabled";
NSString const *onePasswordExtensionButtonKey = @"au.com.timoliver.webviewcontroller.onepassword.button";

@implementation TOWebViewController (OnePassword)

#pragma mark - Accessor Overrides -
- (void)setShowOnePasswordButton:(BOOL)showOnePasswordButton
{
    if (self.showOnePasswordButton == showOnePasswordButton)
        return;

#if TARGET_IPHONE_SIMULATOR
#else
    //Don't bother trying if 1Password isn't on the system
    if ([[OnePasswordExtension sharedExtension] isAppExtensionAvailable] == NO)
        return;
#endif

    objc_setAssociatedObject(self, &onePasswordExtensionEnabledKey, @(showOnePasswordButton), OBJC_ASSOCIATION_ASSIGN);

    if (showOnePasswordButton) {
        //Create the bar button item
        if (self.onePasswordButton == nil) {
            UIImage *onePasswordImage = [UIImage imageNamed:@"onepassword-navbar.png"];
            if (onePasswordImage == nil) {
                NSBundle *onepasswordExtensionResourcesBundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[OnePasswordExtension class]] pathForResource:@"OnePasswordExtensionResources" ofType:@"bundle"]];
                onePasswordImage = [UIImage imageNamed:@"onepassword-navbar.png" inBundle:onepasswordExtensionResourcesBundle compatibleWithTraitCollection:nil];
            }

            UIBarButtonItem *onePasswordButton = [[UIBarButtonItem alloc] initWithImage:onePasswordImage
                                                                                style:UIBarButtonItemStylePlain
                                                                                target:self
                                                                                action:@selector(onePasswordButtonTapped:)];

            objc_setAssociatedObject(self, &onePasswordExtensionButtonKey, onePasswordButton, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
        }

        //Add or insert into our existing application bar buttons
        if (self.applicationBarButtonItems == nil) {
            self.applicationBarButtonItems = @[self.onePasswordButton];
        }
        else {
            NSMutableArray *buttons = [self.applicationBarButtonItems mutableCopy];
            [buttons addObject:self.applicationBarButtonItems];
            self.applicationBarButtonItems = [NSArray arrayWithArray:buttons];
        }
    }
    else {
        //remove it from application bar buttons
        NSMutableArray *buttons = [self.applicationBarButtonItems mutableCopy];
        [buttons removeObject:self.onePasswordButton];
        self.applicationBarButtonItems = [NSArray arrayWithArray:buttons];

        objc_setAssociatedObject(self, &onePasswordExtensionButtonKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
}

- (BOOL)showOnePasswordButton
{
    return [objc_getAssociatedObject(self, &onePasswordExtensionEnabledKey) boolValue];
}

- (UIBarButtonItem *)onePasswordButton
{
    return objc_getAssociatedObject(self, &onePasswordExtensionButtonKey);
}

#pragma mark - Button Callback -
- (void)onePasswordButtonTapped:(id)sender
{
    [[OnePasswordExtension sharedExtension] fillItemIntoWebView:self.webView forViewController:self sender:sender showOnlyLogins:NO completion:nil];
}

@end


text:
using ConceptualMath.Numbers.Generation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using System.Numerics;

namespace ProjectEulerSolutions
{
    [TestClass]
    public class Problem0009
    {
        /*
         * A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

            a2 + b2 = c2
            For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.

            There exists exactly one Pythagorean triplet for which a + b + c = 1000.
            Find the product abc.
        */

        [TestMethod]
        public void PythagoreanTripletWhereSumOfValuesIs1000_HasProduct31875000()
        {
            var upperBound = 1000;
            var sumOfTriplet = new BigInteger(1000);
            var answer = Sequences.NumbersBetween(1, upperBound + 1)
                .FullJoin(Sequences.NumbersBetween(1, upperBound + 1), LinqExtensions.JoinToTuple<BigInteger, BigInteger>())
                .FullJoin(Sequences.NumbersBetween(1, upperBound + 1), LinqExtensions.JoinToTuple<BigInteger, BigInteger, BigInteger>())
                .Where((tuple) => (tuple.Item1 + tuple.Item2 + tuple.Item3).Equals(sumOfTriplet))
                .Where(Conditional.IsPythagoreanTriplet)
                .Select((tuple) => BigInteger.Multiply(BigInteger.Multiply(tuple.Item1, tuple.Item2), tuple.Item3))
                .First();

            Assert.AreEqual(31875000, answer);
        }
    }
}


text:
local base64 = require "base64"
local cgilua = require "cgilua"
local remy = require "remy"

-- TODO: implement all functions from mod_lua's request_rec
local request = {
	-- ENCODING/DECODING FUNCTIONS
	base64_decode = function(_,...) return base64.decode(...) end,
	base64_encode = function(_,...) return base64.encode(...) end,
	escape = function(_,...) return cgilua.urlcode.escape(...) end,
	unescape = function(_,...) return cgilua.urlcode.unescape(...) end,
	sha1  = function(_,...) return remy.sha1(...) end,
	-- REQUEST PARSING FUNCTIONS
	parseargs = function(_) return cgilua.QUERY, {} end,
	parsebody = function(_) return cgilua.POST, {} end,
	-- REQUEST RESPONSE FUNCTIONS
	--puts = function(_,...) cgilua.put(...) end,
	--write = function(_,...) cgilua.print(...) end
	puts = function(_,...) remy.print(...) end,
	write = function(_,...) remy.print(...) end
}

local M = {
  mode = "cgilua",
  request = request
}

function M.init()
	local r = request
	local query = cgilua.servervariable("QUERY_STRING")
	local port = cgilua.servervariable("SERVER_PORT")
	local server_name = cgilua.servervariable("SERVER_NAME")
	local path_info = M.getpathinfo()
	apache2.version = cgilua.servervariable("SERVER_SOFTWARE")
	r = remy.loadrequestrec(r)
	r.ap_auth_type = cgilua.servervariable("AUTH_TYPE")
	if query ~= nil and query ~= '' then
 		r.args = query
	end
	r.banner = apache2.version
	r.canonical_filename = cgilua.script_path
	r.content_type = "text/html" -- CGILua needs a default content_type
	r.context_document_root = cgilua.script_pdir
	r.document_root = cgilua.script_pdir
	r.filename = cgilua.script_path
	r.hostname = server_name
	r.method = cgilua.servervariable("REQUEST_METHOD")
	r.path_info = path_info
	if port ~= nil then
		r.port = tonumber(port)
		if r.port == 443 then
			r.is_https = true
		end
	end
	r.protocol = cgilua.servervariable("SERVER_PROTOCOL")
	r.range = cgilua.servervariable("HTTP_RANGE")
	r.server_name = server_name
	r.started = os.time()
	r.the_request = r.method..' '..M.getunparseduri()..' '..r.protocol
	r.unparsed_uri = M.getunparseduri()
	r.uri = path_info
	r.user = cgilua.servervariable("REMOTE_USER")
	r.useragent_ip = cgilua.servervariable("REMOTE_ADDR")
end

function M.getpathinfo()
	local p = cgilua.servervariable("PATH_INFO")
	--Xavante compatibility fix (Etiene)
	if cgilua.servervariable("SERVER_SOFTWARE"):match('^Xavante')then
		p = cgilua.urlpath
	end
	if p == nil then
		p = cgilua.servervariable("SCRIPT_NAME")
	end
	return p
end

function M.getunparseduri()
	local uri = M.getpathinfo()
	local query = cgilua.servervariable("QUERY_STRING")
	if query ~= nil and query ~= '' then
		uri = uri..'?'..query
	end
	return uri
end

function M.contentheader(content_type)
	local r = request
	r.content_type = content_type
end

-- TODO: better handle the return code
function M.finish(code)
	local r = request

	-- Handle page redirect
	local location = r.headers_out['Location']
  if location ~= nil and r.status == 302 then
     if location:match('^https?://') then
				cgilua.redirect(location)
     else
        -- CGILua needs a full URL
        if r.is_https then
					location = 'https://'..cgilua.servervariable("HTTP_HOST")..location
        else
					location = 'http://'..cgilua.servervariable("HTTP_HOST")..location
        end
				cgilua.redirect(location)
     end
  end

	-- Prints the response text (if any)
	if r.content_type == "text/html" then
		cgilua.htmlheader()
	else
		local header_sep = "/"
		local header_type = remy.splitstring(r.content_type,header_sep)[1]
		local header_subtype = remy.splitstring(r.content_type,header_sep)[2]
		cgilua.contentheader(header_type,header_subtype)
	end
	if remy.responsetext ~= nil then
	   cgilua.print(remy.responsetext)
	end
end

return M


text:
class HomeController < ApplicationController

  skip_before_action :authenticate_user!, only: [:splash]

  def index
    @total_gratitudes = current_user.gratitudes.length
    current_user.streak(:gratitudes).nil? ? @streak = "Add a gratitude!" : @streak = current_user.streak(:gratitudes)
    @best_streak = current_user.best_user_streak
    @best_streak_day = current_user.best_streak_grammar
    @current_streak_day = current_user.current_streak_grammar
  end

  def splash

  end

  def about

  end
  # :nocov:
  def letsencrypt
   render plain: ENV['LE_AUTH_RESPONSE']
  end
  # :nocov:

end


text:
var
  $ = require('../../lib/domWrap'),
  Post = require('../../app/post'),
  itemstpl = require('./post-items.html'),
  template = require('./front.html')

function Front(parent, node, options) {
  this.parent = parent

  var f = this, r = $(node).html(template(options))

  this.nodes = {
    root      : r,
    posts     : r.select('.latest-posts'),
    favorited : r.select('.latest-favs')
  }

  f.handlePosts = function(collection, posts) {
    f.nodes[collection].html(itemstpl({ posts: posts }))
  }

  Post.on('store:posts:did:latest', f.handlePosts)

  Post.latest('posts')
  Post.latest('favorited')
}

Front.prototype.unload = function() {
  this.nodes.root.html('')
  Post.off('store:posts:did:latest', this.handlePosts)
}

module.exports = Front


text:
'use strict';

var advance = require('../util').advance;

var addPrefix = function (message) {
  return 'Inline-block format violation: ' + message;
};

/**
 * Error messages.
 * @readonly
 */
var messages = {
  empty: addPrefix('can\'t be empty.'),
  noFirstSpace: addPrefix('no space after "/*".'),
  extraFirstSpace: addPrefix('more that a single space after "/*".'),
  noLastSpace: addPrefix('no space before "*/".'),
  extraLastSpace: addPrefix('more than a single space before "*/".')
};

/**
 * Format: inline-block.
 *
 * @type {FormatParser}
 */
module.exports = function (comment, location, report) {
  comment = comment.slice(2, -2);
  var position = advance(location.start, {
    column: 2
  });

  if (!comment.length) {
    report(messages.empty, position);
  }
  else {
    if (comment[0] != ' ') {
      report(messages.noFirstSpace, position);
    }
    else {
      if (comment[1] == ' ') {
        report(messages.extraFirstSpace, position);
      }
      position.column += 1;
      comment = comment.slice(1);
    }

    if (comment.slice(-1) != ' ') {
      report(messages.noLastSpace, advance(position, {
        column: comment.length
      }));
    }
    else {
      if (comment.slice(-2)[0] == ' ') {
        report(messages.extraLastSpace, advance(position, {
          column: comment.length - comment.match(/\s+$/)[0].length
        }));
      }
      comment = comment.slice(0, -1);
    }
  }

  return {
    format: 'inline-block',
    lines: [comment],
    position: position
  };
};

module.exports.messages = messages;


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Department extends Model
{
    //    protected $table = 'department';

    /**
     * The accessors to append to the model's array&json form.
     *
     * @var array
     */
    protected $appends = ['hospital_name'];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = ['hospital'];

    /**
     * Scope a query to only include popular departments.
     *
     * @param $query
     * @param $num
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopePopular($query, $num)
    {
        //TODO 定义热门科室
        return $query->where('id', '<=', $num);
    }

    /**
     * Get the hospital that owns the department.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function hospital()
    {
        return $this->belongsTo(Hospital::class);
    }

    /**
     * Get the doctors of the department.
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function doctors()
    {
        return $this->hasMany(Doctor::class);
    }

    /**
     * Add hospital_name of the department to json&array.
     *
     * @return string
     */
    public function getHospitalNameAttribute()
    {
        return $this->hospital->hospital_name;//TODO 莫名其妙会把hospital对象加到json,目前通过添加到hidden属性解决= =
    }
}


text:
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModLessonComponentsModule } from '../../components/components.module';
import { AddonModLessonIndexPage } from './index';

@NgModule({
    declarations: [
        AddonModLessonIndexPage,
    ],
    imports: [
        CoreDirectivesModule,
        AddonModLessonComponentsModule,
        IonicPageModule.forChild(AddonModLessonIndexPage),
        TranslateModule.forChild()
    ],
})
export class AddonModLessonIndexPageModule {}


text:
package org.springframework.boot.actuate.autoconfigure.metrics.web.reactive;

import org.junit.Test;

import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;
import org.springframework.boot.actuate.metrics.web.reactive.server.DefaultWebFluxTagsProvider;
import org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter;
import org.springframework.boot.actuate.metrics.web.reactive.server.WebFluxTagsProvider;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

/**
 * Tests for {@link WebFluxMetricsAutoConfiguration}
 *
 * @author Brian Clozel
 */
public class WebFluxMetricsAutoConfigurationTests {

	private ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner()
			.withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class,
					SimpleMetricsExportAutoConfiguration.class,
					WebFluxMetricsAutoConfiguration.class));

	@Test
	public void shouldProvideWebFluxMetricsBeans() {
		this.contextRunner.run((context) -> {
			assertThat(context).getBeans(MetricsWebFilter.class).hasSize(1);
			assertThat(context).getBeans(DefaultWebFluxTagsProvider.class).hasSize(1);
		});
	}

	@Test
	public void shouldNotOverrideCustomTagsProvider() {
		this.contextRunner.withUserConfiguration(CustomWebFluxTagsProviderConfig.class)
				.run((context) -> assertThat(context).getBeans(WebFluxTagsProvider.class)
						.hasSize(1).containsKey("customWebFluxTagsProvider"));
	}

	@Configuration
	protected static class CustomWebFluxTagsProviderConfig {

		@Bean
		public WebFluxTagsProvider customWebFluxTagsProvider() {
			return mock(WebFluxTagsProvider.class);
		}

	}

}