text:
FROM ubuntu:trusty
RUN apt-get update && apt-get install -y \
  sudo
RUN apt-get update && apt-get install -y \
  python \
  python-pip \
  python3 \
  python3-pip \
  python-virtualenv \
  python-dev \
  python3-dev

# add rscohn1 user with password docker
RUN useradd -ms /bin/bash rscohn1 && echo "rscohn1:docker" | chpasswd && adduser rscohn1 sudo

# turn off color
ADD .bash_aliases /home/rscohn1/

USER rscohn1
WORKDIR /home/rscohn1

redpajama_set_name: RedPajamaGithub


text:
package org.apache.twill.internal.zookeeper;

import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.twill.zookeeper.ZKClientService;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;

/**
 * Unit test for {@link ReentrantDistributedLock}.
 */
public class ReentrantDistributedLockTest {

  @ClassRule
  public static final TemporaryFolder TMP_FOLDER = new TemporaryFolder();
  private static final Logger LOG = LoggerFactory.getLogger(ReentrantDistributedLockTest.class);

  private static InMemoryZKServer zkServer;

  @BeforeClass
  public static void init() throws IOException {
    zkServer = InMemoryZKServer.builder().setDataDir(TMP_FOLDER.newFolder()).build();
    zkServer.startAndWait();
  }

  @AfterClass
  public static void finish() {
    zkServer.stopAndWait();
  }

  @Test(timeout = 20000)
  public void testReentrant() {
    // Test the lock is reentrant from the same thread
    ZKClientService zkClient = createZKClient();
    try {
      ReentrantDistributedLock lock = new ReentrantDistributedLock(zkClient, "reentrant");
      lock.lock();
      try {
        try {
          lock.lock();
        } finally {
          lock.unlock();
        }
      } finally {
        lock.unlock();
      }
    } finally {
      zkClient.stopAndWait();
    }
  }

  @Test (timeout = 20000)
  public void testMultiThreads() throws InterruptedException {
    // Test the lock mechanism between multiple threads
    ZKClientService zkClient = createZKClient();
    try {
      // Create two threads and compete for the lock
      final ReentrantDistributedLock lock = new ReentrantDistributedLock(zkClient, "multiThreads");
      final CountDownLatch acquired = new CountDownLatch(1);
      Thread t = new Thread() {
        @Override
        public void run() {
          lock.lock();
          try {
            acquired.countDown();
          } finally {
            lock.unlock();
          }
        }
      };

      lock.lock();
      try {
        t.start();
        // Wait for the thread to get the lock, should fail.
        Assert.assertFalse(acquired.await(1, TimeUnit.SECONDS));
      } finally {
        lock.unlock();
      }

      Assert.assertTrue(acquired.await(5, TimeUnit.SECONDS));
      t.join();

    } finally {
      zkClient.stopAndWait();
    }
  }

  @Test (timeout = 20000)
  public void testReentrantMultiClients() throws InterruptedException {
    // Test the reentrant lock/unlock mechanism works correctly across multiple instances of lock
    // This is to simulate the lock between multiple processes
    ZKClientService zkClient1 = createZKClient();
    ZKClientService zkClient2 = createZKClient();
    try {
      // Create two distributed locks
      ReentrantDistributedLock lock1 = new ReentrantDistributedLock(zkClient1, "multiClients");
      final ReentrantDistributedLock lock2 = new ReentrantDistributedLock(zkClient2, "multiClients");

      // Create a thread for locking with lock2
      final CountDownLatch lockAcquired = new CountDownLatch(1);
      Thread t = new Thread() {
        @Override
        public void run() {
          lock2.lock();
          try {
            lockAcquired.countDown();
          } finally {
            lock2.unlock();
          }
        }
      };

      // Lock with lock1
      lock1.lock();
      try {
        // Start the lock2 thread. It should be blocked at acquiring the lock
        t.start();
        Assert.assertFalse(lockAcquired.await(1, TimeUnit.SECONDS));

        // Lock with lock1 again and unlock. The inner unlock shouldn't release the distributed lock
        lock1.lock();
        lock1.unlock();

        Assert.assertFalse(lockAcquired.await(1, TimeUnit.SECONDS));
      } finally {
        lock1.unlock();
      }

      // Now lock1 is unlocked, the lock2 thread should be able to proceed
      Assert.assertTrue(lockAcquired.await(5, TimeUnit.SECONDS));
      t.join();
    } finally {
      zkClient1.stopAndWait();
      zkClient2.stopAndWait();
    }
  }

  @Test (timeout = 20000)
  public void testLockInterrupt() throws InterruptedException {
    // Test lock interruption on multiple threads.
    ZKClientService zkClient = createZKClient();
    try {
      final ReentrantDistributedLock lock = new ReentrantDistributedLock(zkClient, "/interrupt");

      // Create a new thread to acquire the same lock interruptibly.
      lock.lock();
      try {
        final CountDownLatch lockAcquired = new CountDownLatch(1);
        final CountDownLatch lockInterrupted = new CountDownLatch(1);
        Thread t = new Thread() {
          @Override
          public void run() {
            try {
              lock.lockInterruptibly();
              try {
                lockAcquired.countDown();
              } finally {
                lock.unlock();
              }
            } catch (InterruptedException e) {
              lockInterrupted.countDown();
            }
          }
        };

        t.start();
        t.interrupt();
        Assert.assertFalse(lockAcquired.await(2, TimeUnit.SECONDS));
        Assert.assertTrue(lockInterrupted.await(2, TimeUnit.SECONDS));
      } finally {
        lock.unlock();
      }
    } finally {
      zkClient.stopAndWait();
    }
  }

  @Test (timeout = 200000)
  public void testLockInterruptMultiClients() throws InterruptedException {
    // Test lock interruption from multiple clients
    ZKClientService zkClient1 = createZKClient();
    ZKClientService zkClient2 = createZKClient();
    try {
      final ReentrantDistributedLock lock1 = new ReentrantDistributedLock(zkClient1, "/multiInterrupt");
      final ReentrantDistributedLock lock2 = new ReentrantDistributedLock(zkClient2, "/multiInterrupt");

      lock1.lock();
      // Create a new thread to acquire a lock interruptibly
      try {
        final CountDownLatch lockAcquired = new CountDownLatch(1);
        final CountDownLatch lockInterrupted = new CountDownLatch(1);
        Thread t = new Thread() {
          @Override
          public void run() {
            try {
              lock2.lockInterruptibly();
              try {
                lockAcquired.countDown();
              } finally {
                lock2.unlock();
              }
            } catch (InterruptedException e) {
              lockInterrupted.countDown();
            }
          }
        };

        t.start();

        // Sleep for 2 seconds to make sure the lock2 in the thread already entered the distributed lock phase.
        TimeUnit.SECONDS.sleep(2);
        t.interrupt();
        Assert.assertFalse(lockAcquired.await(2, TimeUnit.SECONDS));
        Assert.assertTrue(lockInterrupted.await(2, TimeUnit.SECONDS));

      } finally {
        lock1.unlock();
      }

      // After lock1 unlocked, try to lock with lock2 again and it should succeed.
      // This is to verify when a lock is interrupted, it cleanup the states in ZK
      lock2.lock();
      lock2.unlock();

    } finally {
      zkClient1.stopAndWait();
      zkClient2.stopAndWait();
    }
  }

