text:
package org.jclouds.shipyard.parse;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;

import org.jclouds.shipyard.domain.containers.ContainerImageInfo;
import org.jclouds.shipyard.domain.containers.ContainerInfo;
import org.jclouds.shipyard.domain.engines.EngineSettingsInfo;
import org.jclouds.shipyard.domain.images.ImagePortsInfo;
import org.jclouds.shipyard.internal.BaseShipyardParseTest;
import org.testng.annotations.Test;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

@Test(groups = "unit")
public class ContainersParseTest extends BaseShipyardParseTest<List<ContainerInfo>> {

   @Override
   public String resource() {
      return "/containers.json";
   }

   @Override
   @Consumes(MediaType.APPLICATION_JSON)
   public List<ContainerInfo> expected() {

      return ImmutableList.of(
              ContainerInfo.create("e2f6784b75ed8768e83b7ec46ca8ef784941f6ce4c53231023804277965da1d2",
                    "/atlassian-stash",
                    ContainerImageInfo.create("nkatsaros/atlassian-stash:3.5",
                             ImmutableMap.<String, String>of("STASH_HOME", "/var/atlassian/stash", "STASH_VERSION", "3.5.0"),
                             ImmutableList.<String>of("/docker-entrypoint.sh"),
                             "e2f6784b75ed",
                             ImmutableList.<ImagePortsInfo>of(ImagePortsInfo.create("tcp", "0.0.0.0", 8089, 8080)),
                             ImmutableList.<String>of("/var/atlassian/stash"),
                             ImmutableMap.<String, String>of(),
                             true,
                             "bridge"),
                    EngineSettingsInfo.create("sdrelnx150",
                          "http://sdrelnx150:2375",
                          8,
                          8096,
                          ImmutableList.<String>of("sdrelnx150")),
                    "stopped",
                    ImmutableList.<ImagePortsInfo>of(ImagePortsInfo.create("tcp", "0.0.0.0", 8089, 8080)))
      );
   }
}


text:
module.exports = function () { };
module.exports.dependencies = ['sass', 'compile', 'vendors', 'html', 'img', 'copy', 'watch'];

redpajama_set_name: RedPajamaGithub


text:
package org.apache.zeppelin.scheduler;

import junit.framework.TestCase;
import org.apache.zeppelin.scheduler.Job.Status;
import org.junit.Test;

public class FIFOSchedulerTest extends TestCase {

  private SchedulerFactory schedulerSvc;

  @Override
  public void setUp() throws Exception {
    schedulerSvc = new SchedulerFactory();
  }

  @Override
  public void tearDown() {
    schedulerSvc.destroy();
  }

  @Test
  public void testRun() throws InterruptedException {
    Scheduler s = schedulerSvc.createOrGetFIFOScheduler("test");

    Job job1 = new SleepingJob("job1", null, 500);
    Job job2 = new SleepingJob("job2", null, 500);

    s.submit(job1);
    s.submit(job2);
    Thread.sleep(200);

    assertEquals(Status.RUNNING, job1.getStatus());
    assertEquals(Status.PENDING, job2.getStatus());

    Thread.sleep(500);
    assertEquals(Status.FINISHED, job1.getStatus());
    assertEquals(Status.RUNNING, job2.getStatus());
    assertTrue((500 < (Long) job1.getReturn()));
    s.stop();
  }

  @Test
  public void testAbort() throws InterruptedException {
    Scheduler s = schedulerSvc.createOrGetFIFOScheduler("test");

    Job job1 = new SleepingJob("job1", null, 500);
    Job job2 = new SleepingJob("job2", null, 500);

    s.submit(job1);
    s.submit(job2);

    Thread.sleep(200);

    job1.abort();
    job2.abort();

    Thread.sleep(200);

    assertEquals(Status.ABORT, job1.getStatus());
    assertEquals(Status.ABORT, job2.getStatus());

    assertTrue((500 > (Long) job1.getReturn()));
    assertEquals(null, job2.getReturn());
    s.stop();
  }
}


text:
"""
NumPy contrib functionality.
"""

__all__ = ["NumpyFormatter"]

# provisioning imports
from law.contrib.numpy.formatter import NumpyFormatter


text:
<?php

namespace pandaphp\db\mysql;

/**
 * @Description
 * @author songdengtao <http://www.songdengtao.cn/>
 */
class Exp
{
    public function __construct()
    {

    }
}


text:
// Copyright (c) Source Tree Solutions, LLC. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Author:					Joe Audette
// Created:					2016-11-10
// Last Modified:			2019-09-30
//

using cloudscribe.Logging.Models;
using Microsoft.EntityFrameworkCore;

namespace cloudscribe.Logging.EFCore.PostgreSql
{
    public class LoggingDbContext : LoggingDbContextBase, ILoggingDbContext
    {

