text:
static NSString *const WEDebuggerToolbarStepItemIdentifier = @"WEDebuggerToolbarStepItemIdentifier";
static NSString *const WEDebuggerToolbarStepOutItemIdentifier = @"WEDebuggerToolbarStepOutItemIdentifier";
static NSString *const WEDebuggerToolbarStepOverItemIdentifier = @"WEDebuggerToolbarStepOverItemIdentifier";

static NSString *const WEDebuggerWindowToolbarItemIdentifier = @"WEDebuggerWindowToolbarItemIdentifier";

@interface WEDebuggerWindowController ()

@end

@implementation WEDebuggerWindowController
#pragma mark *** Subclass Overrides ***
- (void)dealloc {
#ifdef DEBUG
	NSLog(@"%@ called in %@",NSStringFromSelector(_cmd),[self className]);
#endif
	[_stackViewController release];
	[_memoryViewController release];
	[_displayViewController release];
	[_interruptsViewController release];
	[_memoryMapViewController release];
	[_CPUViewController release];
	[_flagsViewController release];
	[_registersViewController release];
	[_inspectorViewContainer release];
	[_disassemblyViewController release];
	[super dealloc];
}

- (id)init {
	if (!(self = [super initWithWindowNibName:[self windowNibName]]))
		return nil;

	return self;
}

- (NSString *)windowNibName {
	return @"WEDebuggerWindow";
}

- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName {
	return [NSString stringWithFormat:NSLocalizedString(@"%@ - Debugger", @"debugger window title format string"),displayName];
}

- (void)windowDidLoad {
	[super windowDidLoad];

	// toolbar
	NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier:WEDebuggerWindowToolbarItemIdentifier] autorelease];

	[toolbar setAllowsUserCustomization:YES];
	[toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
	[toolbar setSizeMode:NSToolbarSizeModeRegular];
	[toolbar setDelegate:self];

#ifndef DEBUG
	[toolbar setAutosavesConfiguration:YES];
#endif

	[[self window] setToolbar:toolbar];

	// disassembly view
	[[[self disassemblyViewController] view] setFrameSize:[[self disassemblyDummyView] frame].size];
	[[[self disassemblyDummyView] superview] replaceSubview:[self disassemblyDummyView] with:[[self disassemblyViewController] view]];

	// memory view
	[[[self memoryViewController] view] setFrameSize:[[self memoryDummyView] frame].size];
	[[[self memoryDummyView] superview] replaceSubview:[self memoryDummyView] with:[[self memoryViewController] view]];

	// stack view
	[[[self stackViewController] view] setFrameSize:[[self stackDummyView] frame].size];
	[[[self stackDummyView] superview] replaceSubview:[self stackDummyView] with:[[self stackViewController] view]];

	// inspector view
	[[self inspectorScrollView] setAutoresizesSubviews:YES];
	[[self inspectorScrollView] setDocumentView:[self inspectorViewContainer]];

	[[self inspectorViewContainer] addInspectorView:(JUInspectorView *)[[self registersViewController] view] expanded:YES];
	[[self inspectorViewContainer] addInspectorView:(JUInspectorView *)[[self flagsViewController] view] expanded:YES];
	[[self inspectorViewContainer] addInspectorView:(JUInspectorView *)[[self CPUViewController] view] expanded:NO];
	[[self inspectorViewContainer] addInspectorView:(JUInspectorView *)[[self memoryMapViewController] view] expanded:NO];
	[[self inspectorViewContainer] addInspectorView:(JUInspectorView *)[[self interruptsViewController] view] expanded:NO];
	[[self inspectorViewContainer] addInspectorView:(JUInspectorView *)[[self displayViewController] view] expanded:NO];
}
#pragma mark NSToolbarDelegate
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar {
	return [NSArray arrayWithObjects:WEDebuggerToolbarStepItemIdentifier,WEDebuggerToolbarStepOutItemIdentifier,WEDebuggerToolbarStepOverItemIdentifier,NSToolbarSpaceItemIdentifier,NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar {
	return [NSArray arrayWithObjects:NSToolbarFlexibleSpaceItemIdentifier,WEDebuggerToolbarStepItemIdentifier,WEDebuggerToolbarStepOutItemIdentifier,WEDebuggerToolbarStepOverItemIdentifier,NSToolbarFlexibleSpaceItemIdentifier, nil];
}
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag {
	NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease];

	if ([itemIdentifier isEqualToString:WEDebuggerToolbarStepItemIdentifier]) {
		[item setLabel:NSLocalizedString(@"Step", @"Step")];
		[item setPaletteLabel:[item label]];
		[item setImage:[NSImage imageNamed:@"Step"]];
		[item setAction:@selector(step:)];
	}
	else if ([itemIdentifier isEqualToString:WEDebuggerToolbarStepOutItemIdentifier]) {
		[item setLabel:NSLocalizedString(@"Step Out", @"Step Out")];
		[item setPaletteLabel:[item label]];
		[item setImage:[NSImage imageNamed:@"Step Out"]];
		[item setAction:@selector(stepOut:)];
	}
	else if ([itemIdentifier isEqualToString:WEDebuggerToolbarStepOverItemIdentifier]) {
		[item setLabel:NSLocalizedString(@"Step Over", @"Step Over")];
		[item setPaletteLabel:[item label]];
		[item setImage:[NSImage imageNamed:@"Step Over"]];
		[item setAction:@selector(stepOver:)];
	}

	return item;
}

#pragma mark NSSplitViewDelegate
- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)view {
	if ([splitView isVertical] && [[splitView subviews] lastObject] == view)
		return NO;
	else if (![splitView isVertical] && [[splitView subviews] objectAtIndex:0] == view)
		return NO;
	return YES;
}

static CGFloat kLeftSubviewMinimumWidth = 350.0;
static CGFloat kRightSubviewMinimumWidth = 200.0;
static CGFloat kTopSubviewMinimumWidth = 200.0;
static CGFloat kBottomSubviewMinimumWidth = 125.0;

- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(NSInteger)dividerIndex {
	if ([splitView isVertical])
		return proposedMaximumPosition-kRightSubviewMinimumWidth;
	return proposedMaximumPosition-kBottomSubviewMinimumWidth;
}

- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex {
	if ([splitView isVertical])
		return proposedMinimumPosition+kLeftSubviewMinimumWidth;
	return proposedMinimumPosition+kTopSubviewMinimumWidth;
}

- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex {
	if ([splitView isVertical])
		return [splitView convertRect:[[self inspectorSplitterHandleImageView] bounds] fromView:[self inspectorSplitterHandleImageView]];
	return NSZeroRect;
}

- (CGFloat)splitView:(NSSplitView *)splitView constrainSplitPosition:(CGFloat)proposedPosition ofSubviewAt:(NSInteger)dividerIndex {
	if ([self memoryAndStackSplitView] == splitView)
		return NSWidth([splitView bounds])-100.0;
	return proposedPosition;
}

#pragma mark NSWindowDelegate
- (void)windowWillClose:(NSNotification *)notification {
	[[[self calculatorDocument] calculator] setDebugging:NO];
	[[[self calculatorDocument] calculator] setRunning:YES];
}
#pragma mark *** Public Methods ***

#pragma mark IBActions
- (IBAction)step:(id)sender; {
	[[[self calculatorDocument] calculator] step];
}
- (IBAction)stepOver:(id)sender; {
	[[[self calculatorDocument] calculator] stepOver];
}
- (IBAction)stepOut:(id)sender; {
	[[[self calculatorDocument] calculator] stepOut];
}

- (IBAction)toggleNormalBreakpoint:(id)sender; {
	NSIndexSet *selectedIndexes = [[[self disassemblyViewController] tableView] selectedRowIndexes];
	NSTableColumn *tableColumn = [[[[self disassemblyViewController] tableView] tableColumns] objectAtIndex:[[[self disassemblyViewController] tableView] columnWithIdentifier:@"address"]];

	[selectedIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
		uint16_t address = [[[self disassemblyViewController] tableView:[[self disassemblyViewController] tableView] objectValueForTableColumn:tableColumn row:idx] unsignedShortValue];

		[[[self calculatorDocument] calculator] toggleBreakpointOfType:RSBreakpointTypeNormal atAddress:address];
	}];

	[[[self disassemblyViewController] tableView] setNeedsDisplay:YES];
}

#pragma mark Properties
@synthesize disassemblyDummyView=_disassemblyDummyView;
@synthesize inspectorScrollView=_inspectorScrollView;
@synthesize inspectorSplitterHandleImageView=_inspectorSplitterHandleImageView;
@synthesize memoryDummyView=_memoryDummyView;
@synthesize stackDummyView=_stackDummyView;
@synthesize memoryAndStackSplitView=_memoryAndStackSplitView;

