text:
import json

import pytest
from base import BaseAPITestCase
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse_lazy
from le_utils.constants import content_kinds
from testdata import tree

from contentcuration import models as cc
from contentcuration.api import activate_channel
from contentcuration.utils.garbage_collect import clean_up_deleted_chefs
from contentcuration.utils.garbage_collect import get_deleted_chefs_root
from contentcuration.views.files import file_create
from contentcuration.views.internal import api_commit_channel
from contentcuration.views.internal import create_channel

pytestmark = pytest.mark.django_db

class NodeSettingTestCase(BaseAPITestCase):

    def setUp(self):
        super(NodeSettingTestCase, self).setUp()
        # Set up ricecooker trees
        self.channel.staging_tree = cc.ContentNode(kind_id=content_kinds.TOPIC, title="test", node_id="aaa")
        self.channel.staging_tree.save()
        self.channel.previous_tree = cc.ContentNode(kind_id=content_kinds.TOPIC, title="test", node_id="bbb")
        self.channel.previous_tree.save()
        self.channel.chef_tree = cc.ContentNode(kind_id=content_kinds.TOPIC, title="test", node_id="ccc")
        self.channel.chef_tree.save()
        self.channel.save()

        request = self.create_post_request(reverse_lazy('file_create'), {'file': SimpleUploadedFile("file.pdf", b"contents")})
        self.file_response = file_create(request)

    def test_garbage_node_created(self):
        # Make sure loadconstants created the garbage node
        self.assertTrue(cc.ContentNode.objects.filter(pk=settings.ORPHANAGE_ROOT_ID).exists())

    def test_file_create(self):
        self.assertEqual(self.file_response.status_code, 200)
        garbage_node = cc.ContentNode.objects.get(pk=settings.ORPHANAGE_ROOT_ID)
        data = json.loads(self.file_response.content)
        node = json.loads(data['node'])
        node = cc.ContentNode.objects.get(pk=node['id'])

        # Node should be in garbage tree
        self.assertTrue(garbage_node.get_descendants().filter(pk=node.pk).exists())
        self.assertEqual(garbage_node.tree_id, node.tree_id)

    def test_file_move(self):
        self.assertEqual(self.file_response.status_code, 200)
        data = json.loads(self.file_response.content)
        node = json.loads(data['node'])
        node = cc.ContentNode.objects.get(pk=node['id'])

        # Move node and check if it's still in the garbage tree
        node.parent_id = self.channel.main_tree.pk
        node.save()
        garbage_node = cc.ContentNode.objects.get(pk=settings.ORPHANAGE_ROOT_ID)

        # Node shouldn't be in garbage tree
        self.assertFalse(garbage_node.get_descendants().filter(pk=node.pk).exists())
        self.assertNotEqual(garbage_node.tree_id, node.tree_id)

    def test_old_chef_tree(self):
        # make an actual tree for deletion tests
        tree(parent=self.channel.chef_tree)
        chef_tree = self.channel.chef_tree
        self.assertTrue(chef_tree.get_descendant_count() > 0)
        garbage_node = get_deleted_chefs_root()

        self.assertNotEqual(chef_tree, self.channel.staging_tree)
        # Chef tree shouldn't be in garbage tree until create_channel is called
        self.assertFalse(garbage_node.get_descendants().filter(pk=chef_tree.pk).exists())
        create_channel(self.channel.__dict__, self.user)
        garbage_node.refresh_from_db()
        chef_tree.refresh_from_db()
        self.channel.refresh_from_db()

        # We can't use MPTT methods to test the deleted chefs tree because we are not running the sort code
        # for performance reasons, so just do a parent test instead.
        self.assertEquals(chef_tree.parent.pk, garbage_node.pk)

        # New staging tree should not be in garbage tree
        self.assertFalse(self.channel.chef_tree.parent)
        self.assertNotEqual(garbage_node.tree_id, self.channel.chef_tree.tree_id)

        child_pk = chef_tree.children.first().pk

        clean_up_deleted_chefs()

        self.assertFalse(cc.ContentNode.objects.filter(parent=garbage_node).exists())
        self.assertFalse(cc.ContentNode.objects.filter(pk=child_pk).exists())

    def test_old_staging_tree(self):
        staging_tree = self.channel.staging_tree
        garbage_node = get_deleted_chefs_root()

        tree(parent=staging_tree)
        self.assertTrue(staging_tree.get_descendant_count() > 0)

        # Staging tree shouldn't be in garbage tree until api_commit_channel is called
        self.assertFalse(garbage_node.get_descendants().filter(pk=staging_tree.pk).exists())
        request = self.create_post_request(reverse_lazy('api_finish_channel'), data=json.dumps(
            {'channel_id': self.channel.pk}), content_type='application/json')
        response = api_commit_channel(request)
        self.assertEqual(response.status_code, 200)
        garbage_node.refresh_from_db()
        staging_tree.refresh_from_db()
        self.channel.refresh_from_db()

        # We can't use MPTT methods on the deleted chefs tree because we are not running the sort code
        # for performance reasons, so just do a parent test instead.
        self.assertEqual(staging_tree.parent, garbage_node)

        # New staging tree should not be in garbage tree
        self.assertFalse(self.channel.main_tree.parent)
        self.assertNotEqual(garbage_node.tree_id, self.channel.main_tree.tree_id)

        child_pk = staging_tree.children.first().pk

        clean_up_deleted_chefs()

        self.assertFalse(cc.ContentNode.objects.filter(parent=garbage_node).exists())
        self.assertFalse(cc.ContentNode.objects.filter(pk=child_pk).exists())

    def test_activate_channel(self):
        previous_tree = self.channel.previous_tree
        tree(parent=previous_tree)
        garbage_node = get_deleted_chefs_root()

        # Previous tree shouldn't be in garbage tree until activate_channel is called
        self.assertFalse(garbage_node.get_descendants().filter(pk=previous_tree.pk).exists())
        activate_channel(self.channel, self.user)
        garbage_node.refresh_from_db()
        previous_tree.refresh_from_db()
        self.channel.refresh_from_db()

        # We can't use MPTT methods on the deleted chefs tree because we are not running the sort code
        # for performance reasons, so just do a parent test instead.
        self.assertTrue(previous_tree.parent == garbage_node)

        # New previous tree should not be in garbage tree
        self.assertFalse(self.channel.previous_tree.parent)
        self.assertNotEqual(garbage_node.tree_id, self.channel.previous_tree.tree_id)

        child_pk = previous_tree.children.first().pk

        clean_up_deleted_chefs()

        self.assertFalse(cc.ContentNode.objects.filter(parent=garbage_node).exists())
        self.assertFalse(cc.ContentNode.objects.filter(pk=child_pk).exists())


text:
using UnityEngine;
using System.Collections;

namespace BomberChap
{
	public class ResetLevelOnPlayerDeath : MonoBehaviour
	{
		[SerializeField]
		private float m_delay;

