text:
package com.crawljax.plugins.testilizer.casestudies.claroline.instrumentedtests;

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class send_message {

    private WebDriver driver;

    private String baseUrl;

    private boolean acceptNextAlert = true;

    private StringBuffer verificationErrors = new StringBuffer();

    @Before
    public void setUp() throws Exception {
        driver = new FirefoxDriver();
        baseUrl = "http://watersmc.ece.ubc.ca:8888/";
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    }

    @Test
    public void testSendMessage() throws Exception {
        driver.get(baseUrl + "/claroline-1.11.7/index.php");
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("login"))), "clear", "").clear();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("login"))), "sendKeys", "nainy").sendKeys("nainy");
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("password"))), "clear", "").clear();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("password"))), "sendKeys", "nainy").sendKeys("nainy");
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.cssSelector("button[type=\"submit\"]"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.linkText("Platform administration"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.linkText("Send a message to all users"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("message_subject"))), "clear", "").clear();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("message_subject"))), "sendKeys", "Hello").sendKeys("Hello");
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.id("message_fontselect_open"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.cssSelector("#mce_18_aria > span.mceText"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.cssSelector("span.mceIcon.mce_bold"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.cssSelector("span.mceIcon.mce_italic"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.name("send"))), "click", "").click();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.assertionModeOn();
        assertTrue(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.cssSelector("div.claroDialogBox.boxInfo"))).getText().matches("^[\\s\\S]*Message sent[\\s\\S]*$"));
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getAssertion("assertTrue(driver.findElement(By.cssSelector(\"div.claroDialogBox.boxInfo\")).getText().matches(\"^[\\\\s\\\\S]*Message sent[\\\\s\\\\S]*$\"))");
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.assertionModeOff();
        com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getWebElement(driver.findElement(com.crawljax.plugins.testilizer.seleniuminstrumentor.SeleniumInstrumentor.getBy(By.linkText("Logout"))), "click", "").click();
    }

    @After
    public void tearDown() throws Exception {
        driver.quit();
        String verificationErrorString = verificationErrors.toString();
        if (!"".equals(verificationErrorString)) {
            fail(verificationErrorString);
        }
    }

    private boolean isElementPresent(By by) {
        try {
            driver.findElement(by);
            return true;
        } catch (NoSuchElementException e) {
            return false;
        }
    }

    private boolean isAlertPresent() {
        try {
            driver.switchTo().alert();
            return true;
        } catch (NoAlertPresentException e) {
            return false;
        }
    }

    private String closeAlertAndGetItsText() {
        try {
            Alert alert = driver.switchTo().alert();
            String alertText = alert.getText();
            if (acceptNextAlert) {
                alert.accept();
            } else {
                alert.dismiss();
            }
            return alertText;
        } finally {
            acceptNextAlert = true;
        }
    }
}


text:
import { LayoutTimer } from "../../Q/LayoutTimer";

export namespace LazyLoadHelper {

    export function executeOnceWhenShown(element: JQuery, callback: Function) {
        var el = element && element[0];
        if (!el)
            return;

        if (el.offsetWidth > 0 && el.offsetHeight > 0) {
            callback();
            return;
        }

        var timer = LayoutTimer.onShown(() => el, () => {
            LayoutTimer.off(timer);
            callback();
        });
    }

