text:
import os
import sys

try:
    from setuptools import setup, Command
except ImportError:
    from distutils.core import setup, Command

package_name = 'dpkt'
description = 'fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols'
readme = open('README.rst').read()
requirements = []

# PyPI Readme
long_description = open('README.rst').read()

# Pull in the package
package = __import__(package_name)

class BuildDebPackage(Command):
    """Build a Debian Package out of this Python Package"""
    try:
        import stdeb
    except ImportError as exc:
        print 'To build a Debian Package you must install stdeb (pip install stdeb)'

    description = "Build a Debian Package out of this Python Package"
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        os.system('python setup.py sdist')
        sdist_file = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'dist'),
                                  package_name + '-' + package.__version__ + '.tar.gz')
        print sdist_file
        os.system('py2dsc-deb ' + sdist_file)

setup(name=package_name,
      version=package.__version__,
      author=package.__author__,
      author_email=package.__author_email__,
      url=package.__url__,
      description=description,
      long_description=long_description,
      packages=['dpkt'],
      install_requires=requirements,
      license='BSD',
      zip_safe=False,
      classifiers=[
          'Development Status :: 4 - Beta',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: BSD License',
          'Natural Language :: English',
          'Programming Language :: Python :: 2.6',
          'Programming Language :: Python :: 2.7',
          'Programming Language :: Python :: Implementation :: CPython',
          'Programming Language :: Python :: Implementation :: PyPy',
      ],
      cmdclass={'debian': BuildDebPackage}
)

redpajama_set_name: RedPajamaGithub


text:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fragment"
    android:name="com.lab11.nolram.cadernocamera.CriarCadernoActivityFragment"
    tools:layout="@layout/fragment_criar_caderno" android:layout_width="match_parent"
    android:layout_height="match_parent" />


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Profile extends Model
{
	protected $fillable = ['no','initial','prefix','name','phone','suffix','birthplace','birthdate','user_id'];
}


text:
var Scenario = require(".."),
expect = require("expect.js"),
assert = require("assert"),
dbSettings = require("./settings.js"),
utils = require("./utils"),
scenario = Scenario().configure({  //default scenario instance
  dbSettings: dbSettings.good,
  fixtures: utils.fullPath("./fixtures"),
  scenarios: utils.fullPath("./fake_scenarios.js")
}),
connectionString = utils.dbString(dbSettings.good);

var MongoClient = require("mongodb").MongoClient; //setup mongodb driver for data inspection

describe(".connect", function() {
  //setup scenarioe

  it("should properly connect given a valid db configuration file.", function(next) {
    var tscenario = Scenario().configure({
      dbSettings: dbSettings.good,
      fixtures: utils.fullPath("./fixtures"),
      scenarios: utils.fullPath("./fake_scenarios.js")
    });
    tscenario.connect(function(err) {
      expect(err).to.be(null);
      next()
    });
  });

  it("should throw an error given an invalid db configuration file.", function(next) {
    var tscenario = Scenario().configure({
      dbSettings: dbSettings.bad,
      fixtures: utils.fullPath("./fixtures"),
      scenarios: utils.fullPath("./fake_scenarios.js")
    });
    tscenario.connect(function(err) {
      expect(err).to.be.ok();
      next();
    });
  });

  it("should do nothing if connect is called twice");
  // , function(next) {
  //   var tscenario = Scenario().configure({
  //     dbSettings: dbSettings.bad,
  //     fixtures: utils.fullPath("./fixtures"),
  //     scenarios: utils.fullPath("./fake_scenarios.js")
  //   });
  //   tscenario.connect(function(err) {
  //     tscenario.connect(function(err) {
  //       expect(err).to.be(null);
  //     });
  //   });
  // });

});

describe(".load/unload", function() {
  //put MongoClient and scenario initialization in beforeEach hook.
  it("should load a scenario", function(next) {
    MongoClient.connect(connectionString, function(err, db) {
      scenario.connect(function(err) {
        this.load('scenario1', function(err) {
          expect(err).to.be(null);
          db.collection('users').count(function(err, count) {
            expect(count).to.be(1);
            db.collection('cars').count(function(err, count) {
              expect(count).to.be(1);
              next();
            });
          });
        });
      });
    });
  });

  it("should cleanup that scenario", function(next) {
    MongoClient.connect(connectionString, function(err, db) {
      scenario.connect(function(err) {
        this.unload('users', function(err) {
          expect(err).to.be(null);
          db.collection('users').count(function(err, count) {
            expect(count).to.be(0);
            next();
          });
        });
      });
    });
  });

});

describe("scenario loading", function() {
  it("should load a scenario of only fixtures");

  it("should load a scenario of fixtures and other scenarios");

  it("should load a scenario of other scenarios");

  it("should load a scenario and properly cleanup all data");

});


text:
<?php

namespace frontend\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use frontend\models\Requests;

/**
 * RequestsSearch represents the model behind the search form about `frontend\models\Requests`.
 */
class RequestsSearch extends Requests
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id'], 'integer'],
            [['name', 'phone', 'email', 'created_at', 'updated_at'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Requests::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }
        $query->joinWith('specialist.doctor');

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'start_time' => $this->start_time,
            'visited' => $this->visited,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        $query->andFilterWhere(['like', 'doctors.name', $this->specialist_id])
            ->andFilterWhere(['like', 'start_time', $this->start_time])
            ->andFilterWhere(['like', 'phone', $this->phone])
            ->andFilterWhere(['like', 'email', $this->email]);

        return $dataProvider;
    }
}


