text:
(function($) {
	var
		group = $.fn.markdown.defaults.buttons[0].filter(function(group) {
			return group.name == 'groupLink';
		})[0],
		buttonIndex = group.data.findIndex(function(button) {
			return button.name == 'cmdImage';
		})
		FilerFileDialog = function() {
			this.initialize.apply(this, arguments);
		}
	;

	FilerFileDialog.prototype = {
		initialize: function(editor) {
			this.editor = editor;
			this.render();
			this.bindEvents();
		},

		render: function() {
			this.$overlay	= $('
');
			this.$container = $('
');
			this.$header 	= $('
Image/Video
');
			this.$image 	= $('
Choose image or video.
');
			this.$close		= $('X');
			this.$submit	= $('<button>Insert</button>');

			this.$header.append(this.$close);

			this.$overlay.addClass('filer-file-overlay');
			this.$container.addClass('filer-file-container');
			this.$header.addClass('filer-file-header');
			this.$image.addClass('filer-file-image');
			this.$close.addClass('filer-file-close');
			this.$submit.addClass('filer-file-submit');

			this.$overlay.append(this.$container);
			this.$container.append(this.$header);
			this.$container.append(this.$image);
			this.$container.append(this.$submit);
			$('body').append(this.$overlay);
		},

		bindEvents: function() {
			var self = this;

			self.$overlay.on('click', function() {
				self.onClick.apply(self, arguments);
			});
		},

		unbindEvents: function() {
			this.$overlay.off('click');
		},

		close: function() {
			this.unbindEvents();
			this.$overlay.remove();
		},

		openFilerPopup: function() {
			var
				self = this,
				originalDismissAddRelatedObjectPopup = window.dismissAddRelatedObjectPopup,
				baseUrl = window.location.pathname.substring(0, window.location.pathname.indexOf('/admin/'))
			;

			window.dismissRelatedImageLookupPopup = function(popup, id, thumbnail) {
				popup.close();

				window.dismissRelatedImageLookupPopup = originalDismissAddRelatedObjectPopup;

				self.$image
					.data('id', id)
					.css('background-image', 'url("' + thumbnail + '")')
					.addClass('has-image');
			};

			window.open(
				baseUrl + '/admin/filer/folder/?_popup=1&_pick=file',
				'Filer',
				'width=800,height=600,resizable=yes,scrollbars=yes'
			).focus();
			return false;
		},

		onClick: function(e) {
			var $target = $(e.target);

			e.preventDefault();

			switch (true) {
				case $target.hasClass('filer-file-overlay'):
				case $target.hasClass('filer-file-close'):
					this.close();

					break;
				case $target.hasClass('filer-file-image'):
					this.openFilerPopup();

					break;
				case $target.hasClass('filer-file-submit'):
					var id = this.$image.data('id');

					if (id) {
						var selected = this.editor.getSelection();
						this.editor.replaceSelection('[file:' + id + ']');
						this.editor.setSelection(selected.start, selected.start);
						this.close();
					}

					break;
			}
		}
	};

	group.data[buttonIndex] = {
		name: 'cmdFilerFile',
		title: 'Image/Video',
		hotkey: 'Ctrl+G',
		icon: {
			fa: 'fas fa-image',
			fa4: 'fa fa-image'
		},
		callback: function(e) {
			new FilerFileDialog(e);
		}
	};
})(window.jQuery || window.django.jQuery);


text:
A tool to create Anki cards from jisho.org based on specified criteria.

__This project is a WIP and not ready for use!__

redpajama_set_name: RedPajamaGithub


text:
<?php namespace Arcanedev\Stripe\Resources;

use Arcanedev\Stripe\Contracts\Resources\Sku as SkuContract;
use Arcanedev\Stripe\StripeResource;

/**
 * Class     Sku
 *
 * @package  Arcanedev\Stripe\Resources
 * @author   ARCANEDEV <arcanedev.maroc@gmail.com>
 * @link     https://stripe.com/docs/api/php#sku_object
 *
 * @property  string                            id
 * @property  string                            object             // 'sku'
 * @property  bool                              active
 * @property  array                             attributes
 * @property  int                               created             // timestamp
 * @property  string                            currency
 * @property  string                            image
 * @property  \Arcanedev\Stripe\StripeObject    inventory
 * @property  bool                              livemode
 * @property  \Arcanedev\Stripe\AttachedObject  metadata
 * @property  array                             package_dimensions
 * @property  int                               price
 * @property  string                            product
 * @property  int                               updated             // timestamp
 */
class Sku extends StripeResource implements SkuContract
{
    /* ------------------------------------------------------------------------------------------------
     |  Main Functions
     | ------------------------------------------------------------------------------------------------
     */
    /**
     * List all SKUs.
     * @link   https://stripe.com/docs/api/php#list_skus
     *
     * @param  array|null         $params
     * @param  array|string|null  $options
     *
     * @return \Arcanedev\Stripe\Collection|array
     */
    public static function all($params = [], $options = null)
    {
        return self::scopedAll($params, $options);
    }

    /**
     * Retrieve a SKU.
     * @link   https://stripe.com/docs/api/php#retrieve_sku
     *
     * @param  string             $id
     * @param  array|string|null  $options
     *
     * @return self
     */
    public static function retrieve($id, $options = null)
    {
        return self::scopedRetrieve($id, $options);
    }

    /**
     * Create a SKU.
     * @link   https://stripe.com/docs/api/php#create_sku
     *
     * @param  array|null         $params
     * @param  array|string|null  $options
     *
     * @return self
     */
    public static function create($params = [], $options = null)
    {
        return self::scopedCreate($params, $options);
    }

    /**
     * Update a SKU.
     * @link   https://stripe.com/docs/api/php#update_sku
     *
     * @param  string             $id
     * @param  array|null         $params
     * @param  array|string|null  $options
     *
     * @return self
     */
    public static function update($id, $params = [], $options = null)
    {
        return self::scopedUpdate($id, $params, $options);
    }

    /**
     * Update/Save a SKU.
     * @link   https://stripe.com/docs/api/php#update_sku
     *
     * @param  array|string|null  $options
     *
     * @return self
     */
    public function save($options = null)
    {
        return $this->scopedSave($options);
    }

    /**
     * Delete a SKU.
     * @link   https://stripe.com/docs/api/php#delete_sku
     *
     * @param  array|null         $params
     * @param  array|string|null  $options
     *
     * @return self
     */
    public function delete($params = [], $options = null)
    {
        return $this->scopedDelete($params, $options);
    }
}


text:
using System;
using System.Runtime.InteropServices;

// ReSharper disable once CheckNamespace
namespace DlibDotNet
{

    internal sealed partial class NativeMethods
    {

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType maximum_nu_float_vector(IntPtr y, out float ret);

        [DllImport(NativeLibrary, CallingConvention = CallingConvention)]
        public static extern ErrorType maximum_nu_double_vector(IntPtr y, out double ret);

    }

}


text:
@interface UIWebView (JSContext)

- (JSContext *)jsContext;

@end


text:
@class ITBrakes;

@interface ITCar : NSObject

@property (nonatomic, readonly, strong) ITBrakes *brakes;
@property (nonatomic, readonly, strong) NSString *name;

@end


text:
.theia-navigator-container {
    font-size: var(--theia-ui-font-size1);
    color: var(--theia-ui-font-color1);
    margin: 5px;
}

.theia-navigator-container .open-workspace-button-container {
    margin: auto;
    margin-top: 5px;
}

.p-Widget .open-workspace-button {
    border: 1px solid var(--theia-border-color1);
    color: var(--theia-ui-font-color1);
    font-size: var(--theia-ui-font-size1);
    border-radius: 0;
    background-color: var(--theia-accent-color3);
    outline: none;
    cursor: pointer;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
    width: 100%;
}


text:
import aws from 'aws-sdk';
import Bluebird from 'bluebird';

import { Ec2Instance } from '../resource';
import { SlackNotification } from '../notification';

class TrustedAdvisor {
  run() {
    const region = aws.config.region;

    const support = new aws.Support({ apiVersion: '2013-04-15' });
    Bluebird.promisifyAll(Object.getPrototypeOf(support));

    const notification = new SlackNotification(process.env.SLACK_WEBHOOK_URL);

    return support.describeTrustedAdvisorChecksAsync({
      language: 'en'
    })
      .get('checks')
      // TODO: maybe remove this filter?
      .filter(check => check.category === 'cost_optimizing' && check.metadata.includes('Instance ID'))
      .then(checks => {
        return support.describeTrustedAdvisorCheckSummariesAsync({
          checkIds: checks.map(c => c.id)
        })
          .get('summaries')
          .filter(summary => ['warning', 'error'].includes(summary.status) && summary.hasFlaggedResources)
          .map(summary => {
            return { summary, check: checks.find(c => c.id === summary.checkId) };
          })
      })
      .map(({summary, check}) => {
        return support.describeTrustedAdvisorCheckResultAsync({
          checkId: check.id,
          language: 'en'
        })
          .get('result')
          .then(result => {
            const resources = [];

            const instanceNameIndex = check.metadata.findIndex(m => m === 'Instance Name');
            const savingsIndex = check.metadata.findIndex(m => m === 'Estimated Monthly Savings');
            const instanceIdIndex = check.metadata.findIndex(m => m === 'Instance ID');
            if(instanceIdIndex >= 0) {
              resources.push(...result.flaggedResources.map(r => {
                const tags = new Map();
                const fields = [];

                if(instanceNameIndex >= 0) {
                  tags.set('Name', r.metadata[instanceNameIndex]);
                }

                if(savingsIndex >= 0) {
                  fields.push({
                    title: 'Savings',
                    value: r.metadata[savingsIndex],
                    short: true
                  })
                }

                return { fields, resource: new Ec2Instance(r.region, r.metadata[instanceIdIndex], tags) };
              }));
            }

            return Bluebird.resolve(resources)
              .map(({ resource, fields }) => notification[summary.status](resource, check.name, { fields }));
          })
      });
  }
}

export default TrustedAdvisor;


text:
namespace ash {
namespace {
const int kLayerAnimationsForMinimizeDurationMS = 200;

// Durations for the cross-fade animation, in milliseconds.
const float kCrossFadeDurationMinMs = 200.f;
const float kCrossFadeDurationMaxMs = 400.f;

// Durations for the brightness/grayscale fade animation, in milliseconds.
const int kBrightnessGrayscaleFadeDurationMs = 1000;

// Brightness/grayscale values for hide/show window animations.
const float kWindowAnimation_HideBrightnessGrayscale = 1.f;
const float kWindowAnimation_ShowBrightnessGrayscale = 0.f;

const float kWindowAnimation_HideOpacity = 0.f;
const float kWindowAnimation_ShowOpacity = 1.f;
// TODO(sky): if we end up sticking with 0, nuke the code doing the rotation.
const float kWindowAnimation_MinimizeRotate = 0.f;

// Tween type when cross fading a workspace window.
const ui::Tween::Type kCrossFadeTweenType = ui::Tween::EASE_IN_OUT;

// Scales for AshWindow above/below current workspace.
const float kLayerScaleAboveSize = 1.1f;
const float kLayerScaleBelowSize = .9f;

int64 Round64(float f) {
  return static_cast<int64>(f + 0.5f);
}

}  // namespace

const int kCrossFadeDurationMS = 200;

void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
  // Recalculate the transform at restore time since the launcher item may have
  // moved while the window was minimized.
  gfx::Rect bounds = window->bounds();
  gfx::Rect target_bounds = GetMinimizeAnimationTargetBoundsInScreen(window);
  target_bounds =
      ScreenAsh::ConvertRectFromScreen(window->parent(), target_bounds);

  float scale_x = static_cast<float>(target_bounds.width()) / bounds.width();
  float scale_y = static_cast<float>(target_bounds.height()) / bounds.height();

  scoped_ptr<ui::InterpolatedTransform> scale(
      new ui::InterpolatedScale(gfx::Point3F(1, 1, 1),
                                gfx::Point3F(scale_x, scale_y, 1)));

  scoped_ptr<ui::InterpolatedTransform> translation(
      new ui::InterpolatedTranslation(
          gfx::Point(),
          gfx::Point(target_bounds.x() - bounds.x(),
                     target_bounds.y() - bounds.y())));

  scoped_ptr<ui::InterpolatedTransform> rotation(
      new ui::InterpolatedRotation(0, kWindowAnimation_MinimizeRotate));

  scoped_ptr<ui::InterpolatedTransform> rotation_about_pivot(
      new ui::InterpolatedTransformAboutPivot(
          gfx::Point(bounds.width() * 0.5, bounds.height() * 0.5),
          rotation.release()));

  scale->SetChild(translation.release());
  rotation_about_pivot->SetChild(scale.release());

  rotation_about_pivot->SetReversed(show);

  base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
      kLayerAnimationsForMinimizeDurationMS);

  scoped_ptr<ui::LayerAnimationElement> transition(
      ui::LayerAnimationElement::CreateInterpolatedTransformElement(
          rotation_about_pivot.release(), duration));

  transition->set_tween_type(
      show ? ui::Tween::EASE_IN : ui::Tween::EASE_IN_OUT);

  window->layer()->GetAnimator()->ScheduleAnimation(
      new ui::LayerAnimationSequence(transition.release()));

  // When hiding a window, turn off blending until the animation is 3 / 4 done
  // to save bandwidth and reduce jank.
  if (!show) {
    window->layer()->GetAnimator()->SchedulePauseForProperties(
        (duration * 3) / 4, ui::LayerAnimationElement::OPACITY, -1);
  }

  // Fade in and out quickly when the window is small to reduce jank.
  float opacity = show ? 1.0f : 0.0f;
  window->layer()->GetAnimator()->ScheduleAnimation(
      new ui::LayerAnimationSequence(
          ui::LayerAnimationElement::CreateOpacityElement(
              opacity, duration / 4)));
}

void AnimateShowWindow_Minimize(aura::Window* window) {
  window->layer()->set_delegate(window);
  window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
  AddLayerAnimationsForMinimize(window, true);

  // Now that the window has been restored, we need to clear its animation style
  // to default so that normal animation applies.
  views::corewm::SetWindowVisibilityAnimationType(
      window, views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT);
}

void AnimateHideWindow_Minimize(aura::Window* window) {
  window->layer()->set_delegate(NULL);

  // Property sets within this scope will be implicitly animated.
  ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
  base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
      kLayerAnimationsForMinimizeDurationMS);
  settings.SetTransitionDuration(duration);
  settings.AddObserver(
      views::corewm::CreateHidingWindowAnimationObserver(window));
  window->layer()->SetVisible(false);

  AddLayerAnimationsForMinimize(window, false);
}

void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window,
                                                     bool show) {
  window->layer()->set_delegate(window);

  float start_value, end_value;
  if (show) {
    start_value = kWindowAnimation_HideBrightnessGrayscale;
    end_value = kWindowAnimation_ShowBrightnessGrayscale;
  } else {
    start_value = kWindowAnimation_ShowBrightnessGrayscale;
    end_value = kWindowAnimation_HideBrightnessGrayscale;
  }

  window->layer()->SetLayerBrightness(start_value);
  window->layer()->SetLayerGrayscale(start_value);
  if (show) {
    window->layer()->SetOpacity(kWindowAnimation_ShowOpacity);
    window->layer()->SetVisible(true);
  }

  base::TimeDelta duration =
      base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs);

  ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
  settings.SetTransitionDuration(duration);
  if (!show) {
    settings.AddObserver(
        views::corewm::CreateHidingWindowAnimationObserver(window));
  }

  window->layer()->GetAnimator()->
      ScheduleTogether(
          CreateBrightnessGrayscaleAnimationSequence(end_value, duration));
  if (!show) {
    window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
    window->layer()->SetVisible(false);
  }
}