    export function executeEverytimeWhenShown(element: JQuery, callback: Function, callNowIfVisible: boolean) {
        var el = element && element[0];
        if (!el)
            return;

        if (callNowIfVisible && el.offsetWidth > 0 && el.offsetHeight > 0) {
            callback();
        }

        LayoutTimer.onShown(() => el, () => {
            callback();
        });
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

require_once __DIR__ . '/Expectation/Object.php';

use GroupByInc\API\Query;
use GroupByInc\API\Model\Sort;
use Httpful\Response;

class QueryTest extends PHPUnit_Framework_TestCase
{
    private static $QUERY;
    private static $REFINEMENTS_QUERY;
    private static $SORT;

    public static function init()
    {
        self::$QUERY = '{"clientKey":"XXXX-XXXX-XXXX-XXXX","collection":"testproducts","area":"Production",' .
            '"biasingProfile":"testProfile","language":"en","query":"the","sort":[{"field":"price","order":"Descending"}],' .
            '"fields":["brand","category","height"],"orFields":["price","color"],"refinements":[{"navigationName":"green",' .
            '"exclude":true,"high":"delicious","low":"atrocious","type":"Range"},{"navigationName":"green","exclude":false,' .
            '"value":"malaise","type":"Value"}],"customUrlParams":[{"key":"guava","value":"mango"}],"skip":20,"pageSize":14,' .
            '"disableAutocorrection":true,"pruneRefinements":false,"wildcardSearchEnabled":true}';

        self::$REFINEMENTS_QUERY = '{"originalQuery":' . self::$QUERY . ',"navigationName":"height"}';

        self::$SORT = new Sort();
        self::$SORT->setOrder(Sort\Order::Descending)
            ->setField("price");

    }

    public function testSerializeQuery()
    {
        $query = new Query();
        $query->setQuery('the');
        $query->setSort(array(self::$SORT));
        $query->setSkip(20);
        $query->setPageSize(14);
        $query->setCollection('testproducts');
        $query->setArea('Production');
        $query->setBiasingProfile('testProfile');
        $query->setLanguage('en');
        $query->setPruneRefinements(false);
        $query->setDisableAutocorrection(true);
        $query->setCustomUrlParams(array(Object::$CUSTOM_URL_PARAM));
        $query->setNavigations(array(Object::$NAVIGATION));
        $query->addFields(array("brand", "category", "height"));
        $query->addOrFields(array("price", "color"));
        $query->setWildcardSearchEnabled(true);

        $json = $query->getBridgeJson('XXXX-XXXX-XXXX-XXXX');
        $this->assertEquals(self::$QUERY, $json);
    }

    public function testSerializeRefinementsQuery()
    {
        $query = new Query();
        $query->setQuery('the');
        $query->setSort(array(self::$SORT));
        $query->setSkip(20);
        $query->setPageSize(14);
        $query->setCollection('testproducts');
        $query->setArea('Production');
        $query->setBiasingProfile('testProfile');
        $query->setLanguage('en');
        $query->setPruneRefinements(false);
        $query->setDisableAutocorrection(true);
        $query->setCustomUrlParams(array(Object::$CUSTOM_URL_PARAM));
        $query->setNavigations(array(Object::$NAVIGATION));
        $query->addFields(array("brand", "category", "height"));
        $query->addOrFields(array("price", "color"));
        $query->setWildcardSearchEnabled(true);

        $json = $query->getBridgeRefinementsJson('XXXX-XXXX-XXXX-XXXX', 'height');
        $this->assertEquals(self::$REFINEMENTS_QUERY, $json);
    }

    public function testSplitRange()
    {
        $query = new Query();
        $split = $query->splitRefinements("test=bob~price:10..20");
        $this->assertEquals(["test=bob", "price:10..20"], $split);
    }

    public function testSplitNoCategory()
    {
        $query = new Query();
        $split = $query->splitRefinements("~gender=Women~simpleColorDesc=Pink~product=Clothing");
        $this->assertEquals(["gender=Women", "simpleColorDesc=Pink", "product=Clothing"], $split);
    }

    public function testSplitCategory()
    {
        $query = new Query();
        $split = $query->splitRefinements("~category_leaf_expanded=Category Root~Athletics~Men's~Sneakers");
        $this->assertEquals(["category_leaf_expanded=Category Root~Athletics~Men's~Sneakers"], $split);
    }

    public function testSplitMultipleCategory()
    {
        $query = new Query();
        $split = $query->splitRefinements("~category_leaf_expanded=Category Root~Athletics~Men's~Sneakers~category_leaf_id=580003");
        $this->assertEquals(["category_leaf_expanded=Category Root~Athletics~Men's~Sneakers", "category_leaf_id=580003"], $split);
    }

    public function testSplitRangeAndMultipleCategory()
    {
        $query = new Query();
        $split = $query->splitRefinements("test=bob~price:10..20~category_leaf_expanded=Category Root~Athletics~Men's" .
            "~Sneakers~category_leaf_id=580003~color=BLUE~color=YELLOW~color=GREY");
        $this->assertEquals(["test=bob", "price:10..20",
            "category_leaf_expanded=Category Root~Athletics~Men's~Sneakers", "category_leaf_id=580003",
            "color=BLUE", "color=YELLOW", "color=GREY"], $split);
    }

    public function testSplitCategoryLong()
    {
        $query = new Query();
        $split = $query->splitRefinements("~category_leaf_expanded=Category Root~Athletics~Men's~Sneakers~category_leaf_id=580003~" .
            "color=BLUE~color=YELLOW~color=GREY~feature=Lace Up~feature=Light Weight~brand=Nike");
        $this->assertEquals(["category_leaf_expanded=Category Root~Athletics~Men's~Sneakers", "category_leaf_id=580003",
            "color=BLUE", "color=YELLOW", "color=GREY", "feature=Lace Up", "feature=Light Weight",
            "brand=Nike"], $split);
    }

    public function testNull()
    {
        $query = new Query();
        $split = $query->splitRefinements(null);
        $this->assertEquals([], $split);
    }

    public function testEmpty()
    {
        $query = new Query();
        $split = $query->splitRefinements("");
        $this->assertEquals([], $split);
    }

    public function testUtf8()
    {
        $query = new Query();
        $split = $query->splitRefinements("tëst=bäb~price:10..20");
        $this->assertEquals(["tëst=bäb", "price:10..20"], $split);
    }
}

QueryTest::init();


text:
package edu.utah.ece.async.ibiosim.synthesis.VerilogCompiler;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import org.sbolstandard.core2.AccessType;
import org.sbolstandard.core2.Component;
import org.sbolstandard.core2.ComponentDefinition;
import org.sbolstandard.core2.DirectionType;
import org.sbolstandard.core2.FunctionalComponent;
import org.sbolstandard.core2.Interaction;
import org.sbolstandard.core2.Module;
import org.sbolstandard.core2.ModuleDefinition;
import org.sbolstandard.core2.RefinementType;
import org.sbolstandard.core2.RestrictionType;
import org.sbolstandard.core2.SBOLDocument;
import org.sbolstandard.core2.SBOLValidationException;
import org.sbolstandard.core2.SequenceOntology;
import org.sbolstandard.core2.SystemsBiologyOntology;
import org.sbolstandard.core2.TopLevel;

import edu.utah.ece.async.ibiosim.dataModels.sbol.SBOLUtility;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.SBOLException;
import edu.utah.ece.async.ibiosim.synthesis.GeneticGates.GeneticGate;

/**
 * An SBOL utility class created for the VerilogToSBOL converter.
 * @author Tramy Nguyen
 *
 */
public class WrappedSBOL {

	private SBOLDocument sbolDoc;
	private final String sbolVersion = "1.0";

	private Map<String, String> proteinMapping; //map Verilog name to SBOL FunctionalComponent displayId
	private Map<String, GeneticGate> gateMapping;

	//use to generate unique URIs
	private int interCounter, partiCounter, cdCounter, fcCounter, cCounter, moduleCounter, mapsToCounter, seqConstraint, modDefCounter;

	public WrappedSBOL() {
		this.sbolDoc = SBOLUtility.getSBOLUtility().createSBOLDocument();
		this.proteinMapping = new HashMap<>();
		this.gateMapping = new HashMap<>();
	}

	public void setSBOLDocument(SBOLDocument doc) {
		this.sbolDoc = doc;
	}

	public TopLevel copyTopLevel(ComponentDefinition cd) throws SBOLValidationException {
		return this.sbolDoc.createCopy(cd);
	}

	public ModuleDefinition createModuleDefinition(String id) throws SBOLValidationException {
		return this.sbolDoc.createModuleDefinition(getModuleDefinitionId() + id, sbolVersion);
	}

	private ComponentDefinition addComponentDefinition(String cd_id, URI compDefType) throws SBOLValidationException {
		return sbolDoc.createComponentDefinition(cd_id, sbolVersion, compDefType);
	}

	public FunctionalComponent addFunctionalComponent(ModuleDefinition circuit, String fc_id, AccessType accessType, URI compDefId, DirectionType dirType) throws SBOLValidationException {
		return circuit.createFunctionalComponent(fc_id, accessType, compDefId, dirType);
	}

	private Interaction addInteraction(ModuleDefinition circuit, String interactionId, URI interactionType) throws SBOLValidationException {
		return circuit.createInteraction(interactionId, interactionType);
	}

	private void createInteractionParticipation(Interaction interaction, URI participationRole, URI participantId) throws SBOLValidationException {
		interaction.createParticipation(getParticipationId(), participantId, participationRole);
	}

	public Interaction createInhibitionInteraction(ModuleDefinition circuit, FunctionalComponent inhibitor, FunctionalComponent inhibited) throws SBOLValidationException {
		Interaction inter = addInteraction(circuit, getInteractionId() + "_Inhib", SystemsBiologyOntology.INHIBITION);
		createInteractionParticipation(inter, SystemsBiologyOntology.INHIBITOR, inhibitor.getIdentity());
		createInteractionParticipation(inter, SystemsBiologyOntology.INHIBITED, inhibited.getIdentity());
		return inter;
	}

	public Interaction createActivationInteraction(ModuleDefinition circuit, FunctionalComponent stimulator, FunctionalComponent stimulated) throws SBOLValidationException {
		Interaction inter = addInteraction(circuit, getInteractionId() + "_Stim", SystemsBiologyOntology.STIMULATION);
		createInteractionParticipation(inter, SystemsBiologyOntology.STIMULATOR, stimulator.getIdentity());
		createInteractionParticipation(inter, SystemsBiologyOntology.STIMULATED, stimulated.getIdentity());
		return inter;
	}

	public Interaction createComplexFormationInteraction(ModuleDefinition circuit, FunctionalComponent reactant1, FunctionalComponent reactant2, FunctionalComponent complex) throws SBOLValidationException {
		Interaction inter = addInteraction(circuit, getInteractionId() + "_Stim", SystemsBiologyOntology.NON_COVALENT_BINDING);
		createInteractionParticipation(inter, SystemsBiologyOntology.REACTANT, reactant1.getIdentity());
		createInteractionParticipation(inter, SystemsBiologyOntology.REACTANT, reactant2.getIdentity());
		createInteractionParticipation(inter, SystemsBiologyOntology.PRODUCT, complex.getIdentity());
		return inter;
	}

	public Interaction createProductionInteraction(ModuleDefinition circuit, FunctionalComponent template, FunctionalComponent product) throws SBOLValidationException {
		Interaction inter = addInteraction(circuit, getInteractionId() + "_Prod", SystemsBiologyOntology.GENETIC_PRODUCTION);
		createInteractionParticipation(inter, SystemsBiologyOntology.TEMPLATE, template.getIdentity());
		createInteractionParticipation(inter, SystemsBiologyOntology.PRODUCT, product.getIdentity());
		return inter;
	}

	public void createSequenceConstraint(ComponentDefinition tu, Component dnaComponent, URI subject, URI object) throws SBOLValidationException {
		tu.createSequenceConstraint(getSequenceConstraintId(), RestrictionType.PRECEDES, subject, object);
	}

	public FunctionalComponent createTranscriptionalUnit(ModuleDefinition circuit, String tu_id) throws SBOLValidationException {
		String id = "_" + tu_id;
		ComponentDefinition tu = createEngineeredRegion();
		ComponentDefinition pro1 = createPromoter();
		ComponentDefinition cds = createCDS();
		ComponentDefinition terminator = createTerminator();

		tu.createComponent(getComponentId() + "_part", AccessType.PRIVATE, pro1.getIdentity());
		tu.createComponent(getComponentId() + "_part", AccessType.PRIVATE, cds.getIdentity());
		tu.createComponent(getComponentId() + "_part", AccessType.PRIVATE, terminator.getIdentity());
		FunctionalComponent tu_instance = addFunctionalComponent(circuit, getFunctionalComponentId() + id, AccessType.PUBLIC, tu.getIdentity(), DirectionType.NONE);
		return tu_instance;
	}

	public ComponentDefinition createEngineeredRegion() throws SBOLValidationException {
		ComponentDefinition er = addComponentDefinition(getComponentDefinitionId() + "_er", ComponentDefinition.DNA_REGION);
		er.addRole(SequenceOntology.ENGINEERED_REGION);
		return er;
	}

	public ComponentDefinition createPromoter() throws SBOLValidationException{
		ComponentDefinition part = addComponentDefinition(getComponentDefinitionId() + "_promoter", ComponentDefinition.DNA_REGION);
		part.addRole(SequenceOntology.PROMOTER);
		return part;
	}

	public ComponentDefinition createRibosome() throws SBOLValidationException{
		ComponentDefinition part = addComponentDefinition(getComponentDefinitionId() + "_ribosome", ComponentDefinition.DNA_REGION);
		part.addRole(SequenceOntology.RIBOSOME_ENTRY_SITE);
		return part;
	}

	public ComponentDefinition createCDS() throws SBOLValidationException{
		ComponentDefinition part = addComponentDefinition(getComponentDefinitionId() + "_cds", ComponentDefinition.DNA_REGION);
		part.addRole(SequenceOntology.CDS);
		return part;
	}

	public ComponentDefinition createTerminator() throws SBOLValidationException{
		ComponentDefinition part = addComponentDefinition(getComponentDefinitionId() + "_terminator", ComponentDefinition.DNA_REGION);
		part.addRole(SequenceOntology.TERMINATOR);
		return part;
	}

	public FunctionalComponent createProtein(ModuleDefinition circuit, String proteinId, DirectionType proteinDirection) throws SBOLValidationException, SBOLException {
		String id = "_" + proteinId;

		ComponentDefinition protein = addComponentDefinition(getComponentDefinitionId() + id, ComponentDefinition.PROTEIN);
		FunctionalComponent protein_fc = addFunctionalComponent(circuit, getFunctionalComponentId() + id, AccessType.PUBLIC, protein.getIdentity(), proteinDirection);
		proteinMapping.put(proteinId, protein_fc.getDisplayId());
		return protein_fc;
	}

	public FunctionalComponent createMolecule(ModuleDefinition circuit, String moleculeId, URI moleculeType, DirectionType moleculeDirection) throws SBOLValidationException, SBOLException {
		String id = "_" + moleculeId;

		ComponentDefinition molecule = addComponentDefinition(getComponentDefinitionId() + id, moleculeType);
		FunctionalComponent molecule_fc = addFunctionalComponent(circuit, getFunctionalComponentId() + id, AccessType.PUBLIC, molecule.getIdentity(), moleculeDirection);
		proteinMapping.put(moleculeId, molecule_fc.getDisplayId());
		return molecule_fc;
	}

	public Module createModule(ModuleDefinition fullCircuit, ModuleDefinition subCircuit) throws SBOLValidationException {
		return fullCircuit.createModule(getModuleId(), subCircuit.getDisplayId());
	}

	public void createMapsTo(RefinementType refinementType, Module circuit, FunctionalComponent fullCircuitProtein, FunctionalComponent subCircuitProtein) throws SBOLValidationException {
		circuit.createMapsTo(getMapsToId(), refinementType, fullCircuitProtein.getDisplayId(), subCircuitProtein.getDisplayId());
	}

	public FunctionalComponent getFunctionalComponent(ModuleDefinition circuit, String fc_id) throws SBOLException {
		if(circuit.getFunctionalComponent(fc_id) == null) {
			throw new SBOLException("A FunctionalComponent with a displayId: " + fc_id + " does not exist in the given ModuleDefinition with this displayId : " + circuit.getDisplayId(),
					"SBOL object not found");
		}
		return circuit.getFunctionalComponent(fc_id);
	}

	public void addGateMapping(String gateId, GeneticGate logicGate) {
		this.gateMapping.put(gateId, logicGate);
	}

	/**
	 * Get the displayId of the ComponentDefinition that maps to the given Verilog port name.
	 * If the ComponentDefinition does not exist for the given Verilog port name, a null is returned.
	 * @param verilogPortName : Name of the Verilog port name
	 * @return The displayId of the ComponentDefinition that maps to the Verilog port name. Null is returned if the componentDefinition does not exist.
	 */
	public String getProteinMapping(String verilogPortName) {
		return this.proteinMapping.get(verilogPortName);
	}

	public GeneticGate getGateMapping(String gateName) {
		return this.gateMapping.get(gateName);
	}

	private String getComponentDefinitionId() {
		return "CD" + this.cdCounter++;
	}

	private String getComponentId() {
		return "C" + this.cCounter++;
	}

	public String getFunctionalComponentId() {
		return "FC" + fcCounter++;
	}

	private String getInteractionId() {
		return "I" + this.interCounter++;
	}

	private String getParticipationId() {
		return "P" + this.partiCounter++;
	}

	private String getModuleId() {
		return "M" + this.moduleCounter++;
	}

	private String getMapsToId() {
		return "MT" + this.mapsToCounter++;
	}

	private String getSequenceConstraintId() {
		return "SequenceConstraint" + this.seqConstraint++;
	}

	private String getModuleDefinitionId() {
		return "MD" + this.modDefCounter++;
	}

	public SBOLDocument getSBOLDocument(){
		return this.sbolDoc;
	}
}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>AngularJS</title>
    <link rel="stylesheet" href="../libs/bootstrap/dist/css/bootstrap.css"/>
    <link rel="stylesheet" href="../style/style.css">

serwis "service" - singleton

    {{fooSrv.count}}
    <button class="btn btn-primary" ng-click="fooSrv.increment(1)">
        1
    </button>

    <button class="btn btn-lg btn-success" ng-click="fooSrv.increment(5)">
        5
    </button>
    {{fooSrv.count}}


text:
package org.squbs.testkit.japi;

import com.typesafe.config.ConfigFactory;
import org.squbs.unicomplex.JMX;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

public class CustomTestKitConfigTest extends CustomTestKit {

    CustomTestKitConfigTest() {
        super(ConfigFactory.parseString("squbs.actorsystem-name = CustomTestKitConfigTestInConfig"));
    }

    @AfterClass
    public void tearDown() {
        shutdown();
    }

    @Test
    public void testDefaultListenerStarted() {
        Assert.assertEquals(port(), port("default-listener"));
    }

    @Test
    public void testActorSystemName() {
        Assert.assertEquals(system().name(), "CustomTestKitConfigTestInConfig");
    }

    @Test
    public void testPriorityGivenToCustomConfig() {
        Assert.assertEquals(system().settings().config().getString("squbs.actorsystem-name"), "CustomTestKitConfigTestInConfig");
    }

    @Test
    public void testCustomAndDefaultConfigurationAreMerged() {
        Assert.assertEquals(system().settings().config().getBoolean("squbs." + JMX.prefixConfig()), true);
    }
}


text:
"use strict";

const conversions = require("webidl-conversions");
const utils = require("./utils.js");

const impl = utils.implSymbol;

class Attr {
  constructor() {
    throw new TypeError("Illegal constructor");
  }

  get namespaceURI() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["namespaceURI"];
  }

  get prefix() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["prefix"];
  }

