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

<title>Batch (libgdx API)</title>
<meta name="date" content="2016-02-02">
<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

Index

Help

				libgdx API

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.badlogic.gdx.graphics.g2d

Interface Batch

All Superinterfaces:

Disposable

All Known Implementing Classes:

CpuSpriteBatch, PolygonSpriteBatch, SpriteBatch

public interface Batch
extends Disposable

A Batch is used to draw 2D rectangles that reference a texture (region). The class will batch the drawing commands and optimize
 them for processing by the GPU.

 To draw something with a Batch one has to first call the begin() method which will setup appropriate render
 states. When you are done with drawing you have to call end() which will actually draw the things you specified.

 All drawing commands of the Batch operate in screen coordinates. The screen coordinate system has an x-axis pointing to the
 right, an y-axis pointing upwards and the origin is in the lower left corner of the screen. You can also provide your own
 transformation and projection matrices if you so wish.

 A Batch is managed. In case the OpenGL context is lost all OpenGL resources a Batch uses internally get invalidated. A context
 is lost when a user switches to another application or receives an incoming call on Android. A Batch will be automatically
 reloaded after the OpenGL context is restored.

 A Batch is a pretty heavy object so you should only ever have one in your program.

 A Batch works with OpenGL ES 2.0. It will use its own custom shader to draw all provided
 sprites. You can set your own custom shader via setShader(ShaderProgram).

 A Batch has to be disposed if it is no longer used.

Author:

mzechner, Nathan Sweet

Field Summary

Fields

Modifier and Type
Field and Description

static int
C1

static int
C2

static int
C3

static int
C4

static int
U1

static int
U2

static int
U3

static int
U4

static int
V1

static int
V2

static int
V3

static int
V4

static int
X1

static int
X2

static int
X3

static int
X4

static int
Y1

static int
Y2

static int
Y3

static int
Y4

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
begin()

Sets up the Batch for drawing.

void
disableBlending()

Disables blending for drawing sprites.

void
draw(Texture texture,
    float[] spriteVertices,
    int offset,
    int count)

Draws a rectangle using the given vertices.

void
draw(Texture texture,
    float x,
    float y)

Draws a rectangle with the bottom left corner at x,y having the width and height of the texture.

void
draw(Texture texture,
    float x,
    float y,
    float width,
    float height)

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

void
draw(Texture texture,
    float x,
    float y,
    float width,
    float height,
    float u,
    float v,
    float u2,
    float v2)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

void
draw(Texture texture,
    float x,
    float y,
    float originX,
    float originY,
    float width,
    float height,
    float scaleX,
    float scaleY,
    float rotation,
    int srcX,
    int srcY,
    int srcWidth,
    int srcHeight,
    boolean flipX,
    boolean flipY)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

void
draw(Texture texture,
    float x,
    float y,
    float width,
    float height,
    int srcX,
    int srcY,
    int srcWidth,
    int srcHeight,
    boolean flipX,
    boolean flipY)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

void
draw(Texture texture,
    float x,
    float y,
    int srcX,
    int srcY,
    int srcWidth,
    int srcHeight)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels.

void
draw(TextureRegion region,
    float x,
    float y)

Draws a rectangle with the bottom left corner at x,y having the width and height of the region.

void
draw(TextureRegion region,
    float width,
    float height,
    Affine2 transform)

Draws a rectangle transformed by the given matrix.

void
draw(TextureRegion region,
    float x,
    float y,
    float width,
    float height)

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

void
draw(TextureRegion region,
    float x,
    float y,
    float originX,
    float originY,
    float width,
    float height,
    float scaleX,
    float scaleY,
    float rotation)

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

void
draw(TextureRegion region,
    float x,
    float y,
    float originX,
    float originY,
    float width,
    float height,
    float scaleX,
    float scaleY,
    float rotation,
    boolean clockwise)

Draws a rectangle with the texture coordinates rotated 90 degrees.

void
enableBlending()

Enables blending for drawing sprites.

void
end()

Finishes off rendering.

void
flush()

Causes any pending sprites to be rendered, without ending the Batch.

int
getBlendDstFunc()

int
getBlendSrcFunc()

Color
getColor()

float
getPackedColor()

Matrix4
getProjectionMatrix()

Returns the current projection matrix.

ShaderProgram
getShader()

Matrix4
getTransformMatrix()

Returns the current transform matrix.

boolean
isBlendingEnabled()

boolean
isDrawing()

void
setBlendFunction(int srcFunc,
                int dstFunc)

Sets the blending function to be used when rendering sprites.

void
setColor(Color tint)

Sets the color used to tint images when they are added to the Batch.

void
setColor(float color)

void
setColor(float r,
        float g,
        float b,
        float a)

void
setProjectionMatrix(Matrix4 projection)

Sets the projection matrix to be used by this Batch.

void
setShader(ShaderProgram shader)

Sets the shader to be used in a GLES 2.0 environment.

void
setTransformMatrix(Matrix4 transform)

Sets the transform matrix to be used by this Batch.

Methods inherited from interface com.badlogic.gdx.utils.Disposable

dispose

Field Detail

X1

static final int X1

See Also:

Constant Field Values

Y1

static final int Y1

See Also:

Constant Field Values

C1

static final int C1

See Also:

Constant Field Values

U1

static final int U1

See Also:

Constant Field Values

V1

static final int V1

See Also:

Constant Field Values

X2

static final int X2

See Also:

Constant Field Values

Y2

static final int Y2

See Also:

Constant Field Values

C2

static final int C2

See Also:

Constant Field Values

U2

static final int U2

See Also:

Constant Field Values

V2

static final int V2

See Also:

Constant Field Values

X3

static final int X3

See Also:

Constant Field Values

Y3

static final int Y3

See Also:

Constant Field Values

C3

static final int C3

See Also:

Constant Field Values

U3

static final int U3

See Also:

Constant Field Values

V3

static final int V3

See Also:

Constant Field Values

X4

static final int X4

See Also:

Constant Field Values

Y4

static final int Y4

See Also:

Constant Field Values

C4

static final int C4

See Also:

Constant Field Values

U4

static final int U4

See Also:

Constant Field Values

V4

static final int V4

See Also:

Constant Field Values

Method Detail

begin

void begin()

Sets up the Batch for drawing. This will disable depth buffer writing. It enables blending and texturing. If you have more
 texture units enabled than the first one you have to disable them before calling this. Uses a screen coordinate system by
 default where everything is given in pixels. You can specify your own projection and modelview matrices via
 setProjectionMatrix(Matrix4) and setTransformMatrix(Matrix4).

end

void end()

Finishes off rendering. Enables depth writes, disables blending and texturing. Must always be called after a call to
 begin()

setColor

void setColor(Color tint)

Sets the color used to tint images when they are added to the Batch. Default is Color.WHITE.

setColor

void setColor(float r,
              float g,
              float b,
              float a)

See Also:

setColor(Color)

setColor

void setColor(float color)

See Also:

setColor(Color),
Color.toFloatBits()

getColor

Color getColor()

Returns:

the rendering color of this Batch. Manipulating the returned instance has no effect.

getPackedColor

float getPackedColor()

Returns:

the rendering color of this Batch in vertex format

See Also:

Color.toFloatBits()

draw

void draw(Texture texture,
          float x,
          float y,
          float originX,
          float originY,
          float width,
          float height,
          float scaleX,
          float scaleY,
          float rotation,
          int srcX,
          int srcY,
          int srcWidth,
          int srcHeight,
          boolean flipX,
          boolean flipY)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The rectangle is offset by
 originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle should be scaled around
 originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around originX, originY. The
 portion of the Texture given by srcX, srcY and srcWidth, srcHeight is used. These coordinates and sizes are given in
 texels. FlipX and flipY specify whether the texture portion should be flipped horizontally or vertically.

Parameters:

x - the x-coordinate in screen space

y - the y-coordinate in screen space

originX - the x-coordinate of the scaling and rotation origin relative to the screen space coordinates

originY - the y-coordinate of the scaling and rotation origin relative to the screen space coordinates

width - the width in pixels

height - the height in pixels

scaleX - the scale of the rectangle around originX/originY in x

scaleY - the scale of the rectangle around originX/originY in y

rotation - the angle of counter clockwise rotation of the rectangle around originX/originY

srcX - the x-coordinate in texel space

srcY - the y-coordinate in texel space

srcWidth - the source with in texels

srcHeight - the source height in texels

flipX - whether to flip the sprite horizontally

flipY - whether to flip the sprite vertically

draw

void draw(Texture texture,
          float x,
          float y,
          float width,
          float height,
          int srcX,
          int srcY,
          int srcWidth,
          int srcHeight,
          boolean flipX,
          boolean flipY)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The portion of the
 Texture given by srcX, srcY and srcWidth, srcHeight is used. These coordinates and sizes are given in texels. FlipX
 and flipY specify whether the texture portion should be flipped horizontally or vertically.

Parameters:

x - the x-coordinate in screen space

y - the y-coordinate in screen space

width - the width in pixels

height - the height in pixels

srcX - the x-coordinate in texel space

srcY - the y-coordinate in texel space

srcWidth - the source with in texels

srcHeight - the source height in texels

flipX - whether to flip the sprite horizontally

flipY - whether to flip the sprite vertically

draw

void draw(Texture texture,
          float x,
          float y,
          int srcX,
          int srcY,
          int srcWidth,
          int srcHeight)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The portion of the
 Texture given by srcX, srcY and srcWidth, srcHeight are used. These coordinates and sizes are given in texels.

Parameters:

x - the x-coordinate in screen space

y - the y-coordinate in screen space

srcX - the x-coordinate in texel space

srcY - the y-coordinate in texel space

srcWidth - the source with in texels

srcHeight - the source height in texels

draw

void draw(Texture texture,
          float x,
          float y,
          float width,
          float height,
          float u,
          float v,
          float u2,
          float v2)

Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. The portion of the
 Texture given by u, v and u2, v2 are used. These coordinates and sizes are given in texture size percentage. The
 rectangle will have the given tint Color.

Parameters:

x - the x-coordinate in screen space

y - the y-coordinate in screen space

width - the width in pixels

height - the height in pixels

draw

void draw(Texture texture,
          float x,
          float y)

Draws a rectangle with the bottom left corner at x,y having the width and height of the texture.

Parameters:

