text:
package com.navercorp.pinpoint.common.server.bo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.navercorp.pinpoint.common.buffer.AutomaticBuffer;
import com.navercorp.pinpoint.common.buffer.Buffer;
import com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer;
import com.navercorp.pinpoint.common.util.TransactionId;
import com.navercorp.pinpoint.common.util.TransactionIdUtils;
import com.navercorp.pinpoint.thrift.dto.TAnnotation;
import com.navercorp.pinpoint.thrift.dto.TIntStringValue;
import com.navercorp.pinpoint.thrift.dto.TSpan;

/**
 * @author emeroad
 */
public class SpanBo implements Span {

    private static final int VERSION_SIZE = 1;

    // version 0 means that the type of prefix's size is int
    private byte version = 0;

//  private AgentKeyBo agentKeyBo;
    private String agentId;
    private String applicationId;
    private long agentStartTime;

    private String traceAgentId;
    private long traceAgentStartTime;
    private long traceTransactionSequence;
    private long spanId;
    private long parentSpanId;

    private long startTime;
    private int elapsed;

    private String rpc;
    private short serviceType;
    private String endPoint;
    private int apiId;

    private List<AnnotationBo> annotationBoList;
    private short flag; // optional
    private int errCode;

    private List<SpanEventBo> spanEventBoList;

    private long collectorAcceptTime;

    private boolean hasException = false;
    private int exceptionId;
    private String exceptionMessage;
    private String exceptionClass;

    private Short applicationServiceType;

    private String acceptorHost;
    private String remoteAddr; // optional

    private byte loggingTransactionInfo; //optional

    public SpanBo(TSpan span) {
        if (span == null) {
            throw new NullPointerException("span must not be null");
        }
        this.agentId = span.getAgentId();
        this.applicationId = span.getApplicationName();
        this.agentStartTime = span.getAgentStartTime();

        final TransactionId transactionId = TransactionIdUtils.parseTransactionId(span.getTransactionId());
        this.traceAgentId = transactionId.getAgentId();
        if (traceAgentId == null) {
            traceAgentId = this.agentId;
        }
        this.traceAgentStartTime = transactionId.getAgentStartTime();
        this.traceTransactionSequence = transactionId.getTransactionSequence();

        this.spanId = span.getSpanId();
        this.parentSpanId = span.getParentSpanId();

        this.startTime = span.getStartTime();
        this.elapsed = span.getElapsed();

        this.rpc = span.getRpc();

        this.serviceType = span.getServiceType();
        this.endPoint = span.getEndPoint();
        this.flag = span.getFlag();
        this.apiId = span.getApiId();

        this.errCode = span.getErr();

        this.acceptorHost = span.getAcceptorHost();
        this.remoteAddr = span.getRemoteAddr();

        this.loggingTransactionInfo = span.getLoggingTransactionInfo();

        // FIXME (2015.03) Legacy - applicationServiceType added in v1.1.0
        // applicationServiceType is not saved for older versions where applicationServiceType does not exist.
        if (span.isSetApplicationServiceType()) {
            this.applicationServiceType = span.getApplicationServiceType();
        }

        // FIXME span.errCode contains error of span and spanEvent
        // because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
        final TIntStringValue exceptionInfo = span.getExceptionInfo();
        if (exceptionInfo != null) {
            this.hasException = true;
            this.exceptionId = exceptionInfo.getIntValue();
            this.exceptionMessage = exceptionInfo.getStringValue();
        }

        this.annotationBoList = buildAnnotationList(span.getAnnotations());
    }

    public SpanBo(String traceAgentId, long traceAgentStartTime, long traceTransactionSequence, long startTime, int elapsed, long spanId) {
        if (traceAgentId == null) {
            throw new NullPointerException("traceAgentId must not be null");
        }
        this.traceAgentId = traceAgentId;
        this.traceAgentStartTime = traceAgentStartTime;
        this.traceTransactionSequence = traceTransactionSequence;

        this.startTime = startTime;
        this.elapsed = elapsed;

        this.spanId = spanId;
    }

    public SpanBo() {
    }

    public int getVersion() {
        return version & 0xFF;
    }

    public byte getRawVersion() {
        return version;
    }

    public void setVersion(int version) {
        if (version < 0 || version > 255) {
            throw new IllegalArgumentException("out of range (0~255)");
        }
        // check range
        this.version = (byte) (version & 0xFF);
    }

    public String getTransactionId() {
        return TransactionIdUtils.formatString(traceAgentId, traceAgentStartTime, traceTransactionSequence);
    }

    public String getAgentId() {
        return agentId;
    }

    public void setAgentId(String agentId) {
        this.agentId = agentId;
    }

    public String getApplicationId() {
        return applicationId;
    }

    public void setApplicationId(String applicationId) {
        this.applicationId = applicationId;
    }

    public long getAgentStartTime() {
        return agentStartTime;
    }

    public void setAgentStartTime(long agentStartTime) {
        this.agentStartTime = agentStartTime;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public int getElapsed() {
        return elapsed;
    }

    public void setElapsed(int elapsed) {
        this.elapsed = elapsed;
    }

    public String getTraceAgentId() {
        return traceAgentId;
    }

    public void setTraceAgentId(String traceAgentId) {
        this.traceAgentId = traceAgentId;
    }

    public long getTraceAgentStartTime() {
        return traceAgentStartTime;
    }

    public void setTraceAgentStartTime(long traceAgentStartTime) {
        this.traceAgentStartTime = traceAgentStartTime;
    }

    public long getTraceTransactionSequence() {
        return traceTransactionSequence;
    }

    public void setTraceTransactionSequence(long traceTransactionSequence) {
        this.traceTransactionSequence = traceTransactionSequence;
    }

    public String getRpc() {
        return rpc;
    }

    public void setRpc(String rpc) {
        this.rpc = rpc;
    }

    public long getSpanId() {
        return spanId;
    }

    public void setSpanID(long spanId) {
        this.spanId = spanId;
    }

    public long getParentSpanId() {
        return parentSpanId;
    }

    public void setParentSpanId(long parentSpanId) {
        this.parentSpanId = parentSpanId;
    }

    public short getFlag() {
        return flag;
    }

    public void setFlag(short flag) {
        this.flag = flag;
    }

    public String getEndPoint() {
        return endPoint;
    }

    public void setEndPoint(String endPoint) {
        this.endPoint = endPoint;
    }

    public int getApiId() {
        return apiId;
    }

    public void setApiId(int apiId) {
        this.apiId = apiId;
    }

    public List<AnnotationBo> getAnnotationBoList() {
        return annotationBoList;
    }

    private List<AnnotationBo> buildAnnotationList(List<TAnnotation> anoList) {
        if (anoList == null) {
            return Collections.emptyList();
        }
        List<AnnotationBo> boList = new ArrayList<>(anoList.size());
        for (TAnnotation ano : anoList) {
            final AnnotationBo annotationBo = new AnnotationBo(ano);
            boList.add(annotationBo);
        }
        return boList;
    }

    public void setAnnotationBoList(List<AnnotationBo> anoList) {
        if (anoList == null) {
            return;
        }
        this.annotationBoList = anoList;
    }

    public void addSpanEvent(SpanEventBo spanEventBo) {
        if (spanEventBoList == null) {
            spanEventBoList = new ArrayList<>();
        }
        spanEventBoList.add(spanEventBo);
    }

    public List<SpanEventBo> getSpanEventBoList() {
        return spanEventBoList;
    }

    public short getServiceType() {
        return serviceType;
    }

    public void setServiceType(short serviceType) {
        this.serviceType = serviceType;
    }

    public int getErrCode() {
        return errCode;
    }

    public void setErrCode(int errCode) {
        this.errCode = errCode;
    }

    public String getAcceptorHost() {
        return acceptorHost;
    }

    public void setAcceptorHost(String acceptorHost) {
        this.acceptorHost = acceptorHost;
    }

    public String getRemoteAddr() {
        return remoteAddr;
    }

    public void setRemoteAddr(String remoteAddr) {
        this.remoteAddr = remoteAddr;
    }

    public long getCollectorAcceptTime() {
        return collectorAcceptTime;
    }

    public void setCollectorAcceptTime(long collectorAcceptTime) {
        this.collectorAcceptTime = collectorAcceptTime;
    }

    public boolean isRoot() {
        return -1L == parentSpanId;
    }

    public boolean hasException() {
        return hasException;
    }

    public int getExceptionId() {
        return exceptionId;
    }

    public String getExceptionMessage() {
        return exceptionMessage;
    }

    public void setExceptionInfo(int exceptionId, String exceptionMessage) {
        this.hasException = true;
        this.exceptionId = exceptionId;
        this.exceptionMessage = exceptionMessage;
    }

    public String getExceptionClass() {
        return exceptionClass;
    }

    public void setExceptionClass(String exceptionClass) {
        this.exceptionClass = exceptionClass;
    }

    public void setApplicationServiceType(Short applicationServiceType) {
        this.applicationServiceType  = applicationServiceType;
    }

    public boolean hasApplicationServiceType() {
        return applicationServiceType != null;
    }

    public short getApplicationServiceType() {
        if (hasApplicationServiceType()) {
            return this.applicationServiceType;
        } else {
            return this.serviceType;
        }
    }

    public byte getLoggingTransactionInfo() {
        return loggingTransactionInfo;
    }

    // Variable encoding has been added in case of write io operation. The data size can be reduced by about 10%.
    // for test
    @Deprecated
    public byte[] writeValue() {
        /*
           It is difficult to calculate the size of buffer. It's not impossible.
           However just use automatic incremental buffer for convenience's sake.
           Consider to reuse getBufferLength when memory can be used more efficiently later.
        */
        final Buffer buffer = new AutomaticBuffer(256);

        buffer.put(version);

        buffer.putPrefixedString(agentId);

        // Using var makes the sie of time smaller based on the present time. That consumes only 6 bytes.
        buffer.putVar(agentStartTime);

        // insert for rowkey
        // buffer.put(spanID);
        buffer.put(parentSpanId);

        // use var encoding because of based on the present time
        buffer.putVar(startTime);
        buffer.putVar(elapsed);

        buffer.putPrefixedString(rpc);
        buffer.putPrefixedString(applicationId);
        buffer.put(serviceType);
        buffer.putPrefixedString(endPoint);
        buffer.putPrefixedString(remoteAddr);
        buffer.putSVar(apiId);

        // errCode value may be negative
        buffer.putSVar(errCode);

        if (hasException){
            buffer.put(true);
            buffer.putSVar(exceptionId);
            buffer.putPrefixedString(exceptionMessage);
        } else {
            buffer.put(false);
        }

        buffer.put(flag);

        if (hasApplicationServiceType()) {
            buffer.put(true);
            buffer.put(this.applicationServiceType);
        } else {
            buffer.put(false);
        }

        buffer.put(loggingTransactionInfo);

        buffer.putPrefixedString(acceptorHost);

        return buffer.getBuffer();
    }

    public void setLoggingTransactionInfo(byte loggingTransactionInfo) {
        this.loggingTransactionInfo = loggingTransactionInfo;
    }

    public int readValue(byte[] bytes, int offset) {
        final Buffer buffer = new OffsetFixedBuffer(bytes, offset);

        this.version = buffer.readByte();

        // this.mostTraceID = buffer.readLong();
        // this.leastTraceID = buffer.readLong();

        this.agentId = buffer.readPrefixedString();
        this.agentStartTime = buffer.readVarLong();

        // this.spanID = buffer.readLong();
        this.parentSpanId = buffer.readLong();

        this.startTime = buffer.readVarLong();
        this.elapsed = buffer.readVarInt();

        this.rpc = buffer.readPrefixedString();
        this.applicationId = buffer.readPrefixedString();
        this.serviceType = buffer.readShort();
        this.endPoint = buffer.readPrefixedString();
        this.remoteAddr = buffer.readPrefixedString();
        this.apiId = buffer.readSVarInt();

        this.errCode = buffer.readSVarInt();

        this.hasException = buffer.readBoolean();
        if (hasException) {
            this.exceptionId = buffer.readSVarInt();
            this.exceptionMessage = buffer.readPrefixedString();
        }

        this.flag = buffer.readShort();

        // FIXME (2015.03) Legacy - applicationServiceType added in v1.1.0
        // Defaults to span's service type for older versions where applicationServiceType does not exist.
        if (buffer.limit() > 0) {
            final boolean hasApplicationServiceType = buffer.readBoolean();
            if (hasApplicationServiceType) {
                this.applicationServiceType = buffer.readShort();
            }
        }

        if (buffer.limit() > 0) {
            this.loggingTransactionInfo = buffer.readByte();
        }

        if (buffer.limit() > 0) {
            this.acceptorHost = buffer.readPrefixedString();
        }

        return buffer.getOffset();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder(256);
        sb.append("SpanBo{");
        sb.append("version=").append(version);
        sb.append(", agentId='").append(agentId).append('\'');
        sb.append(", applicationId='").append(applicationId).append('\'');
        sb.append(", agentStartTime=").append(agentStartTime);
        sb.append(", traceAgentId='").append(traceAgentId).append('\'');
        sb.append(", traceAgentStartTime=").append(traceAgentStartTime);
        sb.append(", traceTransactionSequence=").append(traceTransactionSequence);
        sb.append(", spanId=").append(spanId);
        sb.append(", parentSpanId=").append(parentSpanId);
        sb.append(", startTime=").append(startTime);
        sb.append(", elapsed=").append(elapsed);
        sb.append(", rpc='").append(rpc).append('\'');
        sb.append(", serviceType=").append(serviceType);
        sb.append(", acceptorHost=").append(acceptorHost);
        sb.append(", endPoint='").append(endPoint).append('\'');
        sb.append(", apiId=").append(apiId);
        sb.append(", annotationBoList=").append(annotationBoList);
        sb.append(", flag=").append(flag);
        sb.append(", errCode=").append(errCode);
        sb.append(", spanEventBoList=").append(spanEventBoList);
        sb.append(", collectorAcceptTime=").append(collectorAcceptTime);
        sb.append(", hasException=").append(hasException);
        sb.append(", exceptionId=").append(exceptionId);
        sb.append(", exceptionMessage='").append(exceptionMessage).append('\'');
        sb.append(", remoteAddr='").append(remoteAddr).append('\'');
        sb.append(", applicationServiceType=").append(applicationServiceType);
        sb.append('}');
        return sb.toString();
    }
}


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

<TITLE>
JpfException
</TITLE>

<META NAME="keywords" CONTENT="org.java.plugin.JpfException class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

JPF 1.5.1

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.java.plugin

Class JpfException

java.lang.Object
  java.lang.Throwable
      java.lang.Exception
          org.java.plugin.JpfException

All Implemented Interfaces:
java.io.Serializable

Direct Known Subclasses:
ManifestProcessingException, PluginLifecycleException

public abstract class JpfException
extends java.lang.Exception

Base JPF exception class that supports localized error messages.

Version:

$Id$

See Also:
Serialized Form

Constructor Summary

protected
JpfException(java.lang.String aPackageName,
             java.lang.String aMessageKey,
             java.lang.Object aData,
             java.lang.Throwable cause)

Method Summary

