text:
package io.undertow.server.handlers.proxy.mod_cluster;

import static org.xnio.Bits.allAreClear;
import static org.xnio.Bits.allAreSet;

import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;

import io.undertow.server.ExchangeCompletionListener;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.handlers.proxy.ProxyCallback;
import io.undertow.server.handlers.proxy.ProxyConnection;

/**
 *
 * @author Emanuel Muckenhuber
 */
class Context {

    private static final AtomicInteger idGen = new AtomicInteger();

    static enum Status {

        ENABLED,
        DISABLED,
        STOPPED,
        ;

    }

    private final int id;
    private final Node node;
    private final String path;
    private final Node.VHostMapping vhost;

    private static final int STOPPED = (1 << 31);
    private static final int DISABLED = (1 << 30);
    private static final int REQUEST_MASK = ((1 << 30) - 1);

    private volatile int state = STOPPED;
    private static final AtomicIntegerFieldUpdater<Context> stateUpdater = AtomicIntegerFieldUpdater.newUpdater(Context.class, "state");

    Context(final String path, final Node.VHostMapping vHost, final Node node) {
        id = idGen.incrementAndGet();
        this.path = path;
        this.node = node;
        this.vhost = vHost;
    }

    public int getId() {
        return id;
    }

    public String getJVMRoute() {
        return node.getJvmRoute();
    }

    public String getPath() {
        return path;
    }

    public List<String> getVirtualHosts() {
        return vhost.getAliases();
    }

    public int getActiveRequests() {
        return state & REQUEST_MASK;
    }

    public Status getStatus() {
        final int state = this.state;
        if ((state & STOPPED) == STOPPED) {
            return Status.STOPPED;
        } else if ((state & DISABLED) == DISABLED) {
            return Status.DISABLED;
        }
        return Status.ENABLED;
    }

    public boolean isEnabled() {
        return allAreClear(state, DISABLED | STOPPED);
    }

    public boolean isStopped() {
        return allAreSet(state, STOPPED);
    }

    public boolean isDisabled() {
        return allAreSet(state, DISABLED);
    }

    Node getNode() {
        return node;
    }

    Node.VHostMapping getVhost() {
        return vhost;
    }

    boolean checkAvailable(boolean existingSession) {
        if (node.checkAvailable(existingSession)) {
            return existingSession ? !isStopped() : isEnabled();
        }
        return false;
    }

    void enable() {
        int oldState, newState;
        for (;;) {
            oldState = this.state;
            newState = oldState & ~(STOPPED | DISABLED);
            if (stateUpdater.compareAndSet(this, oldState, newState)) {
                return;
            }
        }
    }

    void disable() {
        int oldState, newState;
        for (;;) {
            oldState = this.state;
            newState = oldState | DISABLED;
            if (stateUpdater.compareAndSet(this, oldState, newState)) {
                return;
            }
        }
    }

    void stop() {
        int oldState, newState;
        for (;;) {
            oldState = this.state;
            newState = oldState | STOPPED;
            if (stateUpdater.compareAndSet(this, oldState, newState)) {
                return;
            }
        }
    }

    /**
     * Handle a proxy request for this context.
     *
     * @param target       the proxy target
     * @param exchange     the http server exchange
     * @param callback     the proxy callback
     * @param timeout      the timeout
     * @param timeUnit     the time unit
     * @param exclusive    whether this connection is exclusive
     */
    void handleRequest(final ModClusterProxyTarget target, final HttpServerExchange exchange, final ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit, boolean exclusive) {
        if (addRequest()) {
            exchange.addExchangeCompleteListener(new ExchangeCompletionListener() {
                @Override
                public void exchangeEvent(HttpServerExchange exchange, NextListener nextListener) {
                    requestDone();
                    nextListener.proceed();
                }
            });
            node.getConnectionPool().connect(target, exchange, callback, timeout, timeUnit, exclusive);
        } else {
            callback.failed(exchange);
        }
    }

    boolean addRequest() {
        int oldState, newState;
        for (;;) {
            oldState = this.state;
            if ((oldState & STOPPED) != 0) {
                return false;
            }
            newState = oldState + 1;
            if ((newState & REQUEST_MASK) == REQUEST_MASK) {
                return false;
            }
            if (stateUpdater.compareAndSet(this, oldState, newState)) {
                return true;
            }
        }
    }

    void requestDone() {
        int oldState, newState;
        for (;;) {
            oldState = this.state;
            if ((oldState & REQUEST_MASK) == 0) {
                return;
            }
            newState = oldState - 1;
            if (stateUpdater.compareAndSet(this, oldState, newState)) {
                return;
            }
        }
    }

}


text:
package com.microsoft.azure.management.network.v2019_02_01.implementation;

import java.util.List;
import com.microsoft.azure.management.network.v2019_02_01.ConnectivityHop;
import com.microsoft.azure.management.network.v2019_02_01.ConnectionStatus;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Information on the connectivity status.
 */
public class ConnectivityInformationInner {
    /**
     * List of hops between the source and the destination.
     */
    @JsonProperty(value = "hops", access = JsonProperty.Access.WRITE_ONLY)
    private List<ConnectivityHop> hops;

    /**
     * The connection status. Possible values include: 'Unknown', 'Connected',
     * 'Disconnected', 'Degraded'.
     */
    @JsonProperty(value = "connectionStatus", access = JsonProperty.Access.WRITE_ONLY)
    private ConnectionStatus connectionStatus;

    /**
     * Average latency in milliseconds.
     */
    @JsonProperty(value = "avgLatencyInMs", access = JsonProperty.Access.WRITE_ONLY)
    private Integer avgLatencyInMs;

    /**
     * Minimum latency in milliseconds.
     */
    @JsonProperty(value = "minLatencyInMs", access = JsonProperty.Access.WRITE_ONLY)
    private Integer minLatencyInMs;

    /**
     * Maximum latency in milliseconds.
     */
    @JsonProperty(value = "maxLatencyInMs", access = JsonProperty.Access.WRITE_ONLY)
    private Integer maxLatencyInMs;

    /**
     * Total number of probes sent.
     */
    @JsonProperty(value = "probesSent", access = JsonProperty.Access.WRITE_ONLY)
    private Integer probesSent;

    /**
     * Number of failed probes.
     */
    @JsonProperty(value = "probesFailed", access = JsonProperty.Access.WRITE_ONLY)
    private Integer probesFailed;

    /**
     * Get list of hops between the source and the destination.
     *
     * @return the hops value
     */
    public List<ConnectivityHop> hops() {
        return this.hops;
    }

    /**
     * Get the connection status. Possible values include: 'Unknown', 'Connected', 'Disconnected', 'Degraded'.
     *
     * @return the connectionStatus value
     */
    public ConnectionStatus connectionStatus() {
        return this.connectionStatus;
    }

    /**
     * Get average latency in milliseconds.
     *
     * @return the avgLatencyInMs value
     */
    public Integer avgLatencyInMs() {
        return this.avgLatencyInMs;
    }

    /**
     * Get minimum latency in milliseconds.
     *
     * @return the minLatencyInMs value
     */
    public Integer minLatencyInMs() {
        return this.minLatencyInMs;
    }

    /**
     * Get maximum latency in milliseconds.
     *
     * @return the maxLatencyInMs value
     */
    public Integer maxLatencyInMs() {
        return this.maxLatencyInMs;
    }

    /**
     * Get total number of probes sent.
     *
     * @return the probesSent value
     */
    public Integer probesSent() {
        return this.probesSent;
    }

    /**
     * Get number of failed probes.
     *
     * @return the probesFailed value
     */
    public Integer probesFailed() {
        return this.probesFailed;
    }

}

redpajama_set_name: RedPajamaGithub


text:
/*****************************************************************************************
 * File: IND_Entity2d.h
 * Desc: Entity 2d object
 *****************************************************************************************/

/*********************************** The zlib License ************************************
 *
 * Copyright (c) 2013 Indielib-crossplatform Development Team
 *
 * This software is provided 'as-is', without any express or implied
 * warranty. In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 * claim that you wrote the original software. If you use this software
 * in a product, an acknowledgment in the product documentation would be
 * appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and must not be
 * misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source
 * distribution.
 *
 *****************************************************************************************/

#ifndef _IND_ENTITY2D_
#define _IND_ENTITY2D_

// ----- Includes -----

#include "Defines.h"
#include <list>
#include "IND_Object.h"

// ----- Forward declarations -----

class CollisionParser;
class IND_Animation;
class IND_Surface;
class IND_Font;

// --------------------------------------------------------------------------------
//									 IND_Entity2d
// --------------------------------------------------------------------------------

/**
@defgroup IND_Entity2d IND_Entity2d
@ingroup EntityManagers
2d entity class managed by IND_Entity2dManager for drawing graphical objects into the screen and manipulating their attributes, click in ::IND_Entity2d to see all the methods of this class.
*/
/**@{*/

/**
@b IND_Entity2d is an 2d entity object of the class ::IND_Entity2dManager. This class, together with ::IND_Entity3d (object
of ::IND_Entity3dManager), are the most important classes of IndieLib.

An entity is an object that can have a graphical object associated to it. Using the methods of this class you will be able to change
the attributes of the graphical object that it contains.

For example, in a game, a bullet can be a ::IND_Entity2d that has a ::IND_Surface associated to it. You can have as many bullets
(::IND_Entity2d objects) in the screen as you want, all of them sharing the same IND_Surface (the sprite). In system memory
you will have only one 3d mesh loaded, the rest will be instances. The cool thing is that you can
change the attributes of each of these different ::IND_Entity2d objects. For example, you can change the size, rotation, color or transparency
of the bullets. So, having only one sprite, you can have lot of different bullets in the screen, with different sizes, colors, positions, etc.

IND_Entity2d can have so many different graphical objects associated to it:
- Surfaces (Sprites, scrolls, images, etc)
- Animations
- Fonts
- Primitives (lines, rectangles, circles, polys, etc)
*/
class LIB_EXP IND_Entity2d : public IND_Object {
public:

	// ----- Init -----

    static IND_Entity2d* newEntity2d();

    void destroy();

	// ----- Public sets ------

	/** @name Graphical objects assignation to the 2d entity
	*
	*/
	/**@{*/
	void    setSurface(IND_Surface *pNewSurface);
	void    setAnimation(IND_Animation *pNewAnimation);
	void    setPrimitive2d(IND_Primitive2d pPri2d);
	void    setFont(IND_Font *pFont);
	/**@}*/

	/** @name Showing
	*
	*/
	/**@{*/
	void    setShow(bool pShow);
	/**@}*/

