text:
namespace Hw3D
{
	void OpenGlContext::Activate(wxWindow *target)
	{
		if(target == nullptr)
		{
			DO_THROW(Err::CriticalError, "OpenGlContext::Activate: target was null");
		}
		m_currentTarget = dynamic_cast<wxGLCanvas*>(target);
		if(m_currentTarget == nullptr)
		{
			DO_THROW(Err::CriticalError, "OpenGlContext::Activate: target was not a wxGLCanvas object");
		}

		m_context->SetCurrent(*m_currentTarget);

		InitializeContext();
	}

	void OpenGlContext::Clear(int a, int r, int g, int b)
	{
		glClearColor(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	}

	void OpenGlContext::BeginDraw()
	{
		auto rect = Win::wxToRect(m_currentTarget->GetClientRect());
		glViewport(0, 0, rect.Width() + 1, rect.Height() + 1);
		glUseProgram(m_program);
	}

	void OpenGlContext::RenderQuad(const Vertex2D &a, const Vertex2D &b, const Vertex2D &c, const Vertex2D &d)
	{
		glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
		auto posAttrib = glGetAttribLocation(m_program, "position");
		glVertexAttribPointer(posAttrib, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), 0);
		glEnableVertexAttribArray(posAttrib);
		auto texAttrib = glGetAttribLocation(m_program, "tex");
		glVertexAttribPointer(texAttrib, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(sizeof(float) * 3));
		glEnableVertexAttribArray(texAttrib);

		float data[] = {
			a.Position.X, a.Position.Y, 0, a.TexCoord.X, a.TexCoord.Y,
			b.Position.X, b.Position.Y, 0, b.TexCoord.X, b.TexCoord.Y,
			c.Position.X, c.Position.Y, 0, c.TexCoord.X, c.TexCoord.Y,
			d.Position.X, d.Position.Y, 0, d.TexCoord.X, d.TexCoord.Y
		};

		glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STREAM_DRAW);

		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

		GLenum err;
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "Failed rendering quad: " + GetGlErrorString(err));
		}
		glBindBuffer(GL_ARRAY_BUFFER, 0);
	}

	void OpenGlContext::EndDraw()
	{
		m_currentTarget->SwapBuffers();
	}

	void OpenGlContext::SetTexture(int stage, std::shared_ptr<Texture> texture)
	{
		auto glTexture = std::dynamic_pointer_cast<OpenGlTexture>(texture);
		if(glTexture == nullptr)
		{
			DO_THROW(Err::InvalidParam, "Texture object was not an OpenGlTexture");
		}
		auto u_tex = glGetUniformLocation(m_program, "semp");
		if(glGetError() != GL_NO_ERROR)
		{
			DO_THROW(Err::InvalidParam, "No semp");
		}
		if(u_tex == GL_INVALID_VALUE)
		{
			DO_THROW(Err::CriticalError, "Lying OpenGL driver, didn't get a valid uniform location");
		}
		glActiveTexture(GL_TEXTURE0);
		auto name = glTexture->GetTextureName();
		glBindTexture(GL_TEXTURE_2D, name);
		glUniform1i(u_tex, 0);
		if(name == GL_INVALID_VALUE)
		{
			DO_THROW(Err::InvalidParam, "Texture is broken");
		}
	}

	void OpenGlContext::SetMatrix(TransformState state, const Matrix &m)
	{
		if(state == TransformState::Projection)
		{
			auto mProjection = glGetUniformLocation(m_program, "projection");
			if(mProjection == -1)
			{
				DO_THROW(Err::CriticalError, "Failed getting projection matrix location");
			}
			GLenum err;
			if((err = glGetError()) != GL_NO_ERROR)
			{
				DO_THROW(Err::CriticalError, "Failed getting projection matrix location");
			}
			glUniformMatrix4fv(mProjection, 1, GL_FALSE, (GLfloat*)m.m);
			if((err = glGetError()) != GL_NO_ERROR)
			{
				DO_THROW(Err::CriticalError, "Failed getting projection matrix location");
			}
		}
	}

	void OpenGlContext::SendTextureRect(std::shared_ptr<StagingTexture> sourceTexture, const Geom::RectInt &sourceRect, std::shared_ptr<Texture> destinationTexture, const Geom::PointInt &destinationTopLeft)
	{
		auto glStaging = std::dynamic_pointer_cast<OpenGlStagingTexture>(sourceTexture);
		auto glDest = std::dynamic_pointer_cast<OpenGlTexture>(destinationTexture);
		SetTexture(0, destinationTexture);
		glStaging->Transfer(sourceRect, destinationTopLeft);
	}

	OpenGlContext::OpenGlContext(wxWindow *win):
		m_context{std::make_shared<wxGLContext>(dynamic_cast<wxGLCanvas*>(win))}
	{
		glEnable(GL_DEBUG_OUTPUT);
	}

	void OpenGlContext::InitializeContext()
	{
		if(m_isInitialized)
		{
			return;
		}

		GLenum err;

		if (glewInit() != GLEW_OK)
		{
			DO_THROW(Err::CriticalError, "Failed initializing GLEW");
		}
		glGenBuffers(1, &m_vbo);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glGenBuffers failed: " + GetGlErrorString(err));
		}
		const char* vertexShaderSource = "#version 330 core\n"
			"\n"
			"uniform mat4 projection;\n"
			"in vec3 position;\n"
			"in vec2 tex;\n"
			"out vec2 texCoord;\n"
			"\n"
			"void main()\n"
			"{\n"
			"	gl_Position = projection * vec4(position, 1.0);\n"
			"	texCoord = tex;"
			"}";
		const char* fragmentShaderSource = "#version 330 core\n"
			"\n"
			"in vec2 texCoord;\n"
			"out vec4 col;\n"
			"uniform sampler2D semp;\n"
			"\n"
			"void main()\n"
			"{\n"
			"	col = texture2D(semp, texCoord);\n"
			"}";
		auto vertexShader = glCreateShader(GL_VERTEX_SHADER);
		glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glShaderSource (vertex) failed: " + GetGlErrorString(err));
		}

		glCompileShader(vertexShader);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glCompileShader (vertex) failed: " + GetGlErrorString(err));
		}

		auto fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
		glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glShaderSource (fragment) failed: " + GetGlErrorString(err));
		}
		glCompileShader(fragmentShader);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glCompileShader (fragment) failed: " + GetGlErrorString(err));
		}

		m_program = glCreateProgram();
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glCreateProgram failed: " + GetGlErrorString(err));
		}

		glAttachShader(m_program, vertexShader);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glAttachShader (vertex) failed: " + GetGlErrorString(err));
		}
		glAttachShader(m_program, fragmentShader);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glAttachShader (fragment) failed: " + GetGlErrorString(err));
		}

		glLinkProgram(m_program);
		if((err = glGetError()) != GL_NO_ERROR)
		{
			DO_THROW(Err::CriticalError, "glLinkProgram failed: " + GetGlErrorString(err));
		}
	}
}