void AnimateShowWindow_BrightnessGrayscale(aura::Window* window) {
  AnimateShowHideWindowCommon_BrightnessGrayscale(window, true);
}

void AnimateHideWindow_BrightnessGrayscale(aura::Window* window) {
  AnimateShowHideWindowCommon_BrightnessGrayscale(window, false);
}

bool AnimateShowWindow(aura::Window* window) {
  if (!views::corewm::HasWindowVisibilityAnimationTransition(
          window, views::corewm::ANIMATE_SHOW)) {
    return false;
  }

  switch (views::corewm::GetWindowVisibilityAnimationType(window)) {
    case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE:
      AnimateShowWindow_Minimize(window);
      return true;
    case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE:
      AnimateShowWindow_BrightnessGrayscale(window);
      return true;
    default:
      NOTREACHED();
      return false;
  }
}

bool AnimateHideWindow(aura::Window* window) {
  if (!views::corewm::HasWindowVisibilityAnimationTransition(
          window, views::corewm::ANIMATE_HIDE)) {
    return false;
  }

  switch (views::corewm::GetWindowVisibilityAnimationType(window)) {
    case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE:
      AnimateHideWindow_Minimize(window);
      return true;
    case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE:
      AnimateHideWindow_BrightnessGrayscale(window);
      return true;
    default:
      NOTREACHED();
      return false;
  }
}

// Observer for a window cross-fade animation. If either the window closes or
// the layer's animation completes or compositing is aborted due to GPU crash,
// it deletes the layer and removes itself as an observer.
class CrossFadeObserver : public ui::CompositorObserver,
                          public aura::WindowObserver,
                          public ui::ImplicitAnimationObserver {
 public:
  // Observes |window| for destruction, but does not take ownership.
  // Takes ownership of |layer| and its child layers.
  CrossFadeObserver(aura::Window* window, ui::Layer* layer)
      : window_(window),
        layer_(layer) {
    window_->AddObserver(this);
    layer_->GetCompositor()->AddObserver(this);
  }
  virtual ~CrossFadeObserver() {
    window_->RemoveObserver(this);
    window_ = NULL;
    layer_->GetCompositor()->RemoveObserver(this);
    views::corewm::DeepDeleteLayers(layer_);
    layer_ = NULL;
  }

  // ui::CompositorObserver overrides:
  virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE {
  }
  virtual void OnCompositingStarted(ui::Compositor* compositor,
                                    base::TimeTicks start_time) OVERRIDE {
  }
  virtual void OnCompositingEnded(ui::Compositor* compositor) OVERRIDE {
  }
  virtual void OnCompositingAborted(ui::Compositor* compositor) OVERRIDE {
    // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
    layer_->GetAnimator()->StopAnimating();
  }
  virtual void OnCompositingLockStateChanged(
      ui::Compositor* compositor) OVERRIDE {
  }
  virtual void OnUpdateVSyncParameters(ui::Compositor* compositor,
                                       base::TimeTicks timebase,
                                       base::TimeDelta interval) OVERRIDE {
  }

  // aura::WindowObserver overrides:
  virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
    // Triggers OnImplicitAnimationsCompleted() to be called and deletes us.
    layer_->GetAnimator()->StopAnimating();
  }
  virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE {
    layer_->GetAnimator()->StopAnimating();
  }

  // ui::ImplicitAnimationObserver overrides:
  virtual void OnImplicitAnimationsCompleted() OVERRIDE {
    delete this;
  }

 private:
  aura::Window* window_;  // not owned
  ui::Layer* layer_;  // owned

  DISALLOW_COPY_AND_ASSIGN(CrossFadeObserver);
};

// Implementation of cross fading. Window is the window being cross faded. It
// should be at the target bounds. |old_layer| the previous layer from |window|.
// This takes ownership of |old_layer| and deletes when the animation is done.
// |pause_duration| is the duration to pause at the current bounds before
// animating. Returns the duration of the fade.
base::TimeDelta CrossFadeImpl(aura::Window* window,
                              ui::Layer* old_layer,
                              ui::Tween::Type tween_type) {
  const gfx::Rect old_bounds(old_layer->bounds());
  const gfx::Rect new_bounds(window->bounds());
  const bool old_on_top = (old_bounds.width() > new_bounds.width());

  // Shorten the animation if there's not much visual movement.
  const base::TimeDelta duration = GetCrossFadeDuration(old_bounds, new_bounds);

  // Scale up the old layer while translating to new position.
  {
    old_layer->GetAnimator()->StopAnimating();
    ui::ScopedLayerAnimationSettings settings(old_layer->GetAnimator());

    // Animation observer owns the old layer and deletes itself.
    settings.AddObserver(new CrossFadeObserver(window, old_layer));
    settings.SetTransitionDuration(duration);
    settings.SetTweenType(tween_type);
    gfx::Transform out_transform;
    float scale_x = static_cast<float>(new_bounds.width()) /
        static_cast<float>(old_bounds.width());
    float scale_y = static_cast<float>(new_bounds.height()) /
        static_cast<float>(old_bounds.height());
    out_transform.Translate(new_bounds.x() - old_bounds.x(),
                            new_bounds.y() - old_bounds.y());
    out_transform.Scale(scale_x, scale_y);
    old_layer->SetTransform(out_transform);
    if (old_on_top) {
      // The old layer is on top, and should fade out.  The new layer below will
      // stay opaque to block the desktop.
      old_layer->SetOpacity(kWindowAnimation_HideOpacity);
    }
    // In tests |old_layer| is deleted here, as animations have zero duration.
    old_layer = NULL;
  }

  // Set the new layer's current transform, such that the user sees a scaled
  // version of the window with the original bounds at the original position.
  gfx::Transform in_transform;
  const float scale_x = static_cast<float>(old_bounds.width()) /
      static_cast<float>(new_bounds.width());
  const float scale_y = static_cast<float>(old_bounds.height()) /
      static_cast<float>(new_bounds.height());
  in_transform.Translate(old_bounds.x() - new_bounds.x(),
                               old_bounds.y() - new_bounds.y());
  in_transform.Scale(scale_x, scale_y);
  window->layer()->SetTransform(in_transform);
  if (!old_on_top) {
    // The new layer is on top and should fade in.  The old layer below will
    // stay opaque and block the desktop.
    window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
  }
  {
    // Animate the new layer to the identity transform, so the window goes to
    // its newly set bounds.
    ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
    settings.SetTransitionDuration(duration);
    settings.SetTweenType(tween_type);
    window->layer()->SetTransform(gfx::Transform());
    if (!old_on_top) {
      // New layer is on top, fade it in.
      window->layer()->SetOpacity(kWindowAnimation_ShowOpacity);
    }
  }
  return duration;
}

