text:
/*
 * crane-domain.c by @nieltg
 */

#include "crane-domain.h"

struct _CraneDomainPrivate
{
	gchar * path;
	int pid_fd;

	GList * bundles;        // deprecated!
};

/*
 * NOTE: CraneDomainPrivate.bundles is deprecated!
 *
 * There IS NOT ANY bundle-obj, but there IS bundle-tool.
 * Bundle-tool can be instanced by domain or user, but to be usable,
 * it should be associated with domain. Domain will ONLY create bundle-
 * tool if it's needed. Associated bundle-tool is registered, another
 * bundle-tool can't register with same bundle-id in a domain.
 *
 * void crane_bundle_handle (CraneBundle * self, CraneDomain * domain, gchar * bundle_id);
 * boolean _crane_domain_associate (CraneDomain * self, CraneBundle * self);
 *
 * - crane_bundle_handle sets "domain" and "bundle-id" properties.
 * - crane_bundle_handle calls _crane_domain_associate to get GFile.
 * - _crane_domain_associate stores CraneBundle uniquely by bundle-id, if fail, return null.
 * - crane_bundle_handle set "file" prop (if can) and return.
 */

enum
{
	PROP_0,
	PROP_PATH,
	PROP_IS_ACQUIRED,
	LAST_PROP
}

static GParamSpec * properties[LAST_PROP];

enum
{
	BUNDLE_INSTALLED,
	BUNDLE_REMOVED,
	BUNDLE_STARTED,
	BUNDLE_STOPPED,
	LAST_SIGNAL
};

static guint signals[LAST_SIGNAL];

G_DEFINE_TYPE_WITH_PRIVATE (CraneDomain, crane_domain, G_TYPE_OBJECT)

static void
crane_domain_get_property (GObject    * object,
                           guint        prop_id,
                           GValue     * value,
                           GParamSpec * pspec)
{
	CraneDomain * self = CRANE_DOMAIN (object);

	switch (prop_id)
	{
	case PROP_PATH:
		g_value_dup_string (value,
		                    self->_priv->path);
		break;

	case PROP_IS_ACQUIRED:
		g_value_set_boolean (value,
		                     crane_domain_is_acquired (self));
		break;

	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
crane_domain_set_property (GObject    * object,
                           guint        prop_id,
                           GValue     * value,
                           GParamSpec * pspec)
{
	CraneDomain * self = CRANE_DOMAIN (object);

	switch (prop_id)
	{
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
crane_domain_dispose (GObject * obj)
{
	CraneDomain * self = CRANE_DOMAIN (obj);

	crane_domain_release (self, NULL);

	G_OBJECT_CLASS (crane_domain_parent_class)->dispose (obj);
}

static void
crane_domain_finalize (GObject * obj)
{
	CraneDomain * self = CRANE_DOMAIN (obj);

	g_clear_pointer (&self->_priv->bundles, g_hash_table_unref);

	G_OBJECT_CLASS (crane_domain_parent_class)->finalize (obj);
}

static void
crane_domain_class_init (CraneDomainClass * klass)
{
	GObjectClass * object_class = (GObjectClass *) klass;

	object_class->dispose = crane_domain_dispose;
	object_class->finalize = crane_domain_finalize;
	object_class->get_property = crane_domain_get_property;
	object_class->set_property = crane_domain_set_property;

	properties[PROP_PATH] =
		g_param_spec_string ("path",
		                     "Path",
		                     "Path to domain",
		                     NULL,
		                     G_PARAM_READONLY | G_PARAM_STATIC_STRINGS);
	properties[PROP_IS_ACQUIRED] =
		g_param_spec_boolean ("is-acquired",
		                      "Is Acquired",
		                      "Is domain acquired",
		                      NULL,
		                      G_PARAM_READONLY | G_PARAM_STATIC_STRINGS);

	g_object_class_install_properties (object_class, LAST_PROP, properties);

	signals[BUNDLE_INSTALLED] =
		g_signal_new ("bundle-installed",
			      G_OBJECT_CLASS_TYPE (object_class),
			      G_SIGNAL_RUN_FIRST,
			      G_STRUCT_OFFSET (CraneDomainClass, bundle_installed),
			      NULL, NULL, NULL,
			      G_TYPE_NONE,
			      2,
			      CRANE_TYPE_DOMAIN,
			      CRANE_TYPE_BUNDLE);
	signals[BUNDLE_REMOVED] =
		g_signal_new ("bundle-removed",
			      G_OBJECT_CLASS_TYPE (object_class),
			      G_SIGNAL_RUN_FIRST,
			      G_STRUCT_OFFSET (CraneDomainClass, bundle_removed),
			      NULL, NULL, NULL,
			      G_TYPE_NONE,
			      2,
			      CRANE_TYPE_DOMAIN,
			      CRANE_TYPE_BUNDLE);
	signals[BUNDLE_STARTED] =
		g_signal_new ("bundle-started",
			      G_OBJECT_CLASS_TYPE (object_class),
			      G_SIGNAL_RUN_FIRST,
			      G_STRUCT_OFFSET (CraneDomainClass, bundle_started),
			      NULL, NULL, NULL,
			      G_TYPE_NONE,
			      2,
			      CRANE_TYPE_DOMAIN,
			      CRANE_TYPE_BUNDLE);
	signals[BUNDLE_STOPPED] =
		g_signal_new ("bundle-stopped",
			      G_OBJECT_CLASS_TYPE (object_class),
			      G_SIGNAL_RUN_FIRST,
			      G_STRUCT_OFFSET (CraneDomainClass, bundle_stopped),
			      NULL, NULL, NULL,
			      G_TYPE_NONE,
			      2,
			      CRANE_TYPE_DOMAIN,
			      CRANE_TYPE_BUNDLE);
}

static void
release_bundle_tool (gpointer * bundle)
{
	g_return_if_fail (CRANE_IS_BUNDLE (bundle));

	CraneBundle * bundle = CRANE_BUNDLE (bundle);
	crane_bundle_release (bundle);

	g_object_unref (G_OBJECT (bundle));
}

static void
crane_domain_init (CraneDomain * obj)
{
	obj->_priv = crane_domain_get_instance_private (obj);

	obj->_priv->path = NULL;
	obj->_priv->pid_fd = -1;

	obj->_priv->bundles = g_hash_table_new_full (g_str_hash,
	                                             g_str_equal,
	                                             g_free,
	                                             release_bundle_tool);
}

CraneDomain *
crane_domain_new (void)
{
	return g_object_new (CRANE_TYPE_DOMAIN, NULL);
}

gchar *
crane_domain_get_path (CraneDomain * self)
{
	g_return_val_if_fail (CRANE_IS_DOMAIN (self), FALSE);

	return g_strdup (self->_priv->path);
}

gboolean
crane_domain_is_acquired (CraneDomain * self)
{
	g_return_val_if_fail (CRANE_IS_DOMAIN (self), FALSE);

	return self->_priv->pid_fd != -1;
}

void
crane_domain_acquire (CraneDomain * self, gchar * path, GError ** error)
{
	g_return_if_fail (CRANE_IS_DOMAIN (self));
	g_return_if_fail (!crane_domain_is_acquired (self));

	char * root_path = g_strdup (path);

	int ret;
	int err_code;
	GError * g_err;

	/* Check for availability by PID file. */

	char * path_pid = g_build_filename (root_path, ".pidlock");

	errno = 0;

	int fd = open (path_pid, O_WRONLY | O_CREAT | O_SYNC, 0644);
	err_code = errno;

	g_clear_pointer (&path_pid, g_free);

	if (fd == -1)
	{
		/* An error has caused the operation to be failed. */

		g_error_set (error,
		             G_FILE_ERROR,
		             g_file_error_from_errno (err_code),
		             "Unable to open pid-file: %s",
		             strerror (err_code));
		goto error_1;
	}

	ret = flock (fd, LOCK_EX | LOCK_NB);
	err_code = errno;

	if (ret == -1)
	{
		/* Unable to lock. Domain maybe used by another process. */

		g_error_set (error,
		             G_FILE_ERROR,
		             g_file_error_from_errno (err_code),
		             "Unable to lock pid-file: %s",
		             strerror (err_code));
		goto error_2;
	}

	/* Write PID file to the domain. */

	ret = ftruncate (fd, 0);
	err_code = errno;

	if (ret == -1)
	{
		/* Unable to truncate PID file. */

		g_error_set (error,
		             G_FILE_ERROR,
		             g_file_error_from_errno (err_code),
		             "Unable to truncate pid-file: %s",
		             strerror (err_code));
		goto error_2;
	}

	ret = dprintf (fd, "%d\n", getpid ());
	err_code = errno;

	if (ret < 0)
	{
		/* Unable to write current PID to PID file. */

		g_error_set (error,
		             G_FILE_ERROR,
		             g_file_error_from_errno (err_code),
		             "Unable to write pid-file: %s",
		             strerror (err_code));
		goto error_2;
	}

	/* Generate apps list kept inside the bundle. */

	char * path_app = g_build_filename (root_path, "app");

	g_err = NULL;
	GDir * dir_app = g_dir_open (path_app, 0, &g_err);

	g_clear_pointer (&path_app, g_free);

	if (dir_app == NULL)
	{
		/* Error is occured while opening apps directory. */

		g_propagate_error (error, g_err);
		goto error_2;
	}

	errno = 0;

	while ((const gchar * en_raw = g_dir_read_name (dir_app)) != NULL)
	{
		gchar * en = g_strdup (en_raw);

		if (!g_hash_table_insert (self->_priv->bundles, en, NULL))
		{
			/* Key already exist. Duplicate bundle-id detected! */
			/* NOTE: 'en' is freed by GHashTable's remove-hook. */

			g_error_set_literal (error,
			                     G_FILE_ERROR,
			                     G_FILE_ERROR_FAILED,
			                     "Domain is broken: Encountered duplicate bundle-id");
			goto error_3;
		}

		CraneBundle * tool = crane_bundle_new ();

		g_err = NULL;
		ret = crane_bundle_acquire (tool, self, en_raw, g_err);

		g_object_unref (G_OBJECT (tool));

		if (!ret)
		{
			/* Unable to process a bundle. Domain is broken! */

			g_propagate_error (error, g_err);
			goto error_3;
		}
	}

	if (errno != 0)
	{
		/* An error has occured while enumerating directory. */

		g_error_set (error,
		             G_FILE_ERROR,
		             g_file_error_from_errno (err_code),
		             "Directory enumeration failure: %s",
		             strerror (err_code));
		goto error_3;
	}

	g_clear_pointer (&dir_app, g_dir_close);

	self->_priv->pid_fd = fd;
	self->_priv->path = root_path;

	g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PATH]);
	g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IS_ACQUIRED]);

	// TODO: generate acquired signal!

	return;

error_3:
	g_hash_table_remove_all (self->_priv->bundles);
	g_dir_close (dir_app);
error_2:
	close (fd);
error_1:
	g_free (root_path);
}

void
crane_domain_release (CraneDomain * self)
{
	g_return_if_fail (CRANE_IS_DOMAIN (self));
	g_return_if_fail (crane_domain_is_acquired (self));

	// TODO: generate releasing signal!

	/* Release all bundles from bundle-tools. */

	g_hash_table_remove_all (self->_priv->bundles);

	close (fd);

	self->_priv->pid_fd = -1;
	g_clear_pointer (&self->_priv->path, g_free);

	g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PATH]);
	g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_IS_ACQUIRED]);
}


