text:
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGLDRIVER_H
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGLDRIVER_H

#include "DriverBase.h"
#include "GLUtils.h"
#include "OpenGLContext.h"

#include "private/backend/AcquiredImage.h"
#include "private/backend/Driver.h"
#include "private/backend/HandleAllocator.h"
#include "backend/Program.h"

#include "backend/TargetBufferInfo.h"

#include <utils/compiler.h>
#include <utils/Allocator.h>

#include <math/vec4.h>

#include <tsl/robin_map.h>

#include <set>

#ifndef FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB
#    define FILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB 4
#endif

namespace filament::backend {

class OpenGLPlatform;
class PixelBufferDescriptor;
struct TargetBufferInfo;

class OpenGLProgram;
class OpenGLBlitter;
class OpenGLTimerQueryInterface;

class OpenGLDriver final : public DriverBase {
    inline explicit OpenGLDriver(OpenGLPlatform* platform, const Platform::DriverConfig& driverConfig) noexcept;
    ~OpenGLDriver() noexcept final;
    Dispatcher getDispatcher() const noexcept final;

public:
    static Driver* create(OpenGLPlatform* platform, void* sharedGLContext, const Platform::DriverConfig& driverConfig) noexcept;

    class DebugMarker {
        OpenGLDriver& driver;
    public:
        DebugMarker(OpenGLDriver& driver, const char* string) noexcept;
        ~DebugMarker() noexcept;
    };

    // OpenGLDriver specific fields

    struct GLBufferObject : public HwBufferObject {
        using HwBufferObject::HwBufferObject;
        GLBufferObject(uint32_t size,
                BufferObjectBinding bindingType, BufferUsage usage) noexcept
                : HwBufferObject(size), usage(usage) {
            gl.binding = GLUtils::getBufferBindingType(bindingType);
        }
        struct {
            GLuint id = 0;
            GLenum binding = 0;
        } gl;
        BufferUsage usage = {};
    };

    struct GLVertexBuffer : public HwVertexBuffer {
        using HwVertexBuffer::HwVertexBuffer;
        struct {
            // 4 * MAX_VERTEX_ATTRIBUTE_COUNT bytes
            std::array<GLuint, MAX_VERTEX_ATTRIBUTE_COUNT> buffers{};
        } gl;
    };

    struct GLIndexBuffer : public HwIndexBuffer {
        using HwIndexBuffer::HwIndexBuffer;
        struct {
            GLuint buffer{};
        } gl;
    };

    struct GLTexture;
    struct GLSamplerGroup : public HwSamplerGroup {
        using HwSamplerGroup::HwSamplerGroup;
        struct Entry {
            GLTexture const* texture = nullptr;
            GLuint sampler = 0u;
        };
        utils::FixedCapacityVector<Entry> textureUnitEntries;
        explicit GLSamplerGroup(size_t size) noexcept : textureUnitEntries(size) { }
    };

    struct GLRenderPrimitive : public HwRenderPrimitive {
        using HwRenderPrimitive::HwRenderPrimitive;
        OpenGLContext::RenderPrimitive gl;
    };

    struct GLTexture : public HwTexture {
        using HwTexture::HwTexture;
        struct GL {
            GL() noexcept : imported(false), sidecarSamples(1), reserved(0) {}
            GLuint id = 0;          // texture or renderbuffer id
            GLenum target = 0;
            GLenum internalFormat = 0;
            GLuint sidecarRenderBufferMS = 0;  // multi-sample sidecar renderbuffer
            mutable GLsync fence = {};

            // texture parameters go here too
            GLfloat anisotropy = 1.0;
            int8_t baseLevel = 127;
            int8_t maxLevel = -1;
            uint8_t targetIndex = 0;    // optimization: index corresponding to target
            bool imported           : 1;
            uint8_t sidecarSamples  : 4;
            uint8_t reserved        : 3;
        } gl;

        void* platformPImpl = nullptr;
    };

    struct GLTimerQuery : public HwTimerQuery {
        struct State {
            std::atomic<uint64_t> elapsed{};
            std::atomic_bool available{};
        };
        struct {
            GLuint query = 0;
            std::shared_ptr<State> emulation;
        } gl;
        // 0 means not available, otherwise query result in ns.
        std::atomic<uint64_t> elapsed{};
    };

    struct GLStream : public HwStream {
        using HwStream::HwStream;
        struct Info {
            // storage for the read/write textures below
            Platform::ExternalTexture* ets = nullptr;
            GLuint width = 0;
            GLuint height = 0;
        };
        /*
         * The fields below are accessed from the main application thread
         * (not the GL thread)
         */
        struct {
            int64_t timestamp = 0;
            uint8_t cur = 0;
            AcquiredImage acquired;
            AcquiredImage pending;
        } user_thread;
    };

    struct GLRenderTarget : public HwRenderTarget {
        using HwRenderTarget::HwRenderTarget;
        struct {
            // field ordering to optimize size on 64-bits
            GLTexture* color[MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT];
            GLTexture* depth;
            GLTexture* stencil;
            GLuint fbo = 0;
            mutable GLuint fbo_read = 0;
            mutable TargetBufferFlags resolve = TargetBufferFlags::NONE; // attachments in fbo_draw to resolve
            uint8_t samples = 1;
        } gl;
        TargetBufferFlags targets = {};
    };

    struct GLSync : public HwSync {
        using HwSync::HwSync;
        struct State {
            std::atomic<GLenum> status{ GL_TIMEOUT_EXPIRED };
        };
        struct {
            GLsync sync;
        } gl;
        std::shared_ptr<State> result{ std::make_shared<GLSync::State>() };
    };

    OpenGLDriver(OpenGLDriver const&) = delete;
    OpenGLDriver& operator=(OpenGLDriver const&) = delete;

private:
    OpenGLContext mContext;

    OpenGLContext& getContext() noexcept { return mContext; }

    ShaderModel getShaderModel() const noexcept final;

    /*
     * Driver interface
     */

    template<typename T>
    friend class ConcreteDispatcher;

#define DECL_DRIVER_API(methodName, paramsDecl, params) \
    UTILS_ALWAYS_INLINE inline void methodName(paramsDecl);

#define DECL_DRIVER_API_SYNCHRONOUS(RetType, methodName, paramsDecl, params) \
    RetType methodName(paramsDecl) override;

#define DECL_DRIVER_API_RETURN(RetType, methodName, paramsDecl, params) \
    RetType methodName##S() noexcept override; \
    UTILS_ALWAYS_INLINE inline void methodName##R(RetType, paramsDecl);

#include "private/backend/DriverAPI.inc"

    // Memory management...

    // See also the explicit template instantiation in HandleAllocator.cpp
    HandleAllocatorGL mHandleAllocator;

    template<typename D, typename ... ARGS>
    Handle<D> initHandle(ARGS&& ... args) noexcept {
        return mHandleAllocator.allocateAndConstruct<D>(std::forward<ARGS>(args) ...);
    }

    template<typename D, typename B, typename ... ARGS>
    typename std::enable_if<std::is_base_of<B, D>::value, D>::type*
    construct(Handle<B> const& handle, ARGS&& ... args) noexcept {
        return mHandleAllocator.destroyAndConstruct<D, B>(handle, std::forward<ARGS>(args) ...);
    }

    template<typename B, typename D,
            typename = typename std::enable_if<std::is_base_of<B, D>::value, D>::type>
    void destruct(Handle<B>& handle, D const* p) noexcept {
        return mHandleAllocator.deallocate(handle, p);
    }

    template<typename Dp, typename B>
    typename std::enable_if_t<
            std::is_pointer_v<Dp> &&
            std::is_base_of_v<B, typename std::remove_pointer_t<Dp>>, Dp>
    handle_cast(Handle<B>& handle) noexcept {
        return mHandleAllocator.handle_cast<Dp, B>(handle);
    }

    template<typename Dp, typename B>
    inline typename std::enable_if_t<
            std::is_pointer_v<Dp> &&
            std::is_base_of_v<B, typename std::remove_pointer_t<Dp>>, Dp>
    handle_cast(Handle<B> const& handle) noexcept {
        return mHandleAllocator.handle_cast<Dp, B>(handle);
    }

    friend class OpenGLProgram;

    /* Extension management... */

    using MustCastToRightType = void (*)();
    using GetProcAddressType = MustCastToRightType (*)(const char* name);
    GetProcAddressType getProcAddress = nullptr;

    /* Misc... */

    void updateVertexArrayObject(GLRenderPrimitive* rp, GLVertexBuffer const* vb);

    void framebufferTexture(TargetBufferInfo const& binfo,
            GLRenderTarget const* rt, GLenum attachment) noexcept;

    void setRasterState(RasterState rs) noexcept;

    void setStencilState(StencilState ss) noexcept;

    void setTextureData(GLTexture* t,
            uint32_t level,
            uint32_t xoffset, uint32_t yoffset, uint32_t zoffset,
            uint32_t width, uint32_t height, uint32_t depth,
            PixelBufferDescriptor&& p);

    void setCompressedTextureData(GLTexture* t,
            uint32_t level,
            uint32_t xoffset, uint32_t yoffset, uint32_t zoffset,
            uint32_t width, uint32_t height, uint32_t depth,
            PixelBufferDescriptor&& p);

    void renderBufferStorage(GLuint rbo, GLenum internalformat, uint32_t width,
            uint32_t height, uint8_t samples) const noexcept;

    void textureStorage(GLTexture* t,
            uint32_t width, uint32_t height, uint32_t depth) noexcept;

    /* State tracking GL wrappers... */

           void bindTexture(GLuint unit, GLTexture const* t) noexcept;
           void bindSampler(GLuint unit, GLuint sampler) noexcept;
    inline void useProgram(OpenGLProgram* p) noexcept;

    enum class ResolveAction { LOAD, STORE };
    void resolvePass(ResolveAction action, GLRenderTarget const* rt,
            TargetBufferFlags discardFlags) noexcept;

    GLuint getSamplerSlow(SamplerParams sp) const noexcept;

    inline GLuint getSampler(SamplerParams sp) const noexcept {
        assert_invariant(!sp.padding0);
        assert_invariant(!sp.padding1);
        assert_invariant(!sp.padding2);
        auto& samplerMap = mSamplerMap;
        auto pos = samplerMap.find(sp.u);
        if (UTILS_UNLIKELY(pos == samplerMap.end())) {
            return getSamplerSlow(sp);
        }
        return pos->second;
    }

    const std::array<GLSamplerGroup*, Program::SAMPLER_BINDING_COUNT>& getSamplerBindings() const {
        return mSamplerBindings;
    }