@dynamic calculatorDocument;
- (WECalculatorDocument *)calculatorDocument {
	return (WECalculatorDocument *)[self document];
}
@dynamic inspectorViewContainer;
- (JUInspectorViewContainer *)inspectorViewContainer {
	if (!_inspectorViewContainer) {
		_inspectorViewContainer = [[JUInspectorViewContainer alloc] initWithFrame:NSMakeRect(0.0, 0.0, 100.0, 100.0)];
		[_inspectorViewContainer setAutoresizingMask:NSViewWidthSizable];
	}
	return _inspectorViewContainer;
}
@dynamic disassemblyViewController;
- (RSDisassemblyViewController *)disassemblyViewController {
	if (!_disassemblyViewController)
		_disassemblyViewController = [[RSDisassemblyViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _disassemblyViewController;
}
@dynamic registersViewController;
- (RSRegistersViewController *)registersViewController {
	if (!_registersViewController)
		_registersViewController = [[RSRegistersViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _registersViewController;
}
@dynamic flagsViewController;
- (RSFlagsViewController *)flagsViewController {
	if (!_flagsViewController)
		_flagsViewController = [[RSFlagsViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _flagsViewController;
}
@dynamic CPUViewController;
- (RSCPUViewController *)CPUViewController {
	if (!_CPUViewController)
		_CPUViewController = [[RSCPUViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _CPUViewController;
}
@dynamic memoryMapViewController;
- (RSMemoryMapViewController *)memoryMapViewController {
	if (!_memoryMapViewController)
		_memoryMapViewController = [[RSMemoryMapViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _memoryMapViewController;
}
@dynamic interruptsViewController;
- (RSInterruptsViewController *)interruptsViewController {
	if (!_interruptsViewController)
		_interruptsViewController = [[RSInterruptsViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _interruptsViewController;
}
@dynamic displayViewController;
- (RSDisplayViewController *)displayViewController {
	if (!_displayViewController)
		_displayViewController = [[RSDisplayViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _displayViewController;
}
@dynamic memoryViewController;
- (RSMemoryViewController *)memoryViewController {
	if (!_memoryViewController)
		_memoryViewController = [[RSMemoryViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _memoryViewController;
}
@dynamic stackViewController;
- (RSStackViewController *)stackViewController {
	if (!_stackViewController)
		_stackViewController = [[RSStackViewController alloc] initWithCalculator:[[self calculatorDocument] calculator]];
	return _stackViewController;
}

@end


text:
<?php

require_once '../bys-client.php';
require_once('./config.php');

session_start();

$client = new BysClient();

/*
 * GET TOKEN OF SESSION
 *
 * This part must be placed by set "redirect URL".
 */

// First determine if session CODE is set and is not NULL.
if (isset($_GET['code'])) {
    // Call method "getTokens" with code what parameter. It's return tokens and expire time.
    $tokens = $client->getTokens($_GET['code']);

    // Control if Status Code did ok.
    try {
        if ($tokens['status'] != 200) {
            throw new Exception('Status Code is not 200.');
        } {
            // Shown obtained values.
            echo 'access token: ';
            echo $tokens['access_token'];
            echo '
 expires in: ';
            echo $tokens['expires_in'];
            echo '
refresh token: ';
            echo $tokens['refresh_token'];
        }
    }
    catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
    }
}

// If session CODE is not set.
else {

    /**
     * CREATE AUTH URL
     */

    // Set values
    $scope         = "logged_iframes+profile+manage_reservations";
    $state         = "code";
    $access_type   = "offline";
    $response_type = "code";
    $provider_id   = null;
    $as_json       = "false";

    // Call method "createAuthUrl" which return authentificate URL
    $redirect_uri = $client->createAuthUrl($scope, $state, $access_type, $response_type, $provider_id, $as_json);

    // Create link with Auth URL
    print "Connect Me!";
}

?>

redpajama_set_name: RedPajamaGithub


text:
#ifndef TUDAT_COORDINATE_CONVERSIONS_H
#define TUDAT_COORDINATE_CONVERSIONS_H

#include <Eigen/Core>

namespace tudat
{
namespace basic_mathematics
{
namespace coordinate_conversions
{

//! Cylindrical coordinate indices.
/*!
 * Cylindrical coordinate vector indices, for position and velocity components.
 */
enum CylindricalCoordinateIndices
{
    rCylindricalCoordinateIndex,
    thetaCylindricalCoordinateIndex,
    zCylindricalCoordinateIndex,
    rDotCylindricalCoordinateIndex,
    thetaDotCylindricalCoordinateIndex,
    zDotCylindricalCoordinateIndex
};

//! Cartesian coordinate indices.
/*!
 * Cartesian coordinate vector indices, for position and velocity components.
 */
enum CartesianCoordinateIndices
{
    xCartesianCoordinateIndex,
    yCartesianCoordinateIndex,
    zCartesianCoordinateIndex,
    xDotCartesianCoordinateIndex,
    yDotCartesianCoordinateIndex,
    zDotCartesianCoordinateIndex
};

//! Convert cylindrical to Cartesian coordinates.
/*!
 * Converts cylindrical to Cartesian coordinates. Schematic representation can be found on, e.g.,
 * http://mathworld.wolfram.com/CylindricalCoordinates.html.
 * The transformation equations are the following, with \f$ r \f$ the radius and
 * \f$ \theta \f$ the azimuth angle [rad]:
 * \f{eqnarray*}{
 *      x &=& r\cos \theta \\
 *      y &=& r\sin \theta \\
 *      z &=& z \\
 * \f}
 * \param radius Cylindrical radial coordinate r.
 * \param azimuthAngle Cylindrical azimuthal coordinate \theta [rad].
 * \param z Cylindrical height coordinate z.
 * \return Vector of Cartesian coordinates [x,y,z].
 */
Eigen::Vector3d convertCylindricalToCartesian( const double radius,
                                               const double azimuthAngle, const double z );

//! Convert cylindrical to cartesian coordinates.
/*!
 * Converts cylindrical to cartesian coordinates. Schematic representation can be found on, e.g.,
 * http://mathworld.wolfram.com/CylindricalCoordinates.html.
 * The transformation equations are the following, with \f$ r \f$ the radius and
 * \f$ \theta \f$ the azimuth angle [rad]:
 * \f{eqnarray*}{
 *      x &=& r\cos \theta \\
 *      y &=& r\sin \theta \\
 *      z &=& z \\
 * \f}
 * \param cylindricalCoordinates Vector of cylindrical coordinates [r,theta,z].
 * \return Vector of Cartesian coordinates [x,y,z].
 */
Eigen::Vector3d convertCylindricalToCartesian( const Eigen::Vector3d& cylindricalCoordinates );

//! Convert cylindrical to Cartesian state.
/*!
 * Converts cylindrical to Cartesian state. Schematic representation can be found on, e.g.,
 * http://mathworld.wolfram.com/CylindricalCoordinates.html and
 * http://staffweb.cms.gre.ac.uk/~ct02/research/thesis/node26.html.
 * The transformation equations are the following, with \f$ r \f$ the radius and
 * \f$ \theta \f$ the azimuth angle [rad]:
 * \f{eqnarray*}{
 *      x &=& r\cos \theta \\
 *      y &=& r\sin \theta \\
 *      z &=& z \\
 *      \dot{x} &=& V_r\cos{\theta} - V_{\theta}\sin{theta} \\
 *      \dot{y} &=& V_r\sin{\theta} + V_{\theta}\cos{theta} \\
 *      \dot{z} &=& V_z
 * \f}
 * \param cylindricalState Vector of cylindrical state [r,theta,z,Vr,Vtheta,Vz],
 *           where Vtheta = r*thetadot.
 * \return Vector of Cartesian state [x,y,z,xdot,ydot,zdot].
 */
Eigen::VectorXd convertCylindricalToCartesian( const Eigen::VectorXd& cylindricalState );

//! Convert Cartesian to cylindrical coordinates.
/*!
* Converts Cartesian to cylindrical coordinates. Schematic representation can be found on, e.g.,
* http://mathworld.wolfram.com/CylindricalCoordinates.html.
* The transformation equations are the following, with \f$ r \f$ the radius and
* \f$ \theta \f$ the azimuth angle [rad] [0,2\f$ \pi \f$]:
* \f{eqnarray*}{
*      r &=& \sqrt{x^2+y^2} \\
*      \theta &=& \arctan{\frac{y}{x}} \\
*      z &=& z
* \f}
* \param cartesianCoordinates Vector of Cartesian coordinates [x,y,z].
* \return Vector of cylindrical coordinates [r,theta,z].
*/
Eigen::Vector3d convertCartesianToCylindrical( const Eigen::Vector3d& cartesianCoordinates );

//! Convert Cartesian to cylindrical state.
/*!
* Converts Cartesian to cylindrical state. Schematic representation can be found on, e.g.,
* http://mathworld.wolfram.com/CylindricalCoordinates.html and
* http://staffweb.cms.gre.ac.uk/~ct02/research/thesis/node26.html.
* The transformation equations are the following, with \f$ r \f$  the radius,
* \f$ \theta \f$ the azimuth angle [rad] [0,2\f$\pi\f$] and \f$ V_r \f$, \f$ V_{\theta} \f$ and
* \f$ V_z \f$ the linear cylindrical velocities:
* \f{eqnarray*}{
*      r &=& \sqrt{x^2+y^2} \\
*      \theta &=& \arctan{\frac{y}{x}} \\
*      z &=& z \\
*      V_r = \dot{r} &=& \frac{x\dot{x}+y\dot{y}}{\sqrt{x^2+y^2}} \\
*      V_{\theta} = r\dot{\theta} &=& \frac{x\dot{y}-y\dot{x}}{\sqrt{x^2+y^2}} \\
*      V_z = \dot{z}
* \f}
* \param cartesianState Vector of Cartesian state [x,y,z,xdot,ydot,zdot].
* \return Vector of cylindrical state [r,theta,z,Vr,Vtheta,Vz], where Vtheta = r*thetadot.
*/
Eigen::VectorXd convertCartesianToCylindrical( const Eigen::VectorXd& cartesianState );

//! Convert spherical to Cartesian gradient.
/*!
* This function converts a gradient vector with respect to spherical coordinates to a gradient
* vector with respect to Cartesian coordinates. The partial derivatives are calculated according
* to Vallado [2001] as:
* \f{eqnarray*}{
*   \frac{ \partial U }{ \partial x } & = &
*   \frac{ x }{ \sqrt{ x^2 + y^2 +z^2 } } \frac{ \partial U }{ \partial r }
*   - \frac{ x z }{ ( x^2 + y^2 +z^2 ) \sqrt{ x^2 + y^2 } } \frac{ \partial U }{ \partial \phi }
*   - \frac{ y }{ x^2 + y^2 } \frac{ \partial U }{ \partial \lambda } \\
*   \frac{ \partial U }{ \partial y } & = &
*   \frac{ y }{ \sqrt{ x^2 + y^2 +z^2 } } \frac{ \partial U }{ \partial r }
*   - \frac{ y z }{ ( x^2 + y^2 +z^2 ) \sqrt{ x^2 + y^2 } } \frac{ \partial U }{ \partial \phi }
*   + \frac{ x }{ x^2 + y^2 } \frac{ \partial U }{ \partial \lambda } \\
*   \frac{ \partial U }{ \partial z } & = &
*   \frac{ z }{ \sqrt{ x^2 + y^2 +z^2 } } \frac{ \partial U }{ \partial r }
*   + \frac{ \sqrt{ x^2 + y^2 } } { x^2 + y^2 +z^2 } \frac{ \partial U }{ \partial \phi }
* \f}
* in which \f$ x \f$, \f$ y \f$ and \f$ z \f$ are the Cartesian coordinates. \f$ U \f$ is an
* arbitrary scalar. Radius \f$ r \f$ is the length of the position vector. Elevation \f$ \phi \f$
* is the the angle between the position vector and the XY-plane (with the positive direction
* towards the Z-axis). Azimuth \f$ \lambda \f$ is the dihedral angle about the Z-axis between the
* X-axis and the position vector (with the positive direction being right-handed about the Z-axis).
* \param sphericalGradient Vector with partial derivatives with respect to spherical coordinates.
*        The order is important!
*        sphericalGradient( 0 ) = partial derivative with respect to radius,
*        sphericalGradient( 1 ) = partial derivative with respect to elevation,
*        sphericalGradient( 2 ) = partial derivative with respect to azimuth.
* \param cartesianCoordinates Vector with Cartesian coordinates.
*        The order is important!
*        cartesianCoordinates( 0 ) = x coordinate,
*        cartesianCoordinates( 1 ) = y coordinate,
*        cartesianCoordinates( 2 ) = z coordinate.
* \return Vector with partial derivatives with respect to Cartesian coordinates.
*         The order is important!
*         cartesianGradient( 0 ) = partial derivative with respect to x coordinate,
*         cartesianGradient( 1 ) = partial derivative with respect to y coordinate,
*         cartesianGradient( 2 ) = partial derivative with respect to z coordinate.
*/
Eigen::Vector3d convertSphericalToCartesianGradient( const Eigen::Vector3d& sphericalGradient,
                                                     const Eigen::Vector3d& cartesianCoordinates );

} // namespace coordinate_conversions
} // namespace basic_mathematics
} // namespace tudat

#endif // TUDAT_COORDINATE_CONVERSIONS_H


text:
<?php
namespace Forms;

use \Phalcon\Forms\Element\Check;

/**
 * Class SigninForm
 * @package Forms
 */
class SigninForm extends FormBase
{
    public function initialize()
    {
        parent::initialize();

        $this->add($this->createUserEmailElement());

        $this->add($this->createUserPasswordElement());

        /*
        $remember = new Check('remember', [
            'value' => 'yes',
        ]);
        $remember->setLabel('Remember me');
        $this->add($remember);
        */

        $this->add($this->createSubmitElement());
    }
}


text:
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by an Apache 2.0 License.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.userAgent.jscript</title>

<script>

// Mock JScript functions

function ScriptEngine() {
  return 'JScript';
}

function ScriptEngineMajorVersion() {
  return 1;
}

function ScriptEngineMinorVersion() {
  return 2;
}

function ScriptEngineBuildVersion() {
  return 3456;
}

</script>

<script src="../base.js"></script>
<script>
  goog.require('goog.testing.jsunit');
  goog.require('goog.userAgent.jscript');
</script>
</head>
<body>
<script>

function testHasJscript() {
  assertTrue('Should have jscript', goog.userAgent.jscript.HAS_JSCRIPT);
}

function testVersion() {
  assertEquals('Version should be 1.2.3456', '1.2.3456',
               goog.userAgent.jscript.VERSION);
}

function testIsVersion() {
  assertTrue('Should be version 1.2.3456 or larger',
             goog.userAgent.jscript.isVersion('1.2.3456'));
  assertTrue('Should be version 1.2 or larger',
             goog.userAgent.jscript.isVersion('1.2'));
  assertFalse('Should not be version 8.9 or larger',
             goog.userAgent.jscript.isVersion('8.9'));
}

</script>
</body>
</html>


text:
package com.mitchellbosecke.pebble.node.expression;

import com.mitchellbosecke.pebble.error.PebbleException;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplateImpl;
import com.mitchellbosecke.pebble.utils.OperatorUtils;

public class NotEqualsExpression extends BinaryExpression<Boolean> {

    @Override
    public Boolean evaluate(PebbleTemplateImpl self, EvaluationContext context) throws PebbleException {
        return OperatorUtils.equals(getLeftExpression().evaluate(self, context),
                getRightExpression().evaluate(self, context)) == false;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/content_title"
            android:gravity="center_horizontal"
            android:textSize="26dp"
            />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/content_time"
            android:gravity="right"
            android:textSize="18dp" />

        <TextView
            android:layout_marginTop="25dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/content"
            android:textSize="20dp"/>
    </LinearLayout>

</ScrollView>


text:
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion::complete:frontend:*:commands' group-name commands
zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
zstyle ':completion::complete:frontend::' list-grouped

zmodload zsh/mapfile

function _frontend() {
  local CONFIG=$HOME/.frontend-search
  local ret=1

  local -a commands
  local -a frontend_points

  frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )

  commands=(
    'angular: Search in Angular.io website'
    'angularjs: Search in docs.angularjs.org website'
    'bem: Search in BEM website'
    'bootsnipp: Search in bootsnipp website'
    'bundlephobia: Search in Bundlephobia website'
    'caniuse: Search in Can I Use website'
    'codepen: Search in codepen website'
    'compassdoc: Search in COMPASS website'
    'cssflow: Search in cssflow website'
    'dartlang: Search in Dart website'
    'emberjs: Search in Ember website'
    'flowtype: Search in Flowtype website'
    'fontello: Search in fontello website'
    'github: Search in GitHub website'
    'html5please: Search in HTML5 Please website'
    'jestjs: Search in Jest website'
    'jquery: Search in jQuery website'
    'lodash: Search in Lo-Dash website'
    'mdn: Search in MDN website'
    'nodejs: Search in NodeJS website'
    'npmjs: Search in NPMJS website'
    'qunit: Search in Qunit website'
    'reactjs: Search in React website'
    'smacss: Search in SMACSS website'
    'stackoverflow: Search in StackOverflow website'
    'typescript: Search in TypeScript website'
    'unheap: Search in unheap website'
    'vuejs: Search in VueJS website'
  )

  _arguments -C \
    '1: :->first_arg' \
    '2: :->second_arg' && ret=0

  case $state in
    first_arg)
      _describe -t frontend_points "Warp points" frontend_points && ret=0
      _describe -t commands "Commands" commands && ret=0
      ;;
    second_arg)
      case $words[2] in
        jquery)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        mdn)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        compassdoc)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        html5please)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        caniuse)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        dartlang)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        lodash)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        qunit)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        fontello)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        github)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        bootsnipp)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        cssflow)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        codepen)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        unheap)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        bem)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        smacss)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        angularjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        reactjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        emberjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        stackoverflow)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        npmjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        bundlephobia)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        flowtype)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        typescript)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        vuejs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        nodejs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
        jestjs)
          _describe -t points "Warp points" frontend_points && ret=0
          ;;
      esac
      ;;
  esac

  return $ret
}

