text:
package com.tencent.tinker.commons.dexpatcher.util;

import com.tencent.tinker.android.dex.Annotation;
import com.tencent.tinker.android.dex.AnnotationSet;
import com.tencent.tinker.android.dex.AnnotationSetRefList;
import com.tencent.tinker.android.dex.AnnotationsDirectory;
import com.tencent.tinker.android.dex.ClassData;
import com.tencent.tinker.android.dex.ClassDef;
import com.tencent.tinker.android.dex.Code;
import com.tencent.tinker.android.dex.DebugInfoItem;
import com.tencent.tinker.android.dex.DexException;
import com.tencent.tinker.android.dex.EncodedValue;
import com.tencent.tinker.android.dex.EncodedValueCodec;
import com.tencent.tinker.android.dex.EncodedValueReader;
import com.tencent.tinker.android.dex.FieldId;
import com.tencent.tinker.android.dex.Leb128;
import com.tencent.tinker.android.dex.MethodId;
import com.tencent.tinker.android.dex.ProtoId;
import com.tencent.tinker.android.dex.TypeList;
import com.tencent.tinker.android.dex.util.ByteInput;
import com.tencent.tinker.android.dex.util.ByteOutput;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

/**
 * Created by tangyinsheng on 2016/6/29.
 *
 * *** This file is renamed from IndexMap in dx project. ***
 */

public abstract class AbstractIndexMap {

    public abstract int adjustStringIndex(int stringIndex);

    public abstract int adjustTypeIdIndex(int typeIdIndex);

    public abstract int adjustProtoIdIndex(int protoIndex);

    public abstract int adjustFieldIdIndex(int fieldIndex);

    public abstract int adjustMethodIdIndex(int methodIndex);

    public abstract int adjustTypeListOffset(int typeListOffset);

    public abstract int adjustAnnotationOffset(int annotationOffset);

    public abstract int adjustAnnotationSetOffset(int annotationSetOffset);

    public abstract int adjustAnnotationSetRefListOffset(int annotationSetRefListOffset);

    public abstract int adjustAnnotationsDirectoryOffset(int annotationsDirectoryOffset);

    public abstract int adjustStaticValuesOffset(int staticValuesOffset);

    public abstract int adjustClassDataOffset(int classDataOffset);

    public abstract int adjustDebugInfoItemOffset(int debugInfoItemOffset);

    public abstract int adjustCodeOffset(int codeOffset);

    public TypeList adjust(TypeList typeList) {
        if (typeList == TypeList.EMPTY) {
            return typeList;
        }
        short[] types = new short[typeList.types.length];
        for (int i = 0; i < types.length; ++i) {
            types[i] = (short) adjustTypeIdIndex(typeList.types[i]);
        }
        return new TypeList(typeList.off, types);
    }

    public MethodId adjust(MethodId methodId) {
        int adjustedDeclaringClassIndex = adjustTypeIdIndex(methodId.declaringClassIndex);
        int adjustedProtoIndex = adjustProtoIdIndex(methodId.protoIndex);
        int adjustedNameIndex = adjustStringIndex(methodId.nameIndex);
        return new MethodId(
                methodId.off, adjustedDeclaringClassIndex, adjustedProtoIndex, adjustedNameIndex
        );
    }

    public FieldId adjust(FieldId fieldId) {
        int adjustedDeclaringClassIndex = adjustTypeIdIndex(fieldId.declaringClassIndex);
        int adjustedTypeIndex = adjustTypeIdIndex(fieldId.typeIndex);
        int adjustedNameIndex = adjustStringIndex(fieldId.nameIndex);
        return new FieldId(
                fieldId.off, adjustedDeclaringClassIndex, adjustedTypeIndex, adjustedNameIndex
        );
    }

    public ProtoId adjust(ProtoId protoId) {
        int adjustedShortyIndex = adjustStringIndex(protoId.shortyIndex);
        int adjustedReturnTypeIndex = adjustTypeIdIndex(protoId.returnTypeIndex);
        int adjustedParametersOffset = adjustTypeListOffset(protoId.parametersOffset);
        return new ProtoId(
                protoId.off, adjustedShortyIndex, adjustedReturnTypeIndex, adjustedParametersOffset
        );
    }

    public ClassDef adjust(ClassDef classDef) {
        int adjustedTypeIndex = adjustTypeIdIndex(classDef.typeIndex);
        int adjustedSupertypeIndex = adjustTypeIdIndex(classDef.supertypeIndex);
        int adjustedInterfacesOffset = adjustTypeListOffset(classDef.interfacesOffset);
        int adjustedSourceFileIndex = adjustStringIndex(classDef.sourceFileIndex);
        int adjustedAnnotationsOffset = adjustAnnotationsDirectoryOffset(classDef.annotationsOffset);
        int adjustedClassDataOffset = adjustClassDataOffset(classDef.classDataOffset);
        int adjustedStaticValuesOffset = adjustStaticValuesOffset(classDef.staticValuesOffset);
        return new ClassDef(
                classDef.off, adjustedTypeIndex, classDef.accessFlags, adjustedSupertypeIndex,
                adjustedInterfacesOffset, adjustedSourceFileIndex, adjustedAnnotationsOffset,
                adjustedClassDataOffset, adjustedStaticValuesOffset
        );
    }

    public ClassData adjust(ClassData classData) {
        ClassData.Field[] adjustedStaticFields = adjustFields(classData.staticFields);
        ClassData.Field[] adjustedInstanceFields = adjustFields(classData.instanceFields);
        ClassData.Method[] adjustedDirectMethods = adjustMethods(classData.directMethods);
        ClassData.Method[] adjustedVirtualMethods = adjustMethods(classData.virtualMethods);
        return new ClassData(
                classData.off, adjustedStaticFields, adjustedInstanceFields,
                adjustedDirectMethods, adjustedVirtualMethods
        );
    }

    public Code adjust(Code code) {
        int adjustedDebugInfoOffset = adjustDebugInfoItemOffset(code.debugInfoOffset);
        short[] adjustedInstructions = adjustInstructions(code.instructions);
        Code.CatchHandler[] adjustedCatchHandlers = adjustCatchHandlers(code.catchHandlers);
        return new Code(
                code.off, code.registersSize, code.insSize, code.outsSize,
                adjustedDebugInfoOffset, adjustedInstructions, code.tries, adjustedCatchHandlers
        );
    }

    private short[] adjustInstructions(short[] instructions) {
        if (instructions == null || instructions.length == 0) {
            return instructions;
        }
        InstructionTransformer insTrans = new InstructionTransformer(this);
        return insTrans.transform(instructions);
    }

    private Code.CatchHandler[] adjustCatchHandlers(Code.CatchHandler[] catchHandlers) {
        if (catchHandlers == null || catchHandlers.length == 0) {
            return catchHandlers;
        }
        Code.CatchHandler[] adjustedCatchHandlers = new Code.CatchHandler[catchHandlers.length];
        for (int i = 0; i < catchHandlers.length; ++i) {
            Code.CatchHandler catchHandler = catchHandlers[i];
            int typeIndexesCount = catchHandler.typeIndexes.length;
            int[] adjustedTypeIndexes = new int[typeIndexesCount];
            for (int j = 0; j < typeIndexesCount; ++j) {
                adjustedTypeIndexes[j] = adjustTypeIdIndex(catchHandler.typeIndexes[j]);
            }
            adjustedCatchHandlers[i] = new Code.CatchHandler(
                    adjustedTypeIndexes, catchHandler.addresses,
                    catchHandler.catchAllAddress, catchHandler.offset
            );
        }
        return adjustedCatchHandlers;
    }

    private ClassData.Field[] adjustFields(ClassData.Field[] fields) {
        ClassData.Field[] adjustedFields = new ClassData.Field[fields.length];
        for (int i = 0; i < fields.length; ++i) {
            ClassData.Field field = fields[i];
            int adjustedFieldIndex = adjustFieldIdIndex(field.fieldIndex);
            adjustedFields[i] = new ClassData.Field(adjustedFieldIndex, field.accessFlags);
        }
        return adjustedFields;
    }

    private ClassData.Method[] adjustMethods(ClassData.Method[] methods) {
        ClassData.Method[] adjustedMethods = new ClassData.Method[methods.length];
        for (int i = 0; i < methods.length; ++i) {
            ClassData.Method method = methods[i];
            int adjustedMethodIndex = adjustMethodIdIndex(method.methodIndex);
            int adjustedCodeOffset = adjustCodeOffset(method.codeOffset);
            adjustedMethods[i] = new ClassData.Method(
                    adjustedMethodIndex, method.accessFlags, adjustedCodeOffset
            );
        }
        return adjustedMethods;
    }

    public DebugInfoItem adjust(DebugInfoItem debugInfoItem) {
        int[] parameterNames = adjustParameterNames(debugInfoItem.parameterNames);
        byte[] infoSTM = adjustDebugInfoItemSTM(debugInfoItem.infoSTM);
        return new DebugInfoItem(
                debugInfoItem.off, debugInfoItem.lineStart, parameterNames, infoSTM
        );
    }

    private int[] adjustParameterNames(int[] parameterNames) {
        int size = parameterNames.length;
        int[] adjustedParameterNames = new int[size];
        for (int i = 0; i < size; ++i) {
            adjustedParameterNames[i] = adjustStringIndex(parameterNames[i]);
        }
        return adjustedParameterNames;
    }

    private byte[] adjustDebugInfoItemSTM(byte[] infoSTM) {
        ByteArrayInputStream bais = new ByteArrayInputStream(infoSTM);
        final ByteArrayInputStream baisRef = bais;
        ByteInput inAdapter = new ByteInput() {
            @Override
            public byte readByte() {
                return (byte) (baisRef.read() & 0xFF);
            }
        };

        ByteArrayOutputStream baos = new ByteArrayOutputStream(infoSTM.length + 512);
        final ByteArrayOutputStream baosRef = baos;
        ByteOutput outAdapter = new ByteOutput() {
            @Override
            public void writeByte(int i) {
                baosRef.write(i);
            }
        };

        outside_whileloop:
        while (true) {
            int opcode = bais.read() & 0xFF;
            baos.write(opcode);
            switch (opcode) {
                case DebugInfoItem.DBG_END_SEQUENCE: {
                    break outside_whileloop;
                }
                case DebugInfoItem.DBG_ADVANCE_PC: {
                    int addrDiff = Leb128.readUnsignedLeb128(inAdapter);
                    Leb128.writeUnsignedLeb128(outAdapter, addrDiff);
                    break;
                }
                case DebugInfoItem.DBG_ADVANCE_LINE: {
                    int lineDiff = Leb128.readSignedLeb128(inAdapter);
                    Leb128.writeSignedLeb128(outAdapter, lineDiff);
                    break;
                }
                case DebugInfoItem.DBG_START_LOCAL:
                case DebugInfoItem.DBG_START_LOCAL_EXTENDED: {
                    int registerNum = Leb128.readUnsignedLeb128(inAdapter);
                    Leb128.writeUnsignedLeb128(outAdapter, registerNum);

                    int nameIndex = adjustStringIndex(Leb128.readUnsignedLeb128p1(inAdapter));
                    Leb128.writeUnsignedLeb128p1(outAdapter, nameIndex);

                    int typeIndex = adjustTypeIdIndex(Leb128.readUnsignedLeb128p1(inAdapter));
                    Leb128.writeUnsignedLeb128p1(outAdapter, typeIndex);

                    if (opcode == DebugInfoItem.DBG_START_LOCAL_EXTENDED) {
                        int sigIndex = adjustStringIndex(Leb128.readUnsignedLeb128p1(inAdapter));
                        Leb128.writeUnsignedLeb128p1(outAdapter, sigIndex);
                    }
                    break;
                }
                case DebugInfoItem.DBG_END_LOCAL:
                case DebugInfoItem.DBG_RESTART_LOCAL: {
                    int registerNum = Leb128.readUnsignedLeb128(inAdapter);
                    Leb128.writeUnsignedLeb128(outAdapter, registerNum);
                    break;
                }
                case DebugInfoItem.DBG_SET_FILE: {
                    int nameIndex = adjustStringIndex(Leb128.readUnsignedLeb128p1(inAdapter));
                    Leb128.writeUnsignedLeb128p1(outAdapter, nameIndex);
                    break;
                }
                case DebugInfoItem.DBG_SET_PROLOGUE_END:
                case DebugInfoItem.DBG_SET_EPILOGUE_BEGIN:
                default: {
                    break;
                }
            }
        }

        return baos.toByteArray();
    }

