text:
The Challenge:

Create a GitHub account, add username to your Git config.

Better, together

The repository you've created so far is just on your computer, which
        is handy, but makes it pretty hard to share and work with others on.
        No worries, that's what GitHub is for!

Step: Create a GitHub Account

GitHub is a website that allows people everywhere to upload what
        they're working on with Git and to easily work together.

Visit github.com and sign up for a free account.
      High five, welcome!

Step: Add username to Git

Add your GitHub username to your Git configuration,
      which will be needed in order to verify the upcoming challenges. Save it exactly as you created it on GitHub — capitalize where capitalized.

Add your GitHub username to your configuration:

      $ git config --global user.username <USerNamE>

Verify with
 git-it verify

Go to the next challenge
 git-it

Didn't Pass?

GitHub & Git config usernames do not match

A common error is not having your GitHub username match the case of the one you set with git config. For instance, 'JLord' isn't the same as 'jlord'

To change your username set with Git, just do the same command you did earlier, but with the correct capitalization:

$ git config --global user.username <USerNamE>

When you've made your updates, verify again!


text:
import { readdirSync, readFileSync, statSync } from 'fs';
import { debug } from './log';
import { dirname, extname, join, resolve } from 'path';

export function fileExists(filename: string) {
	try {
		statSync(filename);
		return true;
	}
	catch (err) {
		return false;
	}
}

export function getProjectRoot(file: string): string {
	const configFile = getProjectConfigFile(file);
	if (!configFile) {
		return dirname(resolve(file));
	}

	let dir = dirname(file);
	while (dirname(dir) !== dir) {
		let entries = readdirSync(dir);
		if (entries.find(entry => entry === 'node_modules')) {
			return dir;
		}
		dir = dirname(dir);
	}

	return dirname(resolve(configFile));
}

/**
 * Get the tsconfig file associated with a given file.
 *
 * @param file A ts or js filename
 */
export function getProjectConfigFile(file: string, configName?: string): string | null {
	debug(`Checking for config in ${file}`);

	if (!configName) {
		const ext = extname(file);
		if (ext) {
			configName = `${extname(file).slice(1)}config.json`;
		}
		else {
			configName = 'tsconfig.json';
		}
	}

	const path = resolve(file);
	const stats = statSync(path);
	if (!stats.isDirectory()) {
		return getProjectConfigFile(dirname(path), configName);
	}

	for (let filename of readdirSync(path)) {
		if (filename === configName) {
			return join(path, filename);
		}
	}

	if (dirname(path) === path) {
		// We're at the filesystem root -- there's nowhere else to go
		return null;
	}

	return getProjectConfigFile(dirname(path), configName);
}

/**
 * Get the tsconfig data associated with a given file.
 *
 * @param file A ts or js filename
 */
export function getProjectConfig(file: string): any {
	debug(`Checking for config in ${file}`);

	let configFile = getProjectConfigFile(file);
	if (!configFile) {
		return null;
	}

	let data = parseJSON(readFileSync(configFile, { encoding: 'utf8' }));
	let parent = data.extends;
	while (parent) {
		configFile = resolve(dirname(configFile), parent);
		let newData = parseJSON(readFileSync(configFile, { encoding: 'utf8' }));
		parent = newData.extends;
		data = mixConfigs(data, newData);
	}
	return data;
}

function mixConfigs(child: any, parent: any) {
	let config: any = {};
	for (let key in parent) {
		config[key] = parent[key];
	}

	Object.keys(child).filter(key => {
		return key !== 'extends' && key !== 'compilerOptions';
	}).forEach(key => {
		config[key] = child[key];
	});

	if (child.compilerOptions) {
		if (config.compilerOptions) {
			Object.keys(child.compilerOptions).forEach(key => {
				config.compilerOptions[key] = child.compilerOptions[key];
			});
		}
		else {
			config.compilerOptions = child.compilerOptions;
		}
	}

	return config;
}

function parseJSON(text: string): any {
	const textToParse = removeComments(text);
	return JSON.parse(textToParse);
}

function removeComments(text: string): string {
	let state: 'string' | 'block-comment' | 'line-comment' | 'default' = 'default';
	let i = 0;

	// Create an array of chars from the text, the blank out anything in a comment
	const chars = text.split('');

	while (i < chars.length) {
		switch (state) {
			case 'block-comment':
				if (chars[i] === '*' && chars[i + 1] === '/') {
					chars[i] = ' ';
					chars[i + 1] = ' ';
					state = 'default';
					i += 2;
				}
				else if (chars[i] !== '\n') {
					chars[i] = ' ';
					i += 1;
				}
				else {
					i += 1;
				}
				break;

			case 'line-comment':
				if (chars[i] === '\n') {
					state = 'default';
				}
				else {
					chars[i] = ' ';
				}
				i += 1;
				break;

			case 'string':
				if (chars[i] === '"') {
					state = 'default';
					i += 1;
				}
				else if (chars[i] === '\\' && chars[i + 1] === '\\') {
					i += 2;
				}
				else if (chars[i] === '\\' && chars[i + 1] === '"') {
					i += 2;
				}
				else {
					i += 1;
				}
				break;

			default:
				if (chars[i] === '"') {
					state = 'string';
					i += 1;
				}
				else if (chars[i] === '/' && chars[i + 1] === '*') {
					chars[i] = ' ';
					chars[i + 1] = ' ';
					state = 'block-comment';
					i += 2;
				}
				else if (chars[i] === '/' && chars[i + 1] === '/') {
					chars[i] = ' ';
					chars[i + 1] = ' ';
					state = 'line-comment';
					i += 2;
				}
				else {
					i += 1;
				}
		}
	}

	return chars.join('');
}

redpajama_set_name: RedPajamaGithub


text:
package extracells.block

/*class BlockCertusTank extends BlockEC(Material.GLASS, 2.0F, 10.0F) with Extended{

  //setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F)

  override protected def setDefaultExtendedState(state: IBlockState) = setDefaultState(state)

  override protected def addExtendedState(state: IBlockState, world: IBlockAccess, pos: BlockPos) =
    (state, world.getTileEntity(pos)) match {
      case (extendedState: IExtendedBlockState, print: TileEntityCertusTank) =>
        super.addExtendedState(extendedState.withProperty(PropertyTile.Tile, print), world, pos)
      case _ => None
    }

  override protected def createProperties(listed: ArrayBuffer[IProperty[_ <: Comparable[_]]], unlisted: ArrayBuffer[IUnlistedProperty[_]]) {
    super.createProperties(listed, unlisted)
    unlisted += PropertyTile.Tile
  }

  override def createNewTileEntity(worldIn: World, meta: Int): TileEntity = new TileEntityCertusTank

    override def getDrops(world: IBlockAccess, pos: BlockPos, state: IBlockState, fortune: Int): util.List[ItemStack] = {
      val tileEntity = new NBTTagCompound
      val worldTE = world.getTileEntity(pos)
      val list = new util.ArrayList[ItemStack]
      if (worldTE != null && worldTE.isInstanceOf[TileEntityCertusTank]) {
        val dropStack = new ItemStack(BlockEnum.CERTUSTANK.getBlock, 1)
        worldTE.asInstanceOf[TileEntityCertusTank].writeToNBTWithoutCoords(tileEntity)
        if (!tileEntity.hasKey("Empty")) {
          val nbtTag = new NBTTagCompound
          nbtTag.setTag("tileEntity", tileEntity)
          dropStack.setTagCompound(nbtTag)
          list.add(dropStack)
        }

      }
      list
    }

  override def getLocalizedName: String = I18n.translateToLocal(getTranslationKey + ".name")

  override def getTranslationKey: String = super.getTranslationKey.replace("tile.", "")

}*/


text:
from __future__ import absolute_import, division, print_function, unicode_literals

from six import with_metaclass

from enum import Enum
import os
import warnings
import shutil
try:
    import pathlib
except ImportError as e:
    try:
        import pathlib2 as pathlib
    except ImportError:
        raise e
try:
    import ruamel_yaml as yaml
except ImportError:
    import ruamel.yaml as yaml

import exdir

from .. import utils
from .attribute import Attribute
from .constants import *
from .mode import assert_file_open, OpenMode

def _resolve_path(path):
    return pathlib.Path(path).resolve()

def _assert_valid_name(name, container):
    """Check if name (dataset or group) is valid."""
    container.file.name_validation(container.directory, name)

def _create_object_directory(directory, metadata):
    """
    Create object directory and meta file if directory
    don't already exist.
    """
    if directory.exists():
        raise IOError("The directory '" + str(directory) + "' already exists")
    valid_types = [DATASET_TYPENAME, FILE_TYPENAME, GROUP_TYPENAME]
    typename = metadata[EXDIR_METANAME][TYPE_METANAME]
    if typename not in valid_types:
        raise ValueError("{typename} is not a valid typename".format(typename=typename))
    directory.mkdir()
    meta_filename = directory / META_FILENAME
    with meta_filename.open("w", encoding="utf-8") as meta_file:
        if metadata == _default_metadata(typename):
            # if it is the default, we know how to print it fast
            metadata_string = (''
                '{exdir_meta}:\n'
                '   {type_meta}: "{typename}"\n'
                '   {version_meta}: {version}\n'
            '').format(
                exdir_meta=EXDIR_METANAME,
                type_meta=TYPE_METANAME,
                typename=typename,
                version_meta=VERSION_METANAME,
                version=1
            )
        else:
            metadata_string = yaml.dump(metadata)

        try:
            meta_file.write(metadata_string)
        except TypeError:
            # NOTE workaround for Python 2.7
            meta_file.write(metadata_string.decode('utf8'))

