text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CompilerConfiguration">
    <resourceExtensions />
    <wildcardResourcePatterns>
      <entry name="!?*.java" />
      <entry name="!?*.form" />
      <entry name="!?*.class" />
      <entry name="!?*.groovy" />
      <entry name="!?*.scala" />
      <entry name="!?*.flex" />
      <entry name="!?*.kt" />
      <entry name="!?*.clj" />
      <entry name="!?*.aj" />
    </wildcardResourcePatterns>
    <annotationProcessing>
      <profile default="true" name="Default" enabled="false">
        <processorPath useClasspath="true" />
      </profile>
    </annotationProcessing>
    <bytecodeTargetLevel>
      <module name="11st_main" target="1.5" />
      <module name="11st_test" target="1.5" />
      <module name="spring-social-11st-example_main" target="1.8" />
      <module name="spring-social-11st-example_test" target="1.8" />
      <module name="spring-social-11st-spring-social-11st_main" target="1.6" />
      <module name="spring-social-11st-spring-social-11st_test" target="1.6" />
      <module name="spring-social-11st_main" target="1.6" />
      <module name="spring-social-11st_test" target="1.6" />
    </bytecodeTargetLevel>
  </component>
</project>


text:
using System.Linq;
using YUTPLAT.Models;
using YUTPLAT.Repositories.Interface;
using YUTPLAT.ViewModel;
using YUTPLAT.Context;

namespace YUTPLAT.Repositories
{
    public class FrecuenciaMedicionIndicadorRepository : IFrecuenciaMedicionIndicadorRepository
    {
        YutplatDbContext context;

        public FrecuenciaMedicionIndicadorRepository(YutplatDbContext context)
        {
            this.context = context;
        }

        public IQueryable<FrecuenciaMedicionIndicador> GetById(int id)
        {
            return this.context.FrecuenciasMedicionIndicadores.Where(a => a.FrecuenciaMedicionIndicadorID == id);
        }

        public IQueryable<FrecuenciaMedicionIndicador> Todas()
        {
            return this.context.FrecuenciasMedicionIndicadores;
        }

        public IQueryable<FrecuenciaMedicionIndicador> Buscar(FrecuenciaMedicionIndicadorViewModel filtro)
        {
            IQueryable<FrecuenciaMedicionIndicador> queryable = this.context.FrecuenciasMedicionIndicadores;

            if (filtro.Descripcion != null && !string.IsNullOrEmpty(filtro.Descripcion.Trim()))
            {
                queryable = queryable.Where(a => a.Descripcion.Contains(filtro.Descripcion.Trim()));
            }

            return queryable;
        }