    public EncodedValue adjust(EncodedValue encodedArray) {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(encodedArray.data.length);
        new EncodedValueTransformer(
                new ByteOutput() {
                    @Override
                    public void writeByte(int i) {
                        baos.write(i);
                    }
                }
        ).transformArray(
                new EncodedValueReader(encodedArray, EncodedValueReader.ENCODED_ARRAY)
        );
        return new EncodedValue(encodedArray.off, baos.toByteArray());
    }

    public Annotation adjust(Annotation annotation) {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(annotation.encodedAnnotation.data.length);
        new EncodedValueTransformer(
                new ByteOutput() {
                    @Override
                    public void writeByte(int i) {
                        baos.write(i);
                    }
                }
        ).transformAnnotation(annotation.getReader());
        return new Annotation(
                annotation.off,
                annotation.visibility,
                new EncodedValue(annotation.encodedAnnotation.off, baos.toByteArray())
        );
    }

    public AnnotationSet adjust(AnnotationSet annotationSet) {
        int size = annotationSet.annotationOffsets.length;
        int[] adjustedAnnotationOffsets = new int[size];
        for (int i = 0; i < size; ++i) {
            adjustedAnnotationOffsets[i]
                    = adjustAnnotationOffset(annotationSet.annotationOffsets[i]);
        }
        return new AnnotationSet(annotationSet.off, adjustedAnnotationOffsets);
    }

    public AnnotationSetRefList adjust(AnnotationSetRefList annotationSetRefList) {
        int size = annotationSetRefList.annotationSetRefItems.length;
        int[] adjustedAnnotationSetRefItems = new int[size];
        for (int i = 0; i < size; ++i) {
            adjustedAnnotationSetRefItems[i]
                    = adjustAnnotationSetOffset(annotationSetRefList.annotationSetRefItems[i]);
        }
        return new AnnotationSetRefList(annotationSetRefList.off, adjustedAnnotationSetRefItems);
    }

    public AnnotationsDirectory adjust(AnnotationsDirectory annotationsDirectory) {
        int adjustedClassAnnotationsOffset
                = adjustAnnotationSetOffset(annotationsDirectory.classAnnotationsOffset);

        int[][] adjustedFieldAnnotations
                = new int[annotationsDirectory.fieldAnnotations.length][2];
        for (int i = 0; i < adjustedFieldAnnotations.length; ++i) {
            adjustedFieldAnnotations[i][0]
                    = adjustFieldIdIndex(annotationsDirectory.fieldAnnotations[i][0]);
            adjustedFieldAnnotations[i][1]
                    = adjustAnnotationSetOffset(annotationsDirectory.fieldAnnotations[i][1]);
        }

        int[][] adjustedMethodAnnotations
                = new int[annotationsDirectory.methodAnnotations.length][2];
        for (int i = 0; i < adjustedMethodAnnotations.length; ++i) {
            adjustedMethodAnnotations[i][0]
                    = adjustMethodIdIndex(annotationsDirectory.methodAnnotations[i][0]);
            adjustedMethodAnnotations[i][1]
                    = adjustAnnotationSetOffset(annotationsDirectory.methodAnnotations[i][1]);
        }

        int[][] adjustedParameterAnnotations
                = new int[annotationsDirectory.parameterAnnotations.length][2];
        for (int i = 0; i < adjustedParameterAnnotations.length; ++i) {
            adjustedParameterAnnotations[i][0]
                    = adjustMethodIdIndex(annotationsDirectory.parameterAnnotations[i][0]);
            adjustedParameterAnnotations[i][1]
                    = adjustAnnotationSetRefListOffset(
                    annotationsDirectory.parameterAnnotations[i][1]
            );
        }

        return new AnnotationsDirectory(
                annotationsDirectory.off, adjustedClassAnnotationsOffset,
                adjustedFieldAnnotations, adjustedMethodAnnotations, adjustedParameterAnnotations
        );
    }

    /**
     * Adjust an encoded value or array.
     */
    private final class EncodedValueTransformer {
        private final ByteOutput out;

        EncodedValueTransformer(ByteOutput out) {
            this.out = out;
        }

        public void transform(EncodedValueReader reader) {
            switch (reader.peek()) {
                case EncodedValueReader.ENCODED_BYTE:
                    EncodedValueCodec.writeSignedIntegralValue(out, EncodedValueReader.ENCODED_BYTE, reader.readByte());
                    break;
                case EncodedValueReader.ENCODED_SHORT:
                    EncodedValueCodec.writeSignedIntegralValue(out, EncodedValueReader.ENCODED_SHORT, reader.readShort());
                    break;
                case EncodedValueReader.ENCODED_INT:
                    EncodedValueCodec.writeSignedIntegralValue(out, EncodedValueReader.ENCODED_INT, reader.readInt());
                    break;
                case EncodedValueReader.ENCODED_LONG:
                    EncodedValueCodec.writeSignedIntegralValue(out, EncodedValueReader.ENCODED_LONG, reader.readLong());
                    break;
                case EncodedValueReader.ENCODED_CHAR:
                    EncodedValueCodec.writeUnsignedIntegralValue(out, EncodedValueReader.ENCODED_CHAR, reader.readChar());
                    break;
                case EncodedValueReader.ENCODED_FLOAT:
                    // Shift value left 32 so that right-zero-extension works.
                    long longBits = ((long) Float.floatToIntBits(reader.readFloat())) << 32;
                    EncodedValueCodec.writeRightZeroExtendedValue(out, EncodedValueReader.ENCODED_FLOAT, longBits);
                    break;
                case EncodedValueReader.ENCODED_DOUBLE:
                    EncodedValueCodec.writeRightZeroExtendedValue(
                            out, EncodedValueReader.ENCODED_DOUBLE, Double.doubleToLongBits(reader.readDouble()));
                    break;
                case EncodedValueReader.ENCODED_STRING:
                    EncodedValueCodec.writeUnsignedIntegralValue(
                            out, EncodedValueReader.ENCODED_STRING, adjustStringIndex(reader.readString()));
                    break;
                case EncodedValueReader.ENCODED_TYPE:
                    EncodedValueCodec.writeUnsignedIntegralValue(
                            out, EncodedValueReader.ENCODED_TYPE, adjustTypeIdIndex(reader.readType()));
                    break;
                case EncodedValueReader.ENCODED_FIELD:
                    EncodedValueCodec.writeUnsignedIntegralValue(
                            out, EncodedValueReader.ENCODED_FIELD, adjustFieldIdIndex(reader.readField()));
                    break;
                case EncodedValueReader.ENCODED_ENUM:
                    EncodedValueCodec.writeUnsignedIntegralValue(
                            out, EncodedValueReader.ENCODED_ENUM, adjustFieldIdIndex(reader.readEnum()));
                    break;
                case EncodedValueReader.ENCODED_METHOD:
                    EncodedValueCodec.writeUnsignedIntegralValue(
                            out, EncodedValueReader.ENCODED_METHOD, adjustMethodIdIndex(reader.readMethod()));
                    break;
                case EncodedValueReader.ENCODED_ARRAY:
                    writeTypeAndArg(EncodedValueReader.ENCODED_ARRAY, 0);
                    transformArray(reader);
                    break;
                case EncodedValueReader.ENCODED_ANNOTATION:
                    writeTypeAndArg(EncodedValueReader.ENCODED_ANNOTATION, 0);
                    transformAnnotation(reader);
                    break;
                case EncodedValueReader.ENCODED_NULL:
                    reader.readNull();
                    writeTypeAndArg(EncodedValueReader.ENCODED_NULL, 0);
                    break;
                case EncodedValueReader.ENCODED_BOOLEAN:
                    boolean value = reader.readBoolean();
                    writeTypeAndArg(EncodedValueReader.ENCODED_BOOLEAN, value ? 1 : 0);
                    break;
                default:
                    throw new DexException("Unexpected type: " + Integer.toHexString(reader.peek()));
            }
        }

        private void transformAnnotation(EncodedValueReader reader) {
            int fieldCount = reader.readAnnotation();
            Leb128.writeUnsignedLeb128(out, adjustTypeIdIndex(reader.getAnnotationType()));
            Leb128.writeUnsignedLeb128(out, fieldCount);
            for (int i = 0; i < fieldCount; i++) {
                Leb128.writeUnsignedLeb128(out, adjustStringIndex(reader.readAnnotationName()));
                transform(reader);
            }
        }

        private void transformArray(EncodedValueReader reader) {
            int size = reader.readArray();
            Leb128.writeUnsignedLeb128(out, size);
            for (int i = 0; i < size; i++) {
                transform(reader);
            }
        }

        private void writeTypeAndArg(int type, int arg) {
            out.writeByte((arg << 5) | type);
        }
    }
}


text:
namespace llvm {
namespace codeview {

class SymbolVisitorCallbackPipeline : public SymbolVisitorCallbacks {
public:
  SymbolVisitorCallbackPipeline() = default;

  Error visitUnknownSymbol(CVSymbol &Record) override {
    for (auto Visitor : Pipeline) {
      if (auto EC = Visitor->visitUnknownSymbol(Record))
        return EC;
    }
    return Error::success();
  }

  Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
    for (auto Visitor : Pipeline) {
      if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
        return EC;
    }
    return Error::success();
  }

  Error visitSymbolBegin(CVSymbol &Record) override {
    for (auto Visitor : Pipeline) {
      if (auto EC = Visitor->visitSymbolBegin(Record))
        return EC;
    }
    return Error::success();
  }

  Error visitSymbolEnd(CVSymbol &Record) override {
    for (auto Visitor : Pipeline) {
      if (auto EC = Visitor->visitSymbolEnd(Record))
        return EC;
    }
    return Error::success();
  }

  void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks) {
    Pipeline.push_back(&Callbacks);
  }

#define SYMBOL_RECORD(EnumName, EnumVal, Name)                                 \
  Error visitKnownRecord(CVSymbol &CVR, Name &Record) override {               \
    for (auto Visitor : Pipeline) {                                            \
      if (auto EC = Visitor->visitKnownRecord(CVR, Record))                    \
        return EC;                                                             \
    }                                                                          \
    return Error::success();                                                   \
  }
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"

private:
  std::vector<SymbolVisitorCallbacks *> Pipeline;
};

} // end namespace codeview
} // end namespace llvm

#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;
using Newtonsoft.Json;

namespace DaaSDemo.Models.DatabaseProxy
{
    /// <summary>
    ///     Response body when executing a T-SQL command (i.e. a non-query).
    /// </summary>
    public class CommandResult
        : SqlResult
    {
    }
}


text:
package com.lixiaocong.cms.dev;

import com.lixiaocong.cms.entity.User;
import com.lixiaocong.cms.repository.IUserRepository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.context.SecurityContextPersistenceFilter;

//TODO if don't set order, there will be an error, to be fixed
@Profile("develop")
@Order(1)
@Configuration
public class DevWebSecurityConfig extends WebSecurityConfigurerAdapter {

    private Log log = LogFactory.getLog(getClass());

    private IUserRepository userRepository;