  @Test (timeout = 20000)
  public void testTryLock() throws InterruptedException {
    // Test tryLock on multiple threads
    ZKClientService zkClient = createZKClient();
    try {
      final ReentrantDistributedLock lock = new ReentrantDistributedLock(zkClient, "/trylock");

      // Create a new thread to acquire the same lock by using tryLock
      final CountDownLatch lockAcquired = new CountDownLatch(1);
      final CountDownLatch lockFailed = new CountDownLatch(2);
      Thread t = new Thread() {
        @Override
        public void run() {
          try {
            if (!lock.tryLock()) {
              lockFailed.countDown();
            }
            if (!lock.tryLock(1, TimeUnit.SECONDS)) {
              lockFailed.countDown();
            }
            if (lock.tryLock(5, TimeUnit.SECONDS)) {
              // Test the reentrant park as well
              if (lock.tryLock(1, TimeUnit.SECONDS)) {
                if (lock.tryLock()) {
                  lockAcquired.countDown();
                  lock.unlock();
                }
                lock.unlock();
              }
              lock.unlock();
            }
          } catch (InterruptedException e) {
            // Shouldn't happen
            LOG.error(e.getMessage(), e);
          }
        }
      };

      lock.lock();
      try {
        t.start();
        Assert.assertTrue(lockFailed.await(5, TimeUnit.SECONDS));
      } finally {
        lock.unlock();
      }
      Assert.assertTrue(lockAcquired.await(2, TimeUnit.SECONDS));
      t.join();

      // Try to lock again and it should success immediately.
      Assert.assertTrue(lock.tryLock());
      lock.unlock();
    } finally {
      zkClient.stopAndWait();
    }
  }

  @Test (timeout = 20000)
  public void testTryLockMultiClients() throws InterruptedException {
    // Test tryLock on multiple clients
    ZKClientService zkClient1 = createZKClient();
    ZKClientService zkClient2 = createZKClient();
    try {
      final ReentrantDistributedLock lock1 = new ReentrantDistributedLock(zkClient1, "/multiTrylock");
      final ReentrantDistributedLock lock2 = new ReentrantDistributedLock(zkClient2, "/multiTrylock");

      // Create a new thread to acquire the same lock by using tryLock
      final CountDownLatch lockAcquired = new CountDownLatch(1);
      final CountDownLatch lockFailed = new CountDownLatch(2);
      Thread t = new Thread() {
        @Override
        public void run() {
          try {
            if (!lock2.tryLock()) {
              lockFailed.countDown();
            }
            if (!lock2.tryLock(1, TimeUnit.SECONDS)) {
              lockFailed.countDown();
            }
            if (lock2.tryLock(5000, TimeUnit.SECONDS)) {
              // Test the reentrant park as well
              if (lock2.tryLock(1, TimeUnit.SECONDS)) {
                if (lock2.tryLock()) {
                  lockAcquired.countDown();
                  lock2.unlock();
                }
                lock2.unlock();
              }
              lock2.unlock();
            }
          } catch (InterruptedException e) {
            // Shouldn't happen
            LOG.error(e.getMessage(), e);
          }
        }
      };

      lock1.lock();
      try {
        t.start();
        Assert.assertTrue(lockFailed.await(5000, TimeUnit.SECONDS));
      } finally {
        lock1.unlock();
      }
      Assert.assertTrue(lockAcquired.await(10000, TimeUnit.SECONDS));
      t.join();

      // Try to lock again and it should success immediately.
      Assert.assertTrue(lock1.tryLock());
      lock1.unlock();
    } finally {
      zkClient1.stopAndWait();
      zkClient2.stopAndWait();
    }
  }

  @Test (timeout = 60000)
  public void testLockRace() throws Exception {
    // Test for multiple clients race on the lock
    // This is for the case when a lock owner release the lock (node deleted)
    // while the other client tries to watch on the node
    ZKClientService zkClient1 = createZKClient();
    ZKClientService zkClient2 = createZKClient();
    try {
      final Lock[] locks = new Lock[] {
        new ReentrantDistributedLock(zkClient1, "/lockrace"),
        new ReentrantDistributedLock(zkClient2, "/lockrace")
      };

      // Have two clients fight for the lock
      final CyclicBarrier barrier = new CyclicBarrier(2);
      final CountDownLatch lockLatch = new CountDownLatch(2);
      for (int i = 0; i < 2; i++) {
        final int threadId = i;
        Thread t = new Thread() {
          @Override
          public void run() {
            try {
              barrier.await();
              for (int i = 0; i < 100; i++) {
                Lock lock = locks[threadId];
                lock.lock();
                try {
                  // A short sleep to make the race possible to happen
                  Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
                } finally {
                  lock.unlock();
                }
              }
              lockLatch.countDown();
            } catch (Exception e) {
              LOG.error("Exception", e);
            }
          }
        };
        t.start();
      }

      Assert.assertTrue(lockLatch.await(30, TimeUnit.SECONDS));

    } finally {
      zkClient1.stopAndWait();
      zkClient2.stopAndWait();
    }
  }

  @Test (timeout = 60000)
  public void testLockSessionExpire() throws Exception {
    ZKClientService zkClient1 = createZKClient();
    final ZKClientService zkClient2 = createZKClient();

    try {
      Lock lock1 = new ReentrantDistributedLock(zkClient1, "/lockexpire");
      lock1.lock();
      try {
        final CountDownLatch started = new CountDownLatch(1);
        final CountDownLatch failure = new CountDownLatch(1);
        Thread t = new Thread() {
          @Override
          public void run() {
            try {
              started.countDown();
              Lock lock2 = new ReentrantDistributedLock(zkClient2, "/lockexpire");
              lock2.lock();
              try {
                // No-op
              } finally {
                lock2.unlock();
              }
            } catch (Exception ex) {
              failure.countDown();
            }
          }
        };
        t.start();

        Assert.assertTrue(started.await(5, TimeUnit.SECONDS));

        // Wait until the lock2 is waiting.
        while (zkClient1.getChildren("/lockexpire").get().getChildren().size() != 2) {
          TimeUnit.SECONDS.sleep(1);
        }

        // Session timeout for zkclient2, the lock acquisition should failed
        KillZKSession.kill(zkClient2.getZooKeeperSupplier().get(), zkClient2.getConnectString(), 10000);
        Assert.assertTrue(failure.await(10, TimeUnit.SECONDS));

      } finally {
        lock1.unlock();
      }

    } finally {
      zkClient1.stopAndWait();
      zkClient2.stopAndWait();
    }
  }

  private ZKClientService createZKClient() {
    ZKClientService zkClient = ZKClientService.Builder.of(zkServer.getConnectionStr()).build();
    zkClient.startAndWait();

    return zkClient;
  }
}


text:
package org.neda.entity;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * Make Population table with related columns
 */
@Entity
@Table(name = "population")
public class Population {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name = "population_id")
    private long populationId;

    @Column(name = "p_location_id")
    @NotNull
    private long localizationId;

    @Column(name = "age_distribution")
    private String ageDistribution;

    @Column(name = "gender")
    private String gender;

    public long getPopulationId() {
        return populationId;
    }

    public void setPopulationId(long populationId) {
        this.populationId = populationId;
    }

    public long getLocalizationId() {
        return localizationId;
    }

    public void setLocalizationId(long localizationId) {
        this.localizationId = localizationId;
    }

    public String getAgeDistribution() {
        return ageDistribution;
    }

    public void setAgeDistribution(String ageDistribution) {
        this.ageDistribution = ageDistribution;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

}


text:
<?php
namespace Hx\Http\Input;

class Json implements \Hx\Http\InputInterface {

	public function getContentType()
	{
		return 'application/json';
	}

	public function getInput($method)
	{
		if ($method == 'GET')
		{
			$x = array();
			foreach($_GET as $k => $v)
			{
				$x[$k] = json_decode($v, true);
			}

			return array(
				'data' => $x
			);
		}
		else if ($method == 'POST')
		{
			//mb_parse_str(file_get_contents("php://input"), $result);

			return array(
				'data' => json_decode(file_get_contents("php://input"), true)
			);
		}
		else if ($method == 'PUT')
		{
			//mb_parse_str(file_get_contents("php://input"), $result);

			return array(
				'data' => json_decode(file_get_contents("php://input"), true)
			);
		}
		else
		{
			Throw new \Hx\Http\HttpException(
				"Json input decoder not support request method <$method>");
		}
	}
}
?>


text:
package com.blazebit.blazefaces.component.inputfiles;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Part;

import com.blazebit.blazefaces.apt.JsfRenderer;
import com.blazebit.blazefaces.renderkit.OutputRenderer;
import com.blazebit.blazefaces.util.HTML5;
import com.blazebit.blazefaces.util.RendererUtils;

