text:
using namespace std;

#include <pthread.h>
#include "rtos/api/posix/uc_pthread.h"
#include "rtos/api/posix/uc_pthread_class.h"
#include "rtos/kernel/uc_task_class.h"
#include "rtos/qt_interface/stp.h"
#include "rtos/api/posix/uc_pthread_rwlock.h"
#include "rtos/api/posix/uc_semaphore.h"
#include "rtos/kernel/uc_signals_control.h"

class UC_rtos_class;
class UC_task_class;
class uc_pthread_rwlock_class;

class UC_process_class{
public:
    UC_process_class(UC_rtos_class *rtos_parent, const char *name, float optimization = -1);

    ~UC_process_class();

	void create_thread(stp_t *stp);

	UC_task_class * create_new_task();
	void destroy_process();

	UC_task_class * get_current_task(int cpu);

	pthread_mutex_t m_process_mutex; ///< Host mutex to block its host POSIX thread

	vector<UC_task_class *> m_task_list; ///< The list of this process' task

	stp_t *m_stp; ///< Pointer to the qt structure of the next thread to execute
	bool m_stp_destroy; ///< Boolean to destroy the host, POSIX thread destroying the qt structure

	UC_rtos_class *m_parent_rtos; ///< The parent UC_rtos_class

	vector<uc_pthread_key_struct*> m_key_list;
	vector<uc_pthread_cond_t *> m_cond_list;
	vector<uc_pthread_rwlock_class *> m_rwlock_list;
	vector<uc_pthread_mutex_t *> m_mutex_list;

	int m_rwlock_max;

	vector<int *> Semaphores_List;

	UC_signals_control signals_control;

	int m_pid, m_ppid;
	uc_uid_t m_uid, m_euid, m_suid, m_fsuid;
	uc_gid_t m_egid, m_sgid, m_fsgid;
// 	int ngroups;
// 	uc_gid_t groups[NGROUPS];

	uc_gid_t m_pgrp;
	int m_is_group_leader;
	UC_process_class *m_group_leader;
	vector<UC_process_class *> m_group_childs;
// 	uc_pid_t session;
// 	uc_pid_t tgid;

	int m_error_code;
	int m_exit_code;
	int m_exit_signal;

	char *m_process_name;
	float m_optimization_factor;
private:
};

#endif


text:
YSMessagePack is a messagePack packer/unpacker written in swift (swift 3 ready). It is designed to be easy to use. YSMessagePack include following features:

- Pack custom structs and classes / unpack objects by groups and apply handler to each group (easier to re-construct your struct$)
- Asynchronous unpacking
- Pack and unpack multiple message-packed data regardless of types with only one line of code
- Specify how many items to unpack
- Get remaining bytes that were not message-packed ; start packing from some index -- so you can mix messagepack with other protocol!!!
- Helper methods to cast NSData to desired types
- Operator +^ and +^= to join NSData

## Version
 1.6.2 (Dropped swift 2 support, swift 3 support only from now on)

## Installation

- Simply add files under `YSMessagePack/Classes` to your project,
- use cocoapod, add "pod `'YSMessagePack', '~> 1.6.2'` to your podfile

# Usage
### Pack:

```swift

let exampleInt: Int = 1
let exampleStr: String = "Hello World"
let exampleArray: [Int] = [1, 2, 3, 4, 5, 6]
let bool: Bool = true

// To pack items, just put all of them in a single array
// and call the `pack(items:)` function

//this will be the packed data
let msgPackedBytes: NSData = pack(items: [true, foo, exampleInt, exampleStr, exampleArray])

// Now your payload is ready to send!!!

```

But what if we have some custom data structure to send?

```Swift

//To make your struct / class packable
struct MyStruct: Packable {  //Confirm to this protocol
    var name: String
    var index: Int
    func packFormat() -> [Packable] { //protocol function
        return [name, index] //pack order
    }

    func msgtype() -> MsgPackTypes {
        return .Custom
    }
}

let exampleInt: Int = 1
let exampleStr: String = "Hello World"
let exampleArray: [Int] = [1, 2, 3, 4, 5]
let bool: Bool = true

let foo = MyStruct(name: "foo", index: 626)

let msgPackedBytes = pack(items: [bool, foo, exampleInt, exampleStr, exampleArray])

```

**Or you can pack them individually and add them to a byte array manually (Which is also less expensive)**

```swift
let exampleInt: Int = 1
let exampleStr: String = "Hello World"
let exampleArray: [Int] = [1, 2, 3, 4, 5, 6]

//Now pack them individually
let packedInt = exampleInt.packed()

//if you didn't specific encoding, the default encoding will be ASCII
#if swift(>=3)
let packedStr = exampleStr.packed(withEncoding: NSASCIIStringEncoding)
#else
let packedStr = exampleStr.packed(withEncoding: .ascii)
#endif
let packedArray = exampleArray.packed()
//You can use this operator +^ the join the data on rhs to the end of data on lhs
let msgPackedBytes: NSData = packedInt +^ packedStr +^ packedArray
```
## Unpack

YSMessagePack offer a number of different ways and options to unpack include unpack asynchronously, see the example project for detail.

To unpack a messagepacked bytearray is pretty easy:

```swift
do {
    //The unpack method will return an array of NSData which each element is an unpacked object
    let unpackedItems = try msgPackedBytes.itemsUnpacked()
    //instead of casting the NSData to the type you want, you can call these `.castTo..` methods to do the job for you
    let int: Int = unpackedItems[2].castToInt()

    //Same as packing, you can also specify the encoding you want to use, default is ASCII
    let str: String = unpackedItem[3].castToString()
    let array: NSArray = unpackedItems[4].castToArray()
} catch let error as NSError{
    NSLog("Error occurs during unpacking: %@", error)
}

//Remember how to pack your struct? Here is a better way to unpack a stream of bytes formatted in specific format
 let testObj1 = MyStruct(name: "TestObject1", index: 1)
 let testObj2 = MyStruct(name: "TestObject2", index: 2)
 let testObj3 = MyStruct(name: "TestObject3", index: 3)

 let packed = packCustomObjects(testObj1, testObj2, testObj3) //This is an other method that can pack your own struct easier

 let nobjsInOneGroup = 2

 try! packed.unpackByGroupsWith(nobjsInOneGroup) {
     (unpackedData, isLast) -> Bool

     //you can also involve additional args like number of groups to unpack
     guard let name = unpackedData[0].castToString() else {return false} //abort unpacking hen something wrong
     let index = unpackedData[1]
     let testObj = MyStruct(name: name, index: index) // assembly
     return true //proceed unpacking, or return false to abort
 }

```

**If you don't want to unpack every single thing included in the message-pack byte array, you can also specify an amount to unpack, if you want to keep the remaining bytes, you can put `true` in the `returnRemainingBytes` argument, the remaining bytes will stored in the end of the `NSData` array.**

```swift
do {
    //Unpack only 2 objects, and we are not interested in remaining bytes
    let unpackedItems = try msgPackedBytes.itemsUnpacked(specific_amount: 2, returnRemainingBytes: false)
    print(unpackedItems.count) //will print 2
} catch let error as NSError{
    NSLog("Error occurs during unpacking: %@", error)
}
```

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

RSpec.describe AddressFinder::Bulk do
  before do
    AddressFinder.configure do |af|
      af.api_key = 'XXX'
      af.api_secret = 'YYY'
      af.default_country = 'nz'
      af.timeout = 5
      af.retries = 5
    end
  end

  describe '#perform' do
    let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
    let(:net_http){ http.send(:net_http) }

    before do
      WebMock.allow_net_connect!(net_http_connect_on_start: true)
      allow(http).to receive(:sleep)
    end

    after do
      WebMock.disable_net_connect!
    end

    context "with 3 requests in the provided block" do
      let(:response){ double(:response, body: %Q({"success": true}), code: "200") }
      let(:block){
        Proc.new do |proxy|
          proxy.cleanse(q: "1 Willis")
          proxy.cleanse(q: "2 Willis")
          proxy.cleanse(q: "3 Willis")
        end
      }

      it "uses 1 http connection" do
        expect(net_http).to receive(:do_start).once.and_call_original
        expect(net_http).to receive(:transport_request).exactly(3).times.and_return(response)
        expect(net_http).to receive(:do_finish).once.and_call_original
        AddressFinder::Bulk.new(http: http, &block).perform
      end

      it "re-establishes the http connection and continues where we left off when a Net::OpenTimeout, Net::ReadTimeout or SocketError is raised" do
        expect(http).to receive(:re_establish_connection).exactly(3).times.and_call_original
        expect(net_http).to receive(:do_start).exactly(4).times.and_call_original
        expect(net_http).to receive(:transport_request).once.and_return(response) # 1 Willis (success)
        expect(net_http).to receive(:transport_request).once.and_raise(Net::OpenTimeout) # 2 Willis (error)
        expect(net_http).to receive(:transport_request).once.and_raise(Net::ReadTimeout) # Retry 2 Willis (error)
        expect(net_http).to receive(:transport_request).once.and_raise(SocketError) # Retry 2 Willis (error)
        expect(net_http).to receive(:transport_request).exactly(2).and_return(response) # Retry 2 Willis (success) & 3 Willis (success)
        expect(net_http).to receive(:do_finish).exactly(4).times.and_call_original
        AddressFinder::Bulk.new(http: http, &block).perform
      end
    end
  end
end


text:
package org.apache.camel.example.server;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.converter.jaxb.JaxbDataFormat;
import org.apache.camel.example.server.model.IncrementRequest;
import org.apache.camel.example.server.model.IncrementResponse;

public class IncrementRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        JaxbDataFormat jaxb = new JaxbDataFormat(IncrementRequest.class.getPackage().getName());

        from("spring-ws:rootqname:{http://camel.apache.org/example/increment}incrementRequest?endpointMapping=#endpointMapping")
            .unmarshal(jaxb)
            .process(new IncrementProcessor())
            .marshal(jaxb);
    }

    private static final class IncrementProcessor implements Processor {
        @Override
        public void process(Exchange exchange) throws Exception {
            IncrementRequest request = exchange.getIn().getBody(IncrementRequest.class);
            IncrementResponse response = new IncrementResponse();
            int result = request.getInput() + 1; // increment input value
            response.setResult(result);
            exchange.getOut().setBody(response);
        }
    }

}


text:
'use strict';

describe('Service: Healthplanenglish', function () {

  // load the service's module
  beforeEach(module('oncPpnApp'));

  // instantiate service
  var Healthplanenglish;
  beforeEach(inject(function (_Healthplanenglish_) {
    Healthplanenglish = _Healthplanenglish_;
  }));

  it('should do something', function () {
    expect(!!Healthplanenglish).toBe(true);
  });

});


text:
template<
    bool Set>