    @Autowired
    public DevWebSecurityConfig(IUserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().anyRequest().permitAll().and().formLogin().loginPage("/signin").defaultSuccessUrl("/blog").and().logout().logoutUrl("/logout").logoutSuccessUrl("/blog").and().rememberMe().rememberMeParameter("remember-me").and().csrf().disable();
        User admin = userRepository.findByUsername("admin");
        if (admin == null)
            admin = new User("admin", "123456");
        admin.setAdmin(true);
        admin.setPassword("123456");
        userRepository.save(admin);
        http.addFilterAfter(new DevSigninFilter(userRepository), SecurityContextPersistenceFilter.class);
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine;

namespace JsonDotNet.Extras.CustomConverters
{
	public class Vector3Converter : JsonConverter
	{
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			JToken t = JToken.FromObject(value);

			if (t.Type != JTokenType.Object)
			{
				t.WriteTo(writer);
			}
			else
			{
				var o = (JObject)t;
				IList<string> propertyNames = o.Properties().Where(p => p.Name == "x" || p.Name == "y" || p.Name == "z").Select(p => p.Name).ToList();

				o.AddFirst(new JProperty("Keys", new JArray(propertyNames)));
				o.WriteTo(writer);
			}
		}

		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			throw new NotImplementedException("Unnecessary because CanRead is false. The type will skip the converter.");
		}

		public override bool CanRead
		{
			get { return false; }
		}

		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(Vector3);
		}
	}
}


text:
module DummyMovesMapper
  class SummaryMapper < ROM::Mapper
    reject_keys true

    attribute :activity, from: "activity"
    attribute :group, from: "group"
    attribute :duration, from: "duration"
    attribute :distance, from: "distance"
    attribute :steps, from: "steps"
    attribute :calories, from: "calories"

    model Summary
  end
end


text:
title: Setting up Heron with Aurora Cluster Locally on Linux
---

It is possible to setup Heron with a locally running Apache Aurora cluster.
This is a step by step guide on how to configure and setup all the necessary
components.

## Setting Up Apache Aurora Cluster locally

You first need to setup Apache Aurora locally. More detailed description of the
following steps can be found in [A local Cluster with Vagrant](http://aurora.apache.org/documentation/latest/getting-started/vagrant/)

### Step 1: Install VirtualBox and Vagrant

Download and install VirtualBox and Vagrant on your machine. If vagrant is successfully
installed in your machine the following command should list several common commands
for this tool

```bash
$ vagrant
```

### Step 2: Clone the Aurora repository

You can get the source repository for Aurora with the following command

```bash
$ dgit clone git://git.apache.org/aurora.git
```

Once the clone is complete cd into the aurora folder

```bash
$ cd aurora
```

### Step 3: Starting Local Aurora Cluster

To start the local cluster all you have to do is execute the following command. It will install all the needed dependencies like Apache Mesos and Zookeeper in the VM.

```bash
$ vagrant up
```

Additionally to get rid of some of the warning messages that you get during up command execute the following command

```bash
$ vagrant plugin install vagrant-vbguest
```

You can verify that the Aurora cluster is properly running by opening the following links in your web-browser

* Scheduler - http://192.168.33.7:8081
* Observer - http://192.168.33.7:1338
* Mesos Master - http://192.168.33.7:5050
* Mesos Agent - http://192.168.33.7:5051

If you go into http://192.168.33.7:8081/scheduler you can notice that the name of the default cluster that is setup in aurora is
named `devcluster` this will be important to note when submitting typologies from heron.

![Heron topology](/img/aurora-local-cluster-start.png)

## Installing Heron within VM

Now that the Aurora cluster is setup you need to install heron within the cluster VM in order to be able to get the Heron
deployment working. Since this is a fresh VM instance you will have to install the basic software such as "unzip" and set
the JAVA_HOME path as an environmental variable ( Just need to add this to .bashrc file). After you have the basic stuff
working follow the following steps to install Heron in the VM. You can ssh into the VM with the following command

```bash
$ vagrant ssh
```

### Step 1.a : Download installation script files

You can download the script files that match your Linux distribution from
https://github.com/twitter/heron/releases/tag/{{% heronVersion %}}

For example for the {{% heronVersion %}} release the files you need to download For Ubuntu will be the following.

* `heron-client-install-{{% heronVersion %}}-ubuntu.sh`
* `heron-tools-install-{{% heronVersion %}}-ubuntu.sh`

Optionally - You want need the following for the steps in the blog post

* `heron-api-install-{{% heronVersion %}}-ubuntu.sh`
* `heron-core-{{% heronVersion %}}-ubuntu.tar.gz`

### Step 1.b: Execute the client and tools shell scripts

```bash
$ chmod +x heron-client-install-VERSION-PLATFORM.sh
$ ./heron-client-install-VERSION-PLATFORM.sh --user
Heron client installer
----------------------

Uncompressing......
Heron is now installed!

Make sure you have "/home/vagrant/bin" in your path.
```

After this you need to add the path "/home/vagrant/bin". You can just execute the following command
or add it to the end of  .bashrc file ( which is more convenient ).

```bash
$ export PATH=$PATH:/home/vagrant/bin
```

Install the following packages to make sure that you have all the needed dependencies in the VM.
You might have to do sudo apt-get update before you execute the following.

```bash
$ sudo apt-get install git build-essential automake cmake libtool zip libunwind-setjmp0-dev zlib1g-dev unzip pkg-config -y
```

## Configuring State Manager ( Apache Zookeeper )

Since Heron only uses Apache Zookeeper for coordination the load on the Zookeeper
node is minimum. Because of this it is sufficient to use a single Zookeeper node or
if you have an Zookeeper instance running for some other task you can simply use that.
Since Apache Aurora already uses an Zookeeper instance you can directly use that instance
to execute State Manager tasks of Heron. First you need to configure Heron to work with
the Zookeeper instance. You can find meanings of each attribute in [Setting Up ZooKeeper
State Manager] (../../statemanagers/zookeeper). Configurations for State manager are
located in the directory `/home/vagrant/.heron/conf/aurora`.

Open the file `statemgr.yaml` using vim ( or some other text editor you prefer )
and add/edit the file to include the following.

```yaml
# local state manager class for managing state in a persistent fashion
heron.class.state.manager: com.twitter.heron.statemgr.zookeeper.curator.CuratorStateManager

# local state manager connection string
heron.statemgr.connection.string:  "127.0.0.1:2181"

# path of the root address to store the state in a local file system
heron.statemgr.root.path: "/heronroot"

# create the zookeeper nodes, if they do not exist
heron.statemgr.zookeeper.is.initialize.tree: True

# timeout in ms to wait before considering zookeeper session is dead
heron.statemgr.zookeeper.session.timeout.ms: 30000

# timeout in ms to wait before considering zookeeper connection is dead
heron.statemgr.zookeeper.connection.timeout.ms: 30000

# timeout in ms to wait before considering zookeeper connection is dead
heron.statemgr.zookeeper.retry.count: 10

# duration of time to wait until the next retry
heron.statemgr.zookeeper.retry.interval.ms: 10000
```

## Creating Paths in Zookeeper

Next you need to create some paths within Zookeeper since some of the paths
are not created by Heron automatically. So you need to create them manually.
Since Aurora installation already installed Zookeeper, you can use the Zookeeper
cli to create the manual paths.

```bash
$ sudo ./usr/share/zookeeper/bin/zkCli.sh
```

This will connect to the Zookeeper instance running locally. Then execute the
following commands from within the client to create paths `/heronroot/topologies`
and `/heron/topologies`. Later in "Associating new Aurora cluster into Heron UI"
you will see that you only need to create `/heronroot/topologies` but for now lets
create both to make sure you don't get any errors when you run things.

```bash
create /heronroot null
create /heronroot/topologies null
```

```bash
create /heron null
create /heron/topologies null
```

## Configuring Scheduler ( Apache Aurora )

Next you need to configure Apache Aurora to be used as the Scheduler for our Heron
local cluster. In order to do this you need to edit the `scheduler.yaml` file that is
also located in `/home/vagrant/.heron/conf/aurora`. Add/Edit the file to include the
following. More information regarding parameters can be found in [Aurora Cluster](../aurora)

```yaml
# scheduler class for distributing the topology for execution
heron.class.scheduler: com.twitter.heron.scheduler.aurora.AuroraScheduler

# launcher class for submitting and launching the topology
heron.class.launcher: com.twitter.heron.scheduler.aurora.AuroraLauncher

# location of the core package
heron.package.core.uri: file:///home/vagrant/.heron/dist/heron-core.tar.gz

# location of java - pick it up from shell environment
heron.directory.sandbox.java.home: /usr/lib/jvm/java-1.8.0-openjdk-amd64/

# Invoke the IScheduler as a library directly
heron.scheduler.is.service: False
```

Additionally edit the `client.yaml` file and change the core uri to make it consistant.

```yaml
# location of the core package
heron.package.core.uri: file:///home/vagrant/.heron/dist/heron-core.tar.gz
```

### Important Step: Change folder name `aurora` to `devcluster`

Next you need to change the folder name of `/home/vagrant/.heron/conf/aurora` to
`/home/vagrant/.heron/conf/devcluster`. This is because the name of your aurora
cluster is `devcluster` as you noted in a previous step. You can do this with the
following commands

```bash
$ cd /home/vagrant/.heron/conf/
$ mv aurora devcluster
```

## Submitting Example Topology to Aurora cluster

Now you can submit a topology to the aurora cluster. this can be done with the following command.

```bash
$ heron submit devcluster/heronuser/devel --config-path ~/.heron/conf/ ~/.heron/examples/heron-examples.jar com.twitter.heron.examples.ExclamationTopology ExclamationTopology
```

Now you should be able to see the topology in the Aurora UI ( http://192.168.33.7:8081/scheduler/heronuser ) .

![Heron topology](/img/aurora-local-topology-submitted.png)

### Understanding the parameters

below is a brief explanation on some of the important parameters that are used in this command. the first
parameter `devcluster/heronuser/devel` defines cluster, role and env ( env can have values `prod | devel | test | staging` ).
The cluster is the name of the aurora cluster which is `devcluster` in our case. You can give something like your
name for the role name and for env you need to choose from one of the env values.

`--config-path` points to the config folder. the program will automatically look for a folder with the cluster name.
This is why you had to change the name of the aurora conf folder to devcluster.

Now that everything is working you need to perform one last step to be able to see the typologies that you can see in Aurora UI in Heron UI.

## Associating new Aurora cluster into Heron UI

Heron UI uses information that is gets from the heron tracker when displaying the information in the heron UI interface.
So in-order to allow the Heron UI to show Aurora cluster information you need to modify configuration of the Heron tracker
so that it can identify the Aurora Cluster.

Heron Tracker configurations are located at `/home/vagrant/.herontools/conf` the configuration file is named `heron_tracker.yaml`.
By default you should see the following in the file

```yaml
statemgrs:
  -
    type: "file"
    name: "local"
    rootpath: "~/.herondata/repository/state/local"
    tunnelhost: "localhost"
  -
    type: "zookeeper"
    name: "localzk"
    hostport: "localhost:2181"
    rootpath: "/heron"
    tunnelhost: "localhost"
```

You can see that there already two entries. Before, you had to create paths in Zookeeper for `/heron/topologies` this is
because the entry named `localzk` in this file. If you remove this you will not need to create that path in Zookeeper.
Now all you have to is to add a new entry for the aurora cluster into this file ( lets comment out `localzk` ).
Then the file would look like below.

```yaml
statemgrs:
  -
    type: "file"
    name: "local"
    rootpath: "~/.herondata/repository/state/local"
    tunnelhost: "localhost"
  #-
   #type: "zookeeper"
   # name: "localzk"
   # hostport: "localhost:2181"
   # rootpath: "/heron"
   # tunnelhost: "localhost"
  -
    type: "zookeeper"
    name: "devcluster"
    hostport: "localhost:2181"
    rootpath: "/heronroot"
    tunnelhost: "localhost"
```

Now you can start Heron tracker and then Heron UI, Now you will be able to see the aurora cluster from the
Heron UI ( http://192.168.33.7:8889/topologies ) as below

```bash
$ heron-tracker
$ heron-ui
```

![Heron topology](/img/heron-ui-topology-submitted.png)


text:
using Domain.DTO;
using GraphQL.Types;

namespace Domain.GraphQLDTO
{
    public class MatterType : ObjectGraphType
    {
        public MatterType(ALBData data)
        {
            Name = "Matter";
            Description = "A legal thingy";

            Field<NonNullGraphType<StringGraphType>>("reference", "The reference of the matter.");
            Field<StringGraphType>("description", "The description of the matter.");
            Field<DebtType>("debt", "The debt information",
                resolve: context => data.GetDebtForMatter(context.Source as Matter));
            IsTypeOf = value => value is Matter;
        }
    }
}


text:
package foam.lib.json;

import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;

import java.lang.reflect.InvocationTargetException;

import foam.core.Model;
import foam.core.Property;
import foam.lib.parse.*;

public class ModelParserFactory {
  private static HashMap<Model, Parser> parsers_ = new HashMap<>();

  public static Parser getInstance(Model m) {
    if ( parsers_.containsKey(m) ) {
      return parsers_.get(m);
    }

    Parser parser = buildInstance_(m);
    parsers_.put(m, parser);
    return parser;
  }

  public static Parser buildInstance_(Model info) {
    List<Property> properties = info.getProperties();

    Parser[] propertyParsers = new Parser[properties.size()];

    Iterator<Property> iter = properties.iterator();
    int i = 0;
    while(iter.hasNext()) {
      propertyParsers[i] = new PropertyParser(iter.next());
      i++;
    }

    // TODO: Don't fail to parse if we find an unknown property.

    return new Repeat0(new Seq0(new Whitespace(),
                                new Literal(","),
                                new Whitespace(),
                                new Alt(propertyParsers)));
  }
}


text:
@implementation UIViewController (AOTToolkitAdditions)

- (void)removeAllChildViewControllers
{
    for (UIViewController *controller in self.childViewControllers)
    {
        [controller.view removeFromSuperview];
        [controller removeFromParentViewController];
    }
}

@end


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using Com.Ericmas001.Windows.ViewModels.Trees;

namespace Com.Ericmas001.Windows.Converters
{
    public class TreeContextMenuVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var items = value as IEnumerable<TreeContextMenuItemViewModel>;
            if (items == null) return Visibility.Visible;

            if (items.Any(x => x.ExecuteCommand.CanExecute(null)))
                return Visibility.Visible;

            return Visibility.Hidden;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}


text:
module Shaddox
	class Config

		# Init ==============================================

		attr_accessor :tasks

		def initialize(doxfile, opts = {})
			doxfile = './Doxfile' unless doxfile
			if !File.exists?(doxfile)
				puts "Doxfile could not be found.".red
				exit(1)
			end

			@tasks = Hash.new
			@pvr = Provisioner.new(opts)

			instance_eval(File.read(doxfile), doxfile)
		end

		# Methods ============================================

		def invoke(task_key)
			begin
				task = @tasks[task_key.to_sym]
				return if task.done
				task.deps.each { |dep| invoke(dep) }
				info "[#{task_key}] Starting..."
				@pvr.run(task.block)
				task.done = true
				info "[#{task_key}] Done".green
			rescue => e
				err "[#{task_key}] Failed".red
				puts e.message.red
				e.backtrace.each { |line| puts line }
			end
		end

		## DSL Methods ##

		# ### Add a task
		#	key can be bound to a list to define dependencies, like with Rake
		#	task :example => :some_dep do ...
		#	task :example => [:dep1, :dep2] do ...
		def task(arg, &block)
			if arg.is_a? Hash
				fail "Task Argument Error" if arg.size != 1
				key, deps = arg.map { |k, v| [k, v] }.first
				@tasks[key] = Task.new(block, deps)
			else
				fail "Task Argument Error" if !arg.is_a? Symbol
				@tasks[arg] = Task.new(block, [])
			end
		end

	end
end


text:
@implementation UIImage (EasyExtend)

- (UIImage *) toGrayscale
{
    const int RED = 1;
    const int GREEN = 2;
    const int BLUE = 3;

    // Create image rectangle with current image width/height
    CGRect imageRect = CGRectMake(0, 0, self.size.width * self.scale, self.size.height * self.scale);

    int width = imageRect.size.width;
    int height = imageRect.size.height;

    // the pixels will be painted to this array
    uint32_t *pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));

    // clear the pixels so any transparency is preserved
    memset(pixels, 0, width * height * sizeof(uint32_t));

    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

    // create a context with RGBA pixels
    CGContextRef context = CGBitmapContextCreate(pixels, width, height, 8, width * sizeof(uint32_t), colorSpace,
                                                 kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedLast);

    // paint the bitmap to our context which will fill in the pixels array
    CGContextDrawImage(context, CGRectMake(0, 0, width, height), [self CGImage]);

    for(int y = 0; y < height; y++) {
        for(int x = 0; x < width; x++) {
            uint8_t *rgbaPixel = (uint8_t *) &pixels[y * width + x];

            // convert to grayscale using recommended method: http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
            uint32_t gray = 0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE];

            // set the pixels to gray
            rgbaPixel[RED] = gray;
            rgbaPixel[GREEN] = gray;
            rgbaPixel[BLUE] = gray;
        }
    }

    // create a new CGImageRef from our context with the modified pixels
    CGImageRef image = CGBitmapContextCreateImage(context);

    // we're done with the context, color space, and pixels
    CGContextRelease(context);
    CGColorSpaceRelease(colorSpace);
    free(pixels);

    // make a new UIImage to return
    UIImage *resultUIImage = [UIImage imageWithCGImage:image
                                                 scale:self.scale
                                           orientation:UIImageOrientationUp];

    // we're done with image now too
    CGImageRelease(image);

    return resultUIImage;
}