        public LoggingDbContext(
            DbContextOptions<LoggingDbContext> options) : base(options)
        {
            // we don't want to track any logitems because we dont edit them
            // we add them delete them and view them
            //ChangeTracker.AutoDetectChangesEnabled = false;
            ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.HasSequence<long>("LogIds")
                .StartsAt(1)
                .IncrementsBy(1);

            modelBuilder.HasPostgresExtension("uuid-ossp");

            modelBuilder.Entity<LogItem>(entity =>
            {
                entity.ToTable("cs_system_log");
                entity.HasKey(p => p.Id).HasName("pk_cs_system_log");

                entity.Property(p => p.Id).HasColumnName("id").IsRequired();

                entity.Property(p => p.LogDateUtc).HasColumnName("log_date");

                entity.Property(p => p.IpAddress).HasColumnName("ip_address").HasMaxLength(50);

                entity.Property(p => p.Culture).HasColumnName("culture").HasMaxLength(10);

                entity.Property(p => p.Url).HasColumnName("url");

                entity.Property(p => p.ShortUrl).HasColumnName("short_url").HasMaxLength(255);

                entity.Property(p => p.Thread).HasColumnName("thread").HasMaxLength(255);

                entity.Property(p => p.LogLevel).HasColumnName("log_level").HasMaxLength(20);

                entity.Property(p => p.Logger).HasColumnName("logger").HasMaxLength(255);

                entity.Property(p => p.Message).HasColumnName("message");

                entity.Property(p => p.StateJson).HasColumnName("state_json");
                entity.Property(p => p.EventId).HasColumnName("event_id");

            });

        }

    }
}


text:
<!DOCTYPE html>

	<link href="js/bootstrap.min.css" rel="stylesheet"type="text/css">
	<link href="css/moncss.css" rel="stylesheet"type="text/css">

	<title>Comparison of TLS implementations -  Key exchange algorithms (certificate-only) </title>
	<meta charset="utf-8">

Comparison of TLS implementations -  Key exchange algorithms (certificate-only)

			<fieldset>

					<form action="" method="post">
						<legend style="color:red;font-weight: bold;font-style:italic;text-align: center;" >Formulaire</legend>

								RSA :

 <input type="radio" name="FeatureRSA" value="oui">Yes <input type="radio" name="FeatureRSA" value = "non">No <input type="radio" name="FeatureRSA" value = "non">Partial

											<input  style="display:none;" id ="id2RSA"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1RSA','id2RSA');">Changer type</button>

								ECDH-RSA :

 <input type="radio" name="FeatureECDH-RSA" value="oui">Yes <input type="radio" name="FeatureECDH-RSA" value = "non">No <input type="radio" name="FeatureECDH-RSA" value = "non">Partial

											<input  style="display:none;" id ="id2ECDH-RSA"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1ECDH-RSA','id2ECDH-RSA');">Changer type</button>

								Implementation :
 <input id="0" type="text" name="Feature">

								DHE-RSA (forward secrecy) :

 <input type="radio" name="FeatureDHE-RSA (forward secrecy)" value="oui">Yes <input type="radio" name="FeatureDHE-RSA (forward secrecy)" value = "non">No <input type="radio" name="FeatureDHE-RSA (forward secrecy)" value = "non">Partial

											<input  style="display:none;" id ="id2DHE-RSA (forward secrecy)"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1DHE-RSA (forward secrecy)','id2DHE-RSA (forward secrecy)');">Changer type</button>

								ECDH-ECDSA :

 <input type="radio" name="FeatureECDH-ECDSA" value="oui">Yes <input type="radio" name="FeatureECDH-ECDSA" value = "non">No <input type="radio" name="FeatureECDH-ECDSA" value = "non">Partial

											<input  style="display:none;" id ="id2ECDH-ECDSA"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1ECDH-ECDSA','id2ECDH-ECDSA');">Changer type</button>

								RSA-EXPORT (insecure) :

 <input type="radio" name="FeatureRSA-EXPORT (insecure)" value="oui">Yes <input type="radio" name="FeatureRSA-EXPORT (insecure)" value = "non">No <input type="radio" name="FeatureRSA-EXPORT (insecure)" value = "non">Partial

											<input  style="display:none;" id ="id2RSA-EXPORT (insecure)"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1RSA-EXPORT (insecure)','id2RSA-EXPORT (insecure)');">Changer type</button>

								ECDHE-ECDSA (forward secrecy) :

 <input type="radio" name="FeatureECDHE-ECDSA (forward secrecy)" value="oui">Yes <input type="radio" name="FeatureECDHE-ECDSA (forward secrecy)" value = "non">No <input type="radio" name="FeatureECDHE-ECDSA (forward secrecy)" value = "non">Partial

											<input  style="display:none;" id ="id2ECDHE-ECDSA (forward secrecy)"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1ECDHE-ECDSA (forward secrecy)','id2ECDHE-ECDSA (forward secrecy)');">Changer type</button>

								ECDHE-RSA (forward secrecy) :

 <input type="radio" name="FeatureECDHE-RSA (forward secrecy)" value="oui">Yes <input type="radio" name="FeatureECDHE-RSA (forward secrecy)" value = "non">No <input type="radio" name="FeatureECDHE-RSA (forward secrecy)" value = "non">Partial

											<input  style="display:none;" id ="id2ECDHE-RSA (forward secrecy)"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1ECDHE-RSA (forward secrecy)','id2ECDHE-RSA (forward secrecy)');">Changer type</button>

								GOST R 34.10-94 / 34.10-2001 :

 <input type="radio" name="FeatureGOST R 34.10-94 / 34.10-2001" value="oui">Yes <input type="radio" name="FeatureGOST R 34.10-94 / 34.10-2001" value = "non">No <input type="radio" name="FeatureGOST R 34.10-94 / 34.10-2001" value = "non">Partial

											<input  style="display:none;" id ="id2GOST R 34.10-94 / 34.10-2001"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1GOST R 34.10-94 / 34.10-2001','id2GOST R 34.10-94 / 34.10-2001');">Changer type</button>

								DHE-DSS (forward secrecy) :

 <input type="radio" name="FeatureDHE-DSS (forward secrecy)" value="oui">Yes <input type="radio" name="FeatureDHE-DSS (forward secrecy)" value = "non">No <input type="radio" name="FeatureDHE-DSS (forward secrecy)" value = "non">Partial

											<input  style="display:none;" id ="id2DHE-DSS (forward secrecy)"type="text"/>
										    <button class="btn btn-primary btn-xs" type="button" onClick="switchFunction('id1DHE-DSS (forward secrecy)','id2DHE-DSS (forward secrecy)');">Changer type</button>

