text:
#include "../common/util.h"
#include "../common/shader.h"
#include "../common/camera.h"
#include "mesh.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

#define WIDTH (640 * 2)
#define HEIGHT (480 * 2)
#define NUM_ASTEROIDS 2000
#define NUM_POINT_LIGHTS 32
#define SEED 1993

const char* VERTEX_GEOM_SRC = "#version 330 core\n"
                              "layout(location=0) in vec3 position;"
                              "layout(location=1) in vec3 normal;"
                              "layout(location=2) in vec2 texCoord;"
                              "layout(location=3) in mat4 model_inst;"
                              "uniform mat4 view;"
                              "uniform mat4 projection;"
                              "uniform float specularPower;"
                              "out vec3 fPosition;"
                              "out vec3 fNormal;"
                              "out vec2 fTexCoord;"
                              "out float fSpecularPower;"
                              "void main()"
                              "{"
                              "    vec4 wP = model_inst * vec4(position, 1.0);"
                              "    fPosition = wP.xyz;"
                              "    gl_Position = projection * view * wP;"
                              "    fNormal = transpose(inverse(mat3(model_inst))) * normal;"
                              "    fTexCoord = texCoord;"
                              "    fSpecularPower = specularPower;"
                              "}";

const char* FRAGMENT_GEOM_SRC = "#version 330 core\n"
                                "layout(location=0) out vec3 g_position;"
                                "layout(location=1) out vec4 g_normal_spec_pow;" // rgb: normal, a: specular power
                                "layout(location=2) out vec4 g_albedo_spec;" // rgb: albedo, a: spec
                                "in vec3 fPosition;"
                                "in vec3 fNormal;"
                                "in vec2 fTexCoord;"
                                "in float fSpecularPower;"
                                "uniform sampler2D diffuse;"
                                "uniform sampler2D specular;"
                                "void main()"
                                "{"
                                "    g_position = fPosition;"
                                "    g_normal_spec_pow.rgb = normalize(fNormal);"
                                "    g_normal_spec_pow.a = fSpecularPower;"
                                "    g_albedo_spec = texture(diffuse, fTexCoord);"
                                "    g_albedo_spec.a = texture(specular, fTexCoord).r;"
                                "}";

const char* VERTEX_LIGHT_SRC = "#version 330 core\n"
                               "layout(location=0) in vec2 position;"
                               "layout(location=1) in vec2 texCoord;"
                               "out vec2 fTexCoord;"
                               "void main()"
                               "{"
                               "    gl_Position = vec4(position, 0.0, 1.0);"
                               "    fTexCoord = texCoord;"
                               "}";

const char* FRAGMENT_LIGHT_SRC = "#version 330 core\n"
                                 "#define NUM_POINT_LIGHTS 32\n"
                                 "struct PointLight"
                                 "{"
                                 "    vec3 position;"
                                 "    vec3 att;" // x = constant, y = linear, z = quadratic
                                 "    vec3 ambient;"
                                 "    vec3 diffuse;"
                                 "    vec3 specular;"
                                 "};"
                                 "in vec2 fTexCoord;"
                                 "uniform PointLight lights[NUM_POINT_LIGHTS];"
                                 "uniform vec3 eye;"
                                 "uniform sampler2D g_position;"
                                 "uniform sampler2D g_normal_spec_pow;"
                                 "uniform sampler2D g_albedo_spec;"
                                 "out vec4 outputColor;"
                                 "vec3 pointLight(PointLight light, vec3 normal, vec3 pos, vec3 eye, vec3 albedo, float pSpecular, float specularPower)"
                                 "{"
                                 "    vec3 dir = normalize(light.position - pos);"
                                 "    vec3 ambient = albedo * light.ambient;"
                                 "    vec3 diffuse = max(dot(normal, dir), 0.0) * albedo * light.diffuse;"
                                 "    vec3 hwd = normalize(dir + eye);"
                                 "    float spec = pow(max(dot(normal, hwd), 0.0), specularPower);"
                                 "    vec3 specular = light.specular * spec * pSpecular;"
                                 "    float dist = length(light.position - pos);"
                                 "    float attenuation = 1.0f / (light.att.x + light.att.y * dist + light.att.z * dist * dist);"
                                 "    return (ambient + diffuse + specular) * attenuation;"
                                 "}"
                                 "void main()"
                                 "{"
                                 "    vec3 fPosition = texture(g_position, fTexCoord).rgb;"
                                 "    vec3 fNormal = texture(g_normal_spec_pow, fTexCoord).rgb;"
                                 "    float specularPower = texture(g_normal_spec_pow, fTexCoord).a;"
                                 "    vec3 albedo = texture(g_albedo_spec, fTexCoord).rgb;"
                                 "    float specular = texture(g_albedo_spec, fTexCoord).a;"
                                 "    vec3 eyeDir = normalize(eye - fPosition);"
                                 "    vec3 result = vec3(0.0);"
                                 "    for(int i = 0; i < NUM_POINT_LIGHTS; ++i)"
                                 "    {"
                                 "       result += pointLight(lights[i], fNormal, fPosition, eyeDir, albedo, specular, specularPower);"
                                 "    }"
                                 "    outputColor = vec4(result, 1.0);"
                                 "}";

/*
 * Multiple render targets!
 * We create a frame buffer with several GL_COLOR_ATTACHMENTs,
 * which allows us to render to multiple textures at once
 */
struct GBuffer
{
    GBuffer()
    {
        // Generate a framebuffer
        glGenFramebuffers(1, &buffer);
        glBindFramebuffer(GL_FRAMEBUFFER, buffer);

        // Create a texture for the position buffer
        glGenTextures(1, &position);
        glBindTexture(GL_TEXTURE_2D, position);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, WIDTH, HEIGHT, 0, GL_RGB, GL_FLOAT, NULL);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        // Bind the position buffer to the framebuffer
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, position, 0);

        // Create a texture for the normal buffer
        glGenTextures(1, &normal);
        glBindTexture(GL_TEXTURE_2D, normal);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        // Bind the normal buffer to the framebuffer
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, normal, 0);

        // Create a texture for the color buffer
        glGenTextures(1, &color);
        glBindTexture(GL_TEXTURE_2D, color);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        // Bind the color buffer to the framebuffer
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, color, 0);

        GLuint colorAttachments[] =
        {
            GL_COLOR_ATTACHMENT0,
            GL_COLOR_ATTACHMENT1,
            GL_COLOR_ATTACHMENT2
        };

        glDrawBuffers(3, colorAttachments);

        // Create a depth buffer
        glGenRenderbuffers(1, &depth);
        glBindRenderbuffer(GL_RENDERBUFFER, depth);
        glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, WIDTH, HEIGHT);
        // Bind the depth buffer to the framebuffer
        glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);

        if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
        {
            std::cerr << "Could not create G-Buffer!" << std::endl
                << "Error number: " << glGetError() << std::endl;
            exit(1);
        }

        glBindFramebuffer(GL_FRAMEBUFFER, 0);
    };

    ~GBuffer()
    {
        // or glDeleteTextures(3, &position);
        glDeleteTextures(1, &position);
        glDeleteTextures(1, &normal);
        glDeleteTextures(1, &color);
        glDeleteRenderbuffers(1, &depth);
        glDeleteFramebuffers(1, &buffer);
    };

    GLuint buffer, position, normal, color, depth;
};

struct PointLight
{
    void set(const glm::vec3& position, const glm::vec3& att, const glm::vec3& ambient,
            const glm::vec3& diffuse, const glm::vec3& specular)
    {
        this->position = position;
        this->att = att;
        this->ambient = ambient;
        this->diffuse = diffuse;
        this->specular = specular;
    };

    void setUniforms(int index, GLuint program)
    {
        std::string array = "lights[" + std::to_string(index) + "].";
        glUniform3fv(glGetUniformLocation(program, (array + "position").c_str()), 1, glm::value_ptr(position));
        glUniform3fv(glGetUniformLocation(program, (array + "att").c_str()), 1, glm::value_ptr(att));
        glUniform3fv(glGetUniformLocation(program, (array + "ambient").c_str()), 1, glm::value_ptr(ambient));
        glUniform3fv(glGetUniformLocation(program, (array + "diffuse").c_str()), 1, glm::value_ptr(diffuse));
        glUniform3fv(glGetUniformLocation(program, (array + "specular").c_str()), 1, glm::value_ptr(specular));
    };

private:
    glm::vec3 position;
    glm::vec3 att;
    glm::vec3 ambient;
    glm::vec3 diffuse;
    glm::vec3 specular;
};

