text:
package jk_5.nailed.server.world;

import jk_5.nailed.api.map.Map;
import jk_5.nailed.api.util.Location;
import jk_5.nailed.api.world.WorldProvider;
import jk_5.nailed.server.world.voidgen.ChunkProviderVoid;
import jk_5.nailed.server.world.voidgen.WorldChunkManagerVoid;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.*;

public class DelegatingWorldProvider extends net.minecraft.world.WorldProvider {

    private final WorldProvider wrapped;

    private int dimId;
    private jk_5.nailed.api.world.World world;
    private Map map;

    public DelegatingWorldProvider(WorldProvider wrapped){
        this.wrapped = wrapped;
    }

    @Override
    public String getDimensionName() {
        return "DIM" + wrapped.getId();
    }

    @Override
    public void setDimension(int dimensionId) {
        this.dimId = dimensionId;
        wrapped.setId(dimensionId);
        super.setDimension(dimensionId);
    }

    @Override
    public IChunkProvider createChunkGenerator() {
        if(wrapped.getType().equals("overworld")){
            return new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), ""); //TODO: is the "" correct? Extra options
        }else if(wrapped.getType().equals("void")){
            return new ChunkProviderVoid(this.worldObj);
        }else if(wrapped.getType().equals("nether")){
            return new ChunkProviderHell(this.worldObj, false, this.worldObj.getSeed()); //True to generate nether fortresses
        }else if(wrapped.getType().equals("end")){
            return new ChunkProviderEnd(this.worldObj, this.worldObj.getSeed());
        }else if(wrapped.getType().equals("flat")){
            return new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.wrapped.getOptions());
        }else{
            throw new IllegalArgumentException("Unknown world type " + this.wrapped.getType());
        }
    }

    @Override
    protected void registerWorldChunkManager() {
        if(wrapped.getType().equals("overworld")){
            this.worldChunkMgr = new WorldChunkManager(this.worldObj);
        }else if(wrapped.getType().equals("void")){
            this.worldChunkMgr = new WorldChunkManagerVoid(this.worldObj);
        }else if(wrapped.getType().equals("nether")){
            this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.hell, 0.0F);
            this.isHellWorld = true;
            this.hasNoSky = true;
        }else if(wrapped.getType().equals("end")){
            this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.0F);
            this.hasNoSky = true;
        }else if(wrapped.getType().equals("flat")){
            FlatGeneratorInfo info = FlatGeneratorInfo.createFlatGeneratorFromString(this.wrapped.getOptions());
            this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiome(info.getBiome()), 0.5F);
        }else{
            throw new IllegalArgumentException("Unknown world type " + this.wrapped.getType());
        }
    }

    @Override
    public Location getSpawnPoint() {
        //TODO: check worldborder interference
        return this.getWorld().getConfig().spawnPoint();
    }

    @Override
    public String getInternalNameSuffix() {
        return "";
    }

    public jk_5.nailed.api.world.World getWorld(){
        if(this.world == null){
            this.world = NailedDimensionManager.instance().getWorld(this.dimId);
        }
        return this.world;
    }

    public Map getMap(){
        if(this.map == null){
            this.map = this.getWorld().getMap();
        }
        return this.map;
    }

    public WorldProvider getWrapped() {
        return wrapped;
    }
}


text:
using System;
using System.Linq;

using Android.App;
using Android.Content;
using Android.Runtime;
using TinyIoC;
using System.Collections.Generic;

namespace AndroidGitHubContributeNotifier.Model.Services
{
    [Service(Name = "com.YLiohenki.GitHubContributeNotifier.NotificationService")]
    [IntentFilter(new String[] { "com.YLiohenki.GitHubContributeNotifier.NotificationIntent" })]
    public class NotificationService : Android.App.IntentService
    {
        IEventsProvider EventsProvider;
        ISettingsProvider SettingsProvider;
        public NotificationService()
        {
            if (!TinyIoCContainer.Current.TryResolve<IEventsProvider>(out this.EventsProvider))
            {
                Bootstrapper.Run();
                this.EventsProvider = TinyIoCContainer.Current.Resolve<IEventsProvider>();
            }
            this.SettingsProvider = TinyIoCContainer.Current.Resolve<ISettingsProvider>();
        }

        [return: GeneratedEnum]
        public override StartCommandResult OnStartCommand(Intent intent, [GeneratedEnum] StartCommandFlags flags, int startId)
        {
            base.OnStartCommand(intent, flags, startId);
            return StartCommandResult.Sticky;
        }

        protected override void OnHandleIntent(Intent intent)
        {
            var settings = this.SettingsProvider.GetSettings();
            if (settings == null || string.IsNullOrWhiteSpace(settings.UserName))
                return;

            var oldEvents = this.EventsProvider.GetEvents(this.ApplicationContext);
            oldEvents = oldEvents !=null ? oldEvents : new List<Event>();
            var todayOldEvents = oldEvents.Where(x => x.Time.Date == DateTime.Now.Date);
            if (todayOldEvents.Count() > 0)
            {
                return;
            }

            this.EventsProvider.Refresh(this.ApplicationContext);
            var events = this.EventsProvider.GetEvents(this.ApplicationContext);
            if (events == null)
                return;
            var todayEvents = events.Where(x => x.Time.Date == DateTime.Now.Date);
            if (todayEvents.Count() < 1 && DateTime.Now >= DateTime.Now.Date.AddHours(settings.HourOfNotification))
            {
                this.ShowNotification("You haven't any commits today.");
            }
        }
        public static int notificationId = 0;
        protected void ShowNotification(string message)
        {
            Notification.Builder builder = new Notification.Builder(this)
                .SetContentTitle("GitHub Contribute - " + this.SettingsProvider.GetSettings().UserName)
                .SetContentText(message)
                .SetSmallIcon(Resource.Drawable.Notification_Icon);

            var settings = this.SettingsProvider.GetSettings();

            builder.SetDefaults((settings.MakeSoundNotification ? NotificationDefaults.Sound : 0) | (settings.VibrateNotification ? NotificationDefaults.Vibrate : 0));

            Notification notification = builder.Build();

            NotificationManager notificationManager =
                GetSystemService(Context.NotificationService) as NotificationManager;

            notificationManager.Notify((int)(DateTime.Now.Date - new DateTime(2000, 1, 1)).TotalDays, notification);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using namespace std;

typedef enum{ FILTER = 0, PROJECT, BNL_JOIN, INL_JOIN, GH_JOIN, AGG, IDX_SCAN, TBL_SCAN } QUERY_OP;

// Return code
typedef int RC;

struct Table {
  string tableName;
  vector<Attribute> columns;

};

// Record Manager
class CLI
{
public:
  static CLI* Instance();

  RC process(const string input);
  RC start();

protected:
  CLI();
  ~CLI();

private:
  // cli parsers
  RC createTable();
  RC createIndex();
  RC dropTable();
  RC dropIndex(const string tableName="", const string columnName="", bool fromCommand=true);
  RC addAttribute();
  RC insertTuple();
  RC dropAttribute();
  RC load();
  RC printTable(const string tableName);
  RC printAttributes();
  RC printIndex();
  RC help(const string input);
  RC history();

  // query parsers
  // code [0,4]: operation number
  // code -1: operation not found
  // code -2: don't call isIterator
  Iterator * query(Iterator *previous, int code=-1);
  Iterator * createBaseScanner(const string token);
  Iterator * projection(Iterator *input);
  Iterator * filter(Iterator *input);
  Iterator * blocknestedloopjoin(Iterator *input);
  Iterator * indexnestedloopjoin(Iterator *input);
  Iterator * gracehashjoin(Iterator *input);
  Iterator * aggregate(Iterator *input);

  // run the query
  RC run(Iterator *);

  RC createProjectAttributes(const string tableName, vector<Attribute> &attrs);
  RC createCondition(const string tableName, Condition &condition, const bool join=false, const string joinTable="");
  RC createAttribute(Iterator *, Attribute &attr);
  RC createAggregateOp(const string operation, AggregateOp &op);

  void addTableNameToAttrs(const string tableName, vector<string> &attrs);
  bool isIterator(const string token, int &code);
  string getTableName(Iterator *it);
  string getAttribute(const string input);
  string fullyQualify(const string attribute, const string tableName);

  // cli catalog functions
  RC getAttributesFromCatalog(const string tableName, vector<Attribute> &columns);
  RC getAttribute(const string tableName, const string attrName, Attribute &attr);
  RC addAttributeToCatalog(const Attribute &attr, const string tableName, const int position);
  RC addTableToCatalog(const string tableName, const string file_url, const string type);
  RC addIndexToCatalog(const string tableName, const string indexName);

  // helper functions
  char * next();
  bool expect(const string token, const string expected);
  bool expect(const char * token, const string expected);
  string toLower(string input);
  bool checkAttribute(const string tableName, const string columnName, RID &rid, bool searchColumns=true);
  RC error(const string errorMessage);
  RC error(uint errorCode);
  RC printOutputBuffer(vector<string> &buffer, uint mod);
  RC updateOutputBuffer(vector<string> &buffer, void *data, vector<Attribute> &attrs);
  RC insertTupleToDB(const string tableName, const vector<Attribute> attributes, const void *data, unordered_map<int, void *> indexMap);
  RC getAttribute(const string name, const vector<Attribute> pool, Attribute &attr);

  RelationManager * rm;
  static CLI * _cli;
};

#endif


text:
package owltools.ontologyverification.impl;

import static org.junit.Assert.*;

import java.util.Collection;

import org.junit.Test;
import org.semanticweb.owlapi.model.IRI;

import owltools.OWLToolsTestBasics;
import owltools.graph.OWLGraphWrapper;
import owltools.io.ParserWrapper;
import owltools.ontologyverification.CheckWarning;

/**
 * Test for {@link DanglingReferenceCheck}.
 */
public class DanglingReferenceCheckTest extends OWLToolsTestBasics {

	@Test
	public void testDanglingReference() throws Exception {
		ParserWrapper parser = new ParserWrapper();
		IRI iri = IRI.create(getResource("verification/dangling_references.obo").getAbsoluteFile()) ;
		OWLGraphWrapper graph = parser.parseToOWLGraph(iri.toString());

		DanglingReferenceCheck check = new DanglingReferenceCheck();
		Collection<CheckWarning> warnings = check.check(graph, graph.getAllOWLObjects());
		assertEquals(1, warnings.size());
		CheckWarning warning = warnings.iterator().next();
		assertTrue(warning.getIris().contains(IRI.create("http://purl.obolibrary.org/obo/BAR_0001")));
	}

}


text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;

namespace Azure.ResourceManager.MachineLearningServices.Models
{
    public partial class WorkspaceSku
    {
        internal static WorkspaceSku DeserializeWorkspaceSku(JsonElement element)
        {
            Optional<IReadOnlyList<string>> locations = default;
            Optional<IReadOnlyList<ResourceSkuLocationInfo>> locationInfo = default;
            Optional<string> tier = default;
            Optional<string> resourceType = default;
            Optional<string> name = default;
            Optional<IReadOnlyList<SKUCapability>> capabilities = default;
            Optional<IReadOnlyList<Restriction>> restrictions = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("locations"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<string> array = new List<string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    locations = array;
                    continue;
                }
                if (property.NameEquals("locationInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<ResourceSkuLocationInfo> array = new List<ResourceSkuLocationInfo>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceSkuLocationInfo.DeserializeResourceSkuLocationInfo(item));
                    }
                    locationInfo = array;
                    continue;
                }
                if (property.NameEquals("tier"))
                {
                    tier = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resourceType"))
                {
                    resourceType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<SKUCapability> array = new List<SKUCapability>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(SKUCapability.DeserializeSKUCapability(item));
                    }
                    capabilities = array;
                    continue;
                }
                if (property.NameEquals("restrictions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List<Restriction> array = new List<Restriction>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(Restriction.DeserializeRestriction(item));
                    }
                    restrictions = array;
                    continue;
                }
            }
            return new WorkspaceSku(Optional.ToList(locations), Optional.ToList(locationInfo), tier.Value, resourceType.Value, name.Value, Optional.ToList(capabilities), Optional.ToList(restrictions));
        }
    }
}


text:
using System;
using NSubstitute;
using NuSelfUpdate.Tests.Helpers;
using Shouldly;

namespace NuSelfUpdate.Tests.AppUpdaterBehaviour.ApplyPreparedUpdateScenarios
{
    public class PreparedUpdateIsForInstalledAppVersion
    {
        Version _installedVersion;
        IPreparedUpdate _preparedUpdate;
        Exception _exception;
        AppUpdater _appUpdater;