_frontend "$@"

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et


text:
PORTNAME=	libpssh
PORTVERSION=	1.0.1
CATEGORIES=	security

MAINTAINER= 	vagner@bsdway.ru
COMMENT=	Badoo\'s open source asynchronous ssh lib for C/C++

LICENSE=        BSD

USE_GITHUB=     yes
NO_STAGE=       yes
GH_ACCOUNT=     svagner
GH_PROJECT=     ${PORTNAME}
GH_COMMIT=      4b4267a

LIB_DEPENDS=	ssh2:${PORTSDIR}/security/libssh2 \
		libevent-2.0.so:${PORTSDIR}/devel/libevent2

USE_GCC=        any
GNU_CONFIGURE=  yes
USE_AUTOTOOLS=  aclocal automake autoconf libtool

.include <bsd.port.pre.mk>

run-autotools:
	@${ECHO_MSG} ""
	@${ECHO_MSG} "======================== ATTENTION ========================"
	@${ECHO_MSG} "To install this library you must reinstall libssh2 with "
	@${ECHO_MSG} "iohandle patch. This patches you can find in URI: "
	@${ECHO_MSG} "https://github.com/svagner/freebsd_ports/tree/master/patches/libssh2_iohandle_patch"
	@${ECHO_MSG} "Fetch it and copy to /usr/ports/security/libssh2/files. "
	@${ECHO_MSG} "After you must reinstall port libssh2 with commands: "
	@${ECHO_MSG} "# make clean && make install clean"
	@${ECHO_MSG} "If you don't want to do this press Ctrl+C"
	@${ECHO_MSG} "======================== ATTENTION ========================"
	@${ECHO_MSG} ""
	@sleep 10
	@cd ${WRKSRC} && ${SH} ./autogen.sh

.include <bsd.port.post.mk>


text:
#ifndef           OUTPUT_H
#define           OUTPUT_H

#include          "varable.h"
//#include                                      "epapconv.h"
#include          "pageres.h"
#include          "notdll.h"

extern BOOL_EVAR_H (tessedit_write_block_separators, TRUE,
"Write block separators in output");
extern BOOL_VAR_H (tessedit_write_raw_output, FALSE,
"Write raw stuff to name.raw");
extern BOOL_EVAR_H (tessedit_write_output, TRUE, "Write text to name.txt");
extern BOOL_EVAR_H (tessedit_write_txt_map, TRUE,
"Write .txt to .etx map file");
extern BOOL_EVAR_H (tessedit_write_rep_codes, TRUE,
"Write repetition char code");
extern BOOL_EVAR_H (tessedit_write_unlv, FALSE, "Write .unlv output file");
extern STRING_EVAR_H (unrecognised_char, "|",
"Output char for unidentified blobs");
extern INT_EVAR_H (suspect_level, 99, "Suspect marker level");
extern INT_VAR_H (suspect_space_level, 100,
"Min suspect level for rejecting spaces");
extern INT_VAR_H (suspect_short_words, 2,
"Dont Suspect dict wds longer than this");
extern BOOL_VAR_H (suspect_constrain_1Il, FALSE,
"UNLV keep 1Il chars rejected");
extern double_VAR_H (suspect_rating_per_ch, 999.9,
"Dont touch bad rating limit");
extern double_VAR_H (suspect_accept_rating, -999.9,
"Accept good rating limit");
extern BOOL_EVAR_H (tessedit_minimal_rejection, FALSE,
"Only reject tess failures");
extern BOOL_VAR_H (tessedit_zero_rejection, FALSE, "Dont reject ANYTHING");
extern BOOL_VAR_H (tessedit_word_for_word, FALSE,
"Make output have exactly one word per WERD");
extern BOOL_VAR_H (tessedit_consistent_reps, TRUE,
"Force all rep chars the same");
void output_pass(  //Tess output pass //send to api
                 PAGE_RES_IT &page_res_it,
                 BOOL8 write_to_shm,
				 TBOX	*target_word_box=0L);
void write_results(                           //output a word
                   PAGE_RES_IT &page_res_it,  //full info
                   char newline_type,         //type of newline
                   BOOL8 force_eol,           //override tilde crunch?
                   BOOL8 write_to_shm         //send to api
                  );
WERD_CHOICE *make_epaper_choice(                   //convert one word
                                WERD_RES *word,    //word to do
                                char newline_type  //type of newline
                               );
inT16 make_reject (              //make reject code
TBOX * inset_box,                 //bounding box
inT16 prevright,                 //previous char
inT16 nextleft,                  //next char
DENORM * denorm,                 //de-normalizer
char word_string[]               //output string
);
char determine_newline_type(                   //test line ends
                            WERD *word,        //word to do
                            BLOCK *block,      //current block
                            WERD *next_word,   //next word
                            BLOCK *next_block  //block of next word
                           );
void write_cooked_text(                     //write output
                       WERD *word,          //word to do
                       const STRING &text,  //text to write
                       BOOL8 acceptable,    //good stuff
                       BOOL8 pass2,         //done on pass2
                       FILE *fp             //file to write
                      );
void write_shm_text(                    //write output
                    WERD_RES *word,     //word to do
                    BLOCK *block,       //block it is from
                    ROW_RES *row,       //row it is from
                    const STRING &text, //text to write
                    const STRING &text_lengths
                   );
void write_map(                //output a map file
               FILE *mapfile,  //mapfile to write to
               WERD_RES *word);
FILE *open_outfile(  //open .map & .unlv file
                   const char *extension);
void write_unlv_text(WERD_RES *word);
UNICHAR_ID get_rep_char(WERD_RES *word);  // what char is repeated?
void ensure_rep_chars_are_consistent(WERD_RES *word);
void set_unlv_suspects(WERD_RES *word);
inT16 count_alphas(  //how many alphas
                   const char *s,
                   const char *lengths);
inT16 count_alphanums(  //how many alphanums
                      const char *s,
                      const char *lengths);
BOOL8 acceptable_number_string(const char *s,
                               const char *lengths);
#endif


text:
layout: post
title: "How averages will ruin your life"
date: "2019-10-07"
---

Check this out: immediately after college, graduates with STEM degrees earn an average of $10,000 more than graduates with humanities degrees.

But by age 40, those with humanities degrees earn slightly _more_ than those who studied STEM.

On average.

You might find this data comforting if you're really into Greek Literature or archaeology. Sure, you'll start off earning a bit less, but in the long run it'll work out. Right?

Not exactly. The _average_ 40-year-old humanities degree holder income is skewed by a relatively small number of ultra-high-earning careers - lawyers, successful politicians, CEOs.

If your plan is to get that archaeology degree and go into law school ... yeah, you'll probably be fine. If that's definitely _not_ your path, you'll likely find yourself earning _less_ than that average by age 40. Sorry.

**WTF does that have to do with CRO tho**

Anytime someone hands you an average, you should look at it funny. Like it might be hiding a tragic lie. Unless you know about the _distribution_ of the underlying data set, you're in a place of ignorance.

Your average time on site is 1:28. Great! Does that mean you've got a minute and a half with every single visitor? _Let's see ... 🤔 15 seconds to marvel at your beautiful hero image, 45 seconds to fill out your contact form, and 30 seconds to browse content after converting 🏆._

