text:
package org.eclipse.bpmn2.tests;

import junit.textui.TestRunner;

import org.eclipse.bpmn2.Bpmn2Factory;
import org.eclipse.bpmn2.ComplexBehaviorDefinition;

/**
 *
 * A test case for the model object 'Complex Behavior Definition'.
 *
 * @generated
 */
public class ComplexBehaviorDefinitionTest extends BaseElementTest {

	/**
	 *
	 *
	 * @generated
	 */
	public static void main(String[] args) {
		TestRunner.run(ComplexBehaviorDefinitionTest.class);
	}

	/**
	 * Constructs a new Complex Behavior Definition test case with the given name.
	 *
	 *
	 * @generated
	 */
	public ComplexBehaviorDefinitionTest(String name) {
		super(name);
	}

	/**
	 * Returns the fixture for this Complex Behavior Definition test case.
	 *
	 *
	 * @generated
	 */
	@Override
	protected ComplexBehaviorDefinition getFixture() {
		return (ComplexBehaviorDefinition) fixture;
	}

	/**
	 *
	 *
	 * @see junit.framework.TestCase#setUp()
	 * @generated
	 */
	@Override
	protected void setUp() throws Exception {
		setFixture(Bpmn2Factory.eINSTANCE.createComplexBehaviorDefinition());
	}

	/**
	 *
	 *
	 * @see junit.framework.TestCase#tearDown()
	 * @generated
	 */
	@Override
	protected void tearDown() throws Exception {
		setFixture(null);
	}

} //ComplexBehaviorDefinitionTest


text:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:ctv="http://www.ctv.ca/rss/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title><![CDATA[CTVNews.ca - Top Stories - Public RSS]]></title>
    <link>http://www.ctvnews.ca/rss/ctvnews-ca-top-stories-public-rss-1.822009</link>
    <description>
      <![CDATA[Latest news from CTVNews.ca]]>
    </description>
    <lastBuildDate>Sat, 7 Jan 2017 09:40:00 -0500</lastBuildDate>
    <image>
      <title><![CDATA[CTVNews.ca - Top Stories - Public RSS]]></title>
      <link>http://www.ctvnews.ca/rss/ctvnews-ca-top-stories-public-rss-1.822009</link>
      <url>http://www.ctvnews.ca/polopoly_fs/1.822009!/image/image.jpg</url>
    </image>
    <language>en</language>
    <copyright>Copyright Bellmedia</copyright>
    <item>
      <title><![CDATA[Florida shooting suspect struggled with mental health: family ]]></title>
      <link>http://www.ctvnews.ca/world/florida-shooting-suspect-struggled-with-mental-health-family-1.3231183</link>
      <description><![CDATA[The man police say opened fire with a gun from his checked baggage at a Florida airport had a history of mental health issues -- some of which followed his military service in Iraq -- and was receiving psychological treatment at his home in Alaska, his relatives said Friday after the deadly shooting.]]></description>
      <author></author>
      <dc:creator><![CDATA[Jason Dearen]]></dc:creator>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231183</guid>
      <pubDate>Fri, 6 Jan 2017 19:18:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 10:08:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.3231197.1483748339!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[Esteban Santiago, the 26-year-old man police say opened fire with a gun from his checked baggage at a Florida airport, is seen in this image. ]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Suspected gunman picked off passengers, sent crowds fleeing ]]></title>
      <link>http://www.ctvnews.ca/world/suspected-gunman-picked-off-passengers-sent-crowds-fleeing-1.3231564</link>
      <description><![CDATA[Without a word, the gunman moved through the baggage claim picking off travellers until his handgun ran out of ammunition, leaving five dead and eight wounded in Fort Lauderdale's airport.]]></description>
      <author></author>
      <dc:creator><![CDATA[David Fischer]]></dc:creator>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231564</guid>
      <pubDate>Sat, 7 Jan 2017 09:30:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 09:32:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.3231566.1483799307!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg">
        <![CDATA[Passengers run for cover in Terminal 1 at Fort Lauderdale–Hollywood International Airport, Friday, Jan. 6, 2017, in Fort Lauderdale, Fla. (Paul E. Kostyu via AP)
]]>
      </enclosure>
    </item>
    <item>
      <title><![CDATA[Florida attack updates: Fort Lauderdale airport reopens after shooting ]]></title>
      <link>http://www.ctvnews.ca/world/florida-attack-updates-fort-lauderdale-airport-reopens-after-shooting-1.3231538</link>
      <description><![CDATA[Fort Lauderdale-Hollywood International Airport has reopened following the terminal shooting that left five people dead and eight wounded.]]></description>
      <author></author>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231538</guid>
      <pubDate>Sat, 7 Jan 2017 08:27:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 08:27:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.3231542.1483795525!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[Passengers run as they evacuate from Terminal 1 at Fort Lauderdale–Hollywood International Airport in Fort Lauderdale, Fla., Friday, Jan. 6, 2017. (Paul E. Kostyu via AP)]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Exclusive: Top Trudeau advisers have high-level meetings with Trump officials]]></title>
      <link>http://www.ctvnews.ca/politics/exclusive-top-trudeau-advisers-have-high-level-meetings-with-trump-officials-1.3230229</link>
      <description><![CDATA[Prime Minister Justin Trudeau's top advisers have had about a dozen high-level meetings with President-elect Donald Trump's most trusted officials, CTV News has learned.]]></description>
      <author></author>
      <dc:creator><![CDATA[Laura Payton]]></dc:creator>
      <creditLine><![CDATA[Ottawa News Bureau Online Producer]]></creditLine>
      <guid isPermaLink="false">1.3230229</guid>
      <pubDate>Fri, 6 Jan 2017 10:52:00 -0500</pubDate>
      <ctv:lastModifiedDate>Fri, 6 Jan 2017 22:26:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.3104054.1475752331!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[In this March 16, 2016 file photo, Trump Tower is seen in New York. (AP Photo/Mark Lennihan, File)]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Ont. man clocked at 218 kph charged with stunt driving: police ]]></title>
      <link>http://www.ctvnews.ca/canada/ont-man-clocked-at-218-kph-charged-with-stunt-driving-police-1.3231571</link>
      <description><![CDATA[A Thornhill man is facing a stunt driving charge after provincial police in Richmond Hill say they clocked him doing 218 kph in a 100 zone.]]></description>
      <author></author>
      <creditLine><![CDATA[ The Canadian Press]]></creditLine>
      <guid isPermaLink="false">1.3231571</guid>
      <pubDate>Sat, 7 Jan 2017 09:40:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 09:40:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.2304768.1427754560!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[Undated file photo of Highway 407 entrance sign. ]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Report on election hacking says Russia plans to do more]]></title>
      <link>http://www.ctvnews.ca/world/report-on-election-hacking-says-russia-plans-to-do-more-1.3231562</link>
      <description><![CDATA[The new, declassified report on Russian efforts to influence the presidential election has a troublesome prediction: Russia isn't done intruding in U.S. politics and policymaking. ]]></description>
      <author></author>
      <dc:creator><![CDATA[Deb Riechmann, Eileen Sullivan and Julia Pace]]></dc:creator>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231562</guid>
      <pubDate>Sat, 7 Jan 2017 09:30:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 09:30:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.3231567.1483799313!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[A part of the declassified version Intelligence Community Assessment on Russia's efforts to interfere with the U.S. political process is photographed in Washington, Friday, Jan. 6, 2017. (AP / Jon Elswick)]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Red Cross says U.K. hospital crowding a 'humanitarian crisis' ]]></title>
      <link>http://www.ctvnews.ca/health/red-cross-says-u-k-hospital-crowding-a-humanitarian-crisis-1.3231528</link>
      <description><![CDATA[The British Red Cross says overcrowding in hospital emergency rooms has become a 'humanitarian crisis.']]></description>
      <author></author>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231528</guid>
      <pubDate>Sat, 7 Jan 2017 08:11:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 08:11:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.2033845.1412188892!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[A bed sits empty in an operating room in Atlanta in this Friday, Jan. 24, 2014 file photo. (AP / David Goldman)]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Fiat Chrysler recalls 100K vehicles to fix Takata air bags]]></title>
      <link>http://www.ctvnews.ca/autos/fiat-chrysler-recalls-100k-vehicles-to-fix-takata-air-bags-1.3231219</link>
      <description><![CDATA[Fiat Chrysler is recalling more than 100,000 older trucks and SUVs worldwide to replace potentially dangerous Takata air bag inflators.]]></description>
      <author></author>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231219</guid>
      <pubDate>Fri, 6 Jan 2017 19:37:49 -0500</pubDate>
      <ctv:lastModifiedDate>Fri, 6 Jan 2017 19:37:49 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.164859.1483749406!/httpImage/image._gen/derivatives/landscape_300/image."><![CDATA[In this Aug. 11, 2011 file photo, a Dodge Durango is pictured at a dealership in Warren, Mich. (AP / Paul Sancya)]]></enclosure>
    </item>
    <item>
      <title><![CDATA[Taiwan leader heads to Americas; U.S. stops set to irk China]]></title>
      <link>http://www.ctvnews.ca/world/taiwan-leader-heads-to-americas-u-s-stops-set-to-irk-china-1.3231491</link>
      <description><![CDATA[Taiwan's leader pledged to bolster her self-ruled island's presence on the international stage as she set off Saturday to visit four Central American allies on a trip that includes U.S. transits and looks set to raise China's ire.]]></description>
      <author></author>
      <dc:creator><![CDATA[Gillian Wong]]></dc:creator>
      <creditLine><![CDATA[ The Associated Press]]></creditLine>
      <guid isPermaLink="false">1.3231491</guid>
      <pubDate>Sat, 7 Jan 2017 02:50:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 02:50:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.3231492.1483775340!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[Taiwan's President Tsai Ing-wen delivers a speech before traveling to visit Central American allies including a U.S. transit, Saturday, Jan. 7, 2017, at the Taoyuan International Airport in Taouyuan, Taiwan. (Central News Agency via AP)]]></enclosure>
    </item>
    <item>
      <title><![CDATA[$60 million Lotto Max jackpot claimed by ticket sold in Quebec]]></title>
      <link>http://www.ctvnews.ca/canada/60-million-lotto-max-jackpot-claimed-by-ticket-sold-in-quebec-1.3231530</link>
      <description><![CDATA[The whopping $60 million jackpot in Friday night's Lotto Max draw was claimed by a single ticket sold in Quebec.]]></description>
      <author></author>
      <creditLine><![CDATA[ The Canadian Press]]></creditLine>
      <guid isPermaLink="false">1.3231530</guid>
      <pubDate>Sat, 7 Jan 2017 08:01:00 -0500</pubDate>
      <ctv:lastModifiedDate>Sat, 7 Jan 2017 08:01:00 -0500</ctv:lastModifiedDate>
      <enclosure url="http://www.ctvnews.ca/polopoly_fs/1.1926218.1469270321!/httpImage/image.jpg_gen/derivatives/landscape_300/image.jpg"><![CDATA[ A sign outside a Toronto convenience store advertises a Lotto Max draw. (Chris Kitching) ]]></enclosure>
    </item>
  </channel>
</rss>

redpajama_set_name: RedPajamaGithub


text:
from django.views.generic import TemplateView

class DirectTemplateView(TemplateView):
    extra_context = None

    def get_context_data(self, **kwargs):
        context = super(self.__class__, self).get_context_data(**kwargs)
        if self.extra_context is not None:
            for key, value in self.extra_context.items():
                if callable(value):
                    context[key] = value()
                else:
                    context[key] = value
        return context


text:
SYSTEM	=$(TOPDIR)/$(LINUX)

ZTEXTADDR	 = 0x02080000
PARAMS_PHYS	 = 0x0207c000
INITRD_PHYS	 = 0x02180000
INITRD_VIRT	 = 0x02180000

#
# If you don't define ZRELADDR above,
# then it defaults to ZTEXTADDR
#
ifeq ($(ZRELADDR),)
ZRELADDR	= $(ZTEXTADDR)
endif

export	SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS INITRD_VIRT PARAMS_PHYS

Image: $(obj)/Image

targets: $(obj)/Image

$(obj)/Image: vmlinux FORCE
	$(OBJCOPY) -O binary -R .note -R .comment -S vmlinux $@

#$(obj)/Image:	$(CONFIGURE) $(SYSTEM)
#	$(OBJCOPY) -O binary -R .note -R .comment -g -S $(SYSTEM) $@

bzImage: zImage

zImage:	$(CONFIGURE) compressed/$(LINUX)
	$(OBJCOPY) -O binary -R .note -R .comment -S compressed/$(LINUX) $@

bootpImage: bootp/bootp
	$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@

compressed/$(LINUX): $(TOPDIR)/$(LINUX) dep
	@$(MAKE) -C compressed $(LINUX)

bootp/bootp: zImage initrd
	@$(MAKE) -C bootp bootp

initrd:
	@test "$(INITRD_VIRT)" != "" || (echo This architecture does not support INITRD; exit -1)
	@test "$(INITRD)" != "" || (echo You must specify INITRD; exit -1)

#
# installation
#
install: $(CONFIGURE) Image
	sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"

zinstall: $(CONFIGURE) zImage
	sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"

#
# miscellany
#
mrproper clean:
	$(RM) Image zImage bootpImage
#	@$(MAKE) -C compressed clean
#	@$(MAKE) -C bootp clean

dep:


text:
/* eslint-disable @typescript-eslint/no-extraneous-class */

/*!
 * V4Fire Client Core
 * https://github.com/V4Fire/Client
 *
 * Released under the MIT license
 * https://github.com/V4Fire/Client/blob/master/LICENSE
 */

/**
 * [[include:traits/i-progress/README.md]]
 * @packageDocumentation
 */

import type iBlock from 'super/i-block/i-block';
import type { ModsDecl, ModEvent } from 'super/i-block/i-block';

export default abstract class iProgress {
	/**
	 * Trait modifiers
	 */
	static readonly mods: ModsDecl = {
		progress: [
			'true',
			'false'
		]
	};

	/**
	 * Initializes modifier event listeners for the specified component
	 *
	 * @emits `progressStart()`
	 * @emits `progressEnd()`
	 *
	 * @param component
	 */
	static initModEvents<T extends iBlock>(component: T): void {
		component.unsafe.localEmitter.on('block.mod.*.progress.*', (e: ModEvent) => {
			if (e.value === 'false' || e.type === 'remove') {
				void component.setMod('disabled', false);

				if (e.type !== 'remove' || e.reason === 'removeMod') {
					component.emit('progressEnd');
				}

			} else {
				void component.setMod('disabled', true);
				component.emit('progressStart');
			}
		});
	}
}


text:
<?php

class CIPHPUnitTestRedirectException extends RuntimeException
{
}


text:
package net.velyo.mvvm.validation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@ValidateAttribute
public @interface ValidateRange {
	String errorMessage() default "The field %s value must be between %s and %s";
	double max() default 0d;
	double min() default 0d;
	String maxLookup() default "";
	String minLookup() default "";
}


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

import java.util.ArrayList;
import java.util.List;
import model.pojo.Seat;
import model.pojo.SeatId;
import model.ulti.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author Art
 */
public class SeatDAO {

    public static List<Seat> listSeat() {
        List<Seat> lstseat = null;
        try {
            Session session = HibernateUtil.getSessionFactory().openSession();
            Query query = session.createQuery("from Seat");
            lstseat = query.list();
            session.close();
        } catch (Exception e) {
            throw e;
        }
        return lstseat;
    }

    public static List<Seat> listSeatbyShowtime(String time, int cinema) {
        List<Seat> lstseat = listSeat();
        List<Seat> lstseatinshowtime = new ArrayList<Seat>();
        try {
            for (Seat seat : lstseat) {
                if (cinema == seat.getId().getCinema() && time.equals(seat.getId().getTime())) {
                    lstseatinshowtime.add(seat);
                }
            }
            return lstseatinshowtime;
        } catch (Exception e) {
            throw e;
        }
    }

    public static Seat addorupdateSeat(Seat seat) {
        try {
            Session session = HibernateUtil.getSessionFactory().openSession();
            session.beginTransaction();
            session.saveOrUpdate(seat);
            Seat seatadd = (Seat) session.load(Seat.class, seat.getId());
            session.getTransaction().commit();
            session.close();
            return seatadd;
        } catch (Exception e) {
            throw e;
        }
    }

    public static void deleteSeat(Seat seat) {
        try {
            Session session = HibernateUtil.getSessionFactory().openSession();
            session.beginTransaction();
            Seat deleteseat = (Seat) session.get(Seat.class, seat.getId());
            session.delete(deleteseat);
            session.getTransaction().commit();
            session.close();
        } catch (Exception e) {
            throw e;
        }
    }

    public static Seat getSeatbyId(String time, int cinema, String seatname) {
        SeatId id = new SeatId(time, cinema, seatname);
        try {
            List<Seat> lstseat = listSeat();
            for (Seat seat : lstseat) {
                SeatId id1 = seat.getId();
                if (id.equals(id1)) {
                    return seat;
                }
            }
            return null;
        } catch (Exception e) {
            throw e;
        }
    }

    public static void deleteSeatbyShowtime(String time) {
        try {
            List<Seat> lstseat = listSeat();
            for (Seat seat : lstseat) {
                if (time.equals(seat.getId().getTime())) {
                    deleteSeat(seat);
                }
            }
        } catch (Exception e) {
            throw e;
        }
    }
}


text:
@extends('layout')

@section('title', 'Ryo Miyauchi - Team Graphical Graphics')
@section('description', 'Ryo Miyauchiの動画一覧です。')
@section('keywords', 'ヨーヨー,yo-yo-,Team Graphical Graphics,Ryo Miyauchi')

@section('content')

Ryo Miyauchi

Ryo Miyauchi

      @foreach($movies as $title => $link)

{{{ $title }}}

      @endforeach

@endsection


text:
package logbook.internal.gui;

import java.io.IOException;
import java.util.Map;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import logbook.bean.Chara;
import logbook.bean.Ship;
import logbook.bean.ShipMst;
import logbook.bean.SlotItem;
import logbook.bean.SlotItemCollection;
import logbook.bean.SlotitemMst;
import logbook.bean.SlotitemMstCollection;
import logbook.internal.Items;
import logbook.internal.LoggerHolder;
import logbook.internal.Ships;

/**
 * 艦隊タブポップアップ
 *
 */
public class FleetTabShipPopup extends VBox {

    @FXML
    private Label fuel;
    @FXML
    private Label fuelDesc;
    @FXML
    private Label bull;
    @FXML
    private Label bullDesc;
    @FXML
    private HBox planeBox;
    @FXML
    private Label plane;
    @FXML
    private Label planeDesc;

    private final Chara chara;

    private final Map<Integer, SlotItem> itemMap;

    /**
     * 艦隊タブポップアップのコンストラクタ
     *
     * @param chara キャラクター
     */
    public FleetTabShipPopup(Chara chara) {
        this(chara, SlotItemCollection.get().getSlotitemMap());
    }

    /**
     * 艦隊タブポップアップのコンストラクタ
     *
     * @param chara キャラクター
     * @param itemMap 装備マップ
     */
    public FleetTabShipPopup(Chara chara, Map<Integer, SlotItem> itemMap) {
        this.chara = chara;
        this.itemMap = itemMap;
        try {
            FXMLLoader loader = InternalFXMLLoader.load("logbook/gui/fleet_tab_popup.fxml");
            loader.setRoot(this);
            loader.setController(this);
            loader.load();
        } catch (IOException e) {
            LoggerHolder.get().error("FXMLのロードに失敗しました", e);
        }
    }

    @FXML
    void initialize() {
        if (this.chara.isShip()) {
            Ship ship = this.chara.asShip();
            Ships.shipMst(this.chara).map(ShipMst::getFuelMax).ifPresent(max -> {
                this.fuel.setText(ship.getFuel()*100/max+"%");
                this.fuelDesc.setText("("+ship.getFuel()+"/"+max+")");
            });
            Ships.shipMst(this.chara).map(ShipMst::getBullMax).ifPresent(max -> {
                this.bull.setText(ship.getBull()*100/max+"%");
                this.bullDesc.setText("("+ship.getBull()+"/"+max+")");
            });
            int maxPlane = Ships.shipMst(this.chara)
                    .map(ShipMst::getMaxeq)
                    .map(eq -> eq.stream().filter(e -> e > 0).mapToInt(Integer::intValue).sum())
                    .orElse(0);
            if (maxPlane == 0) {
                this.planeBox.setVisible(false);
                this.planeBox.setManaged(false);
            } else {
                int total = ship.getOnslot().stream().filter(e -> e > 0).mapToInt(Integer::intValue).sum();
                if (total >= maxPlane) {
                    this.plane.setText("なし");
                } else {
                    this.plane.setText((maxPlane-total) + "機");
                    this.planeDesc.setText("(要ボーキ"+(maxPlane-total)*5 + ")");
                }
            }
            for (int i = 0; i < ship.getSlotnum(); i++) {
                this.getChildren().add(new FleetTabShipPopupItem(this.chara, this.itemMap, i));
            }
            if (ship.getSlotEx() != 0) {
                SlotItem item = this.itemMap.get(ship.getSlotEx());
                if (item != null) {
                    this.getChildren().add(new FleetTabShipPopupItem(this.chara, this.itemMap));
                }
            }
            double barrageRate = Ships.rocketBarrageActivationRate(ship);
            if (barrageRate != 0D) {
                Label rateLabel = new Label();
                rateLabel.setText("発動率");
                rateLabel.getStyleClass().add("title");
                this.getChildren().add(rateLabel);
                this.getChildren().add(new FleetTabShipPopupRate(barrageRate, "対空噴進弾幕"));
            }
        } else {
            for (int i = 0; i < this.chara.getSlot().size(); i++) {
                if (this.chara.getSlot().get(i) > 0) {
                    this.getChildren().add(new FleetTabShipPopupItem(this.chara, this.itemMap, i));
                }
            }
        }
    }

    /**
     * 艦隊タブポップアップの装備
     *
     */
    private static class FleetTabShipPopupItem extends HBox {

        private static final int SLOT_EX = 6;

        @FXML
        private Label onslot;

        @FXML
        private Label maxeq;

        @FXML
        private ImageView image;

        @FXML
        private Label name;

        /** キャラクター */
        private Chara chara;

        /** スロット番号 */
        private int slotIndex;

        /** 装備マップ */
        private final Map<Integer, SlotItem> itemMap;

        /**
         * 艦隊タブポップアップのコンストラクタ(補強増設)
         *
         * @param chara キャラクター
         */
        public FleetTabShipPopupItem(Chara chara, Map<Integer, SlotItem> itemMap) {
            this(chara, itemMap, SLOT_EX);
        }

        /**
         * 艦隊タブポップアップのコンストラクタ
         *
         * @param chara キャラクター
         * @param slotIndex スロット番号
         */
        public FleetTabShipPopupItem(Chara chara, Map<Integer, SlotItem> itemMap, int slotIndex) {
            this.chara = chara;
            this.slotIndex = slotIndex;
            this.itemMap = itemMap;
            try {
                FXMLLoader loader = InternalFXMLLoader.load("logbook/gui/fleet_tab_popup_item.fxml");
                loader.setRoot(this);
                loader.setController(this);
                loader.load();
            } catch (IOException e) {
                LoggerHolder.get().error("FXMLのロードに失敗しました", e);
            }
        }

        @FXML
        void initialize() {
            if (this.chara.isShip()) {
                Ship ship = this.chara.asShip();

                Integer itemId = this.slotIndex == SLOT_EX
                        ? ship.getSlotEx() : this.chara.getSlot().get(this.slotIndex);

                SlotItem item = this.itemMap.get(itemId);

                Integer slotEq = Ships.shipMst(this.chara)
                        .map(ShipMst::getMaxeq)
                        .map(eq -> eq.size() > this.slotIndex ? eq.get(this.slotIndex) : 0)
                        .orElse(0);
                if (slotEq != null && slotEq > 0) {
                    Integer onslot = ship.getOnslot().get(this.slotIndex);

                    this.onslot.setText(String.valueOf(onslot));
                    // 搭載機数が最大ではない
                    if (!slotEq.equals(onslot)) {
                        this.onslot.getStyleClass().add("alert");
                        this.maxeq.setText("/" + slotEq);
                    }
                    // 搭載機数が空
                    if (onslot == 0) {
                        this.onslot.getStyleClass().add("empty");
                    }
                }
                if (item != null) {
                    this.image.setImage(Items.itemImage(item));
                    this.name.setText(Items.name(item));

                    // 特定の装備以外は搭載機数をグレー表示にする
                    boolean isOnslot = Items.slotitemMst(item)
                            .map(Items::isAircraft)
                            .orElse(false);
                    if (!isOnslot) {
                        this.onslot.getStyleClass().add("disabled");
                    }
                } else {
                    this.name.setText("-");
                }
            } else {
                SlotitemMst item = SlotitemMstCollection.get()
                        .getSlotitemMap()
                        .get(this.chara.getSlot().get(this.slotIndex));
                this.image.setImage(Items.itemImage(item));
                this.name.setText(item.getName());
            }
        }
    }

    /**
     * 艦隊タブポップアップの発動率
     *
     */
    private static class FleetTabShipPopupRate extends HBox {

        @FXML
        private Label kind;

        @FXML
        private Label percent;

        /** 発動率 */
        private double rate;

        /** 種類 */
        private String name;

        /**
         * 艦隊タブポップアップのコンストラクタ
         *
         * @param rate 発動率
         * @param name 種類
         */
        public FleetTabShipPopupRate(double rate, String name) {
            this.rate = rate;
            this.name = name;
            try {
                FXMLLoader loader = InternalFXMLLoader.load("logbook/gui/fleet_tab_popup_rate.fxml");
                loader.setRoot(this);
                loader.setController(this);
                loader.load();
            } catch (IOException e) {
                LoggerHolder.get().error("FXMLのロードに失敗しました", e);
            }
        }

        @FXML
        void initialize() {
            this.kind.setText(this.name);
            this.percent.setText(String.valueOf(this.rate) + "%");
        }
    }
}


text:
<!DOCTYPE html>

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

    <title>Jolly Imposter - n montano</title>
    <meta name="description" content="Shame incomparable! "For unlawful impersonation, you are hereby banished to      the high seas…" Santa's head hung low in the hall as he avoided the stares o...">

    <link href='https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,900,400italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="/css/main.css">
    <link rel="canonical" href="http://erikradio.github.io/2011/03/Jolly-Imposter">
    <link rel="alternate" type="application/rss+xml" title="n montano" href="http://erikradio.github.io/feed.xml">

        *

Jolly Imposter

<time datetime="2011-03-12T00:00:00-06:00" itemprop="datePublished">Mar 12, 2011</time>

Shame incomparable! "For unlawful impersonation, you are hereby banished to
      the high seas…" Santa's head hung low in the hall as he avoided the stares of those men and
      women he had come to love at the company. How could he look at them now, imposter that he
      was?!    He reached the office of the processing station. The young man at
      the keyboard there had already started filling in his information for the banishment. His eyes
      glanced back and forth uncertainly from computer to Santa. "Hmm. Ok. I don't know how to spell
      your name. Would you mind?" Santa sat down at the computer and typed in:    KAPLAN C. MONTGROGRAFIER    The man resumed his seat and Santa
      waited.   Maybe,   he thought,   I should have given my name as Santus
      Clausulus…

© erik radio 2016


text:
layout: page
title: Joan Berg's 94th Birthday
date: 2016-05-24
author: Samantha Frederick
tags: weekly links, java
status: published
summary: Etiam feugiat mauris neque, non euismod mauris venenatis at. Ut.
banner: images/banner/leisure-04.jpg
booking:
  startDate: 12/23/2017
  endDate: 12/24/2017
  ctyhocn: CHIBBHX
  groupCode: JB9B
published: true
---
Cras vitae eros sit amet purus molestie ullamcorper. Donec consectetur leo a justo maximus, ut pretium urna hendrerit. Morbi id magna justo. Aenean nec tincidunt erat. Praesent pulvinar mattis turpis, a tincidunt velit ultricies sit amet. Cras in nibh sed lectus dictum consequat id sollicitudin sapien. Integer quis libero nec nunc pharetra lacinia in vitae sapien. Pellentesque hendrerit, lorem sed tincidunt egestas, lorem sem posuere lectus, nec dapibus justo augue nec est. Phasellus pretium lacus nibh, non molestie elit porttitor quis. Pellentesque dapibus justo eget risus iaculis, eget auctor sem sodales. Duis porttitor magna nec orci faucibus dictum. Aenean quis ex magna. Vivamus aliquam condimentum mollis.

* Vestibulum et nisi volutpat, imperdiet lorem ut, pretium dui
* Donec et risus bibendum, ultricies turpis sit amet, vestibulum sem.

Mauris commodo elit a mauris facilisis sagittis. Sed interdum cursus mauris, sit amet sodales dolor molestie et. Donec finibus tristique maximus. Nam varius, mi nec ultricies venenatis, nisi augue pulvinar arcu, vitae venenatis sapien dolor vel nisl. Praesent faucibus velit et mi varius semper. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis ultricies euismod magna id molestie. Praesent ut interdum quam.


text:
#If NETSTANDARD Then
#Else
' ReSharper disable UnusedMember.Global
Imports System.Data.Common
Imports System.Data.OleDb
Imports PeanutButter.DatabaseHelpers.StatementBuilders

Namespace Executors

  Public Interface IDataReaderBuilder
    Inherits IDisposable
    Function Build() As DbDataReader
    Function WithSql(sql As String) As IDataReaderBuilder
    Function WithSql(statementBuilder As ISelectStatementBuilder) As IDataReaderBuilder
    Function WithConnectionFactory(connectionResolver as Func(Of IDbConnection)) as IDataReaderBuilder
  End Interface

  Public Class DataReaderBuilder
    Implements IDataReaderBuilder
    Implements IDisposable

    Public Shared Function Create() As DataReaderBuilder
      Return New DataReaderBuilder()
    End Function

    Private _sql As String
    Private _selectBuilder As ISelectStatementBuilder
    Private ReadOnly _readers As New List(Of DbDataReader)
    Private _connectionResolver As Func(Of IDbConnection)

    Public Function Build() As DbDataReader Implements IDataReaderBuilder.Build
      Dim sql = GetSQLString()
      If sql Is Nothing Then
        Throw New ArgumentException(Me.GetType().Name & " :: sql not set and no builder provided")
      End If

      If _connectionResolver Is Nothing Then
        Throw New Exception("No connection resolver defined for DbDataReader.Build")
      End If
      Dim connection = _connectionResolver()

      Dim command = New OleDbCommand()
      command.Connection = TryCast(connection, OleDbConnection)
      command.CommandText = sql
      Return command.ExecuteReader
    End Function

#Disable Warning InconsistentNaming
    Private Function GetSQLString() As String
#Enable Warning InconsistentNaming
      If _sql Is Nothing Then
        If _selectBuilder Is Nothing Then
          Return Nothing
        End If
        Return _selectBuilder.Build()
      End If
      Return _sql
    End Function

    Public Function WithSql(sql As String) As IDataReaderBuilder Implements IDataReaderBuilder.WithSql
      _sql = sql
      _selectBuilder = Nothing
      Return Me
    End Function

    Public Function WithSql(statementBuilder As ISelectStatementBuilder) As IDataReaderBuilder Implements IDataReaderBuilder.WithSql
      _sql = Nothing
      _selectBuilder = statementBuilder
      Return Me
    End Function

    Public Sub Dispose() Implements IDisposable.Dispose
      SyncLock Me
        For Each reader In _readers
          If Not reader.IsClosed Then
            reader.Close()
          End If
        Next
      End SyncLock
    End Sub

    Public Function WithConnectionFactory(connectionResolver As Func(Of IDbConnection)) As IDataReaderBuilder Implements IDataReaderBuilder.WithConnectionFactory
      _connectionResolver = connectionResolver
      Return Me
    End Function
  End Class
End NameSpace
#End If


text:
require 'json'

module Support
  module BlockHelpers
    def parse_blocks(source)
      Parser.new(source).data
    end

    class Parser
      def initialize(source)
        @source = source
      end

      def data
        begin
          parsed_data = JSON.parse(@source)
        rescue JSON::ParserError => e
          raise 'Be sure to pass `json: true` arg to bosh_runner.run'
        end
        parsed_data['Blocks']
      end
    end
  end
end

RSpec.configure do |config|
  config.include(Support::BlockHelpers)
end


text:
<?php

namespace Steelbot\TelegramBotApi\Method;

use Steelbot\TelegramBotApi\Traits\JsonAttributesBuilderTrait;

class AnswerCallbackQuery extends AbstractMethod implements \JsonSerializable
{
    use JsonAttributesBuilderTrait;

    /**
     * Unique identifier for the query to be answered.
     *
     * @var string
     */
    protected $callbackQueryId;

    /**
     * Text of the notification. If not specified, nothing will be shown to the user.
     *
     * @var string|null
     */
    protected $text;

    /**
     * If true, an alert will be shown by the client instead of a notification at the
     * top of the chat screen. Defaults to false.
     *
     * @var boolean|null
     */
    protected $showAlert;

    /**
     * URL that will be opened by the user's client.
     *
     * @var string|null
     */
    protected $url;

    /**
     * The maximum amount of time in seconds that the result of the callback query may be cached client-side.
     *
     * @var int|null
     */
    protected $cacheTime;

    public function __construct(string $callbackQueryId)
    {
        $this->callbackQueryId = $callbackQueryId;
    }

    /**
     * @return string
     */
    public function getCallbackQueryId(): string
    {
        return $this->callbackQueryId;
    }

    /**
     * @param string $callbackQueryId
     */
    public function setCallbackQueryId(string $callbackQueryId): self
    {
        $this->callbackQueryId = $callbackQueryId;

        return $this;
    }

    /**
     * @return null|string
     */
    public function getText()
    {
        return $this->text;
    }

    /**
     * @param null|string $text
     */
    public function setText(string $text = null): self
    {
        $this->text = $text;

        return $this;
    }

    /**
     * @return bool|null
     */
    public function getShowAlert()
    {
        return $this->showAlert;
    }

    /**
     * @param bool|null $showAlert
     */
    public function setShowAlert(bool $showAlert = null): self
    {
        $this->showAlert = $showAlert;

        return $this;
    }

    /**
     * @return null|string
     */
    public function getUrl(): ?string
    {
        return $this->url;
    }

    /**
     * @param null|string $url
     *
     * @return AnswerCallbackQuery
     */
    public function setUrl(?string $url): self
    {
        $this->url = $url;

        return $this;
    }

    /**
     * @return int|null
     */
    public function getCacheTime(): ?int
    {
        return $this->cacheTime;
    }

    /**
     * @param int|null $cacheTime
     *
     * @return AnswerCallbackQuery
     */
    public function setCacheTime(?int $cacheTime): self
    {
        $this->cacheTime = $cacheTime;

        return $this;
    }

    /**
     * Get method name.
     *
     * @return string
     */
    public function getMethodName(): string
    {
        return 'answerCallbackQuery';
    }

    /**
     *
     * @return string
     */
    public function getHttpMethod(): string
    {
        return self::HTTP_POST;
    }

    /**
     * Get parameters for HTTP query.
     *
     * @return mixed
     */
    public function getParams(): array
    {
        $params = [
            'callback_query_id' => $this->callbackQueryId,
        ];

        $params = array_merge($params, $this->buildJsonAttributes([
            'show_alert' => $this->showAlert,
            'cache_time' => $this->cacheTime
        ]));

        return $params;
    }

    /**
     * Build result type from incoming data.
     *
     * @param bool $result
     *
     * @return bool
     */
    public function buildResult($result): bool
    {
        return $result;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $result = $this->buildJsonAttributes([
            'text' => $this->text,
            'url' => $this->url
        ]);

        if ($this->text !== null) {
            $result['text'] = $this->text;
        }

        return $result;
    }
}


text:
package app.vfmesthack.kiss.ui.settings;

import app.vfmesthack.kiss.ui.base.BasePresenter;

/**
 * Created by bubu on 3/18/16.
 */
public class SettingsPresenter extends BasePresenter<SettingsMvpView> {
}


text:
To run the sample follow these steps:

1) Set the **Allowed Callback URLs** in the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings) so it works for both Android and iOS apps:
```text
com.auth0samples://${account.namespace}/ios/com.auth0samples/callback,com.auth0samples://${account.namespace}/android/com.auth0samples/callback
```

2) Set the **Allowed Logout URLs** in the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings) so it works for both Android and iOS apps:
```text
com.auth0samples://${account.namespace}/ios/com.auth0samples/callback,com.auth0samples://${account.namespace}/android/com.auth0samples/callback
```

3) Make sure [Node.JS LTS](https://nodejs.org/en/download/), [Yarn](https://yarnpkg.com/lang/en/docs/install/) and [CocoaPods](http://guides.cocoapods.org/using/getting-started.html) are installed.

4) Execute the following commands in the sample's directory:

```bash
yarn install # Install dependencies
cd ios && pod install # Install the iOS module Pod
yarn run ios # Run on iOS device
yarn run android # Run on Android device
```

Read more about how to run react-native apps in their [official documentation](https://facebook.github.io/react-native/docs/running-on-device.html).


text:
<title>pcre_get_stringnumber specification</title>

pcre_get_stringnumber man page

Return to the PCRE index page.

This page is part of the PCRE HTML documentation. It was generated automatically
from the original man page. If there is any nonsense in it, please consult the
man page, in case the conversion went wrong.

SYNOPSIS

#include <pcre.h>

int pcre_get_stringnumber(const pcre *code,
     const char *name);

int pcre16_get_stringnumber(const pcre16 *code,
     PCRE_SPTR16 name);

int pcre32_get_stringnumber(const pcre32 *code,
     PCRE_SPTR32 name);

DESCRIPTION

This convenience function finds the number of a named substring capturing
parenthesis in a compiled pattern. Its arguments are:

  code    Compiled regular expression
  name    Name whose number is required

The yield of the function is the number of the parenthesis if the name is
found, or PCRE_ERROR_NOSUBSTRING otherwise. When duplicate names are allowed
(PCRE_DUPNAMES is set), it is not defined which of the numbers is returned by
pcre[16|32]_get_stringnumber(). You can obtain the complete list by calling
pcre[16|32]_get_stringtable_entries().

There is a complete description of the PCRE native API in the
pcreapi
page and a description of the POSIX API in the
pcreposix
page.

Return to the PCRE index page.


text:
using Newtonsoft.Json.Linq;
using Onism.Cldr.Tools.JsonParsers.Schemas;

namespace Onism.Cldr.Tools.JsonParsers
{
    /// <summary>
    /// Parses JSONs valid against the "Segments" schema.
    /// </summary>
    internal sealed class SegmentsParser : CldrJsonParser
    {
        public SegmentsParser() : base(CldrJsonSchemas.Segments)
        {
        }

        public override CldrJsonMetadata ExtractMetadata(JObject obj)
        {
            return new CldrJsonMetadata
            {
                CldrVersion = obj.SelectToken("segments.identity.version._cldrVersion").ToString(),
                CldrLocale = new CldrLocale(
                    language: obj.SelectToken("segments.identity.language").ToString(),
                    script: obj.SelectToken("segments.identity.script")?.ToString(),
                    territory: obj.SelectToken("segments.identity.territory")?.ToString(),
                    variant: obj.SelectToken("segments.identity.variant")?.ToString()
                )
            };
        }

        public override void RemoveMetadata(JObject obj)
        {
            obj.SelectToken("segments.identity")?.Parent?.Remove();
        }
    }
}


text:
namespace domain_reliability {

// A simple test callback that remembers whether it's been called.
class TestCallback {
 public:
  TestCallback();
  ~TestCallback();

  // Returns a callback that can be called only once.
  const base::RepeatingClosure& callback() { return callback_; }
  // Returns whether the callback returned by |callback()| has been called.
  bool called() const { return called_; }

 private:
  void OnCalled();

  base::RepeatingClosure callback_;
  bool called_;
};

class MockUploader : public DomainReliabilityUploader {
 public:
  typedef base::OnceCallback<void(const std::string& report_json,
                                  int max_upload_depth,
                                  const GURL& upload_url,
                                  UploadCallback upload_callback)>
      UploadRequestCallback;

  explicit MockUploader(UploadRequestCallback callback);

  ~MockUploader() override;

  virtual bool discard_uploads() const;

  // DomainReliabilityUploader implementation:
  void UploadReport(const std::string& report_json,
                    int max_upload_depth,
                    const GURL& upload_url,
                    UploadCallback callback) override;
  void Shutdown() override;
  void SetDiscardUploads(bool discard_uploads) override;
  int GetDiscardedUploadCount() const override;

 private:
  UploadRequestCallback callback_;
  bool discard_uploads_;
};

class MockTime : public MockableTime {
 public:
  MockTime();

  // N.B.: Tasks (and therefore Timers) scheduled to run in the future will
  // never be run if MockTime is destroyed before the mock time is advanced
  // to their scheduled time.
  ~MockTime() override;

  // MockableTime implementation:
  base::Time Now() const override;
  base::TimeTicks NowTicks() const override;
  std::unique_ptr<MockableTime::Timer> CreateTimer() override;

  // Pretends that |delta| has passed, and runs tasks that would've happened
  // during that interval (with |Now()| returning proper values while they
  // execute!)
  void Advance(base::TimeDelta delta);

  // Queues |task| to be run after |delay|. (Lighter-weight than mocking an
  // entire message pump.)
  void AddTask(base::TimeDelta delay, base::OnceClosure task);

 private:
  // Key used to store tasks in the task map. Includes the time the task should
  // run and a sequence number to disambiguate tasks with the same time.
  struct TaskKey {
    TaskKey(base::TimeTicks time, int sequence_number)
        : time(time),
          sequence_number(sequence_number) {}

    base::TimeTicks time;
    int sequence_number;
  };

  // Comparator for TaskKey; sorts by time, then by sequence number.
  struct TaskKeyCompare {
    bool operator() (const TaskKey& lhs, const TaskKey& rhs) const {
      return lhs.time < rhs.time ||
             (lhs.time == rhs.time &&
              lhs.sequence_number < rhs.sequence_number);
    }
  };

  typedef std::map<TaskKey, base::OnceClosure, TaskKeyCompare> TaskMap;

  void AdvanceToInternal(base::TimeTicks target_ticks);

  int elapsed_sec() { return (now_ticks_ - epoch_ticks_).InSeconds(); }

  base::Time now_;
  base::TimeTicks now_ticks_;
  base::TimeTicks epoch_ticks_;
  int task_sequence_number_;
  TaskMap tasks_;
};

std::unique_ptr<DomainReliabilityConfig> MakeTestConfig();
std::unique_ptr<DomainReliabilityConfig> MakeTestConfigWithOrigin(
    const GURL& origin);
DomainReliabilityScheduler::Params MakeTestSchedulerParams();

}  // namespace domain_reliability

#endif  // COMPONENTS_DOMAIN_RELIABILITY_TEST_UTIL_H_


text:
package org.jbpm.workbench.forms.client.i18n;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.Messages;

/**
 * This uses GWT to provide client side compile time resolving of locales. See:
 * http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web- toolkit-doc-1-5&t=DevGuideInternationalization
 * (for more information).
 *

 * Each method name matches up with a key in Constants.properties (the properties file can still be used on the server). To use
 * this, use GWT.create(Constants.class).
 */
public interface Constants extends Messages {

    Constants INSTANCE = GWT.create(Constants.class);

    String Actions();

    String Refresh();

    String Work();

    String Details();

    String Comments();

    String Assignments();

    String Claim();

    String Save();

    String Release();

    String Complete();

    String Form();

    String Start();

    String Submit();

    String Correlation_Key();

    String UnexpectedError(String errorMessage);

    String TaskCompleted(Long id);

    String TaskStarted(Long id);

    String TaskClaimed(Long id);

    String TaskSaved(Long id);

    String TaskReleased(Long id);

    String UnableToFindFormForTask(Long id);

    String Start_process_instance();

    String Select_Process();

    String Process_DeploymentId();

    String Process_Definition();

    String ProcessStarted(Long processInstanceId);

    String UnableToFindFormForProcess(String processName);

    String TaskFormErrorHeader();

    String PermissionDenied();

    String Exception(String message);
}


text:
package org.onosproject.rest.resources;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.net.DeviceId;
import org.onosproject.net.meter.DefaultMeterRequest;
import org.onosproject.net.meter.Meter;
import org.onosproject.net.meter.MeterId;
import org.onosproject.net.meter.MeterRequest;
import org.onosproject.net.meter.MeterService;
import org.onosproject.rest.AbstractWebResource;
import org.slf4j.Logger;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import java.io.IOException;
import java.io.InputStream;

import static org.onlab.util.Tools.nullIsNotFound;
import static org.slf4j.LoggerFactory.getLogger;

/**
 * Query and program meter rules.
 */
@Path("meters")
public class MetersWebResource extends AbstractWebResource {

    @Context
    private UriInfo uriInfo;

    private final Logger log = getLogger(getClass());
    private static final String DEVICE_INVALID = "Invalid deviceId in meter creation request";
    private static final String METER_NOT_FOUND = "Meter is not found for ";

    private final MeterService meterService = get(MeterService.class);
    private final ObjectNode root = mapper().createObjectNode();
    private final ArrayNode metersNode = root.putArray("meters");

    /**
     * Returns all meters of all devices.
     *
     * @return 200 OK with array of all the meters in the system
     * @onos.rsModel Meters
     */
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getMeters() {
        final Iterable<Meter> meters = meterService.getAllMeters();
        if (meters != null) {
            meters.forEach(meter -> metersNode.add(codec(Meter.class).encode(meter, this)));
        }
        return ok(root).build();
    }

    /**
     * Returns a collection of meters by the device id.
     *
     * @param deviceId device identifier
     * @return 200 OK with array of meters which belongs to specified device
     * @onos.rsModel Meters
     */
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("{deviceId}")
    public Response getMetersByDeviceId(@PathParam("deviceId") String deviceId) {
        DeviceId did = DeviceId.deviceId(deviceId);
        final Iterable<Meter> meters = meterService.getMeters(did);
        if (meters != null) {
            meters.forEach(meter -> metersNode.add(codec(Meter.class).encode(meter, this)));
        }
        return ok(root).build();
    }

    /**
     * Returns a meter by the meter id.
     *
     * @param deviceId device identifier
     * @param meterId meter identifier
     * @return 200 OK with a meter, return 404 if no entry has been found
     * @onos.rsModel Meter
     */
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("{deviceId}/{meterId}")
    public Response getMeterByDeviceIdAndMeterId(@PathParam("deviceId") String deviceId,
                                                 @PathParam("meterId") String meterId) {
        DeviceId did = DeviceId.deviceId(deviceId);
        MeterId mid = MeterId.meterId(Long.valueOf(meterId));

        final Meter meter = nullIsNotFound(meterService.getMeter(did, mid),
                METER_NOT_FOUND + mid.id());

        metersNode.add(codec(Meter.class).encode(meter, this));
        return ok(root).build();
    }

    /**
     * Creates new meter rule. Creates and installs a new meter rule for the
     * specified device.
     *
     * @param deviceId device identifier
     * @param stream   meter rule JSON
     * @return status of the request - CREATED if the JSON is correct,
     * BAD_REQUEST if the JSON is invalid
     * @onos.rsModel MeterPost
     */
    @POST
    @Path("{deviceId}")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Response createMeter(@PathParam("deviceId") String deviceId,
                                InputStream stream) {
        try {
            ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
            JsonNode specifiedDeviceId = jsonTree.get("deviceId");

            if (specifiedDeviceId != null &&
                    !specifiedDeviceId.asText().equals(deviceId)) {
                throw new IllegalArgumentException(DEVICE_INVALID);
            }
            jsonTree.put("deviceId", deviceId);
            final MeterRequest meterRequest = codec(MeterRequest.class).decode(jsonTree, this);
            final Meter meter = meterService.submit(meterRequest);

            UriBuilder locationBuilder = uriInfo.getBaseUriBuilder()
                    .path("meters")
                    .path(deviceId)
                    .path(Long.toString(meter.id().id()));
            return Response
                    .created(locationBuilder.build())
                    .build();
        } catch (IOException ex) {
            throw new IllegalArgumentException(ex);
        }
    }

    /**
     * Removes the specified meter.
     *
     * @param deviceId device identifier
     * @param meterId  meter identifier
     * @return 204 NO CONTENT
     */
    @DELETE
    @Path("{deviceId}/{meterId}")
    public Response deleteMeterByDeviceIdAndMeterId(@PathParam("deviceId") String deviceId,
                                                @PathParam("meterId") String meterId) {
        DeviceId did = DeviceId.deviceId(deviceId);
        MeterId mid = MeterId.meterId(Long.valueOf(meterId));
        final Meter tmpMeter = meterService.getMeter(did, mid);
        if (tmpMeter != null) {
            final MeterRequest meterRequest = meterToMeterRequest(tmpMeter, "REMOVE");
            meterService.withdraw(meterRequest, tmpMeter.id());
        }
        return Response.noContent().build();
    }

    /**
     * Converts a meter instance to meterRequest instance with a certain operation.
     *
     * @param meter     meter instance
     * @param operation operation
     * @return converted meterRequest instance
     */
    private MeterRequest meterToMeterRequest(Meter meter, String operation) {
        MeterRequest.Builder builder;
        MeterRequest meterRequest;

        if (meter == null) {
            return null;
        }

        if (meter.isBurst()) {
            builder = DefaultMeterRequest.builder()
                    .fromApp(meter.appId())
                    .forDevice(meter.deviceId())
                    .withUnit(meter.unit())
                    .withBands(meter.bands())
                    .burst();
        } else {
            builder = DefaultMeterRequest.builder()
                    .fromApp(meter.appId())
                    .forDevice(meter.deviceId())
                    .withUnit(meter.unit())
                    .withBands(meter.bands());
        }

        switch (operation) {
            case "ADD":
                meterRequest = builder.add();
                break;
            case "REMOVE":
                meterRequest = builder.remove();
                break;
            default:
                log.warn("Invalid operation {}.", operation);
                return null;
        }

        return meterRequest;
    }
}


text:
package com.overnightApps.myapplication.app.ui.homeFragments;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.overnightApps.myapplication.app.R;
import com.overnightApps.myapplication.app.dao.UserDao;
import com.overnightApps.myapplication.app.service.UserLogIn;
import com.overnightApps.myapplication.app.service.UserSession;
import com.overnightApps.myapplication.app.ui.homeFragments.homeActivityInteractionInterfaces.OnSignUpActivityListener;
import com.overnightApps.myapplication.app.ui.homeFragments.homeActivityInteractionInterfaces.OnUserLogInListener;
import com.overnightApps.myapplication.app.util.AUtil;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by andre on 3/26/14.
 */
public class LogInDialogFragment extends DialogFragment {//TODO - replace this with a real fragment
    @InjectView(R.id.et_email)
    EditText et_email;
    @InjectView(R.id.et_password)
    EditText et_password;
    @InjectView(R.id.tv_startSignUp)
    TextView tv_startSignUp;
    private OnUserLogInListener onUserLogInListener;
    private OnSignUpActivityListener onSignUpActivityListener;

    public LogInDialogFragment() {
    }

    public static LogInDialogFragment newInstance(UserSession userSession) {
        Bundle arguments = new Bundle();
        LogInDialogFragment logInDialogFragment = new LogInDialogFragment();
        logInDialogFragment.setArguments(arguments);
        return logInDialogFragment;
    }

    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        LayoutInflater inflater = getActivity().getLayoutInflater();
        View view = inflater.inflate(R.layout.log_in_dialog, null);
        ButterKnife.inject(this, view);
        builder.setView(view)
                .setPositiveButton(getString(R.string.logInButtonText), new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        String email = AUtil.extractString(et_email);
                        String password = AUtil.extractString(et_password);
                             UserLogIn userLogIn = new UserLogIn(email,password,UserDao.instance());
                             UserLogIn.StatusCode statusCode = userLogIn.logUserIn();
                             if (statusCode == UserLogIn.StatusCode.SUCCESS) {
                                dismiss();
                                onUserLogInListener.logCurrentUserIn();
                            }else {
                                 Toast.makeText(getActivity(), statusCode.getMessage(),Toast.LENGTH_LONG)
                                         .show();
                             }
                    }
                })
                .setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dismiss();
                    }
                });
        return builder.create();
    }

    @OnClick(R.id.tv_startSignUp)
    public void startSignUp(TextView textView) {
        onSignUpActivityListener.startSignUpProcess();
        dismiss();
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        onUserLogInListener = (OnUserLogInListener) activity;
        onSignUpActivityListener = (OnSignUpActivityListener) activity;
    }

    @Override
    public void onDetach() {
        super.onDetach();
        onUserLogInListener = null;
        onSignUpActivityListener = null;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }
}


