text:
// +build Config

package Config

import(
	"encoding/xml"
	"code.myceliUs.com/Utility"
)

type OAuth2Expires struct{

	/** The entity UUID **/
	UUID string
	/** The entity TypeName **/
	TYPENAME string
	/** The parent uuid if there is some. **/
	ParentUuid string
	/** The relation name with the parent. **/
	ParentLnk string
	/** keep track if the entity has change over time. **/
	needSave bool
	/** Keep reference to entity that made use of thit entity **/
	Referenced []string
	/** Get entity by uuid function **/
	getEntityByUuid func(string)(interface{}, error)
	/** Use to put the entity in the cache **/
	setEntity func(interface{})
	/** Generate the entity uuid **/
	generateUuid func(interface{}) string

	/** members of OAuth2Expires **/
	M_id string
	M_expiresAt int64

	/** Associations **/
	M_parentPtr string
}

/** Xml parser for OAuth2Expires **/
type XsdOAuth2Expires struct {
	XMLName xml.Name	`xml:"oauth2Expires"`
	M_id	string	`xml:"id,attr"`
	M_expiresAt	int64	`xml:"expiresAt,attr"`

}
/***************** Entity **************************/

/** UUID **/
func (this *OAuth2Expires) GetUuid() string{
	if len(this.UUID) == 0 {
		this.SetUuid(this.generateUuid(this))
	}
	return this.UUID
}
func (this *OAuth2Expires) SetUuid(uuid string){
	this.UUID = uuid
}

/** Need save **/
func (this *OAuth2Expires) IsNeedSave() bool{
	return this.needSave
}
func (this *OAuth2Expires) SetNeedSave(needSave bool){
	this.needSave=needSave
}

func (this *OAuth2Expires) GetReferenced() []string {
	if this.Referenced == nil {
		this.Referenced = make([]string, 0)
	}
	// return the list of references
	return this.Referenced
}

func (this *OAuth2Expires) SetReferenced(uuid string, field string) {
	if this.Referenced == nil {
		this.Referenced = make([]string, 0)
	}
	if !Utility.Contains(this.Referenced, uuid+":"+field) {
		this.Referenced = append(this.Referenced, uuid+":"+field)
	}
}

func (this *OAuth2Expires) RemoveReferenced(uuid string, field string) {
	if this.Referenced == nil {
		return
	}
	referenced := make([]string, 0)
	for i := 0; i < len(this.Referenced); i++ {
		if this.Referenced[i] != uuid+":"+field {
			referenced = append(referenced, uuid+":"+field)
		}
	}
	this.Referenced = referenced
}

func (this *OAuth2Expires) SetFieldValue(field string, value interface{}) error{
	return Utility.SetProperty(this, field, value)
}

func (this *OAuth2Expires) GetFieldValue(field string) interface{}{
	return Utility.GetProperty(this, field)
}

/** Return the array of entity id's without it uuid **/
func (this *OAuth2Expires) Ids() []interface{} {
	ids := make([]interface{}, 0)
	ids = append(ids, this.M_id)
	return ids
}

/** The type name **/
func (this *OAuth2Expires) GetTypeName() string{
	this.TYPENAME = "Config.OAuth2Expires"
	return this.TYPENAME
}

/** Return the entity parent UUID **/
func (this *OAuth2Expires) GetParentUuid() string{
	return this.ParentUuid
}

/** Set it parent UUID **/
func (this *OAuth2Expires) SetParentUuid(parentUuid string){
	this.ParentUuid = parentUuid
}

/** Return it relation with it parent, only one parent is possible by entity. **/
func (this *OAuth2Expires) GetParentLnk() string{
	return this.ParentLnk
}
func (this *OAuth2Expires) SetParentLnk(parentLnk string){
	this.ParentLnk = parentLnk
}

func (this *OAuth2Expires) GetParent() interface{}{
	parent, err := this.getEntityByUuid(this.ParentUuid)
	if err != nil {
		return nil
	}
	return parent
}

/** Return it relation with it parent, only one parent is possible by entity. **/
func (this *OAuth2Expires) GetChilds() []interface{}{
	var childs []interface{}
	return childs
}
/** Return the list of all childs uuid **/
func (this *OAuth2Expires) GetChildsUuid() []string{
	var childs []string
	return childs
}
/** Give access to entity manager GetEntityByUuid function from Entities package. **/
func (this *OAuth2Expires) SetEntityGetter(fct func(uuid string)(interface{}, error)){
	this.getEntityByUuid = fct
}
/** Use it the set the entity on the cache. **/
func (this *OAuth2Expires) SetEntitySetter(fct func(entity interface{})){
	this.setEntity = fct
}
/** Set the uuid generator function **/
func (this *OAuth2Expires) SetUuidGenerator(fct func(entity interface{}) string){
	this.generateUuid = fct
}

func (this *OAuth2Expires) GetId()string{
	return this.M_id
}

func (this *OAuth2Expires) SetId(val string){
	this.M_id= val
}

func (this *OAuth2Expires) GetExpiresAt()int64{
	return this.M_expiresAt
}

func (this *OAuth2Expires) SetExpiresAt(val int64){
	this.M_expiresAt= val
}

func (this *OAuth2Expires) GetParentPtr()*OAuth2Configuration{
	entity, err := this.getEntityByUuid(this.M_parentPtr)
	if err == nil {
		return entity.(*OAuth2Configuration)
	}
	return nil
}

func (this *OAuth2Expires) SetParentPtr(val *OAuth2Configuration){
	this.M_parentPtr= val.GetUuid()
	this.setEntity(this)
	this.SetNeedSave(true)
}

func (this *OAuth2Expires) ResetParentPtr(){
	this.M_parentPtr= ""
	this.setEntity(this)
}