def _remove_object_directory(directory):
    """
    Remove object directory and meta file if directory exist.
    """
    if not directory.exists():
        raise IOError("The directory '" + str(directory) + "' does not exist")
    assert is_inside_exdir(directory)
    shutil.rmtree(directory)

def _default_metadata(typename):
    return {
        EXDIR_METANAME: {
            TYPE_METANAME: typename,
            VERSION_METANAME: 1
        }
    }

def is_exdir_object(directory):
    """
    WARNING: Does not test if inside exdir directory,
    only if the object can be an exdir object (i.e. a directory).
    """
    return directory.is_dir()

def is_nonraw_object_directory(directory):
    meta_filename = directory / META_FILENAME
    if not meta_filename.exists():
        return False
    with meta_filename.open("r", encoding="utf-8") as meta_file:
        meta_data = yaml.safe_load(meta_file)

        if not isinstance(meta_data, dict):
            return False

        if EXDIR_METANAME not in meta_data:
            return False
        if TYPE_METANAME not in meta_data[EXDIR_METANAME]:
            return False
        valid_types = [DATASET_TYPENAME, FILE_TYPENAME, GROUP_TYPENAME]
        if meta_data[EXDIR_METANAME][TYPE_METANAME] not in valid_types:
            return False
    return True

def is_raw_object_directory(directory):
    return is_exdir_object(directory) and not is_nonraw_object_directory(directory)

def root_directory(path):
    """
    Iterates upwards until a exdir.File object is found.

    returns: path to exdir.File or None if not found.
    """
    path = _resolve_path(path)
    found = False
    while not found:
        if path.parent == path:  # parent is self
            return None
        valid = is_nonraw_object_directory(path)
        if not valid:
            path = path.parent
            continue

        meta_filename = path / META_FILENAME
        with meta_filename.open("r", encoding="utf-8") as meta_file:
            meta_data = yaml.safe_load(meta_file)
        if EXDIR_METANAME not in meta_data:
            path = path.parent
            continue
        exdir_meta = meta_data[EXDIR_METANAME]
        if TYPE_METANAME not in exdir_meta:
            path = path.parent
            continue
        if FILE_TYPENAME != exdir_meta[TYPE_METANAME]:
            path = path.parent
            continue
        found = True
    return path

def is_inside_exdir(path):
    path = _resolve_path(path)
    return root_directory(path) is not None

def assert_inside_exdir(path):
    path = _resolve_path(path)
    if not is_inside_exdir(path):
        raise RuntimeError("Path " + str(path) + " is not inside an Exdir repository.")

def open_object(path):
    from . import exdir_file
    path = _resolve_path(path)
    assert_inside_exdir(path)
    root_dir = root_directory(path)
    object_name = path.relative_to(root_dir)
    object_name = object_name.as_posix()
    exdir_file = exdir_file.File(root_dir)
    if object_name == ".":
        return exdir_file
    return exdir_file[object_name]

# NOTE This is in a separate file only because of circular imports between Object and Raw otherwise
# TODO move this back to Object once circular imports are figured out

class Object(object):
    """
    Parent class for exdir Group and exdir dataset objects
    """
    def __init__(self, root_directory, parent_path, object_name, file):
        self.root_directory = root_directory
        self.object_name = str(object_name)  # NOTE could be path, so convert to str
        self.parent_path = parent_path
        self.relative_path = self.parent_path / self.object_name
        relative_name = str(self.relative_path)
        if relative_name == ".":
            relative_name = ""
        self.name = "/" + relative_name
        self.file = file

    @property # TODO consider warning if file is closed
    def directory(self):
        return self.root_directory / self.relative_path

    @property
    def attrs(self):
        assert_file_open(self.file)
        return Attribute(
            self,
            mode=Attribute._Mode.ATTRIBUTES,
            file=self.file,
        )

    @attrs.setter
    def attrs(self, value):
        assert_file_open(self.file)
        self.attrs._set_data(value)

    @property
    def meta(self):
        assert_file_open(self.file)
        return Attribute(
            self,
            mode=Attribute._Mode.METADATA,
            file=self.file,
        )

    @property # TODO consider warning if file is closed,
    def attributes_filename(self):
        return self.directory / ATTRIBUTES_FILENAME

    @property # TODO consider warning if file is closed
    def meta_filename(self):
        return self.directory / META_FILENAME

    def create_raw(self, name):
        from .raw import Raw
        assert_file_open(self.file)
        _assert_valid_name(name, self)
        directory_name = self.directory / name
        if directory_name.exists():
            raise FileExistsError("'{}' already exists in '{}'".format(name, self))
        directory_name.mkdir()
        return Raw(
            root_directory=self.root_directory,
            parent_path=self.relative_path,
            object_name=name,
            file=self.file
        )

    def require_raw(self, name):
        from .raw import Raw
        assert_file_open(self.file)
        directory_name = self.directory / name
        if directory_name.exists():
            if is_nonraw_object_directory(directory_name):
                raise FileExistsError(
                    "Directory '{}' already exists, but is not raw.".format(directory_name)
                )
            return Raw(
                root_directory=self.root_directory,
                parent_path=self.relative_path,
                object_name=name,
                file=self.file
            )

        return self.create_raw(name)

    @property
    def parent(self):
        from .group import Group
        assert_file_open(self.file)
        if len(self.parent_path.parts) < 1:
            return None
        parent_name = self.parent_path.name
        parent_parent_path = self.parent_path.parent
        return Group(
            root_directory=self.root_directory,
            parent_path=parent_parent_path,
            object_name=parent_name,
            file=self.file
        )

    def __eq__(self, other):
        if self.file.io_mode == OpenMode.FILE_CLOSED:
            return False
        if not isinstance(other, Object):
            return False
        return (
            self.relative_path == other.relative_path and
            self.root_directory == other.root_directory
        )

    def __bool__(self):
        if self.file.io_mode == OpenMode.FILE_CLOSED:
            return False
        return True

    def _repr_html_(self):
        if self.file.io_mode == OpenMode.FILE_CLOSED:
            return None
        return exdir.utils.display.html_tree(self)

    def __repr__(self):
        if self.file.io_mode == OpenMode.FILE_CLOSED:
            return "<Closed Exdir Group>"
        return "<Exdir Group '{}' (mode {})>".format(
            self.directory, self.file.user_mode)


text:
<resources>
    <string name="app_name">GeoTracker</string>
    <string name="clear_list">Alle POI löschen</string>
    <string name="title_activity_web_view">WebView</string>
    <string name="title_activity_geo_object">GeoObjectActivity</string>
    <string name="date">Datum:</string>
    <string name="type">Kategorie:</string>
    <string name="name">Name:</string>
    <string name="name_hint">Bitte Namen eingeben...</string>
    <string name="description">Beschreibung:</string>
    <string name="description_hint">Bitte Beschreibung eingeben...</string>
    <string name="delete">Löschen</string>
    <string name="save">Speichern</string>
    <string name="upload">Upload</string>
    <string name="upload_success">Upload erfolgreich!</string>
    <string name="upload_error">Upload fehlgeschlagen!</string>
    <string name="imgdesc">imgdesc</string>
    <string name="change_type_button">Kategorie ändern</string>
    <string name="change_type">Vor dem Upload die Kategorie ändern!</string>
    <string name="search_text">Nach Kategorie suchen...</string>
    <string name="title_activity_type_list">TypeListActivity</string>
    <string name="navigation_drawer_open">Navigation Drawer öffnen</string>
    <string name="navigation_drawer_close">Navigation Drawer schließem</string>
    <string name="new_poi">Neue POI</string>
    <string name="map_apps">map.apps</string>
    <string name="info">Info</string>
    <string name="author">Matthias Stein</string>
    <string name="company">con terra</string>
</resources>


text:
/* -*- Mode:cc-mode; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/* vim: set ai sw=2 ts=2 et cindent cino={1s: */
/*
 * Host Identity Protocol
 * Copyright (c) 2011-2012 the Boeing Company
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *  \file  ifmap_thread.h
 *
 *  \authors	David Mattes, <david.mattes@boeing.com>
 *
 *  \brief  IF-MAP Plug-in for Endbox mode: Qt thread exec for MAP Client
 *
 */

#ifndef IFMAP_THREAD_H
#define IFMAP_THREAD_H

#include <QtCore>

extern QMutex mapMutex;
extern QWaitCondition mapWaitCond;

class IfmapClient;

class IfmapThread : public QThread {
  Q_OBJECT
public:
  IfmapThread(QObject *parent = 0);
  ~IfmapThread();

  void run();

  void deleteMapClient();

public:
  IfmapClient *_client;

};

#endif


text:
export default class PromiseState {

  // creates a new PromiseState that is pending
  static create(meta) {
    return new PromiseState({
      pending: true,
      meta: meta
    })
  }

  // creates as PromiseState that is refreshing
  // can be called without a previous PromiseState and will be both pending and refreshing
  static refresh(previous, meta) {
    const ps = previous || PromiseState.create(meta)
    ps.refreshing = true
    return ps
  }

  // creates a PromiseState that is resolved with the given value.
  // if the given value is already a PromiseState,
  // it will be returned as is and ignore the provided meta.
  static resolve(value, meta) {
    if (value instanceof PromiseState) {
      return value
    }

    return new PromiseState({
      fulfilled: true,
      value: value,
      meta: meta
    })
  }

  // creates a PromiseState that is rejected with the given reason
  static reject(reason, meta) {
    return new PromiseState({
      rejected: true,
      reason: reason,
      meta: meta
    })
  }

