text:
from __future__ import print_function, division

# basic python
import cPickle as pickle
from PIL import Image
import numpy as np
import numpy.random as npr
from collections import OrderedDict
import time
import tarfile

# theano business
import theano
import theano.tensor as T

# blocks stuff
from blocks.initialization import Constant, IsotropicGaussian, Orthogonal
from blocks.filter import VariableFilter
from blocks.graph import ComputationGraph
from blocks.roles import PARAMETER
from blocks.model import Model
from blocks.bricks import Tanh, Identity, Rectifier, MLP
from blocks.bricks.cost import BinaryCrossEntropy
from blocks.bricks.recurrent import SimpleRecurrent, LSTM

# phil's sweetness
import utils
from BlocksModels import *
from RAMBlocks import *
from SeqCondGenVariants import *
from DKCode import get_adam_updates, get_adadelta_updates
from load_data import load_udm, load_tfd, load_svhn_gray, load_binarized_mnist
from HelperFuncs import construct_masked_data, shift_and_scale_into_01, \
                        row_shuffle, to_fX, one_hot_np
from MotionRenderers import TrajectoryGenerator, get_object_painters

RESULT_PATH = "RAM_TEST_RESULTS/"

BREAK_STR = """
#############################################################################
#############################################################################
#############################################################################
#############################################################################
#############################################################################
#############################################################################
#############################################################################
#############################################################################
"""