<input type="submit" class="btn btn-info" value="Ajouter un produit" />
					</form>

			</fieldset>


text:
<?php

namespace Lunr\Shadow\Tests;

/**
 * Basic tests for the case of empty superglobals.
 *
 * @covers        Lunr\Shadow\CliRequestParser
 * @backupGlobals enabled
 */
class CliRequestParserParseRawDataTest extends CliRequestParserTest
{

    /**
     * Test storing raw request data.
     *
     * @covers   Lunr\Shadow\CliRequestParser::parse_raw_data
     */
    public function testParseRawData(): void
    {
        $this->mock_function('file_get_contents', fn() => 'raw');

        $result = $this->class->parse_raw_data();

        $this->assertEquals('raw', $result);

        $this->unmock_function('file_get_contents');
    }

}

?>


text:
{% extends "base.html" %}

{% block title %}Create Character{% endblock %}

{% block content %}

Create a New Character

<form action="{% url 'characters:create' %}" method="POST">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="Create">
</form>
{% endblock %}


text:
package net.bither.fragment.hot;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;

import net.bither.BitherSetting;
import net.bither.R;
import net.bither.adapter.hot.MarketFragmentListAdapter;
import net.bither.fragment.Refreshable;
import net.bither.fragment.Selectable;
import net.bither.fragment.Unselectable;
import net.bither.model.Market;
import net.bither.ui.base.MarketFragmentListItemView;
import net.bither.ui.base.MarketListHeader;
import net.bither.ui.base.MarketTickerChangedObserver;
import net.bither.util.BroadcastUtil;
import net.bither.util.MarketUtil;

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

public class MarketFragment extends Fragment implements Refreshable,
        Selectable, Unselectable, OnItemClickListener {
    private View v;
    private List<Market> markets;
    private MarketListHeader header;
    private ImageView ivMarketPriceAnimIcon;
    private ListView lv;
    private MarketFragmentListAdapter mAdaper;

    private SelectedThread selectedThread;

    private IntentFilter broadcastIntentFilter = new IntentFilter(
            BroadcastUtil.ACTION_MARKET);
    private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

            header.onMarketTickerChanged();
            int itemCount = lv.getChildCount();
            for (int i = 0;
                 i < itemCount;
                 i++) {
                View v = lv.getChildAt(i);
                if (v instanceof MarketTickerChangedObserver) {
                    MarketTickerChangedObserver o = (MarketTickerChangedObserver) v;
                    o.onMarketTickerChanged();
                }
            }
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        markets = new ArrayList<Market>(MarketUtil.getMarkets());
        mAdaper = new MarketFragmentListAdapter(getActivity(), markets);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        v = inflater
                .inflate(R.layout.fragment_market, container, false);
        header = (MarketListHeader) v.findViewById(R.id.v_header);
        lv = (ListView) v.findViewById(R.id.lv);
        ivMarketPriceAnimIcon = (ImageView) v.findViewById(R.id.iv_market_price_anim_icon);
        lv.setAdapter(mAdaper);
        lv.setOnItemClickListener(this);
        return v;
    }

    public void onResume() {
        super.onResume();
        header.onResume();
        int listItemCount = lv.getChildCount();
        for (int i = 0;
             i < listItemCount;
             i++) {
            View v = lv.getChildAt(i);
            if (v instanceof MarketFragmentListItemView) {
                MarketFragmentListItemView av = (MarketFragmentListItemView) v;
                av.onResume();
            }
        }
        getActivity()
                .registerReceiver(broadcastReceiver, broadcastIntentFilter);
    }

    @Override
    public void onPause() {
        header.onPause();
        int listItemCount = lv.getChildCount();
        for (int i = 0;
             i < listItemCount;
             i++) {
            View v = lv.getChildAt(i);
            if (v instanceof MarketFragmentListItemView) {
                MarketFragmentListItemView av = (MarketFragmentListItemView) v;
                av.onPause();
            }
        }
        getActivity().unregisterReceiver(broadcastReceiver);
        super.onPause();
    }

    @Override
    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        header.setMarket(markets.get(arg2));
    }

    @Override
    public void onSelected() {
        if (lv != null) {
            header.onResume();
            int listItemCount = lv.getChildCount();
            for (int i = 0;
                 i < listItemCount;
                 i++) {
                View v = lv.getChildAt(i);
                if (v instanceof MarketFragmentListItemView) {
                    MarketFragmentListItemView av = (MarketFragmentListItemView) v;
                    av.onResume();
                }
            }
        } else {
            if (selectedThread == null || !selectedThread.isAlive()) {
                selectedThread = new SelectedThread();
                selectedThread.start();
            }
        }
    }

    public void showPriceAlertAnimTo(int fromX, int fromY, Market toMarket) {
        int[] containerOffset = new int[2];
        v.getLocationInWindow(containerOffset);
        containerOffset[0] += v.getPaddingLeft();
        containerOffset[1] += v.getPaddingTop();
        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) ivMarketPriceAnimIcon
                .getLayoutParams();
        lp.topMargin = fromY - containerOffset[1];
        lp.leftMargin = fromX - containerOffset[0];
        int marketIndex = markets.indexOf(toMarket);
        if (marketIndex < lv.getFirstVisiblePosition() || marketIndex > lv.getLastVisiblePosition
                ()) {
            lv.setSelection(marketIndex);
        }
        View marketView = lv.getChildAt(marketIndex - lv.getFirstVisiblePosition());
        View toIconView = marketView.findViewById(R.id.iv_price_alert);
        int[] toLocation = new int[2];
        toIconView.getLocationInWindow(toLocation);
        TranslateAnimation anim = new TranslateAnimation(0, toLocation[0] - fromX, 0,
                toLocation[1] - fromY);
        anim.setDuration(300);
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                doRefresh();
                ivMarketPriceAnimIcon.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
        ivMarketPriceAnimIcon.setVisibility(View.VISIBLE);
        ivMarketPriceAnimIcon.startAnimation(anim);
    }

    @Override
    public void doRefresh() {
        if (lv == null) {
            return;
        }
        refresh();
    }

    public void refresh() {
        if (mAdaper != null) {
            mAdaper.notifyDataSetChanged();
        }
    }

    @Override
    public void onUnselected() {
        if(header != null) {
            header.reset();
        }
    }

    public void notifPriceAlert(BitherSetting.MarketType marketType) {
        Market market = MarketUtil.getMarket(marketType);
        header.setMarket(market);
    }

    private class SelectedThread extends Thread {
        @Override
        public void run() {
            for (int i = 0;
                 i < 20;
                 i++) {
                if (lv != null) {
                    header.onResume();
                    int listItemCount = lv.getChildCount();
                    for (int j = 0;
                         j < listItemCount;
                         j++) {
                        View v = lv.getChildAt(i);
                        if (v instanceof MarketFragmentListItemView) {
                            MarketFragmentListItemView av = (MarketFragmentListItemView) v;
                            av.onResume();
                        }
                    }
                }
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                }
            }
        }
    }
}


