text:
/* Make the render output CPU accessible by defining a framebuffer texture
 * stored in a VCSM (VideoCore shared memory) EGL image.
 *
 * This example just demonstrates how to use use the APIs by using the CPU.
 * to blit an animated rectangle into frame-buffer texture in shared memory.
 *
 * A more realistic example would be to do a blur, edge-detect in GLSL then pass
 * the buffer to OpenCV. There may be some benefit in using multiple GL contexts
 * to reduce the impact of serializing operations with a glFlush.
 *
 * N.B VCSM textures are raster scan order textures. This makes it very
 * convenient to read and modify VCSM frame-buffer textures from the CPU.
 * However, if the output of the CPU stage is drawn again as a texture that
 * is rotated or scaled then it can sometimes be better to use glTexImage2D
 * to allow the driver to convert this back into the native texture format.
 *
 * Example usage
 * raspistill -p 0,0,1024,1024 -gw 0,0,1024,1024 -t 10000 --gl -gs vcsm_square
 */
/* Uncomment the next line to compare with the glReadPixels implementation. VCSM
 * should run at about 40fps with a 1024x1024 texture compared to about 20fps
 * using glReadPixels.
 */
//#define USE_READPIXELS

#include "vcsm_square.h"
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "RaspiTex.h"
#include "RaspiTexUtil.h"
#include "user-vcsm.h"

/* Draw a scaled quad showing the entire texture with the
 * origin defined as an attribute */
static RASPITEXUTIL_SHADER_PROGRAM_T vcsm_square_oes_shader =
{
    .vertex_source =
    "attribute vec2 vertex;\n"
    "varying vec2 texcoord;\n"
    "void main(void) {\n"
    "   texcoord = 0.5 * (vertex + 1.0);\n" \
    "   gl_Position = vec4(vertex, 0.0, 1.0);\n"
    "}\n",

    .fragment_source =
    "#extension GL_OES_EGL_image_external : require\n"
    "uniform samplerExternalOES tex;\n"
    "varying vec2 texcoord;\n"
    "void main(void) {\n"
    "    gl_FragColor = texture2D(tex, texcoord);\n"
    "}\n",
    .uniform_names = {"tex"},
    .attribute_names = {"vertex"},
};
static RASPITEXUTIL_SHADER_PROGRAM_T vcsm_square_shader =
{
    .vertex_source =
    "attribute vec2 vertex;\n"
    "varying vec2 texcoord;\n"
    "void main(void) {\n"
    "   texcoord = 0.5 * (vertex + 1.0);\n" \
    "   gl_Position = vec4(vertex, 0.0, 1.0);\n"
    "}\n",

    .fragment_source =
    "uniform sampler2D tex;\n"
    "varying vec2 texcoord;\n"
    "void main(void) {\n"
    "    gl_FragColor = texture2D(tex, texcoord);\n"
    "}\n",
    .uniform_names = {"tex"},
    .attribute_names = {"vertex"},
};

static GLfloat quad_varray[] = {
   -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, -1.0f,
   -1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f,
};

static GLuint quad_vbo;

#ifdef USE_READPIXELS
unsigned char *pixel_buffer;
#else
static struct egl_image_brcm_vcsm_info vcsm_info;
static EGLImageKHR eglFbImage;
#endif
static GLuint fb_tex_name;
static GLuint fb_name;

// VCSM buffer dimensions must be a power of two. Use glViewPort to draw NPOT
// rectangles within the VCSM buffer.
static int fb_width = 1024;
static int fb_height = 1024;

static const EGLint vcsm_square_egl_config_attribs[] =
{
    EGL_RED_SIZE,   8,
    EGL_GREEN_SIZE, 8,
    EGL_BLUE_SIZE,  8,
    EGL_ALPHA_SIZE, 8,
    EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
    EGL_NONE
};

static int vcsm_square_init(RASPITEX_STATE *raspitex_state)
{
    int rc = vcsm_init();
    vcos_log_trace("%s: vcsm_init %d", VCOS_FUNCTION, rc);

    raspitex_state->egl_config_attribs = vcsm_square_egl_config_attribs;
    rc = raspitexutil_gl_init_2_0(raspitex_state);

    if (rc != 0)
        goto end;

    // Shader for drawing the YUV OES texture
    rc = raspitexutil_build_shader_program(&vcsm_square_oes_shader);
    GLCHK(glUseProgram(vcsm_square_oes_shader.program));
    GLCHK(glUniform1i(vcsm_square_oes_shader.uniform_locations[0], 0)); // tex unit

    // Shader for drawing VCSM sampler2D texture
    rc = raspitexutil_build_shader_program(&vcsm_square_shader);
    GLCHK(glUseProgram(vcsm_square_shader.program));
    GLCHK(glUniform1i(vcsm_square_shader.uniform_locations[0], 0)); // tex unit

    GLCHK(glGenFramebuffers(1, &fb_name));
    GLCHK(glBindFramebuffer(GL_FRAMEBUFFER, fb_name));

    GLCHK(glGenTextures(1, &fb_tex_name));
    GLCHK(glBindTexture(GL_TEXTURE_2D, fb_tex_name));
    GLCHK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
    GLCHK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));

#ifdef USE_READPIXELS
    printf("Using glReadPixels\n");
    GLCHK(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fb_width, fb_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL));
    pixel_buffer = malloc(fb_width * fb_height * 4);
    if (! pixel_buffer) {
        rc = -1;
        goto end;
    }
#else /* USE_READPIXELS */
    printf("Using VCSM\n");
    vcsm_info.width = fb_width;
    vcsm_info.height = fb_height;
    eglFbImage = eglCreateImageKHR(raspitex_state->display, EGL_NO_CONTEXT,
            EGL_IMAGE_BRCM_VCSM, &vcsm_info, NULL);
    if (eglFbImage == EGL_NO_IMAGE_KHR || vcsm_info.vcsm_handle == 0) {
        vcos_log_error("%s: Failed to create EGL VCSM image\n", VCOS_FUNCTION);
        rc = -1;
        goto end;
    }

    GLCHK(glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglFbImage));
#endif /* USE_READPIXELS */

    GLCHK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fb_tex_name, 0));
    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
        vcos_log_error("GL_FRAMEBUFFER is not complete\n");
        rc = -1;
        goto end;
    }
    GLCHK(glBindFramebuffer(GL_FRAMEBUFFER, 0));
    GLCHK(glGenBuffers(1, &quad_vbo));
    GLCHK(glBindBuffer(GL_ARRAY_BUFFER, quad_vbo));
    GLCHK(glBufferData(GL_ARRAY_BUFFER, sizeof(quad_varray), quad_varray, GL_STATIC_DRAW));

    GLCHK(glClearColor(0, 0, 0, 0));
end:
    return rc;
}

// Write the shared memory texture writing something to each line. This is
// just to show that the buffer really is CPU modifiable.
static void vcsm_square_draw_pattern(unsigned char *buffer)
{
    static unsigned x_offset;

    unsigned char *line_start = (unsigned char *) buffer;
    unsigned width = fb_width > 32 ? 32 : fb_width;
    int i = 0;
    size_t stride = fb_width  << 2;

    x_offset = (x_offset + 1) % (fb_width - width);
    for (i = 0; i < fb_height; i++) {
        memset(line_start + (x_offset << 2), ~0, width << 2);
        line_start += stride;
    }
}

#ifdef USE_READPIXELS
static int vcsm_square_redraw_readpixels(RASPITEX_STATE *raspitex_state)
{
    vcos_log_trace("%s", VCOS_FUNCTION);

    GLCHK(glBindFramebuffer(GL_FRAMEBUFFER, fb_name));
    GLCHK(glViewport(0,0,fb_width,fb_height));
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Fill the viewport with the camFill the viewport with the camera image
    GLCHK(glUseProgram(vcsm_square_oes_shader.program));
    GLCHK(glActiveTexture(GL_TEXTURE0));
    GLCHK(glBindTexture(GL_TEXTURE_EXTERNAL_OES, raspitex_state->y_texture));
    GLCHK(glBindBuffer(GL_ARRAY_BUFFER, quad_vbo));
    GLCHK(glEnableVertexAttribArray(vcsm_square_oes_shader.attribute_locations[0]));
    GLCHK(glVertexAttribPointer(vcsm_square_oes_shader.attribute_locations[0], 2, GL_FLOAT, GL_FALSE, 0, 0));
    GLCHK(glDrawArrays(GL_TRIANGLES, 0, 6));

    GLCHK(glReadPixels(0, 0, fb_width, fb_height, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buffer));

    vcsm_square_draw_pattern(pixel_buffer);

    // Enable default window surface
    GLCHK(glBindFramebuffer(GL_FRAMEBUFFER, 0));

    // Draw the modified texture buffer to the screen
    GLCHK(glViewport(raspitex_state->x, raspitex_state->y, raspitex_state->width, raspitex_state->height));
    GLCHK(glUseProgram(vcsm_square_shader.program));
    GLCHK(glActiveTexture(GL_TEXTURE0));
    GLCHK(glBindTexture(GL_TEXTURE_2D, fb_tex_name));
    GLCHK(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, fb_width, fb_height, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buffer));
    GLCHK(glEnableVertexAttribArray(vcsm_square_shader.attribute_locations[0]));
    GLCHK(glVertexAttribPointer(vcsm_square_shader.attribute_locations[0], 2, GL_FLOAT, GL_FALSE, 0, 0));
    GLCHK(glDrawArrays(GL_TRIANGLES, 0, 6));

    GLCHK(glDisableVertexAttribArray(vcsm_square_shader.attribute_locations[0]));
    GLCHK(glUseProgram(0));

    return 0;
}
#else /* USE_READPIXELS */
static int vcsm_square_redraw(RASPITEX_STATE *raspitex_state)
{
    unsigned char *vcsm_buffer = NULL;
    VCSM_CACHE_TYPE_T cache_type;

    vcos_log_trace("%s", VCOS_FUNCTION);

    glClearColor(255, 0, 0, 255);

    GLCHK(glBindFramebuffer(GL_FRAMEBUFFER, fb_name));
    GLCHK(glViewport(0, 0, fb_width, fb_height));
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Fill the viewport with the camFill the viewport with the camera image
    GLCHK(glUseProgram(vcsm_square_oes_shader.program));
    GLCHK(glActiveTexture(GL_TEXTURE0));
    GLCHK(glBindTexture(GL_TEXTURE_EXTERNAL_OES, raspitex_state->y_texture));
    GLCHK(glBindBuffer(GL_ARRAY_BUFFER, quad_vbo));
    GLCHK(glEnableVertexAttribArray(vcsm_square_oes_shader.attribute_locations[0]));
    GLCHK(glVertexAttribPointer(vcsm_square_oes_shader.attribute_locations[0], 2, GL_FLOAT, GL_FALSE, 0, 0));
    GLCHK(glDrawArrays(GL_TRIANGLES, 0, 6));

    GLCHK(glFinish());

    // Make the buffer CPU addressable with host cache enabled
    vcsm_buffer = (unsigned char *) vcsm_lock_cache(vcsm_info.vcsm_handle, VCSM_CACHE_TYPE_HOST, &cache_type);
    if (! vcsm_buffer) {
        vcos_log_error("Failed to lock VCSM buffer for handle %d\n", vcsm_info.vcsm_handle);
        return -1;
    }
    vcos_log_trace("Locked vcsm handle %d at %p\n", vcsm_info.vcsm_handle, vcsm_buffer);

    vcsm_square_draw_pattern(vcsm_buffer);

    // Release the locked texture memory to flush the CPU cache and allow GPU
    // to read it
    vcsm_unlock_ptr(vcsm_buffer);

    // Enable default window surface
    GLCHK(glBindFramebuffer(GL_FRAMEBUFFER, 0));

    // Draw the modified texture buffer to the screen
    GLCHK(glViewport(raspitex_state->x, raspitex_state->y, raspitex_state->width, raspitex_state->height));
    GLCHK(glUseProgram(vcsm_square_shader.program));
    GLCHK(glActiveTexture(GL_TEXTURE0));
    GLCHK(glBindTexture(GL_TEXTURE_2D, fb_tex_name));
    GLCHK(glEnableVertexAttribArray(vcsm_square_shader.attribute_locations[0]));
    GLCHK(glVertexAttribPointer(vcsm_square_shader.attribute_locations[0], 2, GL_FLOAT, GL_FALSE, 0, 0));
    GLCHK(glDrawArrays(GL_TRIANGLES, 0, 6));

    GLCHK(glDisableVertexAttribArray(vcsm_square_shader.attribute_locations[0]));
    GLCHK(glUseProgram(0));

    return 0;
}
#endif /* USE_READPIXELS */

