text:
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/base/base.html">
<script>
'use strict';

/**
 * @fileoverview Provides color scheme related functions.
 */
tv.exportTo('tv.b.ui', function() {

  function boundChannel(v) {
    return Math.min(255, Math.max(0, Math.floor(v)));
  }

  function brightenColor(c) {
    var k;
    if (c.r >= 240 && c.g >= 240 && c.b >= 240)
      k = 0.80;
    else
      k = 1.45;

    return {
      r: boundChannel(c.r * k),
      g: boundChannel(c.g * k),
      b: boundChannel(c.b * k)
    };
  }
  function desaturateColor(c) {
    var value = boundChannel((c.r + c.g + c.b) / 3);
    return { r: value, g: value, b: value };
  }
  function colorToRGBString(c) {
    return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')';
  }
  function colorToRGBAString(c, a) {
    return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + a + ')';
  }

  return {
    brightenColor: brightenColor,
    desaturateColor: desaturateColor,
    colorToRGBString: colorToRGBString,
    colorToRGBAString: colorToRGBAString
  };
});
</script>


text:
class AppStage
{
public:
    AppStage(class App *app)
        : m_app(app)
    { }

    virtual bool init(int argc, char** argv) { return true; }
    virtual void destroy() {}

    virtual void enter() {}
    virtual void exit() {}
    virtual void update() {}
    virtual void render() {};
    virtual void renderUI() {}

    virtual void onKeyDown(int keyCode) {}
    virtual bool onClientAPIEvent(
        PSMEventMessage::eEventType event,
        PSMEventDataHandle opaque_event_handle)
    { return false; }
    virtual void onServiceResponse(PSMResult ResultCode) {}

protected:
    class App *m_app;
};

#endif // APP_STAGE_H

redpajama_set_name: RedPajamaGithub


text:
package org.apache.cassandra.tools;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Set;
import javax.net.ssl.SSLContext;

import com.datastax.driver.core.AuthProvider;
import com.datastax.driver.core.JdkSSLOptions;
import com.datastax.driver.core.SSLOptions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;

import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.config.EncryptionOptions;
import org.apache.cassandra.io.sstable.SSTableLoader;
import org.apache.cassandra.locator.InetAddressAndPort;
import org.apache.cassandra.security.SSLFactory;
import org.apache.cassandra.streaming.*;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.JVMStabilityInspector;
import org.apache.cassandra.utils.NativeSSTableLoaderClient;
import org.apache.cassandra.utils.OutputHandler;

public class BulkLoader
{
    public static void main(String args[]) throws BulkLoadException
    {
        LoaderOptions options = LoaderOptions.builder().parseArgs(args).build();
        load(options);
    }

    public static void load(LoaderOptions options) throws BulkLoadException
    {
        DatabaseDescriptor.toolInitialization();
        OutputHandler handler = new OutputHandler.SystemOutput(options.verbose, options.debug);
        SSTableLoader loader = new SSTableLoader(
                options.directory.getAbsoluteFile(),
                new ExternalClient(
                        options.hosts,
                        options.nativePort,
                        options.storagePort,
                        options.authProvider,
                        options.sslStoragePort,
                        options.serverEncOptions,
                        buildSSLOptions(options.clientEncOptions),
                        options.allowServerPortDiscovery),
                        handler,
                        options.connectionsPerHost,
                        options.targetKeyspace);
        DatabaseDescriptor.setStreamThroughputOutboundMegabitsPerSec(options.throttle);
        DatabaseDescriptor.setInterDCStreamThroughputOutboundMegabitsPerSec(options.interDcThrottle);
        StreamResultFuture future = null;

        ProgressIndicator indicator = new ProgressIndicator();
        try
        {
            if (options.noProgress)
            {
                future = loader.stream(options.ignores);
            }
            else
            {
                future = loader.stream(options.ignores, indicator);
            }

        }
        catch (Exception e)
        {
            JVMStabilityInspector.inspectThrowable(e);
            System.err.println(e.getMessage());
            if (e.getCause() != null)
            {
                System.err.println(e.getCause());
            }
            e.printStackTrace(System.err);
            throw new BulkLoadException(e);
        }

        try
        {
            future.get();

            if (!options.noProgress)
            {
                indicator.printSummary(options.connectionsPerHost);
            }

            // Give sockets time to gracefully close
            Thread.sleep(1000);
        }
        catch (Exception e)
        {
            System.err.println("Streaming to the following hosts failed:");
            System.err.println(loader.getFailedHosts());
            e.printStackTrace(System.err);
            throw new BulkLoadException(e);
        }
    }

    // Return true when everything is at 100%
    static class ProgressIndicator implements StreamEventHandler
    {
        private long start;
        private long lastProgress;
        private long lastTime;

        private long peak = 0;
        private int totalFiles = 0;

        private final Multimap<InetAddressAndPort, SessionInfo> sessionsByHost = HashMultimap.create();

        public ProgressIndicator()
        {
            start = lastTime = System.nanoTime();
        }

        public void onSuccess(StreamState finalState)
        {
        }

        public void onFailure(Throwable t)
        {
        }

        public synchronized void handleStreamEvent(StreamEvent event)
        {
            if (event.eventType == StreamEvent.Type.STREAM_PREPARED)
            {
                SessionInfo session = ((StreamEvent.SessionPreparedEvent) event).session;
                sessionsByHost.put(session.peer, session);
            }
            else if (event.eventType == StreamEvent.Type.FILE_PROGRESS || event.eventType == StreamEvent.Type.STREAM_COMPLETE)
            {
                ProgressInfo progressInfo = null;
                if (event.eventType == StreamEvent.Type.FILE_PROGRESS)
                {
                    progressInfo = ((StreamEvent.ProgressEvent) event).progress;
                }

                long time = System.nanoTime();
                long deltaTime = time - lastTime;

                StringBuilder sb = new StringBuilder();
                sb.append("\rprogress: ");

                long totalProgress = 0;
                long totalSize = 0;

                boolean updateTotalFiles = totalFiles == 0;
                // recalculate progress across all sessions in all hosts and display
                for (InetAddressAndPort peer : sessionsByHost.keySet())
                {
                    sb.append("[").append(peer).append("]");

                    for (SessionInfo session : sessionsByHost.get(peer))
                    {
                        long size = session.getTotalSizeToSend();
                        long current = 0;
                        int completed = 0;

                        if (progressInfo != null && session.peer.equals(progressInfo.peer) && session.sessionIndex == progressInfo.sessionIndex)
                        {
                            session.updateProgress(progressInfo);
                        }
                        for (ProgressInfo progress : session.getSendingFiles())
                        {
                            if (progress.isCompleted())
                            {
                                completed++;
                            }
                            current += progress.currentBytes;
                        }
                        totalProgress += current;

                        totalSize += size;

                        sb.append(session.sessionIndex).append(":");
                        sb.append(completed).append("/").append(session.getTotalFilesToSend());
                        sb.append(" ").append(String.format("%-3d", size == 0 ? 100L : current * 100L / size)).append("% ");

                        if (updateTotalFiles)
                        {
                            totalFiles += session.getTotalFilesToSend();
                        }
                    }
                }

                lastTime = time;
                long deltaProgress = totalProgress - lastProgress;
                lastProgress = totalProgress;

                sb.append("total: ").append(totalSize == 0 ? 100L : totalProgress * 100L / totalSize).append("% ");
                sb.append(FBUtilities.prettyPrintMemoryPerSecond(deltaProgress, deltaTime));
                long average = bytesPerSecond(totalProgress, time - start);

                if (average > peak)
                {
                    peak = average;
                }
                sb.append(" (avg: ").append(FBUtilities.prettyPrintMemoryPerSecond(totalProgress, time - start)).append(")");

                System.out.println(sb.toString());
            }
        }

        private long bytesPerSecond(long bytes, long timeInNano)
        {
            return timeInNano != 0 ? (long) (((double) bytes / timeInNano) * 1000 * 1000 * 1000) : 0;
        }

        private void printSummary(int connectionsPerHost)
        {
            long end = System.nanoTime();
            long durationMS = ((end - start) / (1000000));

            StringBuilder sb = new StringBuilder();
            sb.append("\nSummary statistics: \n");
            sb.append(String.format("   %-24s: %-10d%n", "Connections per host ", connectionsPerHost));
            sb.append(String.format("   %-24s: %-10d%n", "Total files transferred ", totalFiles));
            sb.append(String.format("   %-24s: %-10s%n", "Total bytes transferred ", FBUtilities.prettyPrintMemory(lastProgress)));
            sb.append(String.format("   %-24s: %-10s%n", "Total duration ", durationMS + " ms"));
            sb.append(String.format("   %-24s: %-10s%n", "Average transfer rate ", FBUtilities.prettyPrintMemoryPerSecond(lastProgress, end - start)));
            sb.append(String.format("   %-24s: %-10s%n", "Peak transfer rate ",  FBUtilities.prettyPrintMemoryPerSecond(peak)));
            System.out.println(sb.toString());
        }
    }

    private static SSLOptions buildSSLOptions(EncryptionOptions clientEncryptionOptions)
    {

        if (!clientEncryptionOptions.enabled)
        {
            return null;
        }

        SSLContext sslContext;
        try
        {
            sslContext = SSLFactory.createSSLContext(clientEncryptionOptions, true);
        }
        catch (IOException e)
        {
            throw new RuntimeException("Could not create SSL Context.", e);
        }

        return JdkSSLOptions.builder()
                            .withSSLContext(sslContext)
                            .withCipherSuites(clientEncryptionOptions.cipher_suites)
                            .build();
    }

    static class ExternalClient extends NativeSSTableLoaderClient
    {
        private final int sslStoragePort;
        private final EncryptionOptions.ServerEncryptionOptions serverEncOptions;

        public ExternalClient(Set<InetSocketAddress> hosts,
                              int nativePort,
                              int storagePort,
                              AuthProvider authProvider,
                              int sslStoragePort,
                              EncryptionOptions.ServerEncryptionOptions serverEncryptionOptions,
                              SSLOptions sslOptions,
                              boolean allowServerPortDiscovery)
        {
            super(hosts, nativePort, storagePort, authProvider, sslOptions, allowServerPortDiscovery);
            this.sslStoragePort = sslStoragePort;
            serverEncOptions = serverEncryptionOptions;
        }

        @Override
        public StreamConnectionFactory getConnectionFactory()
        {
            return new BulkLoadConnectionFactory(sslStoragePort, serverEncOptions, false);
        }
    }

    public static class CmdLineOptions extends Options
    {
        /**
         * Add option with argument and argument name
         * @param opt shortcut for option name
         * @param longOpt complete option name
         * @param argName argument name
         * @param description description of the option
         * @return updated Options object
         */
        public Options addOption(String opt, String longOpt, String argName, String description)
        {
            Option option = new Option(opt, longOpt, true, description);
            option.setArgName(argName);

            return addOption(option);
        }

        /**
         * Add option without argument
         * @param opt shortcut for option name
         * @param longOpt complete option name
         * @param description description of the option
         * @return updated Options object
         */
        public Options addOption(String opt, String longOpt, String description)
        {
            return addOption(new Option(opt, longOpt, false, description));
        }
    }
}


text:
  Port-Sainte-Marie est
      une commune géographiquement positionnée dans le département de Lot-et-Garonne en Aquitaine. Elle totalisait 1 913 habitants en 2008.

À Port-Sainte-Marie, le prix moyen à l'achat d'un appartement se situe à 603 € du m² en vente. la valorisation moyenne d'une maison à l'achat se situe à 1 399 € du m². À la location le prix moyen se situe à 5,72 € du m² mensuel.