void CrossFadeToBounds(aura::Window* window, const gfx::Rect& new_bounds) {
  // Some test results in invoking CrossFadeToBounds when window is not visible.
  // No animation is necessary in that case, thus just change the bounds and
  // quit.
  if (!window->TargetVisibility()) {
    window->SetBounds(new_bounds);
    return;
  }

  const gfx::Rect old_bounds = window->bounds();

  // Create fresh layers for the window and all its children to paint into.
  // Takes ownership of the old layer and all its children, which will be
  // cleaned up after the animation completes.
  // Specify |set_bounds| to true here to keep the old bounds in the child
  // windows of |window|.
  ui::Layer* old_layer = views::corewm::RecreateWindowLayers(window, true);
  ui::Layer* new_layer = window->layer();

  // Resize the window to the new size, which will force a layout and paint.
  window->SetBounds(new_bounds);

  // Ensure the higher-resolution layer is on top.
  bool old_on_top = (old_bounds.width() > new_bounds.width());
  if (old_on_top)
    old_layer->parent()->StackBelow(new_layer, old_layer);
  else
    old_layer->parent()->StackAbove(new_layer, old_layer);

  CrossFadeImpl(window, old_layer, ui::Tween::EASE_OUT);
}

void CrossFadeWindowBetweenWorkspaces(aura::Window* new_workspace,
                                      aura::Window* window,
                                      ui::Layer* old_layer) {
  ui::Layer* layer_parent = new_workspace->layer()->parent();
  layer_parent->Add(old_layer);
  const bool restoring = old_layer->bounds().width() > window->bounds().width();
  if (restoring)
    layer_parent->StackAbove(old_layer, new_workspace->layer());
  else
    layer_parent->StackBelow(old_layer, new_workspace->layer());

  CrossFadeImpl(window, old_layer, kCrossFadeTweenType);
}

base::TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds,
                                     const gfx::Rect& new_bounds) {
  if (views::corewm::WindowAnimationsDisabled(NULL))
    return base::TimeDelta();

  int old_area = old_bounds.width() * old_bounds.height();
  int new_area = new_bounds.width() * new_bounds.height();
  int max_area = std::max(old_area, new_area);
  // Avoid divide by zero.
  if (max_area == 0)
    return base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS);

  int delta_area = std::abs(old_area - new_area);
  // If the area didn't change, the animation is instantaneous.
  if (delta_area == 0)
    return base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS);

  float factor =
      static_cast<float>(delta_area) / static_cast<float>(max_area);
  const float kRange = kCrossFadeDurationMaxMs - kCrossFadeDurationMinMs;
  return base::TimeDelta::FromMilliseconds(
      Round64(kCrossFadeDurationMinMs + (factor * kRange)));
}

bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) {
  if (views::corewm::WindowAnimationsDisabled(window))
    return false;

  // Attempt to run CoreWm supplied animation types.
  if (views::corewm::AnimateOnChildWindowVisibilityChanged(window, visible))
    return true;

  // Otherwise try to run an Ash-specific animation.
  if (visible)
    return AnimateShowWindow(window);
  // Don't start hiding the window again if it's already being hidden.
  return window->layer()->GetTargetOpacity() != 0.0f &&
      AnimateHideWindow(window);
}

std::vector<ui::LayerAnimationSequence*>
CreateBrightnessGrayscaleAnimationSequence(float target_value,
                                           base::TimeDelta duration) {
  ui::Tween::Type animation_type = ui::Tween::EASE_OUT;
  scoped_ptr<ui::LayerAnimationSequence> brightness_sequence(
      new ui::LayerAnimationSequence());
  scoped_ptr<ui::LayerAnimationSequence> grayscale_sequence(
      new ui::LayerAnimationSequence());

  scoped_ptr<ui::LayerAnimationElement> brightness_element(
      ui::LayerAnimationElement::CreateBrightnessElement(
          target_value, duration));
  brightness_element->set_tween_type(animation_type);
  brightness_sequence->AddElement(brightness_element.release());

  scoped_ptr<ui::LayerAnimationElement> grayscale_element(
      ui::LayerAnimationElement::CreateGrayscaleElement(
          target_value, duration));
  grayscale_element->set_tween_type(animation_type);
  grayscale_sequence->AddElement(grayscale_element.release());

  std::vector<ui::LayerAnimationSequence*> animations;
  animations.push_back(brightness_sequence.release());
  animations.push_back(grayscale_sequence.release());

  return animations;
}

// Returns scale related to the specified AshWindowScaleType.
void SetTransformForScaleAnimation(ui::Layer* layer,
                                   LayerScaleAnimationDirection type) {
  const float scale =
      type == LAYER_SCALE_ANIMATION_ABOVE ? kLayerScaleAboveSize :
          kLayerScaleBelowSize;
  gfx::Transform transform;
  transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2,
                      -layer->bounds().height() * (scale - 1.0f) / 2);
  transform.Scale(scale, scale);
  layer->SetTransform(transform);
}

gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) {
  Launcher* launcher = Launcher::ForWindow(window);
  // Launcher is created lazily and can be NULL.
  if (!launcher)
    return gfx::Rect();
  gfx::Rect item_rect = launcher->
      GetScreenBoundsOfItemIconForWindow(window);

  // The launcher item is visible and has an icon.
  if (!item_rect.IsEmpty())
    return item_rect;

  // If both the icon width and height are 0, then there is no icon in the
  // launcher for |window| or the icon is hidden in the overflow menu. If the
  // launcher is auto hidden, one of the height or width will be 0 but the
  // position in the launcher and the major dimension are still reported
  // correctly and the window can be animated to the launcher item's light
  // bar.
  if (item_rect.width() != 0 || item_rect.height() != 0) {
    internal::ShelfLayoutManager* layout_manager =
        internal::ShelfLayoutManager::ForLauncher(window);
    if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) {
      gfx::Rect shelf_bounds =
          launcher->shelf_widget()->GetWindowBoundsInScreen();
      switch (layout_manager->GetAlignment()) {
        case SHELF_ALIGNMENT_BOTTOM:
          item_rect.set_y(shelf_bounds.y());
          break;
        case SHELF_ALIGNMENT_LEFT:
          item_rect.set_x(shelf_bounds.right());
          break;
        case SHELF_ALIGNMENT_RIGHT:
          item_rect.set_x(shelf_bounds.x());
          break;
        case SHELF_ALIGNMENT_TOP:
          item_rect.set_y(shelf_bounds.bottom());
          break;
      }
      return item_rect;
    }
  }

  // Assume the launcher is overflowed, zoom off to the bottom right of the
  // work area.
  gfx::Rect work_area =
      Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
  return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
}

}  // namespace ash


text:
/**
 * @license Angular v4.1.0
 * (c) 2010-2017 Google, Inc. https://angular.io/
 * License: MIT
 */
import { AUTO_STYLE, NoopAnimationPlayer } from '@angular/animations';

/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */
/**
 * @experimental Animation support is experimental.
 */
class MockAnimationDriver {
    animate(element, keyframes, duration, delay, easing, previousPlayers = []) {
        const player = new MockAnimationPlayer(element, keyframes, duration, delay, easing, previousPlayers);
        MockAnimationDriver.log.push(player);
        return player;
    }
}
MockAnimationDriver.log = [];
/**
 * @experimental Animation support is experimental.
 */
class MockAnimationPlayer extends NoopAnimationPlayer {
    constructor(element, keyframes, duration, delay, easing, previousPlayers) {
        super();
        this.element = element;
        this.keyframes = keyframes;
        this.duration = duration;
        this.delay = delay;
        this.easing = easing;
        this.previousPlayers = previousPlayers;
        this.__finished = false;
        this.previousStyles = {};
        this._onInitFns = [];
        previousPlayers.forEach(player => {
            if (player instanceof MockAnimationPlayer) {
                const styles = player._captureStyles();
                Object.keys(styles).forEach(prop => { this.previousStyles[prop] = styles[prop]; });
            }
        });
    }
    /* @internal */
    onInit(fn) { this._onInitFns.push(fn); }
    /* @internal */
    init() {
        super.init();
        this._onInitFns.forEach(fn => fn());
        this._onInitFns = [];
    }
    finish() {
        super.finish();
        this.__finished = true;
    }
    destroy() {
        super.destroy();
        this.__finished = true;
    }
    _captureStyles() {
        const captures = {};
        Object.keys(this.previousStyles).forEach(prop => {
            captures[prop] = this.previousStyles[prop];
        });
        if (this.hasStarted()) {
            // when assembling the captured styles, it's important that
            // we build the keyframe styles in the following order:
            // {other styles within keyframes, ... previousStyles }
            this.keyframes.forEach(kf => {
                Object.keys(kf).forEach(prop => {
                    if (prop != 'offset') {
                        captures[prop] = this.__finished ? kf[prop] : AUTO_STYLE;
                    }
                });
            });
        }
        return captures;
    }
}

/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */

/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */
/**
 * @module
 * @description
 * Entry point for all public APIs of the platform-browser/animations/testing package.
 */

export { MockAnimationDriver, MockAnimationPlayer };
//# sourceMappingURL=testing.js.map


text:
package com.herblee.gnensisweather.gson;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * @author HERB
 * @date Created on 2017/8/10 23:21
 * @info:
 */
public class AstroBean {
    /**
     * mr : 20:56
     * ms : 07:51
     * sr : 05:43
     * ss : 19:19
     */

    public String mr;
    public String ms;
    public String sr;
    public String ss;

    public static AstroBean objectFromData(String str) {

        return new Gson().fromJson(str, AstroBean.class);
    }

    public static AstroBean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), AstroBean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<AstroBean> arrayAstroBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<AstroBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<AstroBean> arrayAstroBeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<AstroBean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();

    }
}


text:
[data-palladio-timespan-filter] path {
	fill: #dddddd;
}

[data-palladio-timespan-filter] .axis path, [data-palladio-timespan-filter] .axis line {
	fill: none;
	stroke: #000;
	shape-rendering: crispEdges;
}

[data-palladio-timespan-filter] .axis text {
	font: 10px Helvetica, Arial, sans-serif;
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<title>LuaJava - A Script Tool for Java</title>
    <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<big>LuaJava</big>

A Script Tool for Java

LuaJava

Home

Overview

Status

Dependencies

Download

Credits

Contact us

Manual

Compiling

Installing

Java Console

Lua Reference

Java Reference

Examples

History

Project

Bug Tracker

CVS

License

Examples

Hello World using LuaJava

This example is a simple Hello World application using LuaJava printing both from Lua and Java.

Hello.java

public class Hello
{
  public static void main(String[] args)
  {
    LuaState L = LuaStateFactory.newLuaState();
    L.openLibs();

    L.LdoFile("hello.lua");

    System.out.println("Hello World from Java!");
  }
}

hello.lua

print("Hello World from Lua!")

Accessing a DataBase

This example uses Java JDBC to access a database from Lua.

TestJDBC.java

public class TestJDBC
{

  public static void main(String[] args) throws Exception
  {
    // gets a java.sql.Connection and creates a Statement

    Class.forName("org.hsqldb.jdbcDriver");
    Connection con = DriverManager.getConnection(
	                    "jdbc:hsqldb:hsql://localhost:9002",
	                    "sa", "");
    Statement st = con.createStatement();

    try
    {
      st.execute("DROP TABLE luatest");
    }
    catch (Exception ignore) {}

    st.execute([[CREATE TABLE luatest
               (id int not null primary key,
               str varchar, number double)]]);

    for(int i = 0 ; i < 10 ; i++)
    {
      st.executeUpdate(
          "INSERT INTO luatest (id, str, number) values(" +
          i + ", '" + 2*i + "', " +
          System.currentTimeMillis() + ")");
    }

    // creates a Lua State and register the basic libraries

    LuaState L = LuaStateFactory.newLuaState();
    L.openLibs();

    // registers the statement in the global 'st'

    L.pushObjectValue(st);
    L.setGlobal("st");

    // execute file testJDBC.lua

    int err = L.LdoFile("testJDBC.lua");

    L.close();
    st.close();
    con.close();
  }
}

testJDBC.lua

do
-- tests if object Statement is nil
if st == nil then
    print("Error. st object is nil")
    return
end

local st = st
_G.st = nil

function createSQLProxy(t)

    local tableName = t

    local function i (t,k)

        local id = tonumber(k)
        if not id then
            return nil
        end

        local function mi (t,k)

            local sql = "select "..k.." from "..
                        tableName.." where id="..id
            local rs = st:executeQuery(sql)
            if not rs:next() then
                rs:close()
                return nil
            end

            local res = rs:getString(1)
            rs:close()

            return res
        end

        local res = {}
        setmetatable(res, {__index = mi})
        return res
    end

    local res = {}
    setmetatable(res, {__index = i })
    return res
end

end

proxy = createSQLProxy("luatest")

print(proxy[1].str)
print(proxy[1].number)

$Id: examples.html,v 1.17 2007/01/23 22:37:28 thiago Exp $


text:
package com.company;

import java.util.Scanner;

public class VowelOrDigit {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        char input = scanner.nextLine().charAt(0);

        if (input == 'a' || input == 'e' || input == 'o' || input == 'u' || input == 'i' || input == 'y') {
            System.out.println("vowel");
        } else if (Character.isDigit(input)) {
            System.out.println("digit");
        } else {
            System.out.println("other");
        }
    }
}