  // The PromiseState.all(iterable) method returns a PromiseState
  // that resolves when all of the PromiseStates in the iterable
  // argument have resolved, or rejects with the reason of the
  // first passed PromiseState that rejects.
  static all(iterable) {
    if (!Array.isArray(iterable)) {
      iterable = Array.from(iterable)
    }

    return new PromiseState({
      pending: iterable.some(ps => ps.pending),
      refreshing: iterable.some(ps => ps.refreshing),
      fulfilled: iterable.every(ps => ps.fulfilled),
      rejected: iterable.some(ps => ps.rejected),
      value: iterable.map(ps => ps.value),
      reason: (iterable.find(ps => ps.reason) || {}).reason,
      meta: iterable.map(ps => ps.meta)
    })
  }

  // The PromiseState.race(iterable) method returns a PromiseState
  // that resolves or rejects as soon as one of the PromiseStates in
  // the iterable resolves or rejects, with the value or reason
  // from that PromiseState.
  static race(iterable) {
    if (!Array.isArray(iterable)) {
      iterable = Array.from(iterable)
    }

    const winner = iterable.find(ps => ps.settled)

    return new PromiseState({
      pending: !winner && iterable.some(ps => ps.pending),
      refreshing: !winner && iterable.some(ps => ps.refreshing),
      fulfilled: winner && winner.fulfilled,
      rejected: winner && winner.rejected,
      value: winner && winner.value,
      reason: winner && winner.reason,
      meta: winner && winner.meta
    })
  }

  // Constructor for creating a raw PromiseState. DO NOT USE DIRECTLY. Instead, use PromiseState.create() or other static constructors
  constructor({ pending = false, refreshing = false, fulfilled = false, rejected = false, value = null, reason = null, meta = {} }) {
    this.pending = pending
    this.refreshing = refreshing
    this.fulfilled = fulfilled
    this.rejected = rejected
    this.settled = fulfilled || rejected
    this.value = value
    this.reason = reason
    this.meta = meta
  }

  // Appends and calls fulfillment and rejection handlers on the PromiseState,
  // and returns a new PromiseState resolving to the return value of the called handler,
  // or to its original settled value if the promise was not handled.
  // The handler functions take the value/reason and meta as parameters.
  // (i.e. if the relevant handler onFulfilled or onRejected is undefined).
  // Note, unlike Promise.then(), these handlers are called immediately.
  then(onFulFilled, onRejected) {
    if (this.fulfilled && onFulFilled) {
      return this._mapFlatMapValue(onFulFilled(this.value, this.meta))
    }

    if (this.rejected && onRejected) {
      return this._mapFlatMapValue(onRejected(this.reason, this.meta))
    }

    return this
  }

  // Appends and calls a rejection handler callback to the PromiseState,
  // and returns a new PromiseState resolving to the return value of the
  // callback if it is called, or to its original fulfillment value if
  // the PromiseState is instead fulfilled. The handler function take
  // the reason and meta as parameters. Note, unlike Promise.catch(),
  // this handlers is called immediately.
  catch(onRejected) {
    return this.then(undefined, onRejected)
  }

  _mapFlatMapValue(value) {
    if (value instanceof PromiseState) {
      return value
    } else {
      return PromiseState.resolve(value, this.meta)
    }
  }
}


text:
package org.gradle.api.internal.artifacts.ivyservice;

import org.apache.ivy.Ivy;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.util.Message;
import org.gradle.api.Action;
import org.gradle.api.Transformer;
import org.gradle.internal.Transformers;

import java.util.LinkedList;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class DefaultIvyContextManager implements IvyContextManager {
    private static final int MAX_CACHED_IVY_INSTANCES = 4;
    private final Lock lock = new ReentrantLock();
    private boolean messageAdapterAttached;
    private final LinkedList<Ivy> cached = new LinkedList<Ivy>();
    private final ThreadLocal<Integer> depth = new ThreadLocal<Integer>();

    public void withIvy(final Action<? super Ivy> action) {
        withIvy(Transformers.toTransformer(action));
    }

    public <T> T withIvy(Transformer<? extends T, ? super Ivy> action) {
        Integer currentDepth = depth.get();

        if (currentDepth != null) {
            depth.set(currentDepth + 1);
            try {
                return action.transform(IvyContext.getContext().getIvy());
            } finally {
                depth.set(currentDepth);
            }
        }

        IvyContext.pushNewContext();
        try {
            depth.set(1);
            try {
                Ivy ivy = getIvy();
                try {
                    IvyContext.getContext().setIvy(ivy);
                    return action.transform(ivy);
                } finally {
                    releaseIvy(ivy);
                }
            } finally {
                depth.set(null);
            }
        } finally {
            IvyContext.popContext();
        }
    }

    private Ivy getIvy() {
        lock.lock();
        try {
            if (!cached.isEmpty()) {
                return cached.removeFirst();
            }
            if (!messageAdapterAttached) {
                Message.setDefaultLogger(new IvyLoggingAdaper());
                messageAdapterAttached = true;
            }
        } finally {
            lock.unlock();
        }
        return Ivy.newInstance(new IvySettings());
    }

    private void releaseIvy(Ivy ivy) {
        // cleanup
        ivy.getSettings().getResolvers().clear();
        ivy.getSettings().setDefaultResolver(null);

        lock.lock();
        try {
            if (cached.size() < MAX_CACHED_IVY_INSTANCES) {
                cached.add(ivy);
            }
            // else, throw it away
        } finally {
            lock.unlock();
        }
    }
}


text:
package org.apache.abdera.protocol.server.adapters.jcr;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.activation.MimeType;
import javax.jcr.Credentials;
import javax.jcr.ItemExistsException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
import javax.jcr.Workspace;

import org.apache.abdera.Abdera;
import org.apache.abdera.factory.Factory;
import org.apache.abdera.i18n.iri.IRI;
import org.apache.abdera.i18n.text.Sanitizer;
import org.apache.abdera.model.Content;
import org.apache.abdera.model.Element;
import org.apache.abdera.model.Person;
import org.apache.abdera.model.Text;
import org.apache.abdera.model.Content.Type;
import org.apache.abdera.protocol.server.RequestContext;
import org.apache.abdera.protocol.server.ResponseContext;
import org.apache.abdera.protocol.server.RequestContext.Scope;
import org.apache.abdera.protocol.server.context.EmptyResponseContext;
import org.apache.abdera.protocol.server.context.ResponseContextException;
import org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter;
import org.apache.abdera.protocol.util.PoolManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;

/**
 * Adapter implementation that uses a JCR Repository to store Atompub collection entries. The adapter is intended to be
 * used with the DefaultProvider implementation.
 */
public class JcrCollectionAdapter extends AbstractEntityCollectionAdapter<Node> {

    private final static Log log = LogFactory.getLog(JcrCollectionAdapter.class);

    private static final String TITLE = "title";

    private static final String SUMMARY = "summary";

    private static final String UPDATED = "updated";

    private static final String AUTHOR = "author";

    private static final String AUTHOR_EMAIL = "author.email";

    private static final String AUTHOR_LANGUAGE = "author.language";

    private static final String AUTHOR_NAME = "author.name";

    private static final String CONTENT = "content";

    private static final String SESSION_KEY = "jcrSession";

    private static final String MEDIA = "media";

    private static final String CONTENT_TYPE = "contentType";

    private static final String NAMESPACE = "http://abdera.apache.org";

    private String collectionNodePath;

    private String id;

    private String title;

    private String author;

    private String collectionNodeId;

    private Repository repository;

    private Credentials credentials;

    private int maxActiveSessions = 100;

    private PoolManager<Session> sessionPool;

    public void setCollectionNodePath(String collectionNodePath) {
        this.collectionNodePath = collectionNodePath;
    }

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

    public void setAuthor(String author) {
        this.author = author;
    }

    /**
     * Logs into the repository and posts a node for the collection if one does not exist. Also, this will set up the
     * session pool.
     *
     * @throws RepositoryException
     */
    public void initialize() throws Exception {
        Session session = repository.login(credentials);

        Node collectionNode = null;
        try {
            collectionNode = session.getRootNode().getNode(collectionNodePath);
        } catch (PathNotFoundException e) {
            collectionNode = session.getRootNode().addNode(collectionNodePath);
            collectionNode.addMixin("mix:referenceable");
            session.save();
        }

        this.collectionNodeId = collectionNode.getUUID();
        this.id = "urn:" + collectionNodeId;

        Workspace workspace = session.getWorkspace();

        // Get the NodeTypeManager from the Workspace.
        // Note that it must be cast from the generic JCR NodeTypeManager to the
        // Jackrabbit-specific implementation.
        JackrabbitNodeTypeManager jntmgr = (JackrabbitNodeTypeManager)workspace.getNodeTypeManager();
        if (!jntmgr.hasNodeType("abdera:entry")) {
            InputStream in = getClass().getResourceAsStream("/org/apache/abdera/jcr/nodeTypes.xml");
            try {
                // register the node types and any referenced namespaces
                jntmgr.registerNodeTypes(in, JackrabbitNodeTypeManager.TEXT_XML);
            } finally {
                in.close();
            }
        }

        session.logout();

        sessionPool = new SessionPoolManager(maxActiveSessions, repository, credentials);
    }

    @Override
    public void start(RequestContext request) throws ResponseContextException {
        try {
            Session session = (Session)sessionPool.get(request);

            request.setAttribute(Scope.REQUEST, SESSION_KEY, session);
        } catch (Exception e) {
            throw new ResponseContextException(500, e);
        }
    }