text:
namespace com {
namespace amazonaws {
namespace kinesis {
namespace video {
namespace webrtcclient {

#define NUMBER_OF_FRAME_FILES 403
#define DEFAULT_FPS_VALUE     25
BYTE start4ByteCode[] = {0x00, 0x00, 0x00, 0x01};

class RtpFunctionalityTest : public WebRtcClientTestBase {
};

TEST_F(RtpFunctionalityTest, packetUnderflow)
{
    BYTE rawPacket[] = {0x00, 0x00, 0x00, 0x00};
    RtpPacket rtpPacket;

    MEMSET(&rtpPacket, 0x00, SIZEOF(RtpPacket));

    for (auto i = 0; i <= 12; i++) {
        ASSERT_EQ(setRtpPacketFromBytes(rawPacket, SIZEOF(rawPacket), &rtpPacket), STATUS_RTP_INPUT_PACKET_TOO_SMALL);
    }
}

TEST_F(RtpFunctionalityTest, marshallUnmarshallGettingSameData)
{
    BYTE payload[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
    UINT32 payloadLen = 6;
    PayloadArray payloadArray;
    PRtpPacket packetList = NULL;
    PRtpPacket pRtpPacket = NULL;
    PRtpPacket pNewRtpPacket = NULL;
    PBYTE rawPacket = NULL;
    UINT32 packetLen = 0;
    UINT32 i = 0;

    payloadArray.payloadBuffer = payload;
    payloadArray.payloadLength = payloadLen;
    payloadArray.payloadSubLength = &payloadLen;
    payloadArray.payloadSubLenSize = 1;

    packetList = (PRtpPacket) MEMALLOC(SIZEOF(RtpPacket));

    SRAND(GETTIME());
    EXPECT_EQ(STATUS_SUCCESS,
              constructRtpPackets(&payloadArray, 8, 1, 1324857487, 0x1234ABCD, (PRtpPacket) packetList, payloadArray.payloadSubLenSize));

    EXPECT_NE(NULL, (UINT64) packetList);

    for (i = 0; i < payloadArray.payloadSubLenSize; i++) {
        pRtpPacket = packetList + i;

        EXPECT_EQ(STATUS_SUCCESS, createBytesFromRtpPacket(pRtpPacket, NULL, &packetLen));
        EXPECT_TRUE(NULL != (rawPacket = (PBYTE) MEMALLOC(packetLen)));
        EXPECT_EQ(STATUS_SUCCESS, createBytesFromRtpPacket(pRtpPacket, rawPacket, &packetLen));
        EXPECT_EQ(STATUS_SUCCESS, createRtpPacketFromBytes(rawPacket, packetLen, &pNewRtpPacket));
        // Verify the extracted header is the same as original header
        EXPECT_EQ(pRtpPacket->header.version, pNewRtpPacket->header.version);
        EXPECT_EQ(pRtpPacket->header.sequenceNumber, pNewRtpPacket->header.sequenceNumber);
        EXPECT_EQ(pRtpPacket->header.ssrc, pNewRtpPacket->header.ssrc);
        EXPECT_EQ(pRtpPacket->header.csrcArray, pNewRtpPacket->header.csrcArray);
        EXPECT_EQ(pRtpPacket->header.extensionPayload, pNewRtpPacket->header.extensionPayload);
        EXPECT_EQ(pRtpPacket->header.extension, pNewRtpPacket->header.extension);
        EXPECT_EQ(pRtpPacket->header.timestamp, pNewRtpPacket->header.timestamp);
        EXPECT_EQ(pRtpPacket->header.extensionProfile, pNewRtpPacket->header.extensionProfile);
        EXPECT_EQ(pRtpPacket->header.payloadType, pNewRtpPacket->header.payloadType);
        EXPECT_EQ(pRtpPacket->header.padding, pNewRtpPacket->header.padding);
        EXPECT_EQ(pRtpPacket->header.csrcCount, pNewRtpPacket->header.csrcCount);
        EXPECT_EQ(pRtpPacket->header.extensionLength, pNewRtpPacket->header.extensionLength);
        EXPECT_EQ(pRtpPacket->header.marker, pNewRtpPacket->header.marker);

        // Verify the extracted payload is the same as original payload
        EXPECT_EQ(pRtpPacket->payloadLength, pNewRtpPacket->payloadLength);
        EXPECT_TRUE(MEMCMP(pRtpPacket->payload, pNewRtpPacket->payload, pRtpPacket->payloadLength) == 0);

        EXPECT_EQ(STATUS_SUCCESS, freeRtpPacket(&pNewRtpPacket));
    }

    MEMFREE(packetList);
}

TEST_F(RtpFunctionalityTest, marshallUnmarshallH264Data)
{
    PBYTE payload = (PBYTE) MEMALLOC(200000); // Assuming this is enough
    UINT32 payloadLen = 0;
    PayloadArray payloadArray;
    PRtpPacket pPacketList = NULL;
    PRtpPacket pRtpPacket = NULL;
    PBYTE rawPacket = NULL;
    UINT32 packetLen = 0;
    UINT64 curTime = GETTIME();
    UINT32 fileIndex = 0;
    UINT16 seqNum = 0;
    UINT64 startTimeStamp = curTime;
    UINT32 i = 0;

    payloadArray.maxPayloadLength = 0;
    payloadArray.maxPayloadSubLenSize = 0;
    payloadArray.payloadBuffer = NULL;
    payloadArray.payloadSubLength = NULL;

    for (auto sentAllFrames = 0; sentAllFrames <= 5;) {
        if (fileIndex == NUMBER_OF_FRAME_FILES) {
            sentAllFrames++;
        }

        fileIndex = fileIndex % NUMBER_OF_FRAME_FILES + 1;
        EXPECT_EQ(STATUS_SUCCESS, readFrameData((PBYTE) payload, (PUINT32) &payloadLen, fileIndex, (PCHAR) "../samples/h264SampleFrames"));

        // First call for payload size and sub payload length size
        EXPECT_EQ(STATUS_SUCCESS,
                  createPayloadForH264(DEFAULT_MTU_SIZE, (PBYTE) payload, payloadLen, NULL, &payloadArray.payloadLength, NULL,
                                       &payloadArray.payloadSubLenSize));

        if (payloadArray.payloadLength > payloadArray.maxPayloadLength) {
            if (payloadArray.payloadBuffer != NULL) {
                MEMFREE(payloadArray.payloadBuffer);
            }
            payloadArray.payloadBuffer = (PBYTE) MEMALLOC(payloadArray.payloadLength);
            payloadArray.maxPayloadLength = payloadArray.payloadLength;
        }
        if (payloadArray.payloadSubLenSize > payloadArray.maxPayloadSubLenSize) {
            if (payloadArray.payloadSubLength != NULL) {
                MEMFREE(payloadArray.payloadSubLength);
            }
            payloadArray.payloadSubLength = (PUINT32) MEMALLOC(payloadArray.payloadSubLenSize * SIZEOF(UINT32));
            payloadArray.maxPayloadSubLenSize = payloadArray.payloadSubLenSize;
        }

        // Second call with actual buffer to fill in data
        EXPECT_EQ(STATUS_SUCCESS,
                  createPayloadForH264(DEFAULT_MTU_SIZE, (PBYTE) payload, payloadLen, payloadArray.payloadBuffer, &payloadArray.payloadLength,
                                       payloadArray.payloadSubLength, &payloadArray.payloadSubLenSize));

        EXPECT_LT(0, payloadArray.payloadSubLenSize);
        pPacketList = (PRtpPacket) MEMALLOC(payloadArray.payloadSubLenSize * SIZEOF(RtpPacket));

        constructRtpPackets(&payloadArray, 96, seqNum, (UINT32)((curTime - startTimeStamp) / HUNDREDS_OF_NANOS_IN_A_MILLISECOND), 0x1234ABCD,
                            pPacketList, payloadArray.payloadSubLenSize);

        seqNum = GET_UINT16_SEQ_NUM(seqNum + payloadArray.payloadSubLenSize);

        for (i = 0; i < payloadArray.payloadSubLenSize; i++) {
            pRtpPacket = pPacketList + i;
            EXPECT_EQ(STATUS_SUCCESS, createBytesFromRtpPacket(pRtpPacket, NULL, &packetLen));
            EXPECT_TRUE(NULL != (rawPacket = (PBYTE) MEMALLOC(packetLen)));
            EXPECT_EQ(STATUS_SUCCESS, createBytesFromRtpPacket(pRtpPacket, rawPacket, &packetLen));

            MEMFREE(rawPacket);
            rawPacket = NULL;
        }
        curTime = GETTIME();

        MEMFREE(pPacketList);

        pPacketList = NULL;
    }

    MEMFREE(payloadArray.payloadBuffer);
    MEMFREE(payloadArray.payloadSubLength);
    MEMFREE(payload);
}

TEST_F(RtpFunctionalityTest, packingUnpackingVerifySameH264Frame)
{
    PBYTE payload = (PBYTE) MEMCALLOC(1, 200000); // Assuming this is enough
    PBYTE depayload = (PBYTE) MEMCALLOC(1, 1500); // This is more than max mtu
    UINT32 depayloadSize = 1500;
    UINT32 payloadLen = 0;
    UINT32 fileIndex = 0;
    PayloadArray payloadArray;
    UINT32 i = 0;
    UINT32 offset = 0;
    UINT32 newPayloadLen = 0, newPayloadSubLen = 0;
    BOOL isStartPacket = FALSE;
    PBYTE pCurPtrInPayload = NULL;
    UINT32 remainPayloadLen = 0;
    UINT32 startIndex = 0, naluLength = 0;
    UINT32 startLen = 0;

    payloadArray.maxPayloadLength = 0;
    payloadArray.maxPayloadSubLenSize = 0;
    payloadArray.payloadBuffer = NULL;
    payloadArray.payloadSubLength = NULL;

    for (fileIndex = 1; fileIndex <= NUMBER_OF_FRAME_FILES; fileIndex++) {
        EXPECT_EQ(STATUS_SUCCESS, readFrameData((PBYTE) payload, (PUINT32) &payloadLen, fileIndex, (PCHAR) "../samples/h264SampleFrames"));

        // First call for payload size and sub payload length size
        EXPECT_EQ(STATUS_SUCCESS,
                  createPayloadForH264(DEFAULT_MTU_SIZE, (PBYTE) payload, payloadLen, NULL, &payloadArray.payloadLength, NULL,
                                       &payloadArray.payloadSubLenSize));

        if (payloadArray.payloadLength > payloadArray.maxPayloadLength) {
            if (payloadArray.payloadBuffer != NULL) {
                MEMFREE(payloadArray.payloadBuffer);
            }
            payloadArray.payloadBuffer = (PBYTE) MEMALLOC(payloadArray.payloadLength);
            payloadArray.maxPayloadLength = payloadArray.payloadLength;
        }
        if (payloadArray.payloadSubLenSize > payloadArray.maxPayloadSubLenSize) {
            if (payloadArray.payloadSubLength != NULL) {
                MEMFREE(payloadArray.payloadSubLength);
            }
            payloadArray.payloadSubLength = (PUINT32) MEMALLOC(payloadArray.payloadSubLenSize * SIZEOF(UINT32));
            payloadArray.maxPayloadSubLenSize = payloadArray.payloadSubLenSize;
        }

        // Second call with actual buffer to fill in data
        EXPECT_EQ(STATUS_SUCCESS,
                  createPayloadForH264(DEFAULT_MTU_SIZE, (PBYTE) payload, payloadLen, payloadArray.payloadBuffer, &payloadArray.payloadLength,
                                       payloadArray.payloadSubLength, &payloadArray.payloadSubLenSize));

        EXPECT_LT(0, payloadArray.payloadSubLenSize);

        offset = 0;

        for (i = 0; i < payloadArray.payloadSubLenSize; i++) {
            EXPECT_EQ(STATUS_SUCCESS,
                      depayH264FromRtpPayload(payloadArray.payloadBuffer + offset, payloadArray.payloadSubLength[i], NULL, &newPayloadSubLen,
                                              &isStartPacket));
            newPayloadLen += newPayloadSubLen;
            if (isStartPacket) {
                newPayloadLen -= SIZEOF(start4ByteCode);
            }
            EXPECT_LT(0, newPayloadSubLen);
            offset += payloadArray.payloadSubLength[i];
        }
        EXPECT_LE(newPayloadLen, payloadLen);

        offset = 0;
        newPayloadLen = 0;
        isStartPacket = FALSE;
        pCurPtrInPayload = payload;
        remainPayloadLen = payloadLen;
        for (i = 0; i < payloadArray.payloadSubLenSize; i++) {
            newPayloadSubLen = depayloadSize;
            EXPECT_EQ(STATUS_SUCCESS,
                      depayH264FromRtpPayload(payloadArray.payloadBuffer + offset, payloadArray.payloadSubLength[i], depayload, &newPayloadSubLen,
                                              &isStartPacket));
            if (isStartPacket) {
                EXPECT_EQ(STATUS_SUCCESS, getNextNaluLength(pCurPtrInPayload, remainPayloadLen, &startIndex, &naluLength));
                pCurPtrInPayload += startIndex;
                startLen = SIZEOF(start4ByteCode);
            } else {
                startLen = 0;
            }
            EXPECT_TRUE(MEMCMP(pCurPtrInPayload, depayload + startLen, newPayloadSubLen - startLen) == 0);
            pCurPtrInPayload += newPayloadSubLen - startLen;
            remainPayloadLen -= newPayloadSubLen;
            offset += payloadArray.payloadSubLength[i];
        }
    }

    MEMFREE(payloadArray.payloadBuffer);
    MEMFREE(payloadArray.payloadSubLength);
    MEMFREE(payload);
    MEMFREE(depayload);
}

TEST_F(RtpFunctionalityTest, packingUnpackingVerifySameOpusFrame)
{
    BYTE payload[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
    PBYTE depayload = (PBYTE) MEMALLOC(1500); // This is more than max mtu
    UINT32 depayloadSize = 1500;
    UINT32 payloadLen = 6;
    PayloadArray payloadArray;
    UINT32 newPayloadSubLen = 0;

    payloadArray.maxPayloadLength = 0;
    payloadArray.maxPayloadSubLenSize = 0;
    payloadArray.payloadBuffer = NULL;
    payloadArray.payloadSubLength = NULL;

    // First call for payload size and sub payload length size
    EXPECT_EQ(STATUS_SUCCESS,
              createPayloadForOpus(DEFAULT_MTU_SIZE, (PBYTE) &payload, payloadLen, NULL, &payloadArray.payloadLength, NULL,
                                   &payloadArray.payloadSubLenSize));

    if (payloadArray.payloadLength > payloadArray.maxPayloadLength) {
        if (payloadArray.payloadBuffer != NULL) {
            MEMFREE(payloadArray.payloadBuffer);
        }
        payloadArray.payloadBuffer = (PBYTE) MEMALLOC(payloadArray.payloadLength);
        payloadArray.maxPayloadLength = payloadArray.payloadLength;
    }
    if (payloadArray.payloadSubLenSize > payloadArray.maxPayloadSubLenSize) {
        if (payloadArray.payloadSubLength != NULL) {
            MEMFREE(payloadArray.payloadSubLength);
        }
        payloadArray.payloadSubLength = (PUINT32) MEMALLOC(payloadArray.payloadSubLenSize * SIZEOF(UINT32));
        payloadArray.maxPayloadSubLenSize = payloadArray.payloadSubLenSize;
    }

    // Second call with actual buffer to fill in data
    EXPECT_EQ(STATUS_SUCCESS,
              createPayloadForOpus(DEFAULT_MTU_SIZE, (PBYTE) &payload, payloadLen, payloadArray.payloadBuffer, &payloadArray.payloadLength,
                                   payloadArray.payloadSubLength, &payloadArray.payloadSubLenSize));

    EXPECT_EQ(1, payloadArray.payloadSubLenSize);
    EXPECT_EQ(6, payloadArray.payloadSubLength[0]);

    EXPECT_EQ(STATUS_SUCCESS, depayOpusFromRtpPayload(payloadArray.payloadBuffer, payloadArray.payloadSubLength[0], NULL, &newPayloadSubLen, NULL));
    EXPECT_EQ(6, newPayloadSubLen);

    newPayloadSubLen = depayloadSize;
    EXPECT_EQ(STATUS_SUCCESS,
              depayOpusFromRtpPayload(payloadArray.payloadBuffer, payloadArray.payloadSubLength[0], depayload, &newPayloadSubLen, NULL));
    EXPECT_TRUE(MEMCMP(payload, depayload, newPayloadSubLen) == 0);

    MEMFREE(payloadArray.payloadBuffer);
    MEMFREE(payloadArray.payloadSubLength);
    MEMFREE(depayload);
}

TEST_F(RtpFunctionalityTest, packingUnpackingVerifySameShortG711Frame)
{
    BYTE payload[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
    PBYTE depayload = (PBYTE) MEMALLOC(1500); // This is more than max mtu
    UINT32 depayloadSize = 1500;
    UINT32 payloadLen = 6;
    PayloadArray payloadArray;
    UINT32 newPayloadSubLen = 0;

    payloadArray.maxPayloadLength = 0;
    payloadArray.maxPayloadSubLenSize = 0;
    payloadArray.payloadBuffer = NULL;
    payloadArray.payloadSubLength = NULL;

    // First call for payload size and sub payload length size
    EXPECT_EQ(STATUS_SUCCESS,
              createPayloadForG711(DEFAULT_MTU_SIZE, (PBYTE) &payload, payloadLen, NULL, &payloadArray.payloadLength, NULL,
                                   &payloadArray.payloadSubLenSize));

    if (payloadArray.payloadLength > payloadArray.maxPayloadLength) {
        if (payloadArray.payloadBuffer != NULL) {
            MEMFREE(payloadArray.payloadBuffer);
        }
        payloadArray.payloadBuffer = (PBYTE) MEMALLOC(payloadArray.payloadLength);
        payloadArray.maxPayloadLength = payloadArray.payloadLength;
    }
    if (payloadArray.payloadSubLenSize > payloadArray.maxPayloadSubLenSize) {
        if (payloadArray.payloadSubLength != NULL) {
            MEMFREE(payloadArray.payloadSubLength);
        }
        payloadArray.payloadSubLength = (PUINT32) MEMALLOC(payloadArray.payloadSubLenSize * SIZEOF(UINT32));
        payloadArray.maxPayloadSubLenSize = payloadArray.payloadSubLenSize;
    }

    // Second call with actual buffer to fill in data
    EXPECT_EQ(STATUS_SUCCESS,
              createPayloadForG711(DEFAULT_MTU_SIZE, (PBYTE) &payload, payloadLen, payloadArray.payloadBuffer, &payloadArray.payloadLength,
                                   payloadArray.payloadSubLength, &payloadArray.payloadSubLenSize));

    EXPECT_EQ(1, payloadArray.payloadSubLenSize);
    EXPECT_EQ(6, payloadArray.payloadSubLength[0]);

    EXPECT_EQ(STATUS_SUCCESS, depayG711FromRtpPayload(payloadArray.payloadBuffer, payloadArray.payloadSubLength[0], NULL, &newPayloadSubLen, NULL));
    EXPECT_EQ(6, newPayloadSubLen);

    newPayloadSubLen = depayloadSize;
    EXPECT_EQ(STATUS_SUCCESS,
              depayG711FromRtpPayload(payloadArray.payloadBuffer, payloadArray.payloadSubLength[0], depayload, &newPayloadSubLen, NULL));
    EXPECT_TRUE(MEMCMP(payload, depayload, newPayloadSubLen) == 0);

    MEMFREE(payloadArray.payloadBuffer);
    MEMFREE(payloadArray.payloadSubLength);
    MEMFREE(depayload);
}

TEST_F(RtpFunctionalityTest, packingUnpackingVerifySameLongG711Frame)
{
    BYTE payload[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
    PBYTE depayload = (PBYTE) MEMALLOC(1500); // This is more than max mtu
    UINT32 depayloadSize = 1500;
    UINT32 payloadLen = 10;
    PayloadArray payloadArray;
    UINT32 i = 0;
    UINT32 newPayloadSubLen = 0;
    UINT32 newPayloadLen = 0;
    UINT32 offset = 0;
    PBYTE pCurPtrInPayload;

    payloadArray.maxPayloadLength = 0;
    payloadArray.maxPayloadSubLenSize = 0;
    payloadArray.payloadBuffer = NULL;
    payloadArray.payloadSubLength = NULL;

    // First call for payload size and sub payload length size
    EXPECT_EQ(STATUS_SUCCESS,
              createPayloadForG711(4, (PBYTE) &payload, payloadLen, NULL, &payloadArray.payloadLength, NULL, &payloadArray.payloadSubLenSize));

    if (payloadArray.payloadLength > payloadArray.maxPayloadLength) {
        if (payloadArray.payloadBuffer != NULL) {
            MEMFREE(payloadArray.payloadBuffer);
        }
        payloadArray.payloadBuffer = (PBYTE) MEMALLOC(payloadArray.payloadLength);
        payloadArray.maxPayloadLength = payloadArray.payloadLength;
    }
    if (payloadArray.payloadSubLenSize > payloadArray.maxPayloadSubLenSize) {
        if (payloadArray.payloadSubLength != NULL) {
            MEMFREE(payloadArray.payloadSubLength);
        }
        payloadArray.payloadSubLength = (PUINT32) MEMALLOC(payloadArray.payloadSubLenSize * SIZEOF(UINT32));
        payloadArray.maxPayloadSubLenSize = payloadArray.payloadSubLenSize;
    }

    // Second call with actual buffer to fill in data
    EXPECT_EQ(STATUS_SUCCESS,
              createPayloadForG711(4, (PBYTE) &payload, payloadLen, payloadArray.payloadBuffer, &payloadArray.payloadLength,
                                   payloadArray.payloadSubLength, &payloadArray.payloadSubLenSize));

    EXPECT_EQ(3, payloadArray.payloadSubLenSize);
    EXPECT_EQ(4, payloadArray.payloadSubLength[0]);
    EXPECT_EQ(4, payloadArray.payloadSubLength[1]);
    EXPECT_EQ(2, payloadArray.payloadSubLength[2]);

    offset = 0;

    for (i = 0; i < payloadArray.payloadSubLenSize; i++) {
        EXPECT_EQ(STATUS_SUCCESS,
                  depayG711FromRtpPayload(payloadArray.payloadBuffer + offset, payloadArray.payloadSubLength[i], NULL, &newPayloadSubLen, NULL));
        newPayloadLen += newPayloadSubLen;
        EXPECT_LT(0, newPayloadSubLen);
        offset += payloadArray.payloadSubLength[i];
    }
    EXPECT_EQ(newPayloadLen, payloadLen);

    offset = 0;
    pCurPtrInPayload = payload;
    for (i = 0; i < payloadArray.payloadSubLenSize; i++) {
        newPayloadSubLen = depayloadSize;
        EXPECT_EQ(STATUS_SUCCESS,
                  depayG711FromRtpPayload(payloadArray.payloadBuffer + offset, payloadArray.payloadSubLength[i], depayload, &newPayloadSubLen, NULL));
        EXPECT_TRUE(MEMCMP(pCurPtrInPayload, depayload, newPayloadSubLen) == 0);
        pCurPtrInPayload += newPayloadSubLen;
        offset += payloadArray.payloadSubLength[i];
    }

    MEMFREE(payloadArray.payloadBuffer);
    MEMFREE(payloadArray.payloadSubLength);
    MEMFREE(depayload);
}

TEST_F(RtpFunctionalityTest, invalidNaluParse)
{
    BYTE data[] = {0x01, 0x00, 0x02};
    BYTE data1[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02};
    UINT32 startIndex = 0, naluLength = 0;
    EXPECT_EQ(STATUS_RTP_INVALID_NALU, getNextNaluLength(data, 3, &startIndex, &naluLength));
    EXPECT_EQ(STATUS_RTP_INVALID_NALU, getNextNaluLength(data1, 7, &startIndex, &naluLength));
}

TEST_F(RtpFunctionalityTest, validNaluParse)
{
    BYTE data[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x02};
    UINT32 startIndex = 0, naluLength = 0;
    EXPECT_EQ(STATUS_SUCCESS, getNextNaluLength(data, 6, &startIndex, &naluLength));
    EXPECT_EQ(4, startIndex);
    EXPECT_EQ(2, naluLength);
}

TEST_F(RtpFunctionalityTest, validMultipleNaluParse)
{
    BYTE nalus[] = {0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x0b, 0x0c};
    UINT32 startIndex = 0, naluLength = 0;
    UINT32 nalusLength = 13;
    EXPECT_EQ(STATUS_SUCCESS, getNextNaluLength(nalus, nalusLength, &startIndex, &naluLength));
    EXPECT_EQ(4, startIndex);
    EXPECT_EQ(2, naluLength);
    EXPECT_EQ(STATUS_SUCCESS, getNextNaluLength(&nalus[startIndex + naluLength], nalusLength - startIndex - naluLength, &startIndex, &naluLength));
    EXPECT_EQ(4, startIndex);
    EXPECT_EQ(3, naluLength);
}

TEST_F(RtpFunctionalityTest, trailingZerosWouldBeReturned)
{
    BYTE nalus[] = {0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
    UINT32 startIndex = 0, naluLength = 0;
    UINT32 nalusLength = 11;
    EXPECT_EQ(STATUS_SUCCESS, getNextNaluLength(nalus, nalusLength, &startIndex, &naluLength));
    EXPECT_EQ(4, startIndex);
    EXPECT_EQ(7, naluLength);
}

// https://tools.ietf.org/html/rfc3550#section-5.3.1
TEST_F(RtpFunctionalityTest, createPacketWithExtension)
{
    BYTE payload[10] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
    BYTE extpayload[8] = {0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49};
    BYTE rawbytes[1024] = {0};
    PBYTE ptr = reinterpret_cast<PBYTE>(&rawbytes);
    PRtpPacket pRtpPacket = NULL;
    PRtpPacket pRtpPacket2 = NULL;

    EXPECT_EQ(STATUS_SUCCESS,
              createRtpPacket(2, FALSE, TRUE, 0, FALSE, 96, 42, 100, 0x1234ABCD, NULL, 0x4243, 8, extpayload, payload, 10, &pRtpPacket));
    EXPECT_EQ(STATUS_SUCCESS, setBytesFromRtpPacket(pRtpPacket, ptr, 1024));

    auto len = RTP_GET_RAW_PACKET_SIZE(pRtpPacket);
    EXPECT_EQ(STATUS_SUCCESS, createRtpPacketFromBytes(ptr, len, &pRtpPacket2));
    EXPECT_TRUE(pRtpPacket2->header.extension);
    EXPECT_EQ(0x4243, pRtpPacket2->header.extensionProfile);
    EXPECT_EQ(0x44, pRtpPacket2->header.extensionPayload[2]);
    EXPECT_EQ(0x15, pRtpPacket2->payload[5]);
    freeRtpPacket(&pRtpPacket);
    pRtpPacket2->pRawPacket = NULL;
    freeRtpPacket(&pRtpPacket2);
}

TEST_F(RtpFunctionalityTest, twccPayload)
{
    UINT32 extpayload = TWCC_PAYLOAD(4u, 420u);
    auto ptr = reinterpret_cast<PBYTE>(&extpayload);
    auto seqNum = TWCC_SEQNUM(ptr);
    EXPECT_EQ(4, (ptr[0] >> 4));
    EXPECT_EQ(1, (ptr[0] & 0xfu));
    EXPECT_EQ(420, seqNum);
    EXPECT_EQ(0, ptr[3]);
}

} // namespace webrtcclient
} // namespace video
} // namespace kinesis
} // namespace amazonaws
} // namespace com


text:
package com.spreadsheet.calculator.utils;

import java.util.regex.Pattern;

/**
 * Utility class with helper methods.
 *
 * @author asif
 *
 */
public class Utils {