 java.lang.String
getMessage(java.util.Locale locale)

Methods inherited from class java.lang.Throwable

fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

JpfException

protected JpfException(java.lang.String aPackageName,
                       java.lang.String aMessageKey,
                       java.lang.Object aData,
                       java.lang.Throwable cause)

Method Detail

getMessage

public java.lang.String getMessage(java.util.Locale locale)

Parameters:
locale - locale

Returns:
error message for the given locale

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

JPF 1.5.1

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2007 Dmitry Olshansky. All Rights Reserved.

redpajama_set_name: RedPajamaGithub


text:
#ifndef U_SKIN_H
#define U_SKIN_H

#include "ulib.h"

enum tagSkinButtonStyle
{
    SKBS_NONE   = 0x0000,
    SKBS_SKINED = 0x0001
};

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

ULIB_API BOOL  __stdcall IStart( HINSTANCE hModule, DWORD dwThreadID );
ULIB_API BOOL  __stdcall IStop( void );

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif

#endif


text:
package mx.bigdata.sat.cfdi.examples;

import mx.bigdata.sat.cfdi.v33.schema.*;
import mx.bigdata.sat.cfdi.v33.schema.Comprobante.*;
import mx.bigdata.sat.cfdi.v33.schema.Comprobante.Conceptos.Concepto;
import mx.bigdata.sat.cfdi.v33.schema.Comprobante.Impuestos.Traslados;
import mx.bigdata.sat.cfdi.v33.schema.Comprobante.Impuestos.Traslados.Traslado;

import java.math.BigDecimal;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

public final class ExampleCFDv33Factory {

  public static Comprobante createComprobante() throws Exception {
    ObjectFactory of = new ObjectFactory();
    Comprobante comp = of.createComprobante();
    comp.setVersion("3.3");
    comp.setMoneda(CMoneda.MXN);
    Date date = new GregorianCalendar(2017, 1, 6, 20, 38, 12).getTime();
    comp.setFecha(date);
    comp.setFormaPago("01");
    comp.setSubTotal(new BigDecimal("466.43"));
    comp.setTotal(new BigDecimal("488.50"));
    comp.setTipoDeComprobante(CTipoDeComprobante.I);
    comp.setMetodoPago(CMetodoPago.PUE);
    comp.setLugarExpedicion("45079");
    comp.setEmisor(createEmisor(of));
    comp.setReceptor(createReceptor(of));
    comp.setConceptos(createConceptos(of));
    comp.setImpuestos(createImpuestos(of));
    comp.setComplemento(createComplemento(of));
    return comp;
  }

  private static Complemento createComplemento(ObjectFactory of){
	  Complemento complemento = new Complemento();

	  return complemento;
  }

  private static Emisor createEmisor(ObjectFactory of) {
    Emisor emisor = of.createComprobanteEmisor();
    emisor.setNombre("PHARMA PLUS SA DE CV");
    emisor.setRfc("PPL961114GZ1");
    emisor.setRegimenFiscal("601");
    return emisor;
  }

  private static Receptor createReceptor(ObjectFactory of) {
    Receptor receptor = of.createComprobanteReceptor();
    receptor.setNombre("JUAN PEREZ PEREZ");
    receptor.setRfc("PEPJ8001019Q8");
    receptor.setResidenciaFiscal(CPais.MEX);
    receptor.setUsoCFDI(CUsoCFDI.D_01);
    return receptor;
  }

  private static Conceptos createConceptos(ObjectFactory of) {
    Conceptos cps = of.createComprobanteConceptos();
    List<Concepto> list = cps.getConcepto();
    Concepto c1 = of.createComprobanteConceptosConcepto();
    c1.setClaveProdServ("01010101");
    c1.setClaveUnidad("F52");
    c1.setUnidad("CAPSULAS");
    c1.setImporte(new BigDecimal("244.00"));
    c1.setCantidad(new BigDecimal("1.0"));
    c1.setDescripcion("VIBRAMICINA 100MG 10");
    c1.setValorUnitario(new BigDecimal("244.00"));
    list.add(c1);
    Concepto c2 = of.createComprobanteConceptosConcepto();
    c2.setClaveProdServ("01010101");
    c2.setClaveUnidad("F52");
    c2.setUnidad("BOTELLA");
    c2.setImporte(new BigDecimal("137.93"));
    c2.setCantidad(new BigDecimal("1.0"));
    c2.setDescripcion("CLORUTO 500M");
    c2.setValorUnitario(new BigDecimal("137.93"));
    list.add(c2);
    Concepto c3 = of.createComprobanteConceptosConcepto();
    c3.setClaveProdServ("01010101");
    c3.setUnidad("TABLETAS");
    c3.setClaveUnidad("F52");
    c3.setImporte(new BigDecimal("84.50"));
    c3.setCantidad(new BigDecimal("1.0"));
    c3.setDescripcion("SEDEPRON 250MG 10");
    c3.setValorUnitario(new BigDecimal("84.50"));
    list.add(c3);
    return cps;
  }