La ville est équipée s'agissant de l'éducation des jeunes de un collège.
Pour les plus jeunes, la localité dispose de une maternelle et une école primaire.
Port-Sainte-Marie dispose des équipements permettant une vie àgréable.
Si vous avez un projet immobilier à Port-Sainte-Marie, il est intéressant d' évaluer la notoriété des écoles de la communes

La commune compte de nombreux  aménagements, elle dispose, entre autres, de un terrain de sport, une salle de combat, un équipement de roller/skate et deux boucles de randonnée.

À coté de Port-Sainte-Marie sont situées les communes de
Bazens localisée à 2 km, 513 habitants,
Bruch localisée à 5 km, 749 habitants,
Frégimont à 5 km, 233 habitants,
Montesquieu à 6 km, 764 habitants,
Galapian localisée à 5 km, 302 habitants,
Thouars-sur-Garonne à 5 km, 193 habitants,
 entre autres. De plus, Port-Sainte-Marie est située à seulement 25 km de Saint-Paul.

Le nombre d'habitations, à Port-Sainte-Marie, se décomposait en 2011 en 125 appartements et 782 maisons soit
 un marché plutôt équilibré.


text:
import zipfile
import tarfile
import shutil

def unzip(filename, dir):
    zf = zipfile.ZipFile(filename)
    zf.extractall(dir)

def unzip1(filename, dir):
    zf = zipfile.ZipFile(filename)
    zf.extract(dir)


text:
require 'cultome_player/plugins/help'
require 'cultome_player/plugins/alias'
require 'cultome_player/plugins/points'
require 'cultome_player/plugins/gestures'
require 'cultome_player/plugins/keyboard_special_keys'

module CultomePlayer
  module Plugins
    include Help
    include Alias
    include Points
    include Gestures
    include KeyboardSpecialKeys

    # Check if a plugin implements the given command.
    #
    # @param cmd_name [String] The command name.
    # @return [Boolean] True is the given command is implemented by a plugin.
    def plugins_respond_to?(cmd_name)
      return respond_to?("command_#{cmd_name}".to_sym)
    end

    # Get a command format for a command implemented by a plugin
    #
    # @param cmd_name [String] The command name.
    # @return [Regex] The regex to validate a command format that is implemented by a plugin.
    def plugin_command_sintax(cmd_name)
      return send("sintax_#{cmd_name}".to_sym)
    end

    # Lazy getter for plugins configurator. Its a persistent store where plugin can put their configurations.
    #
    # @param plugin_name [#to_s] The name of the plugin.
    # @return [Hash] Where plugins can stores their information.
    def plugin_config(plugin_name)
      plugin_ns = player_config['plugins'] ||= {}
      return plugin_ns[plugin_name.to_s] ||= {}
    end

    # Call init_plugin_<action> to initialize all the plugins that require it.
    def init_plugins
      methods.grep(/^init_plugin_/).each{|method_name| send(method_name) }
    end

    def clean_plugins
      methods.grep(/^clean_plugin_/).each{|method_name| send(method_name) }
    end
  end
end


text:
<?php

namespace Magento\Review\Controller\Adminhtml\Product;

class MassVisibleIn extends \Magento\Review\Controller\Adminhtml\Product
{
    /**
     * @return void
     */
    public function execute()
    {
        $reviewsIds = $this->getRequest()->getParam('reviews');

        if (!is_array($reviewsIds)) {
            $this->messageManager->addError(__('Please select review(s).'));
        } else {
            try {
                $stores = $this->getRequest()->getParam('stores');
                foreach ($reviewsIds as $reviewId) {
                    $model = $this->_reviewFactory->create()->load($reviewId);
                    $model->setSelectStores($stores);
                    $model->save();
                }
                $this->messageManager->addSuccess(
                    __('A total of %1 record(s) have been updated.', count($reviewsIds))
                );
            } catch (\Magento\Framework\Model\Exception $e) {
                $this->messageManager->addError($e->getMessage());
            } catch (\Exception $e) {
                $this->messageManager->addException(
                    $e,
                    __('An error occurred while updating the selected review(s).')
                );
            }
        }

        $this->_redirect('review/*/pending');
    }
}


text:
if [ -n "$MYSQL_PORT_3306_TCP_ADDR" ] &&  [ -n "$MYSQL_PORT_3306_TCP_PORT" ] &&  [ -n "$MYSQL_ENV_MYSQL_ROOT_PASSWORD" ]; then

    # MySQL docker container integartion, check database name variable exists.
    if [[ -z "$KIE_CONNECTION_DATABASE" ]] ; then
        echo "[ERROR] - Detected database container linking with a MySQL container, but no $KIE_CONNECTION_DATABASE variable is set with the name of the database to use. Exiting!"
        exit 1
    fi

    # MySQL environment variables are set. Proceed with automatic configuration.
    echo "Detected successfull MySQL database container linked. Applying automatic configuration..."
    export KIE_CONNECTION_URL="jdbc:mysql://$MYSQL_PORT_3306_TCP_ADDR:$MYSQL_PORT_3306_TCP_PORT/$KIE_CONNECTION_DATABASE"
    export KIE_CONNECTION_DRIVER="mysql"
    export KIE_CONNECTION_USER="root"
    export KIE_CONNECTION_PASSWORD="$MYSQL_ENV_MYSQL_ROOT_PASSWORD"
fi

# PostgreSQL container linking detection.
# If this KIE container is linked with the official PostgreSQL container, the following environemnt variables will be present.
if [ -n "$POSTGRES_PORT_5432_TCP_ADDR" ] &&  [ -n "$POSTGRES_PORT_5432_TCP_PORT" ] &&  [ -n "$POSTGRES_ENV_POSTGRES_PASSWORD" ]; then

    # PostgreSQL docker container integartion, check database name variable exists.
    if [[ -z "$KIE_CONNECTION_DATABASE" ]] ; then
        echo "[ERROR] - Detected database container linking with a PostgreSQL container, but no $KIE_CONNECTION_DATABASE variable is set with the name of the database to use. Exiting!"
        exit 1
    fi

    # MySQL environment variables are set. Proceed with automatic configuration.
    echo "Detected successfull PostgreSQL database container linked. Applying automatic configuration..."
    export KIE_CONNECTION_URL="jdbc:postgresql://$POSTGRES_PORT_5432_TCP_ADDR:$POSTGRES_PORT_5432_TCP_PORT/$KIE_CONNECTION_DATABASE"
    export KIE_CONNECTION_DRIVER="postgres"
    export KIE_CONNECTION_USER="postgres"
    export KIE_CONNECTION_PASSWORD="$POSTGRES_ENV_POSTGRES_PASSWORD"
fi

# Check if necessary to change the default hibernate dialect for JPA descriptor.
./update-jpa-config.sh $JBOSS_HOME/standalone/deployments/kie-wb.war/WEB-INF/classes/META-INF/persistence.xml