	/**
	 * Regex represents pattern with one or more spaces.
	 */
	public static final Pattern spaceDelimiterRegex = Pattern.compile("\\s+");

	public static String[] parseContent(final String string) {
		return spaceDelimiterRegex.split(string);
	}
}


text:
require 'spec_helper'

describe Balanced::Marketplace, :vcr do
  before do
    api_key = Balanced::ApiKey.new.save
    Balanced.configure api_key.secret
    @marketplace = Balanced::Marketplace.new.save
  end

  describe 'marketplace', :vcr do
    it 'should be a Balanced::Marketplace' do
      @marketplace.should be_instance_of Balanced::Marketplace
    end

    it 'should conform to application/vnd.api+json' do
      @marketplace.id.should_not be_nil
      @marketplace.href.should_not be_nil
      @marketplace.links.should be_instance_of Hash
    end

    it '#href' do
      @marketplace.href.should match(/\/marketplaces\/TEST-MP\w{21,23}/)
    end

    it '#bank_accounts' do
      @marketplace.bank_accounts.should be_instance_of Balanced::Pager
      @marketplace.bank_accounts.href.should eql '/bank_accounts'
    end

    it '#owner_customer' do
      @marketplace.owner_customer.should be_instance_of Balanced::Customer
    end

    it '#meta' do
      @marketplace.meta.should be_instance_of Hash
    end

