text:
<?php
$data = row("select (select count(*) from spartacus_users) as counts, (select count(*) from spartacus_users where last_action + 900 >= unix_timestamp()) as logged ");
?>

Witaj!

	Witaj w świecie dzielnych gladiatorów!

 Stań w szranki i zdobądź chwałę na Arenie!!

	Zarejestrowanych: <?php echo $data->counts ?>

	Online:  <?php echo $data->logged ?>

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using SubSonic;
using SubSonic.Utilities;
namespace DalSic
{
    /// <summary>
    /// Controller class for PN_horarios_trabajo
    /// </summary>
    [System.ComponentModel.DataObject]
    public partial class PnHorariosTrabajoController
    {
        // Preload our schema..
        PnHorariosTrabajo thisSchemaLoad = new PnHorariosTrabajo();
        private string userName = String.Empty;
        protected string UserName
        {
            get
            {
				if (userName.Length == 0)
				{
    				if (System.Web.HttpContext.Current != null)
    				{
						userName=System.Web.HttpContext.Current.User.Identity.Name;
					}
					else
					{
						userName=System.Threading.Thread.CurrentPrincipal.Identity.Name;
					}
				}
				return userName;
            }
        }
        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public PnHorariosTrabajoCollection FetchAll()
        {
            PnHorariosTrabajoCollection coll = new PnHorariosTrabajoCollection();
            Query qry = new Query(PnHorariosTrabajo.Schema);
            coll.LoadAndCloseReader(qry.ExecuteReader());
            return coll;
        }
        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public PnHorariosTrabajoCollection FetchByID(object IdHorarioTrabajo)
        {
            PnHorariosTrabajoCollection coll = new PnHorariosTrabajoCollection().Where("id_horario_trabajo", IdHorarioTrabajo).Load();
            return coll;
        }

		[DataObjectMethod(DataObjectMethodType.Select, false)]
        public PnHorariosTrabajoCollection FetchByQuery(Query qry)
        {
            PnHorariosTrabajoCollection coll = new PnHorariosTrabajoCollection();
            coll.LoadAndCloseReader(qry.ExecuteReader());
            return coll;
        }
        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public bool Delete(object IdHorarioTrabajo)
        {
            return (PnHorariosTrabajo.Delete(IdHorarioTrabajo) == 1);
        }
        [DataObjectMethod(DataObjectMethodType.Delete, false)]
        public bool Destroy(object IdHorarioTrabajo)
        {
            return (PnHorariosTrabajo.Destroy(IdHorarioTrabajo) == 1);
        }

	    /// <summary>
	    /// Inserts a record, can be used with the Object Data Source
	    /// </summary>
        [DataObjectMethod(DataObjectMethodType.Insert, true)]
	    public void Insert(int IdDia,int IdUsuario,short? TrabajaSabado,short? TrabajaDomingo,string InicioHorario,string FinHorario)
	    {
		    PnHorariosTrabajo item = new PnHorariosTrabajo();

            item.IdDia = IdDia;

            item.IdUsuario = IdUsuario;

            item.TrabajaSabado = TrabajaSabado;

            item.TrabajaDomingo = TrabajaDomingo;

            item.InicioHorario = InicioHorario;

            item.FinHorario = FinHorario;

		    item.Save(UserName);
	    }

	    /// <summary>
	    /// Updates a record, can be used with the Object Data Source
	    /// </summary>
        [DataObjectMethod(DataObjectMethodType.Update, true)]
	    public void Update(int IdHorarioTrabajo,int IdDia,int IdUsuario,short? TrabajaSabado,short? TrabajaDomingo,string InicioHorario,string FinHorario)
	    {
		    PnHorariosTrabajo item = new PnHorariosTrabajo();
	        item.MarkOld();
	        item.IsLoaded = true;

			item.IdHorarioTrabajo = IdHorarioTrabajo;

			item.IdDia = IdDia;

			item.IdUsuario = IdUsuario;

			item.TrabajaSabado = TrabajaSabado;

			item.TrabajaDomingo = TrabajaDomingo;

			item.InicioHorario = InicioHorario;

			item.FinHorario = FinHorario;

	        item.Save(UserName);
	    }
    }
}


text:
package com.google.samples.apps.iosched.sync.userdata;

import android.content.Context;

import com.google.samples.apps.iosched.sync.userdata.gms.GMSUserDataSyncHelper;

/**
 * A simple factory to isolate the decision of which synchelper should be used.
 *
 * Currently, the HTTP sync helper is always returned, because of the early stage of
 * the GMS version. In the future, this can be changed.
 */
public class UserDataSyncHelperFactory {
    public static AbstractUserDataSyncHelper buildSyncHelper(Context context, String accountName) {
        return new GMSUserDataSyncHelper(context, accountName);
    }
}


text:
<?php

namespace Phanbook\Models;

class PostsTags extends ModelBase
{

    /**
     *
     * @var integer
     */
    protected $id;

    /**
     *
     * @var integer
     */
    protected $postsId;

    /**
     *
     * @var integer
     */
    protected $tagsId;

    /**
     * Method to set the value of field id
     *
     * @param  integer $id
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * Method to set the value of field postsId
     *
     * @param  integer $postsId
     * @return $this
     */
    public function setPostsId($postsId)
    {
        $this->postsId = $postsId;

        return $this;
    }

    /**
     * Method to set the value of field tagsId
     *
     * @param  integer $tagsId
     * @return $this
     */
    public function setTagsId($tagsId)
    {
        $this->tagsId = $tagsId;

        return $this;
    }

    /**
     * Returns the value of field id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Returns the value of field postsId
     *
     * @return integer
     */
    public function getPostsId()
    {
        return $this->postsId;
    }