text:
// Modules
var gulp = require('gulp');
var pug = require('gulp-pug');
var less = require('gulp-less');
var browserSync = require('browser-sync').create();
var source = require('vinyl-source-stream');
var browserify = require('browserify');

// Tasks
gulp.task('default', ['pug', 'less', 'browserify', 'browserifyRelease']);

gulp.task('pug', function(){
	return gulp.src( './src/pug/**/*.pug')
		.pipe( pug( {pretty: true}))
		.pipe( gulp.dest('./docs/'));
});

gulp.task('less', function(){
	return gulp.src( './src/less/**/*.less')
		.pipe( less())
		.pipe( gulp.dest('./docs/'));
});

gulp.task('browserify', function() {
	return browserify('./src/js/main.js')
	.bundle()
	//Pass desired output filename to vinyl-source-stream
	.pipe(source('build.js'))
	// Start piping stream to tasks!
	.pipe(gulp.dest('./docs/'));
});

gulp.task('browserifyRelease', function() {
	return browserify('./src/js/mainForRelease.js')
	.bundle()
	//Pass desired output filename to vinyl-source-stream
	.pipe(source('buildForRelease.js'))
	// Start piping stream to tasks!
	.pipe(gulp.dest('./docs/'));
});

// Watching
gulp.task('watch', function(){
	browserSync.init({
		port: 4000, //where is browser sync
		proxy: 'http://localhost:3000/', //what are we proxying?
		ui: {port: 4001}, //where is the UI
		browser: [] //empty array of browsers
	});

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

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

	gulp.watch('./src/js/**/*.js', [ 'browserify'])
		.on('change', browserSync.reload);

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

redpajama_set_name: RedPajamaGithub


text:
package com.google.android.mms.util;

import com.google.android.mms.pdu.GenericPdu;

public final class PduCacheEntry {
    private final GenericPdu mPdu;
    private final int mMessageBox;
    private final long mThreadId;

    public PduCacheEntry(GenericPdu pdu, int msgBox, long threadId) {
        mPdu = pdu;
        mMessageBox = msgBox;
        mThreadId = threadId;
    }

    public GenericPdu getPdu() {
        return mPdu;
    }

    public int getMessageBox() {
        return mMessageBox;
    }

    public long getThreadId() {
        return mThreadId;
    }
}


text:
package org.apache.flink.api.java.typeutils.runtime;

import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.TypeSerializerMatchers;
import org.apache.flink.api.common.typeutils.TypeSerializerSchemaCompatibility;
import org.apache.flink.api.common.typeutils.TypeSerializerUpgradeTestBase;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.testutils.migration.MigrationVersion;
import org.apache.flink.types.Value;

import org.hamcrest.Matcher;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;

import static org.hamcrest.Matchers.is;

/**
 * State migration test for {@link RowSerializer}.
 */
@RunWith(Parameterized.class)
public class ValueSerializerUpgradeTest extends TypeSerializerUpgradeTestBase<ValueSerializerUpgradeTest.NameValue, ValueSerializerUpgradeTest.NameValue> {
	public ValueSerializerUpgradeTest(TestSpecification<NameValue, NameValue> testSpecification) {
		super(testSpecification);
	}

	@Parameterized.Parameters(name = "Test Specification = {0}")
	public static Collection<TestSpecification<?, ?>> testSpecifications() throws Exception {
		ArrayList<TestSpecification<?, ?>> testSpecifications = new ArrayList<>();
		for (MigrationVersion migrationVersion : MIGRATION_VERSIONS) {
			testSpecifications.add(
				new TestSpecification<>(
					"value-serializer",
					migrationVersion,
					ValueSerializerSetup.class,
					ValueSerializerVerifier.class));
		}

		return testSpecifications;
	}

	public static final class ValueSerializerSetup implements TypeSerializerUpgradeTestBase.PreUpgradeSetup<NameValue> {
		@Override
		public TypeSerializer<NameValue> createPriorSerializer() {
			return new ValueSerializer<>(NameValue.class);
		}

		@Override
		public NameValue createTestData() {
			NameValue value = new NameValue();
			value.setName("klion26");
			return value;
		}
	}

	public static final class ValueSerializerVerifier implements TypeSerializerUpgradeTestBase.UpgradeVerifier<NameValue> {
		@Override
		public TypeSerializer<NameValue> createUpgradedSerializer() {
			return new ValueSerializer<>(NameValue.class);
		}

		@Override
		public Matcher<NameValue> testDataMatcher() {
			NameValue value = new NameValue();
			value.setName("klion26");
			return is(value);
		}

		@Override
		public Matcher<TypeSerializerSchemaCompatibility<NameValue>> schemaCompatibilityMatcher(MigrationVersion version) {
			return TypeSerializerMatchers.isCompatibleAsIs();
		}
	}

	/**
	 * A dummy class used for this test.
	 */
	public static final class NameValue implements Value {

		public static final long serialVersionUID = 2277251654485371327L;

		private String name;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		@Override
		public void write(DataOutputView out) throws IOException {
			out.writeUTF(name);
		}

		@Override
		public void read(DataInputView in) throws IOException {
			name = in.readUTF();
		}

		@Override
		public boolean equals(Object obj) {
			if (obj == this) {
				return true;
			}
			if (!(obj instanceof NameValue)) {
				return false;
			}

			NameValue other = (NameValue) obj;
			return Objects.equals(this.name, other.name);
		}
	}
}


text:
from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView, CreateView, UpdateView, DeleteView
#from filter_analysis.models import *
#from filter_analysis.views import FilterAnalysisUpdateView, FilterAnalysisDeleteView, FilterConfigUpdateView, FilterConfigDeleteView

urlpatterns = patterns('pathway_analysis.views',
    url('', 'index', name='pathway_analysis'),
    url('populate/', 'populate', name='populate_pathway'),
    url('analysis/', 'analysis', name='pathway_filter_analysis'),
    url('view/<int:pathway_id>', 'view', name='pathway_view'),
#    url(r'^trioanalysis/$', 'trioanalysis', name='trio_analysis'),
#
#
#
#    url(r'^wizard/$', 'wizard', name='filter_wizard'),
##    url(r'^create/$', 'create', name='create_filter'),
#    url(r'^create/$', 'create', name='create_filter'),
#    url(r'^createconfig/$', 'createconfig', name='create_config'),
#    url(r'^updateanalysis/(?P<pk>\d+)', FilterAnalysisUpdateView.as_view(model=FilterAnalysis), name="analysis_update",),
#    url(r'^deleteanalysis/(?P<pk>\d+)', FilterAnalysisDeleteView.as_view(), name="analysis_delete",),
#    url(r'^updateconfig/(?P<pk>\d+)', FilterConfigUpdateView.as_view(model=FilterConfig), name="config_update",),
#    url(r'^deleteconfig/(?P<pk>\d+)', FilterConfigDeleteView.as_view(), name="config_delete",),
)


text:
using System.Runtime.Serialization;
using System.Xml.Serialization;
// ReSharper disable UnusedAutoPropertyAccessor.Global

namespace TWCore.Bot
{
    /// <summary>
    /// Bot chat definition
    /// </summary>
    [DataContract]
    public class BotChat
    {
        /// <summary>
        /// Chat id
        /// </summary>
        [XmlAttribute, DataMember]
        public string Id { get; set; }
        /// <summary>
        /// Chat type
        /// </summary>
        [XmlAttribute, DataMember]
        public BotChatType ChatType { get; set; }
        /// <summary>
        /// Chat name
        /// </summary>
        [XmlAttribute, DataMember]
        public string Name { get; set; }
        /// <summary>
        /// Chat state
        /// </summary>
        [DataMember]
        public object State { get; set; }
    }
}


text:
import json

from copy import deepcopy
from mock import patch, ANY
from django.conf import settings

from django.test import TestCase
from django.test.utils import override_settings

from accounts.models import CtsUser
from accounts.tests.factories import CtsUserFactory
from ona.representation import OnaItemBase
from shipments.models import PackageScan, Shipment
from shipments.tests.factories import PackageFactory
from ona.models import FormSubmission, minimum_aware_datetime
from ona.tasks import process_new_scans, verify_deviceid, reset_bad_form_ids, bad_form_ids, \
    forget_form_definitions
from ona.tests.test_models import PACKAGE_DATA, USER_CODE_DATA, QR_CODE

@override_settings(
    ONA_API_ACCESS_TOKEN='foo',
    ONA_DEVICEID_VERIFICATION_FORM_ID=111,
    ONA_FORM_IDS=[123, 456],
    ONA_DOMAIN='ona.io'
)
@patch('ona.tasks.OnaApiClient.get_form_submissions')
@patch('ona.tasks.OnaApiClient.get_form_definition')
class ProcessNewPackageScansTestCase(TestCase):
    def setUp(self):
        reset_bad_form_ids()
        forget_form_definitions()

    def test_update_package_locations(self, mock_ona_form_def, mock_ona_form_submissions):
        self.assertFalse(FormSubmission.objects.all())
        # The test DATA fixture already contains the form def json
        submission = json.loads(PACKAGE_DATA)
        mock_ona_form_def.return_value = submission['form_definition']
        mock_ona_form_submissions.return_value = [submission]
        process_new_scans.run()
        self.assertEqual(1, FormSubmission.objects.count())
        # Only add the record once
        process_new_scans.run()
        self.assertEqual(1, FormSubmission.objects.count())

    def test_update_package_multiple_locations(self, mock_ona_form_def, mock_ona_form_submissions):
        PackageFactory(code=QR_CODE)
        self.assertFalse(FormSubmission.objects.all())
        # The test DATA fixture already contains the form def json
        submission = json.loads(PACKAGE_DATA)
        other_submission = deepcopy(submission)
        other_submission.update(
            _uuid="2a11435f-8eaf-44f9-bd75-00a4bac8fbce",
            current_location="STATUS_RECEIVED",
            _submission_time="2014-07-25T17:19:16",
        )
        mock_ona_form_def.return_value = submission['form_definition']
        mock_ona_form_submissions.return_value = [submission, other_submission]
        process_new_scans.run()
        self.assertEqual(2, FormSubmission.objects.count())
        loc = PackageScan.objects.all().order_by('when')[0]
        self.assertEqual(loc.status_label, 'English Zero_Point')
        self.assertEqual(loc.package.status, Shipment.STATUS_RECEIVED)
        self.assertEqual(loc.package.shipment.status, Shipment.STATUS_RECEIVED)
        loc = PackageScan.objects.all().order_by('when')[1]
        self.assertEqual(loc.status_label, 'English Received')
        self.assertEqual(loc.package.status, Shipment.STATUS_RECEIVED)
        self.assertEqual(loc.package.shipment.status, Shipment.STATUS_RECEIVED)

    @patch('ona.tasks.logger')
    def test_bad_form_id(self, mock_logger, mock_ona_form_def, mock_ona_form_submissions):
        mock_ona_form_def.return_value = None
        process_new_scans.run()
        self.assertIn(settings.ONA_FORM_IDS[0], bad_form_ids)
        self.assertTrue(mock_logger.error.called)

    @patch('ona.tasks.logger')
    def test_skip_next_bad_form_id(self, mock_logger, mock_ona_form_def, mock_ona_form_submissions):
        mock_ona_form_def.return_value = None
        bad_form_ids.add(settings.ONA_FORM_IDS[0])
        process_new_scans.run()
        # no error logged because we just skip the bad form id
        self.assertFalse(mock_logger.error.called)

@override_settings(
    ONA_API_ACCESS_TOKEN='foo',
    ONA_DEVICEID_VERIFICATION_FORM_ID=111,
    ONA_FORM_IDS=[123, 456],
    ONA_DOMAIN='ona.io'
)
@patch('ona.tasks.OnaApiClient.get_form_definition', autospec=True)
@patch('ona.tasks.OnaApiClient.get_form_submissions', autospec=True)
class DeviceIdToUserTestCase(TestCase):

    def setUp(self):
        self.user = CtsUserFactory(code=QR_CODE)
        reset_bad_form_ids()
        forget_form_definitions()

    def test_verify_deviceid(self, mock_ona_form_submissions, mock_get_form_definition):
        self.assertEqual('', self.user.deviceid)
        self.assertFalse(FormSubmission.objects.all())
        submission = json.loads(USER_CODE_DATA)
        mock_ona_form_submissions.return_value = [submission]
        verify_deviceid.run()
        self.assertEqual(1, FormSubmission.objects.count())
        # Passed minimum as the 'since' parm
        mock_ona_form_submissions.assert_called_with(ANY, 111, since=minimum_aware_datetime())
        # Only add the record once
        verify_deviceid.run()
        self.assertEqual(1, FormSubmission.objects.count())
        # passed the previous submission time as the 'since' parm when fetching forms
        subtime = OnaItemBase.parse_form_datetime(submission['_submission_time'])
        mock_ona_form_submissions.assert_called_with(ANY, 111, since=subtime)
        self.assertEqual('device_foo', CtsUser.objects.get(pk=self.user.pk).deviceid)

    def test_update_deviceid(self, mock_ona_form_submissions, mock_get_form_definition):
        # A later scan can update the user/device connection
        user2 = CtsUserFactory(code='test2', deviceid='device_foo')
        user3 = CtsUserFactory(code='test3', deviceid='device_foo')
        submission = json.loads(USER_CODE_DATA)
        mock_ona_form_submissions.return_value = [submission]
        verify_deviceid.run()
        # "new" user now has device
        self.assertEqual('device_foo', CtsUser.objects.get(pk=self.user.pk).deviceid)
        # and previous users do not
        self.assertEqual('', CtsUser.objects.get(pk=user2.pk).deviceid)
        self.assertEqual('', CtsUser.objects.get(pk=user3.pk).deviceid)

    @patch('ona.tasks.logger')
    def test_verify_deviceid_invalid_code(self, mock_logger, mock_ona_form_submissions,
                                          mock_get_form_definition):
        self.assertFalse(FormSubmission.objects.all())
        # The test DATA fixture already contains the form def json
        submission = json.loads(USER_CODE_DATA)
        submission['qr_code'] = 'foobar'
        mock_ona_form_submissions.return_value = [submission]
        verify_deviceid.run()
        self.assertEqual(0, FormSubmission.objects.count())
        self.assertTrue(mock_logger.error.called)

    def test_not_retrieving_same_forms_repeatedly(self, mock_ona_form_submissions,
                                                  mock_get_form_definition):
        # The test DATA fixture already contains the form def json
        submission = json.loads(USER_CODE_DATA)
        mock_ona_form_submissions.return_value = [submission]
        verify_deviceid.run()
        self.assertEqual(1, FormSubmission.objects.count())

    @patch('ona.tasks.logger')
    def test_bad_form_id(self, mock_logger, mock_ona_form_submissions,
                         mock_get_form_definition):
        mock_get_form_definition.return_value = None
        verify_deviceid.run()
        self.assertIn(settings.ONA_DEVICEID_VERIFICATION_FORM_ID, bad_form_ids)
        self.assertTrue(mock_logger.error.called)


text:
/*eslint no-undef: "off"*/

import { curry, map, pipe } from 'ramda';
import { IMAGES } from './constants.js';
import { emit } from './emitter';
import { getMyCoordinates } from './utils';
import { MAP_LOADER_HIDE, MAP_LOADER_SHOW } from './actions';
import LMap from './map.js';
import * as MapElements from './mapelements.js';
import Leaflet from '../classes/leaflet.js';
import ShowboxTwitterComponent from '../components/showbox-twitter-component.js';

const leaflet = new Leaflet();

export function navigateToUserLocation() {
    getMyCoordinates().then(latLng => {
        LMap.flyTo(latLng, 12);
    });
}

export const generateResults = curry(data => {
    pipe(map(drawObject))(data);
});

export const renderObject = function(renderObject) {
    const data = renderObject.data;
    const type = renderObject.type;
    const geolocation = renderObject.data.geo;

    drawObject(data, geolocation, type);
};

export const drawObject = curry((data, geolocation, iconType) => {
    const coordinates = [geolocation[0], geolocation[1]];
    const latlng = L.latLng(coordinates[1], coordinates[0]);
    const popupOptions = {
        autoPanPadding: L.point(10, 10),
        minWidth: 350,
        maxHeight: 300
    };

    let ShowboxComp;
    let icon, popup, markerOptions;

    switch (iconType) {
    case 'twitter':
        ShowboxComp = new ShowboxTwitterComponent('', '', 'div', '', data);
        ShowboxComp.init();

        popup = leaflet.createPopup(ShowboxComp, popupOptions);
        icon = MapElements.createIcon(IMAGES.SOC_MEDIA_ICONS.TWITTER);

        markerOptions = {
            icon: icon,
            title: 'Tweet',
                // TODO: replace geolocation with username or place.
            alt: `Tweet in (${geolocation[1]}, ${geolocation[0]})`,
            riseOnHover: true
        };

        break;
    case 'yelp':
        console.log('Yelp data, geo, icon', data, geolocation, iconType);
        break;
    default:
        console.log('No soc media was selected.');
    }

    const geojsonFeature = {
        type: 'Feature',
        properties: {
            name: iconType,
            popupContent: popup,
            icon: icon
        },
        geometry: {
            type: 'Point',
            coordinates
        }
    };

    const feature = leaflet.geoJSON(geojsonFeature, {
        onEachFeature(feature, layer) {
            if (feature.properties && feature.properties.popupContent) {
                layer.bindPopup(feature.properties.popupContent).openPopup();
            }
        },

        pointToLayer(feature, latlng) {
            return L.marker(latlng, markerOptions);
        }
    });
});

export function drawYelpIcon(long, lat) {
    const coordinates = [long, lat];
    const geojsonFeature = {
        type: 'Feature',
        properties: {
            name: 'Yelp icon'
        },
        geometry: {
            type: 'Point',
            coordinates
        }
    };

    const markerOptions = {
        icon: MapElements.createIcon(IMAGES.SOC_MEDIA_ICONS.YELP),
        title: 'Yelp',
        alt: 'Yelp icon marker.',
        riseOnHover: true
    };

    leaflet.geoJSON(geojsonFeature, {
        pointToLayer(feature, latlng) {
            return L.marker(latlng, markerOptions);
        }
    });
}


text:
<?php

declare(strict_types=1);

namespace Nelmio\Alice\Throwable\Exception\Symfony\PropertyAccess;

use Symfony\Component\PropertyAccess\Exception\ExceptionInterface;

class RootException extends \Exception implements ExceptionInterface
{
}


text:
package com.fishercoder;

import com.fishercoder.solutions._944;
import org.junit.BeforeClass;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;

public class _944Test {
  private static _944.Solution1 solution1;
  private static String[] A;

  @BeforeClass
  public static void setup() {
    solution1 = new _944.Solution1();
  }

  @Test
  public void test1() {
    A = new String[] {"cba", "daf", "ghi"};
    assertEquals(1, solution1.minDeletionSize(A));
  }

  @Test
  public void test2() {
    A = new String[] {"a", "b"};
    assertEquals(0, solution1.minDeletionSize(A));
  }

  @Test
  public void test3() {
    A = new String[] {"zyx", "wvu", "tsr"};
    assertEquals(3, solution1.minDeletionSize(A));
  }
}


text:
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;

namespace Cadoscopia.DatabaseServices
{
    public abstract class Database
    {
        #region Properties

        public TransactionManager TransactionManager { get; private set; }

        public ObservableCollection<DatabaseObject> Objects { get; } = new ObservableCollection<DatabaseObject>();

        #endregion

        #region Constructors

        protected Database(bool undoRecording = true)
        {
            // ReSharper disable once InvertIf
            if (undoRecording)
                StartUndoRecording();
        }

        public void StartUndoRecording()
        {
            TransactionManager = new TransactionManager(this);
        }

        #endregion
    }
}


text:
package org.apache.ignite.internal.jdbc2;

import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteJdbcDriver;

/**
 * Task for SQL queries execution through {@link IgniteJdbcDriver}.
 * The query can contains several SQL statements.
 */
class JdbcQueryMultipleStatementsNotAllowTask extends JdbcQueryMultipleStatementsTask {
    /** Serial version uid. */
    private static final long serialVersionUID = 0L;

    /**
     * @param ignite Ignite.
     * @param schemaName Schema name.
     * @param sql Sql query.
     * @param isQry Operation type flag - query or not - to enforce query type check.
     * @param loc Local execution flag.
     * @param args Args.
     * @param fetchSize Fetch size.
     * @param locQry Local query flag.
     * @param collocatedQry Collocated query flag.
     * @param distributedJoins Distributed joins flag.
     * @param enforceJoinOrder Enforce joins order falg.
     * @param lazy Lazy query execution flag.
     */
    public JdbcQueryMultipleStatementsNotAllowTask(Ignite ignite, String schemaName, String sql, Boolean isQry, boolean loc,
        Object[] args, int fetchSize, boolean locQry, boolean collocatedQry, boolean distributedJoins,
        boolean enforceJoinOrder, boolean lazy) {
        super(ignite, schemaName, sql, isQry, loc, args, fetchSize, locQry, collocatedQry, distributedJoins,
            enforceJoinOrder, lazy);
    }

    /** {@inheritDoc} */
    @Override protected boolean allowMultipleStatements() {
        return false;
    }
}


text:
.class public Lcom/android/camera/ui/SettingListLayout;
.super Landroid/widget/FrameLayout;
.source "SettingListLayout.java"

# interfaces
.implements Landroid/widget/AbsListView$OnScrollListener;
.implements Landroid/widget/AdapterView$OnItemClickListener;
.implements Lcom/android/camera/ui/InLineSettingItem$Listener;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/camera/ui/SettingListLayout$SettingsListAdapter;,
        Lcom/android/camera/ui/SettingListLayout$Listener;
    }
.end annotation

# static fields
#the value of this static final field might be set in the static constructor
.field private static final LOG:Z = false

.field private static final TAG:Ljava/lang/String; = "SettingListLayout"

# instance fields
.field private mLastItem:Lcom/android/camera/ui/InLineSettingItem;

.field private mListItem:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/android/camera/ListPreference;",
            ">;"
        }
    .end annotation