int vcsm_square_open(RASPITEX_STATE *raspitex_state)
{
    vcos_log_trace("%s", VCOS_FUNCTION);

    raspitex_state->ops.gl_init = vcsm_square_init;
#ifdef USE_READPIXELS
    raspitex_state->ops.redraw = vcsm_square_redraw_readpixels;
#else
    raspitex_state->ops.redraw = vcsm_square_redraw;
#endif /* USE_READPIXELS */
    raspitex_state->ops.update_y_texture = raspitexutil_update_y_texture;
    return 0;
}


text:
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace MasterDevs.ChromeDevTools.Protocol.iOS.Debugger
{
	/// <summary>
	/// Steps out of the function call.
	/// </summary>
	[CommandResponse(ProtocolName.Debugger.StepOut)]
	[SupportedBy("iOS")]
	public class StepOutCommandResponse
	{
	}
}

redpajama_set_name: RedPajamaGithub


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

namespace DelimitedFileViewer.Properties {

    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default {
            get {
                return defaultInstance;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("500, 650")]
        public global::System.Drawing.Size Size {
            get {
                return ((global::System.Drawing.Size)(this["Size"]));
            }
            set {
                this["Size"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("Default")]
        public string Encoding {
            get {
                return ((string)(this["Encoding"]));
            }
            set {
                this["Encoding"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("|")]
        public string Delimiter {
            get {
                return ((string)(this["Delimiter"]));
            }
            set {
                this["Delimiter"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("False")]
        public bool ToggleHeader {
            get {
                return ((bool)(this["ToggleHeader"]));
            }
            set {
                this["ToggleHeader"] = value;
            }
        }
    }
}


text:
<meta charset="UTF-8">
<title>TrickObject.rotation - core</title>
<link rel="stylesheet" href="..\..\..\style.css">

core / com.erikcupal.theblackcatclient.gameObjects / TrickObject / rotation

rotation

val rotation: Float


text:
title: "Documentation"
linkTitle: "Documentation"
---

<!--

 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   https://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.

-->

## Introduction

Apache Avro™ is a data serialization system.

Avro provides:

* Rich data structures.
* A compact, fast, binary data format.
* A container file, to store persistent data.
* Remote procedure call (RPC).
* Simple integration with dynamic languages. Code generation is not required to read or write data files nor to use or implement RPC protocols. Code generation as an optional optimization, only worth implementing for statically typed languages.

## Schemas

Avro relies on schemas. When Avro data is read, the schema used when writing it is always present. This permits each datum to be written with no per-value overheads, making serialization both fast and small. This also facilitates use with dynamic, scripting languages, since data, together with its schema, is fully self-describing.

When Avro data is stored in a file, its schema is stored with it, so that files may be processed later by any program. If the program reading the data expects a different schema this can be easily resolved, since both schemas are present.

When Avro is used in RPC, the client and server exchange schemas in the connection handshake. (This can be optimized so that, for most calls, no schemas are actually transmitted.) Since both client and server both have the other's full schema, correspondence between same named fields, missing fields, extra fields, etc. can all be easily resolved.

Avro schemas are defined with JSON . This facilitates implementation in languages that already have JSON libraries.

## Comparison with other systems

Avro provides functionality similar to systems such as [Thrift](https://thrift.apache.org/), [Protocol Buffers](https://code.google.com/p/protobuf/), etc. Avro differs from these systems in the following fundamental aspects.

* Dynamic typing: Avro does not require that code be generated. Data is always accompanied by a schema that permits full processing of that data without code generation, static datatypes, etc. This facilitates construction of generic data-processing systems and languages.
* Untagged data: Since the schema is present when data is read, considerably less type information need be encoded with data, resulting in smaller serialization size.
* No manually-assigned field IDs: When a schema changes, both the old and new schema are always present when processing data, so differences may be resolved symbolically, using field names.


text:
require 'spec_helper'

module Recurrent
  describe Logger do
    before(:each) do
      @logger = Logger.new('logtastic')
      @users_logger = stub('logger')
      Configuration.logger do |message, log_level|
        @users_logger.info(message) if log_level == :info
        @users_logger.debug(message) if log_level == :debug
        @users_logger.warn(message) if log_level == :warn
      end
    end

    after(:all) do
      Configuration.logger = nil
    end

    describe "#info" do
      it "should send a message to the logger with the info logging level" do
        @users_logger.should_receive(:info).with(@logger.log_message("testing logger"))
        @logger.info("testing logger")
      end
    end

    describe "#debug" do
      it "should send a message to the logger with the debug logging level" do
        @users_logger.should_receive(:debug).with(@logger.log_message("testing logger"))
        @logger.debug("testing logger")
      end
    end

    describe "#warn" do
      it "should send a message to the logger with the info logging level" do
        @users_logger.should_receive(:warn).with(@logger.log_message("testing logger"))
        @logger.warn("testing logger")
      end
    end

    describe "#log_message" do
      it "adds the scheduler's identifier to the message" do
        @logger.log_message("testing").should == "[Recurrent - Process:logtastic - Timestamp:#{Time.now.to_s(:seconds)}] - testing"
      end
    end

  end
end


text:
package org.openksavi.sponge.core.kb;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.function.Function;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

import org.openksavi.sponge.core.util.SpongeUtils;
import org.openksavi.sponge.engine.SpongeEngine;

/**
 * The provider of script-based class instances that caches parsed expressions.
 *
 * @param <S> the type of the script.
 * @param <T> the type of the instance to provide.
 */
public class CachedScriptClassInstancePovider<S, T> implements ScriptClassInstanceProvider<T> {

    private Function<String, S> createScriptFunction;

    private String format;

    private BiFunction<S, Class<T>, T> createInstanceFunction;

    /** The cache. {@code null} if caching is turned off. */
    private LoadingCache<String, S> cache;

    public CachedScriptClassInstancePovider(SpongeEngine engine, Function<String, S> createScriptFunction, String format,
            BiFunction<S, Class<T>, T> createInstanceFunction) {
        this.createScriptFunction = createScriptFunction;
        this.format = format;
        this.createInstanceFunction = createInstanceFunction;

        long cacheExpireTime = engine.getDefaultParameters().getScriptClassInstancePoviderCacheExpireTime();
        if (cacheExpireTime >= 0) {
            // Turn on the cache.
            CacheBuilder<Object, Object> builder = CacheBuilder.newBuilder();
            if (cacheExpireTime > 0) {
                builder.expireAfterAccess(cacheExpireTime, TimeUnit.MILLISECONDS);
            }

            cache = builder.build(new CacheLoader<String, S>() {

                @Override
                public S load(String className) throws Exception {
                    return createScript(className);
                }
            });
        }
    }

    @Override
    public T newInstance(String className, Class<T> javaClass) {
        try {
            return createInstanceFunction.apply(cache != null ? cache.get(className) : createScript(className), javaClass);
        } catch (ExecutionException e) {
            throw SpongeUtils.wrapException(e.getCause() != null ? e.getCause() : e);
        } catch (Exception e) {
            throw SpongeUtils.wrapException(getClass().getSimpleName(), e);
        }
    }

    @Override
    public void clear() {
        if (cache != null) {
            cache.invalidateAll();
        }
    }

    protected S createScript(String className) {
        return createScriptFunction.apply(String.format(format, className));
    }
}


text:
#ifndef __INSERTION_TREE_H__
#define __INSERTION_TREE_H__

#include <cstddef>
#include <pthread.h>

template <class NodeType>
class InsertionTree {
public:

  InsertionTree() : rootNode(NULL), firstNode(NULL), lastNode(NULL),
                    _height(0), numOfNodes(0), numOfLeaves(0) {
    pthread_mutex_init(&lock, NULL);
  }

  void addNode(NodeType* const node);

  bool contains(NodeType* obj) const;

  inline NodeType* root()  const { return rootNode; }
  inline NodeType* first() const { return firstNode; }
  inline NodeType* last()  const { return lastNode;  }

  inline size_t size() const          { return numOfLeaves; }
  inline size_t numberOfNodes() const { return numOfNodes; }
  inline size_t height() const        { return _height; }

  inline bool isPerfect() const {
    return numOfLeaves == 0
          || (numOfLeaves & (numOfLeaves - 1)) == 0; // is power of 2
  }

  void free();

private:
  NodeType* rootNode;
  NodeType* firstNode;
  NodeType* lastNode;

  size_t _height;
  size_t numOfNodes;
  size_t numOfLeaves;

  pthread_mutex_t lock;

  NodeType* insertionNode();
};

#include "InsertionTree.impl.h"

#endif


text:
namespace _01.Distinct_List
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    public class DistinctList
    {
        public static void Main()
        {
            var numbers = Console.ReadLine()
                .Split(new char[] { ' ' })
                .Select(int.Parse)
                .ToList()
                .Distinct();

            Console.WriteLine(string.Join(" ",numbers));
        }
    }
}


text:
import unittest
import base64
import yaml
import mock
from cloudify.mocks import MockCloudifyContext
from .. import CloudInit
from cloudify.state import current_ctx

NODE_PROPS = {
    'header': 'Content-Type: text/cloud_config',
    'resource_config': {},
}
RUNTIME_PROPS = {
    'resource_config': {},
}

DEPLOYMENT_PROXY_TYPE = 'cloudify.nodes.CloudInit'
MINIMUM_CLOUD_CONFIG = 'Content-Type: text/cloud_config\n{}\n'

class CloudifyCloudInitTestBase(unittest.TestCase):

    def get_mock_ctx(self,
                     test_name,
                     test_properties=NODE_PROPS,
                     runtime_properties=RUNTIME_PROPS,
                     node_type=DEPLOYMENT_PROXY_TYPE,
                     retry_number=0):

        operation = {
            'retry_number': retry_number
        }

        ctx = MockCloudifyContext(
            node_id=test_name,
            deployment_id=test_name,
            operation=operation,
            properties=test_properties,
            runtime_properties=runtime_properties
        )

        ctx.operation._operation_context = {'name': 'some.test'}
        ctx.node.type_hierarchy = ['cloudify.nodes.Root', node_type]
        ctx.get_resource_and_render = mock.Mock(
            return_value="resource_and_render")
        ctx.get_resource = mock.Mock(
            return_value="get_resource")
        try:
            ctx.node.type = node_type
        except AttributeError:
            ctx.logger.error('Failed to set node type attribute.')
        return ctx

    def test_operation_update(self):
        """Test the update function"""

        test_name = 'test_operation_update'
        _ctx = self.get_mock_ctx(test_name)
        current_ctx.set(_ctx)

        # First time with no inputs.
        CloudInit(operation_inputs={}).update()
        self.assertEquals(
            MINIMUM_CLOUD_CONFIG,
            _ctx._runtime_properties.get('cloud_config'))

        # Operation inputs for the rest of the test.
        update_inputs = {
            'resource_config': {'packages': ['package1', 'package2']}
        }

        # Test that Operation inputs override the current ctx.
        CloudInit(operation_inputs=update_inputs).update()
        self.assertEquals(
            # Need to covert before compare as we can have different syntax
            yaml.safe_load(
                MINIMUM_CLOUD_CONFIG.format("packages: [package1, package2]")),
            yaml.safe_load(
                _ctx._runtime_properties.get('cloud_config')))

        # Test that base64 version of inputs are equivalent.
        _ctx.node.properties['encode_base64'] = True
        CloudInit(operation_inputs={}).update()
        self.assertEquals(
            # Need to covert before compare as we can have different syntax
            yaml.safe_load(
                MINIMUM_CLOUD_CONFIG.format("packages: [package1, package2]")),
            yaml.safe_load(base64.b64decode(
                _ctx._runtime_properties.get('cloud_config')).decode()))

        # Test that even if we run Base64 on the string
        # the resource_config is not touched.
        self.assertEquals(
            update_inputs.get('resource_config'),
            _ctx._runtime_properties.get('resource_config'))

        # Test that cloud_config string can be ignored.
        _ctx.node.properties['encode_base64'] = False
        CloudInit(operation_inputs={}).update()
        self.assertEquals(
            # Need to covert before compare as we can have different syntax
            yaml.safe_load(
                MINIMUM_CLOUD_CONFIG.format("packages: [package1, package2]")),
            yaml.safe_load(
                _ctx._runtime_properties.get('cloud_config')))

        # check file content
        update_inputs = {
            'resource_config': {'write_files': [{
                'path': 'direct',
                'content': 'abc'
            }, {
                'path': 'resource',
                'content': {
                    'resource_name': 'resource',
                    'resource_type': 'file_resource'
                }
            }, {
                'path': 'resource_render',
                'content': {
                    'resource_type': 'file_resource',
                    'resource_name': 'render',
                    'template_variables': {'a': 'b'}
                }
            }]}
        }

        # Test that Operation inputs override the current ctx.
        CloudInit(operation_inputs=update_inputs).update()
        self.assertEquals(
            {
                'packages': ['package1', 'package2'],
                'Content-Type': 'text/cloud_config',
                'write_files': [{
                    'content': 'abc',
                    'path': 'direct'
                }, {
                    'content': 'get_resource',
                    'path': 'resource'
                }, {
                    'content': 'resource_and_render',
                    'path': 'resource_render'
                }]
            },
            # Need to covert before compare as we can have different syntax
            yaml.safe_load(
                _ctx._runtime_properties.get('cloud_config')))

        # custom cases
        _ctx.get_resource = mock.Mock(side_effect=ValueError('Strage'))
        update_inputs = {
            'resource_config': {'write_files': [{
                'path': 'resource',
                'content': {
                    'resource_name': 'resource',
                    'resource_type': 'file_resource'
                }
            }, 'something_strage']}
        }
        CloudInit(operation_inputs=update_inputs).update()

if __name__ == '__main__':
    unittest.main()


text:
@interface AshtonUIKit ()
@property (nonatomic, readonly) NSArray *attributesToPreserve;
@end

@implementation AshtonUIKit

+ (instancetype)sharedInstance {
    static dispatch_once_t onceToken;
    static AshtonUIKit *sharedInstance;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[AshtonUIKit alloc] init];
    });
    return sharedInstance;
}

- (id)init {
    if (self = [super init]) {
        _attributesToPreserve = @[ AshtonAttrBaselineOffset, AshtonAttrVerticalAlign ];
    }
    return self;
}

- (NSAttributedString *)intermediateRepresentationWithTargetRepresentation:(NSAttributedString *)input {
    NSMutableAttributedString *output = [input mutableCopy];
    NSRange totalRange = NSMakeRange (0, input.length);
    [input enumerateAttributesInRange:totalRange options:0 usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) {
        NSMutableDictionary *newAttrs = [NSMutableDictionary dictionaryWithCapacity:[attrs count]];
        for (id attrName in attrs) {
            id attr = attrs[attrName];
            if ([attrName isEqual:NSParagraphStyleAttributeName]) {
                // produces: paragraph
                if (![attr isKindOfClass:[NSParagraphStyle class]]) continue;
                NSParagraphStyle *paragraphStyle = attr;
                NSMutableDictionary *attrDict = [NSMutableDictionary dictionary];

                if (paragraphStyle.alignment == NSTextAlignmentLeft) attrDict[AshtonParagraphAttrTextAlignment] = @"left";
                if (paragraphStyle.alignment == NSTextAlignmentRight) attrDict[AshtonParagraphAttrTextAlignment] = @"right";
                if (paragraphStyle.alignment == NSTextAlignmentCenter) attrDict[AshtonParagraphAttrTextAlignment] = @"center";
                if (paragraphStyle.alignment == NSTextAlignmentJustified) attrDict[AshtonParagraphAttrTextAlignment] = @"justified";
                newAttrs[AshtonAttrParagraph] = attrDict;
            }
            if ([attrName isEqual:NSFontAttributeName]) {
                // produces: font
                if (![attr isKindOfClass:[UIFont class]]) continue;
                UIFont *font = attr;
                UIFontDescriptor *fontDescriptor = font.fontDescriptor;
                NSMutableDictionary *attrDict = [NSMutableDictionary dictionary];

                CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, NULL);
                CTFontSymbolicTraits symbolicTraits = CTFontGetSymbolicTraits(ctFont);
                if ((symbolicTraits & kCTFontTraitBold) == kCTFontTraitBold) attrDict[AshtonFontAttrTraitBold] = @(YES);
                if ((symbolicTraits & kCTFontTraitItalic) == kCTFontTraitItalic) attrDict[AshtonFontAttrTraitItalic] = @(YES);

                // non-default font feature settings
                NSArray *fontFeatures = [fontDescriptor objectForKey:UIFontDescriptorFeatureSettingsAttribute];
                NSMutableSet *features = [NSMutableSet set];
                if (fontFeatures) {
                    for (NSDictionary *feature in fontFeatures) {
                        [features addObject:@[feature[UIFontFeatureTypeIdentifierKey], feature[UIFontFeatureSelectorIdentifierKey]]];
                    }
                }

                attrDict[AshtonFontAttrFeatures] = features;
                attrDict[AshtonFontAttrPointSize] = @(font.pointSize);
                attrDict[AshtonFontAttrFamilyName] = CFBridgingRelease(CTFontCopyName(ctFont, kCTFontFamilyNameKey));
                attrDict[AshtonFontAttrPostScriptName] = CFBridgingRelease(CTFontCopyName(ctFont, kCTFontPostScriptNameKey));
                CFRelease(ctFont);
                newAttrs[AshtonAttrFont] = attrDict;
            }
            if ([attrName isEqual:NSUnderlineStyleAttributeName]) {
                // produces: underline
                if (![attr isKindOfClass:[NSNumber class]]) continue;
                if ([attr isEqual:@(NSUnderlineStyleSingle)]) newAttrs[AshtonAttrUnderline] = AshtonUnderlineStyleSingle;
            }
            if ([attrName isEqual:NSStrikethroughStyleAttributeName]) {
                // produces: strikthrough
                if (![attr isKindOfClass:[NSNumber class]]) continue;
                if ([attr isEqual:@(NSUnderlineStyleSingle)]) newAttrs[AshtonAttrStrikethrough] = AshtonStrikethroughStyleSingle;
            }
            if ([attrName isEqual:NSForegroundColorAttributeName]) {
                // produces: color
                if (![attr isKindOfClass:[UIColor class]]) continue;
                newAttrs[AshtonAttrColor] = [self arrayForColor:attr];
            }
            if ([attrName isEqual:NSBackgroundColorAttributeName]) {
                // produces: color
                if (![attr isKindOfClass:[UIColor class]]) continue;
                newAttrs[AshtonAttrBackgroundColor] = [self arrayForColor:attr];
            }
			if ([attrName isEqual:NSUnderlineColorAttributeName]) {
				// produces: color
				if (![attr isKindOfClass:[UIColor class]]) continue;
				newAttrs[AshtonAttrUnderlineColor] = [self arrayForColor:attr];
			}
			if ([attrName isEqual:NSStrikethroughColorAttributeName]) {
				// produces: color
				if (![attr isKindOfClass:[UIColor class]]) continue;
				newAttrs[AshtonAttrStrikethroughColor] = [self arrayForColor:attr];
			}
            if ([attrName isEqual:NSLinkAttributeName]) {
                if ([attr isKindOfClass:[NSURL class]]) {
                    newAttrs[AshtonAttrLink] = [attr absoluteString];
                } else if ([attr isKindOfClass:[NSString class]]) {
                    newAttrs[AshtonAttrLink] = attr;
                }
            }
        }
        // after going through all UIKit attributes copy back the preserved attributes, but only if they don't exist already
        // we don't want to overwrite settings that were assigned by UIKit with our preserved attributes
        for (id attrName in attrs) {
            id attr = attrs[attrName];
            if ([self.attributesToPreserve containsObject:attrName]) {
                if(!newAttrs[attrName]) newAttrs[attrName] = attr;
            }
        }
        [output setAttributes:newAttrs range:range];
    }];

    return output;
}

- (NSAttributedString *)targetRepresentationWithIntermediateRepresentation:(NSAttributedString *)input {
    NSMutableAttributedString *output = [input mutableCopy];
    NSRange totalRange = NSMakeRange (0, input.length);
    [input enumerateAttributesInRange:totalRange options:0 usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) {
        NSMutableDictionary *newAttrs = [NSMutableDictionary dictionaryWithCapacity:[attrs count]];
        for (NSString *attrName in attrs) {
            id attr = attrs[attrName];
            if ([attrName isEqualToString:AshtonAttrParagraph]) {
                // consumes: paragraph
                NSDictionary *attrDict = attr;
                NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];

                if ([attrDict[AshtonParagraphAttrTextAlignment] isEqualToString:@"left"])  paragraphStyle.alignment = NSTextAlignmentLeft;
                if ([attrDict[AshtonParagraphAttrTextAlignment] isEqualToString:@"right"]) paragraphStyle.alignment = NSTextAlignmentRight;
                if ([attrDict[AshtonParagraphAttrTextAlignment] isEqualToString:@"center"]) paragraphStyle.alignment = NSTextAlignmentCenter;
                if ([attrDict[AshtonParagraphAttrTextAlignment] isEqualToString:@"justified"]) paragraphStyle.alignment = NSTextAlignmentJustified;

                newAttrs[NSParagraphStyleAttributeName] = paragraphStyle;
            }
            if ([attrName isEqualToString:AshtonAttrFont]) {
                // consumes: font
                NSDictionary *attrDict = attr;
                UIFont *font = [AshtonUtils CTFontRefWithFamilyName:attrDict[AshtonFontAttrFamilyName]
                                                     postScriptName:attrDict[AshtonFontAttrPostScriptName]
                                                               size:[attrDict[AshtonFontAttrPointSize] doubleValue]
                                                          boldTrait:[attrDict[AshtonFontAttrTraitBold] isEqual:@(YES)]
                                                        italicTrait:[attrDict[AshtonFontAttrTraitItalic] isEqual:@(YES)]
                                                           features:attrDict[AshtonFontAttrFeatures]];
                if (font) {
                    newAttrs[NSFontAttributeName] = font;
                } else {
                    // If the font is not available on this device (e.g. custom font), fallback to system font
                    newAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:[attrDict[AshtonFontAttrPointSize] doubleValue]];
                }
            }
            if ([attrName isEqualToString:AshtonAttrUnderline]) {
                // consumes: underline
                if ([attr isEqualToString:AshtonUnderlineStyleSingle]) newAttrs[NSUnderlineStyleAttributeName] = @(NSUnderlineStyleSingle);
                if ([attr isEqualToString:AshtonUnderlineStyleDouble]) newAttrs[NSUnderlineStyleAttributeName] = @(NSUnderlineStyleSingle);
                if ([attr isEqualToString:AshtonUnderlineStyleThick]) newAttrs[NSUnderlineStyleAttributeName] = @(NSUnderlineStyleSingle);
            }
            if ([attrName isEqualToString:AshtonAttrStrikethrough]) {
                if ([attr isEqualToString:AshtonStrikethroughStyleSingle]) newAttrs[NSStrikethroughStyleAttributeName] = @(NSUnderlineStyleSingle);
                if ([attr isEqualToString:AshtonStrikethroughStyleDouble]) newAttrs[NSStrikethroughStyleAttributeName] = @(NSUnderlineStyleSingle);
                if ([attr isEqualToString:AshtonStrikethroughStyleThick]) newAttrs[NSStrikethroughStyleAttributeName] = @(NSUnderlineStyleSingle);
            }
            if ([attrName isEqualToString:AshtonAttrLink]) {
                NSURL *URL = [NSURL URLWithString:attr];
                if (URL) {
                    newAttrs[NSLinkAttributeName] = URL;
                }
            }
            if ([attrName isEqualToString:AshtonAttrColor]) {
                // consumes: color
                newAttrs[NSForegroundColorAttributeName] = [self colorForArray:attr];
            }
            if ([attrName isEqualToString:AshtonAttrBackgroundColor]) {
                // consumes: backgroundColor
                newAttrs[NSBackgroundColorAttributeName] = [self colorForArray:attr];
            }
            if ([self.attributesToPreserve containsObject:attrName]) {
                newAttrs[attrName] = attr;
            }
        }
        [output setAttributes:newAttrs range:range];
    }];

    return output;
}