- (UIImage *)tintWithColor:(UIColor *)tintColor
{
    // Begin drawing
    CGRect aRect = CGRectMake(0.f, 0.f, self.size.width, self.size.height);
    CGImageRef alphaMask;

    //
    // Compute mask flipping image
    //
    {
        UIGraphicsBeginImageContext(aRect.size);
        CGContextRef c = UIGraphicsGetCurrentContext();

        // draw image
        CGContextTranslateCTM(c, 0, aRect.size.height);
        CGContextScaleCTM(c, 1.0, -1.0);
        [self drawInRect: aRect];

        alphaMask = CGBitmapContextCreateImage(c);

        UIGraphicsEndImageContext();
    }

    //
    UIGraphicsBeginImageContext(aRect.size);

    // Get the graphic context
    CGContextRef c = UIGraphicsGetCurrentContext();

    // Draw the image
    [self drawInRect:aRect];

    // Mask
    CGContextClipToMask(c, aRect, alphaMask);

    // Set the fill color space
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextSetFillColorSpace(c, colorSpace);

    // Set the fill color
    CGContextSetFillColorWithColor(c, tintColor.CGColor);

    UIRectFillUsingBlendMode(aRect, kCGBlendModeNormal);

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    // Release memory
    CGColorSpaceRelease(colorSpace);
    CGImageRelease(alphaMask);

    return img;
}

+ (UIImage *) imageWithUrl:(NSString *)url{
    return [UIImage imageWithData: [NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
}

+ (UIImage *)imageWithColor:(UIColor *)color {
    return [self imageWithColor:color size:CGSizeMake(1,1)];
}

+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size {
    CGRect rect = CGRectMake(0, 0, size.width, size.height);
    UIGraphicsBeginImageContextWithOptions(rect.size,NO,1.0f);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}

+ (UIImage *)resizableImageWithColor:(UIColor *)color cornerRadius:(CGFloat)cornerRadius {
    CGFloat minEdgeSize = cornerRadius * 2 + 1;
    CGRect rect = CGRectMake(0, 0, minEdgeSize, minEdgeSize);
    UIBezierPath *roundedRect = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:cornerRadius];
    roundedRect.lineWidth = 0;
    UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0f);
    [color setFill];
    [roundedRect fill];
    [roundedRect stroke];
    [roundedRect addClip];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return [image resizableImageWithCapInsets:UIEdgeInsetsMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)];
}

- (UIImage *)imageByScalingToMaxSize {
    if (self.size.width < ORIGINAL_MAX_WIDTH) return self;
    CGFloat btWidth = 0.0f;
    CGFloat btHeight = 0.0f;
    if (self.size.width > self.size.height) {
        btHeight = ORIGINAL_MAX_WIDTH;
        btWidth = self.size.width * (ORIGINAL_MAX_WIDTH / self.size.height);
    } else {
        btWidth = ORIGINAL_MAX_WIDTH;
        btHeight = self.size.height * (ORIGINAL_MAX_WIDTH / self.size.width);
    }
    CGSize targetSize = CGSizeMake(btWidth, btHeight);
    return [self imageByScalingAndCroppingToSize:targetSize];
}

- (UIImage *)imageByScalingAndCroppingToSize:(CGSize)targetSize {
    UIImage *newImage = nil;
    CGSize imageSize = self.size;
    CGFloat width = imageSize.width;
    CGFloat height = imageSize.height;
    CGFloat targetWidth = targetSize.width;
    CGFloat targetHeight = targetSize.height;
    CGFloat scaleFactor = 0.0;
    CGFloat scaledWidth = targetWidth;
    CGFloat scaledHeight = targetHeight;
    CGPoint thumbnailPoint = CGPointMake(0.0,0.0);
    if (CGSizeEqualToSize(imageSize, targetSize) == NO)
    {
        CGFloat widthFactor = targetWidth / width;
        CGFloat heightFactor = targetHeight / height;

        if (widthFactor > heightFactor)
            scaleFactor = widthFactor; // scale to fit height
        else
            scaleFactor = heightFactor; // scale to fit width
        scaledWidth  = width * scaleFactor;
        scaledHeight = height * scaleFactor;

        // center the image
        if (widthFactor > heightFactor)
        {
            thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
        }
        else
            if (widthFactor < heightFactor)
            {
                thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
            }
    }
    UIGraphicsBeginImageContext(targetSize); // this will crop
    CGRect thumbnailRect = CGRectZero;
    thumbnailRect.origin = thumbnailPoint;
    thumbnailRect.size.width  = scaledWidth;
    thumbnailRect.size.height = scaledHeight;

    [self drawInRect:thumbnailRect];

    newImage = UIGraphicsGetImageFromCurrentImageContext();
    if(newImage == nil) NSLog(@"could not scale image");

    //pop the context to get back to the default
    UIGraphicsEndImageContext();
    return newImage;
}