int main(void)
{
    GLFWwindow* window;
    window = init("Deferred Shading", WIDTH / 2, HEIGHT / 2);
    if(!window)
    {
        return -1;
    }

    glEnable(GL_DEPTH_TEST);

    glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);

    Camera camera(CAMERA_PERSPECTIVE, 45.0f, 0.1f, 1000.0f, (float)WIDTH, (float)HEIGHT);
    setCamera(&camera);

    GLuint geomProgram, lightProgram;
    {
        // Geometry pass program
        GLuint vertex = createShader(VERTEX_GEOM_SRC, GL_VERTEX_SHADER);
        GLuint fragment = createShader(FRAGMENT_GEOM_SRC, GL_FRAGMENT_SHADER);
        geomProgram = createShaderProgram(vertex, fragment);
        linkShader(geomProgram);
        validateShader(geomProgram);
        glDetachShader(geomProgram, vertex);
        glDeleteShader(vertex);
        glDetachShader(geomProgram, fragment);
        glDeleteShader(fragment);
    }
    {
        // Light pass program
        GLuint vertex = createShader(VERTEX_LIGHT_SRC, GL_VERTEX_SHADER);
        GLuint fragment = createShader(FRAGMENT_LIGHT_SRC, GL_FRAGMENT_SHADER);
        lightProgram = createShaderProgram(vertex, fragment);
        linkShader(lightProgram);
        validateShader(lightProgram);
        glDetachShader(lightProgram, vertex);
        glDeleteShader(vertex);
        glDetachShader(lightProgram, fragment);
        glDeleteShader(fragment);
    }

    // Create quad VAO
    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    GLuint vbo;
    glGenBuffers(1, &vbo);

    float vertices[] =
    {
        // x   y       u     v
        -1.0f,  1.0f,  0.0f, 0.0f,
         1.0f,  1.0f,  1.0f, 0.0f,
         1.0f, -1.0f,  1.0f, 1.0f,
        -1.0f, -1.0f,  0.0f, 1.0f
    };

    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    GLuint ebo;
    glGenBuffers(1, &ebo);

    GLuint indices[] =
    {
        0, 1, 2,
        2, 3, 0
    };

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (void*)(2 * sizeof(GLfloat)));

    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

    // Load the diffuse and specular texture
    // TODO: seperate specular texture
    glUseProgram(geomProgram);
    int w, h;
    GLuint textureDiff = loadImage("asteroid.png", &w, &h, 0, false); // GL_TEXTURE0
    if(!textureDiff)
    {
        return -1;
    }
    glUniform1i(glGetUniformLocation(geomProgram, "diffuse"), 0); // GL_TEXTURE0
    GLuint textureSpec = loadImage("asteroid.png", &w, &h, 1, false); // GL_TEXTURE1
    if(!textureSpec)
    {
        return -1;
    }
    glUniform1i(glGetUniformLocation(geomProgram, "specular"), 1); // GL_TEXTURE1

    Mesh mesh;
    if(!mesh.load("asteroid.obj"))
    {
        std::cerr << "Could not load mesh" << std::endl;
        return -1;
    }

    // Set random positions for the asteroids
    std::vector<glm::mat4> models;
    models.resize(NUM_ASTEROIDS);
    srand(SEED);
    for(int i = 0; i < NUM_ASTEROIDS; ++i)
    {
        glm::mat4 model;

        // Translate
        model = glm::translate(model, glm::vec3(rand() % 100 - 50.0f, rand() % 100 - 50.0f, rand() % 100));

        // Scale
        float scale = (rand() % 200) / 100.0f + 0.1f;
        model = glm::scale(model, glm::vec3(scale, scale, scale));

        // Rotate
        model = glm::rotate(model, glm::radians((float)(rand() % 100)), glm::vec3(1.0f, 1.0f, 1.0f));

        models[i] = model;
    }

    mesh.setInstances(NUM_ASTEROIDS, models);

    // Set positions and more for the lights
    PointLight lights[NUM_POINT_LIGHTS];
    for(int i = 0; i < NUM_POINT_LIGHTS; ++i)
    {
        float x, y, z;
        x = rand() % 100 - 50.0f;
        y = rand() % 100 - 50.0f;
        z = rand() % 100;

        float r, g, b; // For simplicity's sake, ambient, diffuse and specular colours are the same
        r = ((rand() % 10) / 20.0f) + 0.5;
        g = ((rand() % 10) / 20.0f) + 0.5;
        b = ((rand() % 10) / 20.0f) + 0.5;

        float con, lin, qua;
        con = 1.0f;
        lin = 0.09f;
        qua = 0.032f;

        lights[i].set(glm::vec3(x, y, z), glm::vec3(con, lin, qua), glm::vec3(r, g, b),
                glm::vec3(r, g, b), glm::vec3(r, g, b));
    }

    GBuffer gBuffer;

    glUseProgram(lightProgram);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, gBuffer.position);
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, gBuffer.normal);
    glActiveTexture(GL_TEXTURE2);
    glBindTexture(GL_TEXTURE_2D, gBuffer.color);
    glUniform1i(glGetUniformLocation(lightProgram, "g_position"), 0);
    glUniform1i(glGetUniformLocation(lightProgram, "g_normal_spec_pow"), 1);
    glUniform1i(glGetUniformLocation(lightProgram, "g_albedo_spec"), 2);

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    while(!glfwWindowShouldClose(window))
    {
        if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
        {
            break;
        }

        updateCamera(WIDTH, HEIGHT, window);

        // GEOMETRY PASS
        glBindFramebuffer(GL_FRAMEBUFFER, gBuffer.buffer);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glm::mat4 proj = camera.getProjection();
        glm::mat4 view = camera.getView();
        glUseProgram(geomProgram);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, textureDiff);
        glActiveTexture(GL_TEXTURE1);
        glBindTexture(GL_TEXTURE_2D, textureSpec);
        glUniformMatrix4fv(glGetUniformLocation(geomProgram, "projection"), 1, GL_FALSE, glm::value_ptr(proj));
        glUniformMatrix4fv(glGetUniformLocation(geomProgram, "view"), 1, GL_FALSE, glm::value_ptr(view));
        glUniform1f(glGetUniformLocation(geomProgram, "specularPower"), 16.0f);
        mesh.render();

        // LIGHT PASS
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glUseProgram(lightProgram);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_2D, gBuffer.position);
        glActiveTexture(GL_TEXTURE1);
        glBindTexture(GL_TEXTURE_2D, gBuffer.normal);
        glActiveTexture(GL_TEXTURE2);
        glBindTexture(GL_TEXTURE_2D, gBuffer.color);
        glUniform3fv(glGetUniformLocation(lightProgram, "eye"), 1, glm::value_ptr(camera.getPosition()));
        for(int i = 0; i < NUM_POINT_LIGHTS; ++i)
        {
            lights[i].setUniforms(i, lightProgram);
        }
        glBindVertexArray(vao);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
        glBindVertexArray(0);

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    // Clean up
    glDeleteTextures(1, &textureDiff);
    glDeleteTextures(1, &textureSpec);
    glDeleteProgram(geomProgram);
    glDeleteProgram(lightProgram);
    glDeleteVertexArrays(1, &vao);
    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &ebo);

    glfwTerminate();
    return 0;
}


text:
Edit

    <form name="form" enctype="multipart/form-data" role="form">

            Title: {{ title }}

            Study ID: {{ studyID }}

            Study Reference: {{ studyReference }}

            Modification: {{ modification }}

            Monograph: {{ monograph }}

            Intervention: {{ intervention }}

            Category: {{ category }}

            File Type: {{ fileType }}

            <input type="file"  ngf-select ngf-max-size="1000MB" name="file" id="id_file"  ng-model="file" />

            <button ng-click="edit(file)" class="btn btn-black">Save</button>

			<button class="btn btn-black">Cancel</button>

    </form>

redpajama_set_name: RedPajamaGithub


text:
package groovy.lang;

import java.util.List;

/**
 *
An interface that defines the API usable by clients of Groovy's Meta Object Protocol (MOP). These methods are
 * implemented by the reference implementation of the {@link groovy.lang.MetaClass} interface.
 *
 * @see MetaClassImpl
 * @author John Wilson
 * @author Graeme Rocher
 */
public interface MetaObjectProtocol {

    /**
     * Obtain a list of all meta properties available on this meta class
     *
     * @see groovy.lang.MetaProperty
     * @return A list of MetaProperty instances
     */
    List<MetaProperty> getProperties();
    /**
     * Obtain a list of all the meta methods available on this meta class
     *
     * @see groovy.lang.MetaMethod
     * @return A list of MetaMethod instances
     */
    List<MetaMethod> getMethods();

    /**
     *
Returns an object satisfying Groovy truth if the implementing MetaClass responds to
     * a method with the given name and arguments types.
     *
     *
Note that this method's return value is based on realised methods and does not take into account
     * objects or classes that implement invokeMethod or methodMissing
     *
     *
This method is "safe" in that it will always return a value and never throw an exception
     *
     * @param obj The object to inspect
     * @param name The name of the method of interest
     * @param argTypes The argument types to match against
     * @return A List of MetaMethods matching the argument types which will be empty if no matching methods exist
     */
    List<MetaMethod> respondsTo(Object obj, String name, Object[] argTypes);

    /**
     *
Returns an object satisfying Groovy truth if the implementing MetaClass responds to
     * a method with the given name regardless of arguments. In other words this method will
     * return for foo() and foo(String).
     *
     *
Note that this method's return value is based on realised methods and does not take into account
     * objects or classes that implement invokeMethod or methodMissing
     *
     *
This method is "safe" in that it will always return a value and never throw an exception
     *
     * @param obj The object to inspect
     * @param name The name of the method of interest
     * @return A List of MetaMethods which will be empty if no methods with the given name exist
     */
    List<MetaMethod> respondsTo(Object obj, String name);