    /**
     * Returns the value of field tagsId
     *
     * @return integer
     */
    public function getTagsId()
    {
        return $this->tagsId;
    }

    /**
     * Initialize method for model.
     */
    public function getSource()
    {
        return 'postsTags';
    }

    /**
     * Independent Column Mapping.
     */
    public function columnMap()
    {
        return array(
            'id' => 'id',
            'postsId' => 'postsId',
            'tagsId' => 'tagsId'
        );
    }
    public function initialize()
    {
        $this->belongsTo('postsId', __NAMESPACE__ .'/Posts', 'id', ['alias' => 'post']);
        $this->belongsTo('tagsId', __NAMESPACE__ .'/Tags', 'id', ['alias' => 'tag']);
    }
}


text:
Disecting the Bolt File
################################################################################

The ``boltfile.py`` is the main script used by Bolt to execute the tasks which
with it is invoked. The file contains the task definitions, as well as, the
configuration parameters for the tasks. If you haven't done so
yet, review the :doc:`Getting Started <getting_started>` guide to familiarize
your-self with a very basic example of a ``boltfile.py``. In this section, we
will look at more advanced examples to learn the different features of Bolt.

In essence, a Bolt File is just a |python|_ script. Within it, you can use the
Bolt API to define and configure the tasks you want to execute. You can name the
script whatever you want and place it in any location, but Bolt, by default,
will look in the current working directory for a file named ``boltfile.py`` and
use it if no other file is specified. This is the recommended way to work with
Bolt.

..  code-block:: powershell

    # Assumes boltfile.py in the current working directory.
    bolt task-to-execute

    # Uses specified file.
    bolt task-to-execute --bolt-file myboltfile.py

..  tip::

    You can run ``bolt --help`` to see Bolt's usage and supported arguments.

The Structure of a Bolt File
================================================================================

There are three distinct sections in a ``boltfile.py``. The first section, like
in any other |python|_ module is the imports, and your can bring in any module
you want.

The second part is the registration of tasks. This involves registering custom
task modules you want to use, as well as, defining custom tasks to create more
complex execution workflows.

The third section of the ``boltfile.py`` is the configuration. Every Bolt File
must declare a ``config`` variable set to a dictionary where the configuration
parameters are defined. The dictionary can be empty, but it is required to
define the variable. Of course, an empty dictionary will not help us to do
much.

The following shows the contents of the ``boltfile.py`` that we created in the
:doc:`Getting Started <getting_started>` guide  and illustrates the three
sections.

..  code-block:: Python

    # Imports section
    import bolt

    # Task registration section
    bolt.register_task('run-tests', ['pip', 'delete-pyc', 'nose'])

    # Configuration section
    config = {
        'pip': {
            'command': 'install',
            'options': {
                'r': 'requirements.txt'
            }
        },
        'delete-pyc': {
            'sourcedir': './source',
            'recursive': True
        },
        'nose': {
            'directory': 'tests'
        }
    }

..  tip::

    It doesn't make any difference if you include your configuration before the
    registration of tasks. As a matter of fact, I started doing it that way
    myself because of the experience I had with |grunt|_. But my experience has
    been that it makes the ``boltfile.py`` more readable if you register your
    tasks right after the imports, and users can see the tasks available
    immediately after opening the file. Overtime, your configuration will grow
    with the usage of Bolt and users will have to scroll all the way down to
    find the available tasks, which is, usually, the most important part of the
    file.

The Import Section
================================================================================

The import section of the ``boltfile.py`` is no different than the imports in any
other python script or module. You will always need to import ``bolt`` to gain
access to its API, which is used, among other things, to register tasks. You will
import and register other modules containing custom tasks. Finally, you can
import any other libraries you might need.

The Task Registration Section
================================================================================

There are different ways to define and register tasks with Bolt. In this section,
we will take a look at the different options and when we should use each one of
them.

Bolt Provided Tasks
-------------------

Bolt provides a set of tasks that are always available when executing Bolt. You
don't need to register them because Bolt does that for you, and they
can be configured without prior registration. This is the case for the tasks
shown in the following example, which we will use as starting point.

..  code-block:: Python

    import bolt

    config = {
        'pip': {
            'command': 'install',
            'options': {
                'r': 'requirements.txt'
            }
        },
        'delete-pyc': {
            'sourcedir': './source',
            'recursive': True
        },
        'nose': {
            'directory': 'tests'
        }
    }

The tasks in the example (``pip``, ``delete-pyc``, and ``nose``) are provided by
Bolt; therefore, we don't need to register them to use them. With this simple
example you can still run each task independently to execute them.

..  code-block:: powershell

    # Install requirements
    bolt pip

    # Delete existing .pyc files
    bolt delete-pyc

    # Execute unit tests
    bolt nose

As you can see, it is very easy to leverage the existing functionality in Bolt,
but the true power comes from the ability to define and create your own tasks
or use other tasks provided by tool and library implementers. Let's take a look
at other ways to define tasks.

Composing Tasks From Existing Ones
----------------------------------

In the example above, we can use any of the three tasks provided by Bolt, but
most of the time I will want to run all those tasks together. I want to make
sure that when anyone working on my project gets source changes they can have
the correct environment setup; therefore, I want them to install any required
packages, and execute the tests with a clean run. For that I can define a
composite task that will execute all three. The following shows the full contents
of the ``boltfile.py`` after adding the composite tasks.

..  code-block:: Python

    import bolt

    bolt.register_task('run-tests', ['pip', 'delete-pyc', 'nose'])
    bolt.register_task('default', ['run-tests'])

    config = {
        'pip': {
            'command': 'install',
            'options': {
                'r': 'requirements.txt'
            }
        },
        'delete-pyc': {
            'sourcedir': './source',
            'recursive': True
        },
        'nose': {
            'directory': 'tests'
        }
    }

