text:
package tweetscuttler

import com.corundumstudio.socketio.{AckRequest, SocketIOClient, SocketIOServer}
import com.corundumstudio.socketio.annotation.{OnConnect, OnEvent}
import org.springframework.beans.factory.annotation.{Autowired, Value}
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component

@Component
class ChatEventHandler {

  private final var server: SocketIOServer = null
  private var streamer: TweetStreamer = null
  private val listener = new TweetStatusListener

  @Value("${auth.consumer.key}")
  val consumerKey: String = null

  @Value("${auth.consumer.secret}")
  val consumerSecret: String = null

  @Value("${auth.token}")
  val token: String = null

  @Value("${auth.secret}")
  val secret: String = null

  @Autowired
  def this(server: SocketIOServer) {
    this()
    this.server = server
  }

  @OnConnect
  def onConnectEvent(client: SocketIOClient): Unit = {
    println("on connect")
    if (streamer == null) {
      streamer = new TweetStreamer(consumerKey, consumerSecret, token, secret)
        .addListener(listener)
    }
  }

  @Scheduled(fixedRate = 1000)
  def sendNextStatus() {
    if (listener.statusQueue.nonEmpty)
      server.getBroadcastOperations.sendEvent("chatevent", listener.statusQueue.dequeue())
  }

  @OnEvent(value = "chatevent")
  def onChatEvent(client: SocketIOClient, request: AckRequest, data: ChatObject) {
    server.getBroadcastOperations.sendEvent("chatevent", data)
    listener.statusQueue.clear()
    streamer.applyFilterAndRun(data.getMessage)
  }
}


text:
var supportsIteratorDestructuring = require("../../../helpers/supportsIteratorDestructuring");
var supportsObjectDestructuring = require("../../../helpers/supportsObjectDestructuring");

module.exports = function(config) {
	return !config.minimize && supportsObjectDestructuring() && supportsIteratorDestructuring();
};

redpajama_set_name: RedPajamaGithub


text:
package dep

import (
	"context"
	"sync"

	"github.com/micromdm/micromdm/dep"
	"github.com/micromdm/micromdm/platform/pubsub"
)

type Service interface {
	DefineProfile(ctx context.Context, p *dep.Profile) (*dep.ProfileResponse, error)
	AssignProfile(ctx context.Context, uuid string, serials ...string) (*dep.ProfileResponse, error)
	GetAccountInfo(ctx context.Context) (*dep.Account, error)
	GetDeviceDetails(ctx context.Context, serials []string) (*dep.DeviceDetailsResponse, error)
	FetchProfile(ctx context.Context, uuid string) (*dep.Profile, error)
}

type DEPClient interface {
	DefineProfile(*dep.Profile) (*dep.ProfileResponse, error)
	AssignProfile(string, ...string) (*dep.ProfileResponse, error)
	FetchProfile(string) (*dep.Profile, error)
	Account() (*dep.Account, error)
	DeviceDetails(...string) (*dep.DeviceDetailsResponse, error)
}

type DEPService struct {
	mtx        sync.RWMutex
	client     DEPClient
	subscriber pubsub.Subscriber
}

func (svc *DEPService) Run() error {
	return svc.watchTokenUpdates(svc.subscriber)
}

func New(client DEPClient, subscriber pubsub.Subscriber) *DEPService {
	return &DEPService{client: client, subscriber: subscriber}
}


text:
window.addEventListener('resize', function(event){
  // do stuff here

  var w = window.innerWidth;
  var h = window.innerHeight;
  var button = document.getElementById("button1");
  var picker = document.getElementById("picker2");
  //480 800

  if( w > 480 && w < 800 ) {

	  button.style.top = "23%";
	  picker.style.top = "35px";

	}else {

	  button.style.top = "50%";
	   picker.style.top = "55px";
	}

});


text:
package org.apache.flink.streaming.util;

public class PerformanceTimer extends PerformanceTracker {

	private static final long serialVersionUID = 1L;

	long timer;
	boolean millis;

	public PerformanceTimer(String name, int counterLength, int countInterval, boolean millis,
			long dumpInterval, String fname) {
		super(name, counterLength, countInterval, dumpInterval, fname);
		this.millis = millis;
	}

	public PerformanceTimer(String name, int counterLength, int countInterval, boolean millis,
			String fname) {
		super(name, counterLength, countInterval, fname);
		this.millis = millis;
	}

	public PerformanceTimer(String name, boolean millis, String fname) {
		super(name, fname);
		this.millis = millis;
	}

	public void startTimer() {
		if (millis) {
			timer = System.currentTimeMillis();
		} else {
			timer = System.nanoTime();
		}

	}

	public void stopTimer(String label) {

		if (millis) {
			track(System.currentTimeMillis() - timer, label);
		} else {
			track(System.nanoTime() - timer, label);
		}
	}

	public void stopTimer() {
		stopTimer("timer");
	}

}


text:
package com.rehivetech.beeeon.gui.adapter.dashboard.items;

import android.os.Parcel;
import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;

/**
 * Created by martin on 20.3.16.
 */
public class VentilationItem extends BaseItem {

	@SerializedName("outSideAbsoluteModuleId")
	private String mOutsideAbsoluteModuleId;

	@SerializedName("insideAbsoluteModuleId")
	private String mInSideAbsoluteModuleId;

	@SerializedName("coordinates")
	@Nullable private double[] mLocation;

	public VentilationItem(String name, String gateId, @Nullable double[] location, @Nullable String outsideAbsoluteModuleId, String inSideAbsoluteModuleId) {
		super(name, gateId);
		mLocation = location;
		mOutsideAbsoluteModuleId = outsideAbsoluteModuleId;
		mInSideAbsoluteModuleId = inSideAbsoluteModuleId;
	}

	public String getOutsideAbsoluteModuleId() {
		return mOutsideAbsoluteModuleId;
	}

	public String getInSideAbsoluteModuleId() {
		return mInSideAbsoluteModuleId;
	}

	@Nullable
	public double[] getLocation() {
		return mLocation;
	}

	@Nullable
	public String getLatitude() {
		if (mLocation == null) return "";
		return Double.toString(mLocation[0]);
	}

	public String getLongitude() {
		if (mLocation == null) return "";
		return Double.toString(mLocation[1]);
	}

	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		super.writeToParcel(dest, flags);
		dest.writeString(mOutsideAbsoluteModuleId);
		dest.writeString(mInSideAbsoluteModuleId);
		dest.writeDoubleArray(mLocation);
	}

	protected VentilationItem(Parcel in) {
		super(in);
		mOutsideAbsoluteModuleId = in.readString();
		mInSideAbsoluteModuleId = in.readString();
		mLocation = in.createDoubleArray();
	}

	public static final Creator<VentilationItem> CREATOR = new Creator<VentilationItem>() {
		public VentilationItem createFromParcel(Parcel source) {
			return new VentilationItem(source);
		}

		public VentilationItem[] newArray(int size) {
			return new VentilationItem[size];
		}
	};
}


text:
<?php

namespace Pablodip\RestModuleBundle\Action;

use Pablodip\ModuleBundle\Action\BaseRouteAction;

/**
 * UpdateAction.
 *
 * @author Pablo Díez <pablodip@gmail.com>
 */
class UpdateAction extends BaseRouteAction
{
    /**
     * {@inheritdoc}
     */
    protected function defineConfiguration()
    {
        $this
            ->setRoute('update', '/{id}', 'PUT')
            ->setController(array($this, 'controller'))
        ;
    }

    public function controller($id)
    {
        $model = $this->getMolino()->findOneById($this->getModule()->getOption('model_class'), $id);
        if (!$model) {
            return $this->getModule()->getExtension('serializer')->createSerializedNotFoundResponse();
        }

        $data = $this->get('request')->request->all();
        if ($this->getModule()->hasExtraFields($data)) {
            return $this->getModule()->createExtraFieldsErrorResponse();
        }
        foreach ($data as $name => $value) {
            $model->{'set'.ucfirst($name)}($value);
        }

        if (count($errors = $this->get('validator')->validate($model))) {
            return $this->getModule()->createValidationFailsErrorResponse($errors);
        }

        $this->getMolino()->save($model);

        return $this->getModule()->getExtension('serializer')->createSerializedResponse($model);
    }
}


text:
window.$$ = window.$$ || {};
window.$$.Draw = window.$$.Draw || {};

(function (DRAW) {
    "use strict";

    var Line = function (container, opts) {
        DRAW.Basic.call(this, container, opts);
        this.start = null;
        this.end = null;
    };
    Line.prototype = Object.create(DRAW.Basic.prototype);
    Line.prototype.constructor = Line;

    Line.prototype.copy = function () {
        var copy = DRAW.Basic.prototype.copy.call(this);
        copy.start = this.start;
        copy.end = this.end;
    };

    Line.prototype.draw = function (start, end, para) {
        // draw element
        if (start == null || end == null) throw new Error("parameter error");
        this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
        this.start = start;
        this.end = end;

        var para = para || {};
        for (var i in para) this._ctx[i] = para[i];
        var image = para.image || null;

        if (image == null) {
            this._ctx.beginPath();
            this._ctx.moveTo(start[0], start[1]);
            this._ctx.lineTo(end[0], end[1]);
            this._ctx.stroke();
            return;
        }

        var lineWidth = para.lineWidth || 1;
        var x = start[0] - end[0];
        var y = start[1] - end[1];
        var len = Math.sqrt(x*x+y*y);
        var angle = Math.atan2(x, -y);
        var offset = -image.width / 2;
        var wid = Math.min(image.width, lineWidth);
        var left = Math.max((image.width - lineWidth)/2, 0);

        this._ctx.translate(start[0], start[1]);
        this._ctx.rotate(angle);

        this._ctx.translate(offset, 0);
        this._ctx.fillStyle = this._ctx.createPattern(image, 'repeat-y');
        this._ctx.fillRect(left, 0, wid, len);
        this._ctx.translate(-offset, 0);

        this._ctx.rotate(-angle);
        this._ctx.translate(-start[0] , -start[1]);
    };

    DRAW.Line = Line;
})(window.$$.Draw);


text:
'use strict';

var FT = window.FT || {};

FT.SampleVisual = function (buckets) {

    if (!(this instanceof FT.SampleVisual))
        return new FT.SampleVisual(buckets);

    //temp
    var canvasCtx = document.getElementById('canvas').getContext('2d');
    var WIDTH = 400;
    var HEIGHT = 400;

    var self = this;

    this.draw = function () {
        self.raf = requestAnimationFrame(self.draw);

        canvasCtx.fillStyle = 'rgb(200, 200, 200)';
        canvasCtx.fillRect(0, 0, WIDTH, HEIGHT);

        canvasCtx.lineWidth = 1;
        canvasCtx.strokeStyle = 'rgb(0, 0, 0)';

        var sliceWidth = WIDTH * 1.0 / buckets.length;
        var x = 0;

        for (var i = 0; i < buckets.length; i++) {
            canvasCtx.fillStyle = 'hsl(' + 360 * (i / buckets.length) + ', 50%, 50%)';
            canvasCtx.fillRect(x, HEIGHT-10, sliceWidth, -buckets[i] * HEIGHT / 2 - 1);
            x += sliceWidth;
        }

    };

};