    /**
     *
Returns true of the implementing MetaClass has a property of the given name
     *
     *
Note that this method will only return true for realised properties and does not take into
     * account implementation of getProperty or propertyMissing
     *
     * @param obj The object to inspect
     * @param name The name of the property
     * @return The MetaProperty or null if it doesn't exist
     */
    MetaProperty hasProperty(Object obj, String name);

    /**
     * Returns a MetaProperty for the given name or null if it doesn't exist
     *
     * @param name The name of the MetaProperty
     * @return A MetaProperty or null
     */
    MetaProperty getMetaProperty(String name);

    /**
     * Retrieves a static MetaMethod for the given name and argument values, using the types of the arguments
     * to establish the chosen MetaMethod
     *
     * @param name The name of the MetaMethod
     * @param args The argument types
     * @return A MetaMethod or null if it doesn't exist
     */
    MetaMethod getStaticMetaMethod(String name, Object[] args);

    /**
     * Retrieves an instance MetaMethod for the given name and argument values, using the types of the
     * argument values to establish the chosen MetaMethod
     *
     * @param name The name of the MetaMethod
     * @param args Array containing - 1) the argument values (using which their types are then inferred), or 2) the corresponding argument types
     * @return A MetaMethod or null if it doesn't exist
     */
    MetaMethod getMetaMethod(String name, Object[] args);

    /**
     * Retrieves that Java Class that the attached Meta behaviours apply to
     *
     * @return The java.lang.Class instance
     */
    Class getTheClass();

    /**
     * Invokes a constructor for the given arguments. The MetaClass will attempt to pick the best argument which
     * matches the types of the objects passed within the arguments array
     *
     * @param arguments The arguments to the constructor
     * @return An instance of the java.lang.Class that this MetaObjectProtocol object applies to
     */
    Object invokeConstructor(Object[] arguments);

    /**
     * Invokes a method on the given Object with the given name and arguments. The MetaClass will attempt to pick
     * the best method for the given name and arguments. If a method cannot be invoked a MissingMethodException will be
     * thrown.
     *
     * @see groovy.lang.MissingMethodException
     * @param object The instance which the method is invoked on
     * @param methodName The name of the method
     * @param arguments The arguments to the method
     * @return The return value of the method which is null if the return type is void
     */
    Object invokeMethod(Object object, String methodName, Object[] arguments);

    /**
     * Invokes a method on the given object, with the given name and single argument.
     *
     * @see #invokeMethod(Object, String, Object[])
     * @param object The Object to invoke the method on
     * @param methodName The name of the method
     * @param arguments The argument to the method
     * @return The return value of the method which is null if the return type is void
     */
     Object invokeMethod(Object object, String methodName, Object arguments);

    /**
     * Invokes a static method on the given Object with the given name and arguments.
     *

     * The Object can either be an instance of the class that this
     * MetaObjectProtocol instance applies to or the java.lang.Class instance itself. If a method cannot be invoked
     * a MissingMethodException is will be thrown
     *
     * @see groovy.lang.MissingMethodException
     * @param object An instance of the class returned by the getTheClass() method or the class itself
     * @param methodName The name of the method
     * @param arguments The arguments to the method
     * @return The return value of the method which is null if the return type is void
     */
    Object invokeStaticMethod(Object object, String methodName, Object[] arguments);

    /**
     * Retrieves a property of an instance of the class returned by the getTheClass() method.
     *

     * What this means is largely down to the MetaClass implementation, however the default case would result
     * in an attempt to invoke a JavaBean getter, or if no such getter exists a public field of the instance.
     *
     * @see MetaClassImpl
     * @param object An instance of the class returned by the getTheClass() method
     * @param property The name of the property to retrieve the value for
     * @return The properties value
     */
    Object getProperty(Object object, String property);

    /**
     * Sets a property of an instance of the class returned by the getTheClass() method.
     *

     * What this means is largely down to the MetaClass implementation, however the default case would result
     * in an attempt to invoke a JavaBean setter, or if no such setter exists to set a public field of the instance.
     *
     * @see MetaClassImpl
     * @param object An instance of the class returned by the getTheClass() method
     * @param property The name of the property to set
     * @param newValue The new value of the property
     */
    void setProperty(Object object, String property, Object newValue);

    /**
     * Retrieves an attribute of an instance of the class returned by the getTheClass() method.
     *

     * What this means is largely down to the MetaClass implementation, however the default case would result
     * in attempt to read a field of the instance.
     *
     * @see MetaClassImpl
     * @param object An instance of the class returned by the getTheClass() method
     * @param attribute The name of the attribute to retrieve the value for
     * @return The attribute value
     */
    Object getAttribute(Object object, String attribute);

    /**
     * Sets an attribute of an instance of the class returned by the getTheClass() method.
     *

     * What this means is largely down to the MetaClass implementation, however the default case would result
     * in an attempt to set a field of the instance.
     *
     * @see MetaClassImpl
     * @param object An instance of the class returned by the getTheClass() method
     * @param attribute The name of the attribute to set
     * @param newValue The new value of the attribute
     */
    void setAttribute(Object object, String attribute, Object newValue);
}


text:
<!--

    Copyright 2014-2016 CyberVision, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

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

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

-->

<beans xmlns="http://www.springframework.org/schema/beans"
   	xmlns:security="http://www.springframework.org/schema/security"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:cache="http://www.springframework.org/schema/cache"
	xsi:schemaLocation="
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
			http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
			http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
			http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
			http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
			http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd">

	<context:component-scan base-package="org.kaaproject.kaa.server.admin" />

	<tx:annotation-driven transaction-manager="adminTransactionManager"/>
	<cache:annotation-driven />

	<util:properties id="admin_dao" location="classpath:/admin-dao.properties" />

    <bean id="adminDataSource"
        class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="#{admin_dao[jdbc_driver_className]}" />
        <property name="url" value="#{admin_dao[jdbc_url]}" />
        <property name="username" value="#{admin_dao[jdbc_username]}" />
        <property name="password" value="#{admin_dao[jdbc_password]}" />
    </bean>

    <bean id="adminSessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="adminDataSource" />
        <property name="packagesToScan" value="org.kaaproject.kaa.server.admin" />
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">#{admin_dao[hibernate_hbm2ddl_auto]}</prop>
                <prop key="hibernate.dialect">#{admin_dao[hibernate_dialect]}</prop>
                <prop key="hibernate.format_sql">#{admin_dao[hibernate_format_sql]}</prop>
                <prop key="hibernate.show_sql">#{admin_dao[hibernate_show_sql]}</prop>
            </props>
        </property>
    </bean>

    <bean id="adminTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="adminSessionFactory" />
        <qualifier value="admin"/>
    </bean>

    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="defaultEncoding" value="UTF-8"/>
        <property name="basenames">
            <list>
                <value>classpath:/admin-web/WEB-INF/KaaMessageSource</value>
            </list>
        </property>
    </bean>

    <bean id="messagingService" class="org.kaaproject.kaa.server.admin.services.messaging.MessagingService" init-method="init" destroy-method="destroy">
            <property name="sendPoolSize" value="10"/>
            <property name="sendTimeout" value="20"/>
    </bean>

    <bean id="kaaAdminAuthListener" class="org.kaaproject.kaa.server.admin.services.auth.KaaAdminAuthListener"/>

    <bean id="kaaAuthService" class="org.kaaproject.kaa.server.admin.services.KaaAuthServiceImpl">
            <property name="passwordEncoder" ref="encoder"/>
    </bean>

	<bean id="cacheService" class="org.kaaproject.kaa.server.admin.services.CacheServiceImpl" />

	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
	    <property name="maxUploadSize">
	        <value>20000000</value>
	    </property>
	    <property name="maxInMemorySize">
	        <value>100000</value>
	    </property>
    </bean>

	<security:http pattern="/kaaAdmin/rest/**"
	               authentication-manager-ref="authenticationManager"
                   entry-point-ref="authenticationEntryPoint"
                   use-expressions="true">
	    <security:access-denied-handler ref="accessDeniedHandler"/>
	    <security:anonymous/>
        <security:intercept-url pattern="/kaaAdmin/rest/api/auth/**" access="permitAll"/>
        <security:intercept-url pattern="/kaaAdmin/rest/**" access="hasAnyRole('KAA_ADMIN','TENANT_ADMIN','TENANT_DEVELOPER','TENANT_USER')"/>
	    <security:custom-filter position="BASIC_AUTH_FILTER" ref="basicAuthenticationFilter"/>
	</security:http>

	<!--security:http auto-config="true"-->
	<security:http authentication-manager-ref="authenticationManager"
                   entry-point-ref="authenticationEntryPoint"
                   use-expressions="true">
	    <security:access-denied-handler ref="accessDeniedHandler"/>
	    <!--security:form-login login-processing-url="/j_spring_security_check"/-->
	    <security:logout logout-url="/j_spring_security_logout"
			    success-handler-ref="logoutSuccessHandler"/>
        <security:anonymous/>
	    <security:intercept-url pattern="/KaaAdmin.html" access="permitAll"/>
        <security:intercept-url pattern="/login/springGwtServices/kaaAuthService" access="permitAll"/>
	    <security:intercept-url pattern="/login/springGwtServices/**" access="denyAll"/>
        <security:intercept-url pattern="/login/**" access="permitAll"/>
        <security:intercept-url pattern="/kaaAdmin/springGwtServices/kaaAuthService" access="permitAll"/>
        <security:intercept-url pattern="/kaaAdmin/springGwtServices/**" access="hasAnyRole('KAA_ADMIN','TENANT_ADMIN','TENANT_DEVELOPER','TENANT_USER')"/>
        <security:intercept-url pattern="/kaaAdmin/servlet/**" access="hasAnyRole('KAA_ADMIN','TENANT_ADMIN','TENANT_DEVELOPER','TENANT_USER')"/>
        <security:intercept-url pattern="/kaaAdmin/**" access="permitAll"/>
	    <security:custom-filter position="FORM_LOGIN_FILTER" ref="authenticationFilter"/>
	</security:http>

	<bean id="basicAuthenticationFilter" class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
        <constructor-arg><ref bean="authenticationManager"/></constructor-arg>
        <constructor-arg><ref bean="authenticationEntryPoint"/></constructor-arg>
    </bean>

	<bean id="authenticationFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
	    <property name="authenticationManager" ref="authenticationManager"/>
	    <property name="filterProcessesUrl" value="/j_spring_security_check"/>
	    <property name="authenticationFailureHandler" ref="loginFailureHandler"/>
	    <property name="authenticationSuccessHandler" ref="loginSuccessHandler"/>
	</bean>

	<bean id="securityContextLogoutHandler" class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" />

	<bean id="loginSuccessHandler" class="org.kaaproject.kaa.server.admin.services.auth.KaaAdminAuthSuccessHandler" >
	    <property name="defaultTargetUrl" value="/kaaAdmin/KaaAdmin.html"/>
	</bean>

	<bean id="loginFailureHandler" class="org.kaaproject.kaa.server.admin.services.auth.KaaAdminAuthFailureHandler" >
	    <property name="defaultFailureUrl" value="/KaaAdmin.html?loginError=true" />
	</bean>

	<bean id="logoutSuccessHandler" class="org.kaaproject.kaa.server.admin.services.auth.KaaAdminLogoutSuccessHandler" >
	    <property name="defaultTargetUrl" value="/KaaAdmin.html"/>
	</bean>

	<bean id="authenticationEntryPoint"
	    class="org.kaaproject.kaa.server.admin.services.auth.KaaAdminAuthEntryPoint">
	</bean>

	<bean id="accessDeniedHandler"
	    class="org.springframework.security.web.access.AccessDeniedHandlerImpl">
	    <!--  property name="errorPage" value="/accessDenied.htm"/-->
	    <property name="errorPage" value="/accessDenied.htm"/>
	</bean>

	<bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
          <property name="userDetailsService" ref="userDetailsService"/>
          <property name="passwordEncoder" ref="encoder"/>
          <property name="postAuthenticationChecks" ref="postAuthenticationChecks"/>
    </bean>

	<bean id="postAuthenticationChecks" class="org.kaaproject.kaa.server.admin.services.auth.KaaPostAuthenticationChecks"/>

	<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
        <property name="providers">
                <list>
                    <ref local="daoAuthenticationProvider" />
                </list>
        </property>
    </bean>

	<bean id="encoder"
            class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
    </bean>