x - the x-coordinate in screen space

y - the y-coordinate in screen space

draw

void draw(Texture texture,
          float x,
          float y,
          float width,
          float height)

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

draw

void draw(Texture texture,
          float[] spriteVertices,
          int offset,
          int count)

Draws a rectangle using the given vertices. There must be 4 vertices, each made up of 5 elements in this order: x, y, color,
 u, v. The getColor() from the Batch is not applied.

draw

void draw(TextureRegion region,
          float x,
          float y)

Draws a rectangle with the bottom left corner at x,y having the width and height of the region.

draw

void draw(TextureRegion region,
          float x,
          float y,
          float width,
          float height)

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height.

draw

void draw(TextureRegion region,
          float x,
          float y,
          float originX,
          float originY,
          float width,
          float height,
          float scaleX,
          float scaleY,
          float rotation)

Draws a rectangle with the bottom left corner at x,y and stretching the region to cover the given width and height. The
 rectangle is offset by originX, originY relative to the origin. Scale specifies the scaling factor by which the rectangle
 should be scaled around originX, originY. Rotation specifies the angle of counter clockwise rotation of the rectangle around
 originX, originY.

draw

void draw(TextureRegion region,
          float x,
          float y,
          float originX,
          float originY,
          float width,
          float height,
          float scaleX,
          float scaleY,
          float rotation,
          boolean clockwise)

Draws a rectangle with the texture coordinates rotated 90 degrees. The bottom left corner at x,y and stretching the region
 to cover the given width and height. The rectangle is offset by originX, originY relative to the origin. Scale specifies the
 scaling factor by which the rectangle should be scaled around originX, originY. Rotation specifies the angle of counter
 clockwise rotation of the rectangle around originX, originY.

Parameters:

clockwise - If true, the texture coordinates are rotated 90 degrees clockwise. If false, they are rotated 90 degrees
           counter clockwise.

draw

void draw(TextureRegion region,
          float width,
          float height,
          Affine2 transform)

Draws a rectangle transformed by the given matrix.

flush

void flush()

Causes any pending sprites to be rendered, without ending the Batch.

disableBlending

void disableBlending()

Disables blending for drawing sprites. Calling this within begin()/end() will flush the batch.

enableBlending

void enableBlending()

Enables blending for drawing sprites. Calling this within begin()/end() will flush the batch.

setBlendFunction

void setBlendFunction(int srcFunc,
                      int dstFunc)

Sets the blending function to be used when rendering sprites.

Parameters:

srcFunc - the source function, e.g. GL20.GL_SRC_ALPHA. If set to -1, Batch won't change the blending function.

dstFunc - the destination function, e.g. GL20.GL_ONE_MINUS_SRC_ALPHA

getBlendSrcFunc

int getBlendSrcFunc()

getBlendDstFunc

int getBlendDstFunc()

getProjectionMatrix

Matrix4 getProjectionMatrix()

Returns the current projection matrix. Changing this within begin()/end() results in undefined behaviour.

getTransformMatrix

Matrix4 getTransformMatrix()

Returns the current transform matrix. Changing this within begin()/end() results in undefined behaviour.

setProjectionMatrix

void setProjectionMatrix(Matrix4 projection)

Sets the projection matrix to be used by this Batch. If this is called inside a begin()/end() block, the
 current batch is flushed to the gpu.

setTransformMatrix

void setTransformMatrix(Matrix4 transform)

Sets the transform matrix to be used by this Batch.

setShader

void setShader(ShaderProgram shader)

Sets the shader to be used in a GLES 2.0 environment. Vertex position attribute is called "a_position", the texture
 coordinates attribute is called "a_texCoord0", the color attribute is called "a_color". See
 ShaderProgram.POSITION_ATTRIBUTE, ShaderProgram.COLOR_ATTRIBUTE and ShaderProgram.TEXCOORD_ATTRIBUTE
 which gets "0" appended to indicate the use of the first texture unit. The combined transform and projection matrx is
 uploaded via a mat4 uniform called "u_projTrans". The texture sampler is passed via a uniform called "u_texture".

 Call this method with a null argument to use the default shader.

 This method will flush the batch before setting the new shader, you can call it in between begin() and
 end().

Parameters:

shader - the ShaderProgram or null to use the default shader.

getShader

ShaderProgram getShader()

Returns:

the current ShaderProgram set by setShader(ShaderProgram) or the defaultShader

isBlendingEnabled

boolean isBlendingEnabled()

Returns:

true if blending for sprites is enabled

isDrawing

boolean isDrawing()

Returns:

true if currently between begin and end.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

libgdx API

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

				Copyright © 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)


text:
\chapter{CLAW Directive Language}
The CLAW Directive Language is specified in the \textit{CLAW Directive Language
Specification} document~\cite{claw:specification}. To parse and validate
this directive language, a parser is needed in the heart of the \clawfcomp.
This section gives an in-depth description of this parser and its
implementation.

\section{CLAW directive language parser}
The CLAW Directive Language parser is based on the ANTLR project
\cite{Parr:2013:DAR:2501720}. ANTLR is a parser generator. From a grammar file,
ANTLR generates a parser that is then used in the CLAW \xcodemlf to \xcodeml
translator to interpret the directives.

\lstinputlisting
  [
    label=lst:antlr,
    language=Java,
    caption=ANTLR Grammar Example
  ]{code/clawp.g4}

Listing \ref{lst:antlr} is a minimalist ANTLR example that support only two
directives \lstinline|!$claw acc| or \lstinline|!$claw omp|.

In this grammar, there are two important sections, the parser and the lexer
sections. The lexer section defines what will be recognized as a token. Here
we defined the directives, the clauses but also more complex construct such as
the \lstinline|IDENTIFIER| on line 28. It described the possible element to
compose an identifier. This \lstinline|IDENTIFIER| can then be used later in
the parser rules.
The parser rules define the actual grammar of the language. In the case
of this small example, the grammar says that the directive string must begins
with \lstinline|claw| and then be followed by \lstinline|acc| or
\lstinline|omp|. The code in \lstinline|{}| is java code that is triggered
when the grammar rule is activated. In the example, it sets a value of the
object returned after the analysis.
The \lstinline|@init{}| section allows to execute some Java code before
triggering the actual parse. The \lstinline|@header{}| allows to insert Java
code before the parser class.

\begin{lstlisting}[label=lst:antlr_cmd,
  caption=ANTLR parser generation command, language=bash]
javac -classpath <antlr_jar> org.antlr.v4.Tool -o . -package claw.wani.language.parser Claw.g4
\end{lstlisting}

The full CLAW ANTLR grammar is defined in the following file:
\lstinline|cx2t/src/claw/wani/language/parser/Claw.g4|

redpajama_set_name: RedPajamaGithub


text:
package Manager;

import Entities.User;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

import org.apache.log4j.Logger;

public class UserManager {
    private final Logger log = Logger.getLogger(this.getClass());
    private ConnectionManager con = null;

    public int getUserId() throws Exception {
        con = ConnectionManager.getDbCon();
        String query = "Select MAX(Id) FROM retail_schema.user";
        ResultSet rs = con.query(query);
        rs.next();
        int id = rs.getInt(1);
        return id;
    }

    public User addUser(List<String> strings) throws Exception {
        log.info("Adding user in the Database");
        int userId = getUserId();
        userId++;
        con = ConnectionManager.getDbCon();
        String query = "INSERT INTO retail_schema.user VALUES (? , ? , ? , ?)";
        PreparedStatement ps = con.insertUsingPrepStatement(query);
        ps.setInt(1, userId);
        ps.setString(2, strings.get(0));
        ps.setString(3, strings.get(1));
        ps.setString(4, strings.get(2));
        int result = con.queryExecutionUsingPrepStat(ps);
        User user = new User();
        if (result == 1) {
            user.setName(strings.get(0));
            user.setCNIC(strings.get(1));
            user.setEmail(strings.get(2));
        }
        return user;
    }

    public User getUserByEmail(String email) throws Exception {
        log.info("Verifying user by email");
        String query = "SELECT * FROM  retail_schema.user WHERE Email = ? ";
        con = ConnectionManager.getDbCon();
        PreparedStatement ps = con.insertUsingPrepStatement(query);
        ps.setString(1, email);
        ResultSet rs = con.queryExecution(ps);
        User user = new User();
        if (rs.next()) {
            if (rs.getString("Email") != null && rs.getString("Email").equals(email)) {
                user.setId(rs.getInt("Id"));
                user.setName(rs.getString("Name"));
                user.setCNIC(rs.getString("CNIC"));
                user.setEmail(rs.getString("Email"));

            }
        }
        return user;
    }

    public User getUserByCNIC(String cnic) throws Exception {
        log.info("Verifying user by CNIC");
        String query = "SELECT * FROM  retail_schema.user WHERE CNIC = ? ";
        con = ConnectionManager.getDbCon();
        PreparedStatement ps = con.insertUsingPrepStatement(query);
        ps.setString(1, cnic);
        ResultSet rs = con.queryExecution(ps);
        User user = new User();
        if (rs.next()) {
            if (rs.getString("CNIC") != null && rs.getString("CNIC").equals(cnic)) {
                user.setId(rs.getInt("Id"));
                user.setName(rs.getString("Name"));
                user.setCNIC(rs.getString("CNIC"));
                user.setEmail(rs.getString("Email"));

            }
        }
        return user;
    }

    public int updateUser(int option, String input, User user) throws Exception {
        con = ConnectionManager.getDbCon();
        String query;
        int res = 0;
        switch (option) {
            case 1:
                query = "UPDATE retail_schema.user SET Name = ?  WHERE CNIC = ? ";
                PreparedStatement ps1 = con.insertUsingPrepStatement(query);
                ps1.setString(1, input);
                ps1.setObject(2, user.getCNIC());
                res = con.queryExecutionUsingPrepStat(ps1);
                break;
            case 2:
                query = "UPDATE retail_schema.user SET CNIC = ?  WHERE CNIC = ? ";
                PreparedStatement ps2 = con.insertUsingPrepStatement(query);
                ps2.setString(1, input);
                ps2.setObject(2, user.getCNIC());
                res = con.queryExecutionUsingPrepStat(ps2);
                break;
            case 3:
                query = "UPDATE retail_schema.user SET Email = ?  WHERE CNIC = ? ";
                PreparedStatement ps3 = con.insertUsingPrepStatement(query);
                ps3.setString(1, input);
                ps3.setObject(2, user.getCNIC());
                res = con.queryExecutionUsingPrepStat(ps3);
                break;
        }
        return res;
    }