	/** @name Animations
	*
	*/
	/**@{*/
	void    setSequence(unsigned int pSequence);
	void    setNumReplays(int pNumReplays);
	/**@}*/

	/** @name Primitives
	*
	*/
	/**@{*/
	void    setLine(int pX1, int pY1, int pX2, int pY2);
	void    setRectangle(int pX1, int pY1, int pX2, int pY2);
	void    setRadius(int pRadius);
	void    setNumSides(int pNumSides);
	void    setPolyAngle(float pPolyAngle);
	void    setPolyPoints(IND_Point *pPolyPoints);
	void    setNumLines(int pNumLines);
	/**@}*/

	/** @name Fonts
	*
	*/
	/**@{*/
	void    setAlign(IND_Align pAlign);
	void    setCharSpacing(int pCharSpacing);
	void    setLineSpacing(int pLineSpacing);
	void    setText(const char *pText);
	/**@}*/

	/** @name Space transformations (Some of these methods dont affect the fonts or the primitives)
	*
	*/
	/**@{*/
	void    setPosition(float pX, float pY, int pZ);
	void    setAngleXYZ(float pAnX, float pAnY, float pAnZ);
	void    setScale(float pSx, float pSy);
	void    setMirrorX(bool pMx);
	void    setMirrorY(bool pMy);
	void    setFilter(IND_Filter pF);
	bool    setHotSpot(float pX, float pY);
	bool    setRegion(int pOffX, int pOffY, int pRegionWidth, int pRegionHeight);
	bool    toggleWrap(bool pWrap);
	void    setWrapOffset(float pUOffset, float pVOffset);
	void    setLayer(int pLayer);
	/**@}*/

	/** @name Color transformations, blending and back face culling (Some of these methods dont affect the fonts or the primitives)
	*
	*/
	/**@{*/
	void    setBackCull(bool pCull);
	void    setTint(unsigned char pR, unsigned char pG, unsigned char pB);
	void    setTransparency(unsigned char pA);
	void    setFade(unsigned char pR, unsigned char pG, unsigned char pB, unsigned char pA);
	void    setBlendSource(IND_BlendingType pSo);
	void    setBlendDest(IND_BlendingType pDs);
	/**@}*/

	/** @name Collisions
	*
	*/
	/**@{*/
	bool setBoundingAreas(const char *pFile);
	bool setBoundingTriangle(const char *pId, int pAx, int pAy, int pBx, int pBy, int pCx, int pCy);
	bool setBoundingCircle(const char *pId, int pOffsetX, int pOffsetY, int pRadius);
	bool setBoundingRectangle(const char *pId, int pOffsetX, int pOffsetY, int pWidth, int pHeight);
	bool deleteBoundingAreas(const char *pId);
	void showCollisionAreas(bool pShowCollisionAreas);
	void showGridAreas(bool pShowGridAreas);
	/**@}*/

	// ----- Public Gets ------

	/** @name Gets
	*
	*/
	/**@{*/

	//! A unique id assigned for this entity instance.
    unsigned int getId() {
        return _id;
    }

    //! If the entity has a surface assigned, it returns a pointer to this surface.
	IND_Surface     *getSurface()      {
		return _su;
	}
	//! If the entity has a animation assigned, it returns a pointer to this animation.
	IND_Animation   *getAnimation()      {
		return _an;
	}
	//! Returns true if the entity is being showed, false if not
	bool    isShow()      {
		return _show;
	}
	//! Returns the sequence number that has been assigned to the animation.
	int     getSequence()      {
		return _sequence;
	}
	//! Returns the number of repetitions the animation has to do. If this value is equal or less than zero, it indicates that the amination is looping.
	int     getNumReplays()      {
		return _numReplays;
	}
	//! Returns X position of the entity.
	float   getPosX()      {
		return _x;
	}
	//! Returns Y position of the entity.
	float   getPosY()      {
		return _y;
	}
	//! Returns Z position of the entity.
	int     getPosZ()      {
		return _z;
	}
	//! Returns the angle in the X axis of the entity.
	float   getAngleX()      {
		return _angleX;
	}
	//! Returns the angle in the Y axis of the entity.
	float   getAngleY()      {
		return _angleY;
	}
	//! Returns the angle in the Z axis of the entity.
	float   getAngleZ()      {
		return _angleZ;
	}
	//! Returns the X scale of the entity.
	float   getScaleX()      {
		return _scaleX;
	}
	//! Returns the Y scale of the entity.
	float   getScaleY()      {
		return _scaleY;
	}
	//! Indicate if the entity is making backface culling 0 = No, 1 = Yes.
	bool    getBackCull()      {
		return _cull;
	}
	//!Indicate if the entity makes horizontal mirror. 0 = No, 1 = Yes.
	bool    getMirrorX()      {
		return _mirrorX;
	}
	//! Indicate if the entity makes vertical mirror. 0 = No, 1 = Yes.
	bool    getMirrorY()      {
		return _mirrorY;
	}
	//! Returns the type of filter ::IND_Filter which uses the graphical object assignated to the entity.
	IND_Filter  getFilter()      {
		return _filter;
	}
	//! Returns the type ::IND_Type which uses the graphical object assignated to the entity.
	IND_Type    getType();
	//! Returns the tint level in the R (red) channel of the entity.
	unsigned char    getTintR()      {
		return _r;
	}
	//! Returns the tint level in the G (green) channel of the entity.
	unsigned char    getTintG()      {
		return _g;
	}
	//! Returns the tint level in the B (blue) channel of the entity.
	unsigned char    getTintB()      {
		return _b;
	}
	//! Returns the transparency level of the entity
	unsigned char    getTransparency()      {
		return _a;
	}
	//! Returns the fade level in R (red) channel of the entity.
	unsigned char    getFadeR()      {
		return _fadeR;
	}
	//! Returns the fade level in G (green) channel of the entity.
	unsigned char    getFadeG()      {
		return _fadeG;
	}
	//! Returns the fade level in B (blue) channel of the entity.
	unsigned char    getFadeB()      {
		return _fadeB;
	}
	//! Returns the fade level of the entity.
	unsigned char    getFadeA()      {
		return _fadeA;
	}
	//! Returns the blending type ::IND_BlendingType for the source
	IND_BlendingType    getBlendSource()      {
		return _so;
	}
	//! Returns the blending type ::IND_BlendingType for the destination
	IND_BlendingType    getDestSource()      {
		return _ds;
	}
	//! Returns the assigned layer of the entity
	int     getLayer()      {
		return _layer;
	}
	//! Returns the X HotSpot of the entity.
	float   getHotSpotX()      {
		return _hotSpotX;
	}
	//! Returns the Y HotSpot of the entity.
	float   getHotSpotY()      {
		return _hotSpotY;
	}
	//! Returns the X position of the upper left corner of the region assigned to the entity by IND_Entity2d::setRegion()
	int     getRegionX()      {
		return _offX;
	}
	//! Returns the Y position of the upper left corner of the region assigned to the entity by IND_Entity2d::setRegion()
	int     getRegionY()      {
		return _offY;
	}
	//! Returns the width of the region assignated to the entity by IND_Entity2d::setRegion()
	int     getRegionWidth()      {
		return _regionWidth;
	}
	//! Returns the height of the region assignated to the entity by IND_Entity2d::setRegion()
	int     getRegionHeight()      {
		return _regionHeight;
	}
	//! Returns the position 1 (true) if the image is being repeated in the X,Y axis
	bool    ifWrap()          {
		return _wrap;
	}
	//! Returns the position in x from the first point of a primitive line.
	int     getLineX1()      {
		return _x1;
	}
	//! Returns the position in y from the first point of a primitive line.
	int     getLineY1()      {
		return _y1;
	}
	//! Returns the position in x from the second point of a primitive line.
	int     getLineX2()      {
		return _x2;
	}
	//! Returns the position in y from the second point of a primitive line.
	int     getLineY2()      {
		return _y2;
	}
	//! Returns the radius of the primitives  ::IND_REGULAR_POLY
	int     getRadius()      {
		return _radius;
	}
	//! Returns the numbers of sides of the primitive ::IND_REGULAR_POLY
	int     getNumSides()      {
		return _numSides;
	}
	//! Returns the primitive angle ::IND_REGULAR_POLY
	float   getPolyAngle()      {
		return _polyAngle;
	}
	//!  Returns the  points array which draw the primitive ::IND_POLY2D
	IND_Point *getPolyPoints()      {
		return _polyPoints;
	}
	//! Returns the number of lines which draw the primitive ::IND_POLY2D
	int     getNumLines()      {
		return _numLines;
	}
	//! Returns the align ::IND_Align of the text
	IND_Align getAlign()      {
		return _align;
	}
	//! Returns the additional space between characters when using IND_Font
	int     getCharSpacing()      {
		return _charSpacing;
	}
	//!  Returns the line spacing between lines when using IND_Font
	int     getLineSpacing()      {
		return _lineSpacing;
	}
	//! Returns the text string of the entity
	char    *getText()      {
		return _text;
	}
	//! Returs true if the collision areas are being shown
	bool    isShowCollisionAreas()      {
		return _showCollisionAreas;
	}
	//! Returs true if the grid areas are being shown
	bool    isShowGridAreas()              {
		return _showGridAreas;
	}
	/**@}*/

private:

	/** @cond DOCUMENT_PRIVATEAPI */

	// ----- Private ------

	IND_Entity2d();
	virtual ~IND_Entity2d();

	// ----- Objects -----

	CollisionParser *_collisionParser;

	// ----- Entity attributes -----

	IND_Surface     *_su;   // Pointer to a surface
	IND_Animation   *_an;   // Pointer to an animation
	IND_Primitive2d _pri2d; // Primitive type
	IND_Font        *_font; // Fonts

	// Show
	bool _show;             // Flag for showing / hiding the entity

	// Space transformation attributes
	bool _updateTransFlag;  // Flag for knowing when to recalculate the transformation matrix of an entity
	float _x;               // x Coordinate
	float _y;               // y Coordinate
	int _z;                 // Depth (indicates which object will be blitted upon which other)
	float _angleX;          // Angle in the x axis
	float _angleY;          // Angle in the y axis
	float _angleZ;          // Angle in the z axis
	float _scaleX;          // Horizontal scaling
	float _scaleY;          // Vertical scaling
	bool _cull;             // Back Face Culling ON / OFF
	float _hotSpotX;        // Hotspot x
	float _hotSpotY;        // Hotspot y
	int _axisCalX;          // Horizontal hotspot precalculated
	int _axisCalY;          // Vertical hotspot precalculated
	bool _mirrorX;          // Horizontal mirroring
	bool _mirrorY;          // Vertical mirroring
	IND_Filter _filter;     // Filter type (0 = Nearest Point || 1 = Linear)
	IND_Matrix  _mat;       // World matrix