</beans>


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://www.heigl.org/docbook/xsl/html/chunk.xsl" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.heigl.org/docbook/dtd/docbookx.dtd"[
<!ENTITY cost SYSTEM "cost.xml">
<!ENTITY technical SYSTEM "technical.xml">
]>
<book id="phpug" lang="en">
    <bookinfo>
        <title>PHP.ug - An international meeting point for the PHP-community</title>
        <author><firstname>Andreas</firstname><surname>Heigl</surname></author>
        <copyright><year>2012</year><holder>Andreas Heigl</holder></copyright>
    </bookinfo>
    <chapter id="phpug.introduction">
    <title>Purpose</title>
    <para>
        This Website provides a location for PHP usergroups worldwide to
        advertise their existence, their meetings and their contact-details.
    </para>
    <para>
        For that we include a map on the frontpage that displays every
        registered location worldwide. The User can then select the nearest UG
        and see the relevant informations like next meeting and
        contact-informations
    </para>
    <para>
        From their you can jump to their website immediately
    </para>
    <para>
        Also a shortlink is provided for every UG so their website can be
        reached using an UTL like http://php.ug/ffm for the Usergroup at
        Frankfurt/Main in Germany or http://php.ug/benelux for the UG in the
        Benelux-Countries.
    </para>
    <para>
        For that every Usergroup can register by providing a unique identifier
        (ffm or benelux), a website and some contact-informations (mainly email,
        but twitter, facebook or Chat are also possible) and a location where
        (or around where) the meetings are held.
    </para>
    <para>
        The provided email-address will then get the login information to change
        and maintain the provided data.
    </para>
    <para>
        All Usergroups will have to verify their existence at least once a year
        so we can archive inactive groups.
    </para>
    <para>
        The meeting schedule will be retrieved weekly from an iCalendar-File the
        usergroup should provide on their Website. That makes it easier to
        maintain a consistent Dataset of the schedules as the UG only needs to
        maintain their local calendar and this website will retrieve that
        information. If no URL to that calendar is given, then no
        meeting-schedule will be displayed.
    </para>
    <para>
        NO statistics will be provided.
    </para>
</chapter>
    &cost;
    &technical;
</book>


text:
@interface PostActionMenu ()

@property (nonatomic) ActionButtonInfo *deleteTextInfo;
@property (nonatomic) ActionButtonInfo *imgurButtonInfo;

@property (nonatomic) UISegmentedControl *themeSegmentedControl;

@end

@implementation PostActionMenu

- (void)dealloc
{
}

- (id)init
{
    if (self = [super init]) {
    }
    return self;
}

- (NSArray *)createAllButtons
{
    if (self.deleteTextInfo == nil) {
        self.deleteTextInfo = [[ActionButtonInfo alloc] initWithTitle:@"本文消去" withImageName:@"delete_30.png"];
        self.imgurButtonInfo = [[ActionButtonInfo alloc] initWithTitle:@"Imgur"
                                                         withImageName:@"arrowup.png"];
        ;
    }

    return @[self.imgurButtonInfo, self.deleteTextInfo];
}

- (void)onButtonTap:(ActionButtonInfo *)info
{
    if (info == self.deleteTextInfo) {
        double delayInSeconds = 0.1f;
        dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
        dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
          [[MySplitVC instance] closeActionMenu:nil
                                             complete:^{

                                               if (self.onDeleteRequest) {
                                                   self.onDeleteRequest();
                                               }

                                             }];
        });

    } else if (info == self.imgurButtonInfo) {
        [self.navigationController closeActionMenu:nil
                                           complete:^{
                                               NSString *url = @"http://m.imgur.com/upload";

                                               SearchWebViewController *searchWebViewController = [[SearchWebViewController alloc] init];
                                               searchWebViewController.searchUrl = url;

                                               //UINavigationController *con = [searchWebViewController wrapWithNavigationController];

                                               [self.navigationController presentViewController:searchWebViewController animated:YES completion:nil];

                                           }];
    }
}

@end


text:
// Qt includes
#include <QAction>
#include <QApplication>
#include <QDebug>
#include <QStandardItemModel>
#include <QTimer>
#include <QTreeView>

// VTK includes
#include <vtkScalarBarWidget.h>
#include <vtkSmartPointer.h>

// CTK includes
#include "ctkCallback.h"
#include "ctkConfig.h"
#include "ctkVTKScalarBarWidget.h"
#include "ctkEventTranslatorPlayerWidget.h"

// QtTesting includes
#include "pqTestUtility.h"

// STD includes
#include <cstdlib>
#include <iostream>

namespace
{
//-----------------------------------------------------------------------------
void checkFinalWidgetState(void* data)
  {
  ctkVTKScalarBarWidget* widget = reinterpret_cast<ctkVTKScalarBarWidget*>(data);

  CTKCOMPARE(widget->title(), "Test QtTesting");
  CTKCOMPARE(widget->labelsFormat(), "%-#6.3g..ghtkd");
  CTKCOMPARE(widget->maxNumberOfColors(), 25);
  CTKCOMPARE(widget->numberOfLabels(), 2);
  }
}

//-----------------------------------------------------------------------------
int ctkVTKScalarBarWidgetEventTranslatorPlayerTest1(int argc, char * argv [] )
{
  QApplication app(argc, argv);

  QString xmlDirectory = CTK_SOURCE_DIR "/Libs/Visualization/VTK/Widgets/Testing/Cpp/";

  // ------------------------
  ctkEventTranslatorPlayerWidget etpWidget;
  pqTestUtility* testUtility = new pqTestUtility(&etpWidget);
  etpWidget.setTestUtility(testUtility);

  // Test case 1
  vtkSmartPointer<vtkScalarBarWidget> scalarBar =
    vtkSmartPointer<vtkScalarBarWidget>::New();

  ctkVTKScalarBarWidget widget;
  widget.setScalarBarWidget(scalarBar);
  widget.setScalarBarWidget(0);
  widget.setScalarBarWidget(scalarBar);

  etpWidget.addTestCase(&widget,
                        xmlDirectory + "ctkVTKScalarBarWidgetEventTranslatorPlayerTest1.xml",
                        &checkFinalWidgetState);

  // ------------------------
  if (!app.arguments().contains("-I"))
    {
    QTimer::singleShot(0, &etpWidget, SLOT(play()));
    }

  etpWidget.show();
  return app.exec();
}