    public int deleteUser(Boolean bool, String inputDataForDeletion) throws Exception {
        log.info("Delete User from Database");
        int result;
        if (bool) {
            String query = "DELETE  FROM  retail_schema.user WHERE Email = ? ";
            con = ConnectionManager.getDbCon();
            PreparedStatement ps = con.insertUsingPrepStatement(query);
            ps.setString(1, inputDataForDeletion);
            result = con.queryExecutionUsingPrepStat(ps);
        } else {
            String query = "DELETE  FROM  retail_schema.user WHERE CNIC = ? ";
            con = ConnectionManager.getDbCon();
            PreparedStatement ps = con.insertUsingPrepStatement(query);
            ps.setString(1, inputDataForDeletion);
            result = con.queryExecutionUsingPrepStat(ps);
        }
        return result;
    }

}


text:
package com.hannesdorfmann.mosby.mvp;

import android.support.v4.app.FragmentActivity;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

/**
 * @author Hannes Dorfmann
 */

@RunWith(PowerMockRunner.class) @PrepareForTest(MvpFragment.class)
public class MvpFragmentTest {

  private MvpFragment<MvpView, MvpPresenter<MvpView>> fragment;
  private FragmentActivity activity;

  @Before public void init() {

    activity = Mockito.mock(FragmentActivity.class);
    fragment = PowerMockito.spy(new MvpFragment<MvpView, MvpPresenter<MvpView>>() {
      @Override public MvpPresenter<MvpView> createPresenter() {
        return null;
      }
    });
  }

  @Test public void retainingAndActivityNull() {
    PowerMockito.when(fragment.getRetainInstance()).thenReturn(true);
    PowerMockito.when(fragment.getActivity()).thenReturn(null);

    Assert.assertFalse(fragment.shouldInstanceBeRetained());
  }

  @Test public void notRetainingAndActivityNull() {
    PowerMockito.when(fragment.getRetainInstance()).thenReturn(false);
    PowerMockito.when(fragment.getActivity()).thenReturn(null);

    Assert.assertFalse(fragment.shouldInstanceBeRetained());
  }

  @Test public void retainingAndNotChangingConfig() {
    PowerMockito.when(fragment.getRetainInstance()).thenReturn(true);
    PowerMockito.when(activity.isChangingConfigurations()).thenReturn(false);

    Assert.assertFalse(fragment.shouldInstanceBeRetained());
  }

  @Test public void retainingAndChangingConfig() {

    PowerMockito.when(fragment.getActivity()).thenReturn(activity);
    PowerMockito.when(fragment.getRetainInstance()).thenReturn(true);
    PowerMockito.when(activity.isChangingConfigurations()).thenReturn(true);

    Assert.assertTrue(fragment.shouldInstanceBeRetained());
  }
}


text:
package com.yunhuwifi.common;

public class Constans {

	public class ContentType {
		public final static String FormUrlEncoded = "application/x-www-form-urlencoded";
		public final static String Text = "text/plain";
		public final static String Json = "application/json";
	}

	public class UserAgent {
		public final static String Android = "Android Mobile";
	}
}


text:
CS310 Home Page

 Problem Solving using Computers -  Fall 1996
 Computer Sciences 310

Check the following pages for information on CS310.

   Instructors and teaching assistants  including office hours.

  Information on
   assignments  including suggestions, copies of assignments, and
   explanations about grading.
   Check the
   policy  on assignments, doing your own work, etc.

  Information on
   examinations  and copies of past exams.

  Information on
    labs  including copies of the handouts.

    Documents  including a syllabus.

  Many of the documents on these web pages are in postscript.
      If you need a postscript viewer, you can obtain one from the
      CS ftp site.  Check the local services section of the
       CS department home page.
      Under local services, go to the FTP web page, and then to the
      ghost directory.  Read the README file for further directions.


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>jleaven</artifactId>
        <groupId>org.linjie.jleaven</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <packaging>jar</packaging>
    <artifactId>ddd</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
        </dependency>

        <!-- spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${google.guava.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

    </dependencies>

</project>


text:
search:
   keywords: ['SQL', 'command', 'alter', 'class', 'ALTER CLASS']
---

# Server Commands - `CREATE SYSTEM USER`

Creates a System user

**Syntax**

```sql
CREATE SYSTEM USER <userName> IDENTIFIED BY <password> ROLE <role>
```

- **`<userName>`** the user name
- **`<password>`** the password
- **`<role>`** an existing role name

**Examples**

- Create a system user with one role:

  orientdb> CREATE SYSTEM USER test IDENTIFIED BY 'foo' ROLE admin

- Create a system user with multiple roles:

  orientdb> CREATE SYSTEM USER test IDENTIFIED BY 'foo' ROLE [reader, writer]


text:
Issues for the expressjs.com website go here https://github.com/strongloop/expressjs.com

## PRs and Code contributions

* Tests must pass.
* Follow existing coding style.
* If you fix a bug, add a test.

## Issues which are questions

We will typically close any vague issues or questions that are specific to some app you are writing. Please double check the docs and other references before being trigger happy with posting a question issue.

Things that will help get your question issue looked at:

* Full and runnable JS code.
* Clear description of the problem or unexpected behavior.
* Clear description of the expected result.
* Steps you have taken to debug it yourself.

If you post a question and do not outline the above items or make it easy for us to understand and reproduce your issue, it will be closed.


text:
CC=$(CXX)
include ../common.mak


text:
using System.IO;
using GroupDocs.Annotation.Options;

namespace GroupDocs.Annotation.Examples.CSharp
{
    /// <summary>
    /// This example demonstrates generating preview of document without rendering comments
    /// </summary>
    class GeneratePreviewWithoutAnnotations
    {
        public static void Run()
        {
            using (Annotator annotator = new Annotator(Constants.ANNOTATED_DOCX))
            {
                PreviewOptions previewOptions = new PreviewOptions(pageNumber =>
                {
                    var pagePath = $"result{pageNumber}.png";
                    return File.Create(pagePath);
                });

                previewOptions.PreviewFormat = PreviewFormats.PNG;
                previewOptions.PageNumbers = new int[] {1, 2, 3, 4, 5, 6};
                previewOptions.RenderAnnotations = false;
                annotator.Document.GeneratePreview(previewOptions);
            }
        }
    }
}


text:
package com.amazonaws.services.identitymanagement.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateSigningCertificateRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The name of the IAM user the signing certificate belongs to.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of
     * the following characters: _+=,.@-
     *

     */
    private String userName;
    /**
     *

     * The ID of the signing certificate you want to update.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters that can consist of any upper or lowercased letter or digit.
     *

     */
    private String certificateId;
    /**
     *

     * The status you want to assign to the certificate. Active means that the certificate can be used for
     * API calls to AWS Inactive means that the certificate cannot be used.
     *

     */
    private String status;

    /**
     * Default constructor for UpdateSigningCertificateRequest object. Callers should use the setter or fluent setter
     * (with...) methods to initialize the object after creating it.
     */
    public UpdateSigningCertificateRequest() {
    }

    /**
     * Constructs a new UpdateSigningCertificateRequest object. Callers should use the setter or fluent setter (with...)
     * methods to initialize any additional object members.
     *
     * @param certificateId
     *        The ID of the signing certificate you want to update.

     *

     *        This parameter allows (through its regex pattern) a string
     *        of characters that can consist of any upper or lowercased letter or digit.
     * @param status
     *        The status you want to assign to the certificate. Active means that the certificate can be
     *        used for API calls to AWS Inactive means that the certificate cannot be used.
     */
    public UpdateSigningCertificateRequest(String certificateId, String status) {
        setCertificateId(certificateId);
        setStatus(status);
    }

    /**
     * Constructs a new UpdateSigningCertificateRequest object. Callers should use the setter or fluent setter (with...)
     * methods to initialize any additional object members.
     *
     * @param certificateId
     *        The ID of the signing certificate you want to update.

     *

     *        This parameter allows (through its regex pattern) a string
     *        of characters that can consist of any upper or lowercased letter or digit.
     * @param status
     *        The status you want to assign to the certificate. Active means that the certificate can be
     *        used for API calls to AWS Inactive means that the certificate cannot be used.
     */
    public UpdateSigningCertificateRequest(String certificateId, StatusType status) {
        setCertificateId(certificateId);
        setStatus(status.toString());
    }

    /**
     *

     * The name of the IAM user the signing certificate belongs to.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of
     * the following characters: _+=,.@-
     *

     *
     * @param userName
     *        The name of the IAM user the signing certificate belongs to.

     *

     *        This parameter allows (through its regex pattern) a string
     *        of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also
     *        include any of the following characters: _+=,.@-
     */

    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     *

     * The name of the IAM user the signing certificate belongs to.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of
     * the following characters: _+=,.@-
     *

     *
     * @return The name of the IAM user the signing certificate belongs to.

     *

     *         This parameter allows (through its regex pattern) a string
     *         of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also
     *         include any of the following characters: _+=,.@-
     */

    public String getUserName() {
        return this.userName;
    }

    /**
     *

     * The name of the IAM user the signing certificate belongs to.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of
     * the following characters: _+=,.@-
     *

     *
     * @param userName
     *        The name of the IAM user the signing certificate belongs to.

     *

     *        This parameter allows (through its regex pattern) a string
     *        of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also
     *        include any of the following characters: _+=,.@-
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public UpdateSigningCertificateRequest withUserName(String userName) {
        setUserName(userName);
        return this;
    }

    /**
     *

     * The ID of the signing certificate you want to update.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters that can consist of any upper or lowercased letter or digit.
     *

     *
     * @param certificateId
     *        The ID of the signing certificate you want to update.

     *

     *        This parameter allows (through its regex pattern) a string
     *        of characters that can consist of any upper or lowercased letter or digit.
     */

    public void setCertificateId(String certificateId) {
        this.certificateId = certificateId;
    }

    /**
     *

     * The ID of the signing certificate you want to update.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters that can consist of any upper or lowercased letter or digit.
     *

     *
     * @return The ID of the signing certificate you want to update.

     *

     *         This parameter allows (through its regex pattern) a string
     *         of characters that can consist of any upper or lowercased letter or digit.
     */

    public String getCertificateId() {
        return this.certificateId;
    }

    /**
     *

     * The ID of the signing certificate you want to update.
     *

     *

     * This parameter allows (through its regex pattern) a string of
     * characters that can consist of any upper or lowercased letter or digit.
     *

     *
     * @param certificateId
     *        The ID of the signing certificate you want to update.

     *

     *        This parameter allows (through its regex pattern) a string
     *        of characters that can consist of any upper or lowercased letter or digit.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public UpdateSigningCertificateRequest withCertificateId(String certificateId) {
        setCertificateId(certificateId);
        return this;
    }

    /**
     *

     * The status you want to assign to the certificate. Active means that the certificate can be used for
     * API calls to AWS Inactive means that the certificate cannot be used.
     *

     *
     * @param status
     *        The status you want to assign to the certificate. Active means that the certificate can be
     *        used for API calls to AWS Inactive means that the certificate cannot be used.
     * @see StatusType
     */

    public void setStatus(String status) {
        this.status = status;
    }

    /**
     *

     * The status you want to assign to the certificate. Active means that the certificate can be used for
     * API calls to AWS Inactive means that the certificate cannot be used.
     *

     *
     * @return The status you want to assign to the certificate. Active means that the certificate can be
     *         used for API calls to AWS Inactive means that the certificate cannot be used.
     * @see StatusType
     */

    public String getStatus() {
        return this.status;
    }

    /**
     *

     * The status you want to assign to the certificate. Active means that the certificate can be used for
     * API calls to AWS Inactive means that the certificate cannot be used.
     *

     *
     * @param status
     *        The status you want to assign to the certificate. Active means that the certificate can be
     *        used for API calls to AWS Inactive means that the certificate cannot be used.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see StatusType
     */

    public UpdateSigningCertificateRequest withStatus(String status) {
        setStatus(status);
        return this;
    }

    /**
     *

     * The status you want to assign to the certificate. Active means that the certificate can be used for
     * API calls to AWS Inactive means that the certificate cannot be used.
     *

     *
     * @param status
     *        The status you want to assign to the certificate. Active means that the certificate can be
     *        used for API calls to AWS Inactive means that the certificate cannot be used.
     * @see StatusType
     */

    public void setStatus(StatusType status) {
        withStatus(status);
    }

    /**
     *

     * The status you want to assign to the certificate. Active means that the certificate can be used for
     * API calls to AWS Inactive means that the certificate cannot be used.
     *

     *
     * @param status
     *        The status you want to assign to the certificate. Active means that the certificate can be
     *        used for API calls to AWS Inactive means that the certificate cannot be used.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see StatusType
     */

    public UpdateSigningCertificateRequest withStatus(StatusType status) {
        this.status = status.toString();
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getUserName() != null)
            sb.append("UserName: ").append(getUserName()).append(",");
        if (getCertificateId() != null)
            sb.append("CertificateId: ").append(getCertificateId()).append(",");
        if (getStatus() != null)
            sb.append("Status: ").append(getStatus());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof UpdateSigningCertificateRequest == false)
            return false;
        UpdateSigningCertificateRequest other = (UpdateSigningCertificateRequest) obj;
        if (other.getUserName() == null ^ this.getUserName() == null)
            return false;
        if (other.getUserName() != null && other.getUserName().equals(this.getUserName()) == false)
            return false;
        if (other.getCertificateId() == null ^ this.getCertificateId() == null)
            return false;
        if (other.getCertificateId() != null && other.getCertificateId().equals(this.getCertificateId()) == false)
            return false;
        if (other.getStatus() == null ^ this.getStatus() == null)
            return false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getUserName() == null) ? 0 : getUserName().hashCode());
        hashCode = prime * hashCode + ((getCertificateId() == null) ? 0 : getCertificateId().hashCode());
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return hashCode;
    }

    @Override
    public UpdateSigningCertificateRequest clone() {
        return (UpdateSigningCertificateRequest) super.clone();
    }

}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace DocumentFormat.OpenXml.Generator.Models;