  get localName() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["localName"];
  }

  get name() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["name"];
  }

  get nodeName() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["nodeName"];
  }

  get value() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["value"];
  }

  set value(V) {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    V = conversions["DOMString"](V, { context: "Failed to set the 'value' property on 'Attr': The provided value" });

    this[impl]["value"] = V;
  }

  get nodeValue() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["nodeValue"];
  }

  set nodeValue(V) {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    V = conversions["DOMString"](V, {
      context: "Failed to set the 'nodeValue' property on 'Attr': The provided value",
      treatNullAsEmptyString: true
    });

    this[impl]["nodeValue"] = V;
  }

  get textContent() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["textContent"];
  }

  set textContent(V) {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    V = conversions["DOMString"](V, {
      context: "Failed to set the 'textContent' property on 'Attr': The provided value",
      treatNullAsEmptyString: true
    });

    this[impl]["textContent"] = V;
  }

  get ownerElement() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return utils.tryWrapperForImpl(this[impl]["ownerElement"]);
  }

  get specified() {
    if (!this || !module.exports.is(this)) {
      throw new TypeError("Illegal invocation");
    }

    return this[impl]["specified"];
  }
}
Object.defineProperties(Attr.prototype, {
  namespaceURI: { enumerable: true },
  prefix: { enumerable: true },
  localName: { enumerable: true },
  name: { enumerable: true },
  nodeName: { enumerable: true },
  value: { enumerable: true },
  nodeValue: { enumerable: true },
  textContent: { enumerable: true },
  ownerElement: { enumerable: true },
  specified: { enumerable: true },
  [Symbol.toStringTag]: { value: "Attr", configurable: true }
});
const iface = {
  // When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
  // method into this array. It allows objects that directly implements *those* interfaces to be recognized as
  // implementing this mixin interface.
  _mixedIntoPredicates: [],
  is(obj) {
    if (obj) {
      if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
        return true;
      }
      for (const isMixedInto of module.exports._mixedIntoPredicates) {
        if (isMixedInto(obj)) {
          return true;
        }
      }
    }
    return false;
  },
  isImpl(obj) {
    if (obj) {
      if (obj instanceof Impl.implementation) {
        return true;
      }

      const wrapper = utils.wrapperForImpl(obj);
      for (const isMixedInto of module.exports._mixedIntoPredicates) {
        if (isMixedInto(wrapper)) {
          return true;
        }
      }
    }
    return false;
  },
  convert(obj, { context = "The provided value" } = {}) {
    if (module.exports.is(obj)) {
      return utils.implForWrapper(obj);
    }
    throw new TypeError(`${context} is not of type 'Attr'.`);
  },

  create(constructorArgs, privateData) {
    let obj = Object.create(Attr.prototype);
    obj = this.setup(obj, constructorArgs, privateData);
    return obj;
  },
  createImpl(constructorArgs, privateData) {
    let obj = Object.create(Attr.prototype);
    obj = this.setup(obj, constructorArgs, privateData);
    return utils.implForWrapper(obj);
  },
  _internalSetup(obj) {},
  setup(obj, constructorArgs, privateData) {
    if (!privateData) privateData = {};

    privateData.wrapper = obj;

    this._internalSetup(obj);
    Object.defineProperty(obj, impl, {
      value: new Impl.implementation(constructorArgs, privateData),
      configurable: true
    });

    obj[impl][utils.wrapperSymbol] = obj;
    if (Impl.init) {
      Impl.init(obj[impl], privateData);
    }
    return obj;
  },
  interface: Attr,
  expose: {
    Window: { Attr }
  }
}; // iface
module.exports = iface;

const Impl = require("../attributes/Attr-impl.js");


text:
package com.leader.spring07.test03.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy=true)
@ComponentScan("com.leader.spring07.test03")
public class T3Config {
	@Bean
	public PlatformTransactionManager getTransactionManager() {
		DataSourceTransactionManager txMan = new DataSourceTransactionManager();
		txMan.setDataSource(getDataSource());
		System.out.println("open PlatformTransactionManager");
		return txMan;
	}

	@Bean
	public DriverManagerDataSource getDataSource() {
		DriverManagerDataSource dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
		dataSource.setUrl("jdbc:mysql://192.168.1.251:3306/spring_test");
		dataSource.setUsername("root");
		dataSource.setPassword("root123");
		System.out.println("open datasource");
		return dataSource;
	}
}


text:
'use strict';

var passport = require('passport'),
    webapi = require('./webapi');

exports.config = require('./config.js');

exports.setupMiddleware = function(app) {
    app.use(passport.initialize());
    app.use(passport.session());
    //setup passport
    require('./services/passport')(app, passport);
}

exports.setupRoutes = function(app, passport) {
    app.use('/webapi/', webapi.routes(app));
}

exports.init = function(app) {
    require('bicycle').bicycle = app.bicycle;
}

exports.errorHandler = require('./webapi/http/index').http500Handler;


text:
import dayjs from "dayjs";
import customParseFormat from "dayjs/plugin/customParseFormat";
import weekOfYear from "dayjs/plugin/weekOfYear";

dayjs.extend(customParseFormat);
dayjs.extend(weekOfYear);

export const getWeekFromDate = (d: dayjs.Dayjs) => {
  return d.week();
};

export const formatShortDate = (date: string | Date | dayjs.Dayjs) => {
  return dayjs(date).format("D MMMM YYYY");
};

export const parseDate = (
  date: string | Date | dayjs.Dayjs,
  format = "DD/MM/YY"
) => {
  return dayjs(date, format);
};


text:
/* Overrides of styles in chrome/browser/resources/chromeos/login/header_bar.js
* that are needed by the desktop user chooser screen
*/
#login-header-bar {
  background-color: white;
  border-top: 1px solid #e2e2e2;
  bottom: 0;
  left: 0;
  padding-bottom: 16px;
  padding-top: 16px;
  position: absolute;
  right: 0;
}

.header-bar-item:first-child {
  -webkit-padding-start: 16px;
}

.header-bar-item {
  display: inline-block;
  font-size: 12px;
}

html[dir=rtl] .header-bar-item {
  background-color: white;
  background-position: right center;
}

html[dir=rtl] #login-header-bar button {
  background-position: right center;
}

#login-header-bar #add-user-button {
  background-image: url(../../../../ui/webui/resources/images/add_box.svg);
}

#login-header-bar #guest-user-button {
  background-image: url(../../../../ui/webui/resources/images/account_box.svg);
  border-right: 1px solid #e2e2e2;
  margin-right: 10px;
}

html[dir=rtl] #login-header-bar #guest-user-button {
  border-left: 1px solid #e2e2e2;
  margin-left: 10px;
}