text:
namespace cc {
class TestWebGraphicsContext3D;
class TestGLES2Interface;

class TestContextProvider : public ContextProvider {
 public:
  typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)>
    CreateCallback;

  static scoped_refptr<TestContextProvider> Create();
  // Creates a worker context provider that can be used on any thread. This is
  // equivalent to: Create(); BindToCurrentThread(); SetupLock().
  static scoped_refptr<TestContextProvider> CreateWorker();
  static scoped_refptr<TestContextProvider> Create(
      scoped_ptr<TestWebGraphicsContext3D> context);

  bool BindToCurrentThread() override;
  void DetachFromThread() override;
  Capabilities ContextCapabilities() override;
  gpu::gles2::GLES2Interface* ContextGL() override;
  gpu::ContextSupport* ContextSupport() override;
  class GrContext* GrContext() override;
  void InvalidateGrContext(uint32_t state) override;
  void SetupLock() override;
  base::Lock* GetLock() override;
  void VerifyContexts() override;
  void DeleteCachedResources() override;
  bool DestroyedOnMainThread() override;
  void SetLostContextCallback(const LostContextCallback& cb) override;
  void SetMemoryPolicyChangedCallback(
      const MemoryPolicyChangedCallback& cb) override;

  TestWebGraphicsContext3D* TestContext3d();

  // This returns the TestWebGraphicsContext3D but is valid to call
  // before the context is bound to a thread. This is needed to set up
  // state on the test context before binding. Don't call
  // InitializeOnCurrentThread on the context returned from this method.
  TestWebGraphicsContext3D* UnboundTestContext3d();

  TestContextSupport* support() { return &support_; }

  void SetMemoryAllocation(const ManagedMemoryPolicy& policy);