  end

end


text:
<?php

namespace WyriHaximus\React\Tests\AsyncInteropLoop;

use AsyncInterop\Loop;
use React\EventLoop\LibEvLoop;
use WyriHaximus\React\AsyncInteropLoop\AsyncInteropLoop;
use WyriHaximus\React\AsyncInteropLoop\ReactDriverFactory;

class AsyncInteropLibEvLoopTest extends AbstractLoopTestCase
{
    public function createLoop()
    {
        if (!class_exists('libev\EventLoop', false)) {
            $this->markTestSkipped();
        }
        Loop::setFactory(ReactDriverFactory::createFactoryFromLoop(LibEvLoop::class));
        return new AsyncInteropLoop();
    }
}


text:
package org.michaelevans.aftermath;

import android.content.Intent;
import android.util.Log;

import java.util.LinkedHashMap;
import java.util.Map;

public final class Aftermath {

    public static final String SUFFIX = "$$Aftermath";
    public static final String ANDROID_PREFIX = "android.";
    public static final String JAVA_PREFIX = "java.";
    private static final String TAG = "Aftermath";
    private static final IOnActivityForResult<Object> NO_OP = null;
    private static boolean debug = false;
    private static final Map<Class<?>, IOnActivityForResult<Object>> AFTERMATHS = new LinkedHashMap<>();

    public static void onActivityResult(Object target, int requestCode, int resultCode, Intent data) {
        Class<?> targetClass = target.getClass();
        if (debug) {
            Log.d(TAG, "Looking up aftermath for " + targetClass.getName());
        }
        IOnActivityForResult<Object> aftermath = findActivityForResultForClass(targetClass);
        if (aftermath != NO_OP) {
            aftermath.onActivityResult(target, requestCode, resultCode, data);
        }
    }

    /**
     * Searches for $$Aftermath class for the given instance, cached for efficiency.
     *
     * @param cls Source class to find a matching $$Aftermath class for
     * @return $$Aftermath class instance
     */
    private static IOnActivityForResult<Object> findActivityForResultForClass(Class<?> cls) {
        IOnActivityForResult<Object> aftermath = AFTERMATHS.get(cls);
        if (aftermath != null) {
            if (debug) Log.d(TAG, "HIT: Cached in aftermath map.");
            return aftermath;
        }
        String clsName = cls.getName();
        if (clsName.startsWith(ANDROID_PREFIX) || clsName.startsWith(JAVA_PREFIX)) {
            if (debug) {
                Log.d(TAG, "MISS: Reached framework class. Abandoning search.");
            }
            return NO_OP;
        }
        //noinspection TryWithIdenticalCatches
        try {
            Class<?> aftermathClass = Class.forName(clsName + SUFFIX);
            //noinspection unchecked
            aftermath = (IOnActivityForResult<Object>) aftermathClass.newInstance();
            if (debug) {
                Log.d(TAG, "HIT: Class loaded aftermath class.");
            }
        } catch (ClassNotFoundException e) {
            if (debug) {
                Log.d(TAG, "Not found. Trying superclass " + cls.getSuperclass().getName());
            }
            aftermath = findActivityForResultForClass(cls.getSuperclass());
        } catch (InstantiationException e) {
            Log.e(TAG, e.getMessage());
        } catch (IllegalAccessException e) {
            Log.e(TAG, e.getMessage());
        }
        AFTERMATHS.put(cls, aftermath);
        return aftermath;
    }

}


text:
import pytest

asdf = pytest.importorskip('asdf')

from asdf.tests.helpers import assert_roundtrip_tree  # noqa: E402

import astropy.units as u  # noqa: E402
from astropy.coordinates import Angle, Latitude, Longitude  # noqa: E402

def test_angle(tmpdir):
    tree = {'angle': Angle(100, u.deg)}
    assert_roundtrip_tree(tree, tmpdir)

def test_latitude(tmpdir):
    tree = {'angle': Latitude(10, u.deg)}
    assert_roundtrip_tree(tree, tmpdir)

def test_longitude(tmpdir):
    tree = {'angle': Longitude(-100, u.deg, wrap_angle=180*u.deg)}
    assert_roundtrip_tree(tree, tmpdir)


text:
package com.lazy.st.db.jdbc;

public class Const {
    public static final String DB_DRIVER_CLSNAME = "com.mysql.jdbc.Driver";
    public static final String DB_URL = "jdbc:mysql://localhost:3306/stock?useUnicode=true&characterEncoding=UTF8";
    public static final String DB_USER = "stock";
    public static final String DB_PASSWD = "xxx";
}


text:
namespace message_center {

class MessageCenterNotificationManagerTest : public testing::Test {
 protected:
  MessageCenterNotificationManagerTest() {
    MessageCenterNotificationManager::RegisterPrefs(local_state_.registry());
  }

  virtual void SetUp() {
    // Clear the preference and initialize.
    local_state_.ClearPref(prefs::kMessageCenterShowedFirstRunBalloon);
    first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon,
                         &local_state_);

    // Get ourselves a run loop.
    run_loop_.reset(new base::RunLoop());

    // Initialize message center infrastructure with mock tray delegate.
    MessageCenter::Initialize();
    message_center_ = MessageCenter::Get();
    scoped_ptr<NotifierSettingsProvider> settings_provider(
        new FakeNotifierSettingsProvider(notifiers_));
    notification_manager_.reset(new MessageCenterNotificationManager(
        message_center_, &local_state_, settings_provider.Pass()));
    delegate_ = new FakeMessageCenterTrayDelegate(message_center_,
                                                  run_loop_->QuitClosure());
    notification_manager_->SetMessageCenterTrayDelegateForTest(delegate_);
    notification_manager_->SetFirstRunTimeoutForTest(
        TestTimeouts::tiny_timeout());
  }

  virtual void TearDown() {
    run_loop_.reset();
    notification_manager_.reset();
    MessageCenter::Shutdown();
  }

  MessageCenterNotificationManager* notification_manager() {
    return notification_manager_.get();
  }

  FakeMessageCenterTrayDelegate* delegate() { return delegate_; }

  MessageCenter* message_center() { return message_center_; }

  const ::Notification GetANotification(const std::string& id) {
    return ::Notification(GURL(),
                          GURL(),
                          base::string16(),
                          base::string16(),
                          blink::WebTextDirectionDefault,
                          base::string16(),
                          base::string16(),
                          new MockNotificationDelegate(id));
  }

  base::RunLoop* run_loop() { return run_loop_.get(); }
  const TestingPrefServiceSimple& local_state() { return local_state_; }
  bool DidFirstRunPref() { return first_run_pref_.GetValue(); }