text:
package org.pocketserver.api.player;

public enum GameMode {
    CREATIVE(0),
    SURVIVAL(1);

    private final int id;

    GameMode(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }
}


text:
CSS Selector Parser
===================

[![Build Status](https://travis-ci.org/utluiz/parCSSer.svg?branch=master)](https://travis-ci.org/utluiz/parCSSer)
[![Coverage Status](https://coveralls.io/repos/utluiz/jericho-selector/badge.svg)](https://coveralls.io/r/utluiz/jericho-selector)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/br.com.starcode.parccser/parccser/badge.svg)](https://maven-badges.herokuapp.com/maven-central/br.com.starcode.parccser/parccser)

A CSS Selector Parser for Java.

## Why

Add jQuery-like capabilities to virtually any library, mainly [Jericho Selector](https://github.com/utluiz/jericho-selector/), an extension I wrote to [Jericho HTML Parser](http://jericho.htmlparser.net).

## How

CSS3 Selector parser implementaion based on [W3C Official Specification][1].

Just add the following dependency:

	<dependency>
		<groupId>br.com.starcode.parccser</groupId>
		<artifactId>parccser</artifactId>
		<version>1.1.3-RELEASE</version>
	</dependency>

## Status

- All main features implemented.
- All important methods covered by tests, including failure scenarios.
- Lacks UTF-8 Characters Support.

## Roadmap

- Improve error handling with mor accurate information
- Maybe... parse the whole CSS files
- Maybe... Implement [SAC](http://www.w3.org/Style/CSS/SAC/)
- Any idea?

## Get in touch

Please, fell free to tell me if you have any issue, suggestion, contribution, or comment. ;)

Just go to [http://luizricardo.org](http://luizricardo.org/en/who-i-am/#contact).

  [1]: http://www.w3.org/TR/css3-selectors/


text:
title: Frozen Flowers
date: 2008-04-14 00:00:00 -06:00
categories:
- whats-blooming
layout: post
blog-banner: whats-blooming-now-spring.jpg
post-date: April 14, 2008
post-time: 2:02 PM
blog-image: wbn-default.jpg
---

On Wednesday I was alerted to a great photo opportunity by our Fragrance Garden horticulturist Fritz.

It's amazing what these plants can tolerate!


text:
package org.apache.sshd.util.test;

import org.apache.sshd.server.Command;
import org.apache.sshd.server.CommandFactory;
import org.apache.sshd.server.command.UnknownCommand;

/**
 * @author Apache MINA SSHD Project
 */
public class UnknownCommandFactory implements CommandFactory {
    public static final UnknownCommandFactory INSTANCE = new UnknownCommandFactory();

    public UnknownCommandFactory() {
        super();
    }

    @Override
    public Command createCommand(String command) {
        return new UnknownCommand(command);
    }
}


text:
namespace FluentWebTest.Syntax.Assert
{
    public interface IAndSyntax
    {
        IAssertSyntax And { get; }
    }
}


text:
//
// Created by DjordjeR on 28.04.17.
//

#ifndef SEP_AG_STUDENT_H
#define SEP_AG_STUDENT_H

#include <string>
#include <vector>
class Subject;

/*
 * Student class, holds the information about the student. Calculates average.
 */
class Student
{
  public:
    /*
     * Constructor that takes name of the student
     */
    Student(std::string name);
    /*
     * Destructor
     */
    virtual ~Student();
    /*
     * Getters
     */
    const std::string getName();
    std::vector<Subject *>  *getSubjectList();
    /*
     * Setters
     */
    void setName(const std::string name);
    void setSubjectList( std::vector<Subject *>  *subject_list);

    /*
     * Calculate average for the student
     */
    float averageGrade();

  private:
    /*
     * Private copy constructor
     */
    Student(const Student &obj);
    /*
     * Private assignment operator
     */
    Student &operator=(const Student &obj);
    /*
     * Holds name of the student
     */
    std::string name_;
    /*
     * Holds the list of subjects
     */
    std::vector<Subject *> *subject_list_;
};

#endif //SEP_AG_STUDENT_H


text:
describe("Jobs Overview", function() {
  context("Jobs page loads correctly", function() {
    beforeEach(function() {
      cy.configureCluster({
        mesos: "1-for-each-health",
        nodeHealth: true
      });
      cy.visitUrl({ url: "/jobs" });
    });

    it("displays jobs overview page", function() {
      cy.get("tbody tr:visible").should("to.have.length", 3);
    });

    it("does not show status or last run for groups", function() {
      cy.get("tbody tr:visible").should(function($tableRows) {
        expect($tableRows[0].children[1].textContent).to.equal("");
        expect($tableRows[0].children[2].textContent).to.equal("");
      });
    });

    it("displays the proper job status", function() {
      cy.get("tbody tr:visible").should(function($tableRows) {
        expect($tableRows[1].children[1].textContent).to.equal("Scheduled");
        expect($tableRows[2].children[1].textContent).to.equal("Running");
      });
    });

    it("displays the proper last run status", function() {
      cy.get("tbody tr:visible").should(function($tableRows) {
        expect($tableRows[1].children[2].textContent).to.equal("Failed");
        expect($tableRows[2].children[2].textContent).to.equal("Success");
      });
    });
  });
});


text:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <meta charset="utf-8"/>
    <title>API Documentation</title>
    <meta name="author" content=""/>
    <meta name="description" content=""/>

    <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
    <link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/prism.css" rel="stylesheet" media="all"/>
    <link href="../css/template.css" rel="stylesheet" media="all"/>

    <link rel="shortcut icon" href="../images/favicon.ico"/>
    <link rel="apple-touch-icon" href="../images/apple-touch-icon.png"/>
    <link rel="apple-touch-icon" sizes="72x72" href="../images/apple-touch-icon-72x72.png"/>
    <link rel="apple-touch-icon" sizes="114x114" href="../images/apple-touch-icon-114x114.png"/>

            API Documentation

                            API Documentation

\Morphatic

                            Charts

                                     Class hierarchy diagram

                            Reports

                                                                                Errors 0

                                                                                Markers 7

                                \

                                Morphatic

                                Qualtrics

                                Exceptions

CurlException

CurlNotInstalledException

MissingParameterException

QualtricsException

QualtricsXMLException

UnknownFormatException

                                Facades

Qualtrics

Qualtrics

QualtricsServiceProvider

                                                \Morphatic\Qualtrics

\Morphatic\QualtricsQualtrics

Qualtrics class

This class implements wrapper functions for all of the API
methods available in the Qualtrics 2.2 API.  It is meant to
be used from within Laravel 4.

Summary

                                Methods

                                Properties

                                Constants

                                                                    __construct()

                                                                    getResponseCountsBySurvey()

                                                                    getUserInfo()

                                                                    addRecipient()

                                                                    createDistribution()

                                                                    createPanel()

                                                                    getPanel()

                                                                    deletePanel()

                                                                    getPanelMemberCount()

                                                                    getPanels()

                                                                    getRecipient()

                                                                    importPanel()

                                                                    removeRecipient()

                                                                    sendReminder()

                                                                    sendSurveyToIndividual()

                                                                    sendSurveyToPanel()

                                                                    updateRecipient()

                                                                    getLegacyResponseData()

                                                                    getSurvey()

                                                                    getSurveys()

                                                                    No public properties found

                                                                    No constants found

                                                                    No protected methods found

                                                                    No protected properties found

                                N/A

                                                                    xmlToArray()

                                                                    parse_csv()

                                                                    parseResponse()

                                                                    request()

                                                                    $username

                                                                    $token

                                                                    $library

                                N/A

File

Morphatic/Qualtrics/Qualtrics.php

Package

\Default

Class hierarchy

\Morphatic\Qualtrics\Qualtrics

Tags

                                author

Morgan Benton <morgan@morphatic.com>

                                todo

Properties

$username

$username : string

Qualtrics username

This is the email address that serves as the Qualtrics
username that has access to the api

Type

                string

Tags

                            todo

$token

$token : string

Qualtrics token

This is the Qualtrics-generated that gives a user
access to the api

Type

                string

Tags

                            todo

$library

$library : string

Qualtrics library

This is a library ID associated with the
username that has access to the api

Type

                string

Tags

                            todo

Methods

__construct()

__construct()

Creates a new object of type Qualtrics, setting appropriate authentication parameters

Tags

                            todo

getResponseCountsBySurvey()

getResponseCountsBySurvey(string[] $params) : object

Gets the total number of responses for a survey in a given date range

$params = array(
    'Format'    => 'JSON',               // Must be XML or JSON, defaults to JSON
    'StartDate' => 'YYYY-MM-DD',         // Start date of responses to include
    'EndDate'   => 'YYYY-MM-DD',         // (optional) defaults to today's date
    'SurveyID'  => 'SV_9LC2rrUZT8c2EiF', // the Qualtrics ID of the survey in question.
);

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
Returns a PHP object with the resulting counts of "Auditable", "Generated" and "Deleted" responses

Tags

                            todo

getUserInfo()

getUserInfo(string[] $params) : object

Gets information about a user

$params = array(
    'Format' => 'JSON', // Must be XML or JSON, defaults to JSON
);

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
Information about the user in question

Tags

                            todo

addRecipient()

addRecipient(string[] $params) : object

Add a new recipient to a panel

$params = array(
    'Format'          => 'JSON',               // Must be XML or JSON, defaults to JSON
    'LibraryID'       => 'GR_6G4LaoiroGxHH12', // Start date of responses to include
    'PanelID'         => 'ML_5yIfnFP0soZK3GJ', // Start date of responses to include
    'FirstName'       => 'Douglas',            // Recipient's first name
    'LastName'        => 'Crockford',          // Recipient's last name
    'Email'           => 'doug@js.org',        // Recipient's email address
    'ExternalDataRef' => 'crockdx',            // (optional)
    'Language'        => 'EN',                 // (optional) language, defaults to EN
    'ED[***]'         => '@dougcrockford',     // (optional) embedded data, e.g. ED[twitterID]
                                               // multiple values for ED possible
);

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
Returns true on success

Tags

                            todo

createDistribution()

createDistribution(string[] $params) : object

Creates a distribution for survey and a panel.  No emails will be sent.  Distribution links can be generated later to take the survey.

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
An object containing the DistributionID

Tags

                            todo

createPanel()

createPanel(string[] $params) : object

Creates a new Panel in the Qualtrics System and returns the ID of the new panel

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
Returns the ID of the new panel

Tags

                            todo

getPanel()

getPanel(string[] $params) : object

Gets all the panel members for the given panel

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The panel members and any requested data

Tags

                            todo

deletePanel()

deletePanel(string[] $params) : object

Deletes a panel

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The results of the deletion process

Tags

                            todo

getPanelMemberCount()

getPanelMemberCount(string[] $params) : object

Gets the number of panel members

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The number of members of the panel

Tags

                            todo

getPanels()

getPanels(string[] $params) : object

Gets all of the panels in a given library

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The panels in the library

Tags

                            todo

getRecipient()

getRecipient(string[] $params) : object

Gets a representation of the recipient and their history

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The representation of the recipient

Tags

                            todo

importPanel()

importPanel(string[] $params) : object

Imports a csv file as a new panel

Imports a csv file as a new panel (optionally it can append to a previously made panel)
into the database and returns the panel id.  The csv file can be posted (there is an
approximate 8 megabytes limit) or a url can be given to retrieve the file from a remote server.
The csv file must be comma separated using " for encapsulation.

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
Contains the new PanelID, a count of imported recipients, and a count of ignored recipients

Tags

                            todo

removeRecipient()

removeRecipient(string[] $params) : object

Removes a specified panel member from a specified panel

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The representation of the recipient

Tags

                            todo

sendReminder()

sendReminder(string[] $params) : object

Sends a reminder through the Qualtrics mailer to the panel or individual as specified by the parent distribution Id

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The email distribution ID and distribution queue id

Tags

                            todo

sendSurveyToIndividual()

sendSurveyToIndividual(string[] $params) : object

Sends a survey through the Qualtrics mailer to the individual specified

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The email distribution ID and distribution queue id

Tags

                            todo

sendSurveyToPanel()

sendSurveyToPanel(string[] $params) : object

Sends a survey through the Qualtrics mailer to the panel specified

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
The email distribution ID and distribution queue id

Tags

                            todo

updateRecipient()

updateRecipient(string[] $params) : object

Updates the recipient's data—any value not specified will be left alone and not updated

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
Returns true on success or WP_Error on failure

Tags

                            todo

getLegacyResponseData()

getLegacyResponseData(string[] $params) : object

Returns all of the response data for a survey in the original (legacy) data format

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
An object representing the responses for the specified panel members

Tags

                            todo

getSurvey()

getSurvey(string[] $params) : object

This request returns an xml export of the survey. NOTE: Custom response format!

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
On object representing the survey.

Tags

                            todo

getSurveys()

getSurveys(string[] $params) : object

This request returns a list of all the surveys for the user

Parameters

                                string[]
                                $params

An array of named parameters needed to complete the request (see code above)

Throws

\Morphatic\Qualtrics\Exceptions\MissingParameterException

Thrown when one of the required parameters does not exist in the $params array

Returns

                    object
                                            —
A list of surveys available to the user

Tags

                            todo

xmlToArray()

xmlToArray(\SimpleXMLElement $xml, object[] $out) : array

Converts XML to Array that can then be converted to JSON

Parameters

                                \SimpleXMLElement
                                $xml

The XML to be converted

                                object[]
                                $out

An empty array to be populated by the function

Returns

                    array
                                            —
The XML converted to an array

Tags

                            todo

parse_csv()

parse_csv(string $csv_string, string $delimiter, boolean $skip_empty_lines, boolean $trim_fields) : array

Converts csv into 2-dimensional array

Parameters

                                string
                                $csv_string

The CSV string to be parsed

                                string
                                $delimiter

The delimiter to be used for parsing, defaults to comma

                                boolean
                                $skip_empty_lines

Whether or not to skip empty lines, defaults to true

                                boolean
                                $trim_fields

Whether or not to trim() fields, defaults to true

Returns

                    array
                                            —
The two-dimensional array representing the CSV

Tags

                            todo

parseResponse()

parseResponse(resource $ch, string $result) : array

Parses the data returned from a Qualtrics request.

Parameters

                                resource
                                $ch

The curl handle associated with the request

                                string
                                $result

The text returned from the request

Throws

\Morphatic\Qualtrics\Exceptions\QualtricsXMLException

Thrown when an XML response cannot be parsed correctly

\Morphatic\Qualtrics\Exceptions\UnknownFormatException

Thrown when Qualtrics returns a response with an unrecognized content-type header

Returns

                    array
                                            —
Returns an array with the headers and parsed response text

Tags

                            todo

request()

request(string $request, string[] $params) : object

Private function that makes a generic Qualtrics API request.

This function takes an API function name and an array of parameters
and makes an attempt to fetch the data using the Qualtrics API.

Parameters

                                string
                                $request

The name of the API function to be called

                                string[]
                                $params

An array which contains any necessary parameters for the API call

Throws

\Morphatic\Qualtrics\Exceptions\CurlNotInstalledException

Thrown when the curl library is not installed on the server

\Morphatic\Qualtrics\Exceptions\QualtricsException

Thrown when Qualtrics returns an error with the request

\Morphatic\Qualtrics\Exceptions\CurlException

Thrown when the curl request is unsuccessful, e.g. request timeout

Returns

                    object
                                            —
Returns an object representing the requested data

Tags

                            todo

            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Qualtrics.php

\Morphatic

Class Hierarchy Diagram

Errors

Markers

                    Documentation is powered by phpDocumentor  and authored
                    on January 5th, 2014 at 00:27.


text:
namespace Farfetch.Buildionaire.Data.Repository.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    using System.Diagnostics.CodeAnalysis;

    [ExcludeFromCodeCoverage]
    public partial class Init : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Builds",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Status = c.Int(nullable: false),
                        TotalScore = c.Int(nullable: false),
                        CreatedAt = c.DateTime(nullable: false),
                        CompletedAt = c.DateTime(nullable: false),
                        Project_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Projects", t => t.Project_Id)
                .Index(t => t.Project_Id);

            CreateTable(
                "dbo.BuildScoreDetails",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Score = c.Int(nullable: false),
                        Build_Id = c.Int(),
                        Metric_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Builds", t => t.Build_Id)
                .ForeignKey("dbo.Metrics", t => t.Metric_Id)
                .Index(t => t.Build_Id)
                .Index(t => t.Metric_Id);

            CreateTable(
                "dbo.Metrics",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Description = c.String(),
                        Weight = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.CodeCoverages",
                c => new
                    {
                        Id = c.Int(nullable: false),
                        TotalBlocks = c.Int(nullable: false),
                        CoveredBlocks = c.Int(nullable: false),
                        TotalTests = c.Int(nullable: false),
                        PassedTests = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Builds", t => t.Id)
                .Index(t => t.Id);

            CreateTable(
                "dbo.CodeReviews",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        CreatedAt = c.DateTime(nullable: false),
                        RequestedBy_Id = c.Int(),
                        Build_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Users", t => t.RequestedBy_Id)
                .ForeignKey("dbo.Builds", t => t.Build_Id)
                .Index(t => t.RequestedBy_Id)
                .Index(t => t.Build_Id);

            CreateTable(
                "dbo.CodeReviewInteractions",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        CreatedAt = c.DateTime(nullable: false),
                        InteractionType = c.Int(nullable: false),
                        CodeReview_Id = c.Int(),
                        User_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.CodeReviews", t => t.CodeReview_Id)
                .ForeignKey("dbo.Users", t => t.User_Id)
                .Index(t => t.CodeReview_Id)
                .Index(t => t.User_Id);

            CreateTable(
                "dbo.Users",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Errors",
                c => new
                    {
                        Id = c.Int(nullable: false),
                        Total = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Builds", t => t.Id)
                .Index(t => t.Id);

            CreateTable(
                "dbo.Projects",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.Id);

            CreateTable(
                "dbo.Warnings",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Type = c.Int(nullable: false),
                        Total = c.Int(nullable: false),
                        Build_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Builds", t => t.Build_Id)
                .Index(t => t.Build_Id);

        }

        public override void Down()
        {
            DropForeignKey("dbo.Warnings", "Build_Id", "dbo.Builds");
            DropForeignKey("dbo.Builds", "Project_Id", "dbo.Projects");
            DropForeignKey("dbo.Errors", "Id", "dbo.Builds");
            DropForeignKey("dbo.CodeReviews", "Build_Id", "dbo.Builds");
            DropForeignKey("dbo.CodeReviewInteractions", "User_Id", "dbo.Users");
            DropForeignKey("dbo.CodeReviews", "RequestedBy_Id", "dbo.Users");
            DropForeignKey("dbo.CodeReviewInteractions", "CodeReview_Id", "dbo.CodeReviews");
            DropForeignKey("dbo.CodeCoverages", "Id", "dbo.Builds");
            DropForeignKey("dbo.BuildScoreDetails", "Metric_Id", "dbo.Metrics");
            DropForeignKey("dbo.BuildScoreDetails", "Build_Id", "dbo.Builds");
            DropIndex("dbo.Warnings", new[] { "Build_Id" });
            DropIndex("dbo.Errors", new[] { "Id" });
            DropIndex("dbo.CodeReviewInteractions", new[] { "User_Id" });
            DropIndex("dbo.CodeReviewInteractions", new[] { "CodeReview_Id" });
            DropIndex("dbo.CodeReviews", new[] { "Build_Id" });
            DropIndex("dbo.CodeReviews", new[] { "RequestedBy_Id" });
            DropIndex("dbo.CodeCoverages", new[] { "Id" });
            DropIndex("dbo.BuildScoreDetails", new[] { "Metric_Id" });
            DropIndex("dbo.BuildScoreDetails", new[] { "Build_Id" });
            DropIndex("dbo.Builds", new[] { "Project_Id" });
            DropTable("dbo.Warnings");
            DropTable("dbo.Projects");
            DropTable("dbo.Errors");
            DropTable("dbo.Users");
            DropTable("dbo.CodeReviewInteractions");
            DropTable("dbo.CodeReviews");
            DropTable("dbo.CodeCoverages");
            DropTable("dbo.Metrics");
            DropTable("dbo.BuildScoreDetails");
            DropTable("dbo.Builds");
        }
    }
}


text:
<add>
<doc>
<field name="uid">doi:10.1371/journal.pntd.0000962</field>
<field name="doi">10.1371/journal.pntd.0000962</field>
<field name="data_source">PLoS Open Access XML</field>
<field name="authors">Yaneth Osorio, Bruno L. Travi, Adam R. Renslo, Alex G. Peniche, Peter C. Melby</field>
<field name="title">Identification of Small Molecule Lead Compounds for Visceral Leishmaniasis Using a Novel Ex Vivo Splenic Explant Model System</field>
<field name="journal">PLoS Neglected Tropical Diseases</field>
<field name="year">2011</field>
<field name="volume">5</field>
<field name="number">2</field>
<field name="pages">e962</field>
<field name="license">Creative Commons Attribution (CC BY)</field>
<field name="license_url">http://creativecommons.org/licenses/by/3.0/</field>
<field name="fulltext">
Abstract

Background

New drugs are needed to treat visceral leishmaniasis (VL) because the current
therapies are toxic, expensive, and parasite resistance may weaken drug
efficacy. We established a novel ex vivo splenic explant culture system from
hamsters infected with luciferase-transfected Leishmania donovani to screen
chemical compounds for anti-leishmanial activity.

Methodology/Principal Findings

This model has advantages over in vitro systems in that it: 1) includes the
whole cellular population involved in the host-parasite interaction; 2) is
initiated at a stage of infection when the immunosuppressive mechanisms that
lead to progressive VL are evident; 3) involves the intracellular form of
Leishmania; 4) supports parasite replication that can be easily quantified by
detection of parasite-expressed luciferase; 5) is adaptable to a high-
throughput screening format; and 6) can be used to identify compounds that
have both direct and indirect anti-parasitic activity. The assay showed
excellent discrimination between positive (amphotericin B) and negative
(vehicle) controls with a Z' Factor >0.8. A duplicate screen of 4 chemical
libraries containing 4,035 compounds identified 202 hits (5.0%) with a Z score
of <–1.96 (p<0.05). Eighty-four (2.1%) of the hits were classified as lead
compounds based on the in vitro therapeutic index (ratio of the compound
concentration causing 50% cytotoxicity in the HepG2 cell line to the
concentration that caused 50% reduction in the parasite load). Sixty-nine
(82%) of the lead compounds were previously unknown to have anti-leishmanial
activity. The most frequently identified lead compounds were classified as
quinoline-containing compounds (14%), alkaloids (10%), aromatics (11%),
terpenes (8%), phenothiazines (7%) and furans (5%).

Conclusions/Significance

The ex vivo splenic explant model provides a powerful approach to identify new
compounds active against L. donovani within the pathophysiologic environment
of the infected spleen. Further in vivo evaluation and chemical optimization
of these lead compounds may generate new candidates for preclinical studies of
treatment for VL.

Author Summary

Visceral leishmaniasis is a life threatening parasitic disease present in
several countries of the world. New drugs are needed to treat this disease
because treatments are becoming increasingly ineffective. We established a
novel system to screen for new anti-leishmanial compounds that utilizes spleen
cells from hamsters infected with the parasite Leishmania donovani. The
parasite strain we used was genetically engineered to emit light by the
incorporation of the firefly luciferase gen. This laboratory test system has
the advantage of reproducing the cellular environment where the drug has to
combat the infection. The efficacy of the compounds is easily determined by
measuring the light emitted by the surviving parasites in a luminometer after
exposing the infected cells to the test compounds. The screening of more than
4,000 molecules showed that 84 (2.1%) of them showed anti-leishmanial activity
and had an acceptable toxicity evaluation. Eighty two percent of these
molecules, which had varied chemical structures, were previously unknown to
have anti-leishmanial activity. Further studies in a</field></doc>
</add>


text:
angular.module('arb.common.resources.ArbRest', [
  'restangular',
  'arb.constants'
])

.config(['RestangularProvider',
  function (RestangularProvider) {
    RestangularProvider.setResponseInterceptor(
      function (data, operation, what) {
        // console.log(data);
        return data;
    });
  }
])

.factory('ArbRest', [
  'Restangular',
  'conf',
  function (Restangular, conf) {
    var ArbRest = Restangular.withConfig(function (RestangularConfigurer) {
      // RestangularConfigurer.setRequestSuffix('.json');
      RestangularConfigurer.setBaseUrl(conf.getApiUrl());
    });

    return ArbRest;

  }
]);


text:
const uuid = require('uuid');
const Immutable = require('immutable');

const ModificationTypes = require('../comm/modification.types');
const StateContainer = require('../state/state.container');
const TransactionExecuter = require('./transaction.executer');

class Transaction {

  constructor(state_container) {
    this.temp_state = new StateContainer(state_container.state);
    this.modificationQueue = Immutable.List([]);
    this.id = uuid.v4();
  }

  get modifications(){
    return this.modificationQueue.toJS();
  }

  _test_modification(modification){
    if(this.temp_state){
      TransactionExecuter.modificationRedcuer(this.temp_state, modification);
    }
  }

  _create_modification(modification){
    this._test_modification(modification);
    this.modificationQueue = this.modificationQueue.push(modification);
    return this;
  }

  set(path, value){
    return this._create_modification({
      type: ModificationTypes.SET,
      path,
      value
    });
  }

  remove(path){
    return this._create_modification({
      type: ModificationTypes.REMOVE,
      path
    });
  }

  push(path, value){
    return this._create_modification({
      type: ModificationTypes.LIST_APPEND,
      path,
      value
    });
  }

  pop(path){
    return this._create_modification({
      type: ModificationTypes.LIST_POP,
      path
    });
  }

  increment(path, value){
    return this._create_modification({
      type: ModificationTypes.INCREMENT,
      path,
      value
    });
  }

  decrement(path, value){
    return this._create_modification({
      type: ModificationTypes.DECREMENT,
      path,
      value
    });
  }

  commit(callback){
    return callback(this);
  }

  rollback (){
    return null;
  }

  toJSON(){
    return JSON.stringify({
      id: this.id,
      modifications: this.modifications
    });
  }
}

module.exports = Transaction;


text:
package com.vaadin.buildhelpers;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.jar.Manifest;

public class ManifestWriter {
    StringBuffer buffer = new StringBuffer();

    public ManifestWriter() {
    }

    /**
     * Writes a manifest attribute to a temporary buffer.
     *
     * @param name
     *            Attribute name
     * @param value
     *            Attribute value
     */
    public void writeAttribute(String name, String value) {
        int linelen = name.length() + 2;
        buffer.append(name);
        buffer.append(": ");

        String remainingValue = value;
        while (linelen + remainingValue.length() > 72) {
            int fitsLine = 72 - linelen;
            buffer.append(remainingValue.substring(0, fitsLine) + "\n ");
            remainingValue = remainingValue.substring(fitsLine);
            linelen = 1;
        }
        buffer.append(remainingValue + "\n");
    }

    /**
     * Writes the manifest to given JAR file.
     *
     * The manifest must be created with {@code #writeAttribute(String, String)}
     * before calling this write.
     *
     * @param jarFilename
     *            File name of the JAR in which the manifest is written
     * @return 0 on success, nonzero value on error
     */
    int updateJar(String jarFilename) {
        int status = 0;

        // Determine a temporary file name
        String newMfPrefix = "vaadin-manifest-" + (new Date()).getTime();
        File newMfFile = null;
        try {
            newMfFile = File.createTempFile(newMfPrefix, ".mf");
        } catch (IOException e) {
            System.err.println("Creating temp file failed");
            status = 1;
        }

        // Write the manifest to the temporary file
        if (status == 0) {
            FileOutputStream fos = null;
            try {
                fos = new FileOutputStream(newMfFile);
                fos.write(getBytes());
                fos.close();
            } catch (IOException e) {
                System.err.println(
                        "Writing to file '" + newMfFile.getAbsolutePath()
                                + "' failed because: " + e.getMessage());
                status = 1;
            }
        }

        // Check that the manifest is OK
        if (status == 0) {
            Manifest checkMf = new Manifest();
            FileInputStream is;
            try {
                is = new FileInputStream(newMfFile);
                checkMf.read(is);
            } catch (IOException e) {
                System.err.println(
                        "Reading from file '" + newMfFile.getAbsolutePath()
                                + "' failed because: " + e.getMessage());
                status = 1;
            }
        }

        // Update the manifest in the Jar
        if (status == 0) {
            System.out.println("Updating manifest in JAR " + jarFilename);
            try {
                // The "mf" order must correspond with manifest-jarfile order
                Process process = Runtime.getRuntime()
                        .exec(new String[] { "jar", "umf",
                                newMfFile.getAbsolutePath(), jarFilename });
                int exitValue = process.waitFor();
                if (exitValue != 0) {
                    InputStream jarErr = process.getErrorStream();
                    BufferedReader reader = new BufferedReader(
                            new InputStreamReader(jarErr));
                    while (reader.ready()) {
                        System.err.println("jar: " + reader.readLine());
                    }
                    System.err.println(
                            "The 'jar' command returned with exit value "
                                    + exitValue);
                    status = 1;
                }
            } catch (IOException e) {
                System.err.println(
                        "Failed to execute 'jar' command. " + e.getMessage());
                status = 1;
            } catch (InterruptedException e) {
                System.err
                        .println("Execution of 'jar' command was interrupted. "
                                + e.getMessage());
                status = 1;
            }
        }

        // Remove the temporary file
        if (newMfFile != null) {
            newMfFile.delete();
        }

        return status;
    }

    @Override
    public String toString() {
        return buffer.toString();
    }

    public byte[] getBytes() {
        return buffer.toString().getBytes();
    }
}


text:
package cmd

import (
	"fmt"

	"code.gitea.io/git"
	"code.gitea.io/gitea/models"
	"code.gitea.io/gitea/modules/log"
	"code.gitea.io/gitea/modules/setting"

	"github.com/urfave/cli"
)

var (
	// CmdAdmin represents the available admin sub-command.
	CmdAdmin = cli.Command{
		Name:  "admin",
		Usage: "Command line interface to perform common administrative operations",
		Subcommands: []cli.Command{
			subcmdCreateUser,
			subcmdChangePassword,
			subcmdRepoSyncReleases,
			subcmdRegenerate,
		},
	}

	subcmdCreateUser = cli.Command{
		Name:   "create-user",
		Usage:  "Create a new user in database",
		Action: runCreateUser,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "name",
				Usage: "Username",
			},
			cli.StringFlag{
				Name:  "password",
				Usage: "User password",
			},
			cli.StringFlag{
				Name:  "email",
				Usage: "User email address",
			},
			cli.BoolFlag{
				Name:  "admin",
				Usage: "User is an admin",
			},
			cli.StringFlag{
				Name:  "config, c",
				Value: "custom/conf/app.ini",
				Usage: "Custom configuration file path",
			},
		},
	}

	subcmdChangePassword = cli.Command{
		Name:   "change-password",
		Usage:  "Change a user's password",
		Action: runChangePassword,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "username,u",
				Value: "",
				Usage: "The user to change password for",
			},
			cli.StringFlag{
				Name:  "password,p",
				Value: "",
				Usage: "New password to set for user",
			},
		},
	}

	subcmdRepoSyncReleases = cli.Command{
		Name:   "repo-sync-releases",
		Usage:  "Synchronize repository releases with tags",
		Action: runRepoSyncReleases,
	}

	subcmdRegenerate = cli.Command{
		Name:  "regenerate",
		Usage: "Regenerate specific files",
		Subcommands: []cli.Command{
			microcmdRegenHooks,
			microcmdRegenKeys,
		},
	}

	microcmdRegenHooks = cli.Command{
		Name:   "hooks",
		Usage:  "Regenerate git-hooks",
		Action: runRegenerateHooks,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "config, c",
				Value: "custom/conf/app.ini",
				Usage: "Custom configuration file path",
			},
		},
	}

	microcmdRegenKeys = cli.Command{
		Name:   "keys",
		Usage:  "Regenerate authorized_keys file",
		Action: runRegenerateKeys,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "config, c",
				Value: "custom/conf/app.ini",
				Usage: "Custom configuration file path",
			},
		},
	}
)