    @Override
    public void end(RequestContext request, ResponseContext response) {
        // Logout of the JCR session
        Session session = getSession(request);
        if (session != null) {
            try {
                sessionPool.release(session);
            } catch (Exception e) {
                log.warn("Could not return Session to pool!", e);
            }
        }
    }

    @Override
    public String getContentType(Node entry) {
        try {
            return getStringOrNull(entry, CONTENT_TYPE);
        } catch (ResponseContextException e) {
            throw new UnsupportedOperationException();
        }
    }

    @Override
    public boolean isMediaEntry(Node entry) throws ResponseContextException {
        try {
            return entry.hasProperty(MEDIA);
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    @Override
    public Node postMedia(MimeType mimeType, String slug, InputStream inputStream, RequestContext request)
        throws ResponseContextException {
        if (slug == null) {
            throw new ResponseContextException("A slug header must be supplied.", 500);
        }
        Node n = postEntry(slug, null, null, new Date(), null, null, request);

        try {
            n.setProperty(MEDIA, inputStream);
            n.setProperty(CONTENT_TYPE, mimeType.toString());

            String summary = postSummaryForEntry(n);
            if (summary != null) {
                n.setProperty(SUMMARY, summary);
            }

            getSession(request).save();

            return n;
        } catch (RepositoryException e) {
            try {
                getSession(request).refresh(false);
            } catch (Throwable t) {
                log.warn(t);
            }
            throw new ResponseContextException(500, e);
        }
    }

    /**
     * post a summary for an entry. Used when a media entry is postd so you have the chance to post a meaningful summary
     * for consumers of the feed.
     *
     * @param n
     * @return
     */
    protected String postSummaryForEntry(Node n) {
        return null;
    }

    @Override
    public Node postEntry(String title,
                          IRI id,
                          String summary,
                          Date updated,
                          List<Person> authors,
                          Content content,
                          RequestContext request) throws ResponseContextException {
        Session session = getSession(request);
        try {

            Node collectionNode = session.getNodeByUUID(collectionNodeId);
            String resourceName = Sanitizer.sanitize(title, "-");
            return postEntry(title, summary, updated, authors, content, session, collectionNode, resourceName, 0);
        } catch (RepositoryException e) {
            try {
                session.refresh(false);
            } catch (Throwable t) {
                log.warn(t);
            }
            throw new ResponseContextException(500, e);
        }
    }

    protected Node postEntry(String title,
                             String summary,
                             Date updated,
                             List<Person> authors,
                             Content content,
                             Session session,
                             Node collectionNode,
                             String resourceName,
                             int num) throws ResponseContextException, RepositoryException {
        try {
            String name = resourceName;
            if (num > 0) {
                name = name + "_" + num;
            }
            Node entry = collectionNode.addNode(name, "abdera:entry");

            entry.addMixin("mix:referenceable");

            mapEntryToNode(entry, title, summary, updated, authors, content, session);

            session.save();

            return entry;
        } catch (ItemExistsException e) {
            return postEntry(title, summary, updated, authors, content, session, collectionNode, resourceName, ++num);
        }
    }

    protected Node mapEntryToNode(Node entry,
                                  String title,
                                  String summary,
                                  Date updated,
                                  List<Person> authors,
                                  Content content,
                                  Session session) throws ResponseContextException, RepositoryException {
        if (title == null) {
            EmptyResponseContext ctx = new EmptyResponseContext(500);
            ctx.setStatusText("Entry title cannot be empty.");
            throw new ResponseContextException(ctx);
        }

        entry.setProperty(TITLE, title);

        if (summary != null) {
            entry.setProperty(SUMMARY, summary);
        }

        Calendar upCal = Calendar.getInstance();
        upCal.setTime(updated);
        entry.setProperty(UPDATED, upCal);

        if (authors != null) {
            for (Person p : authors) {
                Node addNode = entry.addNode(AUTHOR);
                addNode.setProperty(AUTHOR_EMAIL, p.getEmail());
                addNode.setProperty(AUTHOR_LANGUAGE, p.getLanguage());
                addNode.setProperty(AUTHOR_NAME, p.getName());
            }
        }

        if (content != null) {
            switch (content.getContentType()) {
                case TEXT:
                    entry.setProperty(CONTENT, content.getText());
                    entry.setProperty(CONTENT_TYPE, Type.TEXT.toString());
                    break;
                case XHTML:
                    entry.setProperty(CONTENT, asString(content));
                    entry.setProperty(CONTENT_TYPE, Type.XHTML.toString());
                    break;
                default:
                    throw new ResponseContextException("Invalid content element type.", 500);
            }
        }

        if (summary != null) {
            entry.setProperty(SUMMARY, summary);
        }

        return entry;
    }

    private String asString(Content content2) throws ResponseContextException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            content2.<Element> getFirstChild().writeTo(bos);
        } catch (IOException e) {
            throw new ResponseContextException(500, e);
        }
        return new String(bos.toByteArray());
    }

    protected Session getSession(RequestContext request) {
        return (Session)request.getAttribute(Scope.REQUEST, SESSION_KEY);
    }

    @Override
    public void deleteEntry(String resourceName, RequestContext request) throws ResponseContextException {
        Session session = getSession(request);
        try {
            getNode(session, resourceName).remove();
            session.save();
        } catch (RepositoryException e) {
            try {
                session.refresh(false);
            } catch (Throwable t) {
                log.warn(t);
            }
            throw new ResponseContextException(500, e);
        }
    }

    private Node getNode(Session session, String resourceName) throws ResponseContextException, RepositoryException {
        try {
            return session.getNodeByUUID(collectionNodeId).getNode(resourceName);
        } catch (PathNotFoundException e) {
            throw new ResponseContextException(404);
        }
    }

    /** Recursively outputs the contents of the given node. */
    public static void dump(Node node) throws RepositoryException {
        // First output the node path
        System.out.println(node.getPath());
        // Skip the virtual (and large!) jcr:system subtree
        if (node.getName().equals("jcr:system")) {
            return;
        }

        // Then output the properties
        PropertyIterator properties = node.getProperties();
        while (properties.hasNext()) {
            Property property = properties.nextProperty();
            if (property.getDefinition().isMultiple()) {
                // A multi-valued property, print all values
                Value[] values = property.getValues();
                for (int i = 0; i < values.length; i++) {
                    System.out.println(property.getPath() + " = " + values[i].getString());
                }
            } else {
                // A single-valued property
                System.out.println(property.getPath() + " = " + property.getString());
            }
        }

        // Finally output all the child nodes recursively
        NodeIterator nodes = node.getNodes();
        while (nodes.hasNext()) {
            dump(nodes.nextNode());
        }
    }

    @Override
    public String getAuthor(RequestContext request) throws ResponseContextException {
        return author;
    }