text:
<?php

declare(strict_types=1);

namespace League\Container\Test\Asset;

interface BarInterface
{
}


text:
package org.knowm.xchange.gemini.v1.dto.trade;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRawValue;

public class GeminiOrderStatusRequest {

  @JsonProperty("request")
  protected String request;

  @JsonProperty("nonce")
  protected String nonce;

  @JsonProperty("order_id")
  @JsonRawValue
  private long orderId;

  /**
   * Constructor
   *
   * @param nonce
   * @param orderId
   */
  public GeminiOrderStatusRequest(String nonce, long orderId) {

    this.request = "/v1/order/status";
    this.orderId = orderId;
    this.nonce = nonce;
  }

  public String getOrderId() {

    return String.valueOf(orderId);
  }

}


text:
/*************************
*   Precompiled Header   *
**************************/
#include "precomp_base.h"

/**********************
*   System Includes   *
***********************/

/*************************
*   3rd Party Includes   *
**************************/

/***************************
*   Game Engine Includes   *
****************************/
#include "AETime.h"

//Always include last
#include "Memory\MemLeaks.h"

/********************
*   Function Defs   *
*********************/
AETime::AETime(bool sampleFPS, uint32_t numSamples)
    : m_IsSamplingFPS(sampleFPS)
    , m_NumOfSamples(numSamples)
{
    m_FrameSamples.resize(m_NumOfSamples);
    for (uint32_t i = 0; i < m_NumOfSamples; i++)
    {
        m_FrameSamples[i] = 0.0;
    }
}

AETime::~AETime()
{
}

void AETime::Update()
{
    m_FrameTimer.Update();

    if(m_IsSamplingFPS)
    {
        SampleFPS();
    }
}

void AETime::SampleFPS()
{
    m_SampleFramePos++;

    if (m_SampleFramePos >= m_NumOfSamples)
    {
        m_SampleFramePos = 0;
    }

    double diff = m_FrameTimer.GetTimerParams().m_ElapsedTimePression;
    m_FrameSamples[m_SampleFramePos] = diff;

    double totalTime = 0.;
    for (uint32_t i = 0; i < m_NumOfSamples; i++)
    {
        totalTime += m_FrameSamples[i];
    }

    m_MilliPerFrame = static_cast<float>(totalTime / m_NumOfSamples);
    m_FPS = 1.0f / m_MilliPerFrame;
}

bool AETime::NeedToRunConstantUpdate()
{
    const TimerParams& frameTimer = m_FrameTimer.GetTimerParams();

    double diff = frameTimer.m_TotalElapsedTimePression - m_ConstantUpdateTimerParams.m_TotalElapsedTimePression;

    if (diff >= m_ConstantUpdateStep)
    {
        m_ConstantUpdateTimerParams.m_ElapsedTimePression       = m_ConstantUpdateStep;
        m_ConstantUpdateTimerParams.m_ElapsedTime               = (float)m_ConstantUpdateTimerParams.m_ElapsedTimePression;

        m_ConstantUpdateTimerParams.m_TotalElapsedTimePression  += m_ConstantUpdateTimerParams.m_ElapsedTime;
        m_ConstantUpdateTimerParams.m_TotalElapsedTime          = (float)m_ConstantUpdateTimerParams.m_TotalElapsedTimePression;

        return true;
    }

    return false;
}


text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

from provider.compat import user_model_label