def test_seq_pred(use_var=True, use_rav=True, use_att=True,
                  traj_len=20, x_objs=['circle'], y_objs=[0],
                  res_tag="AAA", sample_pretrained=False):
    ##############################
    # File tag, for output stuff #
    ##############################
    if use_att:
        att_tag = "YA"
    else:
        att_tag = "NA"
    var_flags = "UV{}_UR{}_{}".format(int(use_var), int(use_rav), att_tag)
    result_tag = "{}SEQ_PRED_{}_{}".format(RESULT_PATH, var_flags, res_tag)

    # begin by saving an archive of the "main" code files for this test
    if not sample_pretrained:
        tar_name = "{}_code.tar".format(result_tag)
        code_tar = tarfile.open(name=tar_name, mode='w')
        code_tar.add('BlocksAttention.py')
        code_tar.add('SeqCondGenVariants.py')
        code_tar.add('TestSeqPred.py')
        code_tar.close()

    batch_size = 192
    traj_len = 20
    im_dim = 50
    obs_dim = im_dim*im_dim

    # configure a trajectory generator
    obj_scale = 0.15
    im_box = 1.0 - obj_scale
    x_range = [-im_box,im_box]
    y_range = [-im_box,im_box]
    max_speed = 0.15
    TRAJ = TrajectoryGenerator(x_range=x_range, y_range=y_range, \
                               max_speed=max_speed)
    # configure object renderers for the allowed object types...
    obj_types = ['circle', 'cross', 'square', 't-up', 't-down',
                 't-left', 't-right']
    OPTRS = get_object_painters(im_dim=im_dim, obj_types=obj_types, obj_scale=obj_scale)

    def generate_batch(num_samples, obj_type='circle'):
        # generate a minibatch of trajectories
        traj_pos, traj_vel = TRAJ.generate_trajectories(num_samples, (traj_len+1))
        traj_x = traj_pos[:,:,0]
        traj_y = traj_pos[:,:,1]
        # draw the trajectories
        center_x = to_fX( traj_x.T.ravel() )
        center_y = to_fX( traj_y.T.ravel() )
        delta = to_fX( np.ones(center_x.shape) )
        sigma = to_fX( np.ones(center_x.shape) )
        paint_obj = OPTRS[obj_type]
        W = paint_obj(center_y, center_x, delta, 0.05*sigma)
        # shape trajectories into a batch for passing to the model
        batch_imgs = np.zeros((num_samples, (traj_len+1), obs_dim))
        batch_coords = np.zeros((num_samples, (traj_len+1), 2))
        for i in range(num_samples):
            start_idx = i * (traj_len+1)
            end_idx = start_idx + (traj_len+1)
            img_set = W[start_idx:end_idx,:]
            batch_imgs[i,:,:] = img_set
            batch_coords[i,:,0] = center_x[start_idx:end_idx]
            batch_coords[i,:,1] = center_y[start_idx:end_idx]
        batch_imgs = np.swapaxes(batch_imgs, 0, 1)
        batch_coords = np.swapaxes(batch_coords, 0, 1)
        return [to_fX( batch_imgs ), to_fX( batch_coords )]

    def generate_batch_multi(num_samples, xobjs=['circle'], yobjs=[0], img_scale=1.0):
        obj_imgs = []
        obj_coords = []
        for obj in xobjs:
            imgs, coords = generate_batch(num_samples+1, obj_type=obj)
            obj_imgs.append(imgs)
            obj_coords.append(coords)
        seq_len = obj_imgs[0].shape[0] - 1
        batch_size = obj_imgs[0].shape[1]
        obs_dim = obj_imgs[0].shape[2]
        x_imgs = np.zeros((seq_len, batch_size, obs_dim))
        y_imgs = np.zeros((seq_len, batch_size, obs_dim))
        for o_num in range(len(xobjs)):
            x_imgs = x_imgs + obj_imgs[o_num][:-1,:,:]
            if o_num in yobjs:
                y_imgs = y_imgs + obj_imgs[o_num][1:,:,:]
        # # add noise to image sequences
        # pix_mask = npr.rand(*x_imgs.shape) < 0.05
        # pix_noise = npr.rand(*x_imgs.shape)
        # x_imgs = x_imgs + (pix_mask * pix_noise)
        # clip to 0...0.99
        x_imgs = np.maximum(x_imgs, 0.001)
        x_imgs = np.minimum(x_imgs, 0.999)
        y_imgs = np.maximum(y_imgs, 0.001)
        y_imgs = np.minimum(y_imgs, 0.999)
        return [to_fX(x_imgs), to_fX(y_imgs)]

    ############################################################
    # Setup some parameters for the Iterative Refinement Model #
    ############################################################
    total_steps = traj_len
    init_steps = 10
    exit_rate = 0.0
    nll_weight = 1.0
    x_dim = obs_dim
    y_dim = obs_dim
    z_dim = 256
    att_spec_dim = 5
    rnn_dim = 1024
    mlp_dim = 1024

    def visualize_attention(result, pre_tag="AAA", post_tag="AAA"):
        seq_len = result[0].shape[0]
        samp_count = result[0].shape[1]
        # get generated predictions
        x_samps = np.zeros((seq_len*samp_count, obs_dim))
        idx = 0
        for s1 in range(samp_count):
            for s2 in range(seq_len):
                x_samps[idx] = result[0][s2,s1,:]
                idx += 1
        file_name = "{0:s}_traj_xs_{1:s}.png".format(pre_tag, post_tag)
        utils.visualize_samples(x_samps, file_name, num_rows=samp_count)
        # get sequential attention maps
        seq_samps = np.zeros((seq_len*samp_count, obs_dim))
        idx = 0
        for s1 in range(samp_count):
            for s2 in range(seq_len):
                seq_samps[idx] = result[1][s2,s1,:]
                idx += 1
        file_name = "{0:s}_traj_att_maps_{1:s}.png".format(pre_tag, post_tag)
        utils.visualize_samples(seq_samps, file_name, num_rows=samp_count)
        # get sequential attention maps (read out values)
        seq_samps = np.zeros((seq_len*samp_count, obs_dim))
        idx = 0
        for s1 in range(samp_count):
            for s2 in range(seq_len):
                seq_samps[idx] = result[2][s2,s1,:]
                idx += 1
        file_name = "{0:s}_traj_read_outs_{1:s}.png".format(pre_tag, post_tag)
        utils.visualize_samples(seq_samps, file_name, num_rows=samp_count)
        # get original input sequences
        seq_samps = np.zeros((seq_len*samp_count, obs_dim))
        idx = 0
        for s1 in range(samp_count):
            for s2 in range(seq_len):
                seq_samps[idx] = result[3][s2,s1,:]
                idx += 1
        file_name = "{0:s}_traj_xs_in_{1:s}.png".format(pre_tag, post_tag)
        utils.visualize_samples(seq_samps, file_name, num_rows=samp_count)
        return

    def visualize_attention_joint(result, pre_tag="AAA", post_tag="AAA"):
        seq_len = result[0].shape[0]
        samp_count = result[0].shape[1]
        # get generated predictions
        seq_samps = np.zeros((3*seq_len*samp_count, obs_dim))
        idx = 0
        for s1 in range(samp_count):
            for s2 in range(seq_len):
                seq_samps[idx] = result[3][s2,s1,:]
                idx += 1
            for s2 in range(seq_len):
                seq_samps[idx] = result[0][s2,s1,:]
                idx += 1
            for s2 in range(seq_len):
                seq_samps[idx] = result[1][s2,s1,:]
                idx += 1
        file_name = "{0:s}_traj_joint_{1:s}.png".format(pre_tag, post_tag)
        utils.visualize_samples(seq_samps, file_name, num_rows=(3*samp_count))
        return

    rnninits = {
        'weights_init': IsotropicGaussian(0.02),
        'biases_init': Constant(0.),
    }
    inits = {
        'weights_init': IsotropicGaussian(0.02),
        'biases_init': Constant(0.),
    }

    # module for doing local 2d read defined by an attention specification
    img_scale = 1.0 # image coords will range over [-img_scale...img_scale]
    read_N = 2      # use NxN grid for reader
    reader_mlp = FovAttentionReader2d(x_dim=x_dim,
                                      width=im_dim, height=im_dim, N=read_N,
                                      img_scale=img_scale, att_scale=0.33,
                                      **inits)
    read_dim = reader_mlp.read_dim # total number of "pixels" read by reader

    # MLP for updating belief state based on con_rnn
    writer_mlp = MLP([Rectifier(), Identity()], [rnn_dim, mlp_dim, y_dim], \
                     name="writer_mlp", **inits)

    if use_att:
        # mlps for processing inputs to observer LSTMs
        obs_mlp_in = MLP([Identity()], \
                         [(read_dim + att_spec_dim + rnn_dim), 4*rnn_dim], \
                         name="obs_mlp_in", **inits)
        var_mlp_in = MLP([Identity()], \
                         [(read_dim + read_dim + att_spec_dim + rnn_dim), 4*rnn_dim], \
                         name="var_mlp_in", **inits)
        # mlps for processing inputs to controller LSTMs
        con_mlp_in = MLP([Identity()], \
                         [(z_dim + rnn_dim), 4*rnn_dim], \
                         name="con_mlp_in", **inits)
        rav_mlp_in = MLP([Identity()], \
                         [(y_dim + z_dim + rnn_dim), 4*rnn_dim], \
                         name="rav_mlp_in", **inits)
    else:
        # mlps for processing inputs to observer LSTMs
        obs_mlp_in = MLP([Identity()], \
                         [(x_dim + att_spec_dim + rnn_dim), 4*rnn_dim], \
                         name="obs_mlp_in", **inits)
        var_mlp_in = MLP([Identity()], \
                         [(y_dim + x_dim + att_spec_dim + rnn_dim), 4*rnn_dim], \
                         name="var_mlp_in", **inits)
        # mlps for processing inputs to controller LSTMs
        con_mlp_in = MLP([Identity()], \
                         [(z_dim + rnn_dim), 4*rnn_dim], \
                         name="con_mlp_in", **inits)
        rav_mlp_in = MLP([Identity()], \
                         [(y_dim + z_dim + rnn_dim), 4*rnn_dim], \
                         name="rav_mlp_in", **inits)

    # mlps for turning LSTM outputs into conditionals over z_att
    con_mlp_out = CondNet([Rectifier()], [rnn_dim, mlp_dim, att_spec_dim], \
                          name="con_mlp_out", **inits)
    rav_mlp_out = CondNet([Rectifier()], [rnn_dim, mlp_dim, att_spec_dim], \
                          name="rav_mlp_out", **inits)
    # mlps for turning LSTM outputs into conditionals over z_com
    obs_mlp_out = CondNet([], [rnn_dim, z_dim], \
                          name="obs_mlp_out", **inits)
    var_mlp_out = CondNet([], [rnn_dim, z_dim], \
                          name="var_mlp_out", **inits)

    # LSTMs for the actual LSTMs (obviously, perhaps)
    con_rnn = BiasedLSTM(dim=rnn_dim, ig_bias=2.0, fg_bias=1.0, \
                         name="con_rnn", **rnninits)
    obs_rnn = BiasedLSTM(dim=rnn_dim, ig_bias=2.0, fg_bias=1.0, \
                         name="obs_rnn", **rnninits)
    var_rnn = BiasedLSTM(dim=rnn_dim, ig_bias=2.0, fg_bias=1.0, \
                         name="var_rnn", **rnninits)
    rav_rnn = BiasedLSTM(dim=rnn_dim, ig_bias=2.0, fg_bias=1.0, \
                         name="rav_rnn", **rnninits)

    SeqCondGenALL_doc_str = \
    """
    SeqCondGenALL -- constructs conditional densities under time constraints.

    This model sequentially constructs a conditional density estimate by taking
    repeated glimpses at the input x, and constructing a hypothesis about the
    output y. The objective is maximum likelihood for (x,y) pairs drawn from
    some training set. We learn a proper generative model, using variational
    inference -- which can be interpreted as a sort of guided policy search.

    The input pairs (x, y) can be either "static" or "sequential". In the
    static case, the same x and y are used at every step of the hypothesis
    construction loop. In the sequential case, x and y can change at each step
    of the loop.

    Parameters:
        x_and_y_are_seqs: boolean telling whether the conditioning information
                          and prediction targets are sequential.
        total_steps: total number of steps in sequential estimation process
        init_steps: number of steps prior to first NLL measurement
        exit_rate: probability of exiting following each non "init" step
                   **^^ THIS IS SET TO 0 WHEN USING SEQUENTIAL INPUT ^^**
        nll_weight: weight for the prediction NLL term at each step.
                   **^^ THIS IS IGNORED WHEN USING STATIC INPUT ^^**
        x_dim: dimension of inputs on which to condition
        y_dim: dimension of outputs to predict
        use_var: whether to include "guide" distribution for observer
        use_rav: whether to include "guide" distribution for controller
        use_att: whether to use attention-based input processing
        reader_mlp: used for reading from the input
        writer_mlp: used for writing to the output prediction
        con_mlp_in: preprocesses input to the "controller" LSTM
        con_rnn: the "controller" LSTM
        con_mlp_out: CondNet for distribution over att spec given con_rnn
        obs_mlp_in: preprocesses input to the "observer" LSTM
        obs_rnn: the "observer" LSTM
        obs_mlp_out: CondNet for distribution over z given gen_rnn
        var_mlp_in: preprocesses input to the "guide observer" LSTM
        var_rnn: the "guide observer" LSTM
        var_mlp_out: CondNet for distribution over z given var_rnn
        rav_mlp_in: preprocesses input to the "guide controller" LSTM
        rav_rnn: the "guide controller" LSTM
        rav_mlp_out: CondNet for distribution over z given rav_rnn
    """

    SCG = SeqCondGenALL(
                x_and_y_are_seqs=True,
                total_steps=total_steps,
                init_steps=init_steps,
                exit_rate=exit_rate,
                nll_weight=nll_weight,
                x_dim=obs_dim,
                y_dim=obs_dim,
                use_var=use_var,
                use_rav=use_rav,
                use_att=use_att,
                reader_mlp=reader_mlp,
                writer_mlp=writer_mlp,
                con_mlp_in=con_mlp_in,
                con_mlp_out=con_mlp_out,
                con_rnn=con_rnn,
                obs_mlp_in=obs_mlp_in,
                obs_mlp_out=obs_mlp_out,
                obs_rnn=obs_rnn,
                var_mlp_in=var_mlp_in,
                var_mlp_out=var_mlp_out,
                var_rnn=var_rnn,
                rav_mlp_in=rav_mlp_in,
                rav_mlp_out=rav_mlp_out,
                rav_rnn=rav_rnn,
                com_noise=0.4, att_noise=0.1)
    SCG.initialize()

    compile_start_time = time.time()

    # build the attention trajectory sampler
    SCG.build_attention_funcs()

    # TEST SAVE/LOAD FUNCTIONALITY
    param_save_file = "{}_params.pkl".format(result_tag)
    if sample_pretrained:
        SCG.load_model_params(param_save_file)

    # quick test of attention trajectory sampler
    samp_count = 32
    Xb, Yb = generate_batch_multi(samp_count, xobjs=x_objs, yobjs=y_objs, img_scale=img_scale)

    if sample_pretrained:
        # draw sample trajectories from both guide and primary policies
        result = SCG.sample_attention(Xb, Yb, sample_source='q')
        visualize_attention_joint(result, pre_tag=result_tag, post_tag="QS")
        result = SCG.sample_attention(Xb, Yb, sample_source='p')
        visualize_attention_joint(result, pre_tag=result_tag, post_tag="PS")
        return # only sample a model trajectory and then quit
    else:
        result = SCG.sample_attention(Xb, Yb)
        visualize_attention_joint(result, pre_tag=result_tag, post_tag="b0")

    # build the main model functions (i.e. training and cost functions)
    SCG.build_model_funcs()

    compile_end_time = time.time()
    compile_minutes = (compile_end_time - compile_start_time) / 60.0
    print("THEANO COMPILE TIME (MIN): {}".format(compile_minutes))

    ################################################################
    # Apply some updates, to check that they aren't totally broken #
    ################################################################
    print("Beginning to train the model...")
    out_file = open("{}_results.txt".format(result_tag), 'wb')
    out_file.flush()
    costs = [0. for i in range(10)]
    learn_rate = 0.0001
    momentum = 0.9
    kl_scale = 1.0
    cost_iters = 0
    for i in range(500000):
        scale = min(1.0, ((i+1) / 5000.0))
        if (((i + 1) % 10000) == 0):
            learn_rate = learn_rate * 0.96
        if ((i > 160000) and ((i % 20000) == 0)):
            kl_scale = kl_scale + 0.1
        # set sgd and objective function hyperparams for this update
        SCG.set_sgd_params(lr=scale*learn_rate, mom_1=scale*momentum, mom_2=0.98)
        SCG.set_lam_kld(lam_kld_q2p=kl_scale*1.0, lam_kld_p2q=kl_scale*0.1, \
                        lam_kld_amu=0.0, lam_kld_alv=0.0)
        # perform a minibatch update and record the cost for this batch
        Xb, Yb = generate_batch_multi(samp_count, xobjs=x_objs, yobjs=y_objs, img_scale=img_scale)
        result = SCG.train_joint(Xb, Yb)
        costs = [(costs[j] + result[j]) for j in range(len(result))]
        cost_iters += 1
        # output diagnostic information and checkpoint parameters, etc.
        if (((i % 1000) == 0) or \
            ((i < 100) and ((i % 5) == 0)) or \
            ((i < 1000) and ((i % 20) == 0))):
            costs = [(v / float(cost_iters)) for v in costs]
            str1 = "-- batch {0:d} --".format(i)
            str2 = "    total_cost: {0:.4f}".format(costs[0])
            str3 = "    nll_term  : {0:.4f}".format(costs[1])
            str4 = "    kld_q2p   : {0:.4f}".format(costs[2])
            str5 = "    kld_p2q   : {0:.4f}".format(costs[3])
            str6 = "    kld_amu   : {0:.4f}".format(costs[4])
            str7 = "    kld_alv   : {0:.4f}".format(costs[5])
            str8 = "    reg_term  : {0:.4f}".format(costs[6])
            str9 = "    grad_norm : {0:.4f}".format(costs[7])
            str10 = "    updt_norm : {0:.4f}".format(costs[8])
            joint_str = "\n".join([str1, str2, str3, str4, str5, str6, str7, str8, str9, str10])
            print(joint_str)
            out_file.write(joint_str+"\n")
            out_file.flush()
            costs = [0.0 for v in costs]
            cost_iters = 0
        if ((i % 5000) == 0):
            SCG.save_model_params("{}_params.pkl".format(result_tag))
            ###########################################
            # Sample and draw attention trajectories. #
            ###########################################
            samp_count = 32
            Xb, Yb = generate_batch_multi(samp_count, xobjs=x_objs, yobjs=y_objs, img_scale=img_scale)
            result = SCG.sample_attention(Xb, Yb)
            post_tag = "b{0:d}".format(i)
            #visualize_attention(result, pre_tag=result_tag, post_tag=post_tag)
            visualize_attention_joint(result, pre_tag=result_tag, post_tag=post_tag)