func runChangePassword(c *cli.Context) error {
	if err := argsSet(c, "username", "password"); err != nil {
		return err
	}

	if err := initDB(); err != nil {
		return err
	}

	uname := c.String("username")
	user, err := models.GetUserByName(uname)
	if err != nil {
		return err
	}
	if user.Salt, err = models.GetUserSalt(); err != nil {
		return err
	}
	user.HashPassword(c.String("password"))
	if err := models.UpdateUserCols(user, "passwd", "salt"); err != nil {
		return err
	}

	fmt.Printf("%s's password has been successfully updated!\n", user.Name)
	return nil
}

func runCreateUser(c *cli.Context) error {
	if err := argsSet(c, "name", "password", "email"); err != nil {
		return err
	}

	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}

	if err := initDB(); err != nil {
		return err
	}

	if err := models.CreateUser(&models.User{
		Name:     c.String("name"),
		Email:    c.String("email"),
		Passwd:   c.String("password"),
		IsActive: true,
		IsAdmin:  c.Bool("admin"),
	}); err != nil {
		return fmt.Errorf("CreateUser: %v", err)
	}

	fmt.Printf("New user '%s' has been successfully created!\n", c.String("name"))
	return nil
}

func runRepoSyncReleases(c *cli.Context) error {
	if err := initDB(); err != nil {
		return err
	}

	log.Trace("Synchronizing repository releases (this may take a while)")
	for page := 1; ; page++ {
		repos, count, err := models.SearchRepositoryByName(&models.SearchRepoOptions{
			Page:     page,
			PageSize: models.RepositoryListDefaultPageSize,
			Private:  true,
		})
		if err != nil {
			return fmt.Errorf("SearchRepositoryByName: %v", err)
		}
		if len(repos) == 0 {
			break
		}
		log.Trace("Processing next %d repos of %d", len(repos), count)
		for _, repo := range repos {
			log.Trace("Synchronizing repo %s with path %s", repo.FullName(), repo.RepoPath())
			gitRepo, err := git.OpenRepository(repo.RepoPath())
			if err != nil {
				log.Warn("OpenRepository: %v", err)
				continue
			}

			oldnum, err := getReleaseCount(repo.ID)
			if err != nil {
				log.Warn(" GetReleaseCountByRepoID: %v", err)
			}
			log.Trace(" currentNumReleases is %d, running SyncReleasesWithTags", oldnum)

			if err = models.SyncReleasesWithTags(repo, gitRepo); err != nil {
				log.Warn(" SyncReleasesWithTags: %v", err)
				continue
			}

			count, err = getReleaseCount(repo.ID)
			if err != nil {
				log.Warn(" GetReleaseCountByRepoID: %v", err)
				continue
			}

			log.Trace(" repo %s releases synchronized to tags: from %d to %d",
				repo.FullName(), oldnum, count)
		}
	}

	return nil
}