No way. What you've got is a ton of visitors who stick around for a matter of seconds, a handful who stick around for a while, and a select few who spend all their waking hours on your site. The average is meaningless.

On the other hand, if you can get _fewer_ "matter of seconds" visitors while getting _more_ "stick around for a while" visitors (and ignoring the "all their waking hours" folks), that's a win. Whether the average changes or not.


text:
#include "s2n_test.h"

#include "tls/extensions/s2n_client_status_request.h"
#include "tls/s2n_resume.h"

int main(int argc, char **argv)
{
    BEGIN_TEST();

    struct s2n_config *config;
    EXPECT_NOT_NULL(config = s2n_config_new());

    /* Test should_send */
    {
        struct s2n_connection *conn;
        EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT));
        EXPECT_SUCCESS(s2n_connection_set_config(conn, config));

        /* status request should NOT be sent by default */
        EXPECT_FALSE(s2n_client_status_request_extension.should_send(conn));

        /* status request should be sent if ocsp requested */
        config->status_request_type = S2N_STATUS_REQUEST_OCSP;
        EXPECT_TRUE(s2n_client_status_request_extension.should_send(conn));

        EXPECT_SUCCESS(s2n_connection_free(conn));
    }

    /* Enable status requests */
    config->status_request_type = S2N_STATUS_REQUEST_OCSP;

    /* Test send */
    {
        struct s2n_connection *conn;
        EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT));
        EXPECT_SUCCESS(s2n_connection_set_config(conn, config));

        struct s2n_stuffer stuffer;
        EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));

        EXPECT_SUCCESS(s2n_client_status_request_extension.send(conn, &stuffer));

        uint8_t request_type;
        EXPECT_SUCCESS(s2n_stuffer_read_uint8(&stuffer, &request_type));
        EXPECT_EQUAL(request_type, S2N_STATUS_REQUEST_OCSP);

        uint32_t unused_values;
        EXPECT_SUCCESS(s2n_stuffer_read_uint32(&stuffer, &unused_values));
        EXPECT_EQUAL(unused_values, 0);

        EXPECT_EQUAL(s2n_stuffer_data_available(&stuffer), 0);

        EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
        EXPECT_SUCCESS(s2n_connection_free(conn));
    }

    /* Test recv */
    {
        struct s2n_connection *conn;
        EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT));
        EXPECT_SUCCESS(s2n_connection_set_config(conn, config));

        struct s2n_stuffer stuffer;
        EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));

        EXPECT_SUCCESS(s2n_client_status_request_extension.send(conn, &stuffer));

        EXPECT_EQUAL(conn->status_type, S2N_STATUS_REQUEST_NONE);
        EXPECT_SUCCESS(s2n_client_status_request_extension.recv(conn, &stuffer));
        EXPECT_EQUAL(conn->status_type, S2N_STATUS_REQUEST_OCSP);

        EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
        EXPECT_SUCCESS(s2n_connection_free(conn));
    }

    /* Test recv - malformed length, ignore */
    {
        struct s2n_connection *conn;
        EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT));
        EXPECT_SUCCESS(s2n_connection_set_config(conn, config));

        struct s2n_stuffer stuffer;
        EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));

        EXPECT_SUCCESS(s2n_client_status_request_extension.send(conn, &stuffer));
        EXPECT_SUCCESS(s2n_stuffer_wipe_n(&stuffer, sizeof(uint16_t)));

        EXPECT_EQUAL(conn->status_type, S2N_STATUS_REQUEST_NONE);
        EXPECT_SUCCESS(s2n_client_status_request_extension.recv(conn, &stuffer));
        EXPECT_EQUAL(conn->status_type, S2N_STATUS_REQUEST_NONE);

        EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
        EXPECT_SUCCESS(s2n_connection_free(conn));
    }

    /* Test recv - not ocsp request, ignore */
    {
        struct s2n_config *bad_config;
        EXPECT_NOT_NULL(bad_config = s2n_config_new());
        bad_config->status_request_type = UINT8_MAX;

        struct s2n_connection *conn;
        EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT));
        EXPECT_SUCCESS(s2n_connection_set_config(conn, bad_config));

        struct s2n_stuffer stuffer;
        EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&stuffer, 0));

        EXPECT_SUCCESS(s2n_client_status_request_extension.send(conn, &stuffer));

        EXPECT_EQUAL(conn->status_type, S2N_STATUS_REQUEST_NONE);
        EXPECT_SUCCESS(s2n_client_status_request_extension.recv(conn, &stuffer));
        EXPECT_EQUAL(conn->status_type, S2N_STATUS_REQUEST_NONE);

        EXPECT_SUCCESS(s2n_stuffer_free(&stuffer));
        EXPECT_SUCCESS(s2n_connection_free(conn));
        EXPECT_SUCCESS(s2n_config_free(bad_config));
    }

    EXPECT_SUCCESS(s2n_config_free(config));

    END_TEST();
    return 0;
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <title>vector class</title>
  <link rel="stylesheet" type="text/css" href="../../../css/format.css"/>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
  <meta name="description" content="vector class"/>
  <meta name="author" content="Bernhard Wymann"/>
  <meta name="keywords" content="torcs, berniw, bernhard wymann, robot, steer, vector"/>

4.1 The Vector Class

Introduction

          In this chapter we will first develop a class for 2D-vectors. It will make our life easier when
          we try to compute the steer angle or distances and angles to other cars in the later chapters.
		  After that we improve the steering of the car and reduce the lap times. We will do it this time
		  with a more heuristic approach, because the other methods are not that easy to implement. At the
		  end of this chapter we will discuss some other methods for finding a path around the track.

Implementation

		  I will simply show you the vector class "v2d" here. Look up the implementation for
		  details. We implement operators for vector addition, subtraction, negation, multiplication
		  with a scalar and the dot product. Further we want also be able to normalize the vector, to
		  rotate it around a center and to get it's length. Put the following code in a new file called
		  linalg.h.

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef _LINALG_H_
#define _LINALG_H_

class v2d {
    public:
        /* constructors */
        v2d() {}
        v2d(const v2d &src) { this->x = src.x; this->y = src.y; }
        v2d(float x, float y) { this->x = x; this->y = y; }

        /* operators */
        v2d& operator=(const v2d &src);         /* assignment */
        v2d operator+(const v2d &src) const;    /* addition */
        v2d operator-(void) const;              /* negation */
        v2d operator-(const v2d &src) const;    /* subtraction */
        v2d operator*(const float s) const;     /* multiply with scalar */
        float operator*(const v2d &src) const;  /* dot product */
        friend v2d operator*(const float s, const v2d & src);

        /* methods */
        float len(void) const;
        void normalize(void);
        float dist(const v2d &p) const;
        float cosalpha(const v2d &p2, const v2d &center) const;
        v2d rotate(const v2d &c, float arc) const;

        /* data */
        float x;
        float y;
};

/* assignment */
inline v2d& v2d::operator=(const v2d &src)
{
    x = src.x; y = src.y; return *this;
}

/* add *this + src (vector addition) */
inline v2d v2d::operator+(const v2d &src) const
{
    return v2d(x + src.x, y + src.y);
}

/* negation of *this */
inline v2d v2d::operator-(void) const
{
    return v2d(-x, -y);
}

/* compute *this - src (vector subtraction) */
inline v2d v2d::operator-(const v2d &src) const
{
    return v2d(x - src.x, y - src.y);
}

/* scalar product */
inline float v2d::operator*(const v2d &src) const
{
    return src.x*x + src.y*y;
}

/* multiply vector with scalar (v2d*float) */
inline v2d v2d::operator*(const float s) const
{
    return v2d(s*x, s*y);
}

/* multiply scalar with vector (float*v2d) */
inline v2d operator*(const float s, const v2d & src)
{
    return v2d(s*src.x, s*src.y);
}

/* compute cosine of the angle between vectors *this-c and p2-c */
inline float v2d::cosalpha(const v2d &p2, const v2d &c) const
{
    v2d l1 = *this-c;
    v2d l2 = p2 - c;
    return (l1*l2)/(l1.len()*l2.len());
}

/* rotate vector arc radians around center c */
inline v2d v2d::rotate(const v2d &c, float arc) const
{
    v2d d = *this-c;
    float sina = sin(arc), cosa = cos(arc);
    return c + v2d(d.x*cosa-d.y*sina, d.x*sina+d.y*cosa);
}

/* compute the length of the vector */
inline float v2d::len(void) const
{
    return sqrt(x*x+y*y);
}

/* distance between *this and p */
inline float v2d::dist(const v2d &p) const
{
    return sqrt((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y));
}

/* normalize the vector */
inline void v2d::normalize(void)
{
    float l = this->len();
    x /= l; y /= l;
}

Summary

You know how to deal with vectors.

You implemented the above stuff in linalg.h.

Back

The straight.


text:
package client

import (
	"bytes"
	"crypto/rand"
	"encoding/gob"
	"io"
	"log"
	"testing"

	"github.com/mateusbraga/freestore/pkg/view"
)

func TestRegisterMsgGob(t *testing.T) {
	updates := []view.Update{view.Update{Type: view.Join, Process: view.Process{"10.1.1.2:5000"}},
		view.Update{Type: view.Join, Process: view.Process{"10.1.1.3:5000"}},
		view.Update{Type: view.Join, Process: view.Process{"10.1.1.4:5000"}},
	}

	v1 := view.NewWithUpdates(updates...)

	msg := RegisterMsg{}
	msg.Value = createFakeData(512)
	msg.Timestamp = 1
	msg.ViewRef = view.ViewToViewRef(v1)

	buf := new(bytes.Buffer)
	encoder := gob.NewEncoder(buf)
	err := encoder.Encode(msg)
	if err != nil {
		t.Errorf(err.Error())
	}

	var msg2 RegisterMsg
	buf2 := bytes.NewReader(buf.Bytes())
	decoder := gob.NewDecoder(buf2)
	err = decoder.Decode(&msg2)
	if err != nil {
		t.Errorf(err.Error())
	}
}

func BenchmarkRegisterMsgGobEncode(b *testing.B) {
	updates := []view.Update{view.Update{Type: view.Join, Process: view.Process{"10.1.1.2:5000"}},
		view.Update{Type: view.Join, Process: view.Process{"10.1.1.3:5000"}},
		view.Update{Type: view.Join, Process: view.Process{"10.1.1.4:5000"}},
	}
	v1 := view.NewWithUpdates(updates...)

	msg := RegisterMsg{}
	msg.Value = createFakeData(512)
	msg.Timestamp = 1
	msg.ViewRef = view.ViewToViewRef(v1)

	buf := new(bytes.Buffer)

	for i := 0; i < b.N; i++ {
		encoder := gob.NewEncoder(buf)
		err := encoder.Encode(msg)
		if err != nil {
			b.Errorf(err.Error())
		}
		buf.Reset()
	}
}