- (NSArray *)arrayForColor:(UIColor *)color {
    return [AshtonUtils arrayForCGColor:color.CGColor];
}

- (UIColor *)colorForArray:(NSArray *)input {
    CGFloat red = [input[0] doubleValue], green = [input[1] doubleValue], blue = [input[2] doubleValue], alpha = [input[3] doubleValue];
    return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}

@end
#endif


text:
<!DOCTYPE html>

  <meta charset=utf-8 />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <title>Analog Input and Visualisation</title>

Reading analog input and chart

This example uses Smoothie Charts for the chart.

  <canvas id="graph" width="400" height="100"></canvas>


text:
package receiver

import (
	"fmt"
	"testing"
	"time"

	"github.com/tgres/tgres/rrd"
	"github.com/tgres/tgres/serde"
	"github.com/tgres/tgres/series"
)

func Test_dscache_newDsCache(t *testing.T) {
	d := newDsCache(nil, nil, nil)
	if d == nil {
		t.Error("newDsCache returned nil")
	}
}

func Test_dscache_getByIdent(t *testing.T) {
	d := newDsCache(nil, nil, nil)
	foo := newCachedIdent(serde.Ident{"name": "foo"})
	bar := newCachedIdent(serde.Ident{"name": "bar"})
	d.byIdent[foo.String()] = &cachedDs{}
	if rds := d.getByIdent(foo); rds == nil {
		t.Errorf("getByIdent did not return correct value")
	}
	if rds := d.getByIdent(bar); rds != nil {
		t.Errorf("getByIdent did not return nil")
	}
}