# Start Wildfly with some parameters.
./standalone.sh -b $JBOSS_BIND_ADDRESS -Djboss.kie.connection_url=\"$KIE_CONNECTION_URL\" -Djboss.kie.driver=\"$KIE_CONNECTION_DRIVER\" -Djboss.kie.username=\"$KIE_CONNECTION_USER\" -Djboss.kie.password=\"$KIE_CONNECTION_PASSWORD\" --server-config=standalone-full-kie-wb.xml
exit $?


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GraphQLCore.Execution
{
    internal class FieldContext<T> : IContext<T>
    {
        public T Instance { get; private set; }

        public FieldContext(T instance)
        {
            this.Instance = instance;
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<CustomFieldTranslation xmlns="http://soap.sforce.com/2006/04/metadata">
    <name>Contact__c</name>
    <help>La persona afiliada a aquesta organització.</help>
    <relationshipLabel>Comptes afiliats</relationshipLabel>
    <label>Contacte</label>
</CustomFieldTranslation>


text:
#ifndef QQMLVALUETYPE_P_H
#define QQMLVALUETYPE_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include "qqml.h"
#include "qqmlproperty.h"
#include "qqmlproperty_p.h"
#include "qqmlnullablevalue_p_p.h"

#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
#include <QtCore/qeasingcurve.h>
#include <QtCore/qvariant.h>

QT_BEGIN_NAMESPACE

class Q_QML_PRIVATE_EXPORT QQmlValueType : public QObject
{
    Q_OBJECT
public:
    QQmlValueType(int userType, QObject *parent = 0);
    virtual void read(QObject *, int) = 0;
    virtual void readVariantValue(QObject *, int, QVariant *) = 0;
    virtual void write(QObject *, int, QQmlPropertyPrivate::WriteFlags flags) = 0;
    virtual void writeVariantValue(QObject *, int, QQmlPropertyPrivate::WriteFlags, QVariant *) = 0;
    virtual QVariant value() = 0;
    virtual void setValue(const QVariant &) = 0;

    virtual QString toString() const = 0;
    virtual bool isEqual(const QVariant &value) const = 0;

    virtual void onLoad() {}

    inline int userType() const
    {
        return m_userType;
    }

protected:
    inline void readProperty(QObject *obj, int idx, void *p)
    {
        void *a[] = { p, 0 };
        QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
        onLoad();
    }

    inline void writeProperty(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags, void *p)
    {
        int status = -1;
        void *a[] = { p, 0, &status, &flags };
        QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
    }

private:
    int m_userType;
};

template <typename T>
class QQmlValueTypeBase : public QQmlValueType
{
public:
    typedef T ValueType;

    QQmlValueTypeBase(int userType, QObject *parent)
        : QQmlValueType(userType, parent)
    {
    }

    virtual void read(QObject *obj, int idx)
    {
        readProperty(obj, idx, &v);
    }

    virtual void readVariantValue(QObject *obj, int idx, QVariant *into)
    {
        // important: must not change the userType of the variant
        readProperty(obj, idx, into);
    }

    virtual void write(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags)
    {
        writeProperty(obj, idx, flags, &v);
    }

    virtual void writeVariantValue(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags, QVariant *from)
    {
        writeProperty(obj, idx, flags, from);
    }

    virtual QVariant value()
    {
        return QVariant::fromValue(v);
    }

    virtual void setValue(const QVariant &value)
    {
        v = qvariant_cast<T>(value);
        onLoad();
    }

    virtual bool isEqual(const QVariant &other) const
    {
        return QVariant::fromValue(v) == other;
    }

protected:
    ValueType v;
};

class Q_QML_PRIVATE_EXPORT QQmlValueTypeFactory
{
public:
    static bool isValueType(int);
    static QQmlValueType *valueType(int idx);

    static void registerValueTypes(const char *uri, int versionMajor, int versionMinor);
};

class Q_QML_PRIVATE_EXPORT QQmlPointFValueType : public QQmlValueTypeBase<QPointF>
{
    Q_PROPERTY(qreal x READ x WRITE setX FINAL)
    Q_PROPERTY(qreal y READ y WRITE setY FINAL)
    Q_OBJECT
public:
    QQmlPointFValueType(QObject *parent = 0);

    virtual QString toString() const;

    qreal x() const;
    qreal y() const;
    void setX(qreal);
    void setY(qreal);
};

class Q_QML_PRIVATE_EXPORT QQmlPointValueType : public QQmlValueTypeBase<QPoint>
{
    Q_PROPERTY(int x READ x WRITE setX FINAL)
    Q_PROPERTY(int y READ y WRITE setY FINAL)
    Q_OBJECT
public:
    QQmlPointValueType(QObject *parent = 0);

    virtual QString toString() const;

    int x() const;
    int y() const;
    void setX(int);
    void setY(int);
};

class Q_QML_PRIVATE_EXPORT QQmlSizeFValueType : public QQmlValueTypeBase<QSizeF>
{
    Q_PROPERTY(qreal width READ width WRITE setWidth FINAL)
    Q_PROPERTY(qreal height READ height WRITE setHeight FINAL)
    Q_OBJECT
public:
    QQmlSizeFValueType(QObject *parent = 0);

    virtual QString toString() const;

    qreal width() const;
    qreal height() const;
    void setWidth(qreal);
    void setHeight(qreal);
};

class Q_QML_PRIVATE_EXPORT QQmlSizeValueType : public QQmlValueTypeBase<QSize>
{
    Q_PROPERTY(int width READ width WRITE setWidth FINAL)
    Q_PROPERTY(int height READ height WRITE setHeight FINAL)
    Q_OBJECT
public:
    QQmlSizeValueType(QObject *parent = 0);

    virtual QString toString() const;

    int width() const;
    int height() const;
    void setWidth(int);
    void setHeight(int);
};

class Q_QML_PRIVATE_EXPORT QQmlRectFValueType : public QQmlValueTypeBase<QRectF>
{
    Q_PROPERTY(qreal x READ x WRITE setX FINAL)
    Q_PROPERTY(qreal y READ y WRITE setY FINAL)
    Q_PROPERTY(qreal width READ width WRITE setWidth FINAL)
    Q_PROPERTY(qreal height READ height WRITE setHeight FINAL)
    Q_OBJECT
public:
    QQmlRectFValueType(QObject *parent = 0);

    virtual QString toString() const;

    qreal x() const;
    qreal y() const;
    void setX(qreal);
    void setY(qreal);

    qreal width() const;
    qreal height() const;
    void setWidth(qreal);
    void setHeight(qreal);
};

class Q_QML_PRIVATE_EXPORT QQmlRectValueType : public QQmlValueTypeBase<QRect>
{
    Q_PROPERTY(int x READ x WRITE setX FINAL)
    Q_PROPERTY(int y READ y WRITE setY FINAL)
    Q_PROPERTY(int width READ width WRITE setWidth FINAL)
    Q_PROPERTY(int height READ height WRITE setHeight FINAL)
    Q_OBJECT
public:
    QQmlRectValueType(QObject *parent = 0);

    virtual QString toString() const;

    int x() const;
    int y() const;
    void setX(int);
    void setY(int);

    int width() const;
    int height() const;
    void setWidth(int);
    void setHeight(int);
};

class Q_QML_PRIVATE_EXPORT QQmlEasingValueType : public QQmlValueTypeBase<QEasingCurve>
{
    Q_OBJECT
    Q_ENUMS(Type)

    Q_PROPERTY(QQmlEasingValueType::Type type READ type WRITE setType FINAL)
    Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude FINAL)
    Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot FINAL)
    Q_PROPERTY(qreal period READ period WRITE setPeriod FINAL)
    Q_PROPERTY(QVariantList bezierCurve READ bezierCurve WRITE setBezierCurve FINAL)
public:
    enum Type {
        Linear = QEasingCurve::Linear,
        InQuad = QEasingCurve::InQuad, OutQuad = QEasingCurve::OutQuad,
        InOutQuad = QEasingCurve::InOutQuad, OutInQuad = QEasingCurve::OutInQuad,
        InCubic = QEasingCurve::InCubic, OutCubic = QEasingCurve::OutCubic,
        InOutCubic = QEasingCurve::InOutCubic, OutInCubic = QEasingCurve::OutInCubic,
        InQuart = QEasingCurve::InQuart, OutQuart = QEasingCurve::OutQuart,
        InOutQuart = QEasingCurve::InOutQuart, OutInQuart = QEasingCurve::OutInQuart,
        InQuint = QEasingCurve::InQuint, OutQuint = QEasingCurve::OutQuint,
        InOutQuint = QEasingCurve::InOutQuint, OutInQuint = QEasingCurve::OutInQuint,
        InSine = QEasingCurve::InSine, OutSine = QEasingCurve::OutSine,
        InOutSine = QEasingCurve::InOutSine, OutInSine = QEasingCurve::OutInSine,
        InExpo = QEasingCurve::InExpo, OutExpo = QEasingCurve::OutExpo,
        InOutExpo = QEasingCurve::InOutExpo, OutInExpo = QEasingCurve::OutInExpo,
        InCirc = QEasingCurve::InCirc, OutCirc = QEasingCurve::OutCirc,
        InOutCirc = QEasingCurve::InOutCirc, OutInCirc = QEasingCurve::OutInCirc,
        InElastic = QEasingCurve::InElastic, OutElastic = QEasingCurve::OutElastic,
        InOutElastic = QEasingCurve::InOutElastic, OutInElastic = QEasingCurve::OutInElastic,
        InBack = QEasingCurve::InBack, OutBack = QEasingCurve::OutBack,
        InOutBack = QEasingCurve::InOutBack, OutInBack = QEasingCurve::OutInBack,
        InBounce = QEasingCurve::InBounce, OutBounce = QEasingCurve::OutBounce,
        InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce,
        InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve,
        SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve,
        Bezier = QEasingCurve::BezierSpline
    };

    QQmlEasingValueType(QObject *parent = 0);

    virtual QString toString() const;

    Type type() const;
    qreal amplitude() const;
    qreal overshoot() const;
    qreal period() const;
    void setType(Type);
    void setAmplitude(qreal);
    void setOvershoot(qreal);
    void setPeriod(qreal);
    void setBezierCurve(const QVariantList &);
    QVariantList bezierCurve() const;
};

template<typename T>
int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
{
    QByteArray name(T::staticMetaObject.className());

    QByteArray pointerName(name + '*');

    QQmlPrivate::RegisterType type = {
        0,

        qRegisterNormalizedMetaType<T *>(pointerName.constData()), 0, 0, 0,

        QString(),

        uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,

        0, 0,

        0, 0, 0,

        0, 0,

        0,
        0
    };

    return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
}

QT_END_NAMESPACE

#endif  // QQMLVALUETYPE_P_H


text:
@interface NENNewsContentViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imageIcon;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *subtitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyLabel;
@property (weak, nonatomic) IBOutlet UIImageView *replyBackground;
@end

@implementation NENNewsContentViewCell
#warning 只能由NENContentViewCell类调用,其他类不可直接调用!
+ (instancetype)cell
{
    return [[[NSBundle mainBundle] loadNibNamed:@"NENNewsContentViewCell" owner:nil options:nil] firstObject];
}

- (void)setNewsContent:(NENNewsContent *)newsContent
{
    [super setNewsContent:newsContent];

    UIImage *placeholderImage = [UIImage imageNamed:@"photoview_image_default_white"];
    [self.imageIcon sd_setImageWithURL:[NSURL URLWithString:newsContent.imgsrc] placeholderImage:placeholderImage];
    self.titleLabel.text = newsContent.title;
    self.subtitleLabel.text = newsContent.source;

    NSString *replyString = [NSString replyString:[newsContent.replyCount intValue]];
    if (replyString) {
        self.replyLabel.hidden = NO;
        self.replyBackground.hidden = NO;
        self.replyLabel.text = replyString;
    } else {
        self.replyLabel.hidden = YES;
        self.replyBackground.hidden = YES;
    }
}

+ (CGFloat)height
{
    return 80;
}

@end


text:
require 'puppet'
require 'fileutils'

module RSpec::Puppet
  class Setup
    def self.run(module_name=nil)
      unless is_module_dir?
        $stderr.puts "Does not appear to be a Puppet module.  Aborting"
        return false
      end

      if module_name.nil?
        module_name = get_module_name
        if module_name.nil?
          $stderr.puts "Unable to determine module name.  Aborting"
          return false
        end
      end

      [
        'spec',
        'spec/classes',
        'spec/defines',
        'spec/functions',
        'spec/hosts',
        'spec/fixtures',
        'spec/fixtures/manifests',
        'spec/fixtures/modules',
        "spec/fixtures/modules/#{module_name}",
      ].each { |dir| safe_mkdir(dir) }

      safe_touch('spec/fixtures/manifests/site.pp')

      ['manifests','lib','files','templates'].each do |dir|
        if File.exist? dir
          safe_make_symlink("../../../../#{dir}", "spec/fixtures/modules/#{module_name}/#{dir}")
        end
      end

      safe_create_spec_helper
      safe_create_rakefile
    end

  protected
    def self.get_module_name
      module_name = nil
      Dir["manifests/*.pp"].entries.each do |manifest|
        module_name = get_module_name_from_file(manifest)
        break unless module_name.nil?
      end
      module_name
    end

    def self.get_module_name_from_file(file)
      p = Puppet::Parser::Lexer.new
      module_name = nil
      p.string = File.read(file)
      tokens = p.fullscan

      i = tokens.index { |token| [:CLASS, :DEFINE].include? token.first }
      unless i.nil?
        module_name = tokens[i + 1].last[:value].split('::').first
      end

      module_name
    end

    def self.is_module_dir?
      Dir["*"].entries.include? "manifests"
    end

    def self.safe_mkdir(dir)
      if File.exists? dir
        unless File.directory? dir
          $stderr.puts "!! #{dir} already exists and is not a directory"
        end
      else
        FileUtils.mkdir dir
        puts " + #{dir}/"
      end
    end

    def self.safe_touch(file)
      if File.exists? file
        unless File.file? file
          $stderr.puts "!! #{file} already exists and is not a regular file"
        end
      else
        FileUtils.touch file
        puts " + #{file}"
      end
    end

    def self.safe_create_file(filename, content)
      if File.exists? filename
        old_content = File.read(filename)
        if old_content != content
          $stderr.puts "!! #{filename} already exists and differs from template"
        end
      else
        File.open(filename, 'w') do |f|
          f.puts content
        end
        puts " + #{filename}"
      end
    end

    def self.safe_create_spec_helper
      content = <<-EOF
require 'rspec-puppet'

fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))

RSpec.configure do |c|
  c.module_path = File.join(fixture_path, 'modules')
  c.manifest_dir = File.join(fixture_path, 'manifests')
end
EOF
    safe_create_file('spec/spec_helper.rb', content)
    end

    def self.safe_make_symlink(source, target)
      if File.exists? target
        unless File.symlink? target
          $stderr.puts "!! #{target} already exists and is not a symlink"
        end
      else
        FileUtils.ln_s(source, target)
        puts " + #{target}"
      end
    end

    def self.safe_create_rakefile
      content = <<-'EOF'
require 'rake'
require 'rspec/core/rake_task'

desc "Run all RSpec code examples"
RSpec::Core::RakeTask.new(:rspec) do |t|
  t.rspec_opts = File.read("spec/spec.opts").chomp || ""
end

SPEC_SUITES = (Dir.entries('spec') - ['.', '..','fixtures']).select {|e| File.directory? "spec/#{e}" }
namespace :rspec do
  SPEC_SUITES.each do |suite|
    desc "Run #{suite} RSpec code examples"
    RSpec::Core::RakeTask.new(suite) do |t|
      t.pattern = "spec/#{suite}/**/*_spec.rb"
      t.rspec_opts = File.read("spec/spec.opts").chomp || ""
    end
  end
end
task :default => :rspec

begin
  if Gem::Specification::find_by_name('puppet-lint')
    require 'puppet-lint/tasks/puppet-lint'
    PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
    task :default => [:rspec, :lint]
  end
rescue Gem::LoadError
end
EOF
    safe_create_file('Rakefile', content)
    end
  end
end