class _PyObjectCachedKeyUniqueSorterIncer
{
private:
    typedef
        std::pair<_CachedKeyPyObject, PyObject *>
        ValueType;

public:
    _PyObjectCachedKeyUniqueSorterIncer(
        PyObject * fast_seq,
        const _CachedKeyPyObjectCacheGeneratorLT & lt)
    {
        if (fast_seq == Py_None)
            return;

        vals.reserve(PySequence_Fast_GET_SIZE(fast_seq));
        for (size_t i = 0; i < static_cast<size_t>(PySequence_Fast_GET_SIZE(fast_seq)); ++i) {
            PyObject * const val = PySequence_Fast_GET_ITEM(fast_seq, i);
            DBG_ASSERT(PyTuple_Check(val));
            DBG_ASSERT(PyTuple_Size(val) == 2);
            vals.push_back(std::make_pair(
                lt(PyTuple_GET_ITEM(val, 0)),
                PyTuple_GET_ITEM(val, 1)));
        }

        _FirstLT<_CachedKeyPyObjectCacheGeneratorLT> lt_(lt);
        std::sort(vals.begin(), vals.end(), lt_);
        typename VecT::iterator end_it =
            unique(vals.begin(), vals.end(), not2(lt_));
        for (typename VecT::iterator it = end_it; it != vals.end(); ++it)
            it->first.dec();
        vals.erase(end_it, vals.end());
        for (size_t i = 0; i < vals.size(); ++i)
            BANYAN_PYOBJECT_INCREF(vals[i].second);
    }

    ValueType *
    sorted_begin()
    {
        return vals.empty()? NULL: &vals[0];
    }

    ValueType *
    sorted_end()
    {
        return vals.empty()? NULL: &vals[0] + vals.size();
    }

    void
    clear()
    {
        vals.clear();
    }

private:
    typedef
        std::vector<ValueType, PyMemMallocAllocator<ValueType> >
        VecT;

private:
    VecT vals;
};

template<
    class Alg_Tag>
class _TreeImpValueTypeBase<
        Alg_Tag,
        _CachedKeyPyObject,
        false,
        _NullMetadata,
        _CachedKeyPyObjectCacheGeneratorLT> :
    private _PyObjectCachedKeyUniqueSorterIncer<false>,
    public _TreeImpAlgBase<
        Alg_Tag,
        std::pair<_CachedKeyPyObject, PyObject *>,
        false,
        _PairKeyExtractor<_CachedKeyPyObject>,
        _NullMetadata,
        _CachedKeyPyObjectCacheGeneratorLT>
{
protected:
    typedef
        _CachedKeyPyObject
        InternalKeyType;

    typedef
        PyObject *
        InternalDataType;

    typedef
        std::pair<InternalKeyType, PyObject *>
        InternalValueType;

    typedef
        _TreeImpAlgBase<
            Alg_Tag,
            std::pair<_CachedKeyPyObject, PyObject *>,
            false,
            _PairKeyExtractor<_CachedKeyPyObject>,
            _NullMetadata,
            _CachedKeyPyObjectCacheGeneratorLT>
        BaseT;

    typedef typename BaseT::TreeT TreeT;

    typedef
        _PyObjectCachedKeyUniqueSorterIncer<false>
        SortingBaseT;

#ifdef BANYAN_DEBUG
    static void
    assert_valid(const InternalValueType & val)
    {
        val.first.assert_valid();
        BANYAN_PYOBJECT_VERIFY(val.second);
    }
#endif // #ifdef BANYAN_DEBUG

protected:
    inline explicit
    _TreeImpValueTypeBase(
            PyObject * fast_seq,
            const _NullMetadata &,
            const _CachedKeyPyObjectCacheGeneratorLT & lt) :
        SortingBaseT(fast_seq, lt),
        BaseT(
            SortingBaseT::sorted_begin(),
            SortingBaseT::sorted_end(),
            _NullMetadata(),
            lt)
    {
        SortingBaseT::clear();
    }

    int
    traverse(visitproc visit, void * arg)
    {
        for (typename TreeT::Iterator it = BaseT::tree.begin(); it != BaseT::end(); ++it) {
            const int v = visit_internal_value(*it, visit, arg);
            if (v != 0)
                return v;
        }

        return 0;
    }

    inline static void
    dec_internal_value(InternalValueType & val)
    {
        val.first.dec();
        BANYAN_PYOBJECT_DECREF(val.second);
    }

    inline static int
    visit_internal_value(InternalValueType & val, visitproc visit, void * arg)
    {
        const int v = val.first.traverse(visit, arg);
        if (v != 0)
            return v;
        Py_VISIT(val.second);
        return 0;
    }

    inline _CachedKeyPyObject
    key_to_internal_key(PyObject * key)
    {
        return BaseT::tree.less_than()(key);
    }

    inline static PyObject *
    value_to_key(PyObject * val)
    {
        DBG_ASSERT(PyTuple_Check(val));
        DBG_ASSERT(PyTuple_Size(val) == 2);
        return PyTuple_GET_ITEM(val, 0);
    }

    inline static PyObject *
    internal_value_to_key_inc(const InternalValueType & val)
    {
        return val.first.key_inc();
    }

    inline static PyObject *
    internal_value_to_data_inc(const InternalValueType & val)
    {
        BANYAN_PYOBJECT_INCREF(val.second);
        return val.second;
    }

    inline static PyObject *
    internal_value_to_value_inc(const InternalValueType & val)
    {
        PyObject * ext_val = PyTuple_Pack(2, internal_value_to_key_inc(val), internal_value_to_data_inc(val));
        if (ext_val == NULL) {
            PyErr_NoMemory();
            return NULL;
        }
        BANYAN_PYOBJECT_DUMMY_INCREF(ext_val);
        return ext_val;
    }

    inline static void
    update_data(InternalValueType & val, PyObject * data)
    {
        BANYAN_PYOBJECT_DECREF(val.second);
        val.second = data;
    }

    inline InternalValueType
    key_data_to_internal_value_inc(PyObject * key, PyObject * data)
    {
        InternalValueType val = std::make_pair(BaseT::tree.less_than()(key), data);
        BANYAN_PYOBJECT_INCREF(data);
        return val;
    }
};

#endif // #ifndef _TREE_IMP_PYOBJECT_CACHED_KEY_VALUE_TYPE_DICT_BASE_HPP


text:
struct nvkm_dmaobj_func {
	int (*bind)(struct nvkm_dmaobj *, struct nvkm_gpuobj *, int align,
		    struct nvkm_gpuobj **);
};

int nvkm_dma_new_(const struct nvkm_dma_func *, struct nvkm_device *,
		  int index, struct nvkm_dma **);

struct nvkm_dma_func {
	int (*class_new)(struct nvkm_dma *, const struct nvkm_oclass *,
			 void *data, u32 size, struct nvkm_dmaobj **);
};
#endif


text:
<?php

namespace Dawen\Bundle\JsLoggerBundle\Tests\Component;

use Dawen\Bundle\JsLoggerBundle\Twig\JsLoggerTwigExtension;

class JsLoggerTwigExtensionTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $router;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $packages;

    /**
     * @var JsLoggerTwigExtension
     */
    private $twigExtension;

    protected function setUp()
    {
        parent::setUp();

        $this->router = $this->getMockBuilder('Symfony\Component\Routing\Generator\UrlGeneratorInterface')
            ->disableOriginalConstructor()
            ->getMock();

        $this->packages = $this->getMockBuilder('Symfony\Component\Asset\Packages')
            ->disableOriginalConstructor()
            ->getMock();

        $this->twigExtension = new JsLoggerTwigExtension($this->router, $this->packages);
    }

    protected function tearDown()
    {
        $this->router = null;
        $this->packages = null;
        $this->twigExtension = null;

        parent::tearDown();
    }

    public function testInstance()
    {
        $this->assertInstanceOf('Dawen\Bundle\JsLoggerBundle\Twig\JsLoggerTwigExtension', $this->twigExtension);
        $this->assertInstanceOf('\Twig_ExtensionInterface', $this->twigExtension);
        $this->assertInstanceOf('\Twig_Extension', $this->twigExtension);
    }

    public function testGetName()
    {
        $this->assertSame('js_logger', $this->twigExtension->getName());
    }

    public function testGetFunctions()
    {
        $result = $this->twigExtension->getFunctions();

        $this->assertTrue(is_array($result));
        $this->assertCount(1, $result);

        /** @var \Twig_SimpleFunction $function */
        $function = $result[0];
        $this->assertInstanceOf('\Twig_SimpleFunction', $function);
        $this->assertSame($this->twigExtension->getName(), $function->getName());
        $callable = $function->getCallable();
        $this->assertSame($this->twigExtension, $callable[0]);
        $this->assertSame('initLogger', $callable[1]);
    }

    public function testInitLoggerDisabled()
    {
        $this->router->expects($this->never())->method('generate');
        $this->packages->expects($this->never())->method('getUrl');

        $this->twigExtension = new JsLoggerTwigExtension($this->router, $this->packages, false);
        $this->assertSame('', $this->twigExtension->initLogger());
    }

    public function testInitLoggerWithoutLevelRestriction()
    {
        $backendUrl = '/my/backend';
        $assetUrl = '/my/asset';
        $expected = '<script src="' . $assetUrl . '" data-backend-url="' . $backendUrl . '"></script>';

        $this->router->expects($this->once())
            ->method('generate')
            ->with(JsLoggerTwigExtension::ROUTE)
            ->willReturn($backendUrl);
        $this->packages->expects($this->once())
            ->method('getUrl')
            ->with(JsLoggerTwigExtension::ASSET_PATH)
            ->willReturn($assetUrl);

        $this->assertSame($expected, $this->twigExtension->initLogger());
    }

    public function testInitLoggerWithLevelRestriction()
    {
        $backendUrl = '/my/backend';
        $assetUrl = '/my/asset';
        $allowedLevels = ['warning', 'error'];
        $expected = '<script src="' . $assetUrl . '" data-backend-url="' . $backendUrl . '" data-allowed-levels="' . implode(',', $allowedLevels) . '"></script>';

        $this->twigExtension = new JsLoggerTwigExtension($this->router, $this->packages, true, $allowedLevels);

        $this->router->expects($this->once())
            ->method('generate')
            ->with(JsLoggerTwigExtension::ROUTE)
            ->willReturn($backendUrl);
        $this->packages->expects($this->once())
            ->method('getUrl')
            ->with(JsLoggerTwigExtension::ASSET_PATH)
            ->willReturn($assetUrl);

//        var_dump($this->twigExtension->initLogger());
        $this->assertSame($expected, $this->twigExtension->initLogger());
    }

}


text:
local Class = require "lib.hump.Class"
local Component = require "component.Component"
local InputComponent = require "component.input.InputComponent"
local EntityTypes = require "constants.EntityTypes"
local Signals = require "constants.Signals"
local Constants = require "constants.Constants"

local ShieldInputComponent = Class{}
ShieldInputComponent:include(InputComponent)