@JsfRenderer
public class InputFilesRenderer extends OutputRenderer {

    @Override
    public void decode(FacesContext context, UIComponent component) {
        InputFiles inputFile = (InputFiles) component;

        if(!inputFile.isDisabled()) {
            String clientId = inputFile.getClientId(context);

            List<Part> parts = new ArrayList<Part>();

            try {
                for(Part p : ((HttpServletRequest)context.getExternalContext().getRequest()).getParts()) {
                    if(clientId.equals(p.getName())) {
                        parts.add(p);
                    }
                }
            } catch (IOException ex) {
                throw new FacesException("Could not get the parts", ex);
            } catch (ServletException ex) {
                throw new FacesException("Could not get the parts", ex);
            }

            inputFile.setSubmittedValue(parts.toArray(new Part[0]));
        }
    }

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        String clientId = component.getClientId(context);
        InputFiles inputFile = (InputFiles) component;

        encodeMarkup(context, inputFile, clientId);
        encodeScript(context, inputFile, clientId);
    }

    public void encodeMarkup(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("div", null);
        writer.writeAttribute("id", clientId, null);
        writer.writeAttribute("class", "ui-fileupload", null);
            encodeComponentContainer(context, component, clientId);
            encodeFileContainer(context, component, clientId);
            encodeGalleryWidget(context, component, clientId);
            encodeUploadTemplate(context, component, clientId);
            encodeDownloadTemplate(context, component, clientId);
        writer.endElement("div");
    }

    public void encodeStartButton(FacesContext context, InputFiles component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("button", null);
        writer.writeAttribute("type", "submit", null);
        writer.writeAttribute("class", "ui-fileupload-upload", null);
        writer.writeText("Start upload", null);
        writer.endElement("button");
    }

    public void encodeResetButton(FacesContext context, InputFiles component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("button", null);
        writer.writeAttribute("type", "reset", null);
        writer.writeAttribute("class", "ui-fileupload-cancel", null);
        writer.writeText("Cancel upload", null);
        writer.endElement("button");
    }

    public void encodeDeleteButton(FacesContext context, InputFiles component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("button", null);
        writer.writeAttribute("type", "button", null);
        writer.writeAttribute("class", "ui-fileupload-delete", null);
        writer.writeText("Delete", null);
        writer.endElement("button");
    }

    public void encodeCheckbox(FacesContext context, InputFiles component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("input", null);
        writer.writeAttribute("type", "checkbox", null);
        writer.writeAttribute("class", "toggle", null);
        writer.endElement("input");
    }

    public void encodeComponentContainer(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("div", null);
        writer.writeAttribute("class", "ui-fileupload-buttonbar", null);

            writer.startElement("div", null);
            writer.writeAttribute("class", "fileupload-buttons", null);
                writer.startElement("span", null);
                writer.writeAttribute("class", "ui-fileupload-choose", null);
                    writer.startElement("span", null);
                    writer.writeText("Add files...", null);
                    writer.endElement("span");
                    encodeInput(context, component, clientId);
                writer.endElement("span");

                encodeStartButton(context, component);
                encodeResetButton(context, component);
                encodeDeleteButton(context, component);
                encodeCheckbox(context, component);

//                writer.startElement("span", null);
//                writer.writeAttribute("class", "fileinput-button", null);
//                writer.endElement("span");

            writer.endElement("div");

            writer.startElement("div", null);
            writer.writeAttribute("class", "fileupload-progress fade", null);
            writer.writeAttribute("style", "display: none", null);

                writer.startElement("div", null);
                writer.writeAttribute("class", "progress", null);
                writer.writeAttribute("role", "progressbar", null);
                writer.writeAttribute("aria-valuemin", "0", null);
                writer.writeAttribute("aria-valuemax", "100", null);
                writer.endElement("div");

                writer.startElement("div", null);
                writer.writeAttribute("class", "progress-extended", null);
                writer.writeText(" ", null);
                writer.endElement("div");

            writer.endElement("div");
        writer.endElement("div");
    }

    public void encodeInput(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("input", component);

        RendererUtils.encodeAttribute(writer, "id", clientId + "_input", null);
        RendererUtils.encodeAttribute(writer, "name", clientId + "_input", null);
        RendererUtils.encodeAttribute(writer, "type", "file", null);
//        RendererUtils.encodeAttribute(writer, "class", component.getStyleClass(), null, "styleClass");
        RendererUtils.encodeBooleanAttribute(writer, "disabled", component.isDisabled(), false, "disabled");
        RendererUtils.encodeBooleanAttribute(writer, "multiple", true, false, null);
        // Style-Attribute is included here
//        renderPassThruAttributes(context, component, HTML5.COMMON_ATTRIBUTES);
//        renderPassThruAttributes(context, component, HTML5.COMMON_TAG_ATTRIBUTES);
//        renderDataMapAttributes(context, component);
        writer.endElement("input");
    }

    public void encodeFileContainer(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("div", null);
        writer.writeAttribute("class", "ui-fileupload-content", null);
            writer.startElement("table", null);
            writer.writeAttribute("class", "ui-fileupload-files", null);
            writer.writeAttribute("role", "presentation", null);
                writer.startElement("tbody", null);
                writer.writeAttribute("class", "files", null);
                writer.endElement("tbody");
            writer.endElement("table");
        writer.endElement("div");
    }

    public void encodeGalleryWidget(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("div", null);
        writer.writeAttribute("id", "blueimp-gallery", null);
        writer.writeAttribute("class", "blueimp-gallery blueimp-gallery-controls", null);
        writer.writeAttribute("data-filters", ":even", null);
            writer.startElement("div", null);
            writer.writeAttribute("class", "sliders", null);
            writer.endElement("div");

            writer.startElement("h3", null);
            writer.writeAttribute("class", "title", null);
            writer.endElement("h3");

            writer.startElement("a", null);
            writer.writeAttribute("class", "prev", null);
            writer.writeText("‹", null);
            writer.endElement("a");

            writer.startElement("a", null);
            writer.writeAttribute("class", "next", null);
            writer.writeText("›", null);
            writer.endElement("a");

            writer.startElement("a", null);
            writer.writeAttribute("class", "close", null);
            writer.writeText("×", null);
            writer.endElement("a");

            writer.startElement("a", null);
            writer.writeAttribute("class", "play-pause", null);
            writer.endElement("a");

            writer.startElement("ol", null);
            writer.writeAttribute("class", "indicator", null);
            writer.endElement("ol");
        writer.endElement("div");
    }

    public void encodeUploadTemplate(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("script", null);
        writer.writeAttribute("id", clientId + "_template_upload", null);
        writer.writeAttribute("type", "text/x-tmpl", null);
        writer.writeText("{% for (var i=0, file; file=o.files[i]; i++) { %}", null);

        if(component.getFacet("uploadTemplate") == null) {
            encodeDefaultUploadTemplate(context, component, clientId);
        }

        writer.writeText("{% } %}", null);
        writer.endElement("script");
    }

    public void encodeDownloadTemplate(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("script", null);
        writer.writeAttribute("id", clientId + "_template_download", null);
        writer.writeAttribute("type", "text/x-tmpl", null);
        writer.writeText("{% for (var i=0, file; file=o.files[i]; i++) { %}", null);

        if(component.getFacet("downloadTemplate") == null) {
            encodeDefaultDownloadTemplate(context, component, clientId);
        }

        writer.writeText("{% } %}", null);
        writer.endElement("script");
    }

    public void encodeDefaultUploadTemplate(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("tr", null);
        writer.writeAttribute("class", "template-upload fade", null);
            writer.startElement("td", null);
                writer.startElement("span", null);
                writer.writeAttribute("class", "preview", null);
                writer.endElement("span");
            writer.endElement("td");

            writer.startElement("td", null);
                writer.startElement("p", null);
                writer.writeAttribute("class", "name", null);
                writer.writeText("{%=file.name%}", null);
                writer.endElement("p");

                writer.writeText("{% if (file.error) { %}", null);
                    writer.startElement("div", null);
                        writer.startElement("span", null);
                        writer.writeAttribute("class", "error", null);
                        writer.writeText("Error:", null);
                        writer.endElement("span");

                        writer.writeText("{%=file.error%}", null);
                    writer.endElement("div");
                writer.writeText("{% } %}", null);
            writer.endElement("td");

            writer.startElement("td", null);
                writer.startElement("p", null);
                writer.writeAttribute("class", "size", null);
                writer.writeText("{%=o.formatFileSize(file.size)%}", null);
                writer.endElement("p");

                writer.writeText("{% if (!o.file.error) { %}", null);
                    writer.startElement("div", null);
                    writer.writeAttribute("class", "progress", null);
                    writer.endElement("div");
                writer.writeText("{% } %}", null);
            writer.endElement("td");

            writer.startElement("td", null);

                writer.writeText("{% if (!o.files.error && !i && !o.options.autoUpload) { %}", null);
                    writer.startElement("button", null);
                    writer.writeAttribute("class", "start", null);
                    writer.writeText("Start", null);
                    writer.endElement("button");
                writer.writeText("{% } %}", null);

                writer.writeText("{% if (!i) { %}", null);
                    writer.startElement("button", null);
                    writer.writeAttribute("class", "cancel", null);
                    writer.writeText("Cancel", null);
                    writer.endElement("button");
                writer.writeText("{% } %}", null);
            writer.endElement("td");

        writer.endElement("tr");
    }

    public void encodeDefaultDownloadTemplate(FacesContext context, InputFiles component, String clientId) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("tr", null);
        writer.writeAttribute("class", "template-download fade", null);
            writer.startElement("td", null);
                writer.startElement("span", null);
                writer.writeAttribute("class", "preview", null);

                writer.writeText("{% if (file.thumbnailUrl) { %}", null);
                    writer.startElement("a", null);
                    writer.writeAttribute("href", "{%=file.url%}", null);
                    writer.writeAttribute("title", "{%=file.name%}", null);
                    writer.writeAttribute("download", "{%=file.name%}", null);
                    writer.writeAttribute("data-gallery", "data-gallery", null);
                        writer.startElement("img", null);
                        writer.writeAttribute("src", "{%=file.thumbnailUrl%}", null);
                        writer.endElement("img");
                    writer.endElement("a");
                writer.writeText("{% } %}", null);

                writer.endElement("span");
            writer.endElement("td");

            writer.startElement("td", null);
                writer.startElement("p", null);
                writer.writeAttribute("class", "name", null);

                    writer.writeText("{% if (file.thumbnailUrl) { %}", null);
                        writer.startElement("a", null);
                        writer.writeAttribute("href", "{%=file.url%}", null);
                        writer.writeAttribute("title", "{%=file.name%}", null);
                        writer.writeAttribute("download", "{%=file.name%}", null);
                        writer.writeAttribute("data-gallery", "data-gallery", null);
                        writer.writeText("{%=file.name%}", null);
                        writer.endElement("a");
                    writer.writeText("{% } else { %}", null);
                        writer.startElement("a", null);
                        writer.writeAttribute("href", "{%=file.url%}", null);
                        writer.writeAttribute("title", "{%=file.name%}", null);
                        writer.writeAttribute("download", "{%=file.name%}", null);
                        writer.writeText("{%=file.name%}", null);
                        writer.endElement("a");
                    writer.writeText("{% } %}", null);
                writer.endElement("p");

                writer.writeText("{% if (file.error) { %}", null);
                    writer.startElement("div", null);
                        writer.startElement("span", null);
                        writer.writeAttribute("class", "error", null);
                        writer.writeText("Error", null);
                        writer.endElement("span");

                        writer.writeText("{%=file.error%}", null);
                    writer.endElement("div");
                writer.writeText("{% } %}", null);
            writer.endElement("td");

            writer.startElement("td", null);
                writer.startElement("p", null);
                writer.writeAttribute("class", "size", null);
                writer.writeText("{%=o.formatFileSize(file.size)%}", null);
                writer.endElement("p");
            writer.endElement("td");

            writer.startElement("td", null);

                writer.writeText("{% if (file.deleteWithCredentials) { %}", null);
                    writer.startElement("button", null);
                    writer.writeAttribute("class", "delete", null);
                    writer.writeAttribute("data-type", "{%=file.deleteType%}", null);
                    writer.writeAttribute("data-url", "{%=file.deleteUrl%}", null);
                    writer.writeAttribute("data-xhr-fields", "{'withCredentials':true}", null);
                    writer.writeText("Delete", null);
                    writer.endElement("button");
                writer.writeText("{% } else { %}", null);
                    writer.startElement("button", null);
                    writer.writeAttribute("class", "delete", null);
                    writer.writeAttribute("data-type", "{%=file.deleteType%}", null);
                    writer.writeAttribute("data-url", "{%=file.deleteUrl%}", null);
                    writer.writeText("Delete", null);
                    writer.endElement("button");
                writer.writeText("{% } %}", null);

                writer.startElement("input", null);
                writer.writeAttribute("type", "checkbox", null);
                writer.writeAttribute("name", "delete", null);
                writer.writeAttribute("value", "1", null);
                writer.writeAttribute("class", "toggle", null);
                writer.endElement("input");

           writer.endElement("td");

        writer.endElement("tr");
    }

    public void encodeScript(FacesContext context, InputFiles component, String clientId) throws IOException {
        StringBuilder scriptBuilder = new StringBuilder();
        scriptBuilder.append("BlazeFaces.cw('FileUpload',")
        .append("'").append(component.getClientId()).append("',")
        .append("{ id: '").append(component.getClientId()).append("',")
        .append("maxFileSize: ").append(component.getMaxFileSize()).append(",")
        .append("uploadTemplateId: '").append(clientId).append("_template_upload").append("',")
        .append("downloadTemplateId: '").append(clientId).append("_template_download").append("',")
        .append("dnd: false")
//      .append("acceptFileType: ").append(component.getAllowedExtensions())
        .append("});");

        RendererUtils.addBodyBottomScript(context, scriptBuilder.toString());
    }
}