if __name__=="__main__":
    ##################################################
    # TEST WITH NO LATENT VARIABLES AND NO ATTENTION #
    ##################################################
    #test_seq_pred(use_var=False, use_rav=False, use_att=False, traj_len=20, \
    #              x_objs=['t-up', 't-down', 't-left', 't-right'], y_objs=[0,1,2,3], \
    #              res_tag="T1", sample_pretrained=False)
    ###############################################
    # TEST WITH LATENT VARIABLES AND NO ATTENTION #
    ###############################################
    #test_seq_pred(use_var=True, use_rav=False, use_att=False, traj_len=20, \
    #              x_objs=['t-up', 't-down', 't-left', 't-right'], y_objs=[0,1,2,3], \
    #              res_tag="T1", sample_pretrained=False)

    ###############################################
    # TEST WITH NO LATENT VARIABLES AND ATTENTION #
    ###############################################
    #test_seq_pred(use_var=False, use_rav=False, use_att=True, traj_len=20, \
    #              x_objs=['t-up', 't-down', 't-left', 't-right'], y_objs=[0,1,2,3], \
    #              res_tag="T1", sample_pretrained=False)
    ############################################
    # TEST WITH LATENT VARIABLES AND ATTENTION #
    ############################################
    test_seq_pred(use_var=True, use_rav=False, use_att=True, traj_len=20, \
                  x_objs=['t-up', 't-down', 't-left', 't-right'], y_objs=[0,1,2,3], \
                  res_tag="T1", sample_pretrained=False)


text:
// Copyright 2007-2017 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// 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.
namespace MassTransit.Tests
{
    using System;
    using System.Linq;
    using System.Threading.Tasks;
    using GreenPipes;
    using Logging;
    using MassTransit.Testing;
    using NUnit.Framework;
    using Shouldly;
    using Util;

    [TestFixture]
    public class Running_two_in_memory_transports
    {
        [Test]
        public async Task Should_keep_em_separated()
        {
            var internalHarness = new InMemoryTestHarness("internal");
            var externalHarness = new InMemoryTestHarness("external");

            ConsumerTestHarness<RelayConsumer> internalConsumer = internalHarness.Consumer(() => new RelayConsumer(externalHarness.Bus));
            ConsumerTestHarness<RelayConsumer> externalConsumer = externalHarness.Consumer(() => new RelayConsumer(internalHarness.Bus));

            var realConsumer = internalHarness.Consumer<RealConsumer>();

            await internalHarness.Start();
            try
            {
                await externalHarness.Start();
                try
                {
                    await externalHarness.Bus.Publish(new A());

                    realConsumer.Consumed.Select().Any().ShouldBeTrue();
                }
                finally
                {
                    await externalHarness.Stop();
                }
            }
            finally
            {
                await internalHarness.Stop();
            }
        }

        class RelayConsumer :
            IConsumer
        {
            readonly ILog _log = Logger.Get<RelayConsumer>();

            readonly IPublishEndpoint _otherHost;

            public RelayConsumer(IPublishEndpoint otherHost)
            {
                _otherHost = otherHost;
            }

            public Task Consume(ConsumeContext context)
            {
                if (GetVirtualHost(context.SourceAddress) != GetVirtualHost(context.ReceiveContext.InputAddress))
                    return TaskUtil.Completed;

                if (_log.IsInfoEnabled)
                    _log.Info($"Forwarding message: {context.MessageId} from {context.SourceAddress}");

                IPipe<SendContext> contextPipe = context.CreateCopyContextPipe();

                return _otherHost.Publish(context.Message, contextPipe);
            }
        }

        static string GetVirtualHost(Uri address)
        {
            return address.AbsolutePath.Split('/').First(x => !string.IsNullOrWhiteSpace(x));

        }

        class RealConsumer :
            IConsumer
        {
            public Task Consume(ConsumeContext context)
            {
                return TaskUtil.Completed;
            }
        }