class Migration(SchemaMigration):

    def forwards(self, orm):

        # Changing field 'Client.user'
        db.alter_column('oauth2_client', 'user_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm[user_model_label], null=True))

    def backwards(self, orm):

        # User chose to not deal with backwards NULL issues for 'Client.user'
        raise RuntimeError("Cannot reverse this migration. 'Client.user' and its values cannot be restored.")

    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        user_model_label: {
            'Meta': {'object_name': user_model_label.split('.')[-1]},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'oauth2.accesstoken': {
            'Meta': {'object_name': 'AccessToken'},
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oauth2.Client']"}),
            'expires': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 2, 7, 10, 34, 7, 491068)'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'scope': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'token': ('django.db.models.fields.CharField', [], {'default': "'ed2ee3f5209076916309'", 'max_length': '255'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']" % user_model_label})
        },
        'oauth2.client': {
            'Meta': {'object_name': 'Client'},
            'client_id': ('django.db.models.fields.CharField', [], {'default': "'b1f489e6693d6ba20770'", 'max_length': '255'}),
            'client_secret': ('django.db.models.fields.CharField', [], {'default': "'ac43f96040354c910c8e57a4952d9a8e92f83555'", 'max_length': '255'}),
            'client_type': ('django.db.models.fields.IntegerField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'redirect_uri': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']" % user_model_label, 'null': 'True', 'blank': 'True'})
        },
        'oauth2.grant': {
            'Meta': {'object_name': 'Grant'},
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oauth2.Client']"}),
            'code': ('django.db.models.fields.CharField', [], {'default': "'d62c4606c1d7743b59480a85bf8a691aec67df0a'", 'max_length': '255'}),
            'expires': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 2, 8, 10, 44, 7, 492506)'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'redirect_uri': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
            'scope': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']" % user_model_label})
        },
        'oauth2.refreshtoken': {
            'Meta': {'object_name': 'RefreshToken'},
            'access_token': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'refresh_token'", 'unique': 'True', 'to': "orm['oauth2.AccessToken']"}),
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oauth2.Client']"}),
            'expired': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'token': ('django.db.models.fields.CharField', [], {'default': "'9b79a016e6b5220883d0d576f34bcbee29ce36b1'", 'max_length': '255'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']" % user_model_label})
        }
    }

    complete_apps = ['oauth2']


text:
package us.dot.its.jpo.ode.model;

public class DdsSubRequest extends DdsRequest {
   private static final long serialVersionUID = -3817847278248921651L;

   private final int vsmType = 31;
   private String systemSubName;

   public int getVsmType() {
      return vsmType;
   }

   public String getSystemSubName() {
      return systemSubName;
   }

   public DdsSubRequest setSystemSubName(String systemSubName) {
      this.systemSubName = systemSubName;
      return this;
   }

   @Override
   public String toString() {
      return "SUBSCRIBE:" + this.toJson();
   }

   @Override
   public int hashCode() {
      final int prime = 31;
      int result = super.hashCode();
      result = prime * result
            + ((systemSubName == null) ? 0 : systemSubName.hashCode());
      result = prime * result + vsmType;
      return result;
   }

   @Override
   public boolean equals(Object obj) {
      if (this == obj)
         return true;
      if (!super.equals(obj))
         return false;
      if (getClass() != obj.getClass())
         return false;
      DdsSubRequest other = (DdsSubRequest) obj;
      if (systemSubName == null) {
         if (other.systemSubName != null)
            return false;
      } else if (!systemSubName.equals(other.systemSubName))
         return false;
      if (vsmType != other.vsmType)
         return false;
      return true;
   }

}


text:
package com.hue.utils;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Base64;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

import org.apache.commons.lang3.StringUtils;

public final class SecurityUtils {
	private static final String S = "a7eb46cb-79df-4b62-a771-f9d6c33bbc94";
	private static final String R = "AjoYulinTaiRobGuillermo";
	private static final String PASSWORD_PREFIX = "{vero-#}";
	private static final String ENCRYPTION_ALG = "AES/ECB/PKCS5Padding";
	private static final int MAX_ITERATIONS = 10;

	private SecurityUtils() {
	}

	public static byte[] getSHA256HashValue(String input) throws NoSuchAlgorithmException {
		MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
		return sha256.digest(input.getBytes(StandardCharsets.UTF_8));
	}

 	public static String base64Encoding(byte[] bArray) {
 		return Base64.getUrlEncoder().encodeToString(bArray);
 	}

 	public static byte[] base64Decoding(String input) {
 		return Base64.getUrlDecoder().decode(input);
 	}

 	public static String encryptMessage(String msg, SecretKey secretKey) throws Exception {
 		Cipher cipher = Cipher.getInstance(ENCRYPTION_ALG);
 		cipher.init(Cipher.ENCRYPT_MODE, secretKey);
 		byte[] encrypted = cipher.doFinal(msg.getBytes(StandardCharsets.UTF_8));
 		return base64Encoding(encrypted);
 	}

 	public static String decryptMessage(String msg, SecretKey secretKey) throws Exception {
 		Cipher cipher = Cipher.getInstance(ENCRYPTION_ALG);
 		cipher.init(Cipher.DECRYPT_MODE, secretKey);
 		byte[] decrypted = cipher.doFinal(base64Decoding(msg));
 		return new String(decrypted, StandardCharsets.UTF_8);
 	}

 	public static SecretKey getAESKey(String input) throws NoSuchAlgorithmException {
 		byte[] hashCode = getSHA256HashValue(input);
 		SecretKey key = new SecretKeySpec(Arrays.copyOf(hashCode, 16), "AES");

 		return key;
 	}

 	public static String createAuthHeader(String authToken, String email) throws NoSuchAlgorithmException, Exception {
 		return "Token token=" + SecurityUtils.encryptMessage(authToken, getAESKey(StringUtils.reverse(email))) + ", email=" + email;
 	}

 	public static String encryptPassword(String password) throws NoSuchAlgorithmException, Exception {
 		if (password == null || password.trim().equals("") || password.startsWith(PASSWORD_PREFIX)) return password;

 		return PASSWORD_PREFIX + encryptMessage(password, getAESKey(S + StringUtils.reverse(R)));
 	}

 	public static String decryptPassword(String encryptedPassword) throws NoSuchAlgorithmException, Exception {
 		if (encryptedPassword == null || encryptedPassword.trim().equals("") || !encryptedPassword.startsWith(PASSWORD_PREFIX)) return encryptedPassword;

 		return decryptMessage(encryptedPassword.substring(PASSWORD_PREFIX.length()), getAESKey(S + StringUtils.reverse(R)));
 	}

 	public static String createPricingUpgradeParams(String email, String token) throws Exception {
 		return "email=" + email + "&token="
				+ SecurityUtils.encryptMessage(token, SecurityUtils.getAESKey(StringUtils.reverse(email)));
 	}

	public static int getRandomUnusedLocalPort() {
        int rndPort;
        int iterations = 0;

        do {
            rndPort = (int) (Math.random() * 55535d + 10000d);
            iterations++;

            if (iterations >= MAX_ITERATIONS) {
                return -1;
            }
        } while (!available(rndPort));

        return rndPort;
    }

	private static boolean available(int port) {
        try (ServerSocket ignored = new ServerSocket(port, 1, InetAddress.getLoopbackAddress())) {
            return true;
        } catch (IOException ignored) {
            return false;
        }
    }
}


text:
	<title>Mike Gatting's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Mike Gatting's panel show appearances

Mike Gatting (born 1957-06-06[ref]) has appeared in 1 episodes between 2002-2002.  Mike Gatting on Wikipedia.

2002

2002-01-18 / They Think It's All Over


text:
package testrdio

import (
	"testing"
)

func TestGetAlbumsByUPC(t *testing.T) {
	c := createClient(t)

	albums, err := c.GetAlbumsByUPC("011661811324")
	if err != nil {
		t.Fatal(err)
	}

	if len(albums) != 1 {
		t.Fatalf("Album length is %d instead of 1", len(albums))
	}

	if albums[0].Name != "No!" {
		t.Errorf("Album title is %s instead of No!", albums[0].Name)
	}
}

func TestGetAlbumsForArtist(t *testing.T) {
	c := createClient(t)

	albums, err := c.GetAlbumsForArtist("r49021") // They Might Be Giants
	if err != nil {
		t.Fatal(err)
	}

	if len(albums) == 0 {
		t.Fatal("Album length is 0, but TMBG is very prolific")
	}
}

func TestTestGetAlbumsForLabel(t *testing.T) {
	c := createClient(t)

	_, err := c.GetAlbumsForLabel("l755") // Rhino
	if err != nil {
		t.Fatal(err)
	}
}

func TestGetArtistsForLabel(t *testing.T) {
	c := createClient(t)

	_, err := c.GetArtistsForLabel("l755") // Rhino
	if err != nil {
		t.Fatal(err)
	}
}

func TestGetTracksByISRC(t *testing.T) {
	c := createClient(t)

	tracks, err := c.GetTracksByISRC("USPR37300012") // a recording of the song "Love's Theme" by the Love Unlimited Orchestra.
	if err != nil {
		t.Fatal(err)
	}

	if len(tracks) == 0 {
		t.Fatal("Track length is 0, but should be... larger")
	}
}

func TestGetTracksForArtist(t *testing.T) {
	c := createClient(t)

	tracks, err := c.GetTracksForArtist("r49021") // They Might Be Giants
	if err != nil {
		t.Fatal(err)
	}

	if len(tracks) == 0 {
		t.Fatal("Track length is 0, but should be... larger")
	}
}

func TestSearch(t *testing.T) {
	c := createClient(t)

	results, err := c.Search("They Might Be Giants", []string{"Artist"})
	if err != nil {
		t.Fatal(err)
	}

	if len(results) == 0 {
		t.Fatal("Results length is 0, but should be... larger")
	}
}

func TestSearchSuggestions(t *testing.T) {
	c := createClient(t)

	results, err := c.SearchSuggestions("They Might")
	if err != nil {
		t.Fatal(err)
	}

	if len(results) == 0 {
		t.Fatal("Results length is 0, but should be... larger")
	}
}


text:
package io.hops.leader_election.node;

import java.net.InetSocketAddress;
import java.util.List;

public interface SortedActiveNodeList {

  public boolean isEmpty();

  public int size();

  public List<ActiveNode> getActiveNodes();

  public List<ActiveNode> getSortedActiveNodes();

  public ActiveNode getActiveNode(InetSocketAddress address);

  public ActiveNode getLeader();

}


text:
	T.action = { }

--
-- Setup/teardown
--

	local fake = {
		trigger = "fake",
		description = "Fake action used for testing",
	}

	function T.action.setup()
		premake.action.list["fake"] = fake
		solution "MySolution"
		configurations "Debug"
		project "MyProject"
		premake.buildconfigs()
	end

	function T.action.teardown()
		premake.action.list["fake"] = nil
	end

--
-- Tests for call()
--

	function T.action.CallCallsExecuteIfPresent()
		local called = false
		fake.execute = function () called = true end
		premake.action.call("fake")
		test.istrue(called)
	end

	function T.action.CallCallsOnSolutionIfPresent()
		local called = false
		fake.onsolution = function () called = true end
		premake.action.call("fake")
		test.istrue(called)
	end

	function T.action.CallCallsOnProjectIfPresent()
		local called = false
		fake.onproject = function () called = true end
		premake.action.call("fake")
		test.istrue(called)
	end

	function T.action.CallSkipsCallbacksIfNotPresent()
		test.success(premake.action.call, "fake")
	end

--
-- Tests for set()
--

	function T.action.set_SetsActionOS()
		local oldos = _OS
		_OS = "linux"
		premake.action.set("vs2008")
		test.isequal(_OS, "windows")
		_OS = oldos
	end


text:
package io.backchat.scapulet
package stanza

import xml._

/**
 * A Service Discovery Identity model
 *
 * @param category The category for this identity
 * @param `type` The type of identity
 * @param name An optional name for the identity, only used in some cases
 */
class Identity(val category: String, val `type`: String, val name: Option[String] = None) extends Product3[String, String, Option[String]] {

  require(category.nonBlank, "You have to provide a category")
  require(`type`.nonBlank, "You have to provide a type")

  /**
   * Product interface implementation represents the category
   */
  val _1 = category

  /**
   * Product interface implementation represents the type
   */
  val _2 = `type`

  /**
   * Product interface implementation represents the name
   */
  val _3 = name

  /**
   * Whether this can equal that
   * @param that
   * @return Boolean
   */
  def canEqual(that: Any) = that.isInstanceOf[Identity]

  /**
   * Convert this Identity to its XML representation
   *
   * @return [[scala.xml.Node]]
   */
  def toXml = name match {
    case Some(nm) ⇒ <identity category={ category } type={ `type` } name={ nm }/>
    case _        ⇒ <identity category={ category } type={ `type` }/>
  }

  override def hashCode() = scala.runtime.ScalaRunTime._hashCode(this)

  override def equals(p1: Any) = canEqual(p1) && scala.runtime.ScalaRunTime._equals(this, p1)
}

/**
 * Companion object of [[io.backchat.scapulet.stanza.Identity]]
 *
 * @see [[io.backchat.scapulet.stanza.Identity]]
 */
object Identity {

  /**
   * Create an identity with the specified data
   * @see [[io.backchat.scapulet.stanza.Identity]]
   */
  def apply(category: String, `type`: String, name: Option[String] = None): Identity = {
    new Identity(category, `type`, name)
  }

  /**
   * Extract an identity out of a [[scala.xml.Node]]
   * @param elem [[scala.xml.Node]]
   * @return [[scala.Option]]
   */
  def unapply(elem: Node) = elem match {
    case identity @ Elem(_, "identity", _, _, _*) if (identity.attribute("category").isDefined && identity.attribute("type").isDefined) ⇒ {
      val name = identity.attribute("name") flatMap {
        a ⇒ Option(a.text)
      }
      Some(((identity \ "@category").text, (identity \ "@type").text, name))
    }
    case _ ⇒ None
  }

  /**
   * The "account" category is to be used by a server when responding to a disco request sent
   * to the bare JID (user@host addresss) of an account hosted by the server.
   */
  object account {

    /**
     * The user@host is an administrative account
     *
     * {{{
     * <identity category='account' type='admin'/>
     * }}}
     */
    object admin extends Identity("account", "admin")

    /**
     * The user@host is a "guest" account that allows anonymous login by any user
     *
     * {{{
     * <identity category='account' type='anonymous'/>
     * }}}
     */
    object anonymous extends Identity("account", "anonymous")

    /**
     * The user@host is a registered or provisioned account associated with a particular non-administrative user
     *
     * {{{
     * <identity category='account' type='registered'/>
     * }}}
     */
    object registered extends Identity("account", "registered")
  }

  /**
   * The "auth" category consists of server components that provide authentication services within a server implementation.
   */
  object auth {

    /**
     * A server component that authenticates based on external certificates
     *
     * {{{
     * <identity category='auth' type='cert'/>
     * }}}
     */
    object cert extends Identity("auth", "cert")

    /**
     * A server authentication component other than one of the registered types
     *
     * {{{
     * <identity category='auth' type='generic'/>
     * }}}
     */
    object generic extends Identity("auth", "generic")

    /**
     * A server authentication component other than one of the registered types
     *
     * {{{
     * <identity category='auth' type='ldap'/>
     * }}}
     */
    object ldap extends Identity("auth", "ldap")

    /**
     * A server component that authenticates against an NT domain
     *
     * {{{
     * <identity category='auth' type='ntlm'/>
     * }}}
     */
    object ntlm extends Identity("auth", "ntlm")

    /**
     * A server component that authenticates against a PAM system
     *
     * {{{
     * <identity category='auth' type='pam'/>
     * }}}
     */
    object pam extends Identity("auth", "pam")

    /**
     * A server component that authenticates against a Radius system
     *
     * {{{
     * <identity category='auth' type='radius'/>
     * }}}
     */
    object radius extends Identity("auth", "radius")
  }

  /**
   * The "automation" category consists of entities and nodes that provide automated or programmed interaction.
   */
  object automation {

    /**
     * The node for a list of commands; valid only for the node "http://jabber.org/protocol/commands"
     *
     * {{{
     * <identity category='automation' type='command-list'/>
     * }}}
     */
    object `command-list` extends Identity("automation", "command-list")

    /**
     * A node for a specific command; the "node" attribute uniquely identifies the command
     *
     * {{{
     * <identity category='automation' type='command-node'/>
     * }}}
     */
    object `command-node` extends Identity("automation", "command-node")

    /**
     * An entity that supports Jabber-RPC.
     *
     * {{{
     * <identity category='automation' type='rpc'/>
     * }}}
     */
    object rpc extends Identity("automation", "rpc")

    /**
     * An entity that supports the SOAP XMPP Binding.
     *
     * {{{
     * <identity category='automation' type='soap'/>
     * }}}
     */
    object soap extends Identity("automation", "soap")

    /**
     * An entity that provides automated translation services.
     *
     * {{{
     * <identity category='automation' type='translation'/>
     * }}}
     */
    object translation extends Identity("automation", "translation")
  }

  /**
   * The "client" category consists of different types of clients, mostly for instant messaging.
   */
  object client {

    /**
     * An automated client that is not controlled by a human user
     *
     * {{{
     * <identity category='client' type='bot'/>
     * }}}
     */
    object bot extends Identity("client", "bot")

    /**
     * Minimal non-GUI client used on dumb terminals or text-only screens
     *
     * {{{
     * <identity category='client' type='console'/>
     * }}}
     */
    object console extends Identity("client", "console")

    /**
     * A client running on a gaming console
     *
     * {{{
     * <identity category='client' type='game'/>
     * }}}
     */
    object game extends Identity("client", "game")

    /**
     * A client running on a PDA, RIM device, or other handheld
     *
     * {{{
     * <identity category='client' type='handheld'/>
     * }}}
     */
    object handheld extends Identity("client", "handheld")

    /**
     * Standard full-GUI client used on desktops and laptops
     *
     * {{{
     * <identity category='client' type='pc'/>
     * }}}
     */
    object pc extends Identity("client", "pc")

    /**
     * A client running on a mobile phone or other telephony device
     *
     * {{{
     * <identity category='client' type='phone'/>
     * }}}
     */
    object phone extends Identity("client", "phone")

    /**
     * A client that is not actually using an instant messaging client; however,
     * messages sent to this contact will be delivered as Short Message Service (SMS) messages
     *
     * {{{
     * <identity category='client' type='sms'/>
     * }}}
     */
    object sms extends Identity("client", "sms")

    /**
     * A client operated from within a web browser
     *
     * {{{
     * <identity category='client' type='web'/>
     * }}}
     */
    object web extends Identity("client", "web")
  }

  /**
   * The "collaboration" category consists of services that enable multiple individuals to work together in real time.
   */
  object collaboration {

    /**
     * Multi-user whiteboarding service
     *
     * {{{
     * <identity category='collaboration' type='whiteboard'/>
     * }}}
     */
    object whiteboard extends Identity("collaboration", "whiteboard")
  }

  /**
   * The "component" category consists of services that are internal to server implementations and not normally exposed outside a server.
   */
  object component {

    /**
     * A server component that archives traffic
     *
     * {{{
     * <identity category='component' type='archive'/>
     * }}}
     */
    object archive extends Identity("component", "archive")

    /**
     * A server component that handles client connections
     *
     * {{{
     * <identity category='component' type='c2s'/>
     * }}}
     */
    object c2s extends Identity("component", "c2s")

    /**
     * A server component other than one of the registered types
     *
     * {{{
     * <identity category='component' type='generic'/>
     * }}}
     */
    object generic extends Identity("component", "generic")

    /**
     * A server component that handles load balancing
     *
     * {{{
     * <identity category='component' type='load'/>
     * }}}
     */
    object load extends Identity("component", "load")

    /**
     * A server component that logs server information
     *
     * {{{
     * <identity category='component' type='log'/>
     * }}}
     */
    object log extends Identity("component", "log")

    /**
     * A server component that provides presence information
     *
     * {{{
     * <identity category='component' type='presence'/>
     * }}}
     */
    object presence extends Identity("component", "presence")

    /**
     * A server component that handles core routing logic
     *
     * {{{
     * <identity category='component' type='router'/>
     * }}}
     */
    object router extends Identity("component", "router")

    /**
     * A server component that handles server connections
     *
     * {{{
     * <identity category='component' type='s2s'/>
     * }}}
     */
    object s2s extends Identity("component", "s2s")

    /**
     * A server component that manages user sessions
     *
     * {{{
     * <identity category='component' type='sm'/>
     * }}}
     */
    object sm extends Identity("component", "sm")

    /**
     * A server component that provides server statistics
     *
     * {{{
     * <identity category='component' type='stats'/>
     * }}}
     */
    object stats extends Identity("component", "stats")
  }

  /**
   * The "conference" category consists of online conference services such as multi-user chatroom services.
   */
  object conference {

    /**
     * Internet Relay Chat service
     *
     * {{{
     * <identity category='conference' type='irc'/>
     * }}}
     */
    object irc extends Identity("conference", "irc")

    /**
     * Text conferencing service
     *
     * {{{
     * <identity category='component' type='text'/>
     * }}}
     */
    object text extends Identity("conference", "text")

  }

  /**
   * The "directory" category consists of information retrieval services that enable users to search online directories
   * or otherwise be informed about the existence of other XMPP entities.
   */
  object directory {

    /**
     * A directory of chat rooms
     *
     * {{{
     * <identity category='directory' type='chatroom'/>
     * }}}
     */
    object chatroom extends Identity("directory", "chatroom")

    /**
     * A directory that provides shared roster groups
     *
     * {{{
     * <identity category='directory' type='group'/>
     * }}}
     */
    object group extends Identity("directory", "group")

    /**
     * A directory of end users (e.g., JUD)
     *
     * {{{
     * <identity category='directory' type='user'/>
     * }}}
     */
    object user extends Identity("directory", "user")

    /**
     * A directory of waiting list entries
     *
     * {{{
     * <identity category='directory' type='waitinglist'/>
     * }}}
     */
    object waitinglist extends Identity("directory", "waitinglist")
  }

  /**
   * The "gateway" category consists of translators between Jabber/XMPP services and non-XMPP services.
   */
  object gateway {

    /**
     * Gateway to AOL Instant Messenger
     *
     * {{{
     * <identity category='gateway' type='aim'/>
     * }}}
     */
    object aim extends Identity("gateway", "aim")

    /**
     * Gateway to the Facebook IM service
     *
     * {{{
     * <identity category='gateway' type='facebook'/>
     * }}}
     */
    object facebook extends Identity("gateway", "facebook")

    /**
     * Gateway to ICQ
     *
     * {{{
     * <identity category='gateway' type='icq'/>
     * }}}
     */
    object icq extends Identity("gateway", "icq")

    /**
     * Gateway to the Gadu-Gadu IM service
     *
     * {{{
     * <identity category='gateway' type='gadu-gadu'/>
     * }}}
     */
    object `gadu-gadu` extends Identity("gateway", "gadu-gadu")

    /**
     * Gateway that provides HTTP Web Services access
     *
     * {{{
     * <identity category='gateway' type='http-ws'/>
     * }}}
     */
    object `http-ws` extends Identity("gateway", "http-ws")

    /**
     * Gateway to IRC
     *
     * {{{
     * <identity category='gateway' type='irc'/>
     * }}}
     */
    object irc extends Identity("gateway", "irc")

    /**
     * Gateway to Microsoft Live Communications Server
     *
     * {{{
     * <identity category='gateway' type='lcs'/>
     * }}}
     */
    object lcs extends Identity("gateway", "lcs")

    /**
     * Gateway to MSN Messenger
     *
     * {{{
     * <identity category='gateway' type='msn'/>
     * }}}
     */
    object msn extends Identity("gateway", "aim")

    /**
     * Gateway to the mail.ru IM service
     *
     * {{{
     * <identity category='gateway' type='mrim'/>
     * }}}
     */
    object mrim extends Identity("gateway", "mrim")

    /**
     * Gateway to the MySpace IM service
     *
     * {{{
     * <identity category='gateway' type='aim'/>
     * }}}
     */
    object myspaceim extends Identity("gateway", "myspaceim")

    /**
     * Gateway to Microsoft Office Communications Server
     *
     * {{{
     * <identity category='gateway' type='ocs'/>
     * }}}
     */
    object ocs extends Identity("gateway", "ocs")

    /**
     * Gateway to the QQ IM service
     *
     * {{{
     * <identity category='gateway' type='qq'/>
     * }}}
     */
    object qq extends Identity("gateway", "qq")

    /**
     * Gateway to IBM Lotus Sametime
     *
     * {{{
     * <identity category='gateway' type='sametime'/>
     * }}}
     */
    object sametime extends Identity("gateway", "sametime")

    /**
     * Gateway to SIP for Instant Messaging and Presence Leveraging Extensions (SIMPLE)
     *
     * {{{
     * <identity category='gateway' type='simple'/>
     * }}}
     */
    object simple extends Identity("gateway", "simple")

    /**
     * Gateway to the Skype service
     *
     * {{{
     * <identity category='gateway' type='skype'/>
     * }}}
     */
    object skype extends Identity("gateway", "skype")

    /**
     * Gateway to Short Message Service
     *
     * {{{
     * <identity category='gateway' type='sms'/>
     * }}}
     */
    object sms extends Identity("gateway", "sms")

    /**
     * Gateway to the SMTP (email) network
     *
     * {{{
     * <identity category='gateway' type='smtp'/>
     * }}}
     */
    object smtp extends Identity("gateway", "smtp")

    /**
     * Gateway to the Tlen IM service
     *
     * {{{
     * <identity category='gateway' type='tlen'/>
     * }}}
     */
    object tlen extends Identity("gateway", "tlen")

    /**
     * Gateway to the Xfire gaming and IM service
     *
     * {{{
     * <identity category='gateway' type='xfire'/>
     * }}}
     */
    object xfire extends Identity("gateway", "xfire")

    /**
     * Gateway to another XMPP service (NOT via native server-to-server communication)
     *
     * {{{
     * <identity category='gateway' type='xmpp'/>
     * }}}
     */
    object xmpp extends Identity("gateway", "xmpp")

    /**
     * Gateway to Yahoo! Instant Messenger
     *
     * {{{
     * <identity category='gateway' type='yahoo'/>
     * }}}
     */
    object yahoo extends Identity("gateway", "yahoo")
  }

  /**
   * The "headline" category consists of services that provide real-time news or information
   * (often but not necessarily in a message of type "headline").
   */
  object headline {

    /**
     * Service that notifies a user of new email messages.
     *
     * {{{
     * <identity category='headline' type='newmail'/>
     * }}}
     */
    object newmail extends Identity("headline", "newmail")

    /**
     * RSS notification service.
     *
     * {{{
     * <identity category='headline' type='rss'/>
     * }}}
     */
    object rss extends Identity("headline", "rss")

    /**
     * Service that provides weather alerts.
     *
     * {{{
     * <identity category='headline' type='weather'/>
     * }}}
     */
    object weather extends Identity("headline", "weather")
  }

  /**
   * The "hierarchy" category is used to describe nodes within a hierarchy of nodes; the "branch" and "leaf" types are exhaustive.
   */
  object hierarchy {

    /**
     * A service discovery node that contains further nodes in the hierarchy.
     *
     * {{{
     * <identity category='hierarchy' type='branch'/>
     * }}}
     */
    object branch extends Identity("hierarchy", "branch")

    /**
     * A service discovery node that does not contain further nodes in the hierarchy.
     *
     * {{{
     * <identity category='hierarchy' type='leaf'/>
     * }}}
     */
    object leaf extends Identity("hierarchy", "leaf")
  }

  /**
   * The "proxy" category consists of servers or services that act as special-purpose proxies or intermediaries between two or more XMPP endpoints.
   */
  object proxy {

    /**
     * SOCKS5 bytestreams proxy service
     *
     * {{{
     * <identity category='proxy' type='bytestreams'/>
     * }}}
     */
    object bytestreams extends Identity("proxy", "bytestreams")
  }

  /**
   * Services and nodes that adhere to XEP-0060.
   */
  object pubsub {

    /**
     * A pubsub node of the "collection" type.
     *
     * {{{
     * <identity category='pubsub' type='collection'/>
     * }}}
     */
    object collection extends Identity("pubsub", "collection")

    /**
     * A pubsub node of the "leaf" type.
     *
     * {{{
     * <identity category='pubsub' type='leaf'/>
     * }}}
     */
    object leaf extends Identity("pubsub", "leaf")

    /**
     * A personal eventing service that supports the publish-subscribe subset defined in XEP-0163.
     *
     * {{{
     * <identity category='pubsub' type='pep'/>
     * }}}
     */
    object pep extends Identity("pubsub", "pep")

    /**
     * A pubsub service that supports the functionality defined in XEP-0060.
     *
     * {{{
     * <identity category='pubsub' type='service'/>
     * }}}
     */
    object service extends Identity("pubsub", "service")
  }

  /**
   * The "server" category consists of any Jabber/XMPP server.
   */
  object server {

    /**
     * Standard Jabber/XMPP server used for instant messaging and presence
     *
     * {{{
     * <identity category='server' type='im'/>
     * }}}
     */
    object im extends Identity("server", "im")
  }

  /**
   * The "store" category consists of internal server components that provide data storage and retrieval services.
   */
  object store {

    /**
     * A server component that stores data in a Berkeley database
     *
     * {{{
     * <identity category='store' type='berkeley'/>
     * }}}
     */
    object berkeley extends Identity("store", "berkeley")

    /**
     * A server component that stores data on the file system
     *
     * {{{
     * <identity category='store' type='file'/>
     * }}}
     */
    object file extends Identity("store", "file")

    /**
     * A server data storage component other than one of the registered types
     *
     * {{{
     * <identity category='store' type='generic'/>
     * }}}
     */
    object generic extends Identity("store", "generic")

    /**
     * A server component that stores data in an LDAP database
     *
     * {{{
     * <identity category='store' type='ldap'/>
     * }}}
     */
    object ldap extends Identity("store", "ldap")

    /**
     * A server component that stores data in a MySQL database
     *
     * {{{
     * <identity category='store' type='mysql'/>
     * }}}
     */
    object mysql extends Identity("store", "mysql")

    /**
     * A server component that stores data in an Oracle database
     *
     * {{{
     * <identity category='store' type='oracle'/>
     * }}}
     */
    object oracle extends Identity("store", "oracle")

    /**
     * A server component that stores data in a PostgreSQL database
     *
     * {{{
     * <identity category='store' type='postgres'/>
     * }}}
     */
    object postgres extends Identity("store", "postgres")

  }
}


text:
    && !defined(BOOST_MPL_PREPROCESSING_MODE)

#   define BOOST_MPL_PREPROCESSED_HEADER reverse_iter_fold_impl.hpp
#   include <boost/mpl/aux_/include_preprocessed.hpp>

#else

#   define AUX778076_FOLD_IMPL_OP(iter) iter
#   define AUX778076_FOLD_IMPL_NAME_PREFIX reverse_iter_fold
#   include <boost/mpl/aux_/reverse_fold_impl_body.hpp>

#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_AUX_ITER_FOLD_BACKWARD_IMPL_HPP_INCLUDED


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Novitates Mycologicae 190 (1939)

#### Original name
Eriopezia caricina Velen.

### Remarks
null


text:
NS_BEGIN(elloop);

template <typename T>
void dumpHashTable(const HashTable<T> &ht) {
    psln(ht.size());
    psln(ht.capacity());
}

// todo: use HashTable to solve real oj problem.
BEGIN_TEST(HashTableTest, StringHash, @@);

    std::cout << std::boolalpha;
    bool isUnique(false);

    HashTable<std::string> ht;

    dumpHashTable(ht);

    psln(ht.search("hello"));

    psln(ht.insert("hello", isUnique));
    psln(isUnique);
    psln(ht.search("hello"));

END_TEST;

NS_END(elloop);


text:
package hu.opdoc.openkmip4j.representation;

import hu.opdoc.openkmip4j.KmipException;

import java.util.Arrays;
import java.util.stream.Collectors;

/**
 * Created by peter on 2017.06.17..
 */
public class KmipNotRecognizedRepresentationException extends KmipException {

    public KmipNotRecognizedRepresentationException() {
        super("Unrecognized message representation. Supported ones: " + String.join(
                ", ",
                Arrays.asList(Representation.values()).stream()
                        .map(Representation::name)
                        .collect(Collectors.toList())
        ));
    }
}


text:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class P13HandsOfCards {
    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        Map<String, Set<String>> result = new LinkedHashMap<>();

        while (true) {
            String line = reader.readLine();
            if ("joker".equalsIgnoreCase(line)) {
                break;
            }

            String[] params = line.split(":");
            String name = params[0];
            String[] cards = params[1].trim().split(", ");
            if (!result.containsKey(name)) {
                Set<String> cardSet = new HashSet<>();
                cardSet.addAll(Arrays.asList(cards));

                result.put(name, cardSet);
            } else {
                for (String card : cards) {
                    result.get(name).add(card);
                }
            }
        }

        for (Map.Entry<String, Set<String>> entry : result.entrySet()) {
            int score = 0;
            for (String card : entry.getValue()) {
                int power = getCardPower(card);
                int type = getCardType(card);
                if (power != 0 && type != 0) {
                    score += power * type;
                }else{
                    System.out.println("Invalid input!");
                    return;
                }
            }

            System.out.printf("%s: %d\n", entry.getKey(), score);
        }
    }

    private static int getCardType(String card) {
        switch (card.charAt(card.length() - 1)) {
            case 'S':
                return 4;
            case 'H':
                return 3;
            case 'D':
                return 2;
            case 'C':
                return 1;
        }

        return 0;
    }

    private static int getCardPower(String card) {
        if (Character.isDigit(card.charAt(0))) {
            if (card.charAt(0) == '1') {
                return 10;
            } else {
                return Integer.valueOf(card.charAt(0) + "");
            }
        } else {
            switch (card.charAt(0)) {
                case 'J':
                    return 11;
                case 'Q':
                    return 12;
                case 'K':
                    return 13;
                case 'A':
                    return 14;
            }
        }

        return 0;
    }
}


