text:
using System;
using CppSharp.Parser.AST;
using System.Reflection;
using LanguageVersion = CppSharp.Parser.LanguageVersion;
using System.Globalization;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.IO;

namespace CppSharp.Parser
{
    public enum LanguageVersion
    {
        /// <summary>
        /// C programming language (year 1999).
        /// </summary>
        C99,
        /// <summary>
        /// C programming language (year 1999, GNU variant).
        /// </summary>
        C99_GNU,
        /// <summary>
        /// C++ programming language (year 1998).
        /// </summary>
        CPP98,
        /// <summary>
        /// C++ programming language (year 1998, GNU variant).
        /// </summary>
        CPP98_GNU,
        /// <summary>
        /// C++ programming language (year 2011).
        /// </summary>
        CPP11,
        /// <summary>
        /// C++ programming language (year 2011, GNU variant).
        /// </summary>
        CPP11_GNU,
        /// <summary>
        /// C++ programming language (year 2014).
        /// </summary>
        CPP14,
        /// <summary>
        /// C++ programming language (year 2014, GNU variant).
        /// </summary>
        CPP14_GNU,
        /// <summary>
        /// C++ programming language (year 2017).
        /// </summary>
        CPP17,
        /// <summary>
        /// C++ programming language (year 2017, GNU variant).
        /// </summary>
        CPP17_GNU,
    }

    public class ParserOptions : CppParserOptions
    {
        public ParserOptions()
        {
            Abi = Platform.IsUnixPlatform ? CppAbi.Itanium : CppAbi.Microsoft;
            MicrosoftMode = !Platform.IsUnixPlatform;
            CurrentDir = Assembly.GetExecutingAssembly().Location;
        }

        public bool IsItaniumLikeAbi => Abi != CppAbi.Microsoft;
        public bool IsMicrosoftAbi => Abi == CppAbi.Microsoft;

        public bool EnableRTTI { get; set; }
        public LanguageVersion? LanguageVersion { get; set; }

        public ParserOptions BuildForSourceFile(
            IEnumerable<CppSharp.AST.Module> modules, string file = null)
        {
            var options = new ParserOptions
            {
                Abi = this.Abi,
                ToolSetToUse = this.ToolSetToUse,
                TargetTriple = this.TargetTriple,
                NoStandardIncludes = this.NoStandardIncludes,
                NoBuiltinIncludes = this.NoBuiltinIncludes,
                MicrosoftMode = this.MicrosoftMode,
                Verbose = this.Verbose,
                LanguageVersion = this.LanguageVersion,
                UnityBuild = this.UnityBuild
            };

            // This eventually gets passed to Clang's MSCompatibilityVersion, which
            // is in turn used to derive the value of the built-in define _MSC_VER.
            // It used to receive a 4-digit based identifier but now expects a full
            // version MSVC digit, so check if we still have the old version and
            // convert to the right format.

            if (ToolSetToUse.ToString(CultureInfo.InvariantCulture).Length == 4)
                ToolSetToUse *= 100000;

            for (uint i = 0; i < ArgumentsCount; ++i)
            {
                var arg = GetArguments(i);
                options.AddArguments(arg);
            }

            for (uint i = 0; i < IncludeDirsCount; ++i)
            {
                var include = GetIncludeDirs(i);
                options.AddIncludeDirs(include);
            }

            for (uint i = 0; i < SystemIncludeDirsCount; ++i)
            {
                var include = GetSystemIncludeDirs(i);
                options.AddSystemIncludeDirs(include);
            }

            for (uint i = 0; i < DefinesCount; ++i)
            {
                var define = GetDefines(i);
                options.AddDefines(define);
            }

            for (uint i = 0; i < UndefinesCount; ++i)
            {
                var define = GetUndefines(i);
                options.AddUndefines(define);
            }

            for (uint i = 0; i < LibraryDirsCount; ++i)
            {
                var lib = GetLibraryDirs(i);
                options.AddLibraryDirs(lib);
            }

            foreach (var module in modules.Where(
                m => file == null || m.Headers.Contains(file)))
            {
                foreach (var include in module.IncludeDirs)
                    options.AddIncludeDirs(include);

                foreach (var define in module.Defines)
                    options.AddDefines(define);

                foreach (var undefine in module.Undefines)
                    options.AddUndefines(undefine);

                foreach (var libraryDir in module.LibraryDirs)
                    options.AddLibraryDirs(libraryDir);
            }

            return options;
        }

        public void SetupMSVC()
        {
            var vsVersion = VisualStudioVersion.Latest;

            // Silence "warning CS0162: Unreachable code detected"
            #pragma warning disable 162

            switch (BuildConfig.Choice)
            {
                case "vs2012":
                    vsVersion = VisualStudioVersion.VS2012;
                    break;
                case "vs2013":
                    vsVersion = VisualStudioVersion.VS2013;
                    break;
                case "vs2015":
                    vsVersion = VisualStudioVersion.VS2015;
                    break;
                case "vs2017":
                    vsVersion = VisualStudioVersion.VS2017;
                    break;

            #pragma warning restore 162

            }

            SetupMSVC(vsVersion);
        }

        /// <summary>
        /// Sets up the parser options to work with the given Visual Studio toolchain.
        /// </summary>
        /// <param name="vsVersion">The version of Visual Studio to look for.</param>
        public void SetupMSVC(VisualStudioVersion vsVersion)
        {
            MicrosoftMode = true;
            NoBuiltinIncludes = true;
            NoStandardIncludes = true;
            Abi = CppAbi.Microsoft;

            vsVersion = MSVCToolchain.FindVSVersion(vsVersion);
            foreach (var include in MSVCToolchain.GetSystemIncludes(vsVersion))
                AddSystemIncludeDirs(include);

            // do not remove the CppSharp prefix becase the Mono C# compiler breaks
            if (!LanguageVersion.HasValue)
                LanguageVersion = CppSharp.Parser.LanguageVersion.CPP14_GNU;

            var clVersion = MSVCToolchain.GetCLVersion(vsVersion);
            ToolSetToUse = clVersion.Major * 10000000 + clVersion.Minor * 100000;

            AddArguments("-fms-extensions");
            AddArguments("-fms-compatibility");
            AddArguments("-fdelayed-template-parsing");
        }

        public void SetupXcode()
        {
            var builtinsPath = XcodeToolchain.GetXcodeBuiltinIncludesFolder();
            AddSystemIncludeDirs(builtinsPath);

            var cppIncPath = XcodeToolchain.GetXcodeCppIncludesFolder();
            AddSystemIncludeDirs(cppIncPath);

            var includePath = XcodeToolchain.GetXcodeIncludesFolder();
            AddSystemIncludeDirs(includePath);

            NoBuiltinIncludes = true;
            NoStandardIncludes = true;

            AddArguments("-stdlib=libc++");
        }

        private void GetUnixCompilerInfo(string headersPath, out string compiler,
            out string longVersion, out string shortVersion)
        {
            if (!Platform.IsLinux)
            {
                compiler = "gcc";
                // Search for the available GCC versions on the provided headers.
                var versions = Directory.EnumerateDirectories(Path.Combine(headersPath,
                    "usr", "include", "c++"));

                if (versions.Count() == 0)
                    throw new Exception("No valid GCC version found on system include paths");

                string gccVersionPath = versions.First();
                longVersion = shortVersion = gccVersionPath.Substring(
                    gccVersionPath.LastIndexOf(Path.DirectorySeparatorChar) + 1);
                return;
            }
            var info = new ProcessStartInfo(Environment.GetEnvironmentVariable("CXX") ?? "gcc", "-v");
            info.RedirectStandardError = true;
            info.CreateNoWindow = true;
            info.UseShellExecute = false;
            var process = Process.Start(info);
            if (process == null)
                throw new SystemException("GCC compiler was not found.");
            process.WaitForExit();

            var output = process.StandardError.ReadToEnd();
            var match = Regex.Match(output, "(gcc|clang) version (([0-9]+\\.[0-9]+)\\.[0-9]+)");
            if (!match.Success)
                throw new SystemException("GCC compiler was not found.");

            compiler = match.Groups[1].ToString();
            longVersion = match.Groups[2].ToString();
            shortVersion = match.Groups[3].ToString();
        }

        public void SetupLinux(string headersPath = "")
        {
            MicrosoftMode = false;
            NoBuiltinIncludes = true;
            NoStandardIncludes = true;
            Abi = CppAbi.Itanium;

            string compiler, longVersion, shortVersion;
            GetUnixCompilerInfo(headersPath, out compiler, out longVersion, out shortVersion);
            string[] versions = {longVersion, shortVersion};
            string[] tripples = {"x86_64-linux-gnu", "x86_64-pc-linux-gnu"};
            if (compiler == "gcc")
            {
                foreach (var version in versions)
                {
                    AddSystemIncludeDirs($"{headersPath}/usr/include/c++/{version}");
                    AddSystemIncludeDirs($"{headersPath}/usr/include/c++/{version}/backward");
                    foreach (var tripple in tripples)
                    {
                        AddSystemIncludeDirs($"{headersPath}/usr/include/{tripple}/c++/{version}");
                        AddSystemIncludeDirs($"{headersPath}/usr/include/c++/{version}/{tripple}");
                    }
                }
            }
            foreach (var tripple in tripples)
            {
                foreach (var version in versions)
                {
                    AddSystemIncludeDirs($"{headersPath}/usr/lib/{compiler}/{tripple}/{version}/include");
                    AddSystemIncludeDirs($"{headersPath}/usr/lib/{compiler}/{tripple}/{version}/include/c++");
                    AddSystemIncludeDirs($"{headersPath}/usr/lib/{compiler}/{tripple}/{version}/include/c++/{tripple}");
                }
                AddSystemIncludeDirs($"{headersPath}/usr/include/{tripple}");
            }
            AddSystemIncludeDirs($"{headersPath}/usr/include");
        }

        public void Setup()
        {
            SetupArguments();

            if (!NoBuiltinIncludes)
                SetupIncludes();
        }

        private void SetupArguments()
        {
            // do not remove the CppSharp prefix becase the Mono C# compiler breaks
            if (!LanguageVersion.HasValue)
                LanguageVersion = CppSharp.Parser.LanguageVersion.CPP14_GNU;

            switch (LanguageVersion)
            {
                case CppSharp.Parser.LanguageVersion.C99:
                case CppSharp.Parser.LanguageVersion.C99_GNU:
                    AddArguments("-xc");
                    break;
                default:
                    AddArguments("-xc++");
                    break;
            }

            switch (LanguageVersion)
            {
                case CppSharp.Parser.LanguageVersion.C99:
                    AddArguments("-std=c99");
                    break;
                case CppSharp.Parser.LanguageVersion.C99_GNU:
                    AddArguments("-std=gnu99");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP98:
                    AddArguments("-std=c++98");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP98_GNU:
                    AddArguments("-std=gnu++98");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP11:
                    AddArguments("-std=c++11");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP11_GNU:
                    AddArguments("-std=gnu++11");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP14:
                    AddArguments("-std=c++14");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP14_GNU:
                    AddArguments("-std=gnu++14");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP17:
                    AddArguments("-std=c++1z");
                    break;
                case CppSharp.Parser.LanguageVersion.CPP17_GNU:
                    AddArguments("-std=gnu++1z");
                    break;
            }

            if (!EnableRTTI)
                AddArguments("-fno-rtti");
        }

        private void SetupIncludes()
        {
            switch(Platform.Host)
            {
                case TargetPlatform.Windows:
                    SetupMSVC();
                    break;
                case TargetPlatform.MacOS:
                    SetupXcode();
                    break;
                case TargetPlatform.Linux:
                    SetupLinux();
                    break;
            }
        }
    }
}