-(UIImage*)applyLightEffect
{
    UIColor*tintColor =[UIColor colorWithWhite:1.0 alpha:0.3];
    return[self applyBlurWithRadius:30 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil];
}
-(UIImage*)applyExtraLightEffect
{
    UIColor*tintColor =[UIColor colorWithWhite:0.97 alpha:0.82];
    return[self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil];
}
-(UIImage*)applyDarkEffect
{
    UIColor*tintColor =[UIColor colorWithWhite:0.11 alpha:0.73];
    return[self applyBlurWithRadius:20 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil];
}
-(UIImage*)applyTintEffectWithColor:(UIColor*)tintColor
{
    const CGFloat EffectColorAlpha=0.6;
    UIColor*effectColor = tintColor;
    int componentCount =CGColorGetNumberOfComponents(tintColor.CGColor);
    if(componentCount ==2){
        CGFloat b;
        if([tintColor getWhite:&b alpha:NULL]){
            effectColor =[UIColor colorWithWhite:b alpha:EffectColorAlpha];
        }
    }
    else{
        CGFloat r, g, b;
        if([tintColor getRed:&r green:&g blue:&b alpha:NULL]){
            effectColor =[UIColor colorWithRed:r green:g blue:b alpha:EffectColorAlpha];
        }
    }
    return[self applyBlurWithRadius:10 tintColor:effectColor saturationDeltaFactor:-1.0 maskImage:nil];
}
-(UIImage*)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor*)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage*)maskImage
{
    // Check pre-conditions.
    if(self.size.width <1||self.size.height <1){
        NSLog(@"*** error: invalid size: (%.2f x %.2f). Both dimensions must be >= 1: %@",self.size.width,self.size.height,self);
        return nil;
    }
    if(!self.CGImage){
        NSLog(@"*** error: image must be backed by a CGImage: %@",self);
        return nil;
    }
    if(maskImage &&!maskImage.CGImage){
        NSLog(@"*** error: maskImage must be backed by a CGImage: %@", maskImage);
        return nil;
    }
    CGRect imageRect ={CGPointZero,self.size };
    UIImage*effectImage =self;
    BOOL hasBlur = blurRadius > __FLT_EPSILON__;
    BOOL hasSaturationChange = fabs(saturationDeltaFactor -1.)> __FLT_EPSILON__;
    if(hasBlur || hasSaturationChange){
        UIGraphicsBeginImageContextWithOptions(self.size, NO,[[UIScreen mainScreen] scale]);
        CGContextRef effectInContext =UIGraphicsGetCurrentContext();
        CGContextScaleCTM(effectInContext,1.0,-1.0);
        CGContextTranslateCTM(effectInContext,0,-self.size.height);
        CGContextDrawImage(effectInContext, imageRect,self.CGImage);
        vImage_Buffer effectInBuffer;
        effectInBuffer.data =CGBitmapContextGetData(effectInContext);
        effectInBuffer.width =CGBitmapContextGetWidth(effectInContext);
        effectInBuffer.height =CGBitmapContextGetHeight(effectInContext);
        effectInBuffer.rowBytes =CGBitmapContextGetBytesPerRow(effectInContext);
        UIGraphicsBeginImageContextWithOptions(self.size, NO,[[UIScreen mainScreen] scale]);
        CGContextRef effectOutContext =UIGraphicsGetCurrentContext();
        vImage_Buffer effectOutBuffer;
        effectOutBuffer.data =CGBitmapContextGetData(effectOutContext);
        effectOutBuffer.width =CGBitmapContextGetWidth(effectOutContext);
        effectOutBuffer.height =CGBitmapContextGetHeight(effectOutContext);
        effectOutBuffer.rowBytes =CGBitmapContextGetBytesPerRow(effectOutContext);
        if(hasBlur){
            // A description of how to compute the box kernel width from the Gaussian
            // radius (aka standard deviation) appears in the SVG spec:
            // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement
            //
            // For larger values of 's' (s >= 2.0), an approximation can be used: Three
            // successive box-blurs build a piece-wise quadratic convolution kernel, which
            // approximates the Gaussian kernel to within roughly 3%.
            //
            // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5)
            //
            // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel.
            //
            CGFloat inputRadius = blurRadius *[[UIScreen mainScreen] scale];
            NSUInteger radius = floor(inputRadius *3.* sqrt(2* M_PI)/4+0.5);
            if(radius %2!=1){
                radius +=1;// force radius to be odd so that the three box-blur methodology works.
            }
            vImageBoxConvolve_ARGB8888(&effectInBuffer,&effectOutBuffer, NULL,0,0, radius, radius,0, kvImageEdgeExtend);
            vImageBoxConvolve_ARGB8888(&effectOutBuffer,&effectInBuffer, NULL,0,0, radius, radius,0, kvImageEdgeExtend);
            vImageBoxConvolve_ARGB8888(&effectInBuffer,&effectOutBuffer, NULL,0,0, radius, radius,0, kvImageEdgeExtend);
        }
        BOOL effectImageBuffersAreSwapped = NO;
        if(hasSaturationChange){
            CGFloat s = saturationDeltaFactor;
            CGFloat floatingPointSaturationMatrix[]={
                0.0722+0.9278* s,0.0722-0.0722* s,0.0722-0.0722* s,0,
                0.7152-0.7152* s,0.7152+0.2848* s,0.7152-0.7152* s,0,
                0.2126-0.2126* s,0.2126-0.2126* s,0.2126+0.7873* s,0,
                0,0,0,1,
            };
            const int32_t divisor =256;
            NSUInteger matrixSize =sizeof(floatingPointSaturationMatrix)/sizeof(floatingPointSaturationMatrix[0]);
            int16_t saturationMatrix[matrixSize];
            for(NSUInteger i =0; i < matrixSize;++i){
                saturationMatrix[i]=(int16_t)roundf(floatingPointSaturationMatrix[i]* divisor);
            }
            if(hasBlur){
                vImageMatrixMultiply_ARGB8888(&effectOutBuffer,&effectInBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags);
                effectImageBuffersAreSwapped = YES;
            }
            else{
                vImageMatrixMultiply_ARGB8888(&effectInBuffer,&effectOutBuffer, saturationMatrix, divisor, NULL, NULL, kvImageNoFlags);
            }
        }
        if(!effectImageBuffersAreSwapped)
            effectImage =UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        if(effectImageBuffersAreSwapped)
            effectImage =UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
    }
    // Set up output context.
    UIGraphicsBeginImageContextWithOptions(self.size, NO,[[UIScreen mainScreen] scale]);
    CGContextRef outputContext =UIGraphicsGetCurrentContext();
    CGContextScaleCTM(outputContext,1.0,-1.0);
    CGContextTranslateCTM(outputContext,0,-self.size.height);
    // Draw base image.
    CGContextDrawImage(outputContext, imageRect,self.CGImage);
    // Draw effect image.
    if(hasBlur){
        CGContextSaveGState(outputContext);
        if(maskImage){
            CGContextClipToMask(outputContext, imageRect, maskImage.CGImage);
        }
        CGContextDrawImage(outputContext, imageRect, effectImage.CGImage);
        CGContextRestoreGState(outputContext);
    }
    // Add in color tint.
    if(tintColor){
        CGContextSaveGState(outputContext);
        CGContextSetFillColorWithColor(outputContext, tintColor.CGColor);
        CGContextFillRect(outputContext, imageRect);
        CGContextRestoreGState(outputContext);
    }
    // Output image is ready.
    UIImage*outputImage =UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return outputImage;
}

+ (UIImage *) imageFromData: (NSString *) imgSrc
{
    if ([imgSrc hasPrefix:@"data:"]) {
        NSArray *array = [imgSrc componentsSeparatedByString:@"base64,"];
        NSData *data = [[NSData alloc]initWithBase64EncodedString:[array objectAtIndex:1] options:NSDataBase64DecodingIgnoreUnknownCharacters];
        return [UIImage imageWithData:data];
    }else if([imgSrc hasPrefix:@"http://"] || [imgSrc hasPrefix:@"https://"] ){
        return [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imgSrc]]];
    }else if([UIImage imageNamed:imgSrc]){
        return [UIImage imageNamed:imgSrc];
    }else{
        return nil;
    }
}

- (BOOL) imageHasAlpha
{
    CGImageAlphaInfo alpha = CGImageGetAlphaInfo(self.CGImage);
    return (alpha == kCGImageAlphaFirst ||
            alpha == kCGImageAlphaLast ||
            alpha == kCGImageAlphaPremultipliedFirst ||
            alpha == kCGImageAlphaPremultipliedLast);
}

- (NSString *) image2DataURL
{
    NSData *imageData = nil;
    NSString *mimeType = nil;

    if ([self imageHasAlpha]) {
        imageData = UIImagePNGRepresentation(self);
        mimeType = @"image/png";
    } else {
        imageData = UIImageJPEGRepresentation(self, 1.0f);
        mimeType = @"image/jpeg";
    }
    return [NSString stringWithFormat:@"data:%@;base64,%@", mimeType,
            [imageData base64EncodedStringWithOptions:0]];
}
@end


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package knowledgeModel;

import caseBase.CaseBase;
import decisionTree.DT;
import decisionTree.Proposition;
import decisionTree.PropositionKey;
import decisionTree.Tree;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import singleCase.Case;

/**
 *
 * @author juraj
 */
public class KnowledgeModel {

    public Tree user_tree = new Tree();
    public Tree optimal_tree = new Tree();
    public ArrayList<Proposition> active_tree = new ArrayList<>();

    public CaseBase case_base = new CaseBase();

    public ArrayList<String> diagnoses = new ArrayList<>();                         // Lista ID-jeva dijagnoza
    public HashMap<String, String> concepts_map= new HashMap<>();                   // HashMap: ID koncepta/dijagnoze -> Ime koncepta/dijagnoze

    public void initialize(String DT_text_file, String case_base_URL) throws IOException {

        this.user_tree.initialize(DT_text_file);
        this.case_base.initialize(case_base_URL);

        this.setDiagnoses(this.getUser_tree().getDiagnoses());
        this.setConcepts_map(this.getUser_tree().getConceptsMap());

        // dovoljno je za prvi case provjeriti postoje li u mapi

        // sad prodi po bazi i za svaki atribut i dijagnozu provjeri
        // Sad treba apdejtati popis koncepata i dijagnoza

        // Initialize user_tree
        // Update/add diagnoses, attributes in map, based on existing

    }

    public Tree getUser_tree() {
        return user_tree;
    }

    public void setUser_tree(Tree user_tree) {
        this.user_tree = user_tree;
    }

    public Tree getOptimal_tree() {
        return optimal_tree;
    }

    public void setOptimal_tree(Tree optimal_tree) {
        this.optimal_tree = optimal_tree;
    }

    public ArrayList<Proposition> getActive_tree() {
        return active_tree;
    }

    public void setActive_tree(ArrayList<Proposition> active_tree) {
        this.active_tree = active_tree;
    }

    public CaseBase getCase_base() {
        return case_base;
    }

    public void setCase_base(CaseBase case_base) {
        this.case_base = case_base;
    }

    public ArrayList<String> getDiagnoses() {
        return diagnoses;
    }

    public void setDiagnoses(ArrayList<String> diagnoses) {
        this.diagnoses = diagnoses;
    }

    public HashMap<String, String> getConcepts_map() {
        return concepts_map;
    }

    public void setConcepts_map(HashMap<String, String> concepts_map) {
        this.concepts_map = concepts_map;
    }

}


text:
package uk.gov.hmrc.ct.ct600.v2

import uk.gov.hmrc.ct.box.{CtBoxIdentifier, CtInteger}

case class B17(value: Int) extends CtBoxIdentifier(name = "Allowable losses including losses brought forward") with CtInteger


text:
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_HEAP_HEAP_INL_H_
#define V8_HEAP_HEAP_INL_H_

#include <cmath>

// Clients of this interface shouldn't depend on lots of heap internals.
// Do not include anything from src/heap other than src/heap/heap.h and its
// write barrier here!
#include "src/heap/heap-write-barrier.h"
#include "src/heap/heap.h"

#include "src/base/atomic-utils.h"
#include "src/base/platform/platform.h"
#include "src/counters-inl.h"
#include "src/feedback-vector.h"

// TODO(mstarzinger): There is one more include to remove in order to no longer
// leak heap internals to users of this interface!
#include "src/heap/spaces-inl.h"
#include "src/isolate.h"
#include "src/log.h"
#include "src/msan.h"
#include "src/objects-inl.h"
#include "src/objects/allocation-site-inl.h"
#include "src/objects/api-callbacks-inl.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/literal-objects.h"
#include "src/objects/microtask-queue-inl.h"
#include "src/objects/scope-info.h"
#include "src/objects/script-inl.h"
#include "src/profiler/heap-profiler.h"
#include "src/string-hasher.h"
#include "src/zone/zone-list-inl.h"

// The following header includes the write barrier essentials that can also be
// used stand-alone without including heap-inl.h.
// TODO(mlippautz): Remove once users of object-macros.h include this file on
// their own.
#include "src/heap/heap-write-barrier-inl.h"