text:
using System;
using System.Windows.Forms;
using XrmToolBox.Extensibility;
using XrmToolBox.Extensibility.Interfaces;
using XrmToolBox.Extensibility.Args;
using Microsoft.Xrm.Sdk;
using McTools.Xrm.Connection;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Messages;
using System.ComponentModel;
using System.Text;
using System.Collections.Specialized;
using Microsoft.Xrm.Tooling.Connector;

namespace martintmg.MSDYN.Tools.SimpleRecordCloner
{
    public partial class PluginControl : MultipleConnectionsPluginControlBase, IXrmToolBoxPluginControl, IGitHubPlugin, IStatusBarMessenger, IHelpPlugin
    {
        private Panel infoPanel;

        public event EventHandler<StatusBarMessageEventArgs> SendMessageToStatusBar;

        public string RepositoryName
        {
            get
            {
                return "CRMSimpleRecordCloner";
            }
        }

        public string UserName
        {
            get
            {
                return "martintmg";
            }
        }

        public string HelpUrl
        {
            get
            {
                return "https://github.com/martintmg/CRMSimpleRecordCloner";
            }
        }

        private void SetConnectionLabel(ConnectionDetail detail, string serviceType)
        {
            switch (serviceType)
            {
                case "Source":
                    lblSource.Text = detail.ConnectionName;
                    lblSource.ForeColor = Color.Green;
                    break;
            }
        }

        public override void UpdateConnection(IOrganizationService newService, ConnectionDetail detail, string actionName = "", object parameter = null)
        {
            ConnectionDetail = detail;
            if (actionName == "AdditionalOrganization")
            {
                AdditionalConnectionDetails.Clear();
                AdditionalConnectionDetails.Add(detail);
                SetConnectionLabel(detail, "Target");
            }
            else
            {
                SetConnectionLabel(detail, "Source");
            }

            base.UpdateConnection(newService, detail, actionName, parameter);
        }

        #region Base tool implementation

        public PluginControl()
        {
            InitializeComponent();
        }

        #endregion Base tool implementation

        private void btnChooseTarget_Click(object sender, EventArgs e)
        {
            AddAdditionalOrganization();
        }
        private void chkIgnoreAllLookups_CheckedChanged(object sender, EventArgs e)
        {
            if (((CheckBox)sender).Checked == true)
            {
                chkIgnoreOwnerAndModifiedBy.Checked = true;
                chkVerifyLookups.Checked = false;
            }
        }

        private void chkIgnoreOwnerAndModifiedBy_CheckedChanged(object sender, EventArgs e)
        {
            if (((CheckBox)sender).Checked == false)
                chkIgnoreAllLookups.Checked = false;
        }

        private void lstTargetEnvironments_KeyDown(object sender, KeyEventArgs e)
        {
            if (listBoxTargetEnv.SelectedItems.Count > 0 && e.KeyCode == Keys.Delete)
            {
                var conn = listBoxTargetEnv.SelectedItem as ConnectionDetail;

                if (conn != null)
                {
                    RemoveAdditionalOrganization(conn);
                }
            }
        }

        private void ToggleWaitMode(bool on)
        {
            if (on)
            {
                Cursor = Cursors.WaitCursor;
                btnAddToRecordList.Enabled = false;
                btnChooseTarget.Enabled = false;
                btnCloneRecord.Enabled = false;
                txtRecordURL.Enabled = false;
                chkIgnoreAllLookups.Enabled = false;
                chkIgnoreOwnerAndModifiedBy.Enabled = false;
                chkVerifyLookups.Enabled = false;
            }
            else
            {

            }
        }

        private void WorkerProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            InformationPanel.ChangeInformationPanelMessage(infoPanel, e.UserState.ToString());
        }

        private void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            infoPanel.Dispose();
            Controls.Remove(infoPanel);