text:
<?php
Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function() {
    Route::pattern('id', '[0-9]+');
    Route::pattern('id2', '[0-9]+');

    #Admin Dashboard
    Route::get('dashboard', 'Admin\DashboardController@index');

    #Language
    Route::get('language', 'Admin\LanguageController@index');
    Route::get('language/create', 'Admin\LanguageController@getCreate');
    Route::post('language/create', 'Admin\LanguageController@postCreate');
    Route::get('language/{id}/edit', 'Admin\LanguageController@getEdit');
    Route::post('language/{id}/edit', 'Admin\LanguageController@postEdit');
    Route::get('language/{id}/delete', 'Admin\LanguageController@getDelete');
    Route::post('language/{id}/delete', 'Admin\LanguageController@postDelete');
    Route::get('language/data', 'Admin\LanguageController@data');
    Route::get('language/reorder', 'Admin\LanguageController@getReorder');

    #Categories
    Route::get('newscategory', 'Admin\CategoriasController@index');
    Route::get('newscategory/create', 'Admin\CategoriasController@getCreate');
    Route::post('newscategory/create', 'Admin\CategoriasController@postCreate');
    Route::get('newscategory/{id}/edit', 'Admin\CategoriasController@getEdit');
    Route::post('newscategory/{id}/edit', 'Admin\CategoriasController@postEdit');
    Route::get('newscategory/{id}/delete', 'Admin\CategoriasController@getDelete');
    Route::post('newscategory/{id}/delete', 'Admin\CategoriasController@postDelete');
    Route::get('newscategory/data', 'Admin\CategoriasController@data');
    Route::get('newscategory/reorder', 'Admin\CategoriasController@getReorder');

    #Users
    Route::get('users/', 'Admin\UserController@index');
    Route::get('users/create', 'Admin\UserController@getCreate');
    Route::post('users/create', 'Admin\UserController@postCreate');
    Route::get('users/{id}/edit', 'Admin\UserController@getEdit');
    Route::post('users/{id}/edit', 'Admin\UserController@postEdit');
    Route::get('users/{id}/delete', 'Admin\UserController@getDelete');
    Route::post('users/{id}/delete', 'Admin\UserController@postDelete');
    Route::get('users/data', 'Admin\UserController@data');

    #Cosas añadidas
    Route::get('crear/categoria', 'CategoriasController@show');
    Route::post('crear/categoria', 'CategoriasController@create');
    Route::get('site/config', 'Admin\SiteConfig@show'); //Hecho
    Route::post('site/config', 'Admin\SiteConfig@postEdit'); //Hecho
    Route::get('estadisticas/users','ViewStats@statsUser');
    Route::post('estadisticas/users','ViewStats@postStatsUser');
    Route::get('estadisticas/categorias','ViewStats@statsCategorias');
    Route::post('estadisticas/categorias','ViewStats@postStatsCategorias');
    Route::get('factura','GenerateFactura@show');
    Route::get('estadisticas','ViewStats@show');
    //Route::get('factura','GenerateFactura@show');

    #Subastas
    Route::get('subastas','Admin\SubastaController@show');
    Route::get('subasta/finalizadas','Admin\SubastaController@getFinalizadas');
    Route::get('subastas/data/','Admin\SubastaController@data');
    Route::get('subastas/data2/','Admin\SubastaController@data2');

    #Factura
    Route::get('factura/{id}','Admin\SubastaController@factura');
    Route::post('factura/xml','Admin\FacturaController@generateXml');
    Route::post('factura/pdf','Admin\FacturaController@generatePdf');

});


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace slnStartupProjectLibrary
{
    class Project
    {
        public string   ProjectName;
        public string   CDATA;
        public int      Offset;

        public Project(string cdata, int index)
        {
            CDATA = cdata;
            Offset = index;
            MatchCollection projectQuotesMatches = Regex.Matches(CDATA, @"""[^""\\]*(?:\\.[^""\\]*)*""");
            if (projectQuotesMatches.Count == 0)
                throw new Exception("Could not extract quoted strings from the project definition while looking for its name");
            if (projectQuotesMatches.Count < 2)
                throw new Exception("Could not locate project's name from the project definition");
            ProjectName = projectQuotesMatches[1].Value.Trim('"');
        }

        public override string ToString()
        {
            return string.Format("{0} ({1})", ProjectName, Offset);
        }
    }
}


text:
declare namespace Jymfony.Component.HttpServer.Controller.ArgumentResolvers {
    import ContainerInterface = Jymfony.Component.DependencyInjection.ContainerInterface;
    import RequestInterface = Jymfony.Contracts.HttpFoundation.RequestInterface;

    /**
     * Provides an intuitive error message when controller fails because it is not registered as a service.
     *
     * @final
     */
    export class NotTaggedControllerValueResolver extends implementationOf(ArgumentValueResolverInterface) {
        private _container: ContainerInterface;

        /**
         * Constructor.
         */
        __construct(container: ContainerInterface): void;
        constructor(container: ContainerInterface);

        /**
         * @inheritdoc
         */
        supports(request: RequestInterface): boolean;

        /**
         * @inheritdoc
         */
        resolve(request: RequestInterface, argument: ReflectionParameter): never;
    }
}


text:
exports.index = function(req, res) {

	res.render('index', { title: 'Multiplayer prototyping', jsFiles: GAME.gameFiles });
};


text:
namespace Esri
{
  namespace ArcGISRuntime
  {
    class Map;
    class MapQuickView;
  }
}

class QString;

#include <QQuickItem>

class MapLoaded : public QQuickItem
{
  Q_OBJECT

  Q_PROPERTY(QString mapLoadStatus READ mapLoadStatus NOTIFY mapLoadStatusChanged)

public:
  explicit MapLoaded(QQuickItem* parent = nullptr);
  ~MapLoaded() override;

  void componentComplete() override;
  static void init();

signals:
  void mapLoadStatusChanged();

private:
  QString mapLoadStatus() const;

private:
  Esri::ArcGISRuntime::Map* m_map = nullptr;
  Esri::ArcGISRuntime::MapQuickView* m_mapView = nullptr;
  QString m_loadStatus;
};

#endif // MAP_LOADED_H


text:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class MenuUIScript : MonoBehaviour
{
    public GameObject menuPanel;
    public GameObject exitConfirm;
    public GameObject newConfirm;

    void Start ()
    {
        exitConfirm.SetActive(false);
        menuPanel.SetActive(false);
        this.gameObject.SetActive(false);
    }

	// Update is called once per frame
	void Update ()
    {
	    if(Input.GetKeyDown(KeyCode.Escape))
        {
            menuPanel.SetActive(false);
            this.gameObject.SetActive(false);
        }
	}

    public void onMenuButtonPressed()
    {
        menuPanel.SetActive(true);
        this.gameObject.SetActive(true);
    }

    public void onExitButtonPressed()
    {
        exitConfirm.SetActive(true);
        menuPanel.SetActive(false);
    }

    public void onExitConfirmPressed()
    {
        Application.Quit();
    }

    public void onExitCanceledPressed()
    {
        exitConfirm.SetActive(false);
        menuPanel.SetActive(true);
    }

    public void onNewConfirmedPress()
    {
        newConfirm.SetActive(true);
        menuPanel.SetActive(false);
    }

    public void onNewCanceledPressed()
    {
        newConfirm.SetActive(false);
        menuPanel.SetActive(true);
    }

    public void onNewButtonPressed()
    {
        SceneManager.UnloadScene(1);
        SceneManager.LoadScene("scene0");
    }
}


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

/**
 * @fileoverview Polymer element for displaying material design HID detection
 * screen.
 */

(function() {
  /** @const {number} */ var PINCODE_LENGTH = 6;

  Polymer({
    is: 'oobe-hid-detection-md',

    properties: {
      /** "Continue" button is disabled until HID devices are paired. */
      continueButtonDisabled: {
        type: Boolean,
        value: true,
      },

      /** This is the displayed text for keyboard "Pairing" state. */
      keyboardPairingLabel: String,

      /** This is the displayed text for keyboard "Paired" state. */
      keyboardPairedLabel: String,

      /**
       * Current state in mouse pairing process.
       * @private
       */
      mouseState_: String,

      /**
       * Current state in keyboard pairing process.
       * @private
       */
      keyboardState_: String,

      /**
       * Controls visibility of keyboard pincode.
       * @private
       */
      keyboardPincodeVisible_: Boolean,

      /**
       * Reference to OOBE screen object.
       * @type {!OobeTypes.Screen}
       */
      screen: Object,
    },

    /**
     * Displayed keyboard pincode.
     */
    keyboardPincode_: String,

    /**
     * Helper function to update keyboard/mouse state.
     * @param {string} state Existing connection state (one of
     *   screen.CONNECTION).
     * @param {string} newState New connection state (one of screen.CONNECTION).
     * @private
     */
    calculateState_: function(state, newState) {
      if (newState === undefined)
        return state;

      if (newState == this.screen.CONNECTION.UPDATE)
        return state;

      return newState;
    },

    /**
     * Helper function to calculate visibility of 'connected' icons.
     * @param {string} state Connection state (one of screen.CONNECTION).
     * @private
     */
    tickIsVisible_: function(state) {
      return (state == this.screen.CONNECTION.USB) ||
          (state == this.screen.CONNECTION.CONNECTED) ||
          (state == this.screen.CONNECTION.PAIRED);
    },

    /**
     * Helper function to update keyboard/mouse state.
     * Returns true if strings are not equal. False otherwize.
     * @param {string} string1
     * @param {string} string2
     * @private
     */
    notEq_: function(string1, string2) { return string1 != string2; },

    /**
     * Sets current state in mouse pairing process.
     * @param {string} state Connection state (one of screen.CONNECTION).
     */
    setMouseState: function(state) {
      this.mouseState_ = this.calculateState_(this.mouseState_, state);
    },

    /**
     * Updates visibility of keyboard pincode.
     * @param {string} state Connection state (one of screen.CONNECTION).
     * @private
     */
    updateKeyboardPincodeVisible_: function(state) {
      this.keyboardPincodeVisible_ = this.keyboardPincode_ &&
          (this.keyboardState_ == this.screen.CONNECTION.PAIRING);
    },

    /**
     * Sets current state in keyboard pairing process.
     * @param {string} state Connection state (one of screen.CONNECTION).
     */
    setKeyboardState: function(state) {
      this.keyboardState_ = this.calculateState_(this.keyboardState_, state);
      this.updateKeyboardPincodeVisible_();
    },

    /**
     * Sets displayed keyboard pin.
     * @param {string} pincode Pincode.
     * @param {number} entered Number of digits already entered.
     * @param {boolean} expected
     * @param {string} label Connection state displayed description.
     */
    setPincodeState: function(pincode, entered, expected, label) {
      this.keyboardPincode_ = pincode;
      if (!pincode) {
        this.updateKeyboardPincodeVisible_();
        return;
      }

      if (pincode.length != PINCODE_LENGTH)
        console.error('Wrong pincode length');

      // Pincode keys plus Enter key.
      for (let i = 0; i < (PINCODE_LENGTH + 1); i++) {
        var pincodeSymbol = this.$['hid-keyboard-pincode-sym-' + (i + 1)];
        pincodeSymbol.classList.toggle('key-typed', i < entered && expected);
        pincodeSymbol.classList.toggle('key-untyped', i > entered && expected);
        pincodeSymbol.classList.toggle('key-next', i == entered && expected);
        if (i < PINCODE_LENGTH)
          pincodeSymbol.textContent = pincode[i] ? pincode[i] : '';
      }

      var wasVisible = this.keyboardPincodeVisible_;
      this.updateKeyboardPincodeVisible_();
      if (this.keyboardPincodeVisible_ && !wasVisible) {
        announceAccessibleMessage(
            label + ' ' + pincode + ' ' +
            loadTimeData.getString('hidDetectionBTEnterKey'));
      }
    },

    /**
     * This is 'on-tap' event handler for 'Continue' button.
     */
    onHIDContinueTap_: function(event) {
      chrome.send('HIDDetectionOnContinue');
      event.stopPropagation();
    },
  });
})();