	// Color, transperency and fading attribute
	unsigned char _r;                // R component for tinting
	unsigned char _g;                // G component for tinting
	unsigned char _b;                // B component for tinting
	unsigned char _a;                // Transparency
	unsigned char _fadeR;            // R component for the fade to color
	unsigned char _fadeG;            // G component for the fade to color
	unsigned char _fadeB;            // B component for the fade to color
	unsigned char _fadeA;            // Amount of fade
	IND_BlendingType _so;   // Blending source
	IND_BlendingType _ds;   // Blending destination

	// Region
	int _offX;              // x coordinate
	int _offY;              // y coordinate
	int _regionWidth;       // Witdh
	int _regionHeight;      // Height

	// Tiling
	bool _wrap;             // Wrapping
	float _uOffset;       // U Coordinate displacement
	float _vOffset;       // V Coordinate displacement

	// Animation attributes
	unsigned int _sequence;          // Index of the sequence
	int _numReplays;        // Num of replays of the sequence
	int _firstTime;         // Flag

	// 2d primitive attributes
	int _x1, _y1, _x2, _y2; // Line
	int _radius;            // Radius
	IND_Point *_polyPoints; // Point list
	int _numLines;          // Number of sides of the polygon
	int _numSides;          // Number of sides of the regular polygon
	float _polyAngle;       // Regular polygon angle

	// Fonts attributes
	IND_Align _align;       // Font align
	int _charSpacing;       // Additional space between letters
	int _lineSpacing;       // Space between lines
	char *_text;            // Text

	// Collision attributes
	bool _showCollisionAreas;

	// Grid areas attributes
	bool _showGridAreas;

	// Collision list for surfaces (the collision list for animations is in IND_AnimationManager.h)
	list <BOUNDING_COLLISION *> *_listBoundingCollision; // Vector of bounding areas for collision checking

	int _layer;

    unsigned int _id;

	// ----- Private methods -----

	void    initAttrib();

	// ----- Friends -----

	friend class IND_Entity2dManager;

    /** @endcond */
};
/**@}*/

#endif // _IND_ENTITY2D_


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 Package org.apache.lucene.benchmark.byTask.tasks (Lucene 6.0.1 API)</title>
<meta name="date" content="2016-05-23">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
org.apache.lucene.benchmark.byTask.tasks

Packages that use org.apache.lucene.benchmark.byTask.tasks

Package
Description

org.apache.lucene.benchmark.byTask

Benchmarking Lucene By Tasks

org.apache.lucene.benchmark.byTask.stats

Statistics maintained when running benchmark tasks.

org.apache.lucene.benchmark.byTask.tasks

Extendable benchmark tasks.

org.apache.lucene.benchmark.byTask.utils

Utilities used for the benchmark, and for the reports.

Classes in org.apache.lucene.benchmark.byTask.tasks used by org.apache.lucene.benchmark.byTask

Class and Description

ReadTask

Read index (abstract) task.

Classes in org.apache.lucene.benchmark.byTask.tasks used by org.apache.lucene.benchmark.byTask.stats

Class and Description

PerfTask

An abstract task to be tested for performance.

Classes in org.apache.lucene.benchmark.byTask.tasks used by org.apache.lucene.benchmark.byTask.tasks

Class and Description

AddDocTask

Add a document, optionally of a certain size.

BenchmarkHighlighter

Abstract class for benchmarking highlighting performance

NewCollationAnalyzerTask.Implementation

Different Collation implementations: currently
 limited to what is provided in the JDK and ICU.

PerfTask

An abstract task to be tested for performance.

ReadTask

Read index (abstract) task.

ReportTask

Report (abstract) task - all report tasks extend this task.

RepSumByPrefTask

Report by-name-prefix statistics aggregated by name.

ResetInputsTask

Reset inputs so that the test run would behave, input wise,
 as if it just started.

ResetSystemSoftTask

Reset all index and input data and call gc, does NOT erase index/dir, does NOT clear statistics.

SearchTask

Search task.

SearchTravTask

Search and Traverse task.

TaskSequence

Sequence of parallel or sequential tasks.

WriteLineDocTask

A task which writes documents, one line per document.

Classes in org.apache.lucene.benchmark.byTask.tasks used by org.apache.lucene.benchmark.byTask.utils

Class and Description

PerfTask

An abstract task to be tested for performance.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Help

Prev

Next

Frames

No Frames

All Classes

          Copyright © 2000-2016 Apache Software Foundation.  All Rights Reserved.


text:
ENV['APP_ENV'] = 'test'

require 'rubygems'

require 'test/unit'
require 'rack/test'
require File.join(File.dirname(__FILE__), '..', 'evoke')

require 'ostruct'
require 'shoulda'
require 'shoulda/active_record'
require 'mocha'
require File.join(File.dirname(__FILE__), 'model_factory')

require 'chicago/shoulda'
require_local_lib('../test/shoulda')

class Test::Unit::TestCase
  include Rack::Test::Methods

  alias_method :old_run, :run
  def run(*args, &block)
    exception_thrown = false
    ActiveRecord::Base.transaction do
      exception_thrown = false
      begin
        old_run(*args, &block)
      rescue Exception => e
        exception_thrown = true
        raise e
      ensure
        raise ActiveRecord::Rollback unless exception_thrown
      end
    end
  end
end


text:
package com.bluespacetech.security.dao;

import java.io.Serializable;
import java.util.Collection;

public class UserDAO implements Serializable {

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

	private String loggedInUserName;

	private String userType;

	private Collection<String> roles;

	private Collection<String> uiRoles;

	/**
	 * @return the loggedInUserName
	 */
	public String getLoggedInUserName() {
		return loggedInUserName;
	}

	/**
	 * @param loggedInUserName
	 *            the loggedInUserName to set
	 */
	public void setLoggedInUserName(String loggedInUserName) {
		this.loggedInUserName = loggedInUserName;
	}

	/**
	 * @return the roles
	 */
	public Collection<String> getRoles() {
		return roles;
	}

	/**
	 * @param roles
	 *            the roles to set
	 */
	public void setRoles(Collection<String> roles) {
		this.roles = roles;
	}

	/**
	 * @return the uiRoles
	 */
	public Collection<String> getUiRoles() {
		return uiRoles;
	}

	/**
	 * @param uiRoles
	 *            the uiRoles to set
	 */
	public void setUiRoles(Collection<String> uiRoles) {
		this.uiRoles = uiRoles;
	}

	/**
	 * @return the userType
	 */
	public String getUserType() {
		return userType;
	}