    @Override
    public List<Person> getAuthors(Node entry, RequestContext request) throws ResponseContextException {
        try {
            ArrayList<Person> authors = new ArrayList<Person>();
            for (NodeIterator nodes = entry.getNodes(); nodes.hasNext();) {
                Node n = nodes.nextNode();

                if (n.getName().equals(AUTHOR)) {
                    Person author = request.getAbdera().getFactory().newAuthor();
                    author.setName(getStringOrNull(entry, AUTHOR_NAME));
                    author.setEmail(getStringOrNull(entry, AUTHOR_EMAIL));
                    author.setLanguage(getStringOrNull(entry, AUTHOR_LANGUAGE));
                    authors.add(author);
                }
            }
            return authors;
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    @Override
    public Object getContent(Node entry, RequestContext request) throws ResponseContextException {

        String typeStr = getStringOrNull(entry, CONTENT_TYPE);
        Factory factory = Abdera.getInstance().getFactory();
        String textContent = getStringOrNull(entry, CONTENT);
        Type type = Type.valueOf(typeStr);
        Content content = factory.newContent(type);
        switch (type) {
            case TEXT:
                content.setValue(textContent);
                return content;
            case XHTML:
                content.setWrappedValue(textContent);
                return content;
            default:
        }
        return null;
    }

    @Override
    public Iterable<Node> getEntries(RequestContext request) throws ResponseContextException {
        ArrayList<Node> entries = new ArrayList<Node>();

        Session session = getSession(request);
        try {
            Node n = session.getNodeByUUID(collectionNodeId);
            for (NodeIterator nodes = n.getNodes(); nodes.hasNext();) {
                entries.add(nodes.nextNode());
            }
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }

        return entries;
    }

    @Override
    public Node getEntry(String resourceName, RequestContext request) throws ResponseContextException {
        try {
            return getNode(getSession(request), resourceName);
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    @Override
    public String getId(RequestContext request) {
        return id;
    }

    @Override
    public String getId(Node entry) throws ResponseContextException {
        try {
            return "urn:" + entry.getUUID();
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    public String getMediaName(Node entry) throws ResponseContextException {
        return getName(entry);
    }

    public InputStream getMediaStream(Node entry) throws ResponseContextException {
        try {
            Value value = getValueOrNull(entry, MEDIA);
            return (value != null) ? value.getStream() : null;
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }

    }

    @Override
    public String getName(Node entry) throws ResponseContextException {
        try {
            return entry.getName();
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    @Override
    public Text getSummary(Node entry, RequestContext request) throws ResponseContextException {
        Text summary = request.getAbdera().getFactory().newSummary();
        summary.setText(getStringOrNull(entry, SUMMARY));
        return summary;
    }

    public String getTitle(RequestContext request) {
        return title;
    }

    @Override
    public String getTitle(Node entry) throws ResponseContextException {
        return getStringOrNull(entry, TITLE);
    }

    @Override
    public Date getUpdated(Node entry) throws ResponseContextException {
        Calendar updated = getDateOrNull(entry, UPDATED);
        return (updated != null) ? updated.getTime() : null;
    }

    @Override
    public void putEntry(Node entry,
                         String title,
                         Date updated,
                         List<Person> authors,
                         String summary,
                         Content content,
                         RequestContext request) throws ResponseContextException {
        Session session = getSession(request);
        try {
            mapEntryToNode(entry, title, summary, updated, authors, content, session);
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    public static String getStringOrNull(Node node, String propName) throws ResponseContextException {
        try {
            Value v = getValueOrNull(node, propName);
            return (v != null) ? v.getString() : null;
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    public ResponseContext getCategories(RequestContext request) {
        return null;
    }

    public static Calendar getDateOrNull(Node node, String propName) throws ResponseContextException {
        try {
            Value v = getValueOrNull(node, propName);
            return (v != null) ? v.getDate() : null;
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }

    public static Value getValueOrNull(Node node, String propName) throws RepositoryException {
        return node.hasProperty(propName) ? node.getProperty(propName).getValue() : null;
    }

    public void setRepository(Repository repository) {
        this.repository = repository;
    }

    public void setCredentials(Credentials credentials) {
        this.credentials = credentials;
    }

    public void setMaxActiveSessions(int maxActiveSessions) {
        this.maxActiveSessions = maxActiveSessions;
    }

}


text:
<stix:STIX_Package
	xmlns:cyboxCommon="http://cybox.mitre.org/common-2"
	xmlns:cybox="http://cybox.mitre.org/cybox-2"
	xmlns:cyboxVocabs="http://cybox.mitre.org/default_vocabularies-2"
	xmlns:example="http://example.com"
	xmlns:incident="http://stix.mitre.org/Incident-1"
	xmlns:ta="http://stix.mitre.org/ThreatActor-1"
	xmlns:stixCommon="http://stix.mitre.org/common-1"
	xmlns:stixVocabs="http://stix.mitre.org/default_vocabularies-1"
	xmlns:stix-ciqidentity="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1"
	xmlns:stix="http://stix.mitre.org/stix-1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xal="urn:oasis:names:tc:ciq:xal:3"
	xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3"
	xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3"
	xsi:schemaLocation="
	http://cybox.mitre.org/common-2 http://cybox.mitre.org/XMLSchema/common/2.1/cybox_common.xsd
	http://cybox.mitre.org/cybox-2 http://cybox.mitre.org/XMLSchema/core/2.1/cybox_core.xsd
	http://cybox.mitre.org/default_vocabularies-2 http://cybox.mitre.org/XMLSchema/default_vocabularies/2.1/cybox_default_vocabularies.xsd
	http://stix.mitre.org/Incident-1 http://stix.mitre.org/XMLSchema/incident/1.1.1/incident.xsd
	http://stix.mitre.org/ThreatActor-1 http://stix.mitre.org/XMLSchema/threat_actor/1.1.1/threat_actor.xsd
	http://stix.mitre.org/common-1 http://stix.mitre.org/XMLSchema/common/1.1.1/stix_common.xsd
	http://stix.mitre.org/default_vocabularies-1 http://stix.mitre.org/XMLSchema/default_vocabularies/1.1.1/stix_default_vocabularies.xsd
	http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1 http://stix.mitre.org/XMLSchema/extensions/identity/ciq_3.0/1.1.1/ciq_3.0_identity.xsd
	http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.1.1/stix_core.xsd
	urn:oasis:names:tc:ciq:xal:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xAL.xsd
	urn:oasis:names:tc:ciq:xnl:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xNL.xsd
	urn:oasis:names:tc:ciq:xpil:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xPIL.xsd" id="example:Package-4070a292-8a03-4ef6-993c-bbe9327481c3" version="1.1.1" timestamp="2014-09-29T20:52:00+00:00">
    <stix:Incidents>
        <stix:Incident id="example:incident-3cb55baf-a8ba-47bb-b0b2-d7d4f4c281a2" timestamp="2014-09-29T20:52:00+00:00" xsi:type='incident:IncidentType'>
            <incident:Title>A reporter called the Ryerson registrars office to investigate the student status of a person who turned himself in for sexual assault. The registrar allegedly gave information about the student's enrollment status to the reporter which is a violation of the privacy policy.</incident:Title>
            <incident:External_ID source="VERIS">9F5EC660-3CB5-46C1-93E1-24D8F54B5432</incident:External_ID>
            <incident:Time>
                <incident:Initial_Compromise precision="day">2012-11-14T00:00:00</incident:Initial_Compromise>
            </incident:Time>
            <incident:Reporter>
                <stixCommon:Identity xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
                    <ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
  <xpil:PartyName xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xnl:NameLine xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3">dhylender</xnl:NameLine>
  </xpil:PartyName>
</ExtSch:Specification>
                </stixCommon:Identity>
            </incident:Reporter>
            <incident:Victim xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
                <ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
  <xpil:PartyName xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xnl:NameLine xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3">Reyerson University</xnl:NameLine>
  </xpil:PartyName>
  <xpil:Addresses xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xpil:Address>
      <xal:Country xmlns:xal="urn:oasis:names:tc:ciq:xal:3">
        <xal:NameElement>CA</xal:NameElement>
      </xal:Country>
    </xpil:Address>
  </xpil:Addresses>
</ExtSch:Specification>
            </incident:Victim>
            <incident:Affected_Assets>
                <incident:Affected_Asset>
                    <incident:Type>Unknown</incident:Type>
                    <incident:Nature_Of_Security_Effect>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Confidentiality</incident:Property>
                            <incident:Description_Of_Effect>Other: 1</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                    </incident:Nature_Of_Security_Effect>
                </incident:Affected_Asset>
            </incident:Affected_Assets>
            <incident:Impact_Assessment>
                <incident:Impact_Qualification xsi:type="stixVocabs:ImpactQualificationVocab-1.0">Unknown</incident:Impact_Qualification>
            </incident:Impact_Assessment>
            <incident:Attributed_Threat_Actors>
                <incident:Threat_Actor>
                    <stixCommon:Threat_Actor idref="example:threatactor-d0d78bba-df1c-4669-9446-76ddace0bcbe" xsi:type='ta:ThreatActorType'/>
                </incident:Threat_Actor>
            </incident:Attributed_Threat_Actors>
            <incident:Security_Compromise xsi:type="stixVocabs:SecurityCompromiseVocab-1.0">Yes</incident:Security_Compromise>
            <incident:Discovery_Method xsi:type="stixVocabs:DiscoveryMethodVocab-1.0">Unknown</incident:Discovery_Method>
            <incident:Information_Source>
                <stixCommon:Identity>
                    <stixCommon:Name>vcdb</stixCommon:Name>
                </stixCommon:Identity>
                <stixCommon:Tools>
                    <cyboxCommon:Tool>
                        <cyboxCommon:Name>veris2stix</cyboxCommon:Name>
                        <cyboxCommon:Vendor>MITRE</cyboxCommon:Vendor>
                        <cyboxCommon:Version>0.1</cyboxCommon:Version>
                    </cyboxCommon:Tool>
                    <cyboxCommon:Tool>
                        <cyboxCommon:Name>VERIS schema</cyboxCommon:Name>
                        <cyboxCommon:Vendor>Verizon</cyboxCommon:Vendor>
                        <cyboxCommon:Version>1.3</cyboxCommon:Version>
                    </cyboxCommon:Tool>
                </stixCommon:Tools>
                <stixCommon:References>
                    <stixCommon:Reference>http://www.pogowasright.org/?p=32718</stixCommon:Reference>
                </stixCommon:References>
            </incident:Information_Source>
        </stix:Incident>
    </stix:Incidents>
    <stix:Threat_Actors>
        <stix:Threat_Actor id="example:threatactor-d0d78bba-df1c-4669-9446-76ddace0bcbe" timestamp="2014-12-22T16:31:58.760000+00:00" xsi:type='ta:ThreatActorType'>
            <ta:Type timestamp="2014-12-22T16:31:58.760000+00:00">
                <stixCommon:Value xsi:type="stixVocabs:ThreatActorTypeVocab-1.0">Insider Threat</stixCommon:Value>
                <stixCommon:Description>Other</stixCommon:Description>
            </ta:Type>
            <ta:Motivation timestamp="2014-12-22T16:31:58.760000+00:00">
                <stixCommon:Value xsi:type="stixVocabs:MotivationVocab-1.1">Opportunistic</stixCommon:Value>
            </ta:Motivation>
        </stix:Threat_Actor>
    </stix:Threat_Actors>
</stix:STIX_Package>


text:
package org.stefaniuk.json.service.test.service;

import java.util.List;

import org.stefaniuk.json.service.JsonService;
import org.stefaniuk.json.service.test.bean.User;

public class ListService {

    @JsonService
    public List<User> echo(List<User> users) {

        for(User user: users) {
            user.setPassword("******");
        }

        return users;
    }

}


text:
/**
 * MobileAppCategoryVideoCriterion.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.adwords.axis.v201402.video;

/**
 * Represents the operating system criterion used for campaign scheduling.
 * This criterion is immutable
 */
public class MobileAppCategoryVideoCriterion  extends com.google.api.ads.adwords.axis.v201402.video.BaseCriterion  implements java.io.Serializable {
    private java.lang.Integer mobileAppCategoryId;

    public MobileAppCategoryVideoCriterion() {
    }

    public MobileAppCategoryVideoCriterion(
           java.lang.Long id,
           java.lang.String baseCriterionType,
           java.lang.Integer mobileAppCategoryId) {
        super(
            id,
            baseCriterionType);
        this.mobileAppCategoryId = mobileAppCategoryId;
    }

    /**
     * Gets the mobileAppCategoryId value for this MobileAppCategoryVideoCriterion.
     *
     * @return mobileAppCategoryId
     */
    public java.lang.Integer getMobileAppCategoryId() {
        return mobileAppCategoryId;
    }

    /**
     * Sets the mobileAppCategoryId value for this MobileAppCategoryVideoCriterion.
     *
     * @param mobileAppCategoryId
     */
    public void setMobileAppCategoryId(java.lang.Integer mobileAppCategoryId) {
        this.mobileAppCategoryId = mobileAppCategoryId;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof MobileAppCategoryVideoCriterion)) return false;
        MobileAppCategoryVideoCriterion other = (MobileAppCategoryVideoCriterion) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = super.equals(obj) &&
            ((this.mobileAppCategoryId==null && other.getMobileAppCategoryId()==null) ||
             (this.mobileAppCategoryId!=null &&
              this.mobileAppCategoryId.equals(other.getMobileAppCategoryId())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = super.hashCode();
        if (getMobileAppCategoryId() != null) {
            _hashCode += getMobileAppCategoryId().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(MobileAppCategoryVideoCriterion.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/video/v201402", "MobileAppCategoryVideoCriterion"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("mobileAppCategoryId");
        elemField.setXmlName(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/video/v201402", "mobileAppCategoryId"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-root</artifactId>
        <version>8.0-SNAPSHOT</version>
    </parent>
    <artifactId>vaadin-compatibility-client-compiled</artifactId>
    <name>vaadin-compatibility-client-compiled</name>
    <packaging>jar</packaging>

    <properties>
        <widgetset.name>com.vaadin.v7.Vaadin7WidgetSet</widgetset.name>
        <widgetset.style>OBF</widgetset.style>
        <widgetset.local.workers>6</widgetset.local.workers>
        <!-- These files are directly from Vaadin 7 -->
        <sonar.skip>true</sonar.skip>
    </properties>

    <url>https://vaadin.com/</url>
    <description>Vaadin 7 compatibility client compiled</description>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>vaadin-compatibility-server</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>vaadin-compatibility-client</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiler</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-buildhelpers</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-export-package</id>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <classpathScope>compile</classpathScope>
                            <executable>${java.home}/bin/java</executable>
                            <arguments>
                                <argument>-Dvaadin.version=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</argument>
                                <argument>-DincludeNumberPackages=1</argument>

                                <argument>-classpath</argument>
                                <classpath />

                                <argument>com.vaadin.buildhelpers.GeneratePackageExports</argument>

                                <argument>${project.build.directory}/${project.build.finalName}.${project.packaging}</argument>
                                <argument>VAADIN/widgetsets</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <configuration>
                    <modules>
                        <module>${widgetset.name}</module>
                    </modules>
                    <webappDirectory>${project.build.outputDirectory}/VAADIN/widgetsets</webappDirectory>
                    <persistentunitcachedir>${project.build.directory}/gwt-unitCache</persistentunitcachedir>
                    <style>${widgetset.style}</style>
                    <extraJvmArgs>-Xmx1G</extraJvmArgs>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Version>${osgi.bundle.version}</Bundle-Version>
                        <Bundle-RequiredExecutionEnvironment>${osgi.execution.environment}</Bundle-RequiredExecutionEnvironment>
                        <!-- Export package is handled in exec plugin -->
                        <Export-Package></Export-Package>
                        <Import-Package></Import-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <index>false</index>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse
                    m2e settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.codehaus.mojo
                                        </groupId>
                                        <artifactId>
                                            exec-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.4.0,)
                                        </versionRange>
                                        <goals>
                                            <goal>exec</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>


text:
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2009
 *
 *  Last modified:
 *     $Date$ by $Author$
 *     $Revision$
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  Permission is hereby granted, free of charge, to any person obtaining
 *  a copy of this software and associated documentation files (the
 *  "Software"), to deal in the Software without restriction, including
 *  without limitation the rights to use, copy, modify, merge, publish,
 *  distribute, sublicense, and/or sell copies of the Software, and to
 *  permit persons to whom the Software is furnished to do so, subject to
 *  the following conditions:
 *
 *  The above copyright notice and this permission notice shall be
 *  included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

namespace Gecode { namespace Int {

  template<class Task, PropCond pc>
  forceinline
  TaskProp<Task,pc>::TaskProp(Home home, TaskArray<Task>& t0)
    : Propagator(home), t(t0) {
    t.subscribe(home,*this,pc);
  }

  template<class Task, PropCond pc>
  forceinline
  TaskProp<Task,pc>::TaskProp(Space& home, bool shared, TaskProp<Task,pc>& p)
    : Propagator(home,shared,p) {
    t.update(home,shared,p.t);
  }

  template<class Task, PropCond pc>
  PropCost
  TaskProp<Task,pc>::cost(const Space&, const ModEventDelta&) const {
    return PropCost::linear(PropCost::HI,t.size());
  }

  template<class Task, PropCond pc>
  forceinline size_t
  TaskProp<Task,pc>::dispose(Space& home) {
    t.cancel(home,*this,pc);
    (void) Propagator::dispose(home);
    return sizeof(*this);
  }

}}

// STATISTICS: int-prop


text:
=======================================
 Enabling networking-sfc using Devstack
=======================================

1. Download DevStack

2. Add this repo as an external repository::

     > cat local.conf
     [[local|localrc]]
     enable_plugin networking-sfc https://github.com/openstack/networking-sfc

3. run ``stack.sh``


text:
import { DocumentSketch16 } from "../../";

export = DocumentSketch16;


text:
'use strict';

const smoochBot = require('smooch-bot');
const MemoryLock = smoochBot.MemoryLock;
const SmoochApiStore = smoochBot.SmoochApiStore;
const SmoochApiBot = smoochBot.SmoochApiBot;
const StateMachine = smoochBot.StateMachine;
const app = require('../app');
const script = require('../script');
const SmoochCore = require('smooch-core');
const jwt = require('../jwt');

const name = 'BrodyBot';
const avatarUrl = 'https://en.gravatar.com/userimage/50862026/28ce7a84cd60bd822f957140f2e0da3f.jpg';
const store = new SmoochApiStore({
    jwt
});
const lock = new MemoryLock();

function createWebhook(smoochCore, target) {
    return smoochCore.webhooks.create({
        target,
        triggers: ['message:appUser']
    })
        .then((res) => {
            console.log('Smooch webhook created at target', res.webhook.target);
        })
        .catch((err) => {
            console.error('Error creating Smooch webhook:', err);
            console.error(err.stack);
        });
}

// Create a webhook if one doesn't already exist
if (process.env.SERVICE_URL) {
    const target = process.env.SERVICE_URL.replace(/\/$/, '') + '/webhook';
    const smoochCore = new SmoochCore({
        jwt
    });
    smoochCore.webhooks.list()
        .then((res) => {
            if (!res.webhooks.some((w) => w.target === target)) {
                createWebhook(smoochCore, target);
            }
        });
}

app.post('/webhook', function(req, res, next) {
    const messages = req.body.messages.reduce((prev, current) => {
        if (current.role === 'appUser') {
            prev.push(current);
        }
        return prev;
    }, []);

    if (messages.length === 0) {
        return res.end();
    }

    const appUser = req.body.appUser;
    const userId = appUser.userId || appUser._id;
    const stateMachine = new StateMachine({
        script,
        bot: new SmoochApiBot({
            name,
            avatarUrl,
            lock,
            store,
            userId
        })
    });

    stateMachine.receiveMessage(messages[0])
        .then(() => res.end())
        .catch((err) => {
            console.error('SmoochBot error:', err);
            console.error(err.stack);
            res.end();
        });
});

var server = app.listen(process.env.PORT || 8000, function() {
    var host = server.address().address;
    var port = server.address().port;

    console.log('Brody Bot listening at http://%s:%s', host, port);
});


text:
NeedForCryptography
==========

A cryptographic library for python.

About NeedForCryptography
----------

NeedForCryptography is meant to be a cryptographic library. It will provide solutions for main problems in cryptography and many ciphers(some of them often used and other for educational purposes only). The project is inspired by the [Cryptography](http://www.fmi.uni-sofia.bg/algebra/cryptodescr.shtml) course at FMI.

==========

Here is a list of things that will be implemented in the library. All of them will have unit tests.
These who have a suffix "(until June 2nd)" are predictions for "Milestone 1" task of the [Python](http://fmi.py-bg.net/) course at FMI:

* Common problems:
 * Generation of large primes (until June 2nd)
 * Decomposiotion of prime divisors (until June 2nd)
 * Pohlig-Hellman algorithm for finding discrete logarithm in Zn (until June 2nd)
 * Еlectronic signature (until June 2nd)
 * Generate a random bit
 * Secret sharing schemes

* Ciphers:
 * Playfair (until June 2nd)
 * Caeser (until June 2nd)
 * L. Hill (until June 2nd)
 * RC6 (until June 2nd)
 * DES
 * 3DES
 * Feistel
 * RSA
 * MacEliece
 * Diffie–Hellman

Undercover
==========

About Undercover
----------

Undercover will be a django web application(Crypto-Chat) which uses NeedForCryptography.
Users will be able to:

* Share their public keys
* Send encrypted messages
* Decrypt messages
* Enter their private key
* Have an unique identification using "Electronic signature".


text:
ACCEPTED

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

#### Published in
Ann. Soc. Linn. Lyon sér. 2, 16:359. 1868

#### Original name
null

### Remarks
null


text:
go-app

Go-app is a package for **building progressive web apps (PWA)** with the [Go programming language (Golang)](https://golang.org) and [WebAssembly (Wasm)](https://webassembly.org).

Shaping a UI is done by using a **[declarative syntax](/syntax) that creates and compose HTML elements only by using the Go programing language**.

It **uses [Go HTTP standard](https://golang.org/pkg/net/http) model**.

An app created with go-app can out of the box **run in its own window**, **supports offline mode**, and are **SEO friendly**.

## Declarative syntax

Go-app uses a [declarative syntax](/syntax) so you can **write reusable component-based UI elements** just by using the Go programming language.

Here is a Hello World component that takes an input and displays its value in its title:

```go
type hello struct {
	app.Compo

	name string
}

func (h *hello) Render() app.UI {
	return app.Div().Body(
		app.H1().Body(
			app.Text("Hello, "),
			app.If(h.name != "",
				app.Text(h.name),
			).Else(
				app.Text("World!"),
			),
		),
		app.P().Body(
			app.Input().
				Type("text").
				Value(h.name).
				Placeholder("What is your name?").
				AutoFocus(true).
				OnChange(h.ValueTo(&h.name)),
		),
	)
}
```

## Standard HTTP

Apps created with go-app complies with [Go standard HTTP](https://golang.org/pkg/net/http) package interfaces.

```go
func main() {
    // Components routing:
	app.Route("/", &hello{})
	app.Route("/hello", &hello{})
	app.RunWhenOnBrowser()

    // HTTP routing:
	http.Handle("/", &app.Handler{
		Name:        "Hello",
		Description: "An Hello World! example",
	})

	if err := http.ListenAndServe(":8000", nil); err != nil {
		log.Fatal(err)
	}
}
```

## Other features

- [SEO friendly](/seo)
- [Installable](/install)
- Offline mode

## Next

- [Getting started](/start)
- [Understand go-app architecture](/architecture)
- [API reference](/reference)


text:
package com.zigapk.wifipassextract;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;

import com.github.clans.fab.FloatingActionButton;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

import java.util.ArrayList;

public class MainActivity extends Activity {

    public static ArrayList<CardHolder> cardHolders = new ArrayList<CardHolder>();
    public static FloatingActionButton fab;
    public static CardHolder currentCardHolder;
    public static int numberOfNetworks;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        if (Data.isFirstTime(getApplicationContext())) showTermsDialog();
        else startRefresh();

        AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);

        prepareFab();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu items for use in the action bar

        //TODO: uncomment and add coffees
        /*MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);*/
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle presses on the action bar items
        switch (item.getItemId()) {
            case R.id.action_coffee:
                showCoffeeDialog();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    private void startRefresh() {
        new Thread() {
            @Override
            public void run() {
                refresh();
            }
        }.start();
    }

    private void refresh() {
        final TextView progressTv = (TextView) findViewById(R.id.progressTextView);
        final ScrollView scrollView = (ScrollView) findViewById(R.id.mainScrollView);
        final LinearLayout scrollLinearLayout = (LinearLayout) findViewById(R.id.scrollLinearLayout);
        final ProgressBar progressBar = (ProgressBar) findViewById(R.id.mainProgressBar);

        Files.writeToFile("wpa_supplicant.conf", "", getApplicationContext());
        try {
            RootAccess.exec("cp /data/misc/wifi/wpa_supplicant.conf /data/data/com.zigapk.wifipassextract/files/");
            String fileContent = Files.getFileValue("wpa_supplicant.conf", getApplicationContext());

            final Network[] networks = Network.fromFile(fileContent);

            while (networks.length != numberOfNetworks){}
            cardHolders.clear();

            for (int i = 0; i < networks.length; i++) {
                cardHolders.add(new CardHolder(networks[i], getApplicationContext()));
            }

            new Handler(Looper.getMainLooper()).post(new Runnable() {
                                                         public void run() {
                                                             scrollLinearLayout.removeAllViews();
                                                             scrollLinearLayout.addView(marginView(32));
                                                         }
                                                     }
            );

            Thread.sleep(300);

            while (cardHolders.size() != networks.length){
                System.out.print("asdf");
            }

            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    for (int i = 0; i < cardHolders.size(); i++){
                        scrollLinearLayout.addView(cardHolders.get(i).cardView);
                    }

                    scrollLinearLayout.addView(marginView(200));
                    progressTv.setVisibility(View.GONE);
                    progressBar.setVisibility(View.GONE);
                    scrollView.setVisibility(View.VISIBLE);
                }
            });
        } catch (final Exception e) {
            Log.e("", "", e);
            showMessage(getResources().getString(R.string.not_root));
        }
    }

    private void showMessage(final String str) {
        try {
            Thread.sleep(300);
        } catch (Exception e) {
        }
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            public void run() {
                final TextView progressTv = (TextView) findViewById(R.id.progressTextView);
                final ScrollView scrollView = (ScrollView) findViewById(R.id.mainScrollView);
                final ProgressBar progressBar = (ProgressBar) findViewById(R.id.mainProgressBar);
                progressTv.setVisibility(View.VISIBLE);
                progressBar.setVisibility(View.GONE);
                scrollView.setVisibility(View.GONE);
                progressTv.setText(str);
            }
        });
    }

    private void showFirstTimeDialog() {
        new AlertDialog.Builder(MainActivity.this)
                .setTitle(R.string.hello)
                .setMessage(R.string.instructions)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {

                    }
                })
                .create().show();
        Data.setFirstTime(false, getApplicationContext());
    }

    private void showTermsDialog() {
        new Thread() {
            @Override
            public void run() {
                try {
                    Thread.sleep(500);
                } catch (Exception e) {
                }

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    public void run() {
                        new AlertDialog.Builder(MainActivity.this)
                                .setTitle(R.string.terms_title)
                                .setMessage(R.string.terms)
                                .setCancelable(false)
                                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        startRefresh();
                                        showFirstTimeDialog();
                                    }
                                })
                                .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        finish();
                                    }
                                })
                                .create().show();
                    }
                });
            }
        }.start();
    }

    private void showCoffeeDialog() {
        new AlertDialog.Builder(MainActivity.this)
                .setIcon(R.drawable.ic_coffee)
                .setTitle(R.string.give_a_coffee)
                .setItems(R.array.coffe_array, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        // The 'which' argument contains the index position
                        // of the selected item
                    }
                })
                .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                    }
                })
                .create().show();
    }

    private View marginView(int height) {
        View view = new View(getApplicationContext());
        TableRow.LayoutParams params = new TableRow.LayoutParams();
        params.height = height;
        params.width = TableRow.LayoutParams.MATCH_PARENT;
        view.setLayoutParams(params);
        return view;
    }

    private void prepareFab() {
        fab = (FloatingActionButton) findViewById(R.id.myFab);
        fab.setEnabled(false);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
                if (currentCardHolder.hiddenText != null && !currentCardHolder.hidePass) {
                    ClipData clip = ClipData.newPlainText("Password", currentCardHolder.hiddenText);
                    clipboard.setPrimaryClip(clip);
                    Toast.makeText(getApplicationContext(), "Password copied.", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(getApplicationContext(), "No password to copy.", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}


text:
using namespace eprosima::fastrtps::xmlparser;

using namespace ::testing;

class XMLTreeTests : public ::testing::Test
{
public:

    XMLTreeTests()
    {
    }

    ~XMLTreeTests()
    {
    }

};

TEST_F(XMLTreeTests, OnlyRoot)
{
    BaseNode test_base{NodeType::ROOT};
    ASSERT_EQ(NodeType::ROOT, test_base.getType());
    ASSERT_EQ(false, test_base.removeChild(0));
    ASSERT_EQ(nullptr, test_base.getChild(0));
    ASSERT_EQ(nullptr, test_base.getParent());
    ASSERT_EQ(0u, test_base.getNumChildren());
}

TEST_F(XMLTreeTests, RootChildren)
{
    BaseNode test_base{NodeType::ROOT};

    ASSERT_EQ(false, test_base.removeChild(0));
    ASSERT_EQ(nullptr, test_base.getChild(0));
    ASSERT_EQ(0u, test_base.getNumChildren());

    BaseNode* child = new BaseNode{NodeType::APPLICATION};
    test_base.addChild(std::unique_ptr<BaseNode>(child));

    ASSERT_EQ(1u, test_base.getNumChildren());
    ASSERT_EQ(child, test_base.getChild(0));
    ASSERT_EQ(&test_base, test_base.getChild(0)->getParent());
    ASSERT_EQ(NodeType::APPLICATION, test_base.getChild(0)->getType());
    ASSERT_EQ(true, test_base.removeChild(0));
    ASSERT_EQ(0u, test_base.getNumChildren());
    ASSERT_EQ(false, test_base.removeChild(0));
}

TEST_F(XMLTreeTests, RootMultipleChildren)
{
    const unsigned int num_children = 10;
    BaseNode test_base{NodeType::ROOT};

    ASSERT_EQ(false, test_base.removeChild(0));
    ASSERT_EQ(nullptr, test_base.getChild(0));
    ASSERT_EQ(0u, test_base.getNumChildren());

    std::vector<BaseNode*> children_backup;
    for (unsigned int i = 0; i < num_children; ++i)
    {
        children_backup.push_back(new BaseNode{NodeType::APPLICATION});
        test_base.addChild(std::unique_ptr<BaseNode>(children_backup[i]));
    }

    for (unsigned int i = 0; i < num_children; ++i)
    {
        ASSERT_EQ(children_backup[i], test_base.getChild(i));
        ASSERT_EQ(&test_base, test_base.getChild(i)->getParent());
        ASSERT_EQ(NodeType::APPLICATION, test_base.getChild(i)->getType());
    }

    for (unsigned int i = 0; i < num_children; ++i)
    {
        ASSERT_EQ(num_children - i, test_base.getNumChildren());
        ASSERT_EQ(true, test_base.removeChild(0));
        ASSERT_EQ(num_children - i - 1, test_base.getNumChildren());
        ASSERT_EQ(false, test_base.removeChild(num_children - i));
    }
}

TEST_F(XMLTreeTests, DataNode)
{
    const std::string attribute_name0{"Attribute0"};
    const std::string attribute_name1{"Attribute1"};
    const std::string attribute_value0{"TESTATTRIBUTE"};
    const std::string attribute_value1{"TESTATTRIBUTE1"};

    DataNode<std::string> data_node{NodeType::PUBLISHER};
    std::string* data = new std::string("TESTDATA");

    data_node.setData(std::unique_ptr<std::string>(data));
    data_node.addAttribute(attribute_name0, attribute_value0);
    data_node.addAttribute(attribute_name1, attribute_value1);

    ASSERT_EQ(NodeType::PUBLISHER, data_node.getType());
    ASSERT_EQ(data, data_node.getData().get());
    ASSERT_STREQ(attribute_value0.data(), data_node.getAttributes().at(attribute_name0).data());
    ASSERT_STREQ(attribute_value1.data(), data_node.getAttributes().at(attribute_name1).data());
}

int main(
        int argc,
        char** argv)
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}


text:
import Ember from 'ember';

export default Ember.Component.extend({
  classNameBindings: ['active'],
  active: Ember.computed('tabset.active', 'tabId', function() {
    return this.get('tabset.active') === this.get('tabId');
  }),
});


text:
import KnockoutObservable from '@types/knockout';

import Snippet from 'apps/editor/snippet';
import Executable, { ExecutableRaw } from 'apps/editor/execution/executable';
import { syncSqlExecutables } from 'apps/editor/execution/utils';
import { StatementDetails } from 'parse/types';
import { Compute, Connector, Namespace } from 'config/types';
import { VariableIndex } from 'apps/editor/components/variableSubstitution/types';

export interface ExecutorRaw {
  executables: ExecutableRaw[];
}

export interface ExecutorOptions {
  connector: KnockoutObservable<Connector>;
  compute: KnockoutObservable<Compute>;
  namespace: KnockoutObservable<Namespace>;
  database: KnockoutObservable<string>;
  defaultLimit?: KnockoutObservable<number>;
  isSqlEngine?: boolean;
  snippet?: Snippet;
  isSqlAnalyzerEnabled?: boolean;
}

export default class Executor {
  connector: KnockoutObservable<Connector>;
  compute: KnockoutObservable<Compute>;
  namespace: KnockoutObservable<Namespace>;
  database: KnockoutObservable<string>;
  defaultLimit?: KnockoutObservable<number>;
  isSqlEngine?: boolean;
  isSqlAnalyzerEnabled?: boolean;
  executables: Executable[] = [];
  snippet?: Snippet;
  activeExecutable?: Executable;
  variables: VariableIndex = {};

  constructor(options: ExecutorOptions) {
    this.connector = options.connector;
    this.compute = options.compute;
    this.namespace = options.namespace;
    this.database = options.database;
    this.isSqlEngine = options.isSqlEngine;
    this.isSqlAnalyzerEnabled = options.isSqlAnalyzerEnabled;
    this.executables = [];
    this.defaultLimit = options.defaultLimit;
    this.snippet = options.snippet;
  }

  toJs(): ExecutorRaw {
    return {
      executables: this.executables.map(executable => executable.toJs())
    };
  }

  cancelAll(): void {
    this.executables.forEach(existingExecutable => existingExecutable.cancelBatchChain());
  }

  setExecutables(executables: Executable[]): void {
    this.cancelAll();
    this.executables = executables;
    this.executables.forEach(executable => executable.notify());
  }

  update(statementDetails: StatementDetails, beforeExecute: boolean): Executable {
    const executables = syncSqlExecutables(this, statementDetails);

    // Cancel any "lost" executables and any batch chain it's part of
    executables.lost.forEach(lostExecutable => {
      lostExecutable.lost = true;
      lostExecutable.cancelBatchChain();
    });

    // Cancel any intersecting batch chains and create a new chain if just before execute
    if (beforeExecute) {
      executables.selected.forEach(executable => executable.cancelBatchChain());

      let previous: Executable | undefined;
      executables.selected.forEach(executable => {
        if (previous) {
          executable.previousExecutable = previous;
          previous.nextExecutable = executable;
        }
        previous = executable;
      });
    }

    // Update the executables list
    this.activeExecutable = executables.active;
    this.executables = executables.all;

    this.executables.forEach(executable => executable.notify());

    return executables.selected[0];
  }
}


text:
layout: "journal_by_tag"
tag: "biscuit fire"
permalink: "/journal/tag/biscuit-fire/"
header-img: "img/misc-bg.jpg"
---


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    public static class globalVars //basically a  class of global variables, used of r setting the robots names and commnds
    {
        private static string robotCommand_ = string.Empty;
        private static string robotName_ = string.Empty;
  //      private static bool programDone_ = false;

        public static string robotCommand
        {
            get { return robotCommand_; }
            set { robotCommand_ = value; }
        }
        public static string robotName
        {
            get { return robotName_; }
            set { robotName_ = value; }
        }
/*        public static bool programDone
        {
            get { return programDone_; }
            set { programDone_ = value; }
        }
 */

    }
}


text:
@interface ChoosyPickerViewModel : NSObject

@property (nonatomic) ChoosyPickerAppTypeInfo *appTypeInfo;
@property (nonatomic) NSString *pickerTitleText;
@property (nonatomic) NSString *pickerText;
@property (nonatomic) BOOL allowDefaultAppSelection;

@end


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>energy.usef.core.util.encryption (usef-root-pom 1.3.6 API)</title>
<meta name="date" content="2016-09-29">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

energy.usef.core.util.encryption

Interfaces

NaCl.Sodium

Classes

NaCl


text:
require 'spec_helper'

class KMTest
  extend Zuck::KoalaMethods
end

describe Zuck::KoalaMethods do
  describe "assigning a graph instance" do

    it "raises when not a Koala instance" do
      expect{
        KMTest.graph = :something_else
      }.to raise_error "Symbol is not a Koala::Facebook::API"
      KMTest.graph.should be_nil
    end

    it "raises when not a Koala instance" do
      expect{
        KMTest.graph = Koala::Facebook::API.new()
      }.to raise_error
      KMTest.graph.should be_nil
    end

    it "that's valid" do
      KMTest.graph.should be_nil
      KMTest.graph = Koala::Facebook::API.new(:some_token)
      KMTest.graph.should_not be_nil
    end
  end
end


text:
Notes on [this great article][article]

# Device and `/dev`

A device is detected by a driver. A driver is either
- compiled into the monolitic kernel at `/boot/vmlinuz-<release>`, or
- loaded by the running kernel from `/lib/modules/<release>`

Linux populates `/dev/` with detected devices and assigns a name to them.

Thus if a device is inserted but does not emerge in `/dev`, then either
- the corresponding module is not loaded, or
- the module needs to be told to rescan

A device file has a major device number and a minor device number,
which are listed and separated by a comma in the output of `ls -l`:
- major device number identifies the driver. Thus devices with the same major number use the same driver
- minor device number is only used by the driver to distinguish various devices

Device number allocation is documented [in kernel-docs][device-allocation].

`/dev` also includes pseudo-devices like `/dev/zero` and `/dev/null`.

# PCI Devices and `lspci`

PCI devices are listed via `lspci`. Each line of the output begins with
PCI bus address formatted as
```
bus:slot.function
```
or
```
domain:bus:slot.function
```
if `-D` is specified.

`-n` asks `lspci` to display devices in format
```
domain:bus:slot.function class: vendor_code:device_code
```

PCI/PCIe bridges form a tree topology of the connected devices, which can be
listed via `lspci -tv`. The output may look like:

```
...
           +-0d.0-[04-07]----00.0-[05-07]--+-03.0-[06]----00.0  Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           |                               \-07.0-[07]----00.0  Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
...
```

To interpret the output, `[XX-YY]` indicates that the buses connceted to
a bridge are numbered from `XX` to `YY`, and the devices downstream will share
the same bus number. So here the two Ethernet controllers are numbered as
`06:00.0` and `07:00.0` respectively. And the bridges that they are directly connected to
are numbered as `XX:03.0` and `YY:07.0` where `XX` and `YY` are from range `05` to `07`.

Information about a specific device can be displayed via `lspci -s` by giving the
device number as above.

# USB Devices and `lsusb`

USB devices are listed as

```
Bus 001 Device 004: ID 0424:7800 Standard Microsystems Corp.
```

To see full details do `lsusb -s 001:004`.

# Disks and `lsscsi`

Devices are listed as
```
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[2:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0
```

The 4-tuple in the first column is `[scsi_host:channel:target_number:logical_unit_number]`

# `/sys/`

- `/sys/devices` hierarchy of detected devices, this should give a long name that describes how the device is connected to the bus
- `/sys/bus` supported bus types
- `/sys/class` list of device classes
- `/sys/block` symlinks to block detected devices

Find name under `/dev/` for a disk with a specific label, UUID, etc:
```
tree -F /dev/disk
```

Files are attributes of objects, while symlinks are used to represent relationships between objects.
Some attributes are writable to which values could be `echo`-ed in order to tune for performance.

[article]: https://cromwell-intl.com/open-source/sysfs.html
[device-allocation]: https://www.kernel.org/doc/html/latest/admin-guide/devices.html