.end field

.field private mListItemAdapter:Landroid/widget/ArrayAdapter;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/widget/ArrayAdapter",
            "<",
            "Lcom/android/camera/ListPreference;",
            ">;"
        }
    .end annotation
.end field

.field private mListener:Lcom/android/camera/ui/SettingListLayout$Listener;

.field private mSettingList:Landroid/widget/ListView;

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 46
    sget-boolean v0, Lcom/android/camera/Log;->LOGV:Z

    sput-boolean v0, Lcom/android/camera/ui/SettingListLayout;->LOG:Z

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 154
    invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 49
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    .line 155
    return-void
.end method

.method static synthetic access$000(Lcom/android/camera/ui/SettingListLayout;)Ljava/util/ArrayList;
    .locals 1
    .parameter "x0"

    .prologue
    .line 42
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    return-object v0
.end method

# virtual methods
.method public collapseChild()Z
    .locals 4

    .prologue
    .line 234
    const/4 v0, 0x0

    .line 235
    .local v0, collapse:Z
    iget-object v1, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    if-eqz v1, :cond_0

    .line 236
    iget-object v1, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    invoke-virtual {v1}, Lcom/android/camera/ui/InLineSettingItem;->collapseChild()Z

    move-result v0

    .line 238
    :cond_0
    sget-boolean v1, Lcom/android/camera/ui/SettingListLayout;->LOG:Z

    if-eqz v1, :cond_1

    .line 239
    const-string v1, "SettingListLayout"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "collapseChild() return "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/android/camera/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 241
    :cond_1
    return v0