  void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes);

 protected:
  explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context);
  ~TestContextProvider() override;

 private:
  void OnLostContext();

  TestContextSupport support_;

  scoped_ptr<TestWebGraphicsContext3D> context3d_;
  scoped_ptr<TestGLES2Interface> context_gl_;
  bool bound_;

  base::ThreadChecker main_thread_checker_;
  base::ThreadChecker context_thread_checker_;

  base::Lock destroyed_lock_;
  bool destroyed_;

  base::Lock context_lock_;

  LostContextCallback lost_context_callback_;
  MemoryPolicyChangedCallback memory_policy_changed_callback_;
  skia::RefPtr<class GrContext> gr_context_;

  base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_;

  DISALLOW_COPY_AND_ASSIGN(TestContextProvider);
};

}  // namespace cc

#endif  // CC_TEST_TEST_CONTEXT_PROVIDER_H_

redpajama_set_name: RedPajamaGithub


text:
Google Spreadsheets datasource for [SparkSQL and DataFrames](http://spark.apache.org/docs/latest/sql-programming-guide.html)

[![Build Status](https://travis-ci.org/potix2/spark-google-spreadsheets.svg?branch=master)](https://travis-ci.org/potix2/spark-google-spreadsheets)

## Notice

The version 0.4.0 breaks compatibility with previous versions. You must
use a ** spreadsheetId ** to identify which spreadsheet is to be accessed or altered.
In older versions, spreadsheet name was used.

If you don't know spreadsheetId, please read the [Introduction to the Google Sheets API v4](https://developers.google.com/sheets/guides/concepts).

## Requirements

This library supports different versions of Spark:

### Latest compatible versions

| This library | Spark Version |
| ------------ | ------------- |
| 0.6.x        | 2.3.x, 2.4.x  |
| 0.5.x        | 2.0.x         |
| 0.4.x        | 1.6.x         |

## Linking

Using SBT:

```
libraryDependencies += "com.github.potix2" %% "spark-google-spreadsheets" % "0.6.3"
```

Using Maven:

```xml
<dependency>
  <groupId>com.github.potix2</groupId>
  <artifactId>spark-google-spreadsheets_2.11</artifactId>
  <version>0.6.3</version>
</dependency>
```

## SQL API

```sql
CREATE TABLE cars
USING com.github.potix2.spark.google.spreadsheets
OPTIONS (
    path "<spreadsheetId>/worksheet1",
    serviceAccountId "xxxxxx@developer.gserviceaccount.com",
    credentialPath "/path/to/credential.p12"
)
```

## Scala API

```scala
import org.apache.spark.sql.SQLContext

val sqlContext = new SQLContext(sc)

// Creates a DataFrame from a specified worksheet
val df = sqlContext.read.
    format("com.github.potix2.spark.google.spreadsheets").
    option("serviceAccountId", "xxxxxx@developer.gserviceaccount.com").
    option("credentialPath", "/path/to/credential.p12").
    load("<spreadsheetId>/worksheet1")

// Saves a DataFrame to a new worksheet
df.write.
    format("com.github.potix2.spark.google.spreadsheets").
    option("serviceAccountId", "xxxxxx@developer.gserviceaccount.com").
    option("credentialPath", "/path/to/credential.p12").
    save("<spreadsheetId>/newWorksheet")

```

### Using Google default application credentials

Provide authentication credentials to your application code by setting the environment variable
`GOOGLE_APPLICATION_CREDENTIALS`. The variable should be set to the path of the service account json file.

```scala
import org.apache.spark.sql.SQLContext

val sqlContext = new SQLContext(sc)

// Creates a DataFrame from a specified worksheet
val df = sqlContext.read.
    format("com.github.potix2.spark.google.spreadsheets").
    load("<spreadsheetId>/worksheet1")
```

More details: https://cloud.google.com/docs/authentication/production

## License

Copyright 2016-2018, Katsunori Kanda

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.


text:
package org.zstack.appliancevm;

import org.zstack.header.message.MessageReply;
import org.zstack.header.message.NoJsonSchema;
import org.zstack.utils.gson.JSONObjectUtil;

/**
 * Created by frank on 8/22/2015.
 */
public class ApplianceVmAsyncHttpCallReply extends MessageReply {
    @NoJsonSchema
    private Object response;

    public Object getResponse() {
        return response;
    }

    public void setResponse(Object response) {
        this.response = response;
    }

    public <T> T toResponse(Class<T> clz) {
        return JSONObjectUtil.rehashObject(response, clz);
    }
}


text:
========================================
System administration for Object Storage
========================================

By understanding Object Storage concepts, you can better monitor and
administer your storage solution. The majority of the administration
information is maintained in developer documentation at
`docs.openstack.org/developer/swift/ <http://docs.openstack.org/developer/swift/>`__.

See the `OpenStack Configuration
Reference <http://docs.openstack.org/kilo/config-reference/content/>`__
for a list of configuration options for Object Storage.


text:
package TeleGogo

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestSendChatAction(t *testing.T) {
	ass := assert.New(t)

	bot, err := NewBot(testBotToken)
	ass.NoError(err)

	err = bot.SendChatAction(SendChatActionArgs{ChatID: testingID, Action: Typing})
	ass.NoError(err)
}


text:
"use strict";

import React from "react";
import classnames from "classnames";
import { canGoNext } from "./utils/innerSliderUtils";

export class PrevArrow extends React.PureComponent {
  clickHandler(options, e) {
    if (e) {
      e.preventDefault();
    }
    this.props.clickHandler(options, e);
  }
  render() {
    let prevClasses = { "slick-arrow": true, "slick-prev": true };
    let prevHandler = this.clickHandler.bind(this, { message: "previous" });

    if (
      !this.props.infinite &&
      (this.props.currentSlide === 0 ||
        this.props.slideCount <= this.props.slidesToShow)
    ) {
      prevClasses["slick-disabled"] = true;
      prevHandler = null;
    }

    let prevArrowProps = {
      key: "0",
      "data-role": "none",
      className: classnames(prevClasses),
      style: { display: "block" },
      onClick: prevHandler
    };
    let customProps = {
      currentSlide: this.props.currentSlide,
      slideCount: this.props.slideCount
    };
    let prevArrow;

    if (this.props.prevArrow) {
      prevArrow = React.cloneElement(this.props.prevArrow, {
        ...prevArrowProps,
        ...customProps
      });
    } else {
      prevArrow = (
        <button key="0" type="button" {...prevArrowProps}>
          {" "}
          Previous
        </button>
      );
    }

    return prevArrow;
  }
}

export class NextArrow extends React.PureComponent {
  clickHandler(options, e) {
    if (e) {
      e.preventDefault();
    }
    this.props.clickHandler(options, e);
  }
  render() {
    let nextClasses = { "slick-arrow": true, "slick-next": true };
    let nextHandler = this.clickHandler.bind(this, { message: "next" });

    if (!canGoNext(this.props)) {
      nextClasses["slick-disabled"] = true;
      nextHandler = null;
    }

    let nextArrowProps = {
      key: "1",
      "data-role": "none",
      className: classnames(nextClasses),
      style: { display: "block" },
      onClick: nextHandler
    };
    let customProps = {
      currentSlide: this.props.currentSlide,
      slideCount: this.props.slideCount
    };
    let nextArrow;

    if (this.props.nextArrow) {
      nextArrow = React.cloneElement(this.props.nextArrow, {
        ...nextArrowProps,
        ...customProps
      });
    } else {
      nextArrow = (
        <button key="1" type="button" {...nextArrowProps}>
          {" "}
          Next
        </button>
      );
    }

    return nextArrow;
  }
}


text:
<add>
<doc>
<field name="uid">doi:10.1371/journal.pntd.0000367</field>
<field name="doi">10.1371/journal.pntd.0000367</field>
<field name="data_source">PLoS Open Access XML</field>
<field name="authors">Rebecca J. Traub, Julie Macaranas, Mathirut Mungthin, Saovanee Leelayoova, Thomas Cribb, K. Darwin Murrell, R. C. Andrew Thompson</field>
<field name="title">A New PCR-Based Approach Indicates the Range of Clonorchis sinensis Now Extends to Central Thailand</field>
<field name="journal">PLoS Neglected Tropical Diseases</field>
<field name="year">2009</field>
<field name="volume">3</field>
<field name="number">1</field>
<field name="pages">e367</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

Differentiation of the fish-borne trematodes belonging to the Opisthorchiidae,
Heterophyidae and Lecithodendriidae is important from a clinical and
epidemiological perspective, yet it is impossible to do using conventional
coprological techniques, as the eggs are morphologically similar.
Epidemiological investigation therefore currently relies on morphological
examination of adult worms following expulsion chemotherapy. A PCR test
capable of amplifying a segment of the internal transcribed spacer region of
ribosomal DNA for the opisthorchiid and heterophyid flukes eggs taken directly
from faeces was developed and evaluated in a rural community in central
Thailand. The lowest quantity of DNA that could be amplified from individual
adults of Opisthorchis viverrini, Clonorchis sinensis and Haplorchis taichui
was estimated at 0.6 pg, 0.8 pg and 3 pg, respectively. The PCR was capable of
detecting mixed infection with the aforementioned species of flukes under
experimental conditions. A total of 11.6% of individuals in rural communities
in Sanamchaikaet district, central Thailand, were positive for 'Opisthorchis-
like' eggs in their faeces using conventional parasitological detection
techniques. In comparison to microscopy, the PCR yielded a sensitivity and
specificity of 71.0% and 76.7%, respectively. Analysis of the microscopy-
positive PCR products revealed 64% and 23% of individuals to be infected with
O. viverrini and C. sinensis, respectively. The remaining 13% (three
individuals) were identified as eggs of Didymozoidae, presumably being passed
mechanically in the faeces following the ingestion of infected fishes. An
immediate finding of this study is the identification and first report of a C.
sinensis–endemic community in central Thailand. This extends the known range
of this liver fluke in Southeast Asia. The PCR developed herein provides an
important tool for the specific identification of liver and intestinal fluke
species for future epidemiological surveys.

Author Summary

It is estimated that approximately 17 million people are currently infected
with fish-borne flukes worldwide. The fish-borne liver flukes Opisthrochis
viverrini and Clonorchis sinensis cause hepatic and biliary disease in humans.
The minute intestinal flukes are widely distributed in southeast Asia and are
increasingly recognised as an emerging pathogen associated with diarrhoea and
gastritis. The most significant finding of this study is the discovery and
first report of a C. sinensis–endemic community in Thailand. This finding was
aided by the development and application of a new PCR-based technique capable
of specifically detecting and characterising O. viverrini, C. sinensis and the
minute intestinal flukes, directly from eggs in faeces. Since the eggs are
morphologically similar, the fish-borne flukes cannot be differentiated on
basis of microscopic examination of stool. This publication also questions the
presumption that the distribution of fish-borne liver fluke species in Asia
closely parallels the distribution of the snail intermediate hosts. The PCR
provides a useful diagnostic tool for further large-scale epidemiological
surveys to be carried out in Southeast Asia, which will shed further light on
the distrib</field></doc>
</add>


text:
package data;

import lotus.notes.NotesThread;
import org.riverframework.River;
import org.riverframework.core.Session;
import play.Configuration;
import play.Logger;
import play.Play;
import play.inject.ApplicationLifecycle;
import play.libs.F;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * Created by mario.sotil on 10/20/2015.
 */
@Singleton
public class Connection {

    private Session session;
    private Database database;

    @Inject
    public Connection(ApplicationLifecycle lifecycle) {
        Configuration conf = Play.application().configuration();

        String server = (String) null;
        String username = (String) null;
        String password = conf.getString("river.addressbook.password");
        String filepath = conf.getString("river.addressbook.filepath");

        // Creating a new Notes thread
        NotesThread.sinitThread();

        // This will close the session and the Notes thread
        lifecycle.addStopHook(() -> {
            if (session != null) session.close();
            NotesThread.stermThread();

            Logger.info("River session stopped");

            return F.Promise.pure(null);
        });

        // Opening a new River Framework session
        session = River.getSession(River.LOTUS_DOMINO, server, username, password);
        Logger.info("River session opened: " + session.getUserName());

        // Opening the database
        database = session.getDatabase(Database.class, "", filepath);

        // If not, then we create a new one
        if (!database.isOpen()) {
            database = session.createDatabase(Database.class, "", filepath);

            if (!database.isOpen()) {
                Logger.error("I could not create the test database at the local client, with the name '" + filepath + "'");
            } else {
                Logger.info("Database opened: " + database.getName());
                database.reset();
            }

        }
    }

    public Session getSession() {
        return session;
    }

    public Database getDatabase() {
        return database;
    }

}


text:
require 'pp'
require_relative '../environment.rb'

carousel = ArticleSemanticizer::Carousel.new
carousel.rebuild_names_hash
carousel.populate
until carousel.carousel_ary.empty?
  pp carousel.carousel_ary
  carousel.send_content
  sleep(5)
  carousel.get_names
  carousel.populate
end


text:
#!/usr/bin/env node

'use strict';

/* eslint-env node */

/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
 * found when Flow v0.54 was deployed. To see the error delete this comment and
 * run Flow. */
const WebSocket = require('ws');

console.log(`\
WebSocket integration test server

This will send each incoming message back, with the string '_response' appended.
An incoming message of 'exit' will shut down the server.

`);

const server = new WebSocket.Server({port: 5555});
server.on('connection', (ws) => {
  ws.on('message', (message) => {
    console.log('Received message:', message);
    if (message === 'exit') {
      console.log('WebSocket integration test server exit');
      process.exit(0);
    }
    console.log('Cookie:', ws.upgradeReq.headers.cookie);
    ws.send(message + '_response');
  });

  ws.send('hello');
});