text:
<html>
    <head>
        <script src="mraid.js"></script>
        <script language="javascript">
            function handleStateChanged() {
                alert('current state: ' + mraid.getState());
            }

        mraid.addEventListener("stateChange", handleStateChanged);
            </script>
    </head>
    <body align='center' style="background-color:silver;">
        Test MRAID Interstitial removeEventListener<br/>
        <button type='button' onclick='mraid.removeEventListener("stateChange", handleStateChanged);'>Remove Listener</button>
    </body>
</html>


text:
'use strict';

Object.defineProperty(exports, '__esModule', {
	value: true
});

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var JTBody = _react2['default'].createClass({
	displayName: 'JTBody',

	render: function render() {
		var data = this.props.data;

		return _react2['default'].createElement(
			'tbody',
			null,
			data.map(function (row, i) {
				return _react2['default'].createElement(
					'tr',
					{ key: i },
					Object.keys(row).map(function (key, i) {
						var value = row[key];
						return _react2['default'].createElement(
							'td',
							{ key: i, title: key },
							value
						);
					})
				);
			})
		);
	}
});

exports['default'] = JTBody;
module.exports = exports['default'];


text:
#include "vislib/graphics/ColourRGBAu8.h"

/*
 * vislib::graphics::ColourRGBAu8::ColourRGBAu8
 */