function ShieldInputComponent:init()
  self._bullet = true

  self._shieldDuration = 0.5
  self._shieldCooldown = 0

  InputComponent.init(self)
end

function ShieldInputComponent:setOwner(owner)
  InputComponent.setOwner(self, owner)
  assert(owner.body ~= nil, "entity must have body component before adding shield input component, fix!")

  self._shield = EntityCreator.create(EntityTypes.SHIELD, self.owner)
  Signal.emit(Signals.ADD_ENTITY, self._shield)

end

-- clean up after yourself, kill the shield entity when this one dies
function ShieldInputComponent:death()
  Signal.emit(Signals.KILL_ENTITY, self._shield)

  Component.death(self)
end

local function cooldown(self)
  self._bullet = false
  game.timer:after(self._shieldDuration, function()
    self._shield.events:emit(Signals.SHIELD_INACTIVE)
    if Constants.BULLET_COOLDOWN > 0 then
      game.timer:after(self._shieldCooldown, function()
        self._bullet = true
      end)
    else
      self._bullet = true
    end
  end)
end

function ShieldInputComponent:update(dt)
  if love.keyboard.isDown("left") then
    if self._bullet then
      self._shield.events:emit(Signals.SHIELD_ACTIVE, -1, 0, self._shieldDuration)
      cooldown(self)
    end
  end
  if love.keyboard.isDown("up") then
    if self._bullet then
      self._shield.events:emit(Signals.SHIELD_ACTIVE, 0, -1, self._shieldDuration)
      cooldown(self)
    end
  end
  if love.keyboard.isDown("right") then
    if self._bullet then
      self._shield.events:emit(Signals.SHIELD_ACTIVE, 1, 0, self._shieldDuration)
      cooldown(self)
    end
  end
  if love.keyboard.isDown("down") then
    if self._bullet then
      self._shield.events:emit(Signals.SHIELD_ACTIVE, 0, 1, self._shieldDuration)
      cooldown(self)
    end
  end

  InputComponent.update(self, dt)
end

return ShieldInputComponent


text:
"""Support for Hydrawise sprinkler sensors."""
from __future__ import annotations

import logging

import voluptuous as vol

from homeassistant.components.sensor import (
    PLATFORM_SCHEMA,
    SensorDeviceClass,
    SensorEntity,
    SensorEntityDescription,
)
from homeassistant.const import CONF_MONITORED_CONDITIONS, TIME_MINUTES
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util import dt

from . import DATA_HYDRAWISE, HydrawiseEntity

_LOGGER = logging.getLogger(__name__)

SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
    SensorEntityDescription(
        key="next_cycle",
        name="Next Cycle",
        device_class=SensorDeviceClass.TIMESTAMP,
    ),
    SensorEntityDescription(
        key="watering_time",
        name="Watering Time",
        icon="mdi:water-pump",
        native_unit_of_measurement=TIME_MINUTES,
    ),
)

SENSOR_KEYS: list[str] = [desc.key for desc in SENSOR_TYPES]

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_MONITORED_CONDITIONS, default=SENSOR_KEYS): vol.All(
            cv.ensure_list, [vol.In(SENSOR_KEYS)]
        )
    }
)

TWO_YEAR_SECONDS = 60 * 60 * 24 * 365 * 2
WATERING_TIME_ICON = "mdi:water-pump"