        public class A
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
from selenium import webdriver
from selenium.webdriver.common.by import By

baseUrl = "https://forum-testing.herokuapp.com/v1.0/demo"
driver = webdriver.Firefox()
driver.get(baseUrl)

elementListByTagName = driver.find_elements(By.TAG_NAME, "td")
length1 = len(elementListByTagName)

if elementListByTagName is not None:
    print("TagName -> Size of the list is: " + str(length1))

for element in elementListByTagName:
    print(element.text)

elementListByClassName = driver.find_elements_by_class_name("inputs")
length2 = len(elementListByClassName)

for element in elementListByClassName:
    print(element.get_attribute('placeholder'))

if elementListByClassName is not None:
    print("ClassName -> Size of the list is: " + str(length2))


text:
/**
 * Test tFormer Methods
 */

describe( 'Methods : ', function () {

	describe( 'define `new tFormer(formID, options)`', function () {
		it( 'can be defined without new', function () {
			var f1 = new tFormer( 'f' );
			expect( f1 instanceof tFormer ).toBeTruthy();

			var f2 = tFormer( 'f' );
			expect( f2 instanceof tFormer ).toBeTruthy();
		} );

		it( 'caching all inited forms in tFormer.cache', function () {
			var f = tFormer( 'f' );
			expect( f.cache.length > 0 ).toBeTruthy();
		} );
	} );

	describe( 'init()', function () {
		var f = tFormer( 'f' );

		beforeEach( function () {
			f.drop();
		} );

		it( ' - initializing tFormer', function () {
			expect( f.inited ).toBeTruthy();
		} );
	} );

	describe( 'destroy()', function () {
		var f = tFormer( 'f' );
		var f_test = f.field( 't_text' );
		beforeEach( function () {
			f.drop();
			f_test = f.field( 't_text' );
		} );

		it( ' - remove errorClass (and data-error) from fields', function () {
			f_test.el.value = '';
			f_test.setRules( '*' );
			expect( f_test.hasClass( f_test.get( 'errorClass' ) ) ).toBeTruthy();
			expect( f_test.hasClass( f_test.get( 'errorClass' ) ) ).toBeTruthy();
			f.destroy();
			expect( f_test.hasClass( f_test.get( 'errorClass' ) ) ).not.toBeTruthy();
		} );

		it( ' - remove disabledClass from submit button', function () {
			f_test.el.value = '';
			f_test.setRules( '*' );
			expect( f_test.hasClass( f_test.get( 'errorClass' ) ) ).toBeTruthy();
			f.destroy();
			expect( f_test.hasClass( f_test.get( 'errorClass' ) ) ).not.toBeTruthy();
		} );
	} );

	describe( 'validate()', function () {
		var f = tFormer( 'f' );

		beforeEach( function () {
			f.destroy().init();
		} );

		it( 'validate() - whole form and returns is form valid or not', function () {
			expect( f.field( 't_text' ).setRules( '* @' ).validate() ).toBe( false );
		} );

		it( 'validate( field_name ) - whole defined field and returns is form valid or not', function () {
			expect( f.field( 't_text' ).setRules( '* @' ).validate() ).toBe( false );
		} );

		it( 'validate( { highlight: false } ) - validating whole form without displaying errors', function () {
			expect( $( f.field( 't_text' ).setRules( '* @', {highlight: false} ).field ).hasClass( f.field( 't_text' ).get( 'errorClass' ) ) ).toBe( false );
		} );
	} );

	describe( 'toObject()', function () {
		var f = tFormer( 'f' );
		beforeEach( function () {
			f.destroy().init();
		} );

		it( 'toObject()', function () {
			f.form.t_text.value = 'test_input_value';
			$( f.form.t_checkbox ).attr( 'checked', 'checked' );
			f.form.t_textarea.value = 'test_textarea_value';
			f.form.t_select.value = 'test_select_value';

			var obj = f.toObject();
			expect( obj.t_text ).toBe( 'test_input_value' );
			expect( obj.t_select ).toBe( 'test_select_value' );
			expect( obj.t_checkbox ).toBe( true );
			expect( obj.t_textarea ).toBe( 'test_textarea_value' );
		} );
	} );

	describe( 'get(*option_name, field_name)', function () {
		var f = tFormer( 'f' );
		beforeEach( function () {
			f.destroy().init();
		} );

		it( '`field_name == undefined` - return global option', function () {
			expect( f.get( 'requestTimeout' ) ).toBe( f.config.requestTimeout );
		} );

		it( '`field_name` defined - return fieldname option', function () {
			expect( f.get( 'requestTimeout', 't_text' ) ).toBe( f.field( 't_text' ).get( 'requestTimeout' ) );
		} );
	} );

	describe( 'set(*options, field_name)', function () {
		var f = tFormer( 'f' );
		beforeEach( function () {
			f.drop();
		} );

		it( '`field_name == undefined` - set all options as global', function () {
			f.set( { timeout: 1234, requestTimeout: 4321 } );
			expect( f.get( 'timeout' ) ).toBe( f.config.timeout );
			expect( f.get( 'timeout' ) ).toBe( 1234 );
			expect( f.get( 'requestTimeout' ) ).toBe( f.config.requestTimeout );
			expect( f.get( 'requestTimeout' ) ).toBe( 4321 );
		} );

		it( '`field_name` defined - set all options to fieldname', function () {
			f.field( 't_text' ).set( {'errorClass': 'asdfasdfasd'} );
			expect( f.field( 't_text' ).get( 'errorClass' ) ).toBe( f.field( 't_text' ).get( 'errorClass' ) );
			expect( f.field( 't_text' ).get( 'errorClass' ) ).toBe( 'asdfasdfasd' );
			f.field( 't_text' ).set( {'errorClass': 'error'} );
		} );

	} );

	describe( 'setRules(*rules, *field_name, options)', function () {
		var f = tFormer( 'f' );
		beforeEach( function () {
			f.drop();
		} );

		it( 'setting property `rules` to defined `field_name`', function () {
			f.field( 't_text' ).setRules( '* @s' );
			expect( f.field( 't_text' ).get( 'rules' ) ).toBe( '* @s' );
		} );

		it( '`options = {hoghlight: false}` - setRules and validate form without displaying errors', function () {
			f.field( 't_text' ).setRules( '* @s', {highlight: false} );
			expect( $( f.fields.t_text.field ).hasClass( f.field( 't_text' ).get( 'errorClass' ) ) ).toBe( false );
		} );

		it( '`{highlight: true}` - by default', function () {
			expect( f.field( 't_text' ).setRules( '* @s' ).hasClass( f.field( 't_text' ).get( 'errorClass' ) ) ).toBe( true );
		} );

		it( 'set empty `rules` to remove validation rules from `field_name`', function () {
			f.field( 't_text' ).el.value = 'test';
			expect( f.field( 't_text' ).setRules( '* @' ).valid ).toBe( false );
			expect( f.field( 't_text' ).setRules( '' ).valid ).toBe( true );
		} );
	} );

	describe( 'submit button control', function () {
		var f = tFormer( 'f' );
		var sb = f.button( 'submit' );
		beforeEach( function () {
			f.drop();
			sb = f.button( 'submit' );
		} );

		it( 'submitEnable() - turn on submit button', function () {
			f.submitEnable();
			expect( sb.hasClass( sb.get( 'disabledClass' ) ) ).toBe( false );
		} );

		it( 'submitControl(true) is equal to submitEnable()', function () {
			f.submitControl( true );
			expect( sb.hasClass( sb.get( 'disabledClass' ) ) ).toBe( false );
		} );

		it( 'submitDisable() - turn off submit button', function () {
			f.submitDisable();
			expect( sb.hasClass( sb.get( 'disabledClass' ) ) ).toBe( true );
		} );

		it( 'submitControl(false) is equal to submitDisable()', function () {
			f.submitControl( false );
			expect( sb.hasClass( sb.get( 'disabledClass' ) ) ).toBe( true );
		} );
	} );

	describe( 'processing( true / false )', function () {
		var f = tFormer( 'f' );
		var sb = f.button( 'submit' );
		var f_text = f.field( 't_text' );
		beforeEach( function () {
			f.drop();
			sb = f.button( 'submit' );
			f_text = f.field( 't_text' );
		} );

		it( 'processing( true ) - add processing class to button', function () {
			expect( sb.hasClass( sb.get( 'processingClass' ) ) ).toBe( false );
			sb.processing( true );
			expect( sb.hasClass( sb.get( 'processingClass' ) ) ).toBe( true );
		} );
		it( 'processing( true ) - add processing class to field', function () {
			expect( $( f_text.field ).hasClass( f_text.get( 'processingClass' ) ) ).toBe( false );
			f_text.processing( true );
			expect( f_text.hasClass( f_text.get( 'processingClass' ) ) ).toBe( true );
		} );

		it( 'processing( false ) - remove processing class from button', function () {
			sb.processing( true );
			expect( sb.hasClass( sb.get( 'processingClass' ) ) ).toBe( true );
			sb.processing( false );
			expect( sb.hasClass( sb.get( 'processingClass' ) ) ).toBe( false );
		} );
		it( 'processing( false ) - remove processing class from field', function () {
			f_text.processing( true );
			expect( f_text.hasClass( f_text.get( 'processingClass' ) ) ).toBe( true );
			f_text.processing( false );
			expect( f_text.hasClass( f_text.get( 'processingClass' ) ) ).toBe( false );
		} );
	} );

	describe( 'error control', function () {
		var f = tFormer( 'f' );
		var f_text = f.field( 't_text' );
		beforeEach( function () {
			f.drop();
			f_text = f.field( 't_text' );
		} );

		it( 'error( true ) add errorClass to field', function () {
			expect( f_text.error( true ).hasClass( f_text.get( 'errorClass' ) ) ).toBe( true );
			expect( f_text.error( false ).el.getAttribute( 'data-error' ) ).toBeDefined();
		} );

		it( 'error( false ) remove errorClass from field', function () {
			expect( f_text.error( false ).hasClass( f_text.get( 'errorClass' ) ) ).toBe( false );
			expect( f_text.error( false ).el.getAttribute( 'data-error' ) ).toBe( null );
		} );
	} );

	describe( 'lock()', function () {
		var f = tFormer( 'f' );
		var sb = f.button( 'submit' );
		beforeEach( function () {
			f.drop();
			sb = f.button( 'submit' );
		} );

		it( 'increment lock parameter', function () {
			expect( f.locked ).toBe( 0 );
			f.lock();
			expect( f.locked ).toBe( 1 );
			f.lock();
			expect( f.locked ).toBe( 2 );
		} );

		it( 'add disabledClass to submit button', function () {
			expect( f.locked ).toBe( 0 );
			expect( sb.enable().hasClass( sb.get( 'disabledClass' ) ) ).toBe( false );
			f.lock();
			expect( sb.hasClass( sb.get( 'disabledClass' ) ) ).toBe( true );
		} );
	} );

	describe( 'unlock()', function () {
		var f = tFormer( 'f' );
		var sb = f.button( 'submit' );
		beforeEach( function () {
			f.drop();
			sb = f.button( 'submit' );
		} );

		it( 'decrement lock parameter', function () {
			expect( f.locked ).toBe( 0 );
			f.lock();
			expect( f.locked ).toBe( 1 );
			f.unlock();
			expect( f.locked ).toBe( 0 );
		} );

		it( 'remove disabledClass from submit button', function () {
			expect( f.locked ).toBe( 0 );
			expect( sb.enable().hasClass( sb.get( 'disabledClass' ) ) ).toBe( false );
			f.lock();
			expect( sb.hasClass( sb.get( 'disabledClass' ) ) ).toBe( true );

			f.unlock();
			// TODO: valid form check
			//			expect( $( sb.button ).hasClass( sb.get( 'disabledClass' ) ) ).toBe( false );
		} );
	} );

	xdescribe( 'init()', function () {
		var f,
			before = 0,
			onerror = 0,
			onvalid = 0;

		beforeEach( function () {
			before = 0;
			onerror = 0;
			onvalid = 0;
			f = tFormer( 'form_destroy', {
				before : function () {
					before++;
				},
				onerror: function () {
					onerror++;
				},
				onvalid: function () {
					onvalid++;
				}
			} );
		} );

		it( 'search check buttons', function () {
			expect( $( f.btn_events[0][0] ).data( 'check' ) ).toBeDefined();
		} );

		it( 'add events to buttons', function () {
			expect( f.btn_events.length ).toBeGreaterThan( 0 );
		} );

		it( 'search submit button', function () {
			expect( f.get( 'submitButton' ).type ).toBe( 'submit' );
		} );

		it( 'add events to fields', function () {
			expect( f.events.test.blur.length ).toBeGreaterThan( 0 );
			expect( f.events.test.keyup.length ).toBeGreaterThan( 0 );
		} );

		it( 'search submit button', function () {
			expect( f.get( 'submitButton' ).type ).toBe( 'submit' );
		} );

		it( 'add dependencyEvent', function () {
			expect( f.events.depended.keyup.length ).toBe( 2 );
			expect( f.events.parent_depender.keyup.length ).toBe( 3 );
		} );

		it( 'validate form after init, without displaying errors', function () {
			expect( $( f.form.test ).hasClass( f.get( 'errorClass' ) ) ).toBe( false )
			expect( $( f.form.test ).data( 'error' ) ).toBeDefined();
		} );

		it( 'add new onsubmit function', function () {
			expect( $( f.form.test ).hasClass( f.get( 'errorClass' ) ) ).toBe( false )
			expect( $( f.form.test ).data( 'error' ) ).toBeDefined();
			$( f.get( 'submitButton' ) ).trigger( 'click' );
			expect( $( f.form.test ).hasClass( f.get( 'errorClass' ) ) ).toBe( true );
			expect( $( f.form.test ).data( 'error' ) ).toBeDefined();
		} );
	} );

	xdescribe( 'destroy()', function () {
		var f,
			before = 0,
			onerror = 0,
			onvalid = 0;

		beforeEach( function () {
			before = 0;
			onerror = 0;
			onvalid = 0;
			f = tFormer( 'form_destroy', {
				before : function () {
					before++;
				},
				onerror: function () {
					onerror++;
				},
				onvalid: function () {
					onvalid++;
				}
			} );
		} );

		it( 'Remove events from buttons', function () {
			var b = before;
			var el = f.btn_events[0][0];
			var evnt = f.btn_events[0][1];
			$( el ).trigger( evnt );
			expect( before ).toBe( b + 1 );
			f.destroy();
			$( el ).trigger( evnt );
			//			expect( before ).toBe( b + 1 );
			f.init();
		} );

		it( 'Remove events from fields', function () {
			var b = before;
			var el = f.btn_events[0][0];
			var evnt = f.btn_events[0][1];
			$( el ).trigger( evnt );
			expect( before ).toBe( b + 1 );
			f.destroy();
			$( el ).trigger( evnt );
			expect( before ).toBe( b + 1 );
			f.init();
		} );

		it( 'Remove classes from submitButton', function () {
			f.destroy();
			expect( $( f.get( 'submitButton' ) ).hasClass( f.get( 'disabledClass' ) ) ).toBe( false );
			expect( $( f.get( 'submitButton' ) ).hasClass( f.get( 'processingClass' ) ) ).toBe( false );
			f.init();
		} );

		it( 'Remore all timers', function () {
			f.set( {timeout: 8000} );
			f.fieldTimeout.t_text = setTimeout( function () {
				$( f.validateField( f.form.test, true, true ) );
			}, f.get( 'timeout', 't_text' ) );
			expect( f.fieldTimeout.t_text ).toBeDefined();
			f.destroy();
			expect( f.fieldTimeout.t_text ).toBeUndefined();
			f.init();
		} );

		// remove onsubmit validation function
		it( 'Remove onsubmit function', function () {
			expect( f.form.onsubmit ).toBeDefined();
			f.destroy();
			expect( !f.form.onsubmit ).toBe( true );
			f.init();
			expect( f.form.onsubmit ).toBeDefined();
		} )
	} );

} );


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package netra.handlers;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author manthanhd
 */
public class PropertyManager {
    private String filename = null;
    private HashMap<String, String> map;
    private static PropertyManager instance;