vislib::graphics::ColourRGBAu8::ColourRGBAu8(void) {
    this->comp[0] = 0;
    this->comp[1] = 0;
    this->comp[2] = 0;
    this->comp[3] = 255;
}

/*
 * vislib::graphics::ColourRGBAu8::ColourRGBAu8
 */
vislib::graphics::ColourRGBAu8::ColourRGBAu8(unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
    this->comp[0] = r;
    this->comp[1] = g;
    this->comp[2] = b;
    this->comp[3] = a;
}

/*
 * vislib::graphics::ColourRGBAu8::ColourRGBAu8
 */
vislib::graphics::ColourRGBAu8::ColourRGBAu8(const vislib::graphics::ColourRGBAu8& src) {
    *this = src;
}

/*
 * vislib::graphics::ColourRGBAu8::~ColourRGBAu8
 */
vislib::graphics::ColourRGBAu8::~ColourRGBAu8(void) {
    // Intentionally empty
}

/*
 * vislib::graphics::ColourRGBAu8::Interpolate
 */
vislib::graphics::ColourRGBAu8 vislib::graphics::ColourRGBAu8::Interpolate(
    const vislib::graphics::ColourRGBAu8& rhs, float t) const {
    float a = 1.0f - t;
    return vislib::graphics::ColourRGBAu8(
        static_cast<unsigned char>(static_cast<float>(this->comp[0]) * a + static_cast<float>(rhs.comp[0]) * t),
        static_cast<unsigned char>(static_cast<float>(this->comp[1]) * a + static_cast<float>(rhs.comp[1]) * t),
        static_cast<unsigned char>(static_cast<float>(this->comp[2]) * a + static_cast<float>(rhs.comp[2]) * t),
        static_cast<unsigned char>(static_cast<float>(this->comp[3]) * a + static_cast<float>(rhs.comp[3]) * t));
}

/*
 * vislib::graphics::ColourRGBAu8::Set
 */
void vislib::graphics::ColourRGBAu8::Set(unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
    this->comp[0] = r;
    this->comp[1] = g;
    this->comp[2] = b;
    this->comp[3] = a;
}

/*
 * vislib::graphics::ColourRGBAu8::operator==
 */
bool vislib::graphics::ColourRGBAu8::operator==(const vislib::graphics::ColourRGBAu8& rhs) const {
    return (this->comp[0] == rhs.comp[0]) && (this->comp[1] == rhs.comp[1]) && (this->comp[2] == rhs.comp[2]) &&
           (this->comp[3] == rhs.comp[3]);
}

/*
 * vislib::graphics::ColourRGBAu8::operator=
 */
vislib::graphics::ColourRGBAu8& vislib::graphics::ColourRGBAu8::operator=(const vislib::graphics::ColourRGBAu8& rhs) {
    this->comp[0] = rhs.comp[0];
    this->comp[1] = rhs.comp[1];
    this->comp[2] = rhs.comp[2];
    this->comp[3] = rhs.comp[3];
    return *this;
}


