text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<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">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.beam</groupId>
    <artifactId>beam-sdks-java-io-parent</artifactId>
    <version>2.3.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>beam-sdks-java-io-hadoop-common</artifactId>
  <name>Apache Beam :: SDKs :: Java :: IO :: Hadoop Common</name>
  <description>Library to add shared Hadoop classes among Beam IOs.</description>

  <dependencies>
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-core</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
    </dependency>

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

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- build dependencies -->
    <dependency>
      <groupId>com.google.auto.service</groupId>
      <artifactId>auto-service</artifactId>
      <optional>true</optional>
    </dependency>
  </dependencies>
</project>


text:
FOUNDATION_EXPORT double KHTabPagerViewControllerVersionNumber;
FOUNDATION_EXPORT const unsigned char KHTabPagerViewControllerVersionString[];

redpajama_set_name: RedPajamaGithub


text:
package org.openo.nfvo.jujuvnfmadapter.service.rest;

import java.io.File;
import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import org.openo.baseservice.remoteservice.exception.ServiceException;
import org.openo.baseservice.roa.util.restclient.RestfulResponse;
import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
import org.openo.nfvo.jujuvnfmadapter.common.FileUtils;
import org.openo.nfvo.jujuvnfmadapter.common.JujuConfigUtil;
import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils.ExeRes;
import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.JujuVnfmRestfulUtil;
import org.openo.nfvo.jujuvnfmadapter.common.servicetoken.VnfmRestfulUtil;
import org.openo.nfvo.jujuvnfmadapter.service.adapter.impl.AdapterResourceManager;
import org.openo.nfvo.jujuvnfmadapter.service.constant.Constant;
import org.openo.nfvo.jujuvnfmadapter.service.constant.UrlConstant;
import org.openo.nfvo.jujuvnfmadapter.common.SwitchController;
import org.openo.nfvo.jujuvnfmadapter.common.VnfmUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import mockit.Mock;
import mockit.MockUp;
import net.sf.json.JSONObject;

/**
 *

 *

 *

 *
 * @author
 * @version NFVO 0.5 Sep 13, 2016
 */
@Path("/v1/config")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class ConfigRoa {

    private static final Logger LOG = LoggerFactory.getLogger(ConfigRoa.class);

    /**
     *

     *
     * @param context
     * @param resp
     * @return
     * @since NFVO 0.5
     */
    @GET
    @Path("/")
    public String initUI(@Context HttpServletRequest context, @Context HttpServletResponse resp) {
        return EntityUtils.toString(new SwitchController(), SwitchController.class);
    }

    /**
     *

     *
     * @param type
     * @param context
     * @param resp
     * @return
     * @throws ServiceException
     * @since NFVO 0.5
     */
    @GET
    @Path("/debug/{type}")
    public boolean setDebugModel(@PathParam("type") int type, @Context HttpServletRequest context,
            @Context HttpServletResponse resp) throws ServiceException {
        if(type == 1) {
            SwitchController.setDebugModel(true);
        } else {
            SwitchController.setDebugModel(false);
        }
        LOG.debug("change to debug model:" + SwitchController.isDebugModel());
        return SwitchController.isDebugModel();
    }

    /**
     *

     *
     * @param methodName
     * @param context
     * @param resp
     * @return
     * @throws ServiceException
     * @since NFVO 0.5
     */
    @GET
    @Path("/mock/{methodName}")
    public boolean mock(@PathParam("methodName") String methodName, @Context HttpServletRequest context,
            @Context HttpServletResponse resp) throws ServiceException {
        if("getVnfmById".equals(methodName)) {
            new MockUp<VnfmUtil>() {

                @Mock
                public JSONObject getVnfmById(String vnfmId) {
                    JSONObject json = new JSONObject();
                    json.put("vnfmId", vnfmId);
                    json.put("vnfdId", "testVnfdId");
                    json.put("vnfPackageId", "testPackageId");
                    json.put("version", "1");
                    json.put("url", JujuConfigUtil.getValue("jujuvnfm_server_url"));
                    return json;
                }
            };
        } else if("execute".equals(methodName)) {
            new MockUp<EntityUtils>() {

                @Mock
                public ExeRes execute(String dir, List<String> command) {
                    ExeRes er = new ExeRes();
                    String resContent = null;
                    try {
                        resContent = new String(
                                FileUtils.readFile(new File(JujuConfigUtil.getValue("juju_cmd_res_file")), "UTF-8"));
                    } catch(Exception e) {
                        LOG.error("mock fail",e);
                        resContent = "mock fail";
                    }
                    er.setBody(resContent);
                    return er;
                }
            };
        }else if("fetchDownloadUrlFromCatalog".equals(methodName)) {
            new MockUp<AdapterResourceManager>() {
                @Mock
                public String fetchDownloadUrlFromCatalog(String csarId){
                    return JujuConfigUtil.getValue("catalog_download_url");
                }
            };
        }
        return true;
    }

    /**
     *

     *
     * @param methodName
     * @param context
     * @param resp
     * @return
     * @throws ServiceException
     * @since NFVO 0.5
     */
    @GET
    @Path("/unmock/{methodName}")
    public boolean unmock(@PathParam("methodName") String methodName, @Context HttpServletRequest context,
            @Context HttpServletResponse resp) throws ServiceException {
        if("getVnfmById".equals(methodName)) {
            new MockUp<VnfmUtil>() {

                @Mock
                public JSONObject getVnfmById(String vnfmId) {
                    RestfulResponse rsp = VnfmRestfulUtil.getRemoteResponse(
                            String.format(UrlConstant.REST_ESRINFO_GET, vnfmId), JujuVnfmRestfulUtil.GET_TYPE, null);
                    if(rsp == null || rsp.getStatus() != Constant.HTTP_OK) {
                        return null;
                    }
                    LOG.error("funtion=getVnfmById, status={}", rsp.getStatus());
                    return JSONObject.fromObject(rsp.getResponseContent());
                }
            };
        }
        return true;
    }
}


text:
blog
====

my personal blog /website


text:
CREATE TABLE DISK_SHARE(
        ID BIGINT NOT NULL,
	SHARE_TYPE VARCHAR(50),
	SHARE_TIME DATETIME,
	INFO_ID BIGINT,

	NAME VARCHAR(200),
	CREATOR VARCHAR(64),
	TYPE VARCHAR(64),
	DIR_TYPE INT,

	COUNT_VIEW INT,
	COUNT_SAVE INT,
	COUNT_DOWNLOAD INT,
	ORG_ID VARCHAR(200),

        CONSTRAINT PK_DISK_SHARE PRIMARY KEY(ID),
	CONSTRAINT FK_DISK_SHARE_INFO FOREIGN KEY (INFO_ID) REFERENCES DISK_INFO(ID)
);


text:
class btCollisionObject;
// class btCollisionShape;

namespace chrono {

// forward references
class ChBody;

namespace collision {

class ChConvexDecomposition;

/// Class defining the Bullet geometric model for collision detection.
class ChApi ChCollisionModelBullet : public ChCollisionModel {
  protected:
    std::unique_ptr<btCollisionObject> bt_collision_object;  ///< Bullet collision object containing Bullet geometries
    std::shared_ptr<btCompoundShape> bt_compound_shape;      ///< Compound for models with more than one collision shape

  public:
    ChCollisionModelBullet();

    virtual ~ChCollisionModelBullet();

    /// Delete all inserted geometries.
    /// Addition of collision shapes must be done between calls to ClearModel() and BuildModel().
    /// This function must be invoked before adding geometric collision shapes.
    virtual int ClearModel() override;

    /// Complete the construction of the collision model (build the BV hierarchy).
    /// Addition of collision shapes must be done between calls to ClearModel() and BuildModel().
    /// This function must be invoked after all geometric collision shapes have been added.
    virtual int BuildModel() override;

    //
    // GEOMETRY DESCRIPTION
    //
    //  The following functions must be called inbetween
    //  the ClearModel() BuildModel() pair.

    /// Add a sphere shape to this collision model.
    virtual bool AddSphere(                           //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double radius,                                ///< sphere radius
        const ChVector<>& pos = ChVector<>()          ///< center position in model coordinates
        ) override;