    using AttachmentArray = std::array<GLenum, MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT + 2>;
    static GLsizei getAttachments(AttachmentArray& attachments,
            GLRenderTarget const* rt, TargetBufferFlags buffers) noexcept;

    // state required to represent the current render pass
    Handle<HwRenderTarget> mRenderPassTarget;
    RenderPassParams mRenderPassParams;
    GLboolean mRenderPassColorWrite{};
    GLboolean mRenderPassDepthWrite{};
    GLboolean mRenderPassStencilWrite{};

    void clearWithRasterPipe(TargetBufferFlags clearFlags,
            math::float4 const& linearColor, GLfloat depth, GLint stencil) noexcept;

    void setScissor(Viewport const& scissor) noexcept;

    // sampler buffer binding points (nullptr if not used)
    std::array<GLSamplerGroup*, Program::SAMPLER_BINDING_COUNT> mSamplerBindings = {};   // 4 pointers

    mutable tsl::robin_map<uint32_t, GLuint> mSamplerMap;
    mutable std::vector<GLTexture*> mExternalStreams;

    void attachStream(GLTexture* t, GLStream* stream) noexcept;
    void detachStream(GLTexture* t) noexcept;
    void replaceStream(GLTexture* t, GLStream* stream) noexcept;

    OpenGLPlatform& mPlatform;

    void updateStreamAcquired(GLTexture* t, DriverApi* driver) noexcept;
    void updateTextureLodRange(GLTexture* texture, int8_t targetLevel) noexcept;

    void setExternalTexture(GLTexture* t, void* image);

    // tasks executed on the main thread after the fence signaled
    void whenGpuCommandsComplete(std::function<void()> fn) noexcept;
    void executeGpuCommandsCompleteOps() noexcept;
    std::vector<std::pair<GLsync, std::function<void()>>> mGpuCommandCompleteOps;

    // tasks regularly executed on the main thread at until they return true
    void runEveryNowAndThen(std::function<bool()> fn) noexcept;
    void executeEveryNowAndThenOps() noexcept;
    std::vector<std::function<bool()>> mEveryNowAndThenOps;

    void runAtNextRenderPass(void* token, std::function<void()> fn) noexcept;
    void executeRenderPassOps() noexcept;
    void cancelRunAtNextPassOp(void* token) noexcept;
    tsl::robin_map<void*, std::function<void()>> mRunAtNextRenderPassOps;

    // timer query implementation
    OpenGLTimerQueryInterface* mTimerQueryImpl = nullptr;
    bool mFrameTimeSupported = false;
};

// ------------------------------------------------------------------------------------------------

} // namespace filament::backend

#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGLDRIVER_H


