text:
    using System;
    using System.Collections.Generic;
    using System.IO;
    using Amazon.SimpleWorkflow.Model;
    using Amazon.Runtime.Internal.Transform;

    namespace Amazon.SimpleWorkflow.Model.Internal.MarshallTransformations
    {
      /// <summary>
      /// ActivityTypeConfigurationUnmarshaller
      /// </summary>
      internal class ActivityTypeConfigurationUnmarshaller : IUnmarshaller<ActivityTypeConfiguration, XmlUnmarshallerContext>, IUnmarshaller<ActivityTypeConfiguration, JsonUnmarshallerContext>
      {
        ActivityTypeConfiguration IUnmarshaller<ActivityTypeConfiguration, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
        {
          throw new NotImplementedException();
        }

        public ActivityTypeConfiguration Unmarshall(JsonUnmarshallerContext context)
        {
            ActivityTypeConfiguration activityTypeConfiguration = new ActivityTypeConfiguration();

            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                context.Read();
                context.Read();

              if (context.TestExpression("DefaultTaskStartToCloseTimeout", targetDepth))
              {
                activityTypeConfiguration.DefaultTaskStartToCloseTimeout = StringUnmarshaller.GetInstance().Unmarshall(context);
                continue;
              }

              if (context.TestExpression("DefaultTaskHeartbeatTimeout", targetDepth))
              {
                activityTypeConfiguration.DefaultTaskHeartbeatTimeout = StringUnmarshaller.GetInstance().Unmarshall(context);
                continue;
              }

              if (context.TestExpression("DefaultTaskList", targetDepth))
              {
                activityTypeConfiguration.DefaultTaskList = TaskListUnmarshaller.GetInstance().Unmarshall(context);
                continue;
              }

              if (context.TestExpression("DefaultTaskScheduleToStartTimeout", targetDepth))
              {
                activityTypeConfiguration.DefaultTaskScheduleToStartTimeout = StringUnmarshaller.GetInstance().Unmarshall(context);
                continue;
              }

              if (context.TestExpression("DefaultTaskScheduleToCloseTimeout", targetDepth))
              {
                activityTypeConfiguration.DefaultTaskScheduleToCloseTimeout = StringUnmarshaller.GetInstance().Unmarshall(context);
                continue;
              }

                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return activityTypeConfiguration;
                }
            }

            return activityTypeConfiguration;
        }

        private static ActivityTypeConfigurationUnmarshaller instance;
        public static ActivityTypeConfigurationUnmarshaller GetInstance()
        {
            if (instance == null)
                instance = new ActivityTypeConfigurationUnmarshaller();
            return instance;
        }
    }
}


text:
local Collapse, parent = torch.class('nn.Collapse', 'nn.Module')

-- collapses non-batch dims
function Collapse:__init(nInputDim)
   parent.__init(self)
   self.nInputDim = nInputDim
end

function Collapse:updateOutput(input)
   if not input:isContiguous() then
      self._input = self._input or input.new()
      self._input:resize(input:size()):copy(input)
      input = self._input
   end
   if input:dim() > self.nInputDim then
      self.output:view(input,input:size(1),-1)
   else
      self.output:view(input,-1)
   end
   return self.output
end

function Collapse:updateGradInput(input, gradOutput)
   self.gradInput:view(gradOutput, input:size())
   return self.gradInput
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Opl\Template\Compiler;

/**
 * The class provides the functionality of code buffers, where the compiler
 * may store pieces of PHP code that will be attached to the output template
 * around the tag.
 *
 * @author Tomasz Jędrzejewski
 * @copyright Invenzzia Group <http://www.invenzzia.org/> and contributors.
 * @license http://www.invenzzia.org/license/new-bsd New BSD License
 */
class CodeBufferCollection
{
	const TAG_BEFORE = 0;
	const TAG_AFTER = 1;
	const TAG_OPENING_BEFORE = 2;
	const TAG_OPENING_AFTER = 3;
	const TAG_CLOSING_BEFORE = 4;
	const TAG_CLOSING_AFTER = 5;
	const TAG_CONTENT_BEFORE = 6;
	const TAG_CONTENT_AFTER = 7;
	const TAG_CONTENT = 17;

	const TAG_SINGLE_BEFORE = 18;
	const TAG_SINGLE_AFTER = 19;

	const TAG_NAME = 8;
	const TAG_ATTRIBUTES_BEFORE = 9;
	const TAG_ATTRIBUTES_AFTER = 10;
	const TAG_BEGINNING_ATTRIBUTES = 11;
	const TAG_ENDING_ATTRIBUTES = 12;
	const ATTRIBUTE_BEGIN = 13;
	const ATTRIBUTE_END = 14;
	const ATTRIBUTE_NAME = 15;
	const ATTRIBUTE_VALUE = 16;

	/**
	 * Code buffer content is here.
	 * @var array
	 */
	protected $buffers = array();

	/**
	 * Prepends the code to the specified buffer.
	 *
	 * @param int $buffer The buffer ID
	 * @param string $code The code to prepend
	 * @return CodeBufferCollection Fluent interface.
	 */
	public function prepend($buffer, $code)
	{
		if(!isset($this->buffers[$buffer]))
		{
			$this->buffers[$buffer] = '';
		}
		$this->buffers[$buffer] .= ' '.(string)$code;
		return $this;
	} // end prepend();

	/**
	 * Appends the code to the specified buffer.
	 *
	 * @param int $buffer The buffer ID
	 * @param string $code The code to append
	 * @return CodeBufferCollection Fluent interface.
	 */
	public function append($buffer, $code)
	{
		if(!isset($this->buffers[$buffer]))
		{
			$this->buffers[$buffer] = '';
		}
		$this->buffers[$buffer] = ((string)$code).' '.$this->buffers[$buffer];
		return $this;
	} // end append();

	/**
	 * Copies the code from another code buffer collection to the specified buffer.
	 * If the buffer already contains some code, the copied content is appended to
	 * it.
	 *
	 * @param CodeBufferCollection $srcCollection The source code buffer collection.
	 * @param int $srcBuffer The source buffer in the source buffer collection.
	 * @param int $destBuffer The destination buffer in the current code buffer collection.
	 * @return CodeBufferCollection Fluent interface.
	 */
	public function copy(CodeBufferCollection $srcCollection, $srcBuffer, $destBuffer)
	{
		if(isset($this->buffers[$buffer]))
		{
			$this->buffers[$destBuffer] .= $srcCollection->getBuffer($srcBuffer);
		}
		else
		{
			$this->buffers[$destBuffer] = $srcCollection->getBuffer($srcBuffer);
		}
		return $this;
	} // end copy();

	/**
	 * Returns the content of the given code buffer.
	 *
	 * @param int $buffer The buffer ID
	 * @return string
	 */
	public function getBuffer($buffer)
	{
		if(!isset($this->buffers[$buffer]))
		{
			return '';
		}
		return $this->buffers[$buffer];
	} // end getBuffer();

	/**
	 * Returns true, if the given buffer has any content.
	 *
	 * @param int $buffer The buffer ID.
	 * @return boolean
	 */
	public function hasContent($buffer)
	{
		return !empty($this->buffers[$buffer]);
	} // end hasContent();

	/**
	 * Clears the code buffer collection.
	 *
	 * @return CodeBufferCollection Fluent interface.
	 */
	public function clear()
	{
		$this->buffers = array();
		return $this;
	} // end clear();

	/**
	 * Frees the memory.
	 */
	public function dispose()
	{
		$this->buffers = null;
	} // end dispose();

	/**
	 * Links the specified list of code buffer into a single output PHP code
	 * text. If the second argument is set to true, the output code is treated
	 * as a static text and is not enclosed within PHP opening and closing tags.
	 *
	 * The array of buffers to link might also contain strings with static text which
	 * will be mingled with the code buffer contents.
	 *
	 * @param array $buffers The buffers to link.
	 * @param boolean $noPhp Do not treat the buffer content as a PHP code.
	 * @return string
	 */
	public function link(array $buffers, $noPhp = false)
	{
		$out = '';
		$used = false;
		foreach($buffers as $bufferName)
		{
			if(is_string($bufferName))
			{
				if($used)
				{
					$out .= ($noPhp ? $bufferName : ' echo \''.$bufferName.'\'');
				}
				$used = false;
				continue;
			}
			if(isset($this->buffers[$bufferName]))
			{
				$out .= $this->buffers[$bufferName];
				$used = true;
			}
			else
			{
				$used = false;
			}
		}
		if(strlen($out) > 0)
		{
			return ($noPhp ? trim($out) : '<'.'?php '.$out.' ?'.'>');
		}
		return '';
	} // end link();
} // end CodeBufferCollection;


text:
package org.opentele.server.cpr.stamdatalookup.generated;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}NameID"/>
 *         <element ref="{urn:oasis:names:tc:SAML:2.0:assertion}SubjectConfirmation" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "nameID",
    "subjectConfirmation"
})
@XmlRootElement(name = "Subject", namespace = "urn:oasis:names:tc:SAML:2.0:assertion")
public class Subject {

    @XmlElement(name = "NameID", namespace = "urn:oasis:names:tc:SAML:2.0:assertion", required = true)
    protected NameIDType nameID;
    @XmlElement(name = "SubjectConfirmation", namespace = "urn:oasis:names:tc:SAML:2.0:assertion")
    protected SubjectConfirmation subjectConfirmation;

    /**
     * Gets the value of the nameID property.
     *
     * @return
     *     possible object is
     *     {@link NameIDType }
     *
     */
    public NameIDType getNameID() {
        return nameID;
    }

    /**
     * Sets the value of the nameID property.
     *
     * @param value
     *     allowed object is
     *     {@link NameIDType }
     *
     */
    public void setNameID(NameIDType value) {
        this.nameID = value;
    }

    /**
     * Gets the value of the subjectConfirmation property.
     *
     * @return
     *     possible object is
     *     {@link SubjectConfirmation }
     *
     */
    public SubjectConfirmation getSubjectConfirmation() {
        return subjectConfirmation;
    }

    /**
     * Sets the value of the subjectConfirmation property.
     *
     * @param value
     *     allowed object is
     *     {@link SubjectConfirmation }
     *
     */
    public void setSubjectConfirmation(SubjectConfirmation value) {
        this.subjectConfirmation = value;
    }

}


text:
.maxlengthblock {
	display: block;
	position: relative;
}
.maxlengthblock input {
}