text:
"""MyDjango URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/dev/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from web.views import current_time
from web.views import add
from web.views import person
from web.views import home
from web.views import board
from web.views import postmessage

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^time/', current_time),
    url(r'^add/(\d+)/(\d+)', add),
    url(r'^home', home),
    url(r'^person', person),
    url(r'^board', board, name='board'),
    url(r'^postmessage/$', postmessage, name='postmessage')

]

redpajama_set_name: RedPajamaGithub


text:
<?php $this->load->view('dashboard/header'); ?>

<?php echo modules::run('invoices/widgets/generate_dialog'); ?>

<?php echo $this->lang->line('invoice_search'); ?><?php $this->load->view('dashboard/btn_add', array('btn_name'=>'btn_add_invoice', 'btn_value'=>$this->lang->line('create_invoice'))); ?>

			<?php $this->load->view('dashboard/system_messages'); ?>

			<?php $this->load->view('invoices/invoice_table'); ?>

<?php $this->load->view('dashboard/sidebar', array('side_block'=>'invoices/sidebar')); ?>

<?php $this->load->view('dashboard/footer'); ?>


text:
import base from './rollup.base'

if (process.env.BUILD_TARGET === 'production') base.output.file = `${base.proPath}/${base.bundle}.min.js`
else base.output.file = `${base.proPath}/${base.bundle}.dev.js`

base.output.sourcemap = process.env.BUILD_ENV === 'DEMO' || process.env.BUILD_ENV === 'CI' ? base.output.sourcemap : false

delete base.bundle
delete base.devPath
delete base.proPath

export default base


text:
import { describe, it, beforeAll, afterAll } from 'vitest';
import { strict as assert } from 'assert';
import { HttpClient } from '../src';
import { startServer } from './fixtures/server';

describe('HttpClient.events.test.ts', () => {
  let close: any;
  let _url: string;
  beforeAll(async () => {
    const { closeServer, url } = await startServer();
    close = closeServer;
    _url = url;
  });

  afterAll(async () => {
    await close();
  });

  it('should emit request and response events', async () => {
    const httpclient = new HttpClient();
    let requestCount = 0;
    let responseCount = 0;
    httpclient.on('request', info => {
      requestCount++;
      // console.log(info);
      assert.equal(info.url, _url);
      assert(info.requestId > 0);
      assert.equal(info.args.opaque.requestId, `mock-request-id-${requestCount}`);
      if (requestCount === 1) {
        assert.deepEqual(info.ctx, { foo: 'bar' });
      } else {
        assert.equal(info.ctx, undefined);
      }
    });
    httpclient.on('response', info => {
      responseCount++;
      // console.log(info);
      assert.equal(info.req.args.opaque.requestId, `mock-request-id-${requestCount}`);
      assert.equal(info.req.options, info.req.args);
      assert(info.req.args.headers);
      assert(info.req.options.headers);
      assert.equal(info.res.status, 200);
      assert.equal(info.requestId, info.req.requestId);

      if (responseCount === 1) {
        assert.deepEqual(info.ctx, { foo: 'bar' });
        assert.deepEqual(info.ctx, info.req.ctx);
        // timing false
        assert.equal(info.res.timing.requestHeadersSent, 0);
      } else {
        assert.equal(info.ctx, undefined);
        // timing true
        assert(info.res.timing.requestHeadersSent > 0);
      }
      // socket info
      assert(info.res.socket.remoteAddress);
      assert(info.res.socket.remotePort);
      assert(info.res.socket.localAddress);
      assert(info.res.socket.localPort);
      assert(info.res.socket.id > 0);
    });

    let response = await httpclient.request(_url, {
      dataType: 'json',
      opaque: {
        requestId: 'mock-request-id-1',
      },
      ctx: { foo: 'bar' },
    });
    assert.equal(response.status, 200);
    assert.equal(response.data.method, 'GET');
    assert.equal(requestCount, 1);
    assert.equal(responseCount, 1);

    response = await httpclient.request(_url, {
      dataType: 'json',
      opaque: {
        requestId: 'mock-request-id-2',
      },
      timing: true,
    });
    assert.equal(response.status, 200);
    assert.equal(response.data.method, 'GET');

    assert.equal(requestCount, 2);
    assert.equal(responseCount, 2);
  });

  it('should emit response on request error', async () => {
    const httpclient = new HttpClient();
    let requestCount = 0;
    let responseCount = 0;
    httpclient.on('request', info => {
      requestCount++;
    });
    httpclient.on('response', info => {
      responseCount++;
      // console.log(info);
      assert.equal(info.req.args.opaque.requestId, `mock-request-id-${requestCount}`);
      assert.equal(info.req.options, info.req.args);
      assert(info.req.args.headers);
      assert(info.req.options.headers);
      assert.equal(info.res.status, -1);
      assert.equal(info.requestId, info.req.requestId);

      assert.equal(info.error.name, 'SocketError');
      assert.equal(info.error.message, 'other side closed');
      assert.equal(info.error.status, -1);
    });

    await assert.rejects(async () => {
      await httpclient.request(`${_url}error`, {
        dataType: 'json',
        opaque: {
          requestId: 'mock-request-id-1',
        },
        ctx: { foo: 'bar' },
      });
    }, (err: any) => {
      // console.error(err);
      assert.equal(err.name, 'SocketError');
      assert.equal(err.message, 'other side closed');
      assert.equal(err.status, -1);
      return true;
    });
  });
});


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="partyup.com.myapplication.UI.FragmentCategories.FragmentBar">

    <!-- TODO: Update blank fragment layout -->
    <TextView android:layout_width="match_parent" android:layout_height="match_parent"
        android:text="@string/hello_blank_fragment" />

</FrameLayout>


text:
var parent = require('../../es/reflect/has');

module.exports = parent;


text:
title: String.prototype.localecompare
localeTitle: String.prototype.localecompare
---
## String.prototype.localecompare

Это заглушка. [Помогите нашему сообществу расширить его](https://github.com/freecodecamp/guides/tree/master/src/pages/javascript/standard-objects/string/string-prototype-localecompare/index.md) .

[Это руководство по быстрому стилю поможет вам принять ваш запрос на тягу](https://github.com/freecodecamp/guides/blob/master/README.md) .

#### Дополнительная информация:


text:
/** @file
 *  @brief Internal APIs for Bluetooth connection handling.
 */

/*
 * Copyright (c) 2015 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */
typedef enum __packed {
	BT_CONN_DISCONNECTED,
	BT_CONN_CONNECT_SCAN,
	BT_CONN_CONNECT,
	BT_CONN_CONNECTED,
	BT_CONN_DISCONNECT,
} bt_conn_state_t;

/* bt_conn flags: the flags defined here represent connection parameters */
enum {
	BT_CONN_AUTO_CONNECT,
	BT_CONN_BR_LEGACY_SECURE,	/* 16 digits legacy PIN tracker */
	BT_CONN_USER,			/* user I/O when pairing */
	BT_CONN_BR_PAIRING,		/* BR connection in pairing context */
	BT_CONN_BR_NOBOND,		/* SSP no bond pairing tracker */
	BT_CONN_BR_PAIRING_INITIATOR,	/* local host starts authentication */
	BT_CONN_CLEANUP,                /* Disconnected, pending cleanup */

	/* Total number of flags - must be at the end of the enum */
	BT_CONN_NUM_FLAGS,
};

struct bt_conn_le {
	bt_addr_le_t		dst;

	bt_addr_le_t		init_addr;
	bt_addr_le_t		resp_addr;

	uint16_t		interval;
	uint16_t		interval_min;
	uint16_t		interval_max;

	uint16_t		latency;
	uint16_t		timeout;

	uint8_t			features[1][8];

	struct bt_keys		*keys;

	/* Delayed work for connection update and timeout handling */
	struct k_delayed_work	update_work;
};

#if defined(CONFIG_BLUETOOTH_BREDR)
/* For now reserve space for 2 pages of LMP remote features */
#define LMP_MAX_PAGES 2

struct bt_conn_br {
	bt_addr_t		dst;
	uint8_t			remote_io_capa;
	uint8_t			remote_auth;
	uint8_t			pairing_method;
	/* remote LMP features pages per 8 bytes each */
	uint8_t			features[LMP_MAX_PAGES][8];

	struct bt_keys_link_key	*link_key;
};

struct bt_conn_sco {
	/* Reference to ACL Connection */
	struct bt_conn          *acl;
	uint16_t                pkt_type;
};
#endif

struct bt_conn {
	uint16_t		handle;
	uint8_t			type;
	uint8_t			role;

	ATOMIC_DEFINE(flags, BT_CONN_NUM_FLAGS);

#if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR)
	bt_security_t		sec_level;
	bt_security_t		required_sec_level;
	uint8_t			encrypt;
#endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */

	uint8_t			pending_pkts;

	uint16_t		rx_len;
	struct net_buf		*rx;

	/* Queue for outgoing ACL data */
	struct k_fifo		tx_queue;

	/* Active L2CAP channels */
	sys_slist_t		channels;

	atomic_t		ref;

	/* Connection error or reason for disconnect */
	uint8_t			err;

	bt_conn_state_t		state;

	union {
		struct bt_conn_le	le;
#if defined(CONFIG_BLUETOOTH_BREDR)
		struct bt_conn_br	br;
		struct bt_conn_sco	sco;
#endif
	};
};

/* Process incoming data for a connection */
void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, uint8_t flags);

/* Send data over a connection */
int bt_conn_send(struct bt_conn *conn, struct net_buf *buf);

/* Add a new LE connection */
struct bt_conn *bt_conn_add_le(const bt_addr_le_t *peer);

/* Add a new BR/EDR connection */
struct bt_conn *bt_conn_add_br(const bt_addr_t *peer);

/* Add a new SCO connection */
struct bt_conn *bt_conn_add_sco(const bt_addr_t *peer, int link_type);

/* Cleanup SCO references */
void bt_sco_cleanup(struct bt_conn *sco_conn);

/* Look up an existing sco connection by BT address */
struct bt_conn *bt_conn_lookup_addr_sco(const bt_addr_t *peer);

/* Look up an existing connection by BT address */
struct bt_conn *bt_conn_lookup_addr_br(const bt_addr_t *peer);

void bt_conn_pin_code_req(struct bt_conn *conn);
uint8_t bt_conn_get_io_capa(void);
uint8_t bt_conn_ssp_get_auth(const struct bt_conn *conn);
void bt_conn_ssp_auth(struct bt_conn *conn, uint32_t passkey);

void bt_conn_disconnect_all(void);

/* Look up an existing connection */
struct bt_conn *bt_conn_lookup_handle(uint16_t handle);

/* Compare an address with bt_conn destination address */
int bt_conn_addr_le_cmp(const struct bt_conn *conn, const bt_addr_le_t *peer);

/* Look up a connection state. For BT_ADDR_LE_ANY, returns the first connection
 * with the specific state
 */
struct bt_conn *bt_conn_lookup_state_le(const bt_addr_le_t *peer,
					const bt_conn_state_t state);

/* Set connection object in certain state and perform action related to state */
void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state);

int bt_conn_le_conn_update(struct bt_conn *conn,
			   const struct bt_le_conn_param *param);

void notify_le_param_updated(struct bt_conn *conn);

bool le_param_req(struct bt_conn *conn, struct bt_le_conn_param *param);

#if defined(CONFIG_BLUETOOTH_SMP)
/* rand and ediv should be in BT order */
int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand,
				uint16_t ediv, const uint8_t *ltk, size_t len);

/* Notify higher layers that RPA was resolved */
void bt_conn_identity_resolved(struct bt_conn *conn);
#endif /* CONFIG_BLUETOOTH_SMP */

#if defined(CONFIG_BLUETOOTH_SMP) || defined(CONFIG_BLUETOOTH_BREDR)
/* Notify higher layers that connection security changed */
void bt_conn_security_changed(struct bt_conn *conn);
#endif /* CONFIG_BLUETOOTH_SMP || CONFIG_BLUETOOTH_BREDR */

/* Prepare a PDU to be sent over a connection */
struct net_buf *bt_conn_create_pdu(struct net_buf_pool *pool, size_t reserve);

/* Initialize connection management */
int bt_conn_init(void);

/* Selects based on connecton type right semaphore for ACL packets */
struct k_sem *bt_conn_get_pkts(struct bt_conn *conn);

/* k_poll related helpers for the TX thread */
int bt_conn_prepare_events(struct k_poll_event events[]);
void bt_conn_process_tx(struct bt_conn *conn);


text:
#ifndef COMPOTEPLUSPLUS_MENUITEM_H
#define COMPOTEPLUSPLUS_MENUITEM_H

#include "core/core.h"

#include "SDL2/SDL_rect.h"
#include "SDL2/SDL_render.h"
#include "utils.h"

#include "graphic/rendererManager.h"

using Compote::Core::Locator;
using Compote::Graphic::RendererManager;

using Compote::Core::GameObject;
using Compote::Core::GameTime;
using Compote::Core::Updateable;
using Compote::Core::Renderable;

namespace Compote {
    namespace Scene {
        class AbstractMenuScene;
    }
}

namespace Compote {
    namespace Scene{
        namespace Menu {

            /**
             * class MenuItem
             *
             * FIXME : Bad practive here,the MenuItem is tied to graphical rendering implementation
             */
            class MenuItem :
                    public GameObject,
                    public Updateable,
                    public Renderable {

            private:
                SDL_Rect        m_block;
                char*           m_label;
                SDL_Texture*    m_texture;
                bool            m_bActive;

                UICallback d_click;
                UICallback d_hover;

            public:
                MenuItem(const char* label) :
                        m_texture(nullptr),
                        m_block(SDL_Rect()),
                        m_bActive(false) {

                    m_label = (char*)malloc((strlen(label)+1) * sizeof(char));
                    strcpy(m_label, label);
                    m_block.w = 0; m_block.h = 0;
                    m_block.x = 0; m_block.y = 0;
                }

                virtual ~MenuItem() {
                    free(m_label);
                }

                bool v_initialize(void) {
                    Locator::getRenderer()->getTextAsTexture(m_label, m_texture, m_block.w, m_block.h);
                    return true;
                }

                void setActive(bool active) {
                    m_bActive = active;
                }

                void click() {
                    d_click();
                }

                void v_update(const GameTime& gameTime) {
                }

                void v_render(const GameTime& gameTime) {
                    if(m_bActive) {
                        double treshold = sin(gameTime.getCurrentTime() * 0.005f) * 15;
                        int temp = m_block.x;
                        m_block.x += treshold;
                        Locator::getRenderer()->renderTexture(m_texture, &m_block);
                        m_block.x = temp;
                    } else {
                        Locator::getRenderer()->renderTexture(m_texture, &m_block);
                    }
                }

                void v_destroy(void) {
                    SDL_DestroyTexture(m_texture);
                }

                int getX() const {
                    return m_block.x;
                }

                int getY() const {
                    return m_block.y;
                }

                int getWidth() const {
                    return m_block.w;
                }

                int getHeight() const {
                    return m_block.h;
                }

                void setX(int x) {
                    m_block.x = x;
                }

                void setY(int y) {
                    m_block.y = y;
                }

                bool testCollision(int x, int y) {
                    if(x < m_block.x
                        || x > (m_block.x + m_block.w)
                        || y < m_block.y
                        || y > (m_block.y + m_block.h)) {
                        return false;
                    }
                    return true;
                }

                void setClickCallback( UICallback onClickDelegate ) {
                    d_click = onClickDelegate;
                }

                void setHoverCallback( UICallback onHoverDelegate ) {
                    d_hover = onHoverDelegate;
                }
            };
        }
    }
}

#endif //COMPOTEPLUSPLUS_MENUITEM_H


text:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The KoreCore developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_PRIMITIVES_BLOCK_H
#define BITCOIN_PRIMITIVES_BLOCK_H

#include "primitives/transaction.h"
#include "serialize.h"
#include "uint256.h"

/** Nodes collect new transactions into a block, hash them into a hash tree,
 * and scan through nonce values to make the block's hash satisfy proof-of-work
 * requirements.  When they solve the proof-of-work, they broadcast the block
 * to everyone and the block is added to the block chain.  The first transaction
 * in the block is a special one that creates a new coin owned by the creator
 * of the block.
 */
class CBlockHeader
{
public:
    // header
    int32_t nVersion;
    uint256 hashPrevBlock;
    uint256 hashMerkleRoot;
    uint32_t nTime;
    uint32_t nBits;
    uint32_t nNonce;
    uint32_t nBirthdayA;
    uint32_t nBirthdayB;

    CBlockHeader()
    {
        SetNull();
    }

    ADD_SERIALIZE_METHODS;

    template <typename Stream, typename Operation>
    inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
        READWRITE(this->nVersion);
        nVersion = this->nVersion;
        READWRITE(hashPrevBlock);
        READWRITE(hashMerkleRoot);
        READWRITE(nTime);
        READWRITE(nBits);
        READWRITE(nNonce);
        READWRITE(nBirthdayA);
        READWRITE(nBirthdayB);
    }

    void SetNull()
    {
        nVersion = 0;
        hashPrevBlock.SetNull();
        hashMerkleRoot.SetNull();
        nTime = 0;
        nBits = 0;
        nNonce = 0;
        nBirthdayA = 0;
		nBirthdayB = 0;
    }

    bool IsNull() const
    {
        return (nBits == 0);
    }

    uint256 GetHash() const;

    uint256 GetVerifiedHash() const;

    uint256 CalculateBestBirthdayHash();

    uint256 GetMidHash() const;
    int64_t GetBlockTime() const
    {
        return (int64_t)nTime;
    }

    std::string ToString() const;
};

class CBlock : public CBlockHeader
{
public:
    // network and disk
    std::vector<CTransaction> vtx;

    // network and disk
    std::vector<unsigned char> vchBlockSig;

    // memory only
    mutable CScript payee;
    mutable bool fChecked;

    CBlock()
    {
        SetNull();
    }

    CBlock(const CBlockHeader &header)
    {
        SetNull();
        *((CBlockHeader*)this) = header;
    }

    ADD_SERIALIZE_METHODS;

    template <typename Stream, typename Operation>
    inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
        READWRITE(*(CBlockHeader*)this);
        READWRITE(vtx);
	if(vtx.size() > 1 && vtx[1].IsCoinStake())
		READWRITE(vchBlockSig);
    }

    void SetNull()
    {
        CBlockHeader::SetNull();
        vtx.clear();
        fChecked = false;
        payee = CScript();
        vchBlockSig.clear();
    }

    // two types of block: proof-of-work or proof-of-stake
    bool IsProofOfStake() const
    {
        return (vtx.size() > 1 && vtx[1].IsCoinStake());
    }

    bool IsProofOfWork() const
    {
        return !IsProofOfStake();
    }

    CBlockHeader GetBlockHeader() const
    {
        CBlockHeader block;
        block.nVersion       = nVersion;
        block.hashPrevBlock  = hashPrevBlock;
        block.hashMerkleRoot = hashMerkleRoot;
        block.nTime          = nTime;
        block.nBits          = nBits;
        block.nNonce         = nNonce;
		block.nBirthdayA     = nBirthdayA;
        block.nBirthdayB     = nBirthdayB;
        return block;
    }

    std::string ToString() const;
};

/** Describes a place in the block chain to another node such that if the
 * other node doesn't have the same branch, it can find a recent common trunk.
 * The further back it is, the further before the fork it may be.
 */
struct CBlockLocator
{
    std::vector<uint256> vHave;

    CBlockLocator() {}

    CBlockLocator(const std::vector<uint256>& vHaveIn)
    {
        vHave = vHaveIn;
    }

    ADD_SERIALIZE_METHODS;

    template <typename Stream, typename Operation>
    inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
        if (!(nType & SER_GETHASH))
            READWRITE(nVersion);
        READWRITE(vHave);
    }

    void SetNull()
    {
        vHave.clear();
    }

    bool IsNull() const
    {
        return vHave.empty();
    }
};

#endif // BITCOIN_PRIMITIVES_BLOCK_H


text:
namespace Module.Universidade.API.Models.Estudante
{
    public class EstudanteGetModel : EstudanteModel
    {
    }
}


text:
var Firebird = require('node-firebird');

var options = {};

options.host = 'localhost';
options.port = 3050;
options.database = 'c:\bessani softwares\florestal\base\LOCAL1.fdb';
options.user = 'SYSDBA';
options.password = 'masterkey';
options.manager = true;

Firebird.attach(options, function(err, svc) {
    if (err)
        return;
    svc.backup(
        {
            database:'c:/bessani softwares/florestal/base/LOCAL1.fdb',
            files: [
                    {
                     filename:'c:/backup/test.fbk',
                     sizefile:'0'
                    }
                   ]
        },
        function(err, data) {
            console.log(data);
        });
  });


text:
<?php

return [

	/*
	|--------------------------------------------------------------------------
	| Application Debug Mode
	|--------------------------------------------------------------------------
	|
	| When your application is in debug mode, detailed error messages with
	| stack traces will be shown on every error that occurs within your
	| application. If disabled, a simple generic error page is shown.
	|
	*/

	'debug' => env('APP_DEBUG', false),

	/*
	|--------------------------------------------------------------------------
	| Application URL
	|--------------------------------------------------------------------------
	|
	| This URL is used by the console to properly generate URLs when using
	| the Artisan command line tool. You should set this to the root of
	| your application so that it is used when running Artisan tasks.
	|
	*/

	'url' => env('APP_URL', 'http://localhost'),

	/*
	|--------------------------------------------------------------------------
	| Application Timezone
	|--------------------------------------------------------------------------
	|
	| Here you may specify the default timezone for your application, which
	| will be used by the PHP date and date-time functions. We have gone
	| ahead and set this to a sensible default for you out of the box.
	|
	*/

	'timezone' => 'America/Chicago',

	/*
	|--------------------------------------------------------------------------
	| Application Locale Configuration
	|--------------------------------------------------------------------------
	|
	| The application locale determines the default locale that will be used
	| by the translation service provider. You are free to set this value
	| to any of the locales which will be supported by the application.
	|
	*/

	'locale' => 'en',

	/*
	|--------------------------------------------------------------------------
	| Application Fallback Locale
	|--------------------------------------------------------------------------
	|
	| The fallback locale determines the locale to use when the current one
	| is not available. You may change the value to correspond to any of
	| the language folders that are provided through your application.
	|
	*/

	'fallback_locale' => 'en',

	/*
	|--------------------------------------------------------------------------
	| Encryption Key
	|--------------------------------------------------------------------------
	|
	| This key is used by the Illuminate encrypter service and should be set
	| to a random, 32 character string, otherwise these encrypted strings
	| will not be safe. Please do this before deploying an application!
	|
	*/

	'key' => env('APP_KEY', 'SomeRandomString'),

	'cipher' => MCRYPT_RIJNDAEL_128,

	/*
	|--------------------------------------------------------------------------
	| Logging Configuration
	|--------------------------------------------------------------------------
	|
	| Here you may configure the log settings for your application. Out of
	| the box, Laravel uses the Monolog PHP logging library. This gives
	| you a variety of powerful log handlers / formatters to utilize.
	|
	| Available Settings: "single", "daily", "syslog", "errorlog"
	|
	*/

	'log' => 'daily',

	/*
	|--------------------------------------------------------------------------
	| Autoloaded Service Providers
	|--------------------------------------------------------------------------
	|
	| The service providers listed here will be automatically loaded on the
	| request to your application. Feel free to add your own services to
	| this array to grant expanded functionality to your applications.
	|
	*/

	'providers' => [

		/*
		 * Laravel Framework Service Providers...
		 */
		'Illuminate\Foundation\Providers\ArtisanServiceProvider',
		'Illuminate\Auth\AuthServiceProvider',
		'Illuminate\Bus\BusServiceProvider',
		'Illuminate\Cache\CacheServiceProvider',
		'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
		'Illuminate\Routing\ControllerServiceProvider',
		'Illuminate\Cookie\CookieServiceProvider',
		'Illuminate\Database\DatabaseServiceProvider',
		'Illuminate\Encryption\EncryptionServiceProvider',
		'Illuminate\Filesystem\FilesystemServiceProvider',
		'Illuminate\Foundation\Providers\FoundationServiceProvider',
		'Illuminate\Hashing\HashServiceProvider',
		'Illuminate\Mail\MailServiceProvider',
		'Illuminate\Pagination\PaginationServiceProvider',
		'Illuminate\Pipeline\PipelineServiceProvider',
		'Illuminate\Queue\QueueServiceProvider',
		'Illuminate\Redis\RedisServiceProvider',
		'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
		'Illuminate\Session\SessionServiceProvider',
		'Illuminate\Translation\TranslationServiceProvider',
		'Illuminate\Validation\ValidationServiceProvider',
		'Illuminate\View\ViewServiceProvider',

		/*
		 * Application Service Providers...
		 */
		'App\Providers\AppServiceProvider',
		'App\Providers\BusServiceProvider',
		'App\Providers\EventServiceProvider',
		'App\Providers\RouteServiceProvider',

		/*
		 * Extend Application Service Providers...
		 */
		'App\Providers\ViewComposerServiceProvider',

		/*
		 * DEV Package Service Providers
		 */
		'Laracasts\Generators\GeneratorsServiceProvider',
		//'App\Providers\ErrorServiceProvider',
		'Barryvdh\Debugbar\ServiceProvider',

		/*
		 * Composer Service Providers...
		 */
		'Illuminate3\Kotoba\KotobaServiceProvider',

		'anlutro\LaravelSettings\ServiceProvider',
//		'Arrilot\Widgets\ServiceProvider',
//		'Baum\Providers\BaumServiceProvider',
		'Caffeinated\Flash\FlashServiceProvider',
		'Caffeinated\Modules\ModulesServiceProvider',
		'Caffeinated\Modules\ModulesServiceProvider',
		'Caffeinated\Plugins\PluginsServiceProvider',
		'Caffeinated\Themes\ThemesServiceProvider',
		'Collective\Html\HtmlServiceProvider',
//		'Cviebrock\EloquentSluggable\SluggableServiceProvider',
		'GrahamCampbell\Throttle\ThrottleServiceProvider',
		'Illuminate\Html\HtmlServiceProvider',
		'Intervention\Image\ImageServiceProvider',
		'Menu\MenuServiceProvider',
		'Laravel\Socialite\SocialiteServiceProvider',
		'Laravelrus\LocalizedCarbon\LocalizedCarbonServiceProvider',
		'Vinkla\Translator\TranslatorServiceProvider',
		'yajra\Datatables\DatatablesServiceProvider',

	],

	/*
	|--------------------------------------------------------------------------
	| Class Aliases
	|--------------------------------------------------------------------------
	|
	| This array of class aliases will be registered when this application
	| is started. However, feel free to register as many as you wish as
	| the aliases are "lazy" loaded so they don't hinder performance.
	|
	*/

	'aliases' => [

		'App'       => 'Illuminate\Support\Facades\App',
		'Artisan'   => 'Illuminate\Support\Facades\Artisan',
		'Auth'      => 'Illuminate\Support\Facades\Auth',
		'Blade'     => 'Illuminate\Support\Facades\Blade',
		'Bus'       => 'Illuminate\Support\Facades\Bus',
		'Cache'     => 'Illuminate\Support\Facades\Cache',
		'Config'    => 'Illuminate\Support\Facades\Config',
		'Cookie'    => 'Illuminate\Support\Facades\Cookie',
		'Crypt'     => 'Illuminate\Support\Facades\Crypt',
		'DB'        => 'Illuminate\Support\Facades\DB',
		'Eloquent'  => 'Illuminate\Database\Eloquent\Model',
		'Event'     => 'Illuminate\Support\Facades\Event',
		'File'      => 'Illuminate\Support\Facades\File',
		'Hash'      => 'Illuminate\Support\Facades\Hash',
		'Input'     => 'Illuminate\Support\Facades\Input',
		'Inspiring' => 'Illuminate\Foundation\Inspiring',
		'Lang'      => 'Illuminate\Support\Facades\Lang',
		'Log'       => 'Illuminate\Support\Facades\Log',
		'Mail'      => 'Illuminate\Support\Facades\Mail',
		'Password'  => 'Illuminate\Support\Facades\Password',
		'Queue'     => 'Illuminate\Support\Facades\Queue',
		'Redirect'  => 'Illuminate\Support\Facades\Redirect',
		'Redis'     => 'Illuminate\Support\Facades\Redis',
		'Request'   => 'Illuminate\Support\Facades\Request',
		'Response'  => 'Illuminate\Support\Facades\Response',
		'Route'     => 'Illuminate\Support\Facades\Route',
		'Schema'    => 'Illuminate\Support\Facades\Schema',
		'Session'   => 'Illuminate\Support\Facades\Session',
		'Storage'   => 'Illuminate\Support\Facades\Storage',
		'URL'       => 'Illuminate\Support\Facades\URL',
		'Validator' => 'Illuminate\Support\Facades\Validator',
		'View'      => 'Illuminate\Support\Facades\View',

		/*
		 * DEV Package Alias
		 */
		'Debugbar'				=> 'Barryvdh\Debugbar\Facade',

		/*
		 * Package Alias
		 */
		'Carbon'				=> 'Carbon\Carbon',
		'Component'				=> 'Caffeinated\Themes\Facades\Component',
		'Datatables'			=> 'yajra\Datatables\Datatables',
		'DiffFormatter'			=> 'Laravelrus\LocalizedCarbon\DiffFactoryFacade',
		'Flash'					=> 'Caffeinated\Flash\Facades\Flash',
// 		'Form'				=> 'Illuminate\Html\FormFacade',
// 		'HTML'				=> 'Illuminate\Html\HtmlFacade',
		'Form'					=> 'Collective\Html\FormFacade',
		'Html'					=> 'Collective\Html\HtmlFacade',
		'Image'					=> 'Intervention\Image\Facades\Image',
		'LocalizedCarbon'		=> 'Laravelrus\LocalizedCarbon\LocalizedCarbon',
		'Menu'					=> 'Menu\Menu',
		'Module'				=> 'Caffeinated\Modules\Facades\Module',
		'NestedSet'				=> 'Kalnoy\Nestedset\NestedSet',
		'Node'					=> 'Kalnoy\Nestedset\Node',
		'Plugin'				=> 'Caffeinated\Plugins\Facades\Plugin',
		'Setting'				=> 'anlutro\LaravelSettings\Facade',
		'Socialize'				=> 'Laravel\Socialite\Facades\Socialite',
		'Theme'					=> 'Caffeinated\Themes\Facades\Theme',
		'Throttle'				=> 'GrahamCampbell\Throttle\Facades\Throttle',
//		'Widget'				=> 'Arrilot\Widgets\Facade',
//		'AsyncWidget'			=> 'Arrilot\Widgets\AsyncFacade',

	],

];


text:
package org.apache.ignite.internal;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskAdapter;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.resources.LoggerResource;
import org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi;
import org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
import org.jetbrains.annotations.Nullable;

/**
 * Multithreaded job stealing test.
 */
@GridCommonTest(group = "Kernal Self")
public class GridMultithreadedJobStealingSelfTest extends GridCommonAbstractTest {
    /** */
    private Ignite ignite;

    /** */
    public GridMultithreadedJobStealingSelfTest() {
        super(false /* don't start grid*/);
    }

    /** {@inheritDoc} */
    @Override protected void beforeTest() throws Exception {
        ignite = startGridsMultiThreaded(2);
    }

    /** {@inheritDoc} */
    @Override protected void afterTest() throws Exception {
        ignite = null;

        stopAllGrids();
    }

    /**
     * Test 2 jobs on 2 nodes.
     *
     * @throws Exception If test failed.
     */
    public void testTwoJobsMultithreaded() throws Exception {
        final AtomicReference<Exception> fail = new AtomicReference<>(null);

        final AtomicInteger stolen = new AtomicInteger(0);
        final AtomicInteger noneStolen = new AtomicInteger(0);

        int threadsNum = 10;

        GridTestUtils.runMultiThreaded(new Runnable() {
            /** */
            @Override public void run() {
                try {
                    JobStealingResult res = ignite.compute().execute(JobStealingTask.class, null);

                    info("Task result: " + res);

                    switch(res) {
                        case NONE_STOLEN : {
                            noneStolen.addAndGet(2);
                            break;
                        }
                        case ONE_STOLEN : {
                            noneStolen.addAndGet(1);
                            stolen.addAndGet(1);
                            break;
                        }
                        case BOTH_STOLEN: {
                            stolen.addAndGet(2);
                            break;
                        }
                        default: {
                            assert false : "Result is: " + res;
                        }
                    }
                }
                catch (IgniteException e) {
                    log.error("Failed to execute task.", e);

                    fail.getAndSet(e);
                }
            }
        }, threadsNum, "JobStealingThread");

        for (Ignite g : G.allGrids())
            info("Metrics [nodeId=" + g.cluster().localNode().id() +
                ", metrics=" + g.cluster().localNode().metrics() + ']');

        assert fail.get() == null : "Test failed with exception: " + fail.get();

        // Total jobs number is threadsNum * 2
        assert stolen.get() + noneStolen.get() == threadsNum * 2 : "Incorrect processed jobs number";

        assert stolen.get() != 0 : "No jobs were stolen.";

        // Under these circumstances we should not have  more than 2 jobs
        // difference.
        //(but muted to 4 due to very rare fails and low priority of fix)
        assert Math.abs(stolen.get() - noneStolen.get()) <= 4 : "Stats [stolen=" + stolen +
            ", noneStolen=" + noneStolen + ']';
    }

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        JobStealingCollisionSpi colSpi = new JobStealingCollisionSpi();

        // One job at a time.
        colSpi.setActiveJobsThreshold(1);
        colSpi.setWaitJobsThreshold(0);

        JobStealingFailoverSpi failSpi = new JobStealingFailoverSpi();

        // Verify defaults.
        assert failSpi.getMaximumFailoverAttempts() == JobStealingFailoverSpi.DFLT_MAX_FAILOVER_ATTEMPTS;

        cfg.setCollisionSpi(colSpi);
        cfg.setFailoverSpi(failSpi);

        return cfg;
    }

    /**
     * Job stealing task.
     */
    private static class JobStealingTask extends ComputeTaskAdapter<Object, JobStealingResult> {
        /** Grid. */
        @IgniteInstanceResource
        private Ignite ignite;

        /** Logger. */
        @LoggerResource
        private IgniteLogger log;

        /** {@inheritDoc} */
        @SuppressWarnings("ForLoopReplaceableByForEach")
            @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
            @Nullable Object arg) {
            assert subgrid.size() == 2 : "Invalid subgrid size: " + subgrid.size();

            Map<ComputeJobAdapter, ClusterNode> map = new HashMap<>(subgrid.size());

            // Put all jobs onto local node.
            for (int i = 0; i < subgrid.size(); i++)
                map.put(new GridJobStealingJob(2000L), ignite.cluster().localNode());

            return map;
        }

        /** {@inheritDoc} */
        @Override public JobStealingResult reduce(List<ComputeJobResult> results) {
            assert results.size() == 2;

            for (ComputeJobResult res : results)
                log.info("Job result: " + res.getData());

            Object obj0 = results.get(0).getData();

            if (obj0.equals(results.get(1).getData())) {
                if (obj0.equals(ignite.name()))
                    return JobStealingResult.NONE_STOLEN;

                return JobStealingResult.BOTH_STOLEN;
            }

            return JobStealingResult.ONE_STOLEN;
        }
    }

    /**
     * Job stealing job.
     */
    private static final class GridJobStealingJob extends ComputeJobAdapter {
        /** Injected grid. */
        @IgniteInstanceResource
        private Ignite ignite;

        /**
         * @param arg Job argument.
         */
        GridJobStealingJob(Long arg) {
            super(arg);
        }

        /** {@inheritDoc} */
        @Override public Serializable execute() {
            try {
                Long sleep = argument(0);

                assert sleep != null;

                Thread.sleep(sleep);
            }
            catch (InterruptedException e) {
                throw new IgniteException("Job got interrupted.", e);
            }

            return ignite.name();
        }
    }

    /**
     * Job stealing result.
     */
    private enum JobStealingResult {
        /** */
        BOTH_STOLEN,

        /** */
        ONE_STOLEN,

        /** */
        NONE_STOLEN
    }
}


text:
// .NAME vtkButterflySubdivisionFilter - generate a subdivision surface using the Butterfly Scheme
// .SECTION Description
// vtkButterflySubdivisionFilter is an interpolating subdivision scheme
// that creates four new triangles for each triangle in the mesh. The
// user can specify the NumberOfSubdivisions. This filter implements the
// 8-point butterfly scheme described in: Zorin, D., Schroder, P., and
// Sweldens, W., "Interpolating Subdivisions for Meshes with Arbitrary
// Topology," Computer Graphics Proceedings, Annual Conference Series,
// 1996, ACM SIGGRAPH, pp.189-192. This scheme improves previous
// butterfly subdivisions with special treatment of vertices with valence
// other than 6.
//
// Currently, the filter only operates on triangles. Users should use the
// vtkTriangleFilter to triangulate meshes that contain polygons or
// triangle strips.
//
// The filter interpolates point data using the same scheme. New
// triangles created at a subdivision step will have the cell data of
// their parent cell.

// .SECTION Thanks
// This work was supported by PHS Research Grant No. 1 P41 RR13218-01
// from the National Center for Research Resources.

// .SECTION See Also
// vtkInterpolatingSubdivisionFilter vtkLinearSubdivisionFilter

#ifndef __vtkButterflySubdivisionFilter_h
#define __vtkButterflySubdivisionFilter_h

#include "vtkInterpolatingSubdivisionFilter.h"

class vtkCellArray;
class vtkIdList;
class vtkIntArray;

class VTK_GRAPHICS_EXPORT vtkButterflySubdivisionFilter : public vtkInterpolatingSubdivisionFilter
{
public:
  // Description:
  // Construct object with NumberOfSubdivisions set to 1.
  static vtkButterflySubdivisionFilter *New();
  vtkTypeMacro(vtkButterflySubdivisionFilter,vtkInterpolatingSubdivisionFilter);

protected:
  vtkButterflySubdivisionFilter () {};
  ~vtkButterflySubdivisionFilter () {};

private:
  void GenerateSubdivisionPoints(vtkPolyData *inputDS, vtkIntArray *edgeData,
                                 vtkPoints *outputPts, vtkPointData *outputPD);
  void GenerateButterflyStencil(vtkIdType p1, vtkIdType p2, vtkPolyData *polys,
                                vtkIdList *stencilIds, double *weights);
  void GenerateLoopStencil(vtkIdType p1, vtkIdType p2, vtkPolyData *polys,
                           vtkIdList *stencilIds, double *weights);
  void GenerateBoundaryStencil(vtkIdType p1, vtkIdType p2, vtkPolyData *polys,
                               vtkIdList *stencilIds, double *weights);

private:
  vtkButterflySubdivisionFilter(const vtkButterflySubdivisionFilter&);  // Not implemented.
  void operator=(const vtkButterflySubdivisionFilter&);  // Not implemented.
};

#endif


text:
package org.nd4j.linalg.schedule;

import lombok.Data;
import org.nd4j.shade.jackson.annotation.JsonProperty;

/**
 *
 * Polynomial decay schedule, with 3 parameters: initial value, maxIter, power.<br>
 * Note that the the value will be 0 after maxIter, otherwise is given by:
 * value(i) = initialValue * (1 + i/maxIter)^(-power)
 * where i is the iteration or epoch (depending on the setting)
 *
 * @author Alex Black
 */
@Data
public class PolySchedule implements ISchedule {

    private final ScheduleType scheduleType;
    private final double initialValue;
    private final double power;
    private final int maxIter;

    public PolySchedule(@JsonProperty("scheduleType") ScheduleType scheduleType,
                        @JsonProperty("initialValue") double initialValue,
                        @JsonProperty("power") double power,
                        @JsonProperty("maxIter") int maxIter){
        this.scheduleType = scheduleType;
        this.initialValue = initialValue;
        this.power = power;
        this.maxIter = maxIter;
    }

    @Override
    public double valueAt(int iteration, int epoch) {
        int i = (scheduleType == ScheduleType.ITERATION ? iteration : epoch);

        if( i >= maxIter ){
            return 0;
        }

        return initialValue * Math.pow(1 + i / (double)maxIter, power);
    }

    @Override
    public PolySchedule clone() {
        return new PolySchedule(scheduleType, initialValue, power, maxIter);
    }

}


text:
#include "../../../YaizuComLib/src/stkpl/StkPl.h"
#include "../../../YaizuComLib/src/stkwebapp_um/stkwebapp_um.h"
#include "MyMsgProc.h"
#include "ApiOdbcInfo.h"
#include "dataaccess.h"
#include "..\Global.h"
#include "OdbcManager.h"
#include "DbAccessor.h"

StkObject* ApiOdbcInfo::GetOdbcInfo(wchar_t UrlPath[StkWebAppExec::URL_PATH_LENGTH], int* ResultCode, wchar_t* Token)
{
	StkObject* ResObj = new StkObject(L"");
	wchar_t YourName[Global::MAXLEN_OF_USERNAME] = L"";
	int YourId = -1;
	if (!CheckCredentials(Token, YourName, &YourId)) {
		AddCodeAndMsg(ResObj, MyMsgProc::CMDFRK_AUTH_ERROR, MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_AUTH_ERROR), MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_AUTH_ERROR));
		*ResultCode = 401;
		return ResObj;
	}

	if (StkPlWcsStr(UrlPath, L"?query=default")) {
		AddCodeAndMsg(ResObj, 0, L"", L"");
		StkObject* DatObj = new StkObject(L"Data");

		SQLTCHAR ConnStrPostgreSql[Global::MAX_PARAM_LENGTH];
		SQLTCHAR ConnStrMariaDb[Global::MAX_PARAM_LENGTH];
		SQLTCHAR ConnStrMySql[Global::MAX_PARAM_LENGTH];

		DbAccessor* DaMariaDb    = NULL;
		DbAccessor* DaPostgreSql = NULL;
		DbAccessor* DaMySql      = NULL;

		DaMariaDb    = OdbcManager::GetInstance()->CreateAccessorObject(OdbcManager::MARIADB_ACCESSOR);
		DaPostgreSql = OdbcManager::GetInstance()->CreateAccessorObject(OdbcManager::POSTGRESQL_ACCESSOR);
		DaMySql      = OdbcManager::GetInstance()->CreateAccessorObject(OdbcManager::MYSQL_ACCESSOR);

		DaMariaDb->GetDefaultConnStr(ConnStrMariaDb);
		DaPostgreSql->GetDefaultConnStr(ConnStrPostgreSql);
		DaMySql->GetDefaultConnStr(ConnStrMySql);

		OdbcManager::GetInstance()->DeleteAccessorObject(DaMariaDb);
		OdbcManager::GetInstance()->DeleteAccessorObject(DaPostgreSql);
		OdbcManager::GetInstance()->DeleteAccessorObject(DaMySql);

		StkObject* DatObjMariaDb = new StkObject(L"OdbcInfo");
		DatObjMariaDb->AppendChildElement(new StkObject(L"DbType", L"MariaDB"));
		DatObjMariaDb->AppendChildElement(new StkObject(L"ConnStr", ConnStrMariaDb));
		DatObj->AppendChildElement(DatObjMariaDb);

		StkObject* DatObjPostgreSql = new StkObject(L"OdbcInfo");
		DatObjPostgreSql->AppendChildElement(new StkObject(L"DbType", L"PostgreSQL"));
		DatObjPostgreSql->AppendChildElement(new StkObject(L"ConnStr", ConnStrPostgreSql));
		DatObj->AppendChildElement(DatObjPostgreSql);

		StkObject* DatObjMySql = new StkObject(L"OdbcInfo");
		DatObjMySql->AppendChildElement(new StkObject(L"DbType", L"MySQL"));
		DatObjMySql->AppendChildElement(new StkObject(L"ConnStr", ConnStrMySql));
		DatObj->AppendChildElement(DatObjMySql);
		ResObj->AppendChildElement(DatObj);
		*ResultCode = 200;
	} else
	if (StkPlWcsStr(UrlPath, L"?query=configured")) {
		AddCodeAndMsg(ResObj, 0, L"", L"");
		StkObject* DatObj = new StkObject(L"Data");

		wchar_t ConnStr[256];
		int Init;
		int DbmsType = DataAccess::GetInstance()->GetOdbcConfing(ConnStr, &Init);
		wchar_t DbmsTypeStr[16];
		if (Init == 1) {
			lstrcpy(DbmsTypeStr, L"Init");
		} else if (DbmsType == OdbcManager::MARIADB_ACCESSOR) {
			lstrcpy(DbmsTypeStr, L"MariaDB");
		} else if (DbmsType == OdbcManager::POSTGRESQL_ACCESSOR) {
			lstrcpy(DbmsTypeStr, L"PostgreSQL");
		} else if (DbmsType == OdbcManager::MYSQL_ACCESSOR) {
			lstrcpy(DbmsTypeStr, L"MySQL");
		} else {
		}

		StkObject* DatObjDb = new StkObject(L"OdbcInfo");
		DatObjDb->AppendChildElement(new StkObject(L"DbType", DbmsTypeStr));
		DatObjDb->AppendChildElement(new StkObject(L"ConnStr", ConnStr));

		DbAccessor* Da = OdbcManager::GetInstance()->CreateAccessorObject(DbmsType);
		int Ret = Da->Test(ConnStr);
		if (Ret == SQL_SUCCESS) {
			DatObjDb->AppendChildElement(new StkObject(L"Status", L"connectable"));
		} else {
			DatObjDb->AppendChildElement(new StkObject(L"Status", L"unconnectable"));
		}
		OdbcManager::GetInstance()->DeleteAccessorObject(Da);

		DatObj->AppendChildElement(DatObjDb);
		ResObj->AppendChildElement(DatObj);
		*ResultCode = 200;
	} else {
		AddCodeAndMsg(ResObj, MyMsgProc::CMDFRK_REQ_NOT_SUFFICIENT, MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_REQ_NOT_SUFFICIENT),  MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_REQ_NOT_SUFFICIENT));
		*ResultCode = 400;
	}

	return ResObj;
}

StkObject* ApiOdbcInfo::PostOdbcInfo(StkObject* ReqObj, int* ResultCode, wchar_t* Token)
{
	int DbmsType = -1;
	SQLTCHAR ConnStr[Global::MAX_PARAM_LENGTH] = L"";

	StkObject* ResObj = new StkObject(L"");

	wchar_t YourName[Global::MAXLEN_OF_USERNAME] = L"";
	int YourId = -1;
	if (!CheckCredentials(Token, YourName, &YourId)) {
		AddCodeAndMsg(ResObj, MyMsgProc::CMDFRK_AUTH_ERROR, MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_AUTH_ERROR), MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_AUTH_ERROR));
		*ResultCode = 401;
		return ResObj;
	}

	if (!IsAdminUser(Token)) {
		AddCodeAndMsg(ResObj, MyMsgProc::CMDFRK_ACCESS_RIGHT_ERROR, MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_ACCESS_RIGHT_ERROR), MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_ACCESS_RIGHT_ERROR));
		*ResultCode = 403;
		return ResObj;
	}

	StkObject* Elem = ReqObj->GetFirstChildElement();
	while (Elem) {
		if (!lstrcmp(Elem->GetName(), L"DbType") && Elem->GetType() == StkObject::STKOBJECT_ELEM_STRING) {
			if (!lstrcmp(Elem->GetStringValue(), L"MariaDB")) {
				DbmsType = OdbcManager::MARIADB_ACCESSOR;
			} else
			if (!lstrcmp(Elem->GetStringValue(), L"PostgreSQL")) {
				DbmsType = OdbcManager::POSTGRESQL_ACCESSOR;
			} else
			if (!lstrcmp(Elem->GetStringValue(), L"MySQL")) {
				DbmsType = OdbcManager::MYSQL_ACCESSOR;
			}
		}
		if (!lstrcmp(Elem->GetName(), L"ConnStr") && Elem->GetType() == StkObject::STKOBJECT_ELEM_STRING) {
			int LenOfConnStr = lstrlen(Elem->GetStringValue());
			if (LenOfConnStr >= 256) {
				wchar_t TmpMsgEng[StkWebAppExec::URL_PATH_LENGTH];
				wchar_t TmpMsgJpn[StkWebAppExec::URL_PATH_LENGTH];
				StkPlSwPrintf(TmpMsgEng, StkWebAppExec::URL_PATH_LENGTH, L"%ls (Param=%ls, Length=%d, Max Length=255)", MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_PARAM_LENGTH_TOO_LONG), L"ConnStr", LenOfConnStr);
				StkPlSwPrintf(TmpMsgJpn, StkWebAppExec::URL_PATH_LENGTH, L"%ls (Param=%ls, Length=%d, Max Length=255)", MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_PARAM_LENGTH_TOO_LONG), L"ConnStr", LenOfConnStr);
				AddCodeAndMsg(ResObj, MyMsgProc::CMDFRK_PARAM_LENGTH_TOO_LONG, TmpMsgEng, TmpMsgJpn);
				*ResultCode = 400;
				return ResObj;
			}
			lstrcpy(ConnStr, Elem->GetStringValue());
		}
		Elem = Elem->GetNext();
	}
	if (DbmsType == -1 || lstrcmp(ConnStr, L"") == 0) {
		AddCodeAndMsg(ResObj, MyMsgProc::CMDFRK_REQ_NOT_SUFFICIENT, MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_REQ_NOT_SUFFICIENT),  MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_REQ_NOT_SUFFICIENT));
		*ResultCode = 400;
	} else {
		DataAccess::GetInstance()->SetOdbcConnStr(DbmsType, (wchar_t*)ConnStr);
		AddCodeAndMsg(ResObj, 0, L"", L"");
		StkObject* DatObj = new StkObject(L"Data");
		StkObject* DatObjDb = new StkObject(L"OdbcInfo");
		DbAccessor* Da = OdbcManager::GetInstance()->CreateAccessorObject(DbmsType);
		int Ret = Da->Test(ConnStr);
		if (Ret == SQL_SUCCESS) {
			DatObjDb->AppendChildElement(new StkObject(L"Status", L"connectable"));
		} else {
			DatObjDb->AppendChildElement(new StkObject(L"Status", L"unconnectable"));
		}
		OdbcManager::GetInstance()->DeleteAccessorObject(Da);
		DatObj->AppendChildElement(DatObjDb);
		ResObj->AppendChildElement(DatObj);

		StkWebAppUm_AddLogMsg(MyMsgProc::GetMsgEng(MyMsgProc::CMDFRK_LOG_DBMSCHANGE), MyMsgProc::GetMsgJpn(MyMsgProc::CMDFRK_LOG_DBMSCHANGE), YourId);
		*ResultCode = 200;
	}

	return ResObj;
}

StkObject* ApiOdbcInfo::ExecuteImpl(StkObject* ReqObj, int Method, wchar_t UrlPath[StkWebAppExec::URL_PATH_LENGTH], int* ResultCode, wchar_t Locale[3], wchar_t* Token)
{
	if (Method & STKWEBAPP_METHOD_GET) {
		return GetOdbcInfo(UrlPath, ResultCode, Token);
	} else
	if (Method & STKWEBAPP_METHOD_POST) {
		return PostOdbcInfo(ReqObj, ResultCode, Token);
	}
	return NULL;
}


text:
package org.scalatest.finders;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ToStringTarget implements AstNode {

  private final String className;
  private AstNode parent;
  private final List<AstNode> children;
  private final Object target;

  public ToStringTarget(String className, AstNode parent, AstNode[] children, Object target) {
    this.className = className;
    this.parent = parent;
    if (parent != null)
        parent.addChild(this);
    this.children = new ArrayList<>();
    this.children.addAll(Arrays.asList(children));
    this.target = target;
  }

  @Override
  public String className() {
    return className;
  }

  @Override
  public AstNode parent() {
    return parent;
  }

  // TestsOnly, in cases of cyclic dependencies
  public void injectParent(AstNode newParent) {
    if (parent != null) throw new AssertionError("parent already exists");
    parent = newParent;
    parent.addChild(this);
  }

  @Override
  public AstNode[] children() {
    return new AstNode[0];
  }

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

  @Override
  public void addChild(AstNode node) {
    if (!children.contains(node))
      children.add(node);
  }

  @Override
  public boolean canBePartOfTestName() {
    return true;
  }

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


text:
package nachos.threads;

import nachos.machine.*;

/**
 * A communicator allows threads to synchronously exchange 32-bit
 * messages. Multiple threads can be waiting to speak, and multiple
 * threads can be waiting to listen. But there should never be a time
 * when both a speaker and a listener are waiting, because the two threads can
 * be paired off at this point.
 */
public class Communicator {
	/**
	 * Allocate a new communicator.
	 */
	public Communicator() {
		lockListen = new Lock();
		lockSpeak = new Lock();
		lockMsg = new Lock();
		hasRead = false;
		hasSpoken = false;
		cvHasRead = new Condition(lockMsg);
		cvHasSpoken = new Condition(lockMsg);
		message = -1;
	}

	/**
	 * Wait for a thread to listen through this communicator, and then transfer
	 * word to the listener.
	 *
	 *

	 * Does not return until this thread is paired up with a listening thread.
	 * Exactly one listener should receive word.
	 *
	 * @param word the integer to transfer.
	 */
	public void speak(int word) {
		//Acquire speaker lock and message lock
		lockSpeak.acquire();	//mutual exclusion: only 1 speaker can be speaking
		lockMsg.acquire();	//mutual exclusion: You can read or write to message but not both at the same time
		if(D) System.out.println("Inside speak(). About to modify message to " + word);
		//modify message and notify listeners
		message = word;
		hasSpoken = true;
		cvHasSpoken.wake();
		//wait for acknowledgement
		while(!hasRead)
		{
			if(D) System.out.println("Waiting for acknowledgement");
			cvHasRead.sleep();
		}
		//release locks and reset acknowledgement flag
		hasRead = false;
		lockMsg.release();
		lockSpeak.release();
	}

	/**
	 * Wait for a thread to speak through this communicator, and then return the
	 * word that thread passed to <tt>speak()</tt>.
	 *
	 * @return the integer transferred.
	 */
	public int listen() {
		lockListen.acquire();	//mutual exclusion: only 1 listener can be listening
		lockMsg.acquire();	//mututal exclusion: You can read or write a message but not both at the same time
		//wait for speaker to speak;
		while(!hasSpoken)
		{
			cvHasSpoken.sleep();
		}
		int word = message;	//read message
		hasSpoken = false;	//reset flag
		//notify speakers that message has been read
		hasRead = true;
		cvHasRead.wake();
		//release locks
		lockMsg.release();
		lockListen.release();
		return word;
	}

	private static class Listener implements Runnable
	{
		public Listener(Communicator comm, int id)
		{
			this.comm = comm;
			this.id = id;
		}

		public void run()
		{
			int msg = comm.listen();
			System.out.printf("Listener %d received the number %d\n", id, msg);
		}
		private Communicator comm;
		private int id;
	}

	private static class Speaker implements Runnable
	{
		public Speaker(Communicator comm, int id, int msg)
		{
			this.comm = comm;
			this.id = id;
			this.msg = msg;
		}

		public void run()
		{
			System.out.printf("Speaker %d sending the number %d\n", id, msg);
			comm.speak(msg);
		}
		private Communicator comm;
		private int id;
		private int msg;
	}

	public static void selfTest()
	{
		if(D)	System.out.println("Communicator Self Test -------------- ");
		Communicator comm = new Communicator();
		for(int i = 1; i < 3; i++)
		{
			if(D) System.out.println("creating speakers......");
			new KThread(new Speaker(comm, i, i)).setName("Speaker " + (i)).fork();
		}
		for(int i = 1; i < 3; i++)
		{
			System.out.println("Creating listeners.......");
			new KThread(new Listener(comm, i)).setName("Listener " + (i)).fork();
		}
		for(int i = 0; i < 10; i++)
		{
			KThread.yield();
		}
	}

	private Lock lockListen;		// Lock for listeners
	private Lock lockSpeak;			// Lock for Speakers
	private Lock lockMsg;			// Lock to read or modify the message
	private int message;
	private boolean hasRead;		//Acknowledgement - flag to notify speaker that message has been read
	private Condition cvHasRead;		//C.V. for boolean condition hasRead
	private Condition cvHasSpoken;	 	//C.V. for boolean condition hasSpoken
	private boolean hasSpoken;		//determines whether a speaker in this communicator has spoken
	private static final boolean D = true;  //debug flag
}


text:
import Data.List
import Numeric
import Math.NumberTheory.Primes.Testing (isPrime)

pandigitals n = let pandigitalStrs = permutations $ take n "123456789"
                in map (\x -> read x:: Integer) pandigitalStrs

pandigitalsUpTo n = concat $ map pandigitals [1..n]

main = do
    let pandigitalNumbers = pandigitalsUpTo 9
    let pandigitalPrimes = filter isPrime pandigitalNumbers
    print $ maximum $ pandigitalPrimes


text:
/**
 * Faction.js
 *
 * @description :: TODO: You might write a short summary of how this model works and what it represents here.
 */

var Faction = {
    schema: true,
    autoCreatedAt: false,
    autoUpdatedAt: false,
    attributes: {
        id: {
            primaryKey: true,
            type: 'integer',
            unique: true
        },
        name: {
            type: 'string',
            unique: true
        }
    }
};

module.exports = Faction;


text:
from yubikit.core.otp import OtpConnection
from .base import OtpYubiKeyDevice, YUBICO_VID, USAGE_OTP

from ctypes.util import find_library
import ctypes

import glob
import fcntl
import os
import re
import sys
import struct
import logging

# Don't typecheck this file on Windows
assert sys.platform != "win32"  # nosec

logger = logging.getLogger(__name__)

devdir = "/dev/"

# /usr/include/dev/usb/usb_ioctl.h
USB_GET_REPORT = 0xC0205517
USB_SET_REPORT = 0x80205518
USB_GET_REPORT_DESC = 0xC0205515

# /usr/include/dev/hid/hidraw.h>
HIDIOCGRAWINFO = 0x40085520
HIDIOCGRDESC = 0x2000551F
HIDIOCGRDESCSIZE = 0x4004551E
HIDIOCGFEATURE_9 = 0xC0095524
HIDIOCSFEATURE_9 = 0x80095523

class HidrawConnection(OtpConnection):
    """
    hidraw(4) is FreeBSD's modern raw access driver, based on usbhid(4).
    It is available since FreeBSD 13 and can be activated by adding
    `hw.usb.usbhid.enable="1"` to `/boot/loader.conf`. The actual kernel
    module is loaded with `kldload hidraw`.
    """

    def __init__(self, path):
        self.fd = os.open(path, os.O_RDWR)

    def close(self):
        os.close(self.fd)

    def receive(self):
        buf = bytearray(1 + 8)
        fcntl.ioctl(self.fd, HIDIOCGFEATURE_9, buf, True)
        return buf[1:]

    def send(self, data):
        buf = bytes([0]) + data
        fcntl.ioctl(self.fd, HIDIOCSFEATURE_9, buf)

    @staticmethod
    def get_info(dev):
        buf = bytearray(4 + 2 + 2)
        fcntl.ioctl(dev, HIDIOCGRAWINFO, buf, True)
        return struct.unpack("<IHH", buf)

    @staticmethod
    def get_descriptor(dev):
        buf = bytearray(4)
        fcntl.ioctl(dev, HIDIOCGRDESCSIZE, buf, True)
        size = struct.unpack("<I", buf)[0]
        buf += bytearray(size)
        fcntl.ioctl(dev, HIDIOCGRDESC, buf, True)
        return buf[4:]

    @staticmethod
    def get_usage(dev):
        buf = HidrawConnection.get_descriptor(dev)
        usage, usage_page = (None, None)
        while buf:
            head, buf = buf[0], buf[1:]
            typ, size = 0xFC & head, 0x03 & head
            value, buf = buf[:size], buf[size:]
            if typ == 4:  # Usage page
                usage_page = struct.unpack("<I", value.ljust(4, b"\0"))[0]
                if usage is not None:
                    return usage_page, usage
            elif typ == 8:  # Usage
                usage = struct.unpack("<I", value.ljust(4, b"\0"))[0]
                if usage_page is not None:
                    return usage_page, usage

    @staticmethod
    def list_devices():
        devices = []
        for hidraw in glob.glob(devdir + "hidraw?*"):
            try:
                with open(hidraw, "rb") as f:
                    bustype, vid, pid = HidrawConnection.get_info(f)
                    if vid == YUBICO_VID and HidrawConnection.get_usage(f) == USAGE_OTP:
                        devices.append(OtpYubiKeyDevice(hidraw, pid, HidrawConnection))
            except Exception as e:
                logger.debug("Failed opening HID device", exc_info=e)
                continue
        return devices

# For UhidConnection
libc = ctypes.CDLL(find_library("c"))

class usb_gen_descriptor(ctypes.Structure):
    _fields_ = [
        (
            "ugd_data",
            ctypes.c_void_p,
        ),
        ("ugd_lang_id", ctypes.c_uint16),
        ("ugd_maxlen", ctypes.c_uint16),
        ("ugd_actlen", ctypes.c_uint16),
        ("ugd_offset", ctypes.c_uint16),
        ("ugd_config_index", ctypes.c_uint8),
        ("ugd_string_index", ctypes.c_uint8),
        ("ugd_iface_index", ctypes.c_uint8),
        ("ugd_altif_index", ctypes.c_uint8),
        ("ugd_endpt_index", ctypes.c_uint8),
        ("ugd_report_type", ctypes.c_uint8),
        ("reserved", ctypes.c_uint8 * 8),
    ]

class UhidConnection(OtpConnection):
    """
    uhid(4) is FreeBSD's classic USB hid access driver and enabled
    by default in FreeBSD 13.x and earlier.
    """

    def __init__(self, path):
        self.fd = os.open(path, os.O_RDWR)

    def close(self):
        os.close(self.fd)

    def receive(self):
        buf = ctypes.create_string_buffer(9)
        desc = usb_gen_descriptor(
            ugd_data=ctypes.addressof(buf),
            ugd_maxlen=ctypes.sizeof(buf),
            ugd_report_type=3,
        )
        ret = libc.ioctl(self.fd, USB_GET_REPORT, ctypes.pointer(desc))
        if ret != 0:
            raise ValueError("ioctl failed: " + str(ret))
        return buf[:-1]

    def send(self, data):
        buf = ctypes.create_string_buffer(8)
        for i in range(0, len(data)):
            buf[i] = data[i]

        desc = usb_gen_descriptor(
            ugd_data=ctypes.addressof(buf),
            ugd_maxlen=len(buf),
            ugd_report_type=0x3,
        )
        ret = libc.ioctl(self.fd, USB_SET_REPORT, ctypes.pointer(desc))
        if ret != 0:
            raise ValueError("ioctl failed: " + str(ret))

    @staticmethod
    def get_usage(dev):
        c_data = ctypes.create_string_buffer(4096)
        desc = usb_gen_descriptor(
            ugd_data=ctypes.addressof(c_data),
            ugd_maxlen=ctypes.sizeof(c_data),
            ugd_report_type=3,
        )
        ret = libc.ioctl(dev, USB_GET_REPORT_DESC, ctypes.pointer(desc))
        if ret != 0:
            raise ValueError("ioctl failed")

        REPORT_DESCRIPTOR_KEY_MASK = 0xFC
        SIZE_MASK = ~REPORT_DESCRIPTOR_KEY_MASK
        USAGE_PAGE = 0x04
        USAGE = 0x08

        data = c_data.raw
        usage, usage_page = (None, None)
        while data and not (usage and usage_page):
            head, data = struct.unpack_from(">B", data)[0], data[1:]
            key, size = REPORT_DESCRIPTOR_KEY_MASK & head, SIZE_MASK & head
            value = struct.unpack_from("<I", data[:size].ljust(4, b"\0"))[0]
            data = data[size:]
            if key == USAGE_PAGE and not usage_page:
                usage_page = value
            elif key == USAGE and not usage:
                usage = value

        return (usage_page, usage)

    @staticmethod
    def get_info(index):
        vendor_re = re.compile("vendor=(0x[0-9a-fA-F]+)")
        product_re = re.compile("product=(0x[0-9a-fA-F]+)")
        sernum_re = re.compile('sernum="([^"]+)')

        pnpinfo = ("dev.uhid." + index + ".%pnpinfo").encode()

        ovalue = ctypes.create_string_buffer(1024)
        olen = ctypes.c_size_t(ctypes.sizeof(ovalue))
        key = ctypes.c_char_p(pnpinfo)
        retval = libc.sysctlbyname(key, ovalue, ctypes.byref(olen), None, None)
        if retval != 0:
            raise IOError("sysctlbyname failed")

        value = ovalue.value[: olen.value].decode()
        m = vendor_re.search(value)
        vid = int(m.group(1), 16) if m else None
        m = product_re.search(value)
        pid = int(m.group(1), 16) if m else None
        m = sernum_re.search(value)
        serial = m.group(1) if m else None
        return (vid, pid, serial)

    @staticmethod
    def list_devices():
        devices = []
        for uhid in glob.glob(devdir + "uhid?*"):
            index = uhid[len(devdir) + len("uhid") :]
            if not index.isdigit():
                continue

            try:
                (vid, pid, serial) = UhidConnection.get_info(index)
                if vid == YUBICO_VID:
                    with open(uhid, "rb") as f:
                        if UhidConnection.get_usage(f.fileno()) == USAGE_OTP:
                            devices.append(OtpYubiKeyDevice(uhid, pid, UhidConnection))
            except Exception as e:
                logger.debug("Failed opening HID device", exc_info=e)
                continue
        return devices

def list_devices():
    devices = HidrawConnection.list_devices()
    if not devices:
        devices = UhidConnection.list_devices()
    return devices


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%profile}}".
 *
 * @property string $id
 * @property string $truename
 * @property integer $age
 * @property string $sex
 * @property string $birthday
 * @property string $nickname
 * @property string $company
 * @property string $userid
 * @property integer $createtime
 */
class Profile extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%profile}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['age', 'userid', 'createtime'], 'integer'],
            [['sex'], 'string'],
            [['birthday'], 'safe'],
            [['truename', 'nickname'], 'string', 'max' => 32],
            [['company'], 'string', 'max' => 100],
            [['userid'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'truename' => 'Truename',
            'age' => 'Age',
            'sex' => 'Sex',
            'birthday' => 'Birthday',
            'nickname' => 'Nickname',
            'company' => 'Company',
            'userid' => 'Userid',
            'createtime' => 'Createtime',
        ];
    }
}


text:
class CreateMultipleChoiceResponses < ActiveRecord::Migration
  def change
    create_table :multiple_choice_responses do |t|
      t.references :multiple_choice_answer
      t.string :student
      t.timestamps null: false
    end
  end
end


text:
package main

import (
	"github.com/stretchr/testify/require"
	"testing"
)

func TestReadLines(t *testing.T) {
	lines, err := readLines("testdata/lines")
	require.NoError(t, err)
	require.Equal(t, []string{
		"one",
		"two",
		"three",
	}, lines)
}


text:
$tempdir = "c:\temp\"
$tempdir = $tempdir.tostring()
$appToMatch = 'Stackdriver*'
$msiFile = "C:\Windows\system32\msiexec.exe"

$LOG='c:\temp\install.log'

#function to write debugging info to the console
Function Write-SerialPort ([string] $message) {
    $port = new-Object System.IO.Ports.SerialPort COM1,9600,None,8,one
    $port.open()
    $port.WriteLine($message)
    $port.Close()
}

function Get-InstalledApps
{
    if ([IntPtr]::Size -eq 4) {
        $regpath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
    }
    else {
        $regpath = @(
            'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
            'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
        )
    }
    Get-ItemProperty $regpath | .{process{if($_.DisplayName -and $_.UninstallString) { $_ } }} | Select DisplayName, Publisher, InstallDate, DisplayVersion, UninstallString |Sort DisplayName
}

Write-SerialPort "Environment passed in was: ${environment}"

#is stackdriver installed
$result = Get-InstalledApps | where {$_.DisplayName -like $appToMatch}

#if we are not admin
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
  # Relaunch as an elevated process:
  Write-SerialPort "Elevating"
  Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
  exit
}

Write-SerialPort "Prefix: ${environment} Name: ${projectname} comes from the project itself"
Write-SerialPort "Elevated"

Write-Host "Bootstrap script started..."

Write-Host "Getting network config..."
# reconfigure dhcp address as static to avoid warnings during dcpromo
$IpAddr = Get-NetIPAddress -InterfaceAlias Ethernet
$IpConf = Get-NetIPConfiguration -InterfaceAlias Ethernet

Write-SerialPort "Fetching metadata parameters..."
$Domain = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/attributes/domain-name
#$NetBiosName = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/attributes/netbios-name
$KmsKey = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/attributes/kms-key
$KmsRegion = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/attributes/keyring-region
$GcsPrefix = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/attributes/gcs-prefix

Write-SerialPort $Domain, $IpAddr, $GcsPrefix

$tempPath = "c:\temp\"

Write-Host "temp dir: $tempPath"

if((Test-Path $tempPath) -eq 0){
   New-Item -ItemType directory -Path c:\temp\
   Write-Host "created c:\temp"
}

cd C:\temp\

$tempSDPath = "c:\temp\StackdriverMonitoring-GCM-46.exe"

#get stackdriver
if((Test-Path $tempSDPath) -eq 0){
    Write-Host("Downloading stackdriver agent")
    invoke-webrequest https://repo.stackdriver.com/windows/StackdriverMonitoring-GCM-46.exe -OutFile $tempSDPath;
}else{
    Write-Host("Stackdriver Agent already downloaded")
}

Write-SerialPort("Get installed apps")

$appToMatch = "StackdriverAgent"

$result = Get-Process | where {$_.ProcessName -like $appToMatch}

# Now running elevated so launch the script:
If ($result -eq $null) {
    Write-Host "Running the Stackdriver install"
    .\StackdriverMonitoring-GCM-46.exe /S
    #msiexec.exe /qn /norestart /i $tempdir\$puppetInstall PUPPET_MASTER_SERVER=$PROJECT_PREFIX-puppet-p.c.$PROJECT_NAME.internal PUPPET_AGENT_ENVIRONMENT=$PUPPET_AGENT_ENVIRONMENT  /l* $LOG
}else{
    Write-Host "Stackdriver is already installed"
}

Write-Host "Configuring windows-startup-script-url"
$name = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/name
$zone = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/zone
$function = Invoke-RestMethod -Headers @{"Metadata-Flavor" = "Google"} -Uri http://169.254.169.254/computeMetadata/v1/instance/attributes/function

if ($function -eq "pdc"){
  Write-Host "Setting windows-startup-script-url in metadata to $GcsPrefix/powershell/bootstrap/primary-domain-controller-step-1.ps1"
  gcloud compute instances add-metadata "$name" --zone $zone --metadata windows-startup-script-url="$GcsPrefix/powershell/bootstrap/primary-domain-controller-step-1.ps1"
}elseif ($function -eq "sql"){
  Write-Host "Setting windows-startup-script-url in metadata to $GcsPrefix/powershell/bootstrap/install-sql-server-principal-step-1.ps1"
  gcloud compute instances add-metadata "$name" --zone $zone --metadata windows-startup-script-url="$GcsPrefix/powershell/bootstrap/domain-member.ps1"
}

Write-Host "Removing windows-startup-script-ps1 from metadata ..."
gcloud compute instances remove-metadata "$name" --zone $zone --keys="windows-startup-script-ps1"

Write-Host "Restarting computer after winstartup ..."
Restart-Computer


text:
package com.silverforge.elasticsearchrawclient.queryDSL.operators;

public enum SortModeOperator {

    MIN("min"),
    MAX("max"),
    SUM("sum"),
    AVG("avg"),
    MEDIAN("median");

    private String value;

    SortModeOperator(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return value;
    }
}


text:
//Declare a Boolean variable called isFemale and assign an appropriate value corresponding to your gender.
//Print it on the console.
using System;

namespace Boolean_Variable
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Are you male(Yes/No):");
            string result = Console.ReadLine();
            bool isMale = true;
            if (result == "Yes")
            {
                Console.WriteLine(isMale);
            }
            else if (result == "No")
            {
                isMale = false;
                Console.WriteLine(isMale);
            }
            else
            {
                Console.WriteLine("Invalid input !");
            }
        }
    }
}


text:
package com.designpatterns;

/**
 *
 * @author Suresh Sarda (sureshssarda@gmail.com)
 *
 */

public class CarBuilder {

    private int engineCapacity;
    private int tankCapacity;
    private boolean tyres;
    private boolean leatherSeats;

    /**
     * Engine capacity of the car
     *
     * @param capacityInHp
     * @return CarBuilder
     */
    public CarBuilder withEngingCapacity(int capacityInHp) {
        this.engineCapacity = capacityInHp;
        return this;
    }

    /**
     * Petrol Tank Capacity of the car
     *
     * @param capacityInLiters
     * @return CarBuilder
     */
    public CarBuilder withPetrolTankCapacity(int capacityInLiters) {
        this.tankCapacity = capacityInLiters;
        return this;
    }

    /**
     * Specify whether the car has tyres.
     *
     * @return CarBuilder
     */
    public CarBuilder withTyres() {
        this.tyres = true;
        return this;
    }

    /**
     * Leather seats in car
     *
     * @return CarBuilder
     */
    public CarBuilder withLeatherSeats() {
        this.leatherSeats = true;
        return this;
    }

    /**
     * Create a car object with specified parameters
     *
     * @return Car
     */
    public Car build() {
        Car car = new Car(engineCapacity, tankCapacity, tyres);
        car.setLeatherSeats(leatherSeats);
        return car;

    }

}


text:
@implementation TWTValidator

- (instancetype)copyWithZone:(NSZone *)zone
{
    return self;
}

- (NSUInteger)hash
{
    // An arbitrary large prime number
    return 2796203;
}

- (BOOL)isEqual:(id)object
{
    return [object isKindOfClass:[self class]];
}

- (BOOL)validateValue:(id)value error:(out NSError *__autoreleasing *)outError
{
    if (!value) {
        if (outError) {
            *outError = [NSError twt_validationErrorWithCode:TWTValidationErrorCodeValueNil
                                            failingValidator:self
                                                       value:value
                                        localizedDescription:TWTLocalizedString(@"TWTValidator.valueNil.validationError")];
        }

        return NO;
    } else if ([[NSNull null] isEqual:value]) {
        if (outError) {
            *outError = [NSError twt_validationErrorWithCode:TWTValidationErrorCodeValueNull
                                            failingValidator:self
                                                       value:value
                                        localizedDescription:TWTLocalizedString(@"TWTValidator.valueNull.validationError")];
        }

        return NO;
    }

    return YES;
}

@end


text:
package org.apache.velocity.app.event.implement;

import org.apache.commons.lang3.StringEscapeUtils;

/**
 *
Escapes the characters in a String to be suitable for use in JavaScript.

 *
Warning: escaping references this way, without knowing if they land inside or outside Javascript simple-quoted or double-quoted strings, is not usable in production.

 *
 * @see StringEscapeUtils
 * @author wglass
 * @since 1.5
 * @deprecated impractical use
 */
@Deprecated
public class EscapeJavaScriptReference extends EscapeReference
{

    /**
     * Escapes the characters in a String to be suitable for use in JavaScript.
     *
     * @param text
     * @return An escaped String.
     * @see StringEscapeUtils
     */
    @Override
    protected String escape(Object text)
    {
        return StringEscapeUtils.escapeEcmaScript(text.toString());
    }

    /**
     * @return attribute "eventhandler.escape.javascript.match"
     */
    @Override
    protected String getMatchAttribute()
    {
        return "eventhandler.escape.javascript.match";
    }

}


text:
<?php if($update): ;?>Update<?php else:; ?>Add New<?php endif; ?> Project

                <?php if($update): ?>
                    <?php echo form_open('project/update/'.$details['id']); ?>
                <?php else: ?>
                    <?php echo form_open('project/add'); ?>
                <?php endif; ?>

                            Name of the Project
                            <?php echo form_error('name'); ?>
                            <input type="text" class="form-control" name="name" value="<?php echo set_value('name', $details['name']); ?>" placeholder="Name of the Project">

                            Location
                            <?php echo form_error('vdc'); ?>
                            <input type="text" class="form-control" name="vdc" value="<?php echo set_value('vdc', $details['vdc']); ?>" placeholder="VDC">
                            <?php echo form_error('district'); ?>
                            <select class="form-control" name="district">
                                <?php foreach ($districts as $district_): ?>
                                    <option value="<?php echo $district_; ?>"
                                            <?php if (set_value('district', $details['district']) == $district_): ?> selected="selected" <?php endif ?>
                                    >
                                            <?php echo $district_; ?>
                                    </option>
                                <?php endforeach; ?>
                            </select>
                            <?php echo form_error('latitude'); ?>
                            <input type="text" name="latitude" class="form-control" value="<?php echo set_value('latitude', $details['latitude']); ?>" placeholder="Latitude">
                            <?php echo form_error('longitude'); ?>
                            <input type="text" name="longitude" class="form-control" value="<?php echo set_value('longitude', $details['longitude']); ?>" placeholder="Longitude">

                            Map Url
                            <?php echo form_error('url'); ?>
                            <input type="text" class="form-control" name="url" value="<?php echo set_value('url', $details['url']); ?>" placeholder="Map URL">

                            Command Area
                            <?php echo form_error('command_area'); ?>
                            <input type="text" name="command_area" class="form-control" value="<?php echo set_value('command_area', $details['command_area']); ?>" placeholder="Command Area">

                            Hydrology
                            <?php echo form_error('source_name'); ?>
                            <input type="text" name="source_name" class="form-control" value="<?php echo set_value('source_name', $details['source_name']); ?>" placeholder="Name of Source">
                            <?php echo form_error('source_type'); ?>
                            <input type="text" name="source_type" class="form-control" value="<?php echo set_value('source_type', $details['source_type']); ?>" placeholder="Type of Source">

                            Canal
                            <?php echo form_error('main_canal_length'); ?>
                            <input type="text" name="main_canal_length" class="form-control" value="<?php echo set_value('main_canal_length', $details['main_canal_length']); ?>" placeholder="Main Canal Length">
                            <?php echo form_error('design_discharge_intake'); ?>
                            <input type="text" name="design_discharge_intake" class="form-control" value="<?php echo set_value('design_discharge_intake', $details['design_discharge_intake']); ?>" placeholder="Design Discharge at Intake">

                            Beneficiaries
                            <?php echo form_error('population'); ?>
                            <input type="text" name="population" class="form-control" value="<?php echo set_value('population', $details['population']); ?>" placeholder="Population">
                            <?php echo form_error('household'); ?>
                            <input type="text" name="household" class="form-control" value="<?php echo set_value('household', $details['household']); ?>" placeholder="Household">

                            Project Cost
                            <?php echo form_error('total_project_cost'); ?>
                            <input type="text" name="total_project_cost" class="form-control" value="<?php echo set_value('total_project_cost', $details['total_project_cost']); ?>" placeholder="Total Project Cost">
                            <?php echo form_error('cost_per_ha'); ?>
                            <input type="text" name="cost_per_ha" class="form-control" value="<?php echo set_value('cost_per_ha', $details['cost_per_ha']); ?>" placeholder="Cost per Ha">

                            Economic Analysis
                            <?php echo form_error('eirr'); ?>
                            <input type="text" name="eirr" class="form-control" value="<?php echo set_value('eirr', $details['eirr']); ?>" placeholder="EIRR">

                            Status
                            <?php echo form_error('status'); ?>
                            <select class="form-control" name="status">
                                <?php foreach ($status as $status_): ?>
                                    <option value="<?php echo $status_; ?>"
                                        <?php if (set_value('status', $details['status']) == $status_): ?> selected="selected" <?php endif ?>
                                    >
                                        <?php echo $status_; ?>
                                    </option>
                                <?php endforeach; ?>
                            </select>

                            <button type="submit" class="btn btn-primary" id="submit" onclick="return confirm('Are you sure you want to submit this form?');">Submit</button>
                            <a class="btn btn-warning" id="list-admin" href="<?php echo site_url('districts')?>">Cancel

                </form>


text:
#include "rotations.h"

#ifndef WIN32
#include <OgreMath.h>
#include <OgreMatrix3.h>
#else
#include <Ogre/OgreMath.h>
#include <Ogre/OgreMatrix3.h>
#endif

namespace ap {
namespace math {

/**
 * Returns the rotation matrix resulting from yaw, starting from initial position of UNIT_Z
 *
 * Ogre uses right handed coordinate system, so commonly found formulas need to be
 * converted form left handed.
 */
Ogre::Matrix3 getRotationMatrixAfterYaw(Ogre::Radian yaw)
{
    Ogre::Real rotations [3][3];

    Ogre::Real sinValue = Ogre::Math::Sin(yaw);
    Ogre::Real cosValue = Ogre::Math::Cos(yaw);

    rotations[0][0] = cosValue;
    rotations[0][1] = 0;
    rotations[0][2] = sinValue;
    rotations[1][0] = 0;
    rotations[1][1] = 1;
    rotations[1][2] = 0;
    rotations[2][0] = 0 - sinValue;
    rotations[2][1] = 0;
    rotations[2][2] = cosValue;

    return Ogre::Matrix3(rotations);
}

}
}