        void GivenAnInstaledVersion()
        {
            _installedVersion = new Version(1, 1);
        }

        void AndGivenAPreparedUpdateForTheInstalledVersion()
        {
            _preparedUpdate = Substitute.For<IPreparedUpdate>();
            _preparedUpdate.Version.Returns(_installedVersion);
        }

        void AndGivenAnAppUpdater()
        {
            _appUpdater = new AppUpdaterBuilder(TestConstants.AppPackageId)
                .SetupWithTestValues(_installedVersion)
                .Build();
        }

        void WhenApplyingPreparedUpdate()
        {
            _exception = Run.CatchingException(() => _appUpdater.ApplyPreparedUpdate(_preparedUpdate));
        }

        void ThenABackwardUpdateExceptionWillBeThrown()
        {
            _exception.ShouldBeTypeOf<BackwardUpdateException>();
            var backwardUpdate = (BackwardUpdateException)_exception;

            backwardUpdate.InstalledVersion.ShouldBe(_installedVersion);
            backwardUpdate.TargetVersion.ShouldBe(_installedVersion);
        }
    }
}


text:
using System.Text;

namespace Sandbox.Utilities
{
    static class StringExtensions
    {
        public static string SeparateTitleCases(this string source, string separator = " ")
        {
            var result = new StringBuilder();
            char previousChar = default(char);

            for (int i = 0; i < source.Length; i++)
            {
                char currentChar = source[i];

                if (char.IsLower(previousChar) && // Previous char is lowercase
                    char.IsUpper(currentChar)) // Current char is uppercase
                {
                    result.Append(separator); // Append separator
                }
                result.Append(currentChar);

                previousChar = currentChar;
            }

            return result.ToString();
        }
    }
}


text:
package ch.sama.sql.query.base;

import ch.sama.sql.dbo.Field;
import ch.sama.sql.dbo.Table;

public class InsertQueryIM implements IQuery {
    private IQueryRenderer renderer;
	private InsertQuery parent;
    private Table table;

    public InsertQueryIM(IQueryRenderer renderer, InsertQuery parent, Table table) {
        this.renderer = renderer;
        this.parent = parent;
        this.table = table;
    }

    @Override
	public IQuery getParent() {
		return parent;
	}

    @Override
    public String getSql() {
        return renderer.render(this);
    }

    @Override
    public IQuery chainTo(IQuery query) {
        return this.parent.chainTo(query);
    }

    public Table getTable() {
        return table;
    }

	public InsertQueryFinal columns(Field... fields) {
        return new InsertQueryFinal(renderer, this, fields);
	}