text:
[![Build Status](https://travis-ci.org/ggordon/simple_json_api.svg?branch=master)](https://travis-ci.org/ggordon/simple_json_api) [![Code Climate](https://codeclimate.com/github/ggordon/simple_json_api/badges/gpa.svg)](https://codeclimate.com/github/ggordon/simple_json_api) [![Test Coverage](https://codeclimate.com/github/ggordon/simple_json_api/badges/coverage.svg)](https://codeclimate.com/github/ggordon/simple_json_api) [![Gem Version](https://badge.fury.io/rb/simple_json_api.svg)](http://badge.fury.io/rb/simple_json_api)

A gem to render json following the [jsonapi](http://jsonapi.org) spec.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'simple_json_api'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install simple_json_api

### Rails Integration

Use the gem [simple_json_api-rails](https://github.com/dajacques/simple_json_api-rails)

## Usage

### Define serializers

A serializer will need to be created for each resource. The serializer will defined the attributes and associations of the serialized json.

```ruby
class ProjectSerializer < SimpleJsonApi::ResourceSerializer
  serializes :projects, model: Project
  attribute :id
  attribute :name, key: :project_name
  attribute :description
  attribute :position
  has_one :todolist
  has_many :tags
  def href
    "http://example.com/projects/#{_object.id}"
  end
end
```

Serializers are subclasses of `SimpleJsonApi::ResourceSerializer`. The `serializes` method defines the `root_class` for the object, specifying the model is optional, but may be necessary when the serializer cannot be determined for polymorphic associations.
`attribute` defines the attributes of the serializer, the optional `key` allows the name to be changed during serialization.
Associations are declared with `has_many`, `has_one`, and `belongs_to`. These can optionally set `polymorphic: true`. Also if the serializer cannot be determined by the name of the association, that is the name doesn't match any registered serializers, then the `serializer` parameter will need to be set.

### Using serializers

```ruby
render json: SimpleJsonApi.render(
                model: @projects,
                serializer: ProjectSerializer,
                fields: 'id,name',
                include: 'todolist'
              )
```

When rendering the model is the AR data to be serialized, if it is an Array the ArraySerializer will be used for the top collection.
`fields` and `include` follow the jsonapi spec. [Include](http://jsonapi.org/format/#fetching-includes) will be the associations to be included in the generated json. [Fields](http://jsonapi.org/format/#fetching-sparse-fieldsets) is the list of attributes that will be included. The primary key will always be included.

## TODO

0. Better documentation
1. Handle meta section
2. Handle links section
3. Optimize queries (caching?)
4. Handle PUTS/POSTS/DELETES

## Contributing

1. Fork it ( https://github.com/[my-github-username]/simple_json_api/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

redpajama_set_name: RedPajamaGithub


text:
/* Generated By:JJTree: Do not edit this line. ASTInitializer.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package org.iguanatool.testobject.cparser;

public class ASTInitializer extends SimpleNode {
    public ASTInitializer(int id) {
        super(id);
    }

    public ASTInitializer(CParser p, int id) {
        super(p, id);
    }

    /**
     * Accept the visitor.
     **/
    public void jjtAccept(CParserVisitor visitor) {
        visitor.visit(this);
    }
}
/* JavaCC - OriginalChecksum=4f5057fd40cc720a8b85f06b4b852cde (do not edit this line) */


text:
// .NAME vtkXOpenGLRenderWindow - OpenGL rendering window
// .SECTION Description
// vtkXOpenGLRenderWindow is a concrete implementation of the abstract class
// vtkRenderWindow. vtkOpenGLRenderer interfaces to the OpenGL graphics
// library. Application programmers should normally use vtkRenderWindow
// instead of the OpenGL specific version.

#ifndef vtkXOpenGLRenderWindow_h
#define vtkXOpenGLRenderWindow_h

#include "vtkRenderingOpenGL2Module.h" // For export macro
#include "vtkOpenGLRenderWindow.h"
#include <X11/Xlib.h> // Needed for X types used in the public interface
#include <X11/Xutil.h> // Needed for X types used in the public interface

class vtkIdList;
class vtkXOpenGLRenderWindowInternal;

class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
{
public:
  static vtkXOpenGLRenderWindow *New();
  vtkTypeMacro(vtkXOpenGLRenderWindow, vtkOpenGLRenderWindow);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Begin the rendering process.
  virtual void Start(void);

  // Description:
  // End the rendering process and display the image.
  virtual void Frame(void);

  // Description:
  // Initialize the window for rendering.
  virtual void WindowInitialize(void);

  // Description:
  // Initialize the rendering window.  This will setup all system-specific
  // resources.  This method and Finalize() must be symmetric and it
  // should be possible to call them multiple times, even changing WindowId
  // in-between.  This is what WindowRemap does.
  virtual void Initialize(void);

  // Description:
  // "Deinitialize" the rendering window.  This will shutdown all system-specific
  // resources.  After having called this, it should be possible to destroy
  // a window that was used for a SetWindowId() call without any ill effects.
  virtual void Finalize(void);

  // Description:
  // Change the window to fill the entire screen.
  virtual void SetFullScreen(int);

  // Description:
  // Resize the window.
  virtual void WindowRemap(void);

  // Description:
  // Set the preferred window size to full screen.
  virtual void PrefFullScreen(void);

  // Description:
  // Specify the size of the rendering window in pixels.
  virtual void SetSize(int,int);
  virtual void SetSize(int a[2]) {this->SetSize(a[0], a[1]);}

  // Description:
  // Get the X properties of an ideal rendering window.
  virtual Colormap GetDesiredColormap();
  virtual Visual  *GetDesiredVisual();
  virtual XVisualInfo     *GetDesiredVisualInfo();
  virtual int      GetDesiredDepth();

  // Description:
  // Prescribe that the window be created in a stereo-capable mode. This
  // method must be called before the window is realized. This method
  // overrides the superclass method since this class can actually check
  // whether the window has been realized yet.
  virtual void SetStereoCapableWindow(int capable);

  // Description:
  // Make this window the current OpenGL context.
  void MakeCurrent();

  // Description:
  // Tells if this window is the current OpenGL context for the calling thread.
  virtual bool IsCurrent();

  // Description:
  // If called, allow MakeCurrent() to skip cache-check when called.
  // MakeCurrent() reverts to original behavior of cache-checking
  // on the next render.
  void SetForceMakeCurrent();

  // Description:
  // Get report of capabilities for the render window
  const char *ReportCapabilities();

  // Description:
  // Is this render window using hardware acceleration? 0-false, 1-true
  int IsDirect();

  // Description:
  // Xwindow get set functions
  virtual void *GetGenericDisplayId()
    {
      return this->GetDisplayId();
    }

  virtual void *GetGenericWindowId();
  virtual void *GetGenericParentId()
    {
      return reinterpret_cast<void *>(this->ParentId);
    }

  virtual void *GetGenericContext();
  virtual void *GetGenericDrawable()
    {
      return reinterpret_cast<void *>(this->WindowId);
    }

  // Description:
  // Get the current size of the screen in pixels.
  virtual int     *GetScreenSize();

  // Description:
  // Get the position in screen coordinates (pixels) of the window.
  virtual int     *GetPosition();

  // Description:
  // Get this RenderWindow's X display id.
  Display *GetDisplayId();

  // Description:
  // Set the X display id for this RenderWindow to use to a pre-existing
  // X display id.
  void     SetDisplayId(Display *);
  void     SetDisplayId(void *);

  // Description:
  // Get this RenderWindow's parent X window id.
  Window   GetParentId();

  // Description:
  // Sets the parent of the window that WILL BE created.
  void     SetParentId(Window);
  void     SetParentId(void *);

  // Description:
  // Get this RenderWindow's X window id.
  Window   GetWindowId();

  // Description:
  // Set this RenderWindow's X window id to a pre-existing window.
  void     SetWindowId(Window);
  void     SetWindowId(void *);

  // Description:
  // Specify the X window id to use if a WindowRemap is done.
  void     SetNextWindowId(Window);

  // Description:
  // Set the window id of the new window once a WindowRemap is done.
  // This is the generic prototype as required by the vtkRenderWindow
  // parent.
  void     SetNextWindowId(void *);

  void     SetWindowName(const char *);

  // Description:
  // Initialize the render window from the information associated
  // with the currently activated OpenGL context.
  virtual bool InitializeFromCurrentContext();

  // Description:
  // Move the window to a new position on the display.
  void     SetPosition(int,int);
  void     SetPosition(int a[2]) {this->SetPosition(a[0], a[1]);};

  // Description:
  // Hide or Show the mouse cursor, it is nice to be able to hide the
  // default cursor if you want VTK to display a 3D cursor instead.
  void HideCursor();
  void ShowCursor();

  // Description:
  // Change the shape of the cursor
  virtual void SetCurrentCursor(int);

  // Description:
  // Check to see if a mouse button has been pressed or mouse wheel activated.
  // All other events are ignored by this method.
  // This is a useful check to abort a long render.
  virtual  int GetEventPending();

  // Description:
  // Set this RenderWindow's X window id to a pre-existing window.
  void     SetWindowInfo(char *info);

  // Description:
  // Set the window info that will be used after WindowRemap()
  void     SetNextWindowInfo(char *info);

  // Description:
  // Sets the X window id of the window that WILL BE created.
  void     SetParentInfo(char *info);

  // Description:
  // This computes the size of the render window
  // before calling the supper classes render
  void Render();

  // Description:
  // Render without displaying the window.
  void SetOffScreenRendering(int i);

protected:
  vtkXOpenGLRenderWindow();
  ~vtkXOpenGLRenderWindow();

  vtkXOpenGLRenderWindowInternal *Internal;

  Window   ParentId;
  Window   WindowId;
  Window   NextWindowId;
  Display *DisplayId;
  Colormap ColorMap;
  int      OwnWindow;
  int      OwnDisplay;
  int      ScreenSize[2];
  int      CursorHidden;
  int      ForceMakeCurrent;
  int      UsingHardware;
  char    *Capabilities;

  // we must keep track of the cursors we are using
  Cursor XCCrosshair;
  Cursor XCArrow;
  Cursor XCSizeAll;
  Cursor XCSizeNS;
  Cursor XCSizeWE;
  Cursor XCSizeNE;
  Cursor XCSizeNW;
  Cursor XCSizeSE;
  Cursor XCSizeSW;
  Cursor XCHand;

  void CreateAWindow();
  void DestroyWindow();
  void CreateOffScreenWindow(int width, int height);
  void DestroyOffScreenWindow();
  void ResizeOffScreenWindow(int width, int height);
  void CloseDisplay();

private:
  vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&) VTK_DELETE_FUNCTION;
  void operator=(const vtkXOpenGLRenderWindow&) VTK_DELETE_FUNCTION;
};

#endif


text:
using KaVE.Commons.Model.Naming;
using KaVE.Commons.Model.SSTs.Expressions.Assignable;
using KaVE.Commons.Model.SSTs.Impl.Expressions.Assignable;
using KaVE.Commons.Model.SSTs.Impl.References;
using KaVE.Commons.TestUtils;
using NUnit.Framework;

namespace KaVE.Commons.Tests.Model.SSTs.Impl.Expressions.Assignable
{
    internal class CastExpressionTest : SSTBaseTest
    {
        [Test]
        public void DefaultValues()
        {
            var sut = new CastExpression();
            Assert.AreEqual(new VariableReference(), sut.Reference);
            Assert.AreEqual(Names.UnknownType, sut.TargetType);
            Assert.AreEqual(CastOperator.Unknown, sut.Operator);
            Assert.AreNotEqual(0, sut.GetHashCode());
            Assert.AreNotEqual(1, sut.GetHashCode());
        }

        [Test]
        public void SettingValues()
        {
            var sut = new CastExpression
            {
                TargetType = Names.Type("T,P"),
                Reference = SomeVarRef(),
                Operator = CastOperator.SafeCast
            };

            Assert.AreEqual(Names.Type("T,P"), sut.TargetType);
            Assert.AreEqual(SomeVarRef(), sut.Reference);
            Assert.AreEqual(CastOperator.SafeCast, sut.Operator);
        }

        [Test]
        public void Equality_Default()
        {
            var a = new CastExpression();
            var b = new CastExpression();
            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }

        [Test]
        public void Equality_ReallyTheSame()
        {
            var a = new CastExpression
            {
                TargetType = Names.Type("T,P"),
                Reference = SomeVarRef(),
                Operator = CastOperator.SafeCast
            };

            var b = new CastExpression
            {
                TargetType = Names.Type("T,P"),
                Reference = SomeVarRef(),
                Operator = CastOperator.SafeCast
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }

        [Test]
        public void Equality_DifferentTargetType()
        {
            var a = new CastExpression
            {
                TargetType = Names.Type("T,P")
            };

            var b = new CastExpression();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }

        [Test]
        public void Equality_DifferentVarRef()
        {
            var a = new CastExpression
            {
                Reference = SomeVarRef("i")
            };

            var b = new CastExpression();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }

        [Test]
        public void Equality_DifferentOperation()
        {
            var a = new CastExpression
            {
                Operator = CastOperator.SafeCast
            };

            var b = new CastExpression();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }

        [Test]
        public void VisitorIsImplemented()
        {
            var sut = new CastExpression();
            sut.Accept(23).Verify(v => v.Visit(sut, 23));
        }

        [Test]
        public void VisitorWithReturnIsImplemented()
        {
            var sut = new CastExpression();
            sut.Accept(23).VerifyWithReturn(v => v.Visit(sut, 23));
        }

        [Test]
        public void ToStringReflection()
        {
            ToStringAssert.Reflection(new CastExpression());
        }

        [Test]
        public void NumberingOfEnumIsStable()
        {
            // IMPORTANT! do not change any of these because it will affect serialization

            Assert.AreEqual(0, (int) CastOperator.Unknown);
            Assert.AreEqual(1, (int) CastOperator.Cast);
            Assert.AreEqual(2, (int) CastOperator.SafeCast);
        }
    }
}


text:
<?php
require dirname(__DIR__).'/vendor/autoload.php';


text:
{% extends "layout.html" %}

{% block contents %}

            <button type="button" class="close" data-dismiss="alert">
                ×
                Close
            </button>
            경고! 댓글이 완전히 삭제되니, 다시 한번 확인하시기 바랍니다.

        <form role="form" method="post">
            <input type="text" name="password" placeholder="password">
            <button type="submit" class="btn btn-danger">댓글삭제</button>
        </form>

{% endblock %}


text:
/***************************************************************************//**
* \file cyhal_hwmgr_impl.h
*
* Description:
* This file provides internal device specific hardware manager utilities.
*
********************************************************************************
* \copyright
* Copyright 2018-2021 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#pragma once

#include "cyhal_hw_resources.h"
#include "cyhal_triggers.h"

#if defined(__cplusplus)
extern "C" {
#endif

/** Function pointer for use with _cyhal_hwmgr_reserve_instance for getting the input
 * destination of the specified hardware type given a specific block/channel */
typedef cyhal_dest_t (*_cyhal_hwmgr_get_input_dest_t)(uint8_t block_num, uint8_t channel_num);
/** Function pointer for use with _cyhal_hwmgr_reserve_instance for getting the output
 * source of the specified hardware type given a specific block/channel */
typedef cyhal_source_t (*_cyhal_hwmgr_get_output_source_t)(uint8_t block_num, uint8_t channel_num);

/** Attempts to reserve a resource of the specified \p type that is able to connect to the
 * \p src and \p dest signals if provided.
 * @param[in] type      The type of resource to reserve
 * @param[in] src       The optional input source to the resource type to be reserved
 * @param[in] dest      The optional destination target of the resource type to be reserved
 * @param[in] get_src   Function to use to get a source for a specific block/channel
 * @param[in] get_dest  Function to use to get a destination for a specific block/channel
 * @param[out] resource The reserved resource if successful
 * @return The status of the reservation request
 */
cy_rslt_t _cyhal_hwmgr_allocate_with_connection(cyhal_resource_t type, const cyhal_source_t *src, const cyhal_dest_t *dest,
    _cyhal_hwmgr_get_output_source_t get_src, _cyhal_hwmgr_get_input_dest_t get_dest, cyhal_resource_inst_t *resource);

#if defined(__cplusplus)
}
#endif


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace WebLab.Resultados {

    public partial class ProtocoloView {

        /// <summary>
        /// form1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlForm form1;

        /// <summary>
        /// lblDni control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblDni;

        /// <summary>
        /// imgEstado control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Image imgEstado;

        /// <summary>
        /// lblProtocolo control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblProtocolo;

        /// <summary>
        /// lblPaciente control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblPaciente;

        /// <summary>
        /// lblCodigoPaciente control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblCodigoPaciente;

        /// <summary>
        /// lblFecha control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblFecha;

        /// <summary>
        /// lblSexo control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblSexo;

        /// <summary>
        /// lblOrigen control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblOrigen;

        /// <summary>
        /// lblNumeroOrigen control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblNumeroOrigen;

        /// <summary>
        /// lblFechaNacimiento control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblFechaNacimiento;

        /// <summary>
        /// lblEdad control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblEdad;

        /// <summary>
        /// lblSector control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblSector;

        /// <summary>
        /// lblPrioridad control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblPrioridad;

        /// <summary>
        /// lblMedico control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblMedico;

        /// <summary>
        /// lblDiagnostico control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblDiagnostico;

        /// <summary>
        /// lblUsuario control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblUsuario;

        /// <summary>
        /// lblFechaRegistro control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblFechaRegistro;

        /// <summary>
        /// lblHoraRegistro control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblHoraRegistro;

        /// <summary>
        /// pnlObservaciones control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Panel pnlObservaciones;

        /// <summary>
        /// lblObservacion control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblObservacion;

        /// <summary>
        /// lblMuestra control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblMuestra;

        /// <summary>
        /// PesquisaNeonatal1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::WebLab.Resultados.PesquisaNeonatal PesquisaNeonatal1;
    }
}


text:
set(_CATKIN_CURRENT_PACKAGE "x_msgs")
set(x_msgs_VERSION "0.0.0")
set(x_msgs_MAINTAINER "tom <tom@todo.todo>")
set(x_msgs_PACKAGE_FORMAT "1")
set(x_msgs_BUILD_DEPENDS "roscpp" "std_msgs" "message_generation")
set(x_msgs_BUILD_EXPORT_DEPENDS "message_runtime" "roscpp" "std_msgs")
set(x_msgs_BUILDTOOL_DEPENDS "catkin")
set(x_msgs_BUILDTOOL_EXPORT_DEPENDS )
set(x_msgs_EXEC_DEPENDS "message_runtime" "roscpp" "std_msgs")
set(x_msgs_RUN_DEPENDS "message_runtime" "roscpp" "std_msgs")
set(x_msgs_TEST_DEPENDS )
set(x_msgs_DOC_DEPENDS )
set(x_msgs_DEPRECATED "")


text:
/*********************************************************/
//SISTEMA DE ENSAYO DE CAJA Y CUBOS AUTOMATIZADO (ABBT)//
	    //Luis Ángel García Astudillo//
  //Grado en Ingeniería en Tecnologías Industriales//
         //Universidad Carlos III de Madrid//
/********************************************************/

#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS
#endif

#include "stdafx.h"
#include <strsafe.h>
#include "resource.h"
#include "ColorBasics.h"
#include "DepthBasics.h"
#include "Detector.h"
#include <opencv2/opencv.hpp>
#include <Windows.h>
#include <Kinect.h>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>

#define TESTTIME 60 //Duración de la prueba

using std::cout;
using std::cin;
using std::getline;
using namespace cv;

Mat resizedDepth;
int main(void) {
	//Definición de caracteres especiales para su impresión por consola
	char v = 160; //a con tilde
	char w = 130; //e con tilde
	char x = 161; //i con tilde
	char y = 162; //o con tilde
	char z = 163; //u con tilde
	char zz = 168; //cierre interrogación
	char ac = 174; //abrir comillas
	char cc = 175; //cerrar comillas

	Detector detector;

	Mat bufferColorMat(detector.getColorHeight(), detector.getColorWidth(), CV_8UC4);
	Mat bufferColorMat2(detector.getColorHeight(), detector.getColorWidth(), CV_8UC4);
	Mat bufferDepthMat(detector.getDepthHeight(), detector.getDepthWidth(), CV_8UC1);
	Mat bufferDepthMat2(detector.getDepthHeight(), detector.getDepthWidth(), CV_8UC1);
	Mat bufferDepthMat3(detector.getDepthHeight(), detector.getDepthWidth(), CV_8UC1);

	//Mat bufferDepthMat(detector.getDepthHeight(), detector.getDepthWidth(), CV_16UC1);
	//Mat bufferDepthMat2(detector.getDepthHeight(), detector.getDepthWidth(), CV_16UC1);
	//Mat bufferDepthMat3(detector.getDepthHeight(), detector.getDepthWidth(), CV_16UC1);

	HRESULT hr = detector.initializeSensors();
	if (FAILED(hr)) return 0;

	//Cargar los archivos de las plantillas de cubos

	Mat t1 = imread("zero.jpg", IMREAD_UNCHANGED);
	Mat t2 = imread("thirty.jpg", IMREAD_UNCHANGED);
	Mat t3 = imread("fortyfive.jpg", IMREAD_UNCHANGED);
	Mat t4 = imread("sixty.jpg", IMREAD_UNCHANGED);
	if (t1.empty() || t2.empty() || t3.empty() || t4.empty()){
		std::cout << "Las imágenes no fueron leídas correctamente" << endl;
		return 0;
	}

	detector.setZero(t1);
	detector.setThirty(t2);
	detector.setFortyFive(t3);
	detector.setSixty(t4);

	ofstream data;
	string name;
	vector <int> times;
	cout << "Bienvenido al sistema Automatizado del Ensayo de Caja y Cubos (ABBT)."<<endl<<"Introduzca a continuaci"<< y <<"n el nombre del paciente" << endl;
	getline(cin, name);
	cout << "Gracias. A continuaci" << y << "n aparecer" << v << "n en recuadros blancos las posiciones estimadas de la pantalla divisoria y de las cajas. La caja vac" << x << "a deber" << v << " estar inscrita en un rect" << v << "ngulo de l" << x << "nea gruesa." << endl;
	Sleep(5000);

		bool a, b;
		char answer;
		do{
			a = 0;
			b = 0;
			do{
				detector.updateColor(bufferColorMat);
				detector.updateDepth(bufferDepthMat);

				if (detector.getDepthCaptured() && a==0) {
					/*imshow("PROFUNDIDAD", bufferDepthMat);
					waitKey(100000);
					destroyAllWindows();*/
					//imwrite("ProfundidadCompleta.jpg", bufferDepthMat);
					//detector.locateBoxes(bufferDepthMat);//Localizar los compartimentos y la pantalla divisoria
					a = 1;
				}
				if (detector.getColorCaptured() && b==0) {
					/*imshow("COLOR", bufferColorMat);
					waitKey(1000);
					destroyAllWindows();*/
					//imwrite("ColorCompleta.jpg", bufferColorMat);
					//detector.setCoefs(bufferColorMat);
					b = 1;
				}
				}while (a == 0 || b == 0);

			detector.locateBoxes(bufferDepthMat, bufferColorMat);//Localizar los compartimentos y la pantalla divisoria
			cout<< zz << "Se han posicionado correctamente la caja y el divisor\? Si la localizaci" << y << "n ha sido correcta, pulse s. En caso de no ser as" << x << ", mueva ligeramente la caja y pulse la letra n. S" << x << ",No [s,n]"<<endl;
			cin>>answer;
			//cout << answer<< endl;
		} while ((answer != 's'));// || (answer != 'S')); //Confirmación del usuario del posicionamiento correcto de las cajas y la pantalla

		cout << "Ya est" << v << " todo listo. Podemos empezar." << endl;
		Sleep(1000);
		cout << "La prueba comienza en: " << endl << "3" << endl;
		Sleep(1000);
		cout<<"2"<<endl;
		Sleep(1000);
		cout<<"1"<<endl;
		Sleep(1000);
		cout<< "Ya" << "\a" << endl;
		unsigned t0 = clock();
		unsigned newTime, oldTime = t0;

		while (((clock() - t0)/CLOCKS_PER_SEC) < TESTTIME) {//Tiempo de la prueba: 60 segundos
				//Detecta entrada de la mano
				//detector.setHandDetected();
				do {
					detector.updateDepth(bufferDepthMat2);
					if (detector.getDepthCaptured()) {
						detector.detectHand(bufferDepthMat2, 0);
						/*imshow("PROFUNDIDAD", bufferDepthMat2);
						waitKey(100000);
						destroyAllWindows();*/
					}
				} while (detector.getHandDetected() == 0);
				std::cout << "Mano dentro" << endl;
				//Detecta salida de la mano
				do {
					detector.updateDepth(bufferDepthMat2);
					if (detector.getDepthCaptured()) {
						detector.detectHand(bufferDepthMat2, 1);
						/*imshow("PROFUNDIDAD", bufferDepthMat2);
						waitKey(100000);
						destroyAllWindows();*/
					}
				} while (detector.getHandDetected());
				std::cout << "Mano fuera" << endl;
				newTime = clock();
				times.push_back((newTime - oldTime)/(CLOCKS_PER_SEC/1000.0));
				//oldTime = newTime;
				detector.increaseHandDetected();
				int siz = times.size();
 				if ((siz >= 2) && ((times[siz - 1] - times[siz - 2]) < 200)) { //Si el paciente ha movido la caja o la pantalla, la detección de la mano se descontrola (aumenta la velocidad), por lo que es necesario recalibrar las ROI's
					bool detectionFailed = 0;
					bool oldBox = detector.getHandTested();
					do {
						detectionFailed = 0;
						do{
							detector.updateDepth(bufferDepthMat3);
						} while (detector.getDepthCaptured() == 0);

						if (detector.getDepthCaptured()) {
							detector.correctBoxesPosition(bufferDepthMat3);//Volver a situar la pantalla divisoria por si el paciente la hubiese desplazado

							Rect box = detector.getEmptyBox();
							Rect divisor = detector.getDivisor();

							if (abs(box.height - box.width) > 50) detectionFailed = 1;
							if ((divisor.height / divisor.width) < 2) detectionFailed = 1;
							if (oldBox != detector.getHandTested()) detectionFailed = 1;
						}

					} while ((detectionFailed == 1));
				}

				Sleep(100);
				do {
					detector.updateColor(bufferColorMat2);
				} while (detector.getColorCaptured() == 0);

				/*
				if (detector.getLight()) {
					detector.whitePatch(bufferColorMat2);
				}

				imshow("white", bufferColorMat2);
				waitKey(100000);
				destroyAllWindows();
				//imwrite("Image.jpg", bufferColorMat);
				*/

				do {
					detector.updateDepth(bufferDepthMat3);
				} while (detector.getDepthCaptured() == 0);

				//imwrite("colorCompleta.jpg", bufferColorMat);
				//imwrite("profundidadCompleta.jpg", bufferColorMat);

				Size dsize = Size(1506, 1206);
				resize(bufferDepthMat3, resizedDepth, dsize, 0, 0);

				detector.detection(bufferColorMat2, resizedDepth);

			}

	cout<<endl<<"FIN DE LA PRUEBA"<<endl;
	detector.setEnd();

	//Forzar a que la última detección sea más precisa
	int h = detector.getHandDetections();
	int c = detector.getCountedBlocks();
	int colors[5];
	Mat detection;
	Mat tempDetection = detector.getFinalResult().clone();
	colors[0] = detector.getRed();
	colors[1] = detector.getGreen();
	colors[2] = detector.getBlue();
	colors[3] = detector.getYellow();
	colors[4] = detector.getBlack();

	if ((abs(h - c)) > 0){
		cout << "Espere un momento mientras se realizan unas " << z << "ltimas comprobaciones" << endl;

		for (int i = 0; i < 5; i++){
			detector.detection(bufferColorMat2, resizedDepth);
			if (detector.getCountedBlocks() > c){
				tempDetection = detector.getFinalResult();
				c = detector.getCountedBlocks();
				colors[0] = detector.getRed();
				colors[1] = detector.getGreen();
				colors[2] = detector.getBlue();
				colors[3] = detector.getYellow();
				colors[4] = detector.getBlack();
			}
		}

		cout << "Fin de las comprobaciones." << endl;
	}
	detection = tempDetection.clone();

	cout<<"Finalmente, se han detectado "<< detector.getCountedBlocks()<<" cubos ("<<colors[0]<<" cubos rojos, "<<colors[1]<<" cubos verdes, "<<colors[2]<<" cubos azules, "<<colors[3]<<" cubos amarillos y "<<colors[4]<<" cubos de un color sin determinar"<<") y "<<detector.getHandDetections()<< " pasos de la mano."<<endl;
	cout<<endl<<"Los registros de tiempo en segundos entre pasos de la mano han sido los siguientes: "<<endl;
	for (int i = 0; i<times.size(); i++){
		cout<<times[i]/1000.0<<" ";
	}
	cout<<endl;
	float num;
	cout << "Introduzca el n" << z << "mero real de cubos movidos para calcular el porcentaje de acierto del sistema" << endl;
	cin >> num;
	float handPrecission = (detector.getHandDetections() / num) * 100.0;
	float blocksPrecission = (detector.getCountedBlocks() / num) * 100.0;

	//Guardar los datos del ensayo en el fichero
	data.open("resultados.csv", ios::out|ios::app);
	data<<endl<<"'"<<name<<"'"<<",";
	if (detector.getHandTested()) data<<"'Derecha',";
	else data << "'Izquierda',";
	data<<detector.getCountedBlocks()<<",";
	data << blocksPrecission << "% ,";
	data<<times.size()<<",";
	data << handPrecission << "% ,";
	for (int i = 0; i<times.size(); i++) data<<times[i]/1000.0<<",";
	data.close();
	cout<<"Los datos han sido guardados en el documento " << ac << "resultados.csv" << cc << " para su consulta y an" << v << "lisis."<<endl;

	imwrite((String(name) + ".jpg"), detection);
	imshow("Resultado de la deteccion", detection);
	waitKey(500000);
	destroyAllWindows();
	return 0;
}
/*Utilidades

//MOSTRAR IMAGEN DE COLOR
if (detector.getColorCaptured()) {
imshow("COLOR", bufferColorMat);
waitKey(5000);
destroyAllWindows();
}

//MOSTRAR IMAGEN DE PROFUNDIDAD
if (detector.getDepthCaptured()) {
imshow("PROFUNDIDAD", bufferDepthMat);
waitKey(5000);
destroyAllWindows();
}

//ESCALADO
Mat bufferColorMat2(detector.getColorHeight(), detector.getColorWidth(), CV_8UC4);
Size dsize = Size(15, 10);
resize(bufferColorMat, bufferColorMat2, dsize, 0, 0, CV_INTER_AREA);

//MOSTRAR MATRIZ EN FORMATO NÚMEROS
cout << "Color: " << endl << bufferColorMat2 << endl << endl;

//DIBUJAR UN RECTÁNGULO
 void rectangle(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)

//GUARDAR UNA IMAGEN EN EL DISCO
imwrite("Image.jpg", bufferColorMat);
*/


text:
package com.github.jochenw.afw.core.crypt;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.KeyStore;
import java.security.KeyStore.Entry;
import java.security.KeyStore.Entry.Attribute;
import java.security.KeyStore.PasswordProtection;
import java.security.KeyStore.PrivateKeyEntry;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.UnrecoverableEntryException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.util.Set;

import org.junit.Test;

/** A test suite for the {@link SelfSignedCertificateGenerator}.
 */
public class SelfSignedCertificateGeneratorTest {
	/** Test case for {@link SelfSignedCertificateGenerator#createSelfSignedCertificate}.
	 * @throws Exception The test failed.
	 */
	@Test
	public void testCreateSelfSignedCertificateWithDefaultKeyHandler() throws Exception {
		final SelfSignedCertificateGenerator scgen = new SelfSignedCertificateGenerator();
		validate(scgen);
	}

	/** Test case for {@link SelfSignedCertificateGenerator#createSelfSignedCertificate}.
	 * @throws Exception The test failed.
	 */
	@Test
	public void testCreateSelfSignedCertificateWithBcKeyHandler() throws Exception {
		final SelfSignedCertificateGenerator scgen = new SelfSignedCertificateGenerator();
		scgen.setKeyHandler(new BcKeyHandler());
		validate(scgen);
	}

	protected void validate(SelfSignedCertificateGenerator pGenerator) throws KeyStoreException, IOException, NoSuchAlgorithmException,
			CertificateException, UnrecoverableEntryException {
		final Path keyStorePath = Paths.get("target/unit-tests/SelfSignedCertificateGeneratorTest/keystore.jks");
		Files.createDirectories(keyStorePath.getParent());
		Files.deleteIfExists(keyStorePath);
		assertFalse(Files.isRegularFile(keyStorePath));
		pGenerator.setAlias("selfsigned");
		pGenerator.setCountry("DE");
		pGenerator.setFileName(keyStorePath.toString());
		pGenerator.setLocation("The Net");
		pGenerator.setName("127.0.0.1");
		pGenerator.setOrganization("Organized? Me?");
		pGenerator.setOrgUnit("None at all");
		pGenerator.setStateOrProvince("Somewhere");
		pGenerator.setStorePassword("okayokay");
		pGenerator.setValidInDays(9999);
		pGenerator.createSelfSignedCertificate();
		pGenerator.setLogger(System.out::println);
		assertTrue(Files.isRegularFile(keyStorePath));
		try (InputStream in = Files.newInputStream(keyStorePath)) {
			final KeyStore keyStore = KeyStore.getInstance("jks");
			keyStore.load(in, "okayokay".toCharArray());
			final Entry entry = keyStore.getEntry("selfsigned", new PasswordProtection("okayokay".toCharArray()));
			assertNotNull(entry);
			assertTrue(entry instanceof PrivateKeyEntry);
			final PrivateKeyEntry pke = (PrivateKeyEntry) entry;
			final PrivateKey privKey = pke.getPrivateKey();
			assertNotNull(privKey);
			final Set<Attribute> attrs = entry.getAttributes();
			assertNotNull(attrs);
			final Certificate cert = keyStore.getCertificate("selfsigned");
			assertNotNull(cert);
			assertEquals("X.509", cert.getType());
			final PublicKey pubKey = cert.getPublicKey();
			assertEquals("RSA", pubKey.getAlgorithm());
			assertEquals("X.509", pubKey.getFormat());
		}
	}
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Steam_Desktop_Authenticator
{
    public partial class InputForm : Form
    {
        public bool Canceled = false;
        private bool userClosed = true;

        public InputForm(string label, bool password = false)
        {
            InitializeComponent();
            this.labelText.Text = label;

            if (password)
            {
                this.txtBox.PasswordChar = '*';
            }
        }

        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtBox.Text))
            {
                this.Canceled = true;
                this.userClosed = false;
                this.Close();
            }
            else
            {
                this.Canceled = false;
                this.userClosed = false;
                this.Close();
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Canceled = true;
            this.userClosed = false;
            this.Close();
        }

        private void InputForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.userClosed)
            {
                // Set Canceled = true when the user hits the X button.
                this.Canceled = true;
            }
        }
    }
}


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.sync;

import android.content.Context;

import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
import com.google.protobuf.nano.MessageNano;

import org.chromium.base.ThreadUtils;
import org.chromium.sync.protocol.EntitySpecifics;
import org.chromium.sync.protocol.SyncEntity;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

/**
 * Assists in Java interaction the native Sync FakeServer.
 */
public class FakeServerHelper {
    private static final String TAG = "cr.FakeServerHelper";

    // Lazily-instantiated singleton FakeServerHelper.
    private static FakeServerHelper sFakeServerHelper;

    // Pointer value for the FakeServer. This pointer is not owned by native
    // code, so it must be stored here for future deletion.
    private static long sNativeFakeServer = 0L;

    // The pointer to the native object called here.
    private final long mNativeFakeServerHelperAndroid;

    // Accesses the singleton FakeServerHelper. There is at most one instance created per
    // application lifetime, so no deletion mechanism is provided for the native object.
    public static FakeServerHelper get() {
        ThreadUtils.assertOnUiThread();
        if (sFakeServerHelper == null) {
            sFakeServerHelper = new FakeServerHelper();
        }
        return sFakeServerHelper;
    }

    private FakeServerHelper() {
        mNativeFakeServerHelperAndroid = nativeInit();
    }

    /**
     * Creates and configures FakeServer.
     *
     * Each call to this method should be accompanied by a later call to deleteFakeServer to avoid
     * a memory leak.
     */
    public static void useFakeServer(final Context context) {
        if (sNativeFakeServer != 0L) {
            throw new IllegalStateException(
                    "deleteFakeServer must be called before calling useFakeServer again.");
        }

        sNativeFakeServer = ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Long>() {
            @Override
            public Long call() {
                FakeServerHelper fakeServerHelper = FakeServerHelper.get();
                long nativeFakeServer = fakeServerHelper.createFakeServer();
                long resources = fakeServerHelper.createNetworkResources(nativeFakeServer);
                ProfileSyncService.get(context).overrideNetworkResourcesForTest(resources);

                return nativeFakeServer;
            }
        });
    }

    /**
     * Deletes the existing FakeServer.
     */
    public static void deleteFakeServer() {
        checkFakeServerInitialized(
                "useFakeServer must be called before calling deleteFakeServer.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                FakeServerHelper.get().deleteFakeServer(sNativeFakeServer);
                sNativeFakeServer = 0L;
                return null;
            }
        });
    }

    /**
     * Creates a native FakeServer object and returns its pointer. This pointer is owned by the
     * Java caller.
     *
     * @return the FakeServer pointer
     */
    public long createFakeServer() {
        return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Long>() {
            @Override
            public Long call() {
                return nativeCreateFakeServer(mNativeFakeServerHelperAndroid);
            }
        });
    }

    /**
     * Creates a native NetworkResources object. This pointer is owned by the Java caller, but
     * ownership is transferred as part of ProfileSyncService.overrideNetworkResourcesForTest.
     *
     * @param nativeFakeServer pointer to a native FakeServer object.
     * @return the NetworkResources pointer
     */
    public long createNetworkResources(final long nativeFakeServer) {
        return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Long>() {
            @Override
            public Long call() {
                return nativeCreateNetworkResources(
                        mNativeFakeServerHelperAndroid, nativeFakeServer);
            }
        });
    }

    /**
     * Deletes a native FakeServer.
     *
     * @param nativeFakeServer the pointer to be deleted
     */
    public void deleteFakeServer(final long nativeFakeServer) {
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                nativeDeleteFakeServer(mNativeFakeServerHelperAndroid, nativeFakeServer);
                return null;
            }
        });
    }

    /**
     * Returns whether {@code count} entities exist on the fake Sync server with the given
     * {@code modelType} and {@code name}.
     *
     * @param count the number of fake server entities to verify
     * @param modelType the model type of entities to verify
     * @param name the name of entities to verify
     *
     * @return whether the number of specified entities exist
     */
    public boolean verifyEntityCountByTypeAndName(final int count, final int modelType,
            final String name) {
        checkFakeServerInitialized(
                "useFakeServer must be called before data verification.");
        return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() {
            @Override
            public Boolean call() {
                return nativeVerifyEntityCountByTypeAndName(mNativeFakeServerHelperAndroid,
                        sNativeFakeServer, count, modelType, name);
            }
        });
    }

    /**
     * Verifies whether the sessions on the fake Sync server match the given set of urls.
     *
     * @param urls the set of urls to check against; order does not matter.
     *
     * @return whether the sessions on the server match the given urls.
     */
    public boolean verifySessions(final String[] urls) {
        checkFakeServerInitialized(
                "useFakeServer must be called before data verification.");
        return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() {
            @Override
            public Boolean call() {
                return nativeVerifySessions(mNativeFakeServerHelperAndroid, sNativeFakeServer,
                        urls);
            }
        });
    }

    /**
     * Returns all the SyncEntities on the fake server with the given modelType.
     *
     * @param modelType the type of entities to return.
     *
     * @return a list of all the SyncEntity protos for that type.
     */
    public List<SyncEntity> getSyncEntitiesByModelType(final int modelType)
            throws ExecutionException {
        checkFakeServerInitialized("useFakeServer must be called before getting sync entities.");
        return ThreadUtils.runOnUiThreadBlocking(new Callable<List<SyncEntity>>() {
            @Override
            public List<SyncEntity> call() throws InvalidProtocolBufferNanoException {
                byte[][] serializedEntities = nativeGetSyncEntitiesByModelType(
                        mNativeFakeServerHelperAndroid, sNativeFakeServer, modelType);
                List<SyncEntity> entities = new ArrayList<SyncEntity>(serializedEntities.length);
                for (int i = 0; i < serializedEntities.length; i++) {
                    SyncEntity entity = new SyncEntity();
                    MessageNano.mergeFrom(entity, serializedEntities[i]);
                    entities.add(entity);
                }
                return entities;
            }
        });
    }

    /**
     * Injects an entity into the fake Sync server. This method only works for entities that will
     * eventually contain a unique client tag (e.g., preferences, typed URLs).
     *
     * @param name the human-readable name for the entity. This value will be used for the
     *             SyncEntity.name value
     * @param entitySpecifics the EntitySpecifics proto that represents the entity to inject
     */
    public void injectUniqueClientEntity(final String name, final EntitySpecifics entitySpecifics) {
        checkFakeServerInitialized("useFakeServer must be called before data injection.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                // The protocol buffer is serialized as a byte array because it can be easily
                // deserialized from this format in native code.
                nativeInjectUniqueClientEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer,
                        name, MessageNano.toByteArray(entitySpecifics));
                return null;
            }
        });
    }

    /**
     * Modify the specifics of an entity on the fake Sync server.
     *
     * @param id the ID of the entity whose specifics to modify
     * @param entitySpecifics the new specifics proto for the entity
     */
    public void modifyEntitySpecifics(final String id, final EntitySpecifics entitySpecifics) {
        checkFakeServerInitialized("useFakeServer must be called before data modification.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                // The protocol buffer is serialized as a byte array because it can be easily
                // deserialized from this format in native code.
                nativeModifyEntitySpecifics(mNativeFakeServerHelperAndroid, sNativeFakeServer, id,
                        MessageNano.toByteArray(entitySpecifics));
                return null;
            }
        });
    }

    /**
     * Injects a bookmark into the fake Sync server.
     *
     * @param title the title of the bookmark to inject
     * @param url the URL of the bookmark to inject. This String will be passed to the native GURL
     *            class, so it must be a valid URL under its definition.
     * @param parentId the ID of the desired parent bookmark folder
     */
    public void injectBookmarkEntity(final String title, final String url, final String parentId) {
        checkFakeServerInitialized("useFakeServer must be called before data injection.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                nativeInjectBookmarkEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer, title,
                        url, parentId);
                return null;
            }
        });
    }

    /**
     * Injects a bookmark folder into the fake Sync server.
     *
     * @param title the title of the bookmark folder to inject
     * @param parentId the ID of the desired parent bookmark folder
     */
    public void injectBookmarkFolderEntity(final String title, final String parentId) {
        checkFakeServerInitialized("useFakeServer must be called before data injection.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                nativeInjectBookmarkFolderEntity(
                        mNativeFakeServerHelperAndroid, sNativeFakeServer, title, parentId);
                return null;
            }
        });
    }

    /**
     * Modifies an existing bookmark on the fake Sync server.
     *
     * @param bookmarkId the ID of the bookmark to modify
     * @param title the new title of the bookmark
     * @param url the new URL of the bookmark. This String will be passed to the native GURL
     *            class, so it must be a valid URL under its definition.
     * @param parentId the ID of the new desired parent bookmark folder
     */
    public void modifyBookmarkEntity(
            final String bookmarkId, final String title, final String url, final String parentId) {
        checkFakeServerInitialized("useFakeServer must be called before data injection.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                nativeModifyBookmarkEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer,
                        bookmarkId, title, url, parentId);
                return null;
            }
        });
    }

    /**
     * Modifies an existing bookmark folder on the fake Sync server.
     *
     * @param folderId the ID of the bookmark folder to modify
     * @param title the new title of the bookmark folder
     * @param parentId the ID of the new desired parent bookmark folder
     */
    public void modifyBookmarkFolderEntity(
            final String folderId, final String title, final String parentId) {
        checkFakeServerInitialized("useFakeServer must be called before data injection.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                nativeModifyBookmarkFolderEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer,
                        folderId, title, parentId);
                return null;
            }
        });
    }

    /**
     * Deletes an entity on the fake Sync server.
     *
     * In other words, this method injects a tombstone into the fake Sync server.
     *
     * @param id the server ID of the entity to delete
     */
    public void deleteEntity(final String id) {
        checkFakeServerInitialized("useFakeServer must be called before deleting an entity.");
        ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Void>() {
            @Override
            public Void call() {
                nativeDeleteEntity(mNativeFakeServerHelperAndroid, sNativeFakeServer, id);
                return null;
            }
        });
    }

    /**
     * Returns the ID of the Bookmark Bar. This value is to be used in conjunction with
     * injectBookmarkEntity.
     *
     * @return the opaque ID of the bookmark bar entity stored in the server
     */
    public String getBookmarkBarFolderId() {
        checkFakeServerInitialized("useFakeServer must be called before access");
        return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<String>() {
            @Override
            public String call() {
                return nativeGetBookmarkBarFolderId(mNativeFakeServerHelperAndroid,
                        sNativeFakeServer);
            }
        });
    }

    private static void checkFakeServerInitialized(String failureMessage) {
        if (sNativeFakeServer == 0L) {
            throw new IllegalStateException(failureMessage);
        }
    }

    // Native methods.
    private native long nativeInit();
    private native long nativeCreateFakeServer(long nativeFakeServerHelperAndroid);
    private native long nativeCreateNetworkResources(
            long nativeFakeServerHelperAndroid, long nativeFakeServer);
    private native void nativeDeleteFakeServer(
            long nativeFakeServerHelperAndroid, long nativeFakeServer);
    private native boolean nativeVerifyEntityCountByTypeAndName(
            long nativeFakeServerHelperAndroid, long nativeFakeServer, int count, int modelType,
            String name);
    private native boolean nativeVerifySessions(
            long nativeFakeServerHelperAndroid, long nativeFakeServer, String[] urlArray);
    private native byte[][] nativeGetSyncEntitiesByModelType(
            long nativeFakeServerHelperAndroid, long nativeFakeServer, int modelType);
    private native void nativeInjectUniqueClientEntity(
            long nativeFakeServerHelperAndroid, long nativeFakeServer, String name,
            byte[] serializedEntitySpecifics);
    private native void nativeModifyEntitySpecifics(long nativeFakeServerHelperAndroid,
            long nativeFakeServer, String id, byte[] serializedEntitySpecifics);
    private native void nativeInjectBookmarkEntity(
            long nativeFakeServerHelperAndroid, long nativeFakeServer, String title, String url,
            String parentId);
    private native void nativeInjectBookmarkFolderEntity(long nativeFakeServerHelperAndroid,
            long nativeFakeServer, String title, String parentId);
    private native void nativeModifyBookmarkEntity(long nativeFakeServerHelperAndroid,
            long nativeFakeServer, String bookmarkId, String title, String url, String parentId);
    private native void nativeModifyBookmarkFolderEntity(long nativeFakeServerHelperAndroid,
            long nativeFakeServer, String bookmarkId, String title, String parentId);
    private native String nativeGetBookmarkBarFolderId(
            long nativeFakeServerHelperAndroid, long nativeFakeServer);
    private native void nativeDeleteEntity(
            long nativeFakeServerHelperAndroid, long nativeFakeServer, String id);
}


