text:
package cmds;

import com.google.common.base.Splitter;

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

public abstract class AbstractCommand implements Command {

  public static final String COMMAND_PARTS_SEPARATOR = " ";

  public static final String QUOTE = "\"";

  protected String commandName;

  protected List<String> args = new ArrayList<>();

  public AbstractCommand(String cmd) {
    List<String> cmdParts = toCommandParts(cmd);
    if (!cmdParts.isEmpty()) {
      commandName = cmdParts.get(0);
      if (cmdParts.size() >= 2) {
        args = cmdParts.subList(1, cmdParts.size());
      }
    }

  }

  public static List<String> toCommandParts(String cmd) {
    List<String> cmdParts = Splitter.on(COMMAND_PARTS_SEPARATOR).trimResults().
                                     omitEmptyStrings().splitToList(cmd);

    List<String> commandParts = new ArrayList<>();
    StringBuilder builder = new StringBuilder();
    boolean openedQuotes = false;
    for (String cmdPart : cmdParts) {
      if (inQuotes(cmdPart) && !openedQuotes) {
        commandParts.add(cmdPart);
      }
      else if (cmdPart.startsWith(QUOTE) && !openedQuotes) {
        String begin = cmdPart + COMMAND_PARTS_SEPARATOR;
        builder = new StringBuilder(begin);
        openedQuotes = true;
      }
      else if (cmdPart.endsWith(QUOTE) && openedQuotes) {
        builder.append(cmdPart);
        commandParts.add(builder.toString());
        openedQuotes = false;
      }
      else if (openedQuotes) {
        builder.append(cmdPart + COMMAND_PARTS_SEPARATOR);
      }
      else {
        commandParts.add(cmdPart);
      }
    }
    return commandParts;
  }

  public static boolean inQuotes(String str) {
    return str.startsWith(QUOTE) && str.endsWith(QUOTE);
  }
}


text:
package org.apache.drill.common.logical.data;

import java.util.Iterator;

import org.apache.drill.common.logical.data.visitors.LogicalVisitor;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.collect.Iterators;

@JsonTypeName("transform")
public class Transform extends SingleInputOperator {

  private final NamedExpression[] transforms;

  @JsonCreator
  public Transform(@JsonProperty("transforms") NamedExpression[] transforms) {
    super();
    this.transforms = transforms;
  }

  public NamedExpression[] getTransforms() {
    return transforms;
  }

  @Override
  public <T, X, E extends Throwable> T accept(LogicalVisitor<T, X, E> logicalVisitor, X value) throws E {
    return logicalVisitor.visitTransform(this, value);
  }

  @Override
  public Iterator<LogicalOperator> iterator() {
    return Iterators.singletonIterator(getInput());
  }

}

redpajama_set_name: RedPajamaGithub


text:
%% function [W] = buildW_pmi_ST(f_maps,rf,p,opts,row, col)
% builds an affinity matrix W for image im based on PMI
%
% INPUTS
%  f_maps   - NxMxF array of F feature maps for an NxM image
%  rf       - the learned random forest for approximating PMI (unused if ~opts.approximate_PMI)
%  p        - P(A,B) (unused if opts.approximate_PMI)
%  opts     - parameter settings (see setEnvironment)
%  samples   - either the number of samples from the full affinity matrix to
%               compute, or the indices of the full affinity matrix to compute, or empty,
%               in which case the full affinity matrix is computed
%
% OUTPUTS
%  W - affinity matrix
%
% -------------------------------------------------------------------------
% Crisp Boundaries Toolbox
% Phillip Isola, 2014 [phillpi@mit.edu]
% Please email me if you find bugs, or have suggestions or questions
% -------------------------------------------------------------------------

function [W] = buildW_pmi_ST(f_maps,rf,p,opts,ii, jj)