    public InsertQueryFinal columns(String... fields) {
        Field[] fieldList = new Field[fields.length];
        for (int i = 0; i < fieldList.length; ++i) {
            fieldList[i] = new Field(fields[i]);
        }

        return columns(fieldList);
    }
}


text:
package me.chanjar.weixin.mp.bean.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;

@XStreamAlias("xml")
public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage {

    /**
     *
     */
    private static final long serialVersionUID = 1745902309380113978L;
    @XStreamAlias("Video")
    protected final Video video = new Video();

    public WxMpXmlOutVideoMessage() {
        this.msgType = WxConsts.XML_MSG_VIDEO;
    }

    public String getMediaId() {
        return this.video.getMediaId();
    }

    public void setMediaId(String mediaId) {
        this.video.setMediaId(mediaId);
    }

    public String getTitle() {
        return this.video.getTitle();
    }

    public void setTitle(String title) {
        this.video.setTitle(title);
    }

    public String getDescription() {
        return this.video.getDescription();
    }

    public void setDescription(String description) {
        this.video.setDescription(description);
    }

    @XStreamAlias("Video")
    public static class Video {

        @XStreamAlias("MediaId")
        @XStreamConverter(value = XStreamCDataConverter.class)
        private String mediaId;

        @XStreamAlias("Title")
        @XStreamConverter(value = XStreamCDataConverter.class)
        private String title;

        @XStreamAlias("Description")
        @XStreamConverter(value = XStreamCDataConverter.class)
        private String description;

        public String getMediaId() {
            return this.mediaId;
        }

        public void setMediaId(String mediaId) {
            this.mediaId = mediaId;
        }

        public String getTitle() {
            return this.title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getDescription() {
            return this.description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

    }

}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>ptrack</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="ptablew.html" title="ptablew" />
    <link rel="next" href="puts.html" title="puts" />

          ptrack

          Prev
          Orchestra Opcodes and Operators
           Next

          ptrack

ptrack —
      Tracks the pitch of a signal.

Description

      ptrack takes an input signal, splits it into ihopsize blocks and using a STFT method, extracts an estimated pitch for its fundamental frequency as well as estimating the total amplitude of the signal in dB, relative to full-scale (0dB). The method implies an analysis window size of 2*ihopsize samples (overlaping by 1/2 window), which has to be a power-of-two, between 128 and 8192 (hopsizes between 64 and 4096). Smaller windows will give better time precision, but worse frequency accuracy (esp. in low fundamentals).This opcode is based on an original algorithm by M. Puckette.

Syntax

kcps, kamp ptrack asig, ihopsize[,ipeaks]

Initialization

      ihopsize -- size of the analysis 'hop', in samples, required to be power-of-two (min 64, max 4096).
      This is the period between measurements.

      ipeaks, ihi -- number of spectral peaks to use in the analysis, defaults to 20 (optional)

Performance

      kcps -- estimated pitch in Hz.

      kamp -- estimated amplitude in dB relative to full-scale (0dB) (ie. always <= 0).

      ptrack analyzes the input signal, asig,
      to give a pitch/amplitude pair of outputs, for the fundamental of a monophonic signal.
      The output is updated every sr/ihopsize seconds.

Examples

      Here is an example of the ptrack opcode. This example uses the files ptrack.csd.

            Example 692. Example of the ptrack opcode.

            See the sections Real-time Audio
            and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac   ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o ptrack.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
0dbfs  = 1
nchnls = 2

instr 1

ihop  = p4
aout  diskin2 "fox.wav",1, 0, 1
kf,ka ptrack aout, ihop	; pitch track with different hopsizes
kcps  port kf, 0.01	; smooth freq
kamp  port ka, 0.01	; smooth amp
; drive an oscillator
asig  poscil ampdb(kamp)*0dbfs, kcps, 1
      outs  asig, asig

endin
</CsInstruments>
<CsScore>
; simple sine wave
f 1 0 4096 10 1

i 1 0  5 128
i 1 6  5 512
i 1 12 5 1024
e
</CsScore>
</CsoundSynthesizer>

Credits

            Author: Victor Lazzarini

            NUI, Maynooth.

            Maynooth, Ireland

            March, 2007

New in Csound version 5.05

          Prev

            Up

           Next

          ptablew

            Home

           puts


text:
package org.jkiss.dbeaver.model.impl.app;

import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.secret.DBSValueEncryptor;
import org.jkiss.utils.IOUtils;

import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

/**
 * Default value encryptor.
 *
 * Uses Eclipse secure preferences to read/write secrets.
 */
public class DefaultValueEncryptor implements DBSValueEncryptor {

    public static final String CIPHER_NAME = "AES/CBC/PKCS5Padding";
    public static final String KEY_ALGORITHM = "AES";

    private final SecretKey secretKey;
    private final Cipher cipher;

    public DefaultValueEncryptor(SecretKey secretKey) {
        this.secretKey = secretKey;
        try {
            this.cipher = Cipher.getInstance(CIPHER_NAME);
        } catch (Exception e) {
            throw new IllegalStateException("Internal error during encrypted init", e);
        }
    }

    public static SecretKey makeSecretKeyFromPassword(String password) {
/*
        UUID projectID = getProjectID();
        ByteBuffer bb = ByteBuffer.wrap(new byte[8]);
        bb.putLong(projectID.getMostSignificantBits());
        byte[] salt = bb.array();
        PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 20);
*/

        //PBEKeySpec spec = new PBEKeySpec(password.toCharArray());
        byte[] bytes = password.getBytes(StandardCharsets.UTF_8);
        byte[] passBytes = Arrays.copyOf(bytes, 16);
        return new SecretKeySpec(passBytes, KEY_ALGORITHM);

/*
        try {
            return SecretKeyFactory.getInstance("AES").generateSecret(spec);
        } catch (Throwable e) {
            log.error("Error generating secret key for password", e);
            return null;
        }
*/
    }

    @NotNull
    @Override
    public byte[] encryptValue(@NotNull byte[] value) throws DBException {
        try {
            cipher.init(Cipher.ENCRYPT_MODE, secretKey);
            byte[] iv = cipher.getIV();

            ByteArrayOutputStream resultBuffer = new ByteArrayOutputStream();
            try (CipherOutputStream cipherOut = new CipherOutputStream(resultBuffer, cipher)) {
                resultBuffer.write(iv);
                cipherOut.write(value);
            }
            return resultBuffer.toByteArray();
        } catch (Exception e) {
            throw new DBException("Error encrypting value", e);
        }
    }

    @NotNull
    @Override
    public byte[] decryptValue(@NotNull byte[] value) throws DBException {
        try (InputStream byteStream = new ByteArrayInputStream(value)) {
            byte[] fileIv = new byte[16];
            byteStream.read(fileIv);
            cipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(fileIv));

            try (CipherInputStream cipherIn = new CipherInputStream(byteStream, cipher)) {
                ByteArrayOutputStream resultBuffer = new ByteArrayOutputStream();
                IOUtils.copyStream(cipherIn, resultBuffer);
                return resultBuffer.toByteArray();
            }

        } catch (Exception e) {
            throw new DBException("Error decrypting value", e);
        }
    }

}


text:
'use strict';

/**
 * Copyright 2015 The Incremental DOM Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** */
exports.notifications = {
  /**
   * Called after patch has compleated with any Nodes that have been created
   * and added to the DOM.
   * @type {?function(Array<!Node>)}
   */
  nodesCreated: null,

  /**
   * Called after patch has compleated with any Nodes that have been removed
   * from the DOM.
   * Note it's an applications responsibility to handle any childNodes.
   * @type {?function(Array<!Node>)}
   */
  nodesDeleted: null
};

/**
 * Copyright 2015 The Incremental DOM Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Similar to the built-in Treewalker class, but simplified and allows direct
 * access to modify the currentNode property.
 * @param {!Element|!DocumentFragment} node The root Node of the subtree the
 *     walker should start traversing.
 * @constructor
 */
function TreeWalker(node) {
  /**
   * Keeps track of the current parent node. This is necessary as the traversal
   * methods may traverse past the last child and we still need a way to get
   * back to the parent.
   * @const @private {!Array<!Node>}
   */
  this.stack_ = [];

  /**
   * @const {!Element|!DocumentFragment}
   */
  this.root = node;

  /**
   * @type {?Node}
   */
  this.currentNode = node;
}

/**
 * @return {!Node} The current parent of the current location in the subtree.
 */
TreeWalker.prototype.getCurrentParent = function () {
  return this.stack_[this.stack_.length - 1];
};

/**
 * Changes the current location the firstChild of the current location.
 */
TreeWalker.prototype.firstChild = function () {
  this.stack_.push(this.currentNode);
  this.currentNode = this.currentNode.firstChild;
};

/**
 * Changes the current location the nextSibling of the current location.
 */
TreeWalker.prototype.nextSibling = function () {
  this.currentNode = this.currentNode.nextSibling;
};

/**
 * Changes the current location the parentNode of the current location.
 */
TreeWalker.prototype.parentNode = function () {
  this.currentNode = this.stack_.pop();
};

/**
 * Keeps track of the state of a patch.
 * @param {!Element|!DocumentFragment} node The root Node of the subtree the
 *     is for.
 * @param {?Context} prevContext The previous context.
 * @constructor
 */
function Context(node, prevContext) {
  /**
   * @const {TreeWalker}
   */
  this.walker = new TreeWalker(node);

  /**
   * @const {Document}
   */
  this.doc = node.ownerDocument;

  /**
   * Keeps track of what namespace to create new Elements in.
   * @private
   * @const {!Array<(string|undefined)>}
   */
  this.nsStack_ = [undefined];

  /**
   * @const {?Context}
   */
  this.prevContext = prevContext;

  /**
   * @type {(Array<!Node>|undefined)}
   */
  this.created = exports.notifications.nodesCreated && [];

  /**
   * @type {(Array<!Node>|undefined)}
   */
  this.deleted = exports.notifications.nodesDeleted && [];
}

/**
 * @return {(string|undefined)} The current namespace to create Elements in.
 */
Context.prototype.getCurrentNamespace = function () {
  return this.nsStack_[this.nsStack_.length - 1];
};

/**
 * @param {string=} namespace The namespace to enter.
 */
Context.prototype.enterNamespace = function (namespace) {
  this.nsStack_.push(namespace);
};

/**
 * Exits the current namespace
 */
Context.prototype.exitNamespace = function () {
  this.nsStack_.pop();
};

/**
 * @param {!Node} node
 */
Context.prototype.markCreated = function (node) {
  if (this.created) {
    this.created.push(node);
  }
};

/**
 * @param {!Node} node
 */
Context.prototype.markDeleted = function (node) {
  if (this.deleted) {
    this.deleted.push(node);
  }
};

/**
 * Notifies about nodes that were created during the patch opearation.
 */
Context.prototype.notifyChanges = function () {
  if (this.created && this.created.length > 0) {
    exports.notifications.nodesCreated(this.created);
  }

  if (this.deleted && this.deleted.length > 0) {
    exports.notifications.nodesDeleted(this.deleted);
  }
};

/**
 * The current context.
 * @type {?Context}
 */
var context;

/**
 * Enters a new patch context.
 * @param {!Element|!DocumentFragment} node
 */
var enterContext = function (node) {
  context = new Context(node, context);
};

/**
 * Restores the previous patch context.
 */
var restoreContext = function () {
  context = context.prevContext;
};

/**
 * Gets the current patch context.
 * @return {?Context}
 */
var getContext = function () {
  return context;
};

/**
 * Copyright 2015 The Incremental DOM Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * A cached reference to the hasOwnProperty function.
 */
var hasOwnProperty = Object.prototype.hasOwnProperty;

/**
 * A cached reference to the create function.
 */
var create = Object.create;

/**
 * Used to prevent property collisions between our "map" and its prototype.
 * @param {!Object<string, *>} map The map to check.
 * @param {string} property The property to check.
 * @return {boolean} Whether map has property.
 */
var has = function (map, property) {
  return hasOwnProperty.call(map, property);
};

/**
 * Creates an map object without a prototype.
 * @return {!Object}
 */
var createMap = function () {
  return create(null);
};

/**
 * Keeps track of information needed to perform diffs for a given DOM node.
 * @param {!string} nodeName
 * @param {?string=} key
 * @constructor
 */
function NodeData(nodeName, key) {
  /**
   * The attributes and their values.
   * @const
   */
  this.attrs = createMap();

  /**
   * An array of attribute name/value pairs, used for quickly diffing the
   * incomming attributes to see if the DOM node's attributes need to be
   * updated.
   * @const {Array<*>}
   */
  this.attrsArr = [];

  /**
   * The incoming attributes for this Node, before they are updated.
   * @const {!Object<string, *>}
   */
  this.newAttrs = createMap();

  /**
   * The key used to identify this node, used to preserve DOM nodes when they
   * move within their parent.
   * @const
   */
  this.key = key;

  /**
   * Keeps track of children within this node by their key.
   * {?Object<string, !Element>}
   */
  this.keyMap = null;

  /**
   * Whether or not the keyMap is currently valid.
   * {boolean}
   */
  this.keyMapValid = true;

  /**
   * The last child to have been visited within the current pass.
   * @type {?Node}
   */
  this.lastVisitedChild = null;

  /**
   * The node name for this node.
   * @const {string}
   */
  this.nodeName = nodeName;

  /**
   * @type {?string}
   */
  this.text = null;
}

/**
 * Initializes a NodeData object for a Node.
 *
 * @param {Node} node The node to initialize data for.
 * @param {string} nodeName The node name of node.
 * @param {?string=} key The key that identifies the node.
 * @return {!NodeData} The newly initialized data object
 */
var initData = function (node, nodeName, key) {
  var data = new NodeData(nodeName, key);
  node['__incrementalDOMData'] = data;
  return data;
};

/**
 * Retrieves the NodeData object for a Node, creating it if necessary.
 *
 * @param {Node} node The node to retrieve the data for.
 * @return {!NodeData} The NodeData for this Node.
 */
var getData = function (node) {
  var data = node['__incrementalDOMData'];

  if (!data) {
    var nodeName = node.nodeName.toLowerCase();
    var key = null;

    if (node instanceof Element) {
      key = node.getAttribute('key');
    }

    data = initData(node, nodeName, key);
  }

  return data;
};

/**
 * Copyright 2015 The Incremental DOM Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

exports.symbols = {
  default: '__default',

  placeholder: '__placeholder'
};

/**
 * Applies an attribute or property to a given Element. If the value is null
 * or undefined, it is removed from the Element. Otherwise, the value is set
 * as an attribute.
 * @param {!Element} el
 * @param {string} name The attribute's name.
 * @param {?(boolean|number|string)=} value The attribute's value.
 */
exports.applyAttr = function (el, name, value) {
  if (value == null) {
    el.removeAttribute(name);
  } else {
    el.setAttribute(name, value);
  }
};

/**
 * Applies a property to a given Element.
 * @param {!Element} el
 * @param {string} name The property's name.
 * @param {*} value The property's value.
 */
exports.applyProp = function (el, name, value) {
  el[name] = value;
};

/**
 * Applies a style to an Element. No vendor prefix expansion is done for
 * property names/values.
 * @param {!Element} el
 * @param {string} name The attribute's name.
 * @param {string|Object<string,string>} style The style to set. Either a
 *     string of css or an object containing property-value pairs.
 */
var applyStyle = function (el, name, style) {
  if (typeof style === 'string') {
    el.style.cssText = style;
  } else {
    el.style.cssText = '';
    var elStyle = el.style;

    for (var prop in style) {
      if (has(style, prop)) {
        elStyle[prop] = style[prop];
      }
    }
  }
};

/**
 * Updates a single attribute on an Element.
 * @param {!Element} el
 * @param {string} name The attribute's name.
 * @param {*} value The attribute's value. If the value is an object or
 *     function it is set on the Element, otherwise, it is set as an HTML
 *     attribute.
 */
var applyAttributeTyped = function (el, name, value) {
  var type = typeof value;

  if (type === 'object' || type === 'function') {
    exports.applyProp(el, name, value);
  } else {
    exports.applyAttr(el, name, /** @type {?(boolean|number|string)} */value);
  }
};

/**
 * Calls the appropriate attribute mutator for this attribute.
 * @param {!Element} el
 * @param {string} name The attribute's name.
 * @param {*} value The attribute's value.
 */
var updateAttribute = function (el, name, value) {
  var data = getData(el);
  var attrs = data.attrs;

  if (attrs[name] === value) {
    return;
  }

  var mutator = exports.attributes[name] || exports.attributes[exports.symbols.default];
  mutator(el, name, value);

  attrs[name] = value;
};

/**
 * A publicly mutable object to provide custom mutators for attributes.
 * @const {!Object<string, function(!Element, string, *)>}
 */
exports.attributes = createMap();

// Special generic mutator that's called for any attribute that does not
// have a specific mutator.
exports.attributes[exports.symbols.default] = applyAttributeTyped;

exports.attributes[exports.symbols.placeholder] = function () {};

exports.attributes['style'] = applyStyle;

var SVG_NS = 'http://www.w3.org/2000/svg';

/**
 * Enters a tag, checking to see if it is a namespace boundary, and if so,
 * updates the current namespace.
 * @param {string} tag The tag to enter.
 */
var enterTag = function (tag) {
  if (tag === 'svg') {
    getContext().enterNamespace(SVG_NS);
  } else if (tag === 'foreignObject') {
    getContext().enterNamespace(undefined);
  }
};

/**
 * Exits a tag, checking to see if it is a namespace boundary, and if so,
 * updates the current namespace.
 * @param {string} tag The tag to enter.
 */
var exitTag = function (tag) {
  if (tag === 'svg' || tag === 'foreignObject') {
    getContext().exitNamespace();
  }
};

/**
 * Gets the namespace to create an element (of a given tag) in.
 * @param {string} tag The tag to get the namespace for.
 * @return {(string|undefined)} The namespace to create the tag in.
 */
var getNamespaceForTag = function (tag) {
  if (tag === 'svg') {
    return SVG_NS;
  }

  return getContext().getCurrentNamespace();
};

/**
 * Creates an Element.
 * @param {Document} doc The document with which to create the Element.
 * @param {string} tag The tag for the Element.
 * @param {?string=} key A key to identify the Element.
 * @param {?Array<*>=} statics An array of attribute name/value pairs of
 *     the static attributes for the Element.
 * @return {!Element}
 */
var createElement = function (doc, tag, key, statics) {
  var namespace = getNamespaceForTag(tag);
  var el;

  if (namespace) {
    el = doc.createElementNS(namespace, tag);
  } else {
    el = doc.createElement(tag);
  }

  initData(el, tag, key);

  if (statics) {
    for (var i = 0; i < statics.length; i += 2) {
      updateAttribute(el, /** @type {!string}*/statics[i], statics[i + 1]);
    }
  }

  return el;
};

/**
 * Creates a Node, either a Text or an Element depending on the node name
 * provided.
 * @param {Document} doc The document with which to create the Node.
 * @param {string} nodeName The tag if creating an element or #text to create
 *     a Text.
 * @param {?string=} key A key to identify the Element.
 * @param {?Array<*>=} statics The static data to initialize the Node
 *     with. For an Element, an array of attribute name/value pairs of
 *     the static attributes for the Element.
 * @return {!Node}
 */
var createNode = function (doc, nodeName, key, statics) {
  if (nodeName === '#text') {
    return doc.createTextNode('');
  }

  return createElement(doc, nodeName, key, statics);
};

/**
 * Creates a mapping that can be used to look up children using a key.
 * @param {!Node} el
 * @return {!Object<string, !Element>} A mapping of keys to the children of the
 *     Element.
 */
var createKeyMap = function (el) {
  var map = createMap();
  var children = el.children;
  var count = children.length;

  for (var i = 0; i < count; i += 1) {
    var child = children[i];
    var key = getData(child).key;

    if (key) {
      map[key] = child;
    }
  }

  return map;
};

/**
 * Retrieves the mapping of key to child node for a given Element, creating it
 * if necessary.
 * @param {!Node} el
 * @return {!Object<string, !Node>} A mapping of keys to child Elements
 */
var getKeyMap = function (el) {
  var data = getData(el);

  if (!data.keyMap) {
    data.keyMap = createKeyMap(el);
  }

  return data.keyMap;
};

/**
 * Retrieves a child from the parent with the given key.
 * @param {!Node} parent
 * @param {?string=} key
 * @return {?Element} The child corresponding to the key.
 */
var getChild = function (parent, key) {
  return (/** @type {?Element} */key && getKeyMap(parent)[key]
  );
};

/**
 * Registers an element as being a child. The parent will keep track of the
 * child using the key. The child can be retrieved using the same key using
 * getKeyMap. The provided key should be unique within the parent Element.
 * @param {!Node} parent The parent of child.
 * @param {string} key A key to identify the child with.
 * @param {!Node} child The child to register.
 */
var registerChild = function (parent, key, child) {
  getKeyMap(parent)[key] = child;
};

if (process.env.NODE_ENV !== 'production') {
  /**
  * Makes sure that keyed Element matches the tag name provided.
  * @param {!Element} node The node that is being matched.
  * @param {string=} tag The tag name of the Element.
  * @param {?string=} key The key of the Element.
  */
  var assertKeyedTagMatches = function (node, tag, key) {
    var nodeName = getData(node).nodeName;
    if (nodeName !== tag) {
      throw new Error('Was expecting node with key "' + key + '" to be a ' + tag + ', not a ' + nodeName + '.');
    }
  };
}

/**
 * Checks whether or not a given node matches the specified nodeName and key.
 *
 * @param {!Node} node An HTML node, typically an HTMLElement or Text.
 * @param {?string} nodeName The nodeName for this node.
 * @param {?string=} key An optional key that identifies a node.
 * @return {boolean} True if the node matches, false otherwise.
 */
var matches = function (node, nodeName, key) {
  var data = getData(node);

  // Key check is done using double equals as we want to treat a null key the
  // same as undefined. This should be okay as the only values allowed are
  // strings, null and undefined so the == semantics are not too weird.
  return key == data.key && nodeName === data.nodeName;
};

/**
 * Aligns the virtual Element definition with the actual DOM, moving the
 * corresponding DOM node to the correct location or creating it if necessary.
 * @param {string} nodeName For an Element, this should be a valid tag string.
 *     For a Text, this should be #text.
 * @param {?string=} key The key used to identify this element.
 * @param {?Array<*>=} statics For an Element, this should be an array of
 *     name-value pairs.
 * @return {!Node} The matching node.
 */
var alignWithDOM = function (nodeName, key, statics) {
  var context = getContext();
  var walker = context.walker;
  var currentNode = walker.currentNode;
  var parent = walker.getCurrentParent();
  var matchingNode;

  // Check to see if we have a node to reuse
  if (currentNode && matches(currentNode, nodeName, key)) {
    matchingNode = currentNode;
  } else {
    var existingNode = getChild(parent, key);

    // Check to see if the node has moved within the parent or if a new one
    // should be created
    if (existingNode) {
      if (process.env.NODE_ENV !== 'production') {
        assertKeyedTagMatches(existingNode, nodeName, key);
      }

      matchingNode = existingNode;
    } else {
      matchingNode = createNode(context.doc, nodeName, key, statics);

      if (key) {
        registerChild(parent, key, matchingNode);
      }

      context.markCreated(matchingNode);
    }

    // If the node has a key, remove it from the DOM to prevent a large number
    // of re-orders in the case that it moved far or was completely removed.
    // Since we hold on to a reference through the keyMap, we can always add it
    // back.
    if (currentNode && getData(currentNode).key) {
      parent.replaceChild(matchingNode, currentNode);
      getData(parent).keyMapValid = false;
    } else {
      parent.insertBefore(matchingNode, currentNode);
    }

    walker.currentNode = matchingNode;
  }

  return matchingNode;
};

/**
 * Clears out any unvisited Nodes, as the corresponding virtual element
 * functions were never called for them.
 * @param {Node} node
 */
var clearUnvisitedDOM = function (node) {
  var context = getContext();
  var walker = context.walker;
  var data = getData(node);
  var keyMap = data.keyMap;
  var keyMapValid = data.keyMapValid;
  var lastVisitedChild = data.lastVisitedChild;
  var child = node.lastChild;
  var key;

  data.lastVisitedChild = null;

  if (child === lastVisitedChild && keyMapValid) {
    return;
  }

  if (data.attrs[exports.symbols.placeholder] && walker.currentNode !== walker.root) {
    return;
  }

  while (child !== lastVisitedChild) {
    node.removeChild(child);
    context.markDeleted( /** @type {!Node}*/child);

    key = getData(child).key;
    if (key) {
      delete keyMap[key];
    }
    child = node.lastChild;
  }

  // Clean the keyMap, removing any unusued keys.
  for (key in keyMap) {
    child = keyMap[key];
    if (!child.parentNode) {
      context.markDeleted(child);
      delete keyMap[key];
    }
  }

  data.keyMapValid = true;
};

/**
 * Enters an Element, setting the current namespace for nested elements.
 * @param {Node} node
 */
var enterNode = function (node) {
  var data = getData(node);
  enterTag(data.nodeName);
};

/**
 * Exits an Element, unwinding the current namespace to the previous value.
 * @param {Node} node
 */
var exitNode = function (node) {
  var data = getData(node);
  exitTag(data.nodeName);
};

/**
 * Marks node's parent as having visited node.
 * @param {Node} node
 */
var markVisited = function (node) {
  var context = getContext();
  var walker = context.walker;
  var parent = walker.getCurrentParent();
  var data = getData(parent);
  data.lastVisitedChild = node;
};

/**
 * Changes to the first child of the current node.
 */
var firstChild = function () {
  var context = getContext();
  var walker = context.walker;
  enterNode(walker.currentNode);
  walker.firstChild();
};

/**
 * Changes to the next sibling of the current node.
 */
var nextSibling = function () {
  var context = getContext();
  var walker = context.walker;
  markVisited(walker.currentNode);
  walker.nextSibling();
};

/**
 * Changes to the parent of the current node, removing any unvisited children.
 */
var parentNode = function () {
  var context = getContext();
  var walker = context.walker;
  walker.parentNode();
  exitNode(walker.currentNode);
};

if (process.env.NODE_ENV !== 'production') {
  var assertNoUnclosedTags = function (root) {
    var openElement = getContext().walker.getCurrentParent();
    if (!openElement) {
      return;
    }

    var openTags = [];
    while (openElement && openElement !== root) {
      openTags.push(openElement.nodeName.toLowerCase());
      openElement = openElement.parentNode;
    }

    throw new Error('One or more tags were not closed:\n' + openTags.join('\n'));
  };
}

/**
 * Patches the document starting at el with the provided function. This function
 * may be called during an existing patch operation.
 * @param {!Element|!DocumentFragment} node The Element or Document
 *     to patch.
 * @param {!function(T)} fn A function containing elementOpen/elementClose/etc.
 *     calls that describe the DOM.
 * @param {T=} data An argument passed to fn to represent DOM state.
 * @template T
 */
exports.patch = function (node, fn, data) {
  enterContext(node);

  firstChild();
  fn(data);
  parentNode();
  clearUnvisitedDOM(node);

  if (process.env.NODE_ENV !== 'production') {
    assertNoUnclosedTags(node);
  }

  getContext().notifyChanges();
  restoreContext();
};

/**
 * The offset in the virtual element declaration where the attributes are
 * specified.
 * @const
 */
var ATTRIBUTES_OFFSET = 3;

/**
 * Builds an array of arguments for use with elementOpenStart, attr and
 * elementOpenEnd.
 * @const {Array<*>}
 */
var argsBuilder = [];

if (process.env.NODE_ENV !== 'production') {
  /**
   * Keeps track whether or not we are in an attributes declaration (after
   * elementOpenStart, but before elementOpenEnd).
   * @type {boolean}
   */
  var inAttributes = false;

  /** Makes sure that the caller is not where attributes are expected. */
  var assertNotInAttributes = function () {
    if (inAttributes) {
      throw new Error('Was not expecting a call to attr or elementOpenEnd, ' + 'they must follow a call to elementOpenStart.');
    }
  };

  /** Makes sure that the caller is where attributes are expected. */
  var assertInAttributes = function () {
    if (!inAttributes) {
      throw new Error('Was expecting a call to attr or elementOpenEnd. ' + 'elementOpenStart must be followed by zero or more calls to attr, ' + 'then one call to elementOpenEnd.');
    }
  };

  /**
   * Makes sure that placeholders have a key specified. Otherwise, conditional
   * placeholders and conditional elements next to placeholders will cause
   * placeholder elements to be re-used as non-placeholders and vice versa.
   * @param {string} key
   */
  var assertPlaceholderKeySpecified = function (key) {
    if (!key) {
      throw new Error('Placeholder elements must have a key specified.');
    }
  };

  /**
   * Makes sure that tags are correctly nested.
   * @param {string} tag
   */
  var assertCloseMatchesOpenTag = function (tag) {
    var context = getContext();
    var walker = context.walker;
    var closingNode = walker.getCurrentParent();
    var data = getData(closingNode);

    if (tag !== data.nodeName) {
      throw new Error('Received a call to close ' + tag + ' but ' + data.nodeName + ' was open.');
    }
  };

  /** Updates the state to being in an attribute declaration. */
  var setInAttributes = function () {
    inAttributes = true;
  };

  /** Updates the state to not being in an attribute declaration. */
  var setNotInAttributes = function () {
    inAttributes = false;
  };
}

/**
 * @param {string} tag The element's tag.
 * @param {?string=} key The key used to identify this element. This can be an
 *     empty string, but performance may be better if a unique value is used
 *     when iterating over an array of items.
 * @param {?Array<*>=} statics An array of attribute name/value pairs of the
 *     static attributes for the Element. These will only be set once when the
 *     Element is created.
 * @param {...*} var_args Attribute name/value pairs of the dynamic attributes
 *     for the Element.
 * @return {!Element} The corresponding Element.
 */
exports.elementOpen = function (tag, key, statics, var_args) {
  if (process.env.NODE_ENV !== 'production') {
    assertNotInAttributes();
  }

  var node = /** @type {!Element}*/alignWithDOM(tag, key, statics);
  var data = getData(node);

  /*
   * Checks to see if one or more attributes have changed for a given Element.
   * When no attributes have changed, this is much faster than checking each
   * individual argument. When attributes have changed, the overhead of this is
   * minimal.
   */
  var attrsArr = data.attrsArr;
  var attrsChanged = false;
  var i = ATTRIBUTES_OFFSET;
  var j = 0;

  for (; i < arguments.length; i += 1, j += 1) {
    if (attrsArr[j] !== arguments[i]) {
      attrsChanged = true;
      break;
    }
  }

  for (; i < arguments.length; i += 1, j += 1) {
    attrsArr[j] = arguments[i];
  }

  if (j < attrsArr.length) {
    attrsChanged = true;
    attrsArr.length = j;
  }

  /*
   * Actually perform the attribute update.
   */
  if (attrsChanged) {
    var attr,
        newAttrs = data.newAttrs;

    for (attr in newAttrs) {
      newAttrs[attr] = undefined;
    }

    for (i = ATTRIBUTES_OFFSET; i < arguments.length; i += 2) {
      newAttrs[arguments[i]] = arguments[i + 1];
    }

    for (attr in newAttrs) {
      updateAttribute(node, attr, newAttrs[attr]);
    }
  }

  firstChild();
  return node;
};

/**
 * Declares a virtual Element at the current location in the document. This
 * corresponds to an opening tag and a elementClose tag is required. This is
 * like elementOpen, but the attributes are defined using the attr function
 * rather than being passed as arguments. Must be folllowed by 0 or more calls
 * to attr, then a call to elementOpenEnd.
 * @param {string} tag The element's tag.
 * @param {?string=} key The key used to identify this element. This can be an
 *     empty string, but performance may be better if a unique value is used
 *     when iterating over an array of items.
 * @param {?Array<*>=} statics An array of attribute name/value pairs of the
 *     static attributes for the Element. These will only be set once when the
 *     Element is created.
 */
exports.elementOpenStart = function (tag, key, statics) {
  if (process.env.NODE_ENV !== 'production') {
    assertNotInAttributes();
    setInAttributes();
  }

  argsBuilder[0] = tag;
  argsBuilder[1] = key;
  argsBuilder[2] = statics;
};

/***
 * Defines a virtual attribute at this point of the DOM. This is only valid
 * when called between elementOpenStart and elementOpenEnd.
 *
 * @param {string} name
 * @param {*} value
 */
exports.attr = function (name, value) {
  if (process.env.NODE_ENV !== 'production') {
    assertInAttributes();
  }

  argsBuilder.push(name, value);
};

/**
 * Closes an open tag started with elementOpenStart.
 * @return {!Element} The corresponding Element.
 */
exports.elementOpenEnd = function () {
  if (process.env.NODE_ENV !== 'production') {
    assertInAttributes();
    setNotInAttributes();
  }

  var node = exports.elementOpen.apply(null, argsBuilder);
  argsBuilder.length = 0;
  return node;
};

/**
 * Closes an open virtual Element.
 *
 * @param {string} tag The element's tag.
 * @return {!Element} The corresponding Element.
 */
exports.elementClose = function (tag) {
  if (process.env.NODE_ENV !== 'production') {
    assertNotInAttributes();
    assertCloseMatchesOpenTag(tag);
  }

  parentNode();

  var node = /** @type {!Element} */getContext().walker.currentNode;

  clearUnvisitedDOM(node);

  nextSibling();
  return node;
};

/**
 * Declares a virtual Element at the current location in the document that has
 * no children.
 * @param {string} tag The element's tag.
 * @param {?string=} key The key used to identify this element. This can be an
 *     empty string, but performance may be better if a unique value is used
 *     when iterating over an array of items.
 * @param {?Array<*>=} statics An array of attribute name/value pairs of the
 *     static attributes for the Element. These will only be set once when the
 *     Element is created.
 * @param {...*} var_args Attribute name/value pairs of the dynamic attributes
 *     for the Element.
 * @return {!Element} The corresponding Element.
 */
exports.elementVoid = function (tag, key, statics, var_args) {
  var node = exports.elementOpen.apply(null, arguments);
  exports.elementClose.apply(null, arguments);
  return node;
};

/**
 * Declares a virtual Element at the current location in the document that is a
 * placeholder element. Children of this Element can be manually managed and
 * will not be cleared by the library.
 *
 * A key must be specified to make sure that this node is correctly preserved
 * across all conditionals.
 *
 * @param {string} tag The element's tag.
 * @param {string} key The key used to identify this element.
 * @param {?Array<*>=} statics An array of attribute name/value pairs of the
 *     static attributes for the Element. These will only be set once when the
 *     Element is created.
 * @param {...*} var_args Attribute name/value pairs of the dynamic attributes
 *     for the Element.
 * @return {!Element} The corresponding Element.
 */
exports.elementPlaceholder = function (tag, key, statics, var_args) {
  if (process.env.NODE_ENV !== 'production') {
    assertPlaceholderKeySpecified(key);
  }

  var node = exports.elementOpen.apply(null, arguments);
  updateAttribute(node, exports.symbols.placeholder, true);
  exports.elementClose.apply(null, arguments);
  return node;
};

/**
 * Declares a virtual Text at this point in the document.
 *
 * @param {string|number|boolean} value The value of the Text.
 * @param {...(function((string|number|boolean)):string)} var_args
 *     Functions to format the value which are called only when the value has
 *     changed.
 * @return {!Text} The corresponding text node.
 */
exports.text = function (value, var_args) {
  if (process.env.NODE_ENV !== 'production') {
    assertNotInAttributes();
  }

  var node = /** @type {!Text}*/alignWithDOM('#text', null);
  var data = getData(node);

  if (data.text !== value) {
    data.text = /** @type {string} */value;

    var formatted = value;
    for (var i = 1; i < arguments.length; i += 1) {
      formatted = arguments[i](formatted);
    }

    node.data = formatted;
  }

  nextSibling();
  return node;
};
//# sourceMappingURL=incremental-dom-cjs.js.map


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

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

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

<resources>
    <!-- Used in View/Spinner1.java -->
    <string-array name="colors">
        <item>red</item>
        <item>orange</item>
        <item>yellow</item>
        <item>green</item>
        <item>blue</item>
        <item>violet</item>
    </string-array>

    <!-- Used in View/Spinner1.java -->
    <string-array name="planets">
        <item>Mercury</item>
        <item>Venus</item>
        <item>Earth</item>
        <item>Mars</item>
        <item>Jupiter</item>
        <item>Saturn</item>
        <item>Uranus</item>
        <item>Neptune</item>
        <item>Pluto</item>
    </string-array>

    <!-- Used in content/ClipboardSample.java -->
    <string-array name="clip_data_types">
        <item>No data in clipboard</item>
        <item>Text clip</item>
        <item>Intent clip</item>
        <item>Uri clip</item>
    </string-array>

    <!-- Used in App/SearchInvoke.java -->
    <string-array name="search_menuModes">
        <item>Search Key</item>
        <item>Menu Item</item>
        <item>Type-To-Search</item>
        <item>Disabled</item>
    </string-array>

    <!-- Used in app/dialog examples -->
    <string-array name="select_dialog_items">
        <item>Command one</item>
        <item>Command two</item>
        <item>Command three</item>
        <item>Command four</item>
    </string-array>

    <string-array name="select_dialog_items2">
        <item>Map</item>
        <item>Satellite</item>
        <item>Traffic</item>
        <item>Street view</item>
    </string-array>

    <string-array name="select_dialog_items3">
        <item>Every Monday</item>
        <item>Every Tuesday</item>
        <item>Every Wednesday</item>
        <item>Every Thursday</item>
        <item>Every Friday</item>
        <item>Every Saturday</item>
        <item>Every Sunday</item>
    </string-array>

    <!-- Used in app/menu examples -->
    <string-array name="entries_list_preference">
        <item>Alpha Option 01</item>
        <item>Beta Option 02</item>
        <item>Charlie Option 03</item>
    </string-array>

    <!-- Used in app/menu examples -->
    <string-array name="entryvalues_list_preference">
        <item>alpha</item>
        <item>beta</item>
        <item>charlie</item>
    </string-array>

    <!-- Used in app/Sample Device Admin -->
    <string-array name="password_qualities">
        <item>Unspecified</item>
        <item>Something</item>
        <item>Numeric</item>
        <item>Alphabetic</item>
        <item>Alphanumeric</item>
        <item>Complex</item>
    </string-array>

    <!-- Used in app/Screen Orientation -->
    <string-array name="screen_orientations">
        <item>UNSPECIFIED</item>
        <item>LANDSCAPE</item>
        <item>PORTRAIT</item>
        <item>USER</item>
        <item>BEHIND</item>
        <item>SENSOR</item>
        <item>NOSENSOR</item>
        <item>SENSOR_LANDSCAPE</item>
        <item>SENSOR_PORTRAIT</item>
        <item>REVERSE_LANDSCAPE</item>
        <item>REVERSE_PORTRAIT</item>
        <item>FULL_SENSOR</item>
    </string-array>

    <!-- Used in view/Secure View examples -->
    <string-array name="secure_view_clicked">
        <item>*bzzt*\nTransferred $1,000,000 to J. Phisher.  Thank you!</item>
        <item>*bzzt*\nSending all life savings to the International Cabal of Evil Penguins.</item>
        <item>*bzzt*\nOpening portal to R\'lyeh.  Long live Cthulhu!</item>
        <item>*bzzt*\nYou\'re not very good at this, are you?</item>
        <item>*bzzt*\nGo away...</item>
    </string-array>

    <!-- Used in view/Split Touch View example -->
    <string-array name="cheese_responses">
        <item>I\'m afraid we\'re fresh out.</item>
        <item>I\'m afraid we never have that at the end of the week, sir.  We get it fresh on Monday.</item>
        <item>Ah. It\'s been on order, sir, for two weeks.  I was expecting it this morning.</item>
        <item>Normally, sir, yes.  Today the van broke down.</item>
        <item>No.</item>
        <item>No.</item>
        <item>No.</item>
        <item>Yes, sir.  It\'s, ah ..... it\'s a bit runny.</item>
        <item>Well, it\'s very runny, actually, sir.</item>
        <item>I think it\'s a bit runnier than you\'ll like it, sir.</item>
        <item>Oh... The cat\'s eaten it.</item>
        <item>No.</item>
        <item>No.</item>
        <item>No.</item>
        <item>Mmm... cheese.</item>
    </string-array>
</resources>


text:
/*
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
 * Use is subject to license terms.
 *
 * Copyright (c) 2011, 2012, Intel Corporation.
 */
/*
 * This file is part of Lustre, http://www.lustre.org/
 * Lustre is a trademark of Sun Microsystems, Inc.
 *
 * lustre/include/lustre_disk.h
 *
 * Lustre disk format definitions.
 *
 * Author: Nathan Rutman <nathan@clusterfs.com>
 */

#ifndef _LUSTRE_DISK_H
#define _LUSTRE_DISK_H

/** \defgroup disk disk
 *
 * @{
 */

#include "../../include/linux/libcfs/libcfs.h"
#include "../../include/linux/lnet/types.h"
#include <linux/backing-dev.h>

/****************** persistent mount data *********************/

#define LDD_F_SV_TYPE_MDT   0x0001
#define LDD_F_SV_TYPE_OST   0x0002
#define LDD_F_SV_TYPE_MGS   0x0004
#define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT  | \
			    LDD_F_SV_TYPE_OST  | \
			    LDD_F_SV_TYPE_MGS)
#define LDD_F_SV_ALL	0x0008

/****************** mount command *********************/

/* The lmd is only used internally by Lustre; mount simply passes
 * everything as string options
 */

#define LMD_MAGIC    0xbdacbd03
#define LMD_PARAMS_MAXLEN	4096

/* gleaned from the mount command - no persistent info here */
struct lustre_mount_data {
	__u32      lmd_magic;
	__u32      lmd_flags;	 /* lustre mount flags */
	int	lmd_mgs_failnodes; /* mgs failover node count */
	int	lmd_exclude_count;
	int	lmd_recovery_time_soft;
	int	lmd_recovery_time_hard;
	char      *lmd_dev;	   /* device name */
	char      *lmd_profile;    /* client only */
	char      *lmd_mgssec;	/* sptlrpc flavor to mgs */
	char      *lmd_opts;	/* lustre mount options (as opposed to
				 * _device_ mount options)
				 */
	char      *lmd_params;	/* lustre params */
	__u32     *lmd_exclude; /* array of OSTs to ignore */
	char	*lmd_mgs;	/* MGS nid */
	char	*lmd_osd_type;  /* OSD type */
};

#define LMD_FLG_SERVER		0x0001	/* Mounting a server */
#define LMD_FLG_CLIENT		0x0002	/* Mounting a client */
#define LMD_FLG_ABORT_RECOV	0x0008	/* Abort recovery */
#define LMD_FLG_NOSVC		0x0010	/* Only start MGS/MGC for servers,
					 * no other services
					 */
#define LMD_FLG_NOMGS		0x0020	/* Only start target for servers,
					 * reusing existing MGS services
					 */
#define LMD_FLG_WRITECONF	0x0040	/* Rewrite config log */
#define LMD_FLG_NOIR		0x0080	/* NO imperative recovery */
#define LMD_FLG_NOSCRUB		0x0100	/* Do not trigger scrub automatically */
#define LMD_FLG_MGS		0x0200	/* Also start MGS along with server */
#define LMD_FLG_IAM		0x0400	/* IAM dir */
#define LMD_FLG_NO_PRIMNODE	0x0800	/* all nodes are service nodes */
#define LMD_FLG_VIRGIN		0x1000	/* the service registers first time */
#define LMD_FLG_UPDATE		0x2000	/* update parameters */
#define LMD_FLG_HSM		0x4000	/* Start coordinator */

#define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)

/****************** last_rcvd file *********************/

/** version recovery epoch */
#define LR_EPOCH_BITS   32
#define lr_epoch(a) ((a) >> LR_EPOCH_BITS)
#define LR_EXPIRE_INTERVALS 16 /**< number of intervals to track transno */
#define ENOENT_VERSION 1 /** 'virtual' version of non-existent object */

/****************** superblock additional info *********************/

struct ll_sb_info;

struct lustre_sb_info {
	int		       lsi_flags;
	struct obd_device	*lsi_mgc;     /* mgc obd */
	struct lustre_mount_data *lsi_lmd;     /* mount command info */
	struct ll_sb_info	*lsi_llsbi;   /* add'l client sbi info */
	struct dt_device	 *lsi_dt_dev;  /* dt device to access disk fs*/
	atomic_t	      lsi_mounts;  /* references to the srv_mnt */
	char			  lsi_svname[MTI_NAME_MAXLEN];
	char			  lsi_osd_obdname[64];
	char			  lsi_osd_uuid[64];
	struct obd_export	 *lsi_osd_exp;
	char			  lsi_osd_type[16];
	char			  lsi_fstype[16];
	struct backing_dev_info   lsi_bdi;     /* each client mountpoint needs
						* own backing_dev_info
						*/
};

#define LSI_UMOUNT_FAILOVER	      0x00200000
#define LSI_BDI_INITIALIZED	      0x00400000

#define     s2lsi(sb)	((struct lustre_sb_info *)((sb)->s_fs_info))
#define     s2lsi_nocast(sb) ((sb)->s_fs_info)

#define     get_profile_name(sb)   (s2lsi(sb)->lsi_lmd->lmd_profile)
#define	    get_mount_flags(sb)	   (s2lsi(sb)->lsi_lmd->lmd_flags)
#define	    get_mntdev_name(sb)	   (s2lsi(sb)->lsi_lmd->lmd_dev)

/****************** mount lookup info *********************/

struct lustre_mount_info {
	char		 *lmi_name;
	struct super_block   *lmi_sb;
	struct list_head	    lmi_list_chain;
};

/****************** prototypes *********************/

/* obd_mount.c */

int lustre_start_mgc(struct super_block *sb);
void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
						  struct vfsmount *mnt));