.maxlengthblock .counteroverflow {
	font-size: 80%;
	line-height: 14px;
	overflow: hidden;
	position: absolute;
	right: 4px;
	bottom: -15px;
	z-index: 1;
}
.maxlengthblock .counter {
	border: 1px solid #aaa;
	border-top: none;
	border-radius: 0 0 8px 8px;
	height: 14px;
	width: 30px;
	text-align: center;
	display: block;
	background: #fff;

	color: #666;

	-webkit-transform: translate(0, -100%);
	transform: translate(0, -100%);
	-webkit-transition: 0.4s -webkit-transform;
	transition: 0.4s transform;
}
.maxlengthblock.focused .counter,
.maxlengthblock.overrun .counter {
	-webkit-transform: translate(0, 0);
	transform: translate(0, 0);
}
.maxlengthblock.level1 .counter {
	color: #990000;
}
.maxlengthblock.level2 .counter {
	color: #bb0000;
}
.maxlengthblock.level3 .counter {
	color: #ff0000;
}
.maxlengthblock.overrun .counter {
	color: #ffffff;
	background: #880000;
	border-color: #880000;
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W30158_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans20.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">antinental
ESOURCES

    <p class="styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Continental Resources
McKenzie County, ND (NAD 83) Sec. 26-T152N-R99W Syracuse 5-23H

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Wellbore #1

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Plan: Plan #3 01-28-15

    <p class="styleSans15.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Standard

    <p class="styleSans19.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Planning Report

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">23 January, 2015

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
<!DOCTYPE html>

<meta charset="UTF-8">

<title>class RubyXL::Selection - rubyXL 3.3.15</title>

<link href="../css/fonts.css" rel="stylesheet">
<link href="../css/rdoc.css" rel="stylesheet">

    Home

    Pages
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Parent

RubyXL::OOXMLObject

Methods

#before_write_xml

    class RubyXL::Selection

www.schemacentral.com/sc/ooxml/e-ssml_selection-1.html

Public Instance Methods

          before_write_xml()

          click to toggle source

# File lib/rubyXL/objects/worksheet.rb, line 379
def before_write_xml
  # Normally, rindex of activeCellId in sqref:
  # <selection activeCell="E12" activeCellId="9" sqref="A4 B6 C8 D10 E12 A4 B6 C8 D10 E12"/>
  if @active_cell_id.nil? && !@active_cell.nil? && @sqref.size > 1 then
    # But, things can be more complex:
    # <selection activeCell="E8" activeCellId="2" sqref="A4:B4 C6:D6 E8:F8"/>
    # Not using .reverse.each here to avoid memory reallocation.
    @sqref.each_with_index { |ref, ind| @active_cell_id = ind if ref.cover?(@active_cell) }
  end
  true
end

Validate

Generated by RDoc 4.2.0.

Based on Darkfish by Michael Granger.


text:
package me.lavecoral.lave.model.dao;

import me.lavecoral.lave.model.entity.Role;
import me.lavecoral.lave.model.entity.RolePermission;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Collection;
import java.util.Set;

public interface RolePermissionDao extends JpaRepository<RolePermission, Long> {

    Set<RolePermission> findAllByRoleIn(Collection<Role> roleCollection);
}


text:
NS_ASSUME_NONNULL_BEGIN

@interface TJProgressiveImageView : UIImageView

@property (nonatomic, nullable) NSOrderedSet<NSString *> *imageURLStrings;

- (void)setImageURLStrings:(NSOrderedSet<NSString *> * _Nullable)imageURLStrings secondaryImageDepth:(const TJImageCacheDepth)secondaryImageDepth;

- (void)cancelImageLoadsWithPolicy:(const TJImageCacheCancellationPolicy)policy;

@end

NS_ASSUME_NONNULL_END


text:
<?php

use SGP\Validation\Attribute;
use SGP\Validation\MessageBag;
use SGP\Validation\Validator;

class ValidatorTest extends PHPUnit_Framework_TestCase
{
    /**
     * @test
     *
     * @covers Validator::hasAsterisks()
     */
    public function shouldDetermineIfAttributeRuleHasAsterisk()
    {
        $validator = $this->getMockBuilder(Validator::class)
            ->disableOriginalConstructor()
            ->getMock();

        $attribute = $this->getMockBuilder(Attribute::class)
            ->disableOriginalConstructor()
            ->setMethods(['getKey'])
            ->getMock();

        $attribute->expects($this->exactly(2))
            ->method('getKey')
            ->willReturnOnConsecutiveCalls('this is simple', 'users.*.email');

        $this->assertFalse(invokeMethod($validator, 'hasAsterisks', [$attribute]));
        $this->assertTrue(invokeMethod($validator, 'hasAsterisks', [$attribute]));
    }

    /**
     * @test
     *
     * @covers Validator::getLeadingKey()
     */
    public function shouldReturnLeadingKey()
    {
        $validator = $this->getMockBuilder(Validator::class)
            ->disableOriginalConstructor()
            ->getMock();

        $attributeKey = 'foo.*.baz';
        $expected = 'foo';
        $actual = invokeMethod($validator, 'getLeadingKey', [$attributeKey]);

        $this->assertSame($expected, $actual);

        $attributeKey = 'foo.bar.*.baz';
        $expected = 'foo.bar';
        $actual = invokeMethod($validator, 'getLeadingKey', [$attributeKey]);

        $this->assertSame($expected, $actual);

        $attributeKey = 'foo.*.bar.*.baz';
        $expected = 'foo';
        $actual = invokeMethod($validator, 'getLeadingKey', [$attributeKey]);

        $this->assertSame($expected, $actual);

        $attributeKey = 'foo.bar.*.*.baz';
        $expected = 'foo.bar';
        $actual = invokeMethod($validator, 'getLeadingKey', [$attributeKey]);

        $this->assertSame($expected, $actual);

        $attributeKey = 'foo';
        $expected = 'foo';
        $actual = invokeMethod($validator, 'getLeadingKey', [$attributeKey]);

        $this->assertSame($expected, $actual);

        $attributeKey = 'foo.bar';
        $expected = 'foo.bar';
        $actual = invokeMethod($validator, 'getLeadingKey', [$attributeKey]);

        $this->assertSame($expected, $actual);
    }

    /**
     * @test
     */
    public function shouldValidateRule()
    {
        $input = [
            'date' => 'this should fail',
            'userId' => '',
            'brands' => [
                [
                    'id' => 10,
                    'name' => 'Zara',
                    'description' => 'Spanish clothing and accessories retaile'
                ],
                [
                    'id' => 11,
                    'name' => 'H&M',
                    'description' => 'Swedish multinational clothing-retail'
                ]
            ]
        ];

        $rules = [
            'date' => 'required|date',
            'userId' => 'required',
            'brands.*.description' => 'required|min:40'
        ];

        $messages = [
            'userId.required' => 'Missing or empty `user_id`.'
        ];

        $validator = (new Validator($input, $rules, $messages))->run();

        $this->assertTrue($validator->errors() instanceof MessageBag);

        $expected = [
            'date' => [
                'The date is not valid date format.'
            ],
            'userId' => [
                'Missing or empty `user_id`.'
            ],
            'brands.1.description' => [
                'The brands.1.description minimum is 40'
            ]
        ];

        $this->assertSame($expected, $validator->errors()->toArray());
    }
}


text:
package com.taskdesignsinc.android.myanimeviewer.model;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import io.objectbox.BoxStore;
import io.objectbox.annotation.Backlink;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Generated;
import io.objectbox.annotation.Id;
import io.objectbox.annotation.Transient;
import io.objectbox.annotation.apihint.Internal;
import io.objectbox.relation.ToMany;

@Entity
public class Anime {

    @Id
    private long id = 0;
    private String title;
    private String url;
    private String cover;

    private String type;
    private String aliases;
    private String creator;
    private String genres;
    private String summary;
    @Transient
    private String warning;
    private Date date;
    private int status = -1;

    @Backlink(to = "animeId")
    private List<Episode> episodes = new ArrayList<>();

    private String latestEpisode;
    private String latestUpdateTime;
    private int tagId = -1;

    @Transient
    private int newEpisodes = -1;
    @Transient
    private int unviewedEpisodes = -1;
    @Transient
    private int episodeCount = -1;
    @Transient
    private int catalogPosition;

    /** Used to resolve relations */
    @Internal
    @Generated(1307364262)
    transient BoxStore __boxStore;

    @Generated(2088667730)
    @Internal
    /** This constructor was generated by ObjectBox and may change any time. */
    public Anime(long id, String title, String url, String cover, String type,
            String aliases, String creator, String genres, String summary,
            Date date, int status, String latestEpisode, String latestUpdateTime,
            int tagId) {
        this.id = id;
        this.title = title;
        this.url = url;
        this.cover = cover;
        this.type = type;
        this.aliases = aliases;
        this.creator = creator;
        this.genres = genres;
        this.summary = summary;
        this.date = date;
        this.status = status;
        this.latestEpisode = latestEpisode;
        this.latestUpdateTime = latestUpdateTime;
        this.tagId = tagId;
    }

    @Generated(1101169224)
    public Anime() {
    }

    public String getCover() {
        return cover;
    }

    public void setCover(String cover) {
        this.cover = cover;
    }

    @Override
    public String toString() {
        return "Anime [name=" + title + ", "
                + "url=" + url + ", "
                + "cover=" + cover + ", "
                + "aliases=" + aliases + ", "
                + "creator=" + creator + ", "
                + "summary=" + summary + ", "
                + "genres=" + genres + ", "
                + "warning=" + warning + ", "
                + "episodes=" + episodes + "]";
    }

    public long getId() {
        return id;
    }

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

    public String getTitle() {
        return title;
    }

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

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAliases() {
        return aliases;
    }

    public void setAliases(String aliases) {
        this.aliases = aliases;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getGenres() {
        return genres;
    }

    public void setGenres(String genres) {
        this.genres = genres;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getWarning() {
        return warning;
    }

    public void setWarning(String warning) {
        this.warning = warning;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public List<Episode> getEpisodes() {
        return episodes;
    }

    public void setEpisodes(List<Episode> episodes) {
        this.episodes = episodes;
    }

    public String getLatestEpisode() {
        return latestEpisode;
    }

    public void setLatestEpisode(String latestEpisode) {
        this.latestEpisode = latestEpisode;
    }

    public String getLatestUpdateTime() {
        return latestUpdateTime;
    }

    public void setLatestUpdateTime(String latestUpdateTime) {
        this.latestUpdateTime = latestUpdateTime;
    }

    public int getTagId() {
        return tagId;
    }

    public void setTagId(int tagId) {
        this.tagId = tagId;
    }

    public int getNewEpisodes() {
        return newEpisodes;
    }

    public void setNewEpisodes(int newEpisodes) {
        this.newEpisodes = newEpisodes;
    }

    public int getUnviewedEpisodes() {
        return unviewedEpisodes;
    }

    public void setUnviewedEpisodes(int unviewedEpisodes) {
        this.unviewedEpisodes = unviewedEpisodes;
    }

    public int getEpisodeCount() {
        return episodeCount;
    }

    public void setEpisodeCount(int episodeCount) {
        this.episodeCount = episodeCount;
    }

    public boolean hasNewEpisodes() {
        return newEpisodes > 0;
    }

    public int getCatalogPosition() {
        return catalogPosition;
    }

    public void setCatalogPosition(int catalogPosition) {
        this.catalogPosition = catalogPosition;
    }

    public enum Order implements Comparator<Anime> {
        ByNameAZ() {
            @Override
            public int compare(Anime anime1, Anime anime2) {

                String lTitle1 = anime1.getTitle().toLowerCase();
                String lTitle2 = anime2.getTitle().toLowerCase();

                // ascending order
                return lTitle1.compareTo(lTitle2);
            }
        },
        ByNameZA() {
            @Override
            public int compare(Anime anime1, Anime anime2) {

                String lTitle1 = anime1.getTitle().toLowerCase();
                String lTitle2 = anime2.getTitle().toLowerCase();

                // ascending order
                return lTitle2.compareTo(lTitle1);
            }
        },
        ByTagIdL2H() {
            @Override
            public int compare(Anime anime1, Anime anime2) {
                int lPriority1 = anime1.getTagId();
                int lPriority2 = anime2.getTagId();

                if (lPriority1 == lPriority2)
                    return 0;
                else if (lPriority1 > lPriority2)
                    return 1;
                else
                    return -1;
            }
        },
        ByTagIdL2H_AZ() {
            @Override
            public int compare(Anime anime1, Anime anime2) {
                int lPriority1 = anime1.getTagId();
                int lPriority2 = anime2.getTagId();

                if (lPriority1 > lPriority2)
                    return 1;
                else if (lPriority1 < lPriority2)
                    return -1;
                else {
                    return ByNameAZ.compare(anime1, anime2);
                }
            }
        },
        ByTagIdH2L_AZ() {
            @Override
            public int compare(Anime anime1, Anime anime2) {
                int tagId1 = anime1.getTagId();
                int tagId2 = anime2.getTagId();

                if (tagId1 < tagId2)
                    return 1;
                else if (tagId1 > tagId2)
                    return -1;
                else {
                    return ByNameAZ.compare(anime1, anime2);
                }
            }
        },
        ByLastUpdate() {
            @Override
            public int compare(Anime anime1, Anime anime2) {
                //long lUpdateTime1 = anime1.getLastUpdate();
                //long lUpdateTime2 = anime2.getLastUpdate();
                long lUpdateTime1 = 0;
                long lUpdateTime2 = 0;
                if (lUpdateTime1 == lUpdateTime2)
                    return 0;
                else if (lUpdateTime1 > lUpdateTime2)
                    return -1;
                else
                    return 1;
            }
        },
    }
}


text:
"""Use this to allow imports, e.g.

```
from dstoolbox.transformers import ItemSelector
```

instead of

```
from dstoolbox.transformers.slicing import ItemSelector
```

"""

from dstoolbox.transformers.casting import ToDataFrame
from dstoolbox.transformers.padding import Padder2d
from dstoolbox.transformers.padding import Padder3d
from dstoolbox.transformers.preprocessing import ParallelFunctionTransformer
from dstoolbox.transformers.preprocessing import XLabelEncoder
from dstoolbox.transformers.slicing import ItemSelector
from dstoolbox.transformers.text import TextFeaturizer

__all__ = [
    'ItemSelector',
    'ParallelFunctionTransformer',
    'Padder2d',
    'Padder3d',
    'ToDataFrame',
    'TextFeaturizer',
    'XLabelEncoder',
]


text:
var Web3 = require('web3');
var web3 = new Web3();

web3.setProvider(new web3.providers.HttpProvider(process.env.ENODE_BASE || 'http://localhost:8545'));

var info = web3.eth.getCode('0x7679636c99120830c5f96986147cdbee85ee7379');
console.log(info);

// Unlock account: http://ethereum.stackexchange.com/questions/3996/error-personal-unlockaccount-method-not-implemented
// Should add this on geth: `geth ... --rpcapi="db,eth,net,web3,personal,web3"`


text:
<!DOCTYPE html>

	<title>Todo list</title>

		<input type="text" />
		<button id="addTask" type="button">Ajouter une tache</button>


text:
package net.spy.memcached.collection;

import net.spy.memcached.ops.Mutator;

public class BTreeMutate extends CollectionMutate {

	private final String command;

	protected final int by;

	public BTreeMutate(Mutator m, int by) {
		if (Mutator.incr == m) {
			command = "bop incr";
		} else {
			command = "bop decr";
		}

		this.by = by;
	}

	public String stringify() {
		if (str != null)
			return str;

		StringBuilder b = new StringBuilder();
		b.append(by);

		str = b.toString();
		return str;
	}

	public String getCommand() {
		return command;
	}
}


text:
namespace DataSpec::DNAMP2 {

struct ANCS : BigDNA {
  using CINFType = CINF;
  using CSKRType = CSKR;
  using ANIMType = ANIM;

  AT_DECL_DNA_YAML
  Value<atUint16> version;

  struct CharacterSet : BigDNA {
    AT_DECL_DNA_YAML
    Value<atUint16> version;
    Value<atUint32> characterCount;
    struct CharacterInfo : BigDNA {
      AT_DECL_EXPLICIT_DNA_YAML
      using MP1CharacterInfo = DNAMP1::ANCS::CharacterSet::CharacterInfo;

      atUint32 idx;
      std::string name;
      UniqueID32 cmdl;
      UniqueID32 cskr;
      UniqueID32 cinf;

      struct Animation : BigDNA {
        AT_DECL_DNA_YAML
        Value<atUint32> animIdx;
        String<-1> strA;
      };
      std::vector<Animation> animations;

      MP1CharacterInfo::PASDatabase pasDatabase;
      struct ParticleResData {
        std::vector<UniqueID32> part;
        std::vector<UniqueID32> swhc;
        std::vector<UniqueID32> unk;
        std::vector<UniqueID32> elsc;
        std::vector<UniqueID32> spsc;
        std::vector<UniqueID32> unk2;
      } partResData;

      atUint32 unk1 = 0;

      std::vector<MP1CharacterInfo::ActionAABB> animAABBs;

      struct Effect : BigDNA {
        AT_DECL_DNA_YAML
        String<-1> name;
        Value<atUint32> compCount;
        struct EffectComponent : BigDNA {
          AT_DECL_DNA_YAML
          String<-1> name;
          DNAFourCC type;
          UniqueID32 id;
          Value<atUint32> unkMP2;
          Value<float> unk1;
          Value<atUint32> unk2;
          Value<atUint32> unk3;
        };
        Vector<EffectComponent, AT_DNA_COUNT(compCount)> comps;
      };
      std::vector<Effect> effects;

      UniqueID32 cmdlIce;
      UniqueID32 cskrIce;

      std::vector<atUint32> animIdxs;

      atUint32 unk4;
      atUint8 unk5;

      struct Extents : BigDNA {
        AT_DECL_DNA_YAML
        Value<atUint32> animIdx;
        Value<atVec3f> aabb[2];
      };
      std::vector<Extents> extents;
    };
    Vector<CharacterInfo, AT_DNA_COUNT(characterCount)> characters;
  } characterSet;

  struct AnimationSet : BigDNA {
    AT_DECL_DNA_YAML
    Delete expl;

    using MP1AnimationSet = DNAMP1::ANCS::AnimationSet;

    std::vector<MP1AnimationSet::Animation> animations;

    std::vector<MP1AnimationSet::Transition> transitions;
    MP1AnimationSet::MetaTransFactory defaultTransition;

    std::vector<MP1AnimationSet::AdditiveAnimationInfo> additiveAnims;

    float additiveDefaultFadeInDur = 0.0;
    float additiveDefaultFadeOutDur = 0.0;

    std::vector<MP1AnimationSet::HalfTransition> halfTransitions;

    struct EVNT : BigDNA {
      AT_DECL_EXPLICIT_DNA_YAML
      atUint32 version;

      struct EventBase : BigDNA {
        AT_DECL_DNA_YAML
        Value<atUint16> unk0;
        String<-1> name;
        Value<atUint16> type;
        Value<float> startTime;
        Value<atUint32> unk1;
        Value<atUint32> idx;
        Value<atUint8> unk2;
        Value<float> unk3;
        Value<atUint32> unk4;
        Value<atUint32> unk5;
      };

      struct LoopEvent : EventBase {
        AT_DECL_DNA_YAML
        Value<atUint8> flag;
      };
      Value<atUint32> loopEventCount;
      Vector<LoopEvent, AT_DNA_COUNT(loopEventCount)> loopEvents;

      struct UEVTEvent : EventBase {
        AT_DECL_DNA_YAML
        Value<atUint32> uevtType;
        String<-1> boneName;
      };
      Value<atUint32> uevtEventCount;
      Vector<UEVTEvent, AT_DNA_COUNT(uevtEventCount)> uevtEvents;

      struct EffectEvent : EventBase {
        AT_DECL_DNA_YAML
        Value<atUint32> frameCount;
        DNAFourCC effectType;
        UniqueID32 effectId;
        Value<atUint32> boneId;
        Value<float> scale;
        Value<atUint32> parentMode;
      };
      Value<atUint32> effectEventCount;
      Vector<EffectEvent, AT_DNA_COUNT(effectEventCount)> effectEvents;

      struct SFXEvent : EventBase {
        AT_DECL_DNA_YAML
        Value<atUint32> soundId;
        Value<float> smallNum;
        Value<float> bigNum;
        Value<atUint32> sfxUnk1;
        Value<atUint16> sfxUnk2;
        Value<atUint16> sfxUnk3;
        Value<float> sfxUnk4;
      };
      Value<atUint32> sfxEventCount;
      Vector<SFXEvent, AT_DNA_COUNT(sfxEventCount)> sfxEvents;
    };
    std::vector<EVNT> evnts;
  } animationSet;

  void getCharacterResInfo(std::vector<DNAANCS::CharacterResInfo<UniqueID32>>& out) const {
    out.clear();
    out.reserve(characterSet.characters.size());
    for (const CharacterSet::CharacterInfo& ci : characterSet.characters) {
      out.emplace_back();
      DNAANCS::CharacterResInfo<UniqueID32>& chOut = out.back();
      chOut.name = ci.name;
      chOut.cmdl = ci.cmdl;
      chOut.cskr = ci.cskr;
      chOut.cinf = ci.cinf;

      if (ci.cmdlIce.isValid())
        chOut.overlays.emplace_back("ICE", std::make_pair(ci.cmdlIce, ci.cskrIce));
    }
  }

  void getAnimationResInfo(PAKRouter<PAKBridge>* pakRouter,
                           std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) const {
    out.clear();
    for (const DNAMP1::ANCS::AnimationSet::Animation& ai : animationSet.animations)
      ai.metaAnim.m_anim->gatherPrimitives(nullptr, out);
    for (const DNAMP1::ANCS::AnimationSet::Transition& ti : animationSet.transitions)
      if (ti.metaTrans.m_trans)
        ti.metaTrans.m_trans->gatherPrimitives(nullptr, out);
    if (animationSet.defaultTransition.m_trans)
      animationSet.defaultTransition.m_trans->gatherPrimitives(nullptr, out);
  }

  static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
                      PAKRouter<PAKBridge>& pakRouter, const DNAMP2::PAK::Entry& entry, bool force,
                      hecl::blender::Token& btok, std::function<void(const hecl::SystemChar*)> fileChanged) {
    hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
    hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
    hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
    hecl::ProjectPath::Type blendType = blendPath.getPathType();

    if (force || yamlType == hecl::ProjectPath::Type::None || blendType == hecl::ProjectPath::Type::None) {
      ANCS ancs;
      ancs.read(rs);

      if (force || yamlType == hecl::ProjectPath::Type::None) {
        athena::io::FileWriter writer(yamlPath.getAbsolutePath());
        athena::io::ToYAMLStream(ancs, writer);
      }

      if (force || blendType == hecl::ProjectPath::Type::None) {
        hecl::blender::Connection& conn = btok.getBlenderConnection();
        DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_2, 4>(
            conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
      }
    }

    return true;
  }
};

} // namespace DataSpec::DNAMP2


text:
import logging
import time

import tensorflow as tf
from tensorlog import simple
import expt

def runMain(num=250):
  params = expt.setExptParams(num)
  prog = params['prog']
  tlog = simple.Compiler(db=prog.db, prog=prog, autoset_db_params=False)
  train_data = tlog.load_big_dataset('inputs/train-%d.exam' % num)
  mode = params['targetMode']

  loss = tlog.loss(mode)
  optimizer = tf.train.AdagradOptimizer(0.1)
  train_step = optimizer.minimize(loss)

  session = tf.Session()
  session.run(tf.global_variables_initializer())
  t0 = time.time()
  epochs = 10
  for i in range(epochs):
      b = 0
      for (_,(TX,TY)) in tlog.minibatches(train_data,batch_size=125):
          print('epoch',i+1,'of',epochs,'minibatch',b+1)
          train_fd = {tlog.input_placeholder_name(mode):TX, tlog.target_output_placeholder_name(mode):TY}
          session.run(train_step, feed_dict=train_fd)
          b += 1
  print('learning time',time.time()-t0,'sec')

  predicted_y = tlog.inference(mode)
  actual_y = tlog.target_output_placeholder(mode)
  correct_predictions = tf.equal(tf.argmax(actual_y,1), tf.argmax(predicted_y,1))
  accuracy = tf.reduce_mean(tf.cast(correct_predictions, tf.float32))

  test_data = tlog.load_small_dataset('inputs/test-%d.exam' % num)
  UX,UY = test_data[mode]
  test_fd = {tlog.input_placeholder_name(mode):UX, tlog.target_output_placeholder_name(mode):UY}
  acc = session.run(accuracy, feed_dict=test_fd)
  print('test acc',acc)
  return acc #expect 27.2

if __name__== "__main__":
  runMain()


text:
<?php

namespace CRM\ToolsBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * CrmRefErrorsRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CrmRefErrorsRepository extends EntityRepository
{
}


text:
/**
 * Generates a Handlebars block helper called #unlesspage for use in templates. This helper must be re-generated for every page that's rendered, because the return value of the function is dependent on the name of the current page.
 * @param {string} pageName - Name of the page to use in the helper function.
 * @returns {function} A Handlebars helper function.
 */
module.exports = function(pageName) {
  /**
   * Handlebars block helper that renders the content inside of it based on the current page.
   * @param {string...} pages - One or more pages to check.
   * @param (object) options - Handlebars object.
   * @example
   * {{#unlesspage 'index', 'about'}}This must NOT be the index or about page.{{/unlesspage}}
   * @return The content inside the helper if no page matches, or an empty string if a page does match.
   */
  return function() {
    var params = Array.prototype.slice.call(arguments);
    var pages = params.slice(0, -1);
    var options = params[params.length - 1];

    for (var i in pages) {
      if (pages[i] === pageName) {
        return '';
      }
    }

    return options.fn(this);
  }
}


text:
// * ———————————————————————————————————————————————————————— * //
// * 	Admin api handler
// *	All admin_api/* endpoints are routed here, and are consequently
// *	routed into the admin_api folder
// * ———————————————————————————————————————————————————————— * //
var admin_api = function () {}

// local dependencies
var logger = require(enduro.enduro_path + '/libs/logger')

// Gets api name from url - /admin_api/get_something will call get_something.js
admin_api.prototype.call = function (req, res, enduro_server) {

	// Extracts api call name
	var api_name = req.url.match(/\/admin_api\/([^?]*)?.*/)[1]
	logger.timestamp('making api call: ' + api_name, 'admin_api_calls')

	// Executes call function from specified api name
	try {
		require('./admin_api/' + api_name).call(req, res, enduro_server)
	} catch (e) {
		console.log(e)
		res.send({success: false, message: 'api endpoint error'})
	}
}

module.exports = new admin_api()


text:
package org.hillview.table;

import org.hillview.table.api.ContentsKind;
import org.hillview.table.api.IIntColumn;

import javax.annotation.Nullable;
import java.security.InvalidParameterException;
import java.util.ArrayList;

/**
 * A column of integers that can grow in size.
 */
public final class IntListColumn
        extends BaseListColumn
        implements IIntColumn {
    private final ArrayList<int[]> segments;

   public IntListColumn(final ColumnDescription desc) {
        super(desc);
        if (this.description.kind != ContentsKind.Integer)
            throw new InvalidParameterException("Kind should be Integer " + this.description.kind);
        this.segments = new ArrayList<int []>();
    }

    @Override
    public int getInt(final int rowIndex) {
        final int segmentId = rowIndex >> this.LogSegmentSize;
        final int localIndex = rowIndex & this.SegmentMask;
        return this.segments.get(segmentId)[localIndex];
    }

    @Override
    void grow() {
        this.segments.add(new int[this.SegmentSize]);
        this.growMissing();
    }

    @SuppressWarnings("Duplicates")
    public void append(final int value) {
        final int segmentId = this.size >> this.LogSegmentSize;
        final int localIndex = this.size & this.SegmentMask;
        if (this.segments.size() <= segmentId)
            this.grow();
        this.segments.get(segmentId)[localIndex] = value;
        this.size++;
    }

    @Override
    public void parseAndAppendString(@Nullable String s) {
        if ((s == null) || s.isEmpty())
            this.parseEmptyOrNull();
        else
            this.append(Integer.parseInt(s));
    }
}


text:
package ucar.nc2.ft.fmrc;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Formatter;
import java.util.List;
import java.util.Locale;
import java.util.ServiceLoader;
import java.util.StringTokenizer;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import thredds.inventory.MCollection;
import ucar.nc2.constants.CDM;
import ucar.nc2.dataset.CoordinateAxis1DTime;
import ucar.nc2.dataset.DatasetUrl;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.nc2.dt.GridDatatype;
import ucar.nc2.dt.GridCoordSystem;
import ucar.nc2.dt.grid.GridDataset;
import ucar.nc2.NetcdfFile;
import ucar.nc2.internal.dataset.ft.fmrc.InventoryCacheProvider;
import ucar.nc2.ncml.NcMLReader;
import ucar.nc2.dataset.CoordinateAxis1D;
import ucar.nc2.time.CalendarDate;
import ucar.nc2.time.CalendarDateFormatter;
import ucar.nc2.units.DateUnit;
import ucar.nc2.constants._Coordinate;
import org.jdom2.output.XMLOutputter;
import org.jdom2.output.Format;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
import thredds.inventory.MFile;

/**
 * The data inventory of one GridDataset. Track grids, time, vert, ens coordinates. Grids are
 * grouped by the time coordinated that they use. Uses dense time, vert coordinates - just the ones that are in the
 * file.
 *
 * Note: Not sure if the vert coords will ever be different across the time coords.
 *
 * Should be immutable, once the file is finished writing.
 *
 * @author caron
 * @since Jan 11, 2010
 */
public class GridDatasetInv {
  private static final Logger logger = LoggerFactory.getLogger(GridDatasetInv.class);
  private static final int REQ_VERSION = 2; // minimum required version, else regenerate XML
  private static final int CURR_VERSION = 2; // current version

  // Cache the GridDatasetInv directly in memory. Persist to disk if InventoryCacheProvider if found.
  private static Cache<String, GridDatasetInv> cache = CacheBuilder.newBuilder().maximumSize(100).build();

  public static GridDatasetInv open(MCollection cm, MFile mfile, Element ncml) throws IOException {
    try {
      return cache.get(mfile.getPath() + "#fmrInv.xml", new GenerateInv(cm, mfile, ncml));
    } catch (ExecutionException e) {
      throw new IOException("Cache failed", e);
    }
  }

  private static class GenerateInv implements Callable<GridDatasetInv> {
    private final MCollection cm;
    private final MFile mfile;
    private final Element ncml;
    private static final InventoryCacheProvider persistedCache;

    // Look for InventoryCacheProvider, which implements a persistent cache of GridDatasetInv.
    // Persistence is needed for the TDS
    static {
      InventoryCacheProvider icp = null;
      for (InventoryCacheProvider provider : ServiceLoader.load(InventoryCacheProvider.class)) {
        // first one wins
        icp = provider;
      }
      persistedCache = icp;
    }

    GenerateInv(MCollection cm, MFile mfile, Element ncml) {
      this.cm = cm;
      this.mfile = mfile;
      this.ncml = ncml;
    }

    @Override
    public GridDatasetInv call() throws Exception {
      ucar.nc2.dt.GridDataset gds = null;
      GridDatasetInv inv = null;
      if (persistedCache != null) {
        inv = persistedCache.get(mfile);
      }

      if (inv == null) {
        try {
          if (ncml == null) {
            gds = GridDataset.openIfce(mfile.getPath());
          } else {
            NetcdfFile nc = NetcdfDataset.acquireFile(DatasetUrl.create(null, mfile.getPath()), null);
            NetcdfDataset ncd = NcMLReader.mergeNcML(nc, ncml); // create new dataset
            ncd.enhance(); // now that the ncml is added, enhance "in place", ie modify the NetcdfDataset
            gds = new GridDataset(ncd);
          }
          inv = new GridDatasetInv(gds, cm.extractDate(mfile));
          if (persistedCache != null && inv != null) {
            // add inventory to persisted cache
            persistedCache.put(mfile, inv);
          }
        } finally {
          if (gds != null) {
            gds.close();
          }
        }
      }
      return inv;
    }
  }

  /////////////////////////////////////////////////////////////////////////////////////

  private String location;
  private int version;
  private final List<TimeCoord> times = new ArrayList<>(); // list of TimeCoord
  private final List<VertCoord> vaxes = new ArrayList<>(); // list of VertCoord
  private final List<EnsCoord> eaxes = new ArrayList<>(); // list of EnsCoord
  private CalendarDate runDate; // date of the run
  private String runTimeString; // string representation of the date of the run
  private Date lastModified;

  private GridDatasetInv() {}

  public GridDatasetInv(ucar.nc2.dt.GridDataset gds, CalendarDate runDate) {
    this.location = gds.getLocation();
    this.runDate = runDate;

    NetcdfFile ncfile = gds.getNetcdfFile();
    if (ncfile != null && this.runDate == null) {
      runTimeString = ncfile.getRootGroup().findAttributeString(_Coordinate.ModelBaseDate, null);
      if (runTimeString == null) {
        runTimeString = ncfile.getRootGroup().findAttributeString(_Coordinate.ModelRunDate, null);
      }

      if (runTimeString != null) {
        this.runDate = DateUnit.parseCalendarDate(runTimeString);
      }

      if (this.runDate == null) {
        this.runDate = gds.getCalendarDateStart(); // LOOK not really right
        logger.warn("GridDatasetInv using gds.getStartDate() for run date = {} in {}", runTimeString, location);
      }
    }

    if (this.runDate == null) {
      throw new IllegalStateException("No run date");
    }

    this.runTimeString = this.runDate.toString();

    // add each variable, collect unique time and vertical axes
    for (GridDatatype gg : gds.getGrids()) {
      GridCoordSystem gcs = gg.getCoordinateSystem();
      Grid grid = new Grid(gg.getFullName());

      // LOOK: Note this assumes a dense coordinate system
      CoordinateAxis1DTime axis = gcs.getTimeAxis1D();
      if (axis != null) {
        TimeCoord tc = getTimeCoordinate(axis);
        tc.addGridInventory(grid);
        grid.tc = tc;
      }

      CoordinateAxis1D vaxis = gcs.getVerticalAxis();
      if (vaxis != null) {
        grid.vc = getVertCoordinate(vaxis);
      }

    }

    // assign sequence number
    int seqno = 0;
    for (TimeCoord tc : times) {
      tc.setId(seqno++);
    }

  }

  public String toString() {
    return location;
  }

  /**
   * Check if the GribDatasetInv xml format can be fully understood by this code.
   *
   * @return true if version can be fully understood, otherwise false.
   */
  public boolean isXmlVersionCompatible() {
    return this.version >= REQ_VERSION;
  }

  public String getLocation() {
    return location;
  }

  public long getLastModified() {
    return lastModified.getTime();
  }

  /**
   * Get the date of the ForecastModelRun
   *
   * @return the date of the ForecastModelRun
   */
  public CalendarDate getRunDate() {
    return runDate;
  }

  /**
   * Get string representation of the date of the ForecastModelRun
   *
   * @return string representation of the date of the ForecastModelRun
   */
  public String getRunDateString() {
    return runTimeString;
  }

  /**
   * Get a list of unique TimeCoords, which contain the list of variables that all use that
   * TimeCoord.
   *
   * @return list of TimeCoord
   */
  public List<TimeCoord> getTimeCoords() {
    return times;
  }

  /**
   * Get a list of unique VertCoords.
   *
   * @return list of VertCoord
   */
  public List<VertCoord> getVertCoords() {
    return vaxes;
  }

  public Grid findGrid(String name) {
    for (TimeCoord tc : times) {
      List<Grid> grids = tc.getGridInventory();
      for (Grid g : grids) {
        if (g.name.equals(name)) {
          return g;
        }
      }
    }
    return null;
  }

  private TimeCoord getTimeCoordinate(CoordinateAxis1DTime axis) {
    // check for same axis
    for (TimeCoord tc : times) {
      if (tc.getAxisName().equals(axis.getFullName())) {
        return tc;
      }
    }

    // check for same offsets
    TimeCoord want = new TimeCoord(runDate, axis);
    for (TimeCoord tc : times) {
      if ((tc.equalsData(want))) {
        return tc;
      }
    }

    // its a new one
    times.add(want);
    return want;
  }

  private Grid makeGrid(String gridName) {
    return new Grid(gridName);
  }

  /**
   * A Grid variable has a name, timeCoord and optionally a Vertical and Ensemble Coordinate
   */
  public class Grid implements Comparable<Grid> {
    final String name;
    TimeCoord tc; // time coordinates relative to getRunDate()
    EnsCoord ec; // optional
    VertCoord vc; // optional

    private Grid(String name) {
      this.name = name;
    }

    public String getName() {
      return name;
    }

    public String getLocation() {
      return location;
    }

    public String getTimeCoordName() {
      return (tc == null) ? "" : tc.getName();
    }

    public String getVertCoordName() {
      return (vc == null) ? "" : vc.getName();
    }

    public int compareTo(Grid o) {
      return name.compareTo(o.name);
    }

    public int countTotal() {
      int ntimes = tc.getNCoords();
      return ntimes * getVertCoordLength();
    }

    public String toString() {
      return name;
    }

    public int getVertCoordLength() {
      return (vc == null) ? 1 : vc.getValues1().length;
    }

    public TimeCoord getTimeCoord() {
      return tc;
    }

    public GridDatasetInv getFile() {
      return GridDatasetInv.this;
    }
  }

  private VertCoord getVertCoordinate(int wantId) {
    if (wantId < 0) {
      return null;
    }
    for (VertCoord vc : vaxes) {
      if (vc.getId() == wantId) {
        return vc;
      }
    }
    return null;
  }

  private VertCoord getVertCoordinate(CoordinateAxis1D axis) {
    for (VertCoord vc : vaxes) {
      if (vc.getName().equals(axis.getFullName())) {
        return vc;
      }
    }

    VertCoord want = new VertCoord(axis);
    for (VertCoord vc : vaxes) {
      if ((vc.equalsData(want))) {
        return vc;
      }
    }

    // its a new one
    vaxes.add(want);
    return want;
  }

  private EnsCoord getEnsCoordinate(int ens_id) {
    if (ens_id < 0) {
      return null;
    }
    for (EnsCoord ec : eaxes) {
      if ((ec.getId() == ens_id)) {
        return ec;
      }
    }
    return null;
  }

  //////////////////////////////////////////////////////////////

  /**
   * Write the XML representation to a String.
   *
   * @return the XML representation to a String.
   */
  public String writeXML(Date lastModified) {
    XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat());
    return fmt.outputString(writeDocument(lastModified));
  }

  /**
   * Create the XML representation of the GridDatasetInv
   *
   * @return the XML representation as a Document
   */
  Document writeDocument(Date lastModified) {
    Element rootElem = new Element("gridInventory");
    Document doc = new Document(rootElem);
    rootElem.setAttribute("location", location);
    rootElem.setAttribute("runTime", runTimeString);
    if (lastModified != null) {
      rootElem.setAttribute("lastModified", CalendarDateFormatter.toDateTimeString(lastModified));
    }
    rootElem.setAttribute("version", Integer.toString(CURR_VERSION));

    // list all the vertical coords
    Collections.sort(vaxes);
    int count = 0;
    for (VertCoord vc : vaxes) {
      vc.setId(count++);
      Element vcElem = new Element("vertCoord");
      rootElem.addContent(vcElem);
      vcElem.setAttribute("id", Integer.toString(vc.getId()));
      vcElem.setAttribute("name", vc.getName());
      if (vc.getUnits() != null) {
        vcElem.setAttribute(CDM.UNITS, vc.getUnits());
      }

      StringBuilder sbuff = new StringBuilder();
      double[] values1 = vc.getValues1();
      double[] values2 = vc.getValues2();
      for (int j = 0; j < values1.length; j++) {
        if (j > 0) {
          sbuff.append(" ");
        }
        sbuff.append(values1[j]);
        if (values2 != null) {
          sbuff.append(",");
          sbuff.append(values2[j]);
        }
      }
      vcElem.addContent(sbuff.toString());
    }

    // list all the time coords
    count = 0;
    for (TimeCoord tc : times) {
      tc.setId(count++);
      Element timeElement = new Element("timeCoord");
      rootElem.addContent(timeElement);
      timeElement.setAttribute("id", Integer.toString(tc.getId()));
      timeElement.setAttribute("name", tc.getName());
      timeElement.setAttribute("isInterval", tc.isInterval() ? "true" : "false");

      Formatter sbuff = new Formatter();
      if (tc.isInterval()) {
        double[] bound1 = tc.getBound1();
        double[] bound2 = tc.getBound2();
        for (int j = 0; j < bound1.length; j++) {
          sbuff.format((Locale) null, "%f %f,", bound1[j], bound2[j]);
        }

      } else {
        for (double offset : tc.getOffsetTimes()) {
          sbuff.format((Locale) null, "%f,", offset);
        }
      }
      timeElement.addContent(sbuff.toString());

      List<GridDatasetInv.Grid> vars = tc.getGridInventory();
      Collections.sort(vars);
      for (Grid grid : vars) {
        Element varElem = new Element("grid");
        timeElement.addContent(varElem);
        varElem.setAttribute("name", grid.name);
        if (grid.ec != null) {
          varElem.setAttribute("ens_id", Integer.toString(grid.ec.getId()));
        }
        if (grid.vc != null) {
          varElem.setAttribute("vert_id", Integer.toString(grid.vc.getId()));
        }
      }
    }

    return doc;
  }

  /**
   * Construct a GridDatasetInv from its XML representation
   *
   * @param xmlString the xml string
   * @return ForecastModelRun
   * @throws IOException on io error
   */
  public static GridDatasetInv readXML(byte[] xmlString) throws IOException {
    InputStream is = new BufferedInputStream(new ByteArrayInputStream(xmlString));
    org.jdom2.Document doc;
    try {
      SAXBuilder builder = new SAXBuilder();
      builder.setExpandEntities(false);
      doc = builder.build(is);
    } catch (JDOMException e) {
      throw new IOException(e.getMessage() + " reading from XML ");
    }

    Element rootElem = doc.getRootElement();
    GridDatasetInv fmr = new GridDatasetInv();
    fmr.runTimeString = rootElem.getAttributeValue("runTime");
    fmr.location = rootElem.getAttributeValue("location");
    if (fmr.location == null) {
      fmr.location = rootElem.getAttributeValue("name"); // old way
    }
    String lastModifiedS = rootElem.getAttributeValue("lastModified");
    if (lastModifiedS != null) {
      fmr.lastModified = CalendarDateFormatter.isoStringToDate(lastModifiedS);
    }
    String version = rootElem.getAttributeValue("version");
    fmr.version = (version == null) ? 0 : Integer.parseInt(version);
    if (fmr.version < REQ_VERSION) {
      return fmr;
    }

    fmr.runDate = DateUnit.parseCalendarDate(fmr.runTimeString);

    java.util.List<Element> vList = rootElem.getChildren("vertCoord");
    for (Element vertElem : vList) {
      VertCoord vc = new VertCoord();
      fmr.vaxes.add(vc);
      vc.setId(Integer.parseInt(vertElem.getAttributeValue("id")));
      vc.setName(vertElem.getAttributeValue("name"));
      vc.setUnits(vertElem.getAttributeValue(CDM.UNITS));

      // parse the values
      String values = vertElem.getTextNormalize();
      StringTokenizer stoke = new StringTokenizer(values);
      int n = stoke.countTokens();
      double[] values1 = new double[n];
      double[] values2 = null;
      int count = 0;
      while (stoke.hasMoreTokens()) {
        String toke = stoke.nextToken();
        int pos = toke.indexOf(',');
        if (pos < 0) {
          values1[count] = Double.parseDouble(toke);
        } else {
          if (values2 == null) {
            values2 = new double[n];
          }
          String val1 = toke.substring(0, pos);
          String val2 = toke.substring(pos + 1);
          values1[count] = Double.parseDouble(val1);
          values2[count] = Double.parseDouble(val2);
        }
        count++;
      }
      vc.setValues1(values1);
      vc.setValues2(values2);
    }

    java.util.List<Element> tList = rootElem.getChildren("timeCoord");
    for (Element timeElem : tList) {
      TimeCoord tc = new TimeCoord(fmr.runDate);
      fmr.times.add(tc);
      tc.setId(Integer.parseInt(timeElem.getAttributeValue("id")));
      String s = timeElem.getAttributeValue("isInterval");
      boolean isInterval = "true".equals(s);

      if (isInterval) {
        String boundsAll = timeElem.getTextNormalize();
        String[] bounds = boundsAll.split(",");
        int n = bounds.length;
        double[] bound1 = new double[n];
        double[] bound2 = new double[n];
        int count = 0;
        for (String b : bounds) {
          String[] value = b.split(" ");
          bound1[count] = Double.parseDouble(value[0]);
          bound2[count] = Double.parseDouble(value[1]);
          count++;
        }
        tc.setBounds(bound1, bound2);

      } else {
        String values = timeElem.getTextNormalize();
        String[] value = values.split(",");
        int n = value.length;
        double[] offsets = new double[n];
        int count = 0;
        for (String v : value) {
          offsets[count++] = Double.parseDouble(v);
        }
        tc.setOffsetTimes(offsets);
      }

      // get the variable names
      List<Element> varList = timeElem.getChildren("grid");
      for (Element vElem : varList) {
        Grid grid = fmr.makeGrid(vElem.getAttributeValue("name"));
        if (vElem.getAttributeValue("ens_id") != null) {
          grid.ec = fmr.getEnsCoordinate(Integer.parseInt(vElem.getAttributeValue("ens_id")));
        }
        if (vElem.getAttributeValue("vert_id") != null) {
          grid.vc = fmr.getVertCoordinate(Integer.parseInt(vElem.getAttributeValue("vert_id")));
        }
        tc.addGridInventory(grid);
        grid.tc = tc;
      }
    }

    return fmr;
  }

}


text:
import Body from './Body';
import Bullet from './Bullet';

/**
 * @class Represents an enemy on the screen
 * @extends {Body}
 */
export default class Enemy extends Body {
	/**
     * Class constructor
     *
     * @param {Game} game game instance
     * @param {Object} position initial position of the body
     * @param {Object} size the size of the body
     */
	constructor(game, initialPosition, size={width: 15, height: 15}) {
		super(game, size, initialPosition);

		this.patrolX = 0;
		this.speed = 1;
	}

	/**
     * Updates the body properties on each screen update of the game
     */
	update() {
		if (this.patrolX < 0 || this.patrolX > 80) {
            this.speed = -this.speed;
        }

        if (Math.random() > 0.995 && !this.alliedBellow()) {
            this.shoot();
        }

        this.position.x += this.speed;
        this.patrolX += this.speed;
	}

	/**
	 * Indicates if there is as allied bellow
	 *
	 * @return {boolean}
	 */
	alliedBellow() {
		let invader = this,
			alliesBellow = 0;

        for(let b of this.game.bodies) {
            if (
            	b instanceof Enemy &&
                Math.abs(invader.position.x - b.position.x) < b.size.width &&
                b.position.y > invader.position.y
            ) {
            	alliesBellow++
            }
        }

        return alliesBellow > 0;
	}

	/**
     * Adds a Bullet body to the game canvas (simulates shooting)
     */
	shoot() {
		this.game.addBody(new Bullet(
			this.game,
			{x: this.position.x + this.size.width / 2, y: this.position.y + this.size.height + 5}
		));
	}

	/**
     * gets executed when object is destroyed
     */
	onDestroyed() {
		let self = this.constructor;

		if (--self.enemiesLeft <= 0) {
            self.onDestroyedAll();
        }

        console.log(self.enemiesLeft);
	}

	/**
	 * Gets executed when all enemies are destroyed
	 *
	 * @static
	 */
	static onDestroyedAll() {
		window.alert('Game over! YOU WON \\o/');
	}
}


text:
waegookweasel.github.io
=======================

My DBC Phase 0 GitHub Pages site


text:
package jsky.app.ot.viewer.action;

import jsky.app.ot.viewer.ImportWorker;
import jsky.app.ot.viewer.OpenUtils;
import jsky.app.ot.viewer.SPViewer;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;

/**
 * The ImportAction provides opening of an XML file and entry
 * to the database.
 */
public class ImportAction extends AbstractViewerAction {

    public ImportAction() {
        this(null);
    }

    public ImportAction(SPViewer viewer) {
        super(viewer, "Import XML...");
        setEnabled(true);
    }

    public void actionPerformed(final ActionEvent evt) {
        // parent component for file chooser
        final Component c = viewer;
        final File[] files = OpenUtils.getXmlFiles(c);
        if (files == null) {
            // This means cancel was pushed
            return;
        }

        importXmlFiles(files);
    }

    /**
     * Import the given XML files in a background thread.
     * <p/>
     * This method uses a background thread to import the XML files,
     * since the operation can be rather slow. A progress monitor window is
     * displayed while the files are being imported.
     */
    public void importXmlFiles(final File[] files) {
        if (files.length == 0) {
            return;
        }

        final ImportWorker worker = new ImportWorker(files, viewer);
        worker.start();
    }

    public boolean computeEnabledState() throws Exception {
        return true;
    }

}


text:
namespace simdjson {

//
// simdjson_result<dom::array> inline implementation
//
simdjson_really_inline simdjson_result<dom::array>::simdjson_result() noexcept
    : internal::simdjson_result_base<dom::array>() {}
simdjson_really_inline simdjson_result<dom::array>::simdjson_result(dom::array value) noexcept
    : internal::simdjson_result_base<dom::array>(std::forward<dom::array>(value)) {}
simdjson_really_inline simdjson_result<dom::array>::simdjson_result(error_code error) noexcept
    : internal::simdjson_result_base<dom::array>(error) {}

#if SIMDJSON_EXCEPTIONS

inline dom::array::iterator simdjson_result<dom::array>::begin() const noexcept(false) {
  if (error()) { throw simdjson_error(error()); }
  return first.begin();
}
inline dom::array::iterator simdjson_result<dom::array>::end() const noexcept(false) {
  if (error()) { throw simdjson_error(error()); }
  return first.end();
}
inline size_t simdjson_result<dom::array>::size() const noexcept(false) {
  if (error()) { throw simdjson_error(error()); }
  return first.size();
}

#endif // SIMDJSON_EXCEPTIONS

inline simdjson_result<dom::element> simdjson_result<dom::array>::at_pointer(std::string_view json_pointer) const noexcept {
  if (error()) { return error(); }
  return first.at_pointer(json_pointer);
}
inline simdjson_result<dom::element> simdjson_result<dom::array>::at(size_t index) const noexcept {
  if (error()) { return error(); }
  return first.at(index);
}

namespace dom {

//
// array inline implementation
//
simdjson_really_inline array::array() noexcept : tape{} {}
simdjson_really_inline array::array(const internal::tape_ref &_tape) noexcept : tape{_tape} {}
inline array::iterator array::begin() const noexcept {
  return internal::tape_ref(tape.doc, tape.json_index + 1);
}
inline array::iterator array::end() const noexcept {
  return internal::tape_ref(tape.doc, tape.after_element() - 1);
}
inline size_t array::size() const noexcept {
  return tape.scope_count();
}
inline size_t array::number_of_slots() const noexcept {
  return tape.matching_brace_index() - tape.json_index;
}
inline simdjson_result<element> array::at_pointer(std::string_view json_pointer) const noexcept {
  if(json_pointer.empty()) { // an empty string means that we return the current node
      return element(this->tape); // copy the current node
  } else if(json_pointer[0] != '/') { // otherwise there is an error
      return INVALID_JSON_POINTER;
  }
  json_pointer = json_pointer.substr(1);
  // - means "the append position" or "the element after the end of the array"
  // We don't support this, because we're returning a real element, not a position.
  if (json_pointer == "-") { return INDEX_OUT_OF_BOUNDS; }

  // Read the array index
  size_t array_index = 0;
  size_t i;
  for (i = 0; i < json_pointer.length() && json_pointer[i] != '/'; i++) {
    uint8_t digit = uint8_t(json_pointer[i] - '0');
    // Check for non-digit in array index. If it's there, we're trying to get a field in an object
    if (digit > 9) { return INCORRECT_TYPE; }
    array_index = array_index*10 + digit;
  }

  // 0 followed by other digits is invalid
  if (i > 1 && json_pointer[0] == '0') { return INVALID_JSON_POINTER; } // "JSON pointer array index has other characters after 0"

  // Empty string is invalid; so is a "/" with no digits before it
  if (i == 0) { return INVALID_JSON_POINTER; } // "Empty string in JSON pointer array index"

  // Get the child
  auto child = array(tape).at(array_index);
  // If there is an error, it ends here
  if(child.error()) {
    return child;
  }
  // If there is a /, we're not done yet, call recursively.
  if (i < json_pointer.length()) {
    child = child.at_pointer(json_pointer.substr(i));
  }
  return child;
}

inline simdjson_result<element> array::at(size_t index) const noexcept {
  size_t i=0;
  for (auto element : *this) {
    if (i == index) { return element; }
    i++;
  }
  return INDEX_OUT_OF_BOUNDS;
}

//
// array::iterator inline implementation
//
simdjson_really_inline array::iterator::iterator(const internal::tape_ref &_tape) noexcept : tape{_tape} { }
inline element array::iterator::operator*() const noexcept {
  return element(tape);
}
inline array::iterator& array::iterator::operator++() noexcept {
  tape.json_index = tape.after_element();
  return *this;
}
inline array::iterator array::iterator::operator++(int) noexcept {
  array::iterator out = *this;
  ++*this;
  return out;
}
inline bool array::iterator::operator!=(const array::iterator& other) const noexcept {
  return tape.json_index != other.tape.json_index;
}
inline bool array::iterator::operator==(const array::iterator& other) const noexcept {
  return tape.json_index == other.tape.json_index;
}
inline bool array::iterator::operator<(const array::iterator& other) const noexcept {
  return tape.json_index < other.tape.json_index;
}
inline bool array::iterator::operator<=(const array::iterator& other) const noexcept {
  return tape.json_index <= other.tape.json_index;
}
inline bool array::iterator::operator>=(const array::iterator& other) const noexcept {
  return tape.json_index >= other.tape.json_index;
}
inline bool array::iterator::operator>(const array::iterator& other) const noexcept {
  return tape.json_index > other.tape.json_index;
}

} // namespace dom

} // namespace simdjson

#include "simdjson/dom/element-inl.h"

#if defined(__cpp_lib_ranges)
static_assert(std::ranges::view<simdjson::dom::array>);
static_assert(std::ranges::sized_range<simdjson::dom::array>);
#if SIMDJSON_EXCEPTIONS
static_assert(std::ranges::view<simdjson::simdjson_result<simdjson::dom::array>>);
static_assert(std::ranges::sized_range<simdjson::simdjson_result<simdjson::dom::array>>);
#endif // SIMDJSON_EXCEPTIONS
#endif // defined(__cpp_lib_ranges)

#endif // SIMDJSON_INLINE_ARRAY_H


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Epicr. syst. mycol. (Upsaliae) 496 (1838)

#### Original name
Polyporus wightii Klotzsch

### Remarks
null


text:
vim.cmd('filetype plugin indent on')
local augroup = vim.api.nvim_create_augroup('raindev.ftype', {})

vim.api.nvim_create_autocmd({ 'FileType' }, {
  group = augroup,
  pattern = { 'gitcommit' },
  callback = function()
    vim.opt_local.spell = true
  end
})


text:
/**
 * Declares a dictionary's functionality. (Provided by Harvard, not me).
 */

#ifndef DICTIONARY_H
#define DICTIONARY_H

#include <stdbool.h>

// maximum length for a word
// (e.g., pneumonoultramicroscopicsilicovolcanoconiosis)
#define LENGTH 45

// hash function
unsigned int hash(const char* str);

/**
 * Returns true if word is in dictionary else false.
 */
bool check(const char *word);

/**
 * Loads dictionary into memory. Returns true if successful else false.
 */
bool load(const char *dictionary);

/**
 * Returns number of words in dictionary if loaded else 0 if not yet loaded.
 */
unsigned int size(void);

/**
 * Unloads dictionary from memory.  Returns true if successful else false.
 */
bool unload(void);

#endif // DICTIONARY_H


text:
require "bundler"
Bundler.require

if ENV["CC_TEST_REPORTER_ID"]
  require "simplecov"
  SimpleCov.start
end

require "minitest/autorun"
require "rack/test"

class IntegrationSpec < Minitest::Spec
  include Rack::Test::Methods

  def app
    RailsApp
  end

  def assert_body(expected)
    assert_equal expected, last_response.body.strip
  end
end

MiniTest::Spec.register_spec_type("RailsApp", IntegrationSpec)


text:
from __future__ import absolute_import

from .rdfformat import RDFFormat
from .rdfwriter import RDFWriter
from ..exceptions import IllegalArgumentException, RDFHandlerException
from ..vocabulary import RDF
from ..model.value import BNode, Resource
from ..model import BNode, Literal
from ..rio import xmlutil

class RDFXMLWriter(RDFWriter):
    """
    An implementation of the RDFWriter interface that writes RDF documents in
    XML-serialized RDF format.
    This records the format as
    RDF/XML, and records the 'filePath' where the serialized RDF will
    be output to.  If 'filePath' is None, output is to standard output.
    """
    def __init__(self, filePath=None):
        super(RDFXMLWriter, self).__init__(RDFFormat.RDFXML, filePath)
        self.writingStarted = False
        self.headerWritten = False
        self.lastWrittenSubject = None
        self.namespaceTable = {}
        self.buffer = []
        self.headerBuffer = None
        self.prev = None

    def _catch_dup(self, stmt):
        if (self.prev and
            stmt.subject == self.prev.subject and
            stmt.predicate == self.prev.predicate and
            stmt.object == self.prev.object):
            raise Exception("Found dup")
        if (self.prev and
            str(stmt.subject) == str(self.prev.subject) and
            str(stmt.predicate) == str(self.prev.predicate) and
            str(stmt.object) == str(self.prev.object)):
            raise Exception("Found dup")
        self.prev = stmt

    def export(self, statements):
        try:
            self.startRDF()
            for st in statements:
                self._catch_dup(st)
                self.handleStatement(st)
            self.endRDF()
        finally:
            statements.close()
        if self.file_path:
            file = open(self.file_path, 'w')
            file.writelines(self.headerBuffer)
            file.writelines(self.buffer)
        else:
            combined = self.headerBuffer
            combined.extend(self.buffer)
            result = ''.join(combined)
            ## write to standard output
            print result

    def startRDF(self):
        if self.writingStarted:
            raise RDFHandlerException("Document writing has already started")
        if self.namespaceTable is None:
            raise RDFHandlerException("Failed to initialize the namespaces table before exporting.")
        self.writingStarted = True

    def write(self, string):
        self.buffer.append(string)

    def writeHeader(self):
        """
        Write out the header to a separate buffer.  Designed to that it can be written at
        the end of the load, just before the string buffer is written to a file.
        Side-effect: Temporarily swap out the regular buffer while generating the
        header; then replace original buffer.
        """
        try:
            saveBuf = self.buffer
            self.buffer = []
            ## This export format needs the RDF namespace to be defined, add a
            ## prefix for it if there isn't one yet.
            self.setNamespace("rdf", RDF.NAMESPACE, False)
            self.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
            self.writeStartOfStartTag(RDF.NAMESPACE, "RDF")
            for name, prefix in self.namespaceTable.iteritems():
                self.writeNewLine()
                self.writeIndent()
                self.write("xmlns")
                if len(prefix) > 0:
                    self.write(':')
                    self.write(prefix)
                self.write("=\"")
                self.write(xmlutil.escapeDoubleQuotedAttValue(name))
                self.write("\"")
            self.writeEndOfStartTag()
            self.writeNewLine()
        finally:
            self.headerBuffer = self.buffer
            self.buffer = saveBuf
            self.headerWritten = True

    def endRDF(self):
        if not self.writingStarted:
            raise RDFHandlerException("Document writing has not yet started")
        try:
            if not self.headerWritten:
                self.writeHeader()
            self.flushPendingStatements()
            self.writeEndTag(RDF.NAMESPACE, "RDF")
            #self.writer.flush()  ## reinstate if we switch to writing lines to a file instead of to string buffer
        finally:
            self.writingStarted = False
            self.headerWritten = False

    def handleNamespace(self, prefix, name):
        self.setNamespace(prefix, name, False)

#    def _dict_has_value(self, dictionary, value):
#        for v in dictionary.itervalues():
#            if v == value
#

    def getNamespacePrefix(self, namespace):
        """
        Return the prefix assigned to 'namespace', or None
        """
        return self.namespaceTable.get(namespace, None)

    def setNamespace(self, prefix, name, fixedPrefix):
        if self.headerWritten:
            ## Header containing namespace declarations has already been written
            return
        if not name in self.namespaceTable:
            ## Namespace not yet mapped to a prefix, try to give it the specified
            ## prefix
            isLegalPrefix = len(prefix) == 0 or xmlutil.isNCName(prefix)
            if  not isLegalPrefix or prefix in self.namespaceTable.itervalues():
                ## Specified prefix is not legal or the prefix is already in use,
                ## generate a legal unique prefix
                if fixedPrefix:
                    if isLegalPrefix:
                        raise IllegalArgumentException("Prefix is already in use: " + prefix)

                    else:
                        raise IllegalArgumentException("Prefix is not a valid XML namespace prefix: " + prefix)
                if len(prefix) == 0 or not isLegalPrefix:
                    prefix = "ns"
                number = 2
                while (prefix + str(number)) in self.namespaceTable.itervalues():
                    number += 1
                prefix += str(number)
            self.namespaceTable[name] = prefix

    def handleStatement(self, st):
        if not self.writingStarted:
            raise RDFHandlerException("Document writing has not yet been started")
        subj = st.getSubject()
        pred = st.getPredicate()
        obj = st.getObject()
        ## Verify that an XML namespace-qualified name can be created for the
        ## predicate
        predString = pred.uri
        predSplitIdx = xmlutil.findURISplitIndex(predString)
        if predSplitIdx == -1:
            raise RDFHandlerException("Unable to create XML namespace-qualified name for predicate: "
                    + predString)
        predNamespace = predString[0:predSplitIdx]
        predLocalName = predString[predSplitIdx:]
        ## don't write the header out now; wait until the end, so that we can create namespace
        ## prefixes on the fly:
#        if not self.headerWritten:
#            self.writeHeader()
        ## SUBJECT
        if not subj == self.lastWrittenSubject: ## assumes that Resource equality is working here
            self.flushPendingStatements()
            ## Write new subject:
            self.writeStartOfStartTag(RDF.NAMESPACE, "Description")
            if isinstance(subj, BNode):
                bNode = subj
                self.writeAttribute(RDF.NAMESPACE, "nodeID", bNode.getID())
            else:
                uri = subj.uri
                self.writeAttribute(RDF.NAMESPACE, "about", uri)

            self.writeEndOfStartTag()
            self.writeNewLine()
            self.lastWrittenSubject = subj
        ## PREDICATE
        self.writeIndent()
        self.writeStartOfStartTag(predNamespace, predLocalName)
        ## OBJECT
        if isinstance(obj, Resource):
            objRes = obj
            if isinstance(objRes, BNode):
                bNode = objRes
                self.writeAttribute(RDF.NAMESPACE, "nodeID", bNode.getID())
            else:
                uri = objRes.uri
                self.writeAttribute(RDF.NAMESPACE, "resource", uri)
            self.writeEndOfEmptyTag()
        elif isinstance(obj, Literal):
            objLit = obj
            ## language attribute
            if objLit.getLanguage():
                self.writeAttributeWithoutNamespace("xml:lang", objLit.getLanguage())
            ## datatype attribute
            isXMLLiteral = False
            datatype = objLit.getDatatype()
            if datatype:
                ## Check if datatype is rdf:XMLLiteral
                isXMLLiteral = (datatype == RDF.XMLLITERAL)  ## assumes that Literal equality operator is working
                if isXMLLiteral:
                    self.writeAttribute(RDF.NAMESPACE, "parseType", "Literal")
                else:
                    self.writeAttribute(RDF.NAMESPACE, "datatype", datatype.uri)
            self.writeEndOfStartTag()
            ## label
            if isXMLLiteral:
                ## Write XML literal as plain XML
                self.write(objLit.getLabel())
            else:
                self.writeCharacterData(objLit.getLabel())
            self.writeEndTag(predNamespace, predLocalName)
        self.writeNewLine()
        ## Don't write </rdf:Description> yet, maybe the next statement
        ## has the same subject.

    def handleComment(self, comment):
        if not self.headerWritten:
            self.writeHeader()
        self.flushPendingStatements()
        self.write("<!-- ")
        self.write(comment)
        self.write(" -->")
        self.writeNewLine()

    def flushPendingStatements(self):
        if self.lastWrittenSubject:
            ## The last statement still has to be closed:
            self.writeEndTag(RDF.NAMESPACE, "Description")
            self.writeNewLine()
            self.lastWrittenSubject = None

    def writeStartOfStartTag(self, namespace, localName):
        prefix = self.getNamespacePrefix(namespace)
        if prefix is None:
            ## generate new prefix for 'namespace':
            self.setNamespace("ns", namespace, None)
            prefix = self.getNamespacePrefix(namespace)
        if prefix is None:
            self.write("<")
            self.write(localName)
            self.write(" xmlns=\"")
            self.write(xmlutil.escapeDoubleQuotedAttValue(namespace))
            self.write("\"")
        elif len(prefix) == 0:
            ## default namespace
            self.write("<")
            self.write(localName)
        else:
            self.write("<")
            self.write(prefix)
            self.write(":")
            self.write(localName)

    def writeAttributeWithoutNamespace(self, attName, value):
        self.write(" ")
        self.write(attName)
        self.write("=\"")
        self.write(xmlutil.escapeDoubleQuotedAttValue(value))
        self.write("\"")

    def writeAttribute(self, namespace, attName, value):
        prefix = self.getNamespacePrefix(namespace)
        if prefix is None or len(prefix) == 0:
            raise Exception("No prefix has been declared for the namespace used in this attribute: "
                    + namespace)
        self.write(" ")
        self.write(prefix)
        self.write(":")
        self.write(attName)
        self.write("=\"")
        self.write(xmlutil.escapeDoubleQuotedAttValue(value))
        self.write("\"")

    def writeEndOfStartTag(self, ):
        self.write(">")

    def writeEndOfEmptyTag(self, ):
        self.write("/>")

    def writeEndTag(self, namespace, localName):
        prefix = self.getNamespacePrefix(namespace)
        if prefix is None or len(prefix) == 0:
            self.write("</")
            self.write(localName)
            self.write(">")
        else:
            self.write("</")
            self.write(prefix)
            self.write(":")
            self.write(localName)
            self.write(">")

    def writeCharacterData(self, chars):
        self.write(xmlutil.escapeCharacterData(chars))

    def writeIndent(self):
        self.write("    ")

    def writeNewLine(self):
        self.write("\n")


text:
package org.xspring.tutorial.sb.hello.entity;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "dwh_asset_app_summary")
public class DemoAppAsset {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "app_name")
    private String appName;

    @Column(name = "department")
    private String department;

    @Column(name = "admin")
    private String admin;

    @Column(name = "creator")
    private String creator;

    @Column(name = "phone")
    private String phone;

    @Column(name = "vendor_admin")
    private String vendorAdmin;

    @Column(name = "vendor_phone")
    private String vendorPhone;

    @Column(name = "vendor_mail")
    private String vendorMail;

    @Column(name = "app_intro")
    private String appIntro;

    @Column(name = "descr")
    private String descr;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "modify_time")
    private Date modifyTime;

    public Long getId() {
        return id;
    }

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

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getAdmin() {
        return admin;
    }

    public void setAdmin(String admin) {
        this.admin = admin;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getVendorAdmin() {
        return vendorAdmin;
    }

    public void setVendorAdmin(String vendorAdmin) {
        this.vendorAdmin = vendorAdmin;
    }

    public String getVendorPhone() {
        return vendorPhone;
    }

    public void setVendorPhone(String vendorPhone) {
        this.vendorPhone = vendorPhone;
    }

    public String getVendorMail() {
        return vendorMail;
    }

    public void setVendorMail(String vendorMail) {
        this.vendorMail = vendorMail;
    }

    public String getAppIntro() {
        return appIntro;
    }

    public void setAppIntro(String appIntro) {
        this.appIntro = appIntro;
    }

    public String getDescr() {
        return descr;
    }

    public void setDescr(String descr) {
        this.descr = descr;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }
}


text:
name 'shipit'
description 'Service to manage deploys'
run_list(
  'recipe[rubygems]',
  'recipe[rubygems-shipit]'
)


text:
namespace PaintsNow {
	class SkyTransformVS : public TReflected<SkyTransformVS, IShader> {
	public:
		SkyTransformVS();

		TObject<IReflect>& operator () (IReflect& reflect) override;
		String GetShaderText() override;

		IShader::BindBuffer instanceBuffer;
		IShader::BindBuffer globalBuffer;
		IShader::BindBuffer vertexPositionBuffer;
		MatrixFloat4x4 worldMatrix;
		MatrixFloat4x4 viewProjectionMatrix;

		// Input
		Float3 vertexPosition;

		// Output
		Float4 rasterPosition;
		Float3 worldPosition;
	};
}


text:
--------------------------------
--  log something in the console
-- @function [parent=#Console] log
-- @param self
-- @param #char buf
-- @return Console#Console self (return value: cc.Console)

--------------------------------
-- @overload self, cc.Console::Command, string
-- @overload self, string, string
-- @function [parent=#Console] getSubCommand
-- @param self
-- @param #string cmdName
-- @param #string subCmdName
-- @return Console::Command#Console::Command ret (return value: cc.Console::Command)

--------------------------------
--  delete custom command
-- @function [parent=#Console] delCommand
-- @param self
-- @param #string cmdName
-- @return Console#Console self (return value: cc.Console)

--------------------------------
--  stops the Console. 'stop' will be called at destruction time as well
-- @function [parent=#Console] stop
-- @param self
-- @return Console#Console self (return value: cc.Console)

--------------------------------
--  get custom command
-- @function [parent=#Console] getCommand
-- @param self
-- @param #string cmdName
-- @return Console::Command#Console::Command ret (return value: cc.Console::Command)

--------------------------------
--  starts listening to specified file descriptor
-- @function [parent=#Console] listenOnFileDescriptor
-- @param self
-- @param #int fd
-- @return bool#bool ret (return value: bool)

--------------------------------
-- set bind address<br>
-- address : 127.0.0.1
-- @function [parent=#Console] setBindAddress
-- @param self
-- @param #string address
-- @return Console#Console self (return value: cc.Console)

--------------------------------
-- @overload self, cc.Console::Command, string
-- @overload self, string, string
-- @function [parent=#Console] delSubCommand
-- @param self
-- @param #string cmdName
-- @param #string subCmdName
-- @return Console#Console self (return value: cc.Console)

return nil


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX                                                                           XX
XX                          EEInterface                                      XX
XX                                                                           XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

// ONLY FUNCTIONS common to all variants of the JIT (EXE, DLL) should go here)
// otherwise they belong in the corresponding directory.

#include "jitpch.h"

#ifdef _MSC_VER
#pragma hdrstop
#endif

#if defined(DEBUG) || defined(FEATURE_JIT_METHOD_PERF) || defined(FEATURE_SIMD)

#pragma warning(push)
#pragma warning(disable : 4701) // difficult to get rid of C4701 with 'sig' below

/*****************************************************************************/

/*****************************************************************************
 *
 *  Filter wrapper to handle exception filtering.
 *  On Unix compilers don't support SEH.
 */

struct FilterSuperPMIExceptionsParam_eeinterface
{
    Compiler*               pThis;
    Compiler::Info*         pJitInfo;
    bool                    hasThis;
    size_t                  siglength;
    CORINFO_SIG_INFO        sig;
    CORINFO_ARG_LIST_HANDLE argLst;
    CORINFO_METHOD_HANDLE   hnd;
    const char*             returnType;
    const char**            pArgNames;
    EXCEPTION_POINTERS      exceptionPointers;
};

static LONG FilterSuperPMIExceptions_eeinterface(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam)
{
    FilterSuperPMIExceptionsParam_eeinterface* pSPMIEParam = (FilterSuperPMIExceptionsParam_eeinterface*)lpvParam;
    pSPMIEParam->exceptionPointers                         = *pExceptionPointers;

    if (pSPMIEParam->pThis->IsSuperPMIException(pExceptionPointers->ExceptionRecord->ExceptionCode))
    {
        return EXCEPTION_EXECUTE_HANDLER;
    }

    return EXCEPTION_CONTINUE_SEARCH;
}

const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd)
{
    const char* className;
    const char* methodName = eeGetMethodName(hnd, &className);
    if ((eeGetHelperNum(hnd) != CORINFO_HELP_UNDEF) || eeIsNativeMethod(hnd))
    {
        return methodName;
    }

    FilterSuperPMIExceptionsParam_eeinterface param;
    param.returnType = nullptr;
    param.pThis      = this;
    param.hasThis    = false;
    param.siglength  = 0;
    param.hnd        = hnd;
    param.pJitInfo   = &info;

    size_t   length = 0;
    unsigned i;

    /* Generating the full signature is a two-pass process. First we have to walk
       the components in order to assess the total size, then we allocate the buffer
       and copy the elements into it.
     */

    /* Right now there is a race-condition in the EE, className can be nullptr */

    /* initialize length with length of className and '.' */

    if (className)
    {
        length = strlen(className) + 1;
    }
    else
    {
        assert(strlen("<NULL>.") == 7);
        length = 7;
    }

    /* add length of methodName and opening bracket */
    length += strlen(methodName) + 1;

    /* figure out the signature */

    param.pThis->eeGetMethodSig(param.hnd, &param.sig);

    // allocate space to hold the class names for each of the parameters

    if (param.sig.numArgs > 0)
    {
        param.pArgNames = getAllocator(CMK_DebugOnly).allocate<const char*>(param.sig.numArgs);
    }
    else
    {
        param.pArgNames = nullptr;
    }

    PAL_TRY(FilterSuperPMIExceptionsParam_eeinterface*, pParam, &param)
    {
        unsigned i;
        pParam->argLst = pParam->sig.args;

        for (i = 0; i < pParam->sig.numArgs; i++)
        {
            var_types type = pParam->pThis->eeGetArgType(pParam->argLst, &pParam->sig);
            switch (type)
            {
                case TYP_REF:
                case TYP_STRUCT:
                {
                    CORINFO_CLASS_HANDLE clsHnd = pParam->pThis->eeGetArgClass(&pParam->sig, pParam->argLst);
                    // For some SIMD struct types we can get a nullptr back from eeGetArgClass on Linux/X64
                    if (clsHnd != NO_CLASS_HANDLE)
                    {
                        const char* clsName = pParam->pThis->eeGetClassName(clsHnd);
                        if (clsName != nullptr)
                        {
                            pParam->pArgNames[i] = clsName;
                            break;
                        }
                    }
                }
                    __fallthrough;
                default:
                    pParam->pArgNames[i] = varTypeName(type);
                    break;
            }
            pParam->siglength += strlen(pParam->pArgNames[i]);
            pParam->argLst = pParam->pJitInfo->compCompHnd->getArgNext(pParam->argLst);
        }

        /* add ',' if there is more than one argument */

        if (pParam->sig.numArgs > 1)
        {
            pParam->siglength += (pParam->sig.numArgs - 1);
        }

        var_types retType = JITtype2varType(pParam->sig.retType);
        if (retType != TYP_VOID)
        {
            switch (retType)
            {
                case TYP_REF:
                case TYP_STRUCT:
                {
                    CORINFO_CLASS_HANDLE clsHnd = pParam->sig.retTypeClass;
                    if (clsHnd != NO_CLASS_HANDLE)
                    {
                        const char* clsName = pParam->pThis->eeGetClassName(clsHnd);
                        if (clsName != nullptr)
                        {
                            pParam->returnType = clsName;
                            break;
                        }
                    }
                }
                    __fallthrough;
                default:
                    pParam->returnType = varTypeName(retType);
                    break;
            }
            pParam->siglength += strlen(pParam->returnType) + 1; // don't forget the delimiter ':'
        }

        // Does it have a 'this' pointer? Don't count explicit this, which has the this pointer type as the first
        // element of the arg type list
        if (pParam->sig.hasThis() && !pParam->sig.hasExplicitThis())
        {
            assert(strlen(":this") == 5);
            pParam->siglength += 5;
            pParam->hasThis = true;
        }
    }
    PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_eeinterface)
    {
        param.siglength = 0;
    }
    PAL_ENDTRY

    /* add closing bracket and null terminator */

    length += param.siglength + 2;

    char* retName = getAllocator(CMK_DebugOnly).allocate<char>(length);

    /* Now generate the full signature string in the allocated buffer */

    if (className)
    {
        strcpy_s(retName, length, className);
        strcat_s(retName, length, ":");
    }
    else
    {
        strcpy_s(retName, length, "<NULL>.");
    }

    strcat_s(retName, length, methodName);

    // append the signature
    strcat_s(retName, length, "(");

    if (param.siglength > 0)
    {
        param.argLst = param.sig.args;

        for (i = 0; i < param.sig.numArgs; i++)
        {
            var_types type = eeGetArgType(param.argLst, &param.sig);
            strcat_s(retName, length, param.pArgNames[i]);
            param.argLst = info.compCompHnd->getArgNext(param.argLst);
            if (i + 1 < param.sig.numArgs)
            {
                strcat_s(retName, length, ",");
            }
        }
    }

    strcat_s(retName, length, ")");

    if (param.returnType != nullptr)
    {
        strcat_s(retName, length, ":");
        strcat_s(retName, length, param.returnType);
    }

    if (param.hasThis)
    {
        strcat_s(retName, length, ":this");
    }

    assert(strlen(retName) == (length - 1));

    return (retName);
}

#pragma warning(pop)

#endif // defined(DEBUG) || defined(FEATURE_JIT_METHOD_PERF) || defined(FEATURE_SIMD)

/*****************************************************************************/


text:
<?php
namespace ViewComponents\ViewComponents\Data\Operation;

namespace Nayjest\Querying\Operation;

/**
 * DataProvider pagination operation.
 */
class PaginateOperation implements OperationInterface
{
    protected $pageNumber;

    protected $pageSize;

    /**
     * Constructor.
     *
     * @param int $pageNumber
     * @param int $pageSize
     */
    public function __construct($pageNumber = 1, $pageSize = 50)
    {
        $this->pageNumber = $pageNumber;
        $this->pageSize = $pageSize;
    }

    /**
     * @return int
     */
    public function getPageNumber()
    {
        return $this->pageNumber;
    }

    /**
     * @param int $pageNumber
     * @return $this
     */
    public function setPageNumber($pageNumber)
    {
        $this->pageNumber = $pageNumber;
        return $this;
    }

    /**
     * Returns page size.
     * @return int
     */
    public function getPageSize()
    {
        return $this->pageSize;
    }

    /**
     * Sets page size.
     *
     * @param $pageSize
     * @return $this
     */
    public function setPageSize($pageSize)
    {
        $this->pageSize = $pageSize;
        return $this;
    }
}


text:
Kolla Style Commandments
============================

- Step 1: Read the OpenStack Style Commandments
  https://docs.openstack.org/hacking/latest/
- Step 2: Read on

Kolla Specific Commandments
-------------------------------

- [K301] Method's default argument shouldn't be mutable.
- [K302] Use LOG.warning instead of LOG.warn.


text:
package com.armadialogcreator.util;

/**
 Created by Kayler on 09/08/2016.
 */
public class KeyValue<K, V> {
	public static final KeyValue[] EMPTY = new KeyValue[0];

	private final K key;
	private V value;

	public KeyValue(K key, V value) {
		this.key = key;
		this.value = value;
	}

	public K getKey() {
		return key;
	}

	public V getValue() {
		return value;
	}

	public void setValue(V value) {
		this.value = value;
	}

	@Override
	public String toString() {
		return "KeyValue{" +
				"key=" + key +
				", value=" + value +
				'}';
	}
}