            btnAddToRecordList.Enabled = true;
            btnChooseTarget.Enabled = true;
            btnCloneRecord.Enabled = true;
            txtRecordURL.Enabled = true;
            chkIgnoreAllLookups.Enabled = true;
            chkIgnoreOwnerAndModifiedBy.Enabled = true;
            chkVerifyLookups.Enabled = true;

            Cursor = Cursors.Default;

            string message;

            if (e.Error != null)
            {
                message = string.Format("An error occured: {0}", e.Error.Message);
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                message = "Finished Processing!";
                MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void WorkerDoWorkCloneRecords(object sender, DoWorkEventArgs e)
        {
            var bw = (BackgroundWorker)sender;
            var current = 0;

            foreach (var connectioNDetail in AdditionalConnectionDetails)
            {
                var targetService = connectioNDetail.GetCrmServiceClient();

                RetrieveAllEntitiesResponse SourceMetaData = GetMetaData();
                //  lastTargetService = targetService;

                var recordUrlsToProcess = (ListBox.ObjectCollection)e.Argument;

                foreach (var recordUrl in recordUrlsToProcess)
                {
                    current++;
                    var paramaters = GetParameterFromURL(recordUrl.ToString());

                    var RecordId = new Guid(GetParameter(paramaters, "id").ToString());
                    var logicalName = GetParameter(paramaters, "etn")?.ToString();
                    if (logicalName == null)
                    {
                        // fallback if the URL was generated through an oder Dynamics version
                        int objectTypeCode = int.Parse(GetParameter(paramaters, "etc").ToString());
                        logicalName = GetEntityLogicalNameFromMetadataByObjectTypeCode(objectTypeCode);
                    }

                    var entity = Service.Retrieve(logicalName, RecordId, new ColumnSet(true));

                    string displayName = GetRecordDisplayName(SourceMetaData, logicalName, entity);

                    bw.ReportProgress(0, string.Format("Cloning Record {4} of {5}: Displayname \"{0}\" LogicalName \"{1}\" Id \"{2}\" to Environemt \"{3}\"",
                        displayName, entity.LogicalName, entity.Id, targetService.ConnectedOrgFriendlyName,
                        current,
                        recordUrlsToProcess.Count * AdditionalConnectionDetails.Count()));

                    ApplyCloneRulesAndCloneRecord(targetService, SourceMetaData, logicalName, entity);
                }
            }
        }

        private void ApplyCloneRulesAndCloneRecord(CrmServiceClient TargetOrgSvc, RetrieveAllEntitiesResponse SourceMetaData, string logicalName, Entity RecordToClone)
        {
            RemoveTraversedPathAttributeFromEntity(RecordToClone);
            ApplyRemoveAllERefsRule(RecordToClone);
            ApplyIngoreOnwerModfiedByRule(RecordToClone);
            ApplyIgnoreStatusCodeRule(RecordToClone);
            ApplyRemoveNotFoundLookupsRule(TargetOrgSvc, RecordToClone);
            ApplyRemoveNonExistingAttributesInTargetOrganizationRule(TargetOrgSvc, RecordToClone);

            if (!ApplyAreAllLookupsPresentRule(TargetOrgSvc, RecordToClone))
                return;
            ApplyUpsertRecords(TargetOrgSvc, SourceMetaData, logicalName, RecordToClone);
        }

        private void RemoveAttributesFromRecord(List<string> Attributes, Entity RecordToClone)
        {
            Attributes.ForEach(attribute =>
            {
                if (RecordToClone.Contains(attribute))
                    RecordToClone.Attributes.Remove(attribute);
            });
        }

        private void RemoveTraversedPathAttributeFromEntity(Entity RecordToClone)
        {
            RemoveAttributesFromRecord(new List<string> { "traversedpath" }, RecordToClone);
        }

        private void ApplyRemoveAllERefsRule(Entity RecordToClone)
        {
            if (chkIgnoreAllLookups.Checked)
            {
                RemoveAttributesFromRecord(
                    GetAllERefsFromRecord(RecordToClone)
                    .Select(attribute => attribute.Key).ToList()
                    , RecordToClone);
            }
        }

        private static IEnumerable<KeyValuePair<string, object>> GetAllERefsFromRecord(Entity RecordToClone)
        {
            return RecordToClone.Attributes.Where(attribute => attribute.Value.GetType().Name == "EntityReference");
        }

        private void ApplyIngoreOnwerModfiedByRule(Entity RecordToClone)
        {
            if (chkIgnoreOwnerAndModifiedBy.Checked)
            {
                RemoveAttributesFromRecord(new List<string> { Helpers.EntityNames.Owner, Helpers.EntityNames.ModifiedBy }, RecordToClone);
            }
        }

        private void ApplyIgnoreStatusCodeRule(Entity RecordToClone)
        {
            if (chkIgnoreStateCode.Checked)
            {
                RemoveAttributesFromRecord(new List<string> { Helpers.EntityNames.StateCode, Helpers.EntityNames.StatusCode }, RecordToClone);
            }
        }

        private void ApplyRemoveNotFoundLookupsRule(IOrganizationService TargetOrgSvc, Entity RecordToClone)
        {
            if (chkRemoveNotFoundLookups.Checked)
            {
                List<EntityReference> notFoundERefs = GetERefsWhichNotExistsInTargetEnvironment(TargetOrgSvc, RecordToClone);

                RemoveAttributesFromRecord(notFoundERefs.Select(x => x.Name).ToList(), RecordToClone);
            }
        }

        private static List<EntityReference> GetERefsWhichNotExistsInTargetEnvironment(IOrganizationService TargetOrgSvc, Entity RecordToClone)
        {
            var allERefsAttributes = GetAllERefsFromRecord(RecordToClone).ToList();

            var notFoundERefs = new List<EntityReference>();

            allERefsAttributes.ForEach(eRefAttribute =>
            {

                EntityReference eRef = new EntityReference();
                try
                {
                    eRef = (EntityReference)eRefAttribute.Value;
                    var entity = TargetOrgSvc.Retrieve(eRef.LogicalName, eRef.Id, new ColumnSet(false));
                }
                catch
                {
                    notFoundERefs.Add(eRef);
                }
            });
            return notFoundERefs;
        }

        private void ApplyRemoveNonExistingAttributesInTargetOrganizationRule(CrmServiceClient TragetOrgService, Entity RecordToClone)
        {
            if (chkRemoveNonExistingAttributes.Checked)
            {
                RemoveMissingAttributeInTargetEnvironment(TragetOrgService, RecordToClone);
            }
        }

        private void RemoveMissingAttributeInTargetEnvironment(CrmServiceClient TragetOrgService, Entity RecordToClone)
        {
            var entityMetaData = new RetrieveEntityRequest
            {
                RetrieveAsIfPublished = true,
                EntityFilters = Microsoft.Xrm.Sdk.Metadata.EntityFilters.Attributes,
                LogicalName = RecordToClone.LogicalName
            };

            var SourceMetaData = (RetrieveEntityResponse)TragetOrgService.Execute(entityMetaData);

            var sourceAttributes = RecordToClone.Attributes;

            var tempEntity = new Entity();

            SourceMetaData.EntityMetadata.Attributes.ToList().ForEach(attributeMetadata =>
            {
                var attributeLogicalName = attributeMetadata.LogicalName;

                if (!attributeMetadata.IsValidForCreate.Value)
                {
                    sourceAttributes.Remove(attributeLogicalName);
                }
                if (!attributeMetadata.IsValidForUpdate.Value)
                {
                    sourceAttributes.Remove(attributeLogicalName);
                }

                if (sourceAttributes.Contains(attributeLogicalName))
                {
                    tempEntity.Attributes.Add(attributeLogicalName, sourceAttributes[attributeLogicalName]);
                }
            });

            RecordToClone.Attributes.Clear();
            RecordToClone.Attributes = tempEntity.Attributes;
        }

        private bool ApplyAreAllLookupsPresentRule(CrmServiceClient TargetOrgSvc, Entity RecordToClone)
        {
            if (chkVerifyLookups.Checked)
            {
                return AreAllLookUpsPresent(TargetOrgSvc, RecordToClone);
            }

            return true;
        }

        private bool AreAllLookUpsPresent(CrmServiceClient TargetOrgSvc, Entity RecordToClone)
        {
            var missingEntityReferences = GetERefsWhichNotExistsInTargetEnvironment(TargetOrgSvc, RecordToClone);

            if (missingEntityReferences.Any())
            {
                var strBuilder = new StringBuilder();
                strBuilder.AppendLine("The following Lookups are not present in the Target Enviornment. Do you want to proceed?");

                foreach (var missingEntityReference in missingEntityReferences)
                {
                    strBuilder.AppendLine($"LogicalName {missingEntityReference.LogicalName} Id {missingEntityReference.Id} does not exist");
                }

                return MessageBox.Show(strBuilder.ToString(), "Question do you want To Procced?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
            }

            return true;
        }

        private void ApplyUpsertRecords(CrmServiceClient orgService, RetrieveAllEntitiesResponse SourceMetaData, string logicalName, Entity RecordToClone)
        {
            if (chkUpsertRecords.Checked)
            {
                var primaryIdAttribute = SourceMetaData.EntityMetadata.First(entityMetaData => entityMetaData.LogicalName == logicalName).PrimaryIdAttribute;

                RecordToClone.KeyAttributes.Add(primaryIdAttribute, RecordToClone.Id);

                var upsertReq = new UpsertRequest()
                {
                    Target = RecordToClone
                };

                var resp = (UpsertResponse)orgService.Execute(upsertReq);
                var created = resp.RecordCreated;
            }
            else
            {
                orgService.Create(RecordToClone);
            }
        }

        private string GetRecordDisplayName(RetrieveAllEntitiesResponse SourceMetaData, string logicalName, Entity RecordToClone)
        {
            return RecordToClone.GetAttributeValue<string>(SourceMetaData.EntityMetadata.First(entityMetaData => entityMetaData.LogicalName == logicalName).PrimaryNameAttribute);
        }

        private RetrieveAllEntitiesResponse GetMetaData()
        {
            var metaDataRequest = new RetrieveAllEntitiesRequest
            {
                RetrieveAsIfPublished = true
            };

            var SourceMetaData = (RetrieveAllEntitiesResponse)Service.Execute(metaDataRequest);
            return SourceMetaData;
        }

        private void btnCloneRecord_Click(object sender, EventArgs e)
        {
            var recordToProcess = lstRecordsToProcess.Items;
            infoPanel = InformationPanel.GetInformationPanel(this, "Initializing...", 540, 220);
            ToggleWaitMode(true);
            using (var worker = new BackgroundWorker())
            {
                worker.DoWork += WorkerDoWorkCloneRecords;
                worker.ProgressChanged += WorkerProgressChanged;
                worker.RunWorkerCompleted += WorkerRunWorkerCompleted;
                worker.WorkerReportsProgress = true;
                worker.RunWorkerAsync(recordToProcess);
            }
        }

        private NameValueCollection GetParameterFromURL(string RecordUrl)
        {
            Uri.TryCreate(RecordUrl, UriKind.Absolute, out Uri url);
            var queryString = RecordUrl.Substring(RecordUrl.IndexOf('?')).Split('#')[0];
            var parameters = System.Web.HttpUtility.ParseQueryString(queryString); ;

            return parameters;
        }

        private object GetParameter(NameValueCollection Parameters, string Parameter)
        {
            return Parameters[Parameter];
        }

        private string GetEntityLogicalNameFromMetadataByObjectTypeCode(int typeCode)
        {
            string LogicalName;
            var metaDataRequest = new RetrieveAllEntitiesRequest
            {
                RetrieveAsIfPublished = true
            };

            var metadata = (RetrieveAllEntitiesResponse)Service.Execute(metaDataRequest);

            var targetEntity = metadata.EntityMetadata.FirstOrDefault(entity => entity.ObjectTypeCode == typeCode);

            LogicalName = targetEntity.LogicalName;
            return LogicalName;
        }

        private static void ValidDateRecordId(Guid RecordId)
        {
            if (RecordId == Guid.Empty)
            {
                throw new ArgumentException("Entity Id can't be parsed from URL");
            }
        }

        private static void ValidDateTypeCode(int typeCode)
        {
            if (typeCode == -1)
            {
                throw new ArgumentException("EntityTypeCode can't be parsed from URL");
            }
        }

        private static List<string> GetParamtersFromUrl(string query)
        {
            return query.Split('&').ToList();
        }

        private static string ReplaceQuestionMark(Uri url)
        {
            return url.Query.Replace("?", "");
        }

        private void chkVerifyLookups_CheckedChanged(object sender, EventArgs e)
        {
            if (((CheckBox)sender).Checked == true)
            {
                chkIgnoreAllLookups.Checked = false;
            }
        }

        private void btnAddToRecordList_Click(object sender, EventArgs e)
        {
            string RecordUrlToAdd = CleanUpRecordUrl();

            if (IsValidUrl(RecordUrlToAdd))
            {
                lstRecordsToProcess.Items.Add(RecordUrlToAdd);
                txtRecordURL.Text = string.Empty;
            }
            else
            {
                MessageBox.Show("Url is not Valid!");
            }
        }

        private static bool IsValidUrl(string fileToAdd)
        {
            return !string.IsNullOrWhiteSpace(fileToAdd);
        }

        private string CleanUpRecordUrl()
        {
            return txtRecordURL.Text.Replace("<", "").Replace(">", "");
        }

        private void lstTargetEnvironments_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnClose_Click(object sender, EventArgs e)
        {

        }

        private void lstRecordsToProcess_KeyDown(object sender, KeyEventArgs e)
        {
            if (lstRecordsToProcess.SelectedItems.Count > 0 && e.KeyCode == Keys.Delete)
            {
                lstRecordsToProcess.Items.Remove(lstRecordsToProcess.SelectedItem);
            }
        }

        protected override void ConnectionDetailsUpdated(NotifyCollectionChangedEventArgs e)
        {
            listBoxTargetEnv.DataSource = null;
            listBoxTargetEnv.DataSource = AdditionalConnectionDetails.ToList();
            listBoxTargetEnv.DisplayMember = "ConnectionName";
            listBoxTargetEnv.ValueMember = "ConnectionId";
        }
    }
}


text:
require 'spec_helper'

describe PaymentDetails do
  before do
    @payment = mock_model(Spree::Payment, :update_attributes => true, :validate_bank_details= => nil)
    @params = { 'bank_name' => 'bank_name', 'account_no' => "account_no", 'transaction_reference_no' => "transaction_reference_no" }
    @payment_details = PaymentDetails.new(@payment, @params)
  end

