text:
#ifndef SHRPX_HTTP_DOWNSTREAM_CONNECTION_H
#define SHRPX_HTTP_DOWNSTREAM_CONNECTION_H

#include "shrpx.h"

#include "http-parser/http_parser.h"

#include "shrpx_downstream_connection.h"
#include "shrpx_io_control.h"
#include "shrpx_connection.h"

namespace shrpx {

class DownstreamConnectionPool;

class HttpDownstreamConnection : public DownstreamConnection {
public:
  HttpDownstreamConnection(DownstreamConnectionPool *dconn_pool, size_t group,
                           struct ev_loop *loop);
  virtual ~HttpDownstreamConnection();
  virtual int attach_downstream(Downstream *downstream);
  virtual void detach_downstream(Downstream *downstream);

  virtual int push_request_headers();
  virtual int push_upload_data_chunk(const uint8_t *data, size_t datalen);
  virtual int end_upload_data();

  virtual void pause_read(IOCtrlReason reason);
  virtual int resume_read(IOCtrlReason reason, size_t consumed);
  virtual void force_resume_read();

  virtual int on_read();
  virtual int on_write();

  virtual void on_upstream_change(Upstream *upstream);
  virtual int on_priority_change(int32_t pri) { return 0; }
  virtual size_t get_group() const;

  virtual bool poolable() const { return true; }

  int on_connect();
  void signal_write();

private:
  Connection conn_;
  IOControl ioctrl_;
  http_parser response_htp_;
  size_t group_;
  // index of get_config()->downstream_addrs this object is using
  size_t addr_idx_;
  bool connected_;
};

} // namespace shrpx

#endif // SHRPX_HTTP_DOWNSTREAM_CONNECTION_H


text:
using namespace RDKit;

namespace RDGeom {
  unsigned int ci_GRIDPICKLE_VERSION=0x1;

  UniformGrid3D::UniformGrid3D(const UniformGrid3D &other){
    PRECONDITION(other.dp_storage,"cannot copy an unintialized grid");
    RDKit::DiscreteValueVect *data=new RDKit::DiscreteValueVect(*other.dp_storage);
    initGrid(other.d_numX*other.d_spacing,
             other.d_numY*other.d_spacing,
             other.d_numZ*other.d_spacing,
             other.d_spacing,
             other.dp_storage->getValueType(),
             other.d_offSet,
             data);
  }

  void UniformGrid3D::initGrid(double dimX, double dimY, double dimZ, double spacing,
                               RDKit::DiscreteValueVect::DiscreteValueType valType,
                               const RDGeom::Point3D &offSet,
                               RDKit::DiscreteValueVect *data) {
    PRECONDITION(dimX > 0.0, "Invalid x-dimension for grid");
    PRECONDITION(dimY > 0.0, "Invalid y-dimension for grid");
    PRECONDITION(dimZ > 0.0, "Invalid z-dimension for grid");
    PRECONDITION(spacing > 0.0, "Invalid spacing for grid");
    d_numX = static_cast<unsigned int>(floor(dimX/spacing + 0.5));
    d_numY = static_cast<unsigned int>(floor(dimY/spacing + 0.5));
    d_numZ = static_cast<unsigned int>(floor(dimZ/spacing + 0.5));
    PRECONDITION((!data)||data->getValueType()==valType,"grid data type mismatch");
    PRECONDITION((!data)||data->getLength()==d_numX*d_numY*d_numZ,"grid data size mismatch");

    d_spacing = spacing;
    d_offSet = offSet;
    if(!data){
      dp_storage = new RDKit::DiscreteValueVect(valType, d_numX*d_numY*d_numZ);
    } else {
      dp_storage = data;
    }
  }

  UniformGrid3D::UniformGrid3D(const std::string pkl) {
    dp_storage=0;
    this->initFromText(pkl.c_str(),pkl.size());
  }
  UniformGrid3D::UniformGrid3D(const char *pkl,
                               const unsigned int len){
    dp_storage=0;
    this->initFromText(pkl,len);
  }

  UniformGrid3D::~UniformGrid3D() {
    delete dp_storage;
    dp_storage=NULL;
  }

  int UniformGrid3D::getGridIndex(unsigned int xi, unsigned int yi, unsigned int zi) const {
    if (xi >= d_numX) {
      return -1;
    }
    if (yi >= d_numY) {
      return -1;
    }
    if (zi >= d_numZ) {
      return -1;
    }
    return (zi*d_numX*d_numY + yi*d_numX + xi);
  }

  void UniformGrid3D::getGridIndices(unsigned int idx,unsigned int &xi, unsigned int &yi, unsigned int &zi) const {
    if(idx >= d_numX*d_numY*d_numZ){
      throw IndexErrorException(idx);
    }
    xi = idx%d_numX;
    yi = (idx%(d_numX*d_numY))/d_numX;
    zi = idx/(d_numX*d_numY);
  }

  int UniformGrid3D::getGridPointIndex(const Point3D &point) const {
    Point3D tPt(point);
    tPt -= d_offSet;//d_origin;
    tPt /= d_spacing;
    int xi, yi, zi;
    double move = 0.5;
    xi = static_cast<int>(floor(tPt.x + move));
    yi = static_cast<int>(floor(tPt.y + move));
    zi = static_cast<int>(floor(tPt.z + move));

    if ((xi < 0) || (xi >= static_cast<int>(d_numX))) {
      return -1;
    }
    if ((yi < 0) || (yi >= static_cast<int>(d_numY))) {
      return -1;
    }
    if ((zi < 0) || (zi >= static_cast<int>(d_numZ))) {
      return -1;
    }

    return (zi*d_numX*d_numY + yi*d_numX + xi);
  }

  int UniformGrid3D::getVal(const Point3D &point) const {
    int id = getGridPointIndex(point);
    if (id < 0) {
      return -1;
    }
    return dp_storage->getVal(static_cast<unsigned int>(id));
  }

  unsigned int UniformGrid3D::getVal(unsigned int pointId) const {
    return dp_storage->getVal(pointId);
  }

  void UniformGrid3D::setVal(const Point3D &point, unsigned int val) {
    int id = getGridPointIndex(point);
    if (id < 0) {
      return;
    }
    dp_storage->setVal(static_cast<unsigned int>(id), val);
  }

  Point3D UniformGrid3D::getGridPointLoc(unsigned int pointId) const {
    if(pointId >= d_numX*d_numY*d_numZ){
      throw IndexErrorException(pointId);
    }
    Point3D res;
    res.x = (pointId%d_numX)*d_spacing;
    res.y = ((pointId%(d_numX*d_numY))/d_numX)*d_spacing;
    res.z = (pointId/(d_numX*d_numY))*d_spacing;
    res += d_offSet; //d_origin;
    return res;
  }

  void UniformGrid3D::setVal(unsigned int pointId, unsigned int val) {
    dp_storage->setVal(pointId, val);
  }

  bool UniformGrid3D::compareParams(const UniformGrid3D &other) const {
    if (d_numX != other.getNumX()) return false;
    if (d_numY != other.getNumY()) return false;
    if (d_numZ != other.getNumZ()) return false;
    if (fabs(d_spacing - other.getSpacing()) > SPACING_TOL) return false;
    Point3D dOffset = d_offSet;
    dOffset -= other.getOffset();
    if (dOffset.lengthSq() > OFFSET_TOL) {
      return false;
    }
    return true;
  }

  void UniformGrid3D::setSphereOccupancy(const Point3D & center, double radius,
                                         double stepSize, int maxNumLayers,
                                         bool ignoreOutOfBound) {
    int ptIndex = this->getGridPointIndex(center);
    if (ptIndex == -1) {
      if (ignoreOutOfBound) {
        return;
      } else {
        throw GridException("Center outside the grdi boundary");
      }
    }
    Point3D gPt(center); // point on the grid
    gPt -= d_offSet;

    gPt /= d_spacing;

    //unsigned int z = ptIndex/(d_numX*d_numY);
    //unsigned int y = (ptIndex%(d_numX*d_numY))/d_numX;
    //unsigned int x = ptIndex%d_numX;

    unsigned int bPerVal = dp_storage->getNumBitsPerVal();
    unsigned int maxVal = (1 << bPerVal) - 1;
    unsigned int nLayers = maxVal;
    unsigned int valStep = 1;
    if ((maxNumLayers > 0) && (maxNumLayers <= static_cast<int>(nLayers))) {
      nLayers = maxNumLayers;
      valStep = (maxVal+1)/nLayers;
    }
    double bgRad = radius/d_spacing; // base radius in grid coords
    double gStepSize = stepSize/d_spacing; //step size in grid coords
    double gRadius = bgRad + nLayers*gStepSize; // largest radius in grid coords
    double gRad2 = gRadius*gRadius;
    double bgRad2 = bgRad*bgRad;
    int i, j, k;
    double dx, dy, dz, d, d2, dy2z2, dz2;
    int xmin, xmax, ymin, ymax, zmin, zmax;
    xmax = (int)floor(gPt.x + gRadius);
    xmin = (int)ceil(gPt.x - gRadius);
    ymax = (int)floor(gPt.y + gRadius);
    ymin = (int)ceil(gPt.y - gRadius);
    zmax = (int)floor(gPt.z + gRadius);
    zmin = (int)ceil(gPt.z - gRadius);

    unsigned int oval, val, valChange;
    int ptId1, ptId2;
    for (k = zmin; k <= zmax; ++k) {
      if ((k >= 0) && (k < (int)d_numZ)) { // we are inside the grid in the z-direction
        dz = static_cast<double>(k) - gPt.z;
        dz2 = dz*dz;
        ptId1 = k*d_numX*d_numY;
        for (j = ymin; j <= ymax; ++j) {
          if ((j >= 0) && (j < (int)d_numY)) { // inside the grid in the y-direction
            dy = static_cast<double>(j) - gPt.y;
            dy2z2 = dy*dy + dz2;
            if (dy2z2 < gRad2) { // we are within the radius at least from the y,z coordinates
              ptId2 = ptId1 + j*d_numX;
              for (i = xmin; i <= xmax; ++i) {
                if ((i >= 0) && (i < (int)d_numX)) {
                  oval = dp_storage->getVal((unsigned int)(ptId2+i));
                  if (oval < maxVal) { // if we are already at maxVal we will not change that
                    dx = static_cast<double>(i) - gPt.x;
                    d2 = dx*dx + dy2z2;
                    if (d2 < gRad2) { //we are inside the sphere
                      if (d2 < bgRad2) {
                        val = maxVal;
                      } else {
                        d = sqrt(d2);
                        valChange = (static_cast<unsigned int>((d - bgRad)/gStepSize + 1))*(valStep);
                        if (valChange < maxVal) {
                          val = maxVal - valChange;
                        } else {
                          val = 0;
                        }
                      }
                      if (val > oval) {
                        dp_storage->setVal(ptId2+i, val);
                      }
                    } // we are inside the sphere
                  } // grid point does not already have maxVal
                } // inside the grid in x-direction
              } // loop over points in x-direction
            } // inside the sphere based on only z and y coords
          } // we are inside the grid in the y-direction
        } // loop over points in y-direction
      } // inside grid in z-direction
    } // loop over points in z-direction
  }