text:
<title>Offerciti | Store Manage Ads</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Offerciti offline discounts"/>
<meta name="keywords" content="Offers, discounts"/>
<meta name="author" content="www.offerciti.com"/>

            <?php include 'app/views/includes/top-nav.php'; ?>

My Account

                                    Chandana Brothers

                                            Profile

                                            Manage Ads

                                            Wallet

                                            Branches

                                            Post Ad

                                            Change Password

                                            Notifications

                                            Support

Manage Ads

                            <input type="text" placeholder="Ads From Date" id="start-date"
                                   class="form-control date-pic hasDatepicker">

                            <input type="text" placeholder="Ads To Date" id="end-date"
                                   class="form-control date-pic hasDatepicker">

                            <select class="select">
                                <option>Status</option>
                                <option>Active</option>
                                <option>Approved</option>
                                <option>Deleted</option>
                                <option>Expired</option>
                                <option>Pending</option>
                                <option>Rejected</option>
                            </select>

                                <input type="text" class="form-control" id="search"
                                       placeholder="Search Offer Code / category / location">
                                <button class="btn btn-success btn-sm">
                                </button>

                                SNo
                                Offer Code
                                Category
                                Location
                                Validity
                                Status
                                Last Updated
                                Actions

                                1
                                OFR_201510_0022
                                Clothing
                                BHEL, Koti, Lingampally, BHEL, Koti, Lingampally, BHEL, Koti, Lingampally