  private static Impuestos createImpuestos(ObjectFactory of) {
    Impuestos imps = of.createComprobanteImpuestos();

    Traslados trs = of.createComprobanteImpuestosTraslados();
    List<Traslado> list = trs.getTraslado();

    Traslado t1 = of.createComprobanteImpuestosTrasladosTraslado();
    t1.setImporte(new BigDecimal("36"));
    t1.setImpuesto("001");
    t1.setTasaOCuota("0.160000");
    t1.setTipoFactor(CTipoFactor.TASA);
    list.add(t1);

    Traslado t2 = of.createComprobanteImpuestosTrasladosTraslado();
    t2.setImporte(new BigDecimal("22.07"));
    t2.setImpuesto("002");
    t2.setTasaOCuota("0.160000");
    t2.setTipoFactor(CTipoFactor.TASA);
    list.add(t2);

    imps.setTraslados(trs);

    return imps;
  }
}


text:
require('/shared/js/async_storage.js');

suite('asyncStorage', function() {
  test('API', function() {
    assert.typeOf(asyncStorage.length, 'function');
    assert.typeOf(asyncStorage.key, 'function');
    assert.typeOf(asyncStorage.getItem, 'function');
    assert.typeOf(asyncStorage.setItem, 'function');
    assert.typeOf(asyncStorage.removeItem, 'function');
    assert.typeOf(asyncStorage.clear, 'function');
  });

  test('set, get, overwrite, get, remove, get', function(done) {
    // test basic set and get
    asyncStorage.setItem('foo', 'bar', function() {
      asyncStorage.getItem('foo', function(value) {
        assert.equal(value, 'bar');

        // now test overwrite and get
        asyncStorage.setItem('foo', 'overwritten', function() {
          asyncStorage.getItem('foo', function(value) {
            assert.equal(value, 'overwritten');

            // now test remove and get
            asyncStorage.removeItem('foo', function() {
              asyncStorage.getItem('foo', function(value) {
                assert.equal(value, null);
                done();
              });
            });
          });
        });
      });
    });
  });

  test('set and get object values', function(done) {
    var object = {
      x: 1,
      y: 'foo',
      z: true
    };

    function next() {
      generator.next();
    }

    var generator = (function() {
      yield asyncStorage.setItem('myobj', object, next);

      yield asyncStorage.getItem('myobj', function(value) {
        assert.equal(object.x, value.x);
        assert.equal(object.y, value.y);
        assert.equal(object.z, value.z);
        next();
      });

      yield asyncStorage.removeItem('myobj', next);

      yield asyncStorage.getItem('myobj', function(value) {
        assert.equal(value, null);
        done();
      });
    }());
    next();
  });

  test('clear, length, key', function(done) {
    asyncStorage.clear(function() {
      asyncStorage.length(function(len) {
        // length should be 0 after clearing
        assert.equal(len, 0);
        asyncStorage.setItem('key1', 'value1', function() {
          asyncStorage.length(function(len) {
            assert.equal(len, 1);
            asyncStorage.setItem('key2', 'value2', function() {
              asyncStorage.length(function(len) {
                assert.equal(len, 2);
                asyncStorage.setItem('key3', 'value3', function() {
                  asyncStorage.length(function(len) {
                    assert.equal(len, 3);
                    asyncStorage.key(0, function(key) {
                      assert.equal(key, 'key1');
                      asyncStorage.key(1, function(key) {
                        assert.equal(key, 'key2');
                        asyncStorage.key(2, function(key) {
                          assert.equal(key, 'key3');
                          asyncStorage.key(3, function(key) {
                            assert.equal(key, null);
                            asyncStorage.clear(function() {
                              asyncStorage.key(0, function(key) {
                                assert.equal(key, null);
                                asyncStorage.length(function(len) {
                                  assert.equal(len, 0);
                                  done();
                                });
                              });
                            });
                          });
                        });
                      });
                    });
                  });
                });
              });
            });
          });
        });
      });
    });
  });
});


text:
<Alloy>
	<Collection src="heroes"/>
	<NavigationWindow>
		<Window title="data switches">
			<RightNavButton>
				<Button title="toggle" onClick="toggleState"/>
			</RightNavButton>
			<TableView id="table" dataCollection="heroes" top="20">
				<TableViewRow>
					<Label text="{name}"></Label>
					<Switch value="{status}"></Switch>
				</TableViewRow>
			</TableView>
		</Window>
	</NavigationWindow>
</Alloy>


text:
use strict;
use Data::Dumper;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Funcgen::DBSQL::DBAdaptor;
use Getopt::Long;

$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Maxdepth = 3;

=head1

  Script to check probe features. For probe features that are perfect matches
  it checks that the genome sequence they are on is identical to the probe
  sequence.

  check_probe_feature_sequences.pl \
    --registry /homes/mnuhn/work_dir_probemapping/lib/ensembl-funcgen/registry.pm \
    --species saccharomyces_cerevisiae \
    --logic_name ProbeAlign_transcript \
    --check_probe_features_with_nontrivial_cigar_lines 1 \
    --max_check 10000

=cut

my $registry;
my $species;
my $max_check;
my $logic_name;
my $check_probe_features_with_nontrivial_cigar_lines;

GetOptions (
   'registry=s'   => \$registry,
   'species=s'    => \$species,
   'max_check=s'  => \$max_check,
   'logic_name=s' => \$logic_name,
   'check_probe_features_with_nontrivial_cigar_lines=s' => \$check_probe_features_with_nontrivial_cigar_lines,
);

Bio::EnsEMBL::Registry->load_all($registry);

my $funcgen_adaptor       = Bio::EnsEMBL::Registry->get_DBAdaptor( $species, 'Funcgen' );
my $probe_feature_adaptor = Bio::EnsEMBL::Registry->get_adaptor( $species, 'Funcgen', 'ProbeFeature' );

use Bio::EnsEMBL::Utils::SqlHelper;
my $helper = Bio::EnsEMBL::Utils::SqlHelper->new(
  -DB_CONNECTION => $funcgen_adaptor->dbc
);

my $total_checked = 0;
my $total_failed  = 0;
my $total_probe_features_considered = 0;

my $limit_clause = '';
if ($max_check) {
  $limit_clause = "limit $max_check";
}

my @condition;

if ($logic_name) {
  push @condition, "logic_name = \"$logic_name\"";
}

if ($check_probe_features_with_nontrivial_cigar_lines) {
  push @condition, "cigar_line like '%D%'";
} else {
  push @condition, "cigar_line not like '%D%'";
}

my $where_clause = 'where ' . join ' and ', @condition;

my $sql = "select probe_feature_id from probe_feature join analysis using (analysis_id) $where_clause $limit_clause";

print "$sql\n";

$helper->execute_no_return(
  -SQL      => $sql,
  -CALLBACK => sub {
    my $row = shift;
    my $probe_feature_id = $row->[0];
    print check_probe_feature_with_id($probe_feature_id);
    return;
  },
);

my $msg = <<MESSAGE

total_probe_features_considered = $total_probe_features_considered

total_checked = $total_checked
total_failed  = $total_failed

MESSAGE
;

if ($total_failed>0) {
  die($msg);
}
print $msg;

sub check_probe_feature_with_id {

  my $probe_feature_id = shift;
  my $probe_feature = $probe_feature_adaptor->fetch_by_dbID($probe_feature_id);
  return check_probe_feature_and_update_stats($probe_feature);
}

sub check_probe_feature_and_update_stats {

  my $probe_feature = shift;

  $total_probe_features_considered++;
  (
    my $has_passed,
    my $message,
  ) = check_probe_feature($probe_feature);
  $total_checked++;

  if (! $has_passed) {
    $total_failed++;
    return $message;
  }
  return undef;
}

sub check_probe_feature {

  my $probe_feature = shift;

  my $parsed_cigar_string;
  eval {
    $parsed_cigar_string = parse_cigar_string($probe_feature->cigar_string);
  };
  if ($@) {
    die "Can't parse cigar string ". $probe_feature->cigar_string . " of probe feature with id: " . $probe_feature->dbID . "!\n";
  }

#   print Dumper($parsed_cigar_string);

  my $probe_feature_slice  = $probe_feature->slice;
  my $probe_feature_start  = $probe_feature->start;
  my $probe_feature_strand = $probe_feature->strand;

  my @matched_sequence_parts;

  ALIGNMENT_PART: foreach my $current_alignment_part (@$parsed_cigar_string) {

    my $is_a_match_region = $current_alignment_part->{type} eq '=';

    if (! $is_a_match_region) {
      next ALIGNMENT_PART;
    }

    my $matched_sequence_part = $probe_feature_slice->subseq(
      $probe_feature_start + $current_alignment_part->{start_on_alignment},
      $probe_feature_start + $current_alignment_part->{end_on_alignment},
      $probe_feature_strand,
    );
    push @matched_sequence_parts, $matched_sequence_part;
  }

  if ($probe_feature_strand == -1) {
    @matched_sequence_parts = reverse @matched_sequence_parts;
  }

  my $matched_sequence = join '', @matched_sequence_parts;

  my $probe_sequence = $probe_feature->probe->get_ProbeSequence->sequence;

  my $has_passed = uc($matched_sequence) eq uc($probe_sequence);

  my $summarise_test = 0;

  my $must_build_summary = $summarise_test || !$has_passed;

  my $summary;
  if ($must_build_summary) {
    $summary =
        "Has passed: $has_passed\n"
      . "probe_feature = " . Dumper($probe_feature)
      . "Cigar string:" . $probe_feature->cigar_string . "\n"
      . "Sequence in genome: " . (join '..', @matched_sequence_parts) . "\n"
      . "Probe sequence:     $probe_sequence\n"
      . "Probe hit_id:". $probe_feature->hit_id. " \n";
  }

  if ($summarise_test) {
    print "--------------------------------------------------------------------\n";
    print "$summary";
  }
  return $has_passed, $summary;
}

sub parse_cigar_string {
  my $cigar_string = shift;

  my $parsed_cigar_lines = parse_cigar_string_generic($cigar_string);

  my $start_on_alignment = 0;
  my $end_on_alignment   = 0;

  foreach my $current_parsed_cigar_line (@$parsed_cigar_lines) {

    my $length = $current_parsed_cigar_line->{length};

    $end_on_alignment += $length;

    $current_parsed_cigar_line->{start_on_alignment} = $start_on_alignment;
    $current_parsed_cigar_line->{end_on_alignment}   = -1 + $end_on_alignment;

    use Hash::Util qw( lock_hash );
    lock_hash(%$current_parsed_cigar_line);

    $start_on_alignment += $length;
  }
  return $parsed_cigar_lines;
}

sub parse_cigar_string_generic {

  my $cigar_string = shift;

  my @x = $cigar_string =~ /(\d+)(\D)/g;
  # $VAR1 = [
  #   '14',
  #   '=',
  #   '669',
  #   'D',
  #   '35',
  #   '=',
  #   '181',
  #   'D',
  #   '1',
  #   '='
  # ];

  use List::MoreUtils qw( natatime );
  my @parsed_cigar_line;

  my $iterator = natatime 2, @x;
  while (my @pair = $iterator->()) {

    my $length = $pair[0];
    my $type   = $pair[1];

    push @parsed_cigar_line, {
      length => $length,
      type   => $type,
    };
  }
  return \@parsed_cigar_line;
}


text:
/*
 * Copyright 2008, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
        if (c == -1) {
            break;
        }
        switch (c) {
            case 0:
                break;


text:
<?php

namespace Dotenv;

use Dotenv\Environment\FactoryInterface;
use Dotenv\Exception\InvalidPathException;
use Dotenv\Regex\Regex;
use PhpOption\Option;

/**
 * This is the loader class.
 *
 * It's responsible for loading variables by reading a file from disk and:
 * - stripping comments beginning with a `#`,
 * - parsing lines that look shell variable setters, e.g `export key = value`, `key="value"`.
 * - multiline variable look always start with a " and end with it, e.g: `key="value
 *                                                                             value"`
 */
class Loader
{
    /**
     * The file paths.
     *
     * @var string[]
     */
    protected $filePaths;