  UniformGrid3D &UniformGrid3D::operator|=(const UniformGrid3D &other) {
    PRECONDITION(dp_storage,"unintialized grid");
    PRECONDITION(other.dp_storage,"unintialized grid");
    PRECONDITION(compareParams(other),"incompatible grids");

    // EFF: we're probably doing too much copying here:
    RDKit::DiscreteValueVect *newData=new RDKit::DiscreteValueVect((*dp_storage) | (*other.dp_storage));
    delete dp_storage;
    dp_storage = newData;
    return *this;
  }

  UniformGrid3D &UniformGrid3D::operator&=(const UniformGrid3D &other) {
    PRECONDITION(dp_storage,"unintialized grid");
    PRECONDITION(other.dp_storage,"unintialized grid");
    PRECONDITION(compareParams(other),"incompatible grids");

    // EFF: we're probably doing too much copying here:
    RDKit::DiscreteValueVect *newData=new RDKit::DiscreteValueVect((*dp_storage) & (*other.dp_storage));
    delete dp_storage;
    dp_storage = newData;
    return *this;
  }

  UniformGrid3D &UniformGrid3D::operator+=(const UniformGrid3D &other) {
    PRECONDITION(dp_storage,"unintialized grid");
    PRECONDITION(other.dp_storage,"unintialized grid");
    PRECONDITION(compareParams(other),"incompatible grids");

    // EFF: we're probably doing too much copying here:
    *dp_storage += *other.dp_storage;
    return *this;
  }

  UniformGrid3D &UniformGrid3D::operator-=(const UniformGrid3D &other) {
    PRECONDITION(dp_storage,"unintialized grid");
    PRECONDITION(other.dp_storage,"unintialized grid");
    PRECONDITION(compareParams(other),"incompatible grids");

    // EFF: we're probably doing too much copying here:
    *dp_storage -= *other.dp_storage;
    return *this;
  }

  std::string UniformGrid3D::toString() const {
    std::stringstream ss(std::ios_base::binary|std::ios_base::out|std::ios_base::in);
    boost::int32_t tVers = ci_GRIDPICKLE_VERSION*-1;
    streamWrite(ss,tVers);
    boost::uint32_t tInt;
    tInt=d_numX;
    streamWrite(ss,tInt);
    tInt=d_numY;
    streamWrite(ss,tInt);
    tInt=d_numZ;
    streamWrite(ss,tInt);
    streamWrite(ss,d_spacing);
    streamWrite(ss,d_offSet.x);
    streamWrite(ss,d_offSet.y);
    streamWrite(ss,d_offSet.z);

    std::string storePkl=dp_storage->toString();
    boost::uint32_t pklSz=storePkl.size();
    streamWrite(ss,pklSz);
    ss.write(storePkl.c_str(),pklSz*sizeof(char));

    std::string res(ss.str());
    return(res);
  }
  void UniformGrid3D::initFromText(const char *pkl,const unsigned int length){
    std::stringstream ss(std::ios_base::binary|std::ios_base::in|std::ios_base::out);
    ss.write(pkl,length);
    boost::int32_t tVers;
    streamRead(ss,tVers);
    tVers *= -1;
    if(tVers==0x1){

    } else {
      throw ValueErrorException("bad version in UniformGrid3D pickle");
    }
    boost::uint32_t tInt;
    streamRead(ss,tInt);
    d_numX=tInt;
    streamRead(ss,tInt);
    d_numY=tInt;
    streamRead(ss,tInt);
    d_numZ=tInt;
    streamRead(ss,d_spacing);
    double oX,oY,oZ;
    streamRead(ss,oX);
    streamRead(ss,oY);
    streamRead(ss,oZ);
    d_offSet = Point3D(oX,oY,oZ);

    boost::uint32_t pklSz;
    streamRead(ss,pklSz);
    char *buff = new char[pklSz];
    ss.read(buff,pklSz*sizeof(char));
    delete dp_storage;
    dp_storage = new RDKit::DiscreteValueVect(buff,pklSz);
    delete [] buff;
  }

  void writeGridToStream(const UniformGrid3D &grid, std::ostream &outStrm) {
    int dimX = (int)grid.getNumX();//+2;
    int dimY = (int)grid.getNumY();//+2;
    int dimZ = (int)grid.getNumZ();//+2;
    double spacing = grid.getSpacing();
    double lenX = dimX*spacing;
    double lenY = dimY*spacing;
    double lenZ = dimZ*spacing;
    Point3D offSet = grid.getOffset();
    offSet /= spacing;
    outStrm << "Grid file representing a Shape \n\n";
    outStrm << lenX << " " << lenY << " " << lenZ << " 90.0 90.0 90.0" << std::endl;
    outStrm << dimX-1 << " " << dimY-1 << " " << dimZ-1 << std::endl;

    int outX1 = (int)(floor(offSet.x+0.5));
    int outX2 = (int)(floor(offSet.x+0.5))+ (int)(dimX-1);
    // REVIEW: ok - here is a fix to try and make the grid closer to the molecule when displayed
    // (atleast in PyMol). The difference between the pair of values (outX1, outX2) is (dimX-1),
    // that is not the case with pairs the (outY1, outY2) a (outZ1, outZ2). In these cases, the difference is
    // dimY and dimZ respectively. Not sure why this should be the case, but almost always we get a
    // better display in PyMol.
    int outY1 = (int)(floor(offSet.y+0.5));
    int outY2 = (int)(floor(offSet.y+0.5))+ (int)(dimY);
    int outZ1 = (int)(floor(offSet.z+0.5));
    int outZ2 = (int)(floor(offSet.z+0.5))+ (int)(dimZ);

    outStrm << "1"
            << " " << outX1 << " " << outX2
            << " " << outY1 << " " << outY2
            << " " << outZ1 << " " << outZ2 << "\n";
    unsigned int i, nPts = grid.getSize();
    for (i = 0; i < nPts; i++) {
      outStrm <<  static_cast<double>(grid.getVal(i)) << std::endl;
    }
  }

  void writeGridToFile(const UniformGrid3D &grid, std::string filename) {
    //std::ofstream ofStrm(filename.c_str());
    std::ofstream *ofStrm = new std::ofstream(filename.c_str());
    std::ostream *oStrm =  static_cast<std::ostream *>(ofStrm);
    writeGridToStream(grid, *oStrm);
    delete ofStrm;
  }
}

redpajama_set_name: RedPajamaGithub


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.5
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.frostwire.jlibtorrent.swig;

public class file_completed_alert extends torrent_alert {
  private long swigCPtr;