namespace v8 {
namespace internal {

AllocationSpace AllocationResult::RetrySpace() {
  DCHECK(IsRetry());
  return static_cast<AllocationSpace>(Smi::ToInt(object_));
}

HeapObject* AllocationResult::ToObjectChecked() {
  CHECK(!IsRetry());
  return HeapObject::cast(object_);
}

#define ROOT_ACCESSOR(type, name, CamelName) \
  type* Heap::name() { return type::cast(roots_[RootIndex::k##CamelName]); }
MUTABLE_ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR

#define ROOT_ACCESSOR(type, name, CamelName)                                   \
  void Heap::set_##name(type* value) {                                         \
    /* The deserializer makes use of the fact that these common roots are */   \
    /* never in new space and never on a page that is being compacted.    */   \
    DCHECK(!deserialization_complete() ||                                      \
           RootCanBeWrittenAfterInitialization(RootIndex::k##CamelName));      \
    DCHECK_IMPLIES(static_cast<int>(RootIndex::k##CamelName) < kOldSpaceRoots, \
                   !InNewSpace(value));                                        \
    roots_[RootIndex::k##CamelName] = value;                                   \
  }
ROOT_LIST(ROOT_ACCESSOR)
#undef ROOT_ACCESSOR

PagedSpace* Heap::paged_space(int idx) {
  DCHECK_NE(idx, LO_SPACE);
  DCHECK_NE(idx, NEW_SPACE);
  return static_cast<PagedSpace*>(space_[idx]);
}

Space* Heap::space(int idx) { return space_[idx]; }

Address* Heap::NewSpaceAllocationTopAddress() {
  return new_space_->allocation_top_address();
}

Address* Heap::NewSpaceAllocationLimitAddress() {
  return new_space_->allocation_limit_address();
}

Address* Heap::OldSpaceAllocationTopAddress() {
  return old_space_->allocation_top_address();
}

Address* Heap::OldSpaceAllocationLimitAddress() {
  return old_space_->allocation_limit_address();
}

void Heap::UpdateNewSpaceAllocationCounter() {
  new_space_allocation_counter_ = NewSpaceAllocationCounter();
}

size_t Heap::NewSpaceAllocationCounter() {
  return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC();
}

AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationSpace space,
                                   AllocationAlignment alignment) {
  DCHECK(AllowHandleAllocation::IsAllowed());
  DCHECK(AllowHeapAllocation::IsAllowed());
  DCHECK(gc_state_ == NOT_IN_GC);
#ifdef V8_ENABLE_ALLOCATION_TIMEOUT
  if (FLAG_random_gc_interval > 0 || FLAG_gc_interval >= 0) {
    if (!always_allocate() && Heap::allocation_timeout_-- <= 0) {
      return AllocationResult::Retry(space);
    }
  }
#endif
#ifdef DEBUG
  isolate_->counters()->objs_since_last_full()->Increment();
  isolate_->counters()->objs_since_last_young()->Increment();
#endif

  bool large_object = size_in_bytes > kMaxRegularHeapObjectSize;
  bool new_large_object = FLAG_young_generation_large_objects &&
                          size_in_bytes > kMaxNewSpaceHeapObjectSize;
  HeapObject* object = nullptr;
  AllocationResult allocation;
  if (NEW_SPACE == space) {
    if (large_object) {
      space = LO_SPACE;
    } else {
      if (new_large_object) {
        allocation = new_lo_space_->AllocateRaw(size_in_bytes);
      } else {
        allocation = new_space_->AllocateRaw(size_in_bytes, alignment);
      }
      if (allocation.To(&object)) {
        OnAllocationEvent(object, size_in_bytes);
      }
      return allocation;
    }
  }

  // Here we only allocate in the old generation.
  if (OLD_SPACE == space) {
    if (large_object) {
      allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
    } else {
      allocation = old_space_->AllocateRaw(size_in_bytes, alignment);
    }
  } else if (CODE_SPACE == space) {
    if (size_in_bytes <= code_space()->AreaSize()) {
      allocation = code_space_->AllocateRawUnaligned(size_in_bytes);
    } else {
      allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE);
    }
  } else if (LO_SPACE == space) {
    DCHECK(large_object);
    allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE);
  } else if (MAP_SPACE == space) {
    allocation = map_space_->AllocateRawUnaligned(size_in_bytes);
  } else if (RO_SPACE == space) {
#ifdef V8_USE_SNAPSHOT
    DCHECK(isolate_->serializer_enabled());
#endif
    DCHECK(!large_object);
    DCHECK(CanAllocateInReadOnlySpace());
    allocation = read_only_space_->AllocateRaw(size_in_bytes, alignment);
  } else {
    // NEW_SPACE is not allowed here.
    UNREACHABLE();
  }

  if (allocation.To(&object)) {
    if (space == CODE_SPACE) {
      // Unprotect the memory chunk of the object if it was not unprotected
      // already.
      UnprotectAndRegisterMemoryChunk(object);
      ZapCodeObject(object->address(), size_in_bytes);
    }
    OnAllocationEvent(object, size_in_bytes);
  }

  return allocation;
}

void Heap::OnAllocationEvent(HeapObject* object, int size_in_bytes) {
  for (auto& tracker : allocation_trackers_) {
    tracker->AllocationEvent(object->address(), size_in_bytes);
  }

  if (FLAG_verify_predictable) {
    ++allocations_count_;
    // Advance synthetic time by making a time request.
    MonotonicallyIncreasingTimeInMs();

    UpdateAllocationsHash(object);
    UpdateAllocationsHash(size_in_bytes);

    if (allocations_count_ % FLAG_dump_allocations_digest_at_alloc == 0) {
      PrintAllocationsHash();
    }
  } else if (FLAG_fuzzer_gc_analysis) {
    ++allocations_count_;
  } else if (FLAG_trace_allocation_stack_interval > 0) {
    ++allocations_count_;
    if (allocations_count_ % FLAG_trace_allocation_stack_interval == 0) {
      isolate()->PrintStack(stdout, Isolate::kPrintStackConcise);
    }
  }
}

void Heap::OnMoveEvent(HeapObject* target, HeapObject* source,
                       int size_in_bytes) {
  HeapProfiler* heap_profiler = isolate_->heap_profiler();
  if (heap_profiler->is_tracking_object_moves()) {
    heap_profiler->ObjectMoveEvent(source->address(), target->address(),
                                   size_in_bytes);
  }
  for (auto& tracker : allocation_trackers_) {
    tracker->MoveEvent(source->address(), target->address(), size_in_bytes);
  }
  if (target->IsSharedFunctionInfo()) {
    LOG_CODE_EVENT(isolate_, SharedFunctionInfoMoveEvent(source->address(),
                                                         target->address()));
  }

  if (FLAG_verify_predictable) {
    ++allocations_count_;
    // Advance synthetic time by making a time request.
    MonotonicallyIncreasingTimeInMs();

    UpdateAllocationsHash(source);
    UpdateAllocationsHash(target);
    UpdateAllocationsHash(size_in_bytes);

    if (allocations_count_ % FLAG_dump_allocations_digest_at_alloc == 0) {
      PrintAllocationsHash();
    }
  } else if (FLAG_fuzzer_gc_analysis) {
    ++allocations_count_;
  }
}

bool Heap::CanAllocateInReadOnlySpace() {
  return !deserialization_complete_ &&
         (isolate()->serializer_enabled() ||
          !isolate()->initialized_from_snapshot());
}

void Heap::UpdateAllocationsHash(HeapObject* object) {
  Address object_address = object->address();
  MemoryChunk* memory_chunk = MemoryChunk::FromAddress(object_address);
  AllocationSpace allocation_space = memory_chunk->owner()->identity();

  STATIC_ASSERT(kSpaceTagSize + kPageSizeBits <= 32);
  uint32_t value =
      static_cast<uint32_t>(object_address - memory_chunk->address()) |
      (static_cast<uint32_t>(allocation_space) << kPageSizeBits);

  UpdateAllocationsHash(value);
}

void Heap::UpdateAllocationsHash(uint32_t value) {
  uint16_t c1 = static_cast<uint16_t>(value);
  uint16_t c2 = static_cast<uint16_t>(value >> 16);
  raw_allocations_hash_ =
      StringHasher::AddCharacterCore(raw_allocations_hash_, c1);
  raw_allocations_hash_ =
      StringHasher::AddCharacterCore(raw_allocations_hash_, c2);
}

void Heap::RegisterExternalString(String* string) {
  DCHECK(string->IsExternalString());
  DCHECK(!string->IsThinString());
  external_string_table_.AddString(string);
}

void Heap::UpdateExternalString(String* string, size_t old_payload,
                                size_t new_payload) {
  DCHECK(string->IsExternalString());
  Page* page = Page::FromHeapObject(string);

  if (old_payload > new_payload)
    page->DecrementExternalBackingStoreBytes(
        ExternalBackingStoreType::kExternalString, old_payload - new_payload);
  else
    page->IncrementExternalBackingStoreBytes(
        ExternalBackingStoreType::kExternalString, new_payload - old_payload);
}

void Heap::FinalizeExternalString(String* string) {
  DCHECK(string->IsExternalString());
  Page* page = Page::FromHeapObject(string);
  ExternalString* ext_string = ExternalString::cast(string);

  page->DecrementExternalBackingStoreBytes(
      ExternalBackingStoreType::kExternalString,
      ext_string->ExternalPayloadSize());

  v8::String::ExternalStringResourceBase** resource_addr =
      reinterpret_cast<v8::String::ExternalStringResourceBase**>(
          reinterpret_cast<byte*>(string) + ExternalString::kResourceOffset -
          kHeapObjectTag);

  // Dispose of the C++ object if it has not already been disposed.
  if (*resource_addr != nullptr) {
    (*resource_addr)->Dispose();
    *resource_addr = nullptr;
  }
}

Address Heap::NewSpaceTop() { return new_space_->top(); }

// static
bool Heap::InNewSpace(Object* object) {
  DCHECK(!HasWeakHeapObjectTag(object));
  return object->IsHeapObject() && InNewSpace(HeapObject::cast(object));
}

// static
bool Heap::InNewSpace(MaybeObject* object) {
  HeapObject* heap_object;
  return object->GetHeapObject(&heap_object) && InNewSpace(heap_object);
}

// static
bool Heap::InNewSpace(HeapObject* heap_object) {
  // Inlined check from NewSpace::Contains.
  bool result = MemoryChunk::FromHeapObject(heap_object)->InNewSpace();
#ifdef DEBUG
  // If in NEW_SPACE, then check we're either not in the middle of GC or the
  // object is in to-space.
  if (result) {
    // If the object is in NEW_SPACE, then it's not in RO_SPACE so this is safe.
    Heap* heap = Heap::FromWritableHeapObject(heap_object);
    DCHECK(heap->gc_state_ != NOT_IN_GC || InToSpace(heap_object));
  }
#endif
  return result;
}

// static
bool Heap::InFromSpace(Object* object) {
  DCHECK(!HasWeakHeapObjectTag(object));
  return object->IsHeapObject() && InFromSpace(HeapObject::cast(object));
}

// static
bool Heap::InFromSpace(MaybeObject* object) {
  HeapObject* heap_object;
  return object->GetHeapObject(&heap_object) && InFromSpace(heap_object);
}

// static
bool Heap::InFromSpace(HeapObject* heap_object) {
  return MemoryChunk::FromHeapObject(heap_object)
      ->IsFlagSet(Page::IN_FROM_SPACE);
}

// static
bool Heap::InToSpace(Object* object) {
  DCHECK(!HasWeakHeapObjectTag(object));
  return object->IsHeapObject() && InToSpace(HeapObject::cast(object));
}

// static
bool Heap::InToSpace(MaybeObject* object) {
  HeapObject* heap_object;
  return object->GetHeapObject(&heap_object) && InToSpace(heap_object);
}

// static
bool Heap::InToSpace(HeapObject* heap_object) {
  return MemoryChunk::FromHeapObject(heap_object)->IsFlagSet(Page::IN_TO_SPACE);
}

bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); }

bool Heap::InReadOnlySpace(Object* object) {
  return read_only_space_->Contains(object);
}

bool Heap::InNewSpaceSlow(Address address) {
  return new_space_->ContainsSlow(address);
}

bool Heap::InOldSpaceSlow(Address address) {
  return old_space_->ContainsSlow(address);
}

// static
Heap* Heap::FromWritableHeapObject(const HeapObject* obj) {
  MemoryChunk* chunk = MemoryChunk::FromHeapObject(obj);
  // RO_SPACE can be shared between heaps, so we can't use RO_SPACE objects to
  // find a heap. The exception is when the ReadOnlySpace is writeable, during
  // bootstrapping, so explicitly allow this case.
  SLOW_DCHECK(chunk->owner()->identity() != RO_SPACE ||
              static_cast<ReadOnlySpace*>(chunk->owner())->writable());
  Heap* heap = chunk->heap();
  SLOW_DCHECK(heap != nullptr);
  return heap;
}

bool Heap::ShouldBePromoted(Address old_address) {
  Page* page = Page::FromAddress(old_address);
  Address age_mark = new_space_->age_mark();
  return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) &&
         (!page->ContainsLimit(age_mark) || old_address < age_mark);
}

void Heap::CopyBlock(Address dst, Address src, int byte_size) {
  CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src),
            static_cast<size_t>(byte_size / kPointerSize));
}