    /**
     * The environment factory instance.
     *
     * @var \Dotenv\Environment\FactoryInterface
     */
    protected $envFactory;

    /**
     * The environment variables instance.
     *
     * @var \Dotenv\Environment\VariablesInterface
     */
    protected $envVariables;

    /**
     * The list of environment variables declared inside the 'env' file.
     *
     * @var string[]
     */
    protected $variableNames = [];

    /**
     * Create a new loader instance.
     *
     * @param string[]                             $filePaths
     * @param \Dotenv\Environment\FactoryInterface $envFactory
     * @param bool                                 $immutable
     *
     * @return void
     */
    public function __construct(array $filePaths, FactoryInterface $envFactory, $immutable = false)
    {
        $this->filePaths = $filePaths;
        $this->envFactory = $envFactory;
        $this->setImmutable($immutable);
    }

    /**
     * Set immutable value.
     *
     * @param bool $immutable
     *
     * @return $this
     */
    public function setImmutable($immutable = false)
    {
        $this->envVariables = $immutable
            ? $this->envFactory->createImmutable()
            : $this->envFactory->create();

        return $this;
    }

    /**
     * Load the environment file from disk.
     *
     * @throws \Dotenv\Exception\InvalidPathException|\Dotenv\Exception\InvalidFileException
     *
     * @return array<string|null>
     */
    public function load()
    {
        return $this->loadDirect(
            self::findAndRead($this->filePaths)
        );
    }

    /**
     * Directly load the given string.
     *
     * @param string $content
     *
     * @throws \Dotenv\Exception\InvalidFileException
     *
     * @return array<string|null>
     */
    public function loadDirect($content)
    {
        return $this->processEntries(
            Lines::process(preg_split("/(\r\n|\n|\r)/", $content))
        );
    }

    /**
     * Attempt to read the files in order.
     *
     * @param string[] $filePaths
     *
     * @throws \Dotenv\Exception\InvalidPathException
     *
     * @return string[]
     */
    private static function findAndRead(array $filePaths)
    {
        if ($filePaths === []) {
            throw new InvalidPathException('At least one environment file path must be provided.');
        }

        foreach ($filePaths as $filePath) {
            $lines = self::readFromFile($filePath);
            if ($lines->isDefined()) {
                return $lines->get();
            }
        }

        throw new InvalidPathException(
            sprintf('Unable to read any of the environment file(s) at [%s].', implode(', ', $filePaths))
        );
    }

    /**
     * Read the given file.
     *
     * @param string $filePath
     *
     * @return \PhpOption\Option
     */
    private static function readFromFile($filePath)
    {
        $content = @file_get_contents($filePath);

        return Option::fromValue($content, false);
    }

    /**
     * Process the environment variable entries.
     *
     * We'll fill out any nested variables, and acually set the variable using
     * the underlying environment variables instance.
     *
     * @param string[] $entries
     *
     * @throws \Dotenv\Exception\InvalidFileException
     *
     * @return array<string|null>
     */
    private function processEntries(array $entries)
    {
        $vars = [];

        foreach ($entries as $entry) {
            list($name, $value) = Parser::parse($entry);
            $vars[$name] = $this->resolveNestedVariables($value);
            $this->setEnvironmentVariable($name, $vars[$name]);
        }

        return $vars;
    }

    /**
     * Resolve the nested variables.
     *
     * Look for ${varname} patterns in the variable value and replace with an
     * existing environment variable.
     *
     * @param string|null $value
     *
     * @return string|null
     */
    private function resolveNestedVariables($value = null)
    {
        return Option::fromValue($value)
            ->filter(function ($str) {
                return strpos($str, '$') !== false;
            })
            ->flatMap(function ($str) {
                return Regex::replaceCallback(
                    '/\${([a-zA-Z0-9_.]+)}/',
                    function (array $matches) {
                        return Option::fromValue($this->getEnvironmentVariable($matches[1]))
                            ->getOrElse($matches[0]);
                    },
                    $str
                )->success();
            })
            ->getOrElse($value);
    }

    /**
     * Search the different places for environment variables and return first value found.
     *
     * @param string $name
     *
     * @return string|null
     */
    public function getEnvironmentVariable($name)
    {
        return $this->envVariables->get($name);
    }

    /**
     * Set an environment variable.
     *
     * @param string      $name
     * @param string|null $value
     *
     * @return void
     */
    public function setEnvironmentVariable($name, $value = null)
    {
        $this->variableNames[] = $name;
        $this->envVariables->set($name, $value);
    }

    /**
     * Clear an environment variable.
     *
     * This method only expects names in normal form.
     *
     * @param string $name
     *
     * @return void
     */
    public function clearEnvironmentVariable($name)
    {
        $this->envVariables->clear($name);
    }

    /**
     * Get the list of environment variables names.
     *
     * @return string[]
     */
    public function getEnvironmentVariableNames()
    {
        return $this->variableNames;
    }
}


text:
package com.kimfy.notenoughblocks.common.file.json;

public class Category
{
    private BlockJson block;

    public Category(BlockJson block)
    {
        this.block = block;
    }

    int getMaxBlocks()
    {
        return block.getShape().getMaxSubBlocks();
    }

    @Override
    public String toString()
    {
        return block.toString();
    }
}


text:
from micropython import const
import time, machine, bluetooth

TIMEOUT_MS = 5000

_IRQ_CENTRAL_CONNECT = const(1 << 0)
_IRQ_CENTRAL_DISCONNECT = const(1 << 1)
_IRQ_GATTS_WRITE = const(1 << 2)
_IRQ_PERIPHERAL_CONNECT = const(1 << 6)
_IRQ_PERIPHERAL_DISCONNECT = const(1 << 7)
_IRQ_GATTC_SERVICE_RESULT = const(1 << 8)
_IRQ_GATTC_CHARACTERISTIC_RESULT = const(1 << 9)
_IRQ_GATTC_READ_RESULT = const(1 << 11)
_IRQ_GATTC_WRITE_STATUS = const(1 << 12)
_IRQ_GATTC_NOTIFY = const(1 << 13)

SERVICE_UUID = bluetooth.UUID("A5A5A5A5-FFFF-9999-1111-5A5A5A5A5A5A")
CHAR_UUID = bluetooth.UUID("00000000-1111-2222-3333-444444444444")
CHAR = (
    CHAR_UUID,
    bluetooth.FLAG_READ | bluetooth.FLAG_WRITE | bluetooth.FLAG_NOTIFY,
)
SERVICE = (
    SERVICE_UUID,
    (CHAR,),
)
SERVICES = (SERVICE,)

last_event = None
last_data = None
value_handle = 0

def irq(event, data):
    global last_event, last_data, value_handle
    last_event = event
    last_data = data
    if event == _IRQ_CENTRAL_CONNECT:
        print("_IRQ_CENTRAL_CONNECT")
    elif event == _IRQ_CENTRAL_DISCONNECT:
        print("_IRQ_CENTRAL_DISCONNECT")
    elif event == _IRQ_GATTS_WRITE:
        print("_IRQ_GATTS_WRITE", ble.gatts_read(data[-1]))
    elif event == _IRQ_PERIPHERAL_CONNECT:
        print("_IRQ_PERIPHERAL_CONNECT")
    elif event == _IRQ_PERIPHERAL_DISCONNECT:
        print("_IRQ_PERIPHERAL_DISCONNECT")
    elif event == _IRQ_GATTC_CHARACTERISTIC_RESULT:
        # conn_handle, def_handle, value_handle, properties, uuid = data
        if data[-1] == CHAR_UUID:
            print("_IRQ_GATTC_SERVICE_RESULT", data[-1])
            value_handle = data[2]
    elif event == _IRQ_GATTC_READ_RESULT:
        print("_IRQ_GATTC_READ_RESULT", data[-1])
    elif event == _IRQ_GATTC_WRITE_STATUS:
        print("_IRQ_GATTC_WRITE_STATUS", data[-1])
    elif event == _IRQ_GATTC_NOTIFY:
        print("_IRQ_GATTC_NOTIFY", data[-1])

def wait_for_event(event, timeout_ms):
    t0 = time.ticks_ms()
    while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
        if isinstance(event, int):
            if last_event == event:
                break
        elif event():
            break
        machine.idle()

# Acting in peripheral role.
def instance0():
    multitest.globals(BDADDR=ble.config("mac"))
    ((char_handle,),) = ble.gatts_register_services(SERVICES)
    print("gap_advertise")
    ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
    multitest.next()
    try:
        # Write initial characteristic value.
        ble.gatts_write(char_handle, "periph0")

        # Wait for central to connect to us.
        wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
        if last_event != _IRQ_CENTRAL_CONNECT:
            return
        conn_handle, _, _ = last_data

        # Wait for a write to the characteristic from the central.
        wait_for_event(_IRQ_GATTS_WRITE, TIMEOUT_MS)

        # Wait a bit, then write the characteristic and notify it.
        time.sleep_ms(1000)
        ble.gatts_write(char_handle, "periph1")
        ble.gatts_notify(conn_handle, char_handle)

        # Wait for a write to the characteristic from the central.
        wait_for_event(_IRQ_GATTS_WRITE, TIMEOUT_MS)

        # Wait a bit, then notify a new value on the characteristic.
        time.sleep_ms(1000)
        ble.gatts_notify(conn_handle, char_handle, "periph2")