#login-header-bar button {
  -webkit-padding-start: 24px;
  background-color: white;
  background-position: left center;
  background-repeat: no-repeat;
  background-size: 18px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  opacity: 0.8;
}

#login-header-bar button:active,
#login-header-bar button:focus,
#login-header-bar button:hover {
  opacity: 1;
}

#login-header-bar button:focus {
  text-decoration: underline;
}

#logo {
  content: -webkit-image-set(
      url(../../../app/theme/%DISTRIBUTION%/product_logo_name_48.png) 1x,
      url(../../../app/theme/%DISTRIBUTION%/product_logo_name_96.png) 2x);
  height: 18px;
  position: absolute;
  right: 16px;
  top: 20px;
}

html[dir=rtl] #logo {
  left: 16px;
  right: auto;
}


text:
<?php

namespace Tbm\Peval\Operator;

use Tbm\Peval\EvaluationException;
use Tbm\Peval\Operator\IOperator;
use Tbm\Peval\Types\Double;
use Tbm\Peval\Types\String;

/**
 * This is the standard operator that is the parent to all operators found in
 * expressions.
 */
abstract class AbstractOperator implements IOperator
{
    /**
     * @var String
     */
    private $symbol = null;

    /**
     * @var int
     */
	private $precedence = 0;

    /**
     * @var bool
     */
    private $unary = false;

    /**
     * @param String|\Tbm\Peval\Operator\String|\Tbm\Peval\Types\String $symbol
     * @param $precedence
     * @param null $unary
     */
    function __construct(String $symbol, $precedence, $unary = null)
    {
        if ($unary === null) {
            $this->AbstractOperator2($symbol, $precedence);
        }
        else {
            $this->AbstractOperator3($symbol, $precedence, $unary);
        }
    }

    /**
     * A constructor that takes the operator symbol and precedence as input.
     *
     * @param String|\Tbm\Peval\Operator\String|\Tbm\Peval\Types\String $symbol
     * @param $precedence
     * @internal param $symbol The character(s) that makes up the operator.
     *            The character(s) that makes up the operator.
     * @internal param $precedence The precedence level given to this operator.
     *            The precedence level given to this operator.
     */
	private function AbstractOperator2(String $symbol, $precedence) {

		$this->symbol = $symbol;
		$this->precedence = $precedence;
	}

    /**
     * A constructor that takes the operator symbol, precedence, unary indicator
     * and unary precedence as input.
     *
     * @param String|\Tbm\Peval\Operator\String|\Tbm\Peval\Types\String $symbol
     * @param $precedence
     * @param $unary
     * @internal param $symbol The character(s) that makes up the operator.
     *            The character(s) that makes up the operator.
     * @internal param $precedence The precedence level given to this operator.
     *            The precedence level given to this operator.
     * @internal param $unary Indicates of the operator is a unary operator or not.
     *            Indicates of the operator is a unary operator or not.
     */
	private function AbstractOperator3(String $symbol, $precedence, $unary) {

		$this->symbol = $symbol;
		$this->precedence = $precedence;
		$this->unary = $unary;
	}

    public function evaluate(Double $leftOperand, Double $rightOperand = null)
    {
        if ($rightOperand === null) {
            return $this->evaluate1Double($leftOperand);
        }
        elseif ($leftOperand && $rightOperand instanceof Double) {
            return $this->evaluate2Doubles($leftOperand, $rightOperand);
        }
        elseif ($leftOperand && $rightOperand instanceof String) {
            return $this->evaluate2Strings($leftOperand, $rightOperand);
        }
    }

    /**
     * Evaluates two double operands.
     *
     * @param \Tbm\Peval\Types\Double $leftOperand
     * @param \Tbm\Peval\Types\Double $rightOperand
     * @internal param $leftOperand The left operand being evaluated.
     *            The left operand being evaluated.
     * @internal param $rightOperand The right operand being evaluated.
     *            The right operand being evaluated.
     * @return int
     */
	protected function evaluate2Doubles(Double $leftOperand, Double $rightOperand)
    {
		return 0;
	}

    /**
     * Evaluates two string operands.
     *
     * @param \Tbm\Peval\Types\String $leftOperand
     * @param \Tbm\Peval\Types\String $rightOperand
     * @throws \Tbm\Peval\EvaluationException
     * @internal param $leftOperand The left operand being evaluated.
     *            The left operand being evaluated.
     * @internal param $rightOperand The right operand being evaluated.
     *            The right operand being evaluated.
     *
     * @return String The value of the evaluated operands.
     *
     * @exception EvaluateException
     *                Thrown when an error is found while evaluating the
     *                expression.
     */
	protected function evaluate2Strings(String $leftOperand, String $rightOperand)
    {
		throw new EvaluationException("Invalid operation for a string.");
	}

    /**
     * Evaluate one double operand.
     *
     * @param \Tbm\Peval\Types\Double $operand
     * @return int
     * @internal param $operand The operand being evaluated.
     *            The operand being evaluated.
     */
	protected function evaluate1Double(Double $operand) {
		return 0;
	}

	/**
	 * Returns the character(s) that makes up the operator.
	 *
	 * @return The operator symbol.
	 */
	public function getSymbol() {
		return $this->symbol;
	}

	/**
	 * Returns the precedence given to this operator.
	 *
	 * @return The precedecne given to this operator.
	 */
	public function getPrecedence() {
		return $this->precedence;
	}

	/**
	 * Returns the length of the operator symbol.
	 *
	 * @return The length of the operator symbol.
	 */
	public function getLength() {
		return $this->symbol->length();
	}

	/**
	 * Returns an indicator of if the operator is unary or not.
	 *
	 * @return An indicator of if the operator is unary or not.
	 */
	public function isUnary() {
		return $this->unary;
	}

    /**
     * Determines if this operator is equal to another operator. Equality is
     * determined by comparing the operator symbol of both operators.
     *
     * @param object
     *            The object to compare with this operator.
     *
     * @throws IllegalStateException
     * @return True if the object is equal and false if not.
     *
     * @exception IllegalStateException
     *                Thrown if the input object is not of the Operator type.
     */
	public function equals($object)
    {
		if ($object == null) {
			return false;
		}

		if (!($object instanceof AbstractOperator)) {
			throw new IllegalStateException("Invalid operator object.");
		}

		$this->operator = $object;

		if ($this->symbol->equals($this->operator->getSymbol())) {
			return true;
		}

		return false;
	}

	/**
	 * Returns the String representation of this operator, which is the symbol.
	 *
	 * @return The operator symbol.
	 */
	public function toString() {
		return $this->getSymbol();
	}
}


text:
module Prosophobia
  class Session

    attr_accessor :adapter
    attr_accessor :server

    attr_reader :nickname
    attr_reader :username
    attr_reader :realname

    def initialize(adapter, parser = MessageParser.new)
      @adapter = adapter
      @parser = parser

      @me = @adapter.me.id
    end

    def host
      'localhost'
    end

    def greet
      [
        ":#{host} #{'%03d' % RPL_WELCOME} #{nickname} :Welcome!",
        ":#{host} #{'%03d' % RPL_YOURHOST} #{nickname} :Your host is #{host}",
        ":#{host} #{'%03d' % RPL_CREATED} #{nickname} :This server was created at some point.",
        ":#{host} #{'%03d' % RPL_MYINFO} #{nickname} :This server is very interesting."
      ].each { |message| irc_send(message) }
    end

    HANDLERS = {
      'NICK' => :nick_handler,
      'USER' => :user_handler,
      'JOIN' => :join_handler,
      'PRIVMSG' => :privmsg_handler
    }

    def handle(message)
      message = @parser.parse(message)
      method = HANDLERS.fetch(message.command) { return [] }
      send(method, message)
    end

    def nick_handler(message)
      @nickname = message.args.first
    end

    def user_handler(message)
      @username, _, _, @realname = message.args
      greet
    end

    def join_handler(message)
      channel = message.args.first
      channels = channel.split(",")

      channels.each do |channel|
        irc_send ":#{nickname}!~#{username}@#{host} JOIN :#{channel}"
        room = @adapter.find_room_by_name(channel2room(channel))

        irc_send ":#{host} #{'%03d' % RPL_TOPIC} #{nickname} #{channel} :#{room.topic}"
        irc_send ":#{host} #{'%03d' % RPL_NAMREPLY} = #{nickname} #{channel} :#{namelist(room)}"
        irc_send ":#{host} #{'%03d' % RPL_ENDOFNAMES} #{nickname} #{channel} :End of /NAMES list."

        room.listen do |m|
          next unless m.user?
          next if m.user.id == @me
          name = name2nick(m.user.name)
          irc_send ":#{name}!~#{name}@#{host} PRIVMSG #{channel} :#{m.body}\r\n"
        end
      end
    end

    def privmsg_handler(message)
      channel, text = message.args
      room = @adapter.find_room_by_name(channel2room(channel))
      room.speak text
    end

    def irc_send(message)
      puts "Sending: #{message}"
      @server.send_data("#{message}\r\n")
    end

    def room2channel name
      "##{name.gsub(/ /, "-")}"
    end

    def channel2room name
      name.gsub(/-/, " ")[1..-1]
    end

    def name2nick name
      name[0..7]
    end

    def namelist room
      users = room.users.reject { |user| user.id == @me }
      users.map do |user|
        "#{"@" if user.admin?}#{name2nick(user.name)}"
      end.join(" ")
    end
  end
end


text:
using Microsoft.AspNetCore.Mvc.Abstractions;

namespace Microsoft.AspNetCore.Mvc.Infrastructure;

/// <summary>
/// A cached collection of <see cref="ActionDescriptor" />.
/// </summary>
public class ActionDescriptorCollection
{
    /// <summary>
    /// Initializes a new instance of the <see cref="ActionDescriptorCollection"/>.
    /// </summary>
    /// <param name="items">The result of action discovery</param>
    /// <param name="version">The unique version of discovered actions.</param>
    public ActionDescriptorCollection(IReadOnlyList<ActionDescriptor> items, int version)
    {
        if (items == null)
        {
            throw new ArgumentNullException(nameof(items));
        }

        Items = items;
        Version = version;
    }