  describe "#initialize" do
    it "sets payment" do
      @payment_details.payment.should eq(@payment)
    end

    it "sets params" do
      @payment_details.params.should eq(@params)
    end

    it "initializes errors" do
      @payment_details.errors.should eq([])
    end
  end

  describe "#save" do
    context 'when payment details submitted' do
      before do
        @payment.stub(:details_submitted?).and_return(true)
      end

      it "sets errors" do
        @payment_details.save
        @payment_details.errors.should eq(["Payment Details can be submitted only once."])
      end

      it "does not update payment" do
        @payment.should_not_receive(:update_attributes)
        @payment_details.save
      end

      it "returns false" do
        @payment_details.save.should be_false
      end

    end

    context 'when payment details not submitted' do
      before do
        @payment.stub(:details_submitted?).and_return(false)
      end

      it 'sets validates_bank_details to true' do
        @payment.should_receive(:validate_bank_details=).with(true)
        @payment_details.save
      end

      it "updates payment attributes" do
        @payment.should_receive(:update_attributes)
        @payment_details.save
      end

      context 'when payment attributes not updated successfully' do
        before do
          @payment.stub(:update_attributes).and_return(false)
          @payment.stub_chain(:errors, :full_messages).and_return(["some error occurred"])
        end

        it 'sets errors' do
          @payment_details.save
          @payment_details.errors.should eq(["some error occurred"])
        end