        # Wait for the central to disconnect.
        wait_for_event(_IRQ_CENTRAL_DISCONNECT, TIMEOUT_MS)
    finally:
        ble.active(0)

# Acting in central role.
def instance1():
    multitest.next()
    try:
        # Connect to peripheral and then disconnect.
        print("gap_connect")
        ble.gap_connect(0, BDADDR)
        wait_for_event(_IRQ_PERIPHERAL_CONNECT, TIMEOUT_MS)
        if last_event != _IRQ_PERIPHERAL_CONNECT:
            return
        conn_handle, _, _ = last_data

        # Discover characteristics.
        ble.gattc_discover_characteristics(conn_handle, 1, 65535)
        wait_for_event(lambda: value_handle, TIMEOUT_MS)

        # Issue read of characteristic, should get initial value.
        print("gattc_read")
        ble.gattc_read(conn_handle, value_handle)
        wait_for_event(_IRQ_GATTC_READ_RESULT, TIMEOUT_MS)

        # Write to the characteristic, and ask for a response.
        print("gattc_write")
        ble.gattc_write(conn_handle, value_handle, "central0", 1)
        wait_for_event(_IRQ_GATTC_WRITE_STATUS, TIMEOUT_MS)

        # Wait for a notify, then read new value.
        wait_for_event(_IRQ_GATTC_NOTIFY, TIMEOUT_MS)
        print("gattc_read")
        ble.gattc_read(conn_handle, value_handle)
        wait_for_event(_IRQ_GATTC_READ_RESULT, TIMEOUT_MS)

        # Write to the characteristic, and ask for a response.
        print("gattc_write")
        ble.gattc_write(conn_handle, value_handle, "central1", 1)
        wait_for_event(_IRQ_GATTC_WRITE_STATUS, TIMEOUT_MS)

        # Wait for a notify (should have new data), then read old value (should be unchanged).
        wait_for_event(_IRQ_GATTC_NOTIFY, TIMEOUT_MS)
        print("gattc_read")
        ble.gattc_read(conn_handle, value_handle)
        wait_for_event(_IRQ_GATTC_READ_RESULT, TIMEOUT_MS)

        # Disconnect from peripheral.
        print("gap_disconnect:", ble.gap_disconnect(conn_handle))
        wait_for_event(_IRQ_PERIPHERAL_DISCONNECT, TIMEOUT_MS)
    finally:
        ble.active(0)

ble = bluetooth.BLE()
ble.active(1)
ble.irq(irq)


text:
package de.tum.in.niedermr.ta.core.code.identifier;

import java.util.Objects;

import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;

import de.tum.in.niedermr.ta.core.code.constants.JavaConstants;
import de.tum.in.niedermr.ta.core.code.util.Identification;

/** Identifier for Java methods. */
public final class MethodIdentifier implements Identifier {
	private static final String UNKNOWN_RETURN_TYPE = "?";
	public static final MethodIdentifier EMPTY = new MethodIdentifier("*", UNKNOWN_RETURN_TYPE);

	private final String m_identifier;
	private final String m_returnType;

	/** Constructor. */
	private MethodIdentifier(String identifier, String returnType) {
		this.m_identifier = Objects.requireNonNull(identifier);
		this.m_returnType = returnType;
	}

	/**
	 * Create an identifier.
	 *
	 * @param cls
	 *            class instance
	 * @param methodNode
	 *            ASM method node
	 */
	public static MethodIdentifier create(Class<?> cls, MethodNode methodNode) {
		return create(cls.getName(), methodNode);
	}

	/**
	 * Create an identifier.
	 *
	 * @param classNode
	 *            ASM class node
	 * @param methodNode
	 *            ASM method node
	 */
	public static MethodIdentifier create(ClassNode classNode, MethodNode methodNode) {
		return create(classNode.name, methodNode);
	}

	/**
	 * Create an identifier.
	 *
	 * @param className
	 *            class name (dot separator) or class path (slash separator)
	 * @param methodNode
	 *            ASM method node
	 */
	public static MethodIdentifier create(String className, MethodNode methodNode) {
		return create(className, methodNode.name, methodNode.desc);
	}

	/**
	 * Create an identifier.
	 *
	 * @param cls
	 *            class instance
	 * @param methodName
	 *            name of the method
	 * @param methodDesc
	 *            descriptor of the method
	 */
	public static MethodIdentifier create(Class<?> cls, String methodName, String methodDesc) {
		return create(cls.getName(), methodName, methodDesc);
	}

	/**
	 * @param className
	 *            either with dots or slashes
	 */
	public static MethodIdentifier create(String className, String methodName, String methodDesc) {
		String identifier = Identification.asClassName(className) + JavaConstants.CLASS_METHOD_SEPARATOR + methodName
				+ convertDescriptor(methodDesc);
		String returnType = Identification.getMethodReturnType(methodDesc);

		return new MethodIdentifier(identifier, returnType);
	}

	public static MethodIdentifier parse(String methodIdentifier) {
		String[] values = methodIdentifier.split(JavaConstants.RETURN_TYPE_SEPARATOR);
		String returnType = UNKNOWN_RETURN_TYPE;

		if (values.length > 1) {
			returnType = values[1];
		}

		return new MethodIdentifier(values[0], returnType);
	}

	/** {@inheritDoc} */
	@Override
	public final String get() {
		return m_identifier;
	}

	/**
	 * @see #getOnlyReturnType()
	 */
	public final String getWithReturnType() {
		return get() + JavaConstants.RETURN_TYPE_SEPARATOR + getOnlyReturnType();
	}

	/**
	 * The return type would be available if the instance was created using the 'create' method or if the string to be
	 * parsed by the 'parse' method contained the return type. Otherwise {@link #UNKNOWN_RETURN_TYPE} will be returned.
	 */
	public final String getOnlyReturnType() {
		return m_returnType;
	}

	public final String getOnlyClassName() {
		String s = get();

		try {
			// cut the arguments
			s = s.substring(0, s.indexOf(JavaConstants.ARGUMENTS_BEGIN));

			// cut the method name
			s = s.substring(0, s.lastIndexOf(JavaConstants.CLASS_METHOD_SEPARATOR));
		} catch (IndexOutOfBoundsException ex) {
			throw new IllegalStateException("Method identifier is invalid: " + get());
		}

		return s;
	}

	public final String getOnlyMethodName() {
		String s = get();

		try {
			// cut the arguments
			s = s.substring(0, s.indexOf(JavaConstants.ARGUMENTS_BEGIN));

			// cut the method name
			s = s.substring(s.lastIndexOf(JavaConstants.CLASS_METHOD_SEPARATOR) + 1);
		} catch (IndexOutOfBoundsException ex) {
			throw new IllegalStateException("Method identifier is invalid: " + get());
		}

		return s;
	}

	/** {@inheritDoc} */
	@Override
	public int hashCode() {
		return m_identifier.hashCode();
	}

	/**
	 * Two method identifiers are supposed to be equal if the identifiers are equal. The return type is not considered.
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof MethodIdentifier) {
			return Objects.equals(this.m_identifier, ((MethodIdentifier) obj).m_identifier);
		}

		return false;
	}

	private static String convertDescriptor(String descriptor) {
		Type type = Type.getType(descriptor);

		StringBuilder builder = new StringBuilder();

		for (Type argument : type.getArgumentTypes()) {
			builder.append(JavaConstants.ARGUMENTS_SEPARATOR);
			builder.append(argument.getClassName());
		}

		String arguments = builder.toString();

		if (!arguments.isEmpty()) {
			arguments = arguments.substring(1);
		}

		return JavaConstants.ARGUMENTS_BEGIN + arguments + JavaConstants.ARGUMENTS_END;
	}

	/** {@inheritDoc} */
	@Override
	public String toString() {
		return get();
	}
}


text:
"use strict";
/**
 * JSON names not shared with the XmlElementNames or XmlAttributeNames classes.
 */
var JsonNames;
(function (JsonNames) {
    JsonNames.Events = "Events";
    JsonNames.NotificationType = "NotificationType";
    JsonNames.OldFolderId = "OldFolderId";
    JsonNames.OldItemId = "OldItemId";
    JsonNames.PathToExtendedFieldType = "ExtendedPropertyUri";
    JsonNames.PathToIndexedFieldType = "DictionaryPropertyUri";
    JsonNames.PathToUnindexedFieldType = "PropertyUri";
    JsonNames.Path = "Path";
    JsonNames.RecurrencePattern = "RecurrencePattern";
    JsonNames.RecurrenceRange = "RecurrenceRange";
})(JsonNames = exports.JsonNames || (exports.JsonNames = {}));


text:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item
        android:drawable="@drawable/aurora_receivevoice_receive_1"
        android:duration="200" />
    <item
        android:drawable="@drawable/aurora_receivevoice_receive_2"
        android:duration="200" />
    <item
        android:drawable="@drawable/aurora_receivevoice_receive_3"
        android:duration="200" />
</animation-list>


text:
module.exports = function() {
  this.Before("@sns", function (callback) {
    this.service = new this.AWS.SNS();
    callback();
  });

  this.Given(/^I create an SNS topic with name "([^"]*)"$/, function(name, callback) {
    var world = this;
    this.request(null, 'createTopic', {Name: name}, callback, function (resp) {
      world.topicArn = resp.data.TopicArn;
    });
  });

  this.Given(/^I list the SNS topics$/, function(callback) {
    this.request(null, 'listTopics', {}, callback);
  });

  this.Then(/^the list should contain the topic ARN$/, function(callback) {
    var arn = this.topicArn;
    this.assert.contains(this.data.Topics, function(topic) {
      return topic.TopicArn === arn;
    });
    callback();
  });

  this.Then(/^I delete the SNS topic$/, function(callback) {
    this.request(null, 'deleteTopic', {TopicArn: this.topicArn}, callback);
  });

  this.Given(/^I get SNS topic attributes with an invalid ARN$/, function(callback) {
    this.request(null, 'getTopicAttributes', {TopicArn:'INVALID'}, callback, false);
  });
};


text:
package com.simpligility.maven.plugins.android;

import com.android.ddmlib.AdbCommandRejectedException;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.TimeoutException;
import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
import com.simpligility.maven.plugins.android.asm.AndroidTestFinder;
import com.simpligility.maven.plugins.android.common.DeviceHelper;
import com.simpligility.maven.plugins.android.configuration.Test;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * AbstractInstrumentationMojo implements running the instrumentation
 * tests.
 *
 * @author hugo.josefson@jayway.com
 * @author Manfred Moser <manfred@simpligility.com>
 */
public abstract class AbstractInstrumentationMojo extends AbstractAndroidMojo
{