    private PropertyManager(String filename) throws FileNotFoundException{
        this.filename = filename;
        map = new HashMap();
        initContent();
    }

    private void initContent() throws FileNotFoundException{
        BufferedReader reader = new BufferedReader(new FileReader(new File(filename)));
        String s = null;
        if(!map.isEmpty()){
            getMap().clear();
        }
        try {
            while((s = reader.readLine()) != null){
                String key = "", value = "";
                boolean isKey = true;
                char c;
                for(int i = 0;i<s.length();i++){
                    c = s.charAt(i);
                    if(c == '='){
                        isKey = false;
                    }

                    if(isKey){
                        key += c;
                    } else {
                        value += c;
                    }
                }
                key = key.trim();
                value = value.trim();
                getMap().put(key, value);
            }
        } catch (IOException ex) {
            Logger.getLogger(PropertyManager.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void init(String filename) throws FileNotFoundException{
        instance = new PropertyManager(filename);
    }

    public static PropertyManager getInstance(){
        if(instance == null){
            throw new NullPointerException("Property Manager was not initialized!");
        }
        return instance;
    }

    /**
     * @return the map
     */
    public HashMap<String, String> getMap() {
        return map;
    }
}


text:
<?php

namespace Drupal\Component\Plugin\Exception;

/**
 * Plugin exception class to be thrown when a plugin ID could not be found.
 */
class PluginNotFoundException extends PluginException {

  /**
   * Construct a PluginNotFoundException exception.
   *
   * @param string $plugin_id
   *   The plugin ID that was not found.
   * @param string $message
   *   The exception message.
   * @param int $code
   *   The exception code.
   * @param \Exception|null $previous
   *   The previous throwable used for exception chaining.
   *
   * @see \Exception
   */
  public function __construct($plugin_id, $message = '', $code = 0, \Exception $previous = NULL) {
    if (empty($message)) {
      $message = sprintf("Plugin ID '%s' was not found.", $plugin_id);
    }
    parent::__construct($message, $code, $previous);
  }

}


text:
namespace FanBook
{
    partial class form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.addressBar = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
            this.btnDownloadStory = new System.Windows.Forms.Button();
            this.lblProgressText = new System.Windows.Forms.Label();
            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            this.btnSaveStory = new System.Windows.Forms.Button();
            this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
            this.SuspendLayout();
            //
            // addressBar
            //
            this.addressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.addressBar.Location = new System.Drawing.Point(77, 12);
            this.addressBar.Name = "addressBar";
            this.addressBar.Size = new System.Drawing.Size(487, 20);
            this.addressBar.TabIndex = 0;
            this.addressBar.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 15);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(59, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Story URL:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(12, 37);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(34, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Story:";
            //
            // button1
            //
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.Location = new System.Drawing.Point(589, 12);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(54, 23);
            this.button1.TabIndex = 4;
            this.button1.Text = "Get Info";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.btnGetInfo);
            //
            // webBrowser1
            //
            this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.webBrowser1.Location = new System.Drawing.Point(15, 56);
            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
            this.webBrowser1.Name = "webBrowser1";
            this.webBrowser1.Size = new System.Drawing.Size(628, 483);
            this.webBrowser1.TabIndex = 5;
            //
            // btnDownloadStory
            //
            this.btnDownloadStory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.btnDownloadStory.Enabled = false;
            this.btnDownloadStory.Location = new System.Drawing.Point(15, 545);
            this.btnDownloadStory.Name = "btnDownloadStory";
            this.btnDownloadStory.Size = new System.Drawing.Size(90, 23);
            this.btnDownloadStory.TabIndex = 8;
            this.btnDownloadStory.Text = "Download Story";
            this.btnDownloadStory.UseVisualStyleBackColor = true;
            this.btnDownloadStory.Click += new System.EventHandler(this.button2_Click);
            //
            // lblProgressText
            //
            this.lblProgressText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.lblProgressText.AutoSize = true;
            this.lblProgressText.Location = new System.Drawing.Point(494, 550);
            this.lblProgressText.Name = "lblProgressText";
            this.lblProgressText.Size = new System.Drawing.Size(0, 13);
            this.lblProgressText.TabIndex = 10;
            //
            // saveFileDialog1
            //
            this.saveFileDialog1.DefaultExt = "html";
            this.saveFileDialog1.Filter = "Web Page (*.htm;*.html)|*.htm;*.html|All files(*.*)|*.*\"";
            this.saveFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.saveFileDialog1_FileOk);
            //
            // btnSaveStory
            //
            this.btnSaveStory.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.btnSaveStory.Enabled = false;
            this.btnSaveStory.Location = new System.Drawing.Point(256, 545);
            this.btnSaveStory.Name = "btnSaveStory";
            this.btnSaveStory.Size = new System.Drawing.Size(75, 23);
            this.btnSaveStory.TabIndex = 11;
            this.btnSaveStory.Text = "Save Story";
            this.btnSaveStory.UseVisualStyleBackColor = true;
            this.btnSaveStory.Click += new System.EventHandler(this.button3_Click_1);
            //
            // backgroundWorker1
            //
            this.backgroundWorker1.WorkerReportsProgress = true;
            this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
            this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
            this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
            //
            // form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(655, 580);
            this.Controls.Add(this.btnSaveStory);
            this.Controls.Add(this.lblProgressText);
            this.Controls.Add(this.btnDownloadStory);
            this.Controls.Add(this.webBrowser1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.addressBar);
            this.MinimumSize = new System.Drawing.Size(400, 400);
            this.Name = "form1";
            this.Text = "FanBook";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox addressBar;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.WebBrowser webBrowser1;
        private System.Windows.Forms.Button btnDownloadStory;
        private System.Windows.Forms.Label lblProgressText;
        private System.Windows.Forms.SaveFileDialog saveFileDialog1;
        private System.Windows.Forms.Button btnSaveStory;
        private System.ComponentModel.BackgroundWorker backgroundWorker1;
    }
}


text:
package conversion

import (
	"context"
	"crypto/rand"
	"crypto/x509"
	"crypto/x509/pkix"
	"encoding/asn1"
	"encoding/pem"
	"testing"

	"k8s.io/apimachinery/pkg/api/equality"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/utils/diff"
	"sigs.k8s.io/controller-runtime/pkg/client"

	"github.com/jetstack/cert-manager/pkg/api"
	v1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"
	"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2"
	"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha3"
	"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1beta1"
	cmmeta "github.com/jetstack/cert-manager/pkg/apis/meta/v1"
	"github.com/jetstack/cert-manager/pkg/util/pki"
	"github.com/jetstack/cert-manager/test/integration/framework"
)

func generateCSR(t *testing.T) []byte {
	skRSA, err := pki.GenerateRSAPrivateKey(2048)
	if err != nil {
		t.Fatal(err)
	}
	asn1Subj, _ := asn1.Marshal(pkix.Name{
		CommonName: "test",
	}.ToRDNSequence())
	template := x509.CertificateRequest{
		RawSubject: asn1Subj,
	}

	csrBytes, err := x509.CreateCertificateRequest(rand.Reader, &template, skRSA)
	if err != nil {
		t.Fatal(err)
	}

	csr := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE REQUEST", Bytes: csrBytes})

	return csr
}

func TestConversion(t *testing.T) {
	testCSR := generateCSR(t)

	tests := map[string]struct {
		input     client.Object
		targetGVK schema.GroupVersionKind
		output    client.Object
	}{
		"should convert Certificates from v1alpha2 to v1alpha3": {
			input: &v1alpha2.Certificate{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1alpha2.CertificateSpec{
					SecretName: "something",
					CommonName: "test",
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
			targetGVK: v1alpha3.SchemeGroupVersion.WithKind("Certificate"),
			output: &v1alpha3.Certificate{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1alpha3.CertificateSpec{
					SecretName: "something",
					CommonName: "test",
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
		},
		"should convert CertificateRequest from v1alpha2 to v1alpha3": {
			input: &v1alpha2.CertificateRequest{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1alpha2.CertificateRequestSpec{
					CSRPEM: testCSR,
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
			targetGVK: v1alpha3.SchemeGroupVersion.WithKind("CertificateRequest"),
			output: &v1alpha3.CertificateRequest{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1alpha3.CertificateRequestSpec{
					CSRPEM: testCSR,
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
		},
		"should convert Certificate from v1alpha2 to v1beta1": {
			input: &v1alpha2.Certificate{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1alpha2.CertificateSpec{
					SecretName:   "abc",
					CommonName:   "test",
					Organization: []string{"test"},
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
			targetGVK: v1beta1.SchemeGroupVersion.WithKind("Certificate"),
			output: &v1beta1.Certificate{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1beta1.CertificateSpec{
					SecretName: "abc",
					CommonName: "test",
					Subject: &v1beta1.X509Subject{
						Organizations: []string{"test"},
					},
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
		},
		"should convert Certificate from v1beta1 to v1": {
			input: &v1beta1.Certificate{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1beta1.CertificateSpec{
					SecretName: "abc",
					CommonName: "test",
					Subject: &v1beta1.X509Subject{
						Organizations: []string{"test"},
					},
					URISANs:   []string{"spiffe://foo.foo.example.net"},
					EmailSANs: []string{"alice@example.com"},
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
			targetGVK: v1.SchemeGroupVersion.WithKind("Certificate"),
			output: &v1.Certificate{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "test",
					Namespace: "default",
				},
				Spec: v1.CertificateSpec{
					SecretName: "abc",
					CommonName: "test",
					Subject: &v1.X509Subject{
						Organizations: []string{"test"},
					},
					URIs:           []string{"spiffe://foo.foo.example.net"},
					EmailAddresses: []string{"alice@example.com"},
					IssuerRef: cmmeta.ObjectReference{
						Name: "issuername",
					},
				},
			},
		},
	}
	for name, test := range tests {
		t.Run(name, func(t *testing.T) {
			config, stop := framework.RunControlPlane(t)
			defer stop()

			cl, err := client.New(config, client.Options{Scheme: api.Scheme})
			if err != nil {
				t.Fatal(err)
			}

			if err := cl.Create(context.Background(), test.input); err != nil {
				t.Fatal(err)
			}
			meta := test.input.(metav1.ObjectMetaAccessor)

			convertedObj, err := api.Scheme.New(test.targetGVK)
			if err != nil {
				t.Fatal(err)
			}

			if err := cl.Get(context.Background(), client.ObjectKey{Name: meta.GetObjectMeta().GetName(), Namespace: meta.GetObjectMeta().GetNamespace()}, convertedObj.(client.Object)); err != nil {
				t.Fatalf("failed to fetch object in expected API version: %v", err)
			}

			convertedObjMeta := convertedObj.(metav1.ObjectMetaAccessor)
			convertedObjMeta.GetObjectMeta().SetCreationTimestamp(metav1.Time{})
			convertedObjMeta.GetObjectMeta().SetGeneration(0)
			convertedObjMeta.GetObjectMeta().SetUID("")
			convertedObjMeta.GetObjectMeta().SetSelfLink("")
			convertedObjMeta.GetObjectMeta().SetResourceVersion("")
			convertedObjMeta.GetObjectMeta().SetManagedFields([]metav1.ManagedFieldsEntry{})

			if !equality.Semantic.DeepEqual(test.output, convertedObj) {
				t.Errorf("unexpected output: %s", diff.ObjectReflectDiff(test.output, convertedObj))
			}
		})
	}
}


text:
//=============================================================================================================

#ifndef BABYMEGCLIENT_H
#define BABYMEGCLIENT_H

//=============================================================================================================
// INCLUDES
//=============================================================================================================

#include "babymeginfo.h"
#include "babymeg_global.h"

//=============================================================================================================
// EIGEN INCLUDES
//=============================================================================================================

//=============================================================================================================
// QT INCLUDES
//=============================================================================================================

#include <QObject>
#include <QTcpSocket>
#include <QMutex>
#include <QThread>
#include <QDataStream>

//=============================================================================================================
// INCLUDES
//=============================================================================================================

#include "babymeginfo.h"

//=============================================================================================================
// FORWARD DECLARATIONS
//=============================================================================================================

class QNetworkSession;

//=============================================================================================================
// DEFINE NAMESPACE BABYMEGPLUGIN
//=============================================================================================================

namespace BABYMEGPLUGIN
{

//=============================================================================================================
/**
 * DECLARE CLASS BabyMEGClient
 *
 * @brief The BabyMEGClient class provides a TCP/IP communication between Qt and Labview.
 */
class BABYMEGSHARED_EXPORT BabyMEGClient : public QThread
{
    Q_OBJECT

public:
    //=========================================================================================================
    /**
     * Constructs a BabyMEG.
     */
    explicit BabyMEGClient(int myPort, QObject *parent = 0);

    ~BabyMEGClient();

    //=========================================================================================================
    /**
     * Convert an integer (4 bytes) to a 4-byte array
     *
     * @param[in] a -- <int>.
     * @param[out] Byte array.
     */
    QByteArray MGH_LM_Int2Byte(int a);

    //=========================================================================================================
    /**
     * Convert a 4-byte array to an integer
     *
     * @param[in] InByte -- Byte array.
     * @param[out] <int>.
     */
    int MGH_LM_Byte2Int(QByteArray InByte);

    //=========================================================================================================
    /**
     * Convert one 8-byte array to a double
     *
     * @param[in] InByte -- Byte array.
     * @param[out] <double>.
     */
    double MGH_LM_Byte2Double(QByteArray InByte);

    //=========================================================================================================
    /**
     * Hex display
     *
     * @param[in] a -- double number.
     */
    void HescDisplay(double a);

    //=========================================================================================================
    /**
     * Set Head Info
     *
     * @param[in] pInfo -- struct of header information.
     */
    void SetInfo(QSharedPointer<BabyMEGInfo> pInfo);

    //=========================================================================================================
    /**
     * Dispatch the data package
     *
     * @param[in] tmp -- block size.
     */
    void DispatchDataPackage(int tmp);

    //=========================================================================================================
    /**
     * Read next data block
     *
     * @param[in] tmp -- block size.
     */
    void ReadNextBlock(int tmp);

    //=========================================================================================================
    /**
     * Send command with command format as string
     *
     * @param[in] s -- string.
     */
    void SendCommand(QString s);

    //=========================================================================================================
    /**
     * Handle the data buffer connecting to the TCP socket
     *
     * @param[in] void.
     */
    void handleBuffer();

    //=========================================================================================================
    /**
     * Connect to BabyMEG server
     *
     * @param[in] void.
     */
    void ConnectToBabyMEG();

    //=========================================================================================================
    /**
     * DisConnect to BabyMEG server
     *
     * @param[in] void.
     */
    void DisconnectBabyMEG();

    //=========================================================================================================
    /**
     * Send Command to BabyMEG server
     *
     * @param[in] void.
     */
    void SendCommandToBabyMEG();

    //=========================================================================================================
    /**
     * Read data from socket to a buffer
     *
     * @param[in] void.
     */
    void ReadToBuffer();

    //=========================================================================================================
    /**
     * Send Command to BabyMEG command server with short sync connection
     *
     * @param[in] String s - the string will be sent to server.
     */
    void SendCommandToBabyMEGShortConnection(QByteArray s);

    void run();
    void DisplayError(int socketError, const QString &message);
    inline bool isConnected() const;

    QString                     name;

    quint16                     port;
    int                         numBlock;

    bool                        SkipLoop;
    bool                        DataAcqStartFlag;
    bool                        DataACK;

    QSharedPointer<BabyMEGInfo> myBabyMEGInfo;
    QByteArray                  buffer;

private:
    bool                        m_bSocketIsConnected;
    QTcpSocket*                 tcpSocket;

    QMutex                      m_qMutex;

signals:
    void DataAcq();
    void error(int socketError, const QString &message);
};

//=============================================================================================================
// INLINE DEFINITIONS
//=============================================================================================================

inline bool BabyMEGClient::isConnected() const
{
    return m_bSocketIsConnected;
}
} // NAMESPACE

#endif // BABYMEGCLIENT_H


text:
declare module 'lodash.upperfirst' {
  declare export default (string) => string
}


text:
/// @ingroup themeNames
/// @{
extern NSString *__nonnull const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines.
extern NSString *__nonnull const kCPTPlainBlackTheme;   ///< A graph theme with black backgrounds and white lines.
extern NSString *__nonnull const kCPTPlainWhiteTheme;   ///< A graph theme with white backgrounds and black lines.
extern NSString *__nonnull const kCPTSlateTheme;        ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views.
extern NSString *__nonnull const kCPTStocksTheme;       ///< A graph theme with a gradient background and white lines.
/// @}

@class CPTGraph;
@class CPTPlotAreaFrame;
@class CPTAxisSet;
@class CPTMutableTextStyle;

@interface CPTTheme : NSObject<NSCoding, NSSecureCoding>

@property (nonatomic, readwrite, strong, nullable) Class graphClass;

/// @name Theme Management
/// @{
+(void)registerTheme:(nonnull Class)themeClass;
+(nullable NSArray<Class> *)themeClasses;
+(nullable instancetype)themeNamed:(nullable NSString *)themeName;
+(nonnull NSString *)name;
/// @}

/// @name Theme Usage
/// @{
-(void)applyThemeToGraph:(nonnull CPTGraph *)graph;
/// @}

@end

/** @category CPTTheme(AbstractMethods)
 *  @brief CPTTheme abstract methods—must be overridden by subclasses
 **/
@interface CPTTheme(AbstractMethods)

/// @name Theme Usage
/// @{
-(nullable id)newGraph;

-(void)applyThemeToBackground:(nonnull CPTGraph *)graph;
-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame;
-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet;
/// @}

@end


text:
Repository Tools
---------------------

### [Developer tools](/contrib/devtools) ###
Specific tools for developers working on this repository.
Contains the script `github-merge.py` for merging GitHub pull requests securely and signing them using GPG.

### [Verify-Commits](/contrib/verify-commits) ###
Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script.

### [Linearize](/contrib/linearize) ###
Construct a linear, no-fork, best version of the blockchain.

### [Qos](/contrib/qos) ###

A Linux bash script that will set up traffic control (tc) to limit the outgoing bandwidth for connections to the Oakcoin network. This means one can have an always-on oakcoind instance running, and another local oakcoind/oakcoin-qt instance which connects to this node and receives blocks from it.

### [Seeds](/contrib/seeds) ###
Utility to generate the pnSeed[] array that is compiled into the client.

Build Tools and Keys
---------------------

### [Debian](/contrib/debian) ###
Contains files used to package oakcoind/oakcoin-qt
for Debian-based Linux systems. If you compile oakcoind/oakcoin-qt yourself, there are some useful files here.

### [Gitian-descriptors](/contrib/gitian-descriptors) ###
Notes on getting Gitian builds up and running using KVM.

### [Gitian-keys](/contrib/gitian-keys)
PGP keys used for signing Oakcoin Core [Gitian release](/doc/release-process.md) results.

### [MacDeploy](/contrib/macdeploy) ###
Scripts and notes for Mac builds.

### [RPM](/contrib/rpm) ###
RPM spec file for building oakcoin-core on RPM based distributions

### [Gitian-build](/contrib/gitian-build.sh) ###
Script for running full Gitian builds.

Test and Verify Tools
---------------------

### [TestGen](/contrib/testgen) ###
Utilities to generate test vectors for the data-driven Oakcoin tests.

### [Verify Binaries](/contrib/verifybinaries) ###
This script attempts to download and verify the signature file SHA256SUMS.asc from oakcoin.org.


text:
play 'block fun' do
  local_host

  # Compiles to an ansible 'include'
  ansible_include 'inclusion.yml' do
    variables howdy: 123
  end

  block do
    task 'say hello' do
      result = command 'uname'

      failed_when "'Linux' not in #{result.stdout}"
    end

    task 'and goodbye' do
      result = command 'uname -a ' + jinja('foo')

      failed_when "'Darwin' not in #{result.stdout}"
    end

    ansible_when jinja('stuff')
  end
end


text:
<?xml version="1.0" encoding="UTF-8" ?>
        <module>
            <name>blockcontact</name>
            <displayName><![CDATA[Contact Block]]></displayName>
            <version><![CDATA[1.0]]></version>
            <description><![CDATA[Allows you to add additional information about your store's customer service.]]></description>
            <author><![CDATA[]]></author>
            <tab><![CDATA[front_office_features]]></tab>
            <is_configurable>1</is_configurable>
            <need_instance>1</need_instance>
	<limited_countries></limited_countries>
        </module>


text:
package org.elasticsearch.action.admin.indices.close;

import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;

/**
 */
public class CloseIndexAction extends IndicesAction<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {

    public static final CloseIndexAction INSTANCE = new CloseIndexAction();
    public static final String NAME = "indices/close";

    private CloseIndexAction() {
        super(NAME);
    }

    @Override
    public CloseIndexResponse newResponse() {
        return new CloseIndexResponse();
    }

    @Override
    public CloseIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) {
        return new CloseIndexRequestBuilder(client);
    }
}


text:
#include <stdbool.h>
#include <errno.h>

#include "config.h"
#include "nrf24l01.h"
#include "crtp.h"
#include "configblock.h"
#include "ledseq.h"

#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"

static bool isInit;

#define RADIO_CONNECTED_TIMEOUT   M2T(2000)

/* Synchronisation */
xSemaphoreHandle dataRdy;
/* Data queue */
xQueueHandle txQueue;
xQueueHandle rxQueue;

static uint32_t lastPacketTick;

//Union used to efficiently handle the packets (Private type)
typedef union
{
  CRTPPacket crtp;
  struct {
    uint8_t size;
    uint8_t data[32];
  } __attribute__((packed)) raw;
} RadioPacket;

static struct {
  bool enabled;
} state;

static void interruptCallback()
{
  portBASE_TYPE  xHigherPriorityTaskWoken = pdFALSE;

  //To unlock RadioTask
  xSemaphoreGiveFromISR(dataRdy, &xHigherPriorityTaskWoken);

  if(xHigherPriorityTaskWoken)
    vPortYieldFromISR();
}

// 'Class' functions, called from callbacks
static int setEnable(bool enable)
{
  nrfSetEnable(enable);
  state.enabled = enable;

  return 0;
}

static int sendPacket(CRTPPacket * pk)
{
  if (!state.enabled)
    return ENETDOWN;
  xQueueSend( txQueue, pk, 0);

  return 0;
}

static int receivePacket(CRTPPacket * pk)
{
  if (!state.enabled)
    return ENETDOWN;

  xQueueReceive( rxQueue, pk, portMAX_DELAY);

  return 0;
}

static int reset(void)
{
  xQueueReset(txQueue);
  nrfFlushTx();

  return 0;
}

static bool isConnected(void)
{
  if ((xTaskGetTickCount() - lastPacketTick) > RADIO_CONNECTED_TIMEOUT)
    return false;

  return true;
}

static struct crtpLinkOperations radioOp =
{
  .setEnable         = setEnable,
  .sendPacket        = sendPacket,
  .receivePacket     = receivePacket,
  .isConnected       = isConnected,
  .reset             = reset,
};

/* Radio task handles the CRTP packet transfers as well as the radio link
 * specific communications (eg. Scann and ID ports, communication error handling
 * and so much other cool things that I don't have time for it ...)
 */
static void nrf24linkTask(void * arg)
{
  unsigned char dataLen;
  static RadioPacket pk;

  //Packets handling loop
  while(1)
  {
    ledseqRun(LED_GREEN, seq_linkup);

    while (!nrfInterruptActive())
    {
      xSemaphoreTake(dataRdy, M2T(10));
    }
    lastPacketTick = xTaskGetTickCount();

    //Fetch all the data (Loop until the RX Fifo is NOT empty)
    while( !(nrfRead1Reg(REG_FIFO_STATUS)&0x01) )
    {
      dataLen = nrfRxLength(0);

      if (dataLen>32)          //If a packet has a wrong size it is dropped
        nrfFlushRx();
      else                     //Else, it is processed
      {
        //Fetch the data
        pk.raw.size = dataLen-1;
        nrfReadRX((char *)pk.raw.data, dataLen);

        //Push it in the queue (If overflow, the packet is dropped)
        if (!CRTP_IS_NULL_PACKET(pk.crtp))  //Don't follow the NULL packets
          xQueueSend( rxQueue, &pk, 0);
      }
    }

    //Push the data to send (Loop until the TX Fifo is full or there is no more data to send)
    while( (uxQueueMessagesWaiting((xQueueHandle)txQueue) > 0) && !(nrfRead1Reg(REG_FIFO_STATUS)&0x20) )
    {
      xQueueReceive(txQueue, &pk, 0);
      pk.raw.size++;

      nrfWriteAck(0, (char*) pk.raw.data, pk.raw.size);
    }

    //clear the interruptions flags
    nrfWrite1Reg(REG_STATUS, 0x70);
  }
}

static void nrf24linkInitNRF24L01P(void)
{
  int i;
  char radioAddress[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};

  //Set the radio channel
  nrfSetChannel(configblockGetRadioChannel());
  //Set the radio data rate
  nrfSetDatarate(configblockGetRadioSpeed());
  //Set radio address
  nrfSetAddress(0, radioAddress);

  //Power the radio, Enable the DS interruption, set the radio in PRX mode
  nrfWrite1Reg(REG_CONFIG, 0x3F);
  vTaskDelay(M2T(2)); //Wait for the chip to be ready
  // Enable the dynamic payload size and the ack payload for the pipe 0
  nrfWrite1Reg(REG_FEATURE, 0x06);
  nrfWrite1Reg(REG_DYNPD, 0x01);

  //Flush RX
  for(i=0;i<3;i++)
    nrfFlushRx();
  //Flush TX
  for(i=0;i<3;i++)
    nrfFlushTx();
}

/*
 * Public functions
 */

void nrf24linkInit()
{
  if(isInit)
    return;

  nrfInit();

  vTaskSetApplicationTaskTag(0, (void*)TASK_RADIO_ID_NBR);

  /* Initialise the semaphores */
  vSemaphoreCreateBinary(dataRdy);

  /* Queue init */
  rxQueue = xQueueCreate(3, sizeof(RadioPacket));
  txQueue = xQueueCreate(3, sizeof(RadioPacket));

  nrfSetInterruptCallback(interruptCallback);

  nrf24linkInitNRF24L01P();

    /* Launch the Radio link task */
  xTaskCreate(nrf24linkTask, (const signed char * const)NRF24LINK_TASK_NAME,
              NRF24LINK_TASK_STACKSIZE, NULL, NRF24LINK_TASK_PRI, NULL);

  isInit = true;
}

bool nrf24linkTest()
{
  return nrfTest();
}

struct crtpLinkOperations * nrf24linkGetLink()
{
  return &radioOp;
}

void nrf24linkReInit(void)
{
  if (!isInit)
    return;

  nrf24linkInitNRF24L01P();
}


text:
Vim plugin for insert mode completion of words in adjacent tmux panes

## Motivation

If you're using Vim in tandem with Tmux you might be familiar with this pesky
situation:

You're happily editing your lovely files in Vim, when you notice you need to
type a word that you can see in a different Tmux pane right next to Vim. This
might be some secret key found in your REPL or the name of a failing test.

Usually the interesting text is too short to warrant switching panes and going
into Tmux' copy mode, so you end typing it out again.

## But fear no longer!

This plugin adds a completion function that puts all words visible in your Tmux
panes right under your fingertips. Just enter insert mode, start typing any
word you see and press `<C-X><C-U>` to the trigger user defined insert mode
completion.

![][example]

It also completes words that are scrolled off, hidden in background tmux
windows and even different tmux sessions. And it even works from gvim or
MacVim!

![][gvim]

[example]: https://raw.githubusercontent.com/wellle/images/master/tmux-complete-example.png
[gvim]: https://raw.githubusercontent.com/wellle/images/master/gvim-complete.png

## Third party integration

Tmux complete is automatically integrated with the following plugins:

- [asyncomplete](https://github.com/prabirshrestha/asyncomplete.vim)

    To see tmux completions in your asyncomplete pop-up you will need the async
    plugin as well:

    ```vim
    Plug 'prabirshrestha/async.vim'
    Plug 'prabirshrestha/asyncomplete.vim'
    Plug 'wellle/tmux-complete.vim'
    ```

    This integration comes with sensible defaults, but you have some options to
    fine tune it. To start put a block like this into your vimrc:

    ```vim
    let g:tmuxcomplete#asyncomplete_source_options = {
                \ 'name':      'tmuxcomplete',
                \ 'whitelist': ['*'],
                \ 'config': {
                \     'splitmode':      'words',
                \     'filter_prefix':   1,
                \     'show_incomplete': 1,
                \     'sort_candidates': 0,
                \     'scrollback':      0,
                \     'truncate':        0
                \     }
                \ }
    ```

    With `name` you can change how it appears in the pop-up. `whitelist` makes
    it possible to enable this integration only for certain filetypes.

    The `splitmode` can be `words`, `lines`, `ilines`, or `linies,words`.
    `ilines` stands for "inner line", starting with a word character (ignoring
    special chararcters in front) and `ilines,words` completes both lines and
    words.

    If `filter_prefix` is enabled, we will filter candidates based on the
    entered text, this usually gives faster results. For fuzzy matching this
    should be disabled.

    If there you are using many tmux windows with a lot of text in it,
    completion can be slow. That's why we start showing candidates as soon as
    they come in. If you prefer to only see candidates once the list is
    complete, you can disable this by setting `show_incomplete`.

    `sort_candidates` controls whether we sort candidates from tmux externally.
    If it's enabled we can't get early incomplete results. If you have
    `show_incomplete` disabled, this might get slightly quicker results and
    potentially better sorted completions.

    If `scrollback` is positive we will consider that many lines in each tmux
    pane's history for completion.

    If 'truncate' is positive, then only prefixes of the matches up to this
    length are shown in the completion pop-up. Upon selection the full match is
    completed of course.

- [coc](https://github.com/neoclide/coc.nvim)

    You can see tmux completions right in your coc pop-up.

- [ncm2](https://github.com/ncm2/ncm2)

    You can see tmux completions right in your ncm2 pop-up.

- [neocomplete](https://github.com/Shougo/neocomplete.vim)

    You can see tmux completions right in your neocomplete pop-up.

- [neocomplcache](https://github.com/Shougo/neocomplcache.vim)

    You can see tmux completions right in your neocomplcache pop-up.

- [deoplete](https://github.com/Shougo/deoplete.nvim)

    You can see tmux completions right in your deoplete pop-up.

- [unite](https://github.com/Shougo/unite.vim)

    You can use tmux complete as a unite source:

    ```vim
    Unite tmuxcomplete       " opens a menu containing words from adjacent tmux windows
    Unite tmuxcomplete/lines " opens a menu containing words from adjacent tmux windows and lines where they were found
    ```

- [nvim-compe](https://github.com/hrsh7th/nvim-compe)

    You can use tmux complete as a compe source:

    ```vim
    let g:compe.source.tmux = v:true
    ```

## Installation

Use your favorite plugin manager.

- [Vim-plug][vim-plug]

    ```vim
    Plug 'wellle/tmux-complete.vim'
    ```

- [NeoBundle][neobundle]

    ```vim
    NeoBundle 'wellle/tmux-complete.vim'
    ```

- [Vundle][vundle]

    ```vim
    Bundle 'wellle/tmux-complete.vim'
    ```

- [Pathogen][pathogen]

    ```sh
    git clone git://github.com/wellle/tmux-complete.vim.git ~/.vim/bundle/tmux-complete.vim
    ```

[neobundle]: https://github.com/Shougo/neobundle.vim
[vundle]: https://github.com/gmarik/vundle
[vim-plug]: https://github.com/junegunn/vim-plug
[pathogen]: https://github.com/tpope/vim-pathogen

## Settings

Use the `#trigger` option to tune the way you interact with
tmux-complete by putting one of these lines into your `.vimrc`:

- By default, tmux-complete sets Vim's `completefunc`, that can be invoked with
  `<C-X><C-U>`.

    ```vim
    let g:tmuxcomplete#trigger = 'completefunc'
    ```

- Alternatively, you can use Vim's `omnifunc`, that can be invoked with
  `<C-X><C-O>`. This setting also integrates with
  [YouCompleteMe](https://github.com/Valloric/YouCompleteMe) so you can see
  Tmux completions when hitting `<C-Space>`.

    ```vim
    let g:tmuxcomplete#trigger = 'omnifunc'
    ```

- If you're using the [neocomplete](https://github.com/Shougo/neocomplete.vim),
  [neocomplcache](https://github.com/Shougo/neocomplcache.vim) or
  [deoplete](https://github.com/Shougo/deoplete.nvim) integration, you probably
  don't need the additional trigger.

    ```vim
    let g:tmuxcomplete#trigger = ''
    ```

The trigger function itself is named `tmuxcomplete#complete` (in case you want
to call it manually).


text:
/**
 * Contains classes related to the construction and maintenance of indexed
 * vocabularies of objects.
 */
@ParametersAreNonnullByDefault package uk.ac.susx.mlcl.byblo.enumerators;

import javax.annotation.ParametersAreNonnullByDefault;


text:
#ifndef MediaStreamEvent_h
#define MediaStreamEvent_h

#include "modules/EventModules.h"
#include "modules/mediastream/MediaStream.h"
#include "modules/mediastream/MediaStreamEventInit.h"
#include "wtf/text/AtomicString.h"

namespace blink {

class MediaStreamEvent final : public Event {
    DEFINE_WRAPPERTYPEINFO();
public:
    virtual ~MediaStreamEvent();

    static PassRefPtrWillBeRawPtr<MediaStreamEvent> create();
    static PassRefPtrWillBeRawPtr<MediaStreamEvent> create(const AtomicString& type, bool canBubble, bool cancelable, MediaStream*);
    static PassRefPtrWillBeRawPtr<MediaStreamEvent> create(const AtomicString& type, const MediaStreamEventInit& initializer);

    MediaStream* stream() const;
    MediaStream* stream(bool&) const;

    virtual const AtomicString& interfaceName() const override;

    virtual void trace(Visitor*) override;

private:
    MediaStreamEvent();
    MediaStreamEvent(const AtomicString& type, bool canBubble, bool cancelable, MediaStream*);
    MediaStreamEvent(const AtomicString& type, const MediaStreamEventInit&);

    PersistentWillBeMember<MediaStream> m_stream;
};

} // namespace blink

#endif // MediaStreamEvent_h


text:
title: 'We''re (still) recruiting! Second Open Call for BETA Teams! '
date: 2017-09-19T21:29:10.219Z
excerpt: >-
  Applications wanted for Treasurer, Heads of Fundraising, Legal Affairs and
  Team Officers for Layout & Design, Concept & Partnerships
comments: false
share: true
published: true
edit: true
---
![null](/assets/images/21463222_10155573195503211_3881211325650300646_n.jpg)

Bringing Europeans Together Association (BETA e.V.) is pleased to announce its SECOND OPEN CALL for our Team! Applications  open for the following positions:

* Treasurer
* Head of Fundraising
* Head of Legal Affairs
* Layout & Design Team Officers
* Concept & Partnerships Team Officers

We are looking for enthusiastic young volunteers to join a fast-growing family of European youth organisations. We present you a unique opportunity to develop projects as a part of a multicultural learning and working environment.

If you would like to be part of an international team of young and dynamic people from all across Europe and beyond, join us today!

If you are up for the challenge, please apply [HERE.](https://goo.gl/forms/UOlW9ocQJBQVKjfX2)

The deadline for applications is September 24th, 2017 at 23:59 CEST.