text:
sap.ui.define(['testdata/customizing/async/viewReplacements/sap/Component'],
	function(Component) {
	"use strict";

	// extends from testdata.customizing.async.viewReplacements.sap.Component
	return Component.extend("testdata.customizing.async.viewReplacements.customer.Component", {
		metadata : {
			version : "1.0",
			customizing: {
				"sap.ui.viewReplacements": {
					"testdata.customizing.async.viewReplacements.sap.views.XMLView1": {
						"viewName": "testdata.customizing.async.viewReplacements.customer.views.XMLView1Replacement",
						"type": "XML"
					}
				},
				"sap.ui.viewModifications": {
					"testdata.customizing.async.viewReplacements.customer.views.XMLView1Replacement": {
						"textXMLView1Replacement": {
							"visible": false
						}
					}
				}
			}
		}
	});
});

redpajama_set_name: RedPajamaGithub


text:
http://uzumakistudios.com

# Cloning this repos

First of all, clone this repos:

    git clone https://github.com/uzumakistudios/uzumakistudios.github.io
    cd uzumakistudios.github.io

# Creating a new blog post

Before start editing this repos, update it:

    git pull

Create a new file to your post named `_posts/yyyy-mm-dd-title-of-post.md` with the following syntax:

   ---
   layout: post
   title: Title of post
   ---

   Foo bar.

To commit and push your blog post:

   git add --all
   git commit -am "My new post"
   git push origin master

# Editing a page

It´s the same of editing a blog post, but instead of editing a file in `_posts/`, edit the page's index file, like `about/index.html`.

# Setting up Jekyll locally

If you want to preview the generated blog locally, install Jekyll following these instructions [here](https://help.github.com/articles/using-jekyll-with-pages#installing-jekyll).

To preview locally:

   jekyll serve

Then access `http://localhost:400`.


text:
{{ $ctrl.name }}

<md-card>
  <md-card-content>
    Here we will show the user any messages that they have sent and what we have responded to them with.

    1 if user is not logged in then we  create an ananomous account.

    <input ng-model="$ctrl.email">
    <md-button ng-click="$ctrl.updateEmail()"> Update Email</md-button>

  <md-content>

 {{message}}

  </md-content>

   <md-input-container>
     <input ng-model="$ctrl.new_message">
   </md-input-container>
   <md-button ng-click="$ctrl.postMessage()">Send</md-button>
  </md-card-content>
</md-card>


text:
package org.axonframework.commandhandling.distributed.commandfilter;

import org.axonframework.commandhandling.CommandMessage;

import java.io.Serializable;
import java.util.function.Predicate;

/**
 * A command filter that accepts all CommandMessages
 *
 * @author Koen Lavooij
 */
public enum AcceptAll implements Predicate<CommandMessage<?>>, Serializable {

    /**
     * Singleton instance of the {@link AcceptAll} filter
     */
    INSTANCE;

    @Override
    public boolean test(CommandMessage commandMessage) {
        return true;
    }

    @Override
    @SuppressWarnings("unchecked")
    public Predicate<CommandMessage<?>> and(Predicate<? super CommandMessage<?>> other) {
        return (Predicate<CommandMessage<?>>) other;
    }

    @Override
    public Predicate<CommandMessage<?>> negate() {
        return DenyAll.INSTANCE;
    }

    @Override
    public Predicate<CommandMessage<?>> or(Predicate<? super CommandMessage<?>> other) {
        return this;
    }

    @Override
    public String toString() {
        return "AcceptAll{}";
    }
}


text:
namespace blink {

class CustomElementDefinition;
class Element;

class CORE_EXPORT CustomElementReaction
    : public GarbageCollectedFinalized<CustomElementReaction> {
  WTF_MAKE_NONCOPYABLE(CustomElementReaction);

 public:
  CustomElementReaction(CustomElementDefinition*);
  virtual ~CustomElementReaction() = default;

  virtual void invoke(Element*) = 0;

  DECLARE_VIRTUAL_TRACE();

 protected:
  Member<CustomElementDefinition> m_definition;
};

}  // namespace blink

#endif  // CustomElementReaction_h


text:
package javassist.runtime;

/**
 * A support class for compiling a method declared in an inner class.
 * This support class is required at runtime
 * only if the method calls a private constructor in the enclosing class.
 */
public class Inner {
}


text:
<default-header class="top-header"></default-header>

    <navbar-utility-mobile></navbar-utility-mobile>

            <breadcrumbs breadcrumbs="breadcrumbs"></breadcrumbs>

                      <fieldset ng-disabled="disableInputs">
                        <osc-image-summary resource="image" name="imageName"></osc-image-summary>

                        <form class="" ng-show="imageStream" novalidate name="form" ng-submit="createApp()">

                             Name

                               <input type="text"
                                      required
                                      take-focus
                                      minlength="2"
                                      maxlength="24"
                                      pattern="[a-z]([-a-z0-9]*[a-z0-9])?"
                                      ng-model="name"
                                      id="appname"
                                      name="appname"
                                      ng-change="nameTaken = false"
                                      ng-blur="shouldValidateName = form.appname.$dirty"
                                      class="form-control"
                                      autocorrect="off"
                                      autocapitalize="off"
                                      spellcheck="false">

Identifies the resources created for this application.

                                A name is required.

                                Please enter a valid name.

A valid name is applied to all generated resources. It is an alphanumeric (a-z, and 0-9) string with a maximum length of 24 characters, where the first character is a letter (a-z), and the '-' character is allowed anywhere except the first or last character.

                                The name must have at least 2 characters.

                                This name is already in use within the project. Please choose a different name.

                            Git Repository URL

                              <input class="form-control"
                                id="sourceUrl"
                                name="sourceUrl"
                                type="text"
                                required
                                aria-describedby="from_source_help"
                                ng-model="buildConfig.sourceUrl"
                                autocorrect="off"
                                autocapitalize="off"
                                spellcheck="false">

                              Sample repository for {{imageName}}: {{image.metadata.annotations.sampleRepo}},
                                ref: {{image.metadata.annotations.sampleRef}},
                                context dir: {{image.metadata.annotations.sampleContextDir}}
                              Try it

                              A Git repository URL is required.

                              Git repository should be a URL.

                              Git Reference

                                <input
                                  id="gitref"
                                  ng-model="buildConfig.gitRef"
                                  type="text"
                                  placeholder="master"
                                  autocorrect="off"
                                  autocapitalize="off"
                                  spellcheck="false"
                                  class="form-control">

Optional branch, tag, or commit.

                              Context Dir

                                <input
                                  id="contextdir"
                                  ng-model="buildConfig.contextDir"
                                  type="text"
                                  placeholder="/"
                                  autocorrect="off"
                                  autocapitalize="off"
                                  spellcheck="false"
                                  class="form-control">

Optional subdirectory for the application source code, used as the context directory for the build.

                            <osc-form-section
                              header="Routing"
                              about-title="Routing"
                              about="Routing is a way to make your application publicly visible. Otherwise you may only be able to access your application by its IP address, if allowed by the system administrator."
                              expand="true"
                              can-toggle="false"
                              ng-if="routing.portOptions.length"
                              >

                                  <input type="checkbox" ng-model="routing.include">
                                  Create a route to the application

                              <osc-routing
                                model="routing"
                                routing-disabled="!routing.include">
                              </osc-routing>
                            </osc-form-section>

                            <osc-form-section
                              header="Build Configuration"
                              about-title="Build Configuration"
                              about="A build configuration describes how to build your deployable image.  This includes
                                your source, the base builder image, and when to launch new builds."
                              expand="true"
                              can-toggle="false"
                              >

                                  <input type="checkbox" ng-model="buildConfig.buildOnSourceChange"/>
                                  Configure a webhook build trigger

                                  <input type="checkbox" ng-model="buildConfig.buildOnImageChange"/>
                                  Automatically build a new image when the builder image changes

                                  <input type="checkbox" ng-model="buildConfig.buildOnConfigChange"/>
                                  Automatically build a new image when the build configuration changes

Environment Variables (Build and Runtime)

                              <osc-key-values
                                entries="buildConfig.envVars"
                                delimiter="="
                                key-validator="env"
                                delete-policy="added"
                                key-validation-tooltip="A valid environment variable name is an alphanumeric (a-z and 0-9) string beginning with a letter that may contain underscores."></osc-key-values>
                            </osc-form-section>

                            <osc-form-section
                              header="Deployment Configuration"
                              about-title="Deployment Configuration"
                              about="Deployment configurations describe how your application is configured
                                by the cluster and under what conditions it should be recreated (e.g. when the image changes)."
                              expand="true"
                              can-toggle="false"
                              >

Autodeploy when

                                    <input type="checkbox" ng-model="deploymentConfig.deployOnNewImage">
                                    New image is available

                                  <input type="checkbox" ng-model="deploymentConfig.deployOnConfigChange">
                                  Deployment configuration changes

Environment Variables (Runtime only)

                                  <osc-key-values
                                    entries="deploymentConfig.envVars"
                                    delimiter="="
                                    key-validator="env"
                                    delete-policy="added"
                                    key-validation-tooltip="A valid environment variable name is an alphanumeric (a-z and 0-9) string beginning with a letter that may contain underscores."></osc-key-values>

                            </osc-form-section>

                            <osc-form-section
                              header="Scaling"
                              about-title="Scaling"
                              about="Scaling defines the number of running instances of your built image."
                              expand="true"
                              can-toggle="false"
                              >

                                  Replicas:
                                  {{scaling.replicas}}

                                  Replicas:
                                  <input type="number" class="input-number" min="0" name="replicas" ng-model="scaling.replicas" required ng-pattern="/^\-?\d+$/">

                                  Replicas must be an integer value greater than or equal to 0

                            </osc-form-section>

                            <osc-form-section
                              header="Resource Limits"
                              about-title="Resource Limits"
                              about="Resource limits control compute resource usage by a container on a node."
                              expand="true"
                              can-toggle="false"
                              >
                              <edit-request-limit
                                  resources="container.resources"
                                  type="cpu"
                                  limit-ranges="limitRanges"
                                  request-calculated="cpuRequestCalculated"
                                  limit-calculated="cpuLimitCalculated">
                              </edit-request-limit>
                              <edit-request-limit
                                  resources="container.resources"
                                  type="memory"
                                  limit-ranges="limitRanges"
                                  request-calculated="memoryRequestCalculated">
                              </edit-request-limit>

                                {{problem}}

                                {{problem}}

                            </osc-form-section>

                            <button type="submit"
                                class="btn btn-primary btn-lg"
                                ng-disabled="form.$invalid || nameTaken || cpuProblems.length || memoryProblems.length || disableInputs"
                                >Create</button>
                            Cancel

                        </form>

                          {{ emptyMessage }}

                      </fieldset>


text:
package discovery

import (
	"errors"
	"fmt"
	"os"
	"testing"

	"github.com/pachyderm/pachyderm/src/client/pkg/require"
)

func TestEtcdClient(t *testing.T) {

	if os.Getenv("ETCD_PORT_2379_TCP_ADDR") == "" {
		t.Skip("skipping test; $ETCD_PORT_2379_TCP_ADDR not set")
	}

	t.Parallel()
	client, err := getEtcdClient()
	require.NoError(t, err)
	runTest(t, client)
}

func TestEtcdWatch(t *testing.T) {

	if os.Getenv("ETCD_PORT_2379_TCP_ADDR") == "" {
		t.Skip("skipping test; $ETCD_PORT_2379_TCP_ADDR not set")
	}

	t.Parallel()
	client, err := getEtcdClient()
	require.NoError(t, err)
	runWatchTest(t, client)
}

func runTest(t *testing.T, client Client) {
	err := client.Set("foo", "one", 0)
	require.NoError(t, err)
	value, err := client.Get("foo")
	require.NoError(t, err)
	require.Equal(t, "one", value)
	//values, err := client.GetAll("foo")
	//require.NoError(t, err)
	//require.Equal(t, map[string]string{"foo": "one"}, values)

	err = client.Set("a/b/foo", "one", 0)
	require.NoError(t, err)
	err = client.Set("a/b/bar", "two", 0)
	require.NoError(t, err)
	values, err := client.GetAll("a/b")
	require.NoError(t, err)
	require.Equal(t, map[string]string{"a/b/foo": "one", "a/b/bar": "two"}, values)

	require.NoError(t, client.Close())
}

func runWatchTest(t *testing.T, client Client) {
	cancel := make(chan bool)
	err := client.Watch(
		"watch/foo",
		cancel,
		func(value string) error {
			if value == "" {
				return client.Set("watch/foo", "bar", 0)
			}
			require.Equal(t, "bar", value)
			close(cancel)
			return nil
		},
	)
	require.Equal(t, ErrCancelled, err)

	cancel = make(chan bool)
	err = client.WatchAll(
		"watchAll/foo",
		cancel,
		func(value map[string]string) error {
			if value == nil {
				return client.Set("watchAll/foo/bar", "quux", 0)
			}
			require.Equal(t, map[string]string{"watchAll/foo/bar": "quux"}, value)
			close(cancel)
			return nil
		},
	)
	require.Equal(t, ErrCancelled, err)
}

func getEtcdClient() (Client, error) {
	etcdAddress, err := getEtcdAddress()
	if err != nil {
		return nil, err
	}
	return NewEtcdClient(etcdAddress), nil
}

func getEtcdAddress() (string, error) {
	etcdAddr := os.Getenv("ETCD_PORT_2379_TCP_ADDR")
	if etcdAddr == "" {
		return "", errors.New("ETCD_PORT_2379_TCP_ADDR not set")
	}
	return fmt.Sprintf("http://%s:2379", etcdAddr), nil
}


text:
namespace rack {
namespace app {

struct ParamField : ui::TextField {
	ParamWidget* paramWidget;

	void step() override {
		// Keep selected
		APP->event->setSelected(this);
		TextField::step();
	}

	void setParamWidget(ParamWidget* paramWidget) {
		this->paramWidget = paramWidget;
		if (paramWidget->paramQuantity)
			text = paramWidget->paramQuantity->getDisplayValueString();
		selectAll();
	}

	void onSelectKey(const event::SelectKey& e) override {
		if (e.action == GLFW_PRESS && (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER)) {
			float oldValue = paramWidget->paramQuantity->getValue();
			if (paramWidget->paramQuantity)
				paramWidget->paramQuantity->setDisplayValueString(text);
			float newValue = paramWidget->paramQuantity->getValue();

			if (oldValue != newValue) {
				// Push ParamChange history action
				history::ParamChange* h = new history::ParamChange;
				h->moduleId = paramWidget->paramQuantity->module->id;
				h->paramId = paramWidget->paramQuantity->paramId;
				h->oldValue = oldValue;
				h->newValue = newValue;
				APP->history->push(h);
			}

			ui::MenuOverlay* overlay = getAncestorOfType<ui::MenuOverlay>();
			overlay->requestDelete();
			e.consume(this);
		}

		if (!e.getTarget())
			TextField::onSelectKey(e);
	}
};

struct ParamTooltip : ui::Tooltip {
	ParamWidget* paramWidget;

	void step() override {
		if (paramWidget->paramQuantity) {
			// Quantity string
			text = paramWidget->paramQuantity->getString();
			// Param description
			std::string description = paramWidget->paramQuantity->description;
			if (!description.empty())
				text += "\n" + description;
		}
		Tooltip::step();
		// Position at bottom-right of parameter
		box.pos = paramWidget->getAbsoluteOffset(paramWidget->box.size).round();
		// Fit inside parent (copied from Tooltip.cpp)
		assert(parent);
		box = box.nudge(parent->box.zeroPos());
	}
};

struct ParamLabel : ui::MenuLabel {
	ParamWidget* paramWidget;
	void step() override {
		text = paramWidget->paramQuantity->getString();
		MenuLabel::step();
	}
};

struct ParamResetItem : ui::MenuItem {
	ParamWidget* paramWidget;
	void onAction(const event::Action& e) override {
		paramWidget->resetAction();
	}
};

struct ParamFineItem : ui::MenuItem {
};

struct ParamUnmapItem : ui::MenuItem {
	ParamWidget* paramWidget;
	void onAction(const event::Action& e) override {
		engine::ParamHandle* paramHandle = APP->engine->getParamHandle(paramWidget->paramQuantity->module->id, paramWidget->paramQuantity->paramId);
		if (paramHandle) {
			APP->engine->updateParamHandle(paramHandle, -1, 0);
		}
	}
};

void ParamWidget::step() {
	if (paramQuantity) {
		float value = paramQuantity->getValue();
		// Trigger change event when paramQuantity value changes
		if (value != dirtyValue) {
			dirtyValue = value;
			event::Change eChange;
			onChange(eChange);
		}
	}

	Widget::step();
}

void ParamWidget::draw(const DrawArgs& args) {
	Widget::draw(args);

	// Param map indicator
	engine::ParamHandle* paramHandle = paramQuantity ? APP->engine->getParamHandle(paramQuantity->module->id, paramQuantity->paramId) : NULL;
	if (paramHandle) {
		NVGcolor color = paramHandle->color;
		nvgBeginPath(args.vg);
		const float radius = 6;
		// nvgCircle(args.vg, box.size.x / 2, box.size.y / 2, radius);
		nvgRect(args.vg, box.size.x - radius, box.size.y - radius, radius, radius);
		nvgFillColor(args.vg, color);
		nvgFill(args.vg);
		nvgStrokeColor(args.vg, color::mult(color, 0.5));
		nvgStrokeWidth(args.vg, 1.0);
		nvgStroke(args.vg);
	}
}

void ParamWidget::onButton(const event::Button& e) {
	OpaqueWidget::onButton(e);

	// Touch parameter
	if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & RACK_MOD_MASK) == 0) {
		if (paramQuantity) {
			APP->scene->rack->touchedParam = this;
		}
		e.consume(this);
	}

	// Right click to open context menu
	if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT && (e.mods & RACK_MOD_MASK) == 0) {
		createContextMenu();
		e.consume(this);
	}
}