    /**
     * -Dmaven.test.skip is commonly used with Maven to skip tests. We honor it too.
     */
    @Parameter( property = "maven.test.skip", defaultValue = "false", readonly = true )
    private boolean mavenTestSkip;

    /**
     * -DskipTests is commonly used with Maven to skip tests. We honor it too.
     */
    @Parameter( property = "skipTests", defaultValue = "false", readonly = true )
    private boolean mavenSkipTests;

    /**
     * -Dmaven.test.failure.ignore is commonly used with Maven to ignore test failures. We honor it too.
     * Ignore or not tests failures. If true they will be ignored; if
     * false, they will not. Default value is false.
     */
    @Parameter( property = "maven.test.failure.ignore", defaultValue = "false", readonly = true )
    private boolean mavenIgnoreTestFailure;

    /**
     * -Dmaven.test.error.ignore is commonly used with Maven to ignore test errors. We honor it too.
     * Ignore or not tests errors. If true they will be ignored; if
     * false, they will not. Default value is false.
     */
    @Parameter( property = "maven.test.error.ignore", defaultValue = "false", readonly = true )
    private boolean mavenIgnoreTestError;

    /**
     * The configuration to use for running instrumentation tests. Complete configuration
     * is possible in the plugin configuration:
     *

     * <test>
     *   <skip>true|false|auto</skip>
     *   <instrumentationPackage>packageName</instrumentationPackage>
     *   <instrumentationRunner>className</instrumentationRunner>
     *   <debug>true|false</debug>
     *   <coverage>true|false</coverage>
     *   <coverageFile></coverageFile>
     *   <logOnly>true|false</logOnly>  avd
     *   <testSize>small|medium|large</testSize>
     *   <createReport>true|false</createReport>
     *   <classes>
     *     <class>your.package.name.YourTestClass</class>
     *   </classes>
     *   <packages>
     *     <package>your.package.name</package>
     *   </packages>
     *   <instrumentationArgs>
     *     <instrumentationArg>key value</instrumentationArg>
     *   </instrumentationArgs>
     * </test>
     *

     */
    @Parameter
    private Test test;

    /**
     * Enables or disables integration test related goals. If true they will be skipped; if
     * false, they will be run. If auto, they will run if any of the classes inherit from any
     * class in junit.framework.** or android.test.**.
     */
    @Parameter( property = "android.test.skip", defaultValue = "auto" )
    private String testSkip;

    /**
     * Enables or disables integration safe failure.
     * If true build will not stop on test failure or error.
     */
    @Parameter( property = "android.test.failsafe", defaultValue = "true" )
    private Boolean testFailSafe;

    /**
     * Package name of the apk we wish to instrument. If not specified, it is inferred from
     * AndroidManifest.xml.
     */
    @Parameter( property = "android.test.instrumentationPackage" )
    private String testInstrumentationPackage;

    /**
     * Class name of test runner. If not specified, it is inferred from AndroidManifest.xml.
     */
    @Parameter( property = "android.test.instrumentationRunner" )
    private String testInstrumentationRunner;

    /**
     * Enable debug causing the test runner to wait until debugger is
     * connected with the Android debug bridge (adb).
     */
    @Parameter( property = "android.test.debug", defaultValue = "false" )
    private Boolean testDebug;

    /**
     * Enable or disable code coverage for this instrumentation test run.
     */
    @Parameter( property = "android.test.coverage", defaultValue = "false" )
    private Boolean testCoverage;

    /**
     * Location on device into which coverage should be stored (blank for
     * Android default /data/data/your.package.here/files/coverage.ec).
     */
    @Parameter( property = "android.test.coverageFile" )
    private String testCoverageFile;

    /**
     * Enable this flag to run a log only and not execute the tests.
     */
    @Parameter( property = "android.test.logonly", defaultValue = "false" )
    private Boolean testLogOnly;

    /**
     * If specified only execute tests of certain size as defined by
     * the Android instrumentation testing SmallTest, MediumTest and
     * LargeTest annotations. Use "small", "medium" or "large" as values.
     *
     * @see com.android.ddmlib.testrunner.IRemoteAndroidTestRunner
     */
    @Parameter( property = "android.test.testsize" )
    private String testTestSize;

    /**
     * Create a junit xml format compatible output file containing
     * the test results for each device the instrumentation tests run
     * on.
     *

     * The files are stored in target/surefire-reports and named TEST-deviceid.xml.
     * The deviceid for an emulator is deviceSerialNumber_avdName_manufacturer_model.
     * The serial number is commonly emulator-5554 for the first emulator started
     * with numbers increasing. avdName is as defined in the SDK tool. The
     * manufacturer is typically "unknown" and the model is typically "sdk".
     * The deviceid for an actual devices is
     * deviceSerialNumber_manufacturer_model.
     *

     * The file contains system properties from the system running
     * the Android Maven Plugin (JVM) and device properties from the
     * device/emulator the tests are running on.
     *

     * The file contains a single TestSuite for all tests and a
     * TestCase for each test method. Errors and failures are logged
     * in the file and the system log with full stack traces and other
     * details available.
     */
    @Parameter( property = "android.test.createreport", defaultValue = "true" )
    private Boolean testCreateReport;

    /**
     *
Whether to execute tests only in given packages as part of the instrumentation tests.

     *

     * <packages>
     *     <package>your.package.name</package>
     * </packages>
     *

     * or as e.g. -Dandroid.test.packages=package1,package2
     */
    @Parameter( property = "android.test.packages" )
    protected List<String> testPackages;

    /**
     *
Whether to execute test classes which are specified as part of the instrumentation tests.

     *

     * <classes>
     *     <class>your.package.name.YourTestClass</class>
     * </classes>
     *

     * or as e.g. -Dandroid.test.classes=class1,class2
     */
    @Parameter( property = "android.test.classes" )
    protected List<String> testClasses;

    /**
     *
Whether to execute tests which are annotated with the given annotations.

     *

     * <annotations>
     *     <annotation>your.package.name.YourAnnotation</annotation>
     * </annotations>
     *

     * or as e.g. -Dandroid.test.annotations=annotation1,annotation2
     */
    @Parameter( property = "android.test.annotations" )
    protected List<String> testAnnotations;

    /**
     *
Whether to execute tests which are not annotated with the given annotations.

     *

     * <excludeAnnotations>
     *     <excludeAnnotation>your.package.name.YourAnnotation</excludeAnnotation>
     * </excludeAnnotations>
     *

     * or as e.g. -Dandroid.test.excludeAnnotations=annotation1,annotation2
     */
    @Parameter( property = "android.test.excludeAnnotations" )
    protected List<String> testExcludeAnnotations;

    /**
     *
Extra instrumentation arguments.

     *

     * <instrumentationArgs>
     *     <instrumentationArg>key value</instrumentationArg>
     *     <instrumentationArg>key 'value with spaces'</instrumentationArg>
     * </instrumentationArgs>
     *

     * or as e.g. -Dandroid.test.instrumentationArgs="key1 value1","key2 'value with spaces'"
     */
    @Parameter( property = "android.test.instrumentationArgs" )
    protected List<String> testInstrumentationArgs;

    private boolean classesExists;
    private boolean packagesExists;

    // the parsed parameters from the plugin config or properties from command line or pom or settings
    private String parsedSkip;
    private String parsedInstrumentationPackage;
    private String parsedInstrumentationRunner;
    private List<String> parsedClasses;
    private List<String> parsedPackages;
    private List<String> parsedAnnotations;
    private List<String> parsedExcludeAnnotations;
    private Map<String, String> parsedInstrumentationArgs;
    private String parsedTestSize;
    private Boolean parsedCoverage;
    private String parsedCoverageFile;
    private Boolean parsedDebug;
    private Boolean parsedLogOnly;
    private Boolean parsedCreateReport;

    private String packagesList;