    /// <summary>
    /// Returns the cached <see cref="IReadOnlyList{ActionDescriptor}"/>.
    /// </summary>
    public IReadOnlyList<ActionDescriptor> Items { get; }

    /// <summary>
    /// Returns the unique version of the currently cached items.
    /// </summary>
    public int Version { get; }
}


text:
module TicketGate
  class Client < RocketPants::Client
    class Event < APISmith::Smash
      property :created_at
      property :currency
      property :end_at
      property :id
      property :name
      property :parent_id
      property :start_at
      property :ticket_limit
      property :updated_at
    end

    def list_events
      get "events", :transformer => Event
    end

    def get_event id
      get "events/#{id}", :transformer => Event
    end

    def create_event params
      post "events", :extra_body => { :event => params }, :transformer => Event
    end

    def update_event id, params
      put "events/#{id}", :extra_body => { :event => params }, :transformer => Event
    end

    def destroy_event id
      delete "events/#{id}", :transformer => Event
    end
  end
end


text:
<!DOCTYPE html>

	<title>MOBILE BANKER</title>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">

		<link rel="stylesheet" href="../css/style.css" />
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />

				<?php
				session_start();

				// error_reporting(E_ERROR | E_PARSE);

				$phone = $_SESSION['phone'];
				$charge = 0.05;
				$raccountNumber = $_POST['txtReceiverNum'];
				$amount = $_POST['txtTransferAmt'];
				$senderPin = $_POST['txtsenderPin'];

				try {
					$con = mysql_connect('localhost', 'root', '');
					mysql_select_db('test');
					$query = "SELECT * FROM account WHERE pin = '$senderPin' and phoneNumber = '$phone'limit 1";
					$exec = mysql_query($query);
					if ($exec) {
						while ($exec_row = mysql_fetch_assoc($exec)) {
							$accountNumber = $exec_row['accountNumber'];
							$availableBalance = $exec_row['abalance'];
							$currentBalance = $exec_row['cbalance'];
							if ($amount > $currentBalance) {
								echo 'Your balance is lower than the amount you want to send
';
								echo 'Your balance is' . $currentBalance;
							} else {
								$availableBalance = $availableBalance - $amount;
								$currentBalance = $currentBalance - $amount - 0.05;
								 $availableBalance . "
";
								$sqll = "UPDATE test.account SET cbalance = $currentBalance,abalance = $availableBalance WHERE account.accountNumber = $accountNumber";
								$exec = mysql_query($sqll);
								addAmount($amount, $raccountNumber);
							echo "
The transfer was successful, your current balance is $currentBalance
";
				?>

					HOME

				<?php
				}
				}
				} else {
				echo "no exec" . mysql_error();
				}
				} catch (PDOException $e) {
				$e -> getMessage();
				}

				function addAmount($amount, $raccountNumber) {
				$raccountNumber;
				$amount;
				try {

				$rcon = mysql_connect('localhost', 'root', '');
				mysql_select_db('test');

				$rsql = "SELECT * FROM account WHERE accountNumber = $raccountNumber limit 1";
				$rexec = mysql_query($rsql);
				if ($rexec) {
				while ($rexec_row = mysql_fetch_assoc($rexec)) {
				$ravailableBalance = $rexec_row['abalance'] + $amount;
				$rcurrentBalance = $rexec_row['cbalance'] + $amount;
				$ravailableBalance . "
";
				$rsqll = "UPDATE test.account SET cbalance = $rcurrentBalance,abalance = $ravailableBalance WHERE account.accountNumber = $raccountNumber";
				$rexec = mysqli_query($rcon, $rsqll);
				}
				}
				} catch (PDOException $e) {
				$e -> getMessage();
				}
				}
				?>


text:
var gulp = require('gulp');

var htmlmin = require('gulp-htmlmin');
var ngTemplates = require('gulp-ng-templates');

var config = require('../../config').templates.production;

/**
 * Genreates templateCache.js file to cache all the template views
 * for angular app.
 */
gulp.task('templates:production', function () {
  return gulp.src(config.src)
    .pipe(htmlmin(config.options))
    .pipe(ngTemplates({
      standalone: false,
      filename: config.filename,
      module: config.module,
      path: function(path, base) {
        return path.replace(base, 'views/');
      }
    }))
    .pipe(gulp.dest(config.dest));
});


text:
package chandu0101.scalajs.facades.examples.pages.components.pouchdb

import chandu0101.scalajs.facades.examples.pages.common.CodeExample
import chandu0101.scalajs.facades.examples.util.Constants._
import chandu0101.scalajs.facades.pouchdb.PouchDB
import japgolly.scalajs.react._
import japgolly.scalajs.react.vdom.all._

/**
 * Created by chandrasekharkode .
 */
object PDebug {

  val code =
    """
      | PouchDB.enableDebug() // enable
      |    val db = PouchDB.create("scalajs")
      |    db.info
      |    PouchDB.disableDebug // disable
      |
    """.stripMargin

  val component = ReactComponentB[Unit]("PDebug")
    .render(P => {
    div(
      h3("Debug Modes"),
      CodeExample(code)(
        p(key := "yeah", DB_PATH)
      )
    )
  })
    .componentWillMount(scope => {

    PouchDB.enableDebug() // enable
    val db = PouchDB.create("scalajs")
    db.info
    PouchDB.disableDebug // disable
  })
    .buildU

  def apply() = component()
}


text:
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
var clean = require('gulp-clean');
var cssmin = require('gulp-cssmin');
var flatten = require('gulp-flatten');
var rename = require('gulp-rename');
var htmlmin = require('gulp-htmlmin');

// remove files in the public folder
gulp.task('clean', function(){
	return gulp.src('./public/**/**/*', {read: false}).pipe(clean());
});

gulp.task('serve', function(){
	browserSync.init({
		server: {
			baseDir: './public'
		}
	});

	gulp.watch('./assets/pages/*.html' , gulp.series(['pages']));
	gulp.watch(['./assets/images/**/*.jpg', './assets/images/**/*.svg'] , gulp.series(['images']));
	gulp.watch('./assets/styles/*.scss', gulp.series(['styles']));
	gulp.watch('./assets/data/*', gulp.series(['data']));
	gulp.watch('./assets/scripts/*.js', gulp.series(['scripts']));

  	gulp.watch(['public/*', 'public/**/*', 'public/**/**/*']).on('change', browserSync.reload);
});

gulp.task('pages', function(){
	return gulp.src('./assets/pages/*')
		.pipe(htmlmin({
			collapseWhitespace: true
		}))
		.pipe(gulp.dest('./public'), { base: '.' });

});

// compiles styles with foundation base styles
gulp.task('styles', function(){
	return gulp.src('./assets/styles/app.scss')
	.pipe(sass())
	.pipe(cssmin())
	.pipe(gulp.dest('./public/css'), { base: '.'});
});

gulp.task('images', function(){
	return gulp.src([
			'./assets/images/**/*',
			'./assets/images/*'
		])
		.pipe(flatten())
		.pipe(gulp.dest('./public/assets/'));
});

gulp.task('documents', function(){
	return gulp.src('./assets/documents/*').pipe(gulp.dest('./public/assets'));
})

gulp.task('data', function(){
	return gulp.src('./assets/data/*').pipe(gulp.dest('./public/data'));
})

gulp.task('scripts', function(){

	// index page
	gulp.src('./assets/scripts/index.js').pipe(gulp.dest('./public/js'));

	// artwork page
	return gulp.src('./assets/scripts/artApp.js').pipe(gulp.dest('./public/js'));

});

gulp.task('cname', function() {
	return gulp.src('./CNAME').pipe(gulp.dest('./public'));
});

gulp.task('default', gulp.series(['pages', 'images', 'styles', 'data', 'scripts', 'documents', 'serve']));

gulp.task('build', gulp.series(['pages', 'images', 'styles', 'data', 'scripts', 'documents', 'cname']));

gulp.task('default', gulp.series(['pages', 'images', 'styles', 'data', 'scripts', 'documents', 'serve']));


text:
package com.lch.menote;

import android.content.Context;
import android.widget.Toast;

/**
 * Created by lichenghang on 2018/7/7.
 */

@Modified
public class NewP2 {

    public static void run(Context context){
        Toast.makeText(context,"p 22222",1).show();
    }

    protected int rInt(){
        return 1;
    }
    protected NewP2 this$(){
        return this;
    }
}


text:
using System.Collections.Generic;

namespace CacheSharp.WebApi.Example.Mocks
{
    public interface IAccountService
    {
        IEnumerable<Account> GetAccounts(string userId);
        string Transfer(string userId, string fromAccountId, string toAccountId, decimal amount);
        IEnumerable<Transfer> GetTransferHistory(string userId, string accountId);
    }
}


text:
class TodoListsController < ApplicationController
  before_action :authenticate_user!, except: :index
  before_action :authorize_ownership!, only: [:edit, :update, :show, :destroy]
  before_action :convert_durations, only: [:create, :update]

  def index
    if current_user
      @todo_lists = current_user.todo_lists
    else
      @todo_lists = []
      render :welcome
    end
  end

  def show
    @todo_items = @todo_list.todo_items.priority
    @todo_item = @todo_list.todo_items.new
  end

  def new
    @todo_list = current_user.todo_lists.new
  end

  def edit
  end

  def create
    @todo_list = current_user.todo_lists.new(todo_list_params)
    if @todo_list.save
      flash[:notice] = 'Todo List successfully created.'
      redirect_to @todo_list
    else
      flash.now[:error] = 'Validation errors.'
      render :new
    end
  end

  def update
    if @todo_list.update(todo_list_params)
      flash[:notice] = 'Todo List successfully updated.'

      redirect_to @todo_list, status: :see_other
    else
      flash.now[:error] = 'Validation errors.'
      render :edit
    end
  end

  def destroy
    @todo_list.destroy
    redirect_to todo_lists_url, status: :see_other
  end

  private

  def authorize_ownership!
    @todo_list = current_user.todo_lists.find_by_id(params.fetch(:id))
    if @todo_list.nil?
      flash[:alert] = 'You are not the owner of that list or the list does not exist.'
      redirect_to root_path
    end
  end

  def todo_list_params
    params.require(:todo_list).permit(:name, :description, :default_due_at_duration)
  end

  def convert_durations
    default_due_at_duration_unparsed = params[:todo_list][:default_due_at_duration]
    if default_due_at_duration_unparsed
      params[:todo_list][:default_due_at_duration] = ChronicDuration.parse(default_due_at_duration_unparsed)
    end
  end