text:
/**
 * \file
 * \brief VMKit Kernel interface.
 */

/*
 * Copyright (c) 2009, 2013, ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
 */

#ifndef VMKIT_H
#define VMKIT_H

#include "vmx_vmkit.h"
#include "svm_vmkit.h"

#define VMKIT_ERR_OK        0
#define VMKIT_ERR_UNAVAIL   (-1)

errval_t vmkit_enable_virtualization (void);
int vmkit_disable_virtualization (void);
void __attribute__ ((noreturn)) vmkit_vmenter (struct dcb *dcb);
void __attribute__ ((noreturn)) vmkit_vmexec (struct dcb *dcb, lvaddr_t entry);

#endif // _VMKIT_H


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--

  Copyright 2003 - 2017 The eFaps Team

  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.

-->
<ui-form xmlns="http://www.efaps.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.efaps.org/xsd http://www.efaps.org/xsd/eFaps_1.0.xsd">
    <uuid>e587aafd-2df9-4c37-8189-c84ed90484c6</uuid>
    <file-application>eFapsApp-Accounting</file-application>
    <definition>
        <version-expression>(version==latest)</version-expression>
        <name>Accounting_PeriodCreateFromForm</name>
        <field name="period">
            <property name="Label">Accounting_Period.Label</property>
            <property name="ModeCreate">EDITABLE</property>
            <property name="UIProvider">org.efaps.admin.datamodel.ui.StringUI</property>
            <property name="Required">true</property>
            <trigger program="org.efaps.esjp.common.uiform.Field"
                method="autoComplete"
                name="Accounting_PeriodCreateFromForm.period.UI_Field_Autocomplete"
                event="UI_FIELD_AUTOCOMPLETE" >
                <property name="SearchAttribute">Name</property>
                <property name="Select4VALUE">attribute[Name]</property>
                <property name="Select4CHOICE">attribute[Name]</property>
                <property name="Type">Accounting_Period</property>
            </trigger>
        </field>
        <field name="name">
            <property name="ModeCreate">EDITABLE</property>
            <property name="ModeEdit">EDITABLE</property>
            <property name="ModeSearch">EDITABLE</property>
            <property name="Attribute">Name</property>
            <property name="Required">true</property>
        </field>
        <field name="fromDate">
            <property name="Attribute">FromDate</property>
            <property name="Required">true</property>
            <property name="ModeCreate">EDITABLE</property>
            <property name="ModeEdit">EDITABLE</property>
        </field>
        <field name="toDate">
            <property name="Attribute">ToDate</property>
            <property name="Required">true</property>
            <property name="ModeCreate">EDITABLE</property>
            <property name="ModeEdit">EDITABLE</property>
        </field>
    </definition>
</ui-form>


text:
using System;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Ploeh.AutoFixture.Kernel;
using Ploeh.TestTypeFoundation;

namespace Ploeh.AutoFixture.NUnit2.UnitTest
{
    [TestFixture]
    public class FrozenAttributeTest
    {
        [Test]
        public void SutIsAttribute()
        {
            // Fixture setup
            // Exercise system
            var sut = new FrozenAttribute();
            // Verify outcome
            Assert.IsInstanceOf<CustomizeAttribute>(sut);
            // Teardown
        }

        [Test]
        public void GetCustomizationFromNullParameterThrows()
        {
            // Fixture setup
            var sut = new FrozenAttribute();
            // Exercise system and verify outcome
            Assert.Throws<ArgumentNullException>(() =>
                sut.GetCustomization(null));
            // Teardown
        }

        [Test]
        public void GetCustomizationWithSpecificRegisteredTypeReturnsCorrectResult()
        {
            // Fixture setup
            var registeredType = typeof(AbstractType);
#pragma warning disable 0618
            var sut = new FrozenAttribute { As = registeredType };
#pragma warning restore 0618
            var parameter = typeof(TypeWithConcreteParameterMethod)
                .GetMethod("DoSomething", new[] { typeof(ConcreteType) })
                .GetParameters()
                .Single();
            // Exercise system
            var result = sut.GetCustomization(parameter);
            // Verify outcome
            Assert.IsAssignableFrom<FreezingCustomization>(result);
            var freezer = (FreezingCustomization)result;
            Assert.AreEqual(registeredType, freezer.RegisteredType);
            // Teardown
        }

        [Test]
        public void GetCustomizationWithIncompatibleRegisteredTypeThrowsArgumentException()
        {
            // Fixture setup
            var registeredType = typeof(string);
#pragma warning disable 0618
            var sut = new FrozenAttribute { As = registeredType };
#pragma warning restore 0618
            var parameter = typeof(TypeWithConcreteParameterMethod)
                .GetMethod("DoSomething", new[] { typeof(ConcreteType) })
                .GetParameters()
                .Single();
            // Exercise system and verify outcome
            Assert.Throws<ArgumentException>(() => sut.GetCustomization(parameter));
            // Teardown
        }
    }
}


text:
namespace quota {

class ClientUsageTracker;

// A helper class that gathers and tracks the amount of data stored in
// all quota clients.
// An instance of this class is created per storage type.
class WEBKIT_STORAGE_BROWSER_EXPORT UsageTracker : public QuotaTaskObserver {
 public:
  UsageTracker(const QuotaClientList& clients, StorageType type,
               SpecialStoragePolicy* special_storage_policy);
  virtual ~UsageTracker();

  StorageType type() const { return type_; }
  ClientUsageTracker* GetClientTracker(QuotaClient::ID client_id);

  void GetGlobalLimitedUsage(const UsageCallback& callback);
  void GetGlobalUsage(const GlobalUsageCallback& callback);
  void GetHostUsage(const std::string& host, const UsageCallback& callback);
  void UpdateUsageCache(QuotaClient::ID client_id,
                        const GURL& origin,
                        int64 delta);
  void GetCachedHostsUsage(std::map<std::string, int64>* host_usage) const;
  void GetCachedOrigins(std::set<GURL>* origins) const;
  bool IsWorking() const {
    return global_usage_callbacks_.HasCallbacks() ||
           host_usage_callbacks_.HasAnyCallbacks();
  }

  void SetUsageCacheEnabled(QuotaClient::ID client_id,
                            const GURL& origin,
                            bool enabled);

 private:
  struct AccumulateInfo {
    AccumulateInfo() : pending_clients(0), usage(0), unlimited_usage(0) {}
    int pending_clients;
    int64 usage;
    int64 unlimited_usage;
  };

  typedef std::map<QuotaClient::ID, ClientUsageTracker*> ClientTrackerMap;

  friend class ClientUsageTracker;
  void AccumulateClientGlobalLimitedUsage(AccumulateInfo* info,
                                          int64 limited_usage);
  void AccumulateClientGlobalUsage(AccumulateInfo* info,
                                   int64 usage,
                                   int64 unlimited_usage);
  void AccumulateClientHostUsage(AccumulateInfo* info,
                                 const std::string& host,
                                 int64 usage);

  const StorageType type_;
  ClientTrackerMap client_tracker_map_;

  UsageCallbackQueue global_limited_usage_callbacks_;
  GlobalUsageCallbackQueue global_usage_callbacks_;
  HostUsageCallbackMap host_usage_callbacks_;

  base::WeakPtrFactory<UsageTracker> weak_factory_;
  DISALLOW_COPY_AND_ASSIGN(UsageTracker);
};

// This class holds per-client usage tracking information and caches per-host
// usage data.  An instance of this class is created per client.
class ClientUsageTracker : public SpecialStoragePolicy::Observer,
                           public base::NonThreadSafe,
                           public base::SupportsWeakPtr<ClientUsageTracker> {
 public:
  typedef base::Callback<void(int64 limited_usage,
                              int64 unlimited_usage)> HostUsageAccumulator;
  typedef base::Callback<void(const GURL& origin,
                              int64 usage)> OriginUsageAccumulator;
  typedef std::map<std::string, std::set<GURL> > OriginSetByHost;

  ClientUsageTracker(UsageTracker* tracker,
                     QuotaClient* client,
                     StorageType type,
                     SpecialStoragePolicy* special_storage_policy);
  virtual ~ClientUsageTracker();

  void GetGlobalLimitedUsage(const UsageCallback& callback);
  void GetGlobalUsage(const GlobalUsageCallback& callback);
  void GetHostUsage(const std::string& host, const UsageCallback& callback);
  void UpdateUsageCache(const GURL& origin, int64 delta);
  void GetCachedHostsUsage(std::map<std::string, int64>* host_usage) const;
  void GetCachedOrigins(std::set<GURL>* origins) const;
  int64 GetCachedOriginsUsage(const std::set<GURL>& origins,
                              std::vector<GURL>* origins_not_in_cache);
  bool IsUsageCacheEnabledForOrigin(const GURL& origin) const;
  void SetUsageCacheEnabled(const GURL& origin, bool enabled);

 private:
  typedef CallbackQueueMap<HostUsageAccumulator, std::string,
                           Tuple2<int64, int64> > HostUsageAccumulatorMap;

  typedef std::set<std::string> HostSet;
  typedef std::map<GURL, int64> UsageMap;
  typedef std::map<std::string, UsageMap> HostUsageMap;

  struct AccumulateInfo {
    int pending_jobs;
    int64 limited_usage;
    int64 unlimited_usage;

    AccumulateInfo()
        : pending_jobs(0), limited_usage(0), unlimited_usage(0) {}
  };

  void AccumulateLimitedOriginUsage(AccumulateInfo* info,
                                    const UsageCallback& callback,
                                    int64 usage);
  void DidGetOriginsForGlobalUsage(const GlobalUsageCallback& callback,
                                   const std::set<GURL>& origins);
  void AccumulateHostUsage(AccumulateInfo* info,
                           const GlobalUsageCallback& callback,
                           int64 limited_usage,
                           int64 unlimited_usage);

  void DidGetOriginsForHostUsage(const std::string& host,
                                 const std::set<GURL>& origins);

  void GetUsageForOrigins(const std::string& host,
                          const std::set<GURL>& origins);
  void AccumulateOriginUsage(AccumulateInfo* info,
                             const std::string& host,
                             const GURL& origin,
                             int64 usage);

  // Methods used by our GatherUsage tasks, as a task makes progress
  // origins and hosts are added incrementally to the cache.
  void AddCachedOrigin(const GURL& origin, int64 usage);
  void AddCachedHost(const std::string& host);

  int64 GetCachedHostUsage(const std::string& host) const;
  int64 GetCachedGlobalUnlimitedUsage();
  bool GetCachedOriginUsage(const GURL& origin, int64* usage) const;

  // SpecialStoragePolicy::Observer overrides
  virtual void OnGranted(const GURL& origin, int change_flags) OVERRIDE;
  virtual void OnRevoked(const GURL& origin, int change_flags) OVERRIDE;
  virtual void OnCleared() OVERRIDE;

  bool IsStorageUnlimited(const GURL& origin) const;

  UsageTracker* tracker_;
  QuotaClient* client_;
  const StorageType type_;

  int64 global_limited_usage_;
  int64 global_unlimited_usage_;
  bool global_usage_retrieved_;
  HostSet cached_hosts_;
  HostUsageMap cached_usage_by_host_;

  OriginSetByHost non_cached_limited_origins_by_host_;
  OriginSetByHost non_cached_unlimited_origins_by_host_;

  GlobalUsageCallbackQueue global_usage_callback_;
  HostUsageAccumulatorMap host_usage_accumulators_;

  scoped_refptr<SpecialStoragePolicy> special_storage_policy_;

  DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker);
};

}  // namespace quota