func getReleaseCount(id int64) (int64, error) {
	return models.GetReleaseCountByRepoID(
		id,
		models.FindReleasesOptions{
			IncludeTags: true,
		},
	)
}

func runRegenerateHooks(c *cli.Context) error {
	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}

	if err := initDB(); err != nil {
		return err
	}
	return models.SyncRepositoryHooks()
}

func runRegenerateKeys(c *cli.Context) error {
	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}

	if err := initDB(); err != nil {
		return err
	}
	return models.RewriteAllPublicKeys()
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Laranotti</title>

    <link href="public/css/app.css" rel="stylesheet">


text:
<!doctype html>

		<title>Zabuun - Learn Arabic for English Speakers</title>
		<meta name="description" content="">
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/head.php';?>

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/ie8.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/header.php';?>

			<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/side.php';?>

						Modern Standard Arabic (MSA) | Egyptian Colloquial Arabic (ECA) | Both

Living in an Apartment

Poor Upkeep

  A: This floor is falling apart.
 B: How can you tell?
 A: Are you kidding me? Step over here.
 B: You're right. The floor to this apartment is badly damaged.
 A: See, I told you so.
 B: What did you do that made the floor like this?
 A: It wasn't me. It was like this when I moved in here.
 B: You should report this poor upkeep to the landlord.
 A: You're right. I'll call him the first thing in the morning.
 B: Be carful not to damage the floor any further.
 A: I won't. I hope the landlord replaces the floor soon.
 B: He probably will.

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/footer.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/scripts.php';?>