template <Heap::FindMementoMode mode>
AllocationMemento* Heap::FindAllocationMemento(Map* map, HeapObject* object) {
  Address object_address = object->address();
  Address memento_address = object_address + object->SizeFromMap(map);
  Address last_memento_word_address = memento_address + kPointerSize;
  // If the memento would be on another page, bail out immediately.
  if (!Page::OnSamePage(object_address, last_memento_word_address)) {
    return nullptr;
  }
  HeapObject* candidate = HeapObject::FromAddress(memento_address);
  Map* candidate_map = candidate->map();
  // This fast check may peek at an uninitialized word. However, the slow check
  // below (memento_address == top) ensures that this is safe. Mark the word as
  // initialized to silence MemorySanitizer warnings.
  MSAN_MEMORY_IS_INITIALIZED(&candidate_map, sizeof(candidate_map));
  if (candidate_map != ReadOnlyRoots(this).allocation_memento_map()) {
    return nullptr;
  }

  // Bail out if the memento is below the age mark, which can happen when
  // mementos survived because a page got moved within new space.
  Page* object_page = Page::FromAddress(object_address);
  if (object_page->IsFlagSet(Page::NEW_SPACE_BELOW_AGE_MARK)) {
    Address age_mark =
        reinterpret_cast<SemiSpace*>(object_page->owner())->age_mark();
    if (!object_page->Contains(age_mark)) {
      return nullptr;
    }
    // Do an exact check in the case where the age mark is on the same page.
    if (object_address < age_mark) {
      return nullptr;
    }
  }

  AllocationMemento* memento_candidate = AllocationMemento::cast(candidate);

  // Depending on what the memento is used for, we might need to perform
  // additional checks.
  Address top;
  switch (mode) {
    case Heap::kForGC:
      return memento_candidate;
    case Heap::kForRuntime:
      if (memento_candidate == nullptr) return nullptr;
      // Either the object is the last object in the new space, or there is
      // another object of at least word size (the header map word) following
      // it, so suffices to compare ptr and top here.
      top = NewSpaceTop();
      DCHECK(memento_address == top ||
             memento_address + HeapObject::kHeaderSize <= top ||
             !Page::OnSamePage(memento_address, top - 1));
      if ((memento_address != top) && memento_candidate->IsValid()) {
        return memento_candidate;
      }
      return nullptr;
    default:
      UNREACHABLE();
  }
  UNREACHABLE();
}

void Heap::UpdateAllocationSite(Map* map, HeapObject* object,
                                PretenuringFeedbackMap* pretenuring_feedback) {
  DCHECK_NE(pretenuring_feedback, &global_pretenuring_feedback_);
  DCHECK(
      InFromSpace(object) ||
      (InToSpace(object) && Page::FromAddress(object->address())
                                ->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION)) ||
      (!InNewSpace(object) && Page::FromAddress(object->address())
                                  ->IsFlagSet(Page::PAGE_NEW_OLD_PROMOTION)));
  if (!FLAG_allocation_site_pretenuring ||
      !AllocationSite::CanTrack(map->instance_type()))
    return;
  AllocationMemento* memento_candidate =
      FindAllocationMemento<kForGC>(map, object);
  if (memento_candidate == nullptr) return;

  // Entering cached feedback is used in the parallel case. We are not allowed
  // to dereference the allocation site and rather have to postpone all checks
  // till actually merging the data.
  Address key = memento_candidate->GetAllocationSiteUnchecked();
  (*pretenuring_feedback)[reinterpret_cast<AllocationSite*>(key)]++;
}

Isolate* Heap::isolate() {
  return reinterpret_cast<Isolate*>(
      reinterpret_cast<intptr_t>(this) -
      reinterpret_cast<size_t>(reinterpret_cast<Isolate*>(16)->heap()) + 16);
}

void Heap::ExternalStringTable::AddString(String* string) {
  DCHECK(string->IsExternalString());
  DCHECK(!Contains(string));

  if (InNewSpace(string)) {
    new_space_strings_.push_back(string);
  } else {
    old_space_strings_.push_back(string);
  }
}

Oddball* Heap::ToBoolean(bool condition) {
  ReadOnlyRoots roots(this);
  return condition ? roots.true_value() : roots.false_value();
}

uint64_t Heap::HashSeed() {
  uint64_t seed;
  hash_seed()->copy_out(0, reinterpret_cast<byte*>(&seed), kInt64Size);
  DCHECK(FLAG_randomize_hashes || seed == 0);
  return seed;
}

int Heap::NextScriptId() {
  int last_id = last_script_id()->value();
  if (last_id == Smi::kMaxValue) last_id = v8::UnboundScript::kNoScriptId;
  last_id++;
  set_last_script_id(Smi::FromInt(last_id));
  return last_id;
}

int Heap::NextDebuggingId() {
  int last_id = last_debugging_id()->value();
  if (last_id == DebugInfo::DebuggingIdBits::kMax) {
    last_id = DebugInfo::kNoDebuggingId;
  }
  last_id++;
  set_last_debugging_id(Smi::FromInt(last_id));
  return last_id;
}

int Heap::GetNextTemplateSerialNumber() {
  int next_serial_number = next_template_serial_number()->value() + 1;
  set_next_template_serial_number(Smi::FromInt(next_serial_number));
  return next_serial_number;
}

int Heap::MaxNumberToStringCacheSize() const {
  // Compute the size of the number string cache based on the max newspace size.
  // The number string cache has a minimum size based on twice the initial cache
  // size to ensure that it is bigger after being made 'full size'.
  size_t number_string_cache_size = max_semi_space_size_ / 512;
  number_string_cache_size =
      Max(static_cast<size_t>(kInitialNumberStringCacheSize * 2),
          Min<size_t>(0x4000u, number_string_cache_size));
  // There is a string and a number per entry so the length is twice the number
  // of entries.
  return static_cast<int>(number_string_cache_size * 2);
}

void Heap::IncrementExternalBackingStoreBytes(ExternalBackingStoreType type,
                                              size_t amount) {
  base::CheckedIncrement(&backing_store_bytes_, amount);
  // TODO(mlippautz): Implement interrupt for global memory allocations that can
  // trigger garbage collections.
}

void Heap::DecrementExternalBackingStoreBytes(ExternalBackingStoreType type,
                                              size_t amount) {
  base::CheckedDecrement(&backing_store_bytes_, amount);
}

AlwaysAllocateScope::AlwaysAllocateScope(Isolate* isolate)
    : heap_(isolate->heap()) {
  heap_->always_allocate_scope_count_++;
}

AlwaysAllocateScope::~AlwaysAllocateScope() {
  heap_->always_allocate_scope_count_--;
}

CodeSpaceMemoryModificationScope::CodeSpaceMemoryModificationScope(Heap* heap)
    : heap_(heap) {
  if (heap_->write_protect_code_memory()) {
    heap_->increment_code_space_memory_modification_scope_depth();
    heap_->code_space()->SetReadAndWritable();
    LargePage* page = heap_->lo_space()->first_page();
    while (page != nullptr) {
      if (page->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
        CHECK(heap_->memory_allocator()->IsMemoryChunkExecutable(page));
        page->SetReadAndWritable();
      }
      page = page->next_page();
    }
  }
}

CodeSpaceMemoryModificationScope::~CodeSpaceMemoryModificationScope() {
  if (heap_->write_protect_code_memory()) {
    heap_->decrement_code_space_memory_modification_scope_depth();
    heap_->code_space()->SetReadAndExecutable();
    LargePage* page = heap_->lo_space()->first_page();
    while (page != nullptr) {
      if (page->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
        CHECK(heap_->memory_allocator()->IsMemoryChunkExecutable(page));
        page->SetReadAndExecutable();
      }
      page = page->next_page();
    }
  }
}

CodePageCollectionMemoryModificationScope::
    CodePageCollectionMemoryModificationScope(Heap* heap)
    : heap_(heap) {
  if (heap_->write_protect_code_memory() &&
      !heap_->code_space_memory_modification_scope_depth()) {
    heap_->EnableUnprotectedMemoryChunksRegistry();
  }
}

CodePageCollectionMemoryModificationScope::
    ~CodePageCollectionMemoryModificationScope() {
  if (heap_->write_protect_code_memory() &&
      !heap_->code_space_memory_modification_scope_depth()) {
    heap_->ProtectUnprotectedMemoryChunks();
    heap_->DisableUnprotectedMemoryChunksRegistry();
  }
}

CodePageMemoryModificationScope::CodePageMemoryModificationScope(
    MemoryChunk* chunk)
    : chunk_(chunk),
      scope_active_(chunk_->heap()->write_protect_code_memory() &&
                    chunk_->IsFlagSet(MemoryChunk::IS_EXECUTABLE)) {
  if (scope_active_) {
    DCHECK(chunk_->owner()->identity() == CODE_SPACE ||
           (chunk_->owner()->identity() == LO_SPACE &&
            chunk_->IsFlagSet(MemoryChunk::IS_EXECUTABLE)));
    chunk_->SetReadAndWritable();
  }
}

CodePageMemoryModificationScope::~CodePageMemoryModificationScope() {
  if (scope_active_) {
    chunk_->SetReadAndExecutable();
  }
}

}  // namespace internal
}  // namespace v8

#endif  // V8_HEAP_HEAP_INL_H_


text:
package cn.newcapec.function.ecardcity.om.controller;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.newcapec.framework.core.exception.asserts.Assert;
import cn.newcapec.framework.core.exception.asserts.AssertObject;
import cn.newcapec.framework.core.handler.MultiViewResource;
import cn.newcapec.framework.core.rest.Msg;
import cn.newcapec.framework.core.utils.jsonUtils.JSONTools;
import cn.newcapec.function.ecardcity.om.biz.NetSiteClearingRateService;
import cn.newcapec.function.ecardcity.om.biz.NetSiteService;
import cn.newcapec.function.ecardcity.om.model.NetSiteClearingRate;
import cn.newcapec.function.ecardcity.om.utils.Constant;
import cn.newcapec.function.ecardcity.om.utils.DateUtil;

/**
 * @author wj
 * @category 网点结算费率设置Controller
 * @version 1.0
 * @date 2014年5月15日 下午4:00:00
 */
@Controller
@Scope("prototype")
@RequestMapping(value = "/netsiteClearingRate")
@SuppressWarnings("all")
public class NetSiteClearingRateController extends MultiViewResource {
    @Autowired
    private NetSiteClearingRateService objService;
    @Autowired
    private NetSiteService netSiteService;

    /**
     * 费率设置入口
     * @param	modelMap	map模型
     * @return	ModelAndView
     */
    @RequestMapping(value = "edit")
    public ModelAndView edit(ModelMap modelMap) {
	//网点列表
	modelMap.put("netsiteList", getNetSiteList());
	return  toView(getUrl("netsite.netsiteclearingrate.edit"), modelMap);
    }