void ParamWidget::onDoubleClick(const event::DoubleClick& e) {
	resetAction();
}

void ParamWidget::onEnter(const event::Enter& e) {
	if (settings::paramTooltip && !tooltip && paramQuantity) {
		ParamTooltip* paramTooltip = new ParamTooltip;
		paramTooltip->paramWidget = this;
		APP->scene->addChild(paramTooltip);
		tooltip = paramTooltip;
	}
}

void ParamWidget::onLeave(const event::Leave& e) {
	if (tooltip) {
		APP->scene->removeChild(tooltip);
		delete tooltip;
		tooltip = NULL;
	}
}

void ParamWidget::fromJson(json_t* rootJ) {
	json_t* valueJ = json_object_get(rootJ, "value");
	if (valueJ) {
		if (paramQuantity)
			paramQuantity->setValue(json_number_value(valueJ));
	}
}

void ParamWidget::createContextMenu() {
	ui::Menu* menu = createMenu();

	ParamLabel* paramLabel = new ParamLabel;
	paramLabel->paramWidget = this;
	menu->addChild(paramLabel);

	ParamField* paramField = new ParamField;
	paramField->box.size.x = 100;
	paramField->setParamWidget(this);
	menu->addChild(paramField);

	ParamResetItem* resetItem = new ParamResetItem;
	resetItem->text = "Initialize";
	resetItem->rightText = "Double-click";
	resetItem->paramWidget = this;
	menu->addChild(resetItem);

	// ParamFineItem *fineItem = new ParamFineItem;
	// fineItem->text = "Fine adjust";
	// fineItem->rightText = RACK_MOD_CTRL_NAME "+drag";
	// fineItem->disabled = true;
	// menu->addChild(fineItem);

	engine::ParamHandle* paramHandle = paramQuantity ? APP->engine->getParamHandle(paramQuantity->module->id, paramQuantity->paramId) : NULL;
	if (paramHandle) {
		ParamUnmapItem* unmapItem = new ParamUnmapItem;
		unmapItem->text = "Unmap";
		unmapItem->rightText = paramHandle->text;
		unmapItem->paramWidget = this;
		menu->addChild(unmapItem);
	}
}

void ParamWidget::resetAction() {
	if (paramQuantity && paramQuantity->isBounded()) {
		float oldValue = paramQuantity->getValue();
		reset();
		// Here's another way of doing it, but either works.
		// paramQuantity->getParam()->reset();
		float newValue = paramQuantity->getValue();

		if (oldValue != newValue) {
			// Push ParamChange history action
			history::ParamChange* h = new history::ParamChange;
			h->name = "reset parameter";
			h->moduleId = paramQuantity->module->id;
			h->paramId = paramQuantity->paramId;
			h->oldValue = oldValue;
			h->newValue = newValue;
			APP->history->push(h);
		}
	}
}

} // namespace app
} // namespace rack


text:
package io.druid.indexing.common;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.druid.indexing.common.task.Task;
import io.druid.query.DruidMetrics;
import io.druid.segment.realtime.FireDepartment;
import io.druid.segment.realtime.RealtimeMetricsMonitor;

public class TaskRealtimeMetricsMonitorBuilder
{
  private TaskRealtimeMetricsMonitorBuilder() {}

  public static RealtimeMetricsMonitor build(Task task, FireDepartment fireDepartment)
  {
    return new RealtimeMetricsMonitor(
        ImmutableList.of(fireDepartment),
        ImmutableMap.of(
            DruidMetrics.TASK_ID, new String[]{task.getId()},
            DruidMetrics.TASK_TYPE, new String[]{task.getType()}
        )
    );
  }
}


text:
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

namespace Avalonia.Controls
{
    /// <summary>
    /// A panel that can be used to virtualize items.
    /// </summary>
    public interface IVirtualizingPanel : IPanel
    {
        /// <summary>
        /// Gets or sets the controller for the virtualizing panel.
        /// </summary>
        /// <remarks>
        /// A virtualizing controller is responsible for maintaing the controls in the virtualizing
        /// panel. This property will be set by the controller when virtualization is initialized.
        /// Note that this property may remain null if the panel is added to a control that does
        /// not act as a virtualizing controller.
        /// </remarks>
        IVirtualizingController Controller { get; set; }

        /// <summary>
        /// Gets a value indicating whether the panel is full.
        /// </summary>
        /// <remarks>
        /// This property should return false until enough children are added to fill the space
        /// passed into the last measure in the direction of scroll. It should be updated
        /// immediately after a child is added or removed.
        /// </remarks>
        bool IsFull { get; }

        /// <summary>
        /// Gets the number of items that can be removed while keeping the panel full.
        /// </summary>
        /// <remarks>
        /// This property should return the number of children that are completely out of the
        /// panel's current bounds in the direction of scroll. It should be updated after an
        /// arrange.
        /// </remarks>
        int OverflowCount { get; }

        /// <summary>
        /// Gets the direction of scroll.
        /// </summary>
        Orientation ScrollDirection { get; }

        /// <summary>
        /// Gets the average size of the materialized items in the direction of scroll.
        /// </summary>
        double AverageItemSize { get; }

        /// <summary>
        /// Gets or sets a size in pixels by which the content is overflowing the panel, in the
        /// direction of scroll.
        /// </summary>
        /// <remarks>
        /// This may be non-zero even when <see cref="OverflowCount"/> is zero if the last item
        /// overflows the panel bounds.
        /// </remarks>
        double PixelOverflow { get; }

        /// <summary>
        /// Gets or sets the current pixel offset of the items in the direction of scroll.
        /// </summary>
        double PixelOffset { get; set; }
    }
}


text:
from typing import List, Callable
from adbook.orm.entity import Entity
from adbook.addressbook import AddressBook

def convert_person_list(persons: List[Entity]) -> List[str]:
    return [str(person) for person in persons]