internal class StronglyTypedType
{
    public QName Type { get; set; } = null!;

    public IEnumerable<StronglyTypedElement> Elements { get; set; } = Enumerable.Empty<StronglyTypedElement>();
}


text:
/**
 * @jsx React.DOM
 */

var GridRow = React.createClass({
	render: function() {
		var gridCells = [0, 0, 0, 0];

		gridCells = gridCells.map(function(cell){
			return (<GridCell/>)
		})

		return (

					{gridCells}

);
	}
});

var GridCell = React.createClass({
	render: function() {
		return (

);
	}
});

var Grid = React.createClass({
	render: function(){
		var gridRows = [0, 0, 0, 0];

		gridRows = gridRows.map(function(cell){
			return (<GridRow/>)
		})

		return (
{gridRows}
);
	}
});

var Tile = React.createClass({
	render: function(){
		// console.log(this.props);
		var tileValue = 'tile-' + this.props.value,
			tilePos = 'tile-position-' + this.props.x + '-' + this.props.y,
			tileClass = {
				'tile': true,
				'tile-new': true,
				'tile-merged': this.props.merged
			},
			calculatePosition = function(x, y){
				var tilePosition = 121;

				x = x * tilePosition;
				y = y * tilePosition;

				return 'translate(' + x + 'px, ' + y + 'px)';

			},
			position = calculatePosition(this.props.x, this.props.y),
			tileStyle = {};

			tileStyle.WebkitTransform = position;
			tileStyle.MozTransform = position;
			tileStyle.transform = position;
			tileClass[tileValue] = true;
			tileClass[tilePos] = true;
			tileClass = React.addons.classSet(tileClass);

		return (

{this.props.value}

);
	}
});

var Tiles = React.createClass({

	render: function(){

		var tiles = this.props.tiles.map(function(tile){
			return (<Tile value={tile.value} x={tile.x} y={tile.y} />);
		});

		return (
{tiles}
);
	}
});

var Button = React.createClass({

	handleClick: function(e) {
		console.log('clcik');
	},

	render: function(){
		return ({this.props.text});
	}
});

var Score = React.createClass({
	render: function(){
		return (
{this.props.score}
);
	}
});

var SelectTiles = React.createClass({

	handleChange: function(e){
		console.log(this);
	},

	render: function(){
		return (<select v-on="change: changesTilesSize" onChange={this.handleChange}>
					<option value="4">4 tiles</option>
					<option value="5">5 tiles</option>
					<option value="6">6 tiles</option>
				</select>);
	}

});