func BenchmarkRegisterMsgGobDecode(b *testing.B) {
	updates := []view.Update{view.Update{Type: view.Join, Process: view.Process{"10.1.1.2:5000"}},
		view.Update{Type: view.Join, Process: view.Process{"10.1.1.3:5000"}},
		view.Update{Type: view.Join, Process: view.Process{"10.1.1.4:5000"}},
	}
	v1 := view.NewWithUpdates(updates...)

	msg := RegisterMsg{}
	msg.Value = createFakeData(512)
	msg.Timestamp = 1
	msg.ViewRef = view.ViewToViewRef(v1)

	buf := new(bytes.Buffer)
	var msg2 RegisterMsg

	for i := 0; i < b.N; i++ {
		b.StopTimer()
		buf.Reset()
		encoder := gob.NewEncoder(buf)
		err := encoder.Encode(msg)
		if err != nil {
			b.Errorf(err.Error())
		}
		buf2 := bytes.NewReader(buf.Bytes())
		decoder := gob.NewDecoder(buf2)
		b.StartTimer()

		err = decoder.Decode(&msg2)
		if err != nil {
			b.Errorf(err.Error())
		}
	}
}

func createFakeData(size int) []byte {
	data := make([]byte, size)

	n, err := io.ReadFull(rand.Reader, data)
	if n != len(data) || err != nil {
		log.Fatalln("error to generate data:", err)
	}
	return data
}


text:
package utils;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class PageStats {
	public String pagename;
	public int readOnly;
	public int readOnlyFromCache;
	public int withUpdates;
	public int actionFailed;
	public int actionSuccessReadOnly;
	public int actionSuccessWithUpdates;
	public PageStats setPage(String p){
		pagename = p;
		return this;
	}
	public PageStats setReadOnly(int r){
		readOnly = r;
		return this;
	}
	public PageStats setReadOnlyFromCache(int r){
		readOnlyFromCache = r;
		return this;
	}
	public PageStats setWithUpdates(int r){
		withUpdates = r;
		return this;
	}
	public PageStats setActionFailed(int r){
		actionFailed = r;
		return this;
	}
	public PageStats setActionSuccessReadOnly(int r){
		actionSuccessReadOnly = r;
		return this;
	}
	public PageStats setActionSuccessWithUpdates(int r){
		actionSuccessWithUpdates = r;
		return this;
	}
	public int total(){
		return readOnly + readOnlyFromCache + withUpdates + actionFailed + actionSuccessReadOnly + actionSuccessWithUpdates;
	}
	public static final String tableFormat = "%1$30s | %2$12s | %3$12s | %4$12s | %5$12s | %6$12s | %7$12s | %8$12s";
	public String toString(){
		return String.format(tableFormat, pagename, total(), readOnlyFromCache, readOnly, withUpdates, actionSuccessReadOnly, actionSuccessWithUpdates, actionFailed);
	}
	public static void printList(List<PageStats> stats){
		StringBuilder sb = new StringBuilder(1536);
		sb.append("\n")
		.append("Start 5 minute page request statistics")
		.append("\n")
		.append(String.format(tableFormat, "page", "total", "request", "request", "request", "action", "action", "action"))
		.append("\n")
		.append(String.format(tableFormat, "name", "requests", "from cache", "read-only", "with updates", "read-only", "with updates", "failed"))
		.append("\n")
		.append(String.format(tableFormat, "------------------------------", "------------", "------------", "------------", "------------", "------------", "------------", "------------"));
		Collections.sort(stats, new Comparator<PageStats>() {
			public int compare(PageStats p1, PageStats p2) {
				return new Integer(p2.total()).compareTo(p1.total());
			}
		});
		for(int i = 0; i < Math.min(10, stats.size()) ;i++){
			PageStats ps = stats.get(i);
			sb.append("\n").append(ps);
		}
		sb.append("\n")
		.append("End page request statistics");

		org.webdsl.logging.Logger.info(sb);
	}
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>Module: OpenSSL::SSL</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

          Module
          OpenSSL::SSL

            In:

                lib/openssl/dummyssl.rb

                lib/openssl/ssl.rb

Methods

      verify_certificate_identity

Classes and Modules

      Module OpenSSL::SSL::Nonblock

Module OpenSSL::SSL::SocketForwarder

Class OpenSSL::SSL::SSLContext

Class OpenSSL::SSL::SSLError

Class OpenSSL::SSL::SSLServer

Class OpenSSL::SSL::SSLSocket

Constants

          VERIFY_NONE
          =
          0

          VERIFY_PEER
          =
          1

          VERIFY_FAIL_IF_NO_PEER_CERT
          =
          2

          VERIFY_CLIENT_ONCE
          =
          4

          OP_ALL
          =
          0x00000FFF

Public Instance methods

          verify_certificate_identity(cert, hostname)

[Validate]


text: .. mdinclude:: md_git.md


text:
FileInfo

The FileInfo object is established to keep a file or folder information.

	{
		name : String,
 		length : Number,
 		lastModified : Date,
 		absolutePath : String,
 		mineType : String,
 		isBlank : Boolean,
	}


text:
package com.dungeonstory.backend.data.enums;

import com.dungeonstory.backend.Labels;

public enum Skill implements I18nEnum {

    ATHLETICS(Ability.STRENGTH),
    ACROBATICS(Ability.DEXTERITY),
    SLEIGHT_OF_HAND(Ability.DEXTERITY),
    STEALTH(Ability.DEXTERITY),
    ARCANA(Ability.INTELLIGENCE),
    HISTORY(Ability.INTELLIGENCE),
    INVESTIGATION(Ability.INTELLIGENCE),
    NATURE(Ability.INTELLIGENCE),
    RELIGION(Ability.INTELLIGENCE),
    ANIMAL_HANDLING(Ability.WISDOM),
    INSIGHT(Ability.WISDOM),
    MEDICINE(Ability.WISDOM),
    PERCEPTION(Ability.WISDOM),
    SURVIVAL(Ability.WISDOM),
    DECEPTION(Ability.CHARISMA),
    INTIMIDATION(Ability.CHARISMA),
    PERFORMANCE(Ability.CHARISMA),
    PERSUASION(Ability.CHARISMA);

    private Ability keyAbility;

    private Skill(Ability keyAbility) {
        this.keyAbility = keyAbility;
    }

    @Override
    public String getName() {
        return Labels.getInstance().getMessage(getKey(name(), "name"));
    }

    public String getDescription() {
        return Labels.getInstance().getMessage(getKey(name(), "description"));
    }

    public Ability getKeyAbility() {
        return keyAbility;
    }

    @Override
    public String toString() {
        return getName();
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syn. Fung. (Oslo) 23: 74 (2007)

#### Original name
Hyphoderma acutatum Hjortstam & Ryvarden

### Remarks
null


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. Tokyo Univ. Forests (1954)

#### Original name
Stereum pendulum R. Sasaki

### Remarks
null


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit6221124a848892a536a06aeaca66ba73::getLoader();


text:
package com.lb.myapidemo.explosion;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;

import com.lb.libexplosion.view.ExplosionField;
import com.lb.myapidemo.R;

public class ExplosionActivity extends Activity {

	private ExplosionField mExplosionField;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_explosion);
		mExplosionField = ExplosionField.attach2Window(this);
		addListener(findViewById(R.id.root));

	}

	/**
	 * 为root中除了ViewGroup的控件都添加点击事件,点击后执行爆炸效果
	 *
	 * @param root
	 */
	private void addListener(View root) {
		if (root instanceof ViewGroup) {
			ViewGroup parent = (ViewGroup) root;
			for (int i = 0; i < parent.getChildCount(); i++) {
				addListener(parent.getChildAt(i));
			}
		} else {
			root.setClickable(true);
			root.setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					mExplosionField.explode(v);
					v.setOnClickListener(null);
				}
			});
		}
	}

	public void click(View v) {
		View root = findViewById(R.id.root);
		reset(root);
		addListener(root);
		mExplosionField.clear();

	}

	@SuppressLint("NewApi")
	private void reset(View root) {

		if (root instanceof ViewGroup) {
			ViewGroup parent = (ViewGroup) root;
			for (int i = 0; i < parent.getChildCount(); i++) {
				reset(parent.getChildAt(i));
			}
		} else {
			root.setScaleX(1);
			root.setScaleY(1);
			root.setAlpha(1);
		}
	}
}


text:
layout: post
title: "Must have addons for your browser"
tags:
    - firefox
    - chrome
    - browser
    - macos
    - security

category: blog
page_type: long
published: true
---

This is my list of must have extension or addons for my browsers, i'm using quite a lot of browser, mostly for testing, my main browser still [Firefox Quantum](/2017/11/firefox-quantum) and Google Chrome, but it can be installed on most major browser, even Brave or Vivaldi can.