if __name__ == '__main__':
    """
    * Find person by email address (can supply either the exact string or a prefix string,
    ie. both "alexander@company.com" and "alex" should work).
    """

    with AddressBook() as ab:
        p1 = ab.persons.create(first_name="Franc", last_name="Kafka", email="kafka@absurd.org")
        p2 = ab.persons.create(first_name="Sergey", last_name="Esenin")

        p2.emails.append("esenin1@gmail.com")
        p2.emails.append("esenin2@gmail.com")

        ab.persons.add(p1, p2)

        lookingfor_email_1 = "esenin1"
        found1 = ab.persons.find_by_email(lookingfor_email_1)

        print("Find email {}: {}".format(lookingfor_email_1, convert_person_list(found1)))

        lookingfor_email_2 = "kafka@absurd.org"
        found2 = ab.persons.find_by_email(lookingfor_email_2)

        print("Find email {}: {}".format(lookingfor_email_2, convert_person_list(found2)))


text:
package org.apache.mesos.logstash.state;

import org.apache.log4j.Logger;
import org.apache.mesos.Protos;
import org.apache.mesos.Protos.TaskInfo;

import java.io.IOException;
import java.io.NotSerializableException;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import static org.apache.mesos.Protos.TaskID;

/**
 * Model of cluster state. User is able to add, remove and monitor task status.
 */
public class ClusterState {
    public static final Logger LOGGER = Logger.getLogger(ClusterState.class);
    public static final String STATE_LIST = "stateList";
    private final SerializableState state;
    private final FrameworkState frameworkState;
    private final StatePath statePath;

    public ClusterState(SerializableState state, FrameworkState frameworkState) {
        this.state = state;
        this.frameworkState = frameworkState;
        statePath = new StatePath(state);
    }

    /**
     * Get a list of all tasks with state
     * @return a list of TaskInfo
     */
    public List<TaskInfo> getTaskList() {
        List<TaskInfo> taskInfoList = null;
        try {
            taskInfoList = state.get(getKey());
        } catch (IOException ex) {
            LOGGER.info("Unable to get key for cluster state due to invalid frameworkID.");
        }
        return taskInfoList == null ? new ArrayList<>(0) : taskInfoList;
    }

    /**
     * Get the status of a specific task
     * @param taskID the taskID to retreive the task status for
     * @return a POJO representing TaskInfo, TaskStatus and FrameworkID packets
     * @throws InvalidParameterException when the taskId does not exist in the Task list.
     */
    public LSTaskStatus getStatus(TaskID taskID) throws InvalidParameterException {
        TaskInfo taskInfo = getTask(taskID);
        return new LSTaskStatus(state, frameworkState.getFrameworkID(), taskInfo);
    }

    public void addTask(TaskInfo taskInfo) {
        LOGGER.debug("Adding TaskInfo to cluster for task: " + taskInfo.getTaskId().getValue());
        if (exists(taskInfo.getTaskId())) {
            removeTask(taskInfo);
        }
        List<TaskInfo> taskList = getTaskList();
        taskList.add(taskInfo);
        setTaskInfoList(taskList);
    }

    public void removeTask(TaskInfo taskInfo) throws InvalidParameterException {
        List<TaskInfo> taskList = getTaskList();
        Boolean found = false;
        for (TaskInfo info : taskList) {
            if (isEqual(info, taskInfo)) {
                LOGGER.debug("Removing TaskInfo from cluster for task: " + taskInfo.getTaskId().getValue());
                taskList.remove(info);
                found = true;
                break;
            }
        }
        if (!found) {
            throw new InvalidParameterException("TaskInfo does not exist in list: " + taskInfo.getTaskId().getValue());
        }
        setTaskInfoList(taskList);
    }

    private boolean isEqual(TaskInfo taskInfo1, TaskInfo taskInfo2) {
        return taskInfo1.getTaskId().getValue().equals(taskInfo2.getTaskId().getValue());
    }

    public Boolean exists(TaskID taskId) {
        try {
            getStatus(taskId);
        } catch (InvalidParameterException e) {
            return false;
        }
        return true;
    }

    /**
     * Get the TaskInfo packet for a specific task.
     * @param taskID the taskID to retreive the TaskInfo for
     * @return a TaskInfo packet
     * @throws InvalidParameterException when the taskId does not exist in the Task list.
     */
    private TaskInfo getTask(TaskID taskID) throws InvalidParameterException {
        LOGGER.debug("Getting taskInfo from cluster for task: " + taskID.getValue());
        List<TaskInfo> taskInfoList = getTaskList();
        TaskInfo taskInfo = null;
        for (TaskInfo info : taskInfoList) {
            if (info.getTaskId().equals(taskID)) {
                taskInfo = info;
                break;
            }
        }
        if (taskInfo == null) {
            throw new InvalidParameterException("Could not find executor with that task ID: " + taskID.getValue());
        }
        return taskInfo;
    }

    private String logTaskList(List<TaskInfo> taskInfoList) {
        List<String> res = new ArrayList<>();
        for (TaskInfo t : taskInfoList) {
            res.add(t.getTaskId().getValue());
        }
        return Arrays.toString(res.toArray());
    }

    private void setTaskInfoList(List<TaskInfo> taskInfoList) {
        LOGGER.debug("Writing executor state list: " + logTaskList(taskInfoList));
        try {
            statePath.mkdir(getKey());
            state.set(getKey(), taskInfoList);
        } catch (IOException ex) {
            LOGGER.error("Could not write list of executor states to zookeeper: ", ex);
        }
    }

    private String getKey() throws NotSerializableException {
        return frameworkState.getFrameworkID().getValue() + "/" + STATE_LIST;
    }

    public List<TaskID> getTaskIdList() {
        return getTaskList().stream().map(TaskInfo::getTaskId).collect(Collectors.toList());
    }
}


text:
import StorageManager from '../storage/StorageManager';
import StaticClass from '../utils/StaticClass';
import Uuid from '../utils/uuid';

/**
 * State container for keeping track of OAuth states (crsf tokens)
 * @static
 * @private
 */
export default class StateContainer extends StaticClass {
  /**
   * LocalStorage key prefix
   * @returns {String} - prefix
   * @constant
   */
  static get prefix () {
    return 'oauth_state_';
  }

  /**
   * Generate and store a state that can be checked at a later point
   * @returns {string} - state
   */
  static generate () {
    const uuid = Uuid.uuid4();
    const key = StateContainer.prefix + uuid;

    StorageManager.best.set(key, Date.now());

    return uuid;
  }

  /**
   * Validate a state
   * @param {String} state - state to validate
   * @param {Boolean} purge - remove from state db after validation
   * @returns {Boolean} - if the state is valid
   */
  static validate (state, purge = true) {
    const storage = StorageManager.best;
    const key = StateContainer.prefix + state;
    const found = typeof storage.get(key) !== 'undefined';

    if (purge && found) {
      storage.remove(key);
    }

    return found;
  }

  /**
   * Remove all states from the state db
   */
  static clean () {
    const tokens = Object.keys(this.list());

    for (const token of tokens) {
      StorageManager.best.remove(StateContainer.prefix + token);
    }
  }

  /**
   * Get states with their corresponding state db key
   * @returns {Object<String, String>} - List of stored states
   */
  static list () {
    const storage = StorageManager.best;

    return storage
      .keys()
      .filter(x => x.startsWith(StateContainer.prefix))
      .map(x => x.replace(StateContainer.prefix, ''))
      .reduce((out, key) => {
        out[key] = storage.get(key);

        return out;
      }, {});
  }
}


text:
newspublication
===============

News@tvZtewifi


text:
package com.thoughtworks.go.plugin.access.scm;

import com.thoughtworks.go.plugin.api.config.Configuration;
import com.thoughtworks.go.plugin.api.config.Property;

import java.util.Collections;
import java.util.List;

public class SCMPropertyConfiguration extends Configuration {
    @Override
    public List<? extends Property> list() {
        List<SCMProperty> list = (List<SCMProperty>) super.list();
        Collections.sort(list);
        return list;
    }
}


text:
layout: doc_layout
title: Topshelf
category: Service Hosting
prev: /docs/hosting/defaultservicehost.html
next: /docs/hosting/iis.html
---

Note

Topshelf is currently the recommended best practice for hosting Wave services in production.

Topshelf is a very popular service hosting library that allows an application to run as both a console application and a Windows Service. This is ideal, as it allows the application to be ran in console
	mode during development, and as a headless service in production.

To use Topshelf, add this NuGet package to your project:

		 PM> Install-Package Wave.ServiceHosting.TopShelf

With this package installed, enabling Topshelf as the service host can be done using fluent configuration when configuring the host:

{% highlight c# linenos %}
var host = ServiceBus.ConfigureForHosting(c =>
    {
        // Using all default values
        //
        // This is usually adequate, service credentials can be
        // passed into the host during install time, giving more
        // flexibility
        c.UseTopshelf();

        // Or, if you want to have finer grained control, you can specify
        // all of the Topshelf configuration in code:
        c.UseTopshelf(tc =>
        {
        	// Specify the Service Name
        	tc.WithServiceName("Example Service");

        	// Specify the Display Name
        	tc.WithDisplayName("Example Service");

        	// Specify the Service Description
        	tc.WithDescription("Example Service Description");

        	// Specify the user to run the service as
        	tc.WithUsername("DOMAIN\ACCOUNT");

        	// The password to the user above
        	tc.WithPassword("password");

        	// If you don't pass a username/password above, you can specify specific
        	// machine accounts by using one of these three:
        	tc.RunAsLocalService();
        	tc.RunAsLocalSystem();
        	tc.RunAsNetworkService()
    	    });
    });
{% endhighlight %}

Or specified using XML configuration in the host's configuration file:

{% highlight xml linenos %}
<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <configSections>

  </configSections>

  <wave>

  	<serviceHost type="Wave.ServiceHosting.TopShelf.TopShelfHost"/>
  </wave>

  <wave.topshelf>

  	<runAs
  		username="DOMAIN\ACCOUNT"
  		password="password"
  		userType="USER|LOCALSYSTEM|LOCALSERVICE|NETWORKSERVICE"/>

  	<service
  		name="Example Service"
  		description="Example Service Description"
  		displayName="Example Service"/>
  </wave.topshelf>

</configuration>
{% endhighlight %}

Wave services hosted inside of topshelf can be installed using the technique described on the Topshelf website:

{% highlight bash linenos %}
MyService.exe install -username "DOMAIN\ACCOUNT" -password "PASSWORD"
{% endhighlight %}

Topshelf has many options and is beyond the scope of this reference. Please refer to the official Topshelf documentation for more details.


text:
```c#
public int Major { get; }
```

**Namespace:** [McSherry.SemanticVersioning][1]
**Minimum version:** 1.0.0

[1]: ../

**Type:** `System.Int32`
The semantic version's major version.

## Remarks

This version component is incremented each time a version with a
breaking change in it is released. If this is zero, then the version
number represents an unstable, pre-release version that may have
breaking changes made at any time without an increment.


text:
LuCI - Lua Configuration Interface

Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>

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

$Id: samba.lua 9558 2012-12-18 13:58:22Z jow $
]]--

module("luci.controller.samba", package.seeall)

function index()
	if not nixio.fs.access("/etc/config/samba") then
		return
	end

	local page

	page = entry({"admin", "services", "samba"}, cbi("samba"), _("Network Shares"))
	page.dependent = true
end


text:
"""
Django settings for test_project project.

Generated by 'django-admin startproject' using Django 1.9.6.
"""

import django

from .minimal_settings import *

SITE_ID = 1

# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django.contrib.sites",
    "test_project",

    # To access their middlewares for patching:
    "django.contrib.redirects",
    "django.contrib.flatpages",
]

SILENCED_SYSTEM_CHECKS = [
    "fields.E903",  # NullBooleanField is removed except for support in historical migrations
    "fields.E904",  # django.contrib.postgres.fields.JSONField is removed except for support in historical migrations
]