#endif  // WEBKIT_BROWSER_QUOTA_USAGE_TRACKER_H_


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createOr = void 0;

var _algorithm = require("../../type/matrix/utils/algorithm03");

var _algorithm2 = require("../../type/matrix/utils/algorithm12");

var _algorithm3 = require("../../type/matrix/utils/algorithm13");

var _algorithm4 = require("../../type/matrix/utils/algorithm14");

var _algorithm5 = require("../../type/matrix/utils/algorithm05");

var _factory = require("../../utils/factory");

var _number = require("../../plain/number");

var name = 'or';
var dependencies = ['typed', 'matrix', 'equalScalar', 'DenseMatrix'];
var createOr =
/* #__PURE__ */
(0, _factory.factory)(name, dependencies, function (_ref) {
  var typed = _ref.typed,
      matrix = _ref.matrix,
      equalScalar = _ref.equalScalar,
      DenseMatrix = _ref.DenseMatrix;
  var algorithm03 = (0, _algorithm.createAlgorithm03)({
    typed: typed
  });
  var algorithm05 = (0, _algorithm5.createAlgorithm05)({
    typed: typed,
    equalScalar: equalScalar
  });
  var algorithm12 = (0, _algorithm2.createAlgorithm12)({
    typed: typed,
    DenseMatrix: DenseMatrix
  });
  var algorithm13 = (0, _algorithm3.createAlgorithm13)({
    typed: typed
  });
  var algorithm14 = (0, _algorithm4.createAlgorithm14)({
    typed: typed
  });
  /**
   * Logical `or`. Test if at least one value is defined with a nonzero/nonempty value.
   * For matrices, the function is evaluated element wise.
   *
   * Syntax:
   *
   *    math.or(x, y)
   *
   * Examples:
   *
   *    math.or(2, 4)   // returns true
   *
   *    a = [2, 5, 0]
   *    b = [0, 22, 0]
   *    c = 0
   *
   *    math.or(a, b)   // returns [true, true, false]
   *    math.or(b, c)   // returns [false, true, false]
   *
   * See also:
   *
   *    and, not, xor
   *
   * @param  {number | BigNumber | Complex | Unit | Array | Matrix} x First value to check
   * @param  {number | BigNumber | Complex | Unit | Array | Matrix} y Second value to check
   * @return {boolean | Array | Matrix}
   *            Returns true when one of the inputs is defined with a nonzero/nonempty value.
   */

  var or = typed(name, {
    'number, number': _number.orNumber,
    'Complex, Complex': function ComplexComplex(x, y) {
      return x.re !== 0 || x.im !== 0 || y.re !== 0 || y.im !== 0;
    },
    'BigNumber, BigNumber': function BigNumberBigNumber(x, y) {
      return !x.isZero() && !x.isNaN() || !y.isZero() && !y.isNaN();
    },
    'Unit, Unit': function UnitUnit(x, y) {
      return or(x.value || 0, y.value || 0);
    },
    'SparseMatrix, SparseMatrix': function SparseMatrixSparseMatrix(x, y) {
      return algorithm05(x, y, or);
    },
    'SparseMatrix, DenseMatrix': function SparseMatrixDenseMatrix(x, y) {
      return algorithm03(y, x, or, true);
    },
    'DenseMatrix, SparseMatrix': function DenseMatrixSparseMatrix(x, y) {
      return algorithm03(x, y, or, false);
    },
    'DenseMatrix, DenseMatrix': function DenseMatrixDenseMatrix(x, y) {
      return algorithm13(x, y, or);
    },
    'Array, Array': function ArrayArray(x, y) {
      // use matrix implementation
      return or(matrix(x), matrix(y)).valueOf();
    },
    'Array, Matrix': function ArrayMatrix(x, y) {
      // use matrix implementation
      return or(matrix(x), y);
    },
    'Matrix, Array': function MatrixArray(x, y) {
      // use matrix implementation
      return or(x, matrix(y));
    },
    'SparseMatrix, any': function SparseMatrixAny(x, y) {
      return algorithm12(x, y, or, false);
    },
    'DenseMatrix, any': function DenseMatrixAny(x, y) {
      return algorithm14(x, y, or, false);
    },
    'any, SparseMatrix': function anySparseMatrix(x, y) {
      return algorithm12(y, x, or, true);
    },
    'any, DenseMatrix': function anyDenseMatrix(x, y) {
      return algorithm14(y, x, or, true);
    },
    'Array, any': function ArrayAny(x, y) {
      // use matrix implementation
      return algorithm14(matrix(x), y, or, false).valueOf();
    },
    'any, Array': function anyArray(x, y) {
      // use matrix implementation
      return algorithm14(matrix(y), x, or, true).valueOf();
    }
  });
  return or;
});
exports.createOr = createOr;


text:
package com.google.template.soy.data;

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.concurrent.LazyInit;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Message;
import com.google.protobuf.TextFormat;
import com.google.template.soy.data.restricted.NullData;
import com.google.template.soy.internal.proto.Field;
import com.google.template.soy.internal.proto.JavaQualifiedNames;
import com.google.template.soy.jbcsrc.shared.Names;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Soy value that wraps a protocol buffer message object.
 *
 *
TODO(b/70906867): This implements SoyMap/SoyRecord for backwards compatibility. When Soy
 * initially added support for protos we implemented these interfaces to support using protos in
 * legacy untyped templates. This made it easier for teams to start passing protos to their
 * templates but has turned out to be a bad idea because it means your templates work differently in
 * javascript vs java. So now we continue to support these usecases but issue warnings when it
 * occurs. In the long run we will switch to either throwing exception or always returning null from
 * these methods.
 */
public final class SoyProtoValue extends SoyAbstractValue implements SoyLegacyObjectMap, SoyRecord {
  private static final Logger logger = Logger.getLogger(SoyProtoValue.class.getName());

  private static final class ProtoClass {
    final ImmutableMap<String, FieldWithInterpreter> fields;
    final Message defaultInstance;
    final String topLevelName;
    final String fullName;
    final String importPath;

    ProtoClass(Message defaultInstance, ImmutableMap<String, FieldWithInterpreter> fields) {
      this.fullName = defaultInstance.getDescriptorForType().getFullName();
      Descriptor d = defaultInstance.getDescriptorForType();
      while (d.getContainingType() != null) {
        d = d.getContainingType();
      }
      this.topLevelName = d.getName();
      this.importPath = defaultInstance.getDescriptorForType().getFile().getFullName();
      this.defaultInstance = checkNotNull(defaultInstance);
      this.fields = checkNotNull(fields);
    }
  }

  private static final class FieldWithInterpreter extends Field {
    @LazyInit ProtoFieldInterpreter interpreter;

    FieldWithInterpreter(FieldDescriptor fieldDesc) {
      super(fieldDesc);
    }

    private ProtoFieldInterpreter impl() {
      ProtoFieldInterpreter local = interpreter;
      if (local == null) {
        local = ProtoFieldInterpreter.create(getDescriptor());
      }
      return local;
    }

    public SoyValue interpretField(Message message) {
      return impl().soyFromProto(message.getField(getDescriptor()));
    }

    public void assignField(Message.Builder builder, SoyValue value) {
      builder.setField(getDescriptor(), impl().protoFromSoy(value));
    }
  }

  private static final LoadingCache<Descriptor, ProtoClass> classCache =
      CacheBuilder.newBuilder()
          .weakKeys()
          .build(
              new CacheLoader<Descriptor, ProtoClass>() {
                final Field.Factory<FieldWithInterpreter> factory = FieldWithInterpreter::new;

                @Override
                public ProtoClass load(Descriptor descriptor) throws Exception {
                  Set<FieldDescriptor> extensions = new LinkedHashSet<>();
                  return new ProtoClass(
                      getDefaultInstance(descriptor),
                      Field.getFieldsForType(descriptor, extensions, factory));
                }
              });

  private static Message getDefaultInstance(Descriptor key)
      throws ClassNotFoundException, IllegalAccessException, InvocationTargetException,
          NoSuchMethodException {
    Class<?> messageClass = Class.forName(JavaQualifiedNames.getClassName(key));
    return (Message) messageClass.getMethod("getDefaultInstance").invoke(null);
  }

  public static SoyProtoValue create(Message proto) {
    return new SoyProtoValue(proto);
  }

  /** The underlying proto message object. */
  private final Message proto;

  // lazily initialized
  private ProtoClass clazz;

  // This field is used by the Tofu renderer to tell the logging code where the access is, so that
  // the log lines have sufficient information.  For jbcsrc we can just log an exception since the
  // source location can be inferred from the stack trace.
  private Object locationKey;

  private SoyProtoValue(Message proto) {
    this.proto = checkNotNull(proto);
  }

  // lazy accessor for clazz, in jbcsrc we often will not need this metadata. so avoid calculating
  // it if we can
  private ProtoClass clazz() {
    ProtoClass localClazz = clazz;
    if (localClazz == null) {
      localClazz = classCache.getUnchecked(proto.getDescriptorForType());
      clazz = localClazz;
    }
    return localClazz;
  }

  /** Returns the underlying message. */
  public Message getProto() {
    return proto;
  }

  public SoyValue getProtoField(String name) {
    FieldWithInterpreter field = clazz().fields.get(name);
    if (field == null) {
      throw new IllegalArgumentException(
          "Proto " + proto.getClass().getName() + " does not have a field of name " + name);
    }
    return field.interpretField(proto);
  }

  /**
   * Returns the value of the field, or null only if the field has presence semantics and is unset.
   * For fields with no presence semantics (i.e., there's no hasser method), the value is never
   * null.
   */
  public SoyValue getProtoFieldOrNull(String name) {
    FieldWithInterpreter field = clazz().fields.get(name);
    if (field == null) {
      throw new IllegalArgumentException(
          "Proto " + proto.getClass().getName() + " does not have a field of name " + name);
    }
    FieldDescriptor fd = field.getDescriptor();
    if (fd.hasPresence() && !proto.hasField(fd)) {
      return NullData.INSTANCE;
    }
    return field.interpretField(proto);
  }

  public boolean hasProtoField(String name) {
    FieldWithInterpreter field = clazz().fields.get(name);
    if (field == null) {
      throw new IllegalArgumentException(
          "Proto " + proto.getClass().getName() + " does not have a field of name " + name);
    }
    if (field.getDescriptor().isRepeated()) {
      // Compiler should prevent this from happening.
      throw new IllegalArgumentException("Cannot check for presence on repeated field " + name);
    } else {
      return proto.hasField(field.getDescriptor());
    }
  }

  public void setAccessLocationKey(Object location) {
    this.locationKey = location;
  }

  // -----------------------------------------------------------------------------------------------
  // SoyRecord.

  @Deprecated
  @Override
  public boolean hasField(String name) {
    asRecord();
    return false;
  }

  @Deprecated
  @Override
  public SoyValue getField(String name) {
    asRecord();
    return null;
  }

  @Deprecated
  @Override
  public SoyValueProvider getFieldProvider(String name) {
    asRecord();
    return null;
  }

  @Override
  public final ImmutableMap<String, SoyValueProvider> recordAsMap() {
    throw new UnsupportedOperationException();
  }

  @Override
  public void forEach(BiConsumer<String, ? super SoyValueProvider> action) {
    throw new UnsupportedOperationException();
  }

  @Override
  public int recordSize() {
    throw new UnsupportedOperationException();
  }