    /**
     * 保存
     * @return	Msg
     */
    @RequestMapping(value = "save", method = RequestMethod.POST)
    @ResponseBody
    public Msg save() {
	return doExpAssert(new AssertObject() {
	    @Override
	    public void AssertMethod(Msg msg) {
		Assert.isTrue(null != getJsonObject(), "参数传入失败!");
		NetSiteClearingRate obj = JSONTools.JSONToBean(getJsonObject(), NetSiteClearingRate.class);
		Assert.isTrue(StringUtils.isNotBlank(obj.getNetsiteid()), "请先选择网点!");
		if(obj.getFlag().equals("0")){
		    //固定收付(按交易次数)
		    Assert.isTrue(StringUtils.isNotBlank(String.valueOf(obj.getFeepersale())), "请输入每笔交易收费金额!");
		    Assert.isTrue(!obj.getFeepersale().equals("0"), "每笔交易收费金额不能为0!");
		    obj.setFeepersale(new BigDecimal(obj.getFeepersale()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		    obj.setCurrencyrates("0");
		}else{
		    //按金额收费
		    Assert.isTrue(StringUtils.isNotBlank(String.valueOf(obj.getCurrencyrates())), "请输入交易金额收费比列!");
		    Assert.isTrue(!obj.getCurrencyrates().equals("0"), "交易金额收费比列不能为0!");
		    obj.setCurrencyrates(new BigDecimal(obj.getCurrencyrates()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
		    obj.setFeepersale("0");
		}
		Assert.isTrue(StringUtils.isNotBlank(String.valueOf(obj.getTransferratesofbank())), "请输入银行转账费率!");
		obj.setTransferratesofbank(new BigDecimal(obj.getTransferratesofbank()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());

		//TODO 需要更改为从session中获取
		obj.setEdit_person("admin");
		obj.setEdit_date(new Date());
		objService.saveOrUpdate(obj);
		msg.setMsg("保存成功!");
	    }
	});
    }

    /**
     * ajax获取当前网点费率设置数据
     * @return	Msg
     */
    @RequestMapping(value = "ajaxGetClearingRate",method=RequestMethod.POST)
    @ResponseBody
    public Msg ajaxGetClearingRate() {
	return doExpAssert(new AssertObject() {
	    @Override
	    public void AssertMethod(Msg msg) {
		Assert.isTrue(StringUtils.isNotBlank(getJsonObject().getString("netsiteid")), "请先选择网点!");
		String netSiteId=getJsonObject().getString("netsiteid");
		NetSiteClearingRate obj=objService.getByNetSiteID(netSiteId);
		//如果为null,则创建一个默认
		JSONObject json=new JSONObject();
		json.put("netsiteid" ,netSiteId);
		if(obj==null){
		    json.put("id" ,"");
		    json.put("flag" ,"0");
		    json.put("feepersale" ,"0");
		    json.put("currencyrates" ,"0");
		    json.put("edit_person" ,"");
		    json.put("edit_date" ,"");
		}else{
		    json.put("id" ,obj.getId());
		    json.put("flag" ,obj.getFlag());
		    json.put("feepersale" ,obj.getFeepersale());
		    json.put("currencyrates" ,obj.getCurrencyrates());
		    json.put("transferratesofbank" ,obj.getTransferratesofbank());
		    json.put("edit_person" ,obj.getEdit_person());
		    json.put("edit_date" ,DateUtil.formatDate(obj.getEdit_date(),DateUtil.FULL_DATE_FORMAT));
		}
		msg.setData(json.toString());
	    }
	});
    }

    /**
     * 网点列表
     * @return	List
     */
    private List getNetSiteList(){
	Map<String, Object> attrMap=new HashMap<String, Object>();
	attrMap.put("status", Constant.RECORD_DEL_NOT);
	return netSiteService.getList(attrMap);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

     <!-- 这时候不能使用background,只能使用src要不scaleType会不起作用-->
    <ImageView
        android:id="@+id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/a"
        android:scaleType="fitXY"/>

</LinearLayout>


text:
namespace content {

class CONTENT_EXPORT V4L2JpegDecodeAccelerator
    : public media::JpegDecodeAccelerator {
 public:
  V4L2JpegDecodeAccelerator(
      const scoped_refptr<V4L2Device>& device,
      const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
  ~V4L2JpegDecodeAccelerator() override;

  // media::JpegDecodeAccelerator implementation.
  bool Initialize(Client* client) override;
  void Decode(const media::BitstreamBuffer& bitstream_buffer,
              const scoped_refptr<media::VideoFrame>& video_frame) override;
  bool IsSupported() override;

 private:
  // Record for input/output buffers.
  struct BufferRecord {
    BufferRecord();
    ~BufferRecord();
    void* address;          // mmap() address.
    size_t length;          // mmap() length.

    // Set true during QBUF and DQBUF. |address| will be accessed by hardware.
    bool at_device;
  };

  // Job record. Jobs are processed in a FIFO order. This is separate from
  // BufferRecord of input, because a BufferRecord of input may be returned
  // before we dequeue the corresponding output buffer. It can't always be
  // associated with a BufferRecord of output immediately either, because at
  // the time of submission we may not have one available (and don't need one
  // to submit input to the device).
  struct JobRecord {
    JobRecord(media::BitstreamBuffer bitstream_buffer,
              scoped_refptr<media::VideoFrame> video_frame);
    ~JobRecord();

    // Input image buffer.
    media::BitstreamBuffer bitstream_buffer;
    // Output frame buffer.
    scoped_refptr<media::VideoFrame> out_frame;
    // Memory mapped from |bitstream_buffer|.
    scoped_ptr<base::SharedMemory> shm;
  };

  void EnqueueInput();
  void EnqueueOutput();
  void Dequeue();
  bool EnqueueInputRecord();
  bool EnqueueOutputRecord();
  bool CreateInputBuffers();
  bool CreateOutputBuffers();
  void DestroyInputBuffers();
  void DestroyOutputBuffers();
  void ResetQueues();

  // Return the number of input/output buffers enqueued to the device.
  size_t InputBufferQueuedCount();
  size_t OutputBufferQueuedCount();

  // Return true if input buffer should be re-created.
  bool ShouldRecreateInputBuffers();
  // Return true if output buffer should be re-created.
  bool ShouldRecreateOutputBuffers();
  // Create input and output buffer if needed. Return false means that an error
  // has happened.
  bool CreateBuffersIfNecessary();

  void VideoFrameReady(int32_t bitstream_buffer_id);
  void NotifyError(int32_t bitstream_buffer_id, Error error);
  void PostNotifyError(int32_t bitstream_buffer_id, Error error);

  // Run on |decoder_thread_| to enqueue the coming frame.
  void DecodeTask(scoped_ptr<JobRecord> job_record);

  // Run on |decoder_thread_| to dequeue last frame and enqueue next frame.
  // This task is triggered by DevicePollTask.
  void ServiceDeviceTask();

  // Start/Stop |device_poll_thread_|.
  void StartDevicePoll();
  bool StopDevicePoll();

  // Run on |device_poll_thread_| to wait for device events.
  void DevicePollTask();

  // Run on |decoder_thread_| to destroy input and output buffers.
  void DestroyTask();

  // The number of input buffers and output buffers.
  const size_t kBufferCount = 2;

  // Current image size used for checking the size is changed.
  gfx::Size image_coded_size_;

  // Set true when input or output buffers have to be re-allocated.
  bool recreate_input_buffers_pending_;
  bool recreate_output_buffers_pending_;

  // ChildThread's task runner.
  scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_;

  // GPU IO task runner.
  scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;

  // The client of this class.
  Client* client_;

  // The V4L2Device this class is operating upon.
  scoped_refptr<V4L2Device> device_;

  // Thread to communicate with the device.
  base::Thread decoder_thread_;
  // Decode task runner.
  scoped_refptr<base::SingleThreadTaskRunner> decoder_task_runner_;
  // Thread used to poll the V4L2 for events only.
  base::Thread device_poll_thread_;
  // Device poll task runner.
  scoped_refptr<base::SingleThreadTaskRunner> device_poll_task_runner_;

  // All the below members except |weak_factory_| are accessed from
  // |decoder_thread_| only (if it's running).
  std::queue<linked_ptr<JobRecord>> input_jobs_;
  std::queue<linked_ptr<JobRecord>> running_jobs_;

  // Input queue state.
  bool input_streamon_;
  // Mapping of int index to an input buffer record.
  std::vector<BufferRecord> input_buffer_map_;
  // Indices of input buffers ready to use; LIFO since we don't care about
  // ordering.
  std::vector<int> free_input_buffers_;

  // Output queue state.
  bool output_streamon_;
  // Mapping of int index to an output buffer record.
  std::vector<BufferRecord> output_buffer_map_;
  // Indices of output buffers ready to use; LIFO since we don't care about
  // ordering.
  std::vector<int> free_output_buffers_;

  // Weak factory for producing weak pointers on the child thread.
  base::WeakPtrFactory<V4L2JpegDecodeAccelerator> weak_factory_;
  // Point to |this| for use in posting tasks from the decoder thread back to
  // the ChildThread.
  base::WeakPtr<V4L2JpegDecodeAccelerator> weak_ptr_;

  DISALLOW_COPY_AND_ASSIGN(V4L2JpegDecodeAccelerator);
};

}  // namespace content

#endif  // CONTENT_COMMON_GPU_MEDIA_V4L2_JPEG_DECODE_ACCELERATOR_H_


text:
package org.jhove2.app.util.documenter;

import org.jhove2.core.JHOVE2Exception;
import org.jhove2.core.reportable.Reportable;

/**
 * Interface for classes that generate data for module specifications
 * @author smorrissey
 *
 */
public interface ModuleDocumenter {
	public void documentModule(Reportable reportable)
	throws JHOVE2Exception;
}


text:
Install [Calibre](http://calibre-ebook.com/), an ebook manager for Mac

## Usage

```puppet
include calibre
```

## Required Puppet Modules

* `boxen`

## Development

Write code. Run `script/cibuild` to test it. Check the `script`
directory for other useful tools.


text:
#pragma once

namespace fuse {
  /**
   * Partially apply a function with some fixed arguments.
   *
   * @tparam Func The function to partially apply
   * @tparam Arg The fixed arguments, in order.
   */
  template <template <class First, class...Rest> class Func, class...Arg>
  struct apply {
    /**
     * Get the type of the partial function.
     */
    template <class...Args>
    using type = Func<Arg..., Args...>;
  };

  /**
   * Return the result of applying a function to every element of a sequence.
   *
   * @tparam Func The function to apply
   * @tparam Seq The sequence to map over
   */
  template <template <class> class Func, class Seq>
  struct map {
    /**
     * The resulting sequence of the map.
     */
    using type = seq<
      typename Func<typename Seq::head>::type,
      typename map<Func, typename Seq::tail>::type
    >;
  };

  /**
   * Base case specialisation for map. The map of an empty sequence is an
   * empty sequence.
   */
  template <template <class> class Func>
  struct map<Func, empty_seq> {
    using type = empty_seq;
  };

  /**
   * Return the result of left reducing a sequence using a binary function.
   *
   * @tparam Func The function to apply
   * @tparam Seq The sequence to reduce
   */
  template <template <class...> class Func, class Seq>
  struct reduce {
    using type =
      typename Func<typename Seq::head, typename reduce<Func, typename Seq::tail>::type>::type;
  };

  /**
   * Base case specialisation for reduce for sequences of size two.
   */
  template <template <class...> class Func, class Penultimate, class Last>
  struct reduce<Func, seq<Penultimate, seq<Last, empty_seq>>> {
    using type = typename Func<Penultimate, Last>::type;
  };

  /**
   * Get all elements of a sequence for which a predicate function is true.
   *
   * @tparam Func The predicate function
   * @tparam Seq The sequence to filter
   */
  template <template <class> class Func, class Seq>
  struct filter {
    using type = typename std::conditional<
      Func<typename Seq::head>::value,
      seq<typename Seq::head, typename filter<Func, typename Seq::tail>::type>,
      typename filter<Func, typename Seq::tail>::type
    >::type;
  };

  /**
   * Base case specialisation for filter. Filtering an empty list gives an empty list.
   */
  template <template <class> class Func>
  struct filter<Func, empty_seq> {
    using type = empty_seq;
  };
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Annales de la Société des Sciences Naturelles et d'Archéologie de Toulon et du Var 183: 9 (1969)

#### Original name
Crumenula abietina Lagerb., 1949

### Remarks
null


text:
AirCastSample
=============

A sample project to help you set up your Air cast application

Don't forget to register for cast developer liscence and create a receiver app,
then add your app id in Config.as