		private IEnumerator OnTriggerEnter2D(Collider2D other)
		{
			if(this.tag == Tags.Player && (other.tag == Tags.Flame || other.tag == Tags.Enemy))
			{
				yield return new WaitForSeconds(m_delay);
				LevelManager.ReloadCurrentLevel();
			}
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

/*
 * Defining the Package
 */
var Module = require('meanio').Module;

var Remotefacade = new Module('remotefacade');

/*
 * All MEAN packages require registration
 * Dependency injection is used to define required modules
 */
Remotefacade.register(function(app, auth, database) {

  //We enable routing. By default the Package Object is passed to the routes
  Remotefacade.routes(app, auth, database);

  //We are adding a link to the main menu for all authenticated users
  Remotefacade.menus.add({
    title: 'remotefacade example page',
    link: 'remotefacade example page',
    roles: ['authenticated'],
    menu: 'main'
  });

  Remotefacade.aggregateAsset('css', 'remotefacade.css');

  /**
    //Uncomment to use. Requires meanio@0.3.7 or above
    // Save settings with callback
    // Use this for saving data from administration pages
    Remotefacade.settings({
        'someSetting': 'some value'
    }, function(err, settings) {
        //you now have the settings object
    });

    // Another save settings example this time with no callback
    // This writes over the last settings.
    Remotefacade.settings({
        'anotherSettings': 'some value'
    });

    // Get settings. Retrieves latest saved settigns
    Remotefacade.settings(function(err, settings) {
        //you now have the settings object
    });
    */

  return Remotefacade;
});


text:
using namespace std;

Material* Material::CreateMaterial(Program *program) {
	assert(program != 0); // TODO add default material
	assert(program->getProgram() != 0);

	Material *mat = new Material(program);

	const vector< Program::BlockDesc >& blockList = program->getUniformBlockList();
	mat->m_uniformBuffers.clear();
	for (auto& block : blockList) {
		size_t idx = mat->m_uniformBuffers.size();
		UniformBuffer *ub = UniformBuffer::CreateUniformBuffer(block.second);
		if (!ub) {
			delete mat;
			return 0;
		}
		glUniformBlockBinding(program->getProgram(), idx, idx);
		mat->m_uniformBuffers.push_back(ub);
	}

	return mat;
}

bool Material::setUniform(const string& name, int size, const void* data) {
	const UniformDesc* desc = m_program->getUniform(name);
	if (!desc) return false;
	if (desc->blockIndex < 0) {
		return false;
	} else {
		// if (desc->size < size) return false;
		m_uniformBuffers[desc->blockIndex]->setData(desc->location, size, data);
	}
	return true;
}

bool Material::setUniform(const std::string& name, GLint data) {
	const UniformDesc* desc = m_program->getUniform(name);
	if (!desc) return false;
	if (desc->blockIndex < 0) {
		glUseProgram(m_program->getProgram());
		glUniform1i(desc->location, data);
	} else {
		// if (desc->size < sizeof(GLuint)) return false;
		m_uniformBuffers[desc->blockIndex]->setData(desc->location, sizeof(GLuint), &data);
	}
	return true;
}

bool Material::setUniform(const std::string& name, float data) {
	const UniformDesc* desc = m_program->getUniform(name);
	if (!desc) return false;
	if (desc->blockIndex < 0) {
		glUseProgram(m_program->getProgram());
		glUniform1f(desc->location, data);
	} else {
		// if (desc->size < sizeof(float)) return false;
		m_uniformBuffers[desc->blockIndex]->setData(desc->location, sizeof(float), &data);
	}
	return true;
}

bool Material::setUniform(const std::string& name, const glm::vec4& data) {
	const UniformDesc* desc = m_program->getUniform(name);
	if (!desc) return false;
	if (desc->blockIndex < 0) {
		glUseProgram(m_program->getProgram());
		glUniform4fv(desc->location, 1, glm::value_ptr(data));
	} else {
		// if (desc->size < sizeof(glm::vec4)) return false;
		m_uniformBuffers[desc->blockIndex]->setData(desc->location, sizeof(glm::vec4), glm::value_ptr(data));
	}
	return true;
}

bool Material::setUniform(const std::string& name, const glm::vec3& data) {
	const UniformDesc* desc = m_program->getUniform(name);
	if (!desc) return false;
	if (desc->blockIndex < 0) {
		glUseProgram(m_program->getProgram());
		glUniform4fv(desc->location, 1, glm::value_ptr(data));
	} else {
		// if (desc->size < sizeof(glm::vec3)) return false;
		m_uniformBuffers[desc->blockIndex]->setData(desc->location, sizeof(glm::vec3), glm::value_ptr(data));
	}
	return true;
}

bool Material::setUniform(const std::string& name, const glm::mat4& data) {
	const UniformDesc* desc = m_program->getUniform(name);
	if (!desc) return false;
	if (desc->blockIndex < 0) {
		glUseProgram(m_program->getProgram());
		glUniformMatrix4fv(desc->location, 1, GL_FALSE, glm::value_ptr(data));
	} else {
		// if (desc->size < sizeof(glm::mat4)) return false;
		m_uniformBuffers[desc->blockIndex]->setData(desc->location, sizeof(glm::mat4), glm::value_ptr(data));
	}
	return true;
}

bool Material::setTexture(const string& name, Texture *texture) {
	if (m_texNames.find(name) == m_texNames.end()) {
		if (!m_program->getUniform(name)) return false;

		if (!setUniform(name, (GLint)m_textures.size())) return false;
		m_texNames[name] = m_textures.size();
		m_textures.push_back(texture);
	} else {
		size_t idx = m_texNames[name];
		m_textures[idx] = texture;
	}
	return true;
}

void Material::bind() {
	glUseProgram(m_program->getProgram());

	for (size_t idx = 0; idx < m_uniformBuffers.size(); ++idx) {

		UniformBuffer *ub = m_uniformBuffers[idx];
		ub->bind(idx);
	}

	for (auto& t : m_texNames) {

		Texture* tex = m_textures[t.second];
		tex->bind(t.second);
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2016 The Android Open Source Project
  ~
  ~ 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.
  -->
<resources>
    <dimen name="tif_scan_icon_width">80dp</dimen>
    <dimen name="tif_scan_icon_height">80dp</dimen>
    <dimen name="tif_scan_icon_margin_right">24dp</dimen>

    <dimen name="tif_scan_title_text_size">34sp</dimen>
    <dimen name="tif_scan_title_margin_top">178dp</dimen>

    <dimen name="tif_scan_progress_width">432dp</dimen>
    <dimen name="tif_scan_progress_height">4dp</dimen>
    <dimen name="tif_scan_progress_margin_top">16dp</dimen>

    <dimen name="tif_scan_description_margin_top">19dp</dimen>
    <dimen name="tif_scan_description_text_size">14sp</dimen>

    <dimen name="tif_scan_button_height">51dp</dimen>
    <dimen name="tif_scan_button_margin_top">15dp</dimen>
    <dimen name="tif_scan_button_padding">24dp</dimen>
    <dimen name="tif_scan_button_text_size">16sp</dimen>

    <dimen name="tif_scan_channellist_width">312dp</dimen>
    <dimen name="tif_scan_channellist_padding_top">202dp</dimen>
    <dimen name="tif_scan_channellist_padding_start">40dp</dimen>
    <dimen name="tif_scan_channellist_padding_bottom">12dp</dimen>
    <dimen name="tif_scan_channellist_text_size">14sp</dimen>

    <dimen name="tif_scan_channel_num_width">48dp</dimen>
    <dimen name="tif_scan_channel_name_width">96dp</dimen>
</resources>


text:
//------------------------------------------------------------------------------
// <copyright file="LegacyPageAsyncTask.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace System.Web.UI {

using System;
using System.Collections;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.Util;

// Represents an asynchronous task that uses the old asynchronous patterns and the legacy synchronization systems

internal sealed class LegacyPageAsyncTask {
    private BeginEventHandler   _beginHandler;
    private EndEventHandler     _endHandler;
    private EndEventHandler     _timeoutHandler;
    private Object              _state;
    private bool                _executeInParallel;

    private LegacyPageAsyncTaskManager _taskManager;
    private int                 _completionMethodLock;
    private bool                _started;
    private bool                _completed;
    private bool                _completedSynchronously;
    private AsyncCallback       _completionCallback;
    private IAsyncResult        _asyncResult;
    private Exception           _error;

    internal LegacyPageAsyncTask(BeginEventHandler beginHandler, EndEventHandler endHandler, EndEventHandler timeoutHandler, Object state, bool executeInParallel) {
        // Parameter checking is done by the public PageAsyncTask constructor

        _beginHandler = beginHandler;
        _endHandler = endHandler;
        _timeoutHandler = timeoutHandler;
        _state = state;
        _executeInParallel = executeInParallel;
    }

    public BeginEventHandler BeginHandler {
        get { return _beginHandler; }
    }

    public EndEventHandler EndHandler {
        get { return _endHandler; }
    }

    public EndEventHandler TimeoutHandler {
        get { return _timeoutHandler; }
    }

    public Object State {
        get { return _state; }
    }

    public bool ExecuteInParallel {
        get { return _executeInParallel; }
    }

    internal bool Started {
        get { return _started; }
    }

    internal bool CompletedSynchronously {
        get { return _completedSynchronously; }
    }

    internal bool Completed {
        get { return _completed; }
    }

    internal IAsyncResult AsyncResult {
        get { return _asyncResult; }
    }

    internal Exception Error {
        get { return _error; }
    }

    internal void Start(LegacyPageAsyncTaskManager manager, Object source, EventArgs args) {
        Debug.Assert(!_started);

        _taskManager = manager;
        _completionCallback = new AsyncCallback(this.OnAsyncTaskCompletion);
        _started = true;

        Debug.Trace("Async", "Start task");

        try {
            IAsyncResult ar = _beginHandler(source, args, _completionCallback, _state);

            if (ar == null) {
                throw new InvalidOperationException(SR.GetString(SR.Async_null_asyncresult));
            }

            if (_asyncResult == null) {
                // _asyncResult could be not null if already completed
                _asyncResult = ar;
            }
        }
        catch (Exception e) {
            Debug.Trace("Async", "Task failed to start");

            _error = e;
            _completed = true;
            _completedSynchronously = true;
            _taskManager.TaskCompleted(true /*onCallerThread*/); // notify TaskManager
            // it is ok to say false (onCallerThread) above because this kind of
            // error completion will never be the last in ResumeTasks()
        }
    }

    private void OnAsyncTaskCompletion(IAsyncResult ar) {
        Debug.Trace("Async", "Task completed, CompletedSynchronously=" + ar.CompletedSynchronously);

        if (_asyncResult == null) {
            // _asyncResult could be null if the code not yet returned from begin method
            _asyncResult = ar;
        }

        CompleteTask(false /*timedOut*/);
    }

    internal void ForceTimeout(bool syncCaller) {
        Debug.Trace("Async", "Task timed out");
        CompleteTask(true /*timedOut*/, syncCaller /*syncTimeoutCaller*/);
    }

    private void CompleteTask(bool timedOut) {
        CompleteTask(timedOut, false /*syncTimeoutCaller*/);
    }

    private void CompleteTask(bool timedOut, bool syncTimeoutCaller) {
        if (Interlocked.Exchange(ref _completionMethodLock, 1) != 0) {
            return;
        }

        bool needSetupThreadContext;
        bool responseEnded = false;

        if (timedOut) {
            needSetupThreadContext = !syncTimeoutCaller;
        }
        else {
            _completedSynchronously = _asyncResult.CompletedSynchronously;
            needSetupThreadContext = !_completedSynchronously;
        }

        // call the completion or timeout handler
        //  when neeeded setup the thread context and lock
        //  catch and remember all exceptions

        HttpApplication app = _taskManager.Application;

        try {
            if (needSetupThreadContext) {

                using (app.Context.SyncContext.AcquireThreadLock()) {
                    ThreadContext threadContext = null;
                    try {
                        threadContext = app.OnThreadEnter();
                        if (timedOut) {
                            if (_timeoutHandler != null) {
                                _timeoutHandler(_asyncResult);
                            }
                        }
                        else {
                            _endHandler(_asyncResult);
                        }
                    }
                    finally {
                        if (threadContext != null) {
                            threadContext.DisassociateFromCurrentThread();
                        }
                    }
                }
            }
            else {
                if (timedOut) {
                    if (_timeoutHandler != null) {
                        _timeoutHandler(_asyncResult);
                    }
                }
                else {
                    _endHandler(_asyncResult);
                }
            }
        }
        catch (ThreadAbortException e) {
           _error = e;

           HttpApplication.CancelModuleException exceptionState = e.ExceptionState as HttpApplication.CancelModuleException;

           // Is this from Response.End()
           if (exceptionState != null && !exceptionState.Timeout) {
               // Mark the request as completed
               using (app.Context.SyncContext.AcquireThreadLock()) {
                   // Handle response end once. Skip if already initiated (previous AsyncTask)
                   if (!app.IsRequestCompleted) {
                       responseEnded = true;
                       app.CompleteRequest();
                   }
               }

               // Clear the error for Response.End
               _error = null;
           }

           // ---- the exception. Async completion required (DDB 140655)
           Thread.ResetAbort();
        }
        catch (Exception e) {
            _error = e;
        }

        // Complete the current async task
        _completed = true;
        _taskManager.TaskCompleted(_completedSynchronously /*onCallerThread*/); // notify TaskManager

        // Wait for pending AsyncTasks (DDB 140655)
        if (responseEnded) {
            _taskManager.CompleteAllTasksNow(false /*syncCaller*/);
        }
    }
}

}


text:
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// source: /usr/share/vpp/api/core/span.api.json

/*
Package span is a generated VPP binary API for 'span' module.

It consists of:
	  4 messages
	  2 services
*/
package span

import (
	bytes "bytes"
	context "context"
	api "git.fd.io/govpp.git/api"
	struc "github.com/lunixbochs/struc"
	io "io"
	strconv "strconv"
)

const (
	// ModuleName is the name of this module.
	ModuleName = "span"
	// APIVersion is the API version of this module.
	APIVersion = "1.0.0"
	// VersionCrc is the CRC of this module.
	VersionCrc = 0x2a11ff26
)

// SwInterfaceSpanDetails represents VPP binary API message 'sw_interface_span_details'.
type SwInterfaceSpanDetails struct {
	SwIfIndexFrom uint32
	SwIfIndexTo   uint32
	State         uint8
	IsL2          uint8
}

func (*SwInterfaceSpanDetails) GetMessageName() string {
	return "sw_interface_span_details"
}
func (*SwInterfaceSpanDetails) GetCrcString() string {
	return "23966371"
}
func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

// SwInterfaceSpanDump represents VPP binary API message 'sw_interface_span_dump'.
type SwInterfaceSpanDump struct {
	IsL2 uint8
}

func (*SwInterfaceSpanDump) GetMessageName() string {
	return "sw_interface_span_dump"
}
func (*SwInterfaceSpanDump) GetCrcString() string {
	return "67c54650"
}
func (*SwInterfaceSpanDump) GetMessageType() api.MessageType {
	return api.RequestMessage
}

// SwInterfaceSpanEnableDisable represents VPP binary API message 'sw_interface_span_enable_disable'.
type SwInterfaceSpanEnableDisable struct {
	SwIfIndexFrom uint32
	SwIfIndexTo   uint32
	State         uint8
	IsL2          uint8
}

func (*SwInterfaceSpanEnableDisable) GetMessageName() string {
	return "sw_interface_span_enable_disable"
}
func (*SwInterfaceSpanEnableDisable) GetCrcString() string {
	return "7216258d"
}
func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType {
	return api.RequestMessage
}

// SwInterfaceSpanEnableDisableReply represents VPP binary API message 'sw_interface_span_enable_disable_reply'.
type SwInterfaceSpanEnableDisableReply struct {
	Retval int32
}

func (*SwInterfaceSpanEnableDisableReply) GetMessageName() string {
	return "sw_interface_span_enable_disable_reply"
}
func (*SwInterfaceSpanEnableDisableReply) GetCrcString() string {
	return "e8d4e804"
}
func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func init() {
	api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "span.SwInterfaceSpanDetails")
	api.RegisterMessage((*SwInterfaceSpanDump)(nil), "span.SwInterfaceSpanDump")
	api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "span.SwInterfaceSpanEnableDisable")
	api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "span.SwInterfaceSpanEnableDisableReply")
}

// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
	return []api.Message{
		(*SwInterfaceSpanDetails)(nil),
		(*SwInterfaceSpanDump)(nil),
		(*SwInterfaceSpanEnableDisable)(nil),
		(*SwInterfaceSpanEnableDisableReply)(nil),
	}
}