        it 'returns false' do
          @payment_details.save.should be_false
        end
      end

      context 'when payment attributes updated successfully' do
        it 'returns true' do
          @payment_details.save.should be_true
        end
      end
    end
  end
end


text:
AnimationSystem::AnimationSystem(World& iWorld)
    : System<SystemType_t::Animation>(iWorld)
{
}

AnimationSystem::~AnimationSystem()
{
}

void AnimationSystem::update(float iDelay)
{
    // Copy list to avoid problems when entities are removed during loop (end of animation for example)
    auto managedEntitiesCopy = _managedEntities;
    for (std::shared_ptr<Entity> theEntity : managedEntitiesCopy)
    {
        YAB_ASSERT(theEntity);

        auto animations = theEntity->accessComponent<AnimationComponent>();
        auto display = theEntity->accessComponent<RenderComponent>();

        YAB_ASSERT(animations);
        YAB_ASSERT(display);

        EntityState theCurrentState = theEntity->getCurrentState();
        bool isAnimated = ((animations->_currentAnimation != animations->_animations.end())
                           && !animations->_currentAnimation->second->isStopped() );

        auto currentAnimationByState = animations->_animations.find(theCurrentState);
        // if state has changed
        if (animations->_currentAnimation != currentAnimationByState)
        {
            // stop current animation
            if (isAnimated)
            {
                animations->_currentAnimation->second->stop();
                // Do not forget to update the current sprite
                display->_drawable = animations->_currentAnimation->second->getCurrent();
                isAnimated = false;
            }

            // if the current state has animation start it
            animations->_currentAnimation = currentAnimationByState;
            if ( animations->_currentAnimation != animations->_animations.end() )
            {
                animations->_currentAnimation->second->start();
                isAnimated = true;
            }
        }
        else if (isAnimated)     // else resume ongoing animation if any
        {
            animations->_currentAnimation->second->resume();
        }

        // Update sprite if needed
        if (isAnimated) // if sprite changed
        {
            AnimationStatus_t animStatus = animations->_currentAnimation->second->update(iDelay);
            switch(animStatus)
            {
            case AnimEndLoop:
            {
                // end animation callback on end loop
                auto callbackCommandIt = animations->_endAnimationCommands.find(theCurrentState);
                if (callbackCommandIt != animations->_endAnimationCommands.end())
                    callbackCommandIt->second->execute(theEntity);
            }

            case AnimUpdate:
                display->_drawable = animations->_currentAnimation->second->getCurrent();
                break;
            case AnimNoUpdate:
                break;
            }
        }
    }
}

bool AnimationSystem::shouldBeManaged(std::shared_ptr<Entity> iEntity)
{
    return (iEntity && iEntity->hasComponent<AnimationComponent>() && iEntity->hasComponent<RenderComponent>());
}


text:
class SpeedControl {
public:
    SpeedControl(volatile double* leftSpeed, volatile double* rightSpeed, MotorDriver* motors);
    void enable();
    void disable();
    void updatePID();

private:
    PID myPID;
    // double kp = 1.5;
    // double ki = 0.5;
    // double kd = 1;