    protected void instrument() throws MojoExecutionException, MojoFailureException
    {
        parseConfiguration();

        if ( parsedInstrumentationPackage == null )
        {
            parsedInstrumentationPackage = extractPackageNameFromAndroidManifest( destinationManifestFile );
        }

        if ( parsedInstrumentationRunner == null )
        {
            parsedInstrumentationRunner = extractInstrumentationRunnerFromAndroidManifest( destinationManifestFile );
        }

        // only run Tests in specific package
        packagesList = buildCommaSeparatedString( parsedPackages );
        packagesExists = StringUtils.isNotBlank( packagesList );

        if ( parsedClasses != null )
        {
            classesExists = parsedClasses.size() > 0;
        }
        else
        {
            classesExists = false;
        }

        if ( classesExists && packagesExists )
        {
            // if both packages and classes are specified --> ERROR
            throw new  MojoFailureException( "packages and classes are mutually exclusive. They cannot be specified at"
                    + " the same time. Please specify either packages or classes. For details, see "
                    + "http://developer.android.com/guide/developing/testing/testing_otheride.html" );
        }

        DeviceCallback instrumentationTestExecutor = new DeviceCallback()
        {
            public void doWithDevice( final IDevice device ) throws MojoExecutionException, MojoFailureException
            {
                String deviceLogLinePrefix = DeviceHelper.getDeviceLogLinePrefix( device );

                RemoteAndroidTestRunner remoteAndroidTestRunner = new RemoteAndroidTestRunner(
                        parsedInstrumentationPackage, parsedInstrumentationRunner, device );

                if ( packagesExists )
                {
                    for ( String str : packagesList.split( "," ) )
                    {
                        remoteAndroidTestRunner.setTestPackageName( str );
                        getLog().info( deviceLogLinePrefix + "Running tests for specified test package: " + str );
                    }
                }

                if ( classesExists )
                {
                    remoteAndroidTestRunner
                            .setClassNames( parsedClasses.toArray( new String[ parsedClasses.size() ] ) );
                    getLog().info( deviceLogLinePrefix + "Running tests for specified test classes/methods: "
                            + parsedClasses );
                }

                if ( parsedAnnotations != null )
                {
                    for ( String annotation : parsedAnnotations )
                    {
                        remoteAndroidTestRunner.addInstrumentationArg( "annotation", annotation );
                    }
                }

                if ( parsedExcludeAnnotations != null )
                {
                    for ( String annotation : parsedExcludeAnnotations )
                    {
                        remoteAndroidTestRunner.addInstrumentationArg( "notAnnotation", annotation );
                    }

                }

                remoteAndroidTestRunner.setDebug( parsedDebug );
                remoteAndroidTestRunner.setCoverage( parsedCoverage );
                if ( ! "".equals( parsedCoverageFile ) )
                {
                    remoteAndroidTestRunner.addInstrumentationArg( "coverageFile", parsedCoverageFile );
                }
                remoteAndroidTestRunner.setLogOnly( parsedLogOnly );

                if ( StringUtils.isNotBlank( parsedTestSize ) )
                {
                    IRemoteAndroidTestRunner.TestSize validSize = IRemoteAndroidTestRunner.TestSize
                            .getTestSize( parsedTestSize );
                    remoteAndroidTestRunner.setTestSize( validSize );
                }

                addAllInstrumentationArgs( remoteAndroidTestRunner, parsedInstrumentationArgs );

                getLog().info( deviceLogLinePrefix +  "Running instrumentation tests in "
                        + parsedInstrumentationPackage );
                try
                {
                    AndroidTestRunListener testRunListener = new AndroidTestRunListener( device, getLog(),
                            parsedCreateReport, false, "", "", targetDirectory );
                    remoteAndroidTestRunner.run( testRunListener );
                    if ( testRunListener.hasFailuresOrErrors() && !testFailSafe )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + "Tests failed on device." );
                    }
                    if ( testRunListener.testRunFailed() && !testFailSafe  )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix + "Test run failed to complete: "
                                + testRunListener.getTestRunFailureCause() );
                    }
                    if ( testRunListener.threwException() && !testFailSafe  )
                    {
                        throw new MojoFailureException( deviceLogLinePrefix +  testRunListener.getExceptionMessages() );
                    }
                }
                catch ( TimeoutException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "timeout", e );
                }
                catch ( AdbCommandRejectedException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "adb command rejected", e );
                }
                catch ( ShellCommandUnresponsiveException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "shell command " + "unresponsive", e );
                }
                catch ( IOException e )
                {
                    throw new MojoExecutionException( deviceLogLinePrefix + "IO problem", e );
                }
            }
        };

        instrumentationTestExecutor = new ScreenshotServiceWrapper( instrumentationTestExecutor, project, getLog() );

        doWithDevices( instrumentationTestExecutor );
    }

    private void addAllInstrumentationArgs(
            final RemoteAndroidTestRunner remoteAndroidTestRunner,
            final Map<String, String> parsedInstrumentationArgs )
    {
        for ( final Map.Entry<String, String> entry : parsedInstrumentationArgs.entrySet() )
        {
            remoteAndroidTestRunner.addInstrumentationArg( entry.getKey(), entry.getValue() );
        }
    }

    private void parseConfiguration()
    {
        // we got config in pom ... lets use it,
        if ( test != null )
        {
            if ( StringUtils.isNotEmpty( test.getSkip() ) )
            {
                parsedSkip = test.getSkip();
            }
            else
            {
                parsedSkip = testSkip;
            }
            if ( StringUtils.isNotEmpty( test.getInstrumentationPackage() ) )
            {
                parsedInstrumentationPackage = test.getInstrumentationPackage();
            }
            else
            {
                parsedInstrumentationPackage = testInstrumentationPackage;
            }
            if ( StringUtils.isNotEmpty( test.getInstrumentationRunner() ) )
            {
                parsedInstrumentationRunner = test.getInstrumentationRunner();
            }
            else
            {
                parsedInstrumentationRunner = testInstrumentationRunner;
            }
            if ( test.getClasses() != null && ! test.getClasses().isEmpty() )
            {
                parsedClasses = test.getClasses();
            }
            else
            {
                parsedClasses = testClasses;
            }
            if ( test.getAnnotations() != null && ! test.getAnnotations().isEmpty() )
            {
                parsedAnnotations = test.getAnnotations();
            }
            else
            {
                parsedAnnotations =  testAnnotations;
            }
            if ( test.getExcludeAnnotations() != null && ! test.getExcludeAnnotations().isEmpty() )
            {
                parsedExcludeAnnotations = test.getExcludeAnnotations();
            }
            else
            {
                parsedExcludeAnnotations = testExcludeAnnotations;
            }
            if ( test.getPackages() != null && ! test.getPackages().isEmpty() )
            {
                parsedPackages = test.getPackages();
            }
            else
            {
                parsedPackages = testPackages;
            }
            if ( StringUtils.isNotEmpty( test.getTestSize() ) )
            {
                parsedTestSize = test.getTestSize();
            }
            else
            {
                parsedTestSize = testTestSize;
            }
            if ( test.isCoverage() != null )
            {
                parsedCoverage = test.isCoverage();
            }
            else
            {
                parsedCoverage = testCoverage;
            }
            if ( test.getCoverageFile() != null )
            {
                parsedCoverageFile = test.getCoverageFile();
            }
            else
            {
                parsedCoverageFile = "";
            }
            if ( test.isDebug() != null )
            {
                parsedDebug = test.isDebug();
            }
            else
            {
                parsedDebug = testDebug;
            }
            if ( test.isLogOnly() != null )
            {
                parsedLogOnly = test.isLogOnly();
            }
            else
            {
                parsedLogOnly = testLogOnly;
            }
            if ( test.isCreateReport() != null )
            {
                parsedCreateReport = test.isCreateReport();
            }
            else
            {
                parsedCreateReport = testCreateReport;
            }

            parsedInstrumentationArgs = InstrumentationArgumentParser.parse( test.getInstrumentationArgs() );
        }
        // no pom, we take properties
        else
        {
            parsedSkip = testSkip;
            parsedInstrumentationPackage = testInstrumentationPackage;
            parsedInstrumentationRunner = testInstrumentationRunner;
            parsedClasses = testClasses;
            parsedAnnotations = testAnnotations;
            parsedExcludeAnnotations = testExcludeAnnotations;
            parsedPackages = testPackages;
            parsedTestSize = testTestSize;
            parsedCoverage = testCoverage;
            parsedCoverageFile = testCoverageFile;
            parsedDebug = testDebug;
            parsedLogOnly = testLogOnly;
            parsedCreateReport = testCreateReport;
            parsedInstrumentationArgs = InstrumentationArgumentParser.parse( testInstrumentationArgs );
        }
    }

    /**
     * Whether or not to execute integration test related goals. Reads from configuration parameter
     * enableIntegrationTest, but can be overridden with -Dmaven.test.skip.
     *
     * @return true if integration test goals should be executed, false otherwise.
     */
    protected boolean isEnableIntegrationTest() throws MojoFailureException, MojoExecutionException
    {
        parseConfiguration();
        if ( mavenTestSkip )
        {
            getLog().info( "maven.test.skip set - skipping tests" );
            return false;
        }

        if ( mavenSkipTests )
        {
            getLog().info( "maven.skip.tests set - skipping tests" );
            return false;
        }

        if ( "true".equalsIgnoreCase( parsedSkip ) )
        {
            getLog().info( "android.test.skip set - skipping tests" );
            return false;
        }

        if ( "false".equalsIgnoreCase( parsedSkip ) )
        {
            return true;
        }

        if ( parsedSkip == null || "auto".equalsIgnoreCase( parsedSkip ) )
        {
            if ( extractInstrumentationRunnerFromAndroidManifest( destinationManifestFile ) == null )
            {
                getLog().info( "No InstrumentationRunner found - skipping tests" );
                return false;
            }
            return AndroidTestFinder.containsAndroidTests( projectOutputDirectory );
        }

        throw new MojoFailureException( "android.test.skip must be configured as 'true', 'false' or 'auto'." );

    }

    /**
     * Helper method to build a comma separated string from a list.
     * Blank strings are filtered out
     *
     * @param lines A list of strings
     * @return Comma separated String from given list
     */
    protected static String buildCommaSeparatedString( List<String> lines )
    {
        if ( lines == null || lines.size() == 0 )
        {
            return null;
        }

        List<String> strings = new ArrayList<String>( lines.size() );
        for ( String str : lines )
        { // filter out blank strings
            if ( StringUtils.isNotBlank( str ) )
            {
                strings.add( StringUtils.trimToEmpty( str ) );
            }
        }

        return StringUtils.join( strings, "," );
    }

}


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using gov.va.medora.mdo.dao.vista;

namespace gov.va.medora.mdo.dao
{
    public interface IUserDao
    {
        string getUserId(KeyValuePair<string, string> param);
        User[] providerLookup(KeyValuePair<string, string> param);
        User[] userLookup(KeyValuePair<string, string> param);
        IList<User> userLookupList(KeyValuePair<string, string> param);
        User[] userLookup(KeyValuePair<string, string> param, string maxrex);
        User getUser(string uid);
        bool hasPermission(string uid, AbstractPermission permission);
        Dictionary<string, AbstractPermission> getPermissions(PermissionType type, string uid);
        AbstractPermission addPermission(string uid, AbstractPermission permission);
        void removePermission(string uid, AbstractPermission permission);
        bool isValidEsig(string esig);
        bool isUser(string uid);
        OrderedDictionary getUsersWithOption(string optionName);
        void updateUser(User user, string property, object value);
        void updateUser(User user, Dictionary<string, object> properties);
    }
}


text:
module Spree
  module Admin
    class PricesController < ResourceController
      belongs_to 'spree/product', find_by: :slug

      def create
        params.require(:vp).permit!
        params[:vp].each do |variant_id, prices|
          variant = Spree::Variant.find(variant_id)
          next unless variant
          supported_currencies.each do |currency|
            price = variant.price_in(currency.iso_code)
            price.price = (prices[currency.iso_code].blank? ? nil : prices[currency.iso_code])
            price.save! if price.new_record? && price.price || !price.new_record? && price.changed?
          end
        end
        flash[:success] = Spree.t('notice_messages.prices_saved')
        redirect_to admin_product_path(parent)
      end
    end
  end
end


text:
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Apache Fluo Recipes

[![Build Status][ti]][tl] [![Apache License][li]][ll]

**Fluo Recipes are common code for [Apache Fluo][fluo] application developers.**

Fluo Recipes build on the Fluo API to offer additional functionality to developers.
They are published separately from Fluo on their own release schedule.
This allows Fluo Recipes to iterate and innovate faster than Fluo (which will maintain
a more minimal API on a slower release cycle). Fluo Recipes offers code to implement
common patterns on top of Fluo's API.  It also offers glue code to external libraries
like Spark and Kryo.

## Getting Started

* Read the [Fluo Recipes documentation][fluo-docs]
* View the [API][fluo-api] for Fluo Recipes