text:
function isNegativeZero(val)
{
    if (val !== 0) {
        return false;
    }

    var thisInfinity = 1 / val;

    return (thisInfinity < 0);
}

isNegativeZero(-0);
// => true


text:
#ifndef __ANDROID_H__
#define __ANDROID_H__

/* This is for C++ and does no harm in C */
#ifdef __cplusplus
extern "C" {
#endif

#include <jni.h>

void Java_org_deadcode_wmelite_WMELiteFunctions_nativeInit(JNIEnv* env, jobject o, jobject assetMgr);

void android_setLocalEnv(JNIEnv *env);

void android_getLogFileDirectory(char *buffer, int length);

void android_getPrivateFilesPath(char *buffer, int length);

void android_getDeviceTypeHint(char *buffer, int length);

void android_getGamePackagePath(char *buffer, int length);

void android_getGameFilePath(char *buffer, int length);

void android_getFontPath(char *buffer, int length);

void android_getLocalSettingsPath(char *buffer, int length);

void android_getEncodedString(char *inputString, char *encoding, char *buffer, int *length);

void android_getUTFString(char *inputString, char *encoding, char *buffer, int *length);

void android_showURLInBrowser(char *URL);

#ifdef __cplusplus
}
#endif

#endif // __ANDROID_H__


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

	<color name="colorPrimary">@color/material_blue_500</color>
	<color name="colorPrimaryDark">@color/material_blue_700</color>
	<color name="colorAccent">@color/material_deep_purple_a200</color>

	<color name="material_blue_500">#2196F3</color>
	<color name="material_blue_700">#1976D2</color>

	<color name="material_deep_purple_500">#673AB7</color>
	<color name="material_deep_purple_a200">#7C4DFF</color>

	<color name="material_lime_a200">#EEFF41</color>