void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
int lustre_common_put_super(struct super_block *sb);

int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type);

/** @} disk */

#endif /* _LUSTRE_DISK_H */


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml.Serialization;

namespace DataCloner.Core.Configuration
{
    [DebuggerDisplay("{DestinationVar + \"_\" + TableTo}")]

    public class ForeignKeyAdd : IEquatable<ForeignKeyAdd>
    {
        [XmlAttribute]
        public string DestinationSchema { get; set; }

        [XmlAttribute]
        public string DestinationTable { get; set; }

        [XmlElement("Column")]
        public List<ForeignKeyColumn> Columns { get; set; }

        public ForeignKeyAdd()
        {
            Columns = new List<ForeignKeyColumn>();
        }

        public override bool Equals(object obj)
        {
            var o = obj as ForeignKeyAdd;
            return Equals(o);
        }

        public bool Equals(ForeignKeyAdd other)
        {
            if (other == null)
                return false;

            if (other.DestinationSchema == DestinationSchema &&
                other.DestinationTable == DestinationTable)
            {
                foreach (var col in Columns)
                {
                    if (!other.Columns.Contains(col))
                        return false;
                }
            }

            return true;
        }

        public override int GetHashCode()
        {
            return (DestinationSchema+DestinationTable).GetHashCode();
        }
    }
}