var Game = React.createClass({

	getInitialState: function() {
		return {
				score: 1,
				size: 4,
				bestScore: gameStorage.fetch('react2048-config').bestScore || 10,
				tiles: []
			};
	},

	componentDidMount: function() {
		// console.log('--------componentDidMount-------');
	},

	componentDidUpdate: function() {
		// console.log('--------componentDidUpdate-------');
	},

	componentWillMount: function() {
		// console.log('--------componentWillMount-------');

		var data = gameStorage.fetch('react2048');

		if (data.length === 0) {
			this.init();
		} else {
			this.continueGame(data);
		}

	},

	componentWillReceiveProps: function() {
		// console.log('--------componentWillReceiveProps-------');
	},

	componentWillUnmount: function() {
		// console.log('--------componentWillUnmount-------');
	},

	componentWillUpdate: function() {
		// console.log('--------componentWillUpdate-------');
	},

	render: function(){

		return (

2048

							<Score class="score-container" score={this.state.score} />
							<Score class="best-container" score={this.state.bestScore} />

Join the numbers and get to the 2048 tile!

						<Button text="New Game" class="restart-button" />
						Select the number of tiles
						<SelectTiles />

								Keep going
								Try again

							<Grid/>

							<Tiles tiles={this.state.tiles} />

);
	},

	init: function() {

		var startTiles = this.props.startTiles;
		this.initArrayGrid(this.state.size);

		//this.clearMessage();

		this.updateScore(0);

		for (var i = 0; i < this.props.startTiles; i++) {
			this.addRandomTile();
		}
	},

	continueGame: function(data) {
		var arr,
			conf;

		this.conf = conf =  gameStorage.fetch('react2048-config');
		this.initArrayGrid(this.state.size);
		arr = this.grid;
		this.state.tiles = data;

		data.forEach(function(item) {
			arr[item.x][item.y] = 1;
		});
	},

	gameOver: function() {
		this.message();
	},

	initArrayGrid: function(size) {
		var arr = [];

		for (var x = 0; x < size; x++) {
			arr[x] = [];
			for (var y = 0; y < size; y++) {
				arr[x][y] = 0;
			}
		}

		this.grid = arr;
	},

	changesTilesSize: function(e) {
		this.state.size = parseInt(e.target.value);

		this.init();
	},

	addRandomTile: function() {

		if (this.availableCells().length > 0) {
			var value = Math.random() < 0.9 ? 2 : 4,
				randomCell = this.randomAvailableCell(),
				tiles = this.state.tiles;

			this.grid[randomCell.x][randomCell.y] = 1;

			tiles.push({
				x: randomCell.x,
				y: randomCell.y,
				value: value
			});

			this.setState({
				tiles: tiles
			});

			console.log(this.state.tiles);

		}

	},

	// Find the first available random position
	randomAvailableCell: function() {
		var cells = this.availableCells();

		if (cells.length) {
			return cells[Math.floor(Math.random() * cells.length)];
		}
	},

	availableCells: function() {
		var cells = [],
			size = this.state.size,
			grid = this.grid;

		for (var x = 0; x < size; x++) {
			for (var y = 0; y < size; y++) {
				if (!grid[x][y]) {
					cells.push({
						x: x,
						y: y
					});
				}
			}
		}

		return cells;
	},

	getVector: function(direction) {
		var map = {
			0: {
				x: 0,
				y: -1
			}, // Up
			1: {
				x: 1,
				y: 0
			}, // Right
			2: {
				x: 0,
				y: 1
			}, // Down
			3: {
				x: -1,
				y: 0
			} // Left
		};

		return map[direction];
	},

	findFarthestPosition: function(cell, vector) {
		var previous;

		do {
			previous = cell;
			cell = {
				x: previous.x + vector.x,
				y: previous.y + vector.y
			};

		} while (this.withinBounds(cell) && !this.grid[cell.x][cell.y]);

		return {
			farthest: previous,
			next: cell // Used to check if a merge is required
		};
	},

	findTile: function(position) {

		if (position.x === -1 || position.y === -1)
			return null;
		else {
			var tiles = this.state.tiles;

			return tiles.filter(function(item, index) {
				//console.log(item, index);

				return item.x === position.x && item.y === position.y;
			})[0];
		}

	},

	moveTile: function(tile, position) {

		if (tile.x === position.x && tile.y === position.y) {
			return false;
		} else {
			this.grid[tile.x][tile.y] = 0;
			this.grid[position.x][position.y] = 1;

			var tiles = this.state.tiles;

			//Better Way to find index of data
			for (var key in tiles) {
				if (tiles[key].x === tile.x && tiles[key].y === tile.y) {
					break;
				}
			}

			tiles[key].x = position.x;
			tiles[key].y = position.y;

			// this.setState({
			// 	tiles: tiles
			// });

			// tile.x = position.x;
			// tile.y = position.y;

			return true;
		}

	},

	mergeTiles: function(curr, next, position) {
		//debugger;
		next.value = next.value * 2;
		next.merged = true;
		var tiles = this.state.tiles;

		//Better Way to find index of data
		for (var key in tiles) {
			if (tiles[key].x === curr.x && tiles[key].y === curr.y) {
				break;
			}
		}

		this.grid[curr.x][curr.y] = 0;
		tiles.splice(key, 1);

		console.log(tiles);

		// this.setState({
		// 	tiles: tiles
		// });

		// Update the score
		this.updateScore(next.value);

		return true;
	},

	move: function(direction) {

		var vector = this.getVector(direction);
		var traversals = this.buildTraversals(vector);
		var moved = false;
		var self = this;
		var grid = self.grid;
		var positions;
		var next;
		var tile;

		traversals.x.forEach(function(x) {
			traversals.y.forEach(function(y) {
				// console.log(x, y);
				if (grid[x][y]) {
					var tile = self.findTile({
						x: x,
						y: y
					});
					var positions = self.findFarthestPosition({
						x: x,
						y: y
					}, vector);
					//console.log(positions);
					var next = self.findTile(positions.next);

					//console.log(next);
					// Only one merger per row traversal?
					if (next && next.value === tile.value) {
						moved = self.mergeTiles(tile, next, positions.next);

					} else {

						moved = self.moveTile(tile, positions.farthest);
					}

				}

			});
		});

		if (moved) {
			this.addRandomTile();

			if(grid.toString().indexOf('0') === -1){
				if(!this.tileMatchesAvailable()){
					this.gameOver();
				}

			}

		}

	},

	tileMatchesAvailable: function() {

		var size = this.state.size;
		var grid = this.grid;
		var tiles = this.state.tiles;
		var tile;

		for (var x = 0; x < size; x++) {
			for (var y = 0; y < size; y++) {
				tile = grid[x][y];

				if (tile) {
					for (var direction = 0; direction < 4; direction++) {
						var vector = this.getVector(direction);
						var cell = {
							x: x + vector.x,
							y: y + vector.y
						},
							other;

						if (cell.x >= 0 && cell.x < size && cell.y >= 0 && cell.y < size){
							other = grid[cell.x][cell.y];
						} else {
							continue;
						}

						if (other && this.findTile(cell).value === this.findTile({
							x: x,
							y: y
						}).value) {
							return true; // These two tiles can be merged
						}
					}
				}
			}
		}

		return false;
	},

	withinBounds: function(position) {
		var size = this.state.size;

		return position.x >= 0 && position.x < size && position.y >= 0 && position.y < size;
	},

	buildTraversals: function(vector) {
		var traversals = {
			x: [],
			y: []
		},
			size = this.state.size;

		for (var pos = 0; pos < size; pos++) {
			traversals.x.push(pos);
			traversals.y.push(pos);
		}

		// Always traverse from the farthest cell in the chosen direction
		if (vector.x === 1) traversals.x = traversals.x.reverse();
		if (vector.y === 1) traversals.y = traversals.y.reverse();

		return traversals;
	},

	updateScore: function(score) {
		var scoreContainer = document.getElementsByClassName('score-container')[0];

		//On init
		if (score === 0) {
			//this.conf.score = 0;
			this.setState({
				score:0
			});

			return false;
		}

		this.setState({
			score: this.state.score + score
		});

		//this.conf.score += score;
		//gameStorage.save('score', this.score);

		if(this.state.score > this.state.bestScore) {
			this.state.bestScore = this.state.score;
			//gameStorage.save('bestScore', this.bestScore);
		}

		// The mighty 2048 tile
		if (score === 2048)
			this.message(true);

		var addition = document.createElement("div");
		addition.classList.add("score-addition");
		addition.textContent = "+" + score;
		scoreContainer.appendChild(addition);

	},

	message: function(won) {
		var type = won ? "game-won" : "game-over";
		var message = won ? "You win!" : "Game over!";
		var messageContainer = document.querySelector(".game-message");

		messageContainer.classList.add(type);
		messageContainer.getElementsByTagName("p")[0].textContent = message;
	},

	clearMessage: function() {
		messageContainer = document.querySelector(".game-message");

		messageContainer.classList.remove("game-won");
		messageContainer.classList.remove("game-over");
	},

	clearContainer: function(container) {
		while (container.firstChild) {
			container.removeChild(container.firstChild);
		}
	},

	getWindowSize: function() {
		var w = window,
			d = document,
			e = d.documentElement,
			g = d.getElementsByTagName('body')[0],
			x = w.innerWidth || e.clientWidth || g.clientWidth,
			y = w.innerHeight || e.clientHeight || g.clientHeight;

		if (x < 520) {
			this.tileDimension = 69.5;
			this.tilePosition = 67;
		} else {
			this.tileDimension = 124;
			this.tilePosition = 121;

		}
	}

});

var data = []

var game = React.renderComponent(
		<Game tiles={data} startTiles="2" score="0" bestScore="0" />,
		document.body
	);

var Keys = new KeyboardInputManager();

Keys.on('move', function(direction) {
	game.move(direction);
});

// window.onresize = function(event) {
//     Game.getWindowSize();
// };


text:
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Software Facts skill, try saying...

* *Alexa, open software facts*

* *Alexa, ask software facts give me a fact*

* *Alexa, ask software facts tell me a fact*

facts & trivia about software for web development

***

### Skill Details

* **Invocation Name:** software facts
* **Category:** null
* **ID:** amzn1.ask.skill.c76c30a9-c810-452d-bed5-9a3a1af858fc
* **ASIN:** B01LXBRPWT
* **Author:** alphine
* **Release Date:** October 6, 2016 @ 02:12:02
* **In-App Purchasing:** No


text:
.class public interface abstract Ljavax/sip/header/Encoding;
.super Ljava/lang/Object;
.source "Encoding.java"

# virtual methods
.method public abstract getEncoding()Ljava/lang/String;
.end method

.method public abstract setEncoding(Ljava/lang/String;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/text/ParseException;
        }
    .end annotation
.end method