text:
using System;
using Blitzy.Plugin;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Blitzy.Tests.Plugins
{
	[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
	internal class PluginTester
	{
		public PluginTester( IPlugin plug, bool dispose = true )
		{
			Assert.IsNotNull( plug, "Plugin null" );

			Assert.IsNotNull( plug.Author, "Plugin Author" );
			Assert.IsNotNull( plug.Description, "Plugin Description" );
			Assert.IsNotNull( plug.Version, "Plugin Version" );
			Assert.AreEqual( Constants.ApiVersion, plug.ApiVersion, "Plugin APIVersion" );
			Assert.AreNotEqual( Guid.Empty, plug.PluginID, "Plugin ID" );
			Assert.IsNotNull( plug.Website, "Plugin Website" );
			Assert.IsNotNull( plug.Name, "Plugin Name" );

			TestRunComplete = true;

			if( dispose )
			{
				plug.Dispose();
			}
		}

		public readonly bool TestRunComplete;
	}
}


text:
#include <iostream>
#include <vector>
#include <algorithm> // Más info en: http://www.cplusplus.com/reference/algorithm/

using namespace std;

void imprimir(vector<int>);
bool desc(int, int);

int main()
{
  int numeros[] = {1, 1, 2, 3, 1, 5, 3, 5, 3};
  vector<int> vec(numeros, numeros + 9);

  /* min */

  cout << min(1, 10) << endl;

  /* max */

  cout << max(1, 10) << endl;

  /**
   * min_element(first, last)
   *
   * Devuele el valor máximo dentro del rango [first,last]
   * Esta función devuelve un iterador, se debe utilizar * para obtener el valor.
   */

  cout << "Valor mínimo en numeros[]: " << * (min_element(numeros, numeros + 9)) << endl;
  cout << "Valor mínimo en vec<int>: " << * (min_element(vec.begin(), vec.end())) << endl;

  /**
   * max_element(first, last)
   *
   * Devuele el valor máximo dentro del rango [first,last]
   * Esta función devuelve un iterador, se debe utilizar * para obtener el valor.
   */

  cout << "Valor máximo en numeros[]: " << * (max_element(numeros, numeros + 9)) << endl;
  cout << "Valor máximo en vec<int>: " << * (max_element(vec.begin(), vec.end())) << endl;

  /**
   * count(first, last, val)
   *
   * Cuenta las veces que aparece "val" dentro del rango [first,last]
   */

  cout << "El 1 aparece " << count(numeros, numeros + 9, 1) << " veces." << endl;
  cout << "El 5 aparece " << count(vec.begin(), vec.end(), 5) << " veces." << endl;

  /**
   * copy(first, last, result)
   *
   * Copia los elementos dentro del rango [first,last] dentro del rango
   * comenzando en "result"
   */

  int a1[] = {10, 20, 30, 40, 50, 60, 70};
  vector<int> v1(7);
  // Copia los valores desde la posición 0 a la 7 al comienzo del vector v1
  copy(a1, a1 + 7, v1.begin());
  imprimir(v1);

  /**
   * fill(first, last, val)
   *
   * Asigna el valor "val" a todos los dentro del rango [first, last]
   */

  vector<int> v2(10);
  // Llena el vector v2 con 1s desde la posición 0 a la 4
  fill(v2.begin(), v2.begin() + 5, 1);
  // Llena el vector v2 con 2s desde la posición 5 hasta el final
  fill(v2.begin() + 5, v2.end(), 2);
  imprimir(v2);

  /**
   * equal(first, last, first2)
   *
   * Comprueba que los valores dentro del rango [first, last] sean iguales
   * al rango comenando en first2
   */

  a1[3] = 81;
  if(equal(v1.begin(), v1.end(), a1)) {
    cout << "El contenido de v1 y a1 son iguales." << endl;
  } else {
    cout << "El contenido de v1 y a1 no son iguales." << endl;
  }

  /**
   * reverse(first, last)
   *
   * Revierte los valores dentro del rango [first, last]
   */

  reverse(v1.begin(), v1.end());
  imprimir(v1);

  /**
   * find(first, last, val)
   *
   * Retorna un iterador al primer elemento dentro del rango [first, last] que
   * sea igual a "val". Si no existe el elemento la función retorna un puntero
   * a last (última posición)
   */

   const short MAX = 4;
   int aux[MAX] = {10, 20, 30, 40};
   int *p;
   p = find(aux, aux + MAX, 30);

   if (*p == aux[MAX - 1] || p != aux + 4) {
     cout << "Elemento encontrado dentro de aux[]: " << *p << endl;
   } else {
     cout << "Elemento no encontrado." << endl;
   }

  /**
   * sort(first, last)
   *
   * Ordena los elementos dentro del rango [first, last] se forma ascendente.
   */

  sort(vec.begin(), vec.end()); // Ordena el vector
  sort(numeros, numeros + 9); // Ordena el array
  imprimir(vec);

  // Ordena el rango en forma descendente utilizando una función auxiliar
  sort(vec.begin(), vec.end(), desc);
  imprimir(vec);

  /**
   * binary_search(first, last, val)
   *
   * Retorna true si cualquier elemento dentro del rango [first, last] es
   * equivalente a "val". Retora false de lo contrario.
   *
   * IMPORTANTE: Para utilizr esta función, el rango debe estar en orden
  */

  if(binary_search(vec.begin(), vec.end(), 5)) {
    cout << "Valor encontrado dentro de vec<int>" << endl;
  } else {
    cout << "Valor no encontrado dentro de vec<int>" << endl;
  }

  return 0;
}

/**
 * Verifica si el primer valor es mayor o igual al segundo.
 *
 * @param int x Primer valor a comparar
 * @param int y Segundo valor a comparar
 * @return bool
 */
bool desc(int x, int y) {
  return x >= y;
}

/**
 * Imprime el contenido de un vector utilizando iteradores
 *
 * @param vector<int> v Vector a recorrer
 */
void imprimir(vector<int> v) {
  vector<int>::iterator it;
  for(it = v.begin(); it != v.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}


text:
import java.util.*;

public class exitProgram
{
    public static void main(String[ ] args)
    {
      Scanner in = new Scanner(System.in);
      System.out.println("Enter some strings !");
      //List<String> list = new ArrayList<String>( );
      boolean loop = true;
        while(loop)
        {
          String s = in.nextLine( );

            if(s.equals("")|s.equals("q"))
            {
              break;
            }

        }

    }//main ends

}


text:
package org.opencypher.tools.tck.reporting.cucumber;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

class SystemOutReader {
    private PrintStream systemOut = System.out;
    private ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    private TeeOutputStream teeOutput = new TeeOutputStream(System.out, buffer);

    SystemOutReader() {
        System.setOut(new PrintStream(teeOutput));
    }

    void close() throws IOException {
        System.setOut(systemOut);
        buffer.close();
    }

    String clear() {
        String output = buffer.toString();
        buffer.reset();
        return output;
    }

    static class TeeOutputStream extends OutputStream {
        private OutputStream out1;
        private OutputStream out2;

        TeeOutputStream(final OutputStream out1, final OutputStream out2) {
            this.out1 = out1;
            this.out2 = out2;
        }

        @Override
        public void write(final byte[] b) throws IOException {
            this.out1.write(b);
            this.out2.write(b);
        }

        @Override
        public void write(final byte[] b, final int off, final int len) throws IOException {
            this.out1.write(b, off, len);
            this.out2.write(b, off, len);
        }

        @Override
        public void write(final int b) throws IOException {
            this.out1.write(b);
            this.out2.write(b);
        }

        @Override
        public void flush() throws IOException {
            this.out1.flush();
            this.out2.flush();
        }

        @Override
        public void close() throws IOException {
            try {
                this.out1.close();
            } finally {
                this.out2.close();
            }
        }

    }

}


text:
from __future__ import print_function
from benchmark import DTraceCollector, instancePIDs
from twisted.internet import reactor
from twisted.internet.defer import Deferred, inlineCallbacks
from twisted.python.failure import Failure
from twisted.python.log import err
import sys
import signal
import time

class Stop(Exception):
    pass

interrupted = 0.0

def waitForInterrupt():
    if signal.getsignal(signal.SIGINT) != signal.default_int_handler:
        raise RuntimeError("Already waiting")

    d = Deferred()

    def fire(*ignored):
        global interrupted
        signal.signal(signal.SIGINT, signal.default_int_handler)
        now = time.time()
        if now - interrupted < 4:
            reactor.callFromThread(lambda: d.errback(Failure(Stop())))
        else:
            interrupted = now
            reactor.callFromThread(d.callback, None)
    signal.signal(signal.SIGINT, fire)
    return d

@inlineCallbacks
def collect(directory):
    while True:
        pids = instancePIDs(directory)
        dtrace = DTraceCollector("sql_measure.d", pids)
        print('Starting')
        yield dtrace.start()
        print('Started')
        try:
            yield waitForInterrupt()
        except Stop:
            yield dtrace.stop()
            break
        print('Stopping')
        stats = yield dtrace.stop()
        for s in stats:
            if s.name == 'execute':
                s.statements(stats[s])
        print('Stopped')

def main():
    from twisted.python.failure import startDebugMode
    startDebugMode()
    d = collect(sys.argv[1])
    d.addErrback(err, "Problem collecting SQL")
    d.addBoth(lambda ign: reactor.stop())
    reactor.run(installSignalHandlers=False)


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:id="@+id/action_search"
        android:icon="@android:drawable/ic_menu_search"
        android:title="@string/action_search"
        android:showAsAction="ifRoom"/>

    <item android:id="@+id/action_add"
        android:icon="@android:drawable/ic_menu_add"
        android:title="@string/action_add"
        android:showAsAction="ifRoom"/>

    <item android:id="@+id/action_about"
        android:title="@string/action_about"
        android:showAsAction="never"/>

    <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        android:showAsAction="never"/>

    <item android:id="@+id/action_logout"
        android:title="@string/action_logout"
        android:showAsAction="never"/>

</menu>


text:
#pragma once

#include "LFXDecl.h"
#define _EXPORTING

#ifdef _EXPORTING // To be used by SDK developer
#define FN_DECLSPEC __declspec(dllexport)

#elif _IMPORTING // To be used for dynamic linking to dll
#define FN_DECLSPEC __declspec(dllimport)

#else // To be used for linking using static library
#define FN_DECLSPEC
#endif

#ifdef _STDCALL_SUPPORTED
#define STDCALL __stdcall // Declare our calling convention
#else
#define STDCALL
#endif // STDCALL_SUPPORTED

#ifdef __cplusplus
extern "C" {
#endif

	// LightFX 2.0 DLL export function declarations

	/*********************************************************
	Function: LFX_Initialize
	Description:
	Initializes the LightFX 2.0 system.
	This function must be called prior to any other library calls being made. If this
	function is not called, the system will not be initialized and the other functions
	will return LFX_ERROR_NOINIT or LFX_FAILURE.
	Inputs: None
	Outputs: None
	Returns:
	LFX_SUCCESS if the system is successfully initialized, or was already initialized.
	LFX_ERROR_NODEVS if the system is initialized, but no devices are available.
	LFX_FAILURE if initialization fails.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_Initialize();

	/*********************************************************
	Function: LFX_Release
	Description:
	Release the LightFX 2.0 system.
	This function may be called when the system is no longer needed. If this
	function is not called, release will still occur on process detach.
	PnP Note:
	An application may want to release the system and initialize it again in
	response to a device arrival notification, to account for new devices added
	while the application is running.
	Inputs: None
	Outputs: None
	Returns:
	LFX_SUCCESS
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_Release();

	/*********************************************************
	Function: LFX_Reset
	Description:
	Reset the state of the system to 'off' for any lights attached to any devices.
	Note that the change(s) to the physical light(s) do not occur immediately, rather
	only after an LFX_Update() call is made.
	To disable all lights, call LFX_Reset(), immediately followed by LFX_Update().
	Inputs:	None
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if there are no devices available to reset.
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_Reset();

	/*********************************************************
	Function: LFX_Update
	Description:
	Update the entire system, submitting any state changes to hardware
	made since the last LFX_Reset()	call.
	Inputs:	None
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available.
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_Update();

	/*********************************************************
	Function: LFX_UpdateDefault
	Description:
	Update the entire system, submitting any state changes made since the last LFX_Reset()
	call to the hardware, and set the appropriate flags to make the new state the
	power-on default.
	Note: Not all devices will support this functionality.
	Inputs:	None
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_UpdateDefault();

	/*********************************************************
	Function: LFX_GetNumDevices
	Description:
	Get the number of devices attached to the LightFX system
	Inputs:	None
	Outputs: Populates a uint with the current number of attached devices.
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available, leaving the param untouched.
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetNumDevices(unsigned int* const);

	/*********************************************************
	Function: LFX_GetDeviceDescription
	Description:
	Get the description of a device attached to the system
	Inputs:	Accepts an index to the device
	Outputs:
	Populates a character string with the device's description
	Populates a ushort with the device type (see LFXDecl.h for device types)
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available.
	LFX_ERROR_BUFFSIZE if the buffer provided is too small.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetDeviceDescription(const unsigned int, char* const, const unsigned int, unsigned char* const);

	/*********************************************************
	Function: LFX_GetNumLights
	Description:
	Get the number of lights attached to a device in the LightFX system
	Inputs:	Accepts an index to the device
	Outputs: Populates a uint with the current number of attached lights for the device index.
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available at the index provided.
	LFX_ERROR_NOLIGHTS if no lights are available at the device index provided.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetNumLights(const unsigned int, unsigned int* const);

	/*********************************************************
	Function: LFX_GetLightDescription
	Description:
	Get the description of a light attached to a device
	Inputs:	Accepts an index to the device and an index to the light
	Outputs: Populates a character string with the light's description
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available at the index provided.
	LFX_ERROR_NOLIGHTS if no lights are available at the device and light index provided.
	LFX_ERROR_BUFFSIZE if the buffer provided is too small in size.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetLightDescription(const unsigned int, const unsigned int, char* const, const unsigned int);

	/*********************************************************
	Function: LFX_GetLightLocation
	Description:
	Get the location of a light attached to a device
	Inputs:	Accepts an index to the device and an index to the light
	Outputs: Populates a LFX_POSITION structure with the light's position (see LFXDecl.h
	for more information).
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available at the index provided.
	LFX_ERROR_NOLIGHTS if no lights are available at the device and light index provided.
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetLightLocation(const unsigned int, const unsigned int, PLFX_POSITION const);

	/*********************************************************
	Function: LFX_GetLightColor
	Description:
	Get the current color of a light attached to a device
	Important:
	This function provides the current color stored in the active state
	since the last LFX_Reset() call, it does not necessarily reflect the color of the
	physical light. To ensure that the returned value represents the state of the
	physical light, call LFX_GetLightColor immediately after a call to LFX_Update() and
	before the next call to LFX_Reset().
	Inputs:	Accepts an index to the device and an index to the light
	Outputs: Populates a LFX_COLOR structure with the light's description
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NODEVS if the system is initialized but no devices are available at the index provided.
	LFX_ERROR_NOLIGHTS if no lights are available at the device and light index provided.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetLightColor(const unsigned int, const unsigned int, PLFX_COLOR const);

	/*********************************************************
	Function: LFX_SetLightColor
	Description:
	Sets the current color of a light attached to a device
	Important:
	This function changes the current color stored in the active state
	since the last LFX_Reset() call. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made.
	Inputs:	Accepts an index to the device, an index to the light, and a new LFX_COLOR value
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_SetLightColor(const unsigned int, const unsigned int, const PLFX_COLOR);

	/*********************************************************
	Function: LFX_Light
	Description:
	Sets the color of a location for any devices with lights in that
	corresponding location.
	Important:
	This function changes the current color stored in the active state
	since the last LFX_Reset() call. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made.
	Location Mask Note:
	Location mask is a 32-bit field, where each of the first 27 bits represent
	a zone in the virtual cube representing the system (see LFXDecl.h)
	Color Packing Note:
	Color is packed into a 32-bit value, as follows:
	Bits 0-7: Blue
	Bits 8-15: Green
	Bits 16-23: Red
	Bits 24-32: Brightness
	Inputs:	Accepts a 32-bit location mask and a packed color value
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NOLIGHTS if no lights were found at the location mask specified.
	LFX_FAILURE if some other error occurred
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_Light(const unsigned int, const unsigned int);

	/*********************************************************
	Function: LFX_SetLightActionColor
	Description:
	Sets the primary color and an action type to a light
	Important:
	This function changes the current color and action type stored in the active state
	since the last LFX_Reset() call. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made. If the action type is a morph, then
	the secondary color for the action is black.
	Inputs:	Accepts an index to the device, an index to the light, an action type, and a new primary LFX_COLOR value
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_SetLightActionColor(const unsigned int, const unsigned int, const unsigned int, const PLFX_COLOR);

	/*********************************************************
	Function: LFX_SetLightActionColorEx
	Description:
	Sets the primary and secondary colors and an action type to a light
	Important:
	This function changes the current color and action type stored in the active state
	since the last LFX_Reset() call. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made. If the action type is not a morph,
	then the secondary color is ignored.
	Inputs:	Accepts an index to the device, an index to the light, an action type, and two LFX_COLOR values
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_SetLightActionColorEx(const unsigned int, const unsigned int, const unsigned int, const PLFX_COLOR, const PLFX_COLOR);

	/*********************************************************
	Function: LFX_ActionColor
	Description:
	Sets the primary color and an action type for any devices with lights in a location.
	Important:
	This function changes the current primary color and action type stored in the active state
	since the last LFX_Reset() call. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made. If the action type is a morph, then
	the secondary color for the action is black.
	Location Mask Note:
	Location mask is a 32-bit field, where each of the first 27 bits represent
	a zone in the virtual cube representing the system (see LFXDecl.h)
	Color Packing Note:
	Color is packed into a 32-bit value, as follows:
	Bits 0-7: Blue
	Bits 8-15: Green
	Bits 16-23: Red
	Bits 24-32: Brightness
	Inputs:	Accepts a 32-bit location mask and a packed color value
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NOLIGHTS if no lights were found at the location mask specified.
	LFX_FAILURE if some other error occurred
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_ActionColor(const unsigned int, const unsigned int, const unsigned int);

	/*********************************************************
	Function: LFX_ActionColorEx
	Description:
	Sets the primary and secondary color and an action type for any devices with lights in a location.
	Important:
	This function changes the current primary and secondary color and action type stored in the active state
	since the last LFX_Reset() call. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made. If the action type is not a morph,
	then the secondary color is ignored.
	Location Mask Note:
	Location mask is a 32-bit field, where each of the first 27 bits represent
	a zone in the virtual cube representing the system (see LFXDecl.h)
	Color Packing Note:
	Color is packed into a 32-bit value, as follows:
	Bits 0-7: Blue
	Bits 8-15: Green
	Bits 16-23: Red
	Bits 24-32: Brightness
	Inputs:	Accepts a 32-bit location mask and a packed color value
	Outputs: None
	Returns:
	LFX_ERROR_NOINIT if the system is not yet initialized.
	LFX_ERROR_NOLIGHTS if no lights were found at the location mask specified.
	LFX_FAILURE if some other error occurred
	LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_ActionColorEx(const unsigned int, const unsigned int, const unsigned int, const unsigned int);

	/*********************************************************
	Function: LFX_SetTiming
	Description:
	Sets the tempo for actions.
	Important:
	This function changes the current tempo or timing to be used for the
	next actions. It does NOT immediately update the physical light
	settings, until a call to LFX_Update() is made.
	Timing Note:
	Is a value between min and max tempo allowed for the main device.
	If a value lower than min or a value greather than max is entered,
	the value is readjusted to those extremes.
	Inputs:	Accepts a 32-bit timing value
	Outputs: None
	Returns:
	LFX_FAILURE if changing tempo is not supported or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_SetTiming(const int);

	/*********************************************************
	Function: LFX_GetVersion
	Description:
	Get API Version
	Inputs:	Accepts the buffer and buffer size
	Outputs:
	Populates a character string with the API version
	Returns:
	LFX_ERROR_BUFFSIZE if the buffer provided is too small.
	LFX_FAILURE or LFX_SUCCESS otherwise.
	*********************************************************/
	FN_DECLSPEC LFX_RESULT STDCALL LFX_GetVersion(char* const, const unsigned int);

#ifdef __cplusplus
} /* end extern "C" */
#endif

  // The remaining defines and typedefs are useful for explicitly linking to
  // the DLL, and can be ignored if using the static lib, or implicitely linking.
#define LFX_DLL_NAME "LightFX.dll"

  // LightFX 2.0 DLL export function names
#define LFX_DLL_INITIALIZE "LFX_Initialize"
#define LFX_DLL_RELEASE "LFX_Release"
#define LFX_DLL_RESET "LFX_Reset"
#define LFX_DLL_UPDATE "LFX_Update"
#define LFX_DLL_UPDATEDEFAULT "LFX_UpdateDefault"
#define LFX_DLL_GETNUMDEVICES "LFX_GetNumDevices"
#define LFX_DLL_GETDEVDESC "LFX_GetDeviceDescription"
#define LFX_DLL_GETNUMLIGHTS "LFX_GetNumLights"
#define LFX_DLL_GETLIGHTDESC "LFX_GetLightDescription"
#define LFX_DLL_GETLIGHTLOC "LFX_GetLightLocation"
#define LFX_DLL_GETLIGHTCOL "LFX_GetLightColor"
#define LFX_DLL_SETLIGHTCOL	"LFX_SetLightColor"
#define LFX_DLL_LIGHT "LFX_Light"
#define LFX_DLL_SETLIGHTACTIONCOLOR "LFX_SetLightActionColor"
#define LFX_DLL_SETLIGHTACTIONCOLOREX "LFX_SetLightActionColorEx"
#define LFX_DLL_ACTIONCOLOR "LFX_ActionColor"
#define LFX_DLL_ACTIONCOLOREX "LFX_ActionColorEx"
#define LFX_DLL_SETTIMING "LFX_SetTiming"
#define LFX_DLL_GETVERSION "LFX_GetVersion"

  // LightFX 2.0 function pointer declarations
typedef LFX_RESULT(*LFX2INITIALIZE)();
typedef LFX_RESULT(*LFX2RELEASE)();
typedef LFX_RESULT(*LFX2RESET)();
typedef LFX_RESULT(*LFX2UPDATE)();
typedef LFX_RESULT(*LFX2UPDATEDEFAULT)();
typedef LFX_RESULT(*LFX2GETNUMDEVICES)(unsigned int* const);
typedef LFX_RESULT(*LFX2GETDEVDESC)(const unsigned int, char* const, const unsigned int, unsigned char* const);
typedef LFX_RESULT(*LFX2GETNUMLIGHTS)(const unsigned int, unsigned int* const);
typedef LFX_RESULT(*LFX2GETLIGHTDESC)(const unsigned int, const unsigned int, char* const, const unsigned int);
typedef LFX_RESULT(*LFX2GETLIGHTLOC)(const unsigned int, const unsigned int, PLFX_POSITION const);
typedef LFX_RESULT(*LFX2GETLIGHTCOL)(const unsigned int, const unsigned int, PLFX_COLOR const);
typedef LFX_RESULT(*LFX2SETLIGHTCOL)(const unsigned int, const unsigned int, const PLFX_COLOR);
typedef LFX_RESULT(*LFX2LIGHT)(const unsigned int, const unsigned int);
typedef LFX_RESULT(*LFX2SETLIGHTACTIONCOLOR)(const unsigned int, const unsigned int, const unsigned int, const PLFX_COLOR);
typedef LFX_RESULT(*LFX2SETLIGHTACTIONCOLOREX)(const unsigned int, const unsigned int, const unsigned int, const PLFX_COLOR, const PLFX_COLOR);
typedef LFX_RESULT(*LFX2ACTIONCOLOR)(const unsigned int, const unsigned int, const unsigned int);
typedef LFX_RESULT(*LFX2ACTIONCOLOREX)(const unsigned int, const unsigned int, const unsigned int, const unsigned int);
typedef LFX_RESULT(*LFX2SETTIMING)(const int);
typedef LFX_RESULT(*LFX2GETVERSION)(char* const, const unsigned int);


text:
from __future__ import unicode_literals

import frappe, os
import frappe.model
from frappe.modules import scrub, get_module_path, scrub_dt_dn

def export_doc(doc):
	export_to_files([[doc.doctype, doc.name]])

def export_to_files(record_list=None, record_module=None, verbose=0, create_init=None):
	"""
		Export record_list to files. record_list is a list of lists ([doctype, docname, folder name],)  ,
	"""
	if frappe.flags.in_import:
		return

	if record_list:
		for record in record_list:
			folder_name = record[2] if len(record) == 3 else None
			write_document_file(frappe.get_doc(record[0], record[1]), record_module, create_init=create_init, folder_name=folder_name)

def write_document_file(doc, record_module=None, create_init=True, folder_name=None):
	newdoc = doc.as_dict(no_nulls=True)
	doc.run_method("before_export", newdoc)

	# strip out default fields from children
	for df in doc.meta.get_table_fields():
		for d in newdoc.get(df.fieldname):
			for fieldname in frappe.model.default_fields:
				if fieldname in d:
					del d[fieldname]

	module = record_module or get_module_name(doc)

	# create folder
	if folder_name:
		folder = create_folder(module, folder_name, doc.name, create_init)
	else:
		folder = create_folder(module, doc.doctype, doc.name, create_init)

	# write the data file
	fname = scrub(doc.name)
	with open(os.path.join(folder, fname + ".json"), 'w+') as txtfile:
		txtfile.write(frappe.as_json(newdoc))

def get_module_name(doc):
	if doc.doctype  == 'Module Def':
		module = doc.name
	elif doc.doctype=="Workflow":
		module = frappe.db.get_value("DocType", doc.document_type, "module")
	elif hasattr(doc, 'module'):
		module = doc.module
	else:
		module = frappe.db.get_value("DocType", doc.doctype, "module")

	return module

def create_folder(module, dt, dn, create_init):
	module_path = get_module_path(module)

	dt, dn = scrub_dt_dn(dt, dn)

	# create folder
	folder = os.path.join(module_path, dt, dn)

	frappe.create_folder(folder)

	# create init_py_files
	if create_init:
		create_init_py(module_path, dt, dn)

	return folder

def create_init_py(module_path, dt, dn):
	def create_if_not_exists(path):
		initpy = os.path.join(path, '__init__.py')
		if not os.path.exists(initpy):
			open(initpy, 'w').close()

	create_if_not_exists(os.path.join(module_path))
	create_if_not_exists(os.path.join(module_path, dt))
	create_if_not_exists(os.path.join(module_path, dt, dn))


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Revert.js.map


text:
define([], function () {

    function CoverageReport(converageContainer) {
        this.document = converageContainer.ownerDocument;
        converageContainer.innerHTML = this._template;

        this.coverageReport = converageContainer.querySelector('.coverageReport');
        this.summaryTable = converageContainer.querySelector('.summary');
        this.functionsTableBody = converageContainer.querySelector('.functionsSummary tbody');
        this.functionName = converageContainer.querySelector('.functionName');
        this.gutterNode = converageContainer.querySelector('.function .gutter');
        this.codeNode = converageContainer.querySelector('.function .code');

        this._onRowClickListener = this._onRowClick.bind(this);
        this.functionsTableBody.addEventListener('click', this._onRowClickListener);
    }

    CoverageReport.prototype.reset = function reset() {
        this.summaryTable.innerHTML = '';
        this.functionsTableBody.innerHTML = '';
    };

    CoverageReport.prototype.generate = function generate(coverageData) {
        this.coverageData = coverageData;

        var keys = ['statements', 'branches', 'functions'];
        var coverage = coverageUtils.summarizeCoverage(coverageData);

        this.summaryTable.innerHTML = keys.map(function (key) {
            return '
' + key.charAt(0).toUpperCase() + key.substr(1) + '	' +
                    coverage[key].covered + '/' + coverage[key].total + '	' +
                    coverage[key].pct + '%
';
        }).join('\n');

        var paths = this._convertFilesToPaths(Object.keys(coverageData));
        var pathKeys = Object.keys(paths);
        pathKeys.sort();

        this.functionsTableBody.innerHTML = pathKeys.map(function (pathKey) {
            var coverage = coverageUtils.summarizeCoverage(paths[pathKey].map(function (path) {
                return coverageData[path];
            }));

            var summaryCells = keys.map(function (key) {
                return '' + coverage[key].covered + '/' + coverage[key].total +
                        '	' + coverage[key].pct + '%	';
            }).join('');

            var spacing = pathKey.split('/').map(function () {
                return '&nbsp';
            }).join('');

            var hasParent = (pathKey.indexOf("/") >= 0);
            var dataAttribute = /^.*\.js$/.test(pathKey) ? '' : ' data-showchildren="false"';
            var style = hasParent ? ' style="display:none"' : '';
            return '
' + spacing + pathKey + '	' + summaryCells + '
';
        }).join('\n');
    };

    CoverageReport.prototype._template = '

\n' +
            '

Files	Lines / Statements	' +
            'Branches	Functions

\n' +
            '

\n' +
            '

';

    CoverageReport.prototype._onRowClick = function _onRowClick(event) {
        var node = event.target;
        while (node.getAttribute('data-path') || node.parentElement) {
            var path = node.getAttribute('data-path');
            if (path && /\.js$/.test(path)) {
                this._showFunction(path);
            } else if (path) {
                var showChildren = {};
                var visible = {};
                var i, rows = this.functionsTableBody.querySelectorAll('tr');
                for (i = 0; i < rows.length; i++) {
                    showChildren[rows[i].getAttribute('data-path')] = !(rows[i].getAttribute('data-showchildren') === 'false');
                    visible[rows[i].getAttribute('data-path')] = true;
                }

                showChildren[path] = !showChildren[path];

                Object.keys(showChildren).forEach(function (path) {
                    parent = '';
                    visible[path] = path.split(/(?=\/)/).every(function (part) {
                        var parentVisible = !parent || (visible[parent] && showChildren[parent]);
                        parent += part;
                        return parentVisible;
                    });
                });

                for (i = 0; i < rows.length; i++) {
                    path = rows[i].getAttribute('data-path');
                    var style = visible[path] ? '' : 'display:none';
                    rows[i].setAttribute('style', style);

                    if (rows[i].getAttribute('data-showchildren')) {
                        rows[i].setAttribute('data-showchildren', showChildren[path]);
                    }
                }

                return;
            }
            node = node.parentElement;
        }
    };

    CoverageReport.prototype._showFunction = function _showFunction(file) {
        var coverage = this.coverageData[file];
        var code = coverage.code;
        var lines = code.split('\n');
        var rows = new Array(lines.length);

        this.functionName.innerHTML = file;

        this.codeNode.innerHTML = '';
        var i, line;
        for (i = 0; i < lines.length; i++) {
            rows[i] = i + 1;

            line = this.document.createElement('div');
            line.appendChild(this.document.createTextNode(lines[i] || " "));
            if (coverage.l[i + 1] !== undefined) {
                line.setAttribute('class', 'covered covered' + Math.min(Math.ceil(coverage.l[i + 1] / 4), 2));
            }
            this.codeNode.appendChild(line);
        }

        this.gutterNode.innerHTML = rows.join('\n');
    };

    CoverageReport.prototype._convertFilesToPaths = function _convertFilesToPaths(files) {
        var paths = {};
        files.forEach(function (file) {
            var parts = file.split(/(?=\/)/);
            var path = '';
            parts.forEach(function (part) {
                path += part;
                if (!paths[path]) {
                    paths[path] = [];
                }
                paths[path].push(file);
            });
        });
        return paths;
    };

    return CoverageReport;
})