if not os.environ.get("IGNORE_CONTRIB_COMMENTS"):
    # old contrib packages, restored by proxifier in their original django.contrib.* namespace
    INSTALLED_APPS.append(
        "django_comments" if django.VERSION >= (1, 8) else "django.contrib.comments"
    )

MIDDLEWARE_CLASSES = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.auth.middleware.SessionAuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
]
MIDDLEWARE = MIDDLEWARE_CLASSES

ROOT_URLCONF = "test_project.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "allowed_include_roots": [BASE_DIR],
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    }
]

WSGI_APPLICATION = "test_project.wsgi.application"

# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": os.path.join(BASE_DIR, "test_project", "db.sqlite3"),
    }
}

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = "/static/"


text:
<?php

namespace Sonata\MediaBundle\CDN;

class Fallback implements CDNInterface
{
    protected $cdn;

    protected $fallback;

    /**
     * @param CDNInterface $cdn
     * @param CDNInterface $fallback
     */
    public function __construct(CDNInterface $cdn, CDNInterface $fallback)
    {
        $this->cdn      = $cdn;
        $this->fallback = $fallback;
    }

    /**
     * {@inheritdoc}
     */
    public function getPath($relativePath, $isFlushable)
    {
        if ($isFlushable) {
            return $this->fallback->getPath($relativePath, $isFlushable);
        }

        return $this->cdn->getPath($relativePath, $isFlushable);
    }

    /**
     * {@inheritdoc}
     */
    public function flushByString($string)
    {
        $this->cdn->flushByString($string);
    }

    /**
     * {@inheritdoc}
     */
    public function flush($string)
    {
        $this->cdn->flush($string);
    }

    /**
     * {@inheritdoc}
     */
    public function flushPaths(array $paths)
    {
        $this->cdn->flushPaths($paths);
    }
}


text:
import { forwardRef } from "react";

import { FontIcon, FontIconProps } from "@react-md/icon";

export const TheatersFontIcon = forwardRef<HTMLElement, FontIconProps>(
  function TheatersFontIcon(props, ref) {
    return (
      <FontIcon {...props} ref={ref}>
        theaters
      </FontIcon>
    );
  }
);


text:
package cfvbaibai.cardfantasy.engine.skill;

import cfvbaibai.cardfantasy.CardFantasyRuntimeException;
import cfvbaibai.cardfantasy.GameUI;
import cfvbaibai.cardfantasy.data.Skill;
import cfvbaibai.cardfantasy.engine.*;

import java.util.List;

public class ReformingAwaken {
    public static void apply(SkillResolver resolver, SkillUseInfo skillUseInfo, CardInfo card,Player defender,String cardName) throws HeroDieSignal{
        if (card == null || card.isDead())  {
            throw new CardFantasyRuntimeException("card should not be null or dead!");
        }
        if (card.hasUsed(skillUseInfo)) {
            return;
        }
        boolean awakenFlag = false;
        List<CardInfo> fieldCardList = card.getOwner().getField().getAliveCards();
        for(CardInfo aliveCard:fieldCardList)
        {
            if(aliveCard.getName().equals(cardName))
            {
                awakenFlag = true;
                break;
            }
        }
        if(!awakenFlag)
        {
            return;
        }
        Skill skill = skillUseInfo.getSkill();
        resolver.getStage().getUI().useSkill(card, skill, true);
        GameUI ui = resolver.getStage().getUI();

        ui.useSkill(card, card, skillUseInfo.getSkill(), true);
        Player attackPlayer = card.getOwner();
        resolver.killCard(card,card,skill);//改为杀死卡进入墓地

    //    resolver.resolveDeathSkills(card,victim,skillUseInfo.getSkill(),result);//新生可以发动死契
        if(card.getOwner() !=attackPlayer) {
            card.switchOwner(attackPlayer);
        }
        if (card.getStatus().containsStatus(CardStatusType.召唤)) {
            CardStatusItem summonStatusItem = null;
            for(CardStatusItem summonedStatusItem:card.getStatus().getAllItems())
            {
                if(summonedStatusItem.getType()==CardStatusType.召唤){
                    summonStatusItem = summonedStatusItem;
                    break;
                }
            }
            card.reset();
            card.addStatus(summonStatusItem);
            card.setUsed(skillUseInfo);
            resolver.summonCard(card.getOwner(), card, card, true, skill,1);
        } else {
            //处理顽强司命情况下,卡牌已经回到场上,不需要再次结算降临技能。
            if (card.isAlive()) {
                card.setUsed(skillUseInfo);
                return;
            }
            //强制移除卡牌,防止新生以后出现卡牌复制。
            card.getOwner().getHand().removeCard(card);
            card.getOwner().getDeck().removeCard(card);
            card.getOwner().getField().removeCard(card);
            card.getOwner().getOutField().removeCard(card);
            defender.getHand().removeCard(card);
            defender.getDeck().removeCard(card);
            defender.getField().removeCard(card);
            defender.getOutField().removeCard(card);
            resolver.summonCard(card.getOwner(), card, null, false, skillUseInfo.getSkill(), 0);
            card.setUsed(skillUseInfo);
        }
    }

    public static void reset( SkillUseInfo skillUseInfo, CardInfo card) throws HeroDieSignal {
        if(card.hasUsed(skillUseInfo))
        {
            for (SkillEffect effect : card.getEffects()) {
                if (effect.getCause() == skillUseInfo && effect.getType() == SkillEffectType.SKILL_USED) {
                    card.removeEffect(effect);
                    return;
                }
            }
        }
    }
}


text:
package parser

import (
	"fmt"
	"github.com/cloudson/gitql/lexical"
	"strconv"
	_ "unicode"
)

var look_ahead uint8

const Time_YMD = "2006-01-02"
const Time_YMDHIS = "2006-01-02 15:04:05"

type SyntaxError struct {
	expected uint8
	found    uint8
}

func (e *SyntaxError) Error() string {
	var appendix = ""
	if e.found == lexical.T_LITERAL || e.found == lexical.T_ID {
		appendix = fmt.Sprintf("(%s)", lexical.CurrentLexeme)
	}
	return fmt.Sprintf("Expected %s and found %s%s", lexical.TokenName(e.expected), lexical.TokenName(e.found), appendix)
}

func throwSyntaxError(expectedToken uint8, foundToken uint8) error {
	error := new(SyntaxError)
	error.expected = expectedToken
	error.found = foundToken

	return error
}

func New(source string) {
	lexical.New(source)
}

func AST() (*NodeProgram, error) {
	program := new(NodeProgram)
	node, err := gProgram()
	program.Child = node

	return program, err
}

func gProgram() (NodeMain, error) {
	token, err := lexical.Token()
	look_ahead = token

	if err != nil {
		return nil, err
	}

	s, err2 := gSelect()
	if s == nil {
		return nil, err2
	}

	if look_ahead != lexical.T_EOF {
		return nil, throwSyntaxError(lexical.T_EOF, look_ahead)
	}

	return s, nil
}

func gSelect() (*NodeSelect, error) {
	if look_ahead != lexical.T_SELECT {
		return nil, throwSyntaxError(lexical.T_SELECT, look_ahead)
	}
	token, err := lexical.Token()
	look_ahead = token
	if err != nil {
		return nil, err
	}
	s := new(NodeSelect)

	// PARAMETERS
	fields, err2 := gTableParams()
	if err2 != nil {
		return nil, err2
	}

	if len(fields) == 1 && fields[0] == "*" {
		s.WildCard = true
	}
	s.Fields = fields

	// TABLES
	tables, err4 := gTableNames()
	if err4 != nil {
		return nil, err4
	}
	s.Tables = tables

	// WHERE
	where, err6 := gWhere()
	if err6 != nil {
		return nil, err6
	}
	s.Where = where

	// ORDER BY
	order, err6 := gOrder()
	if err6 != nil {
		return nil, err6
	}
	s.Order = order

	// LIMIT
	var err5 error
	s.Limit, err5 = gLimit()
	if s.Limit == -1 {
		// @todo search default limit from file config
		s.Limit = 10
	}

	if err5 != nil {
		return nil, err5
	}

	return s, nil
}

func gTableNames() ([]string, error) {
	if look_ahead != lexical.T_FROM {
		return nil, throwSyntaxError(lexical.T_FROM, look_ahead)
	}
	token, error := lexical.Token()
	if error != nil {
		return nil, error
	}
	look_ahead = token
	if look_ahead != lexical.T_ID {
		return nil, throwSyntaxError(lexical.T_ID, look_ahead)
	}

	tables := make([]string, 1)
	tables[0] = lexical.CurrentLexeme

	token2, err2 := lexical.Token()
	if err2 != nil && token2 != lexical.T_EOF {
		return nil, err2
	}
	look_ahead = token2

	return tables, nil
}

func gTableParams() ([]string, error) {
	if look_ahead == lexical.T_WILD_CARD {
		token, err := lexical.Token()
		if err != nil {
			return nil, err
		}
		look_ahead = token
		return []string{"*"}, nil
	}
	var fields = []string{}
	if look_ahead == lexical.T_ID {
		fields := append(fields, lexical.CurrentLexeme)
		token, err := lexical.Token()
		if err != nil {
			return nil, err
		}
		look_ahead = token
		fields, errorSyntax := gTableParamsRest(&fields, 1)

		return fields, errorSyntax
	}
	return nil, throwSyntaxError(lexical.T_ID, look_ahead)

}

func gTableParamsRest(fields *[]string, count int) ([]string, error) {
	if lexical.T_COMMA == look_ahead {
		var errorToken *lexical.TokenError
		look_ahead, errorToken = lexical.Token()
		if errorToken != nil {
			return *fields, errorToken
		}
		if look_ahead != lexical.T_ID {
			return *fields, throwSyntaxError(lexical.T_ID, look_ahead)
		}

		n := append(*fields, lexical.CurrentLexeme)
		fields = &n
		look_ahead, errorToken = lexical.Token()
		if errorToken != nil {
			return *fields, errorToken
		}
		n, errorSyntax := gTableParamsRest(fields, count+1)
		fields = &n
		if errorSyntax != nil {
			return *fields, errorSyntax
		}
	}

	return *fields, nil
}

func gOrder() (*NodeOrder, error) {
	if look_ahead == lexical.T_ORDER {
		token, err := lexical.Token()
		if err != nil {
			return nil, err
		}
		if token != lexical.T_BY {
			return nil, throwSyntaxError(lexical.T_BY, token)
		}

		order := new(NodeOrder)
		token, err = lexical.Token()
		if err != nil {
			return nil, err
		}
		if token != lexical.T_ID {
			return nil, throwSyntaxError(lexical.T_ID, token)
		}
		order.Field = lexical.CurrentLexeme
		token, err = lexical.Token()
		if err != nil {
			return nil, err
		}
		if token != lexical.T_ASC && token != lexical.T_DESC {
			return nil, throwSyntaxError(lexical.T_ASC, token)
		}
		order.Asc = (token == lexical.T_ASC)

		token, err = lexical.Token()
		if err != nil {
			return nil, err
		}
		look_ahead = token
		return order, nil
	}

	return nil, nil
}

func gLimit() (int, error) {
	if look_ahead != lexical.T_LIMIT {
		return -1, nil
	}
	token, err := lexical.Token()
	if err != nil {
		return 0, err
	}
	look_ahead = token

	number, numberError := strconv.Atoi(lexical.CurrentLexeme)
	if numberError != nil {
		return 0, numberError
	}
	token2, err2 := lexical.Token()
	if token2 != lexical.T_EOF && err2 != nil {
		return 0, err2
	}
	look_ahead = token2

	return number, nil
}

func gWhere() (NodeExpr, error) {
	if look_ahead != lexical.T_WHERE {
		return nil, nil
	}

	token, err := lexical.Token()
	if err != nil {
		return nil, err
	}
	look_ahead = token
	conds, err2 := gWhereConds()

	return conds, err2
}