// RPCService represents RPC service API for span module.
type RPCService interface {
	DumpSwInterfaceSpan(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_DumpSwInterfaceSpanClient, error)
	SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error)
}

type serviceClient struct {
	ch api.Channel
}

func NewServiceClient(ch api.Channel) RPCService {
	return &serviceClient{ch}
}

func (c *serviceClient) DumpSwInterfaceSpan(ctx context.Context, in *SwInterfaceSpanDump) (RPCService_DumpSwInterfaceSpanClient, error) {
	stream := c.ch.SendMultiRequest(in)
	x := &serviceClient_DumpSwInterfaceSpanClient{stream}
	return x, nil
}

type RPCService_DumpSwInterfaceSpanClient interface {
	Recv() (*SwInterfaceSpanDetails, error)
}

type serviceClient_DumpSwInterfaceSpanClient struct {
	api.MultiRequestCtx
}

func (c *serviceClient_DumpSwInterfaceSpanClient) Recv() (*SwInterfaceSpanDetails, error) {
	m := new(SwInterfaceSpanDetails)
	stop, err := c.MultiRequestCtx.ReceiveReply(m)
	if err != nil {
		return nil, err
	}
	if stop {
		return nil, io.EOF
	}
	return m, nil
}

func (c *serviceClient) SwInterfaceSpanEnableDisable(ctx context.Context, in *SwInterfaceSpanEnableDisable) (*SwInterfaceSpanEnableDisableReply, error) {
	out := new(SwInterfaceSpanEnableDisableReply)
	err := c.ch.SendRequest(in).ReceiveReply(out)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// This is a compile-time assertion to ensure that this generated file
// is compatible with the GoVPP api package it is being compiled against.
// A compilation error at this line likely means your copy of the
// GoVPP api package needs to be updated.
const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package

// Reference imports to suppress errors if they are not otherwise used.
var _ = api.RegisterMessage
var _ = bytes.NewBuffer
var _ = context.Background
var _ = io.Copy
var _ = strconv.Itoa
var _ = struc.Pack


text:
@interface FeedbackViewController ()<MFMailComposeViewControllerDelegate,UINavigationControllerDelegate>

@end

@implementation FeedbackViewController

- (UIStatusBarStyle) preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = @"Feedback";

    self.view.backgroundColor = [UIColor colorWithRed:239.0/255.0 green:239.0/255.0 blue:243.0/255.0 alpha:1.0];

    UIButton *leaveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leaveBtn.frame = CGRectMake(-2, 7, self.view.width+4, 44);
    leaveBtn.backgroundColor = [UIColor whiteColor];
    leaveBtn.layer.borderWidth = 1;
    [leaveBtn setTitle:@"Leave Feedback" forState:UIControlStateNormal];
    [leaveBtn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [leaveBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
    [leaveBtn addTarget:self action:@selector(leaveBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    leaveBtn.layer.borderColor = [[UIColor colorWithRed:224.0/255.0 green:224.0/255.0 blue:229.0/255.0 alpha:1.0] CGColor];

    UILabel *lblVersion = [[UILabel alloc] initWithFrame:CGRectMake(0, self.view.height-100, self.view.width, 20)];
    lblVersion.text = @"Version 1.0";
    lblVersion.textColor = [UIColor grayColor];
    lblVersion.textAlignment = NSTextAlignmentCenter;

    [self.view addSubview:leaveBtn];
    [self.view addSubview:lblVersion];
    // Do any additional setup after loading the view.
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

}
- (void)leaveBtnClicked {
    MFMailComposeViewController *mailCompose = [[MFMailComposeViewController alloc] init];
    mailCompose.navigationBar.tintColor = [UIColor whiteColor];
    mailCompose.mailComposeDelegate = self;
    [mailCompose setSubject:@"Feedback"];
    [mailCompose setToRecipients:[NSArray arrayWithObjects:@"ideaboxapp@yahoo.com", nil]];
    [self.navigationController presentViewController:mailCompose animated:YES completion:^{
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error  {
    switch (result)
    {
        case MFMailComposeResultCancelled: {

            break;
        }
        case MFMailComposeResultSaved: {
            SCLAlertView *alert = [[SCLAlertView alloc] init];
            alert.shouldDismissOnTapOutside = YES;

            [alert alertIsDismissed:^{
                NSLog(@"SCLAlertView dismissed!");
            }];

            [alert showNotice:self title:@"Wefie Pic Email Send" subTitle:@"Saved to Draft!" closeButtonTitle:nil duration:2.0f];

            break;

        }
        case MFMailComposeResultSent: {
            SCLAlertView *alert = [[SCLAlertView alloc] init];
            alert.shouldDismissOnTapOutside = YES;

            [alert alertIsDismissed:^{
                NSLog(@"SCLAlertView dismissed!");
            }];

            [alert showSuccess:self title:@"Wefie Pic Email Send" subTitle:@"Successfully sent!" closeButtonTitle:nil duration:2.0f];

            break;
        }
        case MFMailComposeResultFailed: {

            SCLAlertView *alert = [[SCLAlertView alloc] init];
            alert.shouldDismissOnTapOutside = YES;

            [alert alertIsDismissed:^{
                NSLog(@"SCLAlertView dismissed!");
            }];

            [alert showError:self title:@"Wefie Pic Email Send" subTitle:@"Failed to Send!" closeButtonTitle:nil duration:2.0f];

            break;
        }
        default:
        {
            SCLAlertView *alert = [[SCLAlertView alloc] init];
            alert.shouldDismissOnTapOutside = YES;

            [alert alertIsDismissed:^{
                NSLog(@"SCLAlertView dismissed!");
            }];

            [alert showError:self title:@"Wefie Pic Email Send" subTitle:@"Failed to Send" closeButtonTitle:nil duration:2.0f];

            break;
        }
    }
    [self dismissViewControllerAnimated:YES completion:nil];

}
@end


text:
package gov.va.cpe.vpr.termeng.jlv;

import java.util.Iterator;
import java.util.Map;

import gov.va.cpe.vpr.pom.jds.JdsOperations;
import gov.va.cpe.vpr.sync.vista.VistaDataChunk;
import gov.va.hmp.util.LoggingUtil;
import gov.va.hmp.util.NullChecker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.core.JmsOperations;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

public class JLVDocDefUtil {
    private static final Logger LOG = LoggerFactory.getLogger(JLVDocDefUtil.class);

    private JdsOperations jdsTemplate;

    public JLVDocDefUtil(JdsOperations jdsTemplate) {
        super();
        this.jdsTemplate = jdsTemplate;
    }

    public JdsOperations getJdsTemplate() {
        return jdsTemplate;
    }

    public void setJdsTemplate(JdsOperations jdsTemplate) {
        this.jdsTemplate = jdsTemplate;
    }

    private String getVuidForDocDefId(String sDocDefUid) {
        String sVuid = "";

        JsonNode jsonResponse = jdsTemplate.getForJsonNode("/data/" + sDocDefUid);
        if (jsonResponse != null) {
            JsonNode itemsNode = jsonResponse.path("data").path("items");
            if ((itemsNode != null) &&
                (itemsNode.isArray())) {
                Iterator<JsonNode> itemIterator = itemsNode.iterator();
                while (itemIterator.hasNext()) {
                    JsonNode itemNode = itemIterator.next();
                    JsonNode nationalTitleVuidNode = itemNode.path("nationalTitle").path("vuid");
                    if ((nationalTitleVuidNode != null) &&
                        (nationalTitleVuidNode.isTextual())) {
                        sVuid = nationalTitleVuidNode.asText();
                    }
                }
            }
        }

        return sVuid;
    }

    public void insertVuidFromDocDefUid(VistaDataChunk chunk) {
        if ((chunk != null) && (jdsTemplate != null)) {
            LOG.debug("insertVuidFromDocDefUid: jmsTemplate was AutoWired - Yeah!!!");
            @SuppressWarnings("unused")
            Map<String, Object> chunkMap = chunk.getJsonMap();
            LOG.debug("insertVuidFromDocDefUid: before change - chunkMap:" + LoggingUtil.mapContentsOutput("   ", "chunkMap: ", chunkMap));
            LOG.debug("insertVuidFromDocDefUid: before change - content:" + chunk.getContent());
            LOG.debug("insertVuidFromDocDefUid: before change - json:" + chunk.getJson());

            Object oDocDefUid = chunkMap.get("documentDefUid");
            if ((oDocDefUid != null) &&
                (oDocDefUid instanceof String)) {
                String sDocDefUid = (String) oDocDefUid;
                String sVuid = getVuidForDocDefId(sDocDefUid);

                if (NullChecker.isNotNullish(sVuid)) {
                    chunkMap.put("documentDefUidVuid", sVuid);
                    ObjectMapper jsonMapper = new ObjectMapper();
                    try {
                        String sContent = jsonMapper.writeValueAsString(chunkMap);
                        chunk.setContent(sContent);
                    } catch (JsonProcessingException e) {
                        LOG.error("insertVuidFromDocDefUid: Exception occurred updating content  for vuid: " + sVuid, e);
                    }

                    LOG.debug("insertVuidFromDocDefUid: inserted vuid: " + sVuid + " into map for documentDefUid: " + sDocDefUid);
                }
                else {
                    LOG.debug("insertVuidFromDocDefUid: no vuid found for documentDefUid: " + sDocDefUid);
                }
            }
            else {
                LOG.debug("insertVuidFromDocDefUid: no documentDefUid found");
            }
        }
        else {
            LOG.debug("insertVuidFromDocDefUid: jmsTemplate was null - Boo!!!");
        }
    }
}


text:
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography;

internal partial class Interop
{
    internal static unsafe void GetRandomBytes(byte* buffer, int length)
    {
        if (!LocalAppContextSwitches.UseNonRandomizedHashSeed)
        {
            using (RandomNumberGenerator rng = RandomNumberGenerator.Create())
            {
                byte[] tmp = new byte[length];
                rng.GetBytes(tmp);
                Marshal.Copy(tmp, 0, (IntPtr)buffer, length);
            }
        }
    }
}


text:
<?php
include "config.php";
$response = array();
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'https://api.coinhive.com/user/top?secret='.$coinHiveSecret.'&count=10',
    CURLOPT_CONNECTTIMEOUT => 3,
    CURLOPT_TIMEOUT => 5
));
$result = curl_exec($curl);
$json = json_decode($result,true);
foreach($json['users'] as $i => $values){
  $username = htmlentities($values['name']);
  $response[$values['name']] = htmlentities($values['total']);
}
echo json_encode($response);
curl_close($curl);


text:
package com.namelessdev.mpdroid.fragments;

import com.anpmech.mpd.exception.MPDException;
import com.anpmech.mpd.item.Artist;
import com.anpmech.mpd.item.Genre;
import com.anpmech.mpd.item.PlaylistFile;
import com.namelessdev.mpdroid.R;
import com.namelessdev.mpdroid.library.ILibraryFragmentActivity;
import com.namelessdev.mpdroid.tools.Tools;

import android.os.Bundle;
import android.os.Parcelable;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;

import java.io.IOException;
import java.util.Collections;

public class GenresFragment extends BrowseFragment<Genre> {

    private static final String TAG = "GenresFragment";

    public GenresFragment() {
        super(R.string.addGenre, R.string.genreAdded);
    }

    @Override
    protected void add(final Genre item, final boolean replace, final boolean play) {
        try {
            mApp.getMPD().add(item, replace, play);
            Tools.notifyUser(mIrAdded, item);
        } catch (final IOException | MPDException e) {
            Log.e(TAG, "Failed to add all from playlist.", e);
        }
    }

    @Override
    protected void add(final Genre item, final PlaylistFile playlist) {
        try {
            mApp.getMPD().addToPlaylist(playlist, item);
            Tools.notifyUser(mIrAdded, item);
        } catch (final IOException | MPDException e) {
            Log.e(TAG, "Failed to add all genre to playlist.", e);
        }
    }

    @Override
    protected void asyncUpdate() {
        try {
            replaceItems(mApp.getMPD().getGenreResponse());
            Collections.sort(mItems);
        } catch (final IOException | MPDException e) {
            Log.e(TAG, "Failed to update list of genres.", e);
        }
    }

    @Override
    protected Artist getArtist(final Genre item) {
        return null;
    }

    /**
     * This method returns the default string resource.
     *
     * @return The default string resource.
     */
    @Override
    @StringRes
    public int getDefaultTitle() {
        return R.string.genres;
    }

    @Override
    @StringRes
    public int getLoadingText() {
        return R.string.loadingGenres;
    }

    @Override
    public void onItemClick(final AdapterView<?> parent, final View view, final int position,
            final long id) {
        final Bundle bundle = new Bundle(1);
        final Fragment fragment =
                Fragment.instantiate(getActivity(), ArtistsFragment.class.getName(), bundle);

        bundle.putParcelable(Genre.EXTRA, (Parcelable) mItems.get(position));

        ((ILibraryFragmentActivity) getActivity()).pushLibraryFragment(fragment, Artist.EXTRA);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar
        android:id="@+id/my_awesome_toolbar"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary" />

    <include layout="@layout/activity_fragment_container" />

</LinearLayout>


text:
package com.allanbank.mongodb.builder;

import static com.allanbank.mongodb.util.Assertions.assertNotEmpty;

import java.util.concurrent.TimeUnit;

import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.annotation.concurrent.ThreadSafe;

import com.allanbank.mongodb.MongoCollection;
import com.allanbank.mongodb.ReadPreference;
import com.allanbank.mongodb.Version;
import com.allanbank.mongodb.bson.Document;
import com.allanbank.mongodb.bson.DocumentAssignable;

/**
 * Distinct provides container for all of the options to a <tt>distinct</tt>
 * command. A {@link Builder} is provided to assist in creating a
 * {@link Distinct}.
 *
 * @api.yes This class is part of the driver's API. Public and protected members
 *          will be deprecated for at least 1 non-bugfix release (version
 *          numbers are <major>.<minor>.<bugfix>) before being
 *          removed or modified.
 * @copyright 2012-2013, Allanbank Consulting, Inc., All Rights Reserved
 */
@Immutable
@ThreadSafe
public class Distinct {
    /**
     * The first version of MongoDB to support the {@code distinct} command with
     * the ability to limit the execution time on the server.
     */
    public static final Version MAX_TIMEOUT_VERSION = Find.MAX_TIMEOUT_VERSION;

    /**
     * Creates a new builder for a {@link Distinct}.
     *
     * @return The builder to construct a {@link Distinct}.
     */
    public static Builder builder() {
        return new Builder();
    }

    /** The name of the key to collect distinct values for. */
    private final String myKey;

    /** The maximum amount of time to allow the command to run. */
    private final long myMaximumTimeMilliseconds;

    /** The query to select document to perform a distinct query across. */
    private final Document myQuery;

    /** The read preference to use. */
    private final ReadPreference myReadPreference;

    /**
     * Creates a new Distinct.
     *
     * @param builder
     *            The builder to copy the state from.
     * @throws IllegalArgumentException
     *             If neither the {@link #getKey() key} is null or
     *             empty.
     */
    protected Distinct(final Builder builder) {
        assertNotEmpty(builder.myKey,
                "The distinct's command key cannot be null or empty.");

        myKey = builder.myKey;
        myQuery = builder.myQuery;
        myReadPreference = builder.myReadPreference;
        myMaximumTimeMilliseconds = builder.myMaximumTimeMilliseconds;
    }

    /**
     * Returns the name of the key to collect distinct values for.
     *
     * @return The name of the key to collect distinct values for.
     */
    public String getKey() {
        return myKey;
    }

    /**
     * Returns the maximum amount of time to allow the command to run on the
     * Server before it is aborted.
     *
     * @return The maximum amount of time to allow the command to run on the
     *         Server before it is aborted.
     *
     * @since MongoDB 2.6
     */
    public long getMaximumTimeMilliseconds() {
        return myMaximumTimeMilliseconds;
    }

    /**
     * Returns the query to select the documents to run the distinct against.
     *
     * @return The query to select the documents to run the distinct against.
     */
    public Document getQuery() {
        return myQuery;
    }

    /**
     * Returns the {@link ReadPreference} specifying which servers may be used
     * to execute the {@link Distinct} command.
     *

     * If null then the {@link MongoCollection} instance's
     * {@link ReadPreference} will be used.
     *

     *
     * @return The read preference to use.
     *
     * @see MongoCollection#getReadPreference()
     */
    public ReadPreference getReadPreference() {
        return myReadPreference;
    }

    /**
     * Builder provides support for creating a {@link Distinct} object.
     *
     * @api.yes This class is part of the driver's API. Public and protected
     *          members will be deprecated for at least 1 non-bugfix release
     *          (version numbers are <major>.<minor>.<bugfix>)
     *          before being removed or modified.
     * @copyright 2012-2013, Allanbank Consulting, Inc., All Rights Reserved
     */
    @NotThreadSafe
    public static class Builder {

        /** The name of the key to collect distinct values for. */
        protected String myKey;

        /** The maximum amount of time to allow the command to run. */
        protected long myMaximumTimeMilliseconds;

        /** The query to select document to perform a distinct query across. */
        protected Document myQuery;

        /** The read preference to use. */
        protected ReadPreference myReadPreference;

        /**
         * Creates a new Builder.
         */
        public Builder() {
            reset();
        }

        /**
         * Creates a new {@link GroupBy} based on the current state of the
         * builder.
         *
         * @return A new {@link GroupBy} based on the current state of the
         *         builder.
         * @throws IllegalArgumentException
         *             If neither the {@link #setKey key} is null
         *             or empty.
         */
        public Distinct build() throws IllegalArgumentException {
            return new Distinct(this);
        }

        /**
         * Sets the name of the key to collect distinct values for.
         *

         * This method delegates to {@link #setKey(String)}.
         *

         *
         * @param key
         *            The new name of the key to collect distinct values for.
         * @return This {@link Builder} for method call chaining.
         */
        public Builder key(final String key) {
            return setKey(key);
        }

        /**
         * Sets the maximum number of milliseconds to allow the command to run
         * before aborting the request on the server.
         *

         * This method equivalent to {@link #setMaximumTimeMilliseconds(long)
         * setMaximumTimeMilliseconds(timeLimitUnits.toMillis(timeLimit)}.
         *

         *
         * @param timeLimit
         *            The new maximum amount of time to allow the command to
         *            run.
         * @param timeLimitUnits
         *            The units for the maximum amount of time to allow the
         *            command to run.
         *
         * @return This {@link Builder} for method call chaining.
         *
         * @since MongoDB 2.6
         */
        public Builder maximumTime(final long timeLimit,
                final TimeUnit timeLimitUnits) {
            return setMaximumTimeMilliseconds(timeLimitUnits
                    .toMillis(timeLimit));
        }

        /**
         * Sets the value of the query to select the documents to run the
         * distinct against.
         *

         * This method delegates to {@link #setQuery(DocumentAssignable)}.
         *

         *
         * @param query
         *            The new value for the query to select the documents to run
         *            the distinct against.
         * @return This {@link Builder} for method call chaining.
         */
        public Builder query(final DocumentAssignable query) {
            return setQuery(query);
        }

        /**
         * Sets the {@link ReadPreference} specifying which servers may be used
         * to execute the {@link Distinct} command.
         *

         * If not set or set to null then the
         * {@link MongoCollection} instance's {@link ReadPreference} will be
         * used.
         *

         *

         * This method delegates to {@link #setReadPreference(ReadPreference)}.
         *

         *
         * @param readPreference
         *            The read preferences specifying which servers may be used.
         * @return This builder for chaining method calls.
         *
         * @see MongoCollection#getReadPreference()
         */
        public Builder readPreference(final ReadPreference readPreference) {
            return setReadPreference(readPreference);
        }

        /**
         * Resets the builder back to its initial state.
         *
         * @return This {@link Builder} for method call chaining.
         */
        public Builder reset() {
            myKey = null;
            myQuery = null;
            myReadPreference = null;
            myMaximumTimeMilliseconds = 0;

            return this;
        }

        /**
         * Sets the name of the key to collect distinct values for.
         *
         * @param key
         *            The new name of the key to collect distinct values for.
         * @return This {@link Builder} for method call chaining.
         */
        public Builder setKey(final String key) {
            myKey = key;
            return this;
        }

        /**
         * Sets the maximum number of milliseconds to allow the command to run
         * before aborting the request on the server.
         *
         * @param maximumTimeMilliseconds
         *            The new maximum number of milliseconds to allow the
         *            command to run.
         * @return This {@link Builder} for method call chaining.
         *
         * @since MongoDB 2.6
         */
        public Builder setMaximumTimeMilliseconds(
                final long maximumTimeMilliseconds) {
            myMaximumTimeMilliseconds = maximumTimeMilliseconds;
            return this;
        }

        /**
         * Sets the value of the query to select the documents to run the
         * distinct against.
         *
         * @param query
         *            The new value for the query to select the documents to run
         *            the distinct against.
         * @return This {@link Builder} for method call chaining.
         */
        public Builder setQuery(final DocumentAssignable query) {
            myQuery = query.asDocument();
            return this;
        }

        /**
         * Sets the {@link ReadPreference} specifying which servers may be used
         * to execute the {@link Distinct} command.
         *

         * If not set or set to null then the
         * {@link MongoCollection} instance's {@link ReadPreference} will be
         * used.
         *

         *
         * @param readPreference
         *            The read preferences specifying which servers may be used.
         * @return This builder for chaining method calls.
         *
         * @see MongoCollection#getReadPreference()
         */
        public Builder setReadPreference(final ReadPreference readPreference) {
            myReadPreference = readPreference;
            return this;
        }
    }
}


text:
package io.getquill.context.async.postgres

import com.github.mauricio.async.db.QueryResult

import scala.concurrent.ExecutionContext.Implicits.global
import io.getquill.{ Literal, PostgresAsyncContext, Spec }

class PostgresAsyncContextSpec extends Spec {

  import testContext._

  "run non-batched action" in {
    val insert = quote { (i: Int) =>
      qr1.insert(_.i -> i)
    }
    await(testContext.run(insert(lift(1)))) mustEqual 1
  }

  "Insert with returning with single column table" in {
    val inserted: Long = await(testContext.run {
      qr4.insert(lift(TestEntity4(0))).returning(_.i)
    })
    await(testContext.run(qr4.filter(_.i == lift(inserted))))
      .head.i mustBe inserted
  }

  "performIO" in {
    await(performIO(runIO(qr4).transactional))
  }

  "probe" in {
    probe("select 1").toOption mustBe defined
  }

  "cannot extract" in {
    object ctx extends PostgresAsyncContext(Literal, "testPostgresDB") {
      override def extractActionResult[O](
        returningColumn:    String,
        returningExtractor: ctx.Extractor[O]
      )(result: QueryResult) =
        super.extractActionResult(returningColumn, returningExtractor)(result)
    }
    intercept[IllegalStateException] {
      ctx.extractActionResult("w/e", row => 1)(new QueryResult(0, "w/e"))
    }
    ctx.close
  }

  "prepare" in {
    testContext.prepareParams("", ps => (Nil, ps ++ List("Sarah", 127))) mustEqual List("'Sarah'", "127")
  }

  override protected def beforeAll(): Unit = {
    await(testContext.run(qr1.delete))
    ()
  }
}


text:
// Copyright 2020 The gVisor Authors.
//
// 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.

// Package fsmetric defines filesystem metrics.
package fsmetric

import (
	"time"

	"gvisor.dev/gvisor/pkg/metric"
)

// RecordWaitTime enables the ReadWait, GoferReadWait9P, GoferReadWaitHost, and
// TmpfsReadWait metrics. Enabling this comes at a CPU cost due to performing
// three clock reads per read call.
//
// Note that this is only performed in the direct read path, and may not be
// consistently applied for other forms of reads, such as splice.
var RecordWaitTime = false

// Metrics that apply to all filesystems.
var (
	Opens    = metric.MustCreateNewUint64Metric("/fs/opens", false /* sync */, "Number of file opens.")
	Reads    = metric.MustCreateNewUint64Metric("/fs/reads", false /* sync */, "Number of file reads.")
	ReadWait = metric.MustCreateNewUint64NanosecondsMetric("/fs/read_wait", false /* sync */, "Time waiting on file reads, in nanoseconds.")
)

// Metrics that only apply to fs/gofer and fsimpl/gofer.
var (
	GoferOpens9P      = metric.MustCreateNewUint64Metric("/gofer/opens_9p", false /* sync */, "Number of times a file was opened from a gofer and did not have a host file descriptor.")
	GoferOpensHost    = metric.MustCreateNewUint64Metric("/gofer/opens_host", false /* sync */, "Number of times a file was opened from a gofer and did have a host file descriptor.")
	GoferReads9P      = metric.MustCreateNewUint64Metric("/gofer/reads_9p", false /* sync */, "Number of 9P file reads from a gofer.")
	GoferReadWait9P   = metric.MustCreateNewUint64NanosecondsMetric("/gofer/read_wait_9p", false /* sync */, "Time waiting on 9P file reads from a gofer, in nanoseconds.")
	GoferReadsHost    = metric.MustCreateNewUint64Metric("/gofer/reads_host", false /* sync */, "Number of host file reads from a gofer.")
	GoferReadWaitHost = metric.MustCreateNewUint64NanosecondsMetric("/gofer/read_wait_host", false /* sync */, "Time waiting on host file reads from a gofer, in nanoseconds.")
)

// Metrics that only apply to fs/tmpfs and fsimpl/tmpfs.
var (
	TmpfsOpensRO  = metric.MustCreateNewUint64Metric("/in_memory_file/opens_ro", false /* sync */, "Number of times an in-memory file was opened in read-only mode.")
	TmpfsOpensW   = metric.MustCreateNewUint64Metric("/in_memory_file/opens_w", false /* sync */, "Number of times an in-memory file was opened in write mode.")
	TmpfsReads    = metric.MustCreateNewUint64Metric("/in_memory_file/reads", false /* sync */, "Number of in-memory file reads.")
	TmpfsReadWait = metric.MustCreateNewUint64NanosecondsMetric("/in_memory_file/read_wait", false /* sync */, "Time waiting on in-memory file reads, in nanoseconds.")
)

// StartReadWait indicates the beginning of a file read.
func StartReadWait() time.Time {
	if !RecordWaitTime {
		return time.Time{}
	}
	return time.Now()
}

// FinishReadWait indicates the end of a file read whose time is accounted by
// m. start must be the value returned by the corresponding call to
// StartReadWait.
//
// FinishReadWait is marked nosplit for performance since it's often called
// from defer statements, which prevents it from being inlined
// (https://github.com/golang/go/issues/38471).
//
//go:nosplit
func FinishReadWait(m *metric.Uint64Metric, start time.Time) {
	if !RecordWaitTime {
		return
	}
	m.IncrementBy(uint64(time.Since(start).Nanoseconds()))
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<content>this is xml</content>


text:
/*
 * getData.js created by
 * Martin Roberge (c) 2013
 * October 1, 2013
 *
 * Department of Geography and Environmental Planning
 * Towson University
 */

function randomData(n) {//create n pairs of random points
  for (var i = 0; i < n; i++) {
    data[i] = {
      date : new Date(i + 1279568749000), //This creates a date starting at three years ago from when I wrote this
      value : Math.random()
    };

  };
}

function getUSGSlocal(id) {//This function is for grabbing USGS data objects that are stored locally in WaterJSON format.
  //var filename = id;
  var filename = id + ".txt";
  //my local server will not serve files with JSON extensions, so I renamed them with .txt extensions.
  //request data & deal with errors
  d3.json(filename, function(error, json) {
    if (error) {
      return console.warn(error);
    }
    //parse data into proper format. Since every source will have a unique object format, we can't reuse this code for different types of source.
    temp = json.value.timeSeries[0].values[0].value;
    //MR Create a new array of objects from the JSON.
    //data = [];//Clear out the array.
    temp.forEach(function(d, index, array) {
      d.date = new Date(d.dateTime);
      d.value = +d.value;
      data[index] = {
        date : d.date,
        value : d.value
      };
    });

    //console.log(data);
    //mySort(data);
    //console.log(data);

    //add the new data object to the stack of plotdata.
    //plotdata.push(data);
    //Call the function that creates the graph.
    //hydrograph(id);
    //loghistogram(id);
    //flowduration(id);
    //the id parameter is just temporary.
  });
};

function parseusgs(json) {
  temp = json.value.timeSeries[0].values[0].value;
  //MR Create a new array of objects from the JSON.
  data = [];
  //Clear out the array.
  temp.forEach(function(d, index, array) {
    d.date = new Date(d.dateTime);
    d.value = +d.value;
    data[index] = {
      date : d.date,
      value : d.value
    };
  });
  data.sort(function(a, b) {
    return a.date < b.date ? 1 : a.date > b.date ? -1 : 0;
  });
  //Don't assume data are sorted by date yet.
}

/*
var dataEvent = new CustomEvent(
"dataReady",
{
detail : {"siteID" : "01585200"},
bubbles: true,
cancelable: true
}
);
document.addEventListener("dataReady",hydrograph(e.detail.siteID),false);
*/
//var myEvent = new Event("parsed");
//var body = document.getElementById("body").addEventListener("parsed", function (e){alert("parsed!" + e)}, false);

function getUSGS2(id) {
  if (id == "local") {
    var filename = "resources/USGSshort.txt";
  } else {
    var filename = "https://waterservices.usgs.gov/nwis/iv/?format=json&sites=" + id + "&period=P30D&parameterCd=00060";
  }
  //request data & deal with errors

  var xhr = d3.json(filename).on("progress", function() {
    console.log("progress", d3.event.loaded);
  }).on("error", function(error) {
    if (error.status === 0) {
      alert("CORS is not enabled.");
    };
    console.warn("failure!", error);
  }).on("load", function(json) {
    console.log("success!");
    temp = json.value.timeSeries[0].values[0].value;
    //MR Create a new array of objects from the JSON.
    data = [];
    //Clear out the array.
    temp.forEach(function(d, index, array) {
      d.date = new Date(d.dateTime);
      d.value = +d.value;
      data[index] = {
        date : d.date,
        value : d.value
      };
    });

    //Don't assume data are sorted by date yet.
    //document.getElementById("body").dispatchEvent(dataEvent);//post flag that the new data is ready

    //    body.dispatchEvent(myEvent2);//IE doesn't allow the creation of custom events.

    //hydrograph(id);
    //flowduration(id);
    //loghistogram(id);
  }).get();
};

function getUSGS(id) {
  if (id == "local") {
    var filename = "resources/USGSshort.txt";
  } else {
    var filename = "https://waterservices.usgs.gov/nwis/iv/?format=json&sites=" + id + "&period=P30D&parameterCd=00060";
  }
  d3.json(filename, function(error, json) {
    if (error) {
      if (error.status === 0) {
        alert("CORS is not enabled.");
      };
      return console.warn(error);
    }
    //if (!json.value.timeSeries[0].values[0].value){console.warn("there is no data for this site")};
    temp = json.value.timeSeries[0].values[0].value;
    //I need to check if this even has a value!!
    //MR Create a new array of objects from the JSON.
    data = [];
    //Clear out the array.
    temp.forEach(function(d, index, array) {
      d.date = new Date(d.dateTime);
      d.value = +d.value;
      data[index] = {
        date : d.date,
        value : d.value
      };
    });

    //    target.dispatchEvent(myEvent2);
    //hydrograph(id);
    //flowduration(id);
    //loghistogram(id);
  });

};

function getMike(id) {//This function is for grabbing data from the HydroCloud server.
  var filename = "https://10.55.17.169:28017/hydroCloudTest/id01582500/?";
  //Not allowed due to cross-domain request.

  //var filename = id + ".txt"; //A temp workaround the cross-domain issue. Requests a local file to test this function.
  //request data & deal with errors
  d3.json(filename, function(error, json) {
    if (error)
      return console.warn(error);
    //parse data into proper format. Since every source will have a unique object format, we can't reuse this code for different types of source.
    temp = json.rows;
    temp.forEach(function(d, index, array) {
      d.date = new Date(d.time);
      //parse the text into a date object.
      d.value = +d.data.discharge;
      //parse the discharge text into an integer.
      data[index] = {
        date : d.date,
        value : d.value
      };
      //store the parsed values in my data array.
    });

    //add the new data object to the stack of plotdata.
    //plotdata.push(data);
    //Call the function that creates the graph.
    hydrograph(id);
    //loghistogram(id);
    //the id parameter is just temporary.
  });
};

function getMike2(id) {//This function is for grabbing data from the HydroCloud server.
  //var filename = "https://10.55.17.169:28017/hydroCloudTest/id01582500/?";//Not allowed due to cross-domain request.
  //var filename = "https://10.55.17.48:5000/show_data/id01585200/2012-01-05/2013-06-12";
  var filename = "id01585200.json";
  //var filename = id + ".txt"; //A temp workaround the cross-domain issue. Requests a local file to test this function.
  //request data & deal with errors
  d3.json(filename, function(error, json) {
    if (error)
      return console.warn(error);
    //parse data into proper format. Since every source will have a unique object format, we can't reuse this code for different types of source.
    //console.log(json);
    //temp = json.rows;
    temp = json;
    temp.forEach(function(d, index, array) {
      d.date = new Date(d.time);
      //parse the text into a date object.
      d.value = +d.data.discharge;
      //parse the discharge text into an integer.
      data[index] = {
        date : d.date,
        value : d.value
      };
      //store the parsed values in my data array.
    });

    //add the new data object to the stack of plotdata.
    //plotdata.push(data);
    //Call the function that creates the graph.
    hydrograph(id);
    //loghistogram(id);
    //the id parameter is just temporary.
  });
};


text:
<!DOCTYPE html>

  <title>RxFiddle</title>
  <meta charset="utf8" />
  <link rel="stylesheet" href="styles/style.css" type="text/css">
  <link rel="stylesheet" href="styles/survey.css" type="text/css">
  <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1">

        Back to survey

FAQ

What is (the goal of) RxFiddle?

RxFiddle has multiple goals:

Aid developers in understanding reactive code

Aid new developers to learn the reactive paradigm

Aid developers finding bugs in reactive code

The common goal here is to help developers. Whether you are building something yourself, viewing some code
                  of a collegue or learning Rx. Make doing Reactive Programming easier than ever. I wanted to do something
                  back after Rx gave me such a powerfull development tool.

Why go for RxJS version 4.1

Rx is available in many flavors. I investigated whether it is possible to instrument RxJava and RxJs and
                  found out both the JVM and JavaScript libraries are perfectly instrumentable. Considering the visualization
                  tool is browser based the development cycle could be sped up by using a in-browser instrumented version
                  of Rx.

Using RxJS 4.1 is mainly an effect of what I had available when I started of with extending RxMarbles. Creating
                  instumentation for RxJS 5 should be possible too but I expect some more work because of the new ecmascript
                  module structure of version 5.

Update [2017-05-02]: version 5 is (mostly) supported in the version that is available at
                  rxfiddle.net. Be aware that version 5 brings Ecmascript modules into
                  the mix, which makes it harder to swap prototypes (module exports are immutable). Furthermore version 5
                  has some performance features which we need to revert in order to create a full model of the program (affecting
                  ScalarObservables). This should not affect your program in any other way than it's performance, but for
                  non-high-througput samples you should be fine.

It isn't that hard right?

Actually, it is. During the last year I found out just how complicated instrumentation, call stacks and visualization
                  are. Instrumenting Javascript is relatively easy - you just swap the prototype - but you do need a lot
                  of bookkeeping to relate all the gathered information to Observables, Observers and the events flowing
                  through. If you have got the basic map and filter operators working you are still far from done: throw
                  Subjects into the mix and your whole world turns upside down. Same for higher order streams and merging
                  them.

 And you can't just be lazy and correct stuff once you have more information. We are talking Rx here so I
                  wanted everything to be streamed, push based. Any intermediate debug state should be a valid state itself.

Why do a thesis on Reactive Programming / ReactiveX?

I first used Rx.NET in 2013 while doing the last project as an undergraduate student. I remember that it
                  took me quite some time to fully understand the concepts of reactive programming. I did not really see
                  how the data would flow through the stream unless I sprinkled println statements through the stream. When
                  I first used the debugger to step through that code I thought about how awesome it would be to have better
                  tooling. Fast forward to 2015 and I'm laying out the plan for the rest of my master, and there is Erik
                  Meijer - inventor of Rx - as a professor at my university (TU Delft, The Netherlands).

Why did you setup the survey this way?

The goal of the survey is to measure the difference between developing reactive programs using traditional
                  methodology and the development flow where the developer has the option to use RxFidle's capabilities.
                  I hope to speed-up and improve the comprehension of reactive code. The hypothesis is that using RxFiddle
                  the developer gains a better understanding of the reactive code and does so quicker.

This looks like... (RxMarbles, RxVision, etc.)

Yes! I got a lot of external inspiration. Andre Stalz has done some amazing work creating RxMarbles. I've
                  spend some time trying to evaluate whether I could just work with that and extend it, however RxMarbles
                  is mostly built around pre-specified examples, usable in for example the ReactiveX documentation, while
                  RxFiddle aims to visualize áll your reactive code and operators. No matter how crazy you get.

RxVision is doing something comparable to what RxFiddle is doing. It instruments the Rx prototype and plots
                  a visualization. I found it to be limited however. The implementation lacks support for many very common
                  operators and its visualization is very unclear to people who have never seen the tool. It does not really
                  relate to marble diagrams like I feel RxFiddle does.


text:
<?php
/**
 * Created by PhpStorm.
 * User: Dima
 * Date: 05.03.2016
 * Time: 15:10
 */

namespace interfaces;

use yii\db\ActiveRecordInterface;

interface ModelInterface extends ActiveRecordInterface
{
    /**
     * @return integer
     */
    public function getID();

    /*
     * @return string
     */
    public static function className();
}


text:
<?php

namespace insolita\wgadminlte;

use \yii\bootstrap\Widget;
use yii\helpers\Html;

/**
 * This is just an example.
 */
class Alert extends Widget
{
    const TYPE_SUCCESS = 'success';
    const TYPE_WARNING = 'warning';
    const TYPE_DANGER = 'danger';
    const TYPE_INFO = 'info';

    /**@var string $type color style of widget* */

    public $type = self::TYPE_SUCCESS;

    /**@var boolean $closable show or not close button* */
    public $closable = true;

    /**@var string $text your message* */
    public $text = '';

    /**@var string $icon icon class such as "ion ion-bag  or fa fa-beer"* */
    public $icon = '';

    public function init()
    {
        parent::init();
        if (!$this->icon) {
            switch ($this->type) {
            case self::TYPE_INFO: {
                $this->icon = 'fa fa-info';
                break;
            }
            case self::TYPE_DANGER: {
                $this->icon = 'fa fa-ban';
                break;
            }
            case self::TYPE_WARNING: {
                $this->icon = 'fa fa-warning';
                break;
            }
            case self::TYPE_SUCCESS: {
                $this->icon = 'fa fa-check';
                break;
            }
            default: {
                $this->icon = 'fa fa-question';
            }
            }
        }
    }

    public function run()
    {
        Html::addCssClass($this->options, 'alert');
        Html::addCssClass($this->options, 'alert-' . $this->type);
        if ($this->closable) {
            Html::addCssClass($this->options, 'alert-dismissable');
        }
        echo Html::tag(
            'div',
            '<i class="' . $this->icon . '"></i>'
            . (!$this->closable ? ''
                : '<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>')
            . $this->text
            , $this->options
        );
    }

}


text:
Project: /_project.yaml
Book: /_book.yaml

# Installing Bazel on Windows

This page describes the requirements and steps to install Bazel on Windows.
It also includes troubleshooting and other ways to install Bazel, such as
using Chocolatey or Scoop.

## Installing Bazel {:#installing-bazel}

This section covers the prerequisites, environment setup, and detailed
steps during installation on Windows.

### Check your system  {:#check-system}

Recommended: 64 bit Windows 10, version 1703 (Creators Update) or newer

To check your Windows version:

* Click the Start button.
* Type `winver` in the search box and press Enter.
* You should see the About Windows box with your Windows version information.

Also supported:

*   64 bit Windows 7 or newer

*   64 bit Windows Server 2008 R2 or newer

### Install the prerequisites {:#install-prerequisites}

*   [Visual C++ Redistributable for Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145){: .external}

### Download Bazel {:#download-bazel}

*Recommended*: [Use Bazelisk](/install/bazelisk)

Alternatively you can:

*   [Download the Bazel binary (`bazel-{{ '<var>' }}version{{ '</var>' }}-windows-x86_64.exe`) from
 GitHub](https://github.com/bazelbuild/bazel/releases){: .external}.
*   [Install Bazel from Chocolatey](#chocolately)
*   [Install Bazel from Scoop](#scoop)
*   [Build Bazel from source](/install/compile-source)

### Set up your environment {:#set-environment}

To make Bazel easily accessible from command prompts or PowerShell by default, you can rename the Bazel binary to `bazel.exe` and add it to your default paths.

```posix-terminal
set PATH=%PATH%;{{ '<var>' }}path to the Bazel binary{{ '</var>' }}
```

You can also change your system `PATH` environment variable to make it permanent. Check out how to [set environment variables](/docs/windows#set-environment-variables).

### Done {:#done}

"Success: You've installed Bazel."

To check the installation is correct, try to run:

```posix-terminal
bazel {{ '<var>' }}version{{ '</var>' }}
```

Next, you can check out more tips and guidance here:

*   [Installing compilers and language runtimes](#install-compilers)
*   [Troubleshooting](#troubleshooting)
*   [Best practices on Windows](/docs/windows#best-practices)
*   [Tutorials](/start/getting-started#tutorials)

## Installing compilers and language runtimes {:#install-compilers}

Depending on which languages you want to build, you will need:

*   [MSYS2 x86_64](https://www.msys2.org/){: .external}

    MSYS2 is a software distro and building platform for Windows. It contains Bash and common Unix
    tools (like `grep`, `tar`, `git`).

    You will need MSYS2 to build, test, or run targets that depend on Bash. Typically these are
    `genrule`, `sh_binary`, `sh_test`, but there may be more (such as Starlark rules). Bazel shows an
    error if a build target needs Bash but Bazel could not locate it.

*   Common MSYS2 packages

    You will likely need these to build and run targets that depend on Bash. MSYS2 does not install
    these tools by default, so you need to install them manually. Projects that depend on Bash tools in `PATH` need this step (for example TensorFlow).

    Open the MSYS2 terminal and run this command:

    ```posix-terminal
    pacman -S zip unzip patch diffutils git
    ```

    Optional: If you want to use Bazel from CMD or Powershell and still be able
    to use Bash tools, make sure to add
    `{{ '<var>' }}MSYS2_INSTALL_PATH{{ '</var>' }}/usr/bin` to your
    `PATH` environment variable.

*   [Build Tools for Visual Studio 2019](https://aka.ms/buildtools){:#install-vc}

    You will need this to build C++ code on Windows.

    Also supported:

    *   Visual Studio 2015 (or newer) with Visual C++ and Windows 10 SDK

    *   Visual C++ Build Tools 2015 (or newer) and Windows 10 SDK

*   [Java SE Development Kit 11 (JDK) for Windows x64](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html){: .external}{:#install-jdk}

    You will need this to build Java code on Windows.

    Also supported: Java 8, 9, and 10

*   [Python 3.6 for Windows x86-64](https://www.python.org/downloads/windows/){:#install-python}

    You will need this to build Python code on Windows.

    Also supported: Python 2.7 or newer for Windows x86-64

## Troubleshooting {:#troubleshooting}

### Bazel does not find Bash or bash.exe

**Possible reasons**:

*   you installed MSYS2 not under the default install path

*   you installed MSYS2 i686 instead of MSYS2 x86\_64

*   you installed MSYS instead of MSYS2

**Solution**:

Ensure you installed MSYS2 x86\_64.

If that doesn't help:

1.  Go to Start Menu > Settings.

2.  Find the setting "Edit environment variables for your account"

3.  Look at the list on the top ("User variables for <username>"), and click the "New..."
    button below it.

4.  For "Variable name", enter `BAZEL_SH`

5.  Click "Browse File..."

6.  Navigate to the MSYS2 directory, then to `usr\bin` below it.

    For example, this might be `C:\msys64\usr\bin` on your system.

7.  Select the `bash.exe` or `bash` file and click OK

8.  The "Variable value" field now has the path to `bash.exe`. Click OK to close the window.

9.  Done.

    If you open a new cmd.exe or PowerShell terminal and run Bazel now, it will find Bash.

### Bazel does not find Visual Studio or Visual C++

**Possible reasons**:

*   you installed multiple versions of Visual Studio

*   you installed and removed various versions of Visual Studio

*   you installed various versions of the Windows SDK

*   you installed Visual Studio not under the default install path

**Solution**:

1.  Go to Start Menu > Settings.

2.  Find the setting "Edit environment variables for your account"

3.  Look at the list on the top ("User variables for <username>"), and click the "New..."
    button below it.

4.  For "Variable name", enter `BAZEL_VC`

5.  Click "Browse Directory..."

6.  Navigate to the `VC` directory of Visual Studio.

    For example, this might be `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC`
    on your system.

7.  Select the `VC` folder and click OK

8.  The "Variable value" field now has the path to `VC`. Click OK to close the window.

9.  Done.

    If you open a new cmd.exe or PowerShell terminal and run Bazel now, it will find Visual C++.

## Other ways to install Bazel {:#install-options}

### Using Chocolatey {:#chocolately}

1.  Install the [Chocolatey](https://chocolatey.org) package manager

2.  Install the Bazel package:

    ```posix-terminal
    choco install bazel
    ```

    This command will install the latest available version of Bazel and
    its dependencies, such as the MSYS2 shell. This will not install Visual C++
    though.

See [Chocolatey installation and package maintenance
guide](/contribute/windows-chocolatey-maintenance) for more
information about the Chocolatey package.

### Using Scoop {:#scoop}

1.  Install the [Scoop](https://scoop.sh/) package manager using the following PowerShell command:

    ```posix-terminal
    iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
    ```

2.  Install the Bazel package:

    ```posix-terminal
    scoop install bazel
    ```

See [Scoop installation and package maintenance
guide](/contribute/windows-scoop-maintenance) for more
information about the Scoop package.

### Build from source {:#build-from-source}

To build Bazel from scratch instead of installing, see [Compiling from source](/install/compile-source).


text:
dojo.provide("dojo.widget.ResizeHandle");
dojo.provide("dojo.widget.html.ResizeHandle");

dojo.require("dojo.widget.*");
dojo.require("dojo.html");
dojo.require("dojo.style");
dojo.require("dojo.dom");
dojo.require("dojo.event");

dojo.widget.html.ResizeHandle = function(){
	dojo.widget.HtmlWidget.call(this);
}

dojo.inherits(dojo.widget.html.ResizeHandle, dojo.widget.HtmlWidget);

dojo.lang.extend(dojo.widget.html.ResizeHandle, {
	widgetType: "ResizeHandle",

	isSizing: false,
	startPoint: null,
	startSize: null,
	minSize: null,

	targetElmId: '',

	templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlResizeHandle.css"),
	templateString: '

',

	postCreate: function(){
		dojo.event.connect(this.domNode, "onmousedown", this, "beginSizing");
	},

	beginSizing: function(e){
		if (this.isSizing){ return false; }

		// get the target dom node to adjust.  targetElmId can refer to either a widget or a simple node
		this.targetWidget = dojo.widget.byId(this.targetElmId);
		this.targetDomNode = this.targetWidget ? this.targetWidget.domNode : dojo.byId(this.targetElmId);
		if (!this.targetDomNode){ return; }

		this.isSizing = true;
		this.startPoint  = {'x':e.clientX, 'y':e.clientY};
		this.startSize  = {'w':dojo.style.getOuterWidth(this.targetDomNode), 'h':dojo.style.getOuterHeight(this.targetDomNode)};

		dojo.event.kwConnect({
			srcObj: document.body,
			srcFunc: "onmousemove",
			targetObj: this,
			targetFunc: "changeSizing",
			rate: 25
		});
		dojo.event.connect(document.body, "onmouseup", this, "endSizing");

		e.preventDefault();
	},

	changeSizing: function(e){
		// On IE, if you move the mouse above/to the left of the object being resized,
		// sometimes clientX/Y aren't set, apparently.  Just ignore the event.
		try{
			if(!e.clientX  || !e.clientY){ return; }
		}catch(e){
			// sometimes you get an exception accessing above fields...
			return;
		}
		var dx = this.startPoint.x - e.clientX;
		var dy = this.startPoint.y - e.clientY;

		var newW = this.startSize.w - dx;
		var newH = this.startSize.h - dy;

		// minimum size check
		if (this.minSize) {
			if (newW < this.minSize.w) {
				newW = dojo.style.getOuterWidth(this.targetDomNode);
			}
			if (newH < this.minSize.h) {
				newH = dojo.style.getOuterHeight(this.targetDomNode);
			}
		}

		if(this.targetWidget){
			this.targetWidget.resizeTo(newW, newH);
		}else{
			dojo.style.setOuterWidth(this.targetDomNode, newW);
			dojo.style.setOuterHeight(this.targetDomNode, newH);
		}

		e.preventDefault();
	},

	endSizing: function(e){
		dojo.event.disconnect(document.body, "onmousemove", this, "changeSizing");
		dojo.event.disconnect(document.body, "onmouseup", this, "endSizing");

		this.isSizing = false;
	}

});

dojo.widget.tags.addParseTreeHandler("dojo:ResizeHandle");


text:
package com.jacksingleton.scalathegoodparts

import org.scalatest.FlatSpec
import org.scalatest.Matchers._

class ErrorHandlingSpec extends FlatSpec {

  "Error handling with exceptions" should "be ugly" in {
    class LookupException extends Exception

    def lookup(i: Int): String = throw new LookupException

    val result = try {
      lookup(1)
    } catch {
      case e: LookupException => "nada!"
    }

    result should be ("nada!")
  }

  "Error handling with Either" should "be more explicit" in {
    case class LookupError(msg: String)

    def lookup(i: Int): Either[LookupError, String] =
      Left(LookupError("nada!"))

    val result: String = lookup(1) match {
      case Right(s) => s
      case Left(LookupError(msg)) => msg
    }

    result should be ("nada!")
  }

  "More complex error handling with Either" should "be even more explicit" in {
    sealed trait LookupError
    case class NotFound() extends LookupError
    case class DatabaseUnavailable() extends LookupError

    def lookup: Either[LookupError, String] =
      if (false) Right("result") else Left(NotFound())

    val result = lookup match {
      case Right(string) => string
      case Left(NotFound()) => "not found"
    }

    result should be ("not found")

    // [warn]
    // ErrorHandlingSpec.scala:64: match may not be exhaustive.
    // It would fail on the following input: Left(DatabaseUnavailable())
    //   val result = lookup match {
  }

}


text:
package fr.adrienbrault.idea.symfony2plugin.codeInspection;

import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.jetbrains.php.lang.psi.elements.PhpClass;
import fr.adrienbrault.idea.symfony2plugin.codeInspection.quickfix.CreateMethodQuickFix;
import fr.adrienbrault.idea.symfony2plugin.routing.Route;
import fr.adrienbrault.idea.symfony2plugin.routing.RouteHelper;
import fr.adrienbrault.idea.symfony2plugin.routing.dic.ControllerClassOnShortcutReturn;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.*;

/**
 * @author Daniel Espendiller <daniel@espendiller.net>
 */
public class InspectionUtil {

    public static void inspectController(@NotNull PsiElement psiElement, @NotNull String controllerName, @NotNull ProblemsHolder holder, final @NotNull LazyControllerNameResolve lazyControllerNameResolve) {

        List<PsiElement> psiElements = Arrays.asList(RouteHelper.getMethodsOnControllerShortcut(psiElement.getProject(), controllerName));
        if(psiElements.size() > 0) {
            return;
        }

        ControllerClassOnShortcutReturn shortcutReturn = RouteHelper.getControllerClassOnShortcut(psiElement.getProject(), controllerName);
        if(shortcutReturn == null) {
            return;
        }

        int lastPos = controllerName.lastIndexOf(":") + 1;
        String actionName = controllerName.substring(lastPos);
        if(!shortcutReturn.isService()) {
            actionName += "Action";
        }

        final Project project = shortcutReturn.getPhpClass().getProject();
        final String finalActionName = actionName;
        holder.registerProblem(psiElement, "Create Method", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new CreateMethodQuickFix(shortcutReturn.getPhpClass(), actionName, (@NotNull ProblemDescriptor problemDescriptor, @NotNull PhpClass phpClass, @NotNull String functionName) -> {

            // attach route parameter inside method
            String parameters = "";
            String routeName = lazyControllerNameResolve.getRouteName();
            if(routeName != null) {
                Collection<Route> routes = RouteHelper.getRoute(project, routeName);
                if(routes.size() > 0) {
                    Set<String> vars = routes.iterator().next().getVariables();
                    if(vars.size() > 0) {

                        // add dollar char for vars
                        List<String> varsDollar = new ArrayList<>();
                        for(String var: vars) {
                            varsDollar.add("$" + var);
                        }

                        parameters = StringUtils.join(varsDollar, ", ");
                    }
                }
            }

            return new StringBuilder()
                .append("public function ")
                .append(finalActionName)
                .append("(")
                .append(parameters)
                .append(")\n {\n}\n\n");
        }));

    }

    public interface LazyControllerNameResolve {
        @Nullable
        String getRouteName();
    }

}


text:
<?php

namespace Plum\Plum\Converter;

use Mockery as m;

/**
 * LogConverterTest.
 *
 * @author    Sebastian Göttschkes <sebastian.goettschkes@googlemail.com>
 * @copyright 2014-2016 Florian Eckerstorfer
 * @group     unit
 */
class LogConverterTest extends \PHPUnit_Framework_TestCase
{
    protected $logger;

    public function setUp()
    {
        $this->logger = m::mock('Psr\Log\LoggerInterface');
    }

    /**
     * @test
     * @covers Plum\Plum\Converter\LogConverter::__construct()
     * @covers Plum\Plum\Converter\LogConverter::convert()
     */
    public function convertWithDefaultOptions()
    {
        $converter = new LogConverter($this->logger);
        $item      = ['a' => 'foo', 'b' => 'bar'];

        $this->logger->shouldReceive('log')->with('debug', 'Converting item', $item);

        $converter->convert($item);
    }

    /**
     * @test
     * @covers Plum\Plum\Converter\LogConverter::__construct()
     * @covers Plum\Plum\Converter\LogConverter::convert()
     */
    public function convertWithOptions()
    {
        $converter = new LogConverter($this->logger, 'notice', 'Log Me');
        $item      = ['a' => 'foo', 'b' => 'bar'];

        $this->logger->shouldReceive('log')->with('notice', 'Log Me', $item);

        $converter->convert($item);
    }
}


text:
package edu.miami.ccs.goma.pojos;
// Generated May 4, 2012 4:38:51 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Dictionary generated by hbm2java
 */
public class Dictionary  implements java.io.Serializable {

     private long dictionaryId;
     private User userByCreatedBy;
     private User userByUpdatedBy;
     private StatusValue statusValue;
     private String name;
     private String description;
     private Date dateCreated;
     private Date dateUpdated;
     private String dictionaryCode;
     private Set dictionaryTerms = new HashSet(0);

    public Dictionary() {
    }

    public Dictionary(User userByCreatedBy, StatusValue statusValue, String name, String description, Date dateCreated, String dictionaryCode) {

        this.userByCreatedBy = userByCreatedBy;
        this.statusValue = statusValue;
        this.name = name;
        this.description = description;
        this.dateCreated = dateCreated;
        this.dictionaryCode = dictionaryCode;
    }
    public Dictionary(long dictionaryId, User userByCreatedBy, User userByUpdatedBy, StatusValue statusValue, String name, String description, Date dateCreated, Date dateUpdated, String dictionaryCode, Set dictionaryTerms) {
       this.dictionaryId = dictionaryId;
       this.userByCreatedBy = userByCreatedBy;
       this.userByUpdatedBy = userByUpdatedBy;
       this.statusValue = statusValue;
       this.name = name;
       this.description = description;
       this.dateCreated = dateCreated;
       this.dateUpdated = dateUpdated;
       this.dictionaryCode = dictionaryCode;
       this.dictionaryTerms = dictionaryTerms;
    }

    public long getDictionaryId() {
        return this.dictionaryId;
    }

    public void setDictionaryId(long dictionaryId) {
        this.dictionaryId = dictionaryId;
    }
    public User getUserByCreatedBy() {
        return this.userByCreatedBy;
    }

    public void setUserByCreatedBy(User userByCreatedBy) {
        this.userByCreatedBy = userByCreatedBy;
    }
    public User getUserByUpdatedBy() {
        return this.userByUpdatedBy;
    }

    public void setUserByUpdatedBy(User userByUpdatedBy) {
        this.userByUpdatedBy = userByUpdatedBy;
    }
    public StatusValue getStatusValue() {
        return this.statusValue;
    }

    public void setStatusValue(StatusValue statusValue) {
        this.statusValue = statusValue;
    }
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    public Date getDateCreated() {
        return this.dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }
    public Date getDateUpdated() {
        return this.dateUpdated;
    }

    public void setDateUpdated(Date dateUpdated) {
        this.dateUpdated = dateUpdated;
    }
    public String getDictionaryCode() {
        return this.dictionaryCode;
    }

    public void setDictionaryCode(String dictionaryCode) {
        this.dictionaryCode = dictionaryCode;
    }
    public Set getDictionaryTerms() {
        return this.dictionaryTerms;
    }

    public void setDictionaryTerms(Set dictionaryTerms) {
        this.dictionaryTerms = dictionaryTerms;
    }

}


text:
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style>canvas { width: 100%; height: 100% }</style>
    <script src="js/three.js"></script>
</head>
<body>
    <script>
        var scene = new THREE.Scene();

        var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);

        var renderer = new THREE.WebGLRenderer();

        renderer.setSize(window.innerWidth, window.innerHeight);

        document.body.appendChild(renderer.domElement);
        var geometry = new THREE.CubeGeometry(1,1,1);
        var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
        var cube = new THREE.Mesh(geometry, material); scene.add(cube);
        camera.position.z = 5;
        function render() {
            requestAnimationFrame(render);
            cube.rotation.x += 0.1;
            cube.rotation.y += 0.1;
            renderer.render(scene, camera);
        }
        render();
    </script>
</body>
</html>


text:
<title>GetMailBody</title>

GetMailBody()

Syntax

Result$ = GetMailBody(#Mail)

Description

Return the specified mail body, previously set with SetMailBody().

Parameters

#Mail

The mail to use.

Return value

Returns the body as a string.

Example

  InitNetwork()

  If CreateMail(0, "test@purebasic.com", "Hello")
    SetMailBody(0, "This is the body")
    Debug GetMailBody(0) ; Will print "This is the body"
  EndIf

See Also

SetMailBody(), CreateMail()

Supported OS
All

<- GetMailAttribute() - Mail Index - IsMail() ->


text:
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR=${SCRIPT_DIR}/../../../../..
cd "${ROOT_DIR}"

source tensorflow/lite/micro/tools/make/bash_helpers.sh

DOWNLOADS_DIR=${1}
if [ ! -d ${DOWNLOADS_DIR} ]; then
  echo "The top-level downloads directory: ${DOWNLOADS_DIR} does not exist."
  exit 1
fi

DOWNLOADED_RENODE_PATH=${DOWNLOADS_DIR}/renode

if [ -d ${DOWNLOADED_RENODE_PATH} ]; then
  echo >&2 "${DOWNLOADED_RENODE_PATH} already exists, skipping the download."
else
  LINUX_PORTABLE_URL="https://github.com/renode/renode/releases/download/v1.11.0/renode-1.11.0.linux-portable.tar.gz"
  TEMP_ARCHIVE="/tmp/renode.tar.gz"

  echo >&2 "Downloading from url: ${LINUX_PORTABLE_URL}"
  wget ${LINUX_PORTABLE_URL} -O ${TEMP_ARCHIVE} >&2

  EXPECTED_MD5="8415361f5caa843f1e31b59c50b2858f"
  check_md5 ${TEMP_ARCHIVE} ${EXPECTED_MD5}

  mkdir ${DOWNLOADED_RENODE_PATH}
  tar xzf ${TEMP_ARCHIVE} --strip-components=1 --directory "${DOWNLOADED_RENODE_PATH}" >&2
  echo >&2 "Unpacked to directory: ${DOWNLOADED_RENODE_PATH}"

  pip3 install -r ${DOWNLOADED_RENODE_PATH}/tests/requirements.txt >&2
fi

echo "SUCCESS"


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* PftCodeBlock.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using AM.Logging;

using CodeJam;

using JetBrains.Annotations;

using ManagedIrbis.Infrastructure;
using ManagedIrbis.Pft.Infrastructure.Text;

using MoonSharp.Interpreter;

#if CLASSIC || NETCORE

using System.Reflection;

#endif

#endregion

namespace ManagedIrbis.Pft.Infrastructure.Ast
{
    /// <summary>
    ///
    /// </summary>
    [PublicAPI]
    [MoonSharpUserData]
    public sealed class PftCodeBlock
        : PftNode
    {
        #region Properties

        /// <inheritdoc cref="PftNode.ExtendedSyntax" />
        public override bool ExtendedSyntax
        {
            get { return true; }
        }

        #endregion

        #region Construction

        /// <summary>
        /// Constructor.
        /// </summary>
        public PftCodeBlock()
        {
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        public PftCodeBlock
            (
                [NotNull] string text
            )
        {
            Code.NotNullNorEmpty(text, "text");

            Text = text;
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        public PftCodeBlock
            (
                [NotNull] PftToken token
            )
            : base(token)
        {
            Code.NotNull(token, "token");
            token.MustBe(PftTokenKind.TripleCurly);

            if (string.IsNullOrEmpty(token.Text))
            {
                Log.Error
                    (
                        "PftCodeBlock::Constructor: "
                        + "token text not set"
                    );

                throw new PftSyntaxException(token);
            }

            Text = token.Text;
        }

        #endregion

        #region Private members

#if CLASSIC || NETCORE

        private bool _compiled;

        private MethodInfo _method;

#endif

        #endregion

        #region PftNode members

        /// <inheritdoc cref="PftNode.Execute" />
        public override void Execute
            (
                PftContext context
            )
        {
            OnBeforeExecution(context);

#if CLASSIC || NETCORE

            if (!_compiled)
            {
                Log.Trace("PftCodeBlock::Execute: compile method");

                _compiled = true;

                string text = Text;
                if (!string.IsNullOrEmpty(text))
                {
                    _method = SharpRunner.CompileSnippet
                        (
                            text,
                            "PftNode node, PftContext context",
                            err => context.WriteLine(this, err)
                        );
                }
            }

            if (!ReferenceEquals(_method, null))
            {
                Log.Trace ("PftCodeBlock::Execute: invoke method");

                _method.Invoke(null, new object[] {this, context});
            }

#endif

            OnAfterExecution(context);
        }

        /// <inheritdoc cref="PftNode.PrettyPrint" />
        public override void PrettyPrint
            (
                PftPrettyPrinter printer
            )
        {
            printer.EatWhitespace();
            printer.EatNewLine();
            printer
                .WriteLine()
                .WriteIndentIfNeeded()
                .Write("{{{")
                .Write(Text)
                .WriteLine("}}}");
        }

        #endregion

        #region Object members

        /// <inheritdoc cref="object.ToString()" />
        public override string ToString()
        {
            return "{{{" + Text + "}}}";
        }

        #endregion
    }
}