text:
/*jshint globalstrict:false, strict:false, maxlen:1000*/
/*global assertEqual, assertTrue, assertFalse, fail, more */

////////////////////////////////////////////////////////////////////////////////
/// @brief test the statement class
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////

const jsunity = require("jsunity");

const arangodb = require("@arangodb");
const queries = require('@arangodb/aql/queries');
const db = arangodb.db;

////////////////////////////////////////////////////////////////////////////////
/// @brief test suite: statements
////////////////////////////////////////////////////////////////////////////////

function StatementSuite () {
  'use strict';
  return {

////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////

    setUp : function () {
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////

    tearDown : function () {
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief test cursor
////////////////////////////////////////////////////////////////////////////////

    testCursor : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i", count: true });
      var cursor = stmt.execute();

      assertEqual(11, cursor.count());
      for (var i = 1; i <= 11; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 11, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief test to string
////////////////////////////////////////////////////////////////////////////////

    testToString : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i", count: true });
      var cursor = stmt.execute();

      assertEqual(11, cursor.count());
      assertTrue(cursor.hasNext());

      // print it. this should not modify the cursor apart from when it's accessed for printing
      cursor.toString();
      assertTrue(more === cursor);

      for (var i = 1; i <= 11; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 11, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief test more
////////////////////////////////////////////////////////////////////////////////

    testMore : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i", count: true });
      var cursor = stmt.execute();

      assertEqual(11, cursor.count());
      assertTrue(cursor.hasNext());

      // print it. this should not modify the cursor apart from when it's accessed for printing
      cursor.toString();
      assertTrue(more === cursor);

      cursor.toString();
      for (var i = 1; i <= 11; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 11, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief test more
////////////////////////////////////////////////////////////////////////////////

    testMoreEof : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i", count: true });
      var cursor = stmt.execute();

      assertEqual(11, cursor.count());
      assertTrue(cursor.hasNext());

      // print it. this should not modify the cursor apart from when it's accessed for printing
      cursor.toString();
      assertTrue(more === cursor);

      cursor.toString();
      try {
        cursor.toString();
        fail();
      } catch (err) {
        // we're expecting the cursor to be at the end
      }

      assertTrue(cursor.hasNext());
      for (var i = 1; i <= 11; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 11, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    }

  };
}

////////////////////////////////////////////////////////////////////////////////
/// @brief test suite: statements
////////////////////////////////////////////////////////////////////////////////

function StatementStreamSuite () {
  'use strict';

  return {

////////////////////////////////////////////////////////////////////////////////
/// @brief set up
////////////////////////////////////////////////////////////////////////////////

    setUp : function () {
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////

    tearDown : function () {
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief test cursor
////////////////////////////////////////////////////////////////////////////////

    testStreamCursor : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..100 RETURN i",
                                       options: { stream: true },
                                       batchSize: 50});
      var cursor = stmt.execute();

      assertEqual(undefined, cursor.count());
      for (var i = 1; i <= 100; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 100, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    },

    testStreamCursorOnTopLevel : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..100 RETURN i",
                                       stream: true,
                                       batchSize: 50});
      var cursor = stmt.execute();

      assertEqual(undefined, cursor.count());
      for (var i = 1; i <= 100; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 100, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    },

////////////////////////////////////////////////////////////////////////////////
/// @brief test to string
////////////////////////////////////////////////////////////////////////////////

    testStreamToString : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i",
                                       options: { stream: true } });
      var cursor = stmt.execute();

      assertEqual(undefined, cursor.count()); // count is not supported
      assertTrue(cursor.hasNext());

      // print it. this should not modify the cursor apart from when it's accessed for printing
      cursor.toString();
      assertTrue(more === cursor);
      assertTrue(cursor._stream);

      for (var i = 1; i <= 11; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 11, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    },

    testStreamToStringOnTopLevel : function () {
      var stmt = db._createStatement({ query: "FOR i IN 1..11 RETURN i",
                                       stream: true });
      var cursor = stmt.execute();

      assertEqual(undefined, cursor.count()); // count is not supported
      assertTrue(cursor.hasNext());

      // print it. this should not modify the cursor apart from when it's accessed for printing
      cursor.toString();
      assertTrue(more === cursor);
      assertTrue(cursor._stream);

      for (var i = 1; i <= 11; ++i) {
        assertEqual(i, cursor.next());
        assertEqual(i !== 11, cursor.hasNext());
      }

      assertFalse(cursor.hasNext());
    }

  };
}

////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suite
////////////////////////////////////////////////////////////////////////////////

jsunity.run(StatementSuite);
jsunity.run(StatementStreamSuite);
return jsunity.done();


text:
package gov.hhs.fha.nhinc.transform.policy;

//import com.sun.jmx.remote.internal.Unmarshal;
import gov.hhs.fha.nhinc.common.eventcommon.SubscribeEventType;
import gov.hhs.fha.nhinc.common.nhinccommonadapter.CheckPolicyRequestType;
import gov.hhs.fha.nhinc.nhinclib.NullChecker;
import gov.hhs.fha.nhinc.transform.marshallers.JAXBContextHandler;
import gov.hhs.fha.nhinc.util.format.PatientIdFormatUtil;
import gov.hhs.fha.nhinc.xmlCommon.XmlUtility;
import java.io.StringReader;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest;
import oasis.names.tc.ebxml_regrep.xsd.rim._3.AdhocQueryType;
import oasis.names.tc.xacml._2_0.context.schema.os.RequestType;
import oasis.names.tc.xacml._2_0.context.schema.os.ResourceType;
import oasis.names.tc.xacml._2_0.context.schema.os.SubjectType;
import org.apache.log4j.Logger;
import org.oasis_open.docs.wsn.b_2.Subscribe;
import org.oasis_open.docs.wsn.b_2.TopicExpressionType;
import org.w3c.dom.Element;

/**
 *
 * @author svalluripalli
 */
public class SubscribeTransformHelper {

    private static final Logger LOG = Logger.getLogger(SubscribeTransformHelper.class);
    private static final String ActionInValue = "HIEMSubscriptionRequestIn";
    private static final String ActionOutValue = "HIEMSubscriptionRequestOut";
    private static final String PatientAssigningAuthorityAttributeId = Constants.AssigningAuthorityAttributeId;
    private static final String PatientIdAttributeId = Constants.ResourceIdAttributeId;
    private static final String ATTRIBUTE_ID_TOPIC = Constants.ATTRIBUTE_ID_SUBSCRIPTION_TOPIC;

    public static CheckPolicyRequestType transformSubscribeToCheckPolicy(SubscribeEventType event) {
        CheckPolicyRequestType genericPolicyRequest = new CheckPolicyRequestType();
        RequestType request = new RequestType();
        if (InboundOutboundChecker.isInbound(event.getDirection())) {
            request.setAction(ActionHelper.actionFactory(ActionInValue));
        }
        if (InboundOutboundChecker.isOutbound(event.getDirection())) {
            request.setAction(ActionHelper.actionFactory(ActionOutValue));
        }

        SubjectHelper subjHelp = new SubjectHelper();
        SubjectType subject = subjHelp.subjectFactory(event.getSendingHomeCommunity(), event.getMessage()
            .getAssertion());
        request.getSubject().add(subject);

        AdhocQueryRequest adhocReq = new AdhocQueryRequest();
        AdhocQueryType adhocQuery = null;
        adhocQuery = getAdhocQuery(event.getMessage().getSubscribe());
        adhocReq.setAdhocQuery(adhocQuery);
        String patId = AdhocQueryTransformHelper.extractPatientIdentifierId(adhocReq);
        String assignAuth = AdhocQueryTransformHelper.extractPatientIdentifierAssigningAuthority(adhocReq);

        ResourceType resource = new ResourceType();
        AttributeHelper attrHelper = new AttributeHelper();

        if (NullChecker.isNotNullish(assignAuth)) {
            resource.getAttribute().add(
                attrHelper.attributeFactory(PatientAssigningAuthorityAttributeId, Constants.DataTypeString,
                assignAuth));
        }

        if (NullChecker.isNotNullish(patId)) {
            String sStrippedPatientId = PatientIdFormatUtil.parsePatientId(patId);
            LOG.debug("transformSubscribeToCheckPolicy: sStrippedPatientId = " + sStrippedPatientId);
            resource.getAttribute().add(
                attrHelper.attributeFactory(PatientIdAttributeId, Constants.DataTypeString, sStrippedPatientId));
        }

        setTopic(event, resource);

        request.getResource().add(resource);

        AssertionHelper assertHelp = new AssertionHelper();
        assertHelp.appendAssertionDataToRequest(request, event.getMessage().getAssertion());

        genericPolicyRequest.setRequest(request);
        genericPolicyRequest.setAssertion(event.getMessage().getAssertion());
        return genericPolicyRequest;
    }

    private static void setTopic(SubscribeEventType event, ResourceType resource) {
        String topic = null;
        try {
            LOG.debug("######## BEGIN TOPIC EXTRACTION ########");
            JAXBElement<TopicExpressionType> jbElement = (JAXBElement<TopicExpressionType>) event.getMessage()
                .getSubscribe().getFilter().getAny().get(0);
            TopicExpressionType topicExpression = jbElement.getValue();
            topic = (String) topicExpression.getContent().get(0);
            LOG.debug("Topic extracted: " + topic);
        } catch (Throwable t) {
            LOG.error("Error extracting the topic: " + t.getMessage(), t);
        }
        if (NullChecker.isNotNullish(topic)) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Adding topic (" + topic + ") as attribute (" + ATTRIBUTE_ID_TOPIC + ") and type: "
                    + Constants.DataTypeString);
            }
            AttributeHelper attrHelper = new AttributeHelper();
            resource.getAttribute().add(
                attrHelper.attributeFactory(ATTRIBUTE_ID_TOPIC, Constants.DataTypeString, topic));
        }
    }

    public static AdhocQueryType getAdhocQuery(Subscribe nhinSubscribe) {
        AdhocQueryType adhocQuery = null;
        List<Object> any = nhinSubscribe.getAny();

        for (Object anyItem : any) {
            LOG.debug("SubscribeTransformHelper.getAdhocQuery - type of any in list: " + anyItem.getClass().getName());
            if (anyItem instanceof oasis.names.tc.ebxml_regrep.xsd.rim._3.AdhocQueryType) {
                LOG.debug("Any item was oasis.names.tc.ebxml_regrep.xsd.rim._3.AdhocQueryType");
                adhocQuery = (AdhocQueryType) anyItem;
            } else if (anyItem instanceof JAXBElement) {
                LOG.debug("Any item was JAXBElement");
                if (((JAXBElement) anyItem).getValue() instanceof AdhocQueryType) {
                    LOG.debug("Any item - JAXBElement value was AdhocQueryType");
                    adhocQuery = (AdhocQueryType) ((JAXBElement) anyItem).getValue();
                }
            } else if (anyItem instanceof Element) {
                LOG.debug("Any item was Element");
                Element element = (Element) anyItem;
                LOG.debug("SubscribeTransformHelper.getAdhocQuery - element name of any in list: "
                    + element.getLocalName());
                adhocQuery = unmarshalAdhocQuery(element);
            } else {
                LOG.debug("Any type did not fit any expected value");
            }
        }
        return adhocQuery;
    }

    public static AdhocQueryType unmarshalAdhocQuery(Element adhocQueryElement) {
        AdhocQueryType unmarshalledObject = null;
        String contextPath = "oasis.names.tc.ebxml_regrep.xsd.rim._3";
        LOG.debug("begin unmarshal");

        if (adhocQueryElement == null) {
            LOG.warn("element to unmarshal is null");
        } else {
            try {
                LOG.debug("desializing element");
                String serializedElement = XmlUtility.serializeElement(adhocQueryElement);
                LOG.debug("serializedElement=[" + serializedElement + "]");
                LOG.debug("get instance of JAXBContext [contextPath='" + contextPath + "']");
                JAXBContextHandler oHandler = new JAXBContextHandler();
                JAXBContext jc = oHandler.getJAXBContext(contextPath);
                LOG.debug("get instance of unmarshaller");
                javax.xml.bind.Unmarshaller unmarshaller = jc.createUnmarshaller();
                LOG.debug("init stringReader");
                StringReader stringReader = new StringReader(serializedElement);
                LOG.debug("Calling unmarshal");
                JAXBElement<AdhocQueryType> jaxbElement = (JAXBElement<AdhocQueryType>) unmarshaller
                    .unmarshal(stringReader);
                LOG.debug("unmarshalled to JAXBElement");
                unmarshalledObject = jaxbElement.getValue();
                LOG.debug("end unmarshal");
            } catch (Exception e) {
                // "java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory"
                // use jaxb element
                LOG.error("Failed to unmarshall: " + e.getMessage(), e);
                unmarshalledObject = null;
            }
        }

        return unmarshalledObject;
    }
}