def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up a sensor for a Hydrawise device."""
    hydrawise = hass.data[DATA_HYDRAWISE].data
    monitored_conditions = config[CONF_MONITORED_CONDITIONS]

    entities = [
        HydrawiseSensor(zone, description)
        for zone in hydrawise.relays
        for description in SENSOR_TYPES
        if description.key in monitored_conditions
    ]

    add_entities(entities, True)

class HydrawiseSensor(HydrawiseEntity, SensorEntity):
    """A sensor implementation for Hydrawise device."""

    def update(self) -> None:
        """Get the latest data and updates the states."""
        mydata = self.hass.data[DATA_HYDRAWISE].data
        _LOGGER.debug("Updating Hydrawise sensor: %s", self.name)
        relay_data = mydata.relays[self.data["relay"] - 1]
        if self.entity_description.key == "watering_time":
            if relay_data["timestr"] == "Now":
                self._attr_native_value = int(relay_data["run"] / 60)
            else:
                self._attr_native_value = 0
        else:  # _sensor_type == 'next_cycle'
            next_cycle = min(relay_data["time"], TWO_YEAR_SECONDS)
            _LOGGER.debug("New cycle time: %s", next_cycle)
            self._attr_native_value = dt.utc_from_timestamp(
                dt.as_timestamp(dt.now()) + next_cycle
            )


text:
namespace AutoTest.ExampleLibrary.Issues.Issue022
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using AutoTest.ArgNullEx;
    using AutoTest.ArgNullEx.Xunit;
    using Xunit;

    public class Issue022
    {
        [Theory, RequiresArgNullExAutoMoq(typeof(GenericClass<>))]
        [Include(Type = typeof(GenericClass<>))]
        [Substitute(typeof(GenericClass<>), typeof(GenericClass<Version>))]
        public async Task TestGenericClass(MethodData method)
        {
            await method.Execute().ConfigureAwait(false);
            Assert.True(GenericClassBase.Tested);
        }
    }
}


text:
template<typename T>
std::string convert(const T& n)
{
	std::ostringstream stm;
	stm << n;
	return stm.str();
}
#define CONVERT_TO_STRING(v) convert((v))
#else
#define CONVERT_TO_STRING(v) std::to_string((v))
#endif

namespace gofxengine
{

	std::string cvt_to_string(int n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(unsigned int n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(long n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(unsigned long n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(long long n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(unsigned long long n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(float n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(double n)
	{
		return CONVERT_TO_STRING(n);
	}

	std::string cvt_to_string(bool n)
	{
		return CONVERT_TO_STRING(n);
	}
}


text:
"""
In most of other languages Strategy pattern is implemented via creating some
base strategy interface/abstract class and subclassing it with a number of
concrete strategies (as we can see at
http://en.wikipedia.org/wiki/Strategy_pattern), however Python supports
higher-order functions and allows us to have only one class and inject
functions into it's instances, as shown in this example.
"""
import types

class StrategyExample:

    def __init__(self, func=None):
        self.name = 'Strategy Example 0'
        if func is not None:
            self.execute = types.MethodType(func, self)

    def execute(self):
        print(self.name)

def execute_replacement1(self):
    print(self.name + ' from execute 1')

def execute_replacement2(self):
    print(self.name + ' from execute 2')

if __name__ == '__main__':
    strat0 = StrategyExample()

    strat1 = StrategyExample(execute_replacement1)
    strat1.name = 'Strategy Example 1'

    strat2 = StrategyExample(execute_replacement2)
    strat2.name = 'Strategy Example 2'

    strat0.execute()
    strat1.execute()
    strat2.execute()

### OUTPUT ###
# Strategy Example 0
# Strategy Example 1 from execute 1
# Strategy Example 2 from execute 2


text:
using Plang.Compiler.TypeChecker.AST.Declarations;
using System.Collections.Generic;
using System.Linq;
using Plang.Compiler.TypeChecker;
using Plang.Compiler.TypeChecker.Types;
using static Plang.Compiler.Backend.Java.TypeManager;

namespace Plang.Compiler.Backend.Java
{
    internal class TypesGenerator : JavaSourceGenerator {

        private static HashSet<NamedTupleType> AllTuples(Scope scope)
        {
            HashSet<NamedTupleType> ret = new HashSet<NamedTupleType>();

            foreach (var t in scope.Tuples)
            {
                ret.Add(t);
            }

            foreach (var t in scope.Functions.SelectMany(f => AllTuples(f.Scope)))
            {
                ret.Add(t);
            }
            foreach (var t in scope.Machines.SelectMany(m => AllTuples(m.Scope)))
            {
                ret.Add(t);
            }

            return ret;
        }

        internal TypesGenerator(string filename) : base(filename)
        {
        }

        /// <summary>
        /// Generates Java code for a given compilation job's user-defined types like enums
        /// and tuples.
        /// </summary>
        protected override void GenerateCodeImpl()
        {
            WriteLine($"public class {Constants.TypesNamespaceName} {{");

            if (GlobalScope.Enums.Any())
            {
                WriteLine("/* Enums */");
                WriteLine();
                foreach (var e in GlobalScope.Enums)
                {
                    WriteEnumDecl(e);
                }
                WriteLine();
            }

            HashSet<NamedTupleType> tuples = AllTuples(GlobalScope);
            if (tuples.Any())
            {
                WriteLine("/* Tuples */");
                WriteLine();
                foreach (var t in tuples)
                {
                    WriteNamedTupleDecl(t);
                }
                WriteLine();
            }

            WriteLine("}");
        }

        private void WriteEnumDecl(PEnum e)
        {
            WriteLine($"public enum {e.Name} {{");

            int numFields = e.Values.Count();
            foreach (var (param, sep) in e.Values.Select((pair, i) => (pair, i < numFields - 1? "," : ";")))
            {
                WriteLine($"{param.Name}({param.Value.ToString()}){sep}");
            }

            WriteLine("private final int value;");
            WriteLine($"{e.Name}(int i) {{ value = i; }}");

            WriteLine("}");
        }

        private void WriteNamedTupleDecl(NamedTupleType t)
        {
            // This is a sequence of <type, field name> pairs.
            List<(JType, string)> fields =
                new List<(JType, string)>();

            // Build up our list of fields.
            foreach (var e in t.Fields)
            {
                string name = e.Name;
                PLanguageType type = e.Type;

                // In the case where the field type is a typedef, follow
                // the typename resolution until we've found the actual type.
                while (type is TypeDefType tdef)
                {
                    type = tdef.TypeDefDecl.Type;
                }

                JType jType = Types.JavaTypeFor(type);

                fields.Add((jType, name));
            }

            string tname = Names.NameForNamedTuple(t);
            WriteLine($"public static class {tname} implements {Constants.PValueClass}<{tname}> {{");
            WriteLine($"// {t.CanonicalRepresentation}");

            WriteNamedTupleFields(fields);
            WriteLine();

            WriteNamedTupleConstructors(tname, fields);
            WriteLine();

            WriteNamedTupleEqualityMethods(tname, fields);
            WriteLine();

            WriteNamedTupleToString(tname, fields);
            WriteLine();

            WriteLine($"}} //{tname} class definition");

            WriteLine();
        }

        private void WriteNamedTupleFields(List<(JType, string)> fields)
        {
            foreach (var (jType, fieldName) in fields)
            {
                WriteLine($"public {jType.TypeName} {fieldName};");
            }
        }

        private void WriteNamedTupleConstructors(string tname, List<(JType, string)> fields)
        {
            // Write the default constructor.
            WriteLine($"public {tname}() {{");
            foreach (var (jtype, fieldName) in fields)
            {
                WriteLine($"this.{fieldName} = {jtype.DefaultValue};");

            }
            WriteLine($"}}");
            WriteLine();

            // Write the explicit constructor.
            Write($"public {tname}(");
            foreach (var (sep, (jType, fieldName)) in fields.WithPrefixSep(", "))
            {
                Write($"{sep}{jType.TypeName} {fieldName}");
            }
            WriteLine($") {{");
            foreach (var (_, fieldName) in fields)
            {
                WriteLine($"this.{fieldName} = {fieldName};");
            }
            WriteLine($"}}");
            WriteLine();

            // Write the copy constructor for cloning.
            WriteLine($"public {tname} deepClone() {{");
            Write($"return new {tname}(");
            foreach (var (sep, (jType, fieldName)) in fields.WithPrefixSep(", "))
            {
                Write(sep);
                WriteClone(jType, () => Write(fieldName));
            }
            WriteLine(");");
            WriteLine("} // deepClone()");
            WriteLine();
        }

        private void WriteNamedTupleEqualityMethods(string tname, List<(JType, string)> fields)
        {
            // .equals() implementation: this simply defers to deepEquals() but explicitly overriding it is useful
            // for calling assertEquals() in unit tests, for example.
            WriteLine($"public boolean equals(Object other) {{");
            WriteLine("return (this.getClass() == other.getClass() && ");
            WriteLine($"this.deepEquals(({tname})other)");
            WriteLine(");");
            WriteLine("} // equals()");
            WriteLine();

            // hashCode() implementation.
            WriteLine($"public int hashCode() {{");
            Write($"return Objects.hash(");
            foreach (var (sep, (_, fieldName)) in fields.WithPrefixSep(", "))
            {
                Write($"{sep}{fieldName}");
            }
            WriteLine(");");
            WriteLine("} // hashCode()");
            WriteLine();

            // Deep equality predicate.
            WriteLine($"public boolean deepEquals({tname} other) {{");
            WriteLine("return (true");
            foreach (var (jType, fieldName) in fields)
            {
                Write(" && ");
                WriteLine(jType.IsPrimitive
                    ? $"this.{fieldName} == other.{fieldName}"
                    : $"{Constants.PrtDeepEqualsMethodName}(this.{fieldName}, other.{fieldName})");
            }
            WriteLine(");");
            WriteLine("} // deepEquals()");
            WriteLine();
        }

        private void WriteNamedTupleToString(string tname, List<(JType, string)> fields)
        {
            // Write toString() in the same output style as a Java record.
            WriteLine("public String toString() {");
            WriteLine($"StringBuilder sb = new StringBuilder(\"{tname}\");");

            WriteLine("sb.append(\"[\");");
            foreach (var (sep, (_, fieldName)) in fields.WithPrefixSep(", "))
            {
                WriteLine($"sb.append(\"{sep}{fieldName}=\" + {fieldName});");
            }
            WriteLine("sb.append(\"]\");");

            WriteLine("return sb.toString();");
            WriteLine("} // toString()");
        }

    }
}


text:
"""RDFValue instances related to the foreman implementation."""

from grr.lib import rdfvalue
from grr.proto import jobs_pb2

class ForemanRuleAction(rdfvalue.RDFProtoStruct):
  protobuf = jobs_pb2.ForemanRuleAction

class ForemanAttributeRegex(rdfvalue.RDFProtoStruct):
  protobuf = jobs_pb2.ForemanAttributeRegex

  def Validate(self):
    if not self.attribute_name:
      raise ValueError("ForemanAttributeRegex rule invalid - "
                       "not attribute set.")

    self.attribute_name.Validate()

class ForemanAttributeInteger(ForemanAttributeRegex):
  protobuf = jobs_pb2.ForemanAttributeInteger

class ForemanRule(rdfvalue.RDFProtoStruct):
  """A Foreman rule RDF value."""
  protobuf = jobs_pb2.ForemanRule

  def Validate(self):
    for rule in self.regex_rules:
      rule.Validate()

    for rule in self.integer_rules:
      rule.Validate()

  @property
  def hunt_id(self):
    """Returns hunt id of this rule's actions or None if there's none."""
    for action in self.actions or []:
      if action.hunt_id is not None:
        return action.hunt_id

class ForemanRules(rdfvalue.RDFValueArray):
  """A list of rules that the foreman will apply."""
  rdf_type = ForemanRule


text:
package gov.nih.nci.ncicb.cadsr.formbuilder.struts.actions;

import gov.nih.nci.ncicb.cadsr.common.CaDSRConstants;
import gov.nih.nci.ncicb.cadsr.common.dto.FormInstructionTransferObject;
import gov.nih.nci.ncicb.cadsr.common.dto.InstructionTransferObject;
import gov.nih.nci.ncicb.cadsr.formbuilder.common.FormBuilderException;
import gov.nih.nci.ncicb.cadsr.formbuilder.service.FormBuilderServiceDelegate;
import gov.nih.nci.ncicb.cadsr.common.struts.formbeans.GenericDynaFormBean;
import gov.nih.nci.ncicb.cadsr.common.jsp.bean.PaginationBean;
import gov.nih.nci.ncicb.cadsr.common.resource.Form;
import gov.nih.nci.ncicb.cadsr.common.resource.Instruction;
import gov.nih.nci.ncicb.cadsr.common.util.StringUtils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.apache.struts.Globals;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.DynaActionForm;

import java.io.IOException;

import java.util.*;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import gov.nih.nci.ncicb.cadsr.common.dto.ModuleTransferObject;
import gov.nih.nci.ncicb.cadsr.common.dto.ModuleInstructionTransferObject;
import gov.nih.nci.ncicb.cadsr.common.resource.Module;
import gov.nih.nci.ncicb.cadsr.common.resource.ModuleInstruction;
import gov.nih.nci.ncicb.cadsr.formbuilder.struts.common.FormActionUtil;

public class ModuleCreateAction extends FormBuilderSecureBaseDispatchAction {

  /**
   * Prepares the Create Module page
   *
   * @param mapping The ActionMapping used to select this instance.
   * @param form The optional ActionForm bean for this request.
   * @param request The HTTP Request we are processing.
   * @param response The HTTP Response we are processing.
   *
   * @return
   *
   * @throws IOException
   * @throws ServletException
   */
  public ActionForward goToCreateModule(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {

    DynaActionForm dynaForm = (DynaActionForm)form;

    return mapping.findForward("toCreateModule");

  }

  /**
   * Create a module
   *
   * @param mapping The ActionMapping used to select this instance.
   * @param form The optional ActionForm bean for this request.
   * @param request The HTTP Request we are processing.
   * @param response The HTTP Response we are processing.
   *
   * @return
   *
   * @throws IOException
   * @throws ServletException
   */
  public ActionForward createModule(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) throws IOException, ServletException {

    DynaActionForm dynaForm = (DynaActionForm)form;
    Module newModule = new ModuleTransferObject();
    Form crf = (Form) getSessionObject(request, CRF);

    int displayOrder = ((Integer)getSessionObject(request,MODULE_DISPLAY_ORDER_TO_COPY)).intValue();  //((Integer)dynaForm.get(DISPLAY_ORDER)).intValue();

    Form f = (Form)getSessionObject(request, CRF);

    newModule.setForm(f);
    newModule.setLongName((String)dynaForm.get(MODULE_LONG_NAME));
    newModule.setPreferredDefinition(newModule.getLongName());
    newModule.setAslName("DRAFT NEW");
    newModule.setVersion(new Float(1.0));
    newModule.setCreatedBy(request.getRemoteUser());
    newModule.setDisplayOrder(displayOrder);
    newModule.setQuestions(new ArrayList());

    String modInstrStr = (String)dynaForm.get(MODULE_INSTRUCTION);
    if (StringUtils.doesValueExist(modInstrStr)){
      Instruction newModHdrInst = new InstructionTransferObject();
      newModHdrInst.setLongName(newModule.getLongName());
      newModHdrInst.setPreferredDefinition(modInstrStr);
      newModHdrInst.setContext(crf.getContext());
      newModHdrInst.setAslName("DRAFT NEW");
      newModHdrInst.setVersion(new Float(1.0));
      newModHdrInst.setCreatedBy(request.getRemoteUser());
      newModHdrInst.setDisplayOrder(1);
      newModule.setInstruction(newModHdrInst);
    }

    List modules = crf.getModules();

    if(modules == null) {
      modules = new ArrayList();
      crf.setModules(modules);
    }

    if(displayOrder < modules.size()) {
      modules.add(displayOrder, newModule);
      //FormActionUtil.incrementDisplayOrder(modules, displayOrder + 1);
    } else {
      modules.add(newModule);
    }
    FormActionUtil.setInitDisplayOrders(modules); //This is done to set display order in a sequential order

    // Jump to the update location on the screen
    request.setAttribute(CaDSRConstants.ANCHOR,"M"+displayOrder);

    saveMessage("cadsr.formbuilder.module.add.success", request);

    removeSessionObject(request, MODULE_DISPLAY_ORDER_TO_COPY);
    removeSessionObject(request,IN_PROCESS);

    return mapping.findForward("toFormEdit");

  }

}


text:
        <title><?php echo $title ?> - Politicalsimplicity.com</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" >
        <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" rel="stylesheet">
        <link href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet">

        <?php
            foreach ($styles as $file => $type)
                echo HTML::style($file, array('media' => $type)), PHP_EOL
        ?>

        <?php
            foreach ($scripts as $file)
                echo HTML::script($file), PHP_EOL
        ?>

    <?php
        // Change login/logout button
        $authButtonString = "Log In";
        $authButtonAction = "login";
        $user = Auth::instance()->get_user();
        if (isset($user)) {
            $authButtonAction = "logout";
            $authButtonString = "Log Out";
        }
    ?>

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".topNavbar">

                    </button>
                    <?php echo Html::anchor('/', 'Political Simplicity',array('class'=>'navbar-brand','id'=>'logo') ) ?>

                        <li class="<?php //if($active === 'home') echo 'active'; ?>"><a href="<?php echo URL::base(); ?>"> Home

                        <li class="<?php //if($active === 'about') echo 'active'; ?>"><a href="<?php echo URL::base()."management/".$authButtonAction?>"> <?php echo $authButtonString?>

                            <form id="tfnewsearch" method="get" action="" _lpchecked="1">
                                <input type="text" id="search" name="query" size="21" maxlength="120" placeholder="Search our website">
                                <button type="submit"></input>
                            </form>

    <?php if(!isset($sideSelect)) {
        $sideSelect = null;
    } ?>

Candidate Management

                <li class="<?php if($sideSelect == "index"){echo "active";}?>"><?php echo Html::anchor('management/index', 'View Candidates') ?>

                <li class="<?php if($sideSelect == "form"){echo "active";}?>"><?php echo Html::anchor('management/form', 'Create a new Candidate') ?>

                <li class="<?php if($sideSelect == "modify"){echo "active";}?>"><?php echo Html::anchor('management/index', 'Modify Candidate') ?>

<?php
    if (isset($_GET['query'])) {
        $query = $_GET['query'];
        $queryarray = explode(" ", $query);
        $candidate_names = array();
        foreach ($queryarray as $item) {
            $item = strip_tags($item);
            $candidates = ORM::factory('Candidates')->where('first_name', 'like', "$item%")->
                or_where('middle_name', 'like', "$item%")->or_where('last_name', 'like', "$item%")->find_all();
            foreach ($candidates as $candidate) {
                $candidate_names[] = $candidate->first_name . " " . $candidate->middle_name . " " . $candidate->last_name . "
";
            }
        }
        print_r(array_unique($candidate_names));
    }
?>

<?php echo $content ?>

Political Simplicity, 2013
            <a href="<?php echo URL::site('management/')?>">
                <?php echo HTML::image('media/images/plus-xxl.png',array("width"=>25,"height"=>25))?>


text:
**************
Administration
**************

.. toctree::
    :maxdepth: 1

    admin/web-interface
    admin/tuning
    admin/jmx
    admin/properties
    admin/spill
    admin/resource-groups
    admin/session-property-managers
    admin/dist-sort
    admin/dynamic-filtering
    admin/graceful-shutdown
    admin/fault-tolerant-execution

***************
Event listeners
***************

.. toctree::
    :titlesonly:

    admin/event-listeners-http


text:
/*
 */

package hmi.graphics.opengl.geometry;

import hmi.graphics.opengl.GLRenderContext;
import hmi.graphics.opengl.GLRenderObject;
import hmi.graphics.util.BufferUtil;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import javax.media.opengl.*;

/**
 * A simple Sphere object, rendered using direct mode OpenGL
 */
public class SphereGeometry3 implements GLRenderObject {

  float radius = 5.0f;
  int numSlices = 32;
  int numStacks = 16;

  float[] mat_ambient = new float[] {1.0f, 1.0f, 1.0f};
  float[] mat_diffuse = new float[] {1.0f, 1.0f, 1.0f};
  float[] mat_specular = new float[] {0.0f, 0.0f, 0.0f};
  int texId;
  //float drho, dtheta, ds, dt;
//  int sphereList;
  int nrOfVertices ;
  int nrOfTris;
  float[] vertexData;
  float[] normalData;
  float[] texCoordData;
  int[] indexData;

  FloatBuffer vertexBuffer;
  FloatBuffer normalBuffer;
  FloatBuffer texCoordBuffer;
  IntBuffer indexBuffer;

 // FloatBuffer combinedBuffer;

  int vertexBufferId, normalBufferId, indexBufferId, texCoordBufferId;
  int combinedBufferId;

  int combinedSize; // size of combinedBuffer in floats
  int combinedByteBufferSize; // // size of combinedBuffer in bytes

  int dataBufferSize; // size of dataBuffer (in floats)
  int dataByteBufferSize; // size of dataBuffer in bytes
  int texCoordBufferSize;
  int texCoordByteBufferSize;
  int indexBufferSize;
  int indexByteBufferSize;

  int vertexOffset, normalOffset, texcoordOffset;
  int glArrayBufferSize;

  private boolean textured = true;

  private static SphereGeometry3 sphere;

  public static void makeSphere(float radius, int numSlices, int numStacks) {
    sphere = new SphereGeometry3(radius, numSlices, numStacks);
  }

  public static SphereGeometry3 getSphere(float radius, int numSlices, int numStacks) {
    if (sphere == null) makeSphere(radius, numSlices, numStacks);
    return sphere;
  }

   /**
    * Create a new Sphere object
    */
   public SphereGeometry3(float radius, int numSlices, int numStacks) {
      this.radius = radius;
      this.numSlices = numSlices;
      this.numStacks = numStacks;
      init();

   }

   public void setTextured(boolean textured) {
      this.textured = textured;
   }

   public void glInit(GLRenderContext glc) {

      GL2 gl = glc.gl2;
      int[] bufNames = new int[5];
      gl.glGenBuffers(5, bufNames, 0);

      indexBufferId = bufNames[3];
      combinedBufferId = bufNames[4];

      gl.glBindBuffer(GL.GL_ARRAY_BUFFER, combinedBufferId);
      gl.glBufferData(GL.GL_ARRAY_BUFFER, glArrayBufferSize, (FloatBuffer)null, GL.GL_STATIC_DRAW);
      vertexBuffer.rewind();
      gl.glBufferSubData(GL.GL_ARRAY_BUFFER, vertexOffset, dataByteBufferSize, vertexBuffer);
      normalBuffer.rewind();
      gl.glBufferSubData(GL.GL_ARRAY_BUFFER, normalOffset, dataByteBufferSize, normalBuffer);
      texCoordBuffer.rewind();
      gl.glBufferSubData(GL.GL_ARRAY_BUFFER, texcoordOffset, texCoordByteBufferSize, texCoordBuffer);

      gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexBufferId);
      indexBuffer.rewind();
      gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, indexByteBufferSize, indexBuffer, GL.GL_STATIC_DRAW);
      gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
      gl.glEnableClientState(GL2.GL_NORMAL_ARRAY);
   //   int texUnit = 0;
   //   glc.glClientActiveTexture(GLC.GL_TEXTURE0 + texUnit);
       gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);

   }

   public void glRender(GLRenderContext glc) {

        GL2 gl = glc.gl2;
        gl.glBindBuffer(GL.GL_ARRAY_BUFFER, combinedBufferId);

        gl.glNormalPointer(GL.GL_FLOAT, 0, normalOffset);
        gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, texcoordOffset);
        gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertexOffset);

        gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexBufferId);
        gl.glDrawElements(GL.GL_TRIANGLES, indexBufferSize, GL.GL_UNSIGNED_INT, 0L);

   }

   private void init() {
      nrOfVertices = (numStacks+1) * (numSlices+1);
      nrOfTris = numStacks * numSlices * 2;
      dataBufferSize = 3*nrOfVertices; // 3 floats per vertex
      texCoordBufferSize = 2*nrOfVertices;
      indexBufferSize = 3*nrOfTris;

      dataByteBufferSize = 4*dataBufferSize;
      texCoordByteBufferSize = 4* texCoordBufferSize;
      indexByteBufferSize = 4* indexBufferSize;

      glArrayBufferSize = dataByteBufferSize + dataByteBufferSize + texCoordByteBufferSize;

      vertexData = new float[dataBufferSize];
      normalData = new float[dataBufferSize];
      texCoordData = new float[texCoordBufferSize];
      indexData = new int[indexBufferSize];

      vertexBuffer = BufferUtil.directFloatBuffer(dataBufferSize);
      normalBuffer = BufferUtil.directFloatBuffer(dataBufferSize);
      texCoordBuffer = BufferUtil.directFloatBuffer(texCoordBufferSize);
      indexBuffer = BufferUtil.directIntBuffer(indexBufferSize);

      vertexOffset = 0;
      normalOffset = vertexOffset + dataByteBufferSize;

      texcoordOffset = normalOffset + dataByteBufferSize ;

      double dtheta =  Math.PI / numStacks ;
      double dphi =  ( 2.0 * Math.PI) /  numSlices;
      double ds = 1.0 / numSlices;
      double dt = 1.0 / numStacks;
      double theta, phi;
      float stheta, ctheta, sphi, cphi;
      float x, y, z, s, t;
      int vc = 0; // the vertex counter
      // fill stacks, from bottom to top
      for (int i = 0; i<=numStacks; i++) {
         if (i==0 ) {
            stheta = 0.0f;   ctheta = -1.0f;
         } else if (i==numStacks) {
            stheta = 0.0f;   ctheta = 1.0f;
         } else {
            theta = Math.PI - i*dtheta;
            stheta = (float) Math.sin(theta);   ctheta = (float) Math.cos(theta);
         }
         t = (float) (i*dt);
//         hmi.util.Console.println("========================\ni=" + i + "  stheta = " + stheta + "  ctheta=" + ctheta);
         for (int j=0; j<=numSlices; j++) {
            if (j==0 || j==numSlices ) {
                sphi = 0.0f;   cphi = 1.0f;
            } else {
                phi = j * dphi;
                sphi = (float) Math.sin(phi);   cphi = (float) Math.cos(phi);
            }
//            hmi.util.Console.println("j=" + j + "  sphi = " + sphi + "  cphi=" + cphi);
            x =  -sphi * stheta;
            y =   ctheta;
            z =  -cphi * stheta;
            s = (float) (j*ds);
//            hmi.util.Console.println("x=" + x + "  y = " + y + " z= " + z);
            vertexData[3*vc]   = radius * x;
            vertexData[3*vc+1] = radius * y;
            vertexData[3*vc+2] = radius * z;
            normalData[3*vc]   = x;
            normalData[3*vc+1] = y;
            normalData[3*vc+2] = z;
            texCoordData[2*vc] = s;
            texCoordData[2*vc+1] = t;
            vc++;
         }
      }
      int tc = 0; // the triangle counter;
      for (int i = 0; i<numStacks; i++) {
         for (int j=0; j<numSlices; j++) {
           // add two triangles
            int lowerleft =  (i*(numSlices+1)) + j;
            int lowerright = lowerleft+1;
            int upperleft = lowerleft + numSlices+1;
            int upperright = upperleft+1;
            indexData[3*tc] =  lowerleft;
            indexData[3*tc+1] = lowerright;
            indexData[3*tc+2] = upperleft;
            tc++;
            indexData[3*tc] = upperleft;
            indexData[3*tc+1] = lowerright;
            indexData[3*tc+2] = upperright;
            tc++;
         }
      }
//      for (int i=0; i< nrOfVertices; i++) {
//          hmi.util.Console.println("vertex " + i  + " = (" + vertexData[3*i] + ", " +   vertexData[3*i+1] + ", " +  vertexData[3*i+2] + ")");
//      }
      vertexBuffer.put(vertexData);
      normalBuffer.put(normalData);
      texCoordBuffer.put(texCoordData);
      indexBuffer.put(indexData);

   }

}


text:
[![Appcelerator Titanium](http://www-static.appcelerator.com/badges/titanium-git-badge-sq.png)](http://appcelerator.com/titanium/) [![Appcelerator Alloy](http://www-static.appcelerator.com/badges/alloy-git-badge-sq.png)](http://appcelerator.com/alloy/)

The app use also the [drawer](https://github.com/FokkeZB/nl.fokkezb.drawer) widget.
This is a sample app to check news from an api.
The targeted Android sdk is 19.

## Reproduce the issue [*App crash #39*](https://github.com/FokkeZB/nl.fokkezb.pullToRefresh/issues/39)

There is a **News** section which can be reach by the slide menu or the button on the home view.

In the **views/news.xml** a Ti.UI.View wraps the widget. To reproduce the bug just remove it and let the widget at the lop level of this view.
This view takes place in the center view of the drawer which is a Ti.UI.View on Android platform.


text:
import argparse
import hashlib
import math

from ona import OnaApiClient

parser = argparse.ArgumentParser(description='Migrate submissions')
parser.add_argument(
    'url', type=str,
    help='The full URL to get the JSON toilet information from')
parser.add_argument(
    'to_id', type=str,
    help="The id (number) of the form to migrate submissions to")
parser.add_argument(
    'length', type=float,
    help="The radius of the circle for the GPS jitter.")
parser.add_argument(
    'username', type=str, help='The Ona username used to log in')
parser.add_argument(
    'password', type=str, help='The Ona password used to log in')
args = parser.parse_args()

def calculate_gps_offsets(toilet_code):
    length = args.length
    angle = int(hashlib.md5(toilet_code).hexdigest()[-4:], 16)
    angle = (angle - 2 ** 15) / (2. ** 15) * math.pi
    return length * math.cos(angle), length * math.sin(angle)

def generate_location(lat, lon, toilet_code):
    if lat == 0.0 and lon == 0.0:
        return '0.0 0.0'
    offset_lat, offset_lon = calculate_gps_offsets(toilet_code)
    return ' '.join([str(lat + offset_lat), str(lon + offset_lon)])

CONVERSIONS = {
    'code': 'toilet_code', 'section': 'toilet_section',
    'cluster': 'toilet_cluster'}
ADDITIONS = {
    'toilet_location': (generate_location, ['lat', 'lon', 'code'])
}
DEFAULTS = {
    'toilet_state': 'no_issue', 'toilet_issue': '', 'toilet_issue_date': ''}

client = OnaApiClient(args.username, args.password)

def get_toilet_info_from_django():
    url = args.url
    headers = {
        "Content-type": "application/json; charset=utf-8"
    }
    r = client.session.request(
        'GET', url, headers=headers)
    r.raise_for_status()
    return r.json()

def get_fields_from_form(formid):
    form = client.get_form_information(formid)
    fields = []
    for child in form.get('children'):
        fields.append(child.get('name'))
    return fields

toilet_data = get_toilet_info_from_django()
to_fields = get_fields_from_form(args.to_id)

for toilet in toilet_data:
    new_toilet = toilet.copy()
    # Add fields
    for field, (function, arguments) in ADDITIONS.iteritems():
        arguments = [toilet[arg] for arg in arguments]
        new_toilet[field] = function(*arguments)
    # Migrate fields
    for field in toilet:
        if field in CONVERSIONS:
            new_toilet[CONVERSIONS[field]] = toilet[field]
    # Remove deleted fields
        if field not in to_fields:
            del new_toilet[field]
    # Add missing fields
    for field in to_fields:
        if field not in new_toilet:
            new_toilet[field] = DEFAULTS.get(field, None)
    # Post submission to new form
    form_id_string = client.get_form(args.to_id)['id_string']
    try:
        client.submission({
            "id": form_id_string,
            "submission": new_toilet,
        })
    except:
        print("Error sending form %s. Submission: " % form_id_string)
        print(new_toilet)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using geocoderNet.Models;

namespace geocoderNet.Tests.Models
{
    [TestClass]
    public class AddressTest
    {

        [TestMethod]
        public void CleanTest()
        {

            Address address = new Address();
            address.text = "P.O.     Box 12 Washington D.C.";
            Assert.AreEqual(address.clean(address.text), "PO Box 12 Washington DC", "Failed to clean address");

            address.text = "Post Office Box 12      Washington             D.C.";
            Assert.AreEqual(address.clean(address.text), "Post Office Box 12 Washington DC", "Failed to clean address");

            address.text = "P O Box 12 Washington D.C.         ";
            Assert.AreEqual(address.clean(address.text), "P O Box 12 Washington DC", "Failed to clean address");

        }

        [TestMethod]
        public void expand_numbersTest()
        {

            Address address = new Address();
            address.text = "1st Street";
            var lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "1 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "first Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "one Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "1st Street", "Failed to expand_numbers");

            address.text = "3rd Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "3 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "third Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "three Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "3rd Street", "Failed to expand_numbers");

            address.text = "8th Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "8 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "eighth Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "eight Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "8th Street", "Failed to expand_numbers");

            // ---------------------------------------
            address.text = "first Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "1 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "1st Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "one Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "first Street", "Failed to expand_numbers");

            address.text = "third Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "3 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "3rd Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "three Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "third Street", "Failed to expand_numbers");

            address.text = "eighth Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "8 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "8th Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "eight Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "eighth Street", "Failed to expand_numbers");

            // -------------------------------------
            address.text = "one Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "1 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "first Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "1st Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "one Street", "Failed to expand_numbers");

            address.text = "three Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "3 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "third Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "3rd Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "three Street", "Failed to expand_numbers");

            address.text = "eight Street";
            lst = (List<string>)address.expand_numbers(address.text);
            Assert.AreEqual(lst[0], "8 Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[1], "eighth Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[2], "8th Street", "Failed to expand_numbers");
            Assert.AreEqual(lst[3], "eight Street", "Failed to expand_numbers");

        }

        [TestMethod]
        public void parse_zipTest()
        {

            var address = new Address();
            var txt = "P.O. Box 12 Washington D.C. 20002";
            var match = Match.zip.Match(txt);
            var zip = match.Value;
            Assert.AreEqual(zip, "20002", "Failed to parse_zip");
            txt = address.parse_zip(match, txt);
            Assert.AreEqual(txt, "P.O. Box 12 Washington D.C.", "Failed to parse_zip");
            Assert.AreEqual(address.zip, "20002", "Failed to parse_zip");
            Assert.AreEqual(address.plus4, null, "Failed to parse_zip");

            address = new Address();
            txt = "P.O. Box 12 Washington D.C. 20002-0011";
            match = Match.zip.Match(txt);
            zip = match.Value;
            Assert.AreEqual(zip, "20002-0011", "Failed to parse_zip");
            txt = address.parse_zip(match, txt);
            Assert.AreEqual(txt, "P.O. Box 12 Washington D.C.", "Failed to parse_zip");
            Assert.AreEqual(address.zip, "20002", "Failed to parse_zip");
            Assert.AreEqual(address.plus4, "0011", "Failed to parse_zip");

            address = new Address();
            txt = "P.O. Box 12 Washington D.C., 20002";
            match = Match.zip.Match(txt);
            zip = match.Value;
            Assert.AreEqual(zip, "20002", "Failed to parse_zip");
            txt = address.parse_zip(match, txt);
            Assert.AreEqual(txt, "P.O. Box 12 Washington D.C.", "Failed to parse_zip");
            Assert.AreEqual(address.zip, "20002", "Failed to parse_zip");
            Assert.AreEqual(address.plus4, null, "Failed to parse_zip");
        }

        [TestMethod]
        public void parse_stateTest()
        {

            var address = new Address();
            var txt = "P.O. Box 12 Frederick, MD";
            var match = Match.state.Match(txt);
            var state = match.Value;
            Assert.AreEqual(state, "MD", "Failed to parse_zip");
            txt = address.parse_state(match, txt);
            Assert.AreEqual(txt, "P.O. Box 12 Frederick", "Failed to parse_state");
            Assert.AreEqual(address.state, "MD", "Failed to parse_state");
            Assert.AreEqual(address.full_state, "MD", "Failed to parse_state");

            address = new Address();
            txt = "P.O. Box 12 Frederick, Maryland";
            match = Match.state.Match(txt);
            state = match.Value;
            Assert.AreEqual(state, "Maryland", "Failed to parse_zip");
            txt = address.parse_state(match, txt);
            Assert.AreEqual(txt, "P.O. Box 12 Frederick", "Failed to parse_state");
            Assert.AreEqual(address.state, "MD", "Failed to parse_state");
            Assert.AreEqual(address.full_state, "Maryland", "Failed to parse_state");
        }

        [TestMethod]
        public void parse_numberTest()
        {

            var address = new Address();
            var txt = "12 west Partick Street Frederick, MD";
            var match = Match.number.Match(txt);
            var num = match.Value;
            Assert.AreEqual(num, "12", "Failed to parse_number");
            txt = address.parse_number(match, txt);
            Assert.AreEqual(txt, "west Partick Street Frederick, MD", "Failed to parse_number");
            Assert.AreEqual(address.prenum, null, "Failed to parse_number");
            Assert.AreEqual(address.number, "12", "Failed to parse_number");
            Assert.AreEqual(address.sufnum, "", "Failed to parse_number");

             address = new Address();
             txt = "A12 west Partick Street Frederick, MD";
             match = Match.number.Match(txt);
             num = match.Value;
            Assert.AreEqual(num, "A12", "Failed to parse_number");
            txt = address.parse_number(match, txt);
            Assert.AreEqual(txt, "west Partick Street Frederick, MD", "Failed to parse_number");
            Assert.AreEqual(address.prenum, "A", "Failed to parse_number");
            Assert.AreEqual(address.number, "12", "Failed to parse_number");
            Assert.AreEqual(address.sufnum, "", "Failed to parse_number");

            address = new Address();
            txt = "12B west Partick Street Frederick, MD";
            match = Match.number.Match(txt);
            num = match.Value;
            Assert.AreEqual(num, "12B", "Failed to parse_number");
            txt = address.parse_number(match, txt);
            Assert.AreEqual(txt, "west Partick Street Frederick, MD", "Failed to parse_number");
            Assert.AreEqual(address.prenum, null, "Failed to parse_number");
            Assert.AreEqual(address.number, "12", "Failed to parse_number");
            Assert.AreEqual(address.sufnum, "B", "Failed to parse_number");
        }

        [TestMethod]
        public void parseTest()
        {
            var address = new Address();
            address.street = new List<string>();
            address.city = new List<string>();
            address.text = "110 E Patrick Sq Frederick, MD 21701";

            address.parse();
            Assert.AreEqual(address.city.Count(), 2, "Failed to find parse");
            Assert.AreEqual(address.city[0], "E Patrick Sq Frederick".ToLower(), "Failed to find parse");
            Assert.AreEqual(address.city[1], "E Patrick Square Frederick".ToLower(), "Failed to find parse");

        }

        [TestMethod]
        public void expand_streetsTest()
        {
            var address = new Address();

            var st = new List<string>();
            st.Add("North James Johnson St");
            st.Add("S Johnson Bay Ct");
            st.Add("East Patrick Johnson Cyn");
            var res = (List<string>)address.expand_streets(st);
            Assert.AreEqual(res.Count(), 5, "Failed to find street_parts");
            Assert.AreEqual(res[0], "North James Johnson St", "Failed to find street_parts");
            Assert.AreEqual(res[1], "S Johnson Bay Ct", "Failed to find street_parts");
            Assert.AreEqual(res[2], "East Patrick Johnson Cyn", "Failed to find street_parts");
            Assert.AreEqual(res[3], "S Johnson Bay Court", "Failed to find street_parts");
            Assert.AreEqual(res[4], "East Patrick Johnson Canyon", "Failed to find street_parts");
        }

        [TestMethod]
        public void street_partsTest()
        {
            var address = new Address();

            address.street.Add("North James Johnson St");
            address.street.Add("S Johnson Bay St");
            address.street.Add("East Patrick Johnson St");
            var res = (List<string>)address.street_parts();
            Assert.AreEqual(res.Count(), 5, "Failed to find street_parts");
            Assert.AreEqual(res[0], "Johnson", "Failed to find street_parts");
            Assert.AreEqual(res[1], "James Johnson", "Failed to find street_parts");
            Assert.AreEqual(res[2], "Bay", "Failed to find street_parts");
            Assert.AreEqual(res[3], "Johnson Bay", "Failed to find street_parts");
            Assert.AreEqual(res[4], "Patrick Johnson", "Failed to find street_parts");
        }

        [TestMethod]
        public void remove_noise_wordsTest()
        {
            var address = new Address();
            var strings = new List<string>();
            strings.Add("North Johnson St");
            strings.Add(" S  Johnson St");
            strings.Add(" East  Johnson St");
            strings.Add("W  Johnson St");
            var res = (List<string>)address.remove_noise_words(strings);
            Assert.AreEqual(res.Count(), 4, "Failed to find remove_noise_words");
            Assert.AreEqual(res[0], "Johnson", "Failed to find remove_noise_words");
            Assert.AreEqual(res[1], "Johnson", "Failed to find remove_noise_words");
            Assert.AreEqual(res[2], "Johnson", "Failed to find remove_noise_words");
            Assert.AreEqual(res[3], "Johnson", "Failed to find remove_noise_words");

        }

        [TestMethod]
        public void city_partsTest()
        {
            var address = new Address();

            address.city.Add("San Francisco");
            address.city.Add("Baltimore");
            address.city.Add("North Chevy Chase");
            var res = (List<string>)address.city_parts();
            Assert.AreEqual(res.Count(), 6, "Failed to find city_parts");
            Assert.AreEqual(res[0], "Francisco", "Failed to find city_parts");
            Assert.AreEqual(res[1], "San Francisco", "Failed to find city_parts");
            Assert.AreEqual(res[2], "Baltimore", "Failed to find city_parts");
            Assert.AreEqual(res[3], "Chase", "Failed to find city_parts");
            Assert.AreEqual(res[4], "Chevy Chase", "Failed to find city_parts");
            Assert.AreEqual(res[5], "North Chevy Chase", "Failed to find city_parts");
        }

        [TestMethod]
        public void city_xTest()
        {
            var address = new Address();

           // not clear this is being used.
        }

        [TestMethod]
        public void PO_BoxTest()
        {

            var address = new Address();
            address.text = "P.O. Box 12 Washington D.C.";
            Assert.AreEqual(address.po_box(), true, "Failed to find PO Box");

            address.text = "Post Office Box 12 Washington D.C.";
            Assert.AreEqual(address.po_box(), true, "Failed to find PO Box");

            address.text = "P O Box 12 Washington D.C.";
            Assert.AreEqual(address.po_box(), true, "Failed to find PO Box");

        }

        [TestMethod]
        public void IntersectionTest()
        {

            Address address = new Address();
            address.text = "5th and 3rd street washington dc";
            Assert.AreEqual(address.intersection(), true, "Failed to find intersection");

        }

    }
}


text: SELECT * FROM foo, (SELECT func1_sql_setint_imm(func2_sql_int_vol(a)) from foo) r order by 1,2,3;


text:
extern "Java"
{
  namespace gnu
  {
    namespace javax
    {
      namespace swing
      {
        namespace text
        {
          namespace html
          {
            namespace css
            {
                class CSSLexicalException;
            }
          }
        }
      }
    }
  }
}

class gnu::javax::swing::text::html::css::CSSLexicalException : public ::java::io::IOException
{

public:
  CSSLexicalException();
  CSSLexicalException(::java::lang::String *);
  static ::java::lang::Class class$;
};

#endif // __gnu_javax_swing_text_html_css_CSSLexicalException__


text:
/* */
module.exports = function(hljs) {
  return {
    aliases: ['js', 'jsx'],
    keywords: {
      keyword:
        'in of if for while finally var new function do return void else break catch ' +
        'instanceof with throw case default try this switch continue typeof delete ' +
        'let yield const export super debugger as async await static ' +
        // ECMAScript 6 modules import
        'import from as'
      ,
      literal:
        'true false null undefined NaN Infinity',
      built_in:
        'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
        'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
        'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
        'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
        'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
        'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
        'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
        'Promise'
    },
    contains: [
      {
        className: 'meta',
        relevance: 10,
        begin: /^\s*['"]use (strict|asm)['"]/
      },
      {
        className: 'meta',
        begin: /^#!/, end: /$/
      },
      hljs.APOS_STRING_MODE,
      hljs.QUOTE_STRING_MODE,
      { // template string
        className: 'string',
        begin: '`', end: '`',
        contains: [
          hljs.BACKSLASH_ESCAPE,
          {
            className: 'subst',
            begin: '\\$\\{', end: '\\}'
          }
        ]
      },
      hljs.C_LINE_COMMENT_MODE,
      hljs.C_BLOCK_COMMENT_MODE,
      {
        className: 'number',
        variants: [
          { begin: '\\b(0[bB][01]+)' },
          { begin: '\\b(0[oO][0-7]+)' },
          { begin: hljs.C_NUMBER_RE }
        ],
        relevance: 0
      },
      { // "value" container
        begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
        keywords: 'return throw case',
        contains: [
          hljs.C_LINE_COMMENT_MODE,
          hljs.C_BLOCK_COMMENT_MODE,
          hljs.REGEXP_MODE,
          { // E4X / JSX
            begin: /</, end: /(\/\w+|\w+\/)>/,
            subLanguage: 'xml',
            contains: [
              {begin: /<\w+\/>/, skip: true},
              {begin: /<\w+/, end: /(\/\w+|\w+\/)>/, skip: true, contains: ['self']}
            ]
          }
        ],
        relevance: 0
      },
      {
        className: 'function',
        beginKeywords: 'function', end: /\{/, excludeEnd: true,
        contains: [
          hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][0-9A-Za-z$_]*/}),
          {
            className: 'params',
            begin: /\(/, end: /\)/,
            excludeBegin: true,
            excludeEnd: true,
            contains: [
              hljs.C_LINE_COMMENT_MODE,
              hljs.C_BLOCK_COMMENT_MODE
            ]
          }
        ],
        illegal: /\[|%/
      },
      {
        begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
      },
      hljs.METHOD_GUARD,
      { // ES6 class
        className: 'class',
        beginKeywords: 'class', end: /[{;=]/, excludeEnd: true,
        illegal: /[:"\[\]]/,
        contains: [
          {beginKeywords: 'extends'},
          hljs.UNDERSCORE_TITLE_MODE
        ]
      },
      {
        beginKeywords: 'constructor', end: /\{/, excludeEnd: true
      }
    ],
    illegal: /#(?!!)/
  };
};


text:
<?php

namespace Facebook\WebDriver\Support;

use Facebook\WebDriver\Exception\WebDriverException;
use Facebook\WebDriver\Remote\DriverCommand;
use Facebook\WebDriver\Remote\RemoteExecuteMethod;
use PHPUnit\Framework\TestCase;

class ScreenshotHelperTest extends TestCase
{
    const BLACK_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=';

    public function testShouldSavePageScreenshotToSubdirectoryIfNotExists()
    {
        $fullFilePath = sys_get_temp_dir() . '/' . uniqid('php-webdriver-', true) . '/screenshot.png';
        $directoryPath = dirname($fullFilePath);
        $this->assertDirectoryNotExists($directoryPath);

        $executorMock = $this->createMock(RemoteExecuteMethod::class);
        $executorMock->expects($this->once())
            ->method('execute')
            ->with($this->equalTo(DriverCommand::SCREENSHOT))
            ->willReturn(self::BLACK_PIXEL);

        $helper = new ScreenshotHelper($executorMock);
        $output = $helper->takePageScreenshot($fullFilePath);

        $this->assertSame(base64_decode(self::BLACK_PIXEL, true), $output);

        $this->assertDirectoryExists($directoryPath);
        $this->assertFileExists($fullFilePath);

        unlink($fullFilePath);
        rmdir($directoryPath);
    }

    public function testShouldOnlyReturnBase64IfDirectoryNotProvided()
    {
        $executorMock = $this->createMock(RemoteExecuteMethod::class);
        $executorMock->expects($this->once())
            ->method('execute')
            ->with($this->equalTo(DriverCommand::SCREENSHOT))
            ->willReturn(self::BLACK_PIXEL);

        $helper = new ScreenshotHelper($executorMock);
        $output = $helper->takePageScreenshot();

        $this->assertSame(base64_decode(self::BLACK_PIXEL, true), $output);
    }

    public function testShouldSaveElementScreenshotToSubdirectoryIfNotExists()
    {
        $fullFilePath = sys_get_temp_dir() . '/' . uniqid('php-webdriver-', true) . '/screenshot.png';
        $directoryPath = dirname($fullFilePath);
        $this->assertDirectoryNotExists($directoryPath);
        $elementId = 'foo-id';

        $executorMock = $this->createMock(RemoteExecuteMethod::class);
        $executorMock->expects($this->once())
            ->method('execute')
            ->with(DriverCommand::TAKE_ELEMENT_SCREENSHOT, [':id' => $elementId])
            ->willReturn(self::BLACK_PIXEL);

        $helper = new ScreenshotHelper($executorMock);
        $output = $helper->takeElementScreenshot($elementId, $fullFilePath);

        $this->assertSame(base64_decode(self::BLACK_PIXEL, true), $output);
        $this->assertDirectoryExists($directoryPath);
        $this->assertFileExists($fullFilePath);

        unlink($fullFilePath);
        rmdir($directoryPath);
    }

    /**
     * @dataProvider provideInvalidData
     * @param mixed $data
     * @param string $expectedExceptionMessage
     */
    public function testShouldThrowExceptionWhenInvalidDataReceived($data, $expectedExceptionMessage)
    {
        $executorMock = $this->createMock(RemoteExecuteMethod::class);
        $executorMock->expects($this->once())
            ->method('execute')
            ->with($this->equalTo(DriverCommand::SCREENSHOT))
            ->willReturn($data);

        $helper = new ScreenshotHelper($executorMock);

        $this->expectException(WebDriverException::class);
        $this->expectExceptionMessage($expectedExceptionMessage);
        $helper->takePageScreenshot();
    }

    public function provideInvalidData()
    {
        return [
            'empty response' => [null, 'Error taking screenshot, no data received from the remote end'],
            'not valid base64 response' => ['invalid%base64', 'Error decoding screenshot data'],
        ];
    }
}


text:
package com.orientechnologies.orient.core.record.impl;

import com.orientechnologies.orient.core.db.record.ORecordElement;

public class ODocumentInternal {

  public static void clearSource(ODocument document) {
    document.clearSource();
  }

  public static void convertAllMultiValuesToTrackedVersions(ODocument document) {
    document.convertAllMultiValuesToTrackedVersions();
  }

  public static void addOwner(ODocument oDocument, ORecordElement iOwner) {
    oDocument.addOwner(iOwner);
  }

  public static void removeOwner(ODocument oDocument, ORecordElement iOwner) {
    oDocument.removeOwner(iOwner);
  }

}


text:
#ifndef _CONFIG_POGO_E02_H
#define _CONFIG_POGO_E02_H

/*
 * Machine type definition and ID
 */
#define MACH_TYPE_POGO_E02		3542
#define CONFIG_MACH_TYPE		MACH_TYPE_POGO_E02
#define CONFIG_IDENT_STRING		"\nPogo E02"

/*
 * High Level Configuration Options (easy to change)
 */
#define CONFIG_FEROCEON_88FR131		/* CPU Core subversion */
#define CONFIG_KW88F6281		/* SOC Name */
#define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */

/*
 * Commands configuration
 */
#define CONFIG_SYS_NO_FLASH		/* Declare no flash (NOR/SPI) */
#define CONFIG_SYS_MVFS
#define CONFIG_CMD_ENV
#define CONFIG_CMD_NAND

/*
 * mv-common.h should be defined after CMD configs since it used them
 * to enable certain macros
 */
#include "mv-common.h"

/*
 *  Environment variables configurations
 */
#ifdef CONFIG_CMD_NAND
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_SECT_SIZE		0x20000	/* 128K */
#else
#define CONFIG_ENV_IS_NOWHERE
#endif

#define CONFIG_ENV_SIZE			0x20000	/* 128k */
#define CONFIG_ENV_OFFSET		0x60000	/* env starts here */

/*
 * Default environment variables
 */
#define CONFIG_BOOTCOMMAND \
	"setenv bootargs $(bootargs_console); " \
	"run bootcmd_usb; " \
	"bootm 0x00800000 0x01100000"

#define CONFIG_EXTRA_ENV_SETTINGS \
	"mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage)," \
	"32M(rootfs),-(data)\0"\
	"mtdids=nand0=orion_nand\0"\
	"bootargs_console=console=ttyS0,115200\0" \
	"bootcmd_usb=usb start; ext2load usb 0:1 0x00800000 /uImage; " \
	"ext2load usb 0:1 0x01100000 /uInitrd\0"

/*
 * Ethernet Driver configuration
 */
#ifdef CONFIG_CMD_NET
#define CONFIG_MVGBE_PORTS	{1, 0}	/* enable port 0 only */
#define CONFIG_PHY_BASE_ADR	0
#endif /* CONFIG_CMD_NET */

/*
 * File system
 */
#define CONFIG_CMD_JFFS2
#define CONFIG_CMD_UBI
#define CONFIG_CMD_UBIFS
#define CONFIG_RBTREE
#define CONFIG_MTD_DEVICE               /* needed for mtdparts commands */
#define CONFIG_MTD_PARTITIONS
#define CONFIG_CMD_MTDPARTS
#define CONFIG_LZO

#endif /* _CONFIG_POGO_E02_H */


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>samples</artifactId>
        <groupId>com.samples</groupId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <groupId>com.samples.yamodroid</groupId>
    <artifactId>yamodroid-sample</artifactId>
    <packaging>apk</packaging>
    <name>yamodroid-sample</name>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>2.2.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>ru.yandex.money</groupId>
            <artifactId>yamodroid</artifactId>
            <type>apklib</type>
            <scope>compile</scope>
            <version>1.1.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <configuration>
                    <sdk>
                        <platform>19</platform>
                    </sdk>
                </configuration>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.7.0</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>


text:
Addressbook.configure do

  def current_account
    Account.first
  end
end


text:
<!DOCTYPE html>

		<title>Personal Profile</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1">
		<base href="<?php echo $SCHEME.'://'.$HOST.':'.$PORT.$BASE.'/'; ?>" />
		<link href="assets/css/global.css" rel="stylesheet" />

		<check if="{{ @isLightbox }}">
			<link rel="stylesheet" type="text/css" href="assets/css/lightBox.css">

		</check>

			<include href="templates/nav.html" if="{{ @loggedIn }}" />

					<include href="{{ @content }}" />

			<include href="templates/footer.html" if="{{ @loggedIn }}" />


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

<meta name="generator" content="PHPDoctor 2RC4 (http://phpdoctor.sourceforge.net/)">
<meta name="when" content="Wed, 14 Apr 2010 15:12:04 +0000">

<link rel="stylesheet" type="text/css" href="../../stylesheet.css">
<link rel="start" href="../../overview-summary.html">

<title>ORMException (Doctrine)</title>

Doctrine

Overview

Namespace

Class

Tree

Deprecated

Index

Frames
No frames

Summary: Field | Method | Constr
Detail: Field | Method | Constr

Doctrine\ORM\ORMException

/Doctrine/ORM/ORMException.php at line 11

Class ORMException

Class:ORMException - Superclass: Exception
Exception
⌊ ORMException

public  class ORMException
extends Exception

Base exception class for all ORM exceptions.

Author:

Roman Borschel <roman@code-factory.org>

Since:

2.0

Method Summary

static  void

detachedEntityCannotBeRemoved()

static  void

entityManagerClosed()

static  void

entityMissingAssignedId(mixed entity)

static  void

findByRequiresParameter(mixed methodName)

static  void

invalidEntityState(mixed state)

static  void

invalidFindByCall(mixed entityName, mixed fieldName, mixed method)

static  void

invalidFlushMode(mixed mode)

static  void

invalidHydrationMode(mixed mode)

static  void

invalidResultCacheDriver()

static  void

metadataCacheNotConfigured()

static  void

mismatchedEventManager()

static  void

missingMappingDriverImpl()

static  void

notSupported()

static  void

proxyClassesAlwaysRegenerating()

static  void

queryCacheNotConfigured()

static  void

removedEntityInCollectionDetected(mixed entity, mixed assoc)

static  void

unknownEntityNamespace(mixed entityNamespaceAlias)

static  void

unrecognizedField(mixed field)

Method Detail

/Doctrine/ORM/ORMException.php at line 41

detachedEntityCannotBeRemoved

public static  void detachedEntityCannotBeRemoved()

/Doctrine/ORM/ORMException.php at line 51

entityManagerClosed

public static  void entityManagerClosed()

/Doctrine/ORM/ORMException.php at line 19

entityMissingAssignedId

public static  void entityMissingAssignedId(mixed entity)

/Doctrine/ORM/ORMException.php at line 66

findByRequiresParameter

public static  void findByRequiresParameter(mixed methodName)

/Doctrine/ORM/ORMException.php at line 36

invalidEntityState

public static  void invalidEntityState(mixed state)

/Doctrine/ORM/ORMException.php at line 71

invalidFindByCall

public static  void invalidFindByCall(mixed entityName, mixed fieldName, mixed method)

/Doctrine/ORM/ORMException.php at line 46

invalidFlushMode

public static  void invalidFlushMode(mixed mode)

/Doctrine/ORM/ORMException.php at line 56

invalidHydrationMode

public static  void invalidHydrationMode(mixed mode)

/Doctrine/ORM/ORMException.php at line 79

invalidResultCacheDriver

public static  void invalidResultCacheDriver()

/Doctrine/ORM/ORMException.php at line 92

metadataCacheNotConfigured

public static  void metadataCacheNotConfigured()

/Doctrine/ORM/ORMException.php at line 61

mismatchedEventManager

public static  void mismatchedEventManager()

/Doctrine/ORM/ORMException.php at line 13

missingMappingDriverImpl

public static  void missingMappingDriverImpl()

/Doctrine/ORM/ORMException.php at line 83

notSupported

public static  void notSupported()

/Doctrine/ORM/ORMException.php at line 97

proxyClassesAlwaysRegenerating

public static  void proxyClassesAlwaysRegenerating()

/Doctrine/ORM/ORMException.php at line 87

queryCacheNotConfigured

public static  void queryCacheNotConfigured()

/Doctrine/ORM/ORMException.php at line 29

removedEntityInCollectionDetected

public static  void removedEntityInCollectionDetected(mixed entity, mixed assoc)

/Doctrine/ORM/ORMException.php at line 102

unknownEntityNamespace

public static  void unknownEntityNamespace(mixed entityNamespaceAlias)

/Doctrine/ORM/ORMException.php at line 24

unrecognizedField

public static  void unrecognizedField(mixed field)

Doctrine

Overview

Namespace

Class

Tree

Deprecated

Index

Frames
No frames

Summary: Field | Method | Constr
Detail: Field | Method | Constr

This document was generated by PHPDoctor: The PHP Documentation Creator


text:
<?php

namespace Magento\Catalog\Block\Adminhtml\Category;

/**
 * Category container block
 */
class Edit extends \Magento\Backend\Block\Widget\Form\Container
{
    /**
     * @var string
     */
    protected $_template = 'catalog/category/edit.phtml';

    /**
     * @return void
     */
    protected function _construct()
    {
        $this->_objectId = 'entity_id';
        $this->_blockGroup = 'Magento_Catalog';
        $this->_controller = 'adminhtml_category';
        $this->_mode = 'edit';
        parent::_construct();
        $this->buttonList->remove('back');
        $this->buttonList->remove('reset');
        $this->buttonList->remove('save');
    }
}


text:
from NodeDefender.mqtt.command import fire, topic_format

def upgrade(mac_address, *args):
    topic = topic_format.format(mac_address, "sys", "fw", "upgrade")
    payload = list(args)
    return fire(topic, payload = payload, icpe = mac_address)


text:
import User from 'models/user'
import Post from 'models/post'

function usersList() {
  return [
    new User({
      id: '1',
      name: 'Jon Stokes',
      email: 'jon@collectiveidea.com',
      website: 'https://github.com/jonstokes',
      password: 'foobarbazqux',
      role: 'admin'
    }),
    new User({
      id: '2',
      name: 'Willy Wonka',
      email: 'wwonka@collectiveidea.com',
      website: 'https://example.com/',
      password: 'barfooquxbaz',
      user: 'user'
    })
  ]
}

function postsList() {
  return [
    new Post({ id: '1', title: 'This is a taco post', body: 'Mmmm... tacos.', userId: '1' }),
    new Post({ id: '2', url: 'This is burrito post', body: 'Mmmm... burritos.', userId: '1' }),
  ]
}

export {
  usersList,
  postsList,
}