    /// Add an ellipsoid shape to this collision model.
    virtual bool AddEllipsoid(                        //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double rx,                                    ///< x semi-axis
        double ry,                                    ///< y semi-axis
        double rz,                                    ///< z semi-axis
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override;

    /// Add a box shape to this collision model.
    virtual bool AddBox(                              //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double hx,                                    ///< x half-dimension
        double hy,                                    ///< y half-dimension
        double hz,                                    ///< z half-dimension
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override;

    /// Add a cylinder to this collision model (default axis on Y direction).
    virtual bool AddCylinder(                         //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double rx,                                    ///< radius (X direction)
        double rz,                                    ///< radius (Z direction)
        double hy,                                    ///< half length
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override;

    /// Add a cylindrical shell to this collision model (default axis in Y direction).
    virtual bool AddCylindricalShell(                 //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double radius,                                ///< cylinder radius
        double hlen,                                  ///< cylinder half length
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override;

    /// Add a cone to this collision model (default axis on Y direction).
    virtual bool AddCone(                             //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double rx,                                    ///< radius (X direction)
        double rz,                                    ///< radius (Z direction)
        double hy,                                    ///< half length
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override {
        return false;
    }

    /// Add a capsule to this collision model (default axis in Y direction).
    virtual bool AddCapsule(                          //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double radius,                                ///< radius
        double hlen,                                  ///< half-length of capsule axis
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override;

    /// Add a rounded box shape to this collision model.
    virtual bool AddRoundedBox(                       //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double hx,                                    ///< x half-dimension
        double hy,                                    ///< y half-dimension
        double hz,                                    ///< z half-dimension
        double sphere_r,                              ///< radius of sweeping sphere
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override {
        return false;
    }

    /// Add a rounded cylinder to this collision model (default axis on Y direction).
    virtual bool AddRoundedCylinder(                  //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double rx,                                    ///< radius (X direction)
        double rz,                                    ///< radius (Z direction)
        double hy,                                    ///< half length
        double sphere_r,                              ///< radius of sweeping sphere
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override {
        return false;
    }

    /// Add a rounded cone to this collision model (default axis on Y direction).
    virtual bool AddRoundedCone(                      //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double rx,                                    ///< radius (X direction)
        double rz,                                    ///< radius (Z direction)
        double hy,                                    ///< half length
        double sphere_r,                              ///< radius of sweeping sphere
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override {
        return false;
    }

    /// Add a convex hull to this collision model. A convex hull is simply a point cloud that describe a convex
    /// polytope. Connectivity between the vertexes, as faces/edges in triangle meshes is not necessary.
    /// Points are passed as a list which is then copied into the model.
    virtual bool AddConvexHull(                          //
        std::shared_ptr<ChMaterialSurface> material,     ///< surface contact material
        const std::vector<ChVector<double>>& pointlist,  ///< list of hull points
        const ChVector<>& pos = ChVector<>(),            ///< origin position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)        ///< rotation in model coordinates
        ) override;

    /// Add a triangle mesh to this collision model.
    /// Note: if possible, for better performance, avoid triangle meshes and prefer simplified
    /// representations as compounds of primitive convex shapes (boxes, sphers, etc).
    virtual bool AddTriangleMesh(                           //
        std::shared_ptr<ChMaterialSurface> material,        ///< surface contact material
        std::shared_ptr<geometry::ChTriangleMesh> trimesh,  ///< the triangle mesh
        bool is_static,                                     ///< true if model doesn't move. May improve performance.
        bool is_convex,                                     ///< if true, a convex hull is used. May improve robustness.
        const ChVector<>& pos = ChVector<>(),               ///< origin position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1),          ///< rotation in model coordinates
        double sphereswept_thickness = 0.0                  ///< outward sphere-swept layer (when supported)
        ) override;

    /// CUSTOM for this class only: add a concave triangle mesh that will be managed
    /// by GImpact mesh-mesh algorithm. Note that, despite this can work with
    /// arbitrary meshes, there could be issues of robustness and precision, so
    /// when possible, prefer simplified representations as compounds of convex
    /// shapes of boxes/spheres/etc.. type.
    virtual bool AddTriangleMeshConcave(                    //
        std::shared_ptr<ChMaterialSurface> material,        ///< surface contact material
        std::shared_ptr<geometry::ChTriangleMesh> trimesh,  ///< the triangle mesh
        const ChVector<>& pos = ChVector<>(),               ///< origin position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)           ///< rotation in model coordinates
    );

    /// CUSTOM for this class only: add a concave triangle mesh that will be decomposed
    /// into a compound of convex shapes. Decomposition could be more efficient than
    /// AddTriangleMeshConcave(), but preprocessing decomposition might take a while, and
    /// decomposition result is often approximate. Therefore, despite this can work with
    /// arbitrary meshes, there could be issues of robustness and precision, so
    /// when possible, prefer simplified representations as compounds of convex
    /// shapes of boxes/spheres/etc.. type.
    virtual bool AddTriangleMeshConcaveDecomposed(               //
        std::shared_ptr<ChMaterialSurface> material,             ///< surface contact material
        std::shared_ptr<ChConvexDecomposition> mydecomposition,  ///< convex mesh decomposition
        const ChVector<>& pos = ChVector<>(),                    ///< origin position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)                ///< rotation in model coordinates
    );

    /// Add a barrel-like shape to this collision model (main axis on Y direction).
    /// The barrel shape is made by lathing an arc of an ellipse around the vertical Y axis.
    /// The center of the ellipse is on Y=0 level, and it is offsetted by R_offset from
    /// the Y axis in radial direction. The two radii of the ellipse are R_vert (for the
    /// vertical direction, i.e. the axis parallel to Y) and R_hor (for the axis that
    /// is perpendicular to Y). Also, the solid is clamped with two discs on the top and
    /// the bottom, at levels Y_low and Y_high.
    virtual bool AddBarrel(                           //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double Y_low,                                 ///< bottom level
        double Y_high,                                ///< top level
        double R_vert,                                ///< ellipse semi-axis in vertical direction
        double R_hor,                                 ///< ellipse semi-axis in horizontal direction
        double R_offset,                              ///< lateral offset (radius at top and bottom)
        const ChVector<>& pos = ChVector<>(),         ///< center position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1)     ///< rotation in model coordinates
        ) override;

    /// Add a 2D closed line, defined on the XY plane passing by pos and aligned as rot,
    /// that defines a 2D collision shape that will collide with another 2D line of the same type
    /// if aligned on the same plane. This is useful for mechanisms that work on a plane, and that
    /// require more precise collision that is not possible with current 3D shapes. For example,
    /// the line can contain concave or convex round fillets.
    /// Requirements:
    /// - the line must be clockwise for inner material, (counterclockwise=hollow, material outside)
    /// - the line must contain only ChLineSegment and ChLineArc sub-lines
    /// - the sublines must follow in the proper order, with coincident corners, and must be closed.
    virtual bool Add2Dpath(                           //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        std::shared_ptr<geometry::ChLinePath> mpath,  ///< 2D curve path
        const ChVector<>& pos = ChVector<>(),         ///< origin position in model coordinates
        const ChMatrix33<>& rot = ChMatrix33<>(1),    ///< rotation in model coordinates
        const double thickness = 0.001                ///< line thickness
        ) override;

    /// Add a point-like sphere, that will collide with other geometries, but won't ever create contacts between them.
    virtual bool AddPoint(                            //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        double radius = 0,                            ///< node radius
        const ChVector<>& pos = ChVector<>()          ///< center position in model coordinates
        ) override;

    /// Add a triangle from  mesh.
    /// For efficiency, points are stored as pointers. Thus, the user must
    /// take care of memory management and of dangling pointers.
    virtual bool AddTriangleProxy(                    //
        std::shared_ptr<ChMaterialSurface> material,  ///< surface contact material
        ChVector<>* p1,                               ///< points to vertex1 coords
        ChVector<>* p2,                               ///< points to vertex2 coords
        ChVector<>* p3,                               ///< points to vertex3 coords
        ChVector<>* ep1,                              ///< points to neighbouring vertex at edge1 if any
        ChVector<>* ep2,                              ///< points to neighbouring vertex at edge1 if any
        ChVector<>* ep3,                              ///< points to neighbouring vertex at edge1 if any
        bool mowns_vertex_1,         ///< vertex is owned by this triangle (otherwise, owned by neighbour)
        bool mowns_vertex_2,         ///< vertex is owned by this triangle (otherwise, owned by neighbour)
        bool mowns_vertex_3,         ///< vertex is owned by this triangle (otherwise, owned by neighbour)
        bool mowns_edge_1,           ///< edge is owned by this triangle (otherwise, owned by neighbour)
        bool mowns_edge_2,           ///< edge is owned by this triangle (otherwise, owned by neighbour)
        bool mowns_edge_3,           ///< edge is owned by this triangle (otherwise, owned by neighbour)
        double msphereswept_rad = 0  ///< sphere swept triangle ('fat' triangle, improves robustness)
    );

    /// Add all shapes already contained in another model.
    /// The 'another' model must be of ChCollisionModelBullet subclass.
    virtual bool AddCopyOfAnotherModel(ChCollisionModel* another) override;

    virtual void SetFamily(int mfamily) override;
    virtual int GetFamily() override;
    virtual void SetFamilyMaskNoCollisionWithFamily(int mfamily) override;
    virtual void SetFamilyMaskDoCollisionWithFamily(int mfamily) override;
    virtual bool GetFamilyMaskDoesCollisionWithFamily(int mfamily) override;

    /// Set the collision family group of this model.
    /// This is an alternative way of specifying the collision family for this
    /// object.  The value family_group must have a single bit set (i.e. it must
    /// be a power of 2). The corresponding family is then the bit position.
    virtual void SetFamilyGroup(short int group) override;

    /// Set the collision mask for this model.
    /// Any set bit in the specified mask indicates that this model collides with
    /// all objects whose family is equal to the bit position.
    virtual void SetFamilyMask(short int mask) override;

    /// Returns the axis aligned bounding box (AABB) of the collision model,
    /// i.e. max-min along the x,y,z world axes. Remember that SyncPosition()
    /// should be invoked before calling this.
    virtual void GetAABB(ChVector<>& bbmin, ChVector<>& bbmax) const override;

    /// Sets the position and orientation of the collision
    /// model as the current position of the corresponding ChContactable
    virtual void SyncPosition() override;

    /// If the collision shape is a sphere, resize it and return true (if no
    /// sphere is found in this collision shape, return false).
    /// It can also change the outward envelope; the inward margin is automatically the radius of the sphere.
    bool SetSphereRadius(double coll_radius, double out_envelope);

    /// Return the position and orientation of the collision shape with specified index, relative to the model frame.
    virtual ChCoordsys<> GetShapePos(int index) const override;

    /// Return shape characteristic dimensions.
    /// The following collision shapes are supported:
    /// <pre>
    /// SPHERE       radius
    /// BOX          x-halfdim y-halfdim z-halfdim
    /// ELLIPSOID    x-radius y-radius z-radius
    /// CYLINDER     x-radius z-radius halflength
    /// CYLSHELL     radius halflength
    /// </pre>
    virtual std::vector<double> GetShapeDimensions(int index) const override;

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;

  private:
    void injectShape(const ChVector<>& pos, const ChMatrix33<>& rot, ChCollisionShapeBullet* shape);

    void onFamilyChange();

    btCollisionObject* GetBulletModel() { return bt_collision_object.get(); }

    std::vector<std::shared_ptr<geometry::ChTriangleMesh>> m_trimeshes;

    friend class ChCollisionSystemBullet;
    friend class ChCollisionSystemBulletMulticore;
};

}  // end namespace collision

CH_CLASS_VERSION(collision::ChCollisionModelBullet, 0)

}  // end namespace chrono

#endif


text:
package v1alpha1

import (
	"k8s.io/api/core/v1"
	// "k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

/**
* apiVersion: "data-orchestration.org/v1aphla1"
* kind: "Dataset"
* metadata:
*   name: "imagenet"
* spec:
*   # target: /imagenet # optional
*   mountPoint: oss://imagenet-huabei5/images/
*   options:
*      fs.oss.endpoint: oss-cn-huhehaote-internal.aliyuncs.com
*      fs.oss.accessKeyId: xxx
*      fs.oss.accessKeySecret: yyy
*   minReplicas: 1 # optional
*   maxReplicas: 3
*   affinity:
*     nodeAffinity:
*       preferredDuringSchedulingIgnoredDuringExecution:
*       - weight: 1
*         preference:
*           matchExpressions:
*           - key: another-node-label-key
*             operator: Exists
* status:
*   total: 50GiB
*   ufsTotal: 50GiB
*   cacheStatus:
*       cached: 15GiB
*       cachable: 40GiB
*       needMoreForCache: 10GiB
 */

// Mount describes a mounting.
type Mount struct {
	// MountPoint is the mount point of source
	// +kubebuilder:validation:MinLength=10
	// +required
	MountPoint string `json:"mountPoint,omitempty"`

	// Options to configure
	// +optional
	Options map[string]string `json:"options,omitempty"`

	// The name of mount
	// +kubebuilder:validation:MinLength=0
	// +required
	Name string `json:"name,omitempty"`

	// Optional: Defaults to false (read-write).
	// +optional
	ReadOnly bool `json:"readOnly,omitempty"`

	// Optional: Defaults to false (shared).
	// +optional
	Shared bool `json:"shared,omitempty"`
}

// DatasetSpec defines the desired state of Dataset
type DatasetSpec struct {
	// Mounts
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:UniqueItems=false
	// +required
	Mounts []Mount `json:"mounts,omitempty"`

	// Specifies how to prefetch dataset.
	// Valid values are:
	// - "Never" (default): never prefetch the dataset;
	// - "Always": always prefetch the dataset;
	// - "OnDemand": will prefetch when application which consumes the dataset is running
	// +optional
	PrefetchStrategy PrefetchStrategy `json:"prefetchStrategy,omitempty"`

	// +kubebuilder:validation:Minimum=1
	// replicas is the min replicas of dataset in the cluster
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	//floats are not support https://github.com/kubernetes-sigs/controller-tools/blob/abcf7d8d54b0cca0f42c470b705fd3cfe768ede3/pkg/crd/schema.go#L387
	// lowWaterMarkRatio is the
	// +optional
	// LowWaterMarkRatio resource.Quantity `json:"lowWaterMarkRatio,omitempty"`
	LowWaterMarkRatio string `json:"lowWaterMarkRatio,omitempty"`

	//floats are not support https://github.com/kubernetes-sigs/controller-tools/blob/abcf7d8d54b0cca0f42c470b705fd3cfe768ede3/pkg/crd/schema.go#L387
	// highWaterMarkRatio is the
	// +optional
	HighWaterMarkRatio string `json:"highWaterMarkRatio,omitempty"`

	// NodeAffinity defines constraints that limit what nodes this dataset can be cached to.
	// This field influences the scheduling of pods that use the cached dataset.
	// +optional
	NodeAffinity *CacheableNodeAffinity `json:"nodeAffinity,omitempty"`

	// If specified, the cache's tolerations.
	// +optional
	Tolerations []v1.Toleration `json:"tolerations,omitempty"`

	// The runtime handle the dataset, for now, only support alluxio.
	// +optional
	Runtime string `json:"runtime,omitempty"`
}

// PrefetchStrategy describes how the dataset will be prefetched for cache.
// Only one of the following Prefetch policies may be specified.
// If none of the following policies is specified, the default one
// is NeverPrefetch.
// +kubebuilder:validation:Enum=Never;Always;OnDemand
type PrefetchStrategy string

const (
	// AlwaysPrefetch will always prefetch.
	AlwaysPrefetch PrefetchStrategy = "Always"

	// OnDemandPrefetch will prefetch when application which consumes the dataset
	// is running.
	OnDemandPrefetch PrefetchStrategy = "OnDemand"

	// NeverPrefetch cancels currently running job and replaces it with a new one.
	NeverPrefetch PrefetchStrategy = "Never"
)

// CacheableNodeAffinity defines constraints that limit what nodes this dataset can be cached to.
type CacheableNodeAffinity struct {
	// Required specifies hard node constraints that must be met.
	Required *v1.NodeSelector `json:"required,omitempty"`
}

// CacheStateName is the name identifying various cacheStateName in a CacheStateNameList.
type CacheStateName string

// ResourceList is a set of (resource name, quantity) pairs.
type CacheStateList map[CacheStateName]string

// CacheStateName names must be not more than 63 characters, consisting of upper- or lower-case alphanumeric characters,
// with the -, _, and . characters allowed anywhere, except the first or last character.
// The default convention, matching that for annotations, is to use lower-case names, with dashes, rather than
// camel case, separating compound words.
// Fully-qualified resource typenames are constructed from a DNS-style subdomain, followed by a slash `/` and a name.
const (
	// Cached in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
	Cached CacheStateName = "cached"
	// Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
	// Cacheable CacheStateName = "cacheable"
	LowWaterMark CacheStateName = "lowWaterMark"
	// Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
	HighWaterMark CacheStateName = "highWaterMark"
	// NonCacheable size, in bytes (e,g. 5Gi = 5GiB = 5 * 1024 * 1024 * 1024)
	NonCacheable CacheStateName = "nonCacheable"
	// Percentage represents the cache percentage over the total data in the underlayer filesystem.
	// 1.5 = 1500m
	CachedPercentage CacheStateName = "cachedPercentage"

	CacheCapacity CacheStateName = "cacheCapacity"
)

// The dataset phase indicates whether the loading is behaving
type DatasetPhase string

const (
	// planning the cache
	// Planning Phase = "planning"
	// Loading the cache
	PendingDatasetPhase DatasetPhase = "Pending"
	// loaded the cache
	ReadyDatasetPhase DatasetPhase = "Ready"
)

// Condition describes the state of the cache at a certain point.
type CacheCondition struct {
	// Type of cache condition.
	Type CacheConditionType `json:"type"`
	// Status of the condition, one of True, False, Unknown.
	Status v1.ConditionStatus `json:"status"`
	// The reason for the condition's last transition.
	Reason string `json:"reason,omitempty"`
	// A human readable message indicating details about the transition.
	Message string `json:"message,omitempty"`
	// The last time this condition was updated.
	LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
	// Last time the condition transitioned from one status to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}

// CacheConditionType defines all kinds of types of cacheStatus.
type CacheConditionType string

const (
	// Planned means the CRD has been accepted by the system,
	// the master and one of the worker has been started,
	// but the data has not been loaded into the distributed cache system.
	Planned CacheConditionType = "Planned"

	// Preloading means the cache system for the dataset has been Preloading.
	Preloading CacheConditionType = "Preloading"

	// Preloading means the cache system for the dataset has been Preloading.
	Preloaded CacheConditionType = "Preloaded"

	// The cache system are ready
	Ready CacheConditionType = "Ready"

	// Resynced means updating with the underlayer filesystem.
	Resynced CacheConditionType = "Resynced"

	// Resynced means updating with the underlayer filesystem.
	DataSetFailed CacheConditionType = "Failed"
)

const (
	// Planned means the CRD has been accepted by the system,
	// the master and one of the worker has been started,
	// but the data has not been loaded into the distributed cache system.
	DatasetPlannedReason = "DatasetPlanned"

	// PreLoading means the cache system for the dataset has been PreLoading.
	DatasetPreLoadingReason = "DatasetPreLoading"

	// PreLoading means the cache system for the dataset has been PreLoading.
	DatasetPreLoadedReason = "DatasetPreLoaded"

	// The cache system are ready
	DatasetReadyReason = "DatasetReady"

	// Resynced means updating with the underlayer filesystem.
	DatasetResyncedReason = "DatasetResynced"

	// Resynced means updating with the underlayer filesystem.
	DatasetDataSetFailedReason = "DatasetFailed"
)

type CacheStatus struct {
	// Conditions is an array of current observed cache conditions.
	Conditions []CacheCondition `json:"conditions"`

	// CacheStatus represents the total resources of the dataset.
	CacheStates CacheStateList `json:"cacheStates,omitempty"`
}

// DatasetStatus defines the observed state of Dataset
type DatasetStatus struct {
	// Dataset Phase
	Phase DatasetPhase `json:"phase,omitempty"`

	// // Minial Total in bytes of the dataset to load in the cluster
	// MinTotal string `json:"minTotal,omitempty"`

	// Max Total in GB of the dataset to load in the cluster
	Total string `json:"total,omitempty"`

	// Total in GB of dataset in the cluster
	UfsTotal string `json:"ufsTotal,omitempty"`

	// CacheStatus represents the total resources of the dataset.
	CacheStatus CacheStatus `json:"cacheStatus,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Dataset is the Schema for the datasets API
type Dataset struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DatasetSpec   `json:"spec,omitempty"`
	Status DatasetStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
// DatasetList contains a list of Dataset
type DatasetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Dataset `json:"items"`
}

func init() {
	SchemeBuilder.Register(&Dataset{}, &DatasetList{})
}

// +kubebuilder:docs-gen:collapse=Root Object Definitions


text:
const DEFAULT_FILTERS = [
  'customUi',
  'PlatformLocalization',
  'TypeExtensionD1',
  'xsd'
];

const DEFAULT_WALK_OPTIONS = {
  followLinks: false,
  filters: DEFAULT_FILTERS,
  listeners: {}
};

const _walk = require('walk');

class CollectingWalker {

  constructor() {
    this.walkOptions = {};
    this.collectors = [];
  }

  withOptions(options) {
    this.walkOptions = options;
    return this;
  }

  withDefaultOptions() {
    this.walkOptions = DEFAULT_WALK_OPTIONS;
    return this;
  }

  withDefaultFilters() {
    this.walkOptions.filters = DEFAULT_FILTERS;
    return this;
  }

  withFilters() {
    const filters = Array.prototype.slice.call(arguments);
    this.walkOptions.filters = filters;
    return this;
  }

  withCollectors() {
    const collectors = Array.prototype.slice.call(arguments);
    assertUniqueNames(collectors);
    this.collectors = collectors;
    return this;
  }

  walk(moduleName) {
    const localOpts = Object.assign({}, this.walkOptions);
    localOpts.listeners = {
      file: (root, fileStats, next) => {
        const scenario = {
          'root': root,
          'fileStats': fileStats,
          'next': next
        };
        this.collectors.forEach((collector) => {
          if (collector.when(scenario)) {
            collector.thenCollect(scenario);
          }
        });
        next();
      },
      error: (root, nodeStatsArray, next) => {
        next(); //TODO
      }
    };
    _walk.walkSync(moduleName, localOpts);
    return getCollectionMap(this.collectors);
  }

}

function assertUniqueNames(collectors) {
  const seed = {
    foundKeys: {},
    dupes: []
  };
  const uniq = collectors.reduce((previous, next) => {
    const name = next.getCollectionName();
    if (!previous.foundKeys[next.getCollectionName()]) {
      previous.foundKeys[next.getCollectionName()] = next;
    } else {
      previous.dupes.push(name);
    }
    return previous;
  }, seed);
  if (uniq.dupes.length) {
    throw new Error(`
      Collector names must be unique.
      The following duplicates were detected:\n${uniq.dupes.join(", ")}`);
  }
}

function getCollectionMap(collectors) {
  return collectors.reduce((prev, next) => {
    prev[next.getCollectionName()] = next.getCollection();
    return prev;
  }, {});

}

module.exports = CollectingWalker;


text:
class WithRefCount;

void intrusive_ptr_add_ref(WithRefCount*);
void intrusive_ptr_release(WithRefCount*);

class WithRefCount {
protected:
	AtomicCounter ref_count;
public:
	friend void intrusive_ptr_add_ref(WithRefCount*);
	friend void intrusive_ptr_release(WithRefCount*);
};

static inline void intrusive_ptr_add_ref(WithRefCount* o) {
	o->ref_count++;
}
static inline void intrusive_ptr_release(WithRefCount* o) {
	if((--o->ref_count) == 0) delete o;
}

#endif // INTRUSIVES_H


text:
require 'spec_helper'

RSpec.describe UserFinder do
  let_it_be(:user) { create(:user) }

  describe '#find_by_id' do
    context 'when the user exists' do
      it 'returns the user' do
        found = described_class.new(user.id).find_by_id

        expect(found).to eq(user)
      end
    end

    context 'when the user exists (id as string)' do
      it 'returns the user' do
        found = described_class.new(user.id.to_s).find_by_id

        expect(found).to eq(user)
      end
    end

    context 'when the user does not exist' do
      it 'returns nil' do
        found = described_class.new(-1).find_by_id

        expect(found).to be_nil
      end
    end
  end

  describe '#find_by_username' do
    context 'when the user exists' do
      it 'returns the user' do
        found = described_class.new(user.username).find_by_username

        expect(found).to eq(user)
      end
    end

    context 'when the user does not exist' do
      it 'returns nil' do
        found = described_class.new("non_existent_username").find_by_username

        expect(found).to be_nil
      end
    end
  end

  describe '#find_by_id_or_username' do
    context 'when the user exists (id)' do
      it 'returns the user' do
        found = described_class.new(user.id).find_by_id_or_username

        expect(found).to eq(user)
      end
    end

    context 'when the user exists (id as string)' do
      it 'returns the user' do
        found = described_class.new(user.id.to_s).find_by_id_or_username

        expect(found).to eq(user)
      end
    end

    context 'when the user exists (username)' do
      it 'returns the user' do
        found = described_class.new(user.username).find_by_id_or_username

        expect(found).to eq(user)
      end
    end

    context 'when the user does not exist (username)' do
      it 'returns nil' do
        found = described_class.new("non_existent_username").find_by_id_or_username

        expect(found).to be_nil
      end
    end

    context 'when the user does not exist' do
      it 'returns nil' do
        found = described_class.new(-1).find_by_id_or_username

        expect(found).to be_nil
      end
    end
  end

  describe '#find_by_id!' do
    context 'when the user exists' do
      it 'returns the user' do
        found = described_class.new(user.id).find_by_id!

        expect(found).to eq(user)
      end
    end

    context 'when the user exists (id as string)' do
      it 'returns the user' do
        found = described_class.new(user.id.to_s).find_by_id!

        expect(found).to eq(user)
      end
    end

    context 'when the user does not exist' do
      it 'raises ActiveRecord::RecordNotFound' do
        finder = described_class.new(-1)

        expect { finder.find_by_id! }.to raise_error(ActiveRecord::RecordNotFound)
      end
    end
  end

  describe '#find_by_username!' do
    context 'when the user exists' do
      it 'returns the user' do
        found = described_class.new(user.username).find_by_username!

        expect(found).to eq(user)
      end
    end

    context 'when the user does not exist' do
      it 'raises ActiveRecord::RecordNotFound' do
        finder = described_class.new("non_existent_username")

        expect { finder.find_by_username! }.to raise_error(ActiveRecord::RecordNotFound)
      end
    end
  end

  describe '#find_by_id_or_username!' do
    context 'when the user exists (id)' do
      it 'returns the user' do
        found = described_class.new(user.id).find_by_id_or_username!

        expect(found).to eq(user)
      end
    end

    context 'when the user exists (id as string)' do
      it 'returns the user' do
        found = described_class.new(user.id.to_s).find_by_id_or_username!

        expect(found).to eq(user)
      end
    end

    context 'when the user exists (username)' do
      it 'returns the user' do
        found = described_class.new(user.username).find_by_id_or_username!

        expect(found).to eq(user)
      end
    end

    context 'when the user does not exist (username)' do
      it 'raises ActiveRecord::RecordNotFound' do
        finder = described_class.new("non_existent_username")

        expect { finder.find_by_id_or_username! }.to raise_error(ActiveRecord::RecordNotFound)
      end
    end

    context 'when the user does not exist' do
      it 'raises ActiveRecord::RecordNotFound' do
        finder = described_class.new(-1)

        expect { finder.find_by_id_or_username! }.to raise_error(ActiveRecord::RecordNotFound)
      end
    end
  end
end


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Generic plugin interface.
 *
 * @version $Id: plugin_interface.lib.php 12137 2008-12-14 13:58:06Z lem9 $
 * @package phpMyAdmin
 */

/**
 * array PMA_getPlugins(string $plugins_dir, mixed $plugin_param)
 *
 * Reads all plugin information from directory $plugins_dir.
 *
 * @uses    ksort()
 * @uses    opendir()
 * @uses    readdir()
 * @uses    is_file()
 * @uses    preg_match()
 * @param   string  $plugins_dir    directrory with plugins
 * @param   mixed   $plugin_param   parameter to plugin by which they can decide whether they can work
 * @return  array                   list of plugins
 */
function PMA_getPlugins($plugins_dir, $plugin_param)
{
    /* Scan for plugins */
    $plugin_list = array();
    if ($handle = @opendir($plugins_dir)) {
        $is_first = 0;
        while ($file = @readdir($handle)) {
            // In some situations, Mac OS creates a new file for each file
            // (for example ._csv.php) so the following regexp
            // matches a file which does not start with a dot but ends
            // with ".php"
            if (is_file($plugins_dir . $file) && preg_match('@^[^\.](.)*\.php$@i', $file)) {
                include $plugins_dir . $file;
            }
        }
    }
    ksort($plugin_list);
    return $plugin_list;
}

/**
 * string PMA_getString(string $name)
 *
 * returns locale string for $name or $name if no locale is found
 *
 * @uses    $GLOBALS
 * @param   string  $name   for local string
 * @return  string          locale string for $name
 */
function PMA_getString($name)
{
    return isset($GLOBALS[$name]) ? $GLOBALS[$name] : $name;
}

/**
 * string PMA_pluginCheckboxCheck(string $section, string $opt)
 *
 * returns html input tag option 'checked' if plugin $opt should be set by config or request
 *
 * @uses    $_REQUEST
 * @uses    $GLOBALS['cfg']
 * @uses    $GLOBALS['timeout_passed']
 * @param   string  $section    name of config section in
 *                              $GLOBALS['cfg'][$section] for plugin
 * @param   string  $opt        name of option
 * @return  string              hmtl input tag option 'checked'
 */
function PMA_pluginCheckboxCheck($section, $opt)
{
    if ((isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($_REQUEST[$opt])) ||
        (isset($GLOBALS['cfg'][$section][$opt]) && $GLOBALS['cfg'][$section][$opt])) {
        return ' checked="checked"';
    }
    return '';
}

/**
 * string PMA_pluginGetDefault(string $section, string $opt)
 *
 * returns default value for option $opt
 *
 * @uses    htmlspecialchars()
 * @uses    $_REQUEST
 * @uses    $GLOBALS['cfg']
 * @uses    $GLOBALS['timeout_passed']
 * @param   string  $section    name of config section in
 *                              $GLOBALS['cfg'][$section] for plugin
 * @param   string  $opt        name of option
 * @return  string              default value for option $opt
 */
function PMA_pluginGetDefault($section, $opt)
{
    if (isset($GLOBALS['timeout_passed']) && $GLOBALS['timeout_passed'] && isset($_REQUEST[$opt])) {
        return htmlspecialchars($_REQUEST[$opt]);
    } elseif (isset($GLOBALS['cfg'][$section][$opt])) {
        $matches = array();
        /* Possibly replace localised texts */
        if (preg_match_all('/(str[A-Z][A-Za-z0-9]*)/', $GLOBALS['cfg'][$section][$opt], $matches)) {
            $val = $GLOBALS['cfg'][$section][$opt];
            foreach($matches[0] as $match) {
                if (isset($GLOBALS[$match])) {
                    $val = str_replace($match, $GLOBALS[$match], $val);
                }
            }
            return htmlspecialchars($val);
        } else {
            return htmlspecialchars($GLOBALS['cfg'][$section][$opt]);
        }
    }
    return '';
}

/**
 * string PMA_pluginIsActive(string $section, string $opt, string $val)
 *
 * returns html input tag option 'checked' if option $opt should be set by config or request
 *
 * @uses    $_REQUEST
 * @uses    $GLOBALS['cfg']
 * @uses    $GLOBALS['timeout_passed']
 * @param   string  $section    name of config section in
 *                              $GLOBALS['cfg'][$section] for plugin
 * @param   string  $opt        name of option
 * @param   string  $val        value of option to check against
 * @return  string              html input tag option 'checked'
 */
function PMA_pluginIsActive($section, $opt, $val)
{
    if (! empty($GLOBALS['timeout_passed']) && isset($_REQUEST[$opt])) {
        if ($_REQUEST[$opt] == $val) {
            return ' checked="checked"';
        }
    } elseif (isset($GLOBALS['cfg'][$section][$opt]) &&  $GLOBALS['cfg'][$section][$opt] == $val) {
        return ' checked="checked"';
    }
    return '';
}

/**
 * string PMA_pluginGetChoice(string $section, string $name, array &$list, string $cfgname)
 *
 * returns html radio form element for plugin choice
 *
 * @uses    PMA_pluginIsActive()
 * @uses    PMA_getString()
 * @param   string  $section    name of config section in
 *                              $GLOBALS['cfg'][$section] for plugin
 * @param   string  $name       name of radio element
 * @param   array   &$list      array with plugin configuration defined in plugin file
 * @param   string  $cfgname    name of config value, if none same as $name
 * @return  string              html input radio tag
 */
function PMA_pluginGetChoice($section, $name, &$list, $cfgname = NULL)
{
    if (!isset($cfgname)) {
        $cfgname = $name;
    }
    $ret = '';
    foreach ($list as $plugin_name => $val) {
        $ret .= '' . "\n";
        $ret .= '<input type="radio" name="' . $name . '" value="' . $plugin_name . '"'
            . ' id="radio_plugin_' . $plugin_name . '"'
            . ' onclick="if(this.checked) { hide_them_all();';
        if (isset($val['force_file'])) {
            $ret .= 'document.getElementById(\'checkbox_dump_asfile\').checked = true;';
        }
        $ret .= ' document.getElementById(\'' . $plugin_name . '_options\').style.display = \'block\'; };'
                .' return true"'
            . PMA_pluginIsActive($section, $cfgname, $plugin_name) . '/>' . "\n";
        $ret .= ''
            . PMA_getString($val['text']) . '' . "\n";
        $ret .= '

' . "\n";
    }
    return $ret;
}

/**
 * string PMA_pluginGetOneOption(string $section, string $plugin_name, string $id, array &$opt)
 *
 * returns single option in a table row
 *
 * @uses    PMA_getString()
 * @uses    PMA_pluginCheckboxCheck()
 * @uses    PMA_pluginGetDefault()
 * @param   string  $section        name of config section in
 *                                  $GLOBALS['cfg'][$section] for plugin
 * @param   string  $plugin_name    unique plugin name
 * @param   string  $id             option id
 * @param   array   &$opt           plugin option details
 * @return  string                  table row with option
 */
function PMA_pluginGetOneOption($section, $plugin_name, $id, &$opt)
{
    $ret = "\n";
    if ($opt['type'] == 'bool') {
        $ret .= '
' . "\n";
        $ret .= '<input type="checkbox" name="' . $plugin_name . '_' . $opt['name'] . '"'
            . ' value="something" id="checkbox_' . $plugin_name . '_' . $opt['name'] . '"'
            . ' ' . PMA_pluginCheckboxCheck($section, $plugin_name . '_' . $opt['name']);
        if (isset($opt['force'])) {
            /* Same code is also few lines lower, update both if needed */
            $ret .= ' onclick="if (!this.checked && '
                . '(!document.getElementById(\'checkbox_' . $plugin_name . '_' .$opt['force'] . '\') '
                . '|| !document.getElementById(\'checkbox_' . $plugin_name . '_' .$opt['force'] . '\').checked)) '
                . 'return false; else return true;"';
        }
        $ret .= ' />';
        $ret .= ''
            . PMA_getString($opt['text']) . '';
        $ret .= '
' . "\n";
    } elseif ($opt['type'] == 'text') {
        $ret .= '
' . "\n";
        $ret .= ''
            . PMA_getString($opt['text']) . '';
        $ret .= '<input type="text" name="' . $plugin_name . '_' . $opt['name'] . '"'
            . ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"'
            . ' id="text_' . $plugin_name . '_' . $opt['name'] . '"'
            . (isset($opt['size']) ? ' size="' . $opt['size'] . '"' : '')
            . (isset($opt['len']) ? ' maxlength="' . $opt['len'] . '"' : '') . ' />';
        $ret .= '
' . "\n";
    } elseif ($opt['type'] == 'message_only') {
        $ret .= '
' . "\n";
        $ret .= '
' . PMA_getString($opt['text']) . '
';
        $ret .= '
' . "\n";
    } elseif ($opt['type'] == 'select') {
        $ret .= '
' . "\n";
        $ret .= ''
            . PMA_getString($opt['text']) . '';
        $ret .= '<select name="' . $plugin_name . '_' . $opt['name'] . '"'
            . ' id="select_' . $plugin_name . '_' . $opt['name'] . '">';
        $default = PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']);
        foreach($opt['values'] as $key => $val) {
            $ret .= '<option value="' . $key . '"';
            if ($key == $default) {
                $ret .= ' selected="selected"';
            }
            $ret .= '>' . PMA_getString($val) . '</option>';
        }
        $ret .= '</select>';
        $ret .= '
' . "\n";
    } elseif ($opt['type'] == 'hidden') {
        $ret .= '<input type="hidden" name="' . $plugin_name . '_' . $opt['name'] . '"'
            . ' value="' . PMA_pluginGetDefault($section, $plugin_name . '_' . $opt['name']) . '"' . ' />';
    } elseif ($opt['type'] == 'bgroup') {
        $ret .= '<fieldset><legend>';
        /* No checkbox without name */
        if (!empty($opt['name'])) {
            $ret .= '<input type="checkbox" name="' . $plugin_name . '_' . $opt['name'] . '"'
                . ' value="something" id="checkbox_' . $plugin_name . '_' . $opt['name'] . '"'
                . ' ' . PMA_pluginCheckboxCheck($section, $plugin_name . '_' . $opt['name']);
            if (isset($opt['force'])) {
                /* Same code is also few lines higher, update both if needed */
                $ret .= ' onclick="if (!this.checked && '
                    . '(!document.getElementById(\'checkbox_' . $plugin_name . '_' .$opt['force'] . '\') '
                    . '|| !document.getElementById(\'checkbox_' . $plugin_name . '_' .$opt['force'] . '\').checked)) '
                    . 'return false; else return true;"';
            }
            $ret .= ' />';
            $ret .= ''
                . PMA_getString($opt['text']) . '';
        } else {
            $ret .= PMA_getString($opt['text']);
        }
        $ret .= '</legend>';
    } elseif ($opt['type'] == 'egroup') {
        $ret .= '</fieldset>';
    } else {
        /* This should be seen only by plugin writers, so I do not thing this
         * needs translation. */
        $ret .= 'UNKNOWN OPTION ' . $opt['type'] . ' IN IMPORT PLUGIN ' . $plugin_name . '!';
    }
    if (isset($opt['doc'])) {
        if (count($opt['doc']) == 3) {
            $ret .= PMA_showMySQLDocu($opt['doc'][0], $opt['doc'][1], false, $opt['doc'][2]);
        } else {
            $ret .= PMA_showMySQLDocu($opt['doc'][0], $opt['doc'][1]);
        }
    }
    $ret .= "\n";
    return $ret;
}

/**
 * string PMA_pluginGetOptions(string $section, array &$list)
 *
 * return html fieldset with editable options for plugin
 *
 * @uses    PMA_getString()
 * @uses    PMA_pluginGetOneOption()
 * @param   string  $section    name of config section in $GLOBALS['cfg'][$section]
 * @param   array   &$list      array with plugin configuration defined in plugin file
 * @return  string              html fieldset with plugin options
 */
function PMA_pluginGetOptions($section, &$list)
{
    $ret = '';
    // Options for plugins that support them
    foreach ($list as $plugin_name => $val) {
        $ret .= '<fieldset id="' . $plugin_name . '_options" class="options">';
        $ret .= '<legend>' . PMA_getString($val['options_text']) . '</legend>';
        $count = 0;
        if (isset($val['options']) && count($val['options']) > 0) {
            foreach ($val['options'] as $id => $opt) {
                if ($opt['type'] != 'hidden') $count++;
                $ret .= PMA_pluginGetOneOption($section, $plugin_name, $id, $opt);
            }
        }
        if ($count == 0) {
            $ret .= $GLOBALS['strNoOptions'];
        }
        $ret .= '</fieldset>';
    }
    return $ret;
}

/**
 * string PMA_pluginGetJavascript(array &$list)
 *
 * return html/javascript code which is needed for handling plugin stuff
 *
 * @param   array   &$list      array with plugin configuration defined in plugin file
 * @return  string              html fieldset with plugin options
 */
function PMA_pluginGetJavascript(&$list) {
    $ret = '

    ';
    return $ret;
}
?>


text:
using System;
using GridDomain.EventSourcing;

namespace GridDomain.Tests.Unit.ProcessManagers.SoftwareProgrammingDomain.Events
{
    public class GotTiredEvent : DomainEvent
    {
        public GotTiredEvent(string sourceId,
                             string lovelySofaId = null,
                             string favoriteCoffeMachineId = null,
                             string processId = null,
                             DateTime? createdTime = null) : base(sourceId, processId, createdTime: createdTime)
        {
            LovelySofaId = lovelySofaId;
            FavoriteCoffeMachineId = favoriteCoffeMachineId;
        }

        public string PersonId => SourceId;
        public string LovelySofaId { get; }
        public string FavoriteCoffeMachineId { get; }
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace WMAP.Common.Security
{
    /// <summary>
    /// T spec Rijndael
    /// </summary>
    public static class TRijndaelExtender
    {
        #region Rijndael Settings

        /// <summary>
        /// keysize 256 * 8 = 2048
        /// </summary>
        private const int KeySize = 256;

        /// <summary>
        /// blocksize 128
        /// </summary>
        private const int BlockSize = 128;

        /// <summary>
        /// cipher mode is ChainBlockCipher
        /// </summary>
        private const CipherMode CiferMode = CipherMode.CBC;

        /// <summary>
        /// padding mode is none
        /// </summary>
        private const PaddingMode Padding = PaddingMode.None;

        #endregion

        /// <summary>
        /// Tencent's Pkcs7 Padding
        /// </summary>
        /// <param name="text_length"></param>
        /// <returns></returns>
        private static byte[] TPKCS7Padding(int text_length)
        {
            int block_size = 32;

            // 计算需要填充的位数
            int amount_to_pad = block_size - (text_length % block_size);
            if (amount_to_pad == 0)
            {
                amount_to_pad = block_size;
            }

            StringBuilder tmp = new StringBuilder();
            for (int index = 0; index < amount_to_pad; index++)
            {
                tmp.Append(amount_to_pad.ConvertToChar());
            }
            return Encoding.UTF8.GetBytes(tmp.ToString());
        }

        /// <summary>
        /// 将数字转化成ASCII码对应的字符,用于对明文进行补码
        /// </summary>
        /// <param name="a">需要转化的数字</param>
        /// <returns>转化得到的字符</returns>
        private static char ConvertToChar(this int a)
        {

            byte target = (byte)(a & 0xFF);
            return (char)target;
        }

        /// <summary>
        /// Tencent's Rijndael Encrypt
        /// </summary>
        /// <param name="input"></param>
        /// <param name="iv"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static String AES_encrypt(this byte[] input, byte[] iv, byte[] key)
        {
            using (var aes = new RijndaelManaged() { KeySize = KeySize, BlockSize = BlockSize, Padding = Padding, Mode = CiferMode })
            {
                var encrypt = aes.CreateEncryptor(key, iv);

                byte[] xBuff = null;

                #region 自己进行PKCS7补位,用系统自己带的不行
                byte[] msg = new byte[input.Length + 32 - input.Length % 32];
                Array.Copy(input, msg, input.Length);
                byte[] pad = TPKCS7Padding(input.Length);
                Array.Copy(pad, 0, msg, input.Length, pad.Length);
                #endregion

                using (var ms = new MemoryStream())
                {
                    using (var cs = new CryptoStream(ms, encrypt, CryptoStreamMode.Write))
                    {
                        cs.Write(msg, 0, msg.Length);
                    }
                    xBuff = ms.ToArray();
                }

                String Output = Convert.ToBase64String(xBuff);
                return Output;
            }

        }

        /// <summary>
        /// Tencent's Rijndael Decrypt
        /// </summary>
        /// <param name="input"></param>
        /// <param name="iv"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static byte[] AES_decrypt(this String input, byte[] iv, byte[] key)
        {
            using (var aes = new RijndaelManaged() { KeySize = KeySize, BlockSize = BlockSize, Padding = Padding, Mode = CiferMode })
            {
                var decrypt = aes.CreateDecryptor(iv, key);
                byte[] xBuff = null;
                using (var ms = new MemoryStream())
                {
                    using (var cs = new CryptoStream(ms, decrypt, CryptoStreamMode.Write))
                    {
                        byte[] xXml = Convert.FromBase64String(input);
                        byte[] msg = new byte[xXml.Length + 32 - xXml.Length % 32];
                        Array.Copy(xXml, msg, xXml.Length);
                        cs.Write(xXml, 0, xXml.Length);
                    }
                    xBuff = decode2(ms.ToArray());
                }
                return xBuff;

            }
        }

        /// <summary>
        /// decode
        /// </summary>
        /// <param name="decrypted"></param>
        /// <returns></returns>
        private static byte[] decode2(byte[] decrypted)
        {
            int pad = (int)decrypted[decrypted.Length - 1];
            if (pad < 1 || pad > 32)
            {
                pad = 0;
            }
            byte[] res = new byte[decrypted.Length - pad];
            Array.Copy(decrypted, 0, res, 0, decrypted.Length - pad);
            return res;
        }
    }
}


text:
/*
 * @test
 * @bug 8002091
 * @summary Test options patterns for javac,javah,javap and javadoc using
 * javac as a test launcher. Create a dummy javac and intercept options to check
 * reception of options as passed through the launcher without having to launch
 * javac. Only -J and -cp ./* options should be consumed by the launcher.
 * @run main ToolsOpts
 * @author ssides
 */

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ToolsOpts extends TestHelper {
    static final String JBCP_PREPEND = "-J-Xbootclasspath/p:";
    private static File testJar = null;
    static String[][] optionPatterns = {
        {"-J-Xmx128m"},
        {"-J-version"},
        {"-J-XshowSettings:vm"},
        {"-J-Xdiag"},
        {"-J-showversion"},
        {"-J-version", "-option"},
        {"-option"},
        {"-option:sub"},
        {"-option:sub-"},
        {"-option:sub1,sub2"}, // -option:list
        {"-option:{sub1,sub2,sub3}"}, // -option:{list}
        {"-option:{{sub1,sub2,sub3}}"},// -option:{{list}}
        {"-option/c:/export/date/tmp"},
        {"-option=value"},
        {"-Dpk1.pk2.pk3"}, // dot in option
        {"-Dpk1.pk2=value"}, // dot in option followed by =value
        {"@<filename>"},
        {"-option", "http://site.com", "http://site.org"},
        {"-option", "name", "p1:p2.."},
        {"-All these non-options show launchers pass options as is to tool."},
        {"-option"},
        {"-option:sub"},
        {"-option:sub-"},
        {"-option", "<path>"},
        {"-option", "<file>"},
        {"-option", "<dir>"},
        {"-option", "http://a/b/c/g;x?y#s"},
        {"-option", "<html code>"},
        {"-option", "name1:name2"},
        {"-option", "3"},
        {"option1", "-J-version", "option2"},
        {"option1", "-J-version", "-J-XshowSettings:vm", "option2"},};

    static void init() throws IOException {
        if (testJar != null) {
            return;
        }

        // A tool which simulates com.sun.tools.javac.Main argument processing,
        // intercepts options passed via the javac launcher.
        final String mainJava = "Main" + JAVA_FILE_EXT;
        testJar = new File("test" + JAR_FILE_EXT);
        List<String> contents = new ArrayList<>();
        contents.add("package com.sun.tools.javac;");
        contents.add("public class Main {");
        contents.add("    public static void main(String... args) {\n");
        contents.add("       for (String x : args) {\n");
        contents.add("           if(x.compareTo(\" \")!=0)\n");
        contents.add("               System.out.println(x);\n");
        contents.add("       }\n");
        contents.add("    }\n");
        contents.add("}\n");
        createFile(new File(mainJava), contents);

        // compile and jar Main.java into test.jar
        compile("-d", ".", mainJava);
            createJar("cvf", testJar.getAbsolutePath(), "com");
        }

    static void pass(String msg) {
        System.out.println("pass: " + msg);
    }

    static void errout(String msg) {
        System.err.println(msg);
    }

    // Return position of -J option or -1 is does not contain a -J option.
    static int indexOfJoption(String[] opts) {
        for (int i = 0; i < opts.length; i++) {
            if (opts[i].startsWith("-J")) {
                return i;
            }
        }
        return -1;
    }

    /*
     * Check that J options a) are not passed to tool, and b) do the right thing,
     * that is, they should be passed to java launcher and work as expected.
     */
    static void checkJoptionOutput(TestResult tr, String[] opts) throws IOException {
        // Check -J-version options are not passed but do what they should.
        String jopts = "";
        for (String pat : opts) {
            jopts = jopts.concat(pat + " ");
            if (tr.contains("-J")) {
                throw new RuntimeException(
                        "failed: output should not contain option " + pat);
            }
            if (pat.compareTo("-J-version") == 0 ||
                    pat.compareTo("-J-showversion") == 0) {
                if (!tr.contains("java version") &&
                        !tr.contains("openjdk version")) {
                    throw new RuntimeException("failed: " + pat +
                            " should display a version string.");
                }
            } else if (pat.compareTo("-J-XshowSettings:VM") == 0) {
                if (!tr.contains("VM settings")) {
                    throw new RuntimeException("failed: " + pat +
                            " should have display VM settings.");
                }
            }
        }
        pass("Joption check: " + jopts);
    }

    /*
     * Feed each option pattern in optionPatterns array to javac launcher with
     * checking program preempting javac. Check that option received by 'dummy'
     * javac is the one passed on the command line.
     */
    static void runTestOptions() throws IOException {
        init();
        TestResult tr = null;
        String sTestJar = testJar.getAbsolutePath();
        int jpos = -1;
        for (String arg[] : optionPatterns) {
            jpos = indexOfJoption(arg);
            //Build a cmd string for output in results reporting.
            String cmdString = javacCmd + " " + JBCP_PREPEND + sTestJar;
            for (String opt : arg) {
                cmdString = cmdString.concat(" " + opt);
            }
            switch (arg.length) {
                case 1:
                    tr = doExec(javacCmd, JBCP_PREPEND + sTestJar,
                            arg[0]);
                    break;
                case 2:
                    tr = doExec(javacCmd, JBCP_PREPEND + sTestJar,
                            arg[0], arg[1]);
                    break;
                case 3:
                    tr = doExec(javacCmd, JBCP_PREPEND + sTestJar,
                            arg[0], arg[1], arg[2]);
                    break;
                case 4:
                    tr = doExec(javacCmd, JBCP_PREPEND + sTestJar,
                            arg[0], arg[1], arg[2], arg[3]);
                    break;
                default:
                    tr = null;
                    break;
            }

            String[] output = tr.testOutput.toArray(new String[tr.testOutput.size()]);
            //-Joptions should not be passed to tool
            if (jpos > -1) {
                checkJoptionOutput(tr, arg);
                if (tr.contains(arg[jpos])) {
                    throw new RuntimeException(
                            "failed! Should not have passed -J option to tool.\n"
                            + "CMD: " + cmdString);
                }
            } else {
                //check that each non -J option was passed to tool.
                for (int i = 0; i < arg.length; i++) {
                    if (output[i].compareTo(arg[i]) != 0) {
                        throw new RuntimeException(
                                "failed! CMD: " + cmdString + "\n   case:" +
                                output[i] + " != " + arg[i]);
                    } else {
                        pass("check " + output[i] + " == " + arg[i]);
                    }
                }
            }
            pass(cmdString);
        }
    }

    public static void main(String... args) throws IOException {
        runTestOptions();
    }
}


text:
\rm -f lemma_test.xml

#./lemma_test --output_format=XML --log_level=all --report_level=no > lemma_test.xml

exit `./lemma_test --output_format=XML --log_level=all --report_level=no > lemma_test.xml && test -f lemma_test.xml`


text:
<?php

namespace Platformsh\Cli\Command;

use Platformsh\Cli\Util\ActivityUtil;
use Platformsh\Client\Model\Environment;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class EnvironmentActivateCommand extends PlatformCommand
{

    protected function configure()
    {
        $this
          ->setName('environment:activate')
          ->setDescription('Activate an environment')
          ->addArgument('environment', InputArgument::IS_ARRAY, 'The environment(s) to activate')
          ->addOption('no-wait', null, InputOption::VALUE_NONE, 'Do not wait for the operation to complete');
        $this->addProjectOption()
             ->addEnvironmentOption();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->validateInput($input, $output)) {
            return 1;
        }

        if ($this->hasSelectedEnvironment()) {
            $toActivate = array($this->getSelectedEnvironment());
        } else {
            $environments = $this->getEnvironments();
            $environmentIds = $input->getArgument('environment');
            $toActivate = array_intersect_key($environments, array_flip($environmentIds));
            $notFound = array_diff($environmentIds, array_keys($environments));
            foreach ($notFound as $notFoundId) {
                $output->writeln("Environment not found: <error>$notFoundId</error>");
            }
        }

        $success = $this->activateMultiple($toActivate, $input, $output);

        return $success ? 0 : 1;
    }

    /**
     * @param Environment[]   $environments
     * @param InputInterface  $input
     * @param OutputInterface $output
     *
     * @return bool
     */
    protected function activateMultiple(array $environments, InputInterface $input, OutputInterface $output)
    {
        $count = count($environments);
        $processed = 0;
        // Confirm which environments the user wishes to be deactivated.
        $process = array();
        $questionHelper = $this->getHelper('question');
        foreach ($environments as $environment) {
            $environmentId = $environment['id'];
            if ($environment->isActive()) {
                $output->writeln("The environment <info>$environmentId</info> is already active.");
                $count--;
                continue;
            }
            if (!$environment->operationAvailable('activate')) {
                $output->writeln(
                  "Operation not available: The environment <error>$environmentId</error> can't be activated."
                );
                continue;
            }
            $question = "Are you sure you want to activate the environment <info>$environmentId</info>?";
            if (!$questionHelper->confirm($question, $input, $output)) {
                continue;
            }
            $process[$environmentId] = $environment;
        }
        $activities = array();
        /** @var Environment $environment */
        foreach ($process as $environmentId => $environment) {
            try {
                $activities[] = $environment->activate();
                $processed++;
                $output->writeln("Activating environment <info>$environmentId</info>");
            } catch (\Exception $e) {
                $output->writeln($e->getMessage());
            }
        }
        if ($processed) {
            if (!$input->getOption('no-wait')) {
                ActivityUtil::waitMultiple($activities, $output);
            }
            $this->getEnvironments(null, true);
        }

        return $processed >= $count;
    }

}


text:
package main

import (
	"context"
	"database/sql"
	"fmt"
	"net"
	"os"
	"strconv"

	_ "github.com/go-sql-driver/mysql"
	"github.com/pingcap/errors"
	"github.com/spf13/cobra"
	"golang.org/x/sync/errgroup"
)

const (
	flagDatabase = "database"
	flagTable    = "table"
	flagPort     = "port"
	flagWorker   = "worker"
)

var rootCmd *cobra.Command

func main() {
	rootCmd = &cobra.Command{}
	rootCmd.Flags().StringP(flagDatabase, "B", "s3", "Database to import")
	rootCmd.Flags().StringP(flagTable, "T", "t", "Table to import")
	rootCmd.Flags().IntP(flagPort, "P", 4000, "TCP/IP port to connect to")
	rootCmd.Flags().IntP(flagWorker, "w", 16, "Workers to import synchronously")

	rootCmd.RunE = func(cmd *cobra.Command, args []string) error {
		database, err := cmd.Flags().GetString(flagDatabase)
		if err != nil {
			return errors.Trace(err)
		}
		table, err := cmd.Flags().GetString(flagTable)
		if err != nil {
			return errors.Trace(err)
		}
		port, err := cmd.Flags().GetInt(flagPort)
		if err != nil {
			return errors.Trace(err)
		}
		worker, err := cmd.Flags().GetInt(flagWorker)
		if err != nil {
			return errors.Trace(err)
		}

		dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4", "root", "", net.JoinHostPort("127.0.0.1", strconv.Itoa(port)), database)
		db, err := sql.Open("mysql", dsn)
		if err != nil {
			return errors.Trace(err)
		}

		tableTemp := `CREATE TABLE IF NOT EXISTS %s (
	   a VARCHAR(11)
)`
		_, err = db.Exec(fmt.Sprintf(tableTemp, table))
		if err != nil {
			return errors.Trace(err)
		}

		query := fmt.Sprintf("insert into %s values('aaaaaaaaaa')", table) // nolint:gosec
		for i := 1; i < 10000; i++ {
			query += ",('aaaaaaaaaa')"
		}
		ch := make(chan struct{}, worker)
		for i := 0; i < worker; i++ {
			ch <- struct{}{}
		}
		var eg *errgroup.Group
		ctx, cancel := context.WithCancel(context.Background())
		defer cancel()
		eg, ctx = errgroup.WithContext(ctx)
		for i := 0; i < 500; i++ {
			if ctx.Err() != nil {
				break
			}
			<-ch
			eg.Go(func() error {
				_, err := db.ExecContext(ctx, query)
				if err != nil {
					cancel()
					return errors.Trace(err)
				}
				ch <- struct{}{}
				return nil
			})
		}
		return eg.Wait()
	}

	if err := rootCmd.Execute(); err != nil {
		fmt.Printf("fail to import data, err: %v", err)
		os.Exit(2)
	}
}