We added two additional lines to our bolt file. The first one defines a
composite task ``run-tests`` that execute the previous three. The second line
registers a ``default`` task that executes the previously defined ``run-tests``.
Both of this tasks will execute the same set of steps.

Now, I can execute ``bolt run-tests`` from the command line to execute all tasks,
or I can simply call ``bolt``.

..  tip::

    The ``default`` task is a special task that gets executed when calling Bolt
    without specifying a task to execute. You should always provide a ``default``
    task in your ``boltfile.py``.

..  tip::

    You want your ``default`` task to be compose of the steps you will execute
    more often. I like to define ``default`` as the task that I will
    always execute when I pull new changes from my central repo and before
    publishing those changes, so I usually include steps to install new
    required packages, clean the project tree, and execute the unit tests.

Registering Additional Modules
------------------------------

As you start using Bolt more, you will find your-self implementing your own
custom tasks or using modules provided by third-party libraries you use (see
:doc:`Creating Custom Tasks <custom_tasks>` ).
In order to use those tasks, you need to import the module containing them and
register the module. The following example shows how can your register the tasks
in a custom or third-party provided module.

..  code-block:: Python

    # Removed contents for simplicity.
    import my_custom_tasks

    bolt.register_module_tasks(my_custom_tasks)

Now, all the tasks registered by ``my_custom_tasks`` become available for use
and configure (see :doc:`Creating Custom Tasks <custom_tasks>` for more
information about how to create your own).

The Power of Configuration
================================================================================

Bolt provides a very powerful configuration mechanism that abstracts what the
user wants to do from task implementers that expose configuration settings. This
means Bolt gives users the power to describe the configuration parameters of a
task, and it takes care of resolving the configuration before it is sent to the
task implementation, so that developers implementing tasks get a consistent set
of configuration options.

To illustrate how Bolt processes configuration options, I will describe a
scenario that I recently run into in one of my projects.

In a recent project, I found myself using the ``awscli`` and ``boto3`` libraries
available for |python|_. Without going too much into the details of what I was
doing, let's just say that I usually work on a Windows machine, but many of my
applications and scripts are executed in Linux; therefore, cross-platform it is
very important for my projects (and one of the reasons why I choose |python|_).

Turns out that when you use ``awscli`` and/or ``boto3`` in Windows, you need to
install an additional dependency called ``pypiwin32``. This dependency is not
installed nor can be installed on Linux, so that simple fact threw me out for a
few seconds on how I was going to manage the requirements for my project.
Thankfully, I had Bolt at my disposal and I was able to fix the problem in a
very simple, elegant way.

The first step was to add ``awscli`` and ``boto3`` to my ``requirements.txt``
file.

..  code-block:: text

    # In requirements.txt
    awscli>=1.11
    boto3>=1.4

Then, I created a second requirements file called ``requirements_win.txt`` and
added the Windows specific library.

..  code-block:: text

    # In requirements_win.txt
    pypiwin32>=219

I still want all the people collaborating in my code to have the correct set of
requirements, but I don't want them to have to worry about what they need to
install because we use bolt for that. So, this is what I did in my bolt file:

..  code-block:: Python

    # Many lines removed for simplicity.

    import bolt
    import sys

    # Define a task to install the requirements.
    if sys.platform.startswith('win'):
        bolt.register_task('requirements', ['pip', 'pip.win']) # More on this below.
    else:
        bolt.register_task('requirements', ['pip'])

    bolt.register_task('run-tests', ['requirements', 'delete-pyc', 'nose'])
    bolt.register_task('default', ['run-tests'])

    config = {
        'pip': {
            'command': 'install',
            'options': {
                'r': 'requirements.txt'
            },
            'win': {
                'options': {
                    'r': 'requirements_win.txt'
                }
            }
        },
    }

This may seem more complicated than it really is once you understand how Bolt
processes configurations, so let's take a look at it step by step.

The first change I made was to check for the OS in which we are running and
register a ``requirements`` task to install the requirements accordingly. Since,
the ``boltfile.py`` is just a |python|_ script, I can import ``sys`` and create
conditional code if I want to.

Now, let's take a look at what I do on Windows because it is something we haven't
seen yet ``bolt.register_task('requirements', ['pip', 'pip.win']). What is this
``pip.win`` thing?

There might be times when I want to configure a task differently depending on the
environment I'm running (I will show another example later, but this is so cool
that we will expain it first). In those circumstances, instead of providing a
completely different ``boltfile.py`` with a different configuration, Bolt allows
me to nest configuration options that I name my self.

The ``pip`` task knows nothing about the ``win`` option specified, and it doesn't
have to worry about it, but when the ``pip`` task is invoked as ``pip.win``, Bolt
takes the configuration options for ``pip`` and then adds or overwrites any
options defined in the nested ``win`` configuration. Therefore, the configuration
passed to the ``pip`` task when called as ``pip.win`` will look like the following:

..  code-block:: Python

    config = {
        'commmand': 'install',  # Taken from parent
        'options': {
            'r': 'requirements_win.txt'
        }
    }

When the task is invoked as ``pip``, the configuration passed is:

..  code-block:: Python

    config = {
        'commmand': 'install',  # Taken from parent
        'options': {
            'r': 'requirements.txt'
        }
    }

In the registration of the ``requirements`` task for Windows, we execute both,
where if we run on Linux we just execute ``pip``.

..  tip::

    You can nest configurations as deep as you want, so it will be possible to
    define tasks as ``pip.win.32`` and ``pip.win.64`` if needed. In my experience,
    one level of nesting is what you will need for most practical cases, and it
    keeps the configuration readable.

A More Common Configuration Example
-----------------------------------