.end method

.method public initialize(Lcom/android/camera/PreferenceGroup;[Ljava/lang/String;Z)V
    .locals 5
    .parameter "group"
    .parameter "keys"
    .parameter "addrestore"

    .prologue
    .line 158
    invoke-virtual {p0}, Landroid/view/View;->getContext()Landroid/content/Context;

    move-result-object v0

    .line 167
    .local v0, context:Landroid/content/Context;
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    invoke-virtual {v3}, Ljava/util/ArrayList;->clear()V

    .line 169
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    array-length v3, p2

    if-ge v1, v3, :cond_1

    .line 170
    aget-object v3, p2, v1

    invoke-virtual {p1, v3}, Lcom/android/camera/PreferenceGroup;->findPreference(Ljava/lang/String;)Lcom/android/camera/ListPreference;

    move-result-object v2

    .line 171
    .local v2, pref:Lcom/android/camera/ListPreference;
    if-eqz v2, :cond_0

    .line 172
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 169
    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 176
    .end local v2           #pref:Lcom/android/camera/ListPreference;
    :cond_1
    if-eqz p3, :cond_2

    .line 177
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    const/4 v4, 0x0

    invoke-virtual {v3, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 180
    :cond_2
    new-instance v3, Lcom/android/camera/ui/SettingListLayout$SettingsListAdapter;

    invoke-direct {v3, p0}, Lcom/android/camera/ui/SettingListLayout$SettingsListAdapter;-><init>(Lcom/android/camera/ui/SettingListLayout;)V

    iput-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mListItemAdapter:Landroid/widget/ArrayAdapter;

    .line 181
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    iget-object v4, p0, Lcom/android/camera/ui/SettingListLayout;->mListItemAdapter:Landroid/widget/ArrayAdapter;

    invoke-virtual {v3, v4}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 182
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    invoke-virtual {v3, p0}, Landroid/widget/AdapterView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 183
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    const v4, 0x106000d

    invoke-virtual {v3, v4}, Landroid/widget/AbsListView;->setSelector(I)V

    .line 184
    iget-object v3, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    invoke-virtual {v3, p0}, Landroid/widget/AbsListView;->setOnScrollListener(Landroid/widget/AbsListView$OnScrollListener;)V

    .line 185
    return-void
.end method

.method public onDismiss(Lcom/android/camera/ui/InLineSettingItem;)V
    .locals 3
    .parameter "item"

    .prologue
    .line 218
    const-string v0, "SettingListLayout"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onDismiss("

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ") mLastItem="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/android/camera/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 219
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    .line 220
    return-void
.end method

.method protected onFinishInflate()V
    .locals 1

    .prologue
    .line 61
    invoke-super {p0}, Landroid/view/View;->onFinishInflate()V

    .line 62
    const v0, 0x7f0b00e0

    invoke-virtual {p0, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ListView;

    iput-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    .line 63
    return-void
.end method

.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 1
    .parameter
    .parameter "view"
    .parameter "position"
    .parameter "id"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView",
            "<*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .prologue
    .line 199
    .local p1, parent:Landroid/widget/AdapterView;,"Landroid/widget/AdapterView<*>;"
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    add-int/lit8 v0, v0, -0x1

    if-ne p3, v0, :cond_0

    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListener:Lcom/android/camera/ui/SettingListLayout$Listener;

    if-eqz v0, :cond_0

    .line 200
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListener:Lcom/android/camera/ui/SettingListLayout$Listener;

    invoke-interface {v0}, Lcom/android/camera/ui/SettingListLayout$Listener;->onRestorePreferencesClicked()V

    .line 202
    :cond_0
    return-void
.end method

.method public onScroll(Landroid/widget/AbsListView;III)V
    .locals 3
    .parameter "view"
    .parameter "firstVisibleItem"
    .parameter "visibleItemCount"
    .parameter "totalItemCount"

    .prologue
    .line 247
    sget-boolean v0, Lcom/android/camera/ui/SettingListLayout;->LOG:Z

    if-eqz v0, :cond_0

    .line 248
    const-string v0, "SettingListLayout"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onScroll("

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ", "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ", "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ")"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/android/camera/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 251
    :cond_0
    return-void
.end method

.method public onScrollStateChanged(Landroid/widget/AbsListView;I)V
    .locals 3
    .parameter "view"
    .parameter "scrollState"

    .prologue
    .line 255
    sget-boolean v0, Lcom/android/camera/ui/SettingListLayout;->LOG:Z

    if-eqz v0, :cond_0

    .line 256
    const-string v0, "SettingListLayout"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onScrollStateChanged("

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ")"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/android/camera/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 258
    :cond_0
    const/4 v0, 0x1

    if-ne p2, v0, :cond_1

    .line 259
    invoke-virtual {p0}, Lcom/android/camera/ui/SettingListLayout;->collapseChild()Z

    .line 261
    :cond_1
    return-void
.end method

.method public onSettingChanged(Lcom/android/camera/ui/InLineSettingItem;)V
    .locals 1
    .parameter "item"

    .prologue
    .line 189
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    if-eq v0, p1, :cond_0

    .line 190
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    invoke-virtual {v0}, Lcom/android/camera/ui/InLineSettingItem;->collapseChild()Z

    .line 192
    :cond_0
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListener:Lcom/android/camera/ui/SettingListLayout$Listener;

    if-eqz v0, :cond_1

    .line 193
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mListener:Lcom/android/camera/ui/SettingListLayout$Listener;

    invoke-interface {v0, p0}, Lcom/android/camera/ui/SettingListLayout$Listener;->onSettingChanged(Lcom/android/camera/ui/SettingListLayout;)V

    .line 195
    :cond_1
    return-void
.end method

.method public onShow(Lcom/android/camera/ui/InLineSettingItem;)V
    .locals 3
    .parameter "item"

    .prologue
    .line 224
    sget-boolean v0, Lcom/android/camera/ui/SettingListLayout;->LOG:Z

    if-eqz v0, :cond_0

    .line 225
    const-string v0, "SettingListLayout"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "onShow("

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ") mLastItem="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/android/camera/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    .line 227
    :cond_0
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    if-eq v0, p1, :cond_1

    .line 228
    iget-object v0, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    invoke-virtual {v0}, Lcom/android/camera/ui/InLineSettingItem;->collapseChild()Z

    .line 230
    :cond_1
    iput-object p1, p0, Lcom/android/camera/ui/SettingListLayout;->mLastItem:Lcom/android/camera/ui/InLineSettingItem;

    .line 231
    return-void
.end method

.method public reloadPreference()V
    .locals 5

    .prologue
    .line 205
    iget-object v4, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    invoke-virtual {v4}, Landroid/view/ViewGroup;->getChildCount()I

    move-result v0

    .line 206
    .local v0, count:I
    const/4 v1, 0x0

    .local v1, i:I
    :goto_0
    if-ge v1, v0, :cond_1

    .line 207
    iget-object v4, p0, Lcom/android/camera/ui/SettingListLayout;->mListItem:Ljava/util/ArrayList;

    invoke-virtual {v4, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/android/camera/ListPreference;

    .line 208
    .local v2, pref:Lcom/android/camera/ListPreference;
    if-eqz v2, :cond_0

    .line 209
    iget-object v4, p0, Lcom/android/camera/ui/SettingListLayout;->mSettingList:Landroid/widget/ListView;

    invoke-virtual {v4, v1}, Landroid/view/ViewGroup;->getChildAt(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lcom/android/camera/ui/InLineSettingItem;

    .line 211
    .local v3, settingItem:Lcom/android/camera/ui/InLineSettingItem;
    invoke-virtual {v3}, Lcom/android/camera/ui/InLineSettingItem;->reloadPreference()V

    .line 206
    .end local v3           #settingItem:Lcom/android/camera/ui/InLineSettingItem;
    :cond_0
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 214
    .end local v2           #pref:Lcom/android/camera/ListPreference;
    :cond_1
    return-void
.end method

.method public setSettingChangedListener(Lcom/android/camera/ui/SettingListLayout$Listener;)V
    .locals 0
    .parameter "listener"

    .prologue
    .line 150
    iput-object p1, p0, Lcom/android/camera/ui/SettingListLayout;->mListener:Lcom/android/camera/ui/SettingListLayout$Listener;

    .line 151
    return-void
.end method


text:
CREATE DATABASE ecvdphp;
USE ecvdphp;
CREATE TABLE users (
  id INT NOT NULL AUTO_INCREMENT,
  username VARCHAR(255),
  email VARCHAR(255),
  password VARCHAR(255),
  description VARCHAR(511),
  PRIMARY KEY (ID)
);


text:
<?php

namespace Laravel\Socialite;

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Illuminate\Support\Manager;
use Laravel\Socialite\Two\GithubProvider;
use Laravel\Socialite\Two\GoogleProvider;
use Laravel\Socialite\One\TwitterProvider;
use Laravel\Socialite\Two\FacebookProvider;
use Laravel\Socialite\Two\LinkedInProvider;
use Laravel\Socialite\Two\BitbucketProvider;
use League\OAuth1\Client\Server\Twitter as TwitterServer;

class SocialiteManager extends Manager implements Contracts\Factory
{
    /**
     * Get a driver instance.
     *
     * @param  string  $driver
     * @return mixed
     */
    public function with($driver)
    {
        return $this->driver($driver);
    }

    /**
     * Create an instance of the specified driver.
     *
     * @return \Laravel\Socialite\Two\AbstractProvider
     */
    protected function createGithubDriver()
    {
        $config = $this->app['config']['services.github'];

        return $this->buildProvider(
            GithubProvider::class, $config
        );
    }

    /**
     * Create an instance of the specified driver.
     *
     * @return \Laravel\Socialite\Two\AbstractProvider
     */
    protected function createFacebookDriver()
    {
        $config = $this->app['config']['services.facebook'];

        return $this->buildProvider(
            FacebookProvider::class, $config
        );
    }

    /**
     * Create an instance of the specified driver.
     *
     * @return \Laravel\Socialite\Two\AbstractProvider
     */
    protected function createGoogleDriver()
    {
        $config = $this->app['config']['services.google'];

        return $this->buildProvider(
            GoogleProvider::class, $config
        );
    }

    /**
     * Create an instance of the specified driver.
     *
     * @return \Laravel\Socialite\Two\AbstractProvider
     */
    protected function createLinkedinDriver()
    {
        $config = $this->app['config']['services.linkedin'];

        return $this->buildProvider(
          LinkedInProvider::class, $config
        );
    }

    /**
     * Create an instance of the specified driver.
     *
     * @return \Laravel\Socialite\Two\AbstractProvider
     */
    protected function createBitbucketDriver()
    {
        $config = $this->app['config']['services.bitbucket'];

        return $this->buildProvider(
          BitbucketProvider::class, $config
        );
    }

    /**
     * Build an OAuth 2 provider instance.
     *
     * @param  string  $provider
     * @param  array  $config
     * @return \Laravel\Socialite\Two\AbstractProvider
     */
    public function buildProvider($provider, $config)
    {
        return new $provider(
            $this->app['request'], $config['client_id'],
            $config['client_secret'], $this->formatRedirectUrl($config),
            Arr::get($config, 'guzzle', [])
        );
    }

    /**
     * Create an instance of the specified driver.
     *
     * @return \Laravel\Socialite\One\AbstractProvider
     */
    protected function createTwitterDriver()
    {
        $config = $this->app['config']['services.twitter'];

        return new TwitterProvider(
            $this->app['request'], new TwitterServer($this->formatConfig($config))
        );
    }

    /**
     * Format the server configuration.
     *
     * @param  array  $config
     * @return array
     */
    public function formatConfig(array $config)
    {
        return array_merge([
            'identifier' => $config['client_id'],
            'secret' => $config['client_secret'],
            'callback_uri' => $this->formatRedirectUrl($config),
        ], $config);
    }

    /**
     * Format the callback URL, resolving a relative URI if needed.
     *
     * @param  array  $config
     * @return string
     */
    protected function formatRedirectUrl(array $config)
    {
        $redirect = value($config['redirect']);

        return Str::startsWith($redirect, '/')
                    ? $this->app['url']->to($redirect)
                    : $redirect;
    }

    /**
     * Get the default driver name.
     *
     * @throws \InvalidArgumentException
     *
     * @return string
     */
    public function getDefaultDriver()
    {
        throw new InvalidArgumentException('No Socialite driver was specified.');
    }
}


text:
FOUNDATION_EXPORT double LighterAppDelegateVersionNumber;
FOUNDATION_EXPORT const unsigned char LighterAppDelegateVersionString[];


text:
{% if ledger.errors %}

      {{ _('File') }}
      {{ _('Line') }}
      {{ _('Error') }}

    {% for error in ledger.errors %}

      {% with link=url_for_source(file_path=error.source['filename'], line=error.source['lineno']) %}
      {{ error.source['filename'] }}
      {{ error.source['lineno'] }}
      {{ error.message|format_errormsg|safe }}
      {% endwith %}

    {% endfor %}

{% else %}

{{ _('No errors.') }}

{% endif %}


text:
namespace __sanitizer {

enum ThreadStatus {
  ThreadStatusInvalid,   // Non-existent thread, data is invalid.
  ThreadStatusCreated,   // Created but not yet running.
  ThreadStatusRunning,   // The thread is currently running.
  ThreadStatusFinished,  // Joinable thread is finished but not yet joined.
  ThreadStatusDead       // Joined, but some info is still available.
};

enum class ThreadType {
  Regular, // Normal thread
  Worker,  // macOS Grand Central Dispatch (GCD) worker thread
  Fiber,   // Fiber
};

// Generic thread context. Specific sanitizer tools may inherit from it.
// If thread is dead, context may optionally be reused for a new thread.
class ThreadContextBase {
 public:
  explicit ThreadContextBase(u32 tid);
  ~ThreadContextBase();  // Should never be called.

  const u32 tid;  // Thread ID. Main thread should have tid = 0.
  u64 unique_id;  // Unique thread ID.
  u32 reuse_count;  // Number of times this tid was reused.
  tid_t os_id;     // PID (used for reporting).
  uptr user_id;   // Some opaque user thread id (e.g. pthread_t).
  char name[64];  // As annotated by user.

  ThreadStatus status;
  bool detached;
  ThreadType thread_type;

  u32 parent_tid;
  ThreadContextBase *next;  // For storing thread contexts in a list.

  atomic_uint32_t thread_destroyed; // To address race of Joined vs Finished

  void SetName(const char *new_name);

  void SetDead();
  void SetJoined(void *arg);
  void SetFinished();
  void SetStarted(tid_t _os_id, ThreadType _thread_type, void *arg);
  void SetCreated(uptr _user_id, u64 _unique_id, bool _detached,
                  u32 _parent_tid, void *arg);
  void Reset();

  void SetDestroyed();
  bool GetDestroyed();

  // The following methods may be overriden by subclasses.
  // Some of them take opaque arg that may be optionally be used
  // by subclasses.
  virtual void OnDead() {}
  virtual void OnJoined(void *arg) {}
  virtual void OnFinished() {}
  virtual void OnStarted(void *arg) {}
  virtual void OnCreated(void *arg) {}
  virtual void OnReset() {}
  virtual void OnDetached(void *arg) {}
};

typedef ThreadContextBase* (*ThreadContextFactory)(u32 tid);

class ThreadRegistry {
 public:
  static const u32 kUnknownTid;

  ThreadRegistry(ThreadContextFactory factory, u32 max_threads,
                 u32 thread_quarantine_size, u32 max_reuse = 0);
  void GetNumberOfThreads(uptr *total = nullptr, uptr *running = nullptr,
                          uptr *alive = nullptr);
  uptr GetMaxAliveThreads();

  void Lock() { mtx_.Lock(); }
  void CheckLocked() { mtx_.CheckLocked(); }
  void Unlock() { mtx_.Unlock(); }

  // Should be guarded by ThreadRegistryLock.
  ThreadContextBase *GetThreadLocked(u32 tid) {
    DCHECK_LT(tid, n_contexts_);
    return threads_[tid];
  }

  u32 CreateThread(uptr user_id, bool detached, u32 parent_tid, void *arg);

  typedef void (*ThreadCallback)(ThreadContextBase *tctx, void *arg);
  // Invokes callback with a specified arg for each thread context.
  // Should be guarded by ThreadRegistryLock.
  void RunCallbackForEachThreadLocked(ThreadCallback cb, void *arg);

  typedef bool (*FindThreadCallback)(ThreadContextBase *tctx, void *arg);
  // Finds a thread using the provided callback. Returns kUnknownTid if no
  // thread is found.
  u32 FindThread(FindThreadCallback cb, void *arg);
  // Should be guarded by ThreadRegistryLock. Return 0 if no thread
  // is found.
  ThreadContextBase *FindThreadContextLocked(FindThreadCallback cb,
                                             void *arg);
  ThreadContextBase *FindThreadContextByOsIDLocked(tid_t os_id);

  void SetThreadName(u32 tid, const char *name);
  void SetThreadNameByUserId(uptr user_id, const char *name);
  void DetachThread(u32 tid, void *arg);
  void JoinThread(u32 tid, void *arg);
  void FinishThread(u32 tid);
  void StartThread(u32 tid, tid_t os_id, ThreadType thread_type, void *arg);
  void SetThreadUserId(u32 tid, uptr user_id);

 private:
  const ThreadContextFactory context_factory_;
  const u32 max_threads_;
  const u32 thread_quarantine_size_;
  const u32 max_reuse_;

  BlockingMutex mtx_;

  u32 n_contexts_;      // Number of created thread contexts,
                        // at most max_threads_.
  u64 total_threads_;   // Total number of created threads. May be greater than
                        // max_threads_ if contexts were reused.
  uptr alive_threads_;  // Created or running.
  uptr max_alive_threads_;
  uptr running_threads_;

  ThreadContextBase **threads_;  // Array of thread contexts is leaked.
  IntrusiveList<ThreadContextBase> dead_threads_;
  IntrusiveList<ThreadContextBase> invalid_threads_;

  void QuarantinePush(ThreadContextBase *tctx);
  ThreadContextBase *QuarantinePop();
};

typedef GenericScopedLock<ThreadRegistry> ThreadRegistryLock;

} // namespace __sanitizer

#endif // SANITIZER_THREAD_REGISTRY_H


text:
using static Google.Apis.Storage.v1.BucketsResource;

namespace Google.Cloud.Storage.V1
{
    /// <summary>
    /// Options for <c>GetBucketIamPolicy</c> operations.
    /// </summary>
    public sealed class GetBucketIamPolicyOptions
    {
        /// <summary>
        /// If set, this is the ID of the project which will be billed for the request.
        /// The caller must have suitable permissions for the project being billed.
        /// </summary>
        public string UserProject { get; set; }

        internal void ModifyRequest(GetIamPolicyRequest request)
        {
            if (UserProject != null)
            {
                request.UserProject = UserProject;
            }
        }
    }
}


text:
<?php

namespace crewstyle\OlympusZeus\Plugins\Search;

use crewstyle\OlympusZeus\OlympusZeus;
use crewstyle\OlympusZeus\Core\Action\Action;
use crewstyle\OlympusZeus\Core\Field\Field;
use crewstyle\OlympusZeus\Plugins\Search\Search;

/**
 * Builds Search field.
 *
 * @package Olympus Zeus
 * @subpackage Plugins\Search\SearchField
 * @author Achraf Chouk <achrafchouk@gmail.com>
 * @since 4.0.0
 *
 */

class SearchField extends Field
{
    /**
     * @var string
     */
    private $currentpage;

    /**
     * @var boolean
     */
    protected $hasId = false;

    /**
     * @var boolean
     */
    public static $isauthorized = false;

    /**
     * Constructor.
     *
     * @since 4.0.0
     */
    public function __construct()
    {
        add_action('olz_field_current_page', array(&$this, 'hookCurrentPage'), 10, 1);
    }

    /**
     * Hook special hook
     *
     * @since 3.0.0
     */
    public function hookCurrentPage($current) {
        $page = admin_url('admin.php?page='.$current.'&section=search&from=plugin');
        $this->setSearchCurrentPage($page);
    }

    /**
     * Display HTML component.
     *
     * @param array $content Contains all field data
     * @param array $details Contains all field options
     *
     * @since 4.0.0
     */
    public function prepareField($content, $details = array())
    {
        //Build details
        $post = isset($details['post']) ? $details['post'] : 0;
        $prefix = isset($details['prefix']) ? $details['prefix'] : '';
        $tpl = empty($prefix) ? 'pages' : 'terms';

        //Get indexed content count and status
        $count = OlympusZeus::getConfigs(Search::getIndex().'-count', 0);
        $status = OlympusZeus::getConfigs(Search::getIndex().'-status', 0);

        //Get page
        $page = $this->getSearchCurrentPage().'&do=olz-action&make=create';

        //Get right page
        if (0 < $status) {
            $page = $this->getSearchCurrentPage().'&do=olz-action&make=index';
        }

        //Build defaults data
        $template = array(
            'count' => $count,
            'page' => $page,
            'status' => $status,

            //details
            'post' => $post,
            'prefix' => $prefix,
            'template' => $tpl,

            //texts
            //-> notifications
            't_es_notify_n' => sprintf(
                OlympusZeus::__('Check your configurations to properly use the Search Engine.
                    Create now your Search Index'),
                $page
            ),
            't_es_notify_0' => sprintf(
                OlympusZeus::__('Your parameters are well configured but your contents have not been indexed.
                    Let\'s do it!'),
                $page
            ),
            't_es_notify_s' => sprintf(
                OlympusZeus::__('Well done: %d posts have been indexed!
                    Update contents!'),
                $count,
                $page
            ),
        );

        //Get template
        return $this->renderField('plugins/fields/search.html.twig', $template);
    }

    /**
     * Retrieve the $currentpage value
     *
     * @return string $currentpage Get the current page
     *
     * @since 3.0.0
     */
    protected function getSearchCurrentPage()
    {
        return $this->currentpage;
    }

    /**
     * Define the $currentpage value
     *
     * @param string $currentpage Get the current page
     *
     * @since 3.0.0
     */
    public function setSearchCurrentPage($currentpage = '')
    {
        $this->currentpage = $currentpage;
    }
}


text:
package runtime

import "unsafe"

// Needs to be in sync with ../cmd/internal/ld/decodesym.go:/^func.commonsize,
// ../cmd/internal/gc/reflect.go:/^func.dcommontype and
// ../reflect/type.go:/^type.rtype.
type _type struct {
	size       uintptr
	ptrdata    uintptr // size of memory prefix holding all pointers
	hash       uint32
	_unused    uint8
	align      uint8
	fieldalign uint8
	kind       uint8
	alg        *typeAlg
	// gcdata stores the GC type data for the garbage collector.
	// If the KindGCProg bit is set in kind, gcdata is a GC program.
	// Otherwise it is a ptrmask bitmap. See mbitmap.go for details.
	gcdata  *byte
	_string *string
	x       *uncommontype
	ptrto   *_type
	zero    *byte // ptr to the zero value for this type
}

type method struct {
	name    *string
	pkgpath *string
	mtyp    *_type
	typ     *_type
	ifn     unsafe.Pointer
	tfn     unsafe.Pointer
}

type uncommontype struct {
	name    *string
	pkgpath *string
	mhdr    []method
}

type imethod struct {
	name    *string
	pkgpath *string
	_type   *_type
}

type interfacetype struct {
	typ  _type
	mhdr []imethod
}

type maptype struct {
	typ           _type
	key           *_type
	elem          *_type
	bucket        *_type // internal type representing a hash bucket
	hmap          *_type // internal type representing a hmap
	keysize       uint8  // size of key slot
	indirectkey   bool   // store ptr to key instead of key itself
	valuesize     uint8  // size of value slot
	indirectvalue bool   // store ptr to value instead of value itself
	bucketsize    uint16 // size of bucket
	reflexivekey  bool   // true if k==k for all keys
}

type chantype struct {
	typ  _type
	elem *_type
	dir  uintptr
}

type slicetype struct {
	typ  _type
	elem *_type
}

type functype struct {
	typ       _type
	dotdotdot bool
	in        slice
	out       slice
}

type ptrtype struct {
	typ  _type
	elem *_type
}


text:
/**
 * External dependencies
 */
import PropTypes from 'prop-types';

/**
 * WordPress dependencies
 */
import { forwardRef } from '@wordpress/element';

function StoryPlayer({ url, title, poster, width, height }, ref) {
  return (
    <amp-story-player
      ref={ref}
      style={{
        width: width ? `${width}px` : undefined,
        height: height ? `${height}px` : undefined,
      }}
      data-testid="amp-story-player"
    >
      <a href={url}>
        {poster ? (
          <img
            alt={title}
            src={poster}
            width={width}
            height={height}
            data-amp-story-player-poster-img
          />
        ) : (
          title
        )}
      </a>
    </amp-story-player>
  );
}

const StoryPlayerWithRef = forwardRef(StoryPlayer);

StoryPlayer.propTypes = {
  url: PropTypes.string.isRequired,
  title: PropTypes.string.isRequired,
  poster: PropTypes.string,
  width: PropTypes.number,
  height: PropTypes.number,
};

export default StoryPlayerWithRef;


text:
package com.crystalcraftmc.allyouneed.Commands;

import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.crystalcraftmc.allyouneed.Main;

public class AYNTppos implements CommandExecutor{

	public AYNTppos(Main main){

	}

	public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){

		if(sender instanceof Player){

			if(args.length == 3){
				//Main code STARTS here
				try{
				int X = Integer.parseInt(args[0]);
				int Y = Integer.parseInt(args[1]);
				int Z = Integer.parseInt(args[2]);
				Player p = (Player)sender;
				Location loc = new Location(p.getWorld(),X,Y,Z);
				p.teleport(loc);
				}catch(Exception e){
					sender.sendMessage("Enter numeral values please");
				}

				//Main code ENDS here
				return true;
			}
			else return false;
		}
		sender.sendMessage("Only a player could execute this command");
		return true;
	}

}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\PhotoDetails */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'photo_details')->textInput(['maxlength' => 50]) ?>

    <?= $form->field($model, 'user_level')->textInput() ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
namespace base {
namespace win {

class StartupInformation;

};  // namespace win
};  // namespace base

namespace sandbox {

class AttributeList;
class SharedMemIPCServer;
class ThreadProvider;

// TargetProcess models a target instance (child process). Objects of this
// class are owned by the Policy used to create them.
class TargetProcess {
 public:
  // The constructor takes ownership of |initial_token|, |lockdown_token|
  // and |lowbox_token|.
  TargetProcess(base::win::ScopedHandle initial_token,
                base::win::ScopedHandle lockdown_token,
                base::win::ScopedHandle lowbox_token,
                HANDLE job,
                ThreadProvider* thread_pool);
  ~TargetProcess();

  // TODO(cpu): Currently there does not seem to be a reason to implement
  // reference counting for this class since is internal, but kept the
  // the same interface so the interception framework does not need to be
  // touched at this point.
  void AddRef() {}
  void Release() {}

  // Creates the new target process. The process is created suspended.
  DWORD Create(const wchar_t* exe_path,
               const wchar_t* command_line,
               bool inherit_handles,
               const base::win::StartupInformation& startup_info,
               base::win::ScopedProcessInformation* target_info);

  // Destroys the target process.
  void Terminate();

  // Creates the IPC objects such as the BrokerDispatcher and the
  // IPC server. The IPC server uses the services of the thread_pool.
  DWORD Init(Dispatcher* ipc_dispatcher,
             void* policy,
             uint32_t shared_IPC_size,
             uint32_t shared_policy_size);

  // Returns the handle to the target process.
  HANDLE Process() const {
    return sandbox_process_info_.process_handle();
  }

  // Returns the handle to the job object that the target process belongs to.
  HANDLE Job() const {
    return job_;
  }

  // Returns the address of the target main exe. This is used by the
  // interceptions framework.
  HMODULE MainModule() const {
    return reinterpret_cast<HMODULE>(base_address_);
  }

  // Returns the name of the executable.
  const wchar_t* Name() const {
    return exe_name_.get();
  }

  // Returns the process id.
  DWORD ProcessId() const {
    return sandbox_process_info_.process_id();
  }

  // Returns the handle to the main thread.
  HANDLE MainThread() const {
    return sandbox_process_info_.thread_handle();
  }

  // Transfers a 32-bit variable between the broker and the target.
  ResultCode TransferVariable(const char* name, void* address, size_t size);

 private:
  // Details of the target process.
  base::win::ScopedProcessInformation sandbox_process_info_;
  // The token associated with the process. It provides the core of the
  // sbox security.
  base::win::ScopedHandle lockdown_token_;
  // The token given to the initial thread so that the target process can
  // start. It has more powers than the lockdown_token.
  base::win::ScopedHandle initial_token_;
  // The lowbox token associated with the process. This token is set after the
  // process creation.
  base::win::ScopedHandle lowbox_token_;
  // Kernel handle to the shared memory used by the IPC server.
  base::win::ScopedHandle shared_section_;
  // Job object containing the target process.
  HANDLE job_;
  // Reference to the IPC subsystem.
  std::unique_ptr<SharedMemIPCServer> ipc_server_;
  // Provides the threads used by the IPC. This class does not own this pointer.
  ThreadProvider* thread_pool_;
  // Base address of the main executable
  void* base_address_;
  // Full name of the target executable.
  std::unique_ptr<wchar_t, base::FreeDeleter> exe_name_;

  // Function used for testing.
  friend TargetProcess* MakeTestTargetProcess(HANDLE process,
                                              HMODULE base_address);

  DISALLOW_IMPLICIT_CONSTRUCTORS(TargetProcess);
};

// Creates a mock TargetProcess used for testing interceptions.
// TODO(cpu): It seems that this method is not going to be used anymore.
TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address);

}  // namespace sandbox

#endif  // SANDBOX_WIN_SRC_TARGET_PROCESS_H_


text:
<?php echo $judul; ?>

				<input type="button" value="« Kembali">

			<form name="form" id="form" method="post" action="<?php echo $action;?>" onSubmit="return post(this);">

Tipe Pembayaran*

							<input name="tipe_pembayaran" type="radio" value="Cash" <?php if ($tipe_pembayaran == "Cash") echo 'checked="checked"'; ?>> Cash
							<input name="tipe_pembayaran" type="radio" value="KPR"  <?php if ($tipe_pembayaran == "KPR") echo 'checked="checked"'; ?>> KPR

Tahap Pembayaran*

							<input class="center" name="tahap_pembayaran" type="text" size="1" value="<?php echo $tahap_pembayaran; ?>" onkeypress="return isNumberKey(event)"> x

							<input type="hidden" name="id_cara_pembayaran" id="id_cara_pembayaran" value="<?php echo $id_cara_pembayaran; ?>">
							<input type="submit" value="Simpan ✓">

* Harus Diisi

			</form>


text:
package com.example.chichi.thanqu.model;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.chichi.thanqu.R;

import java.util.ArrayList;

/**
 * Created by pacilo on 2017. 6. 6..
 */

public class ClassListAdapter extends BaseAdapter {

    Context context;
    ArrayList<ClassModel> arrayList;

    public ClassListAdapter(Context context, ArrayList list) {
        this.context = context;
        this.arrayList = list;
    }

    public void add(ClassModel m) {
        arrayList.add(m);
    }

    public void clear() {
        arrayList.clear();
    }

    @Override
    public int getCount() {
        return arrayList.size();
    }

    @Override
    public Object getItem(int position) {
        return arrayList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return arrayList.get(position).hashCode();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            v = LayoutInflater.from(context).inflate(android.R.layout.simple_list_item_1, null);
        }
        TextView tv = (TextView) v.findViewById(android.R.id.text1);
        tv.setText(arrayList.get(position).className);
        return v;
    }
}


text:
const webpack = require('webpack');
const getWebpackConfig = require('antd-tools/lib/getWebpackConfig');

// noParse still leave `require('./locale' + name)` in dist files
// ignore is better
// http://stackoverflow.com/q/25384360
function ignoreMomentLocale(webpackConfig) {
  delete webpackConfig.module.noParse;
  webpackConfig.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
}

// Fix ie8 compatibility
function es3ify(webpackConfig) {
  webpackConfig.module.loaders.unshift({
    test: /\.(tsx|jsx?)$/,
    loader: 'es3ify-loader',
  });
}

module.exports = function (webpackConfig) {
  webpackConfig = getWebpackConfig(webpackConfig);
  if (process.env.RUN_ENV === 'PRODUCTION') {
    webpackConfig.forEach((config) => {
      es3ify(config);
      ignoreMomentLocale(config);
    });
  }
  return webpackConfig;
};


text:
magnets = {
  constant = 40,
  radius = 50,
  limit = 200,
  minDist = 1
}

------------------------------------------------------------------------------------------
-- Applies a force to the specified entity, from the specified source position.
-- @param ent The entity table generated from entityProxy.
-- @param sourcePos The source position of the force, a table with an x and y value.
-- @param force The force to apply.
-- @return The new velocity of the entity, or nil if the force was unable to be applied.
------------------------------------------------------------------------------------------
function magnets.applyForce(ent, sourcePos, force)
  local vel = ent.velocity()
  if vel then
    local targetPos = ent.position()
    local posDif = world.distance(targetPos, sourcePos)
    local qQ = force * magnets.constant
    local forceMag = qQ * magnets.distanceScale(posDif)
    local theta = math.atan2(posDif[2], posDif[1])

    vel[1] = vel[1] + (forceMag * math.cos(theta) * entity.dt())
    vel[2] = vel[2] + (forceMag * math.sin(theta) * entity.dt())

    ent.setVelocity(vel)
    return vel
  else
    return nil
  end
end

----------------------------------------------------------------
-- Get the number to scale the force by with distance.
-- Override to scale force differently with distance.
-- Default scale by square inverse of distance (F = kqQ/r^2).
-- @param distance A table with 2 values, the x and y distance.
-- @return The number with which to scale the force by
----------------------------------------------------------------
function magnets.distanceScale(distance)
  local lengthSquared = magnets.lengthSquared(distance)
  if lengthSquared < magnets.minDist then
    lengthSquared = 2 * magnets.minDist - lengthSquared
  end
  return 1/lengthSquared
end

-------------------------------------------------------------------------
-- Adds two vectors.
-- @param u First vector in the form of { x1 , y1 }.
-- @param v Second vector in the form of { x2 , y2 }.
-- @return The sum of the two vectors in the form { x1 + x2 , y1 + y2 }.
-------------------------------------------------------------------------
function magnets.vecSum(u, v)
  return { u[1] + v[1], u[2] + v[2]}
end

-----------------------------------------------
-- Gets the square length of a vector, with a capped minimun distance.
-- @param vec The vector to get the length of.
-- @return The square length of the vector.
-----------------------------------------------
function magnets.lengthSquared(vec)
  return (vec[1] * vec[1]) + (vec[2] * vec[2])
end

------------------------------------------------------------------
-- Checks whether or not the entity should be affected by magnets
-- @param entID The ID of the entity
-- @return Whether or not the entity should be pushed by magnets
------------------------------------------------------------------
function magnets.shouldAffect(entID)
  -- Make sure the entity has been magnetized
  return magnets.isValidTarget(entID) and (magnets.isMagnetized(entID) ~= nil)
end

-----------------------------------------------------------------------------------------------------------------------------------
-- Checks whether or not the entity should be affected by magnets
-- @param entID The ID of the entity
-- @return The entityID of the Magnetizer managing the entity if it is magnetized, nil if it is not, or -1 if there is no manager.
-----------------------------------------------------------------------------------------------------------------------------------
function magnets.isMagnetized(entID)
  if world.callScriptedEntity(entID, "isMagnetized") == true then
    return -1
  end
  if math.magnetizers ~= nil then
    for key,value in pairs(math.magnetizers) do
      if world.entityExists(key) then
        if world.callScriptedEntity(key, "isMagnetized", entID) then
          return key
        end
      else
        math.magnetizers[key] = nil
      end
    end
  end
  return nil
end

------------------------------------------------------------------
-- Checks if the entity is a valid target of magnets
-- @param entID The ID of the entity
-- @return Whether or not the entity can be magnetized
------------------------------------------------------------------
function magnets.isValidTarget(entID)
  local entType = world.entityType(entID)
  return (entType == "monster" or entType == "npc") and (not world.callScriptedEntity(entID, "entity.configParameter", "isStatic", false))
end


text:
package de.craftolution.craftoplugin.module.vote;

import com.vexsoftware.votifier.model.Vote;
import com.vexsoftware.votifier.model.VotifierEvent;
import de.craftolution.craftoplugin.module.vote.record.VoteRecord;
import de.craftolution.craftoplugin.module.vote.record.VoteRecordData;
import de.craftolution.craftoplugin.service.module.Component;
import de.craftolution.craftoplugin.service.module.annotation.Parent;
import de.craftolution.craftoplugin.service.module.annotation.PluginDependencies;
import de.craftolution.craftoplugin.service.playerstorage.StoredPlayer;
import org.bukkit.event.EventHandler;

import java.time.Instant;

@PluginDependencies("Votifier")
public class VoteListener extends Component {

	@Parent VoteModule module;

	@EventHandler
	public void onVoteEvent(VotifierEvent event) {
		Vote vote = event.getVote();
		info("Received vote: %s", vote);

		// Create record
		boolean hasName = vote.getUsername() != null && !vote.getUsername().replace(" ", "").isEmpty();
		StoredPlayer storedPlayer = hasName ? StoredPlayer.get(vote.getUsername()).orElse(null) : null;

		VoteRecordData data = new VoteRecordData(
			vote.getServiceName(),
			vote.getUsername(),
			vote.getAddress(),
			Instant.ofEpochSecond(Long.parseLong(vote.getTimeStamp())),
			storedPlayer != null ? storedPlayer.getId() : null
		);

		VoteRecord record = module.voteRecordManager.create(data);

		// Reward player, if possible
		try {
			module.rewardManager.reward(record);
		}
		catch (Exception e) { report(e, "Failed to reward for vote record: " + record); }
	}

}


text:
/*
 * INET		An implementation of the TCP/IP protocol suite for the LINUX
 *		operating system.  INET is implemented using the BSD Socket
 *		interface as the means of communication with the user level.
 *
 * Authors:	Lotsa people, from code originally in tcp
 *
 *	This program is free software; you can redistribute it and/or
 *      modify it under the terms of the GNU General Public License
 *      as published by the Free Software Foundation; either version
 *      2 of the License, or (at your option) any later version.
 */

#ifndef _INET_HASHTABLES_H
#define _INET_HASHTABLES_H

#include <linux/interrupt.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/vmalloc.h>

#include <net/inet_connection_sock.h>
#include <net/inet_sock.h>
#include <net/sock.h>
#include <net/route.h>
#include <net/tcp_states.h>
#include <net/netns/hash.h>

#include <asm/atomic.h>
#include <asm/byteorder.h>

/* This is for all connections with a full identity, no wildcards.
 * One chain is dedicated to TIME_WAIT sockets.
 * I'll experiment with dynamic table growth later.
 */
struct inet_ehash_bucket {
	struct hlist_nulls_head chain;
	struct hlist_nulls_head twchain;
};

/* There are a few simple rules, which allow for local port reuse by
 * an application.  In essence:
 *
 *	1) Sockets bound to different interfaces may share a local port.
 *	   Failing that, goto test 2.
 *	2) If all sockets have sk->sk_reuse set, and none of them are in
 *	   TCP_LISTEN state, the port may be shared.
 *	   Failing that, goto test 3.
 *	3) If all sockets are bound to a specific inet_sk(sk)->rcv_saddr local
 *	   address, and none of them are the same, the port may be
 *	   shared.
 *	   Failing this, the port cannot be shared.
 *
 * The interesting point, is test #2.  This is what an FTP server does
 * all day.  To optimize this case we use a specific flag bit defined
 * below.  As we add sockets to a bind bucket list, we perform a
 * check of: (newsk->sk_reuse && (newsk->sk_state != TCP_LISTEN))
 * As long as all sockets added to a bind bucket pass this test,
 * the flag bit will be set.
 * The resulting situation is that tcp_v[46]_verify_bind() can just check
 * for this flag bit, if it is set and the socket trying to bind has
 * sk->sk_reuse set, we don't even have to walk the owners list at all,
 * we return that it is ok to bind this socket to the requested local port.
 *
 * Sounds like a lot of work, but it is worth it.  In a more naive
 * implementation (ie. current FreeBSD etc.) the entire list of ports
 * must be walked for each data port opened by an ftp server.  Needless
 * to say, this does not scale at all.  With a couple thousand FTP
 * users logged onto your box, isn't it nice to know that new data
 * ports are created in O(1) time?  I thought so. ;-)	-DaveM
 */
struct inet_bind_bucket {
#ifdef CONFIG_NET_NS
	struct net		*ib_net;
#endif
	unsigned short		port;
	signed short		fastreuse;
	int			num_owners;
	struct hlist_node	node;
	struct hlist_head	owners;
};

static inline struct net *ib_net(struct inet_bind_bucket *ib)
{
	return read_pnet(&ib->ib_net);
}

#define inet_bind_bucket_for_each(tb, node, head) \
	hlist_for_each_entry(tb, node, head, node)

struct inet_bind_hashbucket {
	spinlock_t		lock;
	struct hlist_head	chain;
};

/*
 * Sockets can be hashed in established or listening table
 * We must use different 'nulls' end-of-chain value for listening
 * hash table, or we might find a socket that was closed and
 * reallocated/inserted into established hash table
 */
#define LISTENING_NULLS_BASE (1U << 29)
struct inet_listen_hashbucket {
	spinlock_t		lock;
	struct hlist_nulls_head	head;
};

/* This is for listening sockets, thus all sockets which possess wildcards. */
#define INET_LHTABLE_SIZE	32	/* Yes, really, this is all you need. */

struct inet_hashinfo {
	/* This is for sockets with full identity only.  Sockets here will
	 * always be without wildcards and will have the following invariant:
	 *
	 *          TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
	 *
	 * TIME_WAIT sockets use a separate chain (twchain).
	 */
	struct inet_ehash_bucket	*ehash;
	spinlock_t			*ehash_locks;
	unsigned int			ehash_size;
	unsigned int			ehash_locks_mask;

	/* Ok, let's try this, I give up, we do need a local binding
	 * TCP hash as well as the others for fast bind/connect.
	 */
	struct inet_bind_hashbucket	*bhash;

	unsigned int			bhash_size;
	/* 4 bytes hole on 64 bit */

	struct kmem_cache		*bind_bucket_cachep;

	/* All the above members are written once at bootup and
	 * never written again _or_ are predominantly read-access.
	 *
	 * Now align to a new cache line as all the following members
	 * might be often dirty.
	 */
	/* All sockets in TCP_LISTEN state will be in here.  This is the only
	 * table where wildcard'd TCP sockets can exist.  Hash function here
	 * is just local port number.
	 */
	struct inet_listen_hashbucket	listening_hash[INET_LHTABLE_SIZE]
					____cacheline_aligned_in_smp;

	atomic_t			bsockets;
};

static inline struct inet_ehash_bucket *inet_ehash_bucket(
	struct inet_hashinfo *hashinfo,
	unsigned int hash)
{
	return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
}

static inline spinlock_t *inet_ehash_lockp(
	struct inet_hashinfo *hashinfo,
	unsigned int hash)
{
	return &hashinfo->ehash_locks[hash & hashinfo->ehash_locks_mask];
}

static inline int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo)
{
	unsigned int i, size = 256;
#if defined(CONFIG_PROVE_LOCKING)
	unsigned int nr_pcpus = 2;
#else
	unsigned int nr_pcpus = num_possible_cpus();
#endif
	if (nr_pcpus >= 4)
		size = 512;
	if (nr_pcpus >= 8)
		size = 1024;
	if (nr_pcpus >= 16)
		size = 2048;
	if (nr_pcpus >= 32)
		size = 4096;
	if (sizeof(spinlock_t) != 0) {
#ifdef CONFIG_NUMA
		if (size * sizeof(spinlock_t) > PAGE_SIZE)
			hashinfo->ehash_locks = vmalloc(size * sizeof(spinlock_t));
		else
#endif
		hashinfo->ehash_locks =	kmalloc(size * sizeof(spinlock_t),
						GFP_KERNEL);
		if (!hashinfo->ehash_locks)
			return ENOMEM;
		for (i = 0; i < size; i++)
			spin_lock_init(&hashinfo->ehash_locks[i]);
	}
	hashinfo->ehash_locks_mask = size - 1;
	return 0;
}

static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
{
	if (hashinfo->ehash_locks) {
#ifdef CONFIG_NUMA
		unsigned int size = (hashinfo->ehash_locks_mask + 1) *
							sizeof(spinlock_t);
		if (size > PAGE_SIZE)
			vfree(hashinfo->ehash_locks);
		else
#endif
		kfree(hashinfo->ehash_locks);
		hashinfo->ehash_locks = NULL;
	}
}

extern struct inet_bind_bucket *
		    inet_bind_bucket_create(struct kmem_cache *cachep,
					    struct net *net,
					    struct inet_bind_hashbucket *head,
					    const unsigned short snum);
extern void inet_bind_bucket_destroy(struct kmem_cache *cachep,
				     struct inet_bind_bucket *tb);

static inline int inet_bhashfn(struct net *net,
		const __u16 lport, const int bhash_size)
{
	return (lport + net_hash_mix(net)) & (bhash_size - 1);
}

extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
			   const unsigned short snum);

/* These can have wildcards, don't try too hard. */
static inline int inet_lhashfn(struct net *net, const unsigned short num)
{
	return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1);
}

static inline int inet_sk_listen_hashfn(const struct sock *sk)
{
	return inet_lhashfn(sock_net(sk), inet_sk(sk)->num);
}

/* Caller must disable local BH processing. */
extern void __inet_inherit_port(struct sock *sk, struct sock *child);

extern void inet_put_port(struct sock *sk);

void inet_hashinfo_init(struct inet_hashinfo *h);

extern void __inet_hash_nolisten(struct sock *sk);
extern void inet_hash(struct sock *sk);
extern void inet_unhash(struct sock *sk);

extern struct sock *__inet_lookup_listener(struct net *net,
					   struct inet_hashinfo *hashinfo,
					   const __be32 daddr,
					   const unsigned short hnum,
					   const int dif);

static inline struct sock *inet_lookup_listener(struct net *net,
		struct inet_hashinfo *hashinfo,
		__be32 daddr, __be16 dport, int dif)
{
	return __inet_lookup_listener(net, hashinfo, daddr, ntohs(dport), dif);
}

/* Socket demux engine toys. */
/* What happens here is ugly; there's a pair of adjacent fields in
   struct inet_sock; __be16 dport followed by __u16 num.  We want to
   search by pair, so we combine the keys into a single 32bit value
   and compare with 32bit value read from &...->dport.  Let's at least
   make sure that it's not mixed with anything else...
   On 64bit targets we combine comparisons with pair of adjacent __be32
   fields in the same way.
*/
typedef __u32 __bitwise __portpair;
#ifdef __BIG_ENDIAN
#define INET_COMBINED_PORTS(__sport, __dport) \
	((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
#else /* __LITTLE_ENDIAN */
#define INET_COMBINED_PORTS(__sport, __dport) \
	((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(__sport)))
#endif

#if (BITS_PER_LONG == 64)
typedef __u64 __bitwise __addrpair;
#ifdef __BIG_ENDIAN
#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
	const __addrpair __name = (__force __addrpair) ( \
				   (((__force __u64)(__be32)(__saddr)) << 32) | \
				   ((__force __u64)(__be32)(__daddr)));
#else /* __LITTLE_ENDIAN */
#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
	const __addrpair __name = (__force __addrpair) ( \
				   (((__force __u64)(__be32)(__daddr)) << 32) | \
				   ((__force __u64)(__be32)(__saddr)));
#endif /* __BIG_ENDIAN */
#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
	(((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) &&	\
	 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie))	&&	\
	 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports))	&&	\
	 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
	(((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) &&	\
	 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) &&	\
	 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) &&	\
	 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
#else /* 32-bit arch */
#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)	\
	(((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net))	&&	\
	 (inet_sk(__sk)->daddr		== (__saddr))		&&	\
	 (inet_sk(__sk)->rcv_saddr	== (__daddr))		&&	\
	 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports))	&&	\
	 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif)	\
	(((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net))	&&	\
	 (inet_twsk(__sk)->tw_daddr	== (__saddr))		&&	\
	 (inet_twsk(__sk)->tw_rcv_saddr	== (__daddr))		&&	\
	 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) &&	\
	 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
#endif /* 64-bit arch */

/*
 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we need
 * not check it for lookups anymore, thanks Alexey. -DaveM
 *
 * Local BH must be disabled here.
 */
extern struct sock * __inet_lookup_established(struct net *net,
		struct inet_hashinfo *hashinfo,
		const __be32 saddr, const __be16 sport,
		const __be32 daddr, const u16 hnum, const int dif);

static inline struct sock *
	inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
				const __be32 saddr, const __be16 sport,
				const __be32 daddr, const __be16 dport,
				const int dif)
{
	return __inet_lookup_established(net, hashinfo, saddr, sport, daddr,
					 ntohs(dport), dif);
}