01-01-2016 to 01-07-2016

                                Pending
                                01-10-2015

                                    <button class="btn btn-default btn-sm stats-btn" data-toggle="tooltip"
                                            data-placement="bottom" title="Statistics">

                                    </button>
                                    <button class="btn btn-info btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="View">

                                    </button>
                                    <button class="btn btn-warning btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Edit">

                                    </button>
                                    <button class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Duplicate">

                                    </button>
                                    <button class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Delete">

                                    </button>

                                                SMS
                                                Likes
                                                Rating
                                                Views
                                                <img
                                                        src="<?php echo site_url('app/assets/images/social/Facebook.png'); ?>">

                                                <img
                                                        src="<?php echo site_url('app/assets/images/social/Twitter.png'); ?>">

                                                <img
                                                        src="<?php echo site_url('app/assets/images/social/Google+.png'); ?>">

                                                <img
                                                        src="<?php echo site_url('app/assets/images/social/Email.png'); ?>">

                                                <img
                                                        src="<?php echo site_url('app/assets/images/social/whatsapp.png'); ?>">

                                                <img
                                                        src="<?php echo site_url('app/assets/images/social/sms.png'); ?>">

                                                100
                                                10
                                                3.5/5
                                                100
                                                1
                                                10
                                                10
                                                15
                                                110
                                                1

                                2
                                OFR_201510_0022
                                Jewellery
                                BHEL, Koti, Lingampally

01-01-2016 to 01-07-2016

                                Active
                                01-10-2015

                                    <button class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Statistics">

                                    </button>
                                    <button class="btn btn-info btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="View">

                                    </button>
                                    <button class="btn btn-warning btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Edit">

                                    </button>
                                    <button class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Duplicate">

                                    </button>
                                    <button class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="bottom"
                                            title="Delete">

                                    </button>


text:
import os
import logging

logger = logging.getLogger(__name__)

def read_metrics(lxc_container_id, metric):
    """
    A method to retrieve metrics about a given linux container. Returns a
    generator of key,value pairs for the given container metric.
    """

    metric_keys = metric.split(".")
    if len(metric_keys) < 2:
        raise Exception("Invalid metric %r" % (metric))

    path = os.path.join(
        "/sys/fs/cgroup", metric_keys[0], "docker", lxc_container_id, metric
    )

    if not os.path.exists(path):
        raise Exception("LXC metric file does not exist %r" % (path))

    # Parse the individual keys out of the file
    with open(path, "r") as f:
        line = f.readline()
        while line:
            parts = line.strip().split(" ")

            if len(parts) == 1:
                yield None, parts[0]
            elif len(parts) == 2:
                key, value = parts
                yield key, value
            else:
                raise Exception("Unknown metric syntax %r %r" % (line, parts))

            line = f.readline()

def read_metric(lxc_container_id, metric, key=None):
    """
    A method to retrieve a specific metric and key about a given linux
    container.
    """

    for metric_key, metric_value in read_metrics(lxc_container_id, metric):
        if metric_key == key:
            return metric_value

    return None

def write_metric(lxc_container_id, metric, value):
    """
    Write a value to a group metric, for example changing the memory
    limit. `memory.soft_limit_in_bytes`
    """

    metric_keys = metric.split(".")
    if len(metric_keys) < 2:
        raise Exception("Invalid metric %r" % (metric))

    path = os.path.join(
        "/sys/fs/cgroup", metric_keys[0], "docker", lxc_container_id, metric
    )

    previous_value = read_metric(lxc_container_id, metric)
    new_value = str(value)

    logger.info("Updating cgroup metric %s from %r to %r", path, previous_value, new_value)

    with open(path, "w") as f:
        f.write(new_value)

    updated_value = read_metric(lxc_container_id, metric)
    if updated_value != new_value:
        raise Exception("Failed to write updated cgroup value to %s" % path)


text:
from django.urls import path

from polls import views

app_name = 'polls'
urlpatterns = [
    # /polls/
    path('', views.IndexView.as_view(), name='index'),

    # /polls/<id>
    path('<int:pk>/', views.DetailView.as_view(), name='detail'),

    # /polls/<id>/results/
    path('<int:pk>/results/', views.ResultsView.as_view(), name='results'),

    # /polls/<id>/vote/
    path('<int:question_id>/vote/', views.vote, name='vote'),
]


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Sys_user_group extends Root_Controller
{
    private  $message;
    public $permissions;
    public $controller_url;
    public function __construct()
    {
        parent::__construct();
        $this->message="";
        $this->permissions=User_helper::get_permission('Sys_user_group');
        $this->controller_url='sys_user_group';
        //$this->load->model("sys_module_task_model");
    }

    public function index($action="list",$id=0)
    {
        if($action=="list")
        {
            $this->system_list($id);
        }
        elseif($action=="add")
        {
            $this->system_add();
        }
        elseif($action=="edit")
        {
            $this->system_edit($id);
        }
        elseif($action=="save")
        {
            $this->system_save();
        }
        else
        {
            $this->system_list($id);
        }
    }

    private function system_list()
    {
        if(isset($this->permissions['action0'])&&($this->permissions['action0']==1))
        {
            $data['title']="User Groups";
            $ajax['status']=true;
            $ajax['system_content'][]=array("id"=>"#system_content","html"=>$this->load->view("sys_user_group/list",$data,true));
            if($this->message)
            {
                $ajax['system_message']=$this->message;
            }
            $ajax['system_page_url']=site_url($this->controller_url);
            $this->jsonReturn($ajax);
        }
        else
        {
            $ajax['status']=false;
            $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
            $this->jsonReturn($ajax);
        }

    }

    private function system_add()
    {
        if(isset($this->permissions['action1'])&&($this->permissions['action1']==1))
        {

            $data['title']="Create New User Group";
            $data["user_group"] = Array(
                'id' => 0,
                'name' => '',
                'type' => '',
                'ordering' => 99,
                'status' => $this->config->item('system_status_active')
            );
            $ajax['system_page_url']=site_url($this->controller_url."/index/add");

            $ajax['status']=true;
            $ajax['system_content'][]=array("id"=>"#system_content","html"=>$this->load->view("sys_user_group/add_edit",$data,true));
            if($this->message)
            {
                $ajax['system_message']=$this->message;
            }
            $this->jsonReturn($ajax);
        }
        else
        {
            $ajax['status']=false;
            $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
            $this->jsonReturn($ajax);
        }
    }
    private function system_edit($id)
    {
        if(isset($this->permissions['action2'])&&($this->permissions['action2']==1))
        {
            if(($this->input->post('id')))
            {
                $group_id=$this->input->post('id');
            }
            else
            {
                $group_id=$id;
            }

            $data['user_group']=Query_helper::get_info($this->config->item('table_system_user_group'),'*',array('id ='.$group_id),1);
            $data['title']="Edit User Group (".$data['user_group']['name'].')';
            $ajax['status']=true;
            $ajax['system_content'][]=array("id"=>"#system_content","html"=>$this->load->view("sys_user_group/add_edit",$data,true));
            if($this->message)
            {
                $ajax['system_message']=$this->message;
            }
            $ajax['system_page_url']=site_url($this->controller_url.'/index/edit/'.$group_id);
            $this->jsonReturn($ajax);
        }
        else
        {
            $ajax['status']=false;
            $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
            $this->jsonReturn($ajax);
        }
    }

    private function system_save()
    {
        $id = $this->input->post("id");
        $user = User_helper::get_user();
        if($id>0)
        {
            if(!(isset($this->permissions['action2'])&&($this->permissions['action2']==1)))
            {
                $ajax['status']=false;
                $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
                $this->jsonReturn($ajax);
                die();
            }
        }
        else
        {
            if(!(isset($this->permissions['action1'])&&($this->permissions['action1']==1)))
            {
                $ajax['status']=false;
                $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
                $this->jsonReturn($ajax);
                die();

            }
        }
        if(!$this->check_validation())
        {
            $ajax['status']=false;
            $ajax['system_message']=$this->message;
            $this->jsonReturn($ajax);
        }
        else
        {
            $data=$this->input->post('user_group');
            $this->db->trans_start();  //DB Transaction Handle START
            if($id>0)
            {
                $data['user_updated'] = $user->user_id;
                $data['date_updated'] = time();

                Query_helper::update($this->config->item('table_system_user_group'),$data,array("id = ".$id));

            }
            else
            {

                $data['user_created'] = $user->user_id;
                $data['date_created'] = time();
                Query_helper::add($this->config->item('table_system_user_group'),$data);
            }
            $this->db->trans_complete();   //DB Transaction Handle END
            if ($this->db->trans_status() === TRUE)
            {
                $save_and_new=$this->input->post('system_save_new_status');
                $this->message=$this->lang->line("MSG_SAVED_SUCCESS");
                if($save_and_new==1)
                {
                    $this->system_add();
                }
                else
                {
                    $this->system_list();
                }
            }
            else
            {
                $ajax['status']=false;
                $ajax['desk_message']=$this->lang->line("MSG_SAVED_FAIL");
                $this->jsonReturn($ajax);
            }
        }
    }
    private function check_validation()
    {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('user_group[name]',$this->lang->line('LABEL_NAME'),'required');

        if($this->form_validation->run() == FALSE)
        {
            $this->message=validation_errors();
            return false;
        }
        return true;
    }
    public function get_items()
    {
        $user = User_helper::get_user();
        if($user->user_group==1)
        {
            $items=Query_helper::get_info($this->config->item('table_system_user_group'),array('id','name','status','ordering'),array('status !="'.$this->config->item('system_status_delete').'"'));
        }
        else
        {
            $items=Query_helper::get_info($this->config->item('table_system_user_group'),array('id','name','status','ordering'),array('id !=1','status !="'.$this->config->item('system_status_delete').'"'));
        }
        $this->jsonReturn($items);

    }

}