end


text:
package main

import (
	"flag"
	"fmt"
	"net/http"
	"strconv"
	"sync"

	"github.com/Snapbug/gomemcache/memcache"
	"github.com/golang/glog"
	"github.com/prometheus/client_golang/prometheus"
)

const (
	namespace = "memcache"
)

var (
	cacheOperations  = []string{"get", "delete", "incr", "decr", "cas", "touch"}
	cacheStatuses    = []string{"hits", "misses"}
	cmdCounts        = []string{"get", "set", "flush", "touch"}
	usageTimes       = []string{"curr", "total"}
	usageResources   = []string{"items", "connections"}
	bytesDirections  = []string{"read", "written"}
	removalsStatuses = []string{"expired", "evicted"}
)

// Exporter collects metrics from a set of memcache servers.
type Exporter struct {
	mutex        sync.RWMutex
	mc           *memcache.Client
	up           prometheus.Gauge
	uptime       prometheus.Counter
	cache        *prometheus.CounterVec
	commands     *prometheus.CounterVec
	usage        *prometheus.GaugeVec
	bytes        *prometheus.CounterVec
	removals     *prometheus.CounterVec
	active_slabs prometheus.Gauge
	malloced     prometheus.Gauge

	items_number            *prometheus.GaugeVec
	items_age               *prometheus.GaugeVec
	items_evicted           *prometheus.CounterVec
	items_evicted_unfetched *prometheus.CounterVec
	items_outofmemory       *prometheus.CounterVec
	items_tailrepairs       *prometheus.CounterVec
	items_reclaimed         *prometheus.CounterVec
	items_expired_unfetched *prometheus.CounterVec

	slabs_chunk_size      *prometheus.GaugeVec
	slabs_chunks_per_page *prometheus.GaugeVec
	slabs_total_pages     *prometheus.GaugeVec
	slabs_total_chunks    *prometheus.GaugeVec
	slabs_used_chunks     *prometheus.GaugeVec
	slabs_free_chunks     *prometheus.GaugeVec
	slabs_free_chunks_end *prometheus.GaugeVec
	slabs_mem_requested   *prometheus.GaugeVec
	slabs_get_hits        *prometheus.CounterVec
	slabs_cmd_set         *prometheus.CounterVec
	slabs_delete_hits     *prometheus.CounterVec
	slabs_incr_hits       *prometheus.CounterVec
	slabs_decr_hits       *prometheus.CounterVec
	slabs_cas_hits        *prometheus.CounterVec
	slabs_cas_badval_hits *prometheus.CounterVec
	slabs_touch_hits      *prometheus.CounterVec
}

// NewExporter returns an initialized exporter
func NewExporter(server string) *Exporter {
	return &Exporter{
		mc: memcache.New(server),
		up: prometheus.NewGauge(
			prometheus.GaugeOpts{
				Name:        "up",
				Namespace:   namespace,
				Help:        "Are the servers up.",
				ConstLabels: prometheus.Labels{"server": server},
			},
		),
		uptime: prometheus.NewCounter(
			prometheus.CounterOpts{
				Name:        "uptime",
				Namespace:   namespace,
				Help:        "The uptime of the server.",
				ConstLabels: prometheus.Labels{"server": server},
			},
		),
		cache: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "cache",
				Namespace:   namespace,
				Help:        "The cache hits/misses broken down by command (get, touch, etc.).",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"command", "status"},
		),
		commands: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "commands_total",
				Namespace:   namespace,
				Help:        "Count of memcache operations by command (set, flush, etc).",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"command"},
		),
		usage: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "usage",
				Namespace:   namespace,
				Help:        "Details the resource usage (items/connections) of the server, by time (current/total).",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"time", "resource"},
		),
		bytes: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "bytes",
				Namespace:   namespace,
				Help:        "The bytes sent/received by the server.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"direction"},
		),
		removals: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "removal",
				Namespace:   namespace,
				Help:        "Number of items that have been evicted/expired (status), and if the were fetched ever or not.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"status", "fetched"},
		),
		active_slabs: prometheus.NewGauge(
			prometheus.GaugeOpts{
				Name:        "active_slabs",
				Namespace:   namespace,
				Help:        "Total number of slab classes allocated.",
				ConstLabels: prometheus.Labels{"server": server},
			},
		),
		malloced: prometheus.NewGauge(
			prometheus.GaugeOpts{
				Name:        "malloced_bytes",
				Namespace:   namespace,
				Help:        "Total amount of memory allocated to slab pages.",
				ConstLabels: prometheus.Labels{"server": server},
			},
		),
		items_number: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "items_number",
				Namespace:   namespace,
				Help:        "The number of items currently stored in this slab class.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_age: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "items_age_seconds",
				Namespace:   namespace,
				Help:        "The age of the oldest item within the slab class, in seconds.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_evicted: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "items_evicted",
				Namespace:   namespace,
				Help:        "The number of items evicted to make way for new entries.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_evicted_unfetched: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "items_evicted_unfetched",
				Namespace:   namespace,
				Help:        "The number of items evicted and never fetched.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_outofmemory: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "items_outofmemory",
				Namespace:   namespace,
				Help:        "The number of items for this slab class that have triggered an out of memory error.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_tailrepairs: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "items_tail_repairs",
				Namespace:   namespace,
				Help:        "Number of times the entries for a particular ID need repairing",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_reclaimed: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "items_reclaimed",
				Namespace:   namespace,
				Help:        "Items reclaimed",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		items_expired_unfetched: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "items_expired_unfetched",
				Namespace:   namespace,
				Help:        "The number of items expired and never fetched.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_chunk_size: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_chunk_size_bytes",
				Namespace:   namespace,
				Help:        "Space allocated to each chunk within this slab class.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_chunks_per_page: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_chunks_per_page",
				Namespace:   namespace,
				Help:        "Number of chunks within a single page for this slab class.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_total_pages: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_total_pages",
				Namespace:   namespace,
				Help:        "Number of pages allocated to this slab class.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_total_chunks: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_total_chunks",
				Namespace:   namespace,
				Help:        "Number of chunks allocated to the slab class.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_used_chunks: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_used_chunks",
				Namespace:   namespace,
				Help:        "Number of chunks allocated to an item.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_free_chunks: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_free_chunks",
				Namespace:   namespace,
				Help:        "Number of chunks not yet allocated to items.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_free_chunks_end: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_free_chunks_end",
				Namespace:   namespace,
				Help:        "Number of free chunks at the end of the last allocated page.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_mem_requested: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name:        "slabs_mem_requested_bytes",
				Namespace:   namespace,
				Help:        "The age of the oldest item within the slab class, in seconds.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_get_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_get_hits",
				Namespace:   namespace,
				Help:        "Number of get hits to this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_cmd_set: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_set_cmds",
				Namespace:   namespace,
				Help:        "Number of set commands on this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_delete_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_delete_hits",
				Namespace:   namespace,
				Help:        "Number of delete hits to this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_incr_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_incr_hits",
				Namespace:   namespace,
				Help:        "Number of increment hits to this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_decr_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_decr_hits",
				Namespace:   namespace,
				Help:        "Number of decrement hits to this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_cas_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_cas_hits",
				Namespace:   namespace,
				Help:        "Number of CAS hits to this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_cas_badval_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_cas_badval_hits",
				Namespace:   namespace,
				Help:        "Number of CAS hits on this chunk where the existing value did not match.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
		slabs_touch_hits: prometheus.NewCounterVec(
			prometheus.CounterOpts{
				Name:        "slabs_touch_hits",
				Namespace:   namespace,
				Help:        "The number of touch hits to this chunk.",
				ConstLabels: prometheus.Labels{"server": server},
			},
			[]string{"slab"},
		),
	}
}

// Describe describes all the metrics exported by the memcache exporter. It
// implements prometheus.Collector.
func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
	ch <- e.up.Desc()
	ch <- e.uptime.Desc()
	ch <- e.active_slabs.Desc()
	ch <- e.malloced.Desc()

	e.cache.Describe(ch)
	e.commands.Describe(ch)
	e.usage.Describe(ch)
	e.bytes.Describe(ch)
	e.removals.Describe(ch)

	e.items_number.Describe(ch)
	e.items_age.Describe(ch)
	e.items_evicted.Describe(ch)
	e.items_evicted_unfetched.Describe(ch)
	e.items_outofmemory.Describe(ch)
	e.items_tailrepairs.Describe(ch)
	e.items_reclaimed.Describe(ch)
	e.items_expired_unfetched.Describe(ch)

	e.slabs_chunk_size.Describe(ch)
	e.slabs_chunks_per_page.Describe(ch)
	e.slabs_total_pages.Describe(ch)
	e.slabs_total_chunks.Describe(ch)
	e.slabs_used_chunks.Describe(ch)
	e.slabs_free_chunks.Describe(ch)
	e.slabs_free_chunks_end.Describe(ch)
	e.slabs_mem_requested.Describe(ch)
	e.slabs_get_hits.Describe(ch)
	e.slabs_cmd_set.Describe(ch)
	e.slabs_delete_hits.Describe(ch)
	e.slabs_incr_hits.Describe(ch)
	e.slabs_decr_hits.Describe(ch)
	e.slabs_cas_hits.Describe(ch)
	e.slabs_cas_badval_hits.Describe(ch)
	e.slabs_touch_hits.Describe(ch)
}