func Test_dscache_insert(t *testing.T) {
	d := newDsCache(nil, nil, nil)

	foo := serde.Ident{"name": "foo"}
	ds := serde.NewDbDataSource(0, foo, 0, 0, rrd.NewDataSource(*DftDSSPec))
	rds := &cachedDs{DbDataSourcer: ds}

	d.insert(rds)

	if rds2 := d.getByIdent(newCachedIdent(foo)); rds2 != rds {
		t.Errorf("insert: getByName did not return correct value")
	}
}

func Test_dscache_delete(t *testing.T) {
	d := newDsCache(nil, nil, nil)

	foo := serde.Ident{"name": "foo"}
	ds := serde.NewDbDataSource(0, foo, 0, 0, rrd.NewDataSource(*DftDSSPec))
	rds := &cachedDs{DbDataSourcer: ds}
	d.insert(rds)

	d.delete(foo)

	if rds = d.getByIdent(newCachedIdent(foo)); rds != nil {
		t.Errorf("delete: did not delete")
	}
}

func Test_dscache_preLoad(t *testing.T) {
	db := &fakeSerde{}
	d := newDsCache(db, nil, nil)

	d.preLoad()
	if db.fetchCalled == 0 {
		t.Errorf("db.fetchCalled == 0")
	}

	foo := serde.Ident{"name": "foo"}
	ds := serde.NewDbDataSource(0, foo, 0, 0, rrd.NewDataSource(*DftDSSPec))
	db.returnDss = []rrd.DataSourcer{ds}
	d.preLoad()
	if len(d.byIdent) == 0 {
		t.Errorf("len(d.byIdent) == 0")
	}
	db.fakeErr = true
	if err := d.preLoad(); err == nil {
		t.Errorf("preLoad: err == nil")
	}

	// non-DbDataSource should error
	nds := rrd.NewDataSource(*DftDSSPec)
	db.fakeErr = false
	db.returnDss = []rrd.DataSourcer{nds}
	if err := d.preLoad(); err == nil {
		t.Errorf("preload: a non-DbDataSource should cause error")
	}
}

type fakeSerde struct {
	flushCalled, createCalled, fetchCalled int
	fakeErr                                bool
	returnDss                              []rrd.DataSourcer
	nondb                                  bool
}

func (m *fakeSerde) Fetcher() serde.Fetcher                                { return m }
func (m *fakeSerde) Flusher() serde.Flusher                                { return nil } // Flushing not supported
func (m *fakeSerde) EventListener() serde.EventListener                    { return nil } // not supported
func (f *fakeSerde) FetchDataSourceById(id int64) (rrd.DataSourcer, error) { return nil, nil }
func (m *fakeSerde) Search(serde.SearchQuery) (serde.SearchResult, error)  { return nil, nil }
func (f *fakeSerde) FetchSeries(ds rrd.DataSourcer, from, to time.Time, maxPoints int64) (series.Series, error) {
	return nil, nil
}

func (f *fakeSerde) FetchDataSources() ([]rrd.DataSourcer, error) {
	f.fetchCalled++
	if f.fakeErr {
		return nil, fmt.Errorf("some error")
	}
	if len(f.returnDss) == 0 {
		return make([]rrd.DataSourcer, 0), nil
	}
	return f.returnDss, nil
}

func (f *fakeSerde) FlushDataSource(ds rrd.DataSourcer) error {
	f.flushCalled++
	return nil
}

func (f *fakeSerde) FetchOrCreateDataSource(ident serde.Ident, dsSpec *rrd.DSSpec) (rrd.DataSourcer, error) {
	f.createCalled++
	if f.fakeErr {
		return nil, fmt.Errorf("some error")
	}
	if f.nondb {
		return rrd.NewDataSource(*DftDSSPec), nil
	} else {
		foo := serde.Ident{"name": "foo"}
		return serde.NewDbDataSource(0, foo, 0, 0, rrd.NewDataSource(*DftDSSPec)), nil
	}
}

func Test_dscache_fetchOrCreateByIdent(t *testing.T) {
	db := &fakeSerde{}
	df := &SimpleDSFinder{DftDSSPec}
	sr := &fakeSr{}
	dsf := &dsFlusher{db: db.Flusher(), sr: sr}
	d := newDsCache(db, df, dsf)

	cds := d.getByIdentOrCreateEmpty(newCachedIdent(serde.Ident{"name": "foo"}))
	d.fetchOrCreateByIdent(cds)
	if db.createCalled != 1 {
		t.Errorf("fetchOrCreateByIdent: CreateOrReturnDataSource should be called once, we got: %d", db.createCalled)
	}

	cds = d.getByIdentOrCreateEmpty(newCachedIdent(serde.Ident{"name": ""}))
	if cds != nil {
		t.Errorf("getByIdentOrCreateEmpty: for a blank name we should get nil")
	}

	d = newDsCache(db, df, dsf)
	db.fakeErr = true
	cds = d.getByIdentOrCreateEmpty(newCachedIdent(serde.Ident{"name": "foo"}))
	if err := d.fetchOrCreateByIdent(cds); err == nil {
		t.Errorf("fetchOrCreateByIdent: db error should error")
	}

	// non-DbDataSource should error
	nds := rrd.NewDataSource(*DftDSSPec)
	db.fakeErr = false
	db.nondb = true
	db.returnDss = []rrd.DataSourcer{nds}
	d = newDsCache(db, df, dsf)
	cds = d.getByIdentOrCreateEmpty(newCachedIdent(serde.Ident{"name": "foo"}))
	if err := d.fetchOrCreateByIdent(cds); err == nil {
		t.Errorf("fetchOrCreateByIdent: non-DbDataSource should error")
	}
}

func Test_dscache_register(t *testing.T) {
	d := newDsCache(nil, nil, nil)
	d.clstr = &fakeCluster{}

	foo := serde.Ident{"name": "foo"}
	ds := serde.NewDbDataSource(0, foo, 0, 0, rrd.NewDataSource(*DftDSSPec))
	d.register(ds) // not sure what we are testing here...
}

func Test_dscache_cachedDs_Relinquish(t *testing.T) {
	db := &fakeSerde{}
	df := &SimpleDSFinder{DftDSSPec}
	dsf := &fakeDsFlusher{}
	dsc := newDsCache(db, df, dsf)

	foo := serde.Ident{"name": "foo"}
	ds := serde.NewDbDataSource(0, foo, 0, 0, rrd.NewDataSource(*DftDSSPec))
	rds := &distDs{DbDataSourcer: ds, dsc: dsc}

	err := rds.Relinquish()
	if err != nil {
		t.Errorf("rds.Relinquish: err != nil: %v", err)
	}
	if dsf.called != 0 {
		t.Errorf("if lastupdate is zero, ds should not be flushed")
	}

	ds.ProcessDataPoint(123, time.Unix(1000, 0))
	err = rds.Relinquish()
	if err != nil {
		t.Errorf("rds.Relinquish (2): err != nil: %v", err)
	}
	if dsf.called != 0 {
		t.Errorf("if lastupdate is not zero but there is no rds in cache, ds should not be flushed")
	}

	// test Acquire while we're at it
	dsf.called = 0
	err = rds.Acquire()
	if err != nil {
		t.Errorf("Acquire: err != nil")
	}
	if dsf.called != 0 {
		t.Errorf("Acquire: should not call flush")
	}

	// receiverDs methods
	if rds.Type() != "DataSource" {
		t.Errorf(`rds.Type() != "DataSource"`)
	}

	if rds.GetName() != foo.String() {
		t.Errorf(`rds.GetName() != foo.String(): %v`, rds.GetName())
	}

	if rds.Id() != 0 {
		t.Errorf("id should be 0")
	}
}


text:
package es.bsc.compss.types.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Processor {

    /**
     * Returns the required processor computing units for the resource to run the CE.
     *
     * @return the required processor name to run the CE.
     */
    String computingUnits() default Constants.UNASSIGNED;

    /**
     * Returns the required processor name for the resource to run the CE.
     *
     * @return the required processor name to run the CE.
     */
    String name() default Constants.UNASSIGNED;

    /**
     * Returns the processor speed required for the resource to run the CE.
     *
     * @return the required processor speed to run the CE.
     */
    String speed() default Constants.UNASSIGNED;

    /**
     * Returns the required processor architecture for the resource to run the CE.
     *
     * @return the required architecture for the processor to run the CE.
     */
    String architecture() default Constants.UNASSIGNED;

    /**
     * Returns the required processor type for the resource to run the CE.
     *
     * @return the required type for the processor to run the CE.
     */
    String type() default Constants.UNASSIGNED;

    /**
     * Returns the processor internal memory required for the resource to run the CE.
     *
     * @return the required processor internal memory to run the CE.
     */
    String internalMemorySize() default Constants.UNASSIGNED;

    /**
     * Returns the name of the processor property required for the resource to run the CE.
     *
     * @return the name of the required processor property to run the CE.
     */
    String propertyName() default Constants.UNASSIGNED;

    /**
     * Returns the value of the processor property required for the resource to run the CE.
     *
     * @return the value of the required processor property to run the CE.
     */
    String propertyValue() default Constants.UNASSIGNED;
}


text:
Connect to MongoDB with using PLAIN auth mechanism
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_PLAIN"); ?>
<?php CLEANUP(STANDALONE_PLAIN) ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

$username = "root";
$password = "toor";
$database = "admin";

$parsed = parse_url(STANDALONE_PLAIN);
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
$adminmanager = new MongoDB\Driver\Manager($dsn);