text:
package techreborn.compat.jei.fluidReplicator;

import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import techreborn.api.fluidreplicator.FluidReplicatorRecipe;
import techreborn.client.gui.TRBuilder;
import techreborn.init.ModItems;

import javax.annotation.Nonnull;

/**
 * @author drcrazy
 *
 */
public class FluidReplicatorRecipeWrapper implements IRecipeWrapper {
	private final FluidReplicatorRecipe recipe;
	private final IDrawableAnimated progress;

	public FluidReplicatorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull FluidReplicatorRecipe recipe) {
		this.recipe = recipe;
		IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
		IDrawableStatic progressStatic = guiHelper.createDrawable(TRBuilder.GUI_SHEET, 100, 151, 16, 10);
		int ticksPerCycle = recipe.getTickTime();
		this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
				IDrawableAnimated.StartDirection.LEFT, false);
	}

	/* (non-Javadoc)
	 * @see mezz.jei.api.recipe.IRecipeWrapper#getIngredients(mezz.jei.api.ingredients.IIngredients)
	 */
	@Override
	public void getIngredients(IIngredients ingredients) {
		ingredients.setInput(ItemStack.class, new ItemStack(ModItems.UU_MATTER, recipe.getInput()));
		ingredients.setOutput(FluidStack.class, new FluidStack(recipe.getFluid(), Fluid.BUCKET_VOLUME));
	}

	@Override
	public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
		progress.draw(minecraft, 25, 25);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>

<config>

	<general>
		<name>ug-tilesnested</name>
		<title>Tiles - Nested</title>
		<istiles>true</istiles>
		<published>true</published>
	</general>

</config>


text:
$('.collapse').collapse("hide");

// lomakkeen kurssihaku
$(document).ready(function() { $("#kurssihaku").select2({minimumInputLength: 2, placeholder: "Valitse kurssi"}); });

// animaatio ylhäältä lomakkeelle
$('.lisaauusi').click(function(){
    $('html, body').animate({
        scrollTop: $( $.attr(this, 'href') ).offset().top
    }, 500);
    return false;
});

// haku
$("#haku").on("keyup change", function() {
   var hakusana = this.value.toLowerCase();
   $("div.panel-heading").each(function() {
        var kurssinnimi = $(this).find('.kurssilinkki').text().toLowerCase();
        if (kurssinnimi.indexOf(hakusana) < 0) {
            $(this).hide();
        } else {
            $(this).show();
        }
   });
});

// datepicker
$(function() {
    $("#datepicker").datepicker({ dateFormat: "dd.mm.yy" }).val();
});

// menuun lisää uusi tentti linkki vain scrollatessa
$(window).scroll(function() {
    if ($(window).scrollTop() < 100) {
        $("li#lisaauusilinkki").hide();
    }
    else {
        $("li#lisaauusilinkki").show();
    }
});

//lomakevalidaatio
$('#lomakeform').parsley();

//mallivastausvalidaatio
$('#mallivastausform').parsley();

window.ParsleyConfig = {
    validators: {
        cantmin: {
            fn: function (value, requirement) {
                //return value !== requirement;
                if ($("#kurssihaku").val())
                    if($("#kurssihaku").val().length > 1)
                        {return true}
                    else {return false}
            },
            priority: 32
        }
    },
    i18n: {
        en: {
            cantmin: 'You have to select at least %s items from the list'
        },
        fi: {
            cantmin: 'Valitse kurssi.'
        }
    }
};


text:
package org.apache.tomcat.util.net.puretls;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Vector;

import COM.claymoresystems.ptls.SSLContext;
import COM.claymoresystems.ptls.SSLException;
import COM.claymoresystems.ptls.SSLServerSocket;
import COM.claymoresystems.ptls.SSLSocket;
import COM.claymoresystems.sslg.SSLPolicyInt;

/**
 * SSL server socket factory--wraps PureTLS
 *
 * @author Eric Rescorla
 *
 * some sections of this file cribbed from SSLSocketFactory
 * (the JSSE socket factory)
 *
 */

public class PureTLSSocketFactory
    extends org.apache.tomcat.util.net.ServerSocketFactory
{
    static org.apache.commons.logging.Log logger =
	org.apache.commons.logging.LogFactory.getLog(PureTLSSocketFactory.class);
    static String defaultProtocol = "TLS";
    static boolean defaultClientAuth = false;
    static String defaultKeyStoreFile = "server.pem";
    static String defaultKeyPass = "password";
    static String defaultRootFile = "root.pem";
    static String defaultRandomFile = "random.pem";

    private COM.claymoresystems.ptls.SSLContext context=null;

    public PureTLSSocketFactory() {
    }

    public ServerSocket createSocket(int port)
	throws IOException
    {
	init();
	return new SSLServerSocket(context,port);
    }

    public ServerSocket createSocket(int port, int backlog)
	throws IOException
    {
	init();
	ServerSocket tmp;

	try {
	    tmp=new SSLServerSocket(context,port,backlog);
	}
	catch (IOException e){
	    throw e;
	}
	return tmp;
    }

    public ServerSocket createSocket(int port, int backlog,
				     InetAddress ifAddress)
	throws IOException
    {
	init();
	return new SSLServerSocket(context,port,backlog,ifAddress);
    }

    private void init()
	throws IOException
    {
	if(context!=null)
	    return;

	boolean clientAuth=defaultClientAuth;

	try {
	    String keyStoreFile=(String)attributes.get("keystore");
	    if(keyStoreFile==null) keyStoreFile=defaultKeyStoreFile;

	    String keyPass=(String)attributes.get("keypass");
	    if(keyPass==null) keyPass=defaultKeyPass;

	    String rootFile=(String)attributes.get("rootfile");
	    if(rootFile==null) rootFile=defaultRootFile;

	    String randomFile=(String)attributes.get("randomfile");
	    if(randomFile==null) randomFile=defaultRandomFile;

	    String protocol=(String)attributes.get("protocol");
	    if(protocol==null) protocol=defaultProtocol;

	    String clientAuthStr=(String)attributes.get("clientauth");
	    if(clientAuthStr != null){
		if(clientAuthStr.equals("true")){
		    clientAuth=true;
		} else if(clientAuthStr.equals("false")) {
		    clientAuth=false;
		} else {
		    throw new IOException("Invalid value '" +
					  clientAuthStr +
					  "' for 'clientauth' parameter:");
		}
	    }

            SSLContext tmpContext=new SSLContext();
            try {
                tmpContext.loadRootCertificates(rootFile);
            } catch(IOException iex) {
                if(logger.isDebugEnabled())
                    logger.debug("Error loading Client Root Store: " +
                                 rootFile,iex);
            }
            tmpContext.loadEAYKeyFile(keyStoreFile,keyPass);
	    tmpContext.useRandomnessFile(randomFile,keyPass);

	    SSLPolicyInt policy=new SSLPolicyInt();
	    policy.requireClientAuth(clientAuth);
            policy.handshakeOnConnect(false);
            policy.waitOnClose(false);
            short [] enabledCiphers = getEnabledCiphers(policy.getCipherSuites());
            if( enabledCiphers != null ) {
                policy.setCipherSuites(enabledCiphers);
            }
            tmpContext.setPolicy(policy);
	    context=tmpContext;
	} catch (Exception e){
	    logger.info("Error initializing SocketFactory",e);
	    throw new IOException(e.getMessage());
	}
    }

    /*
     * Determines the SSL cipher suites to be enabled.
     *
     * @return Array of SSL cipher suites to be enabled, or null if the
     * cipherSuites property was not specified (meaning that all supported
     * cipher suites are to be enabled)
     */
    private short [] getEnabledCiphers(short [] supportedCiphers) {

        short [] enabledCiphers = null;

        String attrValue = (String)attributes.get("ciphers");
        if (attrValue != null) {
            Vector vec = null;
            int fromIndex = 0;
            int index = attrValue.indexOf(',', fromIndex);
            while (index != -1) {
                String cipher = attrValue.substring(fromIndex, index).trim();
                int cipherValue = SSLPolicyInt.getCipherSuiteNumber(cipher);
                /*
                 * Check to see if the requested cipher is among the supported
                 * ciphers, i.e., may be enabled
                 */
                if( cipherValue >= 0) {
                    for (int i=0; supportedCiphers != null
                             && i<supportedCiphers.length; i++) {

                        if (cipherValue == supportedCiphers[i]) {
                            if (vec == null) {
                                vec = new Vector();
                            }
                            vec.addElement(new Integer(cipherValue));
                            break;
                        }
                    }
                }
                fromIndex = index+1;
                index = attrValue.indexOf(',', fromIndex);
            }

            if (vec != null) {
                int nCipher = vec.size();
                enabledCiphers = new short[nCipher];
                for(int i=0; i < nCipher; i++) {
                    Integer value = (Integer)vec.elementAt(i);
                    enabledCiphers[i] = value.shortValue();
                }
            }
        }

        return enabledCiphers;

    }

    public Socket acceptSocket(ServerSocket socket)
	throws IOException
    {
	try {
	    Socket sock=socket.accept();
	    return sock;
	} catch (SSLException e){
            logger.debug("SSL handshake error",e);
            throw new SocketException("SSL handshake error" + e.toString());
	}
    }

    public void handshake(Socket sock)
	 throws IOException
    {
	((SSLSocket)sock).handshake();
    }
}


text:
package com.yueny.demo.dubbo.config.schema;

import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

import com.yueny.demo.dubbo.config.api.LockConfig;
import com.yueny.demo.dubbo.config.spring.KapoBean;

/**
 * CodealyNamespaceHandler
 *
 * @author yueny09 <deep_blue_yang@163.com>
 *
 * @DATE 2017年3月31日 下午6:39:15
 *
 */