text:
package com.onemightyroar.campfire.api.models;

public enum MessageType {
	TEXT("TextMessage"),
	PASTE("PasteMessage"),
	SOUND("SoundMessage"),
	ENTER("EnterMessage"),
	LEAVE("LeaveMessage"),
	KICK("KickMessage"),
	SYSTEM("SystemMessage"),
	TIMESTAMP("TimestampMessage"),
	TOPIC_CHANGE("TopicChangeMessage"),
	UPLOAD("UploadMessage"),
	ADVERTISEMENT("AdvertisementMessage"),
	ALLOW_GUEST("AllowGuestsMessage"),
	DISALLOW_GUEST("DisallowGuestsMessage"),
	IDLE("IdleMessage"),
	UNIDLE("UnidleMessage"),
	UNLOCK("UnlockMessage"),
	TWEET("TweetMessage"),
	UNKNOWN("Unknown");

	private String text;

	MessageType(String text) {
		this.text = text;
	}

	public String toString() {
		return this.text;
	}

	public static MessageType fromString(String text) {
		if (text != null) {
			for (MessageType type : MessageType.values()) {
				if (text.equalsIgnoreCase(type.text)) {
					return type;
				}
			}
		}
		return UNKNOWN;
	}
}


text:
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f((g.tempusDominus=g.tempusDominus||{},g.tempusDominus.locales=g.tempusDominus.locales||{},g.tempusDominus.locales.ar_SA={})));})(this,(function(exports){'use strict';const name = "ar-SA";
const localization = {
    today: "اليوم",
    clear: "مسح",
    close: "إغلاق",
    selectMonth: "اختر الشهر",
    previousMonth: "الشهر السابق",
    nextMonth: "الشهر التالي",
    selectYear: "اختر السنة",
    previousYear: "العام السابق",
    nextYear: "العام التالي",
    selectDecade: "اختر العقد",
    previousDecade: "العقد السابق",
    nextDecade: "العقد التالي",
    previousCentury: "القرن السابق",
    nextCentury: "القرن التالي",
    pickHour: "اختر الساعة",
    incrementHour: "أضف ساعة",
    decrementHour: "أنقص ساعة",
    pickMinute: "اختر الدقيقة",
    incrementMinute: "أضف دقيقة",
    decrementMinute: "أنقص دقيقة",
    pickSecond: "اختر الثانية",
    incrementSecond: "أضف ثانية",
    decrementSecond: "أنقص ثانية",
    toggleMeridiem: "تبديل الفترة",
    selectTime: "اخر الوقت",
    selectDate: "اختر التاريخ",
    dayViewHeaderFormat: { month: "long", year: "2-digit" },
    locale: "ar-SA",
    startOfTheWeek: 1,
};exports.localization=localization;exports.name=name;Object.defineProperty(exports,'__esModule',{value:true});}));


text:
<?php

namespace ZendTest\Validator;

use Zend\Validator\Regex;

/**
 * @category   Zend
 * @package    Zend_Validator
 * @subpackage UnitTests
 * @group      Zend_Validator
 */
class RegexTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Ensures that the validator follows expected behavior
     *
     * @return void
     */
    public function testBasic()
    {
        /**
         * The elements of each array are, in order:
         *      - pattern
         *      - expected validation result
         *      - array of test input values
         */
        $valuesExpected = array(
            array('/[a-z]/', true, array('abc123', 'foo', 'a', 'z')),
            array('/[a-z]/', false, array('123', 'A'))
            );
        foreach ($valuesExpected as $element) {
            $validator = new Regex($element[0]);
            foreach ($element[2] as $input) {
                $this->assertEquals($element[1], $validator->isValid($input));
            }
        }
    }

    /**
     * Ensures that getMessages() returns expected default value
     *
     * @return void
     */
    public function testGetMessages()
    {
        $validator = new Regex('/./');
        $this->assertEquals(array(), $validator->getMessages());
    }

    /**
     * Ensures that getPattern() returns expected value
     *
     * @return void
     */
    public function testGetPattern()
    {
        $validator = new Regex('/./');
        $this->assertEquals('/./', $validator->getPattern());
    }

    /**
     * Ensures that a bad pattern results in a thrown exception upon isValid() call
     *
     * @return void
     */
    public function testBadPattern()
    {
        $this->setExpectedException('Zend\Validator\Exception\InvalidArgumentException', 'Internal error parsing');
        $validator = new Regex('/');
    }

    /**
     * @ZF-4352
     */
    public function testNonStringValidation()
    {
        $validator = new Regex('/./');
        $this->assertFalse($validator->isValid(array(1 => 1)));
    }

    /**
     * @ZF-11863
     * @dataProvider specialCharValidationProvider
     */
    public function testSpecialCharValidation($expected, $input)
    {
        // Locale changed due a bug with PHP versions lower than 5.3.4 (https://bugs.php.net/bug.php?id=52971)
        //setlocale(LC_ALL, 'Spanish_Spain', 'es_ES', 'es_ES.utf-8');
        if (version_compare(PHP_VERSION, '5.3.4', '<')) {
            $this->markTestIncomplete( // Skipped because Travis-CI PHP 5.3.3 don't allow set the locale
                "Test skipped because the PHP version is lower than 5.3.4 or the environment don't support quoted characters");
        }
        $validator = new Regex('/^[[:alpha:]\']+$/iu');
        $this->assertEquals($expected, $validator->isValid($input),
                            'Reason: ' . implode('', $validator->getMessages()));
    }

    /**
     * The elements of each array are, in order:
     *      - expected validation result
     *      - test input value
     */
    public function specialCharValidationProvider()
    {
        return array(
            array(true, 'test'),
            array(true, 'òèùtestòò'),
            array(true, 'testà'),
            array(true, 'teààst'),
            array(true, 'ààòòìùéé'),
            array(true, 'èùòìiieeà'),
            array(false, 'test99'),
        );
    }

    public function testEqualsMessageTemplates()
    {
        $validator = new Regex('//');
        $this->assertAttributeEquals($validator->getOption('messageTemplates'),
                                     'messageTemplates', $validator);
    }

    public function testEqualsMessageVariables()
    {
        $validator = new Regex('//');
        $this->assertAttributeEquals($validator->getOption('messageVariables'),
                                     'messageVariables', $validator);
    }
}


text:
.. _ip1:

.. toctree::

.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .

IP Route
==========

Summary/Usage
--------------