  // -----------------------------------------------------------------------------------------------
  // SoyMap.

  @Deprecated
  @Override
  public int getItemCnt() {
    return getItemKeys().size();
  }

  @Deprecated
  @Override
  public Collection<SoyValue> getItemKeys() {
    asMap();
    return ImmutableList.of();
  }

  @Deprecated
  @Override
  public boolean hasItem(SoyValue key) {
    asMap();
    return false;
  }

  @Deprecated
  @Override
  public SoyValue getItem(SoyValue key) {
    asMap();
    return null;
  }

  @Deprecated
  @Override
  public SoyValueProvider getItemProvider(SoyValue key) {
    asMap();
    return null;
  }

  private void asMap() {
    asDeprecatedType("map");
  }

  private void asRecord() {
    asDeprecatedType("record");
  }

  private void asDeprecatedType(String type) {
    Object locationKey = getAndClearLocationKey();
    ProtoClass clazz = clazz();
    // TODO(lukes): consider throwing an exception here, this would be inconsistent withh JS but
    // would be more useful.
    if (locationKey == null) {
      // if there is no locationKey (i.e. this is jbcsrc), then we will use a stack trace
      Exception e = new Exception("bad proto access");
      Names.rewriteStackTrace(e);
      logger.log(
          Level.SEVERE,
          String.format(
              "Accessing a proto of type %s (import {%s} from '%s';) as a %s is deprecated. Add"
                  + " static types to fix."
              ,
              clazz.fullName, clazz.topLevelName, clazz.importPath, type),
          e);
    } else {
      // if there is a locationKey (i.e. this is tofu), then we will use the location key
      logger.log(
          Level.SEVERE,
          String.format(
              "Accessing a proto of type %s (import {%s} from '%s';) as a %s is deprecated. Add"
                  + " static types to fix."
                  + "\n\t%s",
              clazz.fullName, clazz.topLevelName, clazz.importPath, type, locationKey),
          new Exception("bad proto access @" + locationKey));
    }
  }

  private Object getAndClearLocationKey() {
    Object key = locationKey;
    if (key != null) {
      locationKey = null;
    }
    return key;
  }

  // -----------------------------------------------------------------------------------------------
  // SoyValue.

  @Override
  public boolean equals(Object other) {
    return other != null
        && this.getClass() == other.getClass()
        // Use identity for js compatibility
        && this.proto == ((SoyProtoValue) other).proto;
  }

  @Override
  public boolean coerceToBoolean() {
    return true; // matches JS behavior
  }

  @Override
  public String coerceToString() {
    // TODO(gboyer): Make this consistent with JavaScript.
    // TODO(gboyer): Respect ProtoUtils.shouldJsIgnoreField(...)?
    return proto.toString();
  }

  @Override
  public void render(LoggingAdvisingAppendable appendable) throws IOException {
    TextFormat.printer().print(proto, appendable);
  }

  // -----------------------------------------------------------------------------------------------
  // Object.

  /**
   * Returns a string that indicates the type of proto held, to assist in debugging Soy type errors.
   */
  @Override
  public String toString() {
    return String.format("SoyProtoValue<%s>", proto.getDescriptorForType().getFullName());
  }

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

  /**
   * Provides an interface for constructing a SoyProtoValue. Used by the tofu renderer only.
   *
   *
Not for use by Soy users.
   */
  public static final class Builder {
    private final ProtoClass clazz;
    private final Message.Builder builder;

    public Builder(Descriptor soyProto) {
      this.clazz = classCache.getUnchecked(soyProto);
      this.builder = clazz.defaultInstance.newBuilderForType();
    }

    @CanIgnoreReturnValue
    public Builder setField(String field, SoyValue value) {
      clazz.fields.get(field).assignField(builder, value);
      return this;
    }

    public SoyProtoValue build() {
      SoyProtoValue soyProtoValue = new SoyProtoValue(builder.build());
      soyProtoValue.clazz = clazz;
      return soyProtoValue;
    }
  }
}


text:
{-| Version 1 'UUID' utilities.
 -}