%     if (~exist('samples','var'))
%         samples = [];
%     end
%     im_size = size(f_maps(:,:,1));
%
%     %% get local pixel pairs
%     if (isempty(samples) || size(samples,2)==1)
%         [ii,jj] = getLocalPairs(im_size,[],[],samples);
%     else
%         ii = samples(:,1);
%         jj = samples(:,2);
%     end

    %% initialize affinity matrix
    %Npixels = prod(im_size);
    Npixels = size(f_maps,1);
    W = sparse(double(ii),double(jj),0,Npixels,Npixels);

    %% extract features F
    [F,F_unary] = extractF_ST(f_maps,ii,jj);

    %keyboard

    %% evaluate affinities
    if (opts.approximate_PMI)
        w = exp(fastRFreg_predict(F,rf));
    else
        pmi = evalPMI(p,F,F_unary,ii,jj,opts);
        w = exp(pmi);
    end

    %%
    W2 = sparse(double(ii),double(jj),w,Npixels,Npixels);
    W = W+W2;
    W = (W+W'); % we only computed one half of the affinities, now assume they are symmetric
end


text:
namespace TheXDS.MCART.ViewModel;
using System.Windows;

/// <summary>
/// ViewModel con propiedades básicas de gestión de la ventana.
/// </summary>
public abstract class WpfWindowViewModel : WindowViewModel
{
    private WindowState _windowState;

    /// <summary>
    /// Obtiene o establece el estado de la ventana.
    /// </summary>
    public WindowState WindowState
    {
        get => _windowState;
        set => Change(ref _windowState, value);
    }
}


text:
class Coman::Response
  require_relative 'response/code_value'
  require_relative 'response/code_and_status_validator'
  require_relative 'response/messages_validator'
  require_relative 'response/status_value'

  attr_reader :messages, :result

  def initialize(code: nil, messages: [], status:, result: nil)
    @code     = code
    @messages = messages
    @status   = status
    @result   = result

    validate
  end

  def code
    code_value.get
  end

  def error(code = nil, &block)
    return self if already_called_for?(:error)
    return self unless block_given?
    return self unless error?
    return self if code && Coman::Response::CodeValue.new(code: code) != code_value
    block.call(result, messages)
    set_already_called_for(:error)
    self
  end

  def error?
    status_value.error?
  end

  def ok(code = nil, &block)
    return self if already_called_for?(:ok)
    return self unless block_given?
    return self unless ok?
    return self if code && Coman::Response::CodeValue.new(code: code) != code_value
    block.call(result, messages)
    set_already_called_for(:ok)
    self
  end

  def ok?
    status_value.ok?
  end

  def status
    status_value.get
  end

  def to_s
    [].tap do |string|
      string << "status=#{status}"
      string << "messages=#{messages.join(', ')}" if messages.present?
      string << "result=#{result}" if result
    end.join(', ').insert(0, 'RESULT: ')
  end

  private

  def already_called_for?(status)
    already_called_for[status] == true
  end

  def already_called_for
    @already_called_for ||= { error: false, ok: false }
  end

  def code_value
    return @code_value if @code_value
    if @code.nil?
      @code = 200 if ok?
      @code = 400 if error?
    end
    @code_value = Coman::Response::CodeValue.new(code: @code)
  end

  def set_already_called_for(status)
    already_called_for[status] = true
  end

  def status_value
    @status_value ||= Coman::Response::StatusValue.new(status: @status)
  end

  def validate
    # Values are validated on initialize
    status_value
    code_value
    [
      Coman::Response::CodeAndStatusValidator.new(code_value: code_value, status_value: status_value),
      Coman::Response::MessagesValidator.new(messages: messages)
    ].each(&:validate)
  end

  class << self
    def error(opts = {})
      new(opts.merge(status: :error))
    end

    def ok(opts = {})
      new(opts.merge(status: :ok))
    end
  end
end


text:
REDIS_PREFIX = "ruby_quest://"

#The primary queue that handles quest events
REDIS_QUEUE_KEY = "#{REDIS_PREFIX}queue"

#Queue managed by cron that publishes future events into the main queue
REDIS_FUTURE_PRIORITY_QUEUE_KEY = "#{REDIS_PREFIX}future_priority_queue"

#Number of times per second the cron event queue is checked
TICKS_PER_SECOND = 1


text:
package com.netflix.spinnaker.echo.microsoftteams.api;

public class MicrosoftTeamsFact {
  public String name;
  public String value;

  public MicrosoftTeamsFact(String name, String value) {
    this.name = name;
    this.value = value;
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Op. bot. 100: 135 (1989)

#### Original name
Gyroporus cyanescens var. sulfureus Kalamees

### Remarks
null


text:
    Dear {{username}},

    You've received this email because someone using the email address {{email}}--hopefully you--opened up an account at kinkstruction.com.
    Please click the link below to validate your email address and activate your account.

    {{validation_url}}

    Sincerely,

    The Kinkstruction Admin


text:
#ifndef CLOCKWORK_APPLICATION_HH
#define CLOCKWORK_APPLICATION_HH

#include <QGuiApplication>
#include "ApplicationSettings.hh"
#include "Error.hh"
#include "UserInterface.hh"
#include "Scene.hh"

namespace clockwork {
/**
 *
 */
class Application final : public QGuiApplication {
	Q_OBJECT
	Q_PROPERTY(QString applicationRepository READ applicationRepository CONSTANT)
public:
	/**
	 * Instantiates the application.
	 */
	Application(int& argc, char** argv);
	/**
	 *
	 */
	Application(const Application&) = delete;
	/**
	 *
	 */
	Application(Application&&) = delete;
	/**
	 *
	 */
	~Application();
	/**
	 *
	 */
	Application& operator=(const Application&) = delete;
	/**
	 *
	 */
	Application& operator=(Application&&) = delete;
	/**
	 * Returns the application's source code repository URL.
	 */
	QString applicationRepository() const;
	/**
	 * Initializes the application.
	 */
	Error initialize();
	/**
	 * Returns the application's configuration settings.
	 */
	ApplicationSettings& getSettings();
	/**
	 * Returns the application's scene.
	 */
	Scene& getScene();
private:
	/**
	 * Renders the application's scene.
	 */
	void renderScene();
	/**
	 * Parses the specified command line arguments.
	 */
	void parseCommandLineArguments(int& argc, char** argv);
	/**
	 * The application's configuration settings.
	 */
	ApplicationSettings settings_;
	/**
	 * The application's scene.
	 */
	Scene scene_;
	/**
	 * The application's user interface.
	 */
	UserInterface userInterface_;
signals:
	/**
	 * A signal that is emitted when a frame has been successfully rendered.
	 */
	void frameRendered();
};
} // namespace clockwork

#endif // CLOCKWORK_APPLICATION_HH


text:
import { test, moduleFor } from 'ember-qunit';

moduleFor('route:lookup-sale', 'LookupSaleRoute', {
  // Specify the other units that are required for this test.
  // needs: ['controller:foo']
});

test('it exists', function() {
  var route = this.subject();
  ok(route);
});


text:
"""
    fantastic Add-on

    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 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

from resources.lib.modules import log_utils

try:
    import urlresolver

    debrid_resolvers = [resolver() for resolver in urlresolver.relevant_resolvers(order_matters=True) if resolver.isUniversal()]

    if len(debrid_resolvers) == 0:
        # Support Rapidgator accounts! Unfortunately, `sources.py` assumes that rapidgator.net is only ever
        # accessed via a debrid service, so we add rapidgator as a debrid resolver and everything just works.
        # As a bonus(?), rapidgator links will be highlighted just like actual debrid links
        debrid_resolvers = [resolver() for resolver in urlresolver.relevant_resolvers(order_matters=True,include_universal=False) if 'rapidgator.net' in resolver.domains]

except:
    debrid_resolvers = []

def status():
    return debrid_resolvers != []

def resolver(url, debrid):
    try:
        debrid_resolver = [resolver for resolver in debrid_resolvers if resolver.name == debrid][0]

        debrid_resolver.login()
        _host, _media_id = debrid_resolver.get_host_and_id(url)
        stream_url = debrid_resolver.get_media_url(_host, _media_id)

        return stream_url
    except Exception as e:
        log_utils.log('%s Resolve Failure: %s' % (debrid, e), log_utils.LOGWARNING)
        return None


text:
package com.buildria.mocking.builder.rule;

import com.buildria.mocking.TestNameRule;
import com.buildria.mocking.stub.Call;
import com.buildria.mocking.stub.Pair;
import java.util.ArrayList;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;

import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class ParameterRuleTest {

    @Rule
    public TestNameRule testNameRule = new TestNameRule();

    private ParameterRule target;

    @Test(expected = NullPointerException.class)
    public void testConstructorKeyNull() throws Exception {
        String key = null;
        String[] values = new String[] {"values"};
        target = new ParameterRule(key, values);
    }

    @Test(expected = NullPointerException.class)
    public void testConstructorValuesNull() throws Exception {
        String key = "key";
        String[] values = null;
        target = new ParameterRule(key, values);
    }

    @Test(expected = NullPointerException.class)
    public void testApplyCallNull() throws Exception {
        String key = "key";
        String[] values = new String[] {"values"};
        target = new ParameterRule(key, values);

        Call call = null;
        boolean actual = target.apply(call);
    }

    @Test
    public void testApplyOneParams() throws Exception {
        String key = "key";
        String[] values = new String[]{"value1"};
        target = new ParameterRule(key, values);

        Call call = mock(Call.class);
        List<Pair> params = new ArrayList<>();
        params.add(new Pair("key", "value1"));

        when(call.getParameters()).thenReturn(params);

        boolean actual = target.apply(call);

        assertThat(actual, is(true));
    }

    @Test
    public void testApplyTwoParams() throws Exception {
        String key = "key";
        String[] values = new String[]{"value1", "value2"};
        target = new ParameterRule(key, values);

        Call call = mock(Call.class);
        List<Pair> params = new ArrayList<>();
        params.add(new Pair("key", "value1"));
        params.add(new Pair("key", "value2"));

        when(call.getParameters()).thenReturn(params);

        boolean actual = target.apply(call);

        assertThat(actual, is(true));
    }

    @Test
    public void testApplyFalse() throws Exception {
        String key = "key";
        String[] values = new String[]{"value1"};
        target = new ParameterRule(key, values);

        Call call = mock(Call.class);
        List<Pair> params = new ArrayList<>();
        params.add(new Pair("key", "value11"));

        when(call.getParameters()).thenReturn(params);

        boolean actual = target.apply(call);

        assertThat(actual, is(false));
    }

    @Test
    public void testApplyFalse2() throws Exception {
        String key = "key";
        String[] values = new String[]{"value1"};
        target = new ParameterRule(key, values);

        Call call = mock(Call.class);
        List<Pair> params = new ArrayList<>();
        params.add(new Pair("key1", "value11"));

        when(call.getParameters()).thenReturn(params);

        boolean actual = target.apply(call);

        assertThat(actual, is(false));
    }

    @Test
    public void testApplyCaseSensitive1() throws Exception {
        String key = "key";
        String[] values = new String[]{"value1"};
        target = new ParameterRule(key, values);

        Call call = mock(Call.class);
        List<Pair> params = new ArrayList<>();
        params.add(new Pair("kEy", "value1"));

        when(call.getParameters()).thenReturn(params);

        boolean actual = target.apply(call);

        assertThat(actual, is(false));
    }

    @Test
    public void testApplyCaseSensitive2() throws Exception {
        String key = "key";
        String[] values = new String[]{"value1"};
        target = new ParameterRule(key, values);

        Call call = mock(Call.class);
        List<Pair> params = new ArrayList<>();
        params.add(new Pair("key", "Value1"));

        when(call.getParameters()).thenReturn(params);

        boolean actual = target.apply(call);

        assertThat(actual, is(false));
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BasicLoader;
using CADLoader;
using STPLoader.Implementation.Parser;

namespace STPLoader
{
    public static class ParserFactory
    {
        public static IParser Create()
        {
            return new StpParser();
        }
    }
}


text:
import sortBy from 'lodash/sortBy'
import * as React from 'react'
import { ContinueModal, Card, ToggleButton } from '@opentrons/components'
import { i18n } from '../../../localization'
import { resetScrollElements } from '../../../ui/steps/utils'
import { Portal } from '../../portals/MainPageModalPortal'
import styles from '../SettingsPage.css'
import modalStyles from '../../modals/modal.css'
import {
  userFacingFlags,
  type Flags,
  type FlagTypes,
} from '../../../feature-flags'

type Props = {|
  flags: Flags,
  setFeatureFlags: (flags: Flags) => mixed,
|}

export const FeatureFlagCard = (props: Props): React.Node => {
  const [modalFlagName, setModalFlagName] = React.useState<FlagTypes | null>(
    null
  )

  const prereleaseModeEnabled = props.flags.PRERELEASE_MODE === true

  const allFlags = sortBy(Object.keys(props.flags))

  const userFacingFlagNames = allFlags.filter(flagName =>
    userFacingFlags.includes(flagName)
  )

  const prereleaseFlagNames = allFlags.filter(
    flagName => !userFacingFlags.includes(flagName)
  )

  const getDescription = (flag: FlagTypes): React.Node => {
    const RICH_DESCRIPTIONS: { [FlagTypes]: React.Node } = {
      OT_PD_DISABLE_MODULE_RESTRICTIONS: (
        <>

{i18n.t(`feature_flags.${flag}.description_1`)}

{i18n.t(`feature_flags.${flag}.description_2`)}

        </>
      ),
    }
    return (
      RICH_DESCRIPTIONS[flag] || (

{i18n.t(`feature_flags.${flag}.description`)}

      )
    )
  }

  const toFlagRow = flagName => (

          {i18n.t(`feature_flags.${flagName}.title`)}

        <ToggleButton
          className={styles.toggle_button}
          toggledOn={Boolean(props.flags[flagName])}
          onClick={() => {
            resetScrollElements()
            setModalFlagName(flagName)
          }}
        />

        {getDescription(flagName)}

  )

  const noFlagsFallback = (

      No experimental settings are available in this version of Protocol
      Designer.

  )

  const userFacingFlagRows = userFacingFlagNames.map(toFlagRow)
  const prereleaseFlagRows = prereleaseFlagNames.map(toFlagRow)

  let flagSwitchDirection: string = 'on'

  if (modalFlagName) {
    const isFlagOn: ?boolean = props.flags[modalFlagName]
    flagSwitchDirection = isFlagOn ? 'off' : 'on'
  }
  return (
    <>
      {modalFlagName && (
        <Portal>
          <ContinueModal
            alertOverlay
            className={modalStyles.modal}
            heading={i18n.t(
              `modal.experimental_feature_warning.${flagSwitchDirection}.title`
            )}
            onCancelClick={() => setModalFlagName(null)}
            onContinueClick={() => {
              props.setFeatureFlags({
                [(modalFlagName: string)]: !props.flags[modalFlagName],
              })
              setModalFlagName(null)
            }}
          >

              {i18n.t(
                `modal.experimental_feature_warning.${flagSwitchDirection}.body1`
              )}

              {i18n.t(
                `modal.experimental_feature_warning.${flagSwitchDirection}.body2`
              )}

          </ContinueModal>
        </Portal>
      )}
      <Card title={i18n.t('card.title.feature_flags')}>

          {userFacingFlagRows.length > 0 ? userFacingFlagRows : noFlagsFallback}

      </Card>
      {prereleaseModeEnabled && (
        <Card title={i18n.t('card.title.prerelease_mode_flags')}>

{prereleaseFlagRows}

        </Card>
      )}
    </>
  )
}


text:
The `api` Directory
===================

This folder holds all API related routes/functions.

Notice that the file `index.js` has all the routes and uses an express router to make life more simple:

```javascript
var router = express.Router()
```

That router then must be exported (typically at the end of the file) so that the file requiring it (probably `app.js`) can know what to do when a request is sent to the API:

```javascript
module.exports = router;
```

Also, notice that because the file is called `index.js` and is inside its own directory, it can be required as simply the directory name (as seen on line 20 of `app.js`):

```javascript
var api = require('api');
```

----------------------

## Public vs Private API ##

The routes that live in the `index.js` file are private and protected by authentication. The routes that live in the `public.js` file are able to be accessed by any anonymous or authenticated user. These routes are how users can get there JWT to become authenticated.


text:
<Record>
<Term>Quartan Malaria</Term>
<SemanticType>Disease or Syndrome</SemanticType>
<ParentTerm>Malaria</ParentTerm>
<ClassificationPath>Findings_and_Disorders_Kind/Disease, Disorder or Finding/Disease or Disorder/Non-Neoplastic Disorder/Non-Neoplastic Disorder by Special Category/Infectious Disorder/Parasitic Infection/Malaria/Quartan Malaria</ClassificationPath>
<BroaderTerm>Parasitic Infection</BroaderTerm>
<BroaderTerm>Infectious Disorder</BroaderTerm>
<BroaderTerm>Non-Neoplastic Disorder</BroaderTerm>
<BroaderTerm>Disease or Disorder</BroaderTerm>
<BroaderTerm>Non-Neoplastic Disorder by Special Category</BroaderTerm>
<BroaderTerm>Malaria</BroaderTerm>
<BroaderTerm>Quartan Malaria</BroaderTerm>
<BroaderTerm>Disease, Disorder or Finding</BroaderTerm>
<BroaderTerm>Findings_and_Disorders_Kind</BroaderTerm>
<Synonym>Quartan Malaria</Synonym>
<Source>NCI Thesaurus</Source>
</Record>


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Arebis.Data.Entity.InformationSchema
{
    [Table("VIEWS", Schema = "INFORMATION_SCHEMA")]
    public class View : InformationSchemaEntity
    {
        [Key, ForeignKey("Schema"), Column("TABLE_CATALOG", Order = 0)]
        public string CatalogName { get; set; }

        [Key, ForeignKey("Schema"), Column("TABLE_SCHEMA", Order = 1)]
        public string SchemaName { get; set; }

        public virtual Schema Schema { get; set; }

        [Key, Column("TABLE_NAME", Order = 2)]
        public string Name { get; set; }

        [Column("VIEW_DEFINITION")]
        public string Definition { get; set; }

        [Column("CHECK_OPTION")]
        public string CheckOption { get; set; }

        [Column("IS_UPDATABLE")]
        public string IsUpdatableStr { get; set; }

        [InverseProperty("view")]
        public virtual ICollection<ViewColumn> Columns { get; set; }

        [InverseProperty("View")]
        public virtual ICollection<ViewTable> Tables { get; set; }
    }
}


text:
[assembly: Elmah.Scc("$Id: ErrorTextFormatter.cs 566 2009-05-11 10:37:10Z azizatif $")]

namespace Elmah
{
    #region Imports

    using System;

    using TextWriter = System.IO.TextWriter;

    #endregion

    /// <summary>
    /// Provides the base contract for implementations that render
    /// text-based formatting for an error.
    /// </summary>

    public abstract class ErrorTextFormatter
    {
        /// <summary>
        /// Gets the MIME type of the text format provided by the formatter
        /// implementation.
        /// </summary>

        public abstract string MimeType { get; }

        /// <summary>
        /// Formats a text representation of the given <see cref="Error"/>
        /// instance using a <see cref="TextWriter"/>.
        /// </summary>

        public abstract void Format(TextWriter writer, Error error);
    }
}


text:
ActiveRecord::Schema.define(:version => 20090906231856) do

  create_table "affiliates", :force => true do |t|
    t.string   "name"
    t.string   "full_name"
    t.string   "logo_path"
    t.integer  "admin_role_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "affiliations", :force => true do |t|
    t.integer  "location_id"
    t.integer  "affiliate_id"
    t.date     "expires"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "contact_name"
    t.string   "contact_address"
    t.string   "contact_city"
    t.string   "contact_state"
    t.string   "contact_zip"
    t.string   "contact_telephone"
    t.string   "contact_email"
    t.string   "foreign_key"
  end

  add_index "affiliations", ["affiliate_id", "foreign_key"], :name => "index_affiliations_on_affiliate_id_and_foreign_key"

  create_table "clubs", :force => true do |t|
    t.string   "contacts"
    t.string   "description"
    t.string   "foreign_key"
    t.boolean  "hidden"
    t.string   "hours"
    t.string   "name"
    t.string   "slug"
    t.string   "source_id"
    t.string   "url"
    t.integer  "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "locations", :force => true do |t|
    t.string   "name"
    t.integer  "user_id"
    t.string   "street_address"
    t.string   "city"
    t.string   "state"
    t.string   "zip_code"
    t.string   "hours"
    t.decimal  "lat",               :precision => 15, :scale => 10
    t.decimal  "lng",               :precision => 15, :scale => 10
    t.string   "url"
    t.string   "description"
    t.text     "contacts"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "slug"
    t.string   "country"
    t.string   "geocode_precision"
    t.boolean  "hidden"
    t.integer  "source_id"
    t.string   "foreign_key"
  end

  add_index "locations", ["slug"], :name => "index_locations_on_slug", :unique => true

  create_table "roles", :force => true do |t|
    t.string   "name"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "parent_id"
  end

  create_table "slug_redirects", :force => true do |t|
    t.string   "slug"
    t.integer  "location_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "slug_redirects", ["slug"], :name => "index_slug_redirects_on_slug", :unique => true

  create_table "sources", :force => true do |t|
    t.string   "name"
    t.string   "url"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "user_roles", :force => true do |t|
    t.integer  "user_id"
    t.integer  "role_id"
    t.integer  "granting_user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "users", :force => true do |t|
    t.string   "login",                                                  :null => false
    t.string   "email",                                                  :null => false
    t.string   "crypted_password",                                       :null => false
    t.string   "salt",                                                   :null => false
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "remember_token"
    t.datetime "remember_token_expires_at"
    t.string   "activation_code",           :limit => 40
    t.datetime "activated_at"
    t.string   "persistence_token",                                      :null => false
    t.string   "perishable_token",                                       :null => false
    t.integer  "login_count",                             :default => 0, :null => false
    t.integer  "failed_login_count",                      :default => 0, :null => false
    t.datetime "last_request_at"
    t.datetime "current_login_at"
    t.datetime "last_login_at"
    t.string   "current_login_ip"
    t.string   "last_login_ip"
  end

end


text:
package com.intellij.compiler.ant.taskdefs;

import com.intellij.compiler.ant.Tag;
import com.intellij.openapi.util.Couple;
import org.jetbrains.annotations.NonNls;

/**
 * @author Eugene Zhuravlev
 */
public class Property extends Tag {

  public Property(@NonNls final String name, final String value) {
    super("property", Couple.of("name", name), Couple.of("value", value));
  }

  public Property(@NonNls final String filePath) {
    super("property", Couple.of("file", filePath));
  }

}


text:
/*
 * QueuedReferrerProcessingJob.java
 *
 * Created on December 20, 2005, 3:08 PM
 */

package org.apache.roller.business.referrers;

import org.apache.roller.model.RollerFactory;

/**
 * Same as the ReferrerProcessingJob, except that we add a little logic that
 * tries to lookup incoming referrers from the ReferrerQueueManager.
 *
 * @author Allen Gilliland
 */
public class QueuedReferrerProcessingJob extends ReferrerProcessingJob {

    public QueuedReferrerProcessingJob() {
        super();
    }

    public void execute() {

        ReferrerQueueManager refQueue =
                RollerFactory.getRoller().getReferrerQueueManager();

        // check the queue for any incoming referrers
        referrer = refQueue.dequeue();

        // work until the queue is empty
        while(referrer != null) {
            super.execute();

            // check if there are more referrers to process
            referrer = refQueue.dequeue();
        }

    }

}


text:
Returns all fields and values of the hash stored at key. In the returned
value, every field name is followed by its value, so the length of the
reply is twice the size of the hash.

#### Return value
**Array reply**: list of fields and their values stored in the hash, or an empty list when *key* does not exist.

#### Examples
```javascript
    // Sync
    Ayodis.hset('myhash', 'field1', "Hello"); // => (integer) 1
    Ayodis.hset('myhash', 'field2', "World"); // => (integer) 1
    Ayodis.hgetall('myhash'); // => 1) "field1", 2) "Hello", 3) "field2", 4) "World"

    // Async
    Ayodis.hgetall('myhash', function(err, res) {
        // err => null
        // res => 1) "field1", 2) "Hello", 3) "field2", 4) "World"
    });
```


text:
using System.Runtime.InteropServices;

namespace Meziantou.Framework.Win32.Natives;

[ComImport,
Guid(IIDGuid.IShellItem),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IShellItem
{
    void BindToHandler([In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc, [In] ref Guid bhid, [In] ref Guid riid, out IntPtr ppv);

    void GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);

    void GetDisplayName([In] SIGDN sigdnName, [MarshalAs(UnmanagedType.LPWStr)] out string ppszName);

    void GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);

    void Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder);
}


text:
package com.jfinalshop.controller.admin;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;

import com.jfinal.aop.Before;
import com.jfinal.core.JFinal;
import com.jfinal.kit.StrKit;
import com.jfinal.upload.UploadFile;
import com.jfinalshop.bean.SystemConfig;
import com.jfinalshop.model.Brand;
import com.jfinalshop.model.Product;
import com.jfinalshop.util.CommonUtil;
import com.jfinalshop.validator.admin.BrandValidator;

/**
 * 后台类 - 品牌
 *
 */
public class BrandController extends BaseAdminController<Brand>{

	private Brand brand;
	private UploadFile logo;
	// 列表
	public void list() {
		findByPage();
		render("/admin/brand_list.html");
	}

	// 添加
	public void add() {
		render("/admin/brand_input.html");
	}

	// 编辑
	public void edit() {
		String id = getPara("id","");
		if (StrKit.notBlank(id)){
			setAttr("brand", Brand.dao.findById(id));
		}
		render("/admin/brand_input.html");
	}

	// 保存
	@Before(BrandValidator.class)
	public void save() {
		logo = getFile();
		brand = getModel(Brand.class);
		if (logo != null) {
			String allowedUploadImageExtension = getSystemConfig().getAllowedUploadImageExtension().toLowerCase();
			if (StringUtils.isEmpty(allowedUploadImageExtension)){
				addActionError("不允许上传图片文件!");
				return;
			}
			String[] imageExtensionArray = allowedUploadImageExtension.split(SystemConfig.EXTENSION_SEPARATOR);
			String logoExtension = StringUtils.substringAfterLast(logo.getFileName(), ".").toLowerCase();
			if (!ArrayUtils.contains(imageExtensionArray, logoExtension)) {
				addActionError("只允许上传图片文件类型: " + allowedUploadImageExtension + "!");
				return;
			}
			int uploadLimit = getSystemConfig().getUploadLimit() * 1024;
			if (uploadLimit != 0 && logo.getFile().length() > uploadLimit) {
				addActionError("Logo文件大小超出限制!");
				return;
			}
			File uploadImageDir = new File(JFinal.me().getServletContext().getRealPath(SystemConfig.UPLOAD_IMAGE_DIR));
			if (!uploadImageDir.exists()) {
				uploadImageDir.mkdirs();
			}
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
			String dateString = simpleDateFormat.format(new Date());
			String uploadImagePath = SystemConfig.UPLOAD_IMAGE_DIR + dateString + "/" + CommonUtil.getUUID() + "." + logoExtension;
			File file = new File(JFinal.me().getServletContext().getRealPath(uploadImagePath));
			try {
				FileUtils.copyFile(logo.getFile(), file);
			} catch (IOException e) {
				e.printStackTrace();
			}
			brand.set("logo", uploadImagePath);
		}
		saved(brand);
		redirect("/brand/list");
	}

	// 更新
	@Before(BrandValidator.class)
	public void update() {
		logo = getFile();
		brand = getModel(Brand.class);
		if (logo != null) {
			String allowedUploadImageExtension = getSystemConfig().getAllowedUploadImageExtension().toLowerCase();
			if (StringUtils.isEmpty(allowedUploadImageExtension)){
				addActionError("不允许上传图片文件!");
				return;
			}
			String[] imageExtensionArray = allowedUploadImageExtension.split(SystemConfig.EXTENSION_SEPARATOR);
			String logoExtension = StringUtils.substringAfterLast(logo.getFileName(), ".").toLowerCase();
			if (!ArrayUtils.contains(imageExtensionArray, logoExtension)) {
				addActionError("只允许上传图片文件类型: " + allowedUploadImageExtension + "!");
				return;
			}
			int uploadLimit = getSystemConfig().getUploadLimit() * 1024;
			if (uploadLimit != 0 && logo.getFile().length() > uploadLimit) {
				addActionError("Logo文件大小超出限制!");
				return;
			}
			File uploadImageDir = new File(JFinal.me().getServletContext().getRealPath(SystemConfig.UPLOAD_IMAGE_DIR));
			if (!uploadImageDir.exists()) {
				uploadImageDir.mkdirs();
			}
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMM");
			String dateString = simpleDateFormat.format(new Date());
			String uploadImagePath = SystemConfig.UPLOAD_IMAGE_DIR + dateString + "/" + CommonUtil.getUUID() + "." + logoExtension;
			File file = new File(JFinal.me().getServletContext().getRealPath(uploadImagePath));
			try {
				FileUtils.copyFile(logo.getFile(), file);
			} catch (IOException e) {
				e.printStackTrace();
			}
			brand.set("logo", uploadImagePath);
		}
		updated(brand);
		redirect("/brand/list");
	}

	// 删除
	public void delete() {
		String[] ids = getParaValues("ids");
		if (ids != null && ids.length > 0) {
			for (String id : ids) {
				// 充值记录
				List<Product> productList = Brand.dao.findById(id).getProductList();
				if (productList != null && productList.size() > 0){
					ajaxJsonErrorMessage("品牌在产品列表中存在,删除失败!");
					return;
				}
				if (Brand.dao.delete(id)) {
					ajaxJsonSuccessMessage("删除成功!");
				} else {
					ajaxJsonErrorMessage("删除失败!");
				}
			}
		} else {
			ajaxJsonErrorMessage("id为空未选中,删除失败!");
		}
	}
}


text:
from twisted.internet.defer import Deferred

def send_poem(d):
    print 'Sending poem'
    d.callback('Once upon a midnight dreary')

def get_poem():
    """Return a poem 5 seconds later."""
    from twisted.internet import reactor
    d = Deferred()
    reactor.callLater(5, send_poem, d)
    return d

def got_poem(poem):
    print 'I got a poem:', poem

def poem_error(err):
    print 'get_poem failed:', err

def main():
    from twisted.internet import reactor
    reactor.callLater(10, reactor.stop) # stop the reactor in 10 seconds

    d = get_poem()
    d.addCallbacks(got_poem, poem_error)

    reactor.callLater(2, d.cancel) # cancel after 2 seconds

    reactor.run()

main()


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace DroneAidWP81.Layouts
{
    public partial class PLogin : PhoneApplicationPage
    {
        public PLogin()
        {
            InitializeComponent();
        }

        private void btnTap_FacebookLogin(object sender, System.Windows.Input.GestureEventArgs e)
        {
            //Navigate facebook page
            NavigationService.Navigate(new Uri("/Layouts/PFacebookLogin.xaml", UriKind.Relative));
        }
    }
}


text:
package com.adobe.aem.demomachine.gui;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.text.Position;

import org.apache.log4j.Logger;
import org.apache.tools.ant.ProjectHelper;

public class AemDemoNew extends JDialog {

	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private JTextField demoBuildName;
	@SuppressWarnings({ "rawtypes" })
	private JList listConfigs;
	@SuppressWarnings({ "rawtypes" })
	private JList listTopologies;
	@SuppressWarnings({ "rawtypes" })
	private JList listSRP;
	@SuppressWarnings({ "rawtypes" })
	private JList listAemJars;
	@SuppressWarnings({ "rawtypes" })
	private JList listMK;
	private AemDemo aemDemo;
	static Logger logger = Logger.getLogger(AemDemoNew.class);

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public AemDemoNew(AemDemo aemDemoInput) {

		// Initialize as a regular modal window
		super();

		aemDemo = aemDemoInput;

		// Validation tests
		boolean validConfiguration = true;
		List<String> validationErrors = new ArrayList<String>();

		// Let's make sure it's possible to create a demo machine with a license file
		String licenseFileName = "license-" + aemDemo.getDefaultProperties().getProperty("demo.license") + ".properties";
		File licenseFile = new File(aemDemo.getBuildFile().getParentFile().getAbsolutePath() + File.separator + "dist" + File.separator + "license" + File.separator + licenseFileName);
		if (!licenseFile.exists()) {
			validationErrors.add("Please add a valid AEM license file named " + licenseFileName + " in the ${demohome}/dist/license folder");
			validConfiguration = false;
		}

		// Let's make sure it's possible to create a demo machine with at least one .jar file
		AemDemoProperty[] aemJars = AemDemoUtils.listAEMjars(aemDemo.getBuildFile());
		if (aemJars.length==0) {
			validationErrors.add("Please add a valid AEM/CQ .jar file in the ${demohome}/dist/bin folder");
			validConfiguration = false;
		}

		if (validConfiguration) {

			setBounds(150,150,660,340);
			getContentPane().setLayout(null);
			contentPanel.setBounds(0, 0, 660, 340);
			getContentPane().add(contentPanel);
			contentPanel.setLayout(null);

			// Label for demo configs
			JLabel lblSelectADemo = new JLabel("Select demo add-on(s)");
			lblSelectADemo.setBounds(20, 20, 148, 16);
			contentPanel.add(lblSelectADemo);
			JLabel lblSelectMultiple = new JLabel("Use Command/CTRL key for multiple add-ons. (*) indicates that the add-on needs to be downloaded.");
			lblSelectMultiple.setFont(new Font("Serif", Font.ITALIC, 10));
			lblSelectMultiple.setBounds(20, 20, 600, 416);
			contentPanel.add(lblSelectMultiple);

			// List of demo configs
			JScrollPane scrollConfigs = new JScrollPane();
			scrollConfigs.setBounds(20, 45, 140, 175);
			contentPanel.add(scrollConfigs);
			AemDemoProperty[] aemConfigs = AemDemoUtils.listDemoAddons(aemDemo.getBuildFile());
			listConfigs = new JList(aemConfigs);
			listConfigs.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            listConfigs.setSelectedIndices(AemDemoUtils.getDemoAddons(aemDemo.getBuildFile()));

			scrollConfigs.setViewportView(listConfigs);

			// Label for topologies
			JLabel lblEnterAName = new JLabel("Select a topology");
			lblEnterAName.setBounds(175, 20, 124, 16);
			contentPanel.add(lblEnterAName);

			// List of topologies
			JScrollPane scrollTopologies = new JScrollPane();
			scrollTopologies.setBounds(175, 45, 140, 175);
			contentPanel.add(scrollTopologies);
			AemDemoProperty[] aemTopologies = AemDemoUtils.listTopologies(aemDemo.getBuildFile());
			listTopologies = new JList(aemTopologies);
			listTopologies.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			listTopologies.setSelectedIndex(AemDemoUtils.getSelectedIndex(listTopologies,aemDemo.getDefaultProperties(), aemDemo.getPersonalProperties(),AemDemoConstants.OPTIONS_TOPOLOGIES_DEFAULT));
			scrollTopologies.setViewportView(listTopologies);

			// Label for AEM/CQ jar
			JLabel lblSelectAMk = new JLabel("Select an application");
			lblSelectAMk.setBounds(331, 20, 139, 16);
			contentPanel.add(lblSelectAMk);

			// List of AEM/CQ Jar files
			JScrollPane scrollAemJars = new JScrollPane();
			scrollAemJars.setBounds(330, 45, 140, 175);
			contentPanel.add(scrollAemJars);
			listAemJars = new JList(aemJars);
			listAemJars.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			listAemJars.setSelectedIndex(AemDemoUtils.getSelectedIndex(listAemJars,aemDemo.getDefaultProperties(), aemDemo.getPersonalProperties(),AemDemoConstants.OPTIONS_JAR_DEFAULT));
			scrollAemJars.setViewportView(listAemJars);

			// Label for persistence options
			JLabel lblPersistence = new JLabel("Micro-Kernel");
			lblPersistence.setBounds(500, 20, 118, 16);
			contentPanel.add(lblPersistence);

			// List of MicroKernels
			JScrollPane scrollMK = new JScrollPane();
			scrollMK.setBounds(500, 45, 140, 80);
			contentPanel.add(scrollMK);
			AemDemoProperty[] aemMKs = AemDemoUtils.listMKs(aemDemo.getBuildFile());
			listMK = new JList(aemMKs);
			listMK.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			listMK.setSelectedIndex(AemDemoUtils.getSelectedIndex(listMK,aemDemo.getDefaultProperties(), aemDemo.getPersonalProperties(),AemDemoConstants.OPTIONS_STORES_DEFAULT));
			scrollMK.setViewportView(listMK);

			// Label for Community persistence options
			JLabel lblCommunityPersistence = new JLabel("Communities");
			lblCommunityPersistence.setBounds(500, 135, 118, 16);
			contentPanel.add(lblCommunityPersistence);

			// List of SRPs
			JScrollPane scrollSRP = new JScrollPane();
			scrollSRP.setBounds(500, 160, 140, 60);
			contentPanel.add(scrollSRP);
			AemDemoProperty[] aemSRPs = AemDemoUtils.listSRPs(aemDemo.getBuildFile());
			listSRP = new JList(aemSRPs);
			listSRP.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			listSRP.setSelectedIndex(AemDemoUtils.getSelectedIndex(listSRP,aemDemo.getDefaultProperties(), aemDemo.getPersonalProperties(),AemDemoConstants.OPTIONS_SRPS_DEFAULT));
			scrollSRP.setViewportView(listSRP);

			// Input field for demo name
			JLabel lblDemoName = new JLabel("Enter a name for your demo environment");
			lblDemoName.setBounds(20, 240, 279, 16);
			contentPanel.add(lblDemoName);

			demoBuildName = new JTextField(AemDemoUtils.getActualPropertyValue(aemDemo.getDefaultProperties(), aemDemo.getPersonalProperties(), AemDemoConstants.OPTIONS_BUILD_DEFAULT));
			demoBuildName.setBounds(295, 235, 345, 28);
			contentPanel.add(demoBuildName);
			demoBuildName.setColumns(10);

			// Create Button (DEFAULT)
			JButton createButton = new JButton("Create");
			createButton.setBounds(220, 275, 100, 30);
			createButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {

					AemDemoProperty selectedSRP  = (AemDemoProperty) listSRP.getModel().getElementAt(listSRP.getSelectedIndex());
					AemDemoProperty selectedMK  = (AemDemoProperty) listMK.getModel().getElementAt(listMK.getSelectedIndex());
					AemDemoProperty selectedTopology  = (AemDemoProperty) listTopologies.getModel().getElementAt(listTopologies.getSelectedIndex());
					AemDemoProperty selectedJar  = (AemDemoProperty) listAemJars.getModel().getElementAt(listAemJars.getSelectedIndex());
					List<AemDemoProperty> selectedAddOns  = listConfigs.getSelectedValuesList();

					// Input validation
					if (!demoBuildName.getText().matches("[a-zA-Z0-9]+")) {

						// Alphanumeric characters only for build name
						JOptionPane.showMessageDialog(null, "Please use alphanumeric characters only for your demo configuration");
						return;

					}

					// Confirmation dialog to avoid accidental replacement of demo machine instances
					if (aemDemo.getListDemoMachines().getModel().getSize()>0) {
						int index = aemDemo.getListDemoMachines().getNextMatch(demoBuildName.getText(),0,Position.Bias.Forward);
						if (index != -1)  {
							int dialogResult = JOptionPane.showConfirmDialog (null, "There's already a demo environmnent with the same name, do you really want to replace it?","Warning",JOptionPane.YES_NO_OPTION);
							if(dialogResult == JOptionPane.NO_OPTION) {
								return;
							}
						}
					}

					// Since it's a new install, not a rebuild, we need to make sure there isn't an existing demobuild.properties file
					File demobuild = new File(aemDemo.getBuildFile().getParentFile().getAbsolutePath() + File.separator + "demos" + File.separator + demoBuildName.getText() + File.separator + "demobuild.properties");
					if (demobuild!=null && demobuild.exists()) {
						if (demobuild.delete()) System.out.println("Existing demobuild.properties deleted since it's a fresh install");
					}

					// New ANT project
					AemDemoProject p = new AemDemoProject(aemDemo);

					// Overriding with the New Dialog properties
					p.setUserProperty("demo.jar", selectedJar.getValue());
					p.setUserProperty("demo.srp", selectedSRP.getValue());
					p.setUserProperty("demo.store", selectedMK.getValue());
					p.setUserProperty("demo.type", selectedTopology.getValue());
					p.setUserProperty("demo.build", demoBuildName.getText());

					// Overriding the demo add-on options with the current selection
					AemDemoProperty[] aemConfigs = AemDemoUtils.listDemoAddons(aemDemo.getBuildFile());
					for (int i=0;i<aemConfigs.length;i++) {

						if (selectedAddOns.contains(aemConfigs[i])) {
							p.setUserProperty("demo.addons." + (i+1) + "." + aemConfigs[i].getValue(),"true");
						} else {
							p.setUserProperty("demo.addons." + (i+1) + "." + aemConfigs[i].getValue(),"false");
						}

					}

					// Make sure host name is there
					try {
						p.setUserProperty("demo.hostname", InetAddress.getLocalHost().getHostName());
					} catch (UnknownHostException ex) {
						logger.error(ex.getMessage());
					}

					p.init();

					ProjectHelper helper = ProjectHelper.getProjectHelper();
					p.addReference("ant.projectHelper", helper);
					helper.parse(p, aemDemo.getBuildFile());

					// Running the target name as a new Thread
					System.out.println("Building a new " + selectedTopology.getValue() + " demo named " + demoBuildName.getText());
					Thread t = new Thread(new AemDemoRunnable(aemDemo, p, AemDemoConstants.BUILD_ACTION));
					t.start();

					// Closing the dialog
					dispose();

				}
			});

			contentPanel.add(createButton);

			// Cancel Button
			JButton cancelButton = new JButton("Cancel");
			cancelButton.setBounds(340, 275, 100, 30);
			cancelButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {

					dispose();

				}
			});
			contentPanel.add(cancelButton);

			// Set Create as the default button
			JRootPane rootPane = SwingUtilities.getRootPane(createButton);
			rootPane.setDefaultButton(createButton);

		} else {

			setBounds(150,150,760,340);
			getContentPane().setLayout(null);
			contentPanel.setBounds(0, 0, 760, 340);
			getContentPane().add(contentPanel);
			contentPanel.setLayout(null);

			JLabel lblSelectADemo = new JLabel("There are validation errors!");
			lblSelectADemo.setBounds(20, 20, 620, 16);
			contentPanel.add(lblSelectADemo);

			int pos=60;
			for(String errorMsg : validationErrors) {
				JLabel lblError = new JLabel(errorMsg);
				lblError.setBounds(20, pos, 720, 16);
				contentPanel.add(lblError);
				pos=pos+40;
			}

			JButton closeButton = new JButton("Close");
			closeButton.setBounds(20, 260, 60, 30);
			closeButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {

					dispose();

				}
			});
			contentPanel.add(closeButton);

		}

		// Closing ESC
		AemDemoUtils.installEscapeCloseOperation(this);

	}

	public JTextField getDemoBuildName() {

		return demoBuildName;

	}

}


text:
using StichtiteForum.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StichtiteForum
{
    public partial class PostsByCategory : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public IQueryable<StichtiteForum.Models.Post> PostsList_GetData()
        {
            StichtiteForumEntities context = new StichtiteForumEntities();
            int id = Convert.ToInt32(this.Request.Params["id"]);
            if (id == 0)
            {
                this.Response.Redirect("~/Default.aspx");
            }

            var posts = context.Posts.Where(x => x.CategoryId == id);
            this.LabelCategoryTitle.Text = this.Server.HtmlEncode(context.Categories.Find(id).Title);

            return posts;
        }
    }
}


text:
package japgolly.scalajs.react.extra.router

import japgolly.scalajs.react._

case class SimHistory(startUrl: AbsUrl) {

  /** Recent (head) to oldest (tail) */
  var history = List(startUrl)
  var broadcasts = Vector.empty[List[AbsUrl]]

  def reset(): Unit =
    reset(startUrl)

  def reset(url: AbsUrl): Unit = {
    history = List(url)
    broadcasts = Vector.empty
  }

  def currentUrl: AbsUrl =
    history.head

  override def toString =
    s"""
       |SimHistory($startUrl)
       | - history: (${history.length})
       |     ↑ [CURRENT]
       |${history.map("     " + _) mkString "\n"}
       | - broadcasts: (${broadcasts.length})
       |     ↓ [FIRST]
       |${broadcasts.map("     " + _) mkString "\n"}
     """.stripMargin

  def interpret[B](cmd: RouteCmd[B]): CallbackTo[B] = {
    import RouteCmd._
    cmd match {
      case PushState(url)         => Callback{history = url :: history}
      case ReplaceState(url)      => Callback{history = url :: history.tail}
      case SetWindowLocation(url) => Callback{history = url :: Nil}
      case BroadcastSync          => Callback{broadcasts :+= history}
      case Return(a)              => CallbackTo.pure(a)
      case Log(msg)               => Callback.log("[SimHistory] " + msg())
      case Sequence(a, b)         => a.foldLeft[CallbackTo[_]](Callback.empty)(_ >> interpret(_)) >> interpret(b)
    }
  }

  def run[P, B](cmd: RouteCmd[B]): B =
    interpret(cmd).runNow()
}


text:
#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
#include "dcmtk/dcmiod/modsynchronisation.h"
#include "dcmtk/ofstd/ofstream.h"
#include "dcmtk/dcmdata/dcvrui.h"
#include "dcmtk/dcmdata/dcvrcs.h"
#include "dcmtk/dcmdata/dcvrlo.h"
#include "dcmtk/dcmdata/dcvrsh.h"
#include "dcmtk/dcmdata/dcdeftag.h"
#include "dcmtk/dcmiod/iodutil.h"

const OFString IODSynchronizationModule::m_ModuleName = "SynchronizationModule";

IODSynchronizationModule::IODSynchronizationModule(OFshared_ptr<DcmItem> item,
                                                   OFshared_ptr<IODRules> rules)
: IODModule(item, rules)
{
  // reset element rules
  resetRules();
}

IODSynchronizationModule::IODSynchronizationModule()
: IODModule()
{
  resetRules();
}

void IODSynchronizationModule::resetRules()
{
  // parameters are tag, VM, type. Overwrite old rules if any.
  m_Rules->addRule(new IODRule(DCM_SynchronizationFrameOfReferenceUID, "1","1", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_SynchronizationTrigger, "1","1", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_TriggerSourceOrType, "1","3", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_SynchronizationChannel, "2","1C", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_AcquisitionTimeSynchronized, "1","1", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_TimeSource, "1","3", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_TimeDistributionProtocol, "1","3", getName(), DcmIODTypes::IE_FOR), OFTrue);
  m_Rules->addRule(new IODRule(DCM_NTPSourceAddress, "1","3", getName(), DcmIODTypes::IE_FOR), OFTrue);
}

OFString IODSynchronizationModule::getName() const
{
  return m_ModuleName;
}

IODSynchronizationModule::~IODSynchronizationModule()
{
  // clear rules from rule set
  clearData();
}

OFCondition IODSynchronizationModule::getSynchronizationFrameOfReferenceUID(OFString& value,
                                                                            const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_SynchronizationFrameOfReferenceUID, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::getSynchronizationTrigger(OFString& value,
                                                                const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_SynchronizationTrigger, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::getTriggerSourceOrType(OFString& value,
                                                             const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_TriggerSourceOrType, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::getSynchronizationChannel(OFVector<Uint16>& value) const
{
  DcmElement *elem = NULL;
  OFCondition result = m_Item->findAndGetElement(DCM_SynchronizationChannel, elem);
  if (elem)
  {
    result = DcmIODUtil::getUint16ValuesFromElement(*elem, value);
  }
  return result;
}

OFCondition IODSynchronizationModule::getAcquisitionTimeSynchronized(OFString& value,
                                                                     const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_AcquisitionTimeSynchronized, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::getTimeSource(OFString& value,
                                                    const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_TimeSource, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::getTimeDistributionProtocol(OFString& value,
                                                                  const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_TimeDistributionProtocol, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::getNTPSourceAddress(OFString& value,
                                                          const signed long pos) const
{
  return DcmIODUtil::getStringValueFromItem(DCM_NTPSourceAddress, *m_Item, value, pos);
}

OFCondition IODSynchronizationModule::setSynchronizationFrameofReferenceUID(const OFString &value,
                                                                            const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmUniqueIdentifier::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_SynchronizationFrameOfReferenceUID, value);
  return result;
}

OFCondition IODSynchronizationModule::setSynchronizationTrigger(const OFString &value,
                                                                const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_SynchronizationTrigger, value);
  // TODO: Further checks since this field has enumerated values
  return result;
}

OFCondition IODSynchronizationModule::setTriggerSourceOrType(const OFString &value,
                                                             const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmLongString::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_TriggerSourceOrType, value);
  return result;
}

OFCondition IODSynchronizationModule::setSynchronizationChannel(const OFPair<Uint16, Uint16> &value,
                                                                const OFBool checkValue)
{
  (void)checkValue;
  OFCondition result = m_Item->putAndInsertUint16(DCM_SynchronizationChannel, value.first, 0);
  if (result.good())
  {
    result = m_Item->putAndInsertUint16(DCM_SynchronizationChannel, value.second, 0);
  }
  return result;
}

OFCondition IODSynchronizationModule::setAcquisitionTimeSynchronized(const OFString &value,
                                                                     const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_AcquisitionTimeSynchronized, value);
  // TODO: Further checks since this field has enumerated values
  return result;
}

OFCondition IODSynchronizationModule::setTimeSource(const OFString &value,
                                                    const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmShortString::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_TimeSource, value);
  return result;
}

OFCondition IODSynchronizationModule::setTimeDistributionProtocol(const OFString &value,
                                                                  const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_TimeDistributionProtocol, value);
  // TODO: Further checks since this field has enumerated values
  return result;
}

OFCondition IODSynchronizationModule::setNTPSourceAddress(const OFString &value,
                                                          const OFBool checkValue)
{
  OFCondition result = (checkValue) ? DcmLongString::checkStringValue(value, "1") : EC_Normal;
  if (result.good())
    result = m_Item->putAndInsertOFStringArray(DCM_NTPSourceAddress, value);
  return result;
}


text:
package com.saintdan.framework.po;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.http.HttpMethod;

/**
 * Log, record users' behavior.
 *
 * @author Liao Yifan
 * @date 10/27/15
 * @since JDK1.8
 */
@Entity
@Table(name = "logs")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Log implements Serializable {

  private static final long serialVersionUID = 7088091769901805623L;

  @GenericGenerator(
      name = "logSequenceGenerator",
      strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
      parameters = {
          @Parameter(name = "sequence_name", value = "logs_seq"),
          @Parameter(name = "initial_value", value = "1"),
          @Parameter(name = "increment_size", value = "1")
      }
  )
  @Id
  @GeneratedValue(generator = "logSequenceGenerator")
  @Column(updatable = false)
  private long id;

  @Column(nullable = false, length = 50)
  private String ip;

  @Column(nullable = false)
  private String usr;
  private String clientId;
  private String path;
  private HttpMethod method;

  @CreatedDate
  @Column(nullable = false)
  private long createdAt;
}


text:
'use strict';

/* jshint -W030 */
var chai = require('chai')
  , expect = chai.expect
  , Support = require(__dirname + '/support')
  , Promise = require(__dirname + '/../../lib/promise')
  , Transaction = require(__dirname + '/../../lib/transaction')
  , sinon = require('sinon')
  , current = Support.sequelize;

if (current.dialect.supports.transactions) {

describe(Support.getTestDialectTeaser('Sequelize#transaction'), function() {
  beforeEach(function () {
    this.sinon = sinon.sandbox.create();
  });

  afterEach(function () {
    this.sinon.restore();
  });

  describe('then', function() {
    it('gets triggered once a transaction has been successfully committed', function() {
      var called = false;
      return this
        .sequelize
        .transaction().then(function(t) {
          return t.commit().then(function () {
            called = 1;
          });
        })
        .then(function() {
          expect(called).to.be.ok;
        });
    });

    it('gets triggered once a transaction has been successfully rolled back', function() {
      var called = false;
      return this
        .sequelize
        .transaction().then(function(t) {
          return t.rollback().then(function () {
            called = 1;
          });
        })
        .then(function() {
          expect(called).to.be.ok;
        });
    });

    if (Support.getTestDialect() !== 'sqlite') {
      it('works for long running transactions', function() {
        return Support.prepareTransactionTest(this.sequelize).bind(this).then(function(sequelize) {
          this.sequelize = sequelize;

          this.User = sequelize.define('User', {
            name: Support.Sequelize.STRING
          }, { timestamps: false });

          return sequelize.sync({ force: true });
        }).then(function() {
          return this.sequelize.transaction();
        }).then(function(t) {
          var query = 'select sleep(2);';

          switch (Support.getTestDialect()) {
          case 'postgres':
            query = 'select pg_sleep(2);';
            break;
          case 'sqlite':
            query = 'select sqlite3_sleep(2000);';
            break;
          case 'mssql':
            query = 'WAITFOR DELAY \'00:00:02\';';
            break;
          default:
            break;
          }

          return this.sequelize.query(query, { transaction: t }).bind(this).then(function() {
            return this.User.create({ name: 'foo' });
          }).then(function() {
            return this.sequelize.query(query, { transaction: t });
          }).then(function() {
            return t.commit();
          });
        }).then(function() {
          return this.User.all();
        }).then(function(users) {
          expect(users.length).to.equal(1);
          expect(users[0].name).to.equal('foo');
        });
      });
    }
  });

  describe('complex long running example', function() {
    it('works with promise syntax', function() {
      return Support.prepareTransactionTest(this.sequelize).then(function(sequelize) {
        var Test = sequelize.define('Test', {
          id: { type: Support.Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
          name: { type: Support.Sequelize.STRING }
        });

        return sequelize.sync({ force: true }).then(function() {
          return sequelize.transaction().then(function(transaction) {
            expect(transaction).to.be.instanceOf(Transaction);

            return Test
              .create({ name: 'Peter' }, { transaction: transaction })
              .then(function() {
                return Promise.delay(1000).then(function () {
                  return transaction
                    .commit()
                    .then(function() { return Test.count(); })
                    .then(function(count) {
                      expect(count).to.equal(1);
                    });
                });
              });
          });
        });
      });
    });
  });

  describe('concurrency', function() {
    describe('having tables with uniqueness constraints', function() {
      beforeEach(function() {
        var self = this;

        return Support.prepareTransactionTest(this.sequelize).then(function(sequelize) {
          self.sequelize = sequelize;

          self.Model = sequelize.define('Model', {
            name: { type: Support.Sequelize.STRING, unique: true }
          }, {
            timestamps: false
          });

          return self.Model.sync({ force: true });
        });
      });

      it('triggers the error event for the second transactions', function() {
        var self = this;

        return this.sequelize.transaction().then(function(t1) {
          return self.sequelize.transaction().then(function(t2) {
            return self.Model.create({ name: 'omnom' }, { transaction: t1 }).then(function() {
              return Promise.all([
                self.Model.create({ name: 'omnom' }, { transaction: t2 }).catch(function(err) {
                  expect(err).to.be.ok;
                  return t2.rollback();
                }),
                Promise.delay(100).then(function() {
                  return t1.commit();
                })
              ]);
            });
          });
        });
      });
    });
  });
});

}


text:
package org.sagebionetworks.repo.manager.oauth;

import static org.junit.Assert.assertNotNull;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.sagebionetworks.repo.model.oauth.OAuthProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@ExtendWith(SpringExtension.class)
@ContextConfiguration(locations = { "classpath:test-context.xml" })
public class OAuthManagerImplTest {

	@Autowired
	private OAuthManager oAuthManager;

	@Test
	public void testGoogleBinding() {
		OAuthProviderBinding binding = oAuthManager.getBinding(OAuthProvider.GOOGLE_OAUTH_2_0);
		assertNotNull(binding);
		assertNotNull(binding.getAuthorizationUrl("redirectUrl"));
	}

	@Test
	public void testORCIDBinding() {
		OAuthProviderBinding binding = oAuthManager.getBinding(OAuthProvider.ORCID);
		assertNotNull(binding);
		assertNotNull(binding.getAuthorizationUrl("redirectUrl"));
	}

}


text:
package Mail::SpamAssassin::Reporter;

use strict;
use warnings;
# use bytes;
use re 'taint';
use Mail::SpamAssassin::Logger;

our @ISA = qw();

#Removed $VERSION per BUG 6422
#$VERSION = 'bogus';	# avoid CPAN.pm picking up razor ver

###########################################################################

sub new {
  my $class = shift;
  $class = ref($class) || $class;
  my ($main, $msg, $options) = @_;

  my $self = {
    'main'		=> $main,
    'msg'		=> $msg,
    'options'		=> $options,
    'conf'		=> $main->{conf},
  };

  bless($self, $class);
  my $permsgstatus =
        Mail::SpamAssassin::PerMsgStatus->new($self->{main}, $msg);
  $msg->extract_message_metadata ($permsgstatus);
  $permsgstatus->finish();
  $self;
}

###########################################################################

sub report {
  my ($self) = @_;
  $self->{report_return} = 0;
  $self->{report_available} = 0;

  my $text = $self->{main}->remove_spamassassin_markup($self->{msg});

  $self->{main}->call_plugins("plugin_report", { report => $self, text => \$text, msg => $self->{msg} });

  $self->delete_fulltext_tmpfile();

  if ($self->{report_available} == 0) {
    warn "reporter: no reporting methods available, so couldn't report\n";
  }

  return $self->{report_return};
}

###########################################################################

sub revoke {
  my ($self) = @_;
  $self->{revoke_return} = 0;
  $self->{revoke_available} = 0;

  my $text = $self->{main}->remove_spamassassin_markup($self->{msg});

  $self->{main}->call_plugins("plugin_revoke", { revoke => $self, text => \$text, msg => $self->{msg} });

  if ($self->{revoke_available} == 0) {
    warn "reporter: no revoke methods available, so couldn't revoke\n";
  }

  return $self->{revoke_return};
}

###########################################################################

sub create_fulltext_tmpfile {
  Mail::SpamAssassin::PerMsgStatus::create_fulltext_tmpfile(@_);
}
sub delete_fulltext_tmpfile {
  Mail::SpamAssassin::PerMsgStatus::delete_fulltext_tmpfile(@_);
}

sub enter_helper_run_mode {
  Mail::SpamAssassin::PerMsgStatus::enter_helper_run_mode(@_);
}
sub leave_helper_run_mode {
  Mail::SpamAssassin::PerMsgStatus::leave_helper_run_mode(@_);
}

1;


text:
package esride.opendatabridge.reader;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: sma
 * Date: 21.03.13
 * Time: 07:46
 * To change this template use File | Settings | File Templates.
 */
public interface IReader {

    public List<TransformedItem> getItemsFromCatalog() throws ReaderException;

}