redpajama_set_name: RedPajamaGithub


text:
Selected Fields Providers
=========================

Table of contents
-----------------

- [Overview](#overview)
- [How to Use](#how-to-use)
- [Selected Fields Provider](#selected-fields-provider)
- [Fields Required by Columns](#fields-required-by-columns)
- [Fields Required by Sorters](#fields-required-by-sorters)
- [How to Customize](#how-to-customize)

Overview
--------

The selected fields providers must implement interface `Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsProviderInterface`.
Selected fields provider returns an array of field names which must be present in the select statement of the datasource
query according to the given datagrid configuration and parameters. In other words, depending on the datagrid configuration
and parameters (request- and user-specific), it must return the fields needed to be displayed / processed for the datagrid to be rendered correctly.

Please keep in mind that the word `field` here does not mean an `entity field` or `extended field`, but rather
a field which must be present in the select statement of a query.

OroDatagridBundle provides 2 selected fields providers out-of-box:

* `oro_datagrid.provider.selected_fields.columns` (`Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsFromColumnsProvider`)
* `oro_datagrid.provider.selected_fields.sorters` (`Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsFromSortersProvider`)

These providers are collected in the `oro_datagrid.provider.selected_fields` (`Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsProvider`)
service which calls all its inner providers and returns an array of unique field names.

How to Use
----------

Selected fields providers enable fetching field names which must be present in the datasource
query of the datagrid. This data can be used in datagrid extensions which modify the datagrid configuration, add new columns,
sorters, etc. The purpose is **to detect whether it is necessary to add a certain field or join the datasource query as not every
field added to the query is actually displayed to the end user. This can greatly help to improve performance of datagrids that
work with tables which can have many records.**

For example, the `oro_datagrid.provider.selected_fields` service is used in the `oro_entity_extend.datagrid.extension.dynamic_fields` datagrid extension to prevent adding joins for extended fields which are not going to be displayed to the end user.

Selected Fields Provider
------------------------

The `Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsProvider` composite provider is declared as
the `oro_datagrid.provider.selected_fields` service which returns selected fields from all inner providers.

Example:

``` php
$selectedFieldsStateProvider = $this->container->get('oro_datagrid.provider.selected_fields');
$selectedFields = $selectedFieldsStateProvider->getSelectedFields($datagridConfiguration, $datagridParameters);
var_export($selectedFields);
// Will output
//['sampleField1', 'sampleColumn2']
```

Fields Required by Columns
--------------------------

The `Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsFromColumnsProvider`  provider is declared as
the `oro_datagrid.provider.selected_fields.columns` service. It returns fields (used in renderable columns) which must be
present in the select statement of the datasource query.

It uses `Oro\Bundle\DataGridBundle\Provider\State\ColumnsStateProvider` to fetch the current state of columns, then collects
`data_name` configuration options from columns which are currently `renderable` (visible).

Keep in mind that the resulting array of fields can differ depending on the moment when provider is called, because it
fetches data from the datagrid configuration and state which can be changed by extensions and listeners.

The `oro_datagrid.provider.selected_fields.columns` service is not intended to be used directly. Use the `oro_datagrid.provider.selected_fields` service instead to get a full list of selected fields. However, you can use it if you specifically need those fields that are used in renderable columns.

Fields Required by Sorters
--------------------------

The `Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsFromSortersProvider` provider is declared as
a `oro_datagrid.provider.selected_fields.sorters` service. It returns an array of field names (required by applied sorters)
which must be present in the select statement of the datasource query.

It uses `Oro\Bundle\DataGridBundle\Provider\State\SortersStateProvider` to fetch the current state of sorters, then collects
`data_name` configuration options from sorters which are currently applied.

Keep in mind that the resulting array of fields can differ depending on the moment when provider is called, because it
fetches data from the datagrid configuration and state which can be changed by extensions and listeners.

The `oro_datagrid.provider.selected_fields.sorters` service is not intended to be used directly. Use `oro_datagrid.provider.selected_fields`
service instead to get a full list of selected fields. However, you can use it if you specifically need those fields that are required needed by applied sorters.

How to Customize
----------------

You can create your own selected fields provider by implementing `Oro\Bundle\DataGridBundle\Provider\SelectedFields\SelectedFieldsProviderInterface`.
You should define it as a service with the `oro_datagrid.selected_fields_provider` tag.


text:
<?php

namespace Deployer\Task;

use Deployer\Component\PharUpdate\Exception\InvalidArgumentException;
use Deployer\Host\Host;
use Deployer\Host\HostCollection;
use PHPUnit\Framework\TestCase;

class ScriptManagerTest extends TestCase
{
    public function testConstructorReturnsScriptManagerInstance()
    {
        $scriptManager = new ScriptManager(new TaskCollection());
        $classname = 'Deployer\Task\ScriptManager';

        $this->assertInstanceOf($classname, $scriptManager);
    }

    public function testThrowsExceptionIfTaskCollectionEmpty()
    {
        $this->expectException(\InvalidArgumentException::class);

        $scriptManager = new ScriptManager(new TaskCollection());
        $scriptManager->getTasks("");
    }

    public function testThrowsExceptionIfTaskDontExists()
    {
        $this->expectException(\InvalidArgumentException::class);

        $taskCollection = new TaskCollection();
        $taskCollection->set('testTask', new Task('testTask'));

        $scriptManager = new ScriptManager($taskCollection);
        $scriptManager->getTasks("testTask2");
    }

    public function testReturnsArrayOnGetTask()
    {
        $hostCollection = new HostCollection();
        $hostCollection->set('app', (new Host('app'))->stage('prod')->roles('app'));
        $hostCollection->set('db', (new Host('db'))->stage('prod')->roles('db'));

        $task = new Task('compile');
        $task
            ->onStage('prod')
            ->onRoles('app');

        $taskCollection = new TaskCollection();
        $taskCollection->set('compile', $task);

        $scriptManager = new ScriptManager($taskCollection, $hostCollection);

        $this->assertNotEmpty($scriptManager->getTasks("compile"));

        $task = new Task('dump');
        $task
            ->onStage('prod')
            ->onRoles('db');

        $taskCollection = new TaskCollection();
        $taskCollection->set('dump', $task);

        $scriptManager = new ScriptManager($taskCollection, $hostCollection);

        $this->assertNotEmpty($scriptManager->getTasks("dump"));
    }
}


text:
package routines.system.api;

import java.util.Map;

/**
 * Describes the generic Endpoint
 */
public interface ESBEndpointInfo {

    /**
     * Returns a component identifier that should be used
     * to be configured with given {@link ESBEndpointInfo}
     *
     * @return a non-null {@link String} unique for type of endpoint
     */
    String getEndpointKey();

    /**
     * Returns a URI String for the endpoint.
     * This URI should be understood by the consumer
     * with given {@link #getEndpointKey()}
     *
     * @return a non-null {@link String}, ideally a URI
     */
    String getEndpointUri();

    /**
     * Additional endpoint properties that
     * would be required to configure endpoint
     *
     * @return
     */
    Map<String, Object> getEndpointProperties();

}


text:
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

$app->get('/', function() use ($app) {
	$tasks = \App\Task::orderBy('created_at', 'desc')->get();
	return view('index', ['tasks' => $tasks]);
});

$app->post('tasks/{id}/toggle-complete', 'TaskController@toggleComplete');
$app->post('tasks', 'TaskController@create');
$app->post('tasks/clear-complete', 'TaskController@clearComplete');


text:
<?php

namespace Relhub\WebBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ReleaseBuildType extends AbstractType
{
        /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('actions', 'collection', array(
            'type'   => 'hidden',
        ));
        $builder
           ->add('confirm', 'submit')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Relhub\WebBundle\Entity\ReleaseBuild'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'relhub_webbundle_releasebuild';
    }
}


text:
package org.encog.ml.svm;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.Map;

import org.encog.mathutil.libsvm.svm;
import org.encog.mathutil.libsvm.svm_model;
import org.encog.persist.EncogFileSection;
import org.encog.persist.EncogPersistor;
import org.encog.persist.EncogReadHelper;
import org.encog.persist.EncogWriteHelper;
import org.encog.persist.PersistConst;
import org.encog.persist.PersistError;

/**
 * Persist a SVM.
 */
public class PersistSVM implements EncogPersistor {

	/**
	 * The parameter to hold the const C.
	 */
	public static final String PARAM_C = "C";

	/**
	 * The parameter to hold the cache size.
	 */
	public static final String PARAM_CACHE_SIZE = "cacheSize";

	/**
	 * The parameter to hold the coef0.
	 */
	public static final String PARAM_COEF0 = "coef0";

	/**
	 * The parameter to hold the degree.
	 */
	public static final String PARAM_DEGREE = "degree";

	/**
	 * The parameter to hold the eps.
	 */
	public static final String PARAM_EPS = "eps";

	/**
	 * The parameter to hold the gamma.
	 */
	public static final String PARAM_GAMMA = "gamma";

	/**
	 * The parameter to hold the kernel type.
	 */
	public static final String PARAM_KERNEL_TYPE = "kernelType";

	/**
	 * The parameter to hold the number of weights.
	 */
	public static final String PARAM_NUM_WEIGHT = "nrWeight";

	/**
	 * The parameter to hold the nu.
	 */
	public static final String PARAM_NU = "nu";

	/**
	 * The parameter to hold the p.
	 */
	public static final String PARAM_P = "p";

	/**
	 * The parameter to hold the probability.
	 */
	public static final String PARAM_PROBABILITY = "probability";

	/**
	 * The parameter to hold the shrinking.
	 */
	public static final String PARAM_SHRINKING = "shrinking";

	/**
	 * The parameter to hold the SVM type.
	 */
	public static final String PARAM_SVM_TYPE = "svmType";

	/**
	 * The paramater to hold the weight.
	 */
	public static final String PARAM_WEIGHT = "weight";

	/**
	 * The parameter to hold the weight label.
	 */
	public static final String PARAM_WEIGHT_LABEL = "weightLabel";

	/**
	 * @return The file version.
	 */
	@Override
	public final int getFileVersion() {
		return 1;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final String getPersistClassString() {
		return SVM.class.getSimpleName();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final Object read(final InputStream is) {
		final SVM result = new SVM();
		final EncogReadHelper in = new EncogReadHelper(is);
		EncogFileSection section;

		while ((section = in.readNextSection()) != null) {
			if (section.getSectionName().equals("SVM")
					&& section.getSubSectionName().equals("PARAMS")) {
				final Map<String, String> params = section.parseParams();
				result.getProperties().putAll(params);
			}
			if (section.getSectionName().equals("SVM")
					&& section.getSubSectionName().equals("SVM-PARAM")) {
				final Map<String, String> params = section.parseParams();
				result.setInputCount(EncogFileSection.parseInt(params,
						PersistConst.INPUT_COUNT));
				result.getParams().C = EncogFileSection.parseDouble(params,
						PersistSVM.PARAM_C);
				result.getParams().cache_size = EncogFileSection.parseDouble(
						params, PersistSVM.PARAM_CACHE_SIZE);
				result.getParams().coef0 = EncogFileSection.parseDouble(params,
						PersistSVM.PARAM_COEF0);
				result.getParams().degree = EncogFileSection.parseInt(params,
						PersistSVM.PARAM_DEGREE);
				result.getParams().eps = EncogFileSection.parseDouble(params,
						PersistSVM.PARAM_EPS);
				result.getParams().gamma = EncogFileSection.parseDouble(params,
						PersistSVM.PARAM_GAMMA);
				result.getParams().kernel_type = EncogFileSection.parseInt(
						params, PersistSVM.PARAM_KERNEL_TYPE);
				result.getParams().nr_weight = EncogFileSection.parseInt(
						params, PersistSVM.PARAM_NUM_WEIGHT);
				result.getParams().nu = EncogFileSection.parseDouble(params,
						PersistSVM.PARAM_NU);
				result.getParams().p = EncogFileSection.parseDouble(params,
						PersistSVM.PARAM_P);
				result.getParams().probability = EncogFileSection.parseInt(
						params, PersistSVM.PARAM_PROBABILITY);
				result.getParams().shrinking = EncogFileSection.parseInt(
						params, PersistSVM.PARAM_SHRINKING);
				result.getParams().svm_type = EncogFileSection.parseInt(params,
						PersistSVM.PARAM_SVM_TYPE);
				result.getParams().weight = section.parseDoubleArray(
						params, PersistSVM.PARAM_WEIGHT);
				result.getParams().weight_label = EncogFileSection
						.parseIntArray(params, PersistSVM.PARAM_WEIGHT_LABEL);
			} else if (section.getSectionName().equals("SVM")
					&& section.getSubSectionName().equals("SVM-MODEL")) {
				try {
					final StringReader rdr = new StringReader(
							section.getLinesAsString());
					final BufferedReader br = new BufferedReader(rdr);
					final svm_model model = svm.svm_load_model(br);
					result.setModel(model);
					br.close();
					rdr.close();
				} catch (final IOException ex) {
					throw new PersistError(ex);
				}
			}
		}

		return result;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public final void save(final OutputStream os, final Object obj) {
		final EncogWriteHelper out = new EncogWriteHelper(os);
		final SVM svm2 = (SVM) obj;
		out.addSection("SVM");
		out.addSubSection("PARAMS");
		out.addProperties(svm2.getProperties());
		out.addSubSection("SVM-PARAM");
		out.writeProperty(PersistConst.INPUT_COUNT, svm2.getInputCount());
		out.writeProperty(PersistSVM.PARAM_C, svm2.getParams().C);
		out.writeProperty(PersistSVM.PARAM_CACHE_SIZE,
				svm2.getParams().cache_size);
		out.writeProperty(PersistSVM.PARAM_COEF0, svm2.getParams().coef0);
		out.writeProperty(PersistSVM.PARAM_DEGREE, svm2.getParams().degree);
		out.writeProperty(PersistSVM.PARAM_EPS, svm2.getParams().eps);
		out.writeProperty(PersistSVM.PARAM_GAMMA, svm2.getParams().gamma);
		out.writeProperty(PersistSVM.PARAM_KERNEL_TYPE,
				svm2.getParams().kernel_type);
		out.writeProperty(
				PersistSVM.PARAM_NUM_WEIGHT, svm2.getParams().nr_weight);
		out.writeProperty(PersistSVM.PARAM_NU, svm2.getParams().nu);
		out.writeProperty(PersistSVM.PARAM_P, svm2.getParams().p);
		out.writeProperty(PersistSVM.PARAM_PROBABILITY,
				svm2.getParams().probability);
		out.writeProperty(PersistSVM.PARAM_SHRINKING,
				svm2.getParams().shrinking);

		out.writeProperty(PersistSVM.PARAM_SVM_TYPE, svm2.getParams().svm_type);
		out.writeProperty(PersistSVM.PARAM_WEIGHT, svm2.getParams().weight);
		out.writeProperty(PersistSVM.PARAM_WEIGHT_LABEL,
				svm2.getParams().weight_label);
		if (svm2.getModel() != null) {
			out.addSubSection("SVM-MODEL");
			try {
				final ByteArrayOutputStream ba = new ByteArrayOutputStream();
				final DataOutputStream das = new DataOutputStream(ba);
				svm.svm_save_model(das, svm2.getModel());
				out.write(ba.toString("UTF-8"));
				das.close();
				ba.close();

			} catch (final IOException ex) {
				throw new PersistError(ex);
			}
		}

		out.flush();
	}
}


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

var World = require('./src/world.js');
var Robot = require('./src/robot.js');

inquirer.prompt([
    {
        type: 'input',
        name: 'world',
        message: 'Enter world size (ex. "3 3"):',
        validate: function(value) {
            if (value.match(/^(\d+) (\d+)$/))
                return true;
            else
                return 'Invalid input';
        },
        filter: function(value) {
            return value.split(' ').map(function(value) { return parseInt(value, 10); });
        }
    }
], function(answers) {

    var world = new World(answers.world[0], answers.world[1]);

    function askForRobot() {
        inquirer.prompt([
            {
                type: 'input',
                name: 'start',
                message: 'Enter start location and facing direction (ex. "1 1 N"):',
                validate: function(value) {
                    if (value.match(/^(\d+) (\d+) (N|W|E|S)$/i))
                        return true;
                    else
                        return 'Invalid input';
                },
                filter: function(value) { return value.toUpperCase(); }
            },
            {
                type: 'input',
                name: 'instructions',
                message: 'Enter robot instructions:',
                filter: function(value) { return value.toUpperCase(); }
            },
            {
                type: 'confirm',
                name: 'askAgain',
                message: 'Do you want to add another robot?',
                default: true
            }
        ], function(answers) {

            var robot = new Robot(answers.start.split(' ')[0], answers.start.split(' ')[1], answers.start.split(' ')[2]);
            var result = world.passInstructions(robot, answers.instructions);

            console.log(result);

            if (answers.askAgain) {
                askForRobot();
            }
        });
    }

    askForRobot();
});


text:
namespace Microsoft.Azure.Management.AlertsManagement
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// SmartGroupsOperations operations.
    /// </summary>
    public partial interface ISmartGroupsOperations
    {
        /// <summary>
        /// Get all Smart Groups within a specified subscription
        /// </summary>
        /// <remarks>
        /// List all the Smart Groups within a specified subscription.
        /// </remarks>
        /// <param name='targetResource'>
        /// Filter by target resource( which is full ARM ID) Default value is
        /// select all.
        /// </param>
        /// <param name='targetResourceGroup'>
        /// Filter by target resource group name. Default value is select all.
        /// </param>
        /// <param name='targetResourceType'>
        /// Filter by target resource type. Default value is select all.
        /// </param>
        /// <param name='monitorService'>
        /// Filter by monitor service which generates the alert instance.
        /// Default value is select all. Possible values include: 'Application
        /// Insights', 'ActivityLog Administrative', 'ActivityLog Security',
        /// 'ActivityLog Recommendation', 'ActivityLog Policy', 'ActivityLog
        /// Autoscale', 'Log Analytics', 'Nagios', 'Platform', 'SCOM',
        /// 'ServiceHealth', 'SmartDetector', 'VM Insights', 'Zabbix'
        /// </param>
        /// <param name='monitorCondition'>
        /// Filter by monitor condition which is either 'Fired' or 'Resolved'.
        /// Default value is to select all. Possible values include: 'Fired',
        /// 'Resolved'
        /// </param>
        /// <param name='severity'>
        /// Filter by severity.  Default value is select all. Possible values
        /// include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4'
        /// </param>
        /// <param name='smartGroupState'>
        /// Filter by state of the smart group. Default value is to select all.
        /// Possible values include: 'New', 'Acknowledged', 'Closed'
        /// </param>
        /// <param name='timeRange'>
        /// Filter by time range by below listed values. Default value is 1
        /// day. Possible values include: '1h', '1d', '7d', '30d'
        /// </param>
        /// <param name='pageCount'>
        /// Determines number of alerts returned per page in response.
        /// Permissible value is between 1 to 250. When the "includeContent"
        /// filter is selected, maximum value allowed is 25. Default value is
        /// 25.
        /// </param>
        /// <param name='sortBy'>
        /// Sort the query results by input field. Default value is sort by
        /// 'lastModifiedDateTime'. Possible values include: 'alertsCount',
        /// 'state', 'severity', 'startDateTime', 'lastModifiedDateTime'
        /// </param>
        /// <param name='sortOrder'>
        /// Sort the query results order in either ascending or descending.
        /// Default value is 'desc' for time fields and 'asc' for others.
        /// Possible values include: 'asc', 'desc'
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<SmartGroup>>> GetAllWithHttpMessagesAsync(string targetResource = default(string), string targetResourceGroup = default(string), string targetResourceType = default(string), string monitorService = default(string), string monitorCondition = default(string), string severity = default(string), string smartGroupState = default(string), string timeRange = default(string), long? pageCount = default(long?), string sortBy = default(string), string sortOrder = default(string), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Get information related to a specific Smart Group.
        /// </summary>
        /// <remarks>
        /// Get information related to a specific Smart Group.
        /// </remarks>
        /// <param name='smartGroupId'>
        /// Smart group unique id.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<SmartGroup,SmartGroupsGetByIdHeaders>> GetByIdWithHttpMessagesAsync(string smartGroupId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Change the state of a Smart Group.
        /// </summary>
        /// <param name='smartGroupId'>
        /// Smart group unique id.
        /// </param>
        /// <param name='newState'>
        /// New state of the alert. Possible values include: 'New',
        /// 'Acknowledged', 'Closed'
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<SmartGroup,SmartGroupsChangeStateHeaders>> ChangeStateWithHttpMessagesAsync(string smartGroupId, string newState, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Get the history a smart group, which captures any Smart Group state
        /// changes (New/Acknowledged/Closed) .
        /// </summary>
        /// <param name='smartGroupId'>
        /// Smart group unique id.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<SmartGroupModification>> GetHistoryWithHttpMessagesAsync(string smartGroupId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Get all Smart Groups within a specified subscription
        /// </summary>
        /// <remarks>
        /// List all the Smart Groups within a specified subscription.
        /// </remarks>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<SmartGroup>>> GetAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
#include "common/xlsys.h"
#include "common/systype.h"

#include "xlslib/tostr.h"

static void exception_throwing_assertion_reporter(const char *expr, const char *filename, int lineno, const char *funcname)
{
	str_stream s;

	s << "Assertion failed: ";
	s << (expr ? expr : "???");
	s << " at line ";
	s << lineno;
	if(funcname) {
		s << " (" << funcname << ")";
	}
	if(filename) {
		s << " in " << filename;
	} else {
		s << " in [unidentified source file]";
	}
	throw std::string(s);
}

extern "C"
{
	static void xlslib_default_assertion_reporter(const char *expr, const char *fname, int lineno, const char *funcname)
	{
		exception_throwing_assertion_reporter(expr, fname, lineno, funcname);
	}

	static xlslib_userdef_assertion_reporter *callback = &xlslib_default_assertion_reporter;

	void xlslib_report_failed_assertion(const char *expr, const char *fname, int lineno, const char *funcname)
	{
		if(callback) {
			callback(expr, fname, lineno, funcname);
		}
	}

	void xlslib_register_assert_reporter(xlslib_userdef_assertion_reporter *user_func)
	{
		callback = user_func;
	}
};


text:
import startsWith from 'virtualdom/items/shared/utils/startsWith';
import getNewKeypath from 'virtualdom/items/shared/utils/getNewKeypath';

export default function assignNewKeypath ( target, property, oldKeypath, newKeypath ) {
	var existingKeypath = target[ property ];

	if ( !existingKeypath || startsWith( existingKeypath, newKeypath ) || !startsWith( existingKeypath, oldKeypath ) ) {
		return;
	}

	target[ property ] = getNewKeypath( existingKeypath, oldKeypath, newKeypath );
}


text:
import { NgModule, ErrorHandler } from "@angular/core";
import { IonicApp, IonicModule, IonicErrorHandler } from "ionic-angular";

import { GeofenceDetailsPage } from "../pages/geofence-details/geofence-details";
import { GeofenceListItem } from "../components/geofence-list-item/geofence-list-item";
import { GeofenceListPage } from "../pages/geofence-list/geofence-list";
import { GeofenceService } from "../services/geofence-service";
import { MyApp } from "./app.component";

const components = [
  MyApp,
  GeofenceDetailsPage,
  GeofenceListPage,
  GeofenceListItem
]

@NgModule({
  declarations: components,
  imports: [
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: components,
  providers: [
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    GeofenceService
  ]
})
export class AppModule {}


text:
This is native C android code, that uses data from the smartphone accelerometer and applies linear kalman filter to it to try and get the speed of the smartphone.

I wrote it for research of android native developement and for learning kalman filter concepts.
It is basically impossible for this to work good for an interval longer than 0.5 secnods(yes, half a second).

Usage:

Download, compile and run the executable on an android phone through a shell, you'll get debug output.
You can change the output easily and see make graphics with gnuplot or other software.


text:
/*
Package rangeutil provides services for conversion and iteration of range
specifications for use with iNamik/go_lexer

Currently, a 'range specifiction' is defined as a string of unicode characters,
with the ability to specify a range of chararacters by using a '-' between two
characters.  Think of it as a simplified version of standard regex bracket
expression.

Here are some examples:

	Digit        "0123456789" // With no range specifiers
	Digit        "0-9"        // With range specifiers
	Hex Digit    "0-9a-zA-F"  // Allowing for upper and lower case
	Decimal      "-.0-9"      // '-' At beginning means litteral '-'

NOTE: The current implentation of the range specification processer may
allow a literal '-' anywhere that a range is not implied, but the only officially
supported location for a literal '-' is at the beginning of the string.

NOTE: The full unicode character set should be supported
*/
package rangeutil

import (
	"bytes"
	"unicode/utf8"
)

// RangeIteratorCallback defines the prototype for the IterateRangeSpec
// callback function.  The function takes two rune parameters, 'low' and 'hi'
// (which can have the same value) and returns a boolean indicating if it is
// ok to continue processing the rangeSpec (true == ok, false == quit)
type RangeIteratorCallback func(low, hi rune) (ok bool)

// IterateRangeSpec processes a range specification, calling a callback function
// for each rune-range encountered
func IterateRangeSpec(rangeSpec string, callBack RangeIteratorCallback) {
	for i, l := 0, len(rangeSpec); i < l; {
		var low, hi rune

		var size int

		low, size = utf8.DecodeRuneInString(rangeSpec[i:])

		if low == utf8.RuneError {
			panic("error in range spec - invalid rune incountered at index " + string(i))
		}

		i += size

		// Peek at next byte to see if it is '-'
		// NOTE: This *should* be safe
		if i < l && rangeSpec[i] == '-' {
			i++ // skip '-'

			if i < l {
				hi, size = utf8.DecodeRuneInString(rangeSpec[i:])

				if hi == utf8.RuneError {
					panic("error in range spec - invalid rune incountered at index " + string(i))
				}

				i += size

				if low <= hi {
					if callBack(low, hi) == false {
						return
					}
				} else {
					panic("error in range spec - range not low-to-high")
				}
			} else {
				panic("error in range spec - trailing '-'")
			}
		} else {
			if callBack(low, low) == false {
				return
			}
		}
	}
}

// RangeToBytes converts a range specifier into a byte array suitable for
// the Match*Bytes calls of iNamik/go_lexer
func RangeToBytes(rangeSpec string) []byte {
	bytes := new(bytes.Buffer)

	IterateRangeSpec(rangeSpec, func(low, hi rune) bool {
		for ; low <= hi; low++ {
			_, error := bytes.WriteRune(low)
			if error != nil {
				panic(error)
			}
		}
		return true
	})
	return bytes.Bytes()
}

// RangeToRunes converts a range specifier into a rune array suitable for
// the Match*Runes calls of the iNamik/go_lexer
func RangeToRunes(rangeSpec string) []rune {
	runes := make([]rune, 1)
	IterateRangeSpec(rangeSpec, func(low, hi rune) bool {
		for ; low <= hi; low++ {
			runes = append(runes, low)
		}
		return true
	})
	return runes
}


text:
package de.kuei.metafora.lasadmapcreator.client;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.URL;
import com.google.gwt.http.client.UrlBuilder;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;

import de.kuei.metafora.lasadmapcreator.client.serverlink.MapInit;
import de.kuei.metafora.lasadmapcreator.client.serverlink.MapInitAsync;
import de.kuei.metafora.lasadmapcreator.client.util.EncodingUrlBuilder;
import de.kuei.metafora.lasadmapcreator.client.util.UrlDecoder;

/**
 * Entry point classes define onModuleLoad().
 */
public class LasadMapCreator implements EntryPoint {

	public static String token = null;
	public static Vector<String> users = null;
	public static String md5Password = null;
	public static String groupId = null;
	public static String challengeId = null;
	public static String challengeName = null;
	public static String ptNodeId = null;
	public static String ptMap = null;

	// object needed to implement i18n through Languages interface
	final static Languages language = GWT.create(Languages.class);

	private final MapInitAsync mapInit = GWT.create(MapInit.class);

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {

		users = new Vector<String>();
		// read info from URL
		LasadMapCreator.token = UrlDecoder.getParameter("token");

		String user = UrlDecoder.getParameter("user");

		LasadMapCreator.users.add(user);

		Map<String, List<String>> parameters = Window.Location
				.getParameterMap();
		Set<String> keySet = parameters.keySet();
		for (String key : keySet) {
			if (key.startsWith("otherUser")) {
				List<String> values = parameters.get(key);
				for (String u : values) {
					if (u != null)
						LasadMapCreator.users.add(URL.decode(u));
				}
			}
		}

		LasadMapCreator.md5Password = UrlDecoder.getParameter("pw");

		LasadMapCreator.groupId = UrlDecoder.getParameter("groupId");

		LasadMapCreator.challengeId = UrlDecoder.getParameter("challengeId");

		LasadMapCreator.challengeName = UrlDecoder
				.getParameter("challengeName");

		LasadMapCreator.ptNodeId = UrlDecoder.getParameter("ptNodeId");

		LasadMapCreator.ptMap = UrlDecoder.getParameter("ptMap");

		// connecting to LASAD
		Connecting.getInstance().main();

		mapInit.showDialog(ptNodeId, new AsyncCallback<Boolean>() {
			@Override
			public void onSuccess(Boolean result) {
				if (result) {
					Connecting.getInstance().hideUi();
					Dialog.getInstance().main();
				}
			}

			@Override
			public void onFailure(Throwable caught) {
				Window.alert(language.SomeoneAlreadyCreatesMap());
				Connecting.getInstance().label.setText(language
						.CreatingMapNotPossible());
			}
		});

		Timer t = new Timer() {

			@Override
			public void run() {
				mapInit.getMapId(ptNodeId, new AsyncCallback<String[]>() {

					@Override
					public void onFailure(Throwable caught) {
					}

					@Override
					public void onSuccess(String[] result) {
						if (result != null && result[0] != null) {
							// create URL
							UrlBuilder lasadUrlBuilder = new EncodingUrlBuilder();
							lasadUrlBuilder.setProtocol(result[1]);
							lasadUrlBuilder.setHost(result[2]);
							lasadUrlBuilder.setPath(result[3]);

							lasadUrlBuilder.setParameter("autologin", "true");
							lasadUrlBuilder.setParameter("user",
									LasadMapCreator.users.get(0));
							lasadUrlBuilder.setParameter("pw",
									LasadMapCreator.md5Password);
							lasadUrlBuilder.setParameter("pwEncrypted", "true");
							lasadUrlBuilder.setParameter("groupId",
									LasadMapCreator.groupId);
							lasadUrlBuilder.setParameter("challengeId",
									LasadMapCreator.challengeId);
							lasadUrlBuilder.setParameter("challengeName",
									LasadMapCreator.challengeName);
							lasadUrlBuilder.setParameter("mapId", result[0]);
							for (int i = 1; i < users.size(); i++) {
								if (!users.get(i).isEmpty())
									lasadUrlBuilder.setParameter("otherUser"
											+ i, users.get(i));
							}

							final String url = lasadUrlBuilder.buildString();

							mapInit.removeNodeId(ptNodeId,
									new AsyncCallback<Void>() {
										@Override
										public void onFailure(Throwable caught) {
											// show URL
											Window.Location.replace(url);
										}

										@Override
										public void onSuccess(Void result) {
											// show URL
											Window.Location.replace(url);
										}
									});
						}
					}
				});
			}
		};

		t.scheduleRepeating(2000);
	}
}


text:
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package io.v.v23.vdl;

/**
 * VdlString is a representation of a VDL string.
 */
public class VdlString extends VdlValue {
    private static final long serialVersionUID = 1L;

    private final String value;

    public VdlString(VdlType type, String value) {
        super(type);
        assertKind(Kind.STRING);
        this.value = value;
    }

    public VdlString(String value) {
        this(Types.STRING, value);
    }

    public VdlString() {
        this("");
    }

    protected VdlString(VdlType type) {
        this(type, "");
    }

    public String getValue() {
        return value;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (!(obj instanceof VdlString)) return false;
        final VdlString other = (VdlString) obj;
        return value.equals(other.value);
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

    @Override
    public String toString() {
        return value;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_gravity="center">

        <ImageView
            android:id="@+id/img_loading"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:src="@drawable/animation_loading"/>

        <TextView
            android:id="@+id/tv_refresh"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:maxLines="1"
            android:textColor="@color/gray3"
            tools:text="正在刷新"/>

    </RelativeLayout>

</FrameLayout>


text:
package org.chikoo.rest.web.controller;

import javax.inject.Inject;

import org.chikoo.core.model.entity.BlogEntry;
import org.chikoo.core.service.BlogEntryService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class BlogEntryController {

	@Inject
	private BlogEntryService blogEntryService;

	@RequestMapping("/rest/blogEntry/{id}")
	public ResponseEntity<BlogEntry> getBlogEntryResultsById(@PathVariable long id) {
		BlogEntry blogEntry = blogEntryService.findBlogEntry(id);
		return new ResponseEntity<BlogEntry>(blogEntry, HttpStatus.OK);
	}

}


text:
class BuildReaper < BuilderPlugin
  cattr_accessor :number_of_builds_to_keep

  def build_finished(build)
    delete_all_builds_but BuildReaper.number_of_builds_to_keep unless BuildReaper.number_of_builds_to_keep.nil?
  end

  def delete_all_builds_but(number)
    project.builds[0..-(number + 1)].each do |build|
      build.destroy
    end
  end
end

Project.plugin :build_reaper


text:
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Agriminer IPB | Dashboard</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>


text:
/* vim:set ts=4 sw=4 sts=4 et: */
/*
 * The MIT License (MIT)
 * Copyright (c) 2014 Tamas Nepusz
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#ifndef YAK_MEASUREMENT_HPP
#define YAK_MEASUREMENT_HPP

#include <cmath>
#include <yak/util.hpp>

namespace yak {

/**
 * Simple class that implements an n-dimensional measurement.
 */
template <int dimension, typename T=double>
class SimpleMeasurement {
public:
    /**
     * Static constant that can be used to retrieve the dimensions of the
     * measurement vector at compile time.
     */
    static const int DIMENSIONS = dimension;

protected:
    /**
     * Typedef for the datatype used in this class.
     */
    typedef T DataType;

    /**
     * Typedef for a column vector containing exactly \c DIMENSIONS coordinates.
     */
    typedef Eigen::Matrix<T, dimension, 1> ColumnVector;

public:
    /**
     * The value of the measurement in vector form.
     */
    ColumnVector value;

    /**
     * Default constructor.
     */
    SimpleMeasurement() : value(ColumnVector::Zero()) {}

    /**
     * Constructor that sets the measurement to a given value.
     */
    explicit SimpleMeasurement(const ColumnVector& value_) : value(value_) {}
};

/**
 * Implementation of a measurement model that measures each variable
 * independently and adds independent noise to each variable.
 */
template <typename TState, typename TMeasurement>
class IndependentNoisyMeasurementModel {

public:
    /**
     * The number of dimensions of the measurement vector.
     */
    static const int DIMENSIONS = TMeasurement::DIMENSIONS;

    /**
     * Convenience alias for the data type of estimated measurements.
     */
    typedef Gaussian<TMeasurement::DIMENSIONS> MeasurementEstimate;

protected:
    /**
     * Convenience typedef; points to the measurement type used by this model.
     */
    typedef TMeasurement Measurement;

    /**
     * Convenience typedef; points to the type of the matrix that transforms a
     * state into a measurement.
     */
    typedef Eigen::Matrix<typename TState::DataType,
            DIMENSIONS, TState::DIMENSIONS> MeasurementMatrix;

    /**
     * Convenience typedef; points to the type of the matrix that describes the
     * covariance of a measurement.
     */
    typedef Eigen::Matrix<typename TState::DataType,
            DIMENSIONS, DIMENSIONS> CovarianceMatrix;

    /**
     * Convenience typedef; points to a vector that contains the variances of the
     * individual noise components.
     */
    typedef Eigen::Matrix<typename TState::DataType, DIMENSIONS, 1>
        NoiseVarianceVector;

public:
    /**
     * Contains the variances of the individual noise components.
     */
    NoiseVarianceVector variances;

    /**
     * Returns the matrix that transforms a state variable vector into a
     * measurement vector when the matrix is multiplied by the state from the
     * right.
     */
    MeasurementMatrix getMeasurementMatrix() const {
        return MeasurementMatrix::Identity();
    }

    /**
     * Returns the covariance matrix of the measurement noise.
     */
    CovarianceMatrix getNoiseCovarianceMatrix() const {
        return variances.asDiagonal();
    }

    /**
     * Utility function that generates a noise vector using the variances
     * given in this measurement model.
     */
    NoiseVarianceVector generateNoise() const {
        NoiseVarianceVector result;
        int i, n = result.size();
        for (i = 0; i < n; i++) {
            result(i) = standard_normal<typename TState::DataType>() * std::sqrt(variances(i));
        }
        return result;
    }
};

}       // end of namespaces

#endif


text:
Pattern: Use of dynamic `delete`

Issue: -

## Description

Bans usage of the delete operator with computed key expressions.

Rationale: Deleting dynamically computed keys is dangerous and not well optimized.

## Further Reading

* [TSLint - no-dynamic-delete](https://palantir.github.io/tslint/rules/no-dynamic-delete)


text:
define(['modules/forms/module', 'lodash', 'bootstrap-colorpicker'], function (module, _) {

    'use strict';

    return module.registerDirective('smartColorpicker', function () {
        return {
            restrict: 'A',
            compile: function (tElement, tAttributes) {
                tElement.removeAttr('smart-colorpicker data-smart-colorpicker');

                var aOptions = _.pick(tAttributes, ['']);

                var options = _.extend(aOptions, {});

                tElement.colorpicker(options);
            }
        }
    });
});


text:
(function() {

  String.prototype.capitalize = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
  }

  var viewport = document.getElementById('viewport');

  viewport.addEventListener('focus', function(event) {
    console.log(event);
  }, false);
  viewport.dispatchEvent(new FocusEvent('focus'));

  var Input = function() {
    var listeners = [];

    var handle = function(event) {
      for(var i = 0, l = listeners.length; i < l; ++i) {
        var listener = listeners[i];
        if(event.type === listener.type)
          listener['on'+ listener.type.capitalize()].call(listeners[i], event);
      }
    };

    this.registerHandler = function(listener) {
      listeners.push(listener);
      if(/^key/.test(listener.type))
        window.addEventListener(listener.type, handle, false);
      else
        viewport.addEventListener(listener.type, handle, false);
    };
  }

  var KeydownListener = function(data) {
    this.data   = data || null;
    this.type   = 'keydown';
    this.onKeydown = function(event) {
      console.log(data);
    }
  };

  var ClickListener = function(data) {
    this.data   = data || null;
    this.type   = 'click';
    this.onClick = function(event) {
      console.log(data);
    };
  }

  var input = new Input();
  input.registerHandler(new ClickListener(1));
  input.registerHandler(new KeydownListener(2));

})();


text:
require 'metaid'
require 'merb_autoscaffold/view_helpers'
require 'paginator'

module MerbAutoScaffold
  class Controller

    def initialize( model )
      # Create the class
      controller_name = model.to_s.pluralize
      controller = eval(
      <<-EOS
        class ::Scaffold
          class #{ controller_name } < Application
          end
        end
        ::Scaffold::#{ controller_name }
      EOS
      )

      # Add the instance methods
      controller.meta_def( 'Model' ) { model }

      controller.class_eval {
        include ::MerbAutoScaffold::Controller::InstanceMethods
        # include TestIndex
        # extend(TestIndex)
      }

      # Not sure why, but neither of these work:
      # controller.extend( TestIndex )
      #
      # class << controller
      #   include TestIndex
      # end
      #
      # Possibly need to use Merb::Controller#show_action() to register
      # the actions
    end

    # module TestIndex
    #   def index() 'works'; end
    # end

    module InstanceMethods
      def self.included(base)

        base.class_eval {
          include ::Merb::ViewHelpers

          class << self
            attr_accessor :native_actions
            def native_actions() @native_actions ||= []; end
          end

          if instance_methods.include?('index')
            native_actions << 'index'
          else
            def index
              @models = Paginator.new( self.class.Model.count, 20) do |offset, per_page|
                find_all( self.class.Model, :limit => per_page, :offset => offset )
              end
              render
            end
          end

          if instance_methods.include?('show')
            native_actions << 'show'
          else
            def show
              @model = find_first( self.class.Model, params[:id] )
              raise NotFound unless @model
              display @model
            end
          end

          if instance_methods.include?('new')
            native_actions << 'new'
          else
            def new
              only_provides :html
              @model = self.class.Model.new
              render
            end
          end

          if instance_methods.include?('edit')
            native_actions << 'edit'
          else
            def edit
              only_provides :html
              @model = find_first( self.class.Model, params[:id] )
              raise NotFound unless @model
              render
            end
          end

          if instance_methods.include?('create')
            native_actions << 'create'
          else
            def create
              associations = self.class.Model.scaf_has_manys.collect { |a|
                [ a, params['model'].delete( a.name ) ]
              }

              params[:model].each { |k,v| params[:model][k] = nil if v.blank? }

              @model = self.class.Model.new(params[:model])
              if @model.save
                associations.each { |a, ids| update_has_many_association( a, @model, ids ) }
                redirect url( "scaffold_#{self.class.Model.singular_name}", @model)
              else
                render :new
              end
            end
          end

          if instance_methods.include?('update')
            native_actions << 'update'
          else
            def update
              params[:model].each { |k,v| params[:model][k] = nil if v.blank? }

              @model = find_first( self.class.Model, params[:id] )
              raise NotFound unless @model

              associations = self.class.Model.scaf_has_manys.collect { |a|
                [ a, params['model'].delete( a.name ) ]
              }

              if @model.update_attributes(params[:model])
                associations.each { |a, ids| update_has_many_association( a, @model, ids ) }
                redirect url( "scaffold_#{self.class.Model.singular_name}", @model)
              else
                raise BadRequest
              end
            end
          end

          if instance_methods.include?('destroy')
            native_actions << 'destroy'
          else
            def destroy
              @model = find_first( self.class.Model, params[:id] )
              raise NotFound unless @model
              if delete( @model )
                redirect url( "scaffold_#{self.class.Model.plural_name}" )
              else
                raise BadRequest
              end
            end
          end

          private

          alias :_orig_template_location :_template_location

          def _template_location(action, type = nil, controller = controller_name)
            if self.class.native_actions.include?( action_name )
              _orig_template_location( action, type, controller )
            else
              undo   = Pathname(Merb.dir_for(:view)).cleanpath.to_s.gsub(%r([^/]{2,}), '..')
              prefix = File.dirname(__FILE__)
              folder = 'views'
              file   = controller == "layout" ? "layout.#{type}" : "#{action}.#{type}"
              File.join( '.', undo, prefix, folder, file )
            end
          end

          def find_first( klass, *params )
            # wanted to use klass.superclass here, but the case statment seems to be checking the
            # class of klass.superclass instead of an equality check
            case klass.new
              when ActiveRecord::Base then return klass.find(:first, *params)
              when DataMapper::Base   then return klass.first( *params )
            end
          end

          def find_all( klass, *params )
            case klass.new
              when ActiveRecord::Base then return klass.find(:all, *params)
              when DataMapper::Base   then return klass.all( *params )
            end
          end

          def delete( obj )
            case obj
              when ActiveRecord::Base then return obj.destroy
              when DataMapper::Base   then return obj.destroy!
            end
          end

          def clear_association( object, assoc )
            rel = object.send( assoc.name )
            case object
              when ActiveRecord::Base then rel.clear
              when DataMapper::Base   then rel.nullify_association
            end
            rel
          end

          def update_has_many_association( assoc, model, ids )
            # remove all of the associated items
            rel = clear_association( model, assoc )

            # add all of the objects to the relationship
            for obj in find_all( assoc.klass, :conditions => ['id in (?)', ids] )
              rel << obj
            end
            model.save
          end
        }
      end
    end
  end
end


text:
/*****************************************************************************************
	New CSS style classes defined in JSR-286 (Appendix PLT.C)
******************************************************************************************/

/*****************************************************************************************
PLT.C.5 Tables
Table style definitions affect the rendering (i.e. alignment, borders, background color,
etc.) as well as their text attributes.
******************************************************************************************/
/* Table header*/
.portlet-table-header {

}

/* Normal text in a table cell*/
.portlet-table-body {

}

/*Text in every other row in the table*/
.portlet-table-alternate {

}

/*Text in a selected cell range*/
.portlet-table-selected {

}

/*Text of a subheading*/
.portlet-table-subheader {

}

/* Table footer*/
.portlet-table-footer {

}

/*Text that belongs to the table but does not fall in one of the other
categories (e.g. explanatory or help text that is associated with
the table).*/
.portlet-table-text {

}

/*****************************************************************************************
PLT.C.7 Menus
Menu styles define the look-and-feel of the text and background of a menu structure. This
structure may be embedded in the aggregated page or may appear as a context sensitive
popup menu.
******************************************************************************************/
/* General sub-menu settings such as
background color, margins, etc*/
.portlet-menu-cascade {

}

/*Normal, unselected sub-menu item when the
mouse hovers over it*/
.portlet-menu-cascade-item-hover {

}

/*Selected sub-menu item when the mouse
hovers over it*/
.portlet-menu-cascade-item-hoverselected {

}

/*Separator between menu items*/
.portlet-menu-separator {

}

/*Separator between sub-menu items*/
.portlet-menu-cascade-separator {

}

/* Content for a normal, unselected menu or
sub-menu item*/
.portlet-menu-content {
}

/*Content for an selected menu or sub-menu
item*/
.portlet-menu-content-selected {

}

/*Content for an unselected menu or sub-menu
item when the mouse hovers over it*/
.portlet-menu-content-hover {

}

/*Content for a selected menu or sub-menu
item when the mouse hovers over it*/
.portlet-menu-content-hover-selected {

}

/*Indicator that a menu item has an associated
sub-menu*/
.portlet-menu-indicator {

}

/*Indicator when the associated menu item is
selected*/
.portlet-menu-indicator-selected {

}

/*Indicator when the associated menu item has
the mouse hover over it*/
.portlet-menu-indicator-hover {

}

/*Indicator when the associated menu item is
selected and has the mouse hover over it*/
.portlet-menu-indicator-hover-selected {

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

	<Button
		style="@style/appbutton"
		android:id="@+id/btn_speech_write_activation_tag"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:text="@string/btn_speech_write_activation_tag"
    	/>

</LinearLayout>


text:
using Random = effolkronium::random_static;

namespace RosettaStone::SimpleTasks
{
RandomTask::RandomTask(EntityType entityType, int num)
    : ITask(entityType), m_num(num)
{
    // Do nothing
}

TaskID RandomTask::GetTaskID() const
{
    return TaskID::RANDOM;
}

TaskStatus RandomTask::Impl(Player& player)
{
    auto entities =
        IncludeTask::GetEntities(m_entityType, player, m_source, m_target);

    player.GetGame()->taskStack.entities.clear();

    for (int i = 0; i < m_num && !entities.empty(); ++i)
    {
        const auto idx = Random::get<std::size_t>(0, entities.size() - 1);

        Entity* entity = entities.at(idx);
        entities.erase(entities.begin() + idx);
        player.GetGame()->taskStack.entities.emplace_back(entity);
    }

    return TaskStatus::COMPLETE;
}
}  // namespace RosettaStone::SimpleTasks


text:
<title>History - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Overview.html#Overview" title="Overview">
<link rel="prev" href="Overview.html#Overview" title="Overview">
<link rel="next" href="How-It-Works.html#How-It-Works" title="How It Works">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: How It Works,
Previous: Overview,
Up: Overview

1.1 History

One spur behind BFD was the desire, on the part of the GNU 960 team at
Intel Oregon, for interoperability of applications on their COFF and
b.out file formats.  Cygnus was providing GNU support for the team, and
was contracted to provide the required functionality.

The name came from a conversation David Wallace was having with Richard
Stallman about the library: RMS said that it would be quite hard—David
said “BFD”.  Stallman was right, but the name stuck.

At the same time, Ready Systems wanted much the same thing, but for
different object file formats: IEEE-695, Oasys, Srecords, a.out and 68k
coff.

BFD was first implemented by members of Cygnus Support; Steve
Chamberlain (sac@cygnus.com), John Gilmore
(gnu@cygnus.com), K.  Richard Pixley (rich@cygnus.com)
and David Henkel-Wallace (gumby@cygnus.com).


text:
module.exports = zip;

zip._dependencies = ['reduce'];

function zip(listA, listB) {
    var listBReversed = listB.reverse();

    return _.reduce(mergeWithB, [], listA);

    function mergeWithB(memo, elementFromA) {
        memo.push(elementFromA);
        memo.push(listB.pop());
        return memo;
    }
}


text:
lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'sunat'
require './config'

# Group 1

doc = SUNAT::Invoice.new

doc.ruc            = doc.signature.party_id
doc.legal_name     = doc.signature.party_name

doc.id = "FF11-000001"


text:
`renderer/modules/nfc` implements the renderer process details and bindings for
the [Web NFC specification]. It communicates with the browser process through the
[Web NFC Mojo interface]. The platform-specific parts of the
implementation are located in `services/device/nfc`.

[Web NFC specification]: https://w3c.github.io/web-nfc/
[Web NFC Mojo interface]: ../../../../../services/device/public/mojom/nfc.mojom

## Testing

Web NFC is primarily tested in [Web Platform Tests](https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/web_tests/external/wpt/web-nfc/).

## Design Documents

Please refer to the [design documentation](https://sites.google.com/a/chromium.org/dev/developers/design-documents/web-nfc)
for more details.


text:
{% extends "horizon/common/_modal.html" %}
{% block content %}
  {% if table %}

      {{ table.render }}

  {% endif %}
  <form id="{% block form_id %}{{ form_id }}{% endblock %}"
        ng-controller="{% block ng_controller %}DummyCtrl{% endblock %}"
        name="{% block form_name %}{% endblock %}"
        autocomplete="{% block autocomplete %}{% if form.no_autocomplete %}off{% endif %}{% endblock %}"
        class="{% block form_class %}{% endblock %}"
        action="{% block form_action %}{{ submit_url }}{% endblock %}"
        method="{% block form-method %}POST{% endblock %}"
      {% block form_validation %}{% endblock %}
        {% if add_to_field %}data-add-to-field="{{ add_to_field }}"{% endif %} {% block form_attrs %}{% endblock %}>{% csrf_token %}

      {% comment %}
        These fake fields are required to prevent Chrome v34+ from autofilling form.
        {% endcomment %}
      {% if form.no_autocomplete %}

        <input type="text" name="fake_email" value="" />
        <input type="password" name="fake_password" value="" />

      {% endif %}
      {% block modal-body %}

            <fieldset>
            {% include "horizon/common/_form_fields.html" %}
            </fieldset>

            {% block modal-body-right %}{% endblock %}

      {% endblock %}

      {% block modal-footer %}
        {% if cancel_url %}

          {{ cancel_label }}

        {% endif %}
        <input class="btn btn-primary" type="submit" value="{{ submit_label }}">
      {% endblock %}

  </form>
{% endblock %}


text:
using System.Linq;

namespace IoCBridge
{
    /// <summary>
    /// Injector provided to provider functions for retrieving args and other types
    /// </summary>
    public sealed class IoCInjector :
        IIoCInjector
    {
        private readonly CtorArg[] _args = new CtorArg[] { };
        private readonly IIoC _ioc;

        /// <summary>
        /// Instantiates a new instance
        /// </summary>
        /// <param name="ioc">The IoC access instance</param>
        /// <param name="args">The ctor arguments for this request</param>
        public IoCInjector(IIoC ioc, params CtorArg[] args)
        {
            if (args == null) args = new CtorArg[] { };

            _ioc = ioc;
        }

        public T Inject<T>(params CtorArg[] args)
        {
            return _ioc.Get<T>(args);
        }

        public T Arg<T>(int index)
        {
            return (T)_args[index].Value;
        }

        public T Arg<T>(string name)
        {
            return (T)_args.Single(a => a.Name == name).Value;
        }
    }
}


text:
<?php
/**
 * Description ......
 *
 * @Author: qloog
 * @Date: 14-10-6 10:08
 */

namespace Acme\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Acme\BlogBundle\Entity\Article;
use Acme\BlogBundle\Entity\Comment;

/**
 * @Route("/blog/article")
 */
class ArticleController extends Controller
{
	/**
	 * @Route("/show/{id}")
	 */
	public function showAction($id){
		$article = $this->getDoctrine()->getRepository('AcmeBlogBundle:Article')->findOneByid($id);
		return $this->render('AcmeBlogBundle:Article:show.html.twig', array('article' => $article));
	}

	/**
	 * @Route("/cate/{tname}", defaults={"tname" = null})
	 */
	public function listAction($tname){
		if ($tname != null) {
			$articles = $this->getDoctrine()->getRepository('AcmeBlogBundle:Article')->findByCateTname($tname);
		}else{
			$articles = $this->getDoctrine()->getRepository('AcmeBlogBundle:Article')->findAll();
		}
		return $this->render('AcmeBlogBundle:Article:list.html.twig', array('articles' => $articles));
	}
}