</resources>


text:
/*! carousel.js v1.0 | MIT License | https://github.com/oldrivercreative/carousel */
(function($){
  $.fn.carousel = function(options){

    // settings
    var settings = $.extend({}, {
      paging: false,
      navigation: false,
      loop: false,
      autoplay: false,
      delay: 12000,
      buttons: {
        previous: 'Previous',
        next: 'Next',
        navigation: '%i'
      },
      movethreshold: 10,
      swipethreshold: 10,
      oninit: false,
      onupdate: false,
      destroy: false
    }, options);

    // autoplay timer
    var timer = false;

    // transform?
    window.optimusPrime = false;
    if('WebkitTransform' in document.body.style || 'MozTransform' in document.body.style || 'transform' in document.body.style){
      window.optimusPrime = true;
    }

    // carousel
    this.each(function(){

      // get objects
      var carousel = $(this);
      var shaker = carousel.find('ul:eq(0)');

      // destroy?
      if(settings.destroy){
        carousel.trigger('carousel-destroy');
      }

      // create
      else {

        // init
        carousel.on('carousel-init', function(){

          // data
          carousel.data('carousel-position', 0);
          carousel.data('carousel-touch-change', 0);
          carousel.data('carousel-last-touch', false);
          carousel.data('carousel-item-count', shaker.children().size());

          // add classes
          carousel.addClass('ui-carousel');
          shaker.addClass('ui-carousel-shaker');

          // paging?
          if(settings.paging){

            // previous
            var previous = $('<button class="previous">' + settings.buttons.previous + '</button>');
            previous.on('click', function(e){
              e.preventDefault();

              // not a touch gesture
              carousel.data('carousel-last-touch', false);

              // retreat
              carousel.trigger('carousel-retreat');

            });
            carousel.append(previous);

            // next
            var next = $('<button class="next">' + settings.buttons.next + '</button>');
            next.on('click', function(e){
              e.preventDefault();

              // not a touch gesture
              carousel.data('carousel-last-touch', false);

              // advance
              carousel.trigger('carousel-advance');

            });
            carousel.append(next);

          }

          // navigation?
          if(settings.navigation){

            // nav list
            var ul = $('
');
            for(var i = 0; i < carousel.data('carousel-item-count'); i++){

              // <button>
              var navlabel = settings.buttons.navigation.replace('%i', (i+1));
              var button = $('<button>' + navlabel + '</button>');
              button.data('carousel-item', i);
              button.on('click', function(e){
                e.preventDefault();

                // set new position
                var p = $(this).data('carousel-item');
                var slidewidth = shaker.children('li:eq(0)').width() / shaker.width() * 100;
                p = p * slidewidth * -1;
                carousel.data('carousel-position', p);

                // not a touch gesture
                carousel.data('carousel-last-touch', false);

                // contain
                carousel.trigger('carousel-contain');

                // slide
                carousel.trigger('carousel-slide');

              });

              //

              var li = $('
');
              li.append(button);

              // active?
              if(i === 0){
                li.addClass('ui-active');
              }

              // add to nav list
              ul.append(li);

            }

            // add
            carousel.append(ul);

          }

          // contain
          carousel.trigger('carousel-contain');

          // autoplay?
          if(settings.autoplay){
            carousel.trigger('carousel-queue');
          }

          // oninit?
          if(typeof(settings.oninit) == 'function'){
            settings.oninit();
          }

        });

        // touch-down
        carousel.on('carousel-touch-down', function(e, position){

          // add classes
          carousel.addClass('ui-touch-threshold');

          // starting point
          carousel.data('carousel-touch-start', {
            x: position.x,
            y: $(window).scrollTop()
          });

          // disable autoplay while swiping
          if(settings.autoplay){
            carousel.trigger('carousel-dequeue');
          }

        });

        // touch-move
        carousel.on('carousel-touch-move', function(e, position){

          // threshold?
          if(carousel.hasClass('ui-touch-threshold')){

            // get starting position
            var start = carousel.data('carousel-touch-start');

            // scrolling?
            if(Math.abs($(window).scrollTop() - start.y) >= settings.movethreshold){
              carousel.removeClass('ui-touch-threshold');
            }

            // swiping?
            else if(Math.abs(position.x - start.x) >= settings.movethreshold){
              carousel.removeClass('ui-touch-threshold').addClass('ui-touch-swiping');
              $('body').addClass('ui-swiping');
            }

          }

          // swiping?
          if(carousel.hasClass('ui-touch-swiping')){

            // position
            var start = carousel.data('carousel-touch-start');
            var distance = position.x - start.x;
            var position = carousel.data('carousel-position');
            var change = distance / shaker.width() * 100;
            carousel.data('carousel-touch-change', change);

            // shake it
            var p = position + change;
            if(window.optimusPrime){
              shaker.css({
                WebkitTransform: 'translateX(' + p + '%)',
                MozTransform: 'translateX(' + p + '%)',
                transform: 'translateX(' + p + '%)'
              });
            }
            else{
              shaker.css('left', p + '%');
            }

            // onupdate?
            if(typeof(settings.onupdate) == 'function'){
              settings.onupdate(p);
            }

          }

        });

        // touch-up
        carousel.on('carousel-touch-up', function(){

          // threshold?
          if(carousel.hasClass('ui-touch-threshold')){

            // remove classes
            carousel.removeClass('ui-touch-threshold');

          }

          // swiping?
          else if(carousel.hasClass('ui-touch-swiping')){

            // remove classes
            carousel.removeClass('ui-touch-swiping');
            $('body').removeClass('ui-swiping');

            // position
            var position = carousel.data('carousel-position');
            var change = carousel.data('carousel-touch-change');

            // swipe?
            if(change >= settings.swipethreshold){
              var slidewidth = shaker.children('li:eq(0)').width() / shaker.width() * 100;
              if(change <= slidewidth){
                change = slidewidth;
              }
            }
            else if(change <= settings.swipethreshold * -1){
              var slidewidth = shaker.children('li:eq(0)').width() / shaker.width() * 100;
              if(change >= slidewidth * -1){
                change = slidewidth * -1;
              }
            }

            // touch gesture
            carousel.data('carousel-last-touch', true);

            // update
            carousel.data('carousel-position', position + change);

            // contain
            carousel.trigger('carousel-contain');

            // transform
            carousel.trigger('carousel-slide');

          }

          // queue next transition
          if(settings.autoplay){
            carousel.trigger('carousel-queue');
          }

        });

        // queue next transition
        carousel.on('carousel-queue', function(){

          // set timer
          timer = setTimeout(function(){
            carousel.data('carousel-last-touch', false);
            carousel.trigger('carousel-advance');
          }, settings.delay);

        });

        // de-queue transitions
        carousel.on('carousel-dequeue', function(){

          // unset timer
          clearTimeout(timer);

        });

        // advance
        carousel.on('carousel-advance', function(){

          // advance one slide
          var p = carousel.data('carousel-position');
          var slidewidth = shaker.children('li:eq(0)').width() / shaker.width() * 100;
          p -= slidewidth;
          carousel.data('carousel-position', p);

          // contain
          carousel.trigger('carousel-contain');

          // slide
          carousel.trigger('carousel-slide');

          // autoplay?
          if(settings.autoplay){
            carousel.trigger('carousel-dequeue');
            carousel.trigger('carousel-queue');
          }

        });

        // retreat
        carousel.on('carousel-retreat', function(){

          // retreat one slide
          var p = carousel.data('carousel-position');
          var slidewidth = shaker.children('li:eq(0)').width() / shaker.width() * 100;
          p += slidewidth;
          carousel.data('carousel-position', p);

          // contain
          carousel.trigger('carousel-contain');

          // slide
          carousel.trigger('carousel-slide');

          // autoplay?
          if(settings.autoplay){
            carousel.trigger('carousel-dequeue');
            carousel.trigger('carousel-queue');
          }

        });

        // contain
        carousel.on('carousel-contain', function(){

          // get slide width
          var slidewidth = shaker.children('li:eq(0)').width() / shaker.width() * 100;
          var slidesinview = Math.round(100 / slidewidth);
          var slides = carousel.data('carousel-item-count');

          // contain
          var p = carousel.data('carousel-position');
          p = Math.round(p / slidewidth) * slidewidth;
          if(p > 0){
            if(settings.loop && !carousel.data('carousel-last-touch')){
              p = slidewidth * (slides - slidesinview) * -1;
            }
            else{
              p = 0;
            }
          }
          else if(p < slidewidth * (slides - slidesinview) * -1){
            if(settings.loop && !carousel.data('carousel-last-touch')){
              p = 0;
            }
            else{
              p = slidewidth * (slides - slidesinview) * -1;
            }
          }

          // disable paging
          if(!settings.loop && settings.paging && p >= 0){
            carousel.children('button.previous').prop('disabled', true);
          }
          else if(!settings.loop && settings.paging){
            carousel.children('button.previous[disabled]').prop('disabled', false);
          }
          if(!settings.loop && settings.paging && p <= slidewidth * (slides - slidesinview) * -1){
            carousel.children('button.next').prop('disabled', true);
          }
          else if(!settings.loop && settings.paging){
            carousel.children('button.next[disabled]').prop('disabled', false);
          }

          // update
          carousel.data('carousel-position', p);

          // update navigation?
          if(settings.navigation){
            var i = Math.round(Math.abs(p) / slidewidth);
            var navlist = carousel.children('ul.ui-carousel-nav');
            navlist.children().removeClass('ui-active');
            navlist.children().eq(i).addClass('ui-active');
          }

        });

        // slide
        carousel.on('carousel-slide', function(){

          // shake it
          var p = carousel.data('carousel-position');
          if(window.optimusPrime){
            shaker.css({
              WebkitTransform: 'translateX(' + p + '%)',
              MozTransform: 'translateX(' + p + '%)',
              transform: 'translateX(' + p + '%)'
            });
          }
          else{
            shaker.animate({
              left: p + '%'
            }, 300);
          }

          // onupdate?
          if(typeof(settings.onupdate) == 'function'){
            settings.onupdate(p);
          }

        });

        // destroy
        carousel.on('carousel-destroy', function(){

          // remove data
          carousel.removeData('carousel-position');
          carousel.removeData('carousel-item-count');

          // remove events
          carousel.off('carousel-init carousel-advance carousel-retreat carousel-slide');

          // remove paging
          carousel.children('button.previous,button.next').remove();

          // remove classes
          carousel.removeClass('ui-carousel');
          shaker.removeClass('ui-carousel-shaker');
          if(window.optimusPrime){
            shaker.css({
              WebkitTransform: 'translateX(0%)',
              MozTransform: 'translateX(0%)',
              transform: 'translateX(0%)'
            });
          }
          else{
            shaker.css('left', '0%');
          }

          // cancel events?
          if($('.ui-carousel').size() === 0){
            $(window).off('resize');
            $(document).off('mousedown touchstart mousemove touchmove mouseup touchend touchleave touchcancel');
            $('body').removeClass('ui-draggables-listen');
          }

        });

        // init
        carousel.trigger('carousel-init');

      }

    });

    // listen?
    if(!$('body').hasClass('ui-draggables-listen')){

      // add classes
      $('body').addClass('ui-draggables-listen');

      // resize / orientation
      $(window).on('resize orientationchange', function(e){
        $('.ui-carousel').trigger('carousel-slide');
        $('.ui-carousel').trigger('carousel-contain');
      });

      // touch down
      $(document).on('mousedown touchstart', function(e){
        if(e.pageX || e.originalEvent.touches){

          // dragging carousel?
          if($(e.target).is('.ui-carousel,.ui-carousel *:not(.slider-handle,.slider-handle *)') && e.which != 3){

            // touchdown!
            var carousel = $(e.target).closest('.ui-carousel');
            $(carousel).trigger('carousel-touch-down', [
              {
                x: e.pageX ? e.pageX : e.originalEvent.touches[0].pageX,
                y: e.pageY ? e.pageY : e.originalEvent.touches[0].pageY
              }
            ]);

            // prevent cancel in android
            if(navigator.userAgent.match(/Android/i)){
              //e.preventDefault();
            }

          }

        }
      });

      // touch move
      $(document).on('mousemove touchmove', function(e){
        if(e.pageX || e.originalEvent.touches){

          if($('body').hasClass('ui-swiping')){
            e.preventDefault();
          }

          // update threshold/swiping carousel
          $('.ui-carousel.ui-touch-threshold,.ui-carousel.ui-touch-swiping').each(function(){
            $(this).trigger('carousel-touch-move', [
              {
                x: e.pageX ? e.pageX : e.originalEvent.touches[0].pageX,
                y: e.pageY ? e.pageY : e.originalEvent.touches[0].pageY
              }
            ]);
          });

        }
      });

      // touch up
      $(document).on('mouseup touchend touchleave touchcancel', function(e){

        // end threshold/swiping carousel
        $('.ui-carousel.ui-touch-threshold,.ui-carousel.ui-touch-swiping').each(function(){
          $(this).trigger('carousel-touch-up');
        });

      });

    }

    // done
    return this;

  };
}(jQuery));


text:
import numpy as np
import scipy.ndimage
import array
import math

#---数据标准化
def normalize(image, MIN_BOUND=-1000.0, MAX_BOUND=400.0):
    """数据标准化"""
    image = (image - MIN_BOUND) / (MAX_BOUND - MIN_BOUND)
    image[image > 1] = 1.
    image[image < 0] = 0.
    return image

#---设置窗宽
def set_window_width(image, MIN_BOUND=-1000.0, MAX_BOUND=400.0):
    """设置窗宽"""
    image[image > MAX_BOUND] = MAX_BOUND
    image[image < MIN_BOUND] = MIN_BOUND
    return image
#---重采样
def resample(image, old_spacing, new_spacing=[1, 1, 1]):
    resize_factor = old_spacing / new_spacing
    new_real_shape = image.shape * resize_factor
    new_shape = np.round(new_real_shape)
    real_resize_factor = new_shape / image.shape
    new_spacing = old_spacing / real_resize_factor
    image = scipy.ndimage.interpolation.zoom(image, real_resize_factor, mode='nearest')

    return image, new_spacing


text:
<?php

namespace Hoa\String\Bin;

use Hoa\Console;
use Hoa\String;

/**
 * Class Hoa\String\Bin\Fromcode.
 *
 * Get a character from its code. Please, see Hoa\String\String::fromCode.
 *
 * @copyright  Copyright © 2007-2015 Hoa community
 * @license    New BSD License
 */
class Fromcode extends Console\Dispatcher\Kit
{
    /**
     * Options description.
     *
     * @var array
     */
    protected $options = [
        ['base', Console\GetOption::REQUIRED_ARGUMENT, 'b'],
        ['help', Console\GetOption::NO_ARGUMENT,       'h'],
        ['help', Console\GetOption::NO_ARGUMENT,       '?']
    ];

    /**
     * The entry method.
     *
     * @return  int
     */
    public function main()
    {
        $base = 16;

        while (false !== $c = $this->getOption($v)) {
            switch ($c) {
                case 'b':
                    $base = intval($v);

                    break;

                case '__ambiguous':
                    $this->resolveOptionAmbiguity($v);

                    break;

                case 'h':
                case '?':
                default:
                    return $this->usage();
            }
        }

        $this->parser->listInputs($code);

        $char = String::fromCode(base_convert($code, $base, 10));

        echo $char;

        return;
    }

    /**
     * The command usage.
     *
     * @return  int
     */
    public function usage()
    {
        echo
            'Usage   : string:fromcode <char>', "\n",
            'Options :', "\n",
            $this->makeUsageOptionsList([
                'b'    => 'Specify the base of the code (16 by default).',
                'help' => 'This help.'
            ]), "\n";

        return;
    }
}

__halt_compiler();
Get a character from its code.


text:
package de.thk.ct.endpoint.server.osgi;

import de.thk.ct.endpoint.device.osgi.DeviceService;

/**
 * {@link Exception} which indicates that there is no available implementation
 * of {@link DeviceService}.
 *
 * @author Martin Vantroba
 *
 */
public class DeviceServiceNotInitializedException extends Exception {

	private static final long serialVersionUID = 1L;

	/**
	 * Constructs a {@link DeviceServiceNotInitializedException} with the
	 * predefined message.
	 */
	public DeviceServiceNotInitializedException() {
		super("Device service is not initialized.");
	}
}


text:
<?php
namespace Direct\WrapperBundle\MethodParams;

use Direct\WrapperBundle\MethodParams\ParamsTypes\GetCampaignsInfo;

/**
 * Класс "Параметры для метода GetCampaignsListFilter"
 * @author PiskunovYV
 *
 */
class GetCampaignsListFilterParams implements ParamInterface {
	/**
	 * Название метода
	 * @var string
	 */
	private $methodName = 'GetCampaignsListFilter';

	/**
	 * Параметры
	 * @var array
	 */
	private $params = array();

	/**
	 * Конструктор класса
	 * @param string $methodName Метод на директе
	 */
	public function __construct($methodName) {
		$this->methodName = $methodName;
	}

	/**
	 * Возвращаем параметры как массив
	 * @return array Параметры как массив
	 */
	public function getArray() {
		return $this->params;
	}

	/**
	 * Возвращаем параметры как JSON
	 * @return string JSON данные
	 */
	public function getJSON() {
		return json_encode($this->params);
	}

	/**
	 * Метод устанавливает значение параметра для ключа
	 * @param string $key Ключ
	 * @param mixed $value Значение по данному ключу
	 */
	public function setParam($key, $value) {
		$this->params[$key] = $value;
	}

	/**
	 * Добавляем параметр
	 * (non-PHPdoc)
	 * @see Direct\WrapperBundle\MethodParams.ParamInterface::addParam()
	 */
	public function addParam($value) {
		$this->params[] = $value;
	}

	/**
	 * Метод возвращает значение параметра по ключу
	 * @param string $key Ключ
	 * @return mixed Значение параметра или null в случае если параметра с ключом нет
	 */
	public function getParam($key) {
		return (is_array($this->params) && isset($this->params[$key])) ? $this->params[$key] : null;
	}

	/**
	 * Возвращаем имя метода на директе, для которого созданы параметры
	 * @return string
	 */
	public function getAPIMethodName() {
		return $this->methodName;
	}

	//--- Свои методы

	/**
	 * Устанавливаем объекти типа GetCampaignsInfo
	 * @param GetCampaignsInfo $value
	 */
	public function SetGetCampaignsInfo($value) {
		$this->params = $value->getArray();
	}

	/**
	 * Возвращаем объект типа GetCampaignInfo
	 * @return GetCampaignInfo
	 */
	public function GetGetCampaignsInfo() {
		return $this->params;
	}
}


text:
Partial Public Class PageEditControl
    Inherits BaseClasses.BaseSecurityUserControl
#Else
    <ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never), ComponentModel.ToolboxItem(False)> _
    Partial Public Class PageEditControl
        Inherits BaseClasses.BaseSecurityUserControl
#End If

    Public dynpage As dsDTIAdminPanel.DTIDynamicPageRow

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack AndAlso dynpage IsNot Nothing Then
            tbPageName.Text = dynpage.PageName
            'rblTemplate.SelectedValue = dynpage.Template

            If Not dynpage.IsLinkNull Then tbLink.Text = dynpage.Link

            cbAdmin.Checked = (Not dynpage.IsAdminOnlyNull AndAlso dynpage.AdminOnly)
            cbUsers.Checked = (Not dynpage.IsUsersOnlyNull AndAlso dynpage.UsersOnly)

            binddll()
            If dynpage.IsLinkNull Then
                ddlMasterPage.SelectedValue = dynpage.MasterPage
            Else
                ddlMasterPage.Enabled = False
                'rblTemplate.Enabled = False
            End If

            Dim link As String = "http://" & Request.Url.Authority & "/"
            If dynpage.IsLinkNull Then
                link &= "page/" & dynpage.PageName
            Else
                If dynpage.Link.StartsWith("http://") Then
                    link = dynpage.Link
                Else
                    link &= dynpage.Link
                End If
            End If
            lbl.InnerText = link
        End If
    End Sub

    Private Sub binddll()
        Dim location As String = AppDomain.CurrentDomain.BaseDirectory
        For Each masterPage As String In System.IO.Directory.GetFiles(location, "*.Master", IO.SearchOption.AllDirectories)
            masterPage = masterPage.Replace(location, "~/").Replace("\", "/")
            Dim last As Integer = masterPage.LastIndexOf("/") + 1
            ddlMasterPage.Items.Add(New ListItem(masterPage.Substring(last, masterPage.Length - last), masterPage))
        Next
    End Sub

    Public Sub save()
        If dynpage IsNot Nothing Then
            With dynpage
                If tbPageName.Text <> "" Then
                    .PageName = tbPageName.Text
                End If
                If tbLink.Text <> "" Then
                    .Link = tbLink.Text
                Else
                    .SetLinkNull()
                End If
                .AdminOnly = cbAdmin.Checked
                .UsersOnly = cbUsers.Checked
                '.Template = rblTemplate.SelectedValue
                .MasterPage = ddlMasterPage.SelectedValue
            End With
            sqlHelper.Update(dynpage.Table)
            'clears out menu items and page information from session
            Session("DTIAdminPanel.DTIPageHeiarchy") = Nothing
        End If
    End Sub
End Class