text:
<?php

namespace controller;

use \Controller as Controller;
use \DataObject as DataObject;
use \Model as Model;
use \Auth as Auth;
use \http\Session as Session;;
use \Logger as Logger;
use \Localized as Localized;
use \Config as Config;
use \Processor as Processor;
use \http\HttpGet as HttpGet;

use processor\ComicVineImporter as ComicVineImporter;
use processor\UploadImport as UploadImport;
use processor\ImportManager as ImportManager;
use processor\FluxImporter as FluxImporter;

use controller\Admin as Admin;
use connectors\NewznabConnector as NewznabConnector;

use \model\user\Users as Users;
use \model\network\Endpoint as Endpoint;
use \model\network\Endpoint_Type as Endpoint_Type;
use \model\media\Publisher as Publisher;
use \model\media\Character as Character;
use \model\media\Character_Alias as Character_Alias;
use \model\media\Publication as Publication;
use \model\media\Series as Series;

use \SQL as SQL;
use db\Qualifier as Qualifier;

class AdminWanted extends Admin
{
	/**
		sqlite> select s.id, s.name, count(p.id) from
   ...> series s, publication p
   ...> where s.id = p.series_id
   ...> and (p.media_count is null or p.media_count = 0)
   ...> group by s.id, s.name
   ...> having count(p.id) > 0;
	*/
	function index()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$this->view->addStylesheet("select2.min.css");
			$this->view->addScript("select2.min.js");