static inline struct sock *__inet_lookup(struct net *net,
					 struct inet_hashinfo *hashinfo,
					 const __be32 saddr, const __be16 sport,
					 const __be32 daddr, const __be16 dport,
					 const int dif)
{
	u16 hnum = ntohs(dport);
	struct sock *sk = __inet_lookup_established(net, hashinfo,
				saddr, sport, daddr, hnum, dif);

	return sk ? : __inet_lookup_listener(net, hashinfo, daddr, hnum, dif);
}

static inline struct sock *inet_lookup(struct net *net,
				       struct inet_hashinfo *hashinfo,
				       const __be32 saddr, const __be16 sport,
				       const __be32 daddr, const __be16 dport,
				       const int dif)
{
	struct sock *sk;

	local_bh_disable();
	sk = __inet_lookup(net, hashinfo, saddr, sport, daddr, dport, dif);
	local_bh_enable();

	return sk;
}

static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
					     struct sk_buff *skb,
					     const __be16 sport,
					     const __be16 dport)
{
	struct sock *sk;
	const struct iphdr *iph = ip_hdr(skb);

	if (unlikely(sk = skb_steal_sock(skb)))
		return sk;
	else
		return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
				     iph->saddr, sport,
				     iph->daddr, dport, inet_iif(skb));
}

extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
		struct sock *sk, u32 port_offset,
		int (*check_established)(struct inet_timewait_death_row *,
			struct sock *, __u16, struct inet_timewait_sock **),
			       void (*hash)(struct sock *sk));
extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
			     struct sock *sk);
#endif /* _INET_HASHTABLES_H */


text:
namespace AW {

//#if defined _M_IX86
#define __AW_MSVC_WIN_32__
#define __AW_LITTLE_ENDIAN__
//#endif
#define __AW_UTF8__

#ifndef _M_IX86
	#define __FUNCDNAME__ "func"
	#define __FUNCSIG__ "funcsig"
#endif

#ifdef __AW_MSVC_WIN_32__
	typedef int				empty_t;
	constexpr empty_t		empty = 0;

#ifdef __AW_UTF16__
	typedef std::u16string	string;
#define t(str) u##str
	typedef char16_t		character;
	inline static std::string AwStringToStdString(AW::string awStr) {
		static std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> codecvt;
		return codecvt.to_bytes(awStr);
	}

	inline static AW::string StdStringToAwString(std::string str) {
		std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> codecvt;
		return codecvt.from_bytes(str);
	}
#elif defined __AW_UTF8__
	typedef std::string		string;
#define t(str) str
	typedef char			character;
	inline static std::string AwStringToStdString(AW::string awStr) {
		return awStr;
	}