	/**
	 * @param userType
	 *            the userType to set
	 */
	public void setUserType(String userType) {
		this.userType = userType;
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<MachineLearner>
	<!-- JNDI name of the data source to be used by the Machine Learner. This
		data source should be defined in the master-datasources.xml file in conf/datasources
		directory. -->
	<DataSourceName>jdbc/WSO2ML_DB</DataSourceName>

	<!-- Configurations to calculate summary statistics from a dataset. histogramBins
		: Number of intervals in a histogram. categoricalThreshold : threshold to
		determine whether a given feature is categorical or numerical based on the
		skewness of the distribution. sampleSize : Size of the dataset sample which
		will be used for summary statistics calculation and visualization. -->
	<SummaryStatisticsSettings>
		<HistogramBins>20</HistogramBins>
		<CategoricalThreshold>80</CategoricalThreshold>
		<SampleSize>10000</SampleSize>
	</SummaryStatisticsSettings>

	<!-- Properties used by WSO2 ML -->
	<Properties>
		<!-- Defines the size of the thread pool used in WSO2 ML. -->
		<Property name="ml.thread.pool.size" value="100" />
		<!-- Defines the size of the blocked queue used by the thread pool of WSO2 ML. -->
		<Property name="ml.thread.pool.queue.size" value="1000" />
		<!-- Fully qualified name of the file input adapter to be used. -->
		<Property name="file.in"
				  value="org.wso2.carbon.ml.core.impl.FileInputAdapter" />
		<!-- Fully qualified name of the file output adapter to be used. -->
		<Property name="file.out"
				  value="org.wso2.carbon.ml.core.impl.FileOutputAdapter" />
		<!-- Fully qualified name of the HDFS input adapter to be used. -->
		<Property name="hdfs.in"
				  value="org.wso2.carbon.ml.core.impl.HdfsInputAdapter" />
		<!-- Fully qualified name of the HDFS output adapter to be used. -->
		<Property name="hdfs.out"
				  value="org.wso2.carbon.ml.core.impl.HdfsOutputAdapter" />
		<!-- Fully qualified name of the Registry input adapter to be used. -->
		<Property name="registry.in"
				  value="org.wso2.carbon.ml.core.impl.RegistryInputAdapter" />
		<!-- Fully qualified name of the Registry output adapter to be used. -->
		<Property name="registry.out"
				  value="org.wso2.carbon.ml.core.impl.RegistryOutputAdapter" />
	</Properties>

	<!-- Comma separated set of email addresses to which the model building status mails are sent. -->
	<EmailNotificationEndpoint></EmailNotificationEndpoint>

	<!-- Governance Registry location where ML models are published. -->
	<ModelRegistryLocation>ml</ModelRegistryLocation>

	<!-- Optional element. This element should point to a HDFS location where
		ML is allowed to store files. -->
	<HdfsURL>hdfs://localhost:9000</HdfsURL>

	<!-- Storage Details for uploaded datasets. StorageType can be either "file"
		or "hdfs". Default storage type is file and location is {carbon.home}/datasets -->
	<!-- DatasetStorage>
		<StorageType>file</StorageType>
		<StorageDirectory>/tmp</StorageDirectory>
	</DatasetStorage -->

	<!-- Storage Details for built ML Models. StorageType can be either "file"
		or "hdfs". Default storage type is file and location is {carbon.home}/models -->
	<!-- ModelStorage>
		<StorageType>file</StorageType>
		<StorageDirectory>/tmp</StorageDirectory>
	</ModelStorage -->

	<!-- Lists all supported machine learning algorithms. -->
	<Algorithms>
		<Algorithm>
			<Name>LINEAR_REGRESSION</Name>
			<Type>Numerical_Prediction</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Iterations</Name>
				<Value>100</Value>
				<Description>Number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Learning_Rate</Name>
				<Value>0.001</Value>
				<Description>Step size of the optimization algorithm. This parameter
					value should be between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
			<Parameters>
				<Name>SGD_Data_Fraction</Name>
				<Value>1</Value>
				<Description>Fraction of the training dataset used per iteration
					in the optimization algorithm. This parameter value should be
					between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>RIDGE_REGRESSION</Name>
			<Type>Numerical_Prediction</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Iterations</Name>
				<Value>100</Value>
				<Description>Number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Learning_Rate</Name>
				<Value>0.001</Value>
				<Description>Step size of the optimization algorithm. This parameter
					value should be between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Reg_Parameter</Name>
				<Value>0.001</Value>
				<Description>The regularization parameter (also lambda) reduces overfitting
					which reduces the variance of your estimated regression parameters. It
					does this at the expense of adding bias to your estimate. Increasing
					this value results less overfitting but also greater bias. This parameter
					value should be a non-negative real number (0 inclusive).
				</Description>
			</Parameters>
			<Parameters>
				<Name>SGD_Data_Fraction</Name>
				<Value>1</Value>
				<Description>Fraction of the training dataset used per iteration
					in the optimization algorithm. This parameter value should be
					between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>LASSO_REGRESSION</Name>
			<Type>Numerical_Prediction</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Iterations</Name>
				<Value>100</Value>
				<Description>Number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Learning_Rate</Name>
				<Value>0.001</Value>
				<Description>Step size of the optimization algorithm. This parameter
					value should be between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Reg_Parameter</Name>
				<Value>0.001</Value>
				<Description>The regularization parameter (also lambda) reduces overfitting
					which reduces the variance of your estimated regression parameters. It
					does this at the expense of adding bias to your estimate. Increasing
					this value results less overfitting but also greater bias. This parameter
					value should be a non-negative real number (0 inclusive).
				</Description>
			</Parameters>
			<Parameters>
				<Name>SGD_Data_Fraction</Name>
				<Value>1</Value>
				<Description>Fraction of the training dataset used per iteration
					in the optimization algorithm. This parameter value should be
					between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>RANDOM_FOREST_REGRESSION</Name>
			<Type>Numerical_Prediction</Type>
			<isPMMLExportable>false</isPMMLExportable>
			<Parameters>
				<Name>Num_Trees</Name>
				<Value>5</Value>
				<Description>Number of trees in the random forest. Increasing the
					number of trees will decrease the variance in predictions,
					improving the model's test-time accuracy. Also training time
					increases roughly linearly in the number of trees. This parameter
					value should be an integer greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Max_Depth</Name>
				<Value>5</Value>
				<Description>Maximum depth of the tree. This helps you to control
					the size of the tree to prevent overfitting. This parameter
					value should be an integer greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Max_Bins</Name>
				<Value>100</Value>
				<Description>Number of bins used when discretizing continuous
					features. This must be at least the maximum number of categories M
					for any categorical feature. Increasing this allows the algorithm
					to consider more split candidates and make fine-grained split
					decisions. However, it also increases computation and
					communication. This parameter value should be an integer greater
					than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Impurity</Name>
				<Value>variance</Value>
				<Description>Impurity is a measure of the homogeneity of
					the labels at the node. This parameter value should be 'variance'.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Feature_Subset_Strategy</Name>
				<Value>auto</Value>
				<Description>Number of features to use as candidates for splitting
					at each tree node. The number is specified as a fraction or
					function of the total number of features. Decreasing this number
					will speed up training, but can sometimes impact performance if too
					low. This parameter value can take values 'auto', 'all', 'sqrt',
					'log2' and 'onethird' (without quotes).
				</Description>
			</Parameters>
			<Parameters>
				<Name>Seed</Name>
				<Value>12345</Value>
				<Description>Seed for the random number generator.</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>LOGISTIC_REGRESSION</Name>
			<Type>Classification</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Iterations</Name>
				<Value>100</Value>
				<Description>Number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Learning_Rate</Name>
				<Value>0.1</Value>
				<Description>Step size of the optimization algorithm. This parameter
					value should be between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Reg_Type</Name>
				<Value>L2</Value>
				<Description>Type of the regularization. This parameter value
					should be either 'L1' or 'L2' (without quotes).
				</Description>
			</Parameters>
			<Parameters>
				<Name>Reg_Parameter</Name>
				<Value>0.001</Value>
				<Description>The regularization parameter (also lambda) reduces overfitting
					which reduces the variance of your estimated regression parameters. It
					does this at the expense of adding bias to your estimate. Increasing
					this value results less overfitting but also greater bias. This parameter
					value should be a non-negative real number (0 inclusive).
				</Description>
			</Parameters>
			<Parameters>
				<Name>SGD_Data_Fraction</Name>
				<Value>1</Value>
				<Description>Fraction of the training dataset used per iteration
					in the optimization algorithm. This parameter value should be
					between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>LOGISTIC_REGRESSION_LBFGS</Name>
			<Type>Classification</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Reg_Type</Name>
				<Value>L2</Value>
				<Description>Type of the regularization. This parameter value
					should be either 'L1' or 'L2' (without quotes).
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>SVM</Name>
			<Type>Classification</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Iterations</Name>
				<Value>100</Value>
				<Description>Number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Learning_Rate</Name>
				<Value>0.001</Value>
				<Description>Step size of the optimization algorithm. This parameter
					value should be between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Reg_Type</Name>
				<Value>L1</Value>
				<Description>Type of the regularization. This parameter value
					should be either 'L1' or 'L2' (without quotes).
				</Description>
			</Parameters>
			<Parameters>
				<Name>Reg_Parameter</Name>
				<Value>0.001</Value>
				<Description>The regularization parameter (also lambda) reduces overfitting
					which reduces the variance of your estimated regression parameters. It
					does this at the expense of adding bias to your estimate. Increasing
					this value results less overfitting but also greater bias. This parameter
					value should be a non-negative real number (0 inclusive).
				</Description>
			</Parameters>
			<Parameters>
				<Name>SGD_Data_Fraction</Name>
				<Value>1</Value>
				<Description>Fraction of the training dataset used per iteration
					in the optimization algorithm. This parameter value should be
					between 0 and 1, 1 inclusive.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>DECISION_TREE</Name>
			<Type>Classification</Type>
			<isPMMLExportable>false</isPMMLExportable>
			<Parameters>
				<Name>Max_Depth</Name>
				<Value>5</Value>
				<Description>Maximum depth of the tree. This helps you to control
					the size of the tree to prevent overfitting. This parameter
					value should be an integer greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Max_Bins</Name>
				<Value>100</Value>
				<Description>Number of bins used when discretizing continuous
					features. This must be at least the maximum number of categories M
					for any categorical feature. Increasing this allows the algorithm
					to consider more split candidates and make fine-grained split
					decisions. However, it also increases computation and
					communication. This parameter value should be an integer greater
					than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Impurity</Name>
				<Value>gini</Value>
				<Description>Impurity is a measure of the homogeneity of
					the labels at the node. This parameter value should be either 'gini'
					or 'entropy' (without quotes).
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>RANDOM_FOREST_CLASSIFICATION</Name>
			<Type>Classification</Type>
			<isPMMLExportable>false</isPMMLExportable>
			<Parameters>
				<Name>Num_Trees</Name>
				<Value>5</Value>
				<Description>Number of trees in the random forest. Increasing the
					number of trees will decrease the variance in predictions,
					improving the model's test-time accuracy. Also training time
					increases roughly linearly in the number of trees. This parameter
					value should be an integer greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Max_Depth</Name>
				<Value>5</Value>
				<Description>Maximum depth of the tree. This helps you to control
					the size of the tree to prevent overfitting. This parameter
					value should be an integer greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Max_Bins</Name>
				<Value>100</Value>
				<Description>Number of bins used when discretizing continuous
					features. This must be at least the maximum number of categories M
					for any categorical feature. Increasing this allows the algorithm
					to consider more split candidates and make fine-grained split
					decisions. However, it also increases computation and
					communication. This parameter value should be an integer greater
					than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Impurity</Name>
				<Value>gini</Value>
				<Description>Impurity is a measure of the homogeneity of
					the labels at the node. This parameter value should be either 'gini'
					or 'entropy' (without quotes).
				</Description>
			</Parameters>
			<Parameters>
				<Name>Feature_Subset_Strategy</Name>
				<Value>auto</Value>
				<Description>Number of features to use as candidates for splitting
					at each tree node. The number is specified as a fraction or
					function of the total number of features. Decreasing this number
					will speed up training, but can sometimes impact performance if too
					low. This parameter value can take values 'auto', 'all', 'sqrt',
					'log2' and 'onethird' (without quotes).
				</Description>
			</Parameters>
			<Parameters>
				<Name>Seed</Name>
				<Value>12345</Value>
				<Description>Seed for the random number generator.</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>NAIVE_BAYES</Name>
			<Type>Classification</Type>
			<isPMMLExportable>false</isPMMLExportable>
			<Parameters>
				<Name>Lambda</Name>
				<Value>1</Value>
				<Description>Additive smoothing can be used by setting this
					parameter. This parameter value should be an integer greater
					than 0.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>K_MEANS</Name>
			<Type>Clustering</Type>
			<isPMMLExportable>true</isPMMLExportable>
			<Parameters>
				<Name>Max_Iterations</Name>
				<Value>20</Value>
				<Description>Maximum number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Num_Clusters</Name>
				<Value>3</Value>
				<Description>The number of desired clusters. This value should be
					an integer greater than 0.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>K_MEANS_ANOMALY_DETECTION_WITH_UNLABELED_DATA</Name>
			<Type>Anomaly_Detection</Type>
			<isPMMLExportable>false</isPMMLExportable>
			<Parameters>
				<Name>Max_Iterations</Name>
				<Value>100</Value>
				<Description>Maximum number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Num_of_Normal_Clusters</Name>
				<Value>5</Value>
				<Description>The number of desired normal clusters. This value should be
					an integer greater than 0.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>K_MEANS_ANOMALY_DETECTION_WITH_LABELED_DATA</Name>
			<Type>Anomaly_Detection</Type>
			<isPMMLExportable>false</isPMMLExportable>
			<Parameters>
				<Name>Max_Iterations</Name>
				<Value>100</Value>
				<Description>Maximum number of times optimizer runs before completing the
					optimization process. This parameter value should be an integer
					greater than 0.
				</Description>
			</Parameters>
			<Parameters>
				<Name>Num_of_Normal_Clusters</Name>
				<Value>5</Value>
				<Description>The number of desired normal clusters. This value should be
					an integer greater than 0.
				</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>COLLABORATIVE_FILTERING</Name>
			<Type>Recommendation</Type>
			<Parameters>
				<Name>Rank</Name>
				<Value>8</Value>
				<Description>The number of latent factors in the model.</Description>
			</Parameters>
			<Parameters>
				<Name>Iterations</Name>
				<Value>20</Value>
				<Description>Number of iterations of ALS.</Description>
			</Parameters>
			<Parameters>
				<Name>Lambda</Name>
				<Value>0.01</Value>
				<Description>Regularization parameter in ALS.</Description>
			</Parameters>
			<Parameters>
				<Name>Blocks</Name>
				<Value>-1</Value>
				<Description>Level of Parallelism to split computation into. Set to -1 to auto-configure.</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>COLLABORATIVE_FILTERING_IMPLICIT</Name>
			<Type>Recommendation</Type>
			<Parameters>
				<Name>Rank</Name>
				<Value>8</Value>
				<Description>The number of latent factors in the model.</Description>
			</Parameters>
			<Parameters>
				<Name>Iterations</Name>
				<Value>20</Value>
				<Description>Number of iterations of ALS.</Description>
			</Parameters>
			<Parameters>
				<Name>Lambda</Name>
				<Value>0.01</Value>
				<Description>Regularization parameter in ALS.</Description>
			</Parameters>
			<Parameters>
				<Name>Blocks</Name>
				<Value>-1</Value>
				<Description>Level of Parallelism to split computation into. Set to -1 to auto-configure.</Description>
			</Parameters>
			<Parameters>
				<Name>Alpha</Name>
				<Value>40</Value>
				<Description>Confidence parameter.</Description>
			</Parameters>
			<Parameters>
				<Name>Weights</Name>
				<Value>30,70</Value>
				<Description>Comma separated weights given to fields.</Description>
			</Parameters>
		</Algorithm>
		<Algorithm>
			<Name>STACKED_AUTOENCODERS</Name>
			<Type>Deeplearning</Type>
			<Parameters>
				<Name>Batch_Size</Name>
				<Value>100</Value>
				<Description>Batch Size determines the number of training cases considered
					for each epoch.</Description>
			</Parameters>
			<Parameters>
				<Name>Layer_Sizes</Name>
				<Value>500,500,500</Value>
				<Description>Layer Sizes determines the number of neurons of each layer.
					The first layer is the closest to the inputs and the last is the furthest
					from inputs.This is a comma-separated value.</Description>
			</Parameters>
			<Parameters>
				<Name>Activation_Type</Name>
				<Value>RectifierWithDropout</Value>
				<Description>Activation type is the function used to activate neurons
					when inputs given (i.e. f(W.x + b) where W,b and x are weights and bias and inputs
					respectively). The possible values are, Rectifier, RectifierWithDropout, Tanh, TanhWithDropout,
					Maxout, MaxoutWithDropout (case sensitive)
				</Description>
			</Parameters>
			<Parameters>
				<Name>Epochs</Name>
				<Value>10</Value>
				<Description>Epochs define the number of iterations the network is trained for.
					It is important to have a suitable number of epochs, as a high number can lead
					to over-fitting.</Description>
			</Parameters>
		</Algorithm>
	</Algorithms>
</MachineLearner>


text:
package com.linecorp.armeria.common;

import com.linecorp.armeria.common.stream.FilteredStreamMessage;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufHolder;

/**
 * An {@link HttpResponse} that filters objects as they are published. The filtering
 * will happen from an I/O thread, meaning the order of the filtering will match the
 * order that the {@code delegate} processes the objects in.
 */
public abstract class FilteredHttpResponse
        extends FilteredStreamMessage<HttpObject, HttpObject> implements HttpResponse {

    /**
     * Creates a new {@link FilteredHttpResponse} that filters objects published by {@code delegate}
     * before passing to a subscriber.
     */
    protected FilteredHttpResponse(HttpResponse delegate) {
        super(delegate);
    }

    /**
     * Creates a new {@link FilteredHttpResponse} that filters objects published by {@code delegate}
     * before passing to a subscriber.
     *
     * @param withPooledObjects if {@code true}, {@link FilteredStreamMessage#filter(Object)} receives the
     *                          pooled {@link ByteBuf} and {@link ByteBufHolder} as is, without making a copy.
     *                          If you don't know what this means,
     *                          use {@link #FilteredHttpResponse(HttpResponse)}.
     */
    protected FilteredHttpResponse(HttpResponse delegate, boolean withPooledObjects) {
        super(delegate, withPooledObjects);
    }
}


text:
package consulo.csharp.lang;

import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.TemplateLanguageFileType;
import consulo.csharp.psi.icon.CSharpPsiIconGroup;
import consulo.localize.LocalizeValue;
import consulo.ui.image.Image;

import javax.annotation.Nonnull;

/**
 * @author VISTALL
 * @since 22.11.13.
 */
public class CSharpFileType extends LanguageFileType implements TemplateLanguageFileType
{
	public static final String EXTENSION = "cs";
	public static final String DOT_EXTENSION = "." + EXTENSION;

	public static final CSharpFileType INSTANCE = new CSharpFileType();

	private CSharpFileType()
	{
		super(CSharpLanguage.INSTANCE);
	}

	@Nonnull
	@Override
	public String getId()
	{
		return "C#";
	}

	@Nonnull
	@Override
	public LocalizeValue getDescription()
	{
		return LocalizeValue.localizeTODO("C# files");
	}

	@Nonnull
	@Override
	public String getDefaultExtension()
	{
		return EXTENSION;
	}

	@Nonnull
	@Override
	public Image getIcon()
	{
		return CSharpPsiIconGroup.csharp();
	}
}


text:
package org.kaazing.gateway.service.http.directory;

import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TreeMap;

import org.kaazing.gateway.service.ServiceContext;
import org.kaazing.gateway.transport.IoHandlerAdapter;
import org.kaazing.gateway.transport.http.HttpAcceptSession;
import org.kaazing.gateway.transport.http.HttpHeaders;
import org.kaazing.gateway.transport.http.HttpMethod;
import org.kaazing.gateway.transport.http.HttpStatus;
import org.kaazing.gateway.transport.http.HttpUtils;
import org.kaazing.gateway.util.file.FileUtils;
import org.kaazing.mina.core.buffer.IoBufferAllocatorEx;
import org.kaazing.mina.core.buffer.IoBufferEx;

class HttpDirectoryServiceHandler extends IoHandlerAdapter<HttpAcceptSession> {

    private ServiceContext serviceContext;
    private File baseDir;
    private String welcomeFile;
    private File errorPagesDir;
    private boolean indexes;

    HttpDirectoryServiceHandler() {
    }

    ServiceContext getServiceContext() {
        return serviceContext;
    }

    void setServiceContext(ServiceContext serviceContext) {
        this.serviceContext = serviceContext;
    }

    void setBaseDir(File baseDir) {
        this.baseDir = baseDir;
    }

    File getBaseDir() {
        return baseDir;
    }

    void setWelcomeFile(String welcomeFile) {
        this.welcomeFile = welcomeFile;
    }

    String getWelcomeFile() {
        return welcomeFile;
    }

    void setErrorPagesDir(File errorPagesDir) {
        this.errorPagesDir = errorPagesDir;
    }

    boolean usingIndexes() {
        return indexes;
    }

    void setIndexes(boolean indexes) {
        this.indexes = indexes;
    }

    @Override
    public void doSessionCreated(HttpAcceptSession session) throws Exception {
    	// NOOP no license check needed
    }

    @Override
    public void doSessionClosed(HttpAcceptSession session) throws Exception {
    	// NOOP no license check needed
    }

    @Override
    protected void doExceptionCaught(HttpAcceptSession session, Throwable cause) throws Exception {
        // trigger sessionClosed to update connection capabilities accordingly
        session.close(true);
    }

    @Override
    protected void doSessionOpened(HttpAcceptSession session) throws Exception {
        // Get the method used for this request; if not a GET, refuse the
        // request (KG-1233).
        // (KG-11211) Enabling HEAD method too.
        HttpMethod method = session.getMethod();
        if (method != HttpMethod.GET && method != HttpMethod.HEAD) {
            reportError(session, HttpStatus.CLIENT_METHOD_NOT_ALLOWED);
            session.close(false);
            return;
        }

        // get relative path from service path
        String pathInfo = session.getPathInfo().getPath();

        // construct file reference from configured base directory
        File requestFile = new File(baseDir, "/" + pathInfo);

        // check if this is a directory reference
        if (requestFile.isDirectory()) {
            String requestPath = session.getRequestURI().getPath();

            // redirect to include trailing slash, if not present
            // this is important to resolve relative links correctly
            if (!requestPath.endsWith("/")) {
                session.setStatus(HttpStatus.REDIRECT_FOUND);
                // TODO: add queryString back for redirect
                session.setWriteHeader("Location", requestPath + "/");
                session.close(false);
                return;
            }
        }

        // if file is not under baseDir report an access denied error and close session
        boolean underBaseDir = false;
        File baseDirCannonical = baseDir.getCanonicalFile();
        for (File candidate = requestFile.getCanonicalFile(); candidate != null; candidate = candidate.getParentFile()) {
            if ( candidate.equals(baseDirCannonical) ) {
                underBaseDir = true;
                break;
            }
        }

        if (!underBaseDir) {
            reportError(session, HttpStatus.CLIENT_BAD_REQUEST);
            session.close(false);
            return;
        }

        // Make another check for the file being a directory, return the welcomeFile
        // or a directory listing as appropriate. This is done in a separate set
        // from the redirect to allow bad requests to be detected before possibly
        // generating a directory listing.
        if (requestFile.isDirectory()) {
            boolean generateIndex = usingIndexes();
            if (welcomeFile != null) {
                File testWelcomeFile = new File(requestFile, welcomeFile);

                // If the welcome file exists or the service is not generating
                // directory listings, then set the request file to the welcome
                // file. In the case where directory listings aren't being
                // generated, the Gateway will return a NOT_FOUND for a non-existent
                // welcome file.
                if (testWelcomeFile.exists() || !generateIndex) {
                    requestFile = testWelcomeFile;
                    generateIndex = false;
                }
            }

            // if there is no configured welcome file on the service, or no existing
            // welcome file in the directory then we can generate a listing
            if (generateIndex) {
                session.setWriteHeader("Content-Type", "text/html");
                ByteBuffer nioBuf = DirectoryListingUtils.createDirectoryListing(pathInfo, baseDir, requestFile);
                IoBufferAllocatorEx<?> allocator = session.getBufferAllocator();
                IoBufferEx buf = allocator.wrap(nioBuf);
                session.write(buf);
                session.close(false);
                return;
            }
        }

        // if file does not exist then report error and close session
        if (!requestFile.exists()) {
            reportError(session, HttpStatus.CLIENT_NOT_FOUND);
            session.close(false);
            return;
        }

        // check to see if the file has been modified sense last request
        String etag = HttpUtils.getETagHeaderValue(requestFile);
        boolean modified = HttpUtils.hasBeenModified(session, etag, requestFile);
        if (!modified) {
            // file has not been modified so set status and close session
            session.setWriteHeader("ETag", etag);
            session.setStatus(HttpStatus.REDIRECT_NOT_MODIFIED);
            session.close(false);
            return;
        }

        // add cached content file headers.
        HttpUtils.addLastModifiedHeader(session, requestFile);
        HttpUtils.addExpiresHeader(session);
        session.setWriteHeader("ETag", etag);

        // add the content type, based on file extension.
        String contentType = serviceContext.getContentType(FileUtils.getFileExtension(requestFile));
        if (contentType != null) {
            session.setWriteHeader("Content-Type", contentType);
        }

        // get io buffer for file
        IoBufferAllocatorEx<?> allocator = session.getBufferAllocator();
        IoBufferEx buf = HttpUtils.getBufferForFile(allocator, requestFile);

        // add content length
        session.setWriteHeader(HttpHeaders.HEADER_CONTENT_LENGTH, Integer.toString(buf.remaining()));

        // write buffer and close session
        session.write(buf);
        session.close(false);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("HttpDirectoryServiceHandler [baseDir=").append(baseDir);
        if (welcomeFile != null) {
            sb.append(",welcomeFile=").append(welcomeFile);
        }
        if (errorPagesDir != null) {
            sb.append(",errorPagesDir=").append(errorPagesDir);
        }
        sb.append("]");
        return sb.toString();
    }

    private void reportError(HttpAcceptSession session, HttpStatus status) throws IOException {
        session.setStatus(status);
        if (errorPagesDir != null && errorPagesDir.exists()) {
            String errorFileName = Integer.toString(status.code()) + ".html";
            File errorContentFile = new File(errorPagesDir, errorFileName);
            if (errorContentFile.exists() && errorContentFile.canRead()) {
                IoBufferAllocatorEx<?> allocator = session.getBufferAllocator();
                IoBufferEx buf = HttpUtils.getBufferForFile(allocator, errorContentFile);
                session.setWriteHeader(HttpHeaders.HEADER_CONTENT_LENGTH, Integer.toString(buf.remaining()));
                session.write(buf);
            }
        }

    }

    static class DirectoryListingUtils {
        private static final String[] SIZE_UNITS = new String[] { " bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB" };
        private static final String HEADER_BOILERPLATE = "<!DOCTYPE HTML><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>Directory listing for ";
        private static final String BODY_BOILERPLATE = "</title>
Index of ";
        private static final String TABLE_BOILERPLATE = "

Filename	Size	Last Modified Date

";
        private static final String FOOTER_BOILERPLATE = "

<address>Powered by Kaazing WebSocket Gateway</address>";
        private static final String STYLE_BOILERPLATE = "
";
        private static final DateFormat df = new SimpleDateFormat("dd-MMM-yyyy HH:mm");

        public static ByteBuffer createDirectoryListing(String requestPath, File baseDir, File directory) throws Exception {
            StringBuffer sb = new StringBuffer();
            sb.append(HEADER_BOILERPLATE);

            String pathName = getPathName(baseDir, directory);
            if ("".equals(pathName)) {
                pathName = "/";
            }

            sb.append(pathName);

            sb.append(BODY_BOILERPLATE);
            sb.append(pathName);
            sb.append(STYLE_BOILERPLATE); // there's some static CSS to include in the page, add it now

            sb.append(TABLE_BOILERPLATE);

            if (!"/".equals(pathName)) {
                // add a link to the parent directory
                sb.append("
.. (Parent Directory)	<td
");
            }

            File[] files = sortFiles(directory.listFiles());

            // build the HTML response
            if (files != null) {
                for (File file : files) {
                    sb.append(createDirectoryListRow(file));
                }
            }

            sb.append(FOOTER_BOILERPLATE);
            return ByteBuffer.wrap(sb.toString().getBytes());
        }

        private static File[] sortFiles(File[] unsortedFiles) {
            if ((unsortedFiles == null) || (unsortedFiles.length == 0)) {
                return null;
            }

            TreeMap<String, File> subDirMap = new TreeMap<>();
            TreeMap<String, File> fileMap = new TreeMap<>();

            // When creating a listing, directories are grouped first, then
            // files.  Each group is sorted separately.
            for (File file : unsortedFiles) {
                if (file.isDirectory()) {
                    subDirMap.put(file.getName(), file);
                } else {
                    fileMap.put(file.getName(), file);
                }
            }

            int count = 0;
            File[] sortedFiles = new File[unsortedFiles.length];
            for (String key : subDirMap.keySet()) {
                sortedFiles[count++] = subDirMap.get(key);
            }
            for (String key : fileMap.keySet()) {
                sortedFiles[count++] = fileMap.get(key);
            }

            return sortedFiles;
        }

        private static String createDirectoryListRow(File file) {
            StringBuffer sb = new StringBuffer();
            if (file.isDirectory()) {
                // if it's a directory, append a slash to the name to indicate such, don't show a file size
                sb.append("
" + file.getName() + "/" +
                        "		" + getDateString(file.lastModified())  + "
");
            } else {
                sb.append("
" + file.getName() + "" +
                        "	" + getFileSizeString((double)file.length()) +
                        "	" + getDateString(file.lastModified())  + "
");
            }
            return sb.toString();
        }

        // Return the relative path of the target file in relation to this directory service's
        // base directory.  Since the base directory is the "root" in this case, we just want
        // paths under this root.
        private static String getPathName(File baseDir, File targetFile) throws Exception {
            File canonicalFile = targetFile.getCanonicalFile();
            File baseDirCanonical = baseDir.getCanonicalFile();

            if (canonicalFile.equals(baseDirCanonical)) {
                return "";
            } else {
                return getPathName(baseDirCanonical, canonicalFile.getParentFile()) + "/" + canonicalFile.getName();
            }
        }

        private static String getParentPath(String path) {
            String parentPath = path;
            if (parentPath.endsWith("/")) {
                parentPath = parentPath.substring(0, parentPath.length()-1);
            }

            int lastSlashIndex = parentPath.lastIndexOf("/");
            if (lastSlashIndex != -1) {
                // add 1 to include the last slash which skips a redirect when following the link
                return parentPath.substring(0, lastSlashIndex+1);
            }
            return parentPath;
        }

        // Return a string representation of the given number of bytes.  This makes an attempt to
        // use the largest units possible to display the file size while still having a size greater
        // that 1 in those units.  For example, 400 is displayed at "400 bytes" but 4096 is displayed
        // as "4 KB."
        private static String getFileSizeString(double fileSize) {
            int count = 0;
            while (fileSize > 1024) {
                fileSize = fileSize / 1024;
                count++;
            }

            DecimalFormat format = new DecimalFormat("0.0");
            return format.format(fileSize) + SIZE_UNITS[count];
        }

        private static String getDateString(long timestamp) {
            return df.format(new Date(timestamp));
        }
    }
}


text:
/**
 *
 * Process Editor - inubit IS Converter Importer
 *
 * (C) 2009, 2010 inubit AG
 * (C) 2014 the authors
 *
 */
package com.inubit.research.ISConverter.importer;

import java.util.HashMap;
import java.util.Properties;

import net.frapu.code.visualization.EdgeDocker;
import net.frapu.code.visualization.ProcessEdge;
import net.frapu.code.visualization.ProcessModel;
import net.frapu.code.visualization.ProcessNode;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * abstract class serving as a basis to extend the ISImporter for
 * further diagram types
 * @author ff
 *
 */
public abstract class ISDrawElementExtactor {

	/**
	 * @param node
	 * @return
	 */
	public abstract ProcessNode extractNode(Element node);

	 /**
     * used to simplify finding elements in the "Properties" xml structure
     * @param node
     * @param pNode
     * @param xmlName
     * @param propertyName
     * @param customMappings
     */
    public static void findProperty(Element node, ProcessNode pNode, String xmlName, String propertyName, HashMap<String, String> customMappings) {
        String _prop = getProperty(node, xmlName);
        if(_prop != null) {
	        if (customMappings.containsKey(_prop)) {
	            _prop = customMappings.get(_prop);
	        }
	        pNode.setProperty(propertyName, _prop);
        }
    }

	 /**
     * if the property value cannot be found null is returned
     * @param node
     * @param string
     * @return
     */
    public static String getProperty(Element node, String xmlName) {
        Element e = getPropertyNode(node, xmlName);
        if(e != null) {
            String prop = e.getTextContent();
            return prop;
        }
        return null;
    }

    public static Element getPropertyNode(Element node,String xmlName) {
    	Element node2 = (Element) node.getElementsByTagName("Properties").item(0);
        if (node2 != null) {
            node2 = (Element) node2.getElementsByTagName("Property").item(0);
            return getChildByName(xmlName, node2);
        }
        return null;
    }

	public static Element getChildByName(String name, Element node2) {
		NodeList nodelist = node2.getElementsByTagName("Property");
		for (int j = 0; j < nodelist.getLength(); j++) {
		    if (nodelist.item(j) instanceof Element) {
		        Element e = (Element) nodelist.item(j);
		        if (e.getAttribute("name").equals(name)) {
		            return e;
		        }
		    }
		}
		return null;
	}

	/**
	 * @param node
	 * @param node2
	 */
	public abstract void extractStyleSheet(Element xmlNode, ProcessNode node);

	/**
	 * @param connectionNode
	 * @param _eh
	 */
	public abstract void extractEdgeProperties(Element connectionNode, EdgeHolder _eh);

	/**
	 * @param f_props
	 * @param f_type
	 * @return
	 */
	public abstract ProcessEdge createEdge(Properties f_props, String f_type) ;

	/**
	 * called before the model is returned
	 */
	public abstract void postProcessing(ProcessModel model);

	/**
	 * @return
	 */
	public abstract ProcessModel getEmptyModel();

	/**
     * if no size information is given the default size was used in the IS model.
     * As this default size can differ from the default size used in the workbench,
     * it will be transformed here
     * @param node
     */
	public abstract void setDefaultSize(ProcessNode node);

	/**
	 * Is called when a parent child relationship was detected
	 * in the xml of the is workflow, but the parent module is not
	 * an instance of the Cluster class. It has to be resolved manually then
	 * @param p
	 * @param _pn
	 */
	public abstract void setParentChildRelationship(ProcessNode child, ProcessNode parent);

	/**
	 * @param edge
	 * @param e
	 */
	public abstract void processDockedEdge(ProcessEdge edge, EdgeDocker e);
}


text:
export default {
  title: 'Región',
  NAOnlyMessage: 'Defina su código de área. Se utilizará para la marcación local.',
  MultiWithNAMessage: 'Defina el país y código de área para su región. Se utilizará para la marcación local y el formato de número de teléfono.',
  MultiWithoutNAMessage: 'Seleccioné el país en el que se encuentra. Esto se utilizará para la marcación local y el formato de número de teléfono.',
  country: 'País',
  areaCode: 'Código de área',
  areaCodePlaceholder: 'Introducir código de área',
};

// @key: @#@"title"@#@ @source: @#@"Region"@#@
// @key: @#@"NAOnlyMessage"@#@ @source: @#@"Please set your area code. This will be used for local dialing."@#@
// @key: @#@"MultiWithNAMessage"@#@ @source: @#@"Please set the country and area code for your region. This will be used for local dialing and phone number formatting."@#@
// @key: @#@"MultiWithoutNAMessage"@#@ @source: @#@"Please select the country you locate in. This will be used for local dialing and phone number formatting."@#@
// @key: @#@"country"@#@ @source: @#@"Country"@#@
// @key: @#@"areaCode"@#@ @source: @#@"Area Code"@#@
// @key: @#@"areaCodePlaceholder"@#@ @source: @#@"Enter Area Code"@#@


text:
pip install --upgrade pip setuptools virtualenvwrapper
pip install --upgrade 'ipython[notebook]' cython numpy scipy matplotlib pillow sphinx numpydoc


text:
#ifndef _aduiEdit_h
#define _aduiEdit_h
#pragma pack (push, 8)

#pragma once

////////////////////////////////////////////////////////////////////////////
// CAdUiEdit window
#pragma warning(push)
#pragma warning(disable : 4275)
class ADUI_PORT CAdUiEdit : public CEdit {
    DECLARE_DYNAMIC(CAdUiEdit)

public:
                CAdUiEdit ();
virtual         ~CAdUiEdit ();

// Misc.
protected:
        CPoint  m_lastMousePoint;
        CRect   m_tipRect;

public:
virtual void    GetContentExtent (LPCTSTR text, int& width, int& height);
        void    GetTextExtent (LPCTSTR text, int& width, int& height);

// Validation style
public:
        DWORD   m_styleMask;            // style bits (application-defined)

virtual void    SetStyleMask (DWORD);   // define behavior
        DWORD   GetStyleMask ();        // fetch the style
        BOOL    IsStyleMaskSet (DWORD); // verify styles

// AdUi message handlers
protected:
        CWnd    *m_aduiParent;

virtual ADUI_REPLY DoAdUiMessage (
                    ADUI_NOTIFY notifyCode, UINT controlId, LPARAM lParam
                );
virtual void    OnDrawTip (CDC& dc);
virtual BOOL    OnDrawTipText (CAdUiDrawTipText& dtt);
virtual ADUI_REPLY OnGetTipSupport (CPoint& p);
virtual BOOL    OnGetTipRect (CRect& r);
virtual BOOL    OnGetTipText (CString& text);
virtual BOOL    OnHitTipRect (CPoint& p);
public:
        CWnd    *GetAdUiParent ();
        void    SetAdUiParent (CWnd *w);

// ClassWizard-controlled
public:
    //{{AFX_VIRTUAL(CAdUiEdit)
    //}}AFX_VIRTUAL

protected:
    //{{AFX_MSG(CAdUiEdit)
    afx_msg LRESULT OnAdUiMessage (WPARAM wParam, LPARAM lParam);
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    //}}AFX_MSG

    DECLARE_MESSAGE_MAP()
};

class    CAdUiSearchBoxEditor;
class    CAdUiSearchBoxSearchButton;
class    CAdUiSearchBoxClearButton;

////////////////////////////////////////////////////////////////////////////
// CAdUiSearchBox window
class ADUI_PORT CAdUiSearchBox : public CAdUiEdit{
    DECLARE_DYNAMIC(CAdUiSearchBox)

public:
                CAdUiSearchBox ();
virtual         ~CAdUiSearchBox ();
virtual BOOL    Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
virtual void    PreSubclassWindow();
        void    SetDefaultText(LPCTSTR pszText);
        void    SetNotification(LPCTSTR pszText);
        void    ClearEditor();
        bool    IsEditEmpty();

public: //Override methods
virtual void    EditChanged();
virtual void    ClearButtonClicked();
virtual void    SearchButtonClicked();

protected:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
    //{{AFX_MSG(CAdUiComboBox)
    virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
    afx_msg void OnClearButton();
    afx_msg void OnSearchButton();
    afx_msg void SetEditFocus();
    afx_msg void KillEditFocus();
    afx_msg void OnEditChange();
	afx_msg void OnSize(UINT nType, int cx, int cy);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
private:
    BOOL    CreateControls();
    BOOL    DestroyControls();
    void    UpdateSearchBox();
    void    UpdateButton();
    void    GetControlRect(CRect &editRect, CRect &buttonRect);

private:
    bool                    m_bIsControlsCreated;
    CAdUiSearchBoxEditor*    m_pEditor;
    CAdUiSearchBoxSearchButton*      m_pBtnSearch;
    CAdUiSearchBoxClearButton*   m_pBtnClear;

    CString                 m_strNotification;
    CString                 m_strDefaultText;
};
#pragma warning(pop)
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#pragma pack (pop)
#endif

/////////////////////////////////////////////////////////////////////////////


text:
package com.amazonaws.services.opsworks.model.transform;

import static com.amazonaws.util.StringUtils.UTF8;
import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.regex.Pattern;

import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.opsworks.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.json.*;

/**
 * UpdateUserProfileRequest Marshaller
 */
public class UpdateUserProfileRequestMarshaller implements
        Marshaller<Request<UpdateUserProfileRequest>, UpdateUserProfileRequest> {

    public Request<UpdateUserProfileRequest> marshall(
            UpdateUserProfileRequest updateUserProfileRequest) {

        if (updateUserProfileRequest == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        Request<UpdateUserProfileRequest> request = new DefaultRequest<UpdateUserProfileRequest>(
                updateUserProfileRequest, "AWSOpsWorks");
        request.addHeader("X-Amz-Target", "OpsWorks_20130218.UpdateUserProfile");

        request.setHttpMethod(HttpMethodName.POST);

        request.setResourcePath("");

        try {
            StringWriter stringWriter = new StringWriter();
            JSONWriter jsonWriter = new JSONWriter(stringWriter);

            jsonWriter.object();

            if (updateUserProfileRequest.getIamUserArn() != null) {
                jsonWriter.key("IamUserArn").value(
                        updateUserProfileRequest.getIamUserArn());
            }

            if (updateUserProfileRequest.getSshUsername() != null) {
                jsonWriter.key("SshUsername").value(
                        updateUserProfileRequest.getSshUsername());
            }

            if (updateUserProfileRequest.getSshPublicKey() != null) {
                jsonWriter.key("SshPublicKey").value(
                        updateUserProfileRequest.getSshPublicKey());
            }

            if (updateUserProfileRequest.getAllowSelfManagement() != null) {
                jsonWriter.key("AllowSelfManagement").value(
                        updateUserProfileRequest.getAllowSelfManagement());
            }

            jsonWriter.endObject();

            String snippet = stringWriter.toString();
            byte[] content = snippet.getBytes(UTF8);
            request.setContent(new StringInputStream(snippet));
            request.addHeader("Content-Length",
                    Integer.toString(content.length));
            request.addHeader("Content-Type", "application/x-amz-json-1.1");
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }

        return request;
    }

}


text: administration


text:
namespace Elements
{
    public class Character : Element
    {
        private string _character;

        public string TheCharacter
        {
            get
            {
                return _character;
            }
        }

        public Character(CharacterBuffer buffer, bool repetitionsOnly)
        {
            //this.Image = ImageType.Character;
            Start = buffer.IndexInOriginalBuffer;
            if (buffer.IsAtEnd)
            {
                Utility.ParseError("Reached end of buffer in Character constructor!", buffer);
                IsValid = false;
            }
            else if (repetitionsOnly)
            {
                _character = buffer.CurrentCharacter.ToString();
                ParseRepetitions(buffer);
                return;
            }
            _character = buffer.CurrentCharacter.ToString();
            Literal = _character;
            Description = Literal;
            buffer.MoveNext();
            ParseRepetitions(buffer);
        }

        public Character(CharacterBuffer buffer) : this(buffer, false)
        {
        }
    }
}


text:
<?php

namespace DTS\eBaySDK\MerchantData\Enums;

/**
 *
 */
class ShippingFeatureCodeType
{
    const C_CUSTOM_CODE = 'CustomCode';
    const C_DELIVERY_CONFIRMATION = 'DeliveryConfirmation';
    const C_NOT_DEFINED = 'NotDefined';
    const C_OTHER = 'Other';
    const C_SATURDAY_DELIVERY = 'SaturdayDelivery';
    const C_SIGNATURE_CONFIRMATION = 'SignatureConfirmation';
    const C_STEALTH_POSTAGE = 'StealthPostage';
}


text:
package com.jprotractor.scripts;

/**
 * @author Carlos Alexandro Becker (caarlos0@gmail.com)
 */
public final class ResumeAngularBootstrap implements Script {
    @Override
    public String content() {
        return new Loader("resumeAngularBootstrap").content();
    }
}


text:
layout: post
title: Finding the middle of LinkeList and  printing out LinkedList in reverse order
subtitle: How can I find the middle of LinkeList and  print out LinkedList in reverse order ?
category: Extenstion Of DataStructure
tags: [list, stack]
permalink: /2016/07/29/Utilization_Of_LinkedList6/
---

I refered to the book,"coding interview" and [geeksforgeeks](http://www.geeksforgeeks.org/write-a-c-function-to-print-the-middle-of-the-linked-list/).

# where is the center of LinkedList ?

### First, brute-force

  1. get the total length of list, after that, get (the total length of list / 2)

  Let's make pseudo code

  I think this is the simplest way I have ever experienced

```c
  struct ListNode * WhereIsMiddle ( struct ListNode * head ) {
            LinsNode * temp = head;
            int LenOfList = 0;
            int middlePosition = 0;

            // Just, firt get the length of list
            while ( temp != NULL ) {
                LenOfList++;
                temp = temp -> next;
            }

            /// Second. the length of list / 2
            middlePosition = LenOfList / 2;

            temp = head;

            while ( middlePositio != 0 ) {
                temp = temp -> next;
            }

          return temp;

  }
```

### Another way

  what about [geeksforgeeks](http://www.geeksforgeeks.org/write-a-c-function-to-print-the-middle-of-the-linked-list/)

  I think just use how to check whether list is loop or not.

  Use the two of point. Let's see pseudo code

```c
    struct ListNode * WhereIsMiddle(struct ListNode * head) {
         struct ListNode * fastNode = head;
         srruct ListNode * slowNode = head;
         int count = 0  ;

         while (slowNode != NULL) {

          count = 2;
          while ( count != 0 && fastNode != NULL){
                fastNode = fastNode -> next;
                count --;
          }
          if ( fastNode == NULL)
             break;

             slowNode = slowNode -> next;
        }
        return slowNode;
    }
```

  The above is my way to find middle.

  But the following is contents of the book "coding interview".

  While read this book. I feel really way to solve is differenct. Even though the algorithm is the same.

```c
  struct ListNode * FindMiddle (struct ListNode *head) {
    struct ListNode * moveX1 = NULL, * moveX2 = NULL;
    int i = 0;

    moveX1 = moveX2 = head;

    while (moveX2 != NULL) {
        if (i == 0) {
          moveX2 = moveX2 -> next;
          i = 1;
        }
        else if (i == 1) {
          moveX2 = moveX2 -> next;
          moveX1 = moveX1 -> next;
          i = 0;
        }
    }
    return moveX1;
  }
```

# how to print the whole list from the end of the list.

  I think the best way is stack.

  So if you are thinking about stack, You cand choose the type of stack, whether you ust system stack or not.

  Or use stack you make.

### First, How to use stack.

  let's pseudo code

```c
  void PrintFromTheEndOfList (struct ListNode * head) {
    Stack A;
    struct ListNode * temp = head;

    // First. put the total ListNot in stack.
    while (temp != NULL) {
        stack.push(temp);
        temp = temp -> next;
    }

    // Secode, print out from the top of Stack A.
    // If stack is empty, return NULL;
    // If Stack is not empty, return not NULL;
    while (stack.empty() != NULL ) {
      printf( stack.top);
      stack.pop();
    }

  }
```

  The Following shows you how to use recursive function with system stack.

  In addition, the pseudo code is in contents of the book,"coding interview".

  i.e, recursive function !

  that function is useful, when you need to use dynamic programming.

```c
  void PrintListFromEnd (struct ListNode * head) {

        if( head == NULL)
            return ;

        PrintfListFromEnd ( head -> head );

        printf( head -> data );
  }
```


text:
from importlib import import_module

from django.conf import settings
from django.core.management.base import BaseCommand

class Command(BaseCommand):
    help = (
        "Can be run as a cronjob or directly to clean out expired sessions "
        "(only with the database backend at the moment)."
    )

    def handle(self, **options):
        engine = import_module(settings.SESSION_ENGINE)
        try:
            engine.SessionStore.clear_expired()
        except NotImplementedError:
            self.stderr.write("Session engine '%s' doesn't support clearing "
                              "expired sessions.\n" % settings.SESSION_ENGINE)


text:
type: book
publisher: "Pearson"
title: "Wireless Communications and Networks"
isbn: 978-0-13191-835-1
link: https://www.pearsonhighered.com/product/Stallings-Wireless-Communications-Networks-2nd-Edition/9780131918351.html
general: false
year: 2004
authors:
  - name: Stallings
    first: William
---


text:
layout: post
title: Tweets
date: 2020-07-28
summary: These are the tweets for July 28, 2020.
categories:
---


text:
using Dongbo.DFS.Oss;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dongbo.Common;
using Dongbo.Common.Util;
using System.Web;
using System.Collections.Specialized;
using Dongbo.Logging;
using Aliyun.OSS;

namespace Dongbo.DFS.Oss
{
    public class OssProvider : IStorageProvider
    {

        //private static readonly string default_application = DfsConfig.Instance.Applications.FirstOrDefault().ApplicationName;
        private static readonly LogWrapper log = new LogWrapper();
        public OssProvider()
        {

        }
        private DfsPath _GetDfsPath(string path)
        {
            return new DfsPath(path);
        }

        public string AddFile(string path, Stream data, NameValueCollection userMetadata)
        {

            var dfs = _GetDfsPath(path);
            var bucket = dfs.Bucket;
            var skey = dfs.path.Replace("\\", "/").ToLower().TrimStart('/');
            string applicationName = dfs.ApplicationName;
            var metadata = new ObjectMetadata();
            if (!String.IsNullOrEmpty(applicationName))
            {
                var conf = DfsConfig.Instance[applicationName];
                if (conf != null)
                {
                    metadata.CacheControl = conf.CacheControl;
                    metadata.ContentEncoding = conf.ContentEncoding;
                    if (conf.Expires > 0)
                    {
                        metadata.AddHeader(HttpHeaders.Expires, DateTime.Now.AddSeconds(conf.Expires));
                    }
                }
            }

            if (userMetadata != null && userMetadata.Count > 0)
            {
                string cc = userMetadata[HttpHeaders.CacheControl];
                if (!string.IsNullOrEmpty(cc))
                    metadata.CacheControl = userMetadata[HttpHeaders.CacheControl];
                var ce = userMetadata[HttpHeaders.ContentEncoding];
                if (!string.IsNullOrEmpty(ce))
                    metadata.ContentEncoding = ce;

                var cd = userMetadata[HttpHeaders.ContentDisposition];
                if (!string.IsNullOrEmpty(cd))
                    metadata.ContentDisposition = cd;

                var ct = userMetadata[HttpHeaders.ContentType];
                if (!string.IsNullOrEmpty(ct))
                    metadata.ContentType = ct;

                var md5 = userMetadata[HttpHeaders.ContentMd5];
                if (!string.IsNullOrEmpty(md5))
                    metadata.ContentMd5 = md5;

                foreach (string key in userMetadata.AllKeys)
                {
                    var v = userMetadata[key];

                    metadata.UserMetadata.Add(key, v);
                }
            }
            metadata.ContentLength = data.Length;
            if (String.IsNullOrEmpty(metadata.ContentType))
            {
                var contentType = Mime.Lookup(skey);
                metadata.ContentType = contentType;
            }
            try
            {
                var result = OssService.Instance.PutObject(bucket, skey, data, metadata);
                return result.ETag;
            }
            catch (Exception ex)
            {
                log.Error(new Exception(path, ex));
                return String.Empty;
            }

        }
        public Stream GetFileStream(string path)
        {
            var dfs = _GetDfsPath(path);
            try
            {
                return OssService.Instance.GetObject(dfs.Bucket, dfs.path).Content;
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return null;
            }

        }

        public void DeleteFile(string path)
        {
            var dfs = _GetDfsPath(path);
            try
            {
                OssService.Instance.DeleteObject(dfs.Bucket, dfs.path);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }

        }

        public List<string> GetFiles(string dirPath)
        {
            var dfs = _GetDfsPath(dirPath);
            try
            {
                var list = OssService.Instance.ListObjects(dfs.Bucket, dfs.path, null);
                var result = new List<string>();
                foreach (var v in list)
                {
                    result.Add(v.Key);
                }
                return result;
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return null;
            }

        }

        public MBFileInfo GetFileInfo(string path)
        {
            var dfs = _GetDfsPath(path);
            ObjectMetadata metadata = null;
            try
            {
                metadata = OssService.Instance.GetObjectMetadata(dfs.Bucket, dfs.path);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return new MBFileInfo();
            }

            MBFileInfo info = new MBFileInfo();
            var ali = "";
            metadata.UserMetadata.TryGetValue("Aliases", out ali);
            if (!string.IsNullOrEmpty(ali))
            {
                try
                {
                    var a = SerializeHelper.DeserializeJson<string[]>(ali);
                    info.Aliases = a;
                }
                catch { }
                if (info.Aliases == null || info.Aliases.Length == 0)
                {
                    info.Aliases = new string[] { ali };
                }
            }
            info.Ext = Path.GetExtension(dfs.path);
            info.Name = Path.GetFileName(dfs.path);
            info.Metadata = new NameValueCollection();
            info.UploadDate = metadata.LastModified;
            info.LastModified = metadata.LastModified;
            info.Size = metadata.ContentLength;
            info.ContentType = metadata.ContentType;
            info.ETag = metadata.ETag;

            foreach (var item in metadata.UserMetadata)
            {
                info.Metadata.Add(item.Key, item.Value);
            }
            info.Metadata.Add(HttpHeaders.CacheControl, metadata.CacheControl);
            info.Metadata.Add(HttpHeaders.ContentDisposition, metadata.ContentDisposition);
            info.Metadata.Add(HttpHeaders.ContentEncoding, metadata.ContentEncoding);
            info.Metadata.Add(HttpHeaders.Expires, metadata.ExpirationTime.ToString());
            return info;
        }

        public void CopyFile(string sourcePath, string targetPath, NameValueCollection metadata)
        {
            var sdfs = _GetDfsPath(sourcePath);
            var tdfs = _GetDfsPath(targetPath);

            var newMetadata = new ObjectMetadata();
            foreach (string item in metadata)
            {
                newMetadata.AddHeader(item, metadata[item]);
            }
            try
            {
                OssService.Instance.CopyObject(sdfs.Bucket, sdfs.path, tdfs.Bucket, tdfs.path, newMetadata);

            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }

        public string GetPresignedUrl(string path)
        {
            var dfs = _GetDfsPath(path);

            return OssService.Instance.GeneratePresignedUri(dfs.Bucket, dfs.path, 3600, SignHttpMethod.Get).ToString();
        }

        public string GetHttpUrl(string path)
        {
            var dfs = _GetDfsPath(path);
            var url = string.Format("http://{0}.{1}/{2}", dfs.Bucket, OssConfig.Instance.EndPoint.Replace("http://", ""), dfs.path);
            return url;
        }

        public bool DoesFileExist(string path)
        {
            var dfs = _GetDfsPath(path);
            return OssService.Instance.DoesObjectExist(dfs.Bucket, dfs.path);
        }

        public void DowloadFile(string filePath, string localFilePath)
        {
            var dfs = _GetDfsPath(filePath);
            var bucket = dfs.Bucket;
            var skey = dfs.path.Replace("\\", "/").ToLower().TrimStart('/');
            OssService.Instance.DownloadObject(bucket, skey, localFilePath);
        }
    }
}