`ip route [add|del] [count <*n*>] <*dst-ip-addr*>/<*width*> [table <*table-id*>] via [next-hop-address[next-hop-interface] [next-hop-table <*value*>] [weight <*value*>] [preference <*value*>] [udp-encap-id <*value*>] [ip4-lookup-in-table <*value*>] [ip6-lookup-in-table <*value*>] [mpls-lookup-in-table <*value*>] [resolve-via-host] [resolve-via-connected] [rx-ip4 <*interface*>] [out-labels <*value value value*>]`

Description
------------

This command is used to add or delete IPv4 or IPv6 routes. All IP Addresses
('<*dst-ip-addr*>/<*width*>', '<*next-hop-ip-addr*>' and '<*adj-hop-ip-addr*>') can be IPv4 or IPv6,
but all must be of the same form in a single command. To display the current set of routes,
use the commands 'show ip fib' and 'show ip6 fib'.

Example Usage
--------------

Example of how to add a straight forward static route:

.. code-block:: console

    vpp# ip route add 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0

Example of how to delete a straight forward static route:

.. code-block:: console

    vpp# ip route del 6.0.1.2/32 via 6.0.0.1 GigabitEthernet2/0/0

Mainly for route add/del performance testing, one can add or delete multiple routes by adding
'count N' to the previous item:

.. code-block:: console

    vpp# ip route add count 10 7.0.0.0/24 via 6.0.0.1 GigabitEthernet2/0/0

Add multiple routes for the same destination to create equal-cost multipath:

.. code-block:: console

    vpp# ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0

    vpp# ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0

For unequal-cost multipath, specify the desired weights. This combination of weights
results in 3/4 of the traffic following the second path, 1/4 following the first path:

.. code-block:: console

    vpp# ip route add 7.0.0.1/32 via 6.0.0.1 GigabitEthernet2/0/0 weight 1

    vpp# ip route add 7.0.0.1/32 via 6.0.0.2 GigabitEthernet2/0/0 weight 3

To add a route to a particular FIB table (VRF), use:

.. code-block:: console

    vpp# ip route add 172.16.24.0/24 table 7 via GigabitEthernet2/0/0

Declaration and Implementation
---------------------------------

**Declaration:** ip_route_command (src/vnet/ip/lookup.c line 641)

**Implementation:** vnet_ip_route_cmd

Ping
=====

Summary/Usage
--------------

ping {<*ip-addr*> | ipv4 <*ip4-addr*> | ipv6 <*ip6-addr*>} [ipv4 <*ip4-addr*> | ipv6 <*ip6-addr*>] [source <*interface*>] [size <*pktsize*>] [interval <*sec*>] [repeat <*cnt*>] [table-id <*id*>] [verbose]

Description
------------

This command sends an ICMP ECHO_REQUEST to network hosts. The address can be an IPv4 or IPv6
address (or both at the same time).

Example Usage
--------------

Example of how ping an IPv4 address:

.. code-block:: console

    vpp# ping 172.16.1.2 source GigabitEthernet2/0/0 repeat 2

    64 bytes from 172.16.1.2: icmp_seq=1 ttl=64 time=.1090 ms
    64 bytes from 172.16.1.2: icmp_seq=2 ttl=64 time=.0914 ms

    Statistics: 2 sent, 2 received, 0% packet loss

    Example of how ping both an IPv4 address and IPv6 address at the same time:

    vpp# ping 172.16.1.2 ipv6 fe80::24a5:f6ff:fe9c:3a36 source GigabitEthernet2/0/0 repeat 2 verbose

    Adjacency index: 10, sw_if_index: 1
    Adj: ip6-discover-neighbor
    Adj Interface: 0
    Forced set interface: 1
    Adjacency index: 0, sw_if_index: 4294967295
    Adj: ip4-miss
    Adj Interface: 0
    Forced set interface: 1
    Source address: 172.16.1.1
    64 bytes from 172.16.1.2: icmp_seq=1 ttl=64 time=.1899 ms
    Adjacency index: 10, sw_if_index: 1
    Adj: ip6-discover-neighbor
    Adj Interface: 0
    Forced set interface: 1
    Adjacency index: 0, sw_if_index: 4294967295
    Adj: ip4-miss
    Adj Interface: 0
    Forced set interface: 1
    Source address: 172.16.1.1
    64 bytes from 172.16.1.2: icmp_seq=2 ttl=64 time=.0910 ms

    Statistics: 4 sent, 2 received, 50% packet loss

Declaration and Implementation
-------------------------------

Declaration: ping_command (src/vnet/ip/ping.c line 899)

Implementation: ping_ip_address

Set Interface IP Address
=========================

`Set Interface IP Address <../interface/setinterface.html#set-interface-ip-address>`_

Show IP Arp
=============

`Show IP-Arp <../show/show.html#show-ip-arp>`_

Show IP Fib
============

`Show IP-Fib <../show/show.html#show-ip-fib>`_


text:
**Ask me !** signifie **demande moi !**

![travis-ci](https://travis-ci.org/jean-pasqualini/askme-angular-web-platform.svg)

#### Résumé

Ask-me est un outils qui gère des packages de questions de facon décentraliser.

Il dispose d'un moteur de recherche qui va rechercher sur packagist les dépot avec le tag askme-compose.

Ensuite il télécharge le askme-compose.json de ce dépot qui expose différentes catégorie de question et les fichiers yml associé.

L'outils affiche ensuite la liste de ces catégorie et charge les fichiers à la demande quand une categorie de ce dépot est demandé.

Un systeme de cache permet d'optimiser l'affichage des dépots déjà vu.

#### Fonctionalités

- Questions sous forme de package
- Décentralisation des packages de questions
- Moteur de recherche des packages (requetage sur packagist)
- Moteur optimiser grace au cache implémentée
- Mode hors ligne disponible pour les packages mis en favoris

#### Prérequis

- npm
- nodejs v0.12
- http-server
- bower
- Extension chrome pour le cross origin pour les tests sur le pc (https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi)

#### Installation

  git clone https://github.com/jean-pasqualini/askme-angular-web-platform.git && cd askme-angular-web-platform

  sudo add-apt-repository ppa:rwky/nodejs

  sudo apt-get update

  sudo apt-get install nodejs

  Si la commande "node -v" ne marche pas faite "hash -r" puis "node -v" de nouveau

  sudo npm install bower -g

  bower install

  sudo npm install http-server -g

  http-server ./www

  Installer l'extension 'https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi' sur chrome

#### Création apk et installation sur android avec cordova

... Documentation à venir

#### Examples d'écrans

![home](doc/images/home.png)
![questions](doc/images/list-questions.png)
![categories](doc/images/liste-categories.png)
![packages](doc/images/liste-packages.png)


text:
package app.factory;

import app.contracts.Action;
import app.contracts.ActionFactory;
import app.models.actions.BossFight;
import app.models.actions.OneVsOne;

import java.lang.reflect.InvocationTargetException;

public class ActionFactoryImpl implements ActionFactory {
    @Override
    public Action create(String actionName, String... participantNames) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
        switch (actionName) {
            case "OneVsOne":
                return new OneVsOne();
            case "BossFight":
                return new BossFight();
            default:
                return null;
        }
    }
}


text:
#ifndef KGR_KANGARU_INCLUDE_KANGARU_DETAIL_EXCEPTION_HPP
#define KGR_KANGARU_INCLUDE_KANGARU_DETAIL_EXCEPTION_HPP

#include "kangaru/detail/config.hpp"
#include "define.hpp"

#ifndef KGR_KANGARU_NOEXCEPTION

#include <exception>

namespace kgr {

/*
 * This exception is the base exception type for all kind of exception caused by a service not found.
 */
struct service_not_found : std::exception {};

/*
 * This exception is thrown when an abstract service is not found, yet asked for it's definition.
 */
struct abstract_not_found : service_not_found {
	inline char const* what() const noexcept override {
		return "No instance found for the requested abstract service";
	}
};

/*
 * This exception is thrown when a supplied service is not found, yet asked for it's definition.
 */
struct supplied_not_found : service_not_found {
	inline char const* what() const noexcept override {
		return "No instance found for the requested supplied service";
	}
};

} // namespace kgr