// Collect fetches the statistics from the configured memcache servers, and
// delivers them as prometheus metrics. It implements prometheus.Collector.
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
	// prevent concurrent metric collections
	e.mutex.Lock()
	defer e.mutex.Unlock()

	e.cache.Reset()
	e.commands.Reset()
	e.usage.Reset()
	e.bytes.Reset()
	e.removals.Reset()

	e.items_number.Reset()
	e.items_age.Reset()
	e.items_evicted.Reset()
	e.items_evicted_unfetched.Reset()
	e.items_outofmemory.Reset()
	e.items_tailrepairs.Reset()
	e.items_reclaimed.Reset()
	e.items_expired_unfetched.Reset()

	e.slabs_chunk_size.Reset()
	e.slabs_chunks_per_page.Reset()
	e.slabs_total_pages.Reset()
	e.slabs_total_chunks.Reset()
	e.slabs_used_chunks.Reset()
	e.slabs_free_chunks.Reset()
	e.slabs_free_chunks_end.Reset()
	e.slabs_mem_requested.Reset()
	e.slabs_get_hits.Reset()
	e.slabs_cmd_set.Reset()
	e.slabs_delete_hits.Reset()
	e.slabs_incr_hits.Reset()
	e.slabs_decr_hits.Reset()
	e.slabs_cas_hits.Reset()
	e.slabs_cas_badval_hits.Reset()
	e.slabs_touch_hits.Reset()

	itemsvecs := map[string]interface{}{
		"number":            e.items_number,
		"age":               e.items_age,
		"evicted":           e.items_evicted,
		"evicted_unfetched": e.items_evicted_unfetched,
		"outofmemory":       e.items_outofmemory,
		"tailrepairs":       e.items_tailrepairs,
		"reclaimed":         e.items_reclaimed,
		"expired_unfetched": e.items_expired_unfetched,
	}

	slabsvecs := map[string]interface{}{
		"chunk_size":      e.slabs_chunk_size,
		"chunks_per_page": e.slabs_chunks_per_page,
		"total_pages":     e.slabs_total_pages,
		"total_chunks":    e.slabs_total_chunks,
		"used_chunks":     e.slabs_used_chunks,
		"free_chunks":     e.slabs_free_chunks,
		"free_chunks_end": e.slabs_free_chunks_end,
		"mem_requested":   e.slabs_mem_requested,
		"get_hits":        e.slabs_get_hits,
		"cmd_set":         e.slabs_cmd_set,
		"delete_hits":     e.slabs_delete_hits,
		"incr_hits":       e.slabs_incr_hits,
		"decr_hits":       e.slabs_decr_hits,
		"cas_hits":        e.slabs_cas_hits,
		"cas_badval":      e.slabs_cas_badval_hits,
		"touch_hits":      e.slabs_touch_hits,
	}

	stats, err := e.mc.Stats()

	if err != nil {
		e.up.Set(0)
		ch <- e.up
		glog.Infof("Failed to collect stats from memcache: %s", err)
		return
	}

	e.up.Set(1)
	for server, _ := range stats {
		m, err := strconv.ParseUint(stats[server].Stats["uptime"], 10, 64)
		if err != nil {
			e.uptime.Set(0)
		} else {
			e.uptime.Set(float64(m))
		}
		m, err = strconv.ParseUint(stats[server].Stats["total_malloced"], 10, 64)
		if err != nil {
			e.malloced.Set(0)
		} else {
			e.malloced.Set(float64(m))
		}
		m, err = strconv.ParseUint(stats[server].Stats["active_slabs"], 10, 64)
		if err != nil {
			e.active_slabs.Set(0)
		} else {
			e.active_slabs.Set(float64(m))
		}

		for key, vector := range itemsvecs {
			for slab := range stats[server].Items {
				var value float64
				m, err := strconv.ParseUint(stats[server].Items[slab][key], 10, 64)
				if err == nil {
					value = float64(m)
				}
				switch vector := vector.(type) {
				case *prometheus.GaugeVec:
					vector.WithLabelValues(fmt.Sprintf("%d", slab)).Set(value)
				case *prometheus.CounterVec:
					vector.WithLabelValues(fmt.Sprintf("%d", slab)).Set(value)
				}
			}
		}

		for key, vector := range slabsvecs {
			for slab := range stats[server].Slabs {
				var value float64
				m, err := strconv.ParseUint(stats[server].Items[slab][key], 10, 64)
				if err == nil {
					value = float64(m)
				}
				switch vector := vector.(type) {
				case *prometheus.GaugeVec:
					vector.WithLabelValues(fmt.Sprintf("%d", slab)).Set(value)
				case *prometheus.CounterVec:
					vector.WithLabelValues(fmt.Sprintf("%d", slab)).Set(value)
				}
			}
		}

		for _, op := range cacheOperations {
			for _, st := range cacheStatuses {
				m, err := strconv.ParseUint(stats[server].Stats[fmt.Sprintf("%s_%s", op, st)], 10, 64)
				if err != nil {
					e.cache.WithLabelValues(op, st).Set(0)
				} else {
					e.cache.WithLabelValues(op, st).Set(float64(m))
				}
			}
		}

		for _, op := range cmdCounts {
			m, err := strconv.ParseUint(stats[server].Stats[fmt.Sprintf("cmd_%s", op)], 10, 64)
			if err != nil {
				e.commands.WithLabelValues(op).Set(0)
			} else {
				e.commands.WithLabelValues(op).Set(float64(m))
			}
		}

		for _, t := range usageTimes {
			for _, r := range usageResources {
				m, err := strconv.ParseUint(stats[server].Stats[fmt.Sprintf("%s_%s", t, r)], 10, 64)
				if err != nil {
					e.usage.WithLabelValues(t, r).Set(0)
				} else {
					e.usage.WithLabelValues(t, r).Set(float64(m))
				}
			}
		}

		for _, dir := range bytesDirections {
			m, err := strconv.ParseUint(stats[server].Stats[fmt.Sprintf("bytes_%s", dir)], 10, 64)
			if err != nil {
				e.bytes.WithLabelValues(dir).Set(0)
			} else {
				e.bytes.WithLabelValues(dir).Set(float64(m))
			}
		}

		for _, st := range removalsStatuses {
			m, err := strconv.ParseUint(stats[server].Stats[fmt.Sprintf("%s_unfetched", st)], 10, 64)
			if err != nil {
				e.removals.WithLabelValues(st, "unfetched").Set(0)
			} else {
				e.removals.WithLabelValues(st, "unfetched").Set(float64(m))
			}
		}
		m, err = strconv.ParseUint(stats[server].Stats["evicted"], 10, 64)
		if err != nil {
			e.removals.WithLabelValues("evicted", "fetched").Set(0)
		} else {
			e.removals.WithLabelValues("evicted", "fetched").Set(float64(m))
		}
	}

	ch <- e.up
	ch <- e.uptime
	ch <- e.malloced
	ch <- e.active_slabs
	e.cache.Collect(ch)
	e.commands.Collect(ch)
	e.usage.Collect(ch)
	e.bytes.Collect(ch)
	e.removals.Collect(ch)

	for _, vector := range itemsvecs {
		switch vector := vector.(type) {
		case *prometheus.CounterVec:
			vector.Collect(ch)
		case *prometheus.GaugeVec:
			vector.Collect(ch)
		}
	}
	for _, vector := range slabsvecs {
		switch vector := vector.(type) {
		case *prometheus.CounterVec:
			vector.Collect(ch)
		case *prometheus.GaugeVec:
			vector.Collect(ch)
		}
	}
}

func main() {
	var (
		listenAddress = flag.String("web.listen-address", ":9106", "Address to listen on for web interface and telemetry.")
		metricsPath   = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.")
	)

	flag.Parse()

	for _, server := range flag.Args() {
		exporter := NewExporter(server)
		prometheus.MustRegister(exporter)
	}

	http.Handle(*metricsPath, prometheus.Handler())
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte(`
             <title>Memcached Exporter</title>

Memcached Exporter

<a href='` + *metricsPath + `'>Metrics

             `))
	})
	glog.Fatal(http.ListenAndServe(*listenAddress, nil))
}