$cmd = array(
    "createUser" => "bugs",
    "roles" => array(array("role" => "readWrite", "db" => DATABASE_NAME)),
);
$command = new MongoDB\Driver\Command($cmd);
try {
    $result = $adminmanager->executeCommand('$external', $command);
    echo "User Created\n";
} catch(Exception $e) {
    echo $e->getMessage(), "\n";
}

$username = "bugs";
$password = "password";
$database = '$external';

$dsn = sprintf("mongodb://%s:%s@%s:%d/%s?authMechanism=PLAIN", $username, $password, $parsed["host"], $parsed["port"], $database);
$manager = new MongoDB\Driver\Manager($dsn);

$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array("very" => "important"));
try {
    $manager->executeBulkWrite(NS, $bulk);
    $query = new MongoDB\Driver\Query(array("very" => "important"));
    $cursor = $manager->executeQuery(NS, $query);
    foreach($cursor as $document) {
        var_dump($document->very);
    }
    $cmd = new MongoDB\Driver\Command(array("drop" => COLLECTION_NAME));
    $result = $manager->executeCommand(DATABASE_NAME, $cmd);
} catch(Exception $e) {
    printf("Caught %s: %s\n", get_class($e), $e->getMessage());
}
$cmd = array(
    "dropUser" => "bugs",
);
$command = new MongoDB\Driver\Command($cmd);
try {
    $result = $adminmanager->executeCommand('$external', $command);
    echo "User deleted\n";
} catch(Exception $e) {
    echo $e->getMessage(), "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
User Created
string(9) "important"
User deleted
===DONE===


text:
layout: default
---

Intentでオブジェクトを渡す
--------------------------

Intentでオブジェクトを渡すにはjava.io.Serializableインタフェースをimplementsする。

ArrayListやHashMapはSerializable。なのでintentにsetすることが可能。
http://java.sun.com/j2se/1.3/docs/api/java/util/HashMap.html
http://java.sun.com/j2se/1.3/docs/api/java/util/ArrayList.html

ただし、HashMapやArrayListにputやaddされるデータもSerializableである必要がある。


text:
using namespace delta;

Value* IRGenerator::emitVarExpr(const VarExpr& expr) {
    return getValue(expr.getDecl());
}

Value* IRGenerator::emitStringLiteralExpr(const StringLiteralExpr& expr) {
    if (expr.getType().removeOptional().isPointerType() && expr.getType().removeOptional().getPointee().isChar()) {
        return createGlobalStringPtr(expr.getValue());
    }

    auto* stringPtr = createGlobalStringPtr(expr.getValue());
    auto* size = createConstantInt(Type::getInt(), expr.getValue().size());
    auto* alloca = createEntryBlockAlloca(BasicType::get("string", {}), "__str");
    Function* stringConstructor = nullptr;

    for (auto* decl : Module::getStdlibModule()->getSymbolTable().find("string.init")) {
        auto params = llvm::cast<ConstructorDecl>(decl)->getParams();
        if (params.size() == 2 && params[0].getType().isPointerType() && params[1].getType().isInt()) {
            stringConstructor = getFunction(*llvm::cast<ConstructorDecl>(decl));
            break;
        }
    }

    ASSERT(stringConstructor);
    createCall(stringConstructor, { alloca, stringPtr, size }, nullptr);
    return alloca;
}

Value* IRGenerator::emitCharacterLiteralExpr(const CharacterLiteralExpr& expr) {
    return createConstantInt(expr.getType(), expr.getValue());
}

Value* IRGenerator::emitIntLiteralExpr(const IntLiteralExpr& expr) {
    // Integer literals may be typed as floating-point when used in a context
    // that requires a floating-point value. It might make sense to combine
    // IntLiteralExpr and FloatLiteralExpr into a single class.
    if (expr.getType().isFloatingPoint()) {
        return createConstantFP(expr.getType(), expr.getValue().roundToDouble());
    }

    return createConstantInt(expr.getType(), expr.getValue());
}

Value* IRGenerator::emitFloatLiteralExpr(const FloatLiteralExpr& expr) {
    return createConstantFP(expr.getType(), expr.getValue());
}

Value* IRGenerator::emitBoolLiteralExpr(const BoolLiteralExpr& expr) {
    return createConstantBool(expr.getValue());
}

Value* IRGenerator::emitNullLiteralExpr(const NullLiteralExpr& expr) {
    if (expr.getType().isImplementedAsPointer()) {
        return createConstantNull(expr.getType());
    } else {
        return emitOptionalConstruction(expr.getType().getWrappedType(), nullptr);
    }
}

Value* IRGenerator::emitOptionalConstruction(Type wrappedType, Expr* arg) {
    auto* decl = Module::getStdlibModule()->getSymbolTable().findOne("Optional");
    auto typeTemplate = llvm::cast<TypeTemplate>(decl);
    auto typeDecl = typeTemplate->instantiate(wrappedType);
    Function* optionalConstructor = nullptr;

    for (auto* constructor : typeDecl->getConstructors()) {
        if (constructor->getParams().size() == (arg ? 1 : 0)) {
            optionalConstructor = getFunction(*constructor);
            break;
        }
    }

    ASSERT(optionalConstructor);
    auto* alloca = createEntryBlockAlloca(typeDecl->getType());
    llvm::SmallVector<Value*, 2> args;
    args.push_back(alloca);
    if (arg) args.push_back(emitExprForPassing(*arg, optionalConstructor->params[1].getType()));
    createCall(optionalConstructor, args, nullptr);
    return alloca;
}

Value* IRGenerator::emitUndefinedLiteralExpr(const UndefinedLiteralExpr& expr) {
    return createUndefined(expr.getType());
}

Value* IRGenerator::emitArrayLiteralExpr(const ArrayLiteralExpr& expr) {
    Value* array = createUndefined(expr.getType());
    auto index = 0;

    for (auto& element : expr.getElements()) {
        auto* value = emitExpr(*element);
        array = createInsertValue(array, value, index++);
    }

    return array;
}

Value* IRGenerator::emitTupleExpr(const TupleExpr& expr) {
    Value* tuple = createUndefined(expr.getType());
    int index = 0;
    for (auto& element : expr.getElements()) {
        tuple = createInsertValue(tuple, emitExpr(*element.getValue()), index++);
    }
    return tuple;
}

Value* IRGenerator::emitImplicitNullComparison(Value* operand, BinaryOperator op) {
    return createBinaryOp(op, operand, createConstantNull(operand->getType()), nullptr);
}

Value* IRGenerator::emitNot(const UnaryExpr& expr) {
    auto* operand = emitExpr(expr.getOperand());
    if (operand->getType()->isPointerType()) {
        return emitImplicitNullComparison(operand, Token::Equal);
    }
    return createNot(operand);
}

Value* IRGenerator::emitUnaryExpr(const UnaryExpr& expr) {
    switch (expr.getOperator()) {
        case Token::Plus:
            return emitExpr(expr.getOperand());
        case Token::Minus:
            return createNeg(emitExpr(expr.getOperand()));
        case Token::Star: {
            auto operand = emitExpr(expr.getOperand());
            if (auto load = llvm::dyn_cast<LoadInst>(operand)) {
                load->expr = &expr;
            }
            return operand;
        }
        case Token::And:
            return emitExprAsPointer(expr.getOperand());
        case Token::Not:
            // FIXME: Temporary hack. Lower implicit null checks such as `if (ptr)` and `if (!ptr)` when expression lowering is implemented.
            if (expr.getOperand().getType().isOptionalType() && !expr.getOperand().getType().getWrappedType().isPointerType()) {
                auto operand = emitExpr(expr.getOperand());
                auto hasValue = createExtractValue(operand, optionalHasValueFieldIndex);
                return createNot(hasValue);
            }
            LLVM_FALLTHROUGH;
        case Token::Tilde:
            return emitNot(expr);
        case Token::Increment:
            return emitConstantIncrement(expr, 1);
        case Token::Decrement:
            return emitConstantIncrement(expr, -1);
        default:
            llvm_unreachable("invalid prefix operator");
    }
}

// TODO: Lower increment and decrement statements to compound assignments so this isn't needed.
Value* IRGenerator::emitConstantIncrement(const UnaryExpr& expr, int increment) {
    auto operandType = expr.getOperand().getType();
    auto* ptr = emitLvalueExpr(expr.getOperand());
    if (operandType.isPointerType() && llvm::isa<AllocaInst>(ptr)) {
        ptr = createLoad(ptr);
    }
    auto* value = createLoad(ptr);
    Value* result;

    if (value->getType()->isInteger()) {
        result = createBinaryOp(Token::Plus, value, createConstantInt(value->getType(), increment), &expr);
    } else if (value->getType()->isPointerType()) {
        result = createGEP(value, { createConstantInt(Type::getInt(), increment) });
    } else if (value->getType()->isFloatingPoint()) {
        result = createBinaryOp(Token::Plus, value, createConstantFP(value->getType(), increment), &expr);
    } else {
        llvm_unreachable("unknown increment/decrement operand type");
    }

    createStore(result, ptr);
    return nullptr;
}

Value* IRGenerator::emitLogicalAnd(const Expr& left, const Expr& right) {
    auto* rhsBlock = new BasicBlock("and.rhs", insertBlock->parent);
    auto* endBlock = new BasicBlock("and.end");

    Value* lhs = emitExpr(left);
    createCondBr(lhs, rhsBlock, endBlock, lhs);

    setInsertPoint(rhsBlock);
    Value* rhs = emitExpr(right);
    createBr(endBlock, rhs);

    setInsertPoint(endBlock);
    endBlock->parameter = new Parameter { ValueKind::Parameter, lhs->getType(), "and" };
    return endBlock->parameter;
}

Value* IRGenerator::emitLogicalOr(const Expr& left, const Expr& right) {
    auto* rhsBlock = new BasicBlock("or.rhs", insertBlock->parent);
    auto* endBlock = new BasicBlock("or.end");

    Value* lhs = emitExpr(left);
    createCondBr(lhs, endBlock, rhsBlock, lhs);

    setInsertPoint(rhsBlock);
    Value* rhs = emitExpr(right);
    createBr(endBlock, rhs);

    setInsertPoint(endBlock);
    endBlock->parameter = new Parameter { ValueKind::Parameter, lhs->getType(), "or" };
    return endBlock->parameter;
}

Value* IRGenerator::emitBinaryExpr(const BinaryExpr& expr) {
    if (expr.isAssignment()) {
        emitAssignment(expr);
        return nullptr;
    }

    if (expr.getCalleeDecl() != nullptr) {
        return emitCallExpr(expr);
    }

    switch (expr.getOperator()) {
        case Token::AndAnd:
            return emitLogicalAnd(expr.getLHS(), expr.getRHS());

        case Token::OrOr:
            return emitLogicalOr(expr.getLHS(), expr.getRHS());

        default:
            auto left = emitExprOrEnumTag(expr.getLHS(), nullptr);
            auto right = emitExprOrEnumTag(expr.getRHS(), nullptr);

            if (left->getType()->isPointerType() && left->getType()->getPointee()->equals(right->getType())) {
                left = createLoad(left);
            } else if (right->getType()->isPointerType() && right->getType()->getPointee()->equals(left->getType())) {
                right = createLoad(right);
            }

            return createBinaryOp(expr.getOperator(), left, right, &expr);
    }
}

void IRGenerator::emitAssignment(const BinaryExpr& expr) {
    if (expr.getRHS().isUndefinedLiteralExpr()) return;

    auto lvalue = emitAssignmentLHS(expr.getLHS());
    auto rvalue = emitExprForPassing(expr.getRHS(), lvalue->getType()->getPointee());
    createStore(rvalue, lvalue);
}

static bool isBuiltinArrayToArrayRefConversion(Type sourceType, IRType* targetType) {
    return sourceType.removePointer().isArrayWithConstantSize() && targetType->isStruct() && targetType->getName().startswith("ArrayRef<");
}

Value* IRGenerator::emitExprForPassing(const Expr& expr, IRType* targetType) {
    if (!targetType) {
        return emitExpr(expr);
    }

    // TODO: Handle implicit conversions in a separate function.

    if (isBuiltinArrayToArrayRefConversion(expr.getType(), targetType)) {
        ASSERT(expr.getType().removePointer().isArrayWithConstantSize());
        auto* value = emitExprAsPointer(expr);
        auto* elementPtr = createGEP(value, 0);
        auto* arrayRef = createInsertValue(createUndefined(targetType), elementPtr, 0);
        auto size = createConstantInt(Type::getInt(), expr.getType().removePointer().getArraySize());
        return createInsertValue(arrayRef, size, 1);
    }

    // Handle implicit conversions to type 'T[*]'.
    if (expr.getType().removePointer().isArrayWithConstantSize() && targetType->isPointerType() && !targetType->getPointee()->isArrayType()) {
        return createCast(emitLvalueExpr(expr), targetType);
    }

    // Handle implicit conversions to void pointer, and to base type pointer.
    if (expr.getType().isImplementedAsPointer() && targetType->isPointerType()) {
        return createCastIfNeeded(emitExpr(expr), targetType);
    }

    // TODO: Refactor the following.
    auto* value = emitLvalueExpr(expr);

    if (targetType->isPointerType() && value->getType()->equals(targetType->getPointee())) {
        return createTempAlloca(value);
    } else if (value->getType()->isPointerType() && !targetType->equals(value->getType())) {
        value = createLoad(value);
        if (value->getType()->isPointerType() && !targetType->equals(value->getType())) {
            value = createLoad(value);
        }
        return value;
    } else {
        return value;
    }
}

void IRGenerator::emitAssert(Value* condition, const Expr* expr, SourceLocation location, llvm::StringRef message) {
    condition = createIsNull(condition, expr, "assert.condition");
    auto* function = insertBlock->parent;
    auto* failBlock = new BasicBlock("assert.fail", function);
    auto* successBlock = new BasicBlock("assert.success", function);
    auto* assertFail = getFunction(*llvm::cast<FunctionDecl>(Module::getStdlibModule()->getSymbolTable().findOne("assertFail")));
    createCondBr(condition, failBlock, successBlock);
    setInsertPoint(failBlock);
    auto messageAndLocation = llvm::join_items("", message, " at ", llvm::sys::path::filename(location.file), ":", std::to_string(location.line), ":",
                                               std::to_string(location.column), "\n");
    createCall(assertFail, createGlobalStringPtr(messageAndLocation), nullptr);
    createUnreachable();
    setInsertPoint(successBlock);
}

Value* IRGenerator::emitEnumCase(const EnumCase& enumCase, llvm::ArrayRef<NamedValue> associatedValueElements) {
    auto enumDecl = enumCase.getEnumDecl();
    auto tag = emitExpr(*enumCase.getValue());
    if (!enumDecl->hasAssociatedValues()) return tag;

    // TODO: Could reuse variable alloca instead of always creating a new one here.
    auto* enumValue = createEntryBlockAlloca(enumDecl->getType(), "enum");
    createStore(tag, createGEP(enumValue, 0, nullptr, "tag"));

    if (!associatedValueElements.empty()) {
        // TODO: This is duplicated in emitTupleExpr.
        Value* associatedValue = createUndefined(enumCase.getAssociatedType());
        int index = 0;
        for (auto& element : associatedValueElements) {
            associatedValue = createInsertValue(associatedValue, emitExpr(*element.getValue()), index++);
        }
        auto* associatedValuePtr = createCast(createGEP(enumValue, 1, nullptr, "associatedValue"), associatedValue->getType()->getPointerTo());
        createStore(associatedValue, associatedValuePtr);
    }

    return enumValue;
}

Value* IRGenerator::emitCallExpr(const CallExpr& expr, AllocaInst* thisAllocaForInit) {
    if (expr.isBuiltinConversion()) {
        return createCastIfNeeded(emitExpr(*expr.getArgs().front().getValue()), expr.getType());
    }

    if (expr.isBuiltinCast()) {
        return emitBuiltinCast(expr);
    }

    if (expr.getFunctionName() == "assert") {
        emitAssert(emitExpr(*expr.getArgs().front().getValue()), &expr, expr.getCallee().getLocation());
        return nullptr;
    }

    if (auto* enumCase = llvm::dyn_cast_or_null<EnumCase>(expr.getCalleeDecl())) {
        return emitEnumCase(*enumCase, expr.getArgs());
    }

    if (expr.getReceiver() && expr.getReceiverType().removePointer().isArrayType()) {
        if (expr.getFunctionName() == "size") {
            return getArrayLength(*expr.getReceiver(), expr.getReceiverType().removePointer());
        }
        if (expr.getFunctionName() == "iterator") {
            return getArrayIterator(*expr.getReceiver(), expr.getReceiverType().removePointer());
        }
        llvm_unreachable("unknown array member function");
    }

    if (expr.isMoveInit()) {
        auto* receiverValue = emitExpr(*expr.getReceiver());
        auto* argumentValue = emitExpr(*expr.getArgs()[0].getValue());
        createStore(argumentValue, receiverValue);
        return nullptr;
    }

    Value* calleeValue = getFunctionForCall(expr);

    if (!calleeValue) {
        return nullptr;
    }

    std::vector<IRType*> params;

    if (auto* function = llvm::dyn_cast<Function>(calleeValue)) {
        params = map(function->params, [](const Parameter& p) { return p.type; });
    } else {
        if (!calleeValue->getType()->getPointee()->isFunctionType()) {
            calleeValue = createLoad(calleeValue);
        }
        params = calleeValue->getType()->getPointee()->getParamTypes();
    }

    auto param = params.begin();
    llvm::SmallVector<Value*, 16> args;
    auto* calleeDecl = expr.getCalleeDecl();

    if (calleeDecl->isMethodDecl()) {
        if (auto* constructorDecl = llvm::dyn_cast<ConstructorDecl>(calleeDecl)) {
            if (thisAllocaForInit) {
                args.emplace_back(thisAllocaForInit);
            } else if (currentDecl->isConstructorDecl() && expr.getFunctionName() == "init") {
                args.emplace_back(getThis(*param));
            } else {
                args.emplace_back(createEntryBlockAlloca(constructorDecl->getTypeDecl()->getType()));
            }
        } else if (expr.getReceiver()) {
            args.emplace_back(emitExprForPassing(*expr.getReceiver(), *param));
        } else {
            args.emplace_back(getThis());
        }
        ++param;
    }

    for (const auto& arg : expr.getArgs()) {
        auto paramType = param != params.end() ? *param++ : nullptr;
        auto* argValue = emitExprForPassing(*arg.getValue(), paramType);
        ASSERT(!paramType || argValue->getType()->equals(paramType));
        args.push_back(argValue);
    }

    if (calleeDecl->isConstructorDecl()) {
        createCall(calleeValue, args, &expr);
        return args[0];
    } else {
        return createCall(calleeValue, args, &expr);
    }
}

Value* IRGenerator::emitBuiltinCast(const CallExpr& expr) {
    auto* value = emitExpr(*expr.getArgs().front().getValue());
    auto type = expr.getGenericArgs().front();
    return createCast(value, type);
}

Value* IRGenerator::emitSizeofExpr(const SizeofExpr& expr) {
    return createSizeof(expr.getType());
}

Value* IRGenerator::emitAddressofExpr(const AddressofExpr& expr) {
    Value* value = emitExpr(expr.getOperand());
    return createCast(value, Type::getUIntPtr(), "address");
}

Value* IRGenerator::emitMemberAccess(Value* baseValue, const FieldDecl* field, const MemberExpr* expr) {
    auto baseTypeDecl = field->getParentDecl();

    if (baseValue->getType()->isPointerType()) {
        if (baseValue->getType()->getPointee()->isPointerType()) {
            baseValue = createLoad(baseValue);
        }

        if (baseTypeDecl->isUnion()) {
            return createCast(baseValue, field->getType().getPointerTo(), field->getName());
        } else {
            return createGEP(baseValue, baseTypeDecl->getFieldIndex(field), expr, field->getName());
        }
    } else {
        auto index = baseTypeDecl->isUnion() ? 0 : baseTypeDecl->getFieldIndex(field);
        return createExtractValue(baseValue, index, field->getName());
    }
}

Value* IRGenerator::getArrayLength(const Expr& object, Type objectType) {
    if (objectType.isArrayWithRuntimeSize()) {
        return createExtractValue(emitExpr(object), 1, "size");
    } else {
        return createConstantInt(Type::getInt(), objectType.getArraySize());
    }
}

Value* IRGenerator::getArrayIterator(const Expr& object, Type objectType) {
    auto type = BasicType::get("ArrayIterator", objectType.getElementType());
    auto* value = emitExprAsPointer(object);
    auto* elementPtr = createGEP(value, 0);
    auto* size = getArrayLength(object, objectType);
    auto* end = createGEP(elementPtr, { size });
    auto* iterator = createInsertValue(createUndefined(type), elementPtr, 0);
    return createInsertValue(iterator, end, 1);
}

Value* IRGenerator::emitMemberExpr(const MemberExpr& expr) {
    if (auto* enumCase = llvm::dyn_cast_or_null<EnumCase>(expr.getDecl())) {
        return emitEnumCase(*enumCase, {});
    }

    if (expr.getBaseExpr()->getType().removePointer().isTupleType()) {
        return emitTupleElementAccess(expr);
    }

    return emitMemberAccess(emitLvalueExpr(*expr.getBaseExpr()), llvm::cast<FieldDecl>(expr.getDecl()), &expr);
}

Value* IRGenerator::emitTupleElementAccess(const MemberExpr& expr) {
    unsigned index = 0;
    for (auto& element : expr.getBaseExpr()->getType().removePointer().getTupleElements()) {
        if (element.name == expr.getMemberName()) break;
        ++index;
    }

    auto* baseValue = emitLvalueExpr(*expr.getBaseExpr());
    if (baseValue->getType()->isPointerType() && baseValue->getType()->getPointee()->isPointerType()) {
        baseValue = createLoad(baseValue);
    }

    if (baseValue->getType()->isPointerType()) {
        return createGEP(baseValue, index, nullptr, expr.getMemberName());
    } else {
        return createExtractValue(baseValue, index, expr.getMemberName());
    }
}

Value* IRGenerator::emitIndexedAccess(const Expr& base, const Expr& index) {
    auto* value = emitLvalueExpr(base);

    if (base.getType().isArrayWithRuntimeSize()) {
        if (value->getType()->isPointerType()) {
            value = createLoad(value);
        }
        value = createExtractValue(value, 0);
        return createGEP(value, { emitExpr(index) });
    } else {
        if (value->getType()->isPointerType() && value->getType()->getPointee()->isPointerType() &&
            value->getType()->getPointee()->equals(getIRType(base.getType()))) {
            value = createLoad(value);
        }

        if (base.getType().removeOptional().isArrayWithUnknownSize()) {
            return createGEP(value, { emitExpr(index) });
        } else {
            return createGEP(value, { createConstantInt(Type::getInt(), 0), emitExpr(index) });
        }
    }
}

Value* IRGenerator::emitIndexExpr(const IndexExpr& expr) {
    if (!expr.getBase()->getType().removeOptional().removePointer().isArrayType()) {
        return emitCallExpr(expr);
    }

    return emitIndexedAccess(*expr.getBase(), *expr.getIndex());
}

Value* IRGenerator::emitIndexAssignmentExpr(const IndexAssignmentExpr& expr) {
    if (!expr.getBase()->getType().removeOptional().removePointer().isArrayType()) {
        return emitCallExpr(expr);
    }

    auto gep = emitIndexedAccess(*expr.getBase(), *expr.getIndex());
    createStore(emitExpr(*expr.getValue()), gep);
    return nullptr;
}

Value* IRGenerator::emitUnwrapExpr(const UnwrapExpr& expr) {
    auto* value = emitExpr(expr.getOperand());
    llvm::StringRef message = "Unwrap failed";

    if (expr.getOperand().getType().isImplementedAsPointer()) {
        emitAssert(value, &expr, expr.getLocation(), message);
        return value;
    } else {
        emitAssert(createExtractValue(value, optionalHasValueFieldIndex), &expr, expr.getLocation(), message);
        return createExtractValue(value, optionalValueFieldIndex);
    }
}

Value* IRGenerator::emitLambdaExpr(const LambdaExpr& expr) {
    auto functionDecl = expr.getFunctionDecl();

    auto insertBlockBackup = insertBlock;
    auto scopesBackup = std::move(scopes);

    emitDecl(*functionDecl);

    scopes = std::move(scopesBackup);
    if (insertBlockBackup) setInsertPoint(insertBlockBackup);

    VarExpr varExpr(functionDecl->getName().str(), functionDecl->getLocation());
    varExpr.setDecl(functionDecl);
    varExpr.setType(expr.getType());
    return emitVarExpr(varExpr);
}

Value* IRGenerator::emitIfExpr(const IfExpr& expr) {
    auto* condition = emitExpr(*expr.getCondition());
    if (condition->getType()->isPointerType()) {
        condition = emitImplicitNullComparison(condition);
    }
    auto* function = currentFunction;
    auto* thenBlock = new BasicBlock("if.then", function);
    auto* elseBlock = new BasicBlock("if.else");
    auto* endIfBlock = new BasicBlock("if.end");
    createCondBr(condition, thenBlock, elseBlock);

    setInsertPoint(thenBlock);
    auto* thenValue = emitExpr(*expr.getThenExpr());
    createBr(endIfBlock, thenValue);

    setInsertPoint(elseBlock);
    auto* elseValue = emitExpr(*expr.getElseExpr());
    createBr(endIfBlock, elseValue);

    setInsertPoint(endIfBlock);
    endIfBlock->parameter = new Parameter { ValueKind::Parameter, thenValue->getType(), "if.result" };
    return endIfBlock->parameter;
}

Value* IRGenerator::emitImplicitCastExpr(const ImplicitCastExpr& expr) {
    if (expr.getType().isOptionalType()) {
        if (expr.getType().getWrappedType().isImplementedAsPointer()) {
            return emitExpr(*expr.getOperand());
        } else {
            return emitOptionalConstruction(expr.getOperand()->getType(), expr.getOperand());
        }
    }

    llvm_unreachable("all implicit cast variations handled");
}

Value* IRGenerator::emitPlainExpr(const Expr& expr) {
    if (expr.isConstant() && expr.getType().isInteger()) {
        return createConstantInt(expr.getType(), expr.getConstantIntegerValue());
    }

    switch (expr.getKind()) {
        case ExprKind::VarExpr:
            return emitVarExpr(llvm::cast<VarExpr>(expr));
        case ExprKind::StringLiteralExpr:
            return emitStringLiteralExpr(llvm::cast<StringLiteralExpr>(expr));
        case ExprKind::CharacterLiteralExpr:
            return emitCharacterLiteralExpr(llvm::cast<CharacterLiteralExpr>(expr));
        case ExprKind::IntLiteralExpr:
            return emitIntLiteralExpr(llvm::cast<IntLiteralExpr>(expr));
        case ExprKind::FloatLiteralExpr:
            return emitFloatLiteralExpr(llvm::cast<FloatLiteralExpr>(expr));
        case ExprKind::BoolLiteralExpr:
            return emitBoolLiteralExpr(llvm::cast<BoolLiteralExpr>(expr));
        case ExprKind::NullLiteralExpr:
            return emitNullLiteralExpr(llvm::cast<NullLiteralExpr>(expr));
        case ExprKind::UndefinedLiteralExpr:
            return emitUndefinedLiteralExpr(llvm::cast<UndefinedLiteralExpr>(expr));
        case ExprKind::ArrayLiteralExpr:
            return emitArrayLiteralExpr(llvm::cast<ArrayLiteralExpr>(expr));
        case ExprKind::TupleExpr:
            return emitTupleExpr(llvm::cast<TupleExpr>(expr));
        case ExprKind::UnaryExpr:
            return emitUnaryExpr(llvm::cast<UnaryExpr>(expr));
        case ExprKind::BinaryExpr:
            return emitBinaryExpr(llvm::cast<BinaryExpr>(expr));
        case ExprKind::CallExpr:
            return emitCallExpr(llvm::cast<CallExpr>(expr));
        case ExprKind::SizeofExpr:
            return emitSizeofExpr(llvm::cast<SizeofExpr>(expr));
        case ExprKind::AddressofExpr:
            return emitAddressofExpr(llvm::cast<AddressofExpr>(expr));
        case ExprKind::MemberExpr:
            return emitMemberExpr(llvm::cast<MemberExpr>(expr));
        case ExprKind::IndexExpr:
            return emitIndexExpr(llvm::cast<IndexExpr>(expr));
        case ExprKind::IndexAssignmentExpr:
            return emitIndexAssignmentExpr(llvm::cast<IndexAssignmentExpr>(expr));
        case ExprKind::UnwrapExpr:
            return emitUnwrapExpr(llvm::cast<UnwrapExpr>(expr));
        case ExprKind::LambdaExpr:
            return emitLambdaExpr(llvm::cast<LambdaExpr>(expr));
        case ExprKind::IfExpr:
            return emitIfExpr(llvm::cast<IfExpr>(expr));
        case ExprKind::ImplicitCastExpr:
            return emitImplicitCastExpr(llvm::cast<ImplicitCastExpr>(expr));
    }
    llvm_unreachable("all cases handled");
}

Value* IRGenerator::emitExpr(const Expr& expr) {
    auto* value = emitLvalueExpr(expr);

    if (value && value->getType()->isPointerType() && value->getType()->getPointee()->equals(getIRType(expr.getType()))) {
        return createLoad(value);
    }

    return value;
}

Value* IRGenerator::emitExprAsPointer(const Expr& expr) {
    auto* value = emitLvalueExpr(expr);
    if (!value->getType()->isPointerType()) {
        value = createTempAlloca(value);
    }
    return value;
}

Value* IRGenerator::emitExprOrEnumTag(const Expr& expr, Value** enumValue) {
    if (auto* memberExpr = llvm::dyn_cast<MemberExpr>(&expr)) {
        if (auto* enumCase = llvm::dyn_cast_or_null<EnumCase>(memberExpr->getDecl())) {
            return emitExpr(*enumCase->getValue());
        }
    }

    if (auto* enumDecl = llvm::dyn_cast_or_null<EnumDecl>(expr.getType().getDecl())) {
        if (enumDecl->hasAssociatedValues()) {
            auto* value = emitLvalueExpr(expr);
            if (enumValue) *enumValue = value;
            return createLoad(createGEP(value, 0, nullptr, value->getName() + ".tag"));
        }
    }

    return emitExpr(expr);
}

Value* IRGenerator::emitLvalueExpr(const Expr& expr) {
    auto value = emitPlainExpr(expr);

    // Handle optionals that have been implicitly unwrapped due to data-flow analysis.
    if (expr.hasAssignableType() && expr.getAssignableType().isOptionalType() && !expr.getAssignableType().getWrappedType().isPointerType() &&
        expr.getType() == expr.getAssignableType().getWrappedType()) {
        return createGEP(value, optionalValueFieldIndex);
    }

    if (value && expr.hasType()) {
        auto type = getIRType(expr.getType());

        // TODO: Why only FP and integers are cast here?
        if (!type->equals(value->getType()) && (value->getType()->isFloatingPoint() || value->getType()->isInteger())) {
            return createCast(value, type);
        }
    }

    return value;
}

void IRGenerator::setInsertPoint(BasicBlock* block) {
    if (!block->parent) {
        currentFunction->body.push_back(block);
        block->parent = currentFunction;
    }

    insertBlock = block;
}


text:
//
//  BCPay.h
//  BeeCloud
//
//  Created by 健峰 高 on 14-7-29.
//  Copyright (c) 2014年 BeeCloud Inc. All rights reserved.
//

#import <StoreKit/StoreKit.h>

#import "BCConstants.h"

/**
 *  BCPay framework provides handy APIs for in-app purchase, and other payment options to come.
 */
@interface BCPay : NSObject<SKProductsRequestDelegate>

/**
 *  The product list obtained from app store, initiated by initProducts.
 */
@property (nonatomic, strong) NSArray *products;

/**
 *  Failed init productIds.
 */
@property (nonatomic, strong) NSArray *failedIds;

/**
 *  Get instance of BCPay.
 *
 *  @return instance of BCPay.
 */
+ (instancetype)sharedInstance;

/**
 *  Init products.
 *
 *  @param productIds all products app may use.
 *  @param block the block could be nil for just keep the products in @products,
    or you can do some init job for in-app store init in the block.
 */
- (void)initProducts:(NSArray *)productIds withBlock:(BCProductBlock)block;

/**
 *  Set the appUserName, this would help to Detecting Irregular Activity.
 *
 *  @param userName application user name, username in your account system, should
    be unique for each user.
 */
- (void)setUserName:(NSString *)userName;

/**
 *  Purchase a product.
 *
 *  @param product product need to purchase.
 *  @param block   block deal with the purchase result, this should not be null.
    Remind if user buy a product twice, and the first transaction is not finished,
    the second one will be ignored.
 */
- (void)purchase:(SKProduct *)product withBlock:(BCPurchaseBlock)block;

/**
 *  Purchase a product.
 *
 *  @param productId productId need to purchase.
 *  @param block   block deal with the purchase result, this should not be null.
 Remind if user buy a product twice, and the first transaction is not finished,
 the second one will be ignored.
 */
- (void)purchaseWithId:(NSString *)productId withBlock:(BCPurchaseBlock)block;

/**
 *  Restore, for each transaction restored, if transaction.productId in productIds,
    do @BCPurchaseBlock(productId, stateRestored, nil).
 *
 *  @param productIds products need to be restored
 *  @param block      block deal with the restore callback
 */
- (void)restore:(NSArray *)productIds withBlock:(BCPurchaseBlock)block;

/**
 *  Delegate method in SKProductsRequestDelegate for requestion products.
 *
 *  @param request  request for retrieving product info.
 *  @param response response of this request.
 */
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response;

/**
 *  Init product list error delegate.
 *
 *  @param request Init product request
 *  @param error   error
 */
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error;

/**
 *  A method to get a product entity by productId
 *
 *  @param productId
 *
 *  @return product entity
 */
- (SKProduct *)getProductById:(NSString *)productId;

@end


text:
package io.cdap.directives.column;

import io.cdap.cdap.api.annotation.Description;
import io.cdap.cdap.api.annotation.Name;
import io.cdap.cdap.api.annotation.Plugin;
import io.cdap.wrangler.api.Arguments;
import io.cdap.wrangler.api.Directive;
import io.cdap.wrangler.api.DirectiveExecutionException;
import io.cdap.wrangler.api.ExecutorContext;
import io.cdap.wrangler.api.Row;
import io.cdap.wrangler.api.annotations.Categories;
import io.cdap.wrangler.api.lineage.Lineage;
import io.cdap.wrangler.api.lineage.Mutation;
import io.cdap.wrangler.api.parser.ColumnName;
import io.cdap.wrangler.api.parser.TokenType;
import io.cdap.wrangler.api.parser.UsageDefinition;
import io.cdap.wrangler.utils.ColumnConverter;

import java.util.List;

/**
 * A directive for renaming columns.
 */
@Plugin(type = Directive.TYPE)
@Name(Rename.NAME)
@Categories(categories = { "column"})
@Description("Renames a column 'source' to 'target'")
public final class Rename implements Directive, Lineage {
  public static final String NAME = "rename";
  private ColumnName source;
  private ColumnName target;

  @Override
  public UsageDefinition define() {
    UsageDefinition.Builder builder = UsageDefinition.builder(NAME);
    builder.define("source", TokenType.COLUMN_NAME);
    builder.define("target", TokenType.COLUMN_NAME);
    return builder.build();
  }

  @Override
  public void initialize(Arguments args) {
    source = args.value("source");
    if (args.contains("target")) {
      target = args.value("target");
    }
  }

  @Override
  public void destroy() {
    // no-op
  }

  @Override
  public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException {
    for (Row row : rows) {
      ColumnConverter.rename(NAME, row, source.value(), target.value());
    }
    return rows;
  }

  @Override
  public Mutation lineage() {
    return Mutation.builder()
      .readable("Renamed column '%s' to '%s'", source.value(), target.value())
      .relation(source, target)
      .build();
  }
}


text:
package com.intellij.ide.util.treeView;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.psi.PsiDocumentManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public abstract class AbstractTreeStructure {
  public abstract Object getRootElement();
  public abstract Object[] getChildElements(Object element);
  @Nullable
  public abstract Object getParentElement(Object element);

  @NotNull
  public abstract NodeDescriptor createDescriptor(Object element, NodeDescriptor parentDescriptor);

  public abstract void commit();
  public abstract boolean hasSomethingToCommit();

  @NotNull
  public static ActionCallback asyncCommitDocuments(@NotNull Project project) {
    if (project.isDisposed()) return ActionCallback.DONE;
    PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
    if (!documentManager.hasUncommitedDocuments()) {
      return ActionCallback.DONE;
    }
    final ActionCallback callback = new ActionCallback();
    documentManager.performWhenAllCommitted(callback.createSetDoneRunnable());
    return callback;
  }

  /**
   * @return callback which is set to {@link ActionCallback#setDone()} when the tree structure is committed.
   * By default it just calls {@link #commit()} synchronously but it is desirable to override it
   * to provide asynchronous commit to the tree structure to make it more responsible.
   * E.g. when you should commit all documents during the {@link #commit()},
   * you can use {@link #asyncCommitDocuments(Project)} to do it asynchronously.
   */
  @NotNull
  public ActionCallback asyncCommit() {
    if (hasSomethingToCommit()) commit();
    return ActionCallback.DONE;
  }

  public boolean isToBuildChildrenInBackground(Object element){
    return false;
  }

  public boolean isValid(Object element) {
    return true;
  }

  public boolean isAlwaysLeaf(Object element) {
    return false;
  }

  public AsyncResult<Object> revalidateElement(Object element) {
    return AsyncResult.done(element);
  }
}


text:
Acknowledgements
----------------

The Braintree SDK uses code from the following libraries:

* [phpunit](https://github.com/sebastianbergmann/phpunit), BSD-3-Clause License


text:
ActiveRecord::Schema.define(version: 20131109084457) do

  create_table "accounts", force: true do |t|
    t.integer  "user_id"
    t.integer  "currency_id"
    t.decimal  "balance"
    t.decimal  "balance_available"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "accounts", ["user_id", "currency_id"], name: "IX_ACCOUNTS_1", unique: true

  create_table "announcements", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "currencies", force: true do |t|
    t.string   "name"
    t.string   "long_name"
    t.boolean  "process_deposits"
    t.boolean  "allow_withdrawals"
    t.boolean  "process_orders"
    t.decimal  "deposit_min_amount"
    t.decimal  "deposit_max_daily_amount"
    t.decimal  "withdrawal_max_daily_amount"
    t.decimal  "fee"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "currencies", ["name"], name: "index_currencies_on_name", unique: true

  create_table "deposits", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "gacodes", force: true do |t|
    t.integer  "user_id"
    t.string   "code"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "gacodes", ["user_id"], name: "index_gacodes_on_user_id"

  create_table "gausers", force: true do |t|
    t.integer  "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "gausers", ["user_id"], name: "index_gausers_on_user_id"

  create_table "logindetails", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "oldorders", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "orderexecutions", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "orders", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "parameters", force: true do |t|
    t.string   "paramname"
    t.string   "paramvalue"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "parameters", ["paramname"], name: "index_parameters_on_paramname", unique: true

  create_table "trxhistories", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "users", force: true do |t|
    t.string   "email"
    t.string   "language"
    t.string   "password_digest"
    t.string   "activation_token"
    t.datetime "active_since"
    t.boolean  "is_locked"
    t.string   "reset_token"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "users", ["activation_token"], name: "index_users_on_activation_token"
  add_index "users", ["email"], name: "index_users_on_email", unique: true
  add_index "users", ["reset_token"], name: "index_users_on_reset_token"

  create_table "withdrawals", force: true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
package network

import "github.com/docker/docker/pkg/nat"

// Address represents an IP address
type Address struct {
	Addr      string
	PrefixLen int
}

// Settings stores configuration details about the daemon network config
// TODO Windows. Many of these fields can be factored out.,
type Settings struct {
	Bridge                 string
	EndpointID             string
	SandboxID              string
	Gateway                string
	GlobalIPv6Address      string
	GlobalIPv6PrefixLen    int
	HairpinMode            bool
	IPAddress              string
	IPPrefixLen            int
	IPv6Gateway            string
	LinkLocalIPv6Address   string
	LinkLocalIPv6PrefixLen int
	MacAddress             string
	Networks               []string
	Ports                  nat.PortMap
	SandboxKey             string
	SecondaryIPAddresses   []Address
	SecondaryIPv6Addresses []Address
}


text:
singleton GFXStateBlockData( PFX_TurbulenceStateBlock : PFX_DefaultStateBlock)
{
   zDefined = false;
   zEnable = false;
   zWriteEnable = false;

   samplersDefined = true;
   samplerStates[0] = SamplerClampLinear;
};

singleton ShaderData( PFX_TurbulenceShader )
{
   DXVertexShaderFile 	= "shaders/common/postFx/postFxV.hlsl";
   DXPixelShaderFile 	= "shaders/common/postFx/turbulenceP.hlsl";

   pixVersion = 3.0;
};

singleton PostEffect( TurbulenceFx )
{
   isEnabled = false;
   allowReflectPass = true;

   renderTime = "PFXAfterBin";
   renderBin = "GlowBin";
   renderPriority = 0.5; // Render after the glows themselves

   shader = PFX_TurbulenceShader;
   stateBlock=PFX_TurbulenceStateBlock;
   texture[0] = "$backBuffer";
 };


text:
package com.b2international.snowowl.snomed.datastore.index.taxonomy;

import java.util.Arrays;
import java.util.Collection;
import java.util.function.Supplier;

import com.b2international.collections.PrimitiveLists;
import com.b2international.collections.PrimitiveSets;
import com.b2international.collections.ints.IntSet;
import com.b2international.collections.longs.AbstractLongIterator;
import com.b2international.collections.longs.LongCollection;
import com.b2international.collections.longs.LongIterator;
import com.b2international.collections.longs.LongList;
import com.b2international.collections.longs.LongSet;

/**
 * Stores sets of SCTIDs in integer form, using an {@link InternalIdMap} as the
 * mapping between SCTIDs and integers.
 *
 * @since 7.0
 */
public final class InternalSctIdSet implements IInternalSctIdSet {

	public static final Builder builder(final InternalIdMap internalIdMap) {
		return new Builder(internalIdMap);
	}

	public static final class Builder {

		private final InternalIdMap internalIdMap;
		private final IntSet internalIds = PrimitiveSets.newIntOpenHashSet();

		public Builder(final InternalIdMap internalIdMap) {
			this.internalIdMap = internalIdMap;
		}

		public Builder addAll(final Collection<String> sctIds) {
			final LongSet longSctIds = PrimitiveSets.newLongOpenHashSetWithExpectedSize(sctIds.size());

			sctIds.stream()
			.map(Long::parseLong)
			.forEachOrdered(longSctIds::add);

			return addAll(longSctIds);
		}

		public Builder addAll(final LongSet sctIdsToAdd) {
			for (final LongIterator itr = sctIdsToAdd.iterator(); itr.hasNext(); /*empty*/) {
				final long sctId = itr.next();
				final int internalId = internalIdMap.getInternalId(sctId);
				internalIds.add(internalId);
			}

			return this;
		}

		public InternalSctIdSet build() {
			final int[] internalIdArray = internalIds.toArray();
			Arrays.sort(internalIdArray);
			return new InternalSctIdSet(internalIdMap, internalIdArray);
		}
	}

	private final InternalIdMap internalIdMap;
	private final int[] internalIdArray;

	private InternalSctIdSet(final InternalIdMap internalIdMap, final int[] internalIdArray) {
		this.internalIdMap = internalIdMap;
		this.internalIdArray = internalIdArray;
	}

	@Override
	public boolean contains(final String sctId) {
		return contains(Long.parseLong(sctId));
	}

	@Override
	public boolean contains(final long sctId) {
		final int internalId = internalIdMap.getInternalId(sctId);

		if (InternalIdMap.NO_INTERNAL_ID == internalId) {
			return false;
		} else {
			return Arrays.binarySearch(internalIdArray, internalId) >= 0;
		}
	}

	@Override
	public LongList toLongList() {
		return toLongCollection(() -> PrimitiveLists.newLongArrayListWithExpectedSize(size()));
	}

	private <T extends LongCollection> T toLongCollection(final Supplier<T> collectionSupplier) {
		final T result = collectionSupplier.get();

		for (final LongIterator itr = iterator(); itr.hasNext(); /*empty*/) {
			result.add(itr.next());
		}

		return result;
	}

	@Override
	public LongIterator iterator() {
		return new AbstractLongIterator() {
			private int i = 0;

			@Override
			protected long computeNext() {
				if (i < internalIdArray.length) {
					return internalIdMap.getSctId(internalIdArray[i++]);
				} else {
					return endOfData();
				}
			}
		};
	}

	@Override
	public int size() {
		return internalIdArray.length;
	}

	@Override
	public boolean isEmpty() {
		return size() == 0;
	}
}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class Hierarchy (program6 1.0 API)</title>
<meta name="date" content="2017-04-19">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For All Packages

Package Hierarchies:

edu.uniandes.ecos.PSP2.App,

edu.uniandes.ecos.PSP2.Business,

edu.uniandes.ecos.PSP2.Entities,

edu.uniandes.ecos.PSP2.Interfaces

Class Hierarchy

java.lang.Object

edu.uniandes.ecos.PSP2.App.App

edu.uniandes.ecos.PSP2.App.Controller (implements edu.uniandes.ecos.PSP2.Interfaces.IController)

edu.uniandes.ecos.PSP2.Business.Gamma

edu.uniandes.ecos.PSP2.Business.SearchAlgorithm

edu.uniandes.ecos.PSP2.Business.SimpsonRule

edu.uniandes.ecos.PSP2.Entities.SimpsonRuleInfo

edu.uniandes.ecos.PSP2.App.View (implements edu.uniandes.ecos.PSP2.Interfaces.IView)

Interface Hierarchy

edu.uniandes.ecos.PSP2.Interfaces.IController

edu.uniandes.ecos.PSP2.Interfaces.IView

Enum Hierarchy

java.lang.Object

java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)

edu.uniandes.ecos.PSP2.Entities.OperationCode

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2017. All rights reserved.


text:
create table t1 (i1 integer);

insert into t1 values (1),(2),(3),(2),(2),(6),(7),(3);
select * from t1 order by i1;

delete from t1 where i1=1 limit 1;
select * from t1 order by i1  limit 5;

delete from t1 where i1 > 6 limit 1;
select * from t1 order by i1 limit 5;

delete from t1 where inst_num() < 2 limit 2;
select * from t1 order by i1 limit 5;

delete from t1  where current of a limit 2;
select * from t1 order by i1 limit 5;

drop table t1;


text:
<?php
session_start(); // Permet de reutiliser du PHP dans une autre page seulement en rappeler la fonction session_start();
$bdd = new PDO("mysql:host=localhost;dbname=pizzaten;charset=utf8","root","");
?>

      <meta charset="utf-8">

 Inscrivez vous

		<form method="post" action ="index.php">

Nom
<input type="text" name="nomInscription" placeholder="Nom de famille" required data-validation-required-message="Veuillez entrer votre Nom.">

Prénom
<input type="text" name="prenomInscription" placeholder="Prénom" required data-validation-required-message="Veuillez entrer votre Prénom.">

Date de Naissance
 <input type="date" name="birthInscription">

Mail
 <input type="email" name="emailInscription" placeholder="Adresse mail" required>

Mot de passe
 <input type="password" placeholder="Mot de passe" size="25" name="mdpInscription"/>

<input type="submit" name="validerInscription" value="Valider l'inscription">

		</form>