{-# LANGUAGE ForeignFunctionInterface
           , CPP
  #-}

module System.UUID.V1
  ( uuid
  ) where

import System.UUID.FromForeign

import Foreign.C
import Foreign.Ptr

{-| Obtain a Version 1 'UUID' with the native 'UUID' generator.
 -}
uuid                         =  runAndRead native

#ifdef mingw32_HOST_OS

foreign import stdcall unsafe "UuidCreateSequential"
  native                    ::  Ptr CChar -> IO ()

#else

foreign import ccall unsafe "uuid_generate_time"
  native                    ::  Ptr CChar -> IO ()

#endif


text:
package org.apache.parquet.thrift.projection.deprecated;

import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * Test using glob syntax to specify which attribute to retain
 */
public class PathGlobPatternTest {
  @Test
  public void testRecursiveGlob() {
    PathGlobPattern g = new PathGlobPattern("a/**/b");
    assertFalse(g.matches("a/b"));
    assertTrue(g.matches("a/asd/b"));
    assertTrue(g.matches("a/asd/ss/b"));

    g = new PathGlobPattern("a/**");
    assertTrue(g.matches("a/as"));
    assertTrue(g.matches("a/asd/b"));
    assertTrue(g.matches("a/asd/ss/b"));

  }

  @Test
  public void testStandardGlob() {
    PathGlobPattern g = new PathGlobPattern("a/*");
    assertTrue(g.matches("a/as"));
    assertFalse(g.matches("a/asd/b"));
    assertFalse(g.matches("a/asd/ss/b"));

    g = new PathGlobPattern("a/{bb,cc}/d");
    assertTrue(g.matches("a/bb/d"));
    assertTrue(g.matches("a/cc/d"));
    assertFalse(g.matches("a/cc/bb/d"));
    assertFalse(g.matches("a/d"));

  }
}


text:
// Copyright (c) 2015 fjz13. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#include "MedusaPreCompiled.h"
#include "NormalLayer.h"
#include "Node/NodeFactory.h"

MEDUSA_BEGIN;

NormalLayer::NormalLayer(StringRef name/*=StringRef::Empty*/, const IEventArg& e/*=IEventArg::Empty*/)
	:ILayer(name, e)
{

}

NormalLayer::~NormalLayer(void)
{
}

MEDUSA_IMPLEMENT_NODE(NormalLayer);

MEDUSA_END;


text:
import inspect
import pickle
import pkgutil
import unittest

import traceback
import numpy as np
from Orange.base import SklLearner

import Orange.classification
from Orange.classification import (Learner, Model, NaiveBayesLearner,
    LogisticRegressionLearner, NuSVMLearner, MajorityLearner, RandomForestLearner,
    SimpleTreeLearner, SoftmaxRegressionLearner, SVMLearner, LinearSVMLearner,
    OneClassSVMLearner, TreeLearner, KNNLearner, SimpleRandomForestLearner,
    EllipticEnvelopeLearner)
from Orange.classification.rules import _RuleLearner
from Orange.data import (ContinuousVariable, DiscreteVariable,
                         Domain, Table, Variable)
from Orange.evaluation import CrossValidation
from Orange.tests.dummy_learners import DummyLearner, DummyMulticlassLearner
from Orange.tests import test_filename

class MultiClassTest(unittest.TestCase):
    def test_unsupported(self):
        nrows = 20
        ncols = 10
        x = np.random.randint(1, 4, (nrows, ncols))

        # multiple class variables
        y = np.random.randint(0, 2, (nrows, 2))
        t = Table(x, y)
        learn = DummyLearner()
        # TODO: Errors raised from various data checks should be made consistent
        with self.assertRaises((ValueError, TypeError)):
            clf = learn(t)

        # single class variable
        y = np.random.randint(0, 2, (nrows, 1))
        t = Table(x, y)
        learn = DummyLearner()
        clf = learn(t)
        z = clf(x)
        self.assertEqual(z.ndim, 1)

    def test_supported(self):
        nrows = 20
        ncols = 10
        x = np.random.randint(1, 4, (nrows, ncols))
        y = np.random.randint(0, 2, (nrows, 2))
        t = Table(x, y)
        learn = DummyMulticlassLearner()
        clf = learn(t)
        z = clf(x)
        self.assertEqual(z.shape, y.shape)

class ModelTest(unittest.TestCase):
    def test_predict_single_instance(self):
        table = Table("titanic")
        learn = NaiveBayesLearner()
        clf = learn(table)
        pred = []
        for row in table:
            pred.append(clf(row))

    def test_learner_adequacy(self):
        table = Table("housing")
        learner = NaiveBayesLearner()
        self.assertRaises(ValueError, learner, table)

    def test_value_from_probs(self):
        nrows = 100
        ncols = 5
        x = np.random.randint(0, 2, (nrows, ncols))

        # single class variable
        y = np.random.randint(1, 4, (nrows, 1)) // 2    # majority = 1
        t = Table(x, y)
        learn = DummyLearner()
        clf = learn(t)
        clf.ret = Model.Probs
        y2 = clf(x, ret=Model.Value)
        self.assertEqual(y2.shape, (nrows,))
        y2, probs = clf(x, ret=Model.ValueProbs)
        self.assertEqual(y2.shape, (nrows,))
        self.assertEqual(probs.shape, (nrows, 2))

        # multitarget
        y = np.random.randint(1, 6, (nrows, 2))
        y[:, 0] = y[:, 0] // 3          # majority = 1
        y[:, 1] = (y[:, 1] + 4) // 3    # majority = 2
        domain = Domain([ContinuousVariable('i' + str(i)) for i in range(ncols)],
                        [DiscreteVariable('c' + str(i), values=range(4))
                         for i in range(y.shape[1])])
        t = Table(domain, x, y)
        learn = DummyMulticlassLearner()
        clf = learn(t)
        clf.ret = Model.Probs
        y2 = clf(x, ret=Model.Value)
        self.assertEqual(y2.shape, y.shape)
        y2, probs = clf(x, ret=Model.ValueProbs)
        self.assertEqual(y2.shape, y.shape)
        self.assertEqual(probs.shape, (nrows, 2, 4))

    def test_probs_from_value(self):
        nrows = 100
        ncols = 5
        x = np.random.randint(0, 2, (nrows, ncols))

        # single class variable
        y = np.random.randint(0, 2, (nrows, 1))
        t = Table(Domain([DiscreteVariable('v' + str(i), values=np.unique(x[:, i]))
                          for i in range(ncols)],
                         DiscreteVariable('c', values=[1, 2])),
                  x, y)
        learn = DummyLearner()
        clf = learn(t)
        clf.ret = Model.Value
        y2 = clf(x, ret=Model.Probs)
        self.assertEqual(y2.shape, (nrows, 2))
        y2, probs = clf(x, ret=Model.ValueProbs)
        self.assertEqual(y2.shape, (nrows, ))
        self.assertEqual(probs.shape, (nrows, 2))

        # multitarget
        y = np.random.randint(1, 6, (nrows, 2))
        y[:, 0] = y[:, 0] // 3             # majority = 1
        y[:, 1] = (y[:, 1] + 4) // 3 - 1   # majority = 1
        domain = Domain([ContinuousVariable('i' + str(i)) for i in range(ncols)],
                        [DiscreteVariable('c' + str(i), values=range(4))
                         for i in range(y.shape[1])])
        t = Table(domain, x, y)
        learn = DummyMulticlassLearner()
        clf = learn(t)
        clf.ret = Model.Value
        probs = clf(x, ret=Model.Probs)
        self.assertEqual(probs.shape, (nrows, 2, 4))
        y2, probs = clf(x, ret=Model.ValueProbs)
        self.assertEqual(y2.shape, y.shape)
        self.assertEqual(probs.shape, (nrows, 2, 4))

class ExpandProbabilitiesTest(unittest.TestCase):
    def prepareTable(self, rows, attr, vars, class_var_domain):
        attributes = ["Feature %i" % i for i in range(attr)]
        classes = ["Class %i" % i for i in range(vars)]
        attr_vars = [DiscreteVariable(name=a, values=range(2))
                     for a in attributes]
        class_vars = [DiscreteVariable(name=c,
                                       values=range(class_var_domain))
                      for c in classes]
        meta_vars = []
        self.domain = Domain(attr_vars, class_vars, meta_vars)
        self.x = np.random.randint(0, 2, (rows, attr))

    def test_single_class(self):
        rows = 10
        attr = 3
        vars = 1
        class_var_domain = 20
        self.prepareTable(rows, attr, vars, class_var_domain)
        y = np.random.randint(2, 6, (rows, vars)) * 2
        t = Table(self.domain, self.x, y)
        learn = DummyLearner()
        clf = learn(t)
        z, p = clf(self.x, ret=Model.ValueProbs)
        self.assertEqual(p.shape, (rows, class_var_domain))
        self.assertTrue(np.all(z == np.argmax(p, axis=-1)))

    def test_multi_class(self):
        rows = 10
        attr = 3
        vars = 5
        class_var_domain = 20
        self.prepareTable(rows, attr, vars, class_var_domain)
        y = np.random.randint(2, 6, (rows, vars)) * 2
        t = Table(self.domain, self.x, y)
        learn = DummyMulticlassLearner()
        clf = learn(t)
        z, p = clf(self.x, ret=Model.ValueProbs)
        self.assertEqual(p.shape, (rows, vars, class_var_domain))
        self.assertTrue(np.all(z == np.argmax(p, axis=-1)))

class SklTest(unittest.TestCase):
    def test_multinomial(self):
        table = Table("titanic")
        lr = LogisticRegressionLearner()
        assert isinstance(lr, Orange.classification.SklLearner)
        res = CrossValidation(table, [lr], k=2)
        self.assertGreater(Orange.evaluation.AUC(res)[0], 0.7)
        self.assertLess(Orange.evaluation.AUC(res)[0], 0.9)

    def test_nan_columns(self):
        data = Orange.data.Table("iris")
        data.X[:, (1, 3)] = np.NaN
        lr = LogisticRegressionLearner()
        res = CrossValidation(data, [lr], k=2, store_models=True)
        self.assertEqual(len(res.models[0][0].domain.attributes), 2)
        self.assertGreater(Orange.evaluation.CA(res)[0], 0.8)

    def test_params(self):
        learner = SklLearner()
        self.assertIsInstance(learner.params, dict)

class ClassfierListInputTest(unittest.TestCase):
    def test_discrete(self):
        table = Table("titanic")
        tree = Orange.classification.SklTreeLearner()(table)
        strlist = [["crew", "adult", "male"],
                   ["crew", "adult", None]]
        for se in strlist: #individual examples
            assert(all(tree(se) == tree(Orange.data.Table(table.domain, [se]))))
        assert(all(tree(strlist) == tree(Orange.data.Table(table.domain, strlist))))

    def test_continuous(self):
        table = Table("iris")
        tree = Orange.classification.SklTreeLearner()(table)
        strlist = [[2, 3, 4, 5],
                   [1, 2, 3, 5]]
        for se in strlist: #individual examples
            assert(all(tree(se) == tree(Orange.data.Table(table.domain, [se]))))
        assert(all(tree(strlist) == tree(Orange.data.Table(table.domain, strlist))))

class UnknownValuesInPrediction(unittest.TestCase):
    def setUp(self):
        Variable._clear_all_caches()

    def test_unknown(self):
        table = Table("iris")
        tree = LogisticRegressionLearner()(table)
        tree([1, 2, None])

    def test_missing_class(self):
        table = Table(test_filename("adult_sample_missing"))
        for learner in LearnerAccessibility().all_learners():
            try:
                learner = learner()
                if isinstance(learner, NuSVMLearner):
                    learner.params["nu"] = 0.01
                # Skip slow tests
                if isinstance(learner, _RuleLearner):
                    continue
                model = learner(table)
                model(table)
            except TypeError:
                traceback.print_exc()
                continue

class LearnerAccessibility(unittest.TestCase):

    def setUp(self):
        Variable._clear_all_caches()

    def all_learners(self):
        classification_modules = pkgutil.walk_packages(
            path=Orange.classification.__path__,
            prefix="Orange.classification.",
            onerror=lambda x: None)
        for importer, modname, ispkg in classification_modules:
            try:
                module = pkgutil.importlib.import_module(modname)
            except ImportError:
                continue

            for name, class_ in inspect.getmembers(module, inspect.isclass):
                if (issubclass(class_, Learner) and
                        not name.startswith('_') and
                        'base' not in class_.__module__):
                    yield class_

    def test_all_learners_accessible_in_Orange_classification_namespace(self):
        for learner in self.all_learners():
            if not hasattr(Orange.classification, learner.__name__):
                self.fail("%s is not visible in Orange.classification"
                          " namespace" % learner.__name__)

    def test_all_models_work_after_unpickling(self):
        Variable._clear_all_caches()
        datasets = [Table('iris'), Table('titanic')]
        for learner in list(self.all_learners()):
            try:
                learner = learner()
            except Exception:
                print('%s cannot be used with default parameters' % learner.__name__)
                traceback.print_exc()
                continue
            # Skip slow tests
            if isinstance(learner, _RuleLearner):
                continue

            for ds in datasets:
                model = learner(ds)
                s = pickle.dumps(model, 0)
                model2 = pickle.loads(s)

                np.testing.assert_almost_equal(Table(model.domain, ds).X, Table(model2.domain, ds).X)
                np.testing.assert_almost_equal(model(ds), model2(ds),
                                               err_msg='%s does not return same values when unpickled %s' % (learner.__class__.__name__, ds.name))
                #print('%s on %s works' % (learner, ds.name))

    def test_adequacy_all_learners(self):
        for learner in self.all_learners():
            try:
                learner = learner()
                table = Table("housing")
                self.assertRaises(ValueError, learner, table)
            except TypeError:
                traceback.print_exc()
                continue

    def test_adequacy_all_learners_multiclass(self):
        for learner in self.all_learners():
            try:
                learner = learner()
                table = Table(test_filename("test8.tab"))
                self.assertRaises(ValueError, learner, table)
            except TypeError:
                traceback.print_exc()
                continue

class LearnerReprs(unittest.TestCase):
    def test_reprs(self):
        lr = LogisticRegressionLearner(tol=0.0002)
        m = MajorityLearner()
        nb = NaiveBayesLearner()
        rf = RandomForestLearner(bootstrap=False, n_jobs=3)
        st = SimpleTreeLearner(seed=1, bootstrap=True)
        sm = SoftmaxRegressionLearner()
        svm = SVMLearner(shrinking=False)
        lsvm = LinearSVMLearner(tol=0.022, dual=False)
        nsvm = NuSVMLearner(tol=0.003, cache_size=190)
        osvm = OneClassSVMLearner(degree=2)
        tl = TreeLearner(max_depth=3, min_samples_split=1)
        knn = KNNLearner(n_neighbors=4)
        el = EllipticEnvelopeLearner(store_precision=False)
        srf = SimpleRandomForestLearner(n_estimators=20)

        learners = [lr, m, nb, rf, st, sm, svm,
            lsvm, nsvm, osvm, tl, knn, el, srf]

        for l in learners:
            repr_str = repr(l)
            new_l = eval(repr_str)
            self.assertEqual(repr(new_l), repr_str)


text:
[![Build status](https://travis-ci.org/JFK/spider-vagrant.svg?branch=master)](https://travis-ci.org/JFK/spider-vagrant)

# Spider Vagrant

Spider is web crawler framework. This project is to use vagrant in order to enable Spider to run.
Visit https://github.com/JFK/spider

## Preparation

* Vagrant
* ansible

## What gets installed:

* Python2.7, Pip & VirtualEnv
* ntp
* mongodb
* redis
* Nignx
* rq

## Let's get rolling!

Before run ```vagrant up```, you may need to do...

```
$ ssh-add  ~/.ssh/id_rsa
$ echo 'ForwardAgent yes' >> ~/.ssh/config
```

Setup

```
$ git clone git@github.com:JFK/spider-vagrant.git
$ cd spider-vagrant
$ vagrant up
```

In order to access the site, configure hosts file.

```
$ echo "192.168.33.11 <server_name>" | sudo tee -a /etc/hosts
```

## Contribute

If you have any suggestions, feel free to create an issue here on Github and/or fork this repo, make changes and submit a pull request!


text:
@implementation NSDate (KinveyWidgets)

- (NSString*) stringWithFormat:(NSString*)format
{
    NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:format];
    return [dateFormatter stringFromDate:self];
}

@end


text:
using FlatRedBall;
using Gum.Wireframe;
using RenderingLibrary.Graphics;
using System;
using System.Collections.Generic;
using System.Text;

namespace GumCoreShared.FlatRedBall.Embedded
{
    public class PositionedObjectGueWrapper : PositionedObject
    {
        PositionedObject frbObject;
        global::FlatRedBall.Math.Geometry.IReadOnlyScalable frbObjectAsScalable;

        public PositionedObject FrbObject
        {
            get { return frbObject; }
            set
            {
                frbObject = value;
                frbObjectAsScalable = value as global::FlatRedBall.Math.Geometry.IReadOnlyScalable;
            }
        }

        GraphicalUiElement GumParent { get; set; }
        public GraphicalUiElement GumObject { get; private set; }

        public PositionedObjectGueWrapper(PositionedObject frbObject, GraphicalUiElement gumObject) : base()
        {

            var renderable = new InvisibleRenderable();
            renderable.Visible = true;

            GumParent = new GraphicalUiElement();
            GumParent.SetContainedObject(renderable);
            GumParent.XUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall;
            GumParent.YUnits = Gum.Converters.GeneralUnitType.PixelsFromSmall;

            GumParent.XOrigin = HorizontalAlignment.Center;
            GumParent.YOrigin = VerticalAlignment.Center;

            this.FrbObject = frbObject;
            this.GumObject = gumObject;

            gumObject.Parent = GumParent;
        }

        public override void UpdateDependencies(double currentTime)
        {
            base.UpdateDependencies(currentTime);

            // This is going to get positioned according to the FRB object. I guess we'll force update dependencies, which is expensive...
            FrbObject.UpdateDependencies(currentTime);

            // todo - need to support multiple cameras and layers
            var camera = Camera.Main;

            int screenX = 0;
            int screenY = 0;

            global::FlatRedBall.Math.MathFunctions.AbsoluteToWindow(
                FrbObject.X, FrbObject.Y, FrbObject.Z,
                ref screenX, ref screenY, camera);

            GumParent.X = screenX;
            GumParent.Y = screenY;

            if(frbObjectAsScalable != null)
            {
                GumParent.Width = frbObjectAsScalable.ScaleX * 2;
                GumParent.Height = frbObjectAsScalable.ScaleY * 2;
            }
        }
    }
}


text:
var sqliteParser = require('sqlite-parser');
var util = require('util');
// var query = `select a from tableN where array_contains(split(semantics.FT1000,';'),'FV10001')`;
var query = 'select a from tableN where a.y in (1,2,3) and a.z > 10 or z.y = 20;';
// sync
// var ast = sqliteParser(query);
// console.log(ast);

// async
sqliteParser(query, function (err, ast) {
    if (err) {
        console.error(err);
        return;
    }
    console.log(util.inspect(ast,true,null,true));
});