func gWhereConds() (NodeExpr, error) {
	where, err := gWC2(false)
	if err != nil {
		return nil, err
	}

	return where, nil
}

// where cond OR
func gWC2(eating bool) (NodeExpr, error) {
	if eating {
		token, err := lexical.Token()
		if token != lexical.T_EOF && err != nil {
			return nil, err
		}
		look_ahead = token
	}
	expr, err := gWC3(false)
	if err != nil {
		return nil, err
	}
	if look_ahead == lexical.T_OR {
		or := new(NodeOr)
		or.SetLeftValue(expr)
		expr2, err2 := gWC2(true)
		if err2 != nil {
			return nil, err2
		}
		or.SetRightValue(expr2)
		return or, nil
	}
	return expr, nil
}

// where cond AND
func gWC3(eating bool) (NodeExpr, error) {
	if eating {
		token, err := lexical.Token()
		if token != lexical.T_EOF && err != nil {
			return nil, err
		}
		look_ahead = token
	}
	expr, err := gWC4(false)
	if err != nil {
		return nil, err
	}
	if look_ahead == lexical.T_AND {
		and := new(NodeAnd)
		and.SetLeftValue(expr)
		expr2, err2 := gWC3(true)
		if err2 != nil {
			return nil, err2
		}
		and.SetRightValue(expr2)
		return and, nil
	}
	return expr, nil
}

// where cond 'equal', 'in' and 'not equal'
func gWC4(eating bool) (NodeExpr, error) {
	if eating {
		token, err := lexical.Token()
		if token != lexical.T_EOF && err != nil {
			return nil, err
		}
		look_ahead = token
	}
	expr, err := gWC5(false)
	if err != nil {
		return nil, err
	}

	switch look_ahead {
	case lexical.T_EQUAL:
		op := new(NodeEqual)
		op.SetLeftValue(expr)
		expr2, err2 := gWC4(true)
		if err2 != nil {
			return nil, err2
		}
		op.SetRightValue(expr2)

		return op, nil
	case lexical.T_NOT_EQUAL:
		op := new(NodeNotEqual)
		op.SetLeftValue(expr)
		expr2, err2 := gWC4(true)
		if err2 != nil {
			return nil, err2
		}
		op.SetRightValue(expr2)
		return op, nil
	case lexical.T_IN:
		op := new(NodeIn)
		op.SetLeftValue(expr)
		expr2, err2 := gWC4(true)
		if err2 != nil {
			return nil, err2
		}
		op.SetRightValue(expr2)
		return op, nil
	}

	return expr, nil
}

// where cond greater and lesser
func gWC5(eating bool) (NodeExpr, error) {
	if eating {
		token, err := lexical.Token()

		if token != lexical.T_EOF && err != nil {
			return nil, err
		}
		look_ahead = token
	}
	expr, err := rValue()
	if err != nil {
		return nil, err
	}

	switch look_ahead {
	case lexical.T_GREATER, lexical.T_GREATER_OR_EQUAL:
		op := new(NodeGreater)
		op.Equal = (look_ahead == lexical.T_GREATER_OR_EQUAL)
		op.SetLeftValue(expr)
		expr2, err2 := gWC5(true)
		if err2 != nil {
			return nil, err2
		}
		op.SetRightValue(expr2)

		return op, nil
	case lexical.T_SMALLER, lexical.T_SMALLER_OR_EQUAL:
		op := new(NodeSmaller)
		op.Equal = (look_ahead == lexical.T_SMALLER_OR_EQUAL)
		op.SetLeftValue(expr)
		expr2, err2 := gWC5(true)
		if err2 != nil {
			return nil, err2
		}
		op.SetRightValue(expr2)

		return op, nil
	}

	return expr, nil
}

func rValue() (NodeExpr, error) {
	if look_ahead == lexical.T_PARENTH_L {
		token, err := lexical.Token()
		if err != nil {
			return nil, err
		}
		look_ahead = token
		conds, err2 := gWhereConds()
		if err2 != nil {
			return nil, err2
		}
		if look_ahead != lexical.T_PARENTH_R {
			return nil, throwSyntaxError(lexical.T_PARENTH_R, look_ahead)
		}
		token2, err3 := lexical.Token()
		if token2 != lexical.T_EOF && err3 != nil {
			return nil, err3
		}
		look_ahead = token2

		return conds, nil
	}

	if look_ahead == lexical.T_ID {
		n := new(NodeId)
		n.SetValue(lexical.CurrentLexeme)

		token2, err := lexical.Token()
		if token2 != lexical.T_EOF && err != nil {
			return nil, err
		}
		look_ahead = token2

		return n, nil
	}

	if look_ahead != lexical.T_LITERAL && look_ahead != lexical.T_NUMERIC {
		return nil, throwSyntaxError(lexical.T_LITERAL, look_ahead)
	}

	lexeme := lexical.CurrentLexeme
	if look_ahead != lexical.T_LITERAL {
		return nil, throwSyntaxError(lexical.T_AND, look_ahead)
	}

	// @todo inserts IS NULL!

	n := new(NodeLiteral)
	n.SetValue(lexeme)
	token2, err := lexical.Token()
	if err != nil && token2 != lexical.T_EOF {
		return nil, err
	}
	look_ahead = token2

	return n, nil
}


text:
<?php
/*

SQL Buddy - Web based MySQL administration
http://www.sqlbuddy.com/

export.php
- export data in sql and csv formats

MIT license

2008 Calvin Lough <http://calv.in>

*/

include "functions.php";

loginCheck();