			$pub_model = Model::Named('Publication');

			$select = SQL::Select($pub_model);
			$select->where(Qualifier::AndQualifier(
				Qualifier::Equals( "pub_wanted", Model::TERTIARY_TRUE ),
				Qualifier::OrQualifier(
					Qualifier::IsNull( Series::pub_count),
					Qualifier::IsNull( Series::pub_available ),
					Qualifier::AttributeCompare( Series::pub_count, Qualifier::GREATER_THAN, Series::pub_available )
					)
				)
			);
			$select->orderBy( array( array(SQL::SQL_ORDER_ASC => Series::name)));
			$select->limit(0);

			//Session::addPositiveFeedback("select ". $select);

			$this->view->model = $pub_model;
			$this->view->render( '/wanted/index');
		}
	}

	function index_series()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$this->view->addStylesheet("select2.min.css");
			$this->view->addScript("select2.min.js");

			$series_model = Model::Named('Series');

			$select = SQL::Select($series_model);
			$select->where(Qualifier::AndQualifier(
				Qualifier::Equals( "pub_wanted", Model::TERTIARY_TRUE ),
				Qualifier::OrQualifier(
					Qualifier::IsNull( Series::pub_count),
					Qualifier::IsNull( Series::pub_available ),
					Qualifier::AttributeCompare( Series::pub_count, Qualifier::GREATER_THAN, Series::pub_available )
					)
				)
			);
			$select->orderBy( array( array(SQL::SQL_ORDER_ASC => Series::name)));
			$select->limit(0);

			//Session::addPositiveFeedback("select ". $select);

			$this->view->setLocalizedViewTitle("Wanted Series");
			$this->view->model = $series_model;
			$this->view->listArray = $select->fetchAll();
			$this->view->render( '/wanted/index_series');
		}
	}

	function index_story_arc()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$this->view->addStylesheet("select2.min.css");
			$this->view->addScript("select2.min.js");

			$model = Model::Named('Story_Arc');

			$select = SQL::Select($model);
			$select->where(Qualifier::AndQualifier(
				Qualifier::Equals( "pub_wanted", Model::TERTIARY_TRUE ),
				Qualifier::OrQualifier(
					Qualifier::IsNull( Series::pub_count),
					Qualifier::IsNull( Series::pub_available ),
					Qualifier::AttributeCompare( Series::pub_count, Qualifier::GREATER_THAN, Series::pub_available )
					)
				)
			);
			$select->orderBy( array( array(SQL::SQL_ORDER_ASC => Series::name)));
			$select->limit(0);

			//Session::addPositiveFeedback("select ". $select);

			$this->view->setLocalizedViewTitle("Wanted Story Arcs");
			$this->view->model = $model;
			$this->view->listArray = $select->fetchAll();
			$this->view->render( '/wanted/index_story_arc');
		}
	}

	function pubsWanted()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$this->view->addStylesheet("select2.min.css");
			$this->view->addScript("select2.min.js");

			$model = Model::Named('Publication');

			$qualifiers[] = Qualifier::OrQualifier(
				Qualifier::Equals( Publication::media_count, 0 ),
				Qualifier::IsNull( Publication::media_count )
			);

			if ( HttpGet::hasValue('date_range') ) {
				$monthRange = HttpGet::getInt('date_range');
				if ( $monthRange >= 0 ) {
					$start_date = new \DateTime('first day of this month');
					$start_date->modify( '-'.$monthRange.' month' );
					$end_date = clone $start_date;
					$end_date->modify('last day of this month');

					if ( $monthRange == 0 ) {
						$qualifiers[] = Qualifier::GreaterThanEqual( Publication::pub_date,
							$start_date->getTimeStamp()
						);
					}
					else {
						$qualifiers[] = Qualifier::Between( Publication::pub_date,
							$start_date->getTimeStamp(),
							$end_date->getTimeStamp()
						);
					}

					$series_model = Model::Named('Series');
					$qualifiers[] = Qualifier::InSubQuery( Publication::series_id,
						SQL::Select($series_model, array("id"))
						->where( Qualifier::Equals( "pub_wanted", Model::TERTIARY_TRUE ) )
						->limit(0)
					);
				}
			}

			if ( HttpGet::hasValue('series_id') ) {
				$qualifiers[] = Qualifier::Equals( Publication::series_id, HttpGet::getInt('series_id'));
			}
			if ( HttpGet::hasValue('story_arc_id') ) {
				$saj_model = Model::Named('Story_Arc_Publication');
				$qualifiers[] = Qualifier::InSubQuery( Publication::id,
					SQL::Select($saj_model, array("publication_id"))
						->where( Qualifier::Equals( "story_arc_id", HttpGet::getInt('story_arc_id') ))
						->limit(0)
				);
			}

			$select = SQL::Select($model);
			if ( count($qualifiers) > 0 ) {
				$select->where( Qualifier::AndQualifier( $qualifiers ));
			}
			$select->orderBy( array(
					array(SQL::SQL_ORDER_DESC => Publication::issue_num)
				)
			);

			$this->view->model = $model;
			$this->view->listArray = $select->fetchAll();
			$this->view->render( '/wanted/wanted', true);
		}
	}

	function searchWanted($pageNum = 0)
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$model = Model::Named('Publication');
			$series_model = Model::Named('Series');
			$saj_model = Model::Named('Story_Arc_Publication');
			$otherPubQual = null;
			$qualifiers[] = Qualifier::OrQualifier(
				Qualifier::Equals( Publication::media_count, 0 ),
				Qualifier::IsNull( Publication::media_count )
			);
			$qualifiers[] = Qualifier::OrQualifier(
				Qualifier::InSubQuery( Publication::series_id,
					SQL::Select($series_model, array("id"))->where(Qualifier::Equals( "pub_wanted", Model::TERTIARY_TRUE ))->limit(0)
				),
				Qualifier::InSubQuery( Publication::id,
					SQL::SelectJoin($saj_model, array("publication_id"))
						->joinOn( $saj_model, Model::Named("Story_Arc"), null, Qualifier::Equals( "pub_wanted", Model::TERTIARY_TRUE))
						->limit(0)
				)
			);

			// input filters
			if ( isset($_GET['story_arc_id']) && is_array($_GET['story_arc_id']) && count($_GET['story_arc_id']) > 0 ) {
				$qualifiers[] = Qualifier::InSubQuery( Publication::id,
					SQL::Select($saj_model, array("publication_id"))
						->where( Qualifier::IN( "story_arc_id", $_GET['story_arc_id']))
						->limit(0)
				);
			}
			if ( isset($_GET['year']) && strlen($_GET['year']) == 4 ) {
				$start = strtotime("01-01-" . $_GET['year'] . " 00:00");
				$end = strtotime("31-12-" . $_GET['year'] . " 23:59");
				$qualifiers[] = Qualifier::Between( Publication::pub_date, $start, $end );
			}
			if ( isset($_GET['issue']) && strlen($_GET['issue']) > 0) {
				$qualifiers[] = Qualifier::Equals( Publication::issue_num, $_GET['issue'] );
			}
			if ( isset($_GET['series_name']) && strlen($_GET['series_name']) > 0) {
				$select = \SQL::Select( Model::Named('Series'), array(Series::id))
					->where( Qualifier::Like( Series::search_name, normalizeSearchString($_GET['series_name'])) );
				$series_idArray = array_map(function($stdClass) {return $stdClass->{Series::id}; },
					$select->fetchAll());

				if ( is_array($series_idArray) && count($series_idArray) > 0 ) {
					$qualifiers[] = Qualifier::IN( Publication::series_id, $series_idArray );
				}
				else {
					$qualifiers[] = Qualifier::Equals( Publication::id, 0 );
				}
			}

			$select = SQL::Select($model);
			if ( count($qualifiers) > 0 ) {
				$select->where( Qualifier::AndQualifier( $qualifiers ));
			}
			$select->orderBy( array(
					array(SQL::SQL_ORDER_ASC => Publication::series_id),
					array(SQL::SQL_ORDER_DESC => Publication::issue_num)
				)
			);