text:
@interface AppDelegate (NicePayment) <UIAlertViewDelegate>

-(void) callByPaymentAppWith:(NSURL*)url;
@end


text:
<?php namespace SleepingOwl\Seeder\Console;

use DB;
use Illuminate\Console\Command;
use SleepingOwl\Seeder\Lock\Controller;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;

class LockCommand extends Command
{

	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $name = 'seeder:lock';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Lock the database table seed';

	/**
	 * Execute the console command.
	 *
	 * @return void
	 */
	public function fire()
	{
		$table = null;
		$all = $this->option('all');
		if ($all)
		{
			$tables = DB::getDoctrineSchemaManager()->listTableNames();
			$table = implode(',', $tables);
		} else
		{
			$table = $this->argument('table');
		}
		if (is_null($table))
		{
			return $this->error('Provide table name or --all parameter');
		}
		$tables = explode(',', $table);
		foreach ($tables as $table)
		{
			Controller::lock(trim($table));
			$this->getOutput()->writeln("Table <info>$table</info> was locked");
		}
	}

	/**
	 * Get the console command arguments.
	 * @return array
	 */
	protected function getArguments()
	{
		return [
			[
				'table',
				InputArgument::OPTIONAL,
				'Database table name.'
			],
		];
	}

	/**
	 * Get the console command arguments.
	 * @return array
	 */
	protected function getOptions()
	{
		return [
			[
				'all',
				null,
				InputOption::VALUE_NONE,
				'Lock all tables.'
			],
		];
	}

}