if ($_POST) {

	$outputBuffer = "";

	if (isset($db)) {
		$dbs[] = $db;

		if (isset($table))
			$tables[] = $table;
		else if (isset($_POST['EXPORTTABLE']))
			$tables = $_POST['EXPORTTABLE'];
	} else {
		if (isset($_POST['EXPORTDB']))
			$dbs = $_POST['EXPORTDB'];
		$exportDb = true;
	}

	if (isset($_POST['FORMAT']))
		$format = strtoupper($_POST['FORMAT']);

	if (isset($_POST['STRUCTURE']))
		$exportStructure = $_POST['STRUCTURE'];

	if (isset($_POST['DATA']))
		$exportData = $_POST['DATA'];

	if (isset($_POST['DELIMITER']))
		$delimiter = $_POST['DELIMITER'];

	if (isset($_POST['FIELDNAMES']))
		$printFieldnames = $_POST['FIELDNAMES'];

	if (isset($_POST['INSERTTYPE']))
		$insertType = $_POST['INSERTTYPE'];

	if (isset($_POST['OUTPUT']))
		$output = $_POST['OUTPUT'];

	if (isset($_POST['OUTPUTFILETEXT'])) {
		$outputFile = "exports/" . basename($_POST['OUTPUTFILETEXT']);
	}

	if (!isset($delimiter) || $delimiter == "TAB")
		$delimiter = "\t";
	else if ($delimiter == "SEMICOLON")
		$delimiter = ";";
	else if ($delimiter == "SPACE")
		$delimiter = " ";
	else
		$delimiter = ",";

	// for the next three - it has to be one or the other
	// this way, if we get fed garbage, just go with a default
	if (!isset($format) || $format != "CSV")
		$format = "SQL";

	if (!isset($output) || $output != "FILE" || !isset($outputFile))
		$output = "BROWSER";

	if (!isset($insertType) || $insertType != "COMPLETE")
		$insertType = "COMPACT";

	if (isset($format) && $format == "SQL" && !isset($exportStructure) && !isset($exportData)) {
		$error = __("You must export either structure, data, or both") . ".";
	} else if (!isset($dbs)) {
		$error = __("Please select the databases that you would like to export") . ".";
	} else if (isset($db) && !isset($tables)) {
		$error = __("Please select the tables that you would like to export") . ".";
	} else {

		if ($format == "SQL") {

			$version = $conn->getVersion();

			$outputBuffer .= "--\r\n";

			if ($conn->getAdapter() == "mysql")
				$outputBuffer .= "-- MySQL " . $version . "\r\n";
			else if ($conn->getAdapter() == "sqlite")
				$outputBuffer .= "-- SQLite " . $version . "\r\n";

			$outputBuffer .= "-- " . date("r") . "\r\n";
			$outputBuffer .= "--\r\n\r\n";
		}

		foreach ($dbs as $d) {

			$conn->selectDB($d);

			// this checks to see if we are exporting an entire db with all tables
			if (isset($exportDb) && $exportDb == true) {

				if ($format == "SQL") {

					$outputBuffer .= "CREATE DATABASE `$d`";

					if ($conn->hasCharsetSupport())
					{
						$currentChar = "";
						$currentCharSql = $conn->query("SHOW VARIABLES LIKE 'character_set_database'");

						if ($conn->isResultSet($currentCharSql)) {
							$currentChar = $conn->result($currentCharSql, 0, "Value");

							$outputBuffer .= " DEFAULT CHARSET " . $currentChar;
						}
					}

					$outputBuffer .= ";\r\n\r\n";

					$outputBuffer .= "USE `$d`;\r\n\r\n";

				}

				$tableSql = $conn->listTables();

				$tables = "";

				if ($conn->isResultSet($tableSql)) {
					while ($tableRow = $conn->fetchArray($tableSql)) {
						$tables[] = $tableRow[0];
					}
				}
			}

			foreach ($tables as $t) {

				if ($format == "SQL") {

					if ($conn->getAdapter() == "mysql")
						$structureSQL = $conn->query("SHOW FULL FIELDS FROM `$t`");
					else
						$structureSQL = $conn->describeTable($t);

					$tableEngine = "";
					$tableCharset = "";
					$autoIncrement = "";

					if (isset($exportStructure)) {

						if ($conn->isResultSet($structureSQL)) {

							if ($conn->getAdapter() == "mysql") {

								$outputBuffer .= "CREATE TABLE `$t` (";

								$infoSql = $conn->query("SHOW TABLE STATUS LIKE '$t'");

								if ($conn->isResultSet($infoSql) == 1) {

									$infoRow = $conn->fetchAssoc($infoSql);

									$tableEngine = (array_key_exists("Type", $infoRow)) ? $infoRow['Type'] : $infoRow['Engine'];

									if (array_key_exists('Collation', $infoRow) && isset($collationList)) {
										$tableCharset = $collationList[$infoRow['Collation']];
									}

									if (array_key_exists('Auto_increment', $infoRow))
									{
										$autoIncrement = $infoRow['Auto_increment'];
									}
								}

							} else if ($conn->getAdapter() == "sqlite") {

								$outputBuffer .= "CREATE TABLE '$t' (";
							}

							$first = true;

							if ($conn->getAdapter() == "mysql") {

								while ($structureRow = $conn->fetchassoc($structureSQL)) {

									if (!$first)
										$outputBuffer .= ",";

									$outputBuffer .= "\r\n   `" . $structureRow['Field'] . "` " . $structureRow['Type'];

									if (isset($collationList) && isset($structureRow['Collation']) && $structureRow['Collation'] != "NULL" && !is_null($structureRow['Collation'])) {
										if ($collationList[$structureRow['Collation']] != $tableCharset) {
											$outputBuffer .= " CHARSET " . $collationList[$structureRow['Collation']];
										}
									}

									if (isset($structureRow['Null']) && $structureRow['Null'] != "YES")
										$outputBuffer .= " not null";

									if (isset($structureRow['Default']) && $structureRow['Default'] == "CURRENT_TIMESTAMP") {
										$outputBuffer .= " default CURRENT_TIMESTAMP";
									} else if (isset($structureRow['Default']) && $structureRow['Default'] != "") {
										$outputBuffer .= " default '" . $structureRow['Default'] . "'";
									}

									if (isset($structureRow['Extra']) && $structureRow['Extra'] != "")
										$outputBuffer .= " " . $structureRow['Extra'];

									$first = false;
								}

							} else if ($conn->getAdapter() == "sqlite") {

								foreach ($structureSQL as $structureRow) {

									if (!$first)
										$outputBuffer .= ",";

									$outputBuffer .= "\r\n   " . $structureRow[0] . " " . $structureRow[1];

									$first = false;
								}

							}

							// dont forget about the keys
							if ($conn->getAdapter() == "mysql") {
								$keySQL = $conn->query("SHOW INDEX FROM `$t`");

								if ($conn->isResultSet($keySQL)) {
									$currentKey = "";
									while ($keyRow = $conn->fetchAssoc($keySQL)) {
										// if this is the start of a key
										if ($keyRow['Key_name'] != $currentKey) {
											// finish off the last key first, if necessary
											if ($currentKey != "")
												$outputBuffer .= ")";

											if ($keyRow['Key_name'] == "PRIMARY")
												$outputBuffer .= ",\r\n   PRIMARY KEY (";
											elseif ($keyRow['Non_unique'] == "0")
												$outputBuffer .= ",\r\n   UNIQUE KEY (";
											else
												$outputBuffer .= ",\r\n   KEY `" . $keyRow['Key_name'] . "` (";

											$outputBuffer .= "`" . $keyRow['Column_name'] . "`";
										} else {
											$outputBuffer .= ",`" . $keyRow['Column_name'] . "`";
										}

										$currentKey = $keyRow['Key_name'];
									}

									if (isset($currentKey) && $currentKey != "")
										$outputBuffer .= ")";
								}
							}

							$outputBuffer .= "\r\n)";

							if ($conn->getAdapter() == "mysql") {
								if ($tableEngine) {
									$outputBuffer .= ' ENGINE=' . $tableEngine;
								}

								if ($tableCharset) {
									$outputBuffer .= ' DEFAULT CHARSET=' . $tableCharset;
								}

								if ($autoIncrement)
								{
									$outputBuffer .= ' AUTO_INCREMENT=' . $autoIncrement;
								}
							}

							$outputBuffer .= ";\r\n\r\n";
						}
					}

					if ($conn->getAdapter() == "mysql")
						$structureSQL = $conn->query("SHOW FULL FIELDS FROM `$t`");
					else
						$structureSQL = $conn->describeTable($t);

					if (isset($exportData)) {

						$columnList = array();

						if ($conn->getAdapter() == "mysql") {

							$dataSQL = $conn->query("SELECT * FROM `$t`");

							// put the column names in an array
							if ($conn->isResultSet($structureSQL)) {
								while ($structureRow = $conn->fetchAssoc($structureSQL)) {
									$columnList[] = $structureRow['Field'];
									$type[] = $structureRow['Type'];
								}
							}

							$columnImplosion = implode("`, `", $columnList);

							if ($conn->isResultSet($dataSQL)) {

								if ($insertType == "COMPACT")
									$outputBuffer .= "INSERT INTO `$t` (`$columnImplosion`) VALUES \r\n";

								$firstLine = true;

								while ($dataRow = $conn->fetchAssoc($dataSQL)) {

									if ($insertType == "COMPLETE") {
										$outputBuffer .= "INSERT INTO `$t` (`$columnImplosion`) VALUES ";
									} else {
										if (!$firstLine)
											$outputBuffer .= ",\r\n";
									}

									$outputBuffer .= "(";

									$first = true;

									for ($i=0; $i<sizeof($columnList); $i++) {
										if (!$first)
											$outputBuffer .= ", ";

										$currentData = $dataRow[$columnList[$i]];

										if (isset($type) && $currentData && ((isset($binaryDTs) && in_array($type[$i], $binaryDTs)) || stristr($type[$i], "binary") !== false)) {
											$outputBuffer .= "0x" . bin2hex($currentData);
										} else {
											$outputBuffer .= "'" . $conn->escapeString($currentData) . "'";
										}

										$first = false;
									}

									$outputBuffer .= ")";

									if ($insertType == "COMPLETE")
										$outputBuffer .= ";\r\n";

									$firstLine = false;

								}

								if ($insertType == "COMPACT")
									$outputBuffer .= ";\r\n";

							} else {
								$outputBuffer .= "-- [" . sprintf(__("Table `%s` is empty"), $t) . "]\r\n";
							}

						} else if ($conn->getAdapter() == "sqlite") {

							$dataSQL = $conn->query("SELECT * FROM '$t'");

							// put the column names in an array
							if ($conn->isResultSet($structureSQL)) {
								foreach ($structureSQL as $structureRow) {
									$columnList[] = $structureRow[0];
									$type[] = $structureRow[1];
								}
							}

							$columnImplosion = implode("', '", $columnList);

							if ($conn->isResultSet($dataSQL)) {

								$firstLine = true;

								while ($dataRow = $conn->fetchAssoc($dataSQL)) {

									$outputBuffer .= "INSERT INTO '$t' ('$columnImplosion') VALUES (";

									$first = true;

									for ($i=0; $i<sizeof($columnList); $i++) {
										if (!$first)
											$outputBuffer .= ", ";

										$currentData = $dataRow[$columnList[$i]];

										$outputBuffer .= "'" . $conn->escapeString($currentData) . "'";

										$first = false;
									}

									$outputBuffer .= ");\r\n";

									$firstLine = false;

								}

							} else {
								$outputBuffer .= "-- [" . sprintf(__("Table `%s` is empty"), $t) . "]\r\n";
							}

						}
					}

					$outputBuffer .= "\r\n";

				} else if ($format == "CSV") {

					if (isset($printFieldnames)) {
						$structureSQL = $conn->describeTable($t);

						if ($conn->isResultSet($structureSQL)) {
							$first = true;

							if ($conn->getAdapter() == "mysql") {

								while ($structureRow = $conn->fetchArray($structureSQL)) {
									if (!$first)
										$outputBuffer .= $delimiter;

									$outputBuffer .= "\"" . $structureRow[0] . "\"";

									$first = false;
								}

							} else if ($conn->getAdapter() == "sqlite") {

								foreach ($structureSQL as $structureRow) {
									if (!$first)
										$outputBuffer .= $delimiter;

									$outputBuffer .= "\"" . $structureRow[0] . "\"";

									$first = false;
								}

							}

							$outputBuffer .= "\r\n";
						}
					}

					if ($conn->getAdapter() == "mysql") {
						$dataSQL = $conn->query("SELECT * FROM `$t`");
					} else if ($conn->getAdapter() == "sqlite") {
						$dataSQL = $conn->query("SELECT * FROM '$t'");
					}

					if ($conn->isResultSet($dataSQL)) {
						while ($dataRow = $conn->fetchArray($dataSQL)) {
							$data = array();
							foreach ($dataRow as $each) {
								$data[] = "\"" . formatDataForCSV($each) . "\"";
							}

							$dataLine = implode($delimiter, $data);

							$outputBuffer .= $dataLine . "\r\n";
						}
					}

				}

			}

		}

		$outputBuffer = trim($outputBuffer);

		if ($outputBuffer) {
			if ($output == "BROWSER") {
				echo "
";
					echo "" . __("Results:") . " [" . __("Select all") . "]";
					echo "<textarea id=\"EXPORTRESULTS\">" . htmlentities($outputBuffer, ENT_QUOTES, 'UTF-8') . "</textarea>";
				echo "
";
			} else {

				if (!$handle = @fopen($outputFile, "w")) {
					$error = __("The file could not be opened") . ".";
				} else {
					if (fwrite($handle, $outputBuffer) === false) {
						$error = __("Could not write to file") . ".";
					} else {
						echo '
';
						echo __("Successfully wrote content to file") . '. ' . __("Download") . '
' . __("Note") . ': ' . __("If this is a public server, you should delete this file from the server after you download it") . '.
';
					}
				}

				@fclose($handle);

			}
		}

	}
}

if (isset($error)) {
	echo '
' . $error . '
';
}

?>

<?php echo __("Export"); ?>

	<form id="EXPORTFORM" onsubmit="submitForm('EXPORTFORM'); return false">

	<?php

	$showSeperator = false;

	if (isset($db) && !isset($table)) {

	?>

		<?php echo __("Tables"); ?>:
 <?php echo __("All"); ?> / <?php echo __("None"); ?>

		<select name="EXPORTTABLE[]" id="exportTable" multiple="multiple" size="10">
		<?php

		$conn->selectDB($db);

		$tableSql = $conn->listTables();

		if ($conn->isResultSet($tableSql)) {
			while ($tableRow = $conn->fetchArray($tableSql)) {
				echo '<option value="' . $tableRow[0] . '"';

				if (isset($tables) && in_array($tableRow[0], $tables))
					echo ' selected="selected"';

				echo '>' . $tableRow[0] . '</option>';
			}
		}

		?>
		</select>

	<?php

	$showSeperator = true;

	} else if (!isset($db) && $conn->getAdapter() != "sqlite") {
	?>

		<?php echo __("Databases"); ?>:
 <?php echo __("All"); ?> / <?php echo __("None"); ?>

		<select name="EXPORTDB[]" id="exportDb" multiple="multiple" size="10">
		<?php

		$dbSql = $conn->listDatabases();

		if ($conn->isResultSet($dbSql)) {
			while ($dbRow = $conn->fetchArray($dbSql)) {
				if ($dbRow[0] != "information_schema")
				{
					echo '<option value="' . $dbRow[0] . '"';

					if (isset($dbs) && in_array($dbRow[0], $dbs))
						echo ' selected="selected"';

					echo '>' . $dbRow[0] . '</option>';
				}
			}
		}

		?>
		</select>

	<?php

	$showSeperator = true;

	} else if (isset($db) && isset($table)) {

	?>

		<?php echo __("Format"); ?>:

			<input type="radio" name="FORMAT" id="SQLTOGGLE" value="SQL" onchange="updatePane('SQLTOGGLE', 'sqlpane', 'csvpane')" onclick="updatePane('SQLTOGGLE', 'sqlpane', 'csvpane')" <?php if ((isset($format) && $format == "SQL")|| !isset($format)) echo 'checked="checked"'; ?> /><?php echo __("SQL"); ?>

			<input type="radio" name="FORMAT" value="CSV" onchange="updatePane('SQLTOGGLE', 'sqlpane', 'csvpane')" onclick="updatePane('SQLTOGGLE', 'sqlpane', 'csvpane')" <?php if (isset($format) && $format == "CSV") echo 'checked="checked"'; ?> /><?php echo __("CSV"); ?>

	<?php

	$showSeperator = true;

	}

	?>

	<?php

	if ($showSeperator)
		echo '