The previous example is pretty cool, and it solve a very real problem, but most
of the time you will not need or want to have a lot of conditional code in your
``boltfile.py``. The following scenario illustrates a more common approach to
define and configure tasks differently for different environments.

Many times I find my self wanting to execute a task differently when I run it in
my local development environment than when that task is running in the CI/CD
pipeline for my project. A very common scenario for all my projects is that when
I run the unit tests locally, which I do all the time, I run them with bare
options, so I configure the task in the same way as the examples above.

During the build process, however, I want to get more information about the
execution of the tests, and I want to produce some reports and post them to my
CI/CD system. Usually, I want a tests results report, and a code coverage
report. The following shows the tasks I normally register and configure to
execute the unit tests in the different environments.

..  code-block:: Python

    # Lines omitted for simplicity.

    # Developer's tasks. I like to keep the names short, to type less when
    # I run them.
    #
    bolt.register_task('ut', ['pip', 'delete-pyc', 'nose'])

    # Ci/CD Tasks
    #
    bolt.register_task('run-tests', ['pip', 'nose.ci'])

    config = {
        # Again, lines omitted for simplicity.

        'nose': {
            'directory': './tests',
            'ci': {
                'options': {
                    'with-xunit': True,
                    'xunit-file': os.path.join('output', 'unit_tests_log.xml'),
                    'with-coverage': True,
                    'cover-erase': True,
                    'cover-package': './source',
                    'cover-branches': True,
                    'cover-html': True,
                    'cover-html-dir': os.path.join('output', 'coverage')
                }
            }
        }
    }

When I'm working on the project, I execute ``bolt ut``, which does all the
operations I want in my local development environment. In CI/CD, I execute
``bolt run-tests``, which runs different tasks, but I want you to focus on the
different options that I use with ``nose``.