text:
/*eslint strict: [2, "function"]*/ // IIFE form
(function () {
    "use strict";

    /*global console, setTimeout, clearTimeout*/

    var safeFunction = Function,
        context = (function () {
            /*global global*/ // NodeJS global
            if (typeof global === "object") {
                return global;
            }
            /*global window*/ // Browser global
            if (typeof window !== "undefined") {
                return window;
            }
            return safeFunction("return this;")();
        }());

    /*
     * Simple Timer implementation
     */

    function DefaultTimer () {
        this._start = new Date();
        this.elapsed = function () {
            var now = new Date();
            return now - this._start;
        };
    }

    /*
     * Simple BDD implementation
     */

    // Enumeration helper
    function _objectForEach (dictionary, callback, thisArg) {
        for (var property in dictionary) {
            if (Object.prototype.hasOwnProperty.call(dictionary, property)) {
                callback.call(thisArg, dictionary[property], property, dictionary);
            }
        }
    }

    // Class helper
    function _toClass (Constructor, BaseClass, members) {
        function _addMember (value, name) {
            /*jshint validthis:true*/ // Used below and bound to Constructor
            this[name] = value; //eslint-disable-line no-invalid-this
        }
        Constructor.prototype = new BaseClass();
        _objectForEach(members, function (memberValue, memberName) {
            if (memberName === "statics") {
                _objectForEach(memberValue, _addMember, Constructor);
            } else {
                Constructor.prototype[memberName] = memberValue;
            }
        }, Constructor);
        return Constructor;
    }

    //region BDD item classes

    /**
     * Abstract item
     *
     * @param {String} label Label describing the item
     * @param {BDDAbstract} [parent] Parent item
     * @constructor
     */
    var BDDAbstract = _toClass(function BDDAbstract (label, parent) {
        if (undefined !== parent) {
            this.parent = parent;
            if (!Object.prototype.hasOwnProperty.call(parent, "children")) {
                // Make the array unique to the instance
                parent.children = [];
            }
            parent.children.push(this);
        }
        this.label = label;
    }, Object, {

        /**
         * Parent item
         *
         * @type {BDDAbstract}
         */
        parent: null,

        /**
         * Children of the description
         *
         * @type {BDDDescribe[]}
         */
        children: [],

        /** Label of the item */
        label: ""

    });

    /**
     * Test description
     *
     * @param {String} label Label describing the item
     * @param {BDDDescribe} [parent] Parent item
     * @constructor
     * @extends BDDAbstract
     */
    var BDDDescribe = _toClass(function BDDDescribe (label, parent) {
        BDDAbstract.call(this, label, parent);
    }, BDDAbstract, {

        /**
         * List of before callbacks
         *
         * @type {Function[]}
         */
        before: [],

        /**
         * List of beforeEach callbacks
         *
         * @type {Function[]}
         */
        beforeEach: [],

        /**
         * List of afterEach callbacks
         *
         * @type {Function[]}
         */
        afterEach: [],

        /**
         * List of after callbacks
         *
         * @type {Function[]}
         */
        after: [],

        statics: {

            /**
             * Root test folder
             *
             * @type {BDDDescribe}
             * @static
             */
            root: null,

            /**
             * Current test folder
             *
             * @type {BDDDescribe}
             * @static
             */
            current: null,

            /**
             * Adds the callback to the list which member name is provided
             *
             * @param {String} listName List member name
             * @param {Function} callback Callback
             */
            addCallback: function (listName, callback) {
                var current = BDDDescribe.current;
                if (!Object.prototype.hasOwnProperty.call(current, listName)) {
                    // Make the array unique
                    current[listName] = [];
                }
                current[listName].push(callback);
            }

        }
    });

    /**
     * Test case
     *
     * @param {String} label Label describing the item
     * @param {Function} callback Implementation of the test
     * @param {BDDDescribe} [parent] Parent item
     * @constructor
     * @extends BDDAbstract
     */
    var BDDIt = _toClass(function BDDIt (label, callback, parent) {
        BDDAbstract.call(this, label, parent);
        this.callback = callback;
    }, BDDAbstract, {

        /**
         * Test case callback (null if pending)
         *
         * @type {Function}
         */
        callback: null,

        /** Allows to make a success from a failure (and test error cases) */
        failureExpected: false

    });

    //endregion BDD item classes

    //region BDD public interface

    function _output (text, optionalLevel) {
        var level = optionalLevel || "log";
        // Console can be mocked up to check outputs
        if (console.expects) {
            console.expects(level, text, true);
        }
        console[level](text);
    }

    _objectForEach({

        describe: function (label, callback) {
            if (BDDDescribe.root === null) {
                BDDDescribe.current = BDDDescribe.root = new BDDDescribe();
            }
            BDDDescribe.current = new BDDDescribe(label, BDDDescribe.current);
            callback();
            BDDDescribe.current = BDDDescribe.current.parent;
        },

        before: function (callback) {
            BDDDescribe.addCallback("before", callback);
        },

        beforeEach: function (callback) {
            BDDDescribe.addCallback("beforeEach", callback);
        },

        it: function (label, callback, failureExpected) {
            var it = new BDDIt(label, callback, BDDDescribe.current);
            if (failureExpected) {
                it.failureExpected = true;
            }
        },

        afterEach: function (callback) {
            BDDDescribe.addCallback("afterEach", callback);
        },

        after: function (callback) {
            BDDDescribe.addCallback("after", callback);
        },

        /**
         * Fails by throwing an exception if the value is falsy
         *
         * @param {Boolean} condition If the condition is falsy, the assertion fails
         * @param {String} [message] Assertion message
         */
        assert: function (condition, message) {
            if (!condition) {
                throw new Error(message || "ASSERTION failed");
            }
        },

        /*global exit*/
        /**
         * Simulates a way to terminate the process with a result code
         *
         * @param {Number} code Exit code
         */
        exit: function (code) {
            if (code === 0) {
                _output("exit(0)", "log");
            } else {
                _output("exit(" + code + ")", "error");
            }
        }

    }, function (memberValue, memberName) {
        if (!context[memberName]) {
            context[memberName] = memberValue;
        }
    });

    //endregion  BDD public interface

    //region default callback (based on console.log)

    function _getItLineStart (data) {
        if (data.pending) {
            return "-- ";
        }
        if (data.result) {
            return "OK ";
        }
        return "KO ";
    }

    var _handlers = {

        /**
         * describe callback
         *
         * @param {Object} data
         * - {Number} depth item depth
         * - {String} label item label
         */
        describe: function (data) {
            _output(new Array(data.depth + 1).join("\t") + data.label);
        },

        /**
         * it callback
         *
         * @param {Object} data
         * - {Number} depth item depth
         * - {String} label item label
         * - {Boolean} pending test with no implementation
         * - {Boolean} result test result
         * - {Object} exception exception details
         */
        it: function (data) {
            var line = new Array(data.depth + 1).join("\t") + _getItLineStart(data);
            line += data.label;
            _output(line);
            if (data.result === false && data.exception) {
                _output("Exception: " + data.exception.message);
                for (var key in data.exception) {
                    if (key !== "message" && Object.prototype.hasOwnProperty.call(data.exception, key)) {
                        _output("Exception." + key + ": " + data.exception[key]);
                    }
                }
            }
        },

        /**
         * results callback
         *
         * @param {Object} data
         * - {Number} count number of tests
         * - {Number} success succeeded count
         * - {Number} fail failed count
         * - {Number} pending tests with no implementation
         */
        results: function (data) {
            _output("--- Results: ");
            for (var key in data) {
                if (Object.prototype.hasOwnProperty.call(data, key)) {
                    _output(key + "        : ".substring(key.length) + data[key]);
                }
            }
            if (data.fail) {
                _output("KO", "error");
                exit(data.fail);
            } else {
                _output("OK");
                exit(0);
            }
        }
    };

    function _defaultCallback (type, data) {
        /*jshint validthis:true*/
        _handlers[type].call(this, data); //eslint-disable-line no-invalid-this
    }

    //endregion

    //region Running the tests

    var Runner = _toClass(function Runner (callback, timeoutDelay, Timer) {
        this._state = Runner.STATE_DESCRIBE_BEFORE;
        this._callback = callback || _defaultCallback;
        this._timeoutDelay = timeoutDelay || Runner.DEFAULT_TIMEOUT_DELAY;
        this._Timer = Timer || DefaultTimer;
        this._describes = [];
        this._describe = BDDDescribe.root;
        this._nextChildIndexes = [];
        this._beforeEach = [];
        this._afterEach = [];
        this._timer = new this._Timer();
        this._statistics = {
            count: 0,
            success: 0,
            fail: 0,
            pending: 0
        };
        // bind next to this (and hide the prototype version)
        this.next = this.next.bind(this);
    }, Object, {

        /** Current state */
        _state: 0,

        /**
         * Callback used to notify the caller of the progress
         *
         * @type {Function}
         */
        _callback: null,

        /** Asynchronous test limit in time */
        _timeoutDelay: 0,

        /**
         * Stack of describe items being processed
         *
         * @type {BDDDescribe[]}
         */
        _describes: [],

        /**
         * Current describe
         *
         * @type {BDDDescribe}
         */
        _describe: null,

        /**
         * Stack of nextChildIndex (pointing to each describe child)
         *
         * @type {Number[]}
         */
        _nextChildIndexes: [],

        /** Next child index of current describe */
        _nextChildIndex: 0,

        /**
         * List of callbacks to process (before, beforeEach, ...)
         *
         * @type {Function[]}
         */
        _pendingCallbacks: [],

        /**
         * Type of the callbacks to process ("before", "beforeEach", ...)
         *
         * @type {String}
         */
        _pendingCallbacksType: "",

        /**
         * Stacked beforeEach callbacks
         *
         * @type {Function[]}
         */
        _beforeEach: [],

        /**
         * Stacked afterEach callbacks
         *
         * @type {Function[]}
         */
        _afterEach: [],

        /**
         * Timer started when run is called
         *
         * @type {Timer}
         */
        _timer: null,

        /** Test statistics */
        _statistics: {},

        /**
         * Executes the callback and monitor its result
         *
         * @param {Function} callback Function to execute
         * @param {Function} [callbackCompleted=undefined] callbackCompleted Function called when the callback completed
         * (will be bound to the Runner), expected parameters are
         * - {Object} context
         * - {Timer} timer
         * - {Object} [error=undefined] error When not specified, it means the callback succeeded, otherwise this
         * parameter is the error object transmitted by the test execution
         * @param {Object} callbackContext context parameter of the callbackCompleted function
         * @return {Boolean} true if asynchronous
         */
        _monitorCallback: function (callback, callbackCompleted, callbackContext) {
            var monitorContext = {
                    runner: this,
                    doneExpected: callback.length > 0,
                    callbackCompleted: callbackCompleted,
                    callbackContext: callbackContext,
                    error: null,
                    timer: new this._Timer(),
                    numberOfCall: 0,
                    timeoutId: null,
                    complete: this._complete
                },
                done = this._done.bind(monitorContext);
            try {
                return this._secureCall(callback, monitorContext, done);
            } catch (e) {
                monitorContext.error = e;
                monitorContext.doneExpected = false; // Assume synchronous function
                this._processCallResult(null, monitorContext, done);
            }
            return false;
        },

        // done function, is bound to a monitorContext
        _done: function (error) {
            var finalError;
            ++this.numberOfCall;
            if (this.numberOfCall > 1) {
                // Whatever the situation, done MUST be called only once, so overwrite any error here
                finalError = {
                    message: "Done function called " + this.numberOfCall + " times"
                };
            } else {
                finalError = error;
            }
            if (this.numberOfCall > 1 || this.timeoutId) {
                // More than one call (i.e. error) or asynchronous
                this.complete(finalError);
            } else {
                // Can still be processed as synchronous, keep track of error parameter
                this.error = finalError;
            }
            if (this.numberOfCall === 1 && this.timeoutId) {
                // First call in asynchronous mode, prevent timeout execution (no more necessary)...
                clearTimeout(this.timeoutId);
                // ...then, trigger the next step execution (required to continue the test)
                setTimeout(this.runner.next, 0); // next is bound
            }
        },

        // complete wrapper, is bound to a monitorContext
        _complete: function (error) {
            this.callbackCompleted.call(this.runner, this.callbackContext, this.timer, error);
        },

        // provide done parameter only if requested
        _secureCall: function (callback, monitorContext, done) {
            var callbackArgument;
            // If someone wants to mess with arguments, this will prevent it
            if (monitorContext.doneExpected) {
                callbackArgument = done;
            }
            return this._processCallResult(callback(callbackArgument), monitorContext, done);
        },

        // handle the result of the callback
        _processCallResult: function (result, monitorContext, done) {
            var isPromise = Runner.isPromise(result);
            // Synchronous call?
            if (!isPromise && !monitorContext.doneExpected) {
                monitorContext.complete(monitorContext.error);
                done();
                return false;
            }
            // Was done already called?
            if (monitorContext.numberOfCall === 1) {
                monitorContext.complete(monitorContext.error);
                return false;
            } else if (monitorContext.numberOfCall > 0) {
                return false;
            }
            // From there, the callback is asynchronous!
            monitorContext.timeoutId = setTimeout(function () {
                done({
                    message: "Timeout exceeded"
                });
            }, this._timeoutDelay);
            if (isPromise) {
                this._attachToPromise(result, done);
            }
            return true;
        },

        /**
         * @param {Promise} promise Promise to attach to
         * @param {Function} done Callback to trigger when the promise is completed
         */
        _attachToPromise: function (promise, done) {
            var _rejectionReason;
            function fulfilled () {
                done(); // Must have no parameter
            }
            function rejected (optionalReason) {
                _rejectionReason = optionalReason || {
                    message: "Promise rejected with no reason"
                };
                done(_rejectionReason);
            }
            function caught (reason) {
                if (reason !== _rejectionReason) {
                    done(reason);
                }
            }
            promise.then(fulfilled, rejected);
            var catchMethod = promise["catch"];
            if (catchMethod) {
                catchMethod.call(promise, caught);
            }
        },

        /**
         * Call the it test callback
         *
         * @param {BDDIt} it Test case
         * @return {Boolean} true if asynchronous
         */
        _processItCallback: function (it) {
            return this._monitorCallback(it.callback, this._itCallbackCompleted, it);
        },

        // IT Callback completion function (see _monitorCallback)
        _itCallbackCompleted: function (it, timer, optionalError) {
            var error;
            if (it.failureExpected) {
                if (!optionalError) {
                    error = {
                        message: "Failure was expected"
                    };
                }
            } else {
                error = optionalError;
            }
            if (error) {
                this._fail(it.label, timer, error);
            } else {
                this._success(it.label, timer);
            }
        },

        _gentItContext: function () {
            var depth = this._describes.length,
                idx,
                result = ["<root>"];
            for (idx = 1; idx < depth; ++idx) { // Skip root
                result.push(this._describes[idx].label);
            }
            return result;
        },

        // Log a failure
        _fail: function (label, timer, e) {
            ++this._statistics.fail;
            this._callback("it", {
                context: this._gentItContext(),
                depth: this._describes.length,
                label: label,
                result: false,
                timeSpent: timer.elapsed(),
                exception: e
            });
        },

        // Log a success
        _success: function (label, timer) {
            ++this._statistics.success;
            this._callback("it", {
                context: this._gentItContext(),
                depth: this._describes.length,
                label: label,
                result: true,
                timeSpent: timer.elapsed()
            });
        },

        /**
         * Call (before|after)(Each)? callback
         *
         * @param {Function} callback Function to call
         * @return {Boolean} true if asynchronous
         */
        _processCallback: function (callback) {
            return this._monitorCallback(callback, this._callbackCompleted);
        },

        // Callback completion function (see _monitorCallback)
        _callbackCompleted: function (ignored, timer, e) {
            if (e) {
                this._fail("UNEXPECTED error during " + this._pendingCallbacksType + "?", timer, e);
                // TODO right now, an error is not acceptable at this point, signal and ends everything
                this._nextChildIndex = this._describe.children.length;
                this._describes = [];
            }
        },

        // Next step in test
        next: function () {
            // Because of cscript compatibility
            var loop = true;
            while (loop) {
                // Check if any pending callback
                while (this._pendingCallbacks.length) {
                    if (this._processCallback(this._pendingCallbacks.shift())) {
                        // Asynchronous, have to wait for callback
                        return;
                    }
                }
                // _state contains the member to execute
                loop = this[this._state]();
            }
        },

        // STATE_DESCRIBE_BEFORE
        _onDescribeBefore: function () {
            var describe = this._describe;
            this._state = Runner.STATE_DESCRIBE_CHILDREN;
            this._pendingCallbacks = [].concat(describe.before);
            this._pendingCallbacksType = "before";
            return true;
        },

        // STATE_DESCRIBE_CHILDREN
        _onDescribeChildren: function () {
            var children = this._describe.children;
            if (this._nextChildIndex < children.length) {
                var item = children[this._nextChildIndex++];
                if (item instanceof BDDDescribe) {
                    this._stackDescribe(item);

                } else if (item instanceof BDDIt) {
                    this._state = Runner.STATE_DESCRIBE_CHILDIT_BEFORE;
                }
            } else {
                this._state = Runner.STATE_DESCRIBE_AFTER;
            }
            return true;
        },

        // STATE_DESCRIBE_CHILDREN: describe found
        _stackDescribe: function (describe) {
            this._state = Runner.STATE_DESCRIBE_BEFORE;
            this._callback("describe", {
                depth: this._describes.length,
                label: describe.label
            });
            this._describes.push(this._describe);
            this._nextChildIndexes.push(this._nextChildIndex);
            // Concatenate lists of beforeEach and afterEach
            this._beforeEach = this._beforeEach.concat(describe.beforeEach);
            this._afterEach = describe.afterEach.concat(this._afterEach);
            // Becomes the new describe
            this._describe = describe;
            this._nextChildIndex = 0;
        },

        // STATE_DESCRIBE_CHILDIT_BEFORE
        _onItBefore: function () {
            this._state = Runner.STATE_DESCRIBE_CHILDIT_EXECUTE;
            this._pendingCallbacks = [].concat(this._beforeEach);
            this._pendingCallbacksType = "beforeEach";
            return true;
        },

        // STATE_DESCRIBE_CHILDIT_EXECUTE
        _onItExecute: function () {
            this._state = Runner.STATE_DESCRIBE_CHILDIT_AFTER;
            var it = this._describe.children[this._nextChildIndex - 1];
            ++this._statistics.count;
            if (it.callback) {
                return !this._processItCallback(it);
            }
            ++this._statistics.pending;
            this._callback("it", {
                context: this._gentItContext(),
                depth: this._describes.length,
                label: it.label,
                pending: true
            });
            return true;
        },

        // STATE_DESCRIBE_CHILDIT_AFTER
        _onItAfter: function () {
            this._state = Runner.STATE_DESCRIBE_CHILDREN;
            this._pendingCallbacks = [].concat(this._afterEach);
            this._pendingCallbacksType = "afterEach";
            return true;
        },

        // STATE_DESCRIBE_AFTER
        _onDescribeAfter: function () {
            var describe = this._describe;
            this._state = Runner.STATE_DESCRIBE_DONE;
            this._pendingCallbacks = [].concat(describe.after);
            this._pendingCallbacksType = "after";
            return true;
        },

        // STATE_DESCRIBE_DONE
        _onDescribeDone: function () {
            if (this._describes.length > 0) {
                // What's in the describe stack
                this._unstackDescribe();
                return true;
            }
            this._state = Runner.STATE_FINISHED;
            this._statistics.timeSpent = this._timer.elapsed();
            this._callback("results", this._statistics);
            return false;
        },

        _unstackDescribe: function () {
            this._state = Runner.STATE_DESCRIBE_CHILDREN;
            var currentDescribe = this._describe;
            // Remove lists of beforeEach and afterEach
            this._beforeEach = this._beforeEach.slice(0, this._beforeEach.length - currentDescribe.beforeEach.length);
            this._afterEach = this._afterEach.slice(currentDescribe.afterEach.length);
            // No more children, go up
            this._describe = this._describes.pop();
            this._nextChildIndex = this._nextChildIndexes.pop();
        },

        // STATE_FINISHED
        _onFinished: function () {
            return false;
        },

        statics: {
            STATE_DESCRIBE_BEFORE: "_onDescribeBefore",
            STATE_DESCRIBE_CHILDREN: "_onDescribeChildren",
            STATE_DESCRIBE_CHILDIT_BEFORE: "_onItBefore",
            STATE_DESCRIBE_CHILDIT_EXECUTE: "_onItExecute",
            STATE_DESCRIBE_CHILDIT_AFTER: "_onItAfter",
            STATE_DESCRIBE_AFTER: "_onDescribeAfter",
            STATE_DESCRIBE_DONE: "_onDescribeDone",
            STATE_FINISHED: "_onFinished",

            DEFAULT_TIMEOUT_DELAY: 2000, // 2s

            // Test if the provided parameter looks like a promise
            isPromise: function (obj) {
                return obj !== null && typeof obj === "object" && typeof obj.then === "function";
            }
        }
    });

    /**
     * Main entry point to run all tests
     *
     * @param {Function} callback see callback examples above
     * @param {Number} timeoutDelay asynchronous test limit in time (ms)
     * @param {Class} Timer timer to measure elapsed time
     */
    context.run = function (callback, timeoutDelay, Timer) {
        var runner = new Runner(callback, timeoutDelay, Timer);
        runner.next();
    };

    //endregion

}());


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>io.github.binaryfoo</groupId>
  <artifactId>emv-bertlv</artifactId>
  <version>0.1.9-SNAPSHOT</version>
  <name>EMV BER-TLV Decoder</name>
  <description>
    Some decoders for the data used in EMV credit card transactions.
  </description>
  <url>https://github.com/binaryfoo/emv-bertlv</url>

  <licenses>
    <license>
      <name>The MIT License (MIT)</name>
      <url>http://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:binaryfoo/emv-bertlv.git</connection>
    <developerConnection>scm:git:git@github.com:binaryfoo/emv-bertlv.git
    </developerConnection>
    <url>git@github.com:binaryfoo/emv-bertlv.git</url>
    <tag>HEAD</tag>
  </scm>

  <developers>
    <developer>
      <name>Will Currie</name>
      <email>wscurrie@gmail.com</email>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <kotlin.version>1.3.31</kotlin.version>
  </properties>

  <repositories>
    <repository>
      <id>sonatype.oss.snapshots</id>
      <name>Sonatype OSS Snapshot Repository</name>
      <url>http://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>sonatype.oss.snapshots</id>
      <name>Sonatype OSS Snapshot Repository</name>
      <url>http://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <target>1.8</target>
          <source>1.8</source>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <version>${kotlin.version}</version>

        <executions>
          <execution>
            <id>compile</id>
            <phase>process-sources</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>

          <execution>
            <id>test-compile</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.3</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>io.github.binaryfoo.cmdline.Main</mainClass>
                </transformer>
              </transformers>
              <finalName>bertlv-cmdline-${project.version}</finalName>
              <shadedArtifactAttached>true</shadedArtifactAttached>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.3</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib</artifactId>
      <version>${kotlin.version}</version>
    </dependency>
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>1.16</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easymock</groupId>
      <artifactId>easymockclassextension</artifactId>
      <version>2.5.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.3.6</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.xlson.groovycsv</groupId>
      <artifactId>groovycsv</artifactId>
      <version>1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
      <version>1.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
</project>


text:
using System;

namespace Wrox.ProCSharp.Generics
{
    public class RectangleCollection : IIndex<Rectangle>
    {
        private Rectangle[] data = new Rectangle[3]
        {
            new Rectangle { Height=2, Width=5 },
            new Rectangle { Height=3, Width=7},
            new Rectangle { Height=4.5, Width=2.9}
        };

        private static RectangleCollection coll;
        public static RectangleCollection GetRectangles() => coll ?? (coll = new RectangleCollection());

        public Rectangle this[int index]
        {
            get
            {
                if (index < 0 || index > data.Length)
                    throw new ArgumentOutOfRangeException("index");
                return data[index];
            }
        }
        public int Count => data.Length;
    }
}