[fluo]: https://fluo.apache.org/
[fluo-api]: https://fluo.apache.org/api/
[fluo-docs]: https://fluo.apache.org/docs/
[ti]: https://github.com/apache/fluo-recipes/workflows/CI/badge.svg
[tl]: https://github.com/apache/fluo-recipes/actions
[li]: http://img.shields.io/badge/license-ASL-blue.svg
[ll]: https://github.com/apache/fluo-recipes/blob/main/LICENSE


text:
from pin.lib import resources
import unittest
from mock import mock_open, patch

class TestResources(unittest.TestCase):

    @patch("__builtin__.open", mock_open(), create=True)
    def test_duplicate(self):
        with self.assertRaises(ValueError):
            resources.load_fonts(
                ("foo", "/tmp/foo", 8),
                ("foo", "/tmp/foo", 8)
            )


text:
array = [[1,2], ["inner", ["eagle", "par", ["FORE", "hook"]]]]

# attempts:
# ============================================================

p array[1][1][2][0]

# ============================================================

# Hole 2
# Target element: "congrats!"

hash = {outer: {inner: {"almost" => {3 => "congrats!"}}}}

# attempts:
# ============================================================

nested_data = {array: ["array", {hash: "finished"}]}

# ============================================================

# Hole 3
# Target element: "finished"

nested_data = {array: ["array", {hash: "finished"}]}

# attempts:
# ============================================================

p nested_data[:array][1][:hash]

# ============================================================

# RELEASE 3: ITERATE OVER NESTED STRUCTURES

number_array = [5, [10, 15], [20,25,30], 35]

number_array.map! do |element|
  if element.kind_of?(Array)
    element.map! {|inner| inner+5}
  else
    element+5
  end
end

p number_array

# Bonus:

startup_names = ["bit", ["find", "fast", ["optimize", "scope"]]]

startup_names.map! do |element|
  if element.kind_of?(Array)
    element.map! {|inner| inner.to_s+"ly"}
  else
    element.to_s+"ly"
  end
end

p startup_names

# Reflection

# What are some general rules you can apply to nested arrays?
    # Take it one step at a time and really think about what information you are looking for.
# What are some ways you can iterate over nested arrays?
    # We used map! to iterate over our array.
# Did you find any good new methods to implement or did you re-use one you were already familiar with? What was it and why did you decide that was a good option?
    # We used map! and kind_of?. I have used both in the past and seemed to work for us.  When doing the bonus work we were able to add the "ly" to everything accept for the seccond level of nested arrays.  We were on the right track but ran short on time to complete this.


text:
/*
 * HttpClient.java
 *
 * User: greg
 * Created: Jan 26, 2005 6:25:43 PM
 */
package com.dtolabs.client.utils;

import org.apache.commons.httpclient.HttpMethod;

import java.io.IOException;

/**
 * BaseHttpClient provides a simple interface for making and receiving HTTP requests
 * to the server.
 * Instances are obtained via the {@link com.dtolabs.client.utils.WebserviceHttpClientFactory}.
 *
 * @author Greg Schueler greg@dtosolutions.com
 * @version $Revision: 9811 $
 */
public interface BaseHttpClient extends ServerResponse{
    /**
     * Set a Header field for the request.  Must be made before makeRequest is called.
     * @param name header name
     * @param value header value
     */
    void setRequestHeader(String name, String value);

    /**
     * Makes the HTTP request to workbench.
     * @throws java.io.IOException on io error
     * @throws HttpClientException on request error
     */
    void makeRequest() throws IOException, HttpClientException;

    /**
     * Returns the {@link HttpMethod} used for the request.  Will return null before makeRequest is called.
     * @return the HttpMethod instance used for the request.
     */
    HttpMethod getRequestMethod();

    /**
     * Return the content length retrieved
     * @return content length
     */
    int getContentLengthRetrieved();

    /**
     * Set the HTTP method. Default is GET, and POST will be automatically set if isPostRequest() returns true.
     * @param method GET/POST/PUT/DELETE
     */
    void setMethodType(String method);
}


text:
using System;
using System.Configuration;
using System.Globalization;
using InstaSharp;
using InstaSharp.Endpoints;
using InstaSharp.Models;
using InstaSharp.Models.Responses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Media = InstaSharp.Endpoints.Media;

namespace GurlFeed.Tests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void InstaSharpGetTest()
        {
            UserInfo info = new UserInfo
            {
                Id = 1952620338,
                Username = "gurl_feed"
            };

            OAuthResponse response = new OAuthResponse
            {
                AccessToken = ConfigurationManager.AppSettings["AccessToken"],
                User = info
            };

            InstagramConfig config = new InstagramConfig(ConfigurationManager.AppSettings["ClientId"], ConfigurationManager.AppSettings["ClientSecret"]);

            Users users = new Users(config, response);

            UsersResponse userResponse = users.Search("yoventura", 1).Result;

            int userId = userResponse.Data[0].Id;

            MediasResponse medias = users.Recent(userId.ToString(CultureInfo.InvariantCulture), Int64.MaxValue.ToString(), Int64.MinValue.ToString(), int.MaxValue, null, null).Result;

        }
    }
}


text:
![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png)![0 stars](../../images/ic_star_border_black_18dp_1x.png) 0

To use the Snow Report for Bluewood Mountain skill, try saying...

* *Alexa, open Bluewood Mountain*

* *Alexa, ask Bluewood Mountain for the snow report*

* *Alexa, ask Bluewood Mountain for latest conditions*

The Bluewood Mountain Snow Report brought to you by SnoCountry brings you the latest snow fall, snow surface conditions,  base depth, trail, and lift operations information.

***

### Skill Details

* **Invocation Name:** bluewood mountain
* **Category:** null
* **ID:** amzn1.ask.skill.d73440ea-8237-466d-90ab-7f1e52600c52
* **ASIN:** B01M16X979
* **Author:** SnoCountry
* **Release Date:** October 19, 2016 @ 11:12:35
* **In-App Purchasing:** No


text:
'''
Rought and ready script to pull all the data from the 360Giving dkan
to a local machine.

Probably needs some work..
'''

import requests
import json
import os.path
import time

# Create a directory to hold the data
data_directory = 'data'
os.makedirs(data_directory, exist_ok=True)

# Fetch a list of package information from DKAN
base_url = "http://data.threesixtygiving.org/api/3/action/"
url = base_url + "current_package_list_with_resources"
request = requests.get(url)
data = request.json()

'''
    Loop through the packages to get the URLs of the data.
    Check if we have a copy already, if not, or if out of date
    then downlad it.

    Note we are only grabbing csv files
'''
for result in data['result']:
    # We need to make another request with the ID https://github.com/ThreeSixtyGiving/data.threesixtygiving.org/issues/11
    response3 = requests.get(base_url + 'package_show?id=' + result['id'])
    data_package = response3.json()

    # Find the raw data we want from the resources in the data.
    # We only want csvs
    for resource in data_package['result']['resources']:
        if resource['format'] == 'csv':
            print (resource['id'])
            # Now we have the resource, so go and find the URL of the data (at last!
            url = base_url + "resource_show?id=" + resource['id']
            response3 = requests.get(url)
            data_resource = response3.json()
            data_url = data_resource['result']['url']
            # We have the URL!
            print(data_url)

            # Fetch the data!
            testfile = requests.get(data_url)

            os.makedirs(os.path.join(data_directory, result['name']), exist_ok=True)
            output_name = os.path.join(data_directory, result['name'], resource['id'] + '.csv')

            with open(output_name, 'wb') as fp:
                fp.write(testfile.content)


text:
<?php
require_once("utilities.php");
?>
<!DOCTYPE html>

<title>Village X Org | Fund Projects That Villages Choose</title>
<meta name="description" content="Disrupting extreme poverty in rural Africa with democracy, direct giving, and data."/>

<?php
include('header.inc');
?>

WELCOME BACK

      your profile. your impact. your fundraisers.

              <form class="col s12" style="width:100%" id="login_form" method='post'>

EMAIL

                        <input placeholder="enter your email address" class='email' type="email" style="width:100%;padding:0% 0% 0% 0%;font-size:18px;" id="login_email" name="login_email" required data-error=".errorTxt3"/>

PASSWORD

                      <input placeholder="enter your password" class='text' type="password" style="width:100%;padding:0% 0% 0% 0%;font-size:18px;" id="login_password" required data-error=".errorTxt4" name="login_password" />

                          <button id="loginButton" style="width:100%;height:50px;font-size:20px"
                              class="g-recaptcha btn-large donor-background center-align submit"
                              data-sitekey="<?php print CAPTCHA_SITEKEY_V3; ?>"
                              data-callback="onSubmit">
                              SIGN IN
                          </button>

            </form>

            No account yet? Sign up

            Forgot your password? Reset it

No worries.  We'll send you an email with instructions for resetting your password.  Please enter your email below.

            <form id="reset_password_form" method="get" class="center-align">

                            <input placeholder="jane@gmail.com" id="reset_password_email"
                                name="email" required data-error=".errorTxt3"
                                style="font-size: 20px; color: black;" type="email">

                      <button id="resetButton" style="width:100%;height:70px;font-size:22px"
                          class="g-recaptcha btn-large red center-align submit"
                          data-sitekey="<?php print CAPTCHA_SITEKEY_V3; ?>"
                          data-callback="onReset">
                          Reset My Password
                      </button>

            </form>

Account Found!

An email with instructions has been mailed to the address you provided.

          Sounds good!

There was a problem...

We could not find the supplied email in our system.

          Ok


text:
chrome.app.runtime.onLaunched.addListener(function() {
    var screenWidth = screen.availWidth;
    var screenHeight = screen.availHeight;
    var width = screenWidth/2;
    var height = screenHeight/2;

    chrome.app.window.create('index.html',
            {width: width, height: height,
                left: 0,
                top: 0});
});


text:
<!doctype html>

		<title>three.js webgl - materials - cube reflection [camaro]</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

				three.js - webgl cube reflection demo. chevrolet camaro by dskfnwn
					- O, P : change eye separation


text:
class Query::LocationAdvancedSearch < Query::LocationBase
  include Query::Initializers::AdvancedSearch

  def parameter_declarations
    super.merge(
      advanced_search_parameter_declarations
    )
  end

  def initialize_flavor
    add_join(:observations) if params[:content].present?
    initialize_advanced_search
    super
  end

  def add_join_to_names
    add_join(:observations, :names)
  end

  def add_join_to_users
    add_join(:observations, :users)
  end

  def add_join_to_locations; end

  def content_join_spec
    { observations: :comments }
  end
end