#else // defined KGR_KANGARU_NOEXCEPTION

#include <cstdlib>

namespace kgr {

/*
 * This exception is the base exception type for all kind of exception caused by a service not found.
 */
struct service_not_found {};

/*
 * This exception is thrown when an abstract service is not found, yet asked for it's definition.
 */
struct abstract_not_found : service_not_found {
	constexpr static char const* what() noexcept {
		return "No instance found for the requested abstract service";
	}
};

/*
 * This exception is thrown when a supplied service is not found, yet asked for it's definition.
 */
struct supplied_not_found : service_not_found {
	constexpr static char const* what() noexcept {
		return "No instance found for the requested supplied service";
	}
};

} // namespace kgr

#endif // KGR_KANGARU_NOEXCEPTION

#include "undef.hpp"

#endif // KGR_KANGARU_INCLUDE_KANGARU_DETAIL_EXCEPTION_HPP


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

<title>Uses of Class org.objectweb.asm.ClassVisitor (ASM 5.0.4 Documentation)</title>
<meta name="date" content="2015-05-15">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.objectweb.asm.ClassVisitor

Packages that use ClassVisitor

Package
Description

org.objectweb.asm

Provides a small and fast bytecode manipulation framework.

org.objectweb.asm.commons

Provides some useful class and method adapters.

org.objectweb.asm.tree

Provides an ASM visitor that constructs a tree representation of the
classes it visits.

org.objectweb.asm.util

Provides ASM visitors that can be useful for programming and
debugging purposes.

org.objectweb.asm.xml

Provides SAX 2.0 adapters for ASM
visitors to convert classes to and from XML.

Uses of ClassVisitor in org.objectweb.asm

Subclasses of ClassVisitor in org.objectweb.asm

Modifier and Type
Class and Description

class
ClassWriter

A ClassVisitor that generates classes in bytecode form.

Fields in org.objectweb.asm declared as ClassVisitor

Modifier and Type
Field and Description

protected ClassVisitor
ClassVisitor.cv

The class visitor to which this visitor must delegate method calls.

Methods in org.objectweb.asm with parameters of type ClassVisitor

Modifier and Type
Method and Description

void
ClassReader.accept(ClassVisitor classVisitor,
      Attribute[] attrs,
      int flags)

Makes the given visitor visit the Java class of this ClassReader.

void
ClassReader.accept(ClassVisitor classVisitor,
      int flags)

Makes the given visitor visit the Java class of this ClassReader
 .

Constructors in org.objectweb.asm with parameters of type ClassVisitor

Constructor and Description

ClassVisitor(int api,
            ClassVisitor cv)

Constructs a new ClassVisitor.

Uses of ClassVisitor in org.objectweb.asm.commons

Subclasses of ClassVisitor in org.objectweb.asm.commons

Modifier and Type
Class and Description

class
RemappingClassAdapter

A ClassVisitor for type remapping.

class
SerialVersionUIDAdder

A ClassVisitor that adds a serial version unique identifier to a
 class if missing.

class
StaticInitMerger

A ClassVisitor that merges clinit methods into a single one.

Constructors in org.objectweb.asm.commons with parameters of type ClassVisitor

Constructor and Description

GeneratorAdapter(int access,
                Method method,
                String signature,
                Type[] exceptions,
                ClassVisitor cv)

Creates a new GeneratorAdapter.

RemappingClassAdapter(ClassVisitor cv,
                     Remapper remapper)

RemappingClassAdapter(int api,
                     ClassVisitor cv,
                     Remapper remapper)

SerialVersionUIDAdder(ClassVisitor cv)

Creates a new SerialVersionUIDAdder.

SerialVersionUIDAdder(int api,
                     ClassVisitor cv)

Creates a new SerialVersionUIDAdder.

StaticInitMerger(int api,
                String prefix,
                ClassVisitor cv)

StaticInitMerger(String prefix,
                ClassVisitor cv)

Uses of ClassVisitor in org.objectweb.asm.tree

Subclasses of ClassVisitor in org.objectweb.asm.tree

Modifier and Type
Class and Description

class
ClassNode

A node that represents a class.

Methods in org.objectweb.asm.tree with parameters of type ClassVisitor

Modifier and Type
Method and Description

void
MethodNode.accept(ClassVisitor cv)

Makes the given class visitor visit this method.

void
InnerClassNode.accept(ClassVisitor cv)

Makes the given class visitor visit this inner class.

void
FieldNode.accept(ClassVisitor cv)

Makes the given class visitor visit this field.

void
ClassNode.accept(ClassVisitor cv)

Makes the given class visitor visit this class.

Uses of ClassVisitor in org.objectweb.asm.util

Subclasses of ClassVisitor in org.objectweb.asm.util

Modifier and Type
Class and Description

class
CheckClassAdapter

A ClassVisitor that checks that its methods are properly used.

class
TraceClassVisitor

A ClassVisitor that prints the classes it visits with a
 Printer.

Constructors in org.objectweb.asm.util with parameters of type ClassVisitor

Constructor and Description

CheckClassAdapter(ClassVisitor cv)

Constructs a new CheckClassAdapter.

CheckClassAdapter(ClassVisitor cv,
                 boolean checkDataFlow)

Constructs a new CheckClassAdapter.

CheckClassAdapter(int api,
                 ClassVisitor cv,
                 boolean checkDataFlow)

Constructs a new CheckClassAdapter.

TraceClassVisitor(ClassVisitor cv,
                 Printer p,
                 PrintWriter pw)

Constructs a new TraceClassVisitor.

TraceClassVisitor(ClassVisitor cv,
                 PrintWriter pw)

Constructs a new TraceClassVisitor.

Uses of ClassVisitor in org.objectweb.asm.xml

Subclasses of ClassVisitor in org.objectweb.asm.xml

Modifier and Type
Class and Description

class
SAXClassAdapter

A ClassVisitor that generates SAX 2.0
 events from the visited class.

Fields in org.objectweb.asm.xml declared as ClassVisitor

Modifier and Type
Field and Description

protected ClassVisitor
ASMContentHandler.cv

Current instance of the ClassVisitor used to visit
 classfile bytecode.

Constructors in org.objectweb.asm.xml with parameters of type ClassVisitor

Constructor and Description

ASMContentHandler(ClassVisitor cv)

Constructs a new ASMContentHandler object.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/p9/procedures/hwp/memory/mss.H $             */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2017                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

///
/// @file mss.H
/// @brief Main include file for the Memory Subsystem
///
// *HWP HWP Owner: Stephen Glancy <sglancy@us.ibm.com>
// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: HB:FSP

#ifndef _MSS_H_
#define _MSS_H_

#include <fapi2.H>
#include <generic/memory/lib/utils/scom.H>

#include <p9_mc_scom_addresses.H>
#include <p9_mc_scom_addresses_fld.H>

#include <lib/shared/mss_const.H>
#include <lib/shared/mss_kind.H>

#include <generic/memory/lib/utils/index.H>
#include <generic/memory/lib/utils/c_str.H>
#include <lib/utils/num.H>

#include <generic/memory/lib/utils/pos.H>
#include <lib/utils/swizzle.H>
#include <lib/utils/conversions.H>
#include <generic/memory/lib/utils/find.H>
#include <lib/utils/poll.H>
#include <lib/utils/checker.H>
#include <lib/utils/dump_regs.H>

#include <lib/ccs/ccs.H>
#include <lib/mcbist/mcbist.H>

#include <lib/dimm/rcd_load.H>
#include <lib/dimm/mrs_load.H>
#include <lib/dimm/rank.H>
#include <lib/dimm/kind.H>

#include <lib/phy/ddr_phy.H>
#include <lib/phy/dp16.H>
#include <lib/phy/cal_timers.H>
#include <lib/phy/write_cntrl.H>
#include <lib/phy/read_cntrl.H>

#include <lib/mc/mc.H>
#include <lib/mc/port.H>

#endif