';

	?>

	<table cellpadding="0" id="sqlpane"<?php if (isset($format) && $format == "CSV") echo ' style="display: none"'; ?>>

		<?php echo __("Export"); ?>:

			<input type="checkbox" name="STRUCTURE" value="STRUCTURE" <?php if (isset($exportStructure) || !($_POST)) echo 'checked="checked"'; ?> /><?php echo __("Structure"); ?>

			<input type="checkbox" name="DATA" value="DATA" <?php if (isset($exportData) || !($_POST)) echo 'checked="checked"'; ?> /><?php echo __("Data"); ?>

	<?php

	if ($conn->getAdapter() == "mysql") {

	?>

		<?php echo __("Options"); ?>:

			<input type="radio" name="INSERTTYPE" value="COMPACT" <?php if ((isset($insertType) && $insertType == "COMPACT") || !isset($insertType)) echo 'checked="checked"'; ?> /><?php echo __("Compact inserts"); ?>

			<input type="radio" name="INSERTTYPE" value="COMPLETE" <?php if (isset($insertType) && $insertType == "COMPLETE") echo 'checked="checked"'; ?> /><?php echo __("Complete inserts"); ?>

	<?php

	}

	?>

	<table cellpadding="0" id="csvpane"<?php if ((isset($format) && $format == "SQL") || !isset($format)) echo ' style="display: none"'; ?>>

		<?php echo __("Delimiter"); ?>:

			<input type="radio" name="DELIMITER" value="COMMA"<?php if (isset($delimiter) && $delimiter == "," || !isset($delimiter)) echo ' checked="checked"'; ?> /><?php echo __("Comma"); ?>

			<input type="radio" name="DELIMITER" value="TAB"<?php if (isset($delimiter) && $delimiter == "\t") echo ' checked="checked"'; ?> /><?php echo __("Tab"); ?>

			<input type="radio" name="DELIMITER" value="SEMICOLON"<?php if (isset($delimiter) && $delimiter == ";") echo ' checked="checked"'; ?> /><?php echo __("Semicolon"); ?>

			<input type="radio" name="DELIMITER" value="SPACE"<?php if (isset($delimiter) && $delimiter == " ") echo ' checked="checked"'; ?> /><?php echo __("Space"); ?>

		<?php echo __("Options"); ?>:

			<input type="checkbox" name="FIELDNAMES" value="TRUE"<?php if (isset($printFieldnames)) echo ' checked="checked"'; ?> /><?php echo __("Print field names on first line"); ?>

		<?php echo __("If you are exporting a large number of rows, it is recommended that you output the results to a text file"); ?>.

		<?php echo __("Output to"); ?>:

			<input type="radio" name="OUTPUT" value="BROWSER"<?php if (isset($output) && $output == "BROWSER" || !isset($output)) echo ' checked="checked"'; ?> /><?php echo __("Browser"); ?>

			<input type="radio" name="OUTPUT" id="OUTPUTFILE" value="FILE" onchange="exportFilePrep()"<?php if (isset($output) && $output == "FILE") echo ' checked="checked"'; ?> /><?php echo __("Text file"); ?>:<input type="text" class="text" name="OUTPUTFILETEXT" id="OUTPUTFILETEXT" value="<?php if (isset($outputFile)){ echo basename($outputFile); } else if (isset($format) && $format == "CSV") { echo strtolower(__("Export")) . ".csv"; } else { echo strtolower(__("Export")) . ".sql"; } ?>" style="vertical-align: middle; margin-left: 5px" />

		<input type="submit" class="inputbutton" value="<?php echo __("Submit"); ?>" />

	</form>


text:
#define INI_BUFFERSIZE  256       /* maximum line length, maximum path length */

#include "MDD File System\fsio.h"
#include <string.h>

#define INI_FILETYPE                   FSFILE*
#define ini_openread(filename,file)    ((*(file) = FSfopen((filename),FS_READ)) != NULL)
#define ini_openwrite(filename,file)   ((*(file) = FSfopen((filename),FS_WRITE)) != NULL)
#define ini_openrewrite(filename,file) ((*(file) = fopen((filename),FS_READPLUS)) != NULL)
#define ini_close(file)                (FSfclose(*(file)) == 0)
#define ini_write(buffer,file)         (FSfwrite((buffer), 1, strlen(buffer), (*file)) > 0)
#define ini_remove(filename)           (FSremove((filename)) == 0)

#define INI_FILEPOS                    long int
#define ini_tell(file,pos)             (*(pos) = FSftell(*(file)))
#define ini_seek(file,pos)             (FSfseek(*(file), *(pos), SEEK_SET) == 0)

/* Since the Memory Disk Drive file system library reads only blocks of files,
 * the function to read a text line does so by "over-reading" a block of the
 * of the maximum size and truncating it behind the end-of-line.
 */
static int ini_read(char *buffer, int size, INI_FILETYPE *file)
{
  size_t numread = size;
  char *eol;

  if ((numread = FSfread(buffer, 1, size, *file)) == 0)
    return 0;                   /* at EOF */
  if ((eol = strchr(buffer, '\n')) == NULL)
    eol = strchr(buffer, '\r');
  if (eol != NULL) {
    /* terminate the buffer */
    *++eol = '\0';
    /* "unread" the data that was read too much */
    FSfseek(*file, - (int)(numread - (size_t)(eol - buffer)), SEEK_CUR);
  } /* if */
  return 1;
}

#ifndef INI_READONLY
static int ini_rename(const char *source, const char *dest)
{
  FSFILE* ftmp = FSfopen((source), FS_READ);
  FSrename((dest), ftmp);
  return FSfclose(ftmp) == 0;
}
#endif


text:
package net.coding.program;

import android.view.LayoutInflater;
import android.view.View;

import java.lang.reflect.Method;

/**
 * Created by chaochen on 14-10-22.
 */
public class FootUpdate {

    View mLayout;
    View mClick;
    View mLoading;

    public FootUpdate() {
    }

    public int getHigh() {
        if (mLayout == null) {
            return 0;
        }

        return mLayout.getHeight();
    }

    public void initToHead(Object listView, LayoutInflater inflater, final LoadMore loadMore) {
        View v = inflater.inflate(R.layout.listview_foot, null);

        // 为了防止触发listview的onListItemClick事件
        mLayout = v.findViewById(R.id.layout);
        mLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });

        mClick = v.findViewById(R.id.textView);
        mClick.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loadMore.loadMore();
                showLoading();
            }
        });

        mLoading = v.findViewById(R.id.progressBar);

        try {
            Method method = listView.getClass().getMethod("addHeaderView", View.class);
            method.invoke(listView, v);
        } catch (Exception e) {
            Global.errorLog(e);
        }

        mLayout.setVisibility(View.GONE);
    }

    public void init(Object listView, LayoutInflater inflater, final LoadMore loadMore) {
        View v = inflater.inflate(R.layout.listview_foot, null, false);

        // 为了防止触发listview的onListItemClick事件
        mLayout = v.findViewById(R.id.layout);
        mLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });

        mClick = v.findViewById(R.id.textView);
        mClick.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loadMore.loadMore();
                showLoading();
            }
        });

        mLoading = v.findViewById(R.id.progressBar);

        try {
            Method method = listView.getClass().getMethod("addFooterView", View.class);
            method.invoke(listView, v);
        } catch (Exception e) {
            Global.errorLog(e);
        }

        mLayout.setVisibility(View.GONE);
    }

    public void showLoading() {
        show(true, true);
    }

    public void showFail() {
        show(true, false);
    }

    public void dismiss() {
        show(false, true);
    }

    private void show(boolean show, boolean loading) {
        if (mLayout == null) {
            return;
        }

        if (show) {
            mLayout.setVisibility(View.VISIBLE);
            mLayout.setPadding(0, 0, 0, 0);
            if (loading) {
                mClick.setVisibility(View.INVISIBLE);
                mLoading.setVisibility(View.VISIBLE);
            } else {
                mClick.setVisibility(View.VISIBLE);
                mLoading.setVisibility(View.INVISIBLE);
            }
        } else {
            mLayout.setVisibility(View.INVISIBLE);
            mLayout.setPadding(0, -mLayout.getHeight(), 0, 0);
        }
    }

    public static interface LoadMore {
        public void loadMore();
    }
}


text:
package F::FailThrow;

use warnings;
use strict;
use parent 'F::Node';

sub desc {
    my $type = shift->{fail_type};
    return 'throw (fatal exception)' if $type eq 'throw';
    return 'fail (nonfatal exception)';
}

sub perl_fmt {
    my $fail = shift;
    my $exp  = $fail->first_child->perl_fmt_do;
    my $type = $fail->{fail_type};

    # if we're in a function or method, use _func.
    if ($fail->first_parent('Function')) {
        $type .= '_func';
    }

    return $type => {
        expression => $exp,
        pos => $fail->{create_pos}
    };
}

1


text:
{% extends '_base.html' %}

{% block controls %}

{{ i18n.t('admin.project.download_transcript') }}

{{ i18n.t('admin.project.import_transcript') }}

{{ i18n.t('admin.project.save_project') }}

			{% if project.status == 'pending' %}
{{ i18n.t('admin.project.save_and_activate') }}
{% endif %}

{% endblock %}

{% block main %}

{{ i18n.t('admin.project.project_admin') }}

		<form id="project_admin_form" name="project_admin_form" action="{{ project.url }}" method="POST">
			<input id="project_owner" name="project_owner" type="hidden" value="{{ project.owner }}" />
			<input id="project_slug" name="project_slug" type="hidden" value="{{ project.slug }}" />
			<input id="project_type" name="project_type" type="hidden" value="{{ project.type }}" />

{{ i18n.t('admin.project.basic_information') }}

					{{ i18n.t('admin.project.title') }}
					<input id="project_name" name="project_name" type="text" value="{{ project.title }}" />

					{{ i18n.t('admin.project.visibility') }}
					<select id="project_public" name="project_public">
						<option{% if project.public %} selected{% endif %} value="public">{{ i18n.t('admin.project.visibility.public') }}</option>
						<option{% if not project.public %} selected{% endif %} value="private">{{ i18n.t('admin.project.visibility.private') }}</option>
					</select>

					{{ i18n.t('admin.project.description') }}
					<textarea id="project_desc" name="project_desc">{{ project.description }}</textarea>

					{{ i18n.t('admin.project.language') }}
					<input id="project_lang" name="project_lang" type="text" value="{{ project.language }}" />

{{ i18n.t('admin.project.members') }}

					{% for member in members %}

×{{ member.username }}: {{ member.role }}

					{% endfor %}

						{{ i18n.t('admin.project.members.add_user') }}
						<input type="text" placeholder="{{ i18n.t('admin.project.members.username') }}" id="addmember-username" name="addmemberUsername" />
						<select id="addmember-role" name="addmemberRole">
							<option value="proofer">{{ i18n.t('admin.project.roles.proofer') }}</option>
							<option value="reviewer">{{ i18n.t('admin.project.roles.reviewer') }}</option>
							<option value="admin">{{ i18n.t('admin.project.roles.admin') }}</option>
						</select>

						<input type="submit" class="button light" value="{{ i18n.t('admin.project.members.add') }}" />

{{ i18n.t('admin.project.custom_item_fields') }}

					<textarea id="project_fields" name="project_fields" class="fields">{{ project.fields }}</textarea>

{{ i18n.t('admin.project.fields_instructions')|raw }}

{{ i18n.t('admin.project.status') }}

					<select id="project_status" name="project_status">
						<option{% if project.status == 'pending' %} selected{% endif %} value="pending">{{ i18n.t('admin.project.status.pending') }}</option>
						<option{% if project.status == 'active' %} selected{% endif %} value="active">{{ i18n.t('admin.project.status.active') }}</option>
						<option{% if project.status == 'completed' %} selected{% endif %} value="completed">{{ i18n.t('admin.project.status.completed') }}</option>
					</select>

{{ i18n.t('admin.project.workflow') }}

					<input id="project_workflow" name="project_workflow" type="text" value="{{ project.workflow }}" placeholder="@proofer, @proofer, @reviewer" />

{{ i18n.t('admin.project.characters') }}

					<textarea id="project_characters" name="project_characters">{% for entry in project.characters %}{{ entry }} {% endfor %}</textarea>

{{ i18n.t('admin.project.download_template') }}

					<textarea id="project_download_template" name="project_download_template">{{ project.downloadTemplate }}</textarea>

		</form>

{{ i18n.t('admin.project.items') }}

					{% for item in project.items %}

×{{ item.title }} {{ item.type }} • {{ item.status }}
						{% for proof in item.proofs %}

{{ i18n.t('admin.project.item.proofed_by', { "url": project.url ~ "/items/" ~ item.id ~ "/proof/" ~ proof.user, "user": proof.user, "date_completed": proof.date_completed })|raw }}

						{% endfor %}
						{% for review in item.reviews %}

{{ i18n.t('admin.project.item.reviewed_by', { "url": project.url ~ "/items/" ~ item.id ~ "/review/" ~ review.user, "user": review.user, "date_completed": review.date_completed })|raw }}

						{% endfor %}

					{% endfor %}

					<input id="file_upload" name="file_upload" type="file" />

{% endblock %}