//  						Session::addPositiveFeedback("select ". $select);

			$this->view->model = $model;
			$this->view->listArray = $select->fetchAll();
			$this->view->render( '/wanted/wanted', true);
		}
	}

	function newznab($pubId = 0)
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$this->view->addStylesheet("select2.min.css");
			$this->view->addScript("select2.min.js");

			if ( $pubId > 0 ) {
				$publication = Model::Named('Publication')->objectForId( $pubId );
				if ( $publication != false ) {
					$this->view->searchString = $publication->searchString();
				}
			}

			$model = Model::Named('Endpoint');
			$this->view->endpoints = $model->allForTypeCode(Endpoint_Type::Newznab, true);
			$this->view->setLocalizedViewTitle("Search Newznab");
			$this->view->controllerAction = "newznab";
			$this->view->model = $model;
			$this->view->render( '/wanted/newznab');
		}
	}

	// for manual search
	function searchNewznab()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			if ( HttpGet::hasValues('endpoint_id', 'search') ) {
				$model = Model::Named('Endpoint');
				$endpoint = $model->objectForId( $_GET['endpoint_id'] );
				if ( $endpoint->isOverMaximum('daily_max') == false && $endpoint->isOverMaximum('daily_dnld_max') == false) {
					if (strlen($_GET['search']) > 4 ) {
						try {
							$connection = new NewznabConnector( $endpoint );
							$this->view->endpoint_id = $_GET['endpoint_id'];
							$this->view->fluxModel = Model::Named('Flux');
							$this->view->results = $connection->searchComics($_GET['search']);

						}
						catch ( \Exception $e ) {
							Session::addNegativeFeedback( $e->getMessage() );
						}
					}
					$this->view->render( '/wanted/newznab_results', true);
				}
				else {
					echo $endpoint->name . " is over maximum " . $endpoint->dailyMaximumStatus();
					//Session::addNegativeFeedback( "Over Daily Maximum " . $endpoint->dailyMaximumStatus() );
				}
			}
		}
	}

	function enqueued()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$this->view->addStylesheet("select2.min.css");
			$this->view->addScript("select2.min.js");

			$model = Model::Named('Publication');
			$this->view->model = $model;
			$this->view->total = $model->countQueueList();
			$this->view->results = $model->searchQueueList();
			$this->view->render( '/wanted/index_enqueued');
		}
	}

	function newznabQuicksearch($pubId = 0)
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			$points = Model::Named('Endpoint')->allForTypeCode(Endpoint_Type::Newznab, true);
			if ( $points == false || count($points) == 0) {
				echo '
' . Localized::GlobalLabel( "PLEASE_ADD_ENDPOINT" ) . Endpoint_Type::Newznab. '
';
			}
			else if ( $pubId > 0 ) {
				$publication = Model::Named('Publication')->objectForId( $pubId );
				if ( $publication != false ) {
					$publication->setSearch_date(time());
					$publication->saveChanges();
					$this->view->fluxModel = Model::Named('Flux');
					foreach( $points as $endpoint ) {
						//Session::addPositiveFeedback("Searching ". $endpoint . "  for " . $publication->searchString());
						if ( $endpoint->isOverMaximum('daily_max') == false ) {
							try {
								$connection = new NewznabConnector( $endpoint );
								$results = $connection->searchComics($publication->searchString());
								if ( is_array($results) == false ) {
									$results = $connection->searchComics($publication->seriesName() . " " . $publication->paddedIssueNum());
								}

								$this->view->publication_id = $pubId;
								$this->view->publication = $publication;
								$this->view->endpoint_id = $endpoint->id;
								$this->view->results = $results;
								$this->view->render( '/wanted/newznab_quick', true);
							}
							catch ( \Exception $e ) {
								Logger::logException($e);
								echo '
Exception: ' . $e->getMessage(). '
';
							}
						}
					}
				}
				else {
					echo '
No publication found
';
				}
			}
			else {
				echo '
No publication identified
';
			}
		}
	}

	function downloadNewznab()
	{
		if (Auth::handleLogin() && Auth::requireRole(Users::AdministratorRole)) {
			if ( HttpGet::hasValues( 'endpoint_id', 'name', 'guid', 'url', 'postedDate') ) {
				$name = HttpGet::get('name');
				$issue = HttpGet::get('issue');
				$year = HttpGet::get('year');
				$endpoint_id = HttpGet::get('endpoint_id');
				$guid = HttpGet::get('guid');
				$url = HttpGet::get('nzburl');
				$postedDate = HttpGet::get('postedDate');

				$points = Model::Named('Endpoint')->allForTypeCode(Endpoint_Type::SABnzbd, true);
				if ( $points == false || count($points) == 0) {
					$this->view->message = Localized::GlobalLabel( "PLEASE_ADD_ENDPOINT" ) . ' ' . Endpoint_Type::SABnzbd;
 					$this->view->url = Config::Web('/netconfig/index');
 					$this->view->url_title = "Network Config";
					$this->view->render( '/error/index', true);
				}
				else {
					$source = Model::Named('Endpoint')->objectForId($endpoint_id);

					$fluxImporter = new FluxImporter();
					$fluxImporter->setEndpoint( $points[0] );
					$fluxImporter->importFluxValues( $source, $name.' - '.$issue.' ('.$year.')', $guid, $postedDate, $url );
					$fluxImporter->daemonizeProcess();

					echo "Importing .. ";
				}
			}
			else {
				echo "nope";
			}
		}
	}
}


text:
import sys

STDOUT_ORIG = sys.stdout
STDERR_ORIG = sys.stderr
STDOUT_TEMP = None
STDERR_TEMP = None

def outputRedirectStart(errToOut=False):
    '''
    Redirects stdout/stderr to files.
    '''
    global STDOUT_TEMP
    global STDERR_TEMP

    #replace stdout with our own file
    STDOUT_TEMP = open('ip_session.log', 'w')
    sys.stdout = STDOUT_TEMP

    #send stderr to stdout or its own file
    if errToOut:
        STDERR_TEMP = STDOUT_TEMP
    else:
        STDERR_TEMP = open('ip_session_stderr.log', 'w')
    sys.stderr = STDERR_TEMP

def outputRedirectStop():
    global STDOUT_TEMP
    global STDERR_TEMP

    #close fake stdout/stderr
    STDOUT_TEMP.close()
    if STDOUT_TEMP!=STDERR_TEMP:
        STDERR_TEMP.close()

    #restore output streams
    sys.stdout = STDOUT_ORIG
    sys.stderr = STDERR_ORIG