public class CodealyNamespaceHandler extends NamespaceHandlerSupport {
	@Override
	public void init() {
		registerBeanDefinitionParser("lock", new CodealyBeanDefinitionParser(LockConfig.class));
		registerBeanDefinitionParser("kapo", new CodealyBeanDefinitionParser(KapoBean.class));
	}

}


text:
package xml.yellowpages;

import org.jsefa.common.converter.EnumConstant;

/**
 * Enum for different roles an employee plays within a department.
 *
 * @author Norman Lahme-Huetig
 *
 */
enum Role {
    @EnumConstant("senior developer")
    SENIOR_DEVELOPER,

    @EnumConstant("junior developer")
    JUNIOR_DEVELOPER,

    @EnumConstant("account manager")
    ACCOUNT_MANAGER,

    @EnumConstant("key account manager")
    KEY_ACCOUNT_MANAGER;
}


text:
module MynewsListing
  MYNEWS_DEFAULT_SETTINGS = {
    :stories_per_page       => ["int", 10],
    :story_status           => ["string", nil],
#    :story_type             => ["string", nil],     # No constraint - both news & opinion
    :source_ownership       => ["string", nil],     # No constraint - both msm & ind
    :source_status          => ["string", nil],
#    :max_stories_per_source => ["int", nil],     # No constraint
    :media_type             => ["string", nil],     # No constraint
    :max_story_age          => ["int", 3],          # Stories no older than 3 days
    :min_matching_criteria  => ["int", 1],          # Sufficient if a story matches 1 criteria
    :public_mynews          => ["string", "members"],
    :show_details           => ["bool", false],     # detailed story info is hidden by default!
    :hide_reviewed_stories  => ["bool", true],      # Do not show stories I've reviewed!
    :hide_read_stories      => ["bool", false],     # Do not show stories I've read
#    :mynews_homepage        => ["int", false],
  }

  private

  MIN_ACTIVITY_SCORE = 11

  # Larger values makes relevance more important; Smaller values makes timeliness more important (useful to have it between 0.25 and 1)
  TIMELINESS_KNOB    = 0.4

    # Larger the absolute numbers, more likely that older stories with more matches will show up.
    # So, tweak these values up or down depending on how important it is to get more recent stories.
  MATCH_BOOSTS = {
    :member  => TIMELINESS_KNOB * 2.50,
    :source  => TIMELINESS_KNOB * 2.00,
    :feed    => TIMELINESS_KNOB * 2.00,
    :topic   => TIMELINESS_KNOB * 1.50,
    :subject => TIMELINESS_KNOB * 0.25,
  }

  MATCH_DECAY_FACTORS = {
    :member  => 0.67, # match influence capped at 3x
    :source  => 0.10, # match influence capped at 1.1x  -- because it is weird to have multiple matching sources for a story!
    :feed    => 0.80, # match influence capped at 5x
    :topic   => 0.60, # match influence capped at 2.5x  -- because topic tags is not reliable across stories
    :subject => 0.20, # match influence capped at 1.25x -- because subject tags are overarching!
  }

  MYNEWS_ORDERINGS = {
    :mynews_active => {
      :most_recent   => "stories.sort_date DESC, stories.activity_score DESC, stories.sort_rating DESC",
      :most_trusted  => "stories.sort_rating DESC, stories.sort_date DESC, stories.activity_score DESC",
      :most_relevant => "stories.activity_score DESC, stories.sort_date DESC, stories.sort_rating DESC"
    },
    :mynews_inactive => {
      :most_relevant => "stories.sort_date DESC, stories.sort_rating DESC"
    },
  }

  def mynews_settings(member, my_page=true)
    # Set up base listing options
    settings = {}
    MYNEWS_DEFAULT_SETTINGS.each { |k,def_val|
      k = k.to_sym
      val = member.send(k)
      if val.blank?
        settings[k] = def_val[1]
      else
        settings[k] = case def_val[0]
          when "string" then val
          when "int"    then val.to_i
          when "bool"   then (val == "true" || val == "1") ? true : false
          else raise "Unknown Default Setting Type!"
        end
      end
    }

    # If I am seeing another member's mynews page, use default values (rather than the member's values) for some settings
    [:stories_per_page, :show_details].each { |s| settings[s] = MYNEWS_DEFAULT_SETTINGS[s][1] } if !my_page

    return settings
  end

  def followed_items_hash(member)
    { :empty   => member.followed_items.blank?,
      :feeds   => member.followed_feeds.sort   { |a,b| a.name <=> b.name },
      :sources => member.followed_sources.sort { |a,b| a.name <=> b.name },
      :members => member.followed_members.sort { |a,b| a.name <=> b.name },
      :topics  => member.followed_topics.sort  { |a,b| a.name <=> b.name } }
  end

  def mynews_stories(params, member, followed_items, settings)
    if followed_items[:empty]
       { :stories => [] }
    else
      mynews_ordering = params[:listing_type] || :most_relevant
      num_reqd    = settings[:stories_per_page]
      num_stories = num_reqd

      if mynews_ordering == :most_relevant
        # Fetch 5x the number so that we have a bigger window of stories to list relevant stories
        # NOTE: Strictly speaking, I need to fetch ALL stories and then find # matching criteria on all of them,
        # but that is going to be really expensive, plus we are really more interested in newer stories even if
        # fewer criteria match when compared to older stories ... so, fudge!
        num_stories *= 5

        # Fetch more stories if we are hiding reviewed stories!
        # Assuming an avg. of 5 reviews a day
        # But if we are hiding read stories, dont bother -- since reviewed stories will get hidden automatically.
        num_stories += 5 * settings[:max_story_age] if settings[:hide_reviewed_stories] && !settings[:hide_read_stories]

        # fetch at least 30 stories to get a good shot at picking good stories!
        num_stories = 30 if num_stories < 30

        # fetch at most 200 stories
        num_stories = 200 if num_stories > 200
      end

#     max_stories_per_source = settings[:max_stories_per_source]
#     max_stories_per_source = nil if (max_stories_per_source == 0)

      story_type       = (params[:story_type].nil? || params[:story_type] == 'all') ? nil : params[:story_type]
      source_ownership = case params[:source_ownership]
        when nil, 'all' then nil
        when 'mainstream' then Source::MSM
        when 'independent' then Source::IND
        else params[:source_ownership]
      end
      base_opts = {
        :listing_type      => :mynews_active,
        :listing_type_opts => { :min_activity_score => (mynews_ordering == :most_relevant) ? MIN_ACTIVITY_SCORE : nil,
                                :order_by           => MYNEWS_ORDERINGS[:mynews_active][mynews_ordering] },
#        :paginate         => true,
#        :page             => 1,
        :per_page          => num_stories,
#        :time_span         => settings[:max_story_age].days,
        :start_date        => Time.now - settings[:max_story_age].days,
        :end_date          => Time.now + 1.day,  # allow "future" stories to show up!
        :filters           => {
          :story_type      => story_type,
          :hide_read       => member && settings[:hide_read_stories] ? member.id : nil,
          :sources         => {
            :rating_class  => settings[:source_status],
            :media_type    => settings[:media_type],
            :ownership     => source_ownership,
#            :max_stories_per_source => max_stories_per_source
          }
        }
      }

      # Handle story rating setting specially!
      (min_reviews, min_story_rating, status) = case settings[:story_status]
        when nil, ""    then [nil, nil, nil] # Optimization where we check for status != hide rather than status = everything else
        when "posted"   then [nil, nil, [Story::LIST, Story::FEATURE]]
        when "reviewed" then [1,   nil, [Story::LIST, Story::FEATURE]]
        when "rated"    then [3,   nil, [Story::LIST, Story::FEATURE]]
        when "trusted"  then [3,   3.0, [Story::LIST, Story::FEATURE]]
      end
      base_opts[:filters][:min_reviews]      = min_reviews if min_reviews
      base_opts[:filters][:min_story_rating] = min_story_rating if min_story_rating
      base_opts[:filters][:status]           = status if status
      base_opts[:filters][:exclude_stories]  = params[:exclude_stories].split(",").map { |x| x.strip.to_i } if !params[:exclude_stories].blank?

      scores = {}
      tmp_stories = []
      story_matches = {}
      while (true) do
        all_stories = {}
        if params[:follow_type]
          item = params[:follow_type].capitalize.constantize.send("find", params[:follow_id])
          fetch_followed_stories(followed_items, {:type => params[:follow_type].to_sym, :item => item}, base_opts, all_stories, scores, story_matches)
        else
          fetch_followed_stories(followed_items, {:type => :feed},   base_opts, all_stories, scores, story_matches)
          fetch_followed_stories(followed_items, {:type => :source}, base_opts, all_stories, scores, story_matches)
          fetch_followed_stories(followed_items, {:type => :topic},  base_opts, all_stories, scores, story_matches)
          fetch_followed_stories(followed_items, {:type => :member}, base_opts, all_stories, scores, story_matches)
        end

        # Create the final list of stories by filtering out stories that:
        # - don't meet min. # of criteria (ignore num settings criteria if we are choosing from a specific followed item)
        # - I've reviewed (if I want reviewed stories hidden)
        l = all_stories.values
        l = l.reject { |s| story_matches[s.id][:count] < settings[:min_matching_criteria] } if !params[:follow_type]
        l = l.reject { |s| s.reviewed_by?(member) } if member && settings[:hide_reviewed_stories]
        tmp_stories += l

        # Sort the merged list by listing type specific ordering
        # Here, use 'rating' instead of sort_rating!  SSS FIXME: check with fab & david how to handle this.
        case mynews_ordering
          when :most_recent
            tmp_stories.sort! { |s1, s2|
              c = s2.sort_date  <=> s1.sort_date
#              c = story_matches[s2.id][:count] <=> story_matches[s1.id][:count] if (c == 0)
              c = scores[s2.id] <=> scores[s1.id] if (c == 0)
              c = s2.rating     <=> s1.rating  if (c == 0)
              c
            }
          when :most_trusted
            tmp_stories.sort! { |s1, s2|
              c = s2.rating     <=> s1.rating
              c = s2.sort_date  <=> s1.sort_date if (c == 0)
#              c = story_matches[s2.id][:count] <=> story_matches[s1.id][:count] if (c == 0)
              c = scores[s2.id] <=> scores[s1.id]   if (c == 0)
              c
            }
          when :most_relevant
            tmp_stories.sort! { |s1, s2|
#              c = story_matches[s2.id][:count] <=> story_matches[s1.id][:count]
              c = scores[s2.id] <=> scores[s1.id]  # if (c == 0)
              c = s2.sort_date  <=> s1.sort_date if (c == 0)
              c = s2.rating     <=> s1.rating    if (c == 0)
              c
            }
        end

        stories = tmp_stories.first(num_reqd)

        # Most of the time, we will get what we want and bail!  If not, we will fetch stories once more and look for inactive stories
        break if (stories.length == num_reqd) || (mynews_ordering != :most_relevant) || (base_opts[:listing_type] == :mynews_inactive)

        # Try again -- this time, only with inactive stories!
        base_opts[:listing_type] = :mynews_inactive
        base_opts[:listing_type_opts] = { :max_activity_score => MIN_ACTIVITY_SCORE, :order_by => MYNEWS_ORDERINGS[:mynews_inactive][:most_relevant] }
      end

      { :stories => stories, :scores => scores, :matches => story_matches }
    end
  end

  def match_boost_factor(item_type, num_matches)
     # Each new matched item has progressively lower impact -- MATCH_DECAY_FACTORS[item_type]
    decay = MATCH_DECAY_FACTORS[item_type]
    ((1 - decay ** num_matches) / (1 - decay) * MATCH_BOOSTS[item_type])
  end

  def fetch_followed_stories(followed_items, follow_opts, base_opts, all_stories, scores, story_matches)
    item_type = follow_opts[:type]
    itype = "#{item_type}s".to_sym
    fitems = follow_opts[:item] ? [follow_opts[:item]] : followed_items[itype]  # Either a specific id or everything!
    if !fitems.blank?
      fids = fitems.map(&:id)

      # What I really need is a deep clone not a shallow clone!
      opts = base_opts.clone
      opts[:filters][:sources].delete(:ids) # get rid of source ids that get tacked on -- story listing code modifies its arguments!

      # IMPORTANT: Do not use opts[:filters].merge! -- this will modify the underlying base_opts hash
      opts[:filters] = opts[:filters].merge({"#{item_type}_ids".to_sym => fids})

      # SSS FIXME: local_site??  Is mynews subject to local site constraints?
      Story.list_stories_with_associations(opts, [:submitted_by_member, :sources, :tags, {:reviews => :member}, :feeds]).each { |s|
        sid = s.id
        all_stories[sid] = s
        all_matches = case item_type
#          # for topics, return only those matching subjects for which there isn't a matching topic
#          when :topic  then matches = fitems & s.send(itype); matches - matches.collect{ |m| m.class == Topic ? m.subjects : []}.flatten.uniq
          when :topic  then fitems & Topic.tagged_topics_or_subjects(s.topic_or_subject_tags)
          when :member then fitems & ((s.reviews.collect { |r| r.member }.compact) | [s.submitted_by_member])
          else              fitems & s.send(itype)
        end
        num_matches = all_matches.length
        story_matches[sid] ||= {:count => 0}
        story_matches[sid][:count] += num_matches
        story_matches[sid][itype] = all_matches

        # NOTES:
        # 1. Boosting has to be multiplicative so that decay continues to have its effect on the story!
        #    So, stale stories are boosted by a lower value than newer stories
        # 2. Different followed items are boosted differently     -- MATCH_BOOSTS[item_type]
        # 3. Boost topics & subjects different (effectively, subject matches count lower than topic matches)
        # 4. Each new matched item has progressively lower impact -- MATCH_DECAY_FACTORS[item_type]
        if (item_type == :topic)
          num_subjects = all_matches.reject { |x| x.class != Subject }.length
          mbf = match_boost_factor(:subject, num_subjects) + match_boost_factor(:topic, num_matches - num_subjects)
        else
          mbf = match_boost_factor(item_type, num_matches)
        end
        scores[sid] ||= s.activity_score
        scores[sid] *= (1+mbf)
      }
    end
  end

  MYNEWS_DROPDOWN_SETTINGS_FIELDS = [
    [:stories_per_page, "Number of Stories"],
    [:max_story_age, "Story Date"],
    [:story_status, "Story Status"],
#    [:story_type, "Story Type"],
    [:source_status, "Source Status"],
#    [:max_stories_per_source, "Stories per Source"],
    [:media_type, "Source Medium"],
#    [:source_ownership, "Source Ownership"],
    [:min_matching_criteria, "Number of Matches"]
  ]

  MYNEWS_CHECKBOX_SETTINGS_FIELDS = [
    [:hide_reviewed_stories, "Hide stories I've reviewed"],
    [:hide_read_stories, "Hide stories I've read"],
#    [:mynews_homepage, "Make this my homepage"]
  ]

  def self.mynews_special_subjects
    @@mynews_special_subjects ||= Subject.site_subjects(nil, :conditions => {:slug => ["world","us","politics","business","scitech"]}, :order => "topics.id")
  end

  def config_mynews(member, my_page)
    @subject_list     = MynewsListing.mynews_special_subjects
    @followed_items   = followed_items_hash(member)
    @no_follows_yet   = @followed_items[:empty]
    settings          = mynews_settings(member, my_page)
    settings[:stories_per_page] = 25 if request.url =~ /.xml$/ # For RSS feeds, fetch 25 stories no matter what the settings are
    @mynews_opts      = OpenStruct.new(settings)
    res               = mynews_stories(params, @member, @followed_items, settings)
    @stories          = res[:stories]
    @scores           = res[:scores]
    @story_matches    = res[:matches]
  end

  def mynews_listing(member, settings_override = {})
    settings = mynews_settings(member)
    settings.merge!(settings_override)
    mynews_stories({}, member, followed_items_hash(member), settings)
  end