1. [1Password](https://agilebits.com/onepassword/extensions)
People forget their password most of the time, using different password for different website is a secure way to protect your account, but to remember all of them is hard, that's why password management like [1Password](https://agilebits.com/onepassword/) come handy, mind you that this is a paid service. but you could install another password management like [Lastpass](https://www.lastpass.com/).

2. [Onetab](https://www.one-tab.com/)
This one is a saviour, you browse one website, the hyperlink sends you another one and another one, and you ended up with 32 tabs opened, Onetab will save your opened tab and close it, and you will regain your precious CPU and RAM.

3. [Privacy Badger](https://www.eff.org/privacybadger)
This addons will block ads and invisible trackers, a lot of website have their javascript calls to tracking services, and it will track your behaviour and sell it to advertisers.

4. [uBlock Origin](https://github.com/gorhill/uBlock#ublock-origin)
Like Privacy Badger, uBlock origin also remove ads from website with less CPU, and quite efective than Adblock Plus or its variant.

5. [Pocket](https://getpocket.com/)
I saved a lot of article into my Pocket (formerly _Read it later_) i curated most of my dailybite or [Jenius engineering](http://jenius.tech) there.

That's my five must have extension/addons and most used, there's quite a lot of other addons that useful for development or productivity out there.


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.cmmn.engine.impl.persistence.entity;

import java.util.Date;
import java.util.List;

import org.flowable.cmmn.api.runtime.CaseInstance;
import org.flowable.common.engine.impl.db.HasRevision;
import org.flowable.common.engine.impl.persistence.entity.Entity;
import org.flowable.variable.api.delegate.VariableScope;
import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity;

/**
 * @author Joram Barrez
 */
public interface CaseInstanceEntity extends Entity, EntityWithSentryPartInstances, VariableScope, HasRevision, PlanItemInstanceContainer, CaseInstance {

    void setBusinessKey(String businessKey);
    void setBusinessStatus(String businessStatus);
    void setName(String name);
    void setParentId(String parentId);
    void setCaseDefinitionId(String caseDefinitionId);
    void setCaseDefinitionKey(String caseDefinitionKey);
    void setCaseDefinitionName(String caseDefinitionName);
    void setCaseDefinitionVersion(Integer caseDefinitionVersion);
    void setCaseDefinitionDeploymentId(String caseDefinitionDeploymentId);
    void setState(String state);
    void setStartTime(Date startTime);
    void setStartUserId(String startUserId);
    void setLastReactivationTime(Date lastReactivationTime);
    void setLastReactivationUserId(String lastReactivationUserId);
    void setCallbackId(String callbackId);
    void setCallbackType(String callbackType);
    void setReferenceId(String referenceId);
    void setReferenceType(String referenceType);
    void setCompletable(boolean completable);
    void setTenantId(String tenantId);

    Date getLockTime();
    void setLockTime(Date lockTime);

    String getLockOwner();
    void setLockOwner(String lockOwner);

    List<VariableInstanceEntity> getQueryVariables();
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.hadoop.hbase.snapshot.CorruptedSnapshotException (HBase 0.98.8-hadoop2 API)</title>
<meta name="date" content="2014-11-14">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.apache.hadoop.hbase.snapshot.CorruptedSnapshotException

Packages that use CorruptedSnapshotException

Package
Description

org.apache.hadoop.hbase.master.snapshot

org.apache.hadoop.hbase.snapshot

Uses of CorruptedSnapshotException in org.apache.hadoop.hbase.master.snapshot

Methods in org.apache.hadoop.hbase.master.snapshot that throw CorruptedSnapshotException

Modifier and Type
Method and Description

void
MasterSnapshotVerifier.verifySnapshot(org.apache.hadoop.fs.Path snapshotDir,
              Set<String> snapshotServers)

Verify that the snapshot in the directory is a valid snapshot

Uses of CorruptedSnapshotException in org.apache.hadoop.hbase.snapshot

Methods in org.apache.hadoop.hbase.snapshot that throw CorruptedSnapshotException

Modifier and Type
Method and Description

static HBaseProtos.SnapshotDescription
SnapshotDescriptionUtils.readSnapshotInfo(org.apache.hadoop.fs.FileSystem fs,
                org.apache.hadoop.fs.Path snapshotDir)

Read in the HBaseProtos.SnapshotDescription stored for the snapshot in the passed directory

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014 The Apache Software Foundation. All rights reserved.


text:
<?php
namespace app\controllers;

use Yii;
use yii\filters\AccessControl;
use app\models\User;
use yii\web\Controller;
use yii\data\Pagination;

class UserController extends Controller
{

	public function behaviors()
	{
		return [
			'access' => [
				'class' => AccessControl::className(),
				'rules' => [
					[
						'allow' => true,
						'matchCallback' => function($rule, $action) {
							return Yii::$app->user->can('admin');
						}
					],
				],
			],
		];
	}

	public function actionIndex()
	{
		$active_users_query = User::find()->where(['status'=>User::STATUS_ACTIVE])->orderBy('created_at desc');
		$active_count = $active_users_query->count();
		$active_pagination = new Pagination(['totalCount' => $active_count]);
		$active_users = $active_users_query
			->offset($active_pagination->offset)
			->limit($active_pagination->limit)
			->with('roles')
			->all();

		$deactive_users_query = User::find()->where(['status'=>User::STATUS_DELETED])->orderBy('created_at desc');
		$trash_count = $deactive_users_query->count();
		$deactive_users = $deactive_users_query->all();

		return $this->render('index', [
			'active_users' => $active_users,
			'active_pagination' => $active_pagination,

			'deactive_users' => $deactive_users,
			'trash_count' => $trash_count,

		]);
	}

	public function actionCreate()
	{
		$model = new User;
		if ($model->load(Yii::$app->request->post()) && $model->validate()) {
			$model->generateAuthKey();
			$newPassword = uniqid();
			$model->password = $newPassword;
			if ($model->save()) {

				$account = [
					'username' => $model->username,
					'email' => $model->email,
					'password' => $newPassword,
				];

	            // 设置权限
				$auth = Yii::$app->authManager;
				$post_role = Yii::$app->request->post('role');
				if ($post_role && $post_role!='-1') {
					$role = $auth->getRole($post_role);
				} else {
					$role = $auth->getRole('member');
				}
				$auth->assign($role, $model->id);

				// 发送注册邮件
				Yii::$app
	            ->mailer
	            ->compose(
	                ['html' => 'createNewAccount-html'],
	                ['user' => $account]
	            )
	            ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name])
	            ->setTo($model->email)
	            ->setSubject(Yii::t('app', 'Account information for {u}', ['u' => \Yii::$app->name]))
	            ->send();

				// 转到用户管理首页
				return $this->redirect(['index']);
			}
		}
		return $this->render('create', [
			'model' => $model,
		]);
	}

	public function actionUpdate($id)
	{
		$model = $this->findModel($id);
		if ($model->load(Yii::$app->request->post()) && $model->validate()) {
			$model->save();
			$auth = Yii::$app->authManager;
			$post_role = Yii::$app->request->post('role');
			if ($post_role) {
				$role = $auth->getRole($post_role);
			} else {
				$role = $auth->getRole('member');
			}
			$auth->revokeAll($model->id);
			$auth->assign($role, $model->id);

			return $this->redirect(['index']);
		}
		return $this->render('update', [
			'model' => $model,
		]);
	}

	public function actionTrash($id)
	{
		$model = $this->findModel($id);
		$model->status = User::STATUS_DELETED;
		$model->save();
		return $this->redirect(['index']);
	}

	public function actionUntrash($id)
	{
		$model = $this->findModel($id);
		$model->status = User::STATUS_ACTIVE;
		$model->save();
		return $this->redirect(['index']);
	}

	public function actionDelete($id)
	{
		$model = $this->findModel($id);
		$auth = Yii::$app->authManager;
		$auth->revokeAll($id);
		$model->delete();
		return $this->redirect(['index']);
	}

	public function actionTrashAll()
	{
		$ids = Yii::$app->request->post('user_ids');
		if ($ids) {
			//$ids = implode(',', $ids);
			User::updateAll(['status'=>User::STATUS_DELETED], ['in', 'id', $ids]);
		}
		return $this->redirect(['index']);
	}

	public function actionUntrashAll()
	{
		$ids = Yii::$app->request->post('trash_user_ids');
		if ($ids) {
			User::updateAll(['status'=>User::STATUS_ACTIVE], ['in', 'id', $ids]);
		}
		return $this->redirect(['index']);
	}

	public function actionDeleteAll()
	{
		$ids = Yii::$app->request->post('trash_user_ids');
		if ($ids) {
			User::deleteAll(['in', 'id', $ids]);
		}
		return $this->redirect(['index']);
	}

	public function actionSetPassword()
	{
		$pwd = Yii::$app->request->post('pwd');
		$id = Yii::$app->request->post('id');
		if ($pwd && $id) {
			$model = $this->findModel($id);
			$model->password = $pwd;
			$model->save();
		}
		return $this->redirect(['index']);
	}

	protected function findModel($id)
	{
		$model = User::findOne($id);
		if ($model) {
			return $model;
		} else {
			throw new \yii\web\NotFoundHttpException('The requested page is not exists.');
		}
	}
}


text:
from django.core.management.base import BaseCommand
from elastic_json.models import Student
from elastic_json.utils.bulk import put_all_to_index

class Command(BaseCommand):
    help = "generates elasticsearch indexes described in models."

    def handle(self, *args, **options):
        put_all_to_index(Student)


text:
$(function () {
    var searchResultContainer = $('#elastic-search-results');

    $('#elastic-search-field').on('keyup', function () {
        uri = Routing.generate('font_search_term', {
            'term': $(this).val()
        });

        $.get(uri, function(data) {
            searchResultContainer.html(data)
        });
    });
});


text:
package co.cask.hydrator.plugin.batch.aggreagtor;

import co.cask.cdap.api.artifact.ArtifactRange;
import co.cask.cdap.api.artifact.ArtifactSummary;
import co.cask.cdap.api.artifact.ArtifactVersion;
import co.cask.cdap.api.data.format.StructuredRecord;
import co.cask.cdap.api.data.schema.Schema;
import co.cask.cdap.api.dataset.table.Table;
import co.cask.cdap.datapipeline.DataPipelineApp;
import co.cask.cdap.datapipeline.SmartWorkflow;
import co.cask.cdap.etl.api.batch.BatchAggregator;
import co.cask.cdap.etl.mock.batch.MockSink;
import co.cask.cdap.etl.mock.batch.MockSource;
import co.cask.cdap.etl.mock.test.HydratorTestBase;
import co.cask.cdap.etl.proto.v2.ETLBatchConfig;
import co.cask.cdap.etl.proto.v2.ETLPlugin;
import co.cask.cdap.etl.proto.v2.ETLStage;
import co.cask.cdap.proto.artifact.AppRequest;
import co.cask.cdap.proto.id.ApplicationId;
import co.cask.cdap.proto.id.ArtifactId;
import co.cask.cdap.proto.id.NamespaceId;
import co.cask.cdap.test.ApplicationManager;
import co.cask.cdap.test.DataSetManager;
import co.cask.cdap.test.TestConfiguration;
import co.cask.cdap.test.WorkflowManager;
import co.cask.hydrator.plugin.batch.aggreagtor.aggregator.Sampling;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

/**
 * Test for Sampling plugin
 */
public class SamplingTest extends HydratorTestBase {
    @ClassRule
    public static final TestConfiguration CONFIG = new TestConfiguration("explore.enabled", false);

    protected static final ArtifactId BATCH_ARTIFACT_ID = NamespaceId.DEFAULT.artifact("data-pipeline", "4.0.0");
    protected static final ArtifactSummary BATCH_ARTIFACT = new ArtifactSummary("data-pipeline", "4.0.0");

    protected static final Schema SOURCE_SCHEMA =
            Schema.recordOf("sourceRecord",
                    Schema.Field.of(SamplingTest.ID, Schema.of(Schema.Type.STRING)),
                    Schema.Field.of(SamplingTest.NAME, Schema.of(Schema.Type.STRING)),
                    Schema.Field.of(SamplingTest.SALARY, Schema.of(Schema.Type.STRING)),
                    Schema.Field.of(SamplingTest.DESIGNATIONID, Schema.nullableOf(Schema.of(Schema.Type.STRING))));

    private static final String ID = "id";
    private static final String NAME = "name";
    private static final String SALARY = "salary";
    private static final String DESIGNATIONID = "designationid";

    @BeforeClass
    public static void setupTestClass() throws Exception {

        setupBatchArtifacts(BATCH_ARTIFACT_ID, DataPipelineApp.class);
        Set<ArtifactRange> parents = new HashSet<>();
        parents.add(new ArtifactRange(NamespaceId.DEFAULT.getNamespace(), BATCH_ARTIFACT_ID.getArtifact(),
                new ArtifactVersion(BATCH_ARTIFACT.getVersion()), true,
                new ArtifactVersion(BATCH_ARTIFACT.getVersion()), true));
        addPluginArtifact(NamespaceId.DEFAULT.artifact("sampling-aggregator-plugin", "1.6.0"), parents,
                Sampling.class);
    }

    @Test
    public void testSystematicSampling() throws Exception {
        String inputTable = "input_table";
        ETLStage source = new ETLStage("source", MockSource.getPlugin(inputTable));

        Map<String, String> sourceproperties = new ImmutableMap.Builder<String, String>()
                .put("sampleSize", "2")
                .put("random", "0.2")
                .put("totalRecords", "4")
                .put("samplingType", "Systematic")
                .build();

        ETLStage transform = new ETLStage("aggregate",
                new ETLPlugin("Sampling", BatchAggregator.PLUGIN_TYPE, sourceproperties, null));

        String sinkTable = "output_table";
        ETLStage sink = new ETLStage("sink", MockSink.getPlugin(sinkTable));

        ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *")
                .addStage(source)
                .addStage(transform)
                .addStage(sink)
                .addConnection(source.getName(), transform.getName())
                .addConnection(transform.getName(), sink.getName())
                .build();

        AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(BATCH_ARTIFACT, etlConfig);
        ApplicationId appId = NamespaceId.DEFAULT.app("SystematicSamplingTest");
        ApplicationManager appManager = deployApplication(appId, appRequest);

        DataSetManager<Table> inputManager = getDataset(inputTable);
        List<StructuredRecord> input = ImmutableList.of(
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "100").set(NAME, "John").set(SALARY, "1000")
                        .set(DESIGNATIONID, null).build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "101").set(NAME, "Kerry").set(SALARY, "1030")
                        .set(DESIGNATIONID, "2").build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "102").set(NAME, "Mathew").set(SALARY, "1230")
                        .set(DESIGNATIONID, "").build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "103").set(NAME, "Allie").set(SALARY, "2000")
                        .set(DESIGNATIONID, "4").build());
        MockSource.writeInput(inputManager, input);

        WorkflowManager workflowManager = appManager.getWorkflowManager(SmartWorkflow.NAME);
        workflowManager.start();
        workflowManager.waitForFinish(5, TimeUnit.MINUTES);

        DataSetManager<Table> outputManager = getDataset(sinkTable);
        List<StructuredRecord> outputRecords = MockSink.readOutput(outputManager);
        Assert.assertEquals(2, outputRecords.size());
    }

    @Test
    public void testSystematicSamplingWithOverSampling() throws Exception {
        String inputTable = "input_table";
        ETLStage source = new ETLStage("source", MockSource.getPlugin(inputTable));

        Map<String, String> sourceproperties = new ImmutableMap.Builder<String, String>()
                .put("sampleSize", "2")
                .put("overSamplingPercentage", "30")
                .put("totalRecords", "4")
                .put("samplingType", "Systematic")
                .build();

        ETLStage transform = new ETLStage("aggregate",
                new ETLPlugin("Sampling", BatchAggregator.PLUGIN_TYPE, sourceproperties, null));

        String sinkTable = "output_table_with_oversampling";
        ETLStage sink = new ETLStage("sink", MockSink.getPlugin(sinkTable));

        ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *")
                .addStage(source)
                .addStage(transform)
                .addStage(sink)
                .addConnection(source.getName(), transform.getName())
                .addConnection(transform.getName(), sink.getName())
                .build();

        AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(BATCH_ARTIFACT, etlConfig);
        ApplicationId appId = NamespaceId.DEFAULT.app("SystematicSamplingWithOverSamplingTest");
        ApplicationManager appManager = deployApplication(appId, appRequest);

        DataSetManager<Table> inputManager = getDataset(inputTable);
        List<StructuredRecord> input = ImmutableList.of(
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "100").set(NAME, "John").set(SALARY, "1000")
                        .set(DESIGNATIONID, null).build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "101").set(NAME, "Kerry").set(SALARY, "1030")
                        .set(DESIGNATIONID, "2").build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "102").set(NAME, "Mathew").set(SALARY, "1230")
                        .set(DESIGNATIONID, "").build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "103").set(NAME, "Allie").set(SALARY, "2000")
                        .set(DESIGNATIONID, "4").build());
        MockSource.writeInput(inputManager, input);

        WorkflowManager workflowManager = appManager.getWorkflowManager(SmartWorkflow.NAME);
        workflowManager.start();
        workflowManager.waitForFinish(5, TimeUnit.MINUTES);

        DataSetManager<Table> outputManager = getDataset(sinkTable);
        List<StructuredRecord> outputRecords = MockSink.readOutput(outputManager);
        Assert.assertEquals(3, outputRecords.size());
    }

    @Test
    public void testReservoirSampling() throws Exception {
        String inputTable = "input_table";
        ETLStage source = new ETLStage("source", MockSource.getPlugin(inputTable));

        Map<String, String> sourceproperties = new ImmutableMap.Builder<String, String>()
                .put("sampleSize", "2")
                .put("samplingType", "Reservoir")
                .build();

        ETLStage transform = new ETLStage("aggregate",
                new ETLPlugin("Sampling", BatchAggregator.PLUGIN_TYPE, sourceproperties, null));

        String sinkTable = "output_table_reservoir";
        ETLStage sink = new ETLStage("sink", MockSink.getPlugin(sinkTable));

        ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *")
                .addStage(source)
                .addStage(transform)
                .addStage(sink)
                .addConnection(source.getName(), transform.getName())
                .addConnection(transform.getName(), sink.getName())
                .build();

        AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(BATCH_ARTIFACT, etlConfig);
        ApplicationId appId = NamespaceId.DEFAULT.app("ReservoirSamplingTest");
        ApplicationManager appManager = deployApplication(appId, appRequest);

        DataSetManager<Table> inputManager = getDataset(inputTable);
        List<StructuredRecord> input = ImmutableList.of(
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "100").set(NAME, "John").set(SALARY, "1000")
                        .set(DESIGNATIONID, null).build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "101").set(NAME, "Kerry").set(SALARY, "1030")
                        .set(DESIGNATIONID, "2").build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "102").set(NAME, "Mathew").set(SALARY, "1230")
                        .set(DESIGNATIONID, "").build(),
                StructuredRecord.builder(SOURCE_SCHEMA).set(ID, "103").set(NAME, "Allie").set(SALARY, "2000")
                        .set(DESIGNATIONID, "4").build());
        MockSource.writeInput(inputManager, input);

        WorkflowManager workflowManager = appManager.getWorkflowManager(SmartWorkflow.NAME);
        workflowManager.start();
        workflowManager.waitForFinish(5, TimeUnit.MINUTES);

        DataSetManager<Table> outputManager = getDataset(sinkTable);
        List<StructuredRecord> outputRecords = MockSink.readOutput(outputManager);
        Assert.assertEquals(2, outputRecords.size());
        Assert.assertEquals(outputRecords.get(0).getSchema(), SOURCE_SCHEMA);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testSamplingWithoutSampleSizeOrPercentage() {
        Sampling.SamplingConfig config = new Sampling.SamplingConfig(null, null, Float.valueOf(10), null,
                "Systematic", 10);
        config.validate();
    }

    @Test(expected = IllegalArgumentException.class)
    public void testSystematicSamplingWithoutTotalRecords() {
        Sampling.SamplingConfig config = new Sampling.SamplingConfig(10, null, Float.valueOf(10), null,
                "Systematic", null);
        config.validate();
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIllegalRandom() {
        Sampling.SamplingConfig config = new Sampling.SamplingConfig(10, null, Float.valueOf(10), Float.valueOf(10),
                "Systematic", 10);
        config.validate();
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIllegalSamplePercentage() {
        Sampling.SamplingConfig config = new Sampling.SamplingConfig(null, Float.valueOf(110), Float.valueOf(10), null,
                "Systematic", 10);
        config.validate();
    }
}


text:
##
# Import Modules
#
import sqlite3
import os, time

import Common.EdkLogger as EdkLogger
import CommonDataClass.DataClass as DataClass

from Table.TableDataModel import TableDataModel
from Table.TableFile import TableFile
from Table.TableFunction import TableFunction
from Table.TablePcd import TablePcd
from Table.TableIdentifier import TableIdentifier
from Table.TableReport import TableReport
from MetaFileWorkspace.MetaFileTable import ModuleTable
from MetaFileWorkspace.MetaFileTable import PackageTable
from MetaFileWorkspace.MetaFileTable import PlatformTable
from Table.TableFdf import TableFdf

##
# Static definitions
#
DATABASE_PATH = "Ecc.db"

## Database
#
# This class defined the ECC databse
# During the phase of initialization, the database will create all tables and
# insert all records of table DataModel
#
# @param object:    Inherited from object class
# @param DbPath:    A string for the path of the ECC database
#
# @var Conn:        Connection of the ECC database
# @var Cur:         Cursor of the connection
# @var TblDataModel:  Local instance for TableDataModel
#
class Database(object):
    def __init__(self, DbPath):
        self.DbPath = DbPath
        self.Conn = None
        self.Cur = None
        self.TblDataModel = None
        self.TblFile = None
        self.TblFunction = None
        self.TblIdentifier = None
        self.TblPcd = None
        self.TblReport = None
        self.TblInf = None
        self.TblDec = None
        self.TblDsc = None
        self.TblFdf = None

    ## Initialize ECC database
    #
    # 1. Delete all old existing tables
    # 2. Create new tables
    # 3. Initialize table DataModel
    #
    def InitDatabase(self, NewDatabase = True):
        EdkLogger.verbose("\nInitialize ECC database started ...")
        #
        # Drop all old existing tables
        #
        if NewDatabase:
            if os.path.exists(self.DbPath):
                os.remove(self.DbPath)
        self.Conn = sqlite3.connect(self.DbPath, isolation_level = 'DEFERRED')
        self.Conn.execute("PRAGMA page_size=4096")
        self.Conn.execute("PRAGMA synchronous=OFF")
        # to avoid non-ascii charater conversion error
        self.Conn.text_factory = str
        self.Cur = self.Conn.cursor()

        self.TblDataModel = TableDataModel(self.Cur)
        self.TblFile = TableFile(self.Cur)
        self.TblFunction = TableFunction(self.Cur)
        self.TblIdentifier = TableIdentifier(self.Cur)
        self.TblPcd = TablePcd(self.Cur)
        self.TblReport = TableReport(self.Cur)
        self.TblInf = ModuleTable(self.Cur)
        self.TblDec = PackageTable(self.Cur)
        self.TblDsc = PlatformTable(self.Cur)
        self.TblFdf = TableFdf(self.Cur)

        #
        # Create new tables
        #
        if NewDatabase:
            self.TblDataModel.Create()
            self.TblFile.Create()
            self.TblFunction.Create()
            self.TblPcd.Create()
            self.TblReport.Create()
            self.TblInf.Create()
            self.TblDec.Create()
            self.TblDsc.Create()
            self.TblFdf.Create()

        #
        # Init each table's ID
        #
        self.TblDataModel.InitID()
        self.TblFile.InitID()
        self.TblFunction.InitID()
        self.TblPcd.InitID()
        self.TblReport.InitID()
        self.TblInf.InitID()
        self.TblDec.InitID()
        self.TblDsc.InitID()
        self.TblFdf.InitID()

        #
        # Initialize table DataModel
        #
        if NewDatabase:
            self.TblDataModel.InitTable()

        EdkLogger.verbose("Initialize ECC database ... DONE!")

    ## Query a table
    #
    # @param Table:  The instance of the table to be queried
    #
    def QueryTable(self, Table):
        Table.Query()

    ## Close entire database
    #
    # Commit all first
    # Close the connection and cursor
    #
    def Close(self):
        #
        # Commit to file
        #
        self.Conn.commit()

        #
        # Close connection and cursor
        #
        self.Cur.close()
        self.Conn.close()

    ## Insert one file information
    #
    # Insert one file's information to the database
    # 1. Create a record in TableFile
    # 2. Create functions one by one
    #    2.1 Create variables of function one by one
    #    2.2 Create pcds of function one by one
    # 3. Create variables one by one
    # 4. Create pcds one by one
    #
    def InsertOneFile(self, File):
        #
        # Insert a record for file
        #
        FileID = self.TblFile.Insert(File.Name, File.ExtName, File.Path, File.FullPath, Model = File.Model, TimeStamp = File.TimeStamp)

        if File.Model == DataClass.MODEL_FILE_C or File.Model == DataClass.MODEL_FILE_H:
            IdTable = TableIdentifier(self.Cur)
            IdTable.Table = "Identifier%s" % FileID
            IdTable.Create()
            #
            # Insert function of file
            #
            for Function in File.FunctionList:
                FunctionID = self.TblFunction.Insert(Function.Header, Function.Modifier, Function.Name, Function.ReturnStatement, \
                                        Function.StartLine, Function.StartColumn, Function.EndLine, Function.EndColumn, \
                                        Function.BodyStartLine, Function.BodyStartColumn, FileID, \
                                        Function.FunNameStartLine, Function.FunNameStartColumn)
                #
                # Insert Identifier of function
                #
                for Identifier in Function.IdentifierList:
                    IdentifierID = IdTable.Insert(Identifier.Modifier, Identifier.Type, Identifier.Name, Identifier.Value, Identifier.Model, \
                                            FileID, FunctionID, Identifier.StartLine, Identifier.StartColumn, Identifier.EndLine, Identifier.EndColumn)
                #
                # Insert Pcd of function
                #
                for Pcd in Function.PcdList:
                    PcdID = self.TblPcd.Insert(Pcd.CName, Pcd.TokenSpaceGuidCName, Pcd.Token, Pcd.DatumType, Pcd.Model, \
                                       FileID, FunctionID, Pcd.StartLine, Pcd.StartColumn, Pcd.EndLine, Pcd.EndColumn)
            #
            # Insert Identifier of file
            #
            for Identifier in File.IdentifierList:
                IdentifierID = IdTable.Insert(Identifier.Modifier, Identifier.Type, Identifier.Name, Identifier.Value, Identifier.Model, \
                                        FileID, -1, Identifier.StartLine, Identifier.StartColumn, Identifier.EndLine, Identifier.EndColumn)
            #
            # Insert Pcd of file
            #
            for Pcd in File.PcdList:
                PcdID = self.TblPcd.Insert(Pcd.CName, Pcd.TokenSpaceGuidCName, Pcd.Token, Pcd.DatumType, Pcd.Model, \
                                   FileID, -1, Pcd.StartLine, Pcd.StartColumn, Pcd.EndLine, Pcd.EndColumn)

        EdkLogger.verbose("Insert information from file %s ... DONE!" % File.FullPath)

    ## UpdateIdentifierBelongsToFunction
    #
    # Update the field "BelongsToFunction" for each Indentifier
    #
    #
    def UpdateIdentifierBelongsToFunction_disabled(self):
        EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")

        SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier"""
        EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
        self.Cur.execute(SqlCommand)
        Records = self.Cur.fetchall()
        for Record in Records:
            IdentifierID = Record[0]
            BelongsToFile = Record[1]
            StartLine = Record[2]
            EndLine = Record[3]
            Model = Record[4]

            #
            # Check whether an identifier belongs to a function
            #
            EdkLogger.debug(4, "For common identifiers ... ")
            SqlCommand = """select ID from Function
                        where StartLine < %s and EndLine > %s
                        and BelongsToFile = %s""" % (StartLine, EndLine, BelongsToFile)
            EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
            self.Cur.execute(SqlCommand)
            IDs = self.Cur.fetchall()
            for ID in IDs:
                SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (ID[0], IdentifierID)
                EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
                self.Cur.execute(SqlCommand)

            #
            # Check whether the identifier is a function header
            #
            EdkLogger.debug(4, "For function headers ... ")
            if Model == DataClass.MODEL_IDENTIFIER_COMMENT:
                SqlCommand = """select ID from Function
                        where StartLine = %s + 1
                        and BelongsToFile = %s""" % (EndLine, BelongsToFile)
                EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
                self.Cur.execute(SqlCommand)
                IDs = self.Cur.fetchall()
                for ID in IDs:
                    SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, IdentifierID)
                    EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
                    self.Cur.execute(SqlCommand)

        EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE")

    ## UpdateIdentifierBelongsToFunction
    #
    # Update the field "BelongsToFunction" for each Indentifier
    #
    #
    def UpdateIdentifierBelongsToFunction(self):
        EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")

        SqlCommand = """select ID, BelongsToFile, StartLine, EndLine from Function"""
        Records = self.TblFunction.Exec(SqlCommand)
        Data1 = []
        Data2 = []
        for Record in Records:
            FunctionID = Record[0]
            BelongsToFile = Record[1]
            StartLine = Record[2]
            EndLine = Record[3]
            #Data1.append(("'file%s'" % BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine))
            #Data2.append(("'file%s'" % BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1))

            SqlCommand = """Update Identifier%s set BelongsToFunction = %s where BelongsToFile = %s and StartLine > %s and EndLine < %s""" % \
                        (BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine)
            self.TblIdentifier.Exec(SqlCommand)

            SqlCommand = """Update Identifier%s set BelongsToFunction = %s, Model = %s where BelongsToFile = %s and Model = %s and EndLine = %s""" % \
                         (BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1)
            self.TblIdentifier.Exec(SqlCommand)
#       #
#       # Check whether an identifier belongs to a function
#       #
#       print Data1
#       SqlCommand = """Update ? set BelongsToFunction = ? where BelongsToFile = ? and StartLine > ? and EndLine < ?"""
#       print SqlCommand
#       EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
#       self.Cur.executemany(SqlCommand, Data1)
#
#       #
#       # Check whether the identifier is a function header
#       #
#       EdkLogger.debug(4, "For function headers ... ")
#       SqlCommand = """Update ? set BelongsToFunction = ?, Model = ? where BelongsToFile = ? and Model = ? and EndLine = ?"""
#       EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
#       self.Cur.executemany(SqlCommand, Data2)
#
#       EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE")

##
#
# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
#
if __name__ == '__main__':
    EdkLogger.Initialize()
    #EdkLogger.SetLevel(EdkLogger.VERBOSE)
    EdkLogger.SetLevel(EdkLogger.DEBUG_0)
    EdkLogger.verbose("Start at " + time.strftime('%H:%M:%S', time.localtime()))

    Db = Database(DATABASE_PATH)
    Db.InitDatabase()
    Db.QueryTable(Db.TblDataModel)

    identifier1 = DataClass.IdentifierClass(-1, '', '', "i''1", 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 32,  43,  54,  43)
    identifier2 = DataClass.IdentifierClass(-1, '', '', 'i1', 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 15,  43,  20,  43)
    identifier3 = DataClass.IdentifierClass(-1, '', '', 'i1', 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 55,  43,  58,  43)
    identifier4 = DataClass.IdentifierClass(-1, '', '', "i1'", 'aaa', DataClass.MODEL_IDENTIFIER_COMMENT, 1, -1, 77,  43,  88,  43)
    fun1 = DataClass.FunctionClass(-1, '', '', 'fun1', '', 21, 2, 60,  45, 1, 23, 0, [], [])
    file = DataClass.FileClass(-1, 'F1', 'c', 'C:\\', 'C:\\F1.exe', DataClass.MODEL_FILE_C, '2007-12-28', [fun1], [identifier1, identifier2, identifier3, identifier4], [])
    Db.InsertOneFile(file)
    Db.UpdateIdentifierBelongsToFunction()

    Db.QueryTable(Db.TblFile)
    Db.QueryTable(Db.TblFunction)
    Db.QueryTable(Db.TblPcd)
    Db.QueryTable(Db.TblIdentifier)

    Db.Close()
    EdkLogger.verbose("End at " + time.strftime('%H:%M:%S', time.localtime()))


text:
<?php

namespace Booothy\Photo\Infrastructure\Hydrator\Mongo;

use stdClass;
use DateTimeImmutable;
use Booothy\Photo\Domain\Hydrator\PhotoResource as Hydrator;
use Booothy\Photo\Domain\Model\Photo;
use Booothy\Photo\Domain\Model\ValueObject\Id;
use Booothy\Photo\Domain\Model\ValueObject\ImageDetails;
use Booothy\Photo\Domain\Model\ValueObject\Quote;
use Booothy\Photo\Domain\Model\ValueObject\Upload;
use Booothy\User\Domain\Model\ValueObject\Email;

final class PhotoResource implements Hydrator
{
    public function __invoke(stdClass $document)
    {
        $upload_provider = 'atProcessing';

        if (array_key_exists('provider', $document->upload)) {
            $upload_provider = 'at' . ucfirst($document->upload->provider);
        }

        if (!array_key_exists('image_details', $document)) {
            $document->image_details = [
                'hex_color' => '',
                'width' => 0,
                'height' => 0,
            ];
        }

        return new Photo(
            new Id($document->_id),
            new Quote($document->quote),
            Upload::$upload_provider(
                $document->upload->filename,
                $document->upload->mime_type
            ),
            new ImageDetails(
                $document->image_details->hex_color,
                $document->image_details->width,
                $document->image_details->height
            ),
            new DateTimeImmutable($document->creation_date),
            new Email($document->user)
        );
    }
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>Game Jolt Unity API: GameJolt.UI.Behaviours.DismissibleWindow Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>

Game Jolt Unity API
    v2.3.0

GameJolt

UI

Behaviours

DismissibleWindow

Public Member Functions |
Public Attributes |
List of all members

GameJolt.UI.Behaviours.DismissibleWindow Class Reference

Inheritance diagram for GameJolt.UI.Behaviours.DismissibleWindow:

  <map id="GameJolt.UI.Behaviours.DismissibleWindow_map" name="GameJolt.UI.Behaviours.DismissibleWindow_map">
</map>

Public Member Functions

override void 	OnStateUpdate (Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)

Public Attributes

bool 	returnValue

The documentation for this class was generated from the following file:

Plugins/GameJolt/Scripts/UI/Behaviours/DismissibleWindow.cs

<address class="footer">

  Generated by doxygen 1.8.13

</address>


text:
package com.esuta.fidm.repository.schema.support;

import javax.persistence.Embeddable;
import javax.persistence.Entity;
import java.io.Serializable;

/**
 *  @author shood
 * */
@Embeddable
public class FederationIdentifierType implements Serializable {

    /**
     *  An identifier of an origin identity provider in
     *  identity federation that holds the origin version
     *  of an object, that this identifier is referencing.
     * */
    private String federationMemberId;

    /**
     *  A String representation of a value of unique
     *  attribute, that identifies the object in origin
     *  identity provider. The holder of this identifier
     *  does not know the type or meaning of such attribute,
     *  only the value, thus privacy is respected
     * */
    private String uniqueAttributeValue;

    /**
     *  A String representation of a type, or class, of an
     *  origin object in origin identity federation.
     * */
    private String objectType;

    public String getFederationMemberId() {
        return federationMemberId;
    }

    public void setFederationMemberId(String federationMemberId) {
        this.federationMemberId = federationMemberId;
    }

    public String getUniqueAttributeValue() {
        return uniqueAttributeValue;
    }

    public void setUniqueAttributeValue(String uniqueAttributeValue) {
        this.uniqueAttributeValue = uniqueAttributeValue;
    }

    public String getObjectType() {
        return objectType;
    }

    public void setObjectType(String objectType) {
        this.objectType = objectType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof FederationIdentifierType)) return false;

        FederationIdentifierType that = (FederationIdentifierType) o;

        if (federationMemberId != null ? !federationMemberId.equals(that.federationMemberId) : that.federationMemberId != null)
            return false;
        if (objectType != null ? !objectType.equals(that.objectType) : that.objectType != null) return false;
        if (uniqueAttributeValue != null ? !uniqueAttributeValue.equals(that.uniqueAttributeValue) : that.uniqueAttributeValue != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = federationMemberId != null ? federationMemberId.hashCode() : 0;
        result = 31 * result + (uniqueAttributeValue != null ? uniqueAttributeValue.hashCode() : 0);
        result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
        return result;
    }
}