text:
define([
    'jquery',
    '../utils/util',
    '../utils/storage',
    '../utils/defaults',
    'metro-select',
], (jquery, util, storage, defaults) => {
    let templates = {
        column: util.createElement('

'),
        item: util.createElement('

'),
    };

    let pagebase = function pagebase() {};

    pagebase.prototype.className = 'pagebase';

    pagebase.prototype.init = function (
        document,
        name,
        rootNode,
        templateFunc
    ) {
        this.name = name;
        this.rootNode = rootNode;
        this.sort = storage.get(`${this.name}_sort`, false);
        this.currentPage = 0;
        this.templateFunc = templateFunc;
        this.page = 0;

        util.addClass(this.rootNode, this.className);

        if (jquery(`#${this.name}-sort-chooser`).length !== 0) {
            jquery(`#${this.name}-sort-chooser`).metroSelect({
                initial: this.getSort(),
                onchange: this.sortChanged.bind(this),
            });
        }
    };

    /**
     * Build the dom.
     *
     * @param {any} rows HTML rows to be added to the Dom.
     */
    pagebase.prototype.buildDom = function buildDom(rows) {
        this.clear();
        this.addAll(rows);
    };

    /**
     * Add all rows to the page.
     *
     * @param {any} rows The new ros to be added to the page.
     */
    pagebase.prototype.addAll = function addAll(rows) {
        let nodes = [];
        for (let i = 0; i < rows.length; i++) {
            let item = templates.item.cloneNode(true);
            item.id = `${this.name}_${i}`;
            item.firstElementChild.id = `${this.name}_${i}`;
            item.firstElementChild.appendChild(
                this.templateFunc(rows[i], this.currentPage)
            );
            nodes.push(item);
        }

        if (this.getSort() === 'sorted') {
            nodes.sort(this.sortFunc);
        } else {
            nodes.sort(this.unsortFunc);
        }

        this.addAllNodes(nodes);
    };

    /**
     * Adds all the given HTML nodes to the DOM, in a naive way (top to bottom, left to right).
     *
     * @param {any} nodes List of nodes to be added.
     */
    pagebase.prototype.addAllNodes = function addAllNodes(nodes) {
        if (nodes.length) {
            let pageIndex = this.rootNode.children.length;
            let columnNode = templates.column.cloneNode(true);
            columnNode.firstElementChild.id = `${this.name}_${pageIndex}`;

            for (let i = 0; i < nodes.length; i++) {
                columnNode.firstElementChild.appendChild(nodes[i]);
            }

            this.rootNode.appendChild(columnNode);
        }
    };

    /**
     * Clear the list of elements in the page.
     */
    pagebase.prototype.clear = function clear() {
        this.currentPage = 0;
        while (this.rootNode.firstElementChild) {
            this.rootNode.firstElementChild.remove();
        }
    };

    /**
     * Called when the sort options on the page chagnes.
     *
     * @param {any} newSort The new sort order.
     * @param {any} saveSort Whether the new sort should be saved.
     */
    pagebase.prototype.sortChanged = function sortChanged(newSort, saveSort) {
        let currentSort = this.getSort();
        if (saveSort === currentSort) {
            return;
        }

        this.updateSort(newSort);

        if (!!this.rootNode && this.rootNode.childElementCount !== 0) {
            let items = Array.prototype.slice.call(this.rootNode.children);
            while (this.rootNode.lastChild) {
                this.rootNode.removeChild(this.rootNode.lastChild);
            }

            if (newSort === 'sorted') {
                items.sort(this.sortFunc.bind(this));
            } else {
                items.sort(this.unsortFunc.bind(this));
            }

            for (let i = 0; i < items.length; i++) {
                this.rootNode.appendChild(items[i]);
            }
        }
    };

    /**
     * Sort the provided elements in order.
     *
     * @param {any} a The first element being compared.
     * @param {any} b The second element being compared.
     * @return {any} True if the first element is larger, false otherwise.
     */
    pagebase.prototype.sortFunc = function sortFunc(a, b) {
        return pagebase.prototype.compareFunc(a.textContent, b.textContent);
    };

    /**
     * Revert the sorting on the elements.
     *
     * @param {any} a The first element being compared.
     * @param {any} b The second element being compared.
     * @return {any} True if the first element was naturally first.
     */
    pagebase.prototype.unsortFunc = function unsortFunc(a, b) {
        return pagebase.prototype.compareFunc(a.id, b.id);
    };

    /**
     * Compare the two fields for sorting.
     *
     * @param {any} a The first element being compared.
     * @param {any} b The second element being compared.
     * @return {any} True if the first element is larger, false otherwise.
     */
    pagebase.prototype.compareFunc = function compareFunc(a, b) {
        let nameA = a.toUpperCase();
        let nameB = b.toUpperCase();
        if (nameA < nameB) {
            return -1;
        } else if (nameA > nameB) {
            return 1;
        }
    };

    /**
     * Gets the sort order for the current page.
     *
     * @return {any} True if the page should be sorted, false otherwise.
     */
    pagebase.prototype.getSort = function getSort() {
        let sort = storage.get('sort', defaults.defaultSort);
        return sort[this.name];
    };

    /**
     * Updates the current sort options.
     *
     * @param {any} newSort The new sort order.
     */
    pagebase.prototype.updateSort = function updateSort(newSort) {
        let sort = storage.get('sort', defaults.defaultSort);
        sort[this.name] = newSort;
        storage.save('sort', sort);
    };

    return pagebase;
});


text: the branch simple_example contains a simple example of how to use the app package


text:
package apollo.gui.detailviewers.sequencealigner.actions;

import java.awt.event.ActionEvent;
import java.util.Vector;

import javax.swing.AbstractAction;

import apollo.datamodel.SeqFeatureI;
import apollo.editor.AnnotationEditor;
import apollo.gui.synteny.GuiCurationState;

/**
 * An Action class for deleting an exon
 */
public class DeleteExonAction extends AbstractAction {

  private SeqFeatureI feature;
  private GuiCurationState curationState;
  private AnnotationEditor annotationEditor;

  /**
   * Constructor
   * @param name the name of this action
   * @param curationState the curation state
   * @param annotationEditor the annotation editor
   */
  public DeleteExonAction(String name, GuiCurationState curationState,
      AnnotationEditor annotationEditor) {
    super(name);
    this.curationState = curationState;
    this.annotationEditor = annotationEditor;
    this.feature = null;
    this.setEnabled(false);
  }

  /**
   * Performs the deletion
   */
  public void actionPerformed(ActionEvent e) {

    if (!canExecute()) {
      throw new IllegalStateException("feature:" + feature);
    }

    Vector<SeqFeatureI> exons = new Vector<SeqFeatureI>();
    exons.addElement(feature);

    annotationEditor.setSelections(exons, exons, null, null);
    annotationEditor.deleteSelectedFeatures();

    curationState.getSZAP().repaint();
    // TODO repaint all msa's
  }

  /**
   * Sets the exon which is to be deleted
   * @param feature
   */
  public void setFeature(SeqFeatureI feature) {
    this.feature = feature;
  }

  private boolean canExecute() {
    return feature != null && !feature.hasKids() && feature.isExon();
  }

}


text:
<?php

namespace NilPortugues\SchemaOrg\Properties;

use NilPortugues\SchemaOrg\SchemaProperty;

/**
 * Component (sub-)structure(s) that comprise this anatomical structure.
 */
class SubStructureProperty extends SchemaProperty
{
    const SCHEMA_URL = 'http://schema.org/subStructure';
    const PROPERTY_NAME = 'subStructure';

    /**
     * A list of schemas allowed to use this property.
     *
     * @var array
     */
    protected static $allowedSchemas = [
        'http://schema.org/AnatomicalStructure',
    ];
}


text:
package job

import (
	"log"

	"github.com/kubernetes/dashboard/client"
	"github.com/kubernetes/dashboard/resource/common"
	"github.com/kubernetes/dashboard/resource/pod"
	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/apis/batch"
	k8sClient "k8s.io/kubernetes/pkg/client/unversioned"
)

// JobDetail is a presentation layer view of Kubernetes Job resource. This means
// it is Job plus additional augmented data we can get from other sources
// (like services that target the same pods).
type JobDetail struct {
	ObjectMeta common.ObjectMeta `json:"objectMeta"`
	TypeMeta   common.TypeMeta   `json:"typeMeta"`

	// Aggregate information about pods belonging to this Job.
	PodInfo common.PodInfo `json:"podInfo"`

	// Detailed information about Pods belonging to this Job.
	PodList pod.PodList `json:"podList"`

	// Container images of the Job.
	ContainerImages []string `json:"containerImages"`

	// List of events related to this Job.
	EventList common.EventList `json:"eventList"`

	// Parallelism specifies the maximum desired number of pods the job should run at any given
	// time.
	Parallelism *int32 `json:"paralleism"`

	// Completions specifies the desired number of successfully finished pods the job should be
	// run with.
	Completions *int32 `json:"completions"`
}

// GetJobDetail gets job details.
func GetJobDetail(client k8sClient.Interface, heapsterClient client.HeapsterClient,
	namespace, name string) (*JobDetail, error) {

	log.Printf("Getting details of %s service in %s namespace", name, namespace)

	// TODO(floreks): Use channels.
	jobData, err := client.Extensions().Jobs(namespace).Get(name)
	if err != nil {
		return nil, err
	}

	channels := &common.ResourceChannels{
		PodList: common.GetPodListChannel(client, common.NewSameNamespaceQuery(namespace), 1),
	}

	pods := <-channels.PodList.List
	if err := <-channels.PodList.Error; err != nil {
		return nil, err
	}

	events, err := GetJobEvents(client, jobData.Namespace, jobData.Name)
	if err != nil {
		return nil, err
	}

	job := getJobDetail(jobData, heapsterClient, events, pods.Items)
	return &job, nil
}

func getJobDetail(job *batch.Job, heapsterClient client.HeapsterClient,
	events *common.EventList, pods []api.Pod) JobDetail {

	matchingPods := common.FilterNamespacedPodsBySelector(pods, job.ObjectMeta.Namespace,
		job.Spec.Selector.MatchLabels)

	podInfo := getPodInfo(job, matchingPods)

	return JobDetail{
		ObjectMeta:      common.NewObjectMeta(job.ObjectMeta),
		TypeMeta:        common.NewTypeMeta(common.ResourceKindJob),
		ContainerImages: common.GetContainerImages(&job.Spec.Template.Spec),
		PodInfo:         podInfo,
		PodList:         pod.CreatePodList(matchingPods, heapsterClient),
		EventList:       *events,
		Parallelism:     job.Spec.Parallelism,
		Completions:     job.Spec.Completions,
	}
}


text:
class ActiveRecord::Relation
  include AlterMvc::Extensions::CollectionRenderable

  def fetch_collection
    self.to_a
  end

end


text:
<?php

namespace Product\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class ProductController extends AbstractActionController
{
    public function indexAction ()
    {
        $sm = $this->getServiceLocator();
        $ProductTable = $sm->get('ProductTable');
        $product = $ProductTable->fetchAll();

        $viewData = array(
            "products" => $product
        );

        return new ViewModel($viewData);
    }

    public function viewAction()
    {
        $id = $this->params()->fromRoute('id', 0);
        $sm = $this->getServiceLocator();
        $ProductTable = $sm->get('ProductTable');
        $product = $ProductTable->viewProduct($id);

        $viewData = array(
            "products" => $product
        );

        return new ViewModel($viewData);
    }

	public function addCartAction ()
	{
		$sm = $this->getServiceLocator();
        $CartTable = $sm->get('CartTable');
        $CartItemTable = $sm->get('CartItemTable');
        $ProductTable = $sm->get('ProductTable');
        $Session = $sm->get('CartSessionContainer');

		$request = $this->getRequest();

        $cartdata = $request->getPost();

		if ($request->isPost()) {
            $cartid = $this->layout()->cart_id;

            if (isset($this->layout()->cart_id)) {
                $cartid = $cartid;
            } else {
                $cartid = $CartTable->addToCart($cartid);
                $Session->cart_id = $cartid;
            }

            $productDetails = $ProductTable->getProductById($cartdata->product_id);
            exit;

            $checkCartItem = $CartItemTable->checkCartItem($cartid, $cartdata->product_id);

            $CartItemTable->addToCartItem($cartid, $cartdata);
            $this->redirect()->toRoute('product', array('action' => 'cart'));
		} else {
			 $this->redirect()->toRoute('home');
		}
	}

    public function cartAction()
    {

        $sm = $this->getServiceLocator();
        $CartItemTable = $sm->get('CartItemTable');

        $cartdetail = $CartItemTable->cartdetails($this->layout()->cart_id);

        $viewData = array(
            "cartitem" => $cartdetail
        );

        return new ViewModel($viewData);
    }

    public function shippingAction()
    {
        if (!isset($this->layout()->customer_id) AND !isset($this->layout()->cart_id)) {
            $this->redirect()->toRoute('home');
        }

        $sm = $this->getServiceLocator();
        $ShippingTable = $sm->get('ShippingTable');
        $CartItemTable = $sm->get('CartItemTable');
        $ShippingnForm = $sm->get('ShippingForm');
        $request = $this->getRequest();

        if ($request->isPost()) {
            $ShippingFilter = $sm->get('ShippingFilter');
            $ShippingnForm->setInputFilter($ShippingFilter);
            $ShippingnForm->setData($request->getPost());

            if($ShippingnForm->isValid()) {
                $ShippingRegistration = $sm->get('Cart');
                $CartTable = $sm->get('CartTable');
                $CustomerTable = $sm->get('CustomerTable');
                $ShippingRegistration->exchangeArray($ShippingnForm->getData());
                $custommerInfo = $CustomerTable->getCustomerInfo($this->layout()->customer_id);
                $CartTable->updateCart($custommerInfo,$ShippingRegistration,$this->layout()->cart_id);

                $this->redirect()->toRoute('product', array('action' => 'payment'));
            }
        }

        $cartweight = $CartItemTable->getCartTotalWeight($this->layout()->cart_id);
        $cartprice = $CartItemTable->getCartTotalPrice($this->layout()->cart_id);
        $cartweight = ceil($cartweight);

        $shippingpriceground = $ShippingTable->shippingpriceground($this->layout()->cart_id, $cartweight, $shippingamount=0);
        $shippingpriceexpedited = $ShippingTable->shippingpriceexpedited($this->layout()->cart_id, $cartweight, $shippingamount=0);

        $viewData = array(
            "subtotal" => $cartprice,
            "Shipping" => $ShippingnForm,
            "ground" =>  $shippingpriceground,
            "expedited" => $shippingpriceexpedited,
            "totalweight" => $cartweight
        );

        return new ViewModel($viewData);
    }

    public function paymentAction()
    {
        if (!isset($this->layout()->customer_id)) {
            $this->redirect()->toRoute('home');
        }

        $sm = $this->getServiceLocator();
        $CartItemTable = $sm->get('CartItemTable');
        $CartTable = $sm->get('CartTable');
        $cartItemdetail = $CartItemTable->cartdetails($this->layout()->cart_id);
        $cartdetail = $CartTable->cartsdetails($this->layout()->cart_id);

        $viewData = array(
            "cartItemdetails" => $cartItemdetail,
            "cartDetails" => $cartdetail
        );

         return new ViewModel($viewData);
    }

    public function orderconfirmationAction()
    {
        if (!isset($this->layout()->customer_id)) {
            $this->redirect()->toRoute('home');
        }

        $sm = $this->getServiceLocator();
        $JobTable = $sm->get('JobTable');
        $JobItemTable = $sm->get('JobItemTable');
        $CartItemTable = $sm->get('CartItemTable');
        $CartTable = $sm->get('CartTable');
        $cartItemdetail = $CartItemTable->cartdetails($this->layout()->cart_id);
        $cartdetail = $CartTable->cartsdetails($this->layout()->cart_id);
        $joborder = $JobTable->insertToJob($cartdetail);
		$jobitem = $JobItemTable->insertToJobItem($cartItemdetail);

		$viewData = array(
            "cartItemdetails" => $cartItemdetail,
            "cartDetails" => $cartdetail
        );

        return new ViewModel($viewData);
    }
}


text:
using System.Collections.Generic;
using System.Data;
using FluentMigrator.Expressions;
using FluentMigrator.Infrastructure;
using FluentMigrator.Model;
using System;

namespace FluentMigrator.Builders.Create.Column
{
	public class CreateColumnExpressionBuilder : ExpressionBuilderWithColumnTypesBase<CreateColumnExpression, ICreateColumnOptionSyntax>,
		ICreateColumnOnTableSyntax,
		ICreateColumnOptionSyntax,
		ICreateColumnAsTypeOrInSchemaSyntax
	{
		private readonly IMigrationContext _context;

		public CreateColumnExpressionBuilder(CreateColumnExpression expression, IMigrationContext context)
			: base(expression)
		{
			_context = context;
		}

		public ICreateColumnAsTypeOrInSchemaSyntax OnTable(string name)
		{
			Expression.TableName = name;
			return this;
		}

		public ICreateColumnAsTypeSyntax InSchema(string schemaName)
		{
			Expression.SchemaName = schemaName;
			return this;
		}

		public ICreateColumnOptionSyntax WithDefaultValue(object value)
		{
			Expression.Column.DefaultValue = value;
			return this;
		}

		public ICreateColumnOptionSyntax Identity()
		{
			Expression.Column.IsIdentity = true;
			return this;
		}

		public ICreateColumnOptionSyntax Indexed()
		{
			Expression.Column.IsIndexed = true;
			return this;
		}

		public ICreateColumnOptionSyntax PrimaryKey()
		{
			Expression.Column.IsPrimaryKey = true;
			return this;
		}

		public ICreateColumnOptionSyntax PrimaryKey(string primaryKeyName)
		{
			Expression.Column.IsPrimaryKey = true;
			Expression.Column.PrimaryKeyName = primaryKeyName;
			return this;
		}

		public ICreateColumnOptionSyntax Nullable()
		{
			Expression.Column.IsNullable = true;
			return this;
		}

		public ICreateColumnOptionSyntax NotNullable()
		{
			Expression.Column.IsNullable = false;
			return this;
		}

		public ICreateColumnOptionSyntax Unique()
		{
			Expression.Column.IsUnique = true;
			return this;
        }

        public ICreateColumnOptionSyntax ForeignKey(string primaryTableName, string primaryColumnName)
        {
            return ForeignKey(null, null, primaryTableName, primaryColumnName);
        }

        public ICreateColumnOptionSyntax ForeignKey(string foreignKeyName, string primaryTableName, string primaryColumnName)
        {
            return ForeignKey(foreignKeyName, null, primaryTableName, primaryColumnName);
        }

        public ICreateColumnOptionSyntax ForeignKey(string foreignKeyName, string primaryTableSchema, string primaryTableName, string primaryColumnName)
        {
            Expression.Column.IsForeignKey = true;

            var fk = new CreateForeignKeyExpression
            {
                ForeignKey = new ForeignKeyDefinition
                {
                    Name = foreignKeyName,
                    PrimaryTable = primaryTableName,
                    PrimaryTableSchema = primaryTableSchema,
                    ForeignTable = Expression.TableName,
                    ForeignTableSchema = Expression.SchemaName
                }
            };

            fk.ForeignKey.PrimaryColumns.Add(primaryColumnName);
            fk.ForeignKey.ForeignColumns.Add(Expression.Column.Name);

            _context.Expressions.Add(fk);
            return this;
        }

        public ICreateColumnOptionSyntax ReferencedBy(string foreignTableName, string foreignColumnName)
        {
            return ReferencedBy(null, null, foreignTableName, foreignColumnName);
        }

        public ICreateColumnOptionSyntax ReferencedBy(string foreignKeyName, string foreignTableName, string foreignColumnName)
        {
            return ReferencedBy(foreignKeyName, null, foreignTableName, foreignColumnName);
        }

        public ICreateColumnOptionSyntax ReferencedBy(string foreignKeyName, string foreignTableSchema, string foreignTableName, string foreignColumnName)
        {
            var fk = new CreateForeignKeyExpression
            {
                ForeignKey = new ForeignKeyDefinition
                {
                    Name = foreignKeyName,
                    PrimaryTable = Expression.TableName,
                    PrimaryTableSchema = Expression.SchemaName,
                    ForeignTable = foreignTableName,
                    ForeignTableSchema = foreignTableSchema
                }
            };

            fk.ForeignKey.PrimaryColumns.Add(Expression.Column.Name);
            fk.ForeignKey.ForeignColumns.Add(foreignColumnName);

            _context.Expressions.Add(fk);
            return this;
        }

        [Obsolete("Use ForeignKey(string,string)")]
        public ICreateColumnOptionSyntax ForeignKey()
        {
            Expression.Column.IsForeignKey = true;
            return this;
        }

        [Obsolete("Use ReferencedBy")]
        public ICreateColumnOptionSyntax References(string foreignKeyName, string foreignTableName, IEnumerable<string> foreignColumnNames)
        {
            return References(foreignKeyName, null, foreignTableName, foreignColumnNames);
        }

        [Obsolete("Use ReferencedBy")]
        public ICreateColumnOptionSyntax References(string foreignKeyName, string foreignTableSchema, string foreignTableName, IEnumerable<string> foreignColumnNames)
        {
            var fk = new CreateForeignKeyExpression
            {
                ForeignKey = new ForeignKeyDefinition
                {
                    Name = foreignKeyName,
                    PrimaryTable = Expression.TableName,
                    PrimaryTableSchema = Expression.SchemaName,
                    ForeignTable = foreignTableName,
                    ForeignTableSchema = foreignTableSchema
                }
            };

            fk.ForeignKey.PrimaryColumns.Add(Expression.Column.Name);
            foreach (var foreignColumnName in foreignColumnNames)
                fk.ForeignKey.ForeignColumns.Add(foreignColumnName);

            _context.Expressions.Add(fk);
            return this;
        }

		protected override ColumnDefinition GetColumnForType()
		{
			return Expression.Column;
		}
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
namespace Homeinns.Common.Base.Web
{
    /// <summary>
    /// Cookie操作
    /// </summary>
    public class CookieUtil
    {
        /// <summary>
        ///设置Cookie值
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="expiresDay"></param>
        public static void SetCookieValue(string key, string value, double expiresDay)
        {
            HttpContext.Current.Response.Cookies.Set(new HttpCookie(key, value) { Expires = DateTime.Now.AddDays(expiresDay) });
        }

        /// <summary>
        /// 设置Cookie值
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <param name="expiresDay">天数</param>
        public static void SetCookieValue(string name, string key, string value, double expiresDay)
        {
            HttpCookie cookie = new HttpCookie(name);
            cookie.Values.Add(key, value);
            cookie.Expires = DateTime.Now.AddDays(expiresDay);
            HttpContext.Current.Response.Cookies.Set(cookie);
        }

        /// <summary>
        /// 获取Cookie值
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static HttpCookie GetCookieValue(string name)
        {
            return HttpContext.Current.Request.Cookies.Get(name) ?? null;
        }
        /// <summary>
        ///移除Cookie值
        /// </summary>
        /// <param name="cookie"></param>
        public static void RemoveCookieValue(string name)
        {
            HttpCookie myCookie = GetCookieValue(name);
            if (myCookie != null)
            {
                myCookie.Expires = DateTime.Now.AddDays(-1);
                HttpContext.Current.Response.Cookies.Add(myCookie);
            }
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syst. mycol. (Lundae) 2(1): 222 (1822)

#### Original name
Tremella auricula-canis G. Mey.

### Remarks
null


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/geo-political/north-america-and-caribbean/canada/ontario/waterford-ontario-canada" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/geo-political/north-america-and-caribbean/canada/ontario/waterford-ontario-canada</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Waterford (Ontario, Canada)</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/geo-political/north-america-and-caribbean/canada/ontario/waterford-ontario-canada</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/geo-political/north-america-and-caribbean/canada/ontario/waterford-ontario-canada</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
  </sem:triple>
</sem:triples>


text:
using System;
using System.ComponentModel.DataAnnotations;
using System.Web.DynamicData;

namespace DynamicSissOnline {
    public partial class _Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            System.Collections.IList visibleTables = Global.DefaultModel.VisibleTables;
            if (visibleTables.Count == 0) {
                throw new InvalidOperationException("There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.");
            }
            Menu1.DataSource = visibleTables;
            Menu1.DataBind();
        }

    }
}


text:
/**
 * @flow
 * Created by zhiyuan.huang@rdder.com on 17/6/7.
 */

'use strict'

function endTransformNode (el: ASTElement, options: CompilerOptions) {
  if (el.tag !== 'script') return
  if (el.attrsMap.type !== 'x-template') return

  const parent = el.parent
  if (!parent) return

  /*
  * 由于xTemplate 的render 函数生成是在genData 阶段做的,
  * 而vue 中,若ASTElement 被标记为plain=true 则会跳过genData 阶段,
  * 所以,强制将父元素标记为plain=false
  *
  * 另外,现在的处理有点偷懒:
  * 只将<script type="x-template"></script> 的父元素标记为plain=false,
  * 影响是xTemplate 子模板只支持声明在组件template 的根子层级
  * */
  parent.plain = false

  const templateKey = el.attrsMap.id || '"default"'
  const templateValue = el.children[0].text

  let parentTemplateMaps = parent.xTemplateMaps

  if (!parentTemplateMaps) parentTemplateMaps = parent.xTemplateMaps = {}

  // 将xTemplate name、value 存到父节点中,同时将script 节点从父节点清除
  parentTemplateMaps[templateKey] = JSON.stringify(templateValue)

  const index = parent.children.indexOf(el)
  parent.children.splice(index, 1)
}

function genData (el: ASTElement) {
  if (!el.xTemplateMaps) {
    return ''
  } else {

  }
  if (el.xTemplateMaps == null) return ''

  let data = 'xTemplateMaps:{'

  const templateMapStrings = []

  for (const templateKey in el.xTemplateMaps) {
    if (!el.xTemplateMaps.hasOwnProperty(templateKey)) continue

    // we know "el.xTemplateMaps" can not be undefined or null, but flow doesn't
    el.xTemplateMaps && templateMapStrings.push(`${templateKey}:${el.xTemplateMaps[templateKey]}`)
  }

  data += templateMapStrings.join(',')

  data += '},'
  return data
}

export default {
  endTransformNode,
  genData
}


text:
package com.intellij.debugger.ui.breakpoints;

import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.HelpID;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.breakpoints.XBreakpoint;
import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.java.debugger.breakpoints.properties.JavaMethodBreakpointProperties;

import javax.swing.*;

/**
 * @author Egor
 */
public class JavaWildcardMethodBreakpointType extends JavaBreakpointTypeBase<JavaMethodBreakpointProperties>
                                              implements JavaBreakpointType<JavaMethodBreakpointProperties> {

  public JavaWildcardMethodBreakpointType() {
    super("java-wildcard-method", DebuggerBundle.message("method.breakpoints.tab.title"));
  }

  @NotNull
  @Override
  public Icon getEnabledIcon() {
    return AllIcons.Debugger.Db_method_breakpoint;
  }

  @NotNull
  @Override
  public Icon getDisabledIcon() {
    return AllIcons.Debugger.Db_disabled_method_breakpoint;
  }

  @NotNull
  @Override
  public Icon getMutedEnabledIcon() {
    return AllIcons.Debugger.Db_muted_method_breakpoint;
  }

  @NotNull
  @Override
  public Icon getMutedDisabledIcon() {
    return AllIcons.Debugger.Db_muted_disabled_method_breakpoint;
  }

  //@Override
  protected String getHelpID() {
    return HelpID.METHOD_BREAKPOINTS;
  }

  //@Override
  public String getDisplayName() {
    return DebuggerBundle.message("method.breakpoints.tab.title");
  }

  @Override
  public String getDisplayText(XBreakpoint<JavaMethodBreakpointProperties> breakpoint) {
    return JavaMethodBreakpointType.getText(breakpoint);
  }

  @Nullable
  @Override
  public XBreakpointCustomPropertiesPanel<XBreakpoint<JavaMethodBreakpointProperties>> createCustomPropertiesPanel() {
    return new MethodBreakpointPropertiesPanel();
  }

  //@Override
  //public Key<MethodBreakpoint> getBreakpointCategory() {
  //  return MethodBreakpoint.CATEGORY;
  //}

  @Nullable
  @Override
  public JavaMethodBreakpointProperties createProperties() {
    return new JavaMethodBreakpointProperties();
  }

  @Nullable
  @Override
  public XBreakpoint<JavaMethodBreakpointProperties> addBreakpoint(final Project project, JComponent parentComponent) {
    final AddWildcardBreakpointDialog dialog = new AddWildcardBreakpointDialog(project);
    if (!dialog.showAndGet()) {
      return null;
    }
    return ApplicationManager.getApplication().runWriteAction((Computable<XBreakpoint<JavaMethodBreakpointProperties>>)() -> {
      JavaMethodBreakpointProperties properties = new JavaMethodBreakpointProperties(dialog.getClassPattern(), dialog.getMethodName());
      if (Registry.is("debugger.emulate.method.breakpoints")) {
        properties.EMULATED = true; // create all new emulated
      }
      return XDebuggerManager.getInstance(project).getBreakpointManager().addBreakpoint(this, properties);
    });
  }

  @NotNull
  @Override
  public Breakpoint<JavaMethodBreakpointProperties> createJavaBreakpoint(Project project, XBreakpoint<JavaMethodBreakpointProperties> breakpoint) {
    return new WildcardMethodBreakpoint(project, breakpoint);
  }
}


text:
// Windows/Control/ListView.cpp

#include "StdAfx.h"

#include "ListView.h"

#ifndef _UNICODE
extern bool g_IsNT;
#endif

namespace NWindows {
namespace NControl {

bool CListView::CreateEx(DWORD exStyle, DWORD style,
      int x, int y, int width, int height,
      HWND parentWindow, HMENU idOrHMenu,
      HINSTANCE instance, LPVOID createParam)
{
  return CWindow::CreateEx(exStyle, WC_LISTVIEW, TEXT(""), style, x, y, width,
      height, parentWindow, idOrHMenu, instance, createParam);
}

bool CListView::GetItemParam(int index, LPARAM &param) const
{
  LVITEM item;
  item.iItem = index;
  item.iSubItem = 0;
  item.mask = LVIF_PARAM;
  bool aResult = GetItem(&item);
  param = item.lParam;
  return aResult;
}

int CListView::InsertColumn(int columnIndex, LPCTSTR text, int width)
{
  LVCOLUMN ci;
  ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
  ci.pszText = (LPTSTR)text;
  ci.iSubItem = columnIndex;
  ci.cx = width;
  return InsertColumn(columnIndex, &ci);
}

int CListView::InsertItem(int index, LPCTSTR text)
{
  LVITEM item;
  item.mask = LVIF_TEXT | LVIF_PARAM;
  item.iItem = index;
  item.lParam = index;
  item.pszText = (LPTSTR)text;
  item.iSubItem = 0;
  return InsertItem(&item);
}

int CListView::SetSubItem(int index, int subIndex, LPCTSTR text)
{
  LVITEM item;
  item.mask = LVIF_TEXT;
  item.iItem = index;
  item.pszText = (LPTSTR)text;
  item.iSubItem = subIndex;
  return SetItem(&item);
}

#ifndef _UNICODE

int CListView::InsertColumn(int columnIndex, LPCWSTR text, int width)
{
  LVCOLUMNW ci;
  ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
  ci.pszText = (LPWSTR)text;
  ci.iSubItem = columnIndex;
  ci.cx = width;
  return InsertColumn(columnIndex, &ci);
}

int CListView::InsertItem(int index, LPCWSTR text)
{
  LVITEMW item;
  item.mask = LVIF_TEXT | LVIF_PARAM;
  item.iItem = index;
  item.lParam = index;
  item.pszText = (LPWSTR)text;
  item.iSubItem = 0;
  return InsertItem(&item);
}

int CListView::SetSubItem(int index, int subIndex, LPCWSTR text)
{
  LVITEMW item;
  item.mask = LVIF_TEXT;
  item.iItem = index;
  item.pszText = (LPWSTR)text;
  item.iSubItem = subIndex;
  return SetItem(&item);
}

#endif

static LRESULT APIENTRY ListViewSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  CWindow window(hwnd);
  CListView2 *w = (CListView2 *)(window.GetUserDataLongPtr());
  if (w == NULL)
    return 0;
  return w->OnMessage(message, wParam, lParam);
}

LRESULT CListView2::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
  #ifndef _UNICODE
  if (g_IsNT)
    return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
  else
  #endif
    return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
}

void CListView2::SetWindowProc()
{
  SetUserDataLongPtr((LONG_PTR)this);
  #ifndef _UNICODE
  if (g_IsNT)
    _origWindowProc = (WNDPROC)SetLongPtrW(GWLP_WNDPROC, (LONG_PTR)ListViewSubclassProc);
  else
  #endif
    _origWindowProc = (WNDPROC)SetLongPtr(GWLP_WNDPROC, (LONG_PTR)ListViewSubclassProc);
}

/*
LRESULT CListView3::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
  LRESULT res = CListView2::OnMessage(message, wParam, lParam);
  if (message == WM_GETDLGCODE)
  {
    // when user presses RETURN, windows sends default (first) button command to parent dialog.
    // we disable this:
    MSG *msg = (MSG *)lParam;
    WPARAM key = wParam;
    bool change = false;
    if (msg)
    {
      if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN)
        change = true;
    }
    else if (wParam == VK_RETURN)
      change = true;
    if (change)
      res |= DLGC_WANTALLKEYS;
  }
  return res;
}
*/

}}