        public void Dispose()
        {
            context.Dispose();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.araqne.httpd.impl;

import java.net.InetSocketAddress;

import org.araqne.httpd.WebSocket;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WebSocketChannel implements WebSocket {
	private final Logger slog = LoggerFactory.getLogger(WebSocketChannel.class);

	// seconds
	private static final int WRITE_HANG_THRESHOLD = 300;

	private InetSocketAddress localAddr;
	private InetSocketAddress remoteAddr;
	private Channel channel;

	@Override
	public String toString() {
		return "WebSocketChannel [localAddr=" + localAddr + ", remoteAddr=" + remoteAddr + "]";
	}

	public WebSocketChannel(Channel channel) {
		this.channel = channel;
		this.localAddr = (InetSocketAddress) channel.getLocalAddress();
		this.remoteAddr = (InetSocketAddress) channel.getRemoteAddress();
	}

	@Override
	public InetSocketAddress getLocalAddress() {
		return localAddr;
	}

	@Override
	public InetSocketAddress getRemoteAddress() {
		return remoteAddr;
	}

	@Override
	public void send(String text) {
		if (!channel.isOpen())
			return;

		if (!channel.isWritable())
			waitUntilWritable(channel);

		channel.write(new TextWebSocketFrame(text));
	}

	private void waitUntilWritable(Channel channel) {
		long begin = System.nanoTime();

		while (channel.isOpen() && !channel.isWritable()) {
			try {
				Thread.sleep(100);
				long elapsed = (System.nanoTime() - begin) / 1000000000L;

				if (slog.isDebugEnabled())
					slog.debug("araqne httpd: websocket channel [{}] is waiting until writable [{}] secs",
							channel.getRemoteAddress(), elapsed);

				if (elapsed >= WRITE_HANG_THRESHOLD) {
					channel.close();

					throw new IllegalStateException("terminated websocket channel [" + channel.getRemoteAddress()
							+ "], write hang for " + elapsed + " seconds");
				}
			} catch (InterruptedException e) {
			}
		}
	}

	@Override
	public void close() {
		if (channel != null)
			channel.close();
	}
}


text:
<dictionary>
  <definition name="quaquaversally">
    <content>adjective: (of a geological formation) sloping downward from the center in all directions.</content>
  </definition>
  <definition name="tergiversate">
    <content>To use evasions or ambiguities; equivocate.</content>
  </definition>
</dictionary>


text:
TowerDefense.RocketBullet = function () {

    TowerDefense.Bullet.call( this );

    this.type = 'BULLET';
    this.meshSprite = 'bullet-02';

    this.stats = {
        damage: 3,
        speed: .008 // Movement in units.
    }

    this.path = []; // Holds information of the movement
    this.p = 0;
    this.spline = new TowerDefense.Spline();
    this.recheckedEnemy = false;
    this.parentPosition = { x: 0, y: 0, z: 0 }; // Tower position
    this.parentRange = 0; // Tower range
}

TowerDefense.RocketBullet.prototype = Object.create( TowerDefense.Bullet.prototype );

TowerDefense.RocketBullet.prototype.constructor = TowerDefense.RocketBullet;

/**
 * Update the bullet a little closer towards it target, with increasing speed
 * @return void
 */
TowerDefense.RocketBullet.prototype.update = function() {

    if (this.object.position.z < -1) {
        this.remove();
        return;
    }

    // find another target after first try else move till end.
    if (TowerDefense.objects[this.targetIndex] == null) {
        var remove = true;
        if (this.recheckedEnemy == false) {
            this.recheckedEnemy = true;
            this.shootingTargetIndex = TowerDefense.findEnemyInRage(this.parentPosition, this.parentRange);
            if (TowerDefense.objects[this.shootingTargetIndex] != null) {
                remove = false;
            }
        }
        if (remove == true) {
            this.deadTimer--;
            if (this.deadTimer < 100) {
                this.object.material.opacity = (this.deadTimer / 100);
            }
            if (this.deadTimer <= 0) {
                this.remove();
            }
        }
    }
    else {

        var target = TowerDefense.objects[this.targetIndex];

        // Simple collision detection
        if (TowerDefense.inRange(target.object.position, this.object.position,1,false)) {
            TowerDefense.objects[this.targetIndex].removeHealth(this.stats.damage);
            this.remove();
            return;
        }

        if (this.path[0] == null) {
            this.path[0] = { x: this.object.position.x, y: this.object.position.y, z: this.object.position.z };
            var lastPos = {};
            for (var i = 1; i < 2; i++) {
                lastPos = {
                    x: this.object.position.x + (Math.random() * 24 - 12),
                    y: this.object.position.y + (Math.random() * 24 - 12),
                    z: this.object.position.z + (Math.random() * 24)
                };
                this.path[i] = lastPos;
            }
            this.path[2] = {
                x: lastPos.x + (Math.random() * 4 - 2),
                y: lastPos.y + (Math.random() * 4 - 2),
                z: lastPos.z + (Math.random() * 4)
            };
        }
        this.path[3] = target.object.position;

    }
    if (this.path == null || this.path[0] == null || this.path[0].x == null || this.p >= 1) {
        this.remove();
        return;
    }

    var position = this.spline.get2DPoint( this.path, this.p );

    this.object.position.x = position.x;
    this.object.position.y = position.y;
    this.object.position.z = position.z;

    this.p += this.stats.speed;

    if (TowerDefense.counter%12 == 1) {
//        var smoke = new TowerDefense.Decoration.SimpleSmoke();
//        smoke.position.x = this.object.position.x - 1 + (Math.random() * 2);
//        smoke.position.y = this.object.position.y - 1 + (Math.random() * 2);
//        smoke.position.z = this.object.position.z - 1 + (Math.random() * 2);
//        smoke.create();
//        smoke.add();
//        TowerDefense.scene.add(smoke.object);
    }

}


text:
from __future__ import absolute_import
from __future__ import unicode_literals

import os.path as osp

import appdirs
from blazeutils.helpers import tolist
import flask
from pathlib import PurePath
from werkzeug.utils import ImportStringError

from keg.utils import app_environ_get, pymodule_fpaths_to_objects

class ConfigurationError(Exception):
    pass

class SubstituteValue(object):
    def __init__(self, value):
        self.value = value
substitute = SubstituteValue

class Config(flask.Config):
    default_config_locations = [
        # Keg's defaults
        'keg.config.DefaultProfile',
        # Keg's defaults for the selected profile
        'keg.config.{profile}',
        # App defaults for all profiles
        '{app_import_name}.config.DefaultProfile',
        # apply the profile specific defaults that are in the app's config file
        '{app_import_name}.config.{profile}',
    ]

    def from_obj_if_exists(self, obj_location):
        try:
            self.from_object(obj_location)
            self.configs_found.append(obj_location)
        except ImportStringError as e:
            if obj_location not in str(e):
                raise

    def default_config_locations_parsed(self):
        retval = []
        for location in self.default_config_locations:
            # if no profile is given, the location want's one, that location isn't valid
            if '{profile}' in location and self.profile is None:
                continue

            retval.append(location.format(app_import_name=self.app_import_name,
                                          profile=self.profile))
        return retval

    def init_app(self, app_config_profile, app_import_name, app_root_path, config_file_objs=None):
        self.profile = app_config_profile
        self.dirs = appdirs.AppDirs(app_import_name, appauthor=False, multipath=True)
        self.app_import_name = app_import_name
        self.app_root_path = app_root_path

        if config_file_objs:
            self.config_file_objs = config_file_objs
        else:
            possible_config_fpaths = self.config_file_paths()
            self.config_file_objs = pymodule_fpaths_to_objects(possible_config_fpaths)

        if self.profile is None:
            self.profile = self.determine_selected_profile()

        self.configs_found = []

        for dotted_location in self.default_config_locations_parsed():
            dotted_location = dotted_location.format(app_import_name=app_import_name,
                                                     profile=self.profile)
            self.from_obj_if_exists(dotted_location)

        # apply settings from any of this app's configuration files
        for fpath, objects in self.config_file_objs:
            if self.profile in objects:
                self.from_object(objects[self.profile])
                self.configs_found.append('{}:{}'.format(fpath, self.profile))

        sub_values = self.substitution_values()
        self.substitution_apply(sub_values)

    def config_file_paths(self):
        dirs = self.dirs

        config_fname = '{}-config.py'.format(self.app_import_name)

        dpaths = []
        if appdirs.system != 'win32':
            dpaths.extend(dirs.site_config_dir.split(':'))
            dpaths.append('/etc/{}'.format(self.app_import_name))
            dpaths.append('/etc')
        else:
            system_drive = PurePath(dirs.site_config_dir).drive
            system_etc_dir = PurePath(system_drive, '/', 'etc')
            dpaths.extend((
                dirs.site_config_dir,
                system_etc_dir.joinpath(self.app_import_name).__str__(),
                system_etc_dir.__str__()
            ))
        dpaths.append(dirs.user_config_dir)
        dpaths.append(osp.dirname(self.app_root_path))

        fpaths = [osp.join(dpath, config_fname) for dpath in dpaths]

        return fpaths

    def email_error_to(self):
        error_to = self.get('KEG_EMAIL_ERROR_TO')
        override_to = self.get('KEG_EMAIL_OVERRIDE_TO')
        if override_to:
            return tolist(override_to)
        return tolist(error_to)

    def determine_selected_profile(self):
        # if we find the value in the environment, use it
        profile = app_environ_get(self.app_import_name, 'CONFIG_PROFILE')
        if profile is not None:
            return profile

        # look for it in all the config files found
        for fpath, objects in self.config_file_objs:
            if 'DEFAULT_PROFILE' in objects:
                profile = objects['DEFAULT_PROFILE']

        return profile

    def substitution_values(self):
        return dict(
            user_log_dir=self.dirs.user_log_dir,
            app_import_name=self.app_import_name,
        )

    def substitution_apply(self, sub_values):
        for config_key, config_value in self.items():
            if not isinstance(config_value, SubstituteValue):
                continue
            new_value = config_value.value.format(**sub_values)
            self[config_key] = new_value

# The following three classes are default configuration profiles
class DefaultProfile(object):
    KEG_DIR_MODE = 0o777
    KEG_ENDPOINTS = dict(
        home='public.home',
        login='public.home',
        after_login='public.home',
        after_logout='public.home',
    )

    KEG_KEYRING_ENABLE = True

    KEG_SMTP_HOST = 'localhost'

    KEG_LOG_DPATH = substitute('{user_log_dir}')
    KEG_LOG_FNAME = substitute('{app_import_name}.log')
    KEG_LOG_MAX_BACKUPS = 5
    KEG_LOG_MAX_BYTES = 1024 * 1024 * 10  # 10MB
    KEG_LOG_FILE_FORMAT_STR = '%(asctime)s %(levelname)s [%(name)s:%(lineno)d]: %(message)s'
    KEG_LOG_STDOUT_FORMAT_STR = '%(levelname)s - %(name)s - %(message)s'

    KEG_DB_DIALECT_OPTIONS = {}

class DevProfile(object):
    DEBUG = True

class TestProfile(object):
    DEBUG = True
    TESTING = True


text:
package org.codehaus.jremoting.itests.clientcontext;

/**
 * @author Paul Hammant and Rune Johanessen (pairing for part)
 *
 */

public interface AccountManager {

    void transferAmount(String acct1, String acct2, int amt) throws TransferBarfed;

}


text:
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="shortcut icon" href="img/favicon.ico">
	<link rel="stylesheet" href="css/vendor/fluidbox.min.css">
	<link rel="stylesheet" href="css/landing.css">

	<title>Roguelike Game Admin Page</title>

Roguelike

A class project

<input type="button" onclick="logOut()" value="Log Out">


text:
"""
Contains functional tests of the Git class.
"""

import os

import pytest

from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.vcs.git import Git
from tests.lib import _create_test_package

def get_head_sha(script, dest):
    """Return the HEAD sha."""
    result = script.run('git', 'rev-parse', 'HEAD', cwd=dest)
    sha = result.stdout.strip()

    return sha

def do_commit(script, dest):
    script.run(
        'git', 'commit', '-q', '--author', 'pip <pypa-dev@googlegroups.com>',
        '--allow-empty', '-m', 'test commit', cwd=dest
    )
    return get_head_sha(script, dest)

def add_commits(script, dest, count):
    """Return a list of the commit hashes from oldest to newest."""
    shas = []
    for index in range(count):
        sha = do_commit(script, dest)
        shas.append(sha)

    return shas

def check_rev(repo_dir, rev, expected_sha):
    git = Git()
    assert git.get_revision_sha(repo_dir, rev) == expected_sha

def test_git_dir_ignored():
    """
    Test that a GIT_DIR environment variable is ignored.
    """
    git = Git()
    with TempDirectory() as temp:
        temp_dir = temp.path
        env = {'GIT_DIR': 'foo'}
        # If GIT_DIR is not ignored, then os.listdir() will return ['foo'].
        git.run_command(['init', temp_dir], cwd=temp_dir, extra_environ=env)
        assert os.listdir(temp_dir) == ['.git']

def test_git_work_tree_ignored():
    """
    Test that a GIT_WORK_TREE environment variable is ignored.
    """
    git = Git()
    with TempDirectory() as temp:
        temp_dir = temp.path
        git.run_command(['init', temp_dir], cwd=temp_dir)
        # Choose a directory relative to the cwd that does not exist.
        # If GIT_WORK_TREE is not ignored, then the command will error out
        # with: "fatal: This operation must be run in a work tree".
        env = {'GIT_WORK_TREE': 'foo'}
        git.run_command(['status', temp_dir], extra_environ=env, cwd=temp_dir)

def test_get_revision_sha(script):
    with TempDirectory(kind="testing") as temp:
        repo_dir = temp.path
        script.run('git', 'init', cwd=repo_dir)
        shas = add_commits(script, repo_dir, count=3)

        tag_sha = shas[0]
        origin_sha = shas[1]
        head_sha = shas[2]
        assert head_sha == shas[-1]

        origin_ref = 'refs/remotes/origin/origin-branch'
        generic_ref = 'refs/generic-ref'

        script.run(
            'git', 'branch', 'local-branch', head_sha, cwd=repo_dir
        )
        script.run('git', 'tag', 'v1.0', tag_sha, cwd=repo_dir)
        script.run('git', 'update-ref', origin_ref, origin_sha, cwd=repo_dir)
        script.run(
            'git', 'update-ref', 'refs/remotes/upstream/upstream-branch',
            head_sha, cwd=repo_dir
        )
        script.run('git', 'update-ref', generic_ref, head_sha, cwd=repo_dir)

        # Test two tags pointing to the same sha.
        script.run('git', 'tag', 'v2.0', tag_sha, cwd=repo_dir)
        # Test tags sharing the same suffix as another tag, both before and
        # after the suffix alphabetically.
        script.run('git', 'tag', 'aaa/v1.0', head_sha, cwd=repo_dir)
        script.run('git', 'tag', 'zzz/v1.0', head_sha, cwd=repo_dir)

        check_rev(repo_dir, 'v1.0', tag_sha)
        check_rev(repo_dir, 'v2.0', tag_sha)
        check_rev(repo_dir, 'origin-branch', origin_sha)

        ignored_names = [
            # Local branches should be ignored.
            'local-branch',
            # Non-origin remote branches should be ignored.
            'upstream-branch',
            # Generic refs should be ignored.
            'generic-ref',
            # Fully spelled-out refs should be ignored.
            origin_ref,
            generic_ref,
            # Test passing a valid commit hash.
            tag_sha,
            # Test passing a non-existent name.
            'does-not-exist',
        ]
        for name in ignored_names:
            check_rev(repo_dir, name, None)

@pytest.mark.network
def test_is_commit_id_equal(script):
    """
    Test Git.is_commit_id_equal().
    """
    version_pkg_path = _create_test_package(script)
    script.run('git', 'branch', 'branch0.1', cwd=version_pkg_path)
    commit = script.run(
        'git', 'rev-parse', 'HEAD',
        cwd=version_pkg_path
    ).stdout.strip()
    git = Git()
    assert git.is_commit_id_equal(version_pkg_path, commit)
    assert not git.is_commit_id_equal(version_pkg_path, commit[:7])
    assert not git.is_commit_id_equal(version_pkg_path, 'branch0.1')
    assert not git.is_commit_id_equal(version_pkg_path, 'abc123')
    # Also check passing a None value.
    assert not git.is_commit_id_equal(version_pkg_path, None)


text:
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
        <group>
            <file>file:/Users/ariel/dev/netbeans/jee/Integrator/Integrator-war/web/WEB-INF/web.xml</file>
            <file>file:/Users/ariel/dev/netbeans/jee/Integrator/Integrator-war/src/java/org/proydesa/jee/integrator/controller/AllEmployees.java</file>
            <file>file:/Users/ariel/dev/netbeans/jee/Integrator/Integrator-war/web/welcome.jsp</file>
            <file>file:/Users/ariel/dev/netbeans/jee/Integrator/Integrator-war/web/employees.jsp</file>
        </group>
    </open-files>
</project-private>


text:
package io.quarkus.redis.datasource.search;

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

/**
 * Allows customizing the indexed field.
 */
public class FieldOptions {

    private boolean sortable;
    private boolean unf;
    private boolean noStem;
    private boolean noIndex;
    private String phonetic;
    private double weight = -1;
    private char separator;
    private boolean caseSensitive;
    private boolean withSuffixTrie;

    /**
     * Numeric, tag (not supported with JSON) or text attributes can have the optional SORTABLE argument.
     * As the user sorts the results by the value of this attribute, the results will be available with very low
     * latency. (this adds memory overhead so consider not to declare it on large text attributes).
     *
     * @return the current {@code FieldOptions}
     */
    public FieldOptions sortable() {
        this.sortable = true;
        return this;
    }

    /**
     * By default, {@code SORTABLE} applies a normalization to the indexed value (characters set to lowercase, removal
     * of diacritics). When using un-normalized form (UNF), you can disable the normalization and keep the original
     * form of the value.
     *
     * @return the current {@code FieldOptions}
     */
    public FieldOptions unf() {
        this.unf = true;
        return this;
    }

    /**
     * Text attributes can have the {@code NOSTEM} argument which will disable stemming when indexing its values.
     * This may be ideal for things like proper names.
     *
     * @return the current {@code FieldOptions}
     */
    public FieldOptions noStem() {
        this.noStem = true;
        return this;
    }

    /**
     * Attributes can have the {@code NOINDEX} option, which means they will not be indexed. This is useful in
     * conjunction with {@code SORTABLE}, to create attributes whose update using {@code PARTIAL} will not cause full
     * reindexing of the document. If an attribute has {@code NOINDEX} and doesn't have {@code SORTABLE}, it will just
     * be ignored by the index.
     *
     * @return the current {@code FieldOptions}
     */
    public FieldOptions noIndex() {
        this.noIndex = true;
        return this;
    }

    /**
     * Declaring a text attribute as {@code PHONETIC} will perform phonetic matching on it in searches by default.
     * The obligatory argument specifies the phonetic algorithm and language used.
     *
     * @param phonetic the phonetic algorithm
     * @return the current {@code FieldOptions}
     */
    public FieldOptions phonetic(String phonetic) {
        this.phonetic = phonetic;
        return this;
    }

    /**
     * For TEXT attributes, declares the importance of this attribute when calculating result accuracy.
     * This is a multiplication factor, and defaults to 1 if not specified.
     *
     * @param weight the weight
     * @return the current {@code FieldOptions}
     */
    public FieldOptions weight(double weight) {
        this.weight = weight;
        return this;
    }

    /**
     * For TAG attributes, indicates how the text contained in the attribute is to be split into individual tags.
     * The default is {@code ,}. The value must be a single character.
     *
     * @param separator the separator
     * @return the current {@code FieldOptions}
     */
    public FieldOptions separator(char separator) {
        this.separator = separator;
        return this;
    }

    /**
     * For TAG attributes, keeps the original letter cases of the tags. If not specified, the characters are converted
     * to lowercase.
     *
     * @return the current {@code FieldOptions}
     */
    public FieldOptions caseSensitive() {
        this.caseSensitive = true;
        return this;
    }

    /**
     * For TEXT and TAG attributes, keeps a suffix trie with all terms which match the suffix. It is used to optimize
     * contains (foo) and suffix (*foo) queries. Otherwise, a brute-force search on the trie is performed.
     * If suffix trie exists for some fields, these queries will be disabled for other fields.
     *
     * @return the current {@code FieldOptions}
     */
    public FieldOptions withSuffixTrie() {
        this.withSuffixTrie = true;
        return this;
    }

    public List<String> toArgs() {
        List<String> list = new ArrayList<>();
        if (sortable) {
            list.add("SORTABLE");
        }
        if (unf) {
            if (!sortable) {
                throw new IllegalArgumentException("Using `UNF` requires `SORTABLE`");
            }
            list.add("UNF");
        }
        if (noStem) {
            list.add("NOSTEM");
        }
        if (noIndex) {
            list.add("NOINDEX");
        }
        if (phonetic != null) {
            list.add("PHONETIC");
            list.add(phonetic);
        }
        if (weight != -1) {
            list.add("WEIGHT");
            list.add(Double.toString(weight));
        }
        if (separator != 0) {
            list.add("SEPARATOR");
            list.add(Character.toString(separator));
        }
        if (caseSensitive) {
            list.add("CASESENSITIVE");
        }
        if (withSuffixTrie) {
            list.add("WITHSUFFIXTRIE");
        }
        return list;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Cutlass: Layout Concept</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Cutlass

CUDA Templates for Linear Algebra Subroutines and Solvers

Classes

Layout Concept

Classes

struct  	cutlass::Shape< kD_, kH_, kW_, kC_ >

 	A Shape implementing Layout Concept describing the dimensions of a cube.  More...

Detailed Description

Implementations of  layout_concept are used to describe a cube with DxHxW elements and C

scalars per element. A HxW slice of a cube is called an image and a cube consists of D images.

Notations

Let Layout be an implementation of the Layout Concept.

Valid Expressions

Layout::D specifies the depth of a cube

Layout::H specifies the height of a cube

Layout::W specifies the height of a cube

Layout::C specifies the number of channels of each element in a cube

Layout::W_c specifies the number of scalars of each row in one image of a cube.

Layout::H_w specifies the number of elements in an image slice.

Layout::H_w_c_specifies the number of scalars in an image slice.

Layout::D_h_w specifies the number of elements in a cube.

Layout::D_h_w_c specifies the number of scalars in a cube.

Layout::Strides is a Layout Concept specifying the strides.

<address class="footer">
Generated on Fri Oct 26 2018 14:53:34 for Cutlass by

 1.8.14
</address>


text:
package org.softlang.client.guiinfos;

import java.io.Serializable;

public class CompanyInfo implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = -6539729645301595406L;

	private Integer id;
	private String name;
	private double total;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getTotal() {
		return total;
	}

	public void setTotal(double total) {
		this.total = total;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

}


text:
  color:#1a292b;
  min-height:50px;
  min-width:300px;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-icon-allow {
  position:absolute;
  left:12px;
  top:10px;
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-40px -140px;
  width:30px;
  height:30px;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-textWrapper {
  padding:10px 60px 10px 50px;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-textWrapper .pinion-moduleTitle {
  font-size:12px;
  font-weight:900;
  padding-right:60px;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-textWrapper .pinion-resource {
  margin-top:3px;
  font-size:11px;
  padding-right:60px;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-renderer-bar {
  top:7px;
  right:2px;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-renderer-bar .pinion-resourceOption {
  position:relative;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-renderer-bar .pinion-resourceOption .pinion-text {
  display:none;
  position:absolute;
  right:23px;
  top:3px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-renderer-bar .pinion-resourceOption .pinion-icon {
  position:absolute;
  top:0;
  right:0;
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-640px -120px;
  width:20px;
  height:20px;
  cursor:pointer;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-renderer-bar .pinion-resourceOption:hover .pinion-text {
  display:block;
  color:#88a852;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer .pinion-renderer-bar .pinion-resourceOption:hover .pinion-icon {
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-640px -100px;
  width:20px;
  height:20px;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer.pinion-allowed .pinion-icon-allow {
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-70px -140px;
  width:30px;
  height:30px;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer.pinion-allowed .pinion-renderer-bar .pinion-resourceOption .pinion-icon {
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-620px -120px;
  width:20px;
  height:20px;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer.pinion-allowed .pinion-renderer-bar .pinion-resourceOption:hover .pinion-text { color:#e1604b; }
#pinion-backend .pinion-backend-renderer-ResourceRenderer.pinion-allowed .pinion-renderer-bar .pinion-resourceOption:hover .pinion-icon {
  background-image:url('../../../../pinion/assets/images/icons/pinion-icons.png');
  background-position:-620px -80px;
  width:20px;
  height:20px;
}
#pinion-backend .pinion-backend-renderer-ResourceRenderer.ui-selected .pinion-textWrapper .pinion-moduleTitle, #pinion-backend .pinion-backend-renderer-ResourceRenderer.ui-selected .pinion-textWrapper .pinion-resource { color:#edf2f2; }
#pinion-backend .pinion-backend-renderer-ResourceRenderer.dirty .pinion-backend-icon-dirty {
  position:absolute;
  top:5px;
  right:5px;
}


text:
package org.apache.spark.sql.execution.vectorized;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;

import org.apache.spark.sql.types.*;
import org.apache.spark.unsafe.Platform;
import org.apache.spark.unsafe.types.UTF8String;

/**
 * A column backed by an in memory JVM array. This stores the NULLs as a byte per value
 * and a java array for the values.
 */
public final class OnHeapColumnVector extends WritableColumnVector {

  private static final boolean bigEndianPlatform =
    ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN);

  /**
   * Allocates columns to store elements of each field of the schema on heap.
   * Capacity is the initial capacity of the vector and it will grow as necessary. Capacity is
   * in number of elements, not number of bytes.
   */
  public static OnHeapColumnVector[] allocateColumns(int capacity, StructType schema) {
    return allocateColumns(capacity, schema.fields());
  }

  /**
   * Allocates columns to store elements of each field on heap.
   * Capacity is the initial capacity of the vector and it will grow as necessary. Capacity is
   * in number of elements, not number of bytes.
   */
  public static OnHeapColumnVector[] allocateColumns(int capacity, StructField[] fields) {
    OnHeapColumnVector[] vectors = new OnHeapColumnVector[fields.length];
    for (int i = 0; i < fields.length; i++) {
      vectors[i] = new OnHeapColumnVector(capacity, fields[i].dataType());
    }
    return vectors;
  }

  // The data stored in these arrays need to maintain binary compatible. We can
  // directly pass this buffer to external components.

  // This is faster than a boolean array and we optimize this over memory footprint.
  private byte[] nulls;

  // Array for each type. Only 1 is populated for any type.
  private byte[] byteData;
  private short[] shortData;
  private int[] intData;
  private long[] longData;
  private float[] floatData;
  private double[] doubleData;

  // Only set if type is Array or Map.
  private int[] arrayLengths;
  private int[] arrayOffsets;

  public OnHeapColumnVector(int capacity, DataType type) {
    super(capacity, type);

    reserveInternal(capacity);
    reset();
  }

  @Override
  public void close() {
    super.close();
    nulls = null;
    byteData = null;
    shortData = null;
    intData = null;
    longData = null;
    floatData = null;
    doubleData = null;
    arrayLengths = null;
    arrayOffsets = null;
  }

  //
  // APIs dealing with nulls
  //

  @Override
  public void putNotNull(int rowId) {
    nulls[rowId] = (byte)0;
  }

  @Override
  public void putNull(int rowId) {
    nulls[rowId] = (byte)1;
    ++numNulls;
  }

  @Override
  public void putNulls(int rowId, int count) {
    for (int i = 0; i < count; ++i) {
      nulls[rowId + i] = (byte)1;
    }
    numNulls += count;
  }

  @Override
  public void putNotNulls(int rowId, int count) {
    if (!hasNull()) return;
    for (int i = 0; i < count; ++i) {
      nulls[rowId + i] = (byte)0;
    }
  }

  @Override
  public boolean isNullAt(int rowId) {
    return nulls[rowId] == 1;
  }

  //
  // APIs dealing with Booleans
  //

  @Override
  public void putBoolean(int rowId, boolean value) {
    byteData[rowId] = (byte)((value) ? 1 : 0);
  }

  @Override
  public void putBooleans(int rowId, int count, boolean value) {
    byte v = (byte)((value) ? 1 : 0);
    for (int i = 0; i < count; ++i) {
      byteData[i + rowId] = v;
    }
  }

  @Override
  public boolean getBoolean(int rowId) {
    return byteData[rowId] == 1;
  }

  @Override
  public boolean[] getBooleans(int rowId, int count) {
    assert(dictionary == null);
    boolean[] array = new boolean[count];
    for (int i = 0; i < count; ++i) {
      array[i] = (byteData[rowId + i] == 1);
    }
   return array;
  }

  //

  //
  // APIs dealing with Bytes
  //

  @Override
  public void putByte(int rowId, byte value) {
    byteData[rowId] = value;
  }

  @Override
  public void putBytes(int rowId, int count, byte value) {
    for (int i = 0; i < count; ++i) {
      byteData[i + rowId] = value;
    }
  }

  @Override
  public void putBytes(int rowId, int count, byte[] src, int srcIndex) {
    System.arraycopy(src, srcIndex, byteData, rowId, count);
  }

  @Override
  public byte getByte(int rowId) {
    if (dictionary == null) {
      return byteData[rowId];
    } else {
      return (byte) dictionary.decodeToInt(dictionaryIds.getDictId(rowId));
    }
  }

  @Override
  public byte[] getBytes(int rowId, int count) {
    assert(dictionary == null);
    byte[] array = new byte[count];
    System.arraycopy(byteData, rowId, array, 0, count);
    return array;
  }

  @Override
  protected UTF8String getBytesAsUTF8String(int rowId, int count) {
    return UTF8String.fromBytes(byteData, rowId, count);
  }

  //
  // APIs dealing with Shorts
  //

  @Override
  public void putShort(int rowId, short value) {
    shortData[rowId] = value;
  }

  @Override
  public void putShorts(int rowId, int count, short value) {
    for (int i = 0; i < count; ++i) {
      shortData[i + rowId] = value;
    }
  }

  @Override
  public void putShorts(int rowId, int count, short[] src, int srcIndex) {
    System.arraycopy(src, srcIndex, shortData, rowId, count);
  }

  @Override
  public void putShorts(int rowId, int count, byte[] src, int srcIndex) {
    Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET + srcIndex, shortData,
      Platform.SHORT_ARRAY_OFFSET + rowId * 2L, count * 2L);
  }

  @Override
  public short getShort(int rowId) {
    if (dictionary == null) {
      return shortData[rowId];
    } else {
      return (short) dictionary.decodeToInt(dictionaryIds.getDictId(rowId));
    }
  }

  @Override
  public short[] getShorts(int rowId, int count) {
    assert(dictionary == null);
    short[] array = new short[count];
    System.arraycopy(shortData, rowId, array, 0, count);
    return array;
  }

  //
  // APIs dealing with Ints
  //

  @Override
  public void putInt(int rowId, int value) {
    intData[rowId] = value;
  }

  @Override
  public void putInts(int rowId, int count, int value) {
    for (int i = 0; i < count; ++i) {
      intData[i + rowId] = value;
    }
  }

  @Override
  public void putInts(int rowId, int count, int[] src, int srcIndex) {
    System.arraycopy(src, srcIndex, intData, rowId, count);
  }

  @Override
  public void putInts(int rowId, int count, byte[] src, int srcIndex) {
    Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET + srcIndex, intData,
      Platform.INT_ARRAY_OFFSET + rowId * 4L, count * 4L);
  }

  @Override
  public void putIntsLittleEndian(int rowId, int count, byte[] src, int srcIndex) {
    int srcOffset = srcIndex + Platform.BYTE_ARRAY_OFFSET;
    for (int i = 0; i < count; ++i, srcOffset += 4) {
      intData[i + rowId] = Platform.getInt(src, srcOffset);
      if (bigEndianPlatform) {
        intData[i + rowId] = java.lang.Integer.reverseBytes(intData[i + rowId]);
      }
    }
  }

  @Override
  public int getInt(int rowId) {
    if (dictionary == null) {
      return intData[rowId];
    } else {
      return dictionary.decodeToInt(dictionaryIds.getDictId(rowId));
    }
  }

  @Override
  public int[] getInts(int rowId, int count) {
    assert(dictionary == null);
    int[] array = new int[count];
    System.arraycopy(intData, rowId, array, 0, count);
    return array;
  }

  /**
   * Returns the dictionary Id for rowId.
   * This should only be called when the ColumnVector is dictionaryIds.
   * We have this separate method for dictionaryIds as per SPARK-16928.
   */
  public int getDictId(int rowId) {
    assert(dictionary == null)
            : "A ColumnVector dictionary should not have a dictionary for itself.";
    return intData[rowId];
  }

  //
  // APIs dealing with Longs
  //

  @Override
  public void putLong(int rowId, long value) {
    longData[rowId] = value;
  }

  @Override
  public void putLongs(int rowId, int count, long value) {
    for (int i = 0; i < count; ++i) {
      longData[i + rowId] = value;
    }
  }

  @Override
  public void putLongs(int rowId, int count, long[] src, int srcIndex) {
    System.arraycopy(src, srcIndex, longData, rowId, count);
  }

  @Override
  public void putLongs(int rowId, int count, byte[] src, int srcIndex) {
    Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET + srcIndex, longData,
      Platform.LONG_ARRAY_OFFSET + rowId * 8L, count * 8L);
  }

  @Override
  public void putLongsLittleEndian(int rowId, int count, byte[] src, int srcIndex) {
    int srcOffset = srcIndex + Platform.BYTE_ARRAY_OFFSET;
    for (int i = 0; i < count; ++i, srcOffset += 8) {
      longData[i + rowId] = Platform.getLong(src, srcOffset);
      if (bigEndianPlatform) {
        longData[i + rowId] = java.lang.Long.reverseBytes(longData[i + rowId]);
      }
    }
  }

  @Override
  public long getLong(int rowId) {
    if (dictionary == null) {
      return longData[rowId];
    } else {
      return dictionary.decodeToLong(dictionaryIds.getDictId(rowId));
    }
  }

  @Override
  public long[] getLongs(int rowId, int count) {
    assert(dictionary == null);
    long[] array = new long[count];
    System.arraycopy(longData, rowId, array, 0, count);
    return array;
  }

  //
  // APIs dealing with floats
  //

  @Override
  public void putFloat(int rowId, float value) { floatData[rowId] = value; }

  @Override
  public void putFloats(int rowId, int count, float value) {
    Arrays.fill(floatData, rowId, rowId + count, value);
  }

  @Override
  public void putFloats(int rowId, int count, float[] src, int srcIndex) {
    System.arraycopy(src, srcIndex, floatData, rowId, count);
  }

  @Override
  public void putFloats(int rowId, int count, byte[] src, int srcIndex) {
    Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET + srcIndex, floatData,
        Platform.FLOAT_ARRAY_OFFSET + rowId * 4L, count * 4L);
  }

  @Override
  public void putFloatsLittleEndian(int rowId, int count, byte[] src, int srcIndex) {
    if (!bigEndianPlatform) {
      putFloats(rowId, count, src, srcIndex);
    } else {
      ByteBuffer bb = ByteBuffer.wrap(src).order(ByteOrder.LITTLE_ENDIAN);
      for (int i = 0; i < count; ++i) {
        floatData[i + rowId] = bb.getFloat(srcIndex + (4 * i));
      }
    }
  }

  @Override
  public float getFloat(int rowId) {
    if (dictionary == null) {
      return floatData[rowId];
    } else {
      return dictionary.decodeToFloat(dictionaryIds.getDictId(rowId));
    }
  }

  @Override
  public float[] getFloats(int rowId, int count) {
    assert(dictionary == null);
    float[] array = new float[count];
    System.arraycopy(floatData, rowId, array, 0, count);
    return array;
  }

  //
  // APIs dealing with doubles
  //

  @Override
  public void putDouble(int rowId, double value) {
    doubleData[rowId] = value;
  }

  @Override
  public void putDoubles(int rowId, int count, double value) {
    Arrays.fill(doubleData, rowId, rowId + count, value);
  }

  @Override
  public void putDoubles(int rowId, int count, double[] src, int srcIndex) {
    System.arraycopy(src, srcIndex, doubleData, rowId, count);
  }

  @Override
  public void putDoubles(int rowId, int count, byte[] src, int srcIndex) {
    Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET + srcIndex, doubleData,
        Platform.DOUBLE_ARRAY_OFFSET + rowId * 8L, count * 8L);
  }

  @Override
  public void putDoublesLittleEndian(int rowId, int count, byte[] src, int srcIndex) {
    if (!bigEndianPlatform) {
      putDoubles(rowId, count, src, srcIndex);
    } else {
      ByteBuffer bb = ByteBuffer.wrap(src).order(ByteOrder.LITTLE_ENDIAN);
      for (int i = 0; i < count; ++i) {
        doubleData[i + rowId] = bb.getDouble(srcIndex + (8 * i));
      }
    }
  }

  @Override
  public double getDouble(int rowId) {
    if (dictionary == null) {
      return doubleData[rowId];
    } else {
      return dictionary.decodeToDouble(dictionaryIds.getDictId(rowId));
    }
  }

  @Override
  public double[] getDoubles(int rowId, int count) {
    assert(dictionary == null);
    double[] array = new double[count];
    System.arraycopy(doubleData, rowId, array, 0, count);
    return array;
  }

  //
  // APIs dealing with Arrays
  //

  @Override
  public int getArrayLength(int rowId) {
    return arrayLengths[rowId];
  }
  @Override
  public int getArrayOffset(int rowId) {
    return arrayOffsets[rowId];
  }

  @Override
  public void putArray(int rowId, int offset, int length) {
    arrayOffsets[rowId] = offset;
    arrayLengths[rowId] = length;
  }

  //
  // APIs dealing with Byte Arrays
  //

  @Override
  public int putByteArray(int rowId, byte[] value, int offset, int length) {
    int result = arrayData().appendBytes(length, value, offset);
    arrayOffsets[rowId] = result;
    arrayLengths[rowId] = length;
    return result;
  }

  // Spilt this function out since it is the slow path.
  @Override
  protected void reserveInternal(int newCapacity) {
    if (isArray() || type instanceof MapType) {
      int[] newLengths = new int[newCapacity];
      int[] newOffsets = new int[newCapacity];
      if (this.arrayLengths != null) {
        System.arraycopy(this.arrayLengths, 0, newLengths, 0, capacity);
        System.arraycopy(this.arrayOffsets, 0, newOffsets, 0, capacity);
      }
      arrayLengths = newLengths;
      arrayOffsets = newOffsets;
    } else if (type instanceof BooleanType) {
      if (byteData == null || byteData.length < newCapacity) {
        byte[] newData = new byte[newCapacity];
        if (byteData != null) System.arraycopy(byteData, 0, newData, 0, capacity);
        byteData = newData;
      }
    } else if (type instanceof ByteType) {
      if (byteData == null || byteData.length < newCapacity) {
        byte[] newData = new byte[newCapacity];
        if (byteData != null) System.arraycopy(byteData, 0, newData, 0, capacity);
        byteData = newData;
      }
    } else if (type instanceof ShortType) {
      if (shortData == null || shortData.length < newCapacity) {
        short[] newData = new short[newCapacity];
        if (shortData != null) System.arraycopy(shortData, 0, newData, 0, capacity);
        shortData = newData;
      }
    } else if (type instanceof IntegerType || type instanceof DateType ||
      DecimalType.is32BitDecimalType(type) || type instanceof YearMonthIntervalType) {
      if (intData == null || intData.length < newCapacity) {
        int[] newData = new int[newCapacity];
        if (intData != null) System.arraycopy(intData, 0, newData, 0, capacity);
        intData = newData;
      }
    } else if (type instanceof LongType || type instanceof TimestampType ||
        DecimalType.is64BitDecimalType(type) || type instanceof DayTimeIntervalType) {
      if (longData == null || longData.length < newCapacity) {
        long[] newData = new long[newCapacity];
        if (longData != null) System.arraycopy(longData, 0, newData, 0, capacity);
        longData = newData;
      }
    } else if (type instanceof FloatType) {
      if (floatData == null || floatData.length < newCapacity) {
        float[] newData = new float[newCapacity];
        if (floatData != null) System.arraycopy(floatData, 0, newData, 0, capacity);
        floatData = newData;
      }
    } else if (type instanceof DoubleType) {
      if (doubleData == null || doubleData.length < newCapacity) {
        double[] newData = new double[newCapacity];
        if (doubleData != null) System.arraycopy(doubleData, 0, newData, 0, capacity);
        doubleData = newData;
      }
    } else if (childColumns != null) {
      // Nothing to store.
    } else {
      throw new RuntimeException("Unhandled " + type);
    }

    byte[] newNulls = new byte[newCapacity];
    if (nulls != null) System.arraycopy(nulls, 0, newNulls, 0, capacity);
    nulls = newNulls;

    capacity = newCapacity;
  }

  @Override
  protected OnHeapColumnVector reserveNewColumn(int capacity, DataType type) {
    return new OnHeapColumnVector(capacity, type);
  }
}


text:
// Copyright (c) Jeremy W. Kuhne. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Drawing;
using WInterop.Gdi;
using WInterop.Windows;

namespace WhatClr;

/// <summary>
///  Sample from Programming Windows, 5th Edition.
///  Original (c) Charles Petzold, 1998
///  Figure 3-1, Pages 44-46.
/// </summary>
internal static class Program
{
    [STAThread]
    private static void Main()
    {
        Windows.CreateMainWindowAndRun(new WhatColor(), "What Color");
    }
}

internal class WhatColor : WindowClass
{
    public WhatColor() : base(backgroundBrush: BrushHandle.NoBrush) { }

    private static void FindWindowSize(ref int cxWindow, ref int cyWindow)
    {
        TextMetrics tm;
        using (DeviceContext dcScreen = Gdi.CreateInformationContext(""DISPLAY", null))
        {
            dcScreen.GetTextMetrics(out tm);
        }

        cxWindow = 2 * Windows.GetSystemMetrics(SystemMetric.BorderWidth) + 12 * tm.AverageCharWidth;
        cyWindow = 2 * Windows.GetSystemMetrics(SystemMetric.BorderHeight) + Windows.GetSystemMetrics(SystemMetric.CaptionAreaHeight) + 2 * tm.Height;
    }

    private const int ID_TIMER = 1;
    private Color cr, crLast;

    protected override LResult WindowProcedure(WindowHandle window, MessageType message, WParam wParam, LParam lParam)
    {
        switch (message)
        {
            case MessageType.Create:
                window.SetTimer(ID_TIMER, 100);
                return 0;
            case MessageType.Timer:
                Point pt = Windows.GetCursorPosition();

                using (DeviceContext dc = Gdi.CreateDesktopDeviceContext())
                {
                    cr = dc.GetPixel(pt);

                    if (cr != crLast)
                    {
                        crLast = cr;
                        window.GetDeviceContext().SetBackgroundColor(cr);
                        window.Invalidate(erase: false);
                    }
                }
                return 0;
            case MessageType.Paint:
                using (DeviceContext dc = window.BeginPaint())
                {
                    dc.SelectObject(StockFont.SystemFixed);
                    Rectangle rc = window.GetClientRectangle();
                    dc.FillRectangle(rc, dc.GetCurrentBrush());
                    dc.DrawText($"0x{cr.R:X2} 0x{cr.G:X2} 0x{cr.B:X2}".AsSpan(), rc,
                        TextFormat.SingleLine | TextFormat.Center | TextFormat.VerticallyCenter);
                }
                return 0;
            case MessageType.Destroy:
                window.KillTimer(ID_TIMER);
                break;
        }

        return base.WindowProcedure(window, message, wParam, lParam);
    }
}


text:
layout: default
order: 0
---

{{ site.title }}

{{ site.description }}

    {% for post in paginator.posts %}

              {{ post.title }}

          <time datetime="{{ post.date | date_to_long_string }}">
            {{ post.date | date_to_long_string }}
          </time>

          {% if post.description %}
              {{ post.description | strip_html | strip_newlines | truncate: 250 }}
          {% else %}
              {{ post.content | strip_html | strip_newlines | truncate: 250 }}
          {% endif %}

    {% endfor %}

    {% if paginator.total_pages > 1 %}

      {% if paginator.previous_page %}
        « Prev
      {% else %}
        «
      {% endif %}

      {% for page in (1..paginator.total_pages) %}
        {% if page == paginator.page %}
          {{ page }}
        {% elsif page == 1 %}
          {{ page }}
        {% else %}
          {{ page }}
        {% endif %}
      {% endfor %}

      {% if paginator.next_page %}
        Next »
      {% else %}
        »
      {% endif %}

    {% endif %}

{% include footer.html %}


text:
package fr.cvlaminck.owm.json;

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

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import fr.cvlaminck.owm.model.Weather;
import fr.cvlaminck.oww.query.OpenWeatherMapResponse;

public class ResponseJSON
{
	public final static String MESSAGE = "message";
	public final static String CODE = "cod";
	public final static String CALCTIME = "calctime";
	public final static String COUNT = "cnt";
	public final static String LIST = "list";

	public static OpenWeatherMapResponse<Weather> responseFromCurrentWeatherJSON(JSONObject json) throws JSONException
	{
		OpenWeatherMapResponse<Weather> response = new OpenWeatherMapResponse<Weather>();

		response.setMessage(json.getString(MESSAGE));
		response.setCode(json.getInt(CODE));
		if(json.has(CALCTIME) && json.getString(CALCTIME).length() > 0)
			response.setCalctime(json.getDouble(CALCTIME));
		if(json.has(COUNT))
			response.setCount(json.getInt(COUNT));
		if(json.has(LIST))
		{
			JSONArray array = json.getJSONArray(LIST);
			List<Weather> weathers = new ArrayList<Weather>();
			for(int i = 0; i < array.length(); i++)
			{
				weathers.add(WeatherJSON.weatherFromWeatherJSON(array.getJSONObject(i)));
			}
			response.setList(weathers);
		}

		return response;
	}

}


text:
namespace Fixtures.AcceptanceTestsBodyString
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.Rest;
    using Models;

    public static partial class EnumModelExtensions
    {
            /// <summary>
            /// Get enum value 'red color' from enumeration of 'red color', 'green-color',
            /// 'blue_color'.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            public static Colors? GetNotExpandable(this IEnumModel operations)
            {
                return Task.Factory.StartNew(s => ((IEnumModel)s).GetNotExpandableAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Get enum value 'red color' from enumeration of 'red color', 'green-color',
            /// 'blue_color'.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Colors?> GetNotExpandableAsync( this IEnumModel operations, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetNotExpandableWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Sends value 'red color' from enumeration of 'red color', 'green-color',
            /// 'blue_color'
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='stringBody'>
            /// Possible values for this parameter include: 'red color', 'green-color',
            /// 'blue_color'
            /// </param>
            public static void PutNotExpandable(this IEnumModel operations, Colors? stringBody)
            {
                Task.Factory.StartNew(s => ((IEnumModel)s).PutNotExpandableAsync(stringBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Sends value 'red color' from enumeration of 'red color', 'green-color',
            /// 'blue_color'
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='stringBody'>
            /// Possible values for this parameter include: 'red color', 'green-color',
            /// 'blue_color'
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task PutNotExpandableAsync( this IEnumModel operations, Colors? stringBody, CancellationToken cancellationToken = default(CancellationToken))
            {
                await operations.PutNotExpandableWithHttpMessagesAsync(stringBody, null, cancellationToken).ConfigureAwait(false);
            }

    }
}


text:
<?php
// Heading
$_['heading_title']		= '   Materialize "Mega Menu"';
$_['megamenu_title']	= 'Materialize "Mega Menu"';

// Text
$_['text_extension']	= 'Módulos';
$_['text_success']		= 'Definições do módulo atualizadas!';
$_['text_edit']			= 'Editar módulo "Mega Menu"';

// Entry
$_['entry_status']		= 'Estado';

// Error
$_['error_permission']	= 'Aviso: Não tem permissão para modificar este módulo!';


text:
"""
Buildtest defaults, including environment variables and paths, are defined
or derived here.
"""

import pwd
import os

logID = "buildtest"

supported_type_schemas = ["script-v1.0.schema.json", "compiler-v1.0.schema.json"]

# each has a subfolder in buildtest/buildsystem/schemas/ with *.schema.json
supported_schemas = supported_type_schemas + [
    "global.schema.json",
    "settings.schema.json",
]

# Get user home based on effective uid, root of install to copy files
userhome = pwd.getpwuid(os.getuid())[5]
BUILDTEST_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# root of buildtest user home, default shell
BUILDTEST_USER_HOME = os.path.join(userhome, ".buildtest")

# dictionary used for storing status of builds
BUILDTEST_SETTINGS_FILE = os.path.join(BUILDTEST_USER_HOME, "config.yml")

var_root = os.path.join(BUILDTEST_ROOT, "var")
executor_root = os.path.join(var_root, "executors")

BUILDSPEC_CACHE_FILE = os.path.join(var_root, "buildspec-cache.json")

BUILD_REPORT = os.path.join(var_root, "report.json")

BUILDSPEC_DEFAULT_PATH = os.path.join(BUILDTEST_ROOT, "tutorials")

DEFAULT_SETTINGS_FILE = os.path.join(
    BUILDTEST_ROOT, "buildtest", "settings", "config.yml"
)
DEFAULT_SETTINGS_SCHEMA = os.path.join(
    BUILDTEST_ROOT, "buildtest", "schemas", "settings.schema.json"
)


text:
package org.apache.felix.framework;

import java.io.IOException;
import java.net.InetAddress;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.security.AccessControlException;
import java.security.AllPermission;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Set;

import org.apache.felix.framework.util.FelixConstants;
import org.apache.felix.framework.util.StringMap;
import org.apache.felix.framework.util.Util;
import org.apache.felix.framework.util.manifestparser.ManifestParser;
import org.apache.felix.framework.cache.Content;
import org.apache.felix.framework.util.manifestparser.R4Library;
import org.apache.felix.framework.wiring.BundleCapabilityImpl;
import org.apache.felix.framework.wiring.BundleWireImpl;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;

/**
 * The ExtensionManager class is used in several ways.
 *

 * First, a private instance is added (as URL with the instance as
 * URLStreamHandler) to the classloader that loaded the class.
 * It is assumed that this is an instance of URLClassloader (if not extension
 * bundles will not work). Subsequently, extension bundles can be managed by
 * instances of this class (their will be one instance per framework instance).
 *

 *

 * Second, it is used as module definition of the systembundle. Added extension
 * bundles with exported packages will contribute their exports to the
 * systembundle export.
 *

 *

 * Third, it is used as content loader of the systembundle. Added extension
 * bundles exports will be available via this loader.
 *

 */
// The general approach is to have one private static instance that we register
// with the parent classloader and one instance per framework instance that
// keeps track of extension bundles and systembundle exports for that framework
// instance.
class ExtensionManager extends URLStreamHandler implements Content
{
    // The private instance that is added to Felix.class.getClassLoader() -
    // will be null if extension bundles are not supported (i.e., we are not
    // loaded by an instance of URLClassLoader)
    static final ExtensionManager m_extensionManager;

    static
    {
        // pre-init the url sub-system as otherwise we don't work on gnu/classpath
        ExtensionManager extensionManager = new ExtensionManager();
        try
        {
            (new URL("http://felix.extensions:9/")).openConnection();
        }
        catch (Throwable t)
        {
            // This doesn't matter much - we only need the above to init the url subsystem
        }

        // We use the secure action of Felix to add a new instance to the parent
        // classloader.
        try
        {
            Felix.m_secureAction.addURLToURLClassLoader(Felix.m_secureAction.createURL(
                Felix.m_secureAction.createURL(null, "http:", extensionManager),
                "http://felix.extensions:9/", extensionManager),
                Felix.class.getClassLoader());
        }
        catch (Throwable ex)
        {
            // extension bundles will not be supported.
            extensionManager = null;
        }
        m_extensionManager = extensionManager;
    }

    private final Logger m_logger;
    private final Map m_configMap;
    private final Map m_headerMap = new StringMap(false);
    private final BundleRevision m_systemBundleRevision;
    private volatile List<BundleCapability> m_capabilities = Collections.EMPTY_LIST;
    private volatile Set<String> m_exportNames = Collections.EMPTY_SET;
    private volatile Object m_securityContext = null;
    private final List m_extensions;
    private volatile Bundle[] m_extensionsCache;
    private final Set m_names;
    private final Map m_sourceToExtensions;

    // This constructor is only used for the private instance added to the parent
    // classloader.
    private ExtensionManager()
    {
        m_logger = null;
        m_configMap = null;
        m_systemBundleRevision = null;
        m_extensions = new ArrayList();
        m_extensionsCache = new Bundle[0];
        m_names = new HashSet();
        m_sourceToExtensions = new HashMap();
    }

    /**
     * This constructor is used to create one instance per framework instance.
     * The general approach is to have one private static instance that we register
     * with the parent classloader and one instance per framework instance that
     * keeps track of extension bundles and systembundle exports for that framework
     * instance.
     *
     * @param logger the logger to use.
     * @param config the configuration to read properties from.
     * @param systemBundleInfo the info to change if we need to add exports.
     */
    ExtensionManager(Logger logger, Map configMap, Felix felix)
    {
        m_logger = logger;
        m_configMap = configMap;
        m_systemBundleRevision = new ExtensionManagerRevision(felix);
        m_extensions = null;
        m_extensionsCache = null;
        m_names = null;
        m_sourceToExtensions = null;

// TODO: FRAMEWORK - Not all of this stuff really belongs here, probably only exports.
        // Populate system bundle header map.
        m_headerMap.put(FelixConstants.BUNDLE_VERSION,
            m_configMap.get(FelixConstants.FELIX_VERSION_PROPERTY));
        m_headerMap.put(FelixConstants.BUNDLE_SYMBOLICNAME,
            FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
        m_headerMap.put(FelixConstants.BUNDLE_NAME, "System Bundle");
        m_headerMap.put(FelixConstants.BUNDLE_DESCRIPTION,
            "This bundle is system specific; it implements various system services.");
        m_headerMap.put(FelixConstants.EXPORT_SERVICE,
            "org.osgi.service.packageadmin.PackageAdmin," +
            "org.osgi.service.startlevel.StartLevel," +
            "org.osgi.service.url.URLHandlers");

        // The system bundle exports framework packages as well as
        // arbitrary user-defined packages from the system class path.
        // We must construct the system bundle's export metadata.
        // Get configuration property that specifies which class path
        // packages should be exported by the system bundle.
        String syspkgs =
            (String) m_configMap.get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES);
        // If no system packages were specified, load our default value.
        syspkgs = (syspkgs == null)
            ? Util.getDefaultProperty(logger, Constants.FRAMEWORK_SYSTEMPACKAGES)
            : syspkgs;
        syspkgs = (syspkgs == null) ? "" : syspkgs;
        // If any extra packages are specified, then append them.
        String pkgextra =
            (String) m_configMap.get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
        syspkgs = (pkgextra == null) ? syspkgs : syspkgs + "," + pkgextra;
        m_headerMap.put(FelixConstants.BUNDLE_MANIFESTVERSION, "2");
        m_headerMap.put(FelixConstants.EXPORT_PACKAGE, syspkgs);

        // The system bundle alsp provides framework generic capabilities
        // as well as arbitrary user-defined generic capabilities. We must
        // construct the system bundle's capabilitie metadata. Get the
        // configuration property that specifies which capabilities should
        // be provided by the system bundle.
        String syscaps =
            (String) m_configMap.get(FelixConstants.FRAMEWORK_SYSTEMCAPABILITIES);
        // If no system capabilities were specified, load our default value.
        syscaps = (syscaps == null)
            ? Util.getDefaultProperty(logger, Constants.FRAMEWORK_SYSTEMCAPABILITIES)
            : syscaps;
        syscaps = (syscaps == null) ? "" : syscaps;
        // If any extra capabilities are specified, then append them.
        String capextra =
            (String) m_configMap.get(FelixConstants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA);
        syscaps = (capextra == null) ? syscaps : syscaps + "," + capextra;
        m_headerMap.put(FelixConstants.PROVIDE_CAPABILITY, syscaps);
        try
        {
            ManifestParser mp = new ManifestParser(
                m_logger, m_configMap, m_systemBundleRevision, m_headerMap);
            List<BundleCapability> caps = aliasSymbolicName(mp.getCapabilities());
            appendCapabilities(caps);
        }
        catch (Exception ex)
        {
            m_capabilities = Collections.EMPTY_LIST;
            m_logger.log(
                Logger.LOG_ERROR,
                "Error parsing system bundle export statement: "
                + syspkgs, ex);
        }
    }

    private static List<BundleCapability> aliasSymbolicName(List<BundleCapability> caps)
    {
        if (caps == null)
        {
            return new ArrayList<BundleCapability>(0);
        }

        List<BundleCapability> aliasCaps = new ArrayList<BundleCapability>(caps);

        String[] aliases = {
            FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME,
            Constants.SYSTEM_BUNDLE_SYMBOLICNAME };

        for (int capIdx = 0; capIdx < aliasCaps.size(); capIdx++)
        {
            BundleCapability cap = aliasCaps.get(capIdx);

            // Need to alias bundle and host capabilities.
            if (cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE)
                || cap.getNamespace().equals(BundleRevision.HOST_NAMESPACE))
            {
                // Make a copy of the attribute array.
                Map<String, Object> aliasAttrs =
                    new HashMap<String, Object>(cap.getAttributes());
                // Add the aliased value.
                aliasAttrs.put(cap.getNamespace(), aliases);
                // Create the aliased capability to replace the old capability.
                cap = new BundleCapabilityImpl(
                    cap.getRevision(),
                    cap.getNamespace(),
                    cap.getDirectives(),
                    aliasAttrs);
                aliasCaps.set(capIdx, cap);
            }

            // Further, search attributes for bundle symbolic name and alias it too.
            for (Entry<String, Object> entry : cap.getAttributes().entrySet())
            {
                // If there is a bundle symbolic name attribute, add the
                // standard alias as a value.
                if (entry.getKey().equalsIgnoreCase(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE))
                {
                    // Make a copy of the attribute array.
                    Map<String, Object> aliasAttrs =
                        new HashMap<String, Object>(cap.getAttributes());
                    // Add the aliased value.
                    aliasAttrs.put(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE, aliases);
                    // Create the aliased capability to replace the old capability.
                    aliasCaps.set(capIdx, new BundleCapabilityImpl(
                        cap.getRevision(),
                        cap.getNamespace(),
                        cap.getDirectives(),
                        aliasAttrs));
                    // Continue with the next capability.
                    break;
                }
            }
        }

        return aliasCaps;
    }

    public BundleRevision getRevision()
    {
        return m_systemBundleRevision;
    }

    public Object getSecurityContext()
    {
        return m_securityContext;
    }

    public synchronized void setSecurityContext(Object securityContext)
    {
        m_securityContext = securityContext;
    }

    /**
     * Add an extension bundle. The bundle will be added to the parent classloader
     * and it's exported packages will be added to the module definition
     * exports of this instance. Subsequently, they are available form the
     * instance in it's role as content loader.
     *
     * @param felix the framework instance the given extension bundle comes from.
     * @param bundle the extension bundle to add.
     * @throws BundleException if extension bundles are not supported or this is
     *          not a framework extension.
     * @throws SecurityException if the caller does not have the needed
     *          AdminPermission.EXTENSIONLIFECYCLE and security is enabled.
     * @throws Exception in case something goes wrong.
     */
    synchronized void addExtensionBundle(Felix felix, BundleImpl bundle)
        throws SecurityException, BundleException, Exception
    {
        Object sm = System.getSecurityManager();
        if (sm != null)
        {
                ((SecurityManager) sm).checkPermission(
                    new AdminPermission(bundle, AdminPermission.EXTENSIONLIFECYCLE));
        }

        if (!((BundleProtectionDomain) bundle.getProtectionDomain()).impliesDirect(new AllPermission()))
        {
            throw new SecurityException("Extension Bundles must have AllPermission");
        }

        String directive = ManifestParser.parseExtensionBundleHeader((String)
            ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
                .getHeaders().get(Constants.FRAGMENT_HOST));

        // We only support classpath extensions (not bootclasspath).
        if (!Constants.EXTENSION_FRAMEWORK.equals(directive))
        {
            throw new BundleException("Unsupported Extension Bundle type: " +
                directive, new UnsupportedOperationException(
                "Unsupported Extension Bundle type!"));
        }

        try
        {
            // Merge the exported packages with the exported packages of the systembundle.
            List<BundleCapability> exports = null;
            try
            {
                exports = ManifestParser.parseExportHeader(
                    m_logger, m_systemBundleRevision,
                    (String) ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
                        .getHeaders().get(Constants.EXPORT_PACKAGE),
                    m_systemBundleRevision.getSymbolicName(), m_systemBundleRevision.getVersion());
                exports = aliasSymbolicName(exports);
            }
            catch (Exception ex)
            {
                m_logger.log(
                    bundle,
                    Logger.LOG_ERROR,
                    "Error parsing extension bundle export statement: "
                    + ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
                        .getHeaders().get(Constants.EXPORT_PACKAGE), ex);
                return;
            }

            // Add the bundle as extension if we support extensions
            if (m_extensionManager != null)
            {
                // This needs to be the private instance.
                m_extensionManager.addExtension(felix, bundle);
            }
            else
            {
                // We don't support extensions (i.e., the parent is not an URLClassLoader).
                m_logger.log(bundle, Logger.LOG_WARNING,
                    "Unable to add extension bundle to FrameworkClassLoader - Maybe not an URLClassLoader?");
                throw new UnsupportedOperationException(
                    "Unable to add extension bundle to FrameworkClassLoader - Maybe not an URLClassLoader?");
            }
            appendCapabilities(exports);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        BundleRevisionImpl bri = (BundleRevisionImpl) bundle.adapt(BundleRevision.class);
        List<BundleRequirement> reqs = bri.getDeclaredRequirements(BundleRevision.HOST_NAMESPACE);
        List<BundleCapability> caps = getCapabilities(BundleRevision.HOST_NAMESPACE);
        BundleWire bw = new BundleWireImpl(bri, reqs.get(0), m_systemBundleRevision, caps.get(0));
        bri.resolve(
            new BundleWiringImpl(
                m_logger,
                m_configMap,
                null,
                bri,
                null,
                Collections.singletonList(bw),
                Collections.EMPTY_MAP,
                Collections.EMPTY_MAP));
        felix.getDependencies().addDependent(bw);
        felix.setBundleStateAndNotify(bundle, Bundle.RESOLVED);
    }

    /**
     * This is a Felix specific extension mechanism that allows extension bundles
     * to have activators and be started via this method.
     *
     * @param felix the framework instance the extension bundle is installed in.
     * @param bundle the extension bundle to start if it has a Felix specific activator.
     */
    void startExtensionBundle(Felix felix, BundleImpl bundle)
    {
        String activatorClass = (String)
            ((BundleRevisionImpl) bundle.adapt(BundleRevision.class))
                .getHeaders().get(FelixConstants.FELIX_EXTENSION_ACTIVATOR);

        if (activatorClass != null)
        {
            try
            {
// TODO: SECURITY - Should this consider security?
                BundleActivator activator = (BundleActivator)
                    felix.getClass().getClassLoader().loadClass(
                        activatorClass.trim()).newInstance();

// TODO: EXTENSIONMANAGER - This is kind of hacky, can we improve it?
                felix.m_activatorList.add(activator);

                BundleContext context = felix._getBundleContext();

                bundle.setBundleContext(context);

                if ((felix.getState() == Bundle.ACTIVE) || (felix.getState() == Bundle.STARTING))
                {
                    Felix.m_secureAction.startActivator(activator, context);
                }
            }
            catch (Throwable ex)
            {
                m_logger.log(bundle, Logger.LOG_WARNING,
                    "Unable to start Felix Extension Activator", ex);
            }
        }
    }

    /**
     * Remove all extension registered by the given framework instance. Note, it
     * is not possible to unregister allready loaded classes form those extensions.
     * That is why the spec requires a JVM restart.
     *
     * @param felix the framework instance whose extensions need to be unregistered.
     */
    void removeExtensions(Felix felix)
    {
        if (m_extensionManager != null)
        {
            m_extensionManager._removeExtensions(felix);
        }
    }

    private List<BundleCapability> getCapabilities(String namespace)
    {
        List<BundleCapability> caps = m_capabilities;
        List<BundleCapability> result = caps;
        if (namespace != null)
        {
            result = new ArrayList<BundleCapability>();
            for (BundleCapability cap : caps)
            {
                if (cap.getNamespace().equals(namespace))
                {
                    result.add(cap);
                }
            }
        }
        return result;
    }

    private synchronized void appendCapabilities(List<BundleCapability> caps)
    {
        List<BundleCapability> newCaps =
            new ArrayList<BundleCapability>(m_capabilities.size() + caps.size());
        newCaps.addAll(m_capabilities);
        newCaps.addAll(caps);
        m_capabilities = Collections.unmodifiableList(newCaps);
        m_headerMap.put(Constants.EXPORT_PACKAGE, convertCapabilitiesToHeaders(m_headerMap));
    }

    private String convertCapabilitiesToHeaders(Map headers)
    {
        StringBuffer exportSB = new StringBuffer("");
        Set<String> exportNames = new HashSet<String>();

        List<BundleCapability> caps = m_capabilities;
        for (BundleCapability cap : caps)
        {
            if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
            {
                // Add a comma separate if there is an existing package.
                if (exportSB.length() > 0)
                {
                    exportSB.append(", ");
                }

                // Append exported package information.
                exportSB.append(cap.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
                for (Entry<String, String> entry : cap.getDirectives().entrySet())
                {
                    exportSB.append("; ");
                    exportSB.append(entry.getKey());
                    exportSB.append(":=\"");
                    exportSB.append(entry.getValue());
                    exportSB.append("\"");
                }
                for (Entry<String, Object> entry : cap.getAttributes().entrySet())
                {
                    if (!entry.getKey().equals(BundleRevision.PACKAGE_NAMESPACE)
                        && !entry.getKey().equals(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
                        && !entry.getKey().equals(Constants.BUNDLE_VERSION_ATTRIBUTE))
                    {
                        exportSB.append("; ");
                        exportSB.append(entry.getKey());
                        exportSB.append("=\"");
                        exportSB.append(entry.getValue());
                        exportSB.append("\"");
                    }
                }

                // Remember exported packages.
                exportNames.add(
                    (String) cap.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
            }
        }

        m_exportNames = exportNames;

        return exportSB.toString();
    }

    //
    // Classpath Extension
    //

    /*
     * See whether any registered extension provides the class requested. If not
     * throw an IOException.
     */
    public URLConnection openConnection(URL url) throws IOException
    {
        String path = url.getPath();

        if (path.trim().equals("/"))
        {
            return new URLHandlersBundleURLConnection(url);
        }

        Bundle[] extensions = m_extensionsCache;
        URL result = null;
        for (Bundle extBundle : extensions)
        {
            try
            {
                BundleRevisionImpl bri =
                    (BundleRevisionImpl) extBundle.adapt(BundleRevision.class);
                if (bri != null)
                {
                    result = bri.getResourceLocal(path);
                }
            }
            catch (Exception ex)
            {
                // Maybe the bundle went away, so ignore this exception.
            }
            if (result != null)
            {
                return result.openConnection();
            }
        }

        return new URLConnection(url)
            {
                public void connect() throws IOException
                {
                    throw new IOException("Resource not provided by any extension!");
                }
            };
    }

    protected InetAddress getHostAddress(URL u)
    {
        // the extension URLs do not address real hosts
        return null;
    }

    private synchronized void addExtension(Object source, Bundle extension)
    {
        List sourceExtensions = (List) m_sourceToExtensions.get(source);

        if (sourceExtensions == null)
        {
            sourceExtensions = new ArrayList();
            m_sourceToExtensions.put(source, sourceExtensions);
        }

        sourceExtensions.add(extension);

        _add(extension.getSymbolicName(), extension);
        m_extensionsCache = (Bundle[])
                m_extensions.toArray(new Bundle[m_extensions.size()]);
    }

    private synchronized void _removeExtensions(Object source)
    {
        if (m_sourceToExtensions.remove(source) == null)
        {
            return;
        }

        m_extensions.clear();
        m_names.clear();

        for (Iterator iter = m_sourceToExtensions.values().iterator(); iter.hasNext();)
        {
            List extensions = (List) iter.next();
            for (Iterator extIter = extensions.iterator(); extIter.hasNext();)
            {
                Bundle bundle = (Bundle) extIter.next();
                _add(bundle.getSymbolicName(), bundle);
            }
            m_extensionsCache = (Bundle[])
                m_extensions.toArray(new Bundle[m_extensions.size()]);
        }
    }

    private void _add(String name, Bundle extension)
    {
        if (!m_names.contains(name))
        {
            m_names.add(name);
            m_extensions.add(extension);
        }
    }

    public void close()
    {
        // Do nothing on close, since we have nothing open.
    }

    public Enumeration getEntries()
    {
        return new Enumeration()
        {
            public boolean hasMoreElements()
            {
                return false;
            }

            public Object nextElement() throws NoSuchElementException
            {
                throw new NoSuchElementException();
            }
        };
    }

    public boolean hasEntry(String name) {
        return false;
    }

    public byte[] getEntryAsBytes(String name)
    {
        return null;
    }

    public InputStream getEntryAsStream(String name) throws IOException
    {
        return null;
    }

    public Content getEntryAsContent(String name)
    {
        return null;
    }

    public String getEntryAsNativeLibrary(String name)
    {
        return null;
    }

    public URL getEntryAsURL(String name)
    {
        return null;
    }

    //
    // Utility methods.
    //

    class ExtensionManagerRevision extends BundleRevisionImpl
    {
        private final Version m_version;
        private volatile BundleWiring m_wiring;

        ExtensionManagerRevision(Felix felix)
        {
            super(felix, "0");
            m_version = new Version((String)
                m_configMap.get(FelixConstants.FELIX_VERSION_PROPERTY));
        }

        @Override
        public Map getHeaders()
        {
            synchronized (ExtensionManager.this)
            {
                return m_headerMap;
            }
        }

        @Override
        public List<BundleCapability> getDeclaredCapabilities(String namespace)
        {
            return ExtensionManager.this.getCapabilities(namespace);
        }

        @Override
        public String getSymbolicName()
        {
            return FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME;
        }

        @Override
        public Version getVersion()
        {
            return m_version;
        }

        @Override
        public void close()
        {
            // Nothing needed here.
        }

        @Override
        public Content getContent()
        {
            return ExtensionManager.this;
        }

        @Override
        public URL getEntry(String name)
        {
            // There is no content for the system bundle, so return null.
            return null;
        }

        @Override
        public boolean hasInputStream(int index, String urlPath)
        {
            return (getClass().getClassLoader().getResource(urlPath) != null);
        }

        @Override
        public InputStream getInputStream(int index, String urlPath)
        {
            return getClass().getClassLoader().getResourceAsStream(urlPath);
        }

        @Override
        public URL getLocalURL(int index, String urlPath)
        {
            return getClass().getClassLoader().getResource(urlPath);
        }

        @Override
        public void resolve(BundleWiringImpl wire)
        {
            try
            {
                m_wiring = new ExtensionManagerWiring(
                    m_logger, m_configMap, this);
            }
            catch (Exception ex)
            {
                // This should never happen.
            }
        }

        @Override
        public BundleWiring getWiring()
        {
            return m_wiring;
        }
    }

    class ExtensionManagerWiring extends BundleWiringImpl
    {
        ExtensionManagerWiring(
            Logger logger, Map configMap, BundleRevisionImpl revision)
            throws Exception
        {
            super(logger, configMap, null, revision,
                null, Collections.EMPTY_LIST, null, null);
        }

        @Override
        public ClassLoader getClassLoader()
        {
            return getClass().getClassLoader();
        }

        @Override
        public List<BundleCapability> getCapabilities(String namespace)
        {
            return ExtensionManager.this.getCapabilities(namespace);
        }

        @Override
        public List<R4Library> getNativeLibraries()
        {
            return Collections.EMPTY_LIST;
        }

        @Override
        public Class getClassByDelegation(String name) throws ClassNotFoundException
        {
            Class clazz = null;
            String pkgName = Util.getClassPackage(name);
            if (shouldBootDelegate(pkgName))
            {
                try
                {
                    // Get the appropriate class loader for delegation.
                    ClassLoader bdcl = getBootDelegationClassLoader();
                    clazz = bdcl.loadClass(name);
                    // If this is a java.* package, then always terminate the
                    // search; otherwise, continue to look locally if not found.
                    if (pkgName.startsWith("java.") || (clazz != null))
                    {
                        return clazz;
                    }
                }
                catch (ClassNotFoundException ex)
                {
                    // If this is a java.* package, then always terminate the
                    // search; otherwise, continue to look locally if not found.
                    if (pkgName.startsWith("java."))
                    {
                        throw ex;
                    }
                }
            }
            if (clazz == null)
            {
                if (!m_exportNames.contains(Util.getClassPackage(name)))
                {
                    throw new ClassNotFoundException(name);
                }

                clazz = getClass().getClassLoader().loadClass(name);
            }
            return clazz;
        }

        @Override
        public URL getResourceByDelegation(String name)
        {
            return getClass().getClassLoader().getResource(name);
        }

        @Override
        public Enumeration getResourcesByDelegation(String name)
        {
           try
           {
               return getClass().getClassLoader().getResources(name);
           }
           catch (IOException ex)
           {
               return null;
           }
        }

        @Override
        public void dispose()
        {
            // Nothing needed here.
        }
    }
}


text:
package org.apache.sling.jcr.repoinit.impl;

import javax.jcr.Session;

import org.apache.sling.repoinit.parser.operations.CreateServiceUser;
import org.apache.sling.repoinit.parser.operations.CreateUser;
import org.apache.sling.repoinit.parser.operations.DeleteServiceUser;
import org.apache.sling.repoinit.parser.operations.DeleteUser;

/** OperationVisitor which processes only operations related to
 *  service users and ACLs. Having several such specialized visitors
 *  makes it easy to control the execution order.
 */
class UserVisitor extends DoNothingVisitor {

    /** Create a visitor using the supplied JCR Session.
     * @param s must have sufficient rights to create users
     *      and set ACLs.
     */
    public UserVisitor(Session s) {
        super(s);
    }

    @Override
    public void visitCreateServiceUser(CreateServiceUser s) {
        final String id = s.getUsername();
        try {
            if(!UserUtil.serviceUserExists(session, id)) {
                log.info("Creating service user {}", id);
                UserUtil.createServiceUser(session, id);
            } else {
                log.info("Service user {} already exists, no changes made", id);
            }
        } catch(Exception e) {
            report(e, "Unable to create service user [" + id + "]:" + e);
        }
    }

    @Override
    public void visitDeleteServiceUser(DeleteServiceUser s) {
        final String id = s.getUsername();
        log.info("Deleting service user {}", id);
        try {
            UserUtil.deleteServiceUser(session, id);
        } catch(Exception e) {
            report(e, "Unable to delete service user [" + id + "]:" + e);
        }
    }

    @Override
    public void visitCreateUser(CreateUser u) {
        final String id = u.getUsername();
        try {
            if(!UserUtil.serviceExists(session, id)) {
                final String pwd = u.getPassword();
                if(pwd != null) {
                    // TODO we might revise this warning once we're able
                    // to create users by providing their encoded password
                    // using u.getPasswordEncoding - for now I think only cleartext works
                    log.warn("Creating user {} with cleartext password - should NOT be used on production systems", id);
                } else {
                    log.info("Creating user {}", id);
                }
                UserUtil.createUser(session, id, pwd);
            } else {
                log.info("User {} already exists, no changes made", id);
            }
        } catch(Exception e) {
            report(e, "Unable to create user [" + id + "]:" + e);
        }
    }

    @Override
    public void visitDeleteUser(DeleteUser u) {
        final String id = u.getUsername();
        log.info("Deleting user {}", id);
        try {
            UserUtil.deleteUser(session, id);
        } catch(Exception e) {
            report(e, "Unable to delete user [" + id + "]:" + e);
        }
    }

}


text:
Nehan.ListStyleType = (function(){
  /**
     @memberof Nehan
     @class ListStyleType
     @classdesc abstraction of list-style-type.
     @constructor
     @param pos {String} - "disc", "circle", "square", "lower-alpha" .. etc
  */
  function ListStyleType(type){
    this.type = type;
  }

  var __marker_text = {
    "disc": "•",
    "circle":"○",
    "square":"■"
  };

  /**
   @memberof Nehan.ListStyleType
   @return {boolean}
   */
  ListStyleType.prototype.isDecimalList = function(){
    return (this.type === "decimal" || this.type === "decimal-leading-zero");
  };
  /**
   @memberof Nehan.ListStyleType
   @return {boolean}
   */
  ListStyleType.prototype.isNoneList = function(){
    return this.type === "none";
  };
  /**
   @memberof Nehan.ListStyleType
   @return {boolean}
   */
  ListStyleType.prototype.isMarkList = function(){
    return (this.type === "disc" ||
	    this.type === "circle" ||
	    this.type === "square");
  };
  /**
   @memberof Nehan.ListStyleType
   @return {boolean}
   */
  ListStyleType.prototype.isCountableList = function(){
    return (!this.isNoneList() && !this.isMarkList());
  };
  /**
   @memberof Nehan.ListStyleType
   @return {boolean}
   */
  ListStyleType.prototype.isHankaku = function(){
    return (this.type === "lower-alpha" || this.type === "upper-alpha" ||
	    this.type === "lower-roman" || this.type === "upper-roman" ||
	    this.isDecimalList());
  };
  /**
   @memberof Nehan.ListStyleType
   @return {boolean}
   */
  ListStyleType.prototype.isZenkaku = function(){
    return !this.isHankaku();
  };
  ListStyleType.prototype._getMarkerDigitString = function(decimal){
    if(this.type === "decimal"){
      return decimal.toString(10);
    }
    if(this.type === "decimal-leading-zero"){
      if(decimal < 10){
	return "0" + decimal.toString(10);
      }
      return decimal.toString(10);
    }
    return Nehan.Cardinal.getStringByName(this.type, decimal);
  };
  /**
   @memberof Nehan.ListStyleType
   @return {String}
   */
  ListStyleType.prototype.getMarkerHtml = function(count){
    var text = this.getMarkerText(count);
    if(this.isZenkaku()){
      return Nehan.Html.tagWrap("span", text, {
	"class":"nehan-tcy"
      });
    }
    return text;
  };
  /**
   @memberof Nehan.ListStyleType
   @return {String}
   */
  ListStyleType.prototype.getMarkerText = function(count){
    if(this.isNoneList()){
      return Nehan.Const.space;
    }
    if(this.isMarkList()){
      return __marker_text[this.type] || "";
    }
    var digit = this._getMarkerDigitString(count);
    return digit + "."; // add period as postfix.
  };

  return ListStyleType;
})();


text:
using UnityEngine;

namespace Vuforia
{
    /// <summary>
    /// This class serves both as an augmentation definition for a MultiTarget in the editor
    /// as well as a tracked MultiTarget result at runtime
    /// </summary>
    public class MultiTargetBehaviour : MultiTargetAbstractBehaviour
    {
    }
}


text:
package org.haxe.duell.hxjni;

// Wrapper for native library

public class NativeInterface {

     public static native Object callObjectFunction(long inHandle,String function, Object[] args);
     public static native double callNumericFunction(long inHandle,String function, Object[] args);
     public static native void releaseReference(long inHandle);
}


text:
using System;
using Akka.Actor;
using AskSync.AkkaAskSyncLib.Contracts;
using AskSync.AkkaAskSyncLib.Messages;

namespace AskSync.AkkaAskSyncLib.Services
{
    internal class SynchronizedCacheService : SynchronizedCacheStore, ICacheService
    {
        public void AddOrUpdate(string id, AskMessage actorRef, object messageReturned)
        {
            if (id == null) throw new ArgumentNullException(nameof(id));
            if (actorRef == null) throw new ArgumentNullException(nameof(actorRef));
            Cache.AddOrUpdate(id, new Tuple<AskMessage, object>(actorRef, messageReturned));
        }

        public Tuple<AskMessage, object> Read(string id)
        {
            if (id == null) throw new ArgumentNullException(nameof(id));
            var data = Cache.Read(id);

            return data;
        }
    }
}