    // ahora sí
    // double kp = 1.5;
    // double ki = 50;
    // double kd = 2.5;

    double kp = 1;
    double ki = 50;
    double kd = 2.5;

    bool enabled = false;

    double minPwm = 100;
    double maxPwm = 255;

    volatile double* leftSpeed;
    volatile double* rightSpeed;

    volatile double input = 0;
    volatile double output = 0;
    double setpoint = 0;
    MotorDriver* motors;
};

#endif


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require('@angular/core');
var http_1 = require('@angular/http');
var angular2_jwt_1 = require('angular2-jwt/angular2-jwt');
function authHttpServiceFactory(http, options) {
    var _this = this;
    return new angular2_jwt_1.AuthHttp(new angular2_jwt_1.AuthConfig({
        tokenName: 'token',
        tokenGetter: (function () { return localStorage.getItem(_this.tokenName); }),
        globalHeaders: [{ 'Content-Type': 'application/json' }],
    }), http, options);
}
var AuthModule = (function () {
    function AuthModule() {
    }
    AuthModule = __decorate([
        core_1.NgModule({
            providers: [
                {
                    provide: angular2_jwt_1.AuthHttp,
                    useFactory: authHttpServiceFactory,
                    deps: [http_1.Http, http_1.RequestOptions]
                }
            ]
        }),
        __metadata('design:paramtypes', [])
    ], AuthModule);
    return AuthModule;
}());
exports.AuthModule = AuthModule;
//# sourceMappingURL=auth.module.js.map


text:
package swingPlus.shared;

import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JToolBar;

import util.screenshot.JScreenshotBar;

public class MyFrame extends JFrame {

	/**
	 *
	 */
	private static final long serialVersionUID = -3302002692599202389L;

	public MyFrame () {
		super ();
		myFrameInit ();
	}

    public MyFrame (final GraphicsConfiguration gConfig) {
        super (gConfig);
        myFrameInit();
    }

    public MyFrame (final String title) {
        super (title);
        myFrameInit();
    }

    public MyFrame (final String title, final GraphicsConfiguration gConfig) {
        super (title, gConfig);
        myFrameInit();
    }

    final void myFrameInit () {
		final JToolBar jtb = new JScreenshotBar ();
		this.getContentPane().setLayout (new BorderLayout ());
		this.getContentPane().add (jtb, BorderLayout.NORTH);
		this.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE);
		this.addWindowListener (new MyFrameWindowAdapter ());
    }

    class MyFrameWindowAdapter extends WindowAdapter {
    	@Override
		public void windowClosing (final WindowEvent event) {
    		(MyFrame.this).setVisible (false);
    		(MyFrame.this).dispose ();
    	}
    }
}


text:
DROP TABLE T_GOLD;

CREATE TABLE R_GOLD (
  ID         BIGINT NOT NULL AUTO_INCREMENT,
  R_PROVINCE    VARCHAR(255),
  VALUE    INTEGER,
  PRIMARY KEY (ID)
);

ALTER TABLE R_PROVINCE_EU
ADD COLUMN SALT INTEGER;