	inline static AW::string StdStringToAwString(std::string str) {
		return str;
	}
#endif

	typedef unsigned char	byte;
	typedef unsigned int	uint32;
	typedef int				int32;
	typedef double			real64;

#endif

#ifdef __AW_LITTLE_ENDIAN__
#define toAwEndian(x) x
#endif

#ifdef __AW_BIG_ENDIAN__
	// only for inner types
	template<typename T>
	std::vector<AW::byte>&& toAwEndian(const std::vector<AW::byte>& v) {
		std::vector<AW::byte> ret(v.size());
		reverse_copy(v.cbegin(), v.cend(), ret.begin());
		return std::move(ret);
	}
#endif

	constexpr uint32 DEFAULT_PORT = 23521;
	constexpr uint32 WORKER_PORT_START = 23522;
	constexpr uint32 MAX_PORTS = 1000;
	constexpr uint32 COMMUNICATION_PORT_START = 25523;
	constexpr uint32 RECV_SEND_INTERVAL_MS = 10;

    constexpr character* CALLBACK_FUNC_NAME = t("___callback");
    constexpr character* NOP = t("__NOP");

	constexpr uint32 PACKET_MAX_LENGTH = 1400;
};

#endif


text:
(function ($, SpriteSpin) {
  "use strict";

  function startAnimation(e) {
    var $this = $(this), data = $this.spritespin('data');
    if (data.loading){
      return;
    }
    SpriteSpin.updateInput(e, data);
    data.dragging = true;
    $this.spritespin("api").startAnimation();
  }

  function stopAnimation(e) {
    var $this = $(this), data = $this.spritespin('data');
    SpriteSpin.resetInput(data);
    data.dragging = false;
    $this.spritespin("api").stopAnimation();
  }

  function updateInput(e) {
    var $this = $(this), data = $this.spritespin('data');

    if (data.dragging) {
      SpriteSpin.updateInput(e, data);

      var half, delta;
      if (data.orientation === "horizontal") {
        half = (data.target.innerWidth() / 2);
        delta = (data.currentX - data.target.offset().left - half) / half;
      } else {
        half = (data.height / 2);
        delta = (data.currentY - data.target.offset().top - half) / half;
      }
      data.reverse = delta < 0;
      delta = delta < 0 ? -delta : delta;
      data.frameTime = 80 * (1 - delta) + 20;

      if (((data.orientation === 'horizontal') && (data.dX < data.dY)) ||
        ((data.orientation === 'vertical') && (data.dX < data.dY))) {
        e.preventDefault();
      }
    }
  }

  SpriteSpin.registerModule('hold', {

    mousedown: startAnimation,
    mousemove: updateInput,
    mouseup: stopAnimation,
    mouseleave: stopAnimation,

    touchstart: startAnimation,
    touchmove: updateInput,
    touchend: stopAnimation,
    touchcancel: stopAnimation,

    onFrame: function () {
      $(this).spritespin("api").startAnimation();
    }
  });

}(window.jQuery || window.Zepto || window.$, window.SpriteSpin));