# Ensure that an attribute with a prefix unique to the dictionary is properly completed.
######################################################################################################

# Only one attribute has 'z' has a prefix
zoltar = "zoltar"

# Two attributes have 'y' as a prefix, but only one has 'yo'
yorick = "yorick"
yak = "yak"

# Ensure that tabbing on a non-unique prefix cycles through the available options
######################################################################################################

# yorick and yak are used here also

# Ensure that tabbing after 'ident.' cycles through the available options
######################################################################################################

class C:
    'Cdoc'
    pass

c = C()


text:
class AddDifferenceColumnTransactions < ActiveRecord::Migration
  def change
    add_column :transactions, :difference, :decimal, precision: 8, scale: 2
  end
end


text:
@(
    stream: models.Stream,
    children: scala.collection.immutable.List[models.Stream])(implicit request: RequestHeader)

@import play.api.libs.json._
@import helper._
@import play.api.Play.current
@import play.api.i18n.Messages.Implicits._

@extraHead = {
    <link id="favicon"
          rel="icon"
          type="image/png"
          href="@("/s/" + stream.uri + ".png?no-cache=" + scala.util.Random.nextInt())" />
}

@navHeader = {

}

@articleHeader = {

}

@extraScripts = {

    @_streamSearchResultTemplate {

            <button data-bind="click: $parent.removeChildButtonClick">

            </button>

    }

}

@main(stream.name, "stream", extraHead = extraHead, articleHeader = articleHeader, navHeader = navHeader, extraScripts = extraScripts) {

            <time class="stream-updated" data-bind="text: stream().displayUpdated"></time>

            <button class="stream-control-button stream-share btn-lg" disabled>

            </button>

        @helper.form(action = routes.Stream.getStream(stream.uri), 'id -> "stream-search-form", 'role -> "search") {

                    <button class="btn btn-default" type="submit">Go!</button>

                <input name="query" type="text" class="form-control" placeholder="@Messages("blotre.controls.search.findChildPlaceholder")">

        }
        <p id="stream-search-query-label" data-bind="text: query() || 'Latest'"

                <input class="form-control" type="text" name="name" placeholder="Name" />

            <button id="create-child-expand-button"
                class="btn btn-default"
                title="@Messages("blotre.stream.stream.createChildButtonTitle")">

            </button>

                <button class="btn btn-default">@Messages("blotre.stream.stream.cancelCreateChildButton")</button>

@Messages("blotre.stream.stream.noChildren")

}


text:
Layered Detector Calibration
============================

Simulation of gammas and neutrons and the subsquent energy depsotion and optical photons of three layered detectors.

## Geometry
The detector assembly is two thin films sandwhiched between three PMMA slices, mounted with optical grease. The entire assembly was wrapped with teflon and black tape. A fish tail light guide was used to collect the light.
The detector assembly is constructed by placing a number of volumes inside of each other. The largest volume for the detector is the teflon cladding. Inside the telfon cladding volume is slightly smaller PMMA volume to represent the arcylic.  Placed inside the PMMA volume are the detector slices.  The detector slices are actually slices of optical grease, which have the neutron absorbing detector inside of them.

## Histograms and Analysis
The analysis is completed through the GEANT4 analysis manager class, and set to use the ROOT output.  There are two histograms created:
	+ Number of optical photons created in detector
	+ Number of optical photons detected at PMT

The number of optical photons detected in the PMT is found using a sensitive detector in the PMT, and the number of optical photons created is found by counting the number of optical photons in the stacking action.

If the user elected to build for the MPI library the following command may be used for combining the seperate ROOT files
  `hadd GS20_Neutron.root GS20_Neutron_*.root`

## Build Instructions
Options exists to build this a single core application or for multiple processes with the GEANT4 MPI library. To build for a single core application:

	 cd LayeredDetectorCalibration/
	 mkdir build; cd build;
	 cmake ..
	 make

To build for a multicore application one needs to turn on the `USE_MPI` preprocessor defination as follows:

	 cd LayeredDetectorCalibration/
	 mkdir build; cd build
	 cmake .. -DUSE_MPI=ON
	 make

## Run Instructions
If the user elected to build for the MPI libary then it is suggested to submit the job to the cluster through TOURQE/MAUI.


text:
Please don't edit files in the `dist` subdirectory as they are generated via Grunt. You'll find source code in the `src` subdirectory!

### Code style
Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.**

## Modifying the code
First, ensure that you have the latest [Node.js](https://nodejs.org) and [npm](https://npmjs.com) installed.

1. Fork and clone the repo
1. Run `npm install` to install all dependencies
1. Run `npm run test`

## Submitting pull requests

1. Create a new branch, please don't work in your `master` branch directly.
1. Add failing tests for the change you want to make. Run `npm run test` to see the tests fail.
1. Fix stuff.
1. Run `npm run test` to see if the tests pass. Repeat steps 2-4 until done.
1. Open `tests/index.html` unit test file(s) in actual browser to ensure tests pass everywhere.
1. Update the documentation to reflect any changes.
1. Push to your fork and submit a pull request.


text:
@class Allowance, IomOffice, Migrant;

@interface IomData : NSManagedObject

@property (nonatomic, retain) NSString * iomDataId;
@property (nonatomic, retain) NSSet *allowances;
@property (nonatomic, retain) IomOffice *associatedOffice;
@property (nonatomic, retain) Migrant *migrant;
@end

@interface IomData (CoreDataGeneratedAccessors)

- (void)addAllowancesObject:(Allowance *)value;
- (void)removeAllowancesObject:(Allowance *)value;
- (void)addAllowances:(NSSet *)values;
- (void)removeAllowances:(NSSet *)values;

@end


text:
var app = app || {};

// The DOM element for a todo item...
app.TodoView = Backbone.View.extend({

  // ... is a list tag.
  tagName: 'li',

  // Cache the template function for a single item.
  template: Handlebars.compile( $('#item-template').html() ),

  // The DOM events specific to an item.
  events: {
    'click .toggle': 'togglecompleted',
    'dbclick label': 'edit',
    'click .destroy': 'clear',
    'keypress .edit': 'updateOnEnter',
    'blur .edit': 'close'
  },

  // The TodoView listens for changes to its model, re-rendering.
  // Since there's a one-to-one correspondence between a **Todo** and a
  // **TodoView** in this app, we set a direct reference on the model
  // for convenience.
  initialize: function() {
    this.listenTo(this.model, 'change', this.render);
    this.listenTo(this.model, 'destroy', this.remove);
    this.listenTo(this.model, 'visible', this.toggleVisible);
  },

  // Re-renders the titles of the todo item.
  render: function() {
    this.$el.html( this.template( this.model.toJSON() ) );

    this.$el.toggleClass( 'completed', this.model.get('completed') );
    this.toggleVisible();

    this.$input = this.$('.edit');
    return this;
  },

  // toggles visibility of item
  toggleVisible: function() {
    this.$el.toggleClass( 'hidden', this.isHidden() );
  },

  // determines if item should be hidden
  isHidden: function() {
    var isCompleted = this.model.get('completed');
    return ( // hidden case only
      (!isCompleted && app.TodoFilter === 'completed')
      || (isCompleted && app.TodoFilter === 'active')
      );
  },

  // Toggle the `"completed"` state of the model
  togglecompleted: function() {
    this.model.toggle();
  },

  // Switch this view into `"editing"` mode, displaying the input field.
  edit: function() {
    this.$el.addClass('editing');
    this.$input.focus();
  },

  // Close the `"editing"` mode, saving changes to the todo.
  close: function() {
    var value = this.$input.val().trim();

    if ( value ) {
      this.model.save({ title: value });
    }

    this.$el.removeClass('editing');
  },

  //  If you hit `enter`, we're through editing the item.
  updateOnEnter: function( event ) {
    if ( event.which === ENTER_KEY ) {
      this.close();
    }
  },

  // remove the item, destroy the model from *localStorage* and delete its view
  clear: function() {
    this.model.destroy();
  }
});


text:
package com.github.jankroken.commandline.domain;

import com.github.jankroken.commandline.util.ArrayIterator;
import com.github.jankroken.commandline.util.PeekIterator;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class LongOrCompactTokenizerTest {

    @Test
    public void simpleArgumentSplit() {
        String[] args = new String[]{"-abcf", "hello.txt"};
        PeekIterator<String> peekIterator = new PeekIterator<String>(new ArrayIterator<String>(args));
        LongOrCompactTokenizer tokenizer = new LongOrCompactTokenizer(peekIterator);
        assertThat(tokenizer.next().getValue(), is("a"));
        assertThat(tokenizer.next().getValue(), is("b"));
        assertThat(tokenizer.next().getValue(), is("c"));
        assertThat(tokenizer.next().getValue(), is("f"));
        assertThat(tokenizer.next().getValue(), is("hello.txt"));
    }
}


text:
package org.isisaddons.wicket.gmap3.cpt.ui;

import javax.inject.Inject;

import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
import org.apache.isis.viewer.wicket.model.models.ImageResourceCache;
import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.isisaddons.wicket.gmap3.cpt.applib.Locatable;
import org.wicketstuff.gmap.GMap;
import org.wicketstuff.gmap.api.GLatLng;

public class CollectionOfEntitiesAsLocatables extends
        PanelAbstract<EntityCollectionModel> {

	private GLatLng center = new GLatLng(121.417442, 31.217375);

    private static final long serialVersionUID = 1L;

    private static final String ID_MAP = "map";

    private int deviceID;

    @Inject
    private ImageResourceCache imageResourceCache;

    @Inject
    private PageClassRegistry pageClassRegistry;

    public CollectionOfEntitiesAsLocatables(final String id,
            EntityCollectionModel model) {
        super(id, model);

        System.out.println("---------------");
        System.out.println("---------------");
        try{
        	System.out.println(model.getObject().size());
        }catch(Exception e){

        }

        try{
        	System.out.println(model.getObject().get(0).getObject().toString());
        }catch(Exception e){
        	e.printStackTrace();
        }

        try{
        	Locatable lo=(Locatable)model.getObject().get(0).getObject();

        	center = new GLatLng(lo.getLocation().getLongitude(), lo.getLocation().getLatitude());

        	System.out.println(lo.getLocation().toString());

        	deviceID=lo.getLocation().getDeviceID();

        	buildGui(lo.getLocation().getDeviceID());
        }catch(Exception e){
        	e.printStackTrace();
        	buildGui(0);
        }

        System.out.println("---------------");
        System.out.println("---------------");

    }

    private void buildGui(int deviceID) {
        addOrReplace(new GMap(ID_MAP,center,deviceID));
    }

    @Override
    protected void onModelChanged() {
    	buildGui(deviceID);
    }

    @Override
    public void renderHead(IHeaderResponse response) {
        super.renderHead(response);
        PanelUtil.renderHead(response, CollectionOfEntitiesAsLocatables.class);
    }

    //////////////////////////////////////////////
    // Dependency Injection
    //////////////////////////////////////////////

    protected ImageResourceCache getImageCache() {
        return imageResourceCache;
    }

    protected PageClassRegistry getPageClassRegistry() {
        return pageClassRegistry;
    }

}