text:
{-# LANGUAGE Haskell98 #-}
{-# LINE 1 "Blaze/ByteString/Builder/Char8.hs" #-}
------------------------------------------------------------------------------
-- |
-- Module:      Blaze.ByteString.Builder.Char8
-- Copyright:   (c) 2013 Leon P Smith
-- License:     BSD3
-- Maintainer:  Leon P Smith <leon@melding-monads.com>
-- Stability:   experimental
--
-- //Note:// This package is intended for low-level use like implementing
-- protocols. If you need to //serialize// Unicode characters use one of the
-- UTF encodings (e.g. 'Blaze.ByteString.Builder.Char.UTF-8').
--
-- 'Write's and 'Builder's for serializing the lower 8-bits of characters.
--
-- This corresponds to what the 'bytestring' package offer in
-- 'Data.ByteString.Char8'.
--
------------------------------------------------------------------------------

module Blaze.ByteString.Builder.Char8
    (
      -- * Writing Latin-1 (ISO 8859-1) encodable characters to a buffer
      writeChar

      -- * Creating Builders from Latin-1 (ISO 8859-1) encodable characters
    , fromChar
    , fromString
    , fromShow
    , fromText
    , fromLazyText
    ) where

import Blaze.ByteString.Builder.Compat.Write ( Write, writePrimFixed )
import           Data.ByteString.Builder ( Builder )
import qualified Data.ByteString.Builder as B
import qualified Data.ByteString.Builder.Prim as P
import qualified Data.Text      as TS
import qualified Data.Text.Lazy as TL

-- | Write the lower 8-bits of a character to a buffer.
writeChar :: Char -> Write
writeChar = writePrimFixed P.char8
{-# INLINE writeChar #-}

-- | /O(1)/. Serialize the lower 8-bits of a character.
fromChar :: Char -> Builder
fromChar = B.char8
{-# INLINE fromChar #-}

-- | /O(n)/. Serialize the lower 8-bits of all characters of a string
fromString :: String -> Builder
fromString = P.primMapListFixed P.char8
{-# INLINE fromString #-}

-- | /O(n)/. Serialize a value by 'Show'ing it and serializing the lower 8-bits
-- of the resulting string.
fromShow :: Show a => a -> Builder
fromShow = fromString . show
{-# INLINE fromShow #-}

-- | /O(n)/. Serialize the lower 8-bits of all characters in the strict text.
fromText :: TS.Text -> Builder
fromText = fromString . TS.unpack
{-# INLINE fromText #-}

-- | /O(n)/. Serialize the lower 8-bits of all characters in the lazy text.
fromLazyText :: TL.Text -> Builder
fromLazyText = fromString . TL.unpack
{-# INLINE fromLazyText #-}


text:
ASMJIT_BEGIN_NAMESPACE

// ZoneStackBase - Init & Reset
// ============================

Error ZoneStackBase::_init(ZoneAllocator* allocator, size_t middleIndex) noexcept {
  ZoneAllocator* oldAllocator = _allocator;

  if (oldAllocator) {
    Block* block = _block[kBlockIndexFirst];
    while (block) {
      Block* next = block->next();
      oldAllocator->release(block, kBlockSize);
      block = next;
    }

    _allocator = nullptr;
    _block[kBlockIndexFirst] = nullptr;
    _block[kBlockIndexLast] = nullptr;
  }

  if (allocator) {
    Block* block = static_cast<Block*>(allocator->alloc(kBlockSize));
    if (ASMJIT_UNLIKELY(!block))
      return DebugUtils::errored(kErrorOutOfMemory);

    block->_link[kBlockIndexPrev] = nullptr;
    block->_link[kBlockIndexNext] = nullptr;
    block->_start = (uint8_t*)block + middleIndex;
    block->_end = (uint8_t*)block + middleIndex;

    _allocator = allocator;
    _block[kBlockIndexFirst] = block;
    _block[kBlockIndexLast] = block;
  }

  return kErrorOk;
}

// ZoneStackBase - Operations
// ==========================

Error ZoneStackBase::_prepareBlock(uint32_t side, size_t initialIndex) noexcept {
  ASMJIT_ASSERT(isInitialized());

  Block* prev = _block[side];
  ASMJIT_ASSERT(!prev->empty());

  Block* block = _allocator->allocT<Block>(kBlockSize);
  if (ASMJIT_UNLIKELY(!block))
    return DebugUtils::errored(kErrorOutOfMemory);

  block->_link[ side] = nullptr;
  block->_link[!side] = prev;
  block->_start = (uint8_t*)block + initialIndex;
  block->_end = (uint8_t*)block + initialIndex;

  prev->_link[side] = block;
  _block[side] = block;

  return kErrorOk;
}

void ZoneStackBase::_cleanupBlock(uint32_t side, size_t middleIndex) noexcept {
  Block* block = _block[side];
  ASMJIT_ASSERT(block->empty());

  Block* prev = block->_link[!side];
  if (prev) {
    ASMJIT_ASSERT(prev->_link[side] == block);
    _allocator->release(block, kBlockSize);

    prev->_link[side] = nullptr;
    _block[side] = prev;
  }
  else if (_block[!side] == block) {
    // If the container becomes empty center both pointers in the remaining block.
    block->_start = (uint8_t*)block + middleIndex;
    block->_end = (uint8_t*)block + middleIndex;
  }
}

// ZoneStack - Tests
// =================

#if defined(ASMJIT_TEST)
template<typename T>
static void test_zone_stack(ZoneAllocator* allocator, const char* typeName) {
  ZoneStack<T> stack;

  INFO("Testing ZoneStack<%s>", typeName);
  INFO("  (%d items per one Block)", ZoneStack<T>::kNumBlockItems);

  EXPECT(stack.init(allocator) == kErrorOk);
  EXPECT(stack.empty(), "Stack must be empty after `init()`");

  EXPECT(stack.append(42) == kErrorOk);
  EXPECT(!stack.empty()        , "Stack must not be empty after an item has been appended");
  EXPECT(stack.pop() == 42     , "Stack.pop() must return the item that has been appended last");
  EXPECT(stack.empty()         , "Stack must be empty after the last item has been removed");

  EXPECT(stack.prepend(43) == kErrorOk);
  EXPECT(!stack.empty()        , "Stack must not be empty after an item has been prepended");
  EXPECT(stack.popFirst() == 43, "Stack.popFirst() must return the item that has been prepended last");
  EXPECT(stack.empty()         , "Stack must be empty after the last item has been removed");

  int i;
  int iMin =-100000;
  int iMax = 100000;

  INFO("Validating prepend() & popFirst()");
  for (i = iMax; i >= 0; i--) stack.prepend(T(i));
  for (i = 0; i <= iMax; i++) {
    T item = stack.popFirst();
    EXPECT(i == item, "Item '%d' didn't match the item '%lld' popped", i, (long long)item);
    if (!stack.empty()) {
      item = stack.popFirst();
      EXPECT(i + 1 == item, "Item '%d' didn't match the item '%lld' popped", i + 1, (long long)item);
      stack.prepend(item);
    }
  }
  EXPECT(stack.empty());

  INFO("Validating append() & pop()");
  for (i = 0; i <= iMax; i++) stack.append(T(i));
  for (i = iMax; i >= 0; i--) {
    T item = stack.pop();
    EXPECT(i == item, "Item '%d' didn't match the item '%lld' popped", i, (long long)item);
    if (!stack.empty()) {
      item = stack.pop();
      EXPECT(i - 1 == item, "Item '%d' didn't match the item '%lld' popped", i - 1, (long long)item);
      stack.append(item);
    }
  }
  EXPECT(stack.empty());

  INFO("Validating append()/prepend() & popFirst()");
  for (i = 1; i <= iMax; i++) stack.append(T(i));
  for (i = 0; i >= iMin; i--) stack.prepend(T(i));

  for (i = iMin; i <= iMax; i++) {
    T item = stack.popFirst();
    EXPECT(i == item, "Item '%d' didn't match the item '%lld' popped", i, (long long)item);
  }
  EXPECT(stack.empty());

  INFO("Validating append()/prepend() & pop()");
  for (i = 0; i >= iMin; i--) stack.prepend(T(i));
  for (i = 1; i <= iMax; i++) stack.append(T(i));

  for (i = iMax; i >= iMin; i--) {
    T item = stack.pop();
    EXPECT(i == item, "Item '%d' didn't match the item '%lld' popped", i, (long long)item);
  }
  EXPECT(stack.empty());
}

UNIT(zone_stack) {
  Zone zone(8096 - Zone::kBlockOverhead);
  ZoneAllocator allocator(&zone);

  test_zone_stack<int>(&allocator, "int");
  test_zone_stack<int64_t>(&allocator, "int64_t");
}
#endif

ASMJIT_END_NAMESPACE


text:
<?php
declare(strict_types = 1);

namespace Innmind\Rest\Server\Serializer\Denormalizer;

use Innmind\Rest\Server\{
    HttpResource\HttpResource as Resource,
    HttpResource\Property,
    Definition\HttpResource as ResourceDefinition,
    Definition\Property as PropertyDefinition,
    Definition\Access,
    Exception\DenormalizationException,
    Exception\HttpResourceDenormalizationException,
};
use Innmind\Immutable\{
    Map,
    Set,
};

final class HttpResource
{
    public function __invoke(
        array $data,
        ResourceDefinition $definition,
        Access $mask
    ): Resource {
        $errors = Map::of('string', DenormalizationException::class);
        /** @var array */
        $data = $data['resource'];

        /** @var Map<string, Property> */
        $properties = $definition
            ->properties()
            ->reduce(
                Map::of('string', Property::class),
                static function(
                    Map $properties,
                    string $name,
                    PropertyDefinition $definition
                ) use (
                    &$errors,
                    $data,
                    $mask
                ): Map {
                    if (
                        !$definition->access()->matches($mask) &&
                        isset($data[$name])
                    ) {
                        /**
                         * @psalm-suppress MixedMethodCall
                         * @psalm-suppress MixedAssignment
                         */
                        $errors = $errors->put(
                            $name,
                            new DenormalizationException('The field is not allowed')
                        );

                        return $properties;
                    }

                    if (
                        !isset($data[$name]) &&
                        $definition->access()->matches($mask)
                    ) {
                        if ($definition->isOptional()) {
                            return $properties;
                        }

                        /**
                         * @psalm-suppress MixedMethodCall
                         * @psalm-suppress MixedAssignment
                         */
                        $errors = $errors->put(
                            $name,
                            new DenormalizationException('The field is missing')
                        );

                        return $properties;
                    }

                    if (
                        !isset($data[$name]) &&
                        !$definition->access()->matches($mask)
                    ) {
                        return $properties;
                    }

                    try {
                        /** @psalm-suppress MixedArrayAccess */
                        $properties = $properties->put(
                            $name,
                            new Property(
                                $name,
                                $definition->type()->denormalize($data[$name])
                            )
                        );
                    } catch (DenormalizationException $e) {
                        /**
                         * @psalm-suppress MixedMethodCall
                         * @psalm-suppress MixedAssignment
                         */
                        $errors = $errors->put($name, $e);
                    }

                    return $properties;
                }
            );

        /** @psalm-suppress MixedMethodCall */
        if ($errors->size() > 0) {
            /** @psalm-suppress MixedArgument */
            throw new HttpResourceDenormalizationException($errors);
        }

        return new Resource($definition, $properties);
    }
}


text:
package excx.buttons;

import excx.ExcX;
import excx.entities.player.PlayerType;

public class ButtonCommandPlayerSelect extends ButtonCommand{
	PlayerType p;

	public ButtonCommandPlayerSelect(PlayerType pl){
		p = pl;
	}

	@Override
	void execute() {
		ExcX.game.setPlayer(p);
		ExcX.game.prepare();
		ExcX.setState(ExcX.game);
	}

}


text: [Simple, cross-platform, continuous, bidirectional file synchronization for remote development ](https://github.com/havoc-io/mutagen)