Without using any conditional code in the ``boltfile.py` itself, I can run
``nose`` in different ways by specifying a nested configuration ``ci``.

..  tip::

    If you look at the options set for ``nose.ci``, you can see that I use
    ``os.path.join()`` to resolve the location where reports will be generated.
    This illustrates the power of configuration as code.


text:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>WASM Test</title>
</head>
<body>
<script>

    async function init() {
        let data = await fetch("./bin/test.wasm");
        let wasmBytes = await data.arrayBuffer();
        try {
            WebAssembly.compile(wasmBytes).then(function (compiled) {
                window.exports = new WebAssembly.Instance(compiled).exports;
                let foo = exports.newFoo(1.1);
                console.log(exports.getA(foo));
                exports.destroyFoo(foo);
                console.log("WASM Compiled!");
            })

        } catch (e) {
            console.error(e);
        }
    }

    init();
</script>
</body>
</html>


text:
package org.xutils.sample.http;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.http.annotation.HttpRequest;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wyouflf on 16/1/23.
 */
@HttpRequest(
        host = JsonDemoParamsBuilder.SEEVER_A,
        path = "query/test",
        builder = JsonDemoParamsBuilder.class
)
public class JsonDemoParams extends RequestParams {

    public String paramStr;

    public int paramInt;

    public List<String> paramList;

    // 发送请求的示例
    // 参数被JsonDemoParamsBuilder重新加工成json的形式发送.
    // 示例项目的混淆配置会使这个类的字段不被混淆, 字段名作为参数名.
    public static Callback.Cancelable send(Callback.CommonCallback<BaiduResponse> callback) {
        JsonDemoParams params = new JsonDemoParams();
        params.paramStr = "test";
        params.paramInt = 10;
        params.paramList = new ArrayList<String>();
        params.paramList.add("test");
        return x.http().post(params, callback);
    }
}


text:
package mezz.jei.common.plugins.vanilla.ingredients.item;

import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.ingredients.IIngredientHelper;
import mezz.jei.api.ingredients.IIngredientType;
import mezz.jei.api.ingredients.subtypes.UidContext;
import mezz.jei.common.color.ColorGetter;
import mezz.jei.common.platform.IPlatformItemStackHelper;
import mezz.jei.common.platform.IPlatformRegistry;
import mezz.jei.common.platform.Services;
import mezz.jei.common.util.ErrorUtil;
import mezz.jei.common.util.StackHelper;
import mezz.jei.common.util.TagUtil;
import net.minecraft.core.Registry;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;

import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Optional;

public class ItemStackHelper implements IIngredientHelper<ItemStack> {
	private final StackHelper stackHelper;

	public ItemStackHelper(StackHelper stackHelper) {
		this.stackHelper = stackHelper;
	}

	@Override
	public IIngredientType<ItemStack> getIngredientType() {
		return VanillaTypes.ITEM_STACK;
	}

	@Override
	public String getDisplayName(ItemStack ingredient) {
		Component displayNameTextComponent = ingredient.getHoverName();
		String displayName = displayNameTextComponent.getString();
		ErrorUtil.checkNotNull(displayName, "itemStack.getDisplayName()");
		return displayName;
	}

	@Override
	public String getUniqueId(ItemStack ingredient, UidContext context) {
		ErrorUtil.checkNotEmpty(ingredient);
		return stackHelper.getUniqueIdentifierForStack(ingredient, context);
	}

	@Override
	public String getWildcardId(ItemStack ingredient) {
		ErrorUtil.checkNotEmpty(ingredient);
		return StackHelper.getRegistryNameForStack(ingredient);
	}

	@Override
	public String getDisplayModId(ItemStack ingredient) {
		ErrorUtil.checkNotEmpty(ingredient);

		IPlatformItemStackHelper itemStackHelper = Services.PLATFORM.getItemStackHelper();
		String modId = itemStackHelper.getCreatorModId(ingredient);
		if (modId == null) {
			IPlatformRegistry<Item> registry = Services.PLATFORM.getRegistry(Registry.ITEM_REGISTRY);
			ResourceLocation registryName = registry.getRegistryName(ingredient.getItem());
			if (registryName == null) {
				String stackInfo = getErrorInfo(ingredient);
				throw new IllegalStateException("null registryName for: " + stackInfo);
			}
			modId = registryName.getNamespace();
		}
		return modId;
	}

	@Override
	public Iterable<Integer> getColors(ItemStack ingredient) {
		return ColorGetter.getColors(ingredient, 2);
	}

	@Override
	public ResourceLocation getResourceLocation(ItemStack ingredient) {
		ErrorUtil.checkNotEmpty(ingredient);

		Item item = ingredient.getItem();
		IPlatformRegistry<Item> itemRegistry = Services.PLATFORM.getRegistry(Registry.ITEM_REGISTRY);
		ResourceLocation name = itemRegistry.getRegistryName(item);
		if (name == null) {
			String stackInfo = getErrorInfo(ingredient);
			throw new IllegalStateException("item.getRegistryName() returned null for: " + stackInfo);
		}

		return name;
	}

	@Override
	public ItemStack getCheatItemStack(ItemStack ingredient) {
		return ingredient;
	}

	@Override
	public ItemStack copyIngredient(ItemStack ingredient) {
		return ingredient.copy();
	}

	@Override
	public ItemStack normalizeIngredient(ItemStack ingredient) {
		ItemStack copy = ingredient.copy();
		copy.setCount(1);
		return copy;
	}

	@Override
	public boolean isValidIngredient(ItemStack ingredient) {
		return !ingredient.isEmpty();
	}

	@Override
	public boolean isIngredientOnServer(ItemStack ingredient) {
		Item item = ingredient.getItem();
		IPlatformRegistry<Item> registry = Services.PLATFORM.getRegistry(Registry.ITEM_REGISTRY);
		return registry.contains(item);
	}

	@Override
	public Collection<ResourceLocation> getTags(ItemStack ingredient) {
		return TagUtil.getTags(ingredient.getTags());
	}

	@Override
	public Collection<String> getCreativeTabNames(ItemStack ingredient) {
		Collection<String> creativeTabsStrings = new ArrayList<>();
		IPlatformItemStackHelper itemStackHelper = Services.PLATFORM.getItemStackHelper();
		for (CreativeModeTab itemGroup : itemStackHelper.getCreativeTabs(ingredient)) {
			if (itemGroup != null) {
				String creativeTabName = itemGroup.getDisplayName().getString();
				creativeTabsStrings.add(creativeTabName);
			}
		}
		return creativeTabsStrings;
	}

	@Override
	public String getErrorInfo(@Nullable ItemStack ingredient) {
		return ErrorUtil.getItemStackInfo(ingredient);
	}

	@Override
	public Optional<ResourceLocation> getTagEquivalent(Collection<ItemStack> ingredients) {
		return TagUtil.getTagEquivalent(ingredients, ItemStack::getItem, Registry.ITEM::getTags);
	}
}


text:
package oshi.util.platform.windows;

import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeoutException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sun.jna.platform.win32.Ole32;
import com.sun.jna.platform.win32.WinError;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.platform.win32.COM.COMException;
import com.sun.jna.platform.win32.COM.COMUtils;
import com.sun.jna.platform.win32.COM.Wbemcli;
import com.sun.jna.platform.win32.COM.WbemcliUtil;

import oshi.annotation.concurrent.ThreadSafe;
import oshi.util.GlobalConfig;

/**
 * Utility to handle WMI Queries. Designed to be extended with user-customized
 * behavior.
 */
@ThreadSafe
public class WmiQueryHandler {

    private static final Logger LOG = LoggerFactory.getLogger(WmiQueryHandler.class);

    private static int globalTimeout = GlobalConfig.get(GlobalConfig.OSHI_UTIL_WMI_TIMEOUT, -1);

    static {
        if (globalTimeout == 0 || globalTimeout < -1) {
            throw new GlobalConfig.PropertyException(GlobalConfig.OSHI_UTIL_WMI_TIMEOUT);
        }
    }

    // Timeout for WMI queries
    protected int wmiTimeout = globalTimeout;

    // Cache failed wmi classes
    protected final Set<String> failedWmiClassNames = new HashSet<>();

    // Preferred threading model
    private int comThreading = Ole32.COINIT_MULTITHREADED;

    // Track initialization of Security
    private boolean securityInitialized = false;

    private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
    private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];

    // Factory to create this or a subclass
    private static Class<? extends WmiQueryHandler> customClass = null;

    /**
     * Factory method to create an instance of this class. To override this class,
     * use {@link #setInstanceClass(Class)} to define a subclass which extends
     * {@link oshi.util.platform.windows.WmiQueryHandler}.
     *
     * @return An instance of this class or a class defined by
     *         {@link #setInstanceClass(Class)}
     */
    public static synchronized WmiQueryHandler createInstance() {
        if (customClass == null) {
            return new WmiQueryHandler();
        }
        try {
            return customClass.getConstructor(EMPTY_CLASS_ARRAY).newInstance(EMPTY_OBJECT_ARRAY);
        } catch (NoSuchMethodException | SecurityException e) {
            LOG.error("Failed to find or access a no-arg constructor for {}", customClass);
        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
                | InvocationTargetException e) {
            LOG.error("Failed to create a new instance of {}", customClass);
        }
        return null;
    }

    /**
     * Define a subclass to be instantiated by {@link #createInstance()}. The class
     * must extend {@link oshi.util.platform.windows.WmiQueryHandler}.
     *
     * @param instanceClass
     *            The class to instantiate with {@link #createInstance()}.
     */
    public static synchronized void setInstanceClass(Class<? extends WmiQueryHandler> instanceClass) {
        customClass = instanceClass;
    }

    /**
     * Query WMI for values. Makes no assumptions on whether the user has previously
     * initialized COM.
     *
     * @param <T>
     *            WMI queries use an Enum to identify the fields to query, and use
     *            the enum values as keys to retrieve the results.
     * @param query
     *            A WmiQuery object encapsulating the namespace, class, and
     *            properties
     * @return a WmiResult object containing the query results, wrapping an EnumMap
     */
    public <T extends Enum<T>> WbemcliUtil.WmiResult<T> queryWMI(WbemcliUtil.WmiQuery<T> query) {
        return queryWMI(query, true);
    }

    /**
     * Query WMI for values.
     *
     * @param <T>
     *            WMI queries use an Enum to identify the fields to query, and use
     *            the enum values as keys to retrieve the results.
     * @param query
     *            A WmiQuery object encapsulating the namespace, class, and
     *            properties
     * @param initCom
     *            Whether to initialize COM. If {@code true}, initializes COM before
     *            the query and uninitializes after. If {@code false}, assumes the
     *            user has initialized COM separately. This can improve WMI query
     *            performance.
     * @return a WmiResult object containing the query results, wrapping an EnumMap
     */
    public <T extends Enum<T>> WbemcliUtil.WmiResult<T> queryWMI(WbemcliUtil.WmiQuery<T> query, boolean initCom) {
        WbemcliUtil.WmiResult<T> result = WbemcliUtil.INSTANCE.new WmiResult<>(query.getPropertyEnum());
        if (failedWmiClassNames.contains(query.getWmiClassName())) {
            return result;
        }
        boolean comInit = false;
        try {
            if (initCom) {
                comInit = initCOM();
            }
            result = query.execute(wmiTimeout);
        } catch (COMException e) {
            // Ignore any exceptions with OpenHardwareMonitor
            if (!WmiUtil.OHM_NAMESPACE.equals(query.getNameSpace())) {
                final int hresult = e.getHresult() == null ? -1 : e.getHresult().intValue();
                switch (hresult) {
                case Wbemcli.WBEM_E_INVALID_NAMESPACE:
                    LOG.warn("COM exception: Invalid Namespace {}", query.getNameSpace());
                    break;
                case Wbemcli.WBEM_E_INVALID_CLASS:
                    LOG.warn("COM exception: Invalid Class {}", query.getWmiClassName());
                    break;
                case Wbemcli.WBEM_E_INVALID_QUERY:
                    LOG.warn("COM exception: Invalid Query: {}", WmiUtil.queryToString(query));
                    break;
                default:
                    handleComException(query, e);
                    break;
                }
                failedWmiClassNames.add(query.getWmiClassName());
            }
        } catch (TimeoutException e) {
            LOG.warn("WMI query timed out after {} ms: {}", wmiTimeout, WmiUtil.queryToString(query));
        } finally {
            if (comInit) {
                unInitCOM();
            }
        }
        return result;
    }

    /**
     * COM Exception handler. Logs a warning message.
     *
     * @param query
     *            a {@link com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery}
     *            object.
     * @param ex
     *            a {@link com.sun.jna.platform.win32.COM.COMException} object.
     */
    protected void handleComException(WbemcliUtil.WmiQuery<?> query, COMException ex) {
        LOG.warn(
                "COM exception querying {}, which might not be on your system. Will not attempt to query it again. Error was {}: {}",
                query.getWmiClassName(), ex.getHresult() == null ? null : ex.getHresult().intValue(), ex.getMessage());
    }

    /**
     * Initializes COM library and sets security to impersonate the local user
     *
     * @return True if COM was initialized and needs to be uninitialized, false
     *         otherwise
     */
    public boolean initCOM() {
        boolean comInit = false;
        // Step 1: --------------------------------------------------
        // Initialize COM. ------------------------------------------
        comInit = initCOM(getComThreading());
        if (!comInit) {
            comInit = initCOM(switchComThreading());
        }
        // Step 2: --------------------------------------------------
        // Set general COM security levels --------------------------
        if (comInit && !isSecurityInitialized()) {
            WinNT.HRESULT hres = Ole32.INSTANCE.CoInitializeSecurity(null, -1, null, null,
                    Ole32.RPC_C_AUTHN_LEVEL_DEFAULT, Ole32.RPC_C_IMP_LEVEL_IMPERSONATE, null, Ole32.EOAC_NONE, null);
            // If security already initialized we get RPC_E_TOO_LATE
            // This can be safely ignored
            if (COMUtils.FAILED(hres) && hres.intValue() != WinError.RPC_E_TOO_LATE) {
                Ole32.INSTANCE.CoUninitialize();
                throw new COMException("Failed to initialize security.", hres);
            }
            securityInitialized = true;
        }
        return comInit;
    }

    /**
     * Initializes COM with a specific threading model
     *
     * @param coInitThreading
     *            The threading model
     * @return True if COM was initialized and needs to be uninitialized, false
     *         otherwise
     */
    protected boolean initCOM(int coInitThreading) {
        WinNT.HRESULT hres = Ole32.INSTANCE.CoInitializeEx(null, coInitThreading);
        switch (hres.intValue()) {
        // Successful local initialization (S_OK) or was already initialized
        // (S_FALSE) but still needs uninit
        case COMUtils.S_OK:
        case COMUtils.S_FALSE:
            return true;
        // COM was already initialized with a different threading model
        case WinError.RPC_E_CHANGED_MODE:
            return false;
        // Any other results is impossible
        default:
            throw new COMException("Failed to initialize COM library.", hres);
        }
    }

    /**
     * UnInitializes COM library. This should be called once for every successful
     * call to initCOM.
     */
    public void unInitCOM() {
        Ole32.INSTANCE.CoUninitialize();
    }

    /**
     * Returns the current threading model for COM initialization, as OSHI is
     * required to match if an external program has COM initialized already.
     *
     * @return The current threading model
     */
    public int getComThreading() {
        return comThreading;
    }

    /**
     * Switches the current threading model for COM initialization, as OSHI is
     * required to match if an external program has COM initialized already.
     *
     * @return The new threading model after switching
     */
    public int switchComThreading() {
        if (comThreading == Ole32.COINIT_APARTMENTTHREADED) {
            comThreading = Ole32.COINIT_MULTITHREADED;
        } else {
            comThreading = Ole32.COINIT_APARTMENTTHREADED;
        }
        return comThreading;
    }

    /**
     * Security only needs to be initialized once. This boolean identifies whether
     * that has happened.
     *
     * @return Returns the securityInitialized.
     */
    public boolean isSecurityInitialized() {
        return securityInitialized;
    }

    /**
     * Gets the current WMI timeout. WMI queries will fail if they take longer than
     * this number of milliseconds. A value of -1 is infinite (no timeout).
     *
     * @return Returns the current value of wmiTimeout.
     */
    public int getWmiTimeout() {
        return wmiTimeout;
    }

    /**
     * Sets the WMI timeout. WMI queries will fail if they take longer than this
     * number of milliseconds.
     *
     * @param wmiTimeout
     *            The wmiTimeout to set, in milliseconds. To disable timeouts, set
     *            timeout as -1 (infinite).
     */
    public void setWmiTimeout(int wmiTimeout) {
        this.wmiTimeout = wmiTimeout;
    }
}


text:
@interface PodsDummy_Pods_SunnyNavigation_Example : NSObject
@end
@implementation PodsDummy_Pods_SunnyNavigation_Example
@end


text:
package edu.towson.cis.cosc455.mleroy1.project1.tokens;

import edu.towson.cis.cosc455.MLeRoy.project1.interfaces.Legaltoken;

public class TEXT implements Legaltoken{
	public final static String text="ABCDEFGHIJKLMNOPQRSTUVWXYZ,.':?_!/0123456789";

	@Override
	public boolean legal(String x) {
		for(int i=0; i<text.length();i++){
			if(x.equalsIgnoreCase(text.substring(i, i+1)))
				return true;
		}
		return false;
	}

	public String html(boolean open) {
		return "";
	}
}


text:
package org.firstglobal.teamcode.configurations;

import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;

import org.firstglobal.FgCommon.RobotConfiguration;
import org.firstinspires.ftc.robotcore.external.Telemetry;

/**
 * It is assumed that there is a configuration that is currently activated on the robot controller
 * (run menu / Configure Robot ) with the same name as this class.
 * It is also assumed that the device names in the 'init()' method below are the same as the devices
 * named on the activated configuration on the robot.
 */
public class MotorAndServoRobot extends RobotConfiguration {

    //motors
    public DcMotor motor0;
    public Servo servo0;
    //use the below instead when configuring a Continuous Rotation Servo
    //public CRServo serv0;

    /**
     * Assign your class instance variables to the saved device names in the hardware map
     *
     * @param hardwareMap
     * @param telemetry
     */
    @Override
    protected void init(HardwareMap hardwareMap, Telemetry telemetry) {

        setTelemetry(telemetry);

        servo0 = (Servo) getHardwareOn("servo0", hardwareMap.servo);
        //use the below instead when configuring a Continuous Rotation Servo
        //servo0 = (CRServo) getHardwareOn("servo1", hardwareMap.crservo);

        motor0 = (DcMotor) getHardwareOn("motor0", hardwareMap.dcMotor);

    }

    /**
     * Factory method for this class
     *
     * @param hardwareMap
     * @param telemetry
     * @return
     */
    public static MotorAndServoRobot newConfig(HardwareMap hardwareMap, Telemetry telemetry) {

        MotorAndServoRobot config = new MotorAndServoRobot();
        config.init(hardwareMap, telemetry);
        return config;

    }

}


text:
<?php defined('BX_DOL') or die('hack attempt');

require_once('BxCreditsGridOrdersAdministration.php');

class BxCreditsGridOrdersCommon extends BxCreditsGridOrdersAdministration
{
    public function __construct ($aOptions, $oTemplate = false)
    {
        parent::__construct ($aOptions, $oTemplate);
    }

    protected function _getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
    {
        if(empty($this->_iUserId))
            return [];

        $this->_aOptions['source'] .= $this->_oModule->_oDb->prepareAsString(" AND `to`.`profile_id`=?", $this->_iUserId);

        return parent::_getDataSql($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
    }
}

/** @} */


text:
from __future__ import absolute_import

class SparkModel(object):
    pass


text:
/*
 * This is a basic func test for a Common application.
 */
YUI({
    useConsoleOutput: true,
    useBrowserConsole: true,
    logInclude: { TestRunner: true }
}).use('node', 'node-event-simulate', 'test', 'console', function (Y) {

    var suite = new Y.Test.Suite("Common: compositemojit1server");

    suite.add(new Y.Test.Case({

	    "test compositemojit1server": function() {
	        var that = this;
            Y.one('#nav_h3').simulate('click');
	        that.wait(function(){
		        Y.Assert.areEqual('news heard a click from nav \(type\: CM_Nav\) with the data\:', Y.one('#click1').get('innerHTML').match(/news heard a click from nav \(type\: CM_Nav\) with the data\:/gi));
		        Y.Assert.areEqual('Hi News!', Y.one('#click1').get('innerHTML').match(/Hi News!/gi));
		        Y.one('#nav_h3').simulate('click');
		        that.wait(function(){
			        Y.Assert.areEqual('news heard a click from nav \(type\: CM_Nav\) with the data\:', Y.one('#click2').get('innerHTML').match(/news heard a click from nav \(type\: CM_Nav\) with the data\:/gi));
			        Y.Assert.areEqual('Hi News!', Y.one('#click1').get('innerHTML').match(/Hi News!/gi));
		         }, 4000);
	        }, 4000);
        }

   }));

   Y.Test.Runner.add(suite);

});


text:
package org.quickbundle.base.beans;

import java.util.List;

import org.quickbundle.tools.context.RmBeanHelper;
import org.springframework.dao.OptimisticLockingFailureException;

public class NumberIncrementService {

	public long initIdPool(TableIdRuleVo ruleVo, long blocksize) {
		long oldId;
		List<Long> oldPoolLastIds = RmBeanHelper.getCommonServiceInstance().queryForList("select LAST_ID from RM_ID_POOL where ID=?",
				new String[] { ruleVo.getTableName() }, Long.class);
		if(oldPoolLastIds.size() == 0) {
			oldId = getMaxIdFromTable(ruleVo);
		} else {
			oldId = oldPoolLastIds.get(0).longValue();
		}
		long newPoolLastId = oldId + blocksize;
		if(oldPoolLastIds.size() == 0) {
			RmBeanHelper.getCommonServiceInstance().doUpdate("insert into RM_ID_POOL (ID, VERSION, LAST_ID) values(?, ?, ?)",
					new Object[] { ruleVo.getTableName(), 1, newPoolLastId });
		} else {
			int updateCount = RmBeanHelper.getCommonServiceInstance().doUpdate("update RM_ID_POOL set LAST_ID=?, VERSION=VERSION+1 where ID=? and LAST_ID=?",
					new Object[] { newPoolLastId, ruleVo.getTableName(),  oldPoolLastIds.get(0) });
			if(updateCount == 0) {
				throw new OptimisticLockingFailureException("can not update lastId that read this time: " + ruleVo.getTableName());
			}
		}
		return oldId;
	}

	private long getMaxIdFromTable(TableIdRuleVo ruleVo) {
		StringBuilder sql = new StringBuilder();
		sql.append("select max(");
		sql.append(ruleVo.getIdName());
		sql.append(") max_id from ");
		sql.append(ruleVo.getTableName());
		List<Long> maxIdObjs = RmBeanHelper.getCommonServiceInstance().queryForList(sql.toString(), Long.class);
		long maxId;
		if (maxIdObjs.size() == 0 || maxIdObjs.get(0) == null) {
			maxId = 0;
		} else {
			maxId = maxIdObjs.get(0).longValue();
		}
		maxId++;
		return maxId;
	}

	public long acquireId(TableIdRuleVo ruleVo, long blocksize) {
		List<Long> oldPoolLastIds = RmBeanHelper.getCommonServiceInstance().queryForList("select LAST_ID from RM_ID_POOL where ID=?",
				new String[] { ruleVo.getTableName() }, Long.class);
		long newPoolLastId = oldPoolLastIds.get(0) + blocksize;
		int updateCount = RmBeanHelper.getCommonServiceInstance().doUpdate("update RM_ID_POOL set LAST_ID=?, VERSION=VERSION+1 where ID=? and LAST_ID=?",
				new Object[] { newPoolLastId, ruleVo.getTableName(), oldPoolLastIds.get(0) });
		if (updateCount == 0) {
			throw new OptimisticLockingFailureException("can not update lastId that read this time: " + ruleVo.getTableName());
		}
		return oldPoolLastIds.get(0).longValue();
	}
}


text:
package jkanvas.util;

import static org.junit.Assert.*;

import org.junit.Test;

/**
 * Tests the integrity of the known {@link Interpolator} implementations.
 *
 * @author Joschi <josua.krause@gmail.com>
 */
public class InterpolatorTest {

  /**
   * Tests the inverse interpolation of the given {@link Interpolator}.
   *
   * @param pol The interpolator.
   */
  private static void testInverse(final Interpolator pol) {
    for(double t = 0; t < 1; t += 1e-5) {
      assertEquals(t, pol.inverseInterpolate(pol.interpolate(t)), 1e-3);
      assertEquals(t, pol.interpolate(pol.inverseInterpolate(t)), 1e-3);
    }
    assertEquals(1.0, pol.inverseInterpolate(pol.interpolate(1)), 1e-3);
    assertEquals(1.0, pol.interpolate(pol.inverseInterpolate(1)), 1e-3);
  }

  /**
   * Tests the inverse interpolation of known {@link Interpolator}
   * implementations.
   */
  @Test
  public void testInverse() {
    testInverse(Interpolator.LINEAR);
    testInverse(Interpolator.SMOOTH);
    testInverse(Interpolator.SLOW_IN_OUT);
    testInverse(Interpolator.QUAD_IN_OUT);
    testInverse(Interpolator.LOG);
    testInverse(Interpolator.SQRT);
  }

  /**
   * Tests start and end points.
   *
   * @param pol The interpolation.
   */
  private static void testStartEnd(final Interpolator pol) {
    assertEquals(0, pol.interpolate(0), 1e-3);
    assertEquals(1, pol.interpolate(1), 1e-3);
  }

  /** Checks whether start and end points are interpolated correctly. */
  @Test
  public void testStartEnd() {
    testStartEnd(Interpolator.LINEAR);
    testStartEnd(Interpolator.SMOOTH);
    testStartEnd(Interpolator.SLOW_IN_OUT);
    testStartEnd(Interpolator.QUAD_IN_OUT);
    testStartEnd(Interpolator.LOG);
    testStartEnd(Interpolator.SQRT);
  }

}