  protected file_completed_alert(long cPtr, boolean cMemoryOwn) {
    super(libtorrent_jni.file_completed_alert_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(file_completed_alert obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        libtorrent_jni.delete_file_completed_alert(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public file_completed_alert(torrent_handle h, int idx) {
    this(libtorrent_jni.new_file_completed_alert(torrent_handle.getCPtr(h), h, idx), true);
  }

  public int type() {
    return libtorrent_jni.file_completed_alert_type(swigCPtr, this);
  }

  public int category() {
    return libtorrent_jni.file_completed_alert_category(swigCPtr, this);
  }

  public String what() {
    return libtorrent_jni.file_completed_alert_what(swigCPtr, this);
  }

  public String message() {
    return libtorrent_jni.file_completed_alert_message(swigCPtr, this);
  }

  public void setIndex(int value) {
    libtorrent_jni.file_completed_alert_index_set(swigCPtr, this, value);
  }

  public int getIndex() {
    return libtorrent_jni.file_completed_alert_index_get(swigCPtr, this);
  }

  public final static int alert_type = libtorrent_jni.file_completed_alert_alert_type_get();
  public final static int static_category = libtorrent_jni.file_completed_alert_static_category_get();
}


text:
<!DOCTYPE html>

  PASS: did not crash.


text:
const { getSplittedDataFromFile, str2num, timer, sortAsc, combinations, sum, mult } = require('../utilities');

timer.start();

for (const comb of combinations(sortAsc(str2num(getSplittedDataFromFile(1))), 3)) {
    if (sum(comb) === 2020) {
        console.log(mult(comb));
        break;
    }
}

timer.stop();


text: export * from  './selectivity/selectivity';


text:
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq.Expressions;
using System.Reflection;
using RazorEngine.Templating;

using SharpCore.Logging;

namespace SharpDoc
{
    internal class DynamicHelper : IDynamicMetaObjectProvider
    {
        public DynamicHelper()
        {
            Methods = new Dictionary<string, List<HelperMethod>>();
        }

        private Dictionary<string, List<HelperMethod>> Methods { get; set;}

        DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject( Expression parameter)
        {
            return new DynamicDictionaryMetaObject(parameter, this);
        }

        private class HelperMethod
        {
            public ITemplate Template { get; set; }

            public MethodInfo Method { get; set; }
        }

        public void RegisterHelper(ITemplate template, MethodInfo methodInfo)
        {
            string name = methodInfo.Name;
            List<HelperMethod> list;
            if (!Methods.TryGetValue(name, out list))
            {
                list = new List<HelperMethod>();
                Methods.Add(name, list);
            }
            list.Add(new HelperMethod { Method = methodInfo, Template = template } );
        }

        #region Nested type: DynamicDictionaryMetaObject

        private class DynamicDictionaryMetaObject : DynamicMetaObject
        {
            internal DynamicDictionaryMetaObject(
                Expression parameter,
                DynamicHelper value)
                : base(parameter, BindingRestrictions.Empty, value)
            {
            }

            public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)
            {
                var dictionary = (DynamicHelper)Value;

                if (!dictionary.Methods.ContainsKey(binder.Name))
                {
                    Logger.Error("Unable to find method [{0}]", binder.Name);
                    return null;
                }

                var  helperMethodInstanceList = dictionary.Methods[binder.Name];
                HelperMethod helperMethodInstance = null;

                // Find correct method
                foreach (var helperMethod in helperMethodInstanceList)
                {
                    var parameterInfos = helperMethod.Method.GetParameters();
                    if ( helperMethod.Method.GetParameters().Length == args.Length)
                    {
                        bool isMethodFound = true;
                        for (int i = 0; i < parameterInfos.Length; i++)
                        {
                            var parameterInfo = parameterInfos[i];
                            var argumentType = args[i].RuntimeType ?? parameterInfo.ParameterType;
                            if (!parameterInfo.ParameterType.IsAssignableFrom(argumentType))
                            {
                                isMethodFound = false;
                            }
                        }
                        if (isMethodFound)
                        {
                            helperMethodInstance = helperMethod;
                            break;
                        }
                    }
                }

                if (helperMethodInstance == null)
                {
                    // Todo, write parameters
                    throw new InvalidOperationException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Unable to find target method [{0}]", binder.Name));
                }

                var methodParams = new Expression[args.Length];
                for (int i = 0; i < args.Length; i++)
                    methodParams[i] = args[i].Expression;

                var methodToString = typeof (TemplateWriter).GetMethod("ToString");

                var computeResult =
                    Expression.Call(Expression.Call(Expression.Constant(helperMethodInstance.Template), helperMethodInstance.Method, methodParams),
                                    methodToString);

                return new DynamicMetaObject(computeResult, BindingRestrictions.GetTypeRestriction(Expression, LimitType));
            }
        }

        #endregion
    }
}


text:
using EasyLOB.Security;
using System.Collections.Generic;

namespace EasyLOB.Library.App
{
    public class AppProfile
    {
        #region Properties User

        public bool IsAdministrator { get; }

        public bool IsAuthenticated { get; }

        public List<string> Roles { get; }

        public string UserName { get; }

        #endregion Properties User

        #region Properties Audit Trail

        public List<AppProfileAuditTrail> AuditTrail { get; }

        #endregion Properties Audit Trail

        #region Methods

        public AppProfile()
        {
            IsAdministrator = false;
            IsAuthenticated = false;
            Roles = new List<string>();
            UserName = "";

            AuditTrail = new List<AppProfileAuditTrail>();
        }

        public AppProfile(IAuthenticationManager authenticationManager)
        {
            IsAdministrator = authenticationManager.IsAdministrator;
            IsAuthenticated = authenticationManager.IsAuthenticated;
            Roles = authenticationManager.Roles;
            UserName = authenticationManager.UserName;

            AuditTrail = new List<AppProfileAuditTrail>();
        }

        #endregion Methods
    }

    public class AppProfileAuditTrail
    {
        #region Properties

        public string Domain { get; set; }

        public string Entity { get; set; }

        public string LogMode { get; set; }

        public string LogOperations { get; set; }

        #endregion Properties
    }
}


text:
package org.apache.activemq.artemis.core.settings;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class RepositoryTest extends ActiveMQTestBase {

   HierarchicalRepository<HashSet<Role>> securityRepository;

   @Override
   @Before
   public void setUp() throws Exception {
      super.setUp();

      securityRepository = new HierarchicalObjectRepository<>();
   }

   @Test
   public void testDefault() {
      securityRepository.setDefault(new HashSet<Role>());
      HashSet<Role> roles = securityRepository.getMatch("queues.something");

      Assert.assertEquals(roles.size(), 0);
   }

   @Test
   public void testMatchingDocs() throws Throwable {
      HierarchicalObjectRepository<String> repo = new HierarchicalObjectRepository<>();

      repo.addMatch("a.b.#", "ab#");
      repo.addMatch("a.b.d.#", "abd#");
      repo.addMatch("#", "root");

      Assert.assertEquals("ab#", repo.getMatch("a.b"));
      Assert.assertEquals("ab#", repo.getMatch("a.b.c"));
      Assert.assertEquals("abd#", repo.getMatch("a.b.d.lll"));
      Assert.assertEquals("root", repo.getMatch("z.z.z.z.z"));
   }

   @Test
   public void testSingleMatch() {
      securityRepository.addMatch("queues.*", new HashSet<Role>());
      HashSet<Role> hashSet = securityRepository.getMatch("queues.something");
      Assert.assertEquals(hashSet.size(), 0);
   }

   @Test
   public void testSingletwo() {
      securityRepository.addMatch("queues.another.aq.*", new HashSet<Role>());
      HashSet<Role> roles = new HashSet<>(2);
      roles.add(new Role("test1", true, true, true, true, true, true, true, true));
      roles.add(new Role("test2", true, true, true, true, true, true, true, true));
      securityRepository.addMatch("queues.aq", roles);
      HashSet<Role> roles2 = new HashSet<>(2);
      roles2.add(new Role("test1", true, true, true, true, true, true, true, true));
      roles2.add(new Role("test2", true, true, true, true, true, true, true, true));
      roles2.add(new Role("test3", true, true, true, true, true, true, true, true));
      securityRepository.addMatch("queues.another.andanother", roles2);

      HashSet<Role> hashSet = securityRepository.getMatch("queues.another.andanother");
      Assert.assertEquals(hashSet.size(), 3);
   }

   @Test
   public void testWithoutWildcard() {
      securityRepository.addMatch("queues.1.*", new HashSet<Role>());
      HashSet<Role> roles = new HashSet<>(2);
      roles.add(new Role("test1", true, true, true, true, true, true, true, true));
      roles.add(new Role("test2", true, true, true, true, true, true, true, true));
      securityRepository.addMatch("queues.2.aq", roles);
      HashSet<Role> hashSet = securityRepository.getMatch("queues.2.aq");
      Assert.assertEquals(hashSet.size(), 2);
   }

   @Test
   public void testMultipleWildcards() {
      HierarchicalRepository<String> repository = new HierarchicalObjectRepository<>();
      repository.addMatch("#", "#");
      repository.addMatch("a", "a");
      repository.addMatch("a.#", "a.#");
      repository.addMatch("a.*", "a.*");
      repository.addMatch("a.b.c", "a.b.c");
      repository.addMatch("a.*.c", "a.*.c");
      repository.addMatch("a.d.c", "a.d.c");
      repository.addMatch("a.b.#", "a.b.#");
      repository.addMatch("a.b", "a.b");
      repository.addMatch("a.b.c.#", "a.b.c.#");
      repository.addMatch("a.b.c.d", "a.b.c.d");
      repository.addMatch("a.*.*.d", "a.*.*.d");
      repository.addMatch("a.*.d.#", "a.*.d.#");
      String val = repository.getMatch("a");
      Assert.assertEquals("a", val);
      val = repository.getMatch("a.b");
      Assert.assertEquals("a.b", val);
      val = repository.getMatch("a.x");
      Assert.assertEquals("a.*", val);
      val = repository.getMatch("a.b.x");
      Assert.assertEquals("a.b.#", val);
      val = repository.getMatch("a.b.c");
      Assert.assertEquals("a.b.c", val);
      val = repository.getMatch("a.d.c");
      Assert.assertEquals("a.d.c", val);
      val = repository.getMatch("a.x.c");
      Assert.assertEquals("a.*.c", val);
      val = repository.getMatch("a.b.c.d");
      Assert.assertEquals("a.b.c.d", val);
      val = repository.getMatch("a.x.c.d");
      Assert.assertEquals("a.*.*.d", val);
      val = repository.getMatch("a.b.x.d");
      Assert.assertEquals("a.*.*.d", val);
      val = repository.getMatch("a.d.x.d");
      Assert.assertEquals("a.*.*.d", val);
      val = repository.getMatch("a.d.d.g");
      Assert.assertEquals("a.*.d.#", val);
      val = repository.getMatch("zzzz.z.z.z.d.r.g.f.sd.s.fsdfd.fsdfs");
      Assert.assertEquals("#", val);
   }

   @Test
   public void testRepositoryMerge() {
      HierarchicalRepository<DummyMergeable> repository = new HierarchicalObjectRepository<>();
      repository.addMatch("#", new DummyMergeable(1));
      repository.addMatch("a.#", new DummyMergeable(2));
      repository.addMatch("b.#", new DummyMergeable(3));
      repository.addMatch("a.b.#", new DummyMergeable(4));
      repository.addMatch("b.c.#", new DummyMergeable(5));
      repository.addMatch("a.b.c.#", new DummyMergeable(6));
      repository.addMatch("a.b.*.d", new DummyMergeable(7));
      repository.addMatch("a.b.c.*", new DummyMergeable(8));
      repository.getMatch("a.b.c.d");
      Assert.assertEquals(5, DummyMergeable.timesMerged);
      Assert.assertTrue(DummyMergeable.contains(1));
      Assert.assertTrue(DummyMergeable.contains(2));
      Assert.assertTrue(DummyMergeable.contains(4));
      Assert.assertTrue(DummyMergeable.contains(7));
      Assert.assertTrue(DummyMergeable.contains(8));
      DummyMergeable.reset();
      repository.getMatch("a.b.c");
      Assert.assertEquals(3, DummyMergeable.timesMerged);
      Assert.assertTrue(DummyMergeable.contains(1));
      Assert.assertTrue(DummyMergeable.contains(2));
      Assert.assertTrue(DummyMergeable.contains(4));
      DummyMergeable.reset();
      repository.getMatch("z");
      Assert.assertEquals(0, DummyMergeable.timesMerged);
      DummyMergeable.reset();
   }

   @Test
   public void testAddListener() {
      HierarchicalRepository<String> repository = new HierarchicalObjectRepository<>();
      repository.addMatch("#", "1");
      repository.addMatch("B", "2");

      final AtomicInteger called = new AtomicInteger(0);
      repository.registerListener(new HierarchicalRepositoryChangeListener() {
         @Override
         public void onChange() {
            called.incrementAndGet();
         }
      });

      assertEquals(1, called.get());

      repository.disableListeners();

      repository.addMatch("C", "3");

      assertEquals(1, called.get());

      repository.enableListeners();

      assertEquals(2, called.get());

      repository.addMatch("D", "4");

      assertEquals(3, called.get());

      repository.removeMatch("D");

      assertEquals(4, called.get());

      repository.disableListeners();

      repository.removeMatch("C");

      assertEquals(4, called.get());
   }

   @Test
   public void testIllegalMatches() {
      HierarchicalRepository<String> repository = new HierarchicalObjectRepository<>();
      try {
         repository.addMatch("hjhjhjhjh.#.hhh", "test");
         fail("expected exception");
      } catch (IllegalArgumentException e) {
         // pass
      }
      try {
         repository.addMatch(null, "test");
         fail("expected exception");
      } catch (IllegalArgumentException e) {
         // pass
      }
   }

   static class DummyMergeable implements Mergeable {

      static int timesMerged = 0;

      static ArrayList<Integer> merged = new ArrayList<>();

      private final Integer id;

      static void reset() {
         DummyMergeable.timesMerged = 0;
         DummyMergeable.merged = new ArrayList<>();
      }

      static boolean contains(final Integer i) {
         return DummyMergeable.merged.contains(i);
      }

      DummyMergeable(final Integer id) {
         this.id = id;
      }

      @Override
      public void merge(final Object merged) {
         DummyMergeable.timesMerged++;
         DummyMergeable.merged.add(id);
         DummyMergeable.merged.add(((DummyMergeable) merged).id);
      }
   }
}


text:
import isObject from '@zap/utils/isObject'
import truncate from './truncate'

/**
 * sanitize - Sanitize specific object properties (by truncating them).
 *
 * NOTE: This method takes a rudimentary approach to modifying the object properties that could have unintended
 * side-effects, such as removing prototype data.
 *
 * @param {*} data sanitize (truncate) object properties
 * @param {Array} properties list of object properties to sanitize
 * @returns {*} cloned object with sanitized properties
 */
const sanitize = (data, properties = []) => {
  let sanitizedData
  if (isObject(data)) {
    sanitizedData = { ...data }
    properties.forEach(key => {
      if (data[key]) {
        sanitizedData[key] = truncate(data[key])
      }
    })
  }
  return sanitizedData || data
}

export default sanitize


text:
module SimpleTasksRuby
  class ProductionData
    def self.get_path
      File.expand_path("../../../samples/realData.txt", __FILE__)
    end
  end
end


text:
package main

import (
	"flag"
	"io"
	"strings"
	"net/http"
	"os"
	"os/signal"
	"runtime/pprof"
	"syscall"

        "github.com/evoila/influxdb-firehose-nozzle/influxdbfirehosenozzle"
        "github.com/evoila/influxdb-firehose-nozzle/nozzleconfig"
        "github.com/evoila/influxdb-firehose-nozzle/logger"
        "github.com/evoila/influxdb-firehose-nozzle/uaatokenfetcher"
	"github.com/evoila/influxdb-firehose-nozzle/cfinstanceinfoapi"
)

var (
 	logFilePath = flag.String("logFile", "", "The agent log file, defaults to STDOUT")
 	logLevel    = flag.Bool("debug", false, "Debug logging")
     	configFile  = flag.String("config", "config/influxdb-firehose-nozzle.json", "Location of the nozzle config json file")
)

func main() {
	flag.Parse()

	log := logger.NewLogger(*logLevel, *logFilePath, "influxdb-firehose-nozzle", "")

	config, err := nozzleconfig.Parse(*configFile)
	if err != nil {
		log.Fatalf("Error parsing config: %s", err.Error())
	}

        tokenFetcher := uaatokenfetcher.New(
 		config.UAAURL,
 		config.Client,
 		config.ClientSecret,
 		config.SsLSkipVerify,
 		log,
 	)

	threadDumpChan := registerGoRoutineDumpSignalChannel()
	defer close(threadDumpChan)
	go dumpGoRoutine(threadDumpChan)

	go runServer()
	appmap := make(map[string]cfinstanceinfoapi.AppInfo)

	log.Infof("Capturing events of type: " + config.EventFilter)
	if (strings.Contains(config.EventFilter,"HttpStartStop") || strings.Contains(config.EventFilter,"ContainerMetric")) {
		cfinstanceinfoapi.GenAppMap(config, appmap)
        	go cfinstanceinfoapi.UpdateAppMap(config, appmap)
	}

	influxDbNozzle := influxdbfirehosenozzle.NewInfluxDbFirehoseNozzle(config, tokenFetcher, log, appmap)
	influxDbNozzle.Start()
}

func defaultResponse(w http.ResponseWriter, r *http.Request) {
	io.WriteString(w, "{ \"status\" : \"running\" }")
}

func runServer() {
	port := os.Getenv("PORT")

	log := logger.NewLogger(*logLevel, *logFilePath, "influxdb-firehose-nozzle", "")
	log.Infof("Go Port from environment: " + port)

	if port == "" {
		port = "8000"
	}

	log.Infof("Starting server with port: " + port)

	http.HandleFunc("/", defaultResponse)
	http.ListenAndServe(":"+port, nil)
}

func registerGoRoutineDumpSignalChannel() chan os.Signal {
	threadDumpChan := make(chan os.Signal, 1)
	signal.Notify(threadDumpChan, syscall.SIGUSR1)

	return threadDumpChan
}

func dumpGoRoutine(dumpChan chan os.Signal) {
	for range dumpChan {
		goRoutineProfiles := pprof.Lookup("goroutine")
		if goRoutineProfiles != nil {
			goRoutineProfiles.WriteTo(os.Stdout, 2)
		}
	}
}


text:
/**
 * Created by vlado on 22-Sep-16.
 */
;
(function () {
    'use strict';

    describe('cityGetApp.weather.controller module:', function () {

        beforeEach(function () {

            module('ui.router');
            module('cityGetApp.constant');
            module('cityGetApp.routeRequest');
            module('cityGetApp.controllers');
            module('cityGetApp.city.service');

        });

        describe('WeatherCityCtrl - ', function () {

            var ctrl, scope, rootScope, CityService, q, deferred, weather, stateParams;

            beforeEach(inject(
                function (_$controller_, _$rootScope_, _CityService_, _$q_, _$stateParams_) {

                    rootScope = _$rootScope_;
                    scope = rootScope.$new();
                    CityService = _CityService_;
                    q = _$q_;
                    deferred = q.defer();
                    stateParams = _$stateParams_;

                    stateParams = {zipCode: '98555'};
                    scope.global = {
                        error: null
                    };
                    weather = {
                        channel: {
                            item: '98555'
                        }
                    };

                    spyOn(CityService, 'getWeather').and.returnValue(deferred.promise);

                    ctrl = _$controller_('WeatherCityCtrl', {

                        $rootScope: rootScope,
                        $scope: scope,
                        CityService: CityService

                    });
                }));

            it('WeatherCityCtrl should be initialized', function () {
                expect(ctrl).toBeDefined();
            });

            it('$scope.weather should be defined and NULL', function () {
                expect(scope.weather).toBeDefined();
                expect(scope.weather).toBeNull();
            });

            describe('$scope.global: ', function () {

                it('$scope.global should be defined', function () {
                    expect(scope.global).toBeDefined();
                });

                it('$scope.global.error should be defined and NULL', function () {
                    expect(scope.global.error).toBeDefined();
                    expect(scope.global.error).toBeNull();
                });

            });

            describe('CityService.getWeather(): ', function () {

                it('should to be defined', function () {
                    expect(CityService.getWeather().then).toBeDefined();
                });

                it('should be defined and return products', function () {
                    deferred.resolve(weather);
                    scope.$apply();

                    expect(scope.weather).toEqual(stateParams.zipCode);
                    expect(scope.global.error).toBeNull();
                });

                it('should reject promise', function () {
                    var response = "Error!";

                    deferred.reject(response);
                    scope.$apply();

                    expect(scope.weather).toBeNull();
                    expect(scope.global.error).toEqual(response);
                });

            });

        });
    });

}());


text:
module Import
  module ContentHelper
    def countries_yaml_content
      countries.inject([]) do |output, country|
        output << "    #{country[:code]}: \"#{country[:name]}\""
        output
      end.join("\n")
    end

    def countries_hash_content
      countries.inject([]) do |output, country|
        output << "    :#{country[:code]} => \"#{country[:name]}\","
        output
      end.join("\n")
    end

    def get_output
      send :"#{file_ext}_output"
    end

    def yaml_output
      output = %Q{#{locale}:
  countries:
#{countries_yaml_content}
}
    end

    def rb_output
      output = <<HASH
{
:#{locale} => {
  :countries => {
    #{countries_hash_content}
  }
}
}
HASH
    end
    alias_method :yml_output, :yaml_output
  end
end


text:
This is a helper for you to easily handle the login hud;

For example:
using hud to show information:

	+ (MBProgressHUD *)showMessage:(NSString *)message toView:(UIView *)view;

	+ (MBProgressHUD *)showMessage:(NSString *)message;

for faster access:

	+ (void)showSuccess:(NSString *)success toView:(UIView *)view;
	+ (void)showError:(NSString *)error toView:(UIView *)view;

or fastest access:

	+ (void)showSuccess:(NSString *)success;
	+ (void)showError:(NSString *)error;

hiding the hud after usage:

+ (void)hideHUDForView:(UIView *)view;
+ (void)hideHUD;

typically:

	[MBProgressHUD showMessage:@"loading..."];

	[MBProgressHUD performSelector:@selector(showSuccess:) withObject:@"login Success" afterDelay:1.5];

Go to Demo for more info.

Hopefully you will enjoy in it!

license: MIT.


text:
<?php

namespace Athene2Test\HydratorTest\Zend;

use Athene2\Hydrator\Zend\PluginAwareReflection;
use Athene2Test\HydratorTest\Asset\AbstractPluginAwareTest;
use Athene2Test\HydratorTest\Asset\EntityAsset;

class PluginAwareReflectionTest extends AbstractPluginAwareTest
{
    public function testHydrateCallsPlugin()
    {
        $pluginManager = $this->getPluginManager();
        $hydrator      = new PluginAwareReflection($pluginManager);
        $entity        = new EntityAsset();
        $plugin        = $this->addPlugin($pluginManager, 'foo');
        $data          = [];

        $plugin->expects($this->once())->method('hydrate')->with($data, $entity)->will($this->returnValue(['id' => 1]));
        $hydrator->addPlugin('foo');

        $hydrator->hydrate($data, $entity);
        $this->assertEquals(1, $entity->getId());
    }

    public function testExtractCallsPlugin()
    {
        $pluginManager = $this->getPluginManager();
        $hydrator      = new PluginAwareReflection($pluginManager);
        $entity        = new EntityAsset();
        $plugin        = $this->addPlugin($pluginManager, 'foo');

        $entity->setId(1);
        $hydrator->addPlugin('foo');

        $plugin->expects($this->once())->method('extract')->with($entity)->will($this->returnValue(['foo' => 'bar']));
        $this->assertEquals(['id' => 1, 'foo' => 'bar'], $hydrator->extract($entity));
    }
}


text:
/**
 * Server API routes
 * @namespace server.routes
 */


text:
package org.motechproject.openmrs19.it;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.motechproject.event.MotechEvent;
import org.motechproject.event.listener.EventListener;
import org.motechproject.event.listener.EventListenerRegistryService;
import org.motechproject.openmrs19.domain.OpenMRSConcept;
import org.motechproject.openmrs19.domain.OpenMRSConceptName;
import org.motechproject.openmrs19.exception.ConceptNameAlreadyInUseException;
import org.motechproject.openmrs19.service.EventKeys;
import org.motechproject.openmrs19.service.OpenMRSConceptService;
import org.motechproject.testing.osgi.BasePaxIT;
import org.motechproject.testing.osgi.container.MotechNativeTestContainerFactory;
import org.ops4j.pax.exam.ExamFactory;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerSuite;

import javax.inject.Inject;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

@RunWith(PaxExam.class)
@ExamReactorStrategy(PerSuite.class)
@ExamFactory(MotechNativeTestContainerFactory.class)
public class MRSConceptServiceIT extends BasePaxIT {

    @Inject
    private OpenMRSConceptService conceptAdapter;

    @Inject
    EventListenerRegistryService eventListenerRegistry;

    final Object lock = new Object();

    MrsListener mrsListener;

    OpenMRSConcept conceptOne;
    OpenMRSConcept conceptTwo;

    @Before
    public void setUp() throws ConceptNameAlreadyInUseException, InterruptedException {

        mrsListener = new MrsListener();

        eventListenerRegistry.registerListener(mrsListener, Arrays.asList(EventKeys.CREATED_NEW_CONCEPT_SUBJECT,
                EventKeys.UPDATED_CONCEPT_SUBJECT,EventKeys.DELETED_CONCEPT_SUBJECT));

        conceptTwo = createConcept(prepareConceptTwo());
        conceptOne = createConcept(prepareConceptOne());
    }

    @Test
    public void shouldCreateConcept() throws ConceptNameAlreadyInUseException {

        assertEquals(conceptOne.getName().getName(), mrsListener.eventParameters.get(EventKeys.CONCEPT_NAME));
        assertEquals(conceptOne.getDataType(), mrsListener.eventParameters.get(EventKeys.CONCEPT_DATA_TYPE));
        assertEquals(conceptOne.getConceptClass(), mrsListener.eventParameters.get(EventKeys.CONCEPT_CONCEPT_CLASS));

        assertTrue(mrsListener.created);
        assertFalse(mrsListener.updated);
        assertFalse(mrsListener.deleted);
    }

    @Test
    public void shouldUpdateConcept() throws InterruptedException, ConceptNameAlreadyInUseException {

        conceptOne.setDataType("Text");
        conceptOne.setConceptClass("Test");

        OpenMRSConcept updatedConcept;

        synchronized (lock) {
            updatedConcept = (OpenMRSConcept) conceptAdapter.updateConcept(conceptOne);
            lock.wait(6000);
        }

        assertNotNull(updatedConcept);

        assertEquals(conceptOne.getDataType(), mrsListener.eventParameters.get(EventKeys.CONCEPT_DATA_TYPE));
        assertEquals(conceptOne.getConceptClass(), mrsListener.eventParameters.get(EventKeys.CONCEPT_CONCEPT_CLASS));

        assertTrue(mrsListener.created);
        assertTrue(mrsListener.updated);
        assertFalse(mrsListener.deleted);
    }

    @Test
    public void shouldDeleteConcept() throws InterruptedException, ConceptNameAlreadyInUseException {

        synchronized (lock) {
            conceptAdapter.deleteConcept(conceptOne.getUuid());
            assertNull(conceptAdapter.getConceptByUuid(conceptOne.getUuid()));

            lock.wait(60000);
        }

        assertTrue(mrsListener.created);
        assertFalse(mrsListener.updated);
        assertTrue(mrsListener.deleted);
    }

    @Test
    public void shouldGetAllConcepts() throws ConceptNameAlreadyInUseException, InterruptedException {

        List<? extends OpenMRSConcept> concepts = conceptAdapter.getAllConcepts();

        assertTrue(concepts.size() >= 2);
    }

    @Test
    public void shouldGetConcepts() {

        List<? extends OpenMRSConcept> concepts = conceptAdapter.getConcepts(1, 1);

        assertTrue(concepts.size() == 1);

        concepts = conceptAdapter.getConcepts(1, 2);

        assertTrue(concepts.size() == 2);

    }

    @Test
    public void shouldFindSingleConceptByName() throws InterruptedException, ConceptNameAlreadyInUseException {

        List<? extends OpenMRSConcept> concepts = conceptAdapter.search(conceptOne.getName().getName());

        assertEquals(1, concepts.size());

        assertEquals(concepts.get(0), conceptOne);

    }

    @After
    public void tearDown() throws InterruptedException {

        deleteConcept(conceptOne);
        deleteConcept(conceptTwo);

        eventListenerRegistry.clearListenersForBean(mrsListener.getIdentifier());
    }

    private OpenMRSConcept prepareConceptOne() {

        OpenMRSConcept concept = new OpenMRSConcept();
        OpenMRSConceptName conceptName = new OpenMRSConceptName("FooConceptOne");

        concept.setNames(Arrays.asList(conceptName));
        concept.setDataType("TEXT");
        concept.setConceptClass("Test");

        return concept;
    }

    private OpenMRSConcept prepareConceptTwo() {

        OpenMRSConcept concept = new OpenMRSConcept();
        OpenMRSConceptName conceptName = new OpenMRSConceptName("FooConceptTwo");

        concept.setNames(Arrays.asList(conceptName));
        concept.setDataType("TEXT");
        concept.setConceptClass("Test");

        return concept;
    }

    private OpenMRSConcept createConcept(OpenMRSConcept concept) throws ConceptNameAlreadyInUseException, InterruptedException {

        OpenMRSConcept created;

        synchronized (lock) {
            created = conceptAdapter.createConcept(concept);
            assertNotNull(created);
            lock.wait(60000);
        }
        return created;
    }

    private void deleteConcept(OpenMRSConcept concept) throws InterruptedException {

        conceptAdapter.deleteConcept(concept.getUuid());
        assertNull(conceptAdapter.getConceptByUuid(concept.getUuid()));

    }

    public class MrsListener implements EventListener {

        private boolean created = false;
        private boolean deleted = false;
        private boolean updated = false;
        private Map<String, Object> eventParameters;

        public void handle(MotechEvent event) {

            if (event.getSubject().equals(EventKeys.CREATED_NEW_CONCEPT_SUBJECT)) {
                created = true;
            } else if (event.getSubject().equals(EventKeys.UPDATED_CONCEPT_SUBJECT)) {
                updated = true;
            } else if (event.getSubject().equals(EventKeys.DELETED_CONCEPT_SUBJECT)) {
                deleted = true;
            }
            eventParameters = event.getParameters();
            synchronized (lock) {
                lock.notify();
            }
        }

        @Override
        public String getIdentifier() {
            return "mrsTestListener";
        }
    }
}


text:
<nz-tabset
  class="main-view-tabs query-result__tabs"
  [nzAnimated]="false"
  nzSize="small"
  nzTabBarGutter="16"
  [(nzSelectedIndex)]="selectedIndex"
>
  <nz-tab
    [nzTitle]="'QUERY_RESULT_TAB' | translate"
    [nzDisabled]="isSubscribed"
  >

              {{ 'QUERY_RESULT_NO_RESULT_TEXT' | translate }}

              {{responseStatus}} {{responseStatusText}}
              <app-icon name="clock"></app-icon> {{responseTime}}ms

            <button track-id="download_result" class="query-result__download-button" (click)="downloadResultChange.next()">
              <app-icon name="download"></app-icon>
              {{ 'QUERY_RESULT_DOWNLOAD_RESULT_BUTTON' | translate }}
            </button>
            <button
              *ngFor="let uiAction of uiActions"
              class="query-result__download-button"
              (click)="uiActionExecuteChange.next(uiAction)"
            >
              {{ uiAction.title }}
            </button>

          <ngx-codemirror
            #editor
            class="app-query-result-textarea"
            [options]="resultEditorConfig"
            [ngModel]="queryResult | json"
          ></ngx-codemirror>

  </nz-tab>
  <nz-tab
    [nzTitle]="'SUBSCRIPTION_RESULT_TAB' | translate"
    [nzDisabled]="!isSubscribed && !subscriptionResponses?.length"
  >

                  {{ subscriptionUrl }}

                <button track-id="clear_subscription" class="subscription-button" (click)="clearSubscriptionChange.next()">{{ 'SUBSCRIPTIONS_CLEAR_TEXT' | translate }}</button>
                <button track-id="stop_subscription" class="subscription-button subscription-button--stop" (click)="stopSubscriptionChange.next()">{{ 'SUBSCRIPTIONS_STOP_TEXT' | translate }}</button>

            <app-subscription-result-item
              *ngFor="let item of subscriptionResponses; trackBy:subscriptionResponseTrackBy;"
              [data]="item"
            ></app-subscription-result-item>

            <button
              *ngIf="isSubscribed"
              class="subscription-result__float-action-button"
              [ngClass]="{ 'subscription-result__float-action-button--active': autoscrollSubscriptionResponses }"
              (click)="autoscrollSubscriptionResponsesChange.next()"
            >
              {{ 'SUBSCRIPTIONS_AUTOSCROLL_TEXT' | translate }}
            </button>

  </nz-tab>
  <nz-tab
    [nzTitle]="'RESPONSE_HEADERS_TAB' | translate"
  >

        <nz-table
          #smallTable
          nzSize="small"
          nzNoResult=""
          [nzShowPagination]="false"
          [nzTemplateMode]="true"
        >

              Name
              Value

              {{ headerKey }}
              {{ responseHeaders[headerKey] }}

        </nz-table>

          {{ 'RESPONSE_HEADERS_MORE_IN_APPS' | translate }}

  </nz-tab>
</nz-tabset>

      {{ panel.title }}

    <ng-container
      *ngFor="let panel of bottomPanels; trackBy:trackById"
    >

        <app-element-wrapper
          [element]="panel.element"
          [windowId]="windowId"
          [activeWindowId]="activeWindowId"
        ></app-element-wrapper>

    </ng-container>


text:
<?php namespace App\Exceptions;

use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;

abstract class AbstractException extends Exception
	{
	    protected $id;
	    protected $status = '404';
	    protected $title;
	    protected $details;
        protected $model;
    	protected $messages;

	    public function __construct($message)
	    {
	    	$message = $this->create(func_get_args())
	        parent::__construct($message);
	    }

     //    public function __construct(MessageBag $errors)
	    // {
	    //     $this->errors = $errors;
	    //     parent::__construct('Validation has failed.');
	    // }

	    public function getStatus()
	    {
	        return (int) $this->status;
	    }

	    public function toArray()
	    {
	        return [
	            'id'     => $this->id,
	            'status' => $this->status,
	            'title'  => $this->title,
	            'details' => $this->details,
	        ];
	    }

	    protected function create(array $args)
	    {
	        $this->id = array_shift($args);
	        $error = config(sprintf('errors.%s', $this->id));
	        $this->title  = $error['title'];
	        $this->detail = vsprintf($error['details'], $args);
	        return $this->details;
	    }

	    public function __toString()
	    {
	        $lines = explode("\n", parent::__toString());

	        return array_shift($lines)." \nValidation errors:\n".implode($this->errors->all(), "\n")."\n".implode($lines, "\n");
	    }

	    public function toJson($options = 0)
	    {
	        return json_encode($this->toArray(), $options);
	    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<metamorph xmlns="http://www.culturegraph.org/metamorph" version="1">

	<rules>

		<!-- UDC fields, standard and non-standard (11.10.2012 / osc) -->

		<!--Recursion at the beginning perhaps it might make sense to refactor all such recursions just at the beginning or into a seperate file-->
		<!-- quetsions
			- why indicators with ?? and not '*' - is there a differne in behaviour?
		-->
		<concat name="@080" delimiter="" flushWith="080??" reset="true" >
			<data source="080??.a" />
			<data source="080??.x" />
		</concat>

		<!-- doesn't work I get ony the first and datasource doesn't provide flush-->
		<!--
		<data source="690?7.2" name="@6907.2" />
		<data source="909?7.2" name="@9097.2"/>
		-->

		<entity name="classif_udc[]" flushWith="record">
			<combine name="" value="${080}" >
				<data source="@080" name="080"/>
			</combine>

			<!-- this combination of flushWith and reset is important for this use case, otherwise we can't collect multiple datafield tags
			 valid against the rule

			 todo: give explanation for this behaviour!
			 -->
			<combine name="" value="${690u}"  flushWith="690??" reset="true">
			<!-- template
        <xsl:for-each select="$fragment/datafield[@tag='690'][@ind2='7'][matches(descendant::subfield[@code='2'][1],'^snl local', 'i')]/subfield[@code='u']">
            <field name="classif_udc">
                <xsl:value-of select="." />
            </field>
        </xsl:for-each>
			-->

				<if>
					<data source="690?7.2">
						<!-- no occurence because we need all datafields -->
						<!--<occurrence only="1"/>-->
						<case to="lower"/>
						<regexp match="^snl local"/>
					</data>

				</if>
				<data source="690?7.u" name="690u" />

			</combine>
			<combine name="" value="${909c}" flushWith="909??" reset="true">
				<!-- template
				<xsl:for-each select="$fragment/datafield[@tag='909'][@ind2='7'][matches(descendant::subfield[@code='2'][1], 'sb_xxxx', 'i')]/subfield[@code='c']">
					<field name="classif_udc">
						<xsl:value-of select="." />
					</field>
				</xsl:for-each>
				-->

				<if>
					<data source="909?7.2">

						 <!-- <occurrence only="1"/> -->
						<case to="lower"/>
						<regexp  match="sb_xxxx" />
					</data>
				</if>
				<data source="909?7.c" name="909c"/>
			</combine>
		</entity>

	</rules>

</metamorph>


text:
package com.fanlehai.java.algorithm;

import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import org.junit.Assert;
import org.junit.Test;

public class Bubble {

	public void bubble(LinkedList<Integer> list) {
		if (list == null) {
			throw new NullPointerException();
		}
		Boolean bChange = false;
		for(int i =0; i<list.size()-1; ++i){
			if (list.get(i) > list.get(i+1)) {
				list.set(i, list.get(i) ^ list.get(i+1));
				list.set(i+1, list.get(i) ^ list.get(i+1));
				list.set(i, list.get(i) ^ list.get(i+1));
				bChange = true;
			}
		}
		if (bChange) {
			bubble(list);
		}
	}

	@Test
	public void bubbleTest(){
		List<Integer> list = Arrays.asList(8,9,4,5,7,6,3,2,1);
		LinkedList<Integer> linkedList = new LinkedList<>(list);
		bubble(linkedList);
		Collections.sort(list);
		Assert.assertArrayEquals(list.toArray(), linkedList.toArray());
	}

}


text:
layout: page
title: Andrew Guerrero's 75th Birthday
date: 2016-05-24
author: Katherine Fitzpatrick
tags: weekly links, java
status: published
summary: Cum sociis natoque penatibus et magnis dis parturient.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 11/09/2018
  endDate: 11/14/2018
  ctyhocn: ELKMDHX
  groupCode: AG7B
published: true
---
Vestibulum ultricies dolor sed lectus tempor commodo. Nunc quis ornare ante. Curabitur ac purus lacus. Curabitur magna erat, lacinia in aliquam et, fringilla non lorem. Sed tristique, lectus ut commodo fermentum, ipsum justo elementum purus, vitae vulputate purus lorem porttitor mauris. Duis a dolor in nisl fermentum blandit. Mauris semper imperdiet mauris vel commodo.
Fusce luctus vehicula vehicula. Cras ut dapibus leo. Quisque eu sagittis dolor. Integer a sapien in ex hendrerit vulputate vel et ante. Morbi facilisis nulla ac vulputate viverra. Aliquam eu maximus ipsum, ut fringilla magna. Praesent ac odio nunc.

* Duis dapibus lacus ut tincidunt scelerisque
* Nullam imperdiet dui non metus sollicitudin lacinia
* Proin non diam hendrerit, consectetur tellus et, fringilla neque.

Suspendisse varius fermentum lorem, at mollis eros fermentum sit amet. Cras neque felis, tristique et accumsan sed, feugiat quis velit. Vivamus vitae suscipit ante, in auctor nisi. Fusce pharetra ac mauris ac mollis. Donec molestie urna in nulla ultrices, eleifend iaculis ligula sodales. Donec elementum nec massa facilisis ullamcorper. Ut justo mi, bibendum at velit a, egestas eleifend nisl. Sed bibendum quam pulvinar, elementum dui molestie, mattis orci. In efficitur quam vel dolor vestibulum, consequat blandit sapien commodo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer placerat elit ut sapien ornare, vel porta ex venenatis. Vestibulum consequat eros at efficitur hendrerit. Sed commodo semper magna ac ullamcorper. Praesent sit amet elit vel neque dignissim fringilla sit amet in massa.
Nulla lacinia auctor diam ut viverra. Curabitur lacinia nisi at luctus commodo. Donec rhoncus, augue at efficitur egestas, tortor lorem bibendum arcu, sit amet maximus augue ex et odio. Integer eu dolor arcu. Aliquam vehicula aliquet malesuada. Suspendisse potenti. Pellentesque dapibus lorem ut nisi laoreet, sit amet tempus nunc vulputate. Praesent vel augue dictum, lacinia erat ac, egestas lectus.


text:
package ch.softappeal.yass.tutorial.contract;

import ch.softappeal.yass.generate.py.*;
import ch.softappeal.yass.generate.ts.*;
import ch.softappeal.yass.remote.*;
import ch.softappeal.yass.serialize.*;
import ch.softappeal.yass.serialize.fast.*;
import ch.softappeal.yass.tutorial.contract.generic.*;
import ch.softappeal.yass.tutorial.contract.instrument.*;
import ch.softappeal.yass.tutorial.contract.instrument.stock.*;

import java.util.*;

import static ch.softappeal.yass.remote.MethodMapperKt.*;
import static ch.softappeal.yass.serialize.fast.BaseTypeSerializersKt.*;
import static ch.softappeal.yass.serialize.fast.FastSerializersKt.*;
import static ch.softappeal.yass.transport.MessageSerializerKt.*;
import static ch.softappeal.yass.transport.PacketSerializerKt.*;

public final class Config {

    public static final FastSerializer CONTRACT_SERIALIZER = jSimpleFastSerializer(
        TypeScriptGeneratorKt.baseTypeSerializers(
            getIntSerializer(),
            Expiration.TYPE_SERIALIZER
        ),
        Arrays.asList(
            PriceKind.class,
            Price.class,
            Stock.class,
            Bond.class,
            SystemException.class,
            UnknownInstrumentsException.class,
            Pair.class,
            PairBoolBool.class,
            Triple.class,
            TripleWrapper.class
        ),
        Collections.emptyList(),
        false
    );

    public static final Serializer MESSAGE_SERIALIZER = messageSerializer(CONTRACT_SERIALIZER);
    public static final Serializer PACKET_SERIALIZER = packetSerializer(MESSAGE_SERIALIZER);

    private abstract static class Role extends Services {
        Role() {
            super(getSimpleMethodMapperFactory());
        }
    }

    public static final class Initiator extends Role { // to be implemented by initiator
        public final ContractId<PriceListener> priceListener = contractId(PriceListener.class, 0);
        public final ContractId<EchoService> echoService = contractId(EchoService.class, 1);
    }

    public static final class Acceptor extends Role { // to be implemented by acceptor
        public final ContractId<PriceEngine> priceEngine = contractId(PriceEngine.class, 0);
        public final ContractId<InstrumentService> instrumentService = contractId(InstrumentService.class, 1);
        public final ContractId<EchoService> echoService = contractId(EchoService.class, 2);
        public final ContractId<GenericEchoService> genericEchoService = contractId(GenericEchoService.class, 3);
    }

    public static final Initiator INITIATOR = new Initiator();
    public static final Acceptor ACCEPTOR = new Acceptor();

    public static final FastSerializer PY_CONTRACT_SERIALIZER = jSimpleFastSerializer(
        PythonGeneratorKt.baseTypeSerializers(
            getIntSerializer(),
            Expiration.TYPE_SERIALIZER
        ),
        Arrays.asList(
            PriceKind.class,
            Price.class,
            Stock.class,
            Bond.class,
            SystemException.class,
            UnknownInstrumentsException.class
        ),
        Arrays.asList(
            Node.class
        ),
        false
    );

    public static final class PyAcceptor extends Role {
        public final ContractId<PriceEngine> priceEngine = contractId(PriceEngine.class, 0);
        public final ContractId<InstrumentService> instrumentService = contractId(InstrumentService.class, 1);
        public final ContractId<EchoService> echoService = contractId(EchoService.class, 2);
    }

    public static final PyAcceptor PY_ACCEPTOR = new PyAcceptor();

}


text:
@implementation CoreTextLineData
- (instancetype)initWithTitle:(NSString *)title url:(NSString *)url range:(NSRange)range {
    if (self = [super init]) {
        self.title = title;
        self.url = url;
        self.range = range;
    }
    return self;
}
@end


text:
import proto  # type: ignore

__protobuf__ = proto.module(
    package="google.ads.googleads.v10.enums",
    marshal="google.ads.googleads.v10",
    manifest={
        "FeedOriginEnum",
    },
)

class FeedOriginEnum(proto.Message):
    r"""Container for enum describing possible values for a feed
    origin.

    """

    class FeedOrigin(proto.Enum):
        r"""Possible values for a feed origin."""
        UNSPECIFIED = 0
        UNKNOWN = 1
        USER = 2
        GOOGLE = 3

__all__ = tuple(sorted(__protobuf__.manifest))


text:
class GuessingGame
  def initialize(answer)
    @answer = answer
end

  def guess(guess)
    @guess = guess
  if @guess > @answer
    p :high
  elsif @guess == @answer
    p :correct
  else @guess < @answer
    p :low
  end
end
end

def solved?
    if @guess == @answer
      p true
    else
     p false
  end
end

# Reflect
# How do instance variables and methods represent the characteristics and behaviors (actions) of a real-world object? When should you use instance variables? What do they do for you?
# Instance variables work across the same class.  For instance, during the two last methods, I use both answer and guess variables.  I wouldn't be able to do this with a local variable, which would only work within the method in which it was called.
# Explain how to use flow control. Did you have any trouble using it in this challenge? If so, what did you struggle with?
# Flow control involves the outcomes of code being determined by different user responses. I mainly used it in relation to if/else statements.
# Why do you think this code requires you to return symbols? What are the benefits of using symbols?
# I'm still trying to figure out why symbols are used; it seems to make code cleaner and shorter.  Also, WGR mentioned symbols are unchangeable, which would have its advantages.


text:
:mod:`asyncio` --- Asynchronous I/O
===================================

.. module:: asyncio
   :synopsis: Asynchronous I/O.

--------------

.. sidebar:: Hello World!

   ::

       import asyncio

       async def main():
           print('Hello ...')
           await asyncio.sleep(1)
           print('... World!')

       # Python 3.7+
       asyncio.run(main())

asyncio is a library to write **concurrent** code using
the **async/await** syntax.

asyncio is used as a foundation for multiple Python asynchronous
frameworks that provide high-performance network and web-servers,
database connection libraries, distributed task queues, etc.

asyncio is often a perfect fit for IO-bound and high-level
**structured** network code.

asyncio provides a set of **high-level** APIs to:

* :ref:`run Python coroutines <coroutine>` concurrently and
  have full control over their execution;

* perform :ref:`network IO and IPC <asyncio-streams>`;

* control :ref:`subprocesses <asyncio-subprocess>`;

* distribute tasks via :ref:`queues <asyncio-queues>`;

* :ref:`synchronize <asyncio-sync>` concurrent code;

Additionally, there are **low-level** APIs for
*library and framework developers* to:

* create and manage :ref:`event loops <asyncio-event-loop>`, which
  provide asynchronous APIs for :meth:`networking <loop.create_server>`,
  running :meth:`subprocesses <loop.subprocess_exec>`,
  handling :meth:`OS signals <loop.add_signal_handler>`, etc;

* implement efficient protocols using
  :ref:`transports <asyncio-transports-protocols>`;

* :ref:`bridge <asyncio-futures>` callback-based libraries and code
  with async/await syntax.

.. We use the "rubric" directive here to avoid creating
   the "Reference" subsection in the TOC.

.. rubric:: Reference

.. toctree::
   :caption: High-level APIs
   :maxdepth: 1

   asyncio-task.rst
   asyncio-stream.rst
   asyncio-sync.rst
   asyncio-subprocess.rst
   asyncio-queue.rst
   asyncio-exceptions.rst

.. toctree::
   :caption: Low-level APIs
   :maxdepth: 1

   asyncio-eventloop.rst
   asyncio-future.rst
   asyncio-protocol.rst
   asyncio-policy.rst
   asyncio-platforms.rst

.. toctree::
   :caption: Guides and Tutorials
   :maxdepth: 1

   asyncio-api-index.rst
   asyncio-llapi-index.rst
   asyncio-dev.rst


text:
import { app_html } from '../code';
import { AppComponent } from '../app.component';
import { TestBed } from '@angular/core/testing';
import 'initTestBed';

beforeEach(() => {
  TestBed.resetTestingModule();
  TestBed.configureTestingModule({ declarations: [AppComponent] });

  TestBed.overrideComponent(AppComponent, {
    set: {
      template: app_html,
      templateUrl: undefined
    }
  });
  try { TestBed.compileComponents(); } catch(e) { console.log(e); }
});

describe('Blabla', () => {
  it(`@@assignFakeVideosToComponent`, () => {
      const fixture = TestBed.createComponent(AppComponent);
      fixture.componentInstance.search('');
    chai.expect(fixture.componentInstance.videos.length, 'Should have no dogs').equals(3);
    });

  it(`@@IterateWithNgForAndDisplayTitle`, () => {
    const fixture = TestBed.createComponent(AppComponent);
    fixture.componentInstance.search('itten');
    fixture.detectChanges();
    chai.expect(fixture.nativeElement.innerHTML).contains(fixture.componentInstance.videos[0].title);
    chai.expect(fixture.nativeElement.innerHTML).contains(fixture.componentInstance.videos[1].title);

    fixture.componentInstance.search('cat');
    fixture.detectChanges();
    chai.expect(fixture.nativeElement.innerHTML).contains(fixture.componentInstance.videos[0].title);
  });

  it(`@@alsoDisplayThumbnail`, () => {
    const fixture = TestBed.createComponent(AppComponent);
    fixture.detectChanges();
    fixture.componentInstance.search('');
    fixture.detectChanges();
    const images = fixture.nativeElement.querySelectorAll('img');
    chai.expect(images.length).equals(3);
    chai.expect(images[1].getAttribute('src')).equals(fixture.componentInstance.videos[1].src);
    chai.expect(images[0].getAttribute('src')).equals(fixture.componentInstance.videos[0].src);
  });

  it(`@@insideSearchMethodFilterFakeVideos`, () => {
    const fixture = TestBed.createComponent(AppComponent);
    fixture.componentInstance.search('itten');
    chai.expect(fixture.componentInstance.videos.length, 'Should have 2 kitten videos').equals(2);
    fixture.componentInstance.search('cat');
    chai.expect(fixture.componentInstance.videos.length, 'Should have 1 cat').equals(1);
    fixture.componentInstance.search('dog');
    chai.expect(fixture.componentInstance.videos.length, 'Should have no dogs').equals(0);
  });

  // it(`#Bonus app.html: Make hitting enter work in the input trigger the search`, () => {
  //   //TODO
  // });

  it(`@@bonusDisplayAllVideosByDefault`, () => {
    const fixture = TestBed.createComponent(AppComponent);
    fixture.detectChanges();
    const images = fixture.nativeElement.querySelectorAll('img');
    chai.expect(images.length).equals(3);
  });
});


text:
/* Implement a tree using prototypal instantiation.
 Your tree should have methods named "addChild" and "contains".
 */

// EXAMPLE USAGE:
// var tree = treeMaker();
// tree.addChild(1);
// tree.addChild(2);
// tree.contains(2);   // yields 'true'

var treeMaker = function(value) {
  var tree = Object.create(treeMaker.methods);
  tree.value = value;
  tree.children = [];
  return tree;
};

//methods go here!
treeMaker.methods = {};

treeMaker.methods.addChild = function(value) {
  this.children.push(value);
};

treeMaker.methods.contains = function(target) {
  return this.children.indexOf(target) > -1;
};


text:
package org.apache.phoenix.parse;

import java.sql.SQLException;
import java.util.List;

public class StatelessTraverseAllParseNodeVisitor extends TraverseAllParseNodeVisitor<Void> {
    @Override
    public Void visitLeave(LikeParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(AndParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(OrParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(FunctionParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(ComparisonParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(CaseParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(AddParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(MultiplyParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(DivideParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(SubtractParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(NotParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(CastParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(InListParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(StringConcatParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(BetweenParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(RowValueConstructorParseNode node, List<Void> l) throws SQLException {
        return null;
    }

    @Override
    public Void visitLeave(ArrayConstructorNode node, List<Void> l) throws SQLException {
        return null;
    }
}


text:
// Code generated by gen_tests.py and process_polyglot.py.
// Do not edit this file directly.
// The template for this file is located at:
// ../template.go.tpl
package reql_tests

import (
	"testing"
	"time"

	"github.com/stretchr/testify/suite"
	r "gopkg.in/rethinkdb/rethinkdb-go.v6"
	"gopkg.in/rethinkdb/rethinkdb-go.v6/internal/compare"
)

// Tests the RQL `map` function
func TestTransformMapSuite(t *testing.T) {
	suite.Run(t, new(TransformMapSuite))
}

type TransformMapSuite struct {
	suite.Suite

	session *r.Session
}

func (suite *TransformMapSuite) SetupTest() {
	suite.T().Log("Setting up TransformMapSuite")
	// Use imports to prevent errors
	_ = time.Time{}
	_ = compare.AnythingIsFine

	session, err := r.Connect(r.ConnectOpts{
		Address: url,
	})
	suite.Require().NoError(err, "Error returned when connecting to server")
	suite.session = session

	r.DBDrop("db_tfm_map").Exec(suite.session)
	err = r.DBCreate("db_tfm_map").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("db_tfm_map").Wait().Exec(suite.session)
	suite.Require().NoError(err)

}

func (suite *TransformMapSuite) TearDownSuite() {
	suite.T().Log("Tearing down TransformMapSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DBDrop("db_tfm_map").Exec(suite.session)

		suite.session.Close()
	}
}

func (suite *TransformMapSuite) TestCases() {
	suite.T().Log("Running TransformMapSuite: Tests the RQL `map` function")

	{
		// transform/map.yaml line #5
		/* 'STREAM' */
		var expected_ string = "STREAM"
		/* r.range().map(r.range(), lambda x, y:(x, y)).type_of() */

		suite.T().Log("About to run line #5: r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).TypeOf()")

		runAndAssert(suite.Suite, expected_, r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).TypeOf(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #5")
	}

	{
		// transform/map.yaml line #10
		/* 'STREAM' */
		var expected_ string = "STREAM"
		/* r.range().map(r.expr([]), lambda x, y:(x, y)).type_of() */

		suite.T().Log("About to run line #10: r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).TypeOf()")

		runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).TypeOf(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #10")
	}

	{
		// transform/map.yaml line #15
		/* 'ARRAY' */
		var expected_ string = "ARRAY"
		/* r.expr([]).map(r.expr([]), lambda x, y:(x, y)).type_of() */

		suite.T().Log("About to run line #15: r.Expr([]interface{}{}).Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).TypeOf()")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).TypeOf(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #15")
	}

	{
		// transform/map.yaml line #21
		/* [0, 0, 0] */
		var expected_ []interface{} = []interface{}{0, 0, 0}
		/* r.range(3).map(lambda:0) */

		suite.T().Log("About to run line #21: r.Range(3).Map(func() interface{} { return 0})")

		runAndAssert(suite.Suite, expected_, r.Range(3).Map(func() interface{} { return 0 }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	{
		// transform/map.yaml line #26
		/* [0, 0, 0] */
		var expected_ []interface{} = []interface{}{0, 0, 0}
		/* r.range(3).map(r.range(4), lambda x,y:0) */

		suite.T().Log("About to run line #26: r.Range(3).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return 0})")

		runAndAssert(suite.Suite, expected_, r.Range(3).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return 0 }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #26")
	}

	{
		// transform/map.yaml line #31
		/* [[1]] */
		var expected_ []interface{} = []interface{}{[]interface{}{1}}
		/* r.expr([1]).map(lambda x:(x,)) */

		suite.T().Log("About to run line #31: r.Expr([]interface{}{1}).Map(func(x r.Term) interface{} { return []interface{}{x}})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(func(x r.Term) interface{} { return []interface{}{x} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #31")
	}

	{
		// transform/map.yaml line #36
		/* [[1, 1]] */
		var expected_ []interface{} = []interface{}{[]interface{}{1, 1}}
		/* r.expr([1]).map(r.expr([1]), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #36: r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #36")
	}

	{
		// transform/map.yaml line #41
		/* [[1, 1, 1]] */
		var expected_ []interface{} = []interface{}{[]interface{}{1, 1, 1}}
		/* r.expr([1]).map(r.expr([1]), r.expr([1]), lambda x, y, z:(x, y, z)) */

		suite.T().Log("About to run line #41: r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), r.Expr([]interface{}{1}), func(x r.Term, y r.Term, z r.Term) interface{} { return []interface{}{x, y, z}})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), r.Expr([]interface{}{1}), func(x r.Term, y r.Term, z r.Term) interface{} { return []interface{}{x, y, z} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #41")
	}

	{
		// transform/map.yaml line #47
		/* err("ReqlQueryLogicError", "The function passed to `map` expects 2 arguments, but 1 sequence was found.", []) */
		var expected_ Err = err("ReqlQueryLogicError", "The function passed to `map` expects 2 arguments, but 1 sequence was found.")
		/* r.expr([1]).map(lambda x, y:(x, y)) */

		suite.T().Log("About to run line #47: r.Expr([]interface{}{1}).Map(func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #47")
	}

	{
		// transform/map.yaml line #52
		/* err("ReqlQueryLogicError", "The function passed to `map` expects 1 argument, but 2 sequences were found.", []) */
		var expected_ Err = err("ReqlQueryLogicError", "The function passed to `map` expects 1 argument, but 2 sequences were found.")
		/* r.expr([1]).map(r.expr([1]), lambda x:(x,)) */

		suite.T().Log("About to run line #52: r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term) interface{} { return []interface{}{x}})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term) interface{} { return []interface{}{x} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #52")
	}

	{
		// transform/map.yaml line #58
		/* [] */
		var expected_ []interface{} = []interface{}{}
		/* r.range().map(r.expr([]), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #58: r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #58")
	}

	{
		// transform/map.yaml line #63
		/* [[1, 1], [2, 2]] */
		var expected_ []interface{} = []interface{}{[]interface{}{1, 1}, []interface{}{2, 2}}
		/* r.expr([1, 2]).map(r.expr([1, 2, 3, 4]), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #63: r.Expr([]interface{}{1, 2}).Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #63")
	}

	{
		// transform/map.yaml line #68
		/* [[0, 0], [1, 1]] */
		var expected_ []interface{} = []interface{}{[]interface{}{0, 0}, []interface{}{1, 1}}
		/* r.range(2).map(r.range(4), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #68: r.Range(2).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Range(2).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #68")
	}

	{
		// transform/map.yaml line #73
		/* [[0, 1], [1, 2], [2, 3], [3, 4]] */
		var expected_ []interface{} = []interface{}{[]interface{}{0, 1}, []interface{}{1, 2}, []interface{}{2, 3}, []interface{}{3, 4}}
		/* r.range().map(r.expr([1, 2, 3, 4]), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #73: r.Range().Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #73")
	}

	{
		// transform/map.yaml line #78
		/* [[0, 0], [1, 1], [2, 2]] */
		var expected_ []interface{} = []interface{}{[]interface{}{0, 0}, []interface{}{1, 1}, []interface{}{2, 2}}
		/* r.range(3).map(r.range(5), r.js("(function(x, y){return [x, y];})")) */

		suite.T().Log("About to run line #78: r.Range(3).Map(r.Range(5), r.JS('(function(x, y){return [x, y];})'))")

		runAndAssert(suite.Suite, expected_, r.Range(3).Map(r.Range(5), r.JS("(function(x, y){return [x, y];})")), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #78")
	}

	{
		// transform/map.yaml line #83
		/* err("ReqlQueryLogicError", "Cannot convert NUMBER to SEQUENCE", []) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot convert NUMBER to SEQUENCE")
		/* r.range().map(r.expr(1), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #83: r.Range().Map(r.Expr(1), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr(1), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #83")
	}

	{
		// transform/map.yaml line #89
		/* err("ReqlQueryLogicError", "Cannot use an infinite stream with an aggregation function (`reduce`, `count`, etc.) or coerce it to an array.", []) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot use an infinite stream with an aggregation function (`reduce`, `count`, etc.) or coerce it to an array.")
		/* r.range().map(r.range(), lambda x, y:(x, y)).count() */

		suite.T().Log("About to run line #89: r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).Count()")

		runAndAssert(suite.Suite, expected_, r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #89")
	}

	{
		// transform/map.yaml line #95
		/* [[0], [1], [2]] */
		var expected_ []interface{} = []interface{}{[]interface{}{0}, []interface{}{1}, []interface{}{2}}
		/* r.map(r.range(3), lambda x:(x,)) */

		suite.T().Log("About to run line #95: r.Map(r.Range(3), func(x r.Term) interface{} { return []interface{}{x}})")

		runAndAssert(suite.Suite, expected_, r.Map(r.Range(3), func(x r.Term) interface{} { return []interface{}{x} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #95")
	}

	{
		// transform/map.yaml line #100
		/* [1, 2, 3] */
		var expected_ []interface{} = []interface{}{1, 2, 3}
		/* r.map(r.range(3), r.row + 1) */

		suite.T().Log("About to run line #100: r.Map(r.Range(3), r.Row.Add(1))")

		runAndAssert(suite.Suite, expected_, r.Map(r.Range(3), r.Row.Add(1)), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #100")
	}

	{
		// transform/map.yaml line #104
		/* [[0, 0], [1, 1], [2, 2]] */
		var expected_ []interface{} = []interface{}{[]interface{}{0, 0}, []interface{}{1, 1}, []interface{}{2, 2}}
		/* r.map(r.range(3), r.range(5), lambda x, y:(x, y)) */

		suite.T().Log("About to run line #104: r.Map(r.Range(3), r.Range(5), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})")

		runAndAssert(suite.Suite, expected_, r.Map(r.Range(3), r.Range(5), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #104")
	}
}


text:
CREATE SCHEMA mdt_test;
SET search_path = mdt_test;

-- CREATE VIEW
CREATE VIEW
	pg_stat_last_operation_testview AS
SELECT
	c.relname AS objname, staactionname AS actionname, stasubtype AS subtype
FROM
	pg_stat_last_operation lo
		JOIN pg_catalog.pg_class c ON (
			c.oid = lo.objid
		)
		JOIN pg_catalog.pg_namespace nsp ON (
			c.relnamespace = nsp.oid AND nsp.nspname = 'mdt_test'
		)
ORDER BY
	statime;

SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'CREATE';

-- CREATE TABLE
CREATE TABLE pg_stat_last_operation_test (foo int) DISTRIBUTED BY (foo);

CREATE TABLE mdt_test_part1 (
  id int,
  rank int,
  year date,
  gender char(1))
DISTRIBUTED BY (id, gender, year)
PARTITION BY list (gender)
SUBPARTITION BY range (year)
SUBPARTITION TEMPLATE (start (date '2001-01-01'))
(VALUES ('M'), VALUES ('F'));
ALTER TABLE mdt_test_part1 ADD DEFAULT PARTITION default_part;

CREATE TABLE mdt_all_types (
  a int,
  col001 char DEFAULT 'z',
  col002 numeric,
  col003 boolean DEFAULT false,
  col004 bit(3) DEFAULT '111',
  col005 text DEFAULT 'pookie',
  col006 integer[] DEFAULT '{5, 4, 3, 2, 1}',
  col007 character varying(512) DEFAULT 'Now is the time',
  col008 character varying DEFAULT 'Now is the time',
  col009 character varying(512)[],
  col010 numeric(8),
  col011 int,
  col012 double precision,
  col013 bigint,
  col014 char(8),
  col015 bytea,
  col016 timestamp with time zone,
  col017 interval,
  col018 cidr,
  col019 inet,
  col020 macaddr,
  col021 serial,
  col022 money,
  col023 bigserial,
  col024 timetz,
  col025 circle,
  col026 box,
  col027 name,
  col028 path,
  col029 int2,
  col031 bit varying(256),
  col032 date,
  col034 lseg,
  col035 point,
  col036 polygon,
  col037 real,
  col039 time,
  col040 timestamp
)
WITH (appendonly=true);

SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'CREATE';

-- GRANT
GRANT ALL ON mdt_all_types TO public;
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'PRIVILEGE';

-- VACUUM
VACUUM ANALYZE mdt_all_types ;
SELECT * FROM pg_stat_last_operation_testview WHERE actionname in ('VACUUM','ANALYZE');
SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_all_%');

-- TRUNCATE
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'TRUNCATE';
INSERT INTO pg_stat_last_operation_test SELECT generate_series(1, 5);
TRUNCATE pg_stat_last_operation_test;
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'TRUNCATE';

-- DROP TABLE
SELECT * FROM pg_stat_last_operation_testview WHERE actionname = 'DROP';
SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
DROP TABLE mdt_all_types;
SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');
DROP TABLE mdt_test_part1;
SELECT * FROM pg_stat_last_operation_testview WHERE objname like ('mdt_%');


text:
@implementation MATwitterFavouritesList

@end


text:
from . import ISO
from . import UOM
from . import azhagi
from . import combinational
from . import itrans
from . import jaffna
from .algorithm import Iterative, Greedy, Tamil2English, reverse_transliteration_table

#Transliteration module
iterative_transliterate = Iterative.transliterate


text:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { observer } from 'mobx-react';
import { Link } from 'components/link/link';

// CSS
import { styles, vars, css } from 'styles/css';

export interface MainContentWrapperProps {
  color?: "theme" | "success" | "warn"
};

@observer
export class MainContentWrapper extends React.Component<MainContentWrapperProps, {}> {
  static defaultProps = {
    color: "theme"
  }

  render() {
    return (

          {this.props.children}

            <Link to="https://github.com/citizenlabsgr/voter-engagement" target="_blank">View On GitHub</Link>

    );
  }
}

let style = styles({
  wrapper: {
    position: 'relative',
    minHeight: '100vh',
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    justifyContent: 'center',
    padding: vars.spacing
  },
  content: {
    position: 'relative',
    maxWidth: 525
  },
  githubLink: {
    position: 'absolute',
    bottom: 20,
    right: 20,
  },
});


text:
`stopwatch on

Some Sample Templates that demonstrate Japid features.

Please follow the controller actions and render paths for the
source code.

Hello Japid, using an overridden
	version of renderText()

using tags in a template

def
	tag: define a method that return a string that can be invoked from
	super template. Compare this to the set tag

*{
    this is a little too complicated

demo how to composite a
	page with independent segments with the invoke tag

}*

demo how to composite a
	page with independent segments with the invoke tag

implicit template
	binding with JapidController.renderJapid()

a template with template
	and tags etc...

use the log
	macro in a template. watch the output in the console

i18n, use
	predefined messages

looping and tag calling

the "open for" loop and the now deprecated "*Each* tag

open if statement: minimalistic if-else statement can can take any expression rather than boolean values as the condition.

example:

		    ``if expr
		        xxx
		    ``else if expr
		        yyy
		    ``else
		        zzz
		    ``

using invoke tag with
	local variables requires final attribute

suppressNull,
	a directive to allow safe navigation in expression, default off

show how to dump a post
	detail with japid.dump.request spec in the application.conf. see
	console for output.

cache with
	renderJapid

using the CacheFor
	annotation

action forwarding with
	dontRedirect() from JapidController

 use
	``{ in if and while

 `verbatim
	raw expression with ${} and html-safe expression with ~{}
	`

 content
	negotiation. Use tools like CURL to test it:
curl -i -H "Accept: application/json" http://127.0.0.1:9000/more.ContentNegotiation/index

Content negotiation works with renderJapid(), which does
	implicit parameter binding and template picking.

For more doc: see Play
	Content Negotiation

 Use relative path
	in layout spec and tags: prefix the layout name or the tag name with a
	dot "." to let the compiler prefix the path with the current package.
	This saves using the full and long class qualifications.

`String na = "bran";
`int ag = 123;

validation and errors

 using the flash object

flash with success

flash with a message

flash with errors

flash with a message

	   ` SearchParams sp = new  SearchParams("key1, key2", "AND");
	   reverse URL lookup with complex object
    *{
    }*

reverse to a static  png

Reverse lookup is slow...

app mode: "${_play.mode}"


text:
package logentries

import (
	"github.com/hashicorp/terraform/helper/schema"
	"github.com/hashicorp/terraform/terraform"
	"github.com/logentries/le_goclient"
)

// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {

	// The actual provider
	return &schema.Provider{
		Schema: map[string]*schema.Schema{
			"account_key": &schema.Schema{
				Type:        schema.TypeString,
				Required:    true,
				DefaultFunc: schema.EnvDefaultFunc("LOGENTRIES_ACCOUNT_KEY", nil),
				Description: descriptions["account_key"],
			},
		},

		ResourcesMap: map[string]*schema.Resource{
			"logentries_log":    resourceLogentriesLog(),
			"logentries_logset": resourceLogentriesLogSet(),
		},

		ConfigureFunc: providerConfigure,
	}
}

var descriptions map[string]string

func init() {
	descriptions = map[string]string{
		"account_key": "The Log Entries account key.",
	}
}

func providerConfigure(d *schema.ResourceData) (interface{}, error) {
	return logentries.NewClient(d.Get("account_key").(string)), nil
}


text:
1.

## External Links ##
* TBD

Categories: Experimental Strategy


text:
module OrderedCollection
  VERSION = "0.0.1"
end


text:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:id="@+id/list_item_forecast_textview"
    android:minHeight="50dp"
    android:gravity="center_vertical"
    >

</TextView>


text:
require 'spec_helper'
require 'bullhorn/rest/entities/resume'
require 'bullhorn/rest'
require 'tempfile'

describe Bullhorn::Rest::Client, :vcr do

  let(:client) { Bullhorn::Rest::Client.new(client_id: test_bh_client_id, client_secret: test_bh_client_secret, username: test_bh_username, password: test_bh_password) }

    describe "Update existing candidates " do
      it "should update primary skills " do
        payload = {ids: [11853], primarySkills: [375606, 11481]}
        res = client.mass_update_candidate(payload.to_json)
        expect(res.count).to eq(1)
      end
    end

    describe "Adding new candidates " do

    it "should convert to html" do
      #json  = File.read("spec/fixtures/example_resume_upload.json")
      #res = client.create_candidate(json)
      #base64_content = Base64.encode64(file)
      5.times do
        file  = File.new("spec/fixtures/mattwright.pdf", "rb")
        res = client.convert_resume_to_html(file.read, "pdf", "application/pdf")
        puts res.html
      end
    end

    it "should insert new candiate" do

      json  = File.read("spec/fixtures/example_resume_upload.json")
      #res = client.create_candidate(json)
      #expect(res.changedEntityId).to_not be_nil
    end

    it "should allow primary skills association" do

      json  = File.read("spec/fixtures/example_resume_upload.json")
      #res = client.create_candidate(json)
      #res = client.associate_candidate(res.changedEntityId, "primarySkills", [58,128909])

    end

    it "should allow CV Upload" do

#      file_content  = File.read("spec/fixtures/mattwright.pdf")
 #     json  = File.read("spec/fixtures/example_resume_upload.json")
      #res = client.create_candidate(json)
  #    base64_content = Base64.encode64(file_content)
   #   client.upload_cv(37383, {:externalID => "CV", :fileContent => base64_content, :fileType => "SAMPLE", name: "mattwright.pdf" })

      #res = client.associate_candidate(res.changedEntityId, "primarySkills", [58,128909])
    end

  end

end


text:
<!DOCTYPE html>

The following checkbox should be red: <input type=checkbox checked>