 private:
  scoped_ptr<base::RunLoop> run_loop_;
  TestingPrefServiceSimple local_state_;
  MessageCenter* message_center_;
  std::vector<Notifier*> notifiers_;
  scoped_ptr<MessageCenterNotificationManager> notification_manager_;
  FakeMessageCenterTrayDelegate* delegate_;
  content::TestBrowserThreadBundle thread_bundle_;
  BooleanPrefMember first_run_pref_;
};

TEST_F(MessageCenterNotificationManagerTest, SetupNotificationManager) {
  TestingProfile profile;
  notification_manager()->Add(GetANotification("test"), &profile);
  EXPECT_FALSE(DidFirstRunPref());
}

// The following tests test the first run balloon, which is only implemented for
// Windows.
TEST_F(MessageCenterNotificationManagerTest, FirstRunShown) {
  TestingProfile profile;
  notification_manager()->Add(GetANotification("test"), &profile);
  message_center()->DisplayedNotification(
      "test", message_center::DISPLAY_SOURCE_MESSAGE_CENTER);
  message_center()->MarkSinglePopupAsShown("test", false);

  run_loop()->Run();
  base::RunLoop run_loop_2;
  run_loop_2.RunUntilIdle();
  EXPECT_TRUE(delegate()->displayed_first_run_balloon());
  EXPECT_TRUE(DidFirstRunPref());
}

TEST_F(MessageCenterNotificationManagerTest,
       FirstRunNotShownWithPopupsVisible) {
  TestingProfile profile;
  notification_manager()->Add(GetANotification("test"), &profile);
  message_center()->DisplayedNotification(
      "test", message_center::DISPLAY_SOURCE_MESSAGE_CENTER);
  run_loop()->RunUntilIdle();
  EXPECT_FALSE(delegate()->displayed_first_run_balloon());
  EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive());
  EXPECT_FALSE(DidFirstRunPref());
}

TEST_F(MessageCenterNotificationManagerTest,
       FirstRunNotShownWithMessageCenter) {
  TestingProfile profile;
  notification_manager()->Add(GetANotification("test"), &profile);
  message_center()->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER);
  run_loop()->RunUntilIdle();
  EXPECT_FALSE(notification_manager()->FirstRunTimerIsActive());
  EXPECT_FALSE(DidFirstRunPref());
}
}  // namespace message_center


text:
DEVSOLPY

Proyectos

Conozca un poco mas acerca de nuestros proyectos

Productos

Acceda a demostraciones en linea de nuestros Produtos en Produccion

Servicios

No es necesario que cuente con una infraestructura, nos adaptamos a su empresa

Clientes

Definitivamente nuestros clientes nos aman, compruebelo usted mismo


text:
function woof_init_select_hierarchy() {

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Option: rename.exclude_directory_pattern</title>
<link href="css/screen.css" rel="stylesheet" type="text/css" />

Option: rename.exclude_directory_pattern

This option can be used to exclude all directory names matching the specified regexp pattern.

Example of usage in the config.php file:

$mcFileManagerConfig['rename.exclude_directory_pattern'] = "/^notthis$|^notthat$/i";

Example of usage in a mc_access file:

rename.exclude_directory_pattern=/^notthis$|^notthat$/i

Help index

Copyright © 2005-2006 Moxiecode Systems AB


text:
use strict;

# This is a short example that basically does the same
# thing as the default file system access method

# This will index only one directory (the current directory)
# See the more advanced example DirTree.pl in the swish-e prog-bin directory.

my $dir = '.';
opendir D, $dir or die $!;
while ( $_ = readdir D   ) {
    next unless /\.htm$/;
    my ( $size, $mtime )  = (stat "$dir/$_" )[7,9];
    open FH, "$dir/$_" or die "$! on $dir/$_";

    print <<EOF;
Content-Length: $size
Last-Mtime: $mtime
Path-Name: $dir/$_

EOF
    print <FH>;
}


text:
/* jshint expr: true */
//var utils = require('./utils');
var username= 'mem.staging+amit1.varma1@gmail.com';
var password = '123456';

module.exports = {
  tags: ['google'],
  'test' : function (client) {
    client

      .url('http://enterprise-test.monotype.com')
      .pause(3000)
      client.expect.element('body').to.be.present;
      client.maximizeWindow()
      .waitForElementPresent('.js-login', 1000)
      .click('.js-login')
      .pause(1000)
	//wait to open loign popup.
//	.waitForElementVisible(elementTags['email-input-field'],3000)
	.setValue('#UserName', username)// enter email to the email input field
	.setValue('#LoginPassword', password)//enter password to the password input field
	.click('#login_button_for_portal')// click on sign in button
	// wait for dashboard page
    .pause(6000)
	.waitForElementVisible('.browseFonts', 3000) // wait for element browse font
    .getText('.browseFonts', function (result) {
           result.value.match('Browse fonts')?console.log('correct'):Console('error');
						})
     .pause(5000)
	 //client.url('http://enterprise-test.monotype.com/en/family/monotype/kairos');

      .waitForElementPresent('#leftsidebar-fontlist-list>li:nth-child(1)',3000)
		.click('#leftsidebar-fontlist-list>li:nth-child(1)')
		.pause(5000)
		.waitForElementPresent('.edit-list.js-edit-list.button.button--edit',3000)

		// data object for settings button on DOM
		.expect.element('.edit-list.js-edit-list.button.button--edit').to.have.Attribute('class').which.equals('edit-list')
		.expect.element('.edit-list.js-edit-list.button.button--edit').to.have.Attribute('class').which.equals('js-edit-list')
		.expect.element('.edit-list.js-edit-list.button.button--edit').to.have.Attribute('class').which.equals('button-edit')
    	.expect.element('.edit-list.js-edit-list.button.button--edit').to.have.Attribute('rel').which.equals('#edit-list')
		.expect.element('.edit-list.js-edit-list.button.button--edit').to.have.Attribute('role').which.equals('link')
/*

		// Data object for settings button on Css Data

		browser.expect.element('.button.button--edit:hover').to.have.css('background').which.equals('#f35736')
		browser.expect.element('.button.button--edit:hover').to.have.css('border-color').which.equals('#f35736')
		browser.expect.element('.button.button--edit:hover').to.have.css('color').which.equals('#fff')
*/

     },

};


text:
[![Build Status](https://travis-ci.org/JoshCheek/thread_order.svg)](https://travis-ci.org/JoshCheek/thread_order)

ThreadOrder
===========

A tool for testing threaded code.
Its purpose is to enable reasoning about thread order.

* Tested on 1.8.7 - 2.6, JRuby, Rbx
* It has no external dependencies
* It does not depend on the stdlib.

Example
-------

```ruby
# A somewhat contrived class we're going to test.
class MyQueue
  attr_reader :array

  def initialize
    @array, @mutex = [], Mutex.new
  end

  def enqueue
    @mutex.synchronize { @array << yield }
  end
end

require 'rspec/autorun'
require 'thread_order'

RSpec.describe MyQueue do
  let(:queue) { described_class.new }
  let(:order) { ThreadOrder.new }
  after { order.apocalypse! } # ensure everything gets cleaned up (technically redundant for our one example, but it's a good practice)

  it 'is threadsafe on enqueue' do
    # will execute in a thread, can be invoked by name
    order.declare :concurrent_enqueue do
      queue.enqueue { :concurrent }
    end

    # this enqueue will block until the mutex puts the other one to sleep
    queue.enqueue do
      order.pass_to :concurrent_enqueue, resume_on: :sleep
      :main
    end

    order.join_all # concurrent_enqueue may still be asleep
    expect(queue.array).to eq [:main, :concurrent]
  end
end

# >> MyQueue
# >>   is threadsafe on enqueue
# >>
# >> Finished in 0.00131 seconds (files took 0.08687 seconds to load)
# >> 1 example, 0 failures
```


text:
date: 2013-10-30
layout: post
title: "Uncloud your Life"
published: true
url: /2013/10/30/uncloud-your-life.html
---

There has been a lot of talk lately about privacy in the cloud and owning
your own data. I'm not linking any articles here, since there are so many
and I don't think anyone has missed it. However it spurred a new and awesome
debate about hosting your own applications and thinking about where your data
is stored and who manages it. I have thought about writing this for a while
and always felt there wasn't enough to write about. But in the spirit of
sharing and getting back into writing I decided to do it nonetheless.

The setup I'm describing has grown pretty organically and is heavily based on
what I use and how I work everyday. This is also probably a bit too technical
to be considered a general purpose manual. But that will have to do for now. I
am also a heavy FreeBSD user, as it makes a lot of things easier and more
enjoyable for me. So my setup is also very biased towards that.

### Email
Maybe one of the most important parts is email. I switched from hosted email
providers to self hosted (first on a friend's server) in 2005, when the 12MB
Inbox I had wasn't big enough anymore and before GMail was widely available in
Germany (at least I only knew one person with a GMail account back then). So
nothing has changed for me there. I also think email is considered to be one
of the more painful things to self host although I don't think this is true. I
run a setup based on [FreeBSD][freebsd], [sendmail][sendmail] and the [Dovecot
IMAP server][dovecot] which is not very complicated to set up. Especially the
FreeBSD/sendmail part literally takes 10 minutes. I don't really run spam
filtering since it hasn't been a problem (I do filter some known spam
addresses in my procmail rules though). I read my email in [mutt][mutt] on the
laptop where it is synced with [offlineimap][offlineimap] and also run mutt in
a tmux session on my mailserver to access it from anywhere. On iOS devices I
use the built-in Mail application and have come to love [Triage][triage] for
quickly going through email when I have a minute.

### Calendars and Contacts
Another very important aspect of my daily synced data are calendars and
contacts. Especially with the iPhone and iPad being in constant use, I want
that data to be synced everywhere. I used to use iCloud for that and it works
beautifully and I wanted something which works equally flawless. After some
trial and error I found [ownCloud][owncloud] which provides CalDav and CardDav
services as well as general WebDAV. The setup guides are really good and
include most of the common clients. I nevertheless ran into some problems
with the initial setup on iOS and OSX clients because of when and where they
expect slashes or protocol headers. However this is a
configuration/documentation issue, which is annoying but can be solved.

### File sync
I used to use [Dropbox][dropbox] a lot. I loved the simplicity and being able
to have files in sync everywhere. I even put my git repos in there at some
point so I could continue working from every computer I used. With time I used
it less and less as I simplified my workflows a lot but it was still important
to have a proper file sync solution, mostly for convenince options like
syncing [Alfred][alfred] preferences. But I wanted to get all my documents out
of a location that somebody else had under control. Thankfully ownCloud also
comes with a client to sync the WebDAV directory between computers. So I
basically set that up and copied everything over from Dropbox. It has been
working really well so far, though I don't have heavy requirements for syncing
and files in there don't change that often.

### GTD/Todo tracking
I track everything in [OmniFocus][omnifocus]. Literally. Work stuff, personal
stuff, movies I want to watch, books I want to read, it pulls in GitHub issues
and Jira tickets that are assigned to me, I plan blog posts I want to write
and talks I want to give in there. I extensively use custom perspectives to
get data out. It's safe to say that it's an important piece of software for
me. Luckily Omni products support syncing via WebDAV and have been for a
while. Thus it was very easy to switch from the hosted Omni Sync Server, which
works flawlessly, to just use WebDAV endpoint of ownCloud. I have since also
looked around to find out if there are alternatives to OmniFocus if I ever
wanted to switch away from OSX. Sadly it seems to be that self hosting is
rarely an option for any app and I have only found a handful that even
provided a synchronisation mechanism that does not involve DropBox, Apple or
their own cloud sync solution.

### Note taking
Note taking was also an important part that had to continue to work for me. I
don't take a lot of notes all the time. But when I need to jot something down,
it must not matter whether I'm on my phone or in VIM on my laptop. I was a
very happy [Simplenote][simplenote] customer and still think it's the best
cloud based note taking platform there is. I even wrote a [VIM
plugin][simplenote.vim] for it so I'd never have to leave my trusty editor.
This also meant a solution that would replace it needed a decent iOS client,
notes I can access from VIM, support for Markdown and a syncing engine that is
ideally based on WebDAV, since I was already running that. And after some
searching I actually found this unicorn of note taking solutions. It's simply
called [Notebooks][notebooks] and it's a simple app that displays the folders
and files in a WebDav directory, let's you edit text files and view them in
Markdown mode. And even take and attach pictures. It comes as a Universal App
for iPhone and iPad and has an OSX client in a beta version, which I don't use
because I can just edit all the files in VIM. Which makes me very happy.

### Password syncing
The only application I haven't found a satisfying self hosted solution yet is
password syncing. I use [1Password][1password] and am very happy with it.
However the only non-LAN solutions for syncing that it provides are Dropbox
and iCloud. So I switched to Wi-fi sync for my passwords. It's not ideal and
there will come a point where I am on my iPad and don't have a password there
and am too lazy to open the laptop to sync. However since all passwords for
my crucial services are already synced this won't be the end of the world and
can very likely wait until I am on a nother device or have both the laptop and
the iPad open. So I'm not 100% happy with it but it is one of those "good
enough" solutions.

### IRC and Instant Messaging
Being able to idle on IRC and have a proper chat client at hand everywhere has
always been important to me and for that I have run terminal based clients in
a screen or tmux session for years now. Since I (similarly to email) never
used any of the cloud based solutions, I was already running [ZNC][znc] and
[Bitlbee][bitlbee]. And since the changes in GTalk earlier this year which
broke a lot of stuff for me, I also already had a [Jabber account][jabber]
which I was using for chat and OTR.

### Backup
How to handle backups was one of the bigger concerns I had. Now that I would
be hosting all my data I needed a proper plan so when one of my servers dies
I'm not losing everything that was on there. Like probably almost every Mac
user, I used to use [Arq][arq] to backup my laptop to an encrypted S3 bucket.
However that was only ever the client side. And I was happy with it because
it included my mail folder and thus I had a backup of my email. And when I
stopped using that to not push all my date to S3 I also didn't backup my email
anymore. After some thought it was clear to me that I wanted to have a backup
in a location with as much control as possible. I decided to buy an [HP
Microserver][microserver] and put it in my apartment. It runs FreeBSD
(surprise!) and has a 2x2TB encrypted ZFS RAID. The backup location for each
of my machines on that RAID is an independent filesystem so I can snapshot it
regularly and go back in time if I have to. The server pulls in data from my
servers via rsync and that's how I do backups. It's less automated than I want
it to be right now and I still have to configure it to server as a TimeMachine
destination for my laptop. But this is already a pretty good solution for me.

### Where I still use the cloud
I've extensively talked about how I moved my data into self hosted
applications and what I use for those use cases. However that doesn't mean
that I'm completely free of cloud based applications. Obviously there are a
variety of applications that don't support this yet or where it's not even
something that would work without changing the product a lot. That means I
still use Dropbox to sync [Papers][papers] or automatically pull in pictures
from Instagram. Since Google Reader died I switched to [Feedbin][feedbin] and
have no intention to stop using it, I have my Kindle books at Amazon, my music
in the iTunes Cloud, I use a variety of infrastructure software as a service
to [monitor my servers][monitoring] and I run my [public image
sharing][imagesharing] and [custom URL shortener][katana] on S3 and Heroku and
this blog on GitHub Pages. The difference for me is, that most of this data I
don't necessarily regard as private as the ones I pulled into my own hosting.
I will probably experiment with how I can do some of this on my own in the
future, but it is less important to me right now.

### Why are you telling me all this?
As I said in the first section, this is not considered a manual of how to host
your own data. While I try to keep my [Chef cookbooks][cookbooks] for this
stuff up to date, they are very custom tailored and probably not of great use
for everybody. If you want to get started and host your own data, I highly
recommend checking out [Alex Payne's Sovereign Project][sovereign]. It's an
Ansible project which installs a lot of the things I've been talking about
here and is definitely much easier to get started with. I do hope though I was
able to share some ideas and make hosting your own data sound a little less
scary.

I also realize that even with an easy to get started guide and a collection of
Chef recipes this is not something every person can run and you need some
understanding of (and tolerance for) running your own services. There has been
some work going on for some time to make it easier to host your own services
and even have decentralized applications. The newest one I am aware of is
called [Grand Decentral Station][decentralize] and looks very promising. I
would love to see some of these ideas flourish and be pushed forward. And
maybe have a future in which we can not only pay people to run services for
us, but also to develop services we can run ourselves as easy as it is to set
up a TV or a Roomba today.

[sovereign]: https://github.com/al3x/sovereign
[omnifocus]: http://www.omnigroup.com/omnifocus
[freebsd]: http://www.freebsd.org
[sendmail]: http://www.sendmail.com/sm/open_source/
[mutt]: http://www.mutt.org
[dovecot]: http://www.dovecot.org
[triage]: http://www.triage.cc
[owncloud]: http://owncloud.org
[offlineimap]: http://offlineimap.org
[dropbox]: http://dropbox.com
[alfred]: http://www.alfredapp.com
[simplenote]: http://simplenote.com
[simplenote.vim]: https://github.com/mrtazz/simplenote.vim
[notebooks]: http://www.notebooksapp.com
[papers]: http://www.papersapp.com
[1password]: https://agilebits.com/onepassword
[arq]: http://www.haystacksoftware.com/arq/
[microserver]: http://www8.hp.com/us/en/products/proliant-servers/product-detail.html?oid=5336619#!tab=features
[feedbin]: https://feedbin.me
[monitoring]: http://www.unwiredcouch.com/2012/09/15/getting-started-with-monitoring.html
[cookbooks]: https://github.com/mrtazz/cookbooks
[jabber]: http://web.jabber.ccc.de
[znc]: http://wiki.znc.in/ZNC
[bitlbee]: http://www.bitlbee.org/main.php/news.r.html
[decentralize]: http://decentralize.it
[imagesharing]: https://github.com/roidrage/s3itch
[katana]: https://github.com/mrtazz/katana


text:
<?xml version="1.1" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.taberstorm.taberstorch" >
    <uses-permission android:name="android.permission.CAMERA"/>
    <!--<uses-feature android:name="android.hardware.Camera" android:required="true"/>-->

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".FlashLight"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.osconfig.v1beta.model;

/**
 * Represents a single yum package repository. These will be added to a repo file that will be
 * managed at /etc/yum.repos.d/google_osconfig.repo.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud OS Config API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class RepositoryResourceYumRepository extends com.google.api.client.json.GenericJson {

  /**
   * The location of the repository directory.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String baseUrl;

  /**
   * The display name of the repository.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String displayName;

  /**
   * URIs of GPG keys.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<java.lang.String> gpgKeys;

  /**
   * A one word, unique name for this repository. This will be the `repo id` in the yum config file
   * and also the `display_name` if `display_name` is omitted. This id is also used as the unique
   * identifier when checking for resource conflicts.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String id;

  /**
   * The location of the repository directory.
   * @return value or {@code null} for none
   */
  public java.lang.String getBaseUrl() {
    return baseUrl;
  }

  /**
   * The location of the repository directory.
   * @param baseUrl baseUrl or {@code null} for none
   */
  public RepositoryResourceYumRepository setBaseUrl(java.lang.String baseUrl) {
    this.baseUrl = baseUrl;
    return this;
  }

  /**
   * The display name of the repository.
   * @return value or {@code null} for none
   */
  public java.lang.String getDisplayName() {
    return displayName;
  }

  /**
   * The display name of the repository.
   * @param displayName displayName or {@code null} for none
   */
  public RepositoryResourceYumRepository setDisplayName(java.lang.String displayName) {
    this.displayName = displayName;
    return this;
  }

  /**
   * URIs of GPG keys.
   * @return value or {@code null} for none
   */
  public java.util.List<java.lang.String> getGpgKeys() {
    return gpgKeys;
  }

  /**
   * URIs of GPG keys.
   * @param gpgKeys gpgKeys or {@code null} for none
   */
  public RepositoryResourceYumRepository setGpgKeys(java.util.List<java.lang.String> gpgKeys) {
    this.gpgKeys = gpgKeys;
    return this;
  }

  /**
   * A one word, unique name for this repository. This will be the `repo id` in the yum config file
   * and also the `display_name` if `display_name` is omitted. This id is also used as the unique
   * identifier when checking for resource conflicts.
   * @return value or {@code null} for none
   */
  public java.lang.String getId() {
    return id;
  }

  /**
   * A one word, unique name for this repository. This will be the `repo id` in the yum config file
   * and also the `display_name` if `display_name` is omitted. This id is also used as the unique
   * identifier when checking for resource conflicts.
   * @param id id or {@code null} for none
   */
  public RepositoryResourceYumRepository setId(java.lang.String id) {
    this.id = id;
    return this;
  }

  @Override
  public RepositoryResourceYumRepository set(String fieldName, Object value) {
    return (RepositoryResourceYumRepository) super.set(fieldName, value);
  }

  @Override
  public RepositoryResourceYumRepository clone() {
    return (RepositoryResourceYumRepository) super.clone();
  }

}


text:
Magic Commands
=======

.. autoclass:: cactusbot.commands.command.Command
    :members:


text:
require 'rails_helper'

RSpec.describe Support::Ticket, :type => :model do
  describe '.visible_for' do
    let(:user){create :user}
    let(:ticket_when_user_is_owner){create :ticket, user: user}
    let(:ticket_assigned_to_user){create :ticket, assigned_to: user}
    let(:other_ticket){create :ticket}

    before(:each){ticket_when_user_is_owner; ticket_assigned_to_user; other_ticket}

    subject{Support::Ticket.visible_for(user)}

    it{is_expected.to include ticket_when_user_is_owner}
    it{is_expected.to include ticket_assigned_to_user}
    it{is_expected.not_to include other_ticket}

  end

  describe '#processing' do
    let(:user){create :user}
    let(:ticket){create :ticket}

    subject{ticket.processing user}

    it{expect{subject}.to change{ticket.reload.state}.to eq 'in_progress'}
    it{expect{subject}.to change{ticket.reload.assigned_to}.to eq user}
  end

  describe '#expert_process' do
    let(:user){create :user}
    let(:ticket){create :ticket, :delegated}

    subject{ticket.expert_process user}

    it{expect{subject}.to change{ticket.reload.state}.to eq 'expert_in_progress'}
    it{expect{subject}.to change{ticket.reload.expert}.to eq user}
  end

  describe '#has_new_comments_for' do
    let(:ticket){create :ticket}
    let(:comment){create :comment, ticket: ticket, is_public: true}

    before(:each){comment}

    subject{ticket.has_new_comments_for? user}

    context 'user has new comment' do
      let(:user){ticket.user}

      it{is_expected.to be_truthy}
    end

    context 'user has not new comment' do
      let(:user){comment.author}

      it{is_expected.to be_falsey}
    end
  end
end


text:
    <title>Random Theme Color Generator</title>
    <?php
      $themecode = "#" . substr(uniqid(rand()), -6);
      echo '<meta name="theme-color" content="'. $themecode . '" />';
    ?>

      Current Theme color code: <?php echo $themecode; ?>

      Used code:

        <?php echo '<meta name="theme-color" content="'.$themecode.'" / >';?>

GitHub


text:
namespace
{

void CopyAggregateChildren(TIntermAggregate *from, TIntermAggregate *to)
{
    const TIntermSequence *fromSequence = from->getSequence();
    for (size_t ii = 0; ii < fromSequence->size(); ++ii)
    {
        to->getSequence()->push_back(fromSequence->at(ii));
    }
}

TIntermSymbol *CreateReturnValueSymbol(const TType &type)
{
    TIntermSymbol *node = new TIntermSymbol(0, "angle_return", type);
    node->setInternal(true);
    return node;
}

TIntermSymbol *CreateReturnValueOutSymbol(const TType &type)
{
    TType outType(type);
    outType.setQualifier(EvqOut);
    return CreateReturnValueSymbol(outType);
}

TIntermAggregate *CreateReplacementCall(TIntermAggregate *originalCall, TIntermTyped *returnValueTarget)
{
    TIntermAggregate *replacementCall = new TIntermAggregate(EOpFunctionCall);
    replacementCall->setType(TType(EbtVoid));
    replacementCall->setUserDefined();
    replacementCall->setName(originalCall->getName());
    replacementCall->setFunctionId(originalCall->getFunctionId());
    replacementCall->setLine(originalCall->getLine());
    TIntermSequence *replacementParameters = replacementCall->getSequence();
    TIntermSequence *originalParameters = originalCall->getSequence();
    for (auto &param : *originalParameters)
    {
        replacementParameters->push_back(param);
    }
    replacementParameters->push_back(returnValueTarget);
    return replacementCall;
}

class ArrayReturnValueToOutParameterTraverser : private TIntermTraverser
{
  public:
    static void apply(TIntermNode *root, unsigned int *temporaryIndex);
  private:
    ArrayReturnValueToOutParameterTraverser();

    bool visitAggregate(Visit visit, TIntermAggregate *node) override;
    bool visitBranch(Visit visit, TIntermBranch *node) override;
    bool visitBinary(Visit visit, TIntermBinary *node) override;

    bool mInFunctionWithArrayReturnValue;
};

void ArrayReturnValueToOutParameterTraverser::apply(TIntermNode *root, unsigned int *temporaryIndex)
{
    ArrayReturnValueToOutParameterTraverser arrayReturnValueToOutParam;
    arrayReturnValueToOutParam.useTemporaryIndex(temporaryIndex);
    root->traverse(&arrayReturnValueToOutParam);
    arrayReturnValueToOutParam.updateTree();
}

ArrayReturnValueToOutParameterTraverser::ArrayReturnValueToOutParameterTraverser()
    : TIntermTraverser(true, false, true),
      mInFunctionWithArrayReturnValue(false)
{
}

bool ArrayReturnValueToOutParameterTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
{
    if (visit == PreVisit)
    {
        if (node->isArray())
        {
            if (node->getOp() == EOpFunction)
            {
                // Replace the parameters child node of the function definition with another node
                // that has the out parameter added.
                // Also set the function to return void.

                TIntermAggregate *params = node->getSequence()->front()->getAsAggregate();
                ASSERT(params != nullptr && params->getOp() == EOpParameters);

                TIntermAggregate *replacementParams = new TIntermAggregate;
                replacementParams->setOp(EOpParameters);
                CopyAggregateChildren(params, replacementParams);
                replacementParams->getSequence()->push_back(CreateReturnValueOutSymbol(node->getType()));
                replacementParams->setLine(params->getLine());

                mReplacements.push_back(NodeUpdateEntry(node, params, replacementParams, false));

                node->setType(TType(EbtVoid));

                mInFunctionWithArrayReturnValue = true;
            }
            else if (node->getOp() == EOpPrototype)
            {
                // Replace the whole prototype node with another node that has the out parameter added.
                TIntermAggregate *replacement = new TIntermAggregate;
                replacement->setOp(EOpPrototype);
                CopyAggregateChildren(node, replacement);
                replacement->getSequence()->push_back(CreateReturnValueOutSymbol(node->getType()));
                replacement->setUserDefined();
                replacement->setName(node->getName());
                replacement->setFunctionId(node->getFunctionId());
                replacement->setLine(node->getLine());
                replacement->setType(TType(EbtVoid));

                mReplacements.push_back(NodeUpdateEntry(getParentNode(), node, replacement, false));
            }
            else if (node->getOp() == EOpFunctionCall)
            {
                // Handle call sites where the returned array is not assigned.
                // Examples where f() is a function returning an array:
                // 1. f();
                // 2. another_array == f();
                // 3. another_function(f());
                // 4. return f();
                // Cases 2 to 4 are already converted to simpler cases by SeparateExpressionsReturningArrays, so we
                // only need to worry about the case where a function call returning an array forms an expression by
                // itself.
                TIntermAggregate *parentAgg = getParentNode()->getAsAggregate();
                if (parentAgg != nullptr && parentAgg->getOp() == EOpSequence)
                {
                    nextTemporaryIndex();
                    TIntermSequence replacements;
                    replacements.push_back(createTempDeclaration(node->getType()));
                    TIntermSymbol *returnSymbol = createTempSymbol(node->getType());
                    replacements.push_back(CreateReplacementCall(node, returnSymbol));
                    mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentAgg, node, replacements));
                }
                return false;
            }
        }
    }
    else if (visit == PostVisit)
    {
        if (node->getOp() == EOpFunction)
        {
            mInFunctionWithArrayReturnValue = false;
        }
    }
    return true;
}

bool ArrayReturnValueToOutParameterTraverser::visitBranch(Visit visit, TIntermBranch *node)
{
    if (mInFunctionWithArrayReturnValue && node->getFlowOp() == EOpReturn)
    {
        // Instead of returning a value, assign to the out parameter and then return.
        TIntermSequence replacements;

        TIntermBinary *replacementAssignment = new TIntermBinary(EOpAssign);
        TIntermTyped *expression = node->getExpression();
        ASSERT(expression != nullptr);
        replacementAssignment->setLeft(CreateReturnValueSymbol(expression->getType()));
        replacementAssignment->setRight(node->getExpression());
        replacementAssignment->setType(expression->getType());
        replacementAssignment->setLine(expression->getLine());
        replacements.push_back(replacementAssignment);

        TIntermBranch *replacementBranch = new TIntermBranch(EOpReturn, nullptr);
        replacementBranch->setLine(node->getLine());
        replacements.push_back(replacementBranch);

        mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(getParentNode()->getAsAggregate(), node, replacements));
    }
    return false;
}

bool ArrayReturnValueToOutParameterTraverser::visitBinary(Visit visit, TIntermBinary *node)
{
    if (node->getOp() == EOpAssign && node->getLeft()->isArray())
    {
        TIntermAggregate *rightAgg = node->getRight()->getAsAggregate();
        if (rightAgg != nullptr && rightAgg->getOp() == EOpFunctionCall && rightAgg->isUserDefined())
        {
            TIntermAggregate *replacementCall = CreateReplacementCall(rightAgg, node->getLeft());
            mReplacements.push_back(NodeUpdateEntry(getParentNode(), node, replacementCall, false));
        }
    }
    return false;
}

} // namespace

void ArrayReturnValueToOutParameter(TIntermNode *root, unsigned int *temporaryIndex)
{
    ArrayReturnValueToOutParameterTraverser::apply(root, temporaryIndex);
}


text:
@interface Errors : NSMutableArray {
 @public
  int count_;
  ErrorList *errorList_;
}

- (ErrorList *)getErrorList;
- (void)synErrWithInt:(int)line
              withInt:(int)col
              withInt:(int)n;
- (void)semErrWithInt:(int)line
              withInt:(int)col
         withNSString:(NSString *)s;
- (void)semErrWithInt:(int)line
              withInt:(int)col
         withNSString:(NSString *)s
         withNSString:(NSString *)fileName;
- (void)semErrWithNSString:(NSString *)s;
- (void)warningWithInt:(int)line
               withInt:(int)col
          withNSString:(NSString *)s;
- (void)warningWithInt:(int)line
               withInt:(int)col
          withNSString:(NSString *)s
          withNSString:(NSString *)fileName;
- (void)warningWithNSString:(NSString *)s;
- (id)init;
@end

#endif // _Errors_H_


text:
package auth_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestAuth(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Auth Suite")
}


text:
angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])
    .constant('uiDatetimePickerConfig', {
        dateFormat: 'yyyy-MM-dd HH:mm',
        html5Types: {
            date: 'yyyy-MM-dd',
            'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss',
            'month': 'yyyy-MM'
        },
        enableDate: true,
        enableTime: true,
        todayText: 'Today',
        nowText: 'Now',
        clearText: 'Clear',
        closeText: 'Done',
        dateText: 'Date',
        timeText: 'Time',
        closeOnDateSelection: true,
        appendToBody: false,
        showButtonBar: true
    })
    .directive('datetimePicker', ['$compile', '$parse', '$document', '$timeout', '$position', 'dateFilter', 'dateParser', 'uiDatetimePickerConfig', '$rootScope',
        function ($compile, $parse, $document, $timeout, $position, dateFilter, dateParser, uiDatetimePickerConfig, $rootScope) {
            return {
                restrict: 'A',
                require: 'ngModel',
                scope: {
                    isOpen: '=?',
                    enableDate: '=?',
                    enableTime: '=?',
                    todayText: '@',
                    nowText: '@',
                    dateText: '@',
                    timeText: '@',
                    clearText: '@',
                    closeText: '@',
                    dateDisabled: '&'
                },
                link: function (scope, element, attrs, ngModel) {
                    var dateFormat = uiDatetimePickerConfig.dateFormat,
                        closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$parent.$eval(attrs.closeOnDateSelection) : uiDatetimePickerConfig.closeOnDateSelection,
                        appendToBody = angular.isDefined(attrs.datepickerAppendToBody) ? scope.$parent.$eval(attrs.datepickerAppendToBody) : uiDatetimePickerConfig.appendToBody;

                    scope.showButtonBar = angular.isDefined(attrs.showButtonBar) ? scope.$parent.$eval(attrs.showButtonBar) : uiDatetimePickerConfig.showButtonBar;

                    // determine which pickers should be available. Defaults to date and time
                    scope.enableDate = angular.isDefined(scope.enableDate) ? scope.enableDate : uiDatetimePickerConfig.enableDate;
                    scope.enableTime = angular.isDefined(scope.enableTime) ? scope.enableTime : uiDatetimePickerConfig.enableTime;

                    // default picker view
                    scope.showPicker = scope.enableDate ? 'date' : 'time';

                    // get text
                    scope.getText = function (key) {
                        return scope[key + 'Text'] || uiDatetimePickerConfig[key + 'Text'];
                    };

                    var isHtml5DateInput = false;
                    if (uiDatetimePickerConfig.html5Types[attrs.type]) {
                        dateFormat = uiDatetimePickerConfig.html5Types[attrs.type];
                        isHtml5DateInput = true;
                    } else {
                        dateFormat = attrs.datepickerPopup || uiDatetimePickerConfig.dateFormat;
                        attrs.$observe('datetimePicker', function(value) {
                            var newDateFormat = value || uiDatetimePickerConfig.dateFormat;

                            if (newDateFormat !== dateFormat) {
                                dateFormat = newDateFormat;
                                ngModel.$modelValue = null;

                                if (!dateFormat) {
                                    throw new Error('datetimePicker must have a date format specified.');
                                }
                            }
                        });
                    }

                    // popup element used to display calendar
                    var popupEl = angular.element('' +
                        '
' +
                        '

' +
                        '
' +
                        '
' +
                        '

' +
                        '
');

                    // get attributes from directive
                    popupEl.attr({
                        'ng-model': 'date',
                        'ng-change': 'dateSelection(date)'
                    });

                    function cameltoDash(string) {
                        return string.replace(/([A-Z])/g, function ($1) { return '-' + $1.toLowerCase(); });
                    }

                    // datepicker element
                    var datepickerEl = angular.element(popupEl.children()[0]);

                    if (isHtml5DateInput) {
                        if (attrs.type === 'month') {
                            datepickerEl.attr('datepicker-mode', '"month"');
                            datepickerEl.attr('min-mode', 'month');
                        }
                    }

                    if (attrs.datepickerOptions) {
                        var options = scope.$parent.$eval(attrs.datepickerOptions);

                        if (options && options.initDate) {
                            scope.initDate = options.initDate;
                            datepickerEl.attr('init-date', 'initDate');
                            delete options.initDate;
                        }

                        angular.forEach(options, function (value, option) {
                            datepickerEl.attr(cameltoDash(option), value);
                        });
                    }

                    // timepicker element
                    var timepickerEl = angular.element(popupEl.children()[1]);

                    if (attrs.timepickerOptions) {
                        var options = scope.$parent.$eval(attrs.timepickerOptions);

                        angular.forEach(options, function (value, option) {
                            timepickerEl.attr(cameltoDash(option), value);
                        });
                    }

                    // set datepickerMode to day by default as need to create watch
                    // else disabled cannot pass in mode
                    if (!angular.isDefined(attrs['datepickerMode'])) {
                        attrs['datepickerMode'] = 'day';
                    }

                    scope.watchData = {};
                    angular.forEach(['minMode', 'maxMode', 'minDate', 'maxDate', 'datepickerMode', 'initDate', 'shortcutPropagation'], function(key) {
                        if (attrs[key]) {
                            var getAttribute = $parse(attrs[key]);
                            scope.$parent.$watch(getAttribute, function(value) {
                                scope.watchData[key] = value;
                            });
                            datepickerEl.attr(cameltoDash(key), 'watchData.' + key);

                            // Propagate changes from datepicker to outside
                            if (key === 'datepickerMode') {
                                var setAttribute = getAttribute.assign;
                                scope.$watch('watchData.' + key, function(value, oldvalue) {
                                    if (angular.isFunction(setAttribute) && value !== oldvalue) {
                                        setAttribute(scope.$parent, value);
                                    }
                                });
                            }
                        }
                    });

                    if (attrs.dateDisabled) {
                        datepickerEl.attr('date-disabled', 'dateDisabled({ date: date, mode: mode })');
                    }

                    // do not check showWeeks attr, as should be used via datePickerOptions

                    function parseDate(viewValue) {
                        if (angular.isNumber(viewValue)) {
                            // presumably timestamp to date object
                            viewValue = new Date(viewValue);
                        }

                        if (!viewValue) {
                            return null;
                        } else if (angular.isDate(viewValue) && !isNaN(viewValue)) {
                            return viewValue;
                        } else if (angular.isString(viewValue)) {
                            var date = dateParser.parse(viewValue, dateFormat, scope.date);
                            if (isNaN(date)) {
                                return null;
                            } else {
                                return date;
                            }
                        } else {
                            return null;
                        }
                    }

                    function validator(modelValue, viewValue) {
                        var value = modelValue || viewValue;

                        if (!(attrs.ngRequired || attrs.required) && !value) {
                            return true;
                        }

                        if (angular.isNumber(value)) {
                            value = new Date(value);
                        }
                        if (!value) {
                            return true;
                        } else if (angular.isDate(value) && !isNaN(value)) {
                            return true;
                        } else if (angular.isDate(new Date(value)) && !isNaN(new Date(value).valueOf())) {
                            return true;
                        } else if (angular.isString(value)) {
                            var date = dateParser.parse(value, dateFormat);
                            return !isNaN(date);
                        } else {
                            return false;
                        }
                    }

                    if (!isHtml5DateInput) {
                        // Internal API to maintain the correct ng-invalid-[key] class
                        ngModel.$$parserName = 'datetime';
                        ngModel.$validators.datetime = validator;
                        ngModel.$parsers.unshift(parseDate);
                        ngModel.$formatters.push(function(value) {
                            scope.date = value;
                            return ngModel.$isEmpty(value) ? value : dateFilter(value, dateFormat);
                        });
                    } else {
                        ngModel.$formatters.push(function(value) {
                            scope.date = value;
                            return value;
                        });
                    }

                    // Inner change
                    scope.dateSelection = function (dt) {

                        // check if timePicker is being shown and merge dates, so that the date
                        // part is never changed, only the time
                        if (scope.enableTime && scope.showPicker === 'time') {

                            // only proceed if dt is a date
                            if (dt || dt != null) {
                                // check if our scope.date is null, and if so, set to todays date
                                if (!angular.isDefined(scope.date) || scope.date == null) {
                                    scope.date = new Date();
                                }

                                // dt will not be undefined if the now or today button is pressed
                                if (dt && dt != null) {
                                    // get the existing date and update the time
                                    var date = new Date(scope.date);
                                    date.setHours(dt.getHours());
                                    date.setMinutes(dt.getMinutes());
                                    date.setSeconds(dt.getSeconds());
                                    date.setMilliseconds(dt.getMilliseconds());
                                    dt = date;
                                }
                            }
                        }

                        if (angular.isDefined(dt)) {
                            scope.date = dt;
                        }

                        var date = scope.date ? dateFilter(scope.date, dateFormat) : null;

                        element.val(date);
                        ngModel.$setViewValue(date);

                        if (closeOnDateSelection) {
                            // do not close when using timePicker as make impossible to choose a time
                            if (scope.showPicker != 'time' && date != null) {
                                // if time is enabled, swap to timePicker
                                if (scope.enableTime) {
                                    // need to delay this, else timePicker never shown
                                    $timeout(function() {
                                        scope.showPicker = 'time';
                                    }, 0);
                                } else {
                                    scope.close();
                                }
                            }
                        }

                    };

                    // Detect changes in the view from the text box
                    ngModel.$viewChangeListeners.push(function() {
                        scope.date = dateParser.parse(ngModel.$viewValue, dateFormat, scope.date);
                    });

                    var documentClickBind = function (event) {
                        if (scope.isOpen && !(element[0].contains(event.target) || $popup[0].contains(event.target))) {
                            scope.$apply(function () {
                                scope.close();
                            });
                        }
                    };

                    var inputKeydownBind = function(evt) {
                        if (evt.which === 27 && scope.isOpen) {
                            evt.preventDefault();
                            evt.stopPropagation();
                            scope.$apply(function() {
                                scope.close();
                            });
                            element[0].focus();
                        } else if (evt.which === 40 && !scope.isOpen) {
                            evt.preventDefault();
                            evt.stopPropagation();
                            scope.$apply(function() {
                                scope.isOpen = true;
                            });
                        }
                    };
                    element.bind('keydown', inputKeydownBind);

                    scope.keydown = function(evt) {
                        if (evt.which === 27) {
                            scope.close();
                            element[0].focus();
                        }
                    };

                    scope.$watch('isOpen', function (value) {
                        scope.dropdownStyle = {
                            display: value ? 'block' : 'none'
                        };

                        if (value) {
                            var position = appendToBody ? $position.offset(element) : $position.position(element);

                            if (appendToBody) {
                                scope.dropdownStyle.top = (position.top + element.prop('offsetHeight')) +'px';
                            } else {
                                scope.dropdownStyle.top = undefined;
                            }

                            scope.dropdownStyle.left = position.left + 'px';

                            $timeout(function() {
                                scope.$broadcast('datepicker.focus');
                                $document.bind('click', documentClickBind);
                            }, 0, false);
                        } else {
                            $document.unbind('click', documentClickBind);
                        }
                    });

                    scope.isDisabled = function(date) {
                        var isToday = (date == 'today');

                        if (date === 'today' || date === 'now')
                            date = new Date();

                        if (attrs.dateDisabled) {
                            return scope.dateDisabled({date: date, mode: scope.watchData['datepickerMode']});
                        } else {
                            return false;
                        }
                    };

                    scope.select = function (opt) {

                        var date = null;
                        var isNow = opt === 'now';

                        if (opt === 'today' || opt == 'now') {
                            var now = new Date();
                            if (angular.isDate(scope.date)) {
                                date = new Date(scope.date);
                                date.setFullYear(now.getFullYear(), now.getMonth(), now.getDate());
                                date.setHours(now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds());
                            } else {
                                date = now;
                            }
                        }

                        scope.dateSelection(date);

                        if (opt == 'clear')
                            scope.close();
                    };

                    scope.close = function () {
                        scope.isOpen = false;

                        // if enableDate and enableTime are true, reopen the picker in date mode first
                        if (scope.enableDate && scope.enableTime)
                            scope.showPicker = 'date';

                        element[0].focus();
                    };

                    scope.changePicker = function (evt, picker) {
                        evt.preventDefault();
                        evt.stopPropagation();

                        scope.showPicker = picker;
                    };

                    var $popup = $compile(popupEl)(scope);
                    // Prevent jQuery cache memory leak (template is now redundant after linking)
                    popupEl.remove();

                    if (appendToBody) {
                        $document.find('body').append($popup);
                    } else {
                        element.after($popup);
                    }

                    scope.$on('$destroy', function () {
                        if (scope.isOpen === true) {
                            if (!$rootScope.$$phase) {
                                scope.$apply(function() {
                                    scope.close();
                                });
                            }
                        }

                        $popup.remove();
                        element.unbind('keydown', inputKeydownBind);
                        $document.unbind('click', documentClickBind);
                    });
                }
            };
        }])

    .directive('datePickerWrap', function () {
        return {
            restrict: 'EA',
            replace: true,
            transclude: true,
            templateUrl: 'template/date-picker.html'
        };
    })

    .directive('timePickerWrap', function () {
        return {
            restrict: 'EA',
            replace: true,
            transclude: true,
            templateUrl: 'template/time-picker.html'
        };
    });

angular.module('ui.bootstrap.datetimepicker').run(['$templateCache', function($templateCache) {
  'use strict';

  $templateCache.put('template/date-picker.html',
    "

<button type=button class=\"btn btn-sm btn-info\" ng-click=\"select('today')\" ng-disabled=\"isDisabled('today')\">{{ getText('today') }}</button> <button type=button class=\"btn btn-sm btn-danger\" ng-click=\"select('clear')\">{{ getText('clear') }}</button> <button ng-if=enableTime type=button class=\"btn btn-sm btn-default\" ng-click=\"changePicker($event, 'time')\">{{ getText('time')}}</button> <button type=button class=\"btn btn-sm btn-success\" ng-click=close()>{{ getText('close') }}</button>

"
  );

  $templateCache.put('template/time-picker.html',
    "

<button type=button class=\"btn btn-sm btn-info\" ng-click=\"select('now')\" ng-disabled=\"isDisabled('now')\">{{ getText('now') }}</button> <button type=button class=\"btn btn-sm btn-danger\" ng-click=\"select('clear')\">{{ getText('clear') }}</button> <button ng-if=enableDate type=button class=\"btn btn-sm btn-default\" ng-click=\"changePicker($event, 'date')\">{{ getText('date')}}</button> <button type=button class=\"btn btn-sm btn-success\" ng-click=close()>{{ getText('close') }}</button>

"
  );

}]);


text:
package org.noear.weed.xml;

import org.noear.weed.SQLBuilder;

import java.util.Map;

public interface IXmlSqlBuilder {
    SQLBuilder build(Map map) throws Exception;
}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<page>

	<title>Ajuda per la cerca</title>

Consultes

	Per cercar amb Nutch, simplement escriu algunes paraules.

Els resultats només inclouen pàgines que contenen totes les paraules de la consulta.

Fes servir cometes per indicar les paraules que han d'aparèixer, forçosament, una al costat de l'altra, com una frase,
p.e., "pilar de sis".

La puntuació entre paraules també provoca que es cerqui com una frase. Així, cercar http://www.apache.org/ és el mateix que cercar "http www
apache org".

Les cerques no diferencien entre minúscules i majúscules, d'aquesta manera, cercar NuTcH és el mateix que cercar nUtCh.

Es pot prohibir una paraula de les pàgines que resulten de la cerca posant un signe menys davant seu, p.e., cercar futbol -lliga buscará pàgines que parlin de futbol però que no emprin la paraula "lliga".

Això és tot!

Resultats

Cada plana coincident resultat de la cerca té els següents enllaços:

(en memòria) mostra la versió de la plana que s'ha baixat Nutch.

(explicació) mostra una explicació de com s'ha puntuat aquesta plana

(àncores) mostra la llista d'enllaços d'entrada indexats per aquesta pàgina.

</page>


text:
<rolltemplate class="sheet-rolltemplate-rolls">

      {{#title}}
{{title}}
{{/title}}

      {{#subtitle}}
{{subtitle}}
{{/subtitle}}

      {{#allprops() title subtitle desc color baseroll}}

{{key}}

{{value}}

      {{/allprops() title subtitle desc color baseroll}}
      {{#rollTotal() baseroll 2}}

^{critical-fumble}

      {{/rollTotal() baseroll 2}}
      {{#rollTotal() baseroll 12}}

Critical Success!

      {{/rollTotal() baseroll 12}}
      {{#desc}}
{{desc}}
{{/desc}}

</rolltemplate>


text:
$(function () {
  'use strict';
  // Is the current page a Programming Task?
  var isRegularTaskPage = !!$('#catlinks a[title="Category:Programming Tasks"]').length;
  var isDraftTaskPage = !!$('#catlinks a[title="Category:Draft Programming Tasks"]').length;
  // Do nothing if this isn't a task page.
  var isTaskPage = isRegularTaskPage || isDraftTaskPage;
  if (!isTaskPage) return;

  var languageSelector = new LanguageSelector();
  languageSelector.run();
});


text:
package org.jump.service;

import java.util.List;

import org.jump.entity.ApplicationConfiguration;
import org.jump.entity.ExecutionStatus;
import org.jump.parser.AbstractCommand;

public class Executor {

    public ExecutionStatus execute(ApplicationConfiguration appConfig, List<AbstractCommand> commands) throws Exception {

        TransactionalSqlExecutor sqlExecutor = new TransactionalSqlExecutor(appConfig);
        for (AbstractCommand command: commands) {
            ExecutionStatus executionStatus = runCommand(appConfig, command, sqlExecutor);

            if (executionStatus.equals(ExecutionStatus.MANUAL_ROLLBACK)) {

                return executionStatus;
            }
        }

        if (!appConfig.isDryRun()) {

            sqlExecutor.commitAndClose();
            return ExecutionStatus.SUCCESSFUL;
        } else {

            sqlExecutor.rollbackAndClose();
            return ExecutionStatus.SUCCESSFUL_DRY_RUN;
        }
    }

    private ExecutionStatus runCommand(ApplicationConfiguration appConfig, AbstractCommand command, TransactionalSqlExecutor sqlExecutor) throws Exception {

        switch (command.getType()) {
        case SQL_COMMAND:
            for (String sql: command.getSqlCommand().getSqls()) {

                sqlExecutor.executeUpdate(sql);
            }
            break;

        case INSERT_COMMAND:
            InsertCommandExecutor insertCommandExecutor = new InsertCommandExecutor(appConfig, command.getInsertCommand(), sqlExecutor);
            insertCommandExecutor.execute();
            break;

        case ROLLBACK_COMMAND:
            sqlExecutor.rollbackAndClose();
            return ExecutionStatus.MANUAL_ROLLBACK;

        case BASIC_VARIABLE:
            CacheManager.getInstance().addVariable(command.getVariableCommand().getName(), command.getVariableCommand().getValue());
            break;

        default:
            String message = String.format("Command %s unknown.", command.getType().toString());
            throw new RuntimeException(message);
        }

        return ExecutionStatus.SUCCESSFUL;
    }
}