end


text:
namespace Dyoub.App.Data
{
    using System.Data.Entity.Migrations;

    public partial class CreatePurchasePayment : DbMigration
    {
        public override void Up()
        {
            CreateTable("PurchasePayment", t => new
            {
                Id = t.Int(nullable: false, identity: true),
                TenantId = t.Int(nullable: false),
                PurchaseOrderId = t.Int(nullable: false),
                NumberOfInstallments = t.Int(nullable: false),
                InstallmentValue = t.Decimal(nullable: false, precision: 8, scale: 2),
                Total = t.Decimal(nullable: false, precision: 10, scale: 2),
                Date = t.DateTime(nullable: false)
            })
            .PrimaryKey(t => new { t.Id, t.TenantId });

            AddForeignKey(
                dependentTable: "PurchasePayment",
                dependentColumn: "TenantId",
                principalTable: "Tenant",
                principalColumn: "Id",
                cascadeDelete: false
            );

            AddForeignKey(
                dependentTable: "PurchasePayment",
                dependentColumns: new string[] { "PurchaseOrderId", "TenantId" },
                principalTable: "PurchaseOrder",
                principalColumns: new string[] { "Id", "TenantId" },
                cascadeDelete: true
            );
        }

        public override void Down()
        {
            DropTable("PurchasePayment");
        }
    }
}


text:
package org.aperte.lp.model;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

/**
 * Models a list of countries for selection in the UI.
 */
@XmlRootElement(name = "countries")
@XmlType(name = "")
public class Countries {

    /**
     * The list of countries.
     */
    private ArrayList<MapEntry> countries;

    /**
     * Constructor.
     */
    public Countries() {
        countries = new ArrayList<MapEntry>();
    }

    /**
     * Retrieves the countries as key-value pairs.
     * Example: for Canada, the key is "ca" and the value is "Canada".
     *
     * @return the countries
     */
    @XmlElement(name = "country")
    public ArrayList<MapEntry> getCountries() {
        return countries;
    }

    /**
     * Retrieves a copy of the countries with keys and values inverted.
     * Example: for Canada, the key is "Canada" and the value is "ca".
     *
     * @return the countries with keys and values inverted
     */
    public ArrayList<MapEntry> getCountriesInverted() {
        ArrayList<MapEntry> inverted = new ArrayList<MapEntry>(countries.size());
        for (MapEntry entry : countries) {
            inverted.add(new MapEntry(entry.value, entry.key));
        }

        return inverted;
    }

    /**
     * Retrieves a copy of the countries as a map.
     * Example: for Canada, the key is "ca" and the value is "Canada".
     *
     * @return the countries as a map
     */
    public Map<String, String> getCountriesAsMap() {
        Map<String, String> map = new HashMap<String, String>(countries.size());
        for (MapEntry entry : countries) {
            map.put(entry.key, entry.value);
        }

        return map;
    }

    /**
     * Sets the countries.
     *
     * @param countries the countries
     */
    public void setCountries(Map<String, String> countries) {
        if (countries == null) {
            this.countries = new ArrayList<MapEntry>();
        }
        else {
            this.countries = new ArrayList<MapEntry>(countries.size());
            for (Entry<String, String> entry : countries.entrySet()) {
                this.countries.add(new MapEntry(entry.getKey(), entry.getValue()));
            }
        }
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((countries == null) ? 0 : countries.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Countries)) {
            return false;
        }
        Countries other = (Countries) obj;
        if (countries == null) {
            if (other.countries != null) {
                return false;
            }
        }
        else if (!countries.equals(other.countries)) {
            return false;
        }
        return true;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="Examples">
  <process id="transactionDependentTaskListenerProcess" isExecutable="true">
    <startEvent id="startevent1" name="Start" />

    <sequenceFlow sourceRef="startevent1" targetRef="usertask1" />

    <userTask id="usertask1" name="User Task 1">
      <extensionElements>
        <activiti:taskListener
                event="complete"
                class="org.flowable.examples.bpmn.tasklistener.CurrentTaskTransactionDependentTaskListener"
                onTransaction="committed"
                customPropertiesResolverClass="org.flowable.examples.bpmn.executionlistener.MyCustomPropertiesResolver"/>
      </extensionElements>
    </userTask>

    <sequenceFlow sourceRef="usertask1" targetRef="endevent1" />

    <endEvent id="endevent1" name="End" />
  </process>
</definitions>


text:
\chapter{Preliminary fits}
\label{chap:cpv:prelim_fits}

The yield extraction technique used to measure the signal yields entering the
computation of \ARaw, shown in \cref{eqn:cpv:introduction:araw}, is described
in \cref{chap:cpv:araw}.
Before then, it is useful to fit to the charge-combined data in order to
perform studies that require background subtraction, selection efficiency
estimates, and the like.
This \lcnamecref{chap:cpv:prelim_fits} describes the binned \chisq\ fit to the
\phh\ invariant mass spectrum that is used for such studies.

\section{Input data and shape parameterisation}
\label{chap:cpv:prelim_fits:data_pdfs}

The data entering the fit depends on the study that the information is needed
for.
For example, the study of the optimal \ac{PID} requirements described in
\cref{chap:cpv:selection:offline} requires a mass fit before the offline
\ac{PID} requirements are applied.
In all cases, the models and general fit procedure are the same.

The mass spectrum of the three-body \phh\ system is used to discriminate
between signal and background.
The following will list the functional forms used in the fit to describe the
these components of the data.
In all cases, the normalisation factors are omitted from the definitions, and
the variable $x$ represents the \PLambdac\ mass.

For both the \pKK\ and \ppipi\ samples, the signal model $f$ is the linear sum
of two normal distributions $G$ sharing a common mean $\mu$ but with different
widths $\sigma_{1}$ and $\sigma_{2}$, defined as
\begin{equation}
  f(x; \mu, w, \alpha) = \alpha{}G(x; \mu, \alpha{w}) +
    (1 - \alpha)G(x; \mu, \frac{w}{\alpha}).
  \label{eqn:cpv:prelim_fits:sig_model}
\end{equation}
The parameter $\alpha$ describes the `relative strength' of each normal
distribution and is bounded in the range $[0, 1]$, and the widths $\sigma_{1}$
  and $\sigma_{2}$ have been parameterised as
\begin{equation}
  \sigma_{1} = \alpha{w},\ \text{and}\ \sigma_{2} = \frac{w}{\alpha}.
  \label{eqn:cpv:prelim_fits:sigma_def}
\end{equation}
This enforces the relation $\sigma_{1} \leq \sigma_{2}$, which is useful to
know when trying to reason about the fitted values of $\alpha$, and was
observed to increase the stability of the fit compared to having free,
independent widths $\sigma_{1}$ and $\sigma_{2}$.
For both modes, the background model $g$ is a first-order polynomial with
coefficient $a_{0}$
\begin{equation}
  g(x) = 1 + a_{0}x.
  \label{eqn:cpv:prelim_fits:bkg_model}
\end{equation}
The signal and background models are combined as a linear sum to form a total
function $h$, where each component is weighted by their respective yields
\nsig\ and \nbkg.
The \chisq\ fit is performed on the data in the range
\begin{equation}
  2230 < m(\PLambdac) < \SI{2350}{\GeVcc},
\end{equation}
with bins of width \SI{1}{\MeVcc}.

Once a fit has converged and the associated covariance matrix is
positive-definite, sWeights~\cite{Pivk:2004ty} are computed and are attached to
each candidate.
This allows for the statistical subtraction of either the signal or the
background component in bins of some variable that is not correlated with the
\PLambdac\ mass.

Fits to the fully selected 2012 magnet down dataset for the \pKK\ and \ppipi\
modes are given in \cref{fig:cpv:prelim_fits:full}.
A good description of the data is seen, and this is representative of the fit
quality in all data sub-samples.
Tables of signal and background yields measured in the preliminary fit are
given for each fully selected subset of the data for \pKK\ in
\cref{tab:cpv:prelim_fits:yields:pKK} and for \ppipi\ in
\cref{tab:cpv:prelim_fits:yields:ppipi}.
Also given are the number of signal candidates per unit of integrated
luminosity $\nsig/\intlumi$.

\section{Validation}
\label{chap:cpv:prelim_fits:validation}

To evaluate the bias of the fitter and reliability of the uncertainties,
pseudo-experiments are performed by generating \ac{MC} data from the fitted
\ac{PDF}.
One thousand pseudo-experiments are run for each mode and for each data
sub-sample.
The parameter values of the generating \acp{PDF}, from which data points are
drawn, are the same as those found in the fits to the fully selected data,
except for the values of yield parameters.
Each yield parameter value for each pseudo-experiment is drawn from a Poisson
distribution whose mean is set to the value of the yield found in the fits to
the data~\cite{Karbach:2012vg}.

For each pseudo-experiment, the fitted parameter value and the uncertainty on
that fit are recorded, and a pull value $p$ is computed as the difference
between the fitted value $v'$ and the true generating value $v$, divided by the
parameter value uncertainty $\unc{v}$
\begin{equation}
  p = \frac{v - v'}{\unc{v}}.
\end{equation}
The true value for each yield parameter is taken to be the mean value of the
Poisson distribution from which the generating value is drawn.
An unbiased fitter with correct uncertainty coverage should have a distribution
of pull values drawn from a unit Gaussian.

The results of the pseudo-experiments are shown in
\cref{fig:cpv:prelim_fits:validation:pKK} and
\cref{fig:cpv:prelim_fits:validation:ppipi} for the 2012 magnet down \pKK\ and
\ppipi\ data.
It is seen that the signal yield parameter is unbiased.

\begin{figure}
  \begin{subfigure}[b]{0.5\textwidth}
    \includegraphics[width=\textwidth]{cpv/preliminary_fits/fits-unweighted_no-simultaneous/LcTopKK_2012_MagDown_fit.pdf}
    \caption{\pKK}
    \label{fig:cpv:prelim_fits:full:pKK}
  \end{subfigure}
  \begin{subfigure}[b]{0.5\textwidth}
    \includegraphics[width=\textwidth]{cpv/preliminary_fits/fits-unweighted_no-simultaneous/LcToppipi_2012_MagDown_fit.pdf}
    \caption{\ppipi}
    \label{fig:cpv:prelim_fits:full:ppipi}
  \end{subfigure}
  \caption{%
    Fits to the \PLambdac\ mass spectrum in the 2012 magnet down dataset for
    \pKK~(\subref*{fig:cpv:prelim_fits:full:pKK}) and
    \ppipi~(\subref*{fig:cpv:prelim_fits:full:ppipi}).
    The full offline selection is applied.
    The solid blue line is the total fit to the data in black points, and the
    dotted red and dashed blue lines are the background and signal components,
    respectively.
    Below each fit is a pull plot, showing the difference between the total fit
    model and the data in each bin, normalised by the Poisson uncertainty on
    the number of entries in that bin.
  }
  \label{fig:cpv:prelim_fits:full}
\end{figure}

\begin{table}
  \centering
  \caption{%
    Signal and background yields measured in the preliminary fit for each fully
    selected subset of the \pKK\ data.
  }
  \label{tab:cpv:prelim_fits:yields:pKK}
  \input{tables/cpv/preliminary_fits/LcTopKK_yields}
\end{table}

\begin{table}
  \centering
  \caption{%
    Signal and background yields measured in the preliminary fit for each fully
    selected subset of the \ppipi\ data.
  }
  \label{tab:cpv:prelim_fits:yields:ppipi}
  \input{tables/cpv/preliminary_fits/LcToppipi_yields}
\end{table}

\begin{figure}
  \includegraphics[width=\textwidth]{cpv/preliminary_fits/fits-unweighted_no-simultaneous/LcTopKK_2012_MagDown_pulls.pdf}
  \caption{%
    Validation of the fits to the \PLambdac\ mass spectrum in the
    charge-combined 2012 magnet down \pKK\ dataset.
    Each plot shows the distribution of the pull values for a single fit
    parameter, indicated in the legend, along with a fit of a Gaussian
    distribution with mean $\mu$ and width $\sigma$.
  }
  \label{fig:cpv:prelim_fits:validation:pKK}
\end{figure}

\begin{figure}
  \includegraphics[width=\textwidth]{cpv/preliminary_fits/fits-unweighted_no-simultaneous/LcToppipi_2012_MagDown_pulls.pdf}
  \caption{%
    Validation of the fits to the \PLambdac\ mass spectrum in the
    charge-combined 2012 magnet down \ppipi\ dataset.
    Each plot shows the distribution of the pull values for a single fit
    parameter, indicated in the legend, along with a fit of a Gaussian
    distribution with mean $\mu$ and width $\sigma$.
  }
  \label{fig:cpv:prelim_fits:validation:ppipi}
\end{figure}


text:
/**
 */
package gluemodel.CIM.IEC61970.LoadModel;

import org.eclipse.emf.common.util.EList;

/**
 *
 * A representation of the model object 'Sub Load Area'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link gluemodel.CIM.IEC61970.LoadModel.SubLoadArea#getLoadArea Load Area}

 *
{@link gluemodel.CIM.IEC61970.LoadModel.SubLoadArea#getLoadGroups Load Groups}

 *

 *
 * @see gluemodel.CIM.IEC61970.LoadModel.LoadModelPackage#getSubLoadArea()
 * @model annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='The class is the second level in a hierarchical structure for grouping of loads for the purpose of load flow load scaling.'"
 *        annotation="http://langdale.com.au/2005/UML Profile\040documentation='The class is the second level in a hierarchical structure for grouping of loads for the purpose of load flow load scaling.'"
 *        annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='The class is the second level in a hierarchical structure for grouping of loads for the purpose of load flow load scaling.' Profile\040documentation='The class is the second level in a hierarchical structure for grouping of loads for the purpose of load flow load scaling.'"
 * @generated
 */
public interface SubLoadArea extends EnergyArea {
	/**
	 * Returns the value of the 'Load Area' reference.
	 * It is bidirectional and its opposite is '{@link gluemodel.CIM.IEC61970.LoadModel.LoadArea#getSubLoadAreas Sub Load Areas}'.
	 *
	 *

	 * If the meaning of the 'Load Area' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Load Area' reference.
	 * @see #setLoadArea(LoadArea)
	 * @see gluemodel.CIM.IEC61970.LoadModel.LoadModelPackage#getSubLoadArea_LoadArea()
	 * @see gluemodel.CIM.IEC61970.LoadModel.LoadArea#getSubLoadAreas
	 * @model opposite="SubLoadAreas"
	 *        annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='The LoadArea where the SubLoadArea belongs.'"
	 *        annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='The LoadArea where the SubLoadArea belongs.'"
	 * @generated
	 */
	LoadArea getLoadArea();

	/**
	 * Sets the value of the '{@link gluemodel.CIM.IEC61970.LoadModel.SubLoadArea#getLoadArea Load Area}' reference.
	 *
	 *
	 * @param value the new value of the 'Load Area' reference.
	 * @see #getLoadArea()
	 * @generated
	 */
	void setLoadArea(LoadArea value);

	/**
	 * Returns the value of the 'Load Groups' reference list.
	 * The list contents are of type {@link gluemodel.CIM.IEC61970.LoadModel.LoadGroup}.
	 * It is bidirectional and its opposite is '{@link gluemodel.CIM.IEC61970.LoadModel.LoadGroup#getSubLoadArea Sub Load Area}'.
	 *
	 *

	 * If the meaning of the 'Load Groups' reference list isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Load Groups' reference list.
	 * @see gluemodel.CIM.IEC61970.LoadModel.LoadModelPackage#getSubLoadArea_LoadGroups()
	 * @see gluemodel.CIM.IEC61970.LoadModel.LoadGroup#getSubLoadArea
	 * @model opposite="SubLoadArea"
	 *        annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='The Loadgroups in the SubLoadArea.'"
	 *        annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='The Loadgroups in the SubLoadArea.'"
	 * @generated
	 */
	EList<LoadGroup> getLoadGroups();

} // SubLoadArea


text:
div.Component { border:1px dashed #CCC; padding:5px; margin:1px;width:615px; height:20px; background-color:#FFF; }
div.Component.Selected { background-color:#EEE; }
div.Component.PlaceHolder { background-color:#FDFEDE; }
div.Component.HD1 { background-color:#FFF; }
div.Component.HD1 div.ComponentDisplayName { background-color:#FFF; font-weight:bold; padding-left:24px; font-size:15px; }

div.Component.HD2 { background-color:#FFF; }
div.Component.HD2 div.ComponentDisplayName { background-color:#FFF; font-weight:bold; padding-left:24px; font-size:13px; }

div.Component.ASEV div.ComponentDisplayName { background-image:url(../_images/Icons/user_comment.png); }
div.Component.ASPR div.ComponentDisplayName { background-image:url(../_images/Icons/application_side_contract.png); }
div.Component.ASPO div.ComponentDisplayName { background-image:url(../_images/Icons/application_side_expand.png); }
div.Component.TX div.ComponentDisplayName { background-image:url(../_images/Icons/font.png); }
div.Component.FD div.ComponentDisplayName { background-image:url(../_images/Icons/disk.png); }
div.Component.FV div.ComponentDisplayName { background-image:url(../_images/Icons/page.png); }
div.Component.ST div.ComponentDisplayName { background-image:url(../_images/Icons/shield.png); }
div.Component.EC div.ComponentDisplayName { background-image:url(../_images/Icons/world_link.png); }
div.Component.VID div.ComponentDisplayName { background-image:url(../_images/Icons/television.png); }
div.Component.AUD div.ComponentDisplayName { background-image:url(../_images/Icons/sound.png); }
div.Component.TA div.ComponentDisplayName { background-image:url(../_images/Icons/key.png); }
div.Component.PAY div.ComponentDisplayName { background-image:url(../_images/Icons/creditcards.png);  }
div.Component.HD1 div.ComponentDisplayName { background-image:url(../_images/Icons/text_heading_1.png);  }
div.Component.HD2 div.ComponentDisplayName { background-image:url(../_images/Icons/text_heading_2.png);  }
div.Component.HD3 div.ComponentDisplayName { background-image:url(../_images/Icons/text_heading_3.png);  }

div.ComponentHandle { width:18px; margin-right:3px; margin-top:2px;float:left; }
div.ComponentDisplayName { float:left; margin-top:3px; background-repeat:no-repeat; background-position:3px; padding-left:24px; width:350px; }
div.ComponentOptions { float:left; margin-top:3px; margin-left:4px; }
div.ComponentInfo { width:400px; float:left; font-size:10px; }

div.ComponentItem { margin:3px;float:left; width:130px; padding:0px 0px 0px 30px; background-position:8px; background-repeat:no-repeat; }
div.ComponentItem a { text-decoration:none; display:block; }
div.ComponentItem a:hover { text-decoration:underline; }
div.ComponentDesc { font-size:10px; color:#555; padding-left:24px; display:none; }
div.ComponentItem.ASEV { background-image:url(../_images/Icons/user_comment.png); }
div.ComponentItem.ASPR { background-image:url(../_images/Icons/application_side_contract.png); }
div.ComponentItem.ASPO { background-image:url(../_images/Icons/application_side_expand.png); }
div.ComponentItem.TX { background-image:url(../_images/Icons/font.png); }
div.ComponentItem.FD { background-image:url(../_images/Icons/disk.png); }
div.ComponentItem.FV { background-image:url(../_images/Icons/page.png); }
div.ComponentItem.ST { background-image:url(../_images/Icons/shield.png); }
div.ComponentItem.EC { background-image:url(../_images/Icons/world_link.png); }
div.ComponentItem.VID { background-image:url(../_images/Icons/television.png); }
div.ComponentItem.AUD { background-image:url(../_images/Icons/sound.png); }
div.ComponentItem.TA { background-image:url(../_images/Icons/key.png); }
div.ComponentItem.PAY { background-image:url(../_images/Icons/creditcards.png);  }
div.ComponentItem.HD1 { background-image:url(../_images/Icons/text_heading_1.png);  }
div.ComponentItem.HD2 { background-image:url(../_images/Icons/text_heading_2.png);  }
div.ComponentItem.HD3 { background-image:url(../_images/Icons/text_heading_3.png);  }


text:
// Generated from /POI/java/org/apache/poi/poifs/storage/BlockWritable.java

#pragma once

#include <java/io/fwd-POI.hpp>
#include <org/apache/poi/poifs/storage/fwd-POI.hpp>
#include <java/lang/Object.hpp>

struct poi::poifs::storage::BlockWritable
    : public virtual ::java::lang::Object
{
    virtual void writeBlocks(::java::io::OutputStream* stream) /* throws(IOException) */ = 0;

    // Generated
    static ::java::lang::Class *class_();
};


text:
hand
====

Renders a range of cards fanned out as if in a hand. Saves as PNG regardless of back end.

Options
-------

radius
  default: ``:auto``

  The distance from the bottom of each card to the center of the fan. If set to ``:auto``, then it is computed as 30% of the card's height. Why 30%? Because it looks good that way. Reasons.

angle_range
  default: ``((Math::PI / -4.0)..(Math::PI / 2))``

  The overall width of the fan, in radians. Angle of zero is a vertical card. Further negative angles widen the fan counter-clockwise and positive angles widen the fan clockwise.

margin
  default: ``75``

  the margin around the entire image. Supports :doc:`/units`.

fill_color
  default: ``:white``

  Backdrop color. See :doc:`/colors`.

.. include:: /args/trim.rst

file
  default: ``'hand.png'``

  The file to save relative to the current directory. Will overwrite without warning.

.. include:: /args/output_dir.rst
.. include:: /args/range.rst

Examples
--------


text:
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *button=[[UIButton alloc]init];
    [button setTitle:@"点击一下" forState:UIControlStateNormal];
    button.translatesAutoresizingMaskIntoConstraints = NO;
    [button setBackgroundColor:[UIColor blackColor]];
    [self.view addSubview:button];

    NSArray *constraints1 = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[button]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button)];
    NSArray *constraints2 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-20-[button(==30)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button)];
    [self.view addConstraints:constraints1];
    [self.view addConstraints:constraints2];

    UIButton *button1=[[UIButton alloc]init];
    button1.translatesAutoresizingMaskIntoConstraints=NO;
    [button1 setTitle:@"请不要点击我" forState:UIControlStateNormal];
    [button1 setBackgroundColor:[UIColor redColor]];
    [self.view addSubview:button1];
    //---------------------------------------------------------------------
    //button1距离父视图的水平方向的距离是20
    //NSArray *constraints3 = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[button1]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button1)];
    //button1距离button的Y坐标是8.高度是30
    //NSArray *constraints4 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button]-[button1(==30)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button,button1)];
    //NSArray *constraints4 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button]-[button1(==height)]" options:0 metrics:@{@"height":@30} views:NSDictionaryOfVariableBindings(button,button1)];
    //---------------------------------------------------------------------
    //水平方向button1和button一样的宽度
    NSArray *constraints3 = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[button1(button)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button,button1)];
    //button1距离button的Y坐标是8.且高度和button1一样
    //NSArray *constraints4 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button]-[button1(button)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button,button1)];
    //指定同级的button和button1之间的竖直方向的距离50.并且高度相同
    NSArray *constraints5 = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[button]-50-[button1(button)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(button,button1)];
    [self.view addConstraints:constraints3];
    //[self.view addConstraints:constraints4];
    [self.view addConstraints:constraints5];

}

@end


text:
#ifndef CYL_CUTTER_H
#define CYL_CUTTER_H

#include <iostream>
#include <string>
#include <vector>

#include "millingcutter.hpp"
#include "bullcutter.hpp"

namespace ocl
{

///
/// \brief Cylindrical MillingCutter (flat-endmill)
///
/// defined by one parameter, the cutter diameter
class CylCutter : public MillingCutter {
    public:
        CylCutter();
        /// create CylCutter with diameter d and length l
        explicit CylCutter(double d, double l);
        /// offset of Cylinder is BullCutter
        MillingCutter* offsetCutter(double d) const {return new BullCutter(diameter+2*d, d, length+d);}
        /// string repr
        friend std::ostream& operator<<(std::ostream &stream, CylCutter c);
        std::string str() const;
    protected:
        bool vertexPush(const Fiber& f, Interval& i, const Triangle& t) const;
        CC_CLZ_Pair singleEdgeDropCanonical(const Point& u1, const Point& u2) const;
        double height(double r) const {return ( r <= radius ) ? 0.0 : -1.0;}
        double width(double h) const {return radius;}
};

} // end namespace
#endif


text:
package org.apache.camel.component.http;

import java.net.ConnectException;
import java.util.concurrent.TimeUnit;

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.handler.BasicValidationHandler;
import org.apache.http.impl.bootstrap.HttpServer;
import org.apache.http.impl.bootstrap.ServerBootstrap;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class HttpNoConnectionRedeliveryTest extends BaseHttpTest {

    private HttpServer localServer;

    @Before
    @Override
    public void setUp() throws Exception {
        localServer = ServerBootstrap.bootstrap().
                setHttpProcessor(getBasicHttpProcessor()).
                setConnectionReuseStrategy(getConnectionReuseStrategy()).
                setResponseFactory(getHttpResponseFactory()).
                setExpectationVerifier(getHttpExpectationVerifier()).
                setSslContext(getSSLContext()).
                registerHandler("/search", new BasicValidationHandler("GET", null, null, getExpectedContent())).create();
        localServer.start();

        super.setUp();
    }

    @After
    @Override
    public void tearDown() throws Exception {
        super.tearDown();

        if (localServer != null) {
            localServer.stop();
        }
    }

    @Test
    public void httpConnectionOk() throws Exception {
        Exchange exchange = template.request("direct:start", null);

        assertExchange(exchange);
    }

    @Test
    public void httpConnectionNotOk() throws Exception {
        // stop server so there are no connection
        // and wait for it to terminate
        localServer.stop();
        localServer.awaitTermination(5000, TimeUnit.MILLISECONDS);

        Exchange exchange = template.request("direct:start", null);
        assertTrue(exchange.isFailed());

        ConnectException cause = assertIsInstanceOf(ConnectException.class, exchange.getException());
        assertTrue(cause.getMessage().contains("failed"));

        assertEquals(true, exchange.getIn().getHeader(Exchange.REDELIVERED));
        assertEquals(4, exchange.getIn().getHeader(Exchange.REDELIVERY_COUNTER));
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .onException(ConnectException.class)
                        .maximumRedeliveries(4)
                        .backOffMultiplier(2)
                        .redeliveryDelay(100)
                        .maximumRedeliveryDelay(5000)
                        .useExponentialBackOff()
                    .end()
                    .to("http://" + localServer.getInetAddress().getHostName() + ":" + localServer.getLocalPort() + "/search");
            }
        };
    }
}


text:
package com.cthos.pfpt.core.chr;

import com.cthos.pfpt.core.CharacterClass;

public class Rogue extends CharacterClass {
    public Rogue() {
        babProgression = "medium";
        hitDie = 8;
        badSaves.add("fort");
        badSaves.add("will");
        skillsPerLevel = 8;
    }

    public String toString() {
        return "rogue";
    }
}


text:
import React from 'react';
import { FormikFormField, TextInput } from 'core/presentation';
import { INotificationTypeCustomConfig } from 'core/domain';

export class MicrosoftTeamsNotificationType extends React.Component<INotificationTypeCustomConfig> {
  public render() {
    const { fieldName } = this.props;
    return (
      <FormikFormField
        label="Teams Webhook URL"
        name={fieldName ? `${fieldName}.address` : 'address'}
        input={(props) => (
          <TextInput
            inputClassName={'form-control input-sm'}
            {...props}
            placeholder="URL starts with https://outlook.office.com/webhook/"
          />
        )}
        required={true}
      />
    );
  }
}


text:
'use strict';

module.exports = PcapStream;

var pcap = require('pcap-parser');
var Readable = require('stream').Readable;
if (!Readable) {
  Readable = require('readable-stream');
}
var util = require('util');

util.inherits(PcapStream, Readable);

function PcapStream(source, opts) {
  var self = (this instanceof PcapStream)
           ? this
           : Object.create(PcapStream.prototype);

  opts = opts || {};

  if (opts.objectMode === false) {
    throw new Error('PcapStream requires stream objectMode; do not set ' +
                    'option {objectMode: false}');
  }
  opts.objectMode = true;

  Readable.call(self, opts);

  self._parser = pcap.parse(source);
  self._parser.on('packet', self._onPacket.bind(self));
  self._parser.on('end', self.push.bind(self, null));
  self._parser.on('error', self.emit.bind(self, 'error'));

  return self;
}

PcapStream.prototype._read = function(size, callback) {
  this._parser.stream.resume();
};

PcapStream.prototype._onPacket = function(packet) {
  var res = this.push( { pcap: packet.header, data: packet.data } );
  if (!res) {
    this._parser.stream.pause();
  }
};


text:
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AppTonic.Examples.Shared.Domain;

namespace AppTonic.Examples.Shared.Data
{
    public class InMemoryUserRepository : IUserRepository
    {
        private readonly List<User> _users = new List<User>();
        public void Add(User user)
        {
            _users.Add(user);
        }

        public void Save()
        {
            // not implemented
        }

        public User GetFirst()
        {
            // Example method only, not example
            return _users.FirstOrDefault();
        }

        public Task<User> GetFirstAsync()
        {
            // Not how you would implement async at all!
            return Task.FromResult(_users.FirstOrDefault());
        }

        public void Dispose()
        {
        }
    }
}