text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="description" content="Technical blog about software engineering and topics like Elixir, Elm. .NET, C#, Functional Programming and Machine Learning">
    <link rel="stylesheet" href="/css/material.min.css">

    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

    <link href="/css/main.css" rel="stylesheet">
    <title>Wolfgang Loder - Technical Blog</title>

            Wolfgang Loder

                About Me

        Back to Article List

Publishing a book on Leanpub

                        <info datetime=" 2016-09-01
                        ">
                        Sep 01, 2016
                        </info>

                            <info>

 (updated: Jan 05, 2017)

                            </info>

In August 2016 I published my first book on Leanpub. Overall, it was a very good experience with no major problems.

Leanpub is a self-publishing platform that encourages lean publishing: Even if the book is not finished it should be made available to potential readers and buyers. It is like a kickstarter book project where readers support the writing of a book, not knowing if they will ever get a finished product.

It is a good idea to publish the book in its infant state, but there are pitfalls as well. I published the first chapters of the book and then it stayed there for a long time, because I was contracted for an unexpected project and could not write. Fortunately the readers I had at that time did not demand their money back. It was a bit embarassing for me - all the time estimations I had were completely blown away.

Estimations were also wrong, because unexpected issues can occur:

Code highlighting was not always working. I have to stress that this issue also had to do with misunderstandings how the highlighting engine works. In any case, whenever I went to Leanpub's Google group my issues were answered within the delays of dfferent time zones and support was very helpful.

Formatting with markdown did not always bring the expected result. I remember trying to define a table and wasted a whole day making this work. It is this sort of problem where you have something working, then you add a feature like in this case a row or column and it totally falls apart. Eventually I gave up and formatted it in a different way, because epub and mobi would not render the table as I wanted anyway.

I had to work out my writing process and it took me a while until I was happy.

Once everything was in place and my external project had finished writing the book was moving on a fair pace. The most important thing that can be said about Leanpub is that it never got into my way. When I wanted to create the book to preview it is was just doing it without any problems. I used Dropbox publishing, so my texts were copied to the shared folder and the results were loaded to this folder as well where I could download it from. There were a few times when the website was not available, but I guess this had to do with the different time zones and nightly maintenance on the Leanpub servers.

Let's examine my writing process a little bit more:

As mentioned before, all file exchange between my computer and Leanpub was done via a Dropbox shared folder.

I did not want to work on the Dropbox folder, so I created a project on my computer as working folder.

Being a software developer, I set up a git project to make sure I have versions of my files and pushed the local repository to a private GitHub repository.

I also did not want to work directly on the markup files that are used to create the book. The reason again is to keep files I work on separated from the files I created a book from, even if it is a preview only. Both sets of files are in the git repository and if something goes wrong - and it will! - it is possible to go back to a previous version.

All this sounds a bit complicated, but I never lost anything I have written. It needs a fair amount of copying text, though. This can be achieved by doing it manually or automating it. I wrote some scripts for automation, but most of the time I just copied changed text around, especially at a later stage of the book. Sometimes it is good not to trust your own programming abilities 100%…

It is not only text that had to be copied, but also images and code examples. One of the challenges was to keep the running number of the code examples correct. The examples are numbered like Example 4-2 which means example number two in chapter 4. First, I went through the chapters and did the numbering manually, but when the chapters got larger and the changes more, I just wrote a small Perl script to automate this task.

A very important, but also a bit boring task is proof reading before it can be given to somebody else for editing. Reading through 300 pages again and again is not very pleasant and takes some time.

I wrote the book on a MacBook Pro with lots of memory to have all applications I need opened including one or two virtual machines. My editor for the text is Scrivener - I used it for some time now and it deserves its own blog post. For the code I used different editors, but mostly Atom.

Leanpub also provides a PDF version that can be uploaded to Amazon for offering a print-on-demand book. In fact, they encourage authors to do this once the book is 100% finished. In my case the publisher Apress approached me and in December 2016 the book was published by them. This means that I had to take down the book on Leanpub and it is not available there anymore.

Conclusion

It was a very good experience for me to publish on Leanpub. They don't take a lot of money, so there is a nice chunk of royalties left. I can only recommend it to anyone who wants to publish a book.

                Please enable JavaScript to view the comments
                    powered by Disqus.

            <input class="mdl-mega-footer--heading-checkbox" type="checkbox" checked>

INFO

kujuasiokubahatisha@gmail.com

kujuahub.com

            <input class="mdl-mega-footer--heading-checkbox" type="checkbox" checked>

SOCIAL

                          <svg viewBox="0 0 16 16">
                            <path fill="#828282"
                                  d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/>
                          </svg>

                        kujua

                          <svg viewBox="0 0 16 16">
                            <path fill="#828282" d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809
                            c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27 c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767 c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206 C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271 c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469 c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"/>
                          </svg>

                        wolfgang_loder

            <input class="mdl-mega-footer--heading-checkbox" type="checkbox" checked>

ABOUT

Technology Blog by Wolfgang Loder (About). Software development technologies and methods covered amongst others: Elixir, Elm. .NET, C#, Functional Programming, Machine Learning

Privacy & Impressum


text:
import argparse
import base64
import hashlib
import re
import os
import sys

def ComputeIntegrity(input_path):
  hasher = hashlib.sha256()
  with open(input_path, 'rb') as f:
    hasher.update(f.read())
  return base64.b64encode(hasher.digest())

def WriteHeader(input_paths_and_integrity, output_path):
  with open(output_path, 'w') as f:
    f.write('// DO NOT MODIFY THIS FILE DIRECTLY!\n')
    f.write('// IT IS GENERATED BY generate_integrity_header.py\n')
    f.write('// FROM:\n')
    for (input_filename, _) in input_paths_and_integrity:
      f.write('//     * ' + input_filename + '\n')

    f.write('\n')

    for (input_filename, integrity) in input_paths_and_integrity:
      define_name = re.sub('\W', '_', input_filename.upper())
      define_name = define_name + '_INTEGRITY'

      f.write('#define ' + define_name + ' "' + integrity.decode() + '"\n')

      f.write('\n')

def main():
  parser = argparse.ArgumentParser(
      description='Generate a C++ header containing a sha256 checksum of the '
      'input files.')
  parser.add_argument('input_path', help='Path to an input file.', nargs='+')
  parser.add_argument('--output_path', help='Path to an output header file.')
  args = parser.parse_args()

  input_paths = args.input_path
  output_path = args.output_path

  input_paths_and_integrity = [(os.path.basename(path), ComputeIntegrity(path))
                          for path in input_paths]
  WriteHeader(input_paths_and_integrity, output_path)

  return 0

if __name__ == '__main__':
  sys.exit(main())

redpajama_set_name: RedPajamaGithub


text:
package com.badlogic.ashley.core;
import static org.junit.Assert.*;

import org.junit.Test;

import com.badlogic.ashley.utils.ImmutableArray;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.GdxRuntimeException;

public class FamilyManagerTests {

	private static class ComponentA implements Component {}
	private static class ComponentB implements Component {}
	private static class ComponentC implements Component {}

	@Test
	public void entitiesForFamily () {
		Array<Entity> entities = new Array<Entity>();
		ImmutableArray<Entity> immutableEntities = new ImmutableArray<Entity>(entities);
		FamilyManager manager = new FamilyManager(immutableEntities);

		Family family = Family.all(ComponentA.class, ComponentB.class).get();
		ImmutableArray<Entity> familyEntities = manager.getEntitiesFor(family);

		assertEquals(0, familyEntities.size());

		Entity entity1 = new Entity();
		Entity entity2 = new Entity();
		Entity entity3 = new Entity();
		Entity entity4 = new Entity();

		entity1.add(new ComponentA());
		entity1.add(new ComponentB());

		entity2.add(new ComponentA());
		entity2.add(new ComponentC());

		entity3.add(new ComponentA());
		entity3.add(new ComponentB());
		entity3.add(new ComponentC());

		entity4.add(new ComponentA());
		entity4.add(new ComponentB());
		entity4.add(new ComponentC());

		entities.add(entity1);
		entities.add(entity2);
		entities.add(entity3);
		entities.add(entity4);

		manager.updateFamilyMembership(entity1);
		manager.updateFamilyMembership(entity2);
		manager.updateFamilyMembership(entity3);
		manager.updateFamilyMembership(entity4);

		assertEquals(3, familyEntities.size());
		assertTrue(familyEntities.contains(entity1, true));
		assertTrue(familyEntities.contains(entity3, true));
		assertTrue(familyEntities.contains(entity4, true));
		assertFalse(familyEntities.contains(entity2, true));
	}

	@Test
	public void entityForFamilyWithRemoval () {
		Array<Entity> entities = new Array<Entity>();
		ImmutableArray<Entity> immutableEntities = new ImmutableArray<Entity>(entities);
		FamilyManager manager = new FamilyManager(immutableEntities);

		Entity entity = new Entity();
		entity.add(new ComponentA());

		entities.add(entity);

		manager.updateFamilyMembership(entity);

		ImmutableArray<Entity> familyEntities = manager.getEntitiesFor(Family.all(ComponentA.class).get());

		assertEquals(1, familyEntities.size());
		assertTrue(familyEntities.contains(entity, true));

		entity.removing = true;
		entities.removeValue(entity, true);

		manager.updateFamilyMembership(entity);
		entity.removing = false;

		assertEquals(0, familyEntities.size());
		assertFalse(familyEntities.contains(entity, true));
	}

	@Test
	public void entitiesForFamilyAfter () {
		Array<Entity> entities = new Array<Entity>();
		ImmutableArray<Entity> immutableEntities = new ImmutableArray<Entity>(entities);
		FamilyManager manager = new FamilyManager(immutableEntities);

		Family family = Family.all(ComponentA.class, ComponentB.class).get();
		ImmutableArray<Entity> familyEntities = manager.getEntitiesFor(family);

		assertEquals(0, familyEntities.size());

		Entity entity1 = new Entity();
		Entity entity2 = new Entity();
		Entity entity3 = new Entity();
		Entity entity4 = new Entity();

		entities.add(entity1);
		entities.add(entity2);
		entities.add(entity3);
		entities.add(entity4);

		entity1.add(new ComponentA());
		entity1.add(new ComponentB());

		entity2.add(new ComponentA());
		entity2.add(new ComponentC());

		entity3.add(new ComponentA());
		entity3.add(new ComponentB());
		entity3.add(new ComponentC());

		entity4.add(new ComponentA());
		entity4.add(new ComponentB());
		entity4.add(new ComponentC());

		manager.updateFamilyMembership(entity1);
		manager.updateFamilyMembership(entity2);
		manager.updateFamilyMembership(entity3);
		manager.updateFamilyMembership(entity4);

		assertEquals(3, familyEntities.size());
		assertTrue(familyEntities.contains(entity1, true));
		assertTrue(familyEntities.contains(entity3, true));
		assertTrue(familyEntities.contains(entity4, true));
		assertFalse(familyEntities.contains(entity2, true));
	}

	@Test
	public void entitiesForFamilyWithRemoval () {
		Array<Entity> entities = new Array<Entity>();
		ImmutableArray<Entity> immutableEntities = new ImmutableArray<Entity>(entities);
		FamilyManager manager = new FamilyManager(immutableEntities);

		Family family = Family.all(ComponentA.class, ComponentB.class).get();
		ImmutableArray<Entity> familyEntities = manager.getEntitiesFor(family);

		Entity entity1 = new Entity();
		Entity entity2 = new Entity();
		Entity entity3 = new Entity();
		Entity entity4 = new Entity();

		entities.add(entity1);
		entities.add(entity2);
		entities.add(entity3);
		entities.add(entity4);

		entity1.add(new ComponentA());
		entity1.add(new ComponentB());

		entity2.add(new ComponentA());
		entity2.add(new ComponentC());

		entity3.add(new ComponentA());
		entity3.add(new ComponentB());
		entity3.add(new ComponentC());

		entity4.add(new ComponentA());
		entity4.add(new ComponentB());
		entity4.add(new ComponentC());

		manager.updateFamilyMembership(entity1);
		manager.updateFamilyMembership(entity2);
		manager.updateFamilyMembership(entity3);
		manager.updateFamilyMembership(entity4);

		assertEquals(3, familyEntities.size());
		assertTrue(familyEntities.contains(entity1, true));
		assertTrue(familyEntities.contains(entity3, true));
		assertTrue(familyEntities.contains(entity4, true));
		assertFalse(familyEntities.contains(entity2, true));

		entity1.remove(ComponentA.class);
		entity3.removing = true;
		entities.removeValue(entity3, true);

		manager.updateFamilyMembership(entity1);
		manager.updateFamilyMembership(entity3);

		entity3.removing = false;

		assertEquals(1, familyEntities.size());
		assertTrue(familyEntities.contains(entity4, true));
		assertFalse(familyEntities.contains(entity1, true));
		assertFalse(familyEntities.contains(entity3, true));
		assertFalse(familyEntities.contains(entity2, true));
	}

	@Test
	public void entitiesForFamilyWithRemovalAndFiltering () {
		Array<Entity> entities = new Array<Entity>();
		ImmutableArray<Entity> immutableEntities = new ImmutableArray<Entity>(entities);
		FamilyManager manager = new FamilyManager(immutableEntities);

		ImmutableArray<Entity> entitiesWithComponentAOnly = manager.getEntitiesFor(Family.all(ComponentA.class)
			.exclude(ComponentB.class).get());

		ImmutableArray<Entity> entitiesWithComponentB = manager.getEntitiesFor(Family.all(ComponentB.class).get());

		Entity entity1 = new Entity();
		Entity entity2 = new Entity();

		entities.add(entity1);
		entities.add(entity2);

		entity1.add(new ComponentA());

		entity2.add(new ComponentA());
		entity2.add(new ComponentB());

		manager.updateFamilyMembership(entity1);
		manager.updateFamilyMembership(entity2);

		assertEquals(1, entitiesWithComponentAOnly.size());
		assertEquals(1, entitiesWithComponentB.size());

		entity2.remove(ComponentB.class);

		manager.updateFamilyMembership(entity2);

		assertEquals(2, entitiesWithComponentAOnly.size());
		assertEquals(0, entitiesWithComponentB.size());
	}

	@Test
	public void entityListenerThrows() {
		Array<Entity> entities = new Array<Entity>();
		ImmutableArray<Entity> immutableEntities = new ImmutableArray<Entity>(entities);
		FamilyManager manager = new FamilyManager(immutableEntities);

		EntityListener listener = new EntityListener() {
			@Override
			public void entityAdded (Entity entity) {
				throw new GdxRuntimeException("throwing");
			}

			@Override
			public void entityRemoved (Entity entity) {
				throw new GdxRuntimeException("throwing");
			}
		};

		manager.addEntityListener(Family.all().get(), 0, listener);

		Entity entity = new Entity();
		entities.add(entity);

		boolean thrown = false;
		try {
			manager.updateFamilyMembership(entity);
		}
		catch (Exception e) {
			thrown = true;
		}

		assertTrue(thrown);
		assertFalse(manager.notifying());
	}
}


text:
package org.jsapar.model;

import org.junit.Test;

import static org.junit.Assert.*;

public class BooleanCellTest {

    @Test
    public void testGetSetBooleanValue() {
        BooleanCell cell = new BooleanCell("test", false);
        assertFalse(cell.getValue());
    }

    @Test
    public void testGetStringValue() {
        BooleanCell cell = new BooleanCell("test", false);
        assertEquals("false", cell.getStringValue());
    }

    @Test
    public void testCompareValueTo() {
        BooleanCell cell1 = new BooleanCell("test", false);
        BooleanCell cell2 = new BooleanCell("test", false);
        BooleanCell cell3 = new BooleanCell("test", true);
        BooleanCell cell4 = new BooleanCell("test", true);
        assertEquals(0, cell1.compareValueTo(cell1));
        assertEquals(0, cell1.compareValueTo(cell2));
        assertTrue(cell1.compareValueTo(cell3) < 0);
        assertTrue(cell3.compareValueTo(cell1) > 0);
        assertEquals(0, cell3.compareValueTo(cell3));
        assertEquals(0, cell3.compareValueTo(cell4));
    }
}


text:
import sys
import os
import random

from basic.constant import ROOT_PATH
from basic.common import readRankingResults,printStatus
from dataengine import DataEngine

class PositiveEngine (DataEngine):

    def __init__(self, collection, rootpath=ROOT_PATH):
        DataEngine.__init__(self, collection)
        self.name = '%s.%s' % (self.__class__.__name__, collection)

    def precompute(self, concept):
        datafile = os.path.join(self.datadir, 'tagged,lemm', concept + ".txt")
        newset = map(str.strip, open(datafile).readlines())
        self.candidateset = [x for x in newset if x in self.imset]
        self.target = concept
        print ("[%s] precomputing candidate positive examples for %s: %d instances" % (self.name, concept, len(self.candidateset)))

class SelectivePositiveEngine (PositiveEngine):

    def __init__(self, collection, method, rootpath=ROOT_PATH):
        PositiveEngine.__init__(self, collection)
        self.name = '%s.%s.%s' % (self.__class__.__name__, collection, method)
        self.datadir = os.path.join(rootpath, collection, 'SimilarityIndex', collection, method)

    def precompute(self, concept):
    	  print ("[%s] precomputing candidate positive examples for %s" % (self.name, concept))
    	  datafile = os.path.join(self.datadir, '%s.txt' % concept)
    	  ranklist = readRankingResults(datafile)
    	  self.candidateset = [x[0] for x in ranklist]
    	  self.target = concept

    def sample(self, concept, n):
        if self.target != concept:
            self.precompute(concept)

        if len(self.candidateset) <= n:
            print ("[%s] request %d examples of %s, but %d available only :(" % (self.name, n, concept, len(self.candidateset)))
            return list(self.candidateset)
        return self.candidateset[:n]

if __name__ == "__main__":
    collection = "train10k"
    method = "tagged,lemm/%s/vgg-verydeep-16-fc7relu,cosineknn,1000,lemm" % collection
    pe1 = PositiveEngine(collection)

    pe2 = SelectivePositiveEngine(collection, method)
    for concept in str.split('airplane dog'):
        pe1.sample(concept, 100)
        pe2.sample(concept, 100)


text:
<?php

namespace UGRM\WebBundle\Model;

use UGRM\DataBundle\Model\Location;

class MeetingTweet
{
    /**
     * @var \UGRM\DataBundle\Model\Meeting
     */
    private $meeting;

    /**
     * @var string
     */
    private $host;

    private $tweet = '';

    private $tweetlen = 0;

    public function __construct(\UGRM\DataBundle\Model\Meeting $meeting, $host)
    {
        $this->meeting = $meeting;
        $this->host = $host;
    }

    function addToTweet($str, $strlen = null)
    {
        $thelen = $this->tweetlen + ($strlen ? $strlen : strlen($str));
        if ($thelen > 140) return;
        $this->tweet .= $str;
        $this->tweetlen = $thelen;
    }

    protected function reset()
    {
        $this->tweet = '';
        $this->tweetlen = 0;
    }

    /**
     * @return string
     */
    public function getTweet()
    {
        $this->reset();
        if ($this->meeting->time->isToday()) {
            $this->addToTweet('Heute');
        } elseif ($this->meeting->time->isTomorrow()) {
            $this->addToTweet('Morgen');
        } else {
            $this->addToTweet('Am ' . strftime('%a, %d.%m', $this->meeting->time->format('U')));
        }
        $prefix = $this->meeting->usergroup->female || $this->meeting->usergroup->plural ? 'die ' : 'der ';
        $n = $this->getName();
        $this->addToTweet(($this->meeting->usergroup->plural ? ' treffen sich ' : ' trifft sich ') . $prefix . $n);
        $this->addToTweet(' um ' . strftime('%H:%M Uhr', $this->meeting->time->format('U')));
        if ($this->meeting->location && $this->meeting->location instanceof Location) {
            $this->addToTweet(' in ' . $this->meeting->location->city);
            if ($this->meeting->location->twitter) $this->addToTweet(' ' . $this->meeting->location->twitter);
        }
        $this->addToTweet(' ' . sprintf('http://%s/~%s', $this->host, $this->meeting->usergroup->id), 22);
        $ht = $this->meeting->usergroup->hashtag;
        if ($ht && $ht != $n && substr($ht, 1) != substr($n, 1)) $this->addToTweet(' ' . $ht);
        foreach ($this->meeting->usergroup->tags as $tag) {
            $this->addToTweet(' #' . preg_replace('/[^a-zA-Z0-9]/', '', $tag));
        }
        $this->addToTweet(' #ugrm');
        return $this->tweet;
    }

    protected function getName()
    {
        if ($n = $this->meeting->usergroup->twitter) return $n;
        if ($n = $this->meeting->usergroup->hashtag) return $n;
        if ($n = $this->meeting->usergroup->nickname) return $n;
        return $this->meeting->usergroup->name;
    }

    public function getLink()
    {
        $url = 'https://twitter.com/intent/tweet';
        $params = array(
            'original_referer' => sprintf('http://%s/', $this->host),
            'text' => $this->getTweet());
        return $url . '?' . http_build_query($params);
    }
}


text:
package demo.domain;

import org.springframework.data.repository.Repository;

public interface UserRepository extends Repository<User, Long> {

	User findByUsername(String username);

}


text:
var E = require('..')
        .config({namespace:'NODE'})
        .write({user:'goliatone', passwoord:'secret'})
        .on('write', function(ENV){
            console.log(JSON.stringify(ENV, null, 4));
        });


text:
/****************************************************************************
 *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
 *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
 ****************************************************************************/

/*
**	setbuf.c
**
**	Support for set_term(), reset_shell_mode(), reset_prog_mode().
**
*/

#include <curses.priv.h>

MODULE_ID("$Id: setbuf.c,v 1.13 2007/05/12 19:04:02 tom Exp $")

/*
 * If the output file descriptor is connected to a tty (the typical case) it
 * will probably be line-buffered.  Keith Bostic pointed out that we don't want
 * this; it hoses people running over networks by forcing out a bunch of small
 * packets instead of one big one, so screen updates on ptys look jerky.
 * Restore block buffering to prevent this minor lossage.
 *
 * The buffer size is a compromise.  Ideally we'd like a buffer that can hold
 * the maximum possible update size (the whole screen plus cup commands to
 * change lines as it's painted).  On a 66-line xterm this can become
 * excessive.  So we min it with the amount of data we think we can get through
 * two Ethernet packets (maximum packet size - 100 for TCP/IP overhead).
 *
 * Why two ethernet packets?  It used to be one, on the theory that said
 * packets define the maximum size of atomic update.  But that's less than the
 * 2000 chars on a 25 x 80 screen, and we don't want local updates to flicker
 * either.  Two packet lengths will handle up to a 35 x 80 screen.
 *
 * The magic '6' is the estimated length of the end-of-line cup sequence to go
 * to the next line.  It's generous.  We used to mess with the buffering in
 * init_mvcur() after cost computation, but that lost the sequences emitted by
 * init_acs() in setupscreen().
 *
 * "The setvbuf function may be used only after the stream pointed to by stream
 * has been associated with an open file and before any other operation is
 * performed on the stream." (ISO 7.9.5.6.)
 *
 * Grrrr...
 *
 * On a lighter note, many implementations do in fact allow an application to
 * reset the buffering after it has been written to.  We try to do this because
 * otherwise we leave stdout in buffered mode after endwin() is called.  (This
 * also happens with SVr4 curses).
 *
 * There are pros/cons:
 *
 * con:
 *	There is no guarantee that we can reestablish buffering once we've
 *	dropped it.
 *
 *	We _may_ lose data if the implementation does not coordinate this with
 *	fflush.
 *
 * pro:
 *	An implementation is more likely to refuse to change the buffering than
 *	to do it in one of the ways mentioned above.
 *
 *	The alternative is to have the application try to change buffering
 *	itself, which is certainly no improvement.
 *
 * Just in case it does not work well on a particular system, the calls to
 * change buffering are all via the macro NC_BUFFERED.  Some implementations
 * do indeed get confused by changing setbuf on/off, and will overrun the
 * buffer.  So we disable this by default (there may yet be a workaround).
 */
NCURSES_EXPORT(void)
_nc_set_buffer(FILE *ofp, bool buffered)
{
    /* optional optimization hack -- do before any output to ofp */
#if HAVE_SETVBUF || HAVE_SETBUFFER
    if (SP->_buffered != buffered) {
	unsigned buf_len;
	char *buf_ptr;

	if (getenv("NCURSES_NO_SETBUF") != 0)
	    return;

	fflush(ofp);
#ifdef __DJGPP__
	setmode(ofp, O_BINARY);
#endif
	if (buffered != 0) {
	    buf_len = min(LINES * (COLS + 6), 2800);
	    if ((buf_ptr = SP->_setbuf) == 0) {
		if ((buf_ptr = typeMalloc(char, buf_len)) == NULL)
		      return;
		SP->_setbuf = buf_ptr;
		/* Don't try to free this! */
	    }
#if !USE_SETBUF_0
	    else
		return;
#endif
	} else {
#if !USE_SETBUF_0
	    return;
#else
	    buf_len = 0;
	    buf_ptr = 0;
#endif
	}

#if HAVE_SETVBUF
#ifdef SETVBUF_REVERSED		/* pre-svr3? */
	(void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF);
#else
	(void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len);
#endif
#elif HAVE_SETBUFFER
	(void) setbuffer(ofp, buf_ptr, (int) buf_len);
#endif

	SP->_buffered = buffered;
    }
#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */
}


text:
<?php

namespace Fuel\Core;

// ------------------------------------------------------------------------

/**
 * Fieldset Class
 *
 * Define a set of fields that can be used to generate a form or to validate input.
 *
 * @package   Fuel
 * @category  Core
 */
class Fieldset
{
	/**
	 * @var  Fieldset
	 */
	protected static $_instance;

	/**
	 * @var  array  contains references to all instantiations of Fieldset
	 */
	protected static $_instances = array();

	/**
	 * Create Fieldset object
	 *
	 * @param   string    Identifier for this fieldset
	 * @param   array     Configuration array
	 * @return  Fieldset
	 */
	public static function forge($name = 'default', array $config = array())
	{
		if ($exists = static::instance($name))
		{
			\Error::notice('Fieldset with this name exists already, cannot be overwritten.');
			return $exists;
		}

		static::$_instances[$name] = new static($name, $config);

		if ($name == 'default')
		{
			static::$_instance = static::$_instances[$name];
		}

		return static::$_instances[$name];
	}

	/**
	 * Return a specific instance, or the default instance (is created if necessary)
	 *
	 * @param   string  driver id
	 * @return  Fieldset
	 */
	public static function instance($instance = null)
	{
		if ($instance !== null)
		{
			if ( ! array_key_exists($instance, static::$_instances))
			{
				return false;
			}

			return static::$_instances[$instance];
		}

		if (static::$_instance === null)
		{
			static::$_instance = static::forge();
		}

		return static::$_instance;
	}

	/**
	 * @var  string  instance id
	 */
	protected $name;

	/**
	 * @var  string  tag used to wrap this instance
	 */
	protected $fieldset_tag = null;

	/**
	 * @var  Fieldset  instance to which this instance belongs
	 */
	protected $fieldset_parent = null;

	/**
	 * @var  array  instances that belong to this one
	 */
	protected $fieldset_children = array();

	/**
	 * @var  array  array of Fieldset_Field objects
	 */
	protected $fields = array();

	/**
	 * @var  Validation  instance of validation
	 */
	protected $validation;

	/**
	 * @var  Form  instance of form
	 */
	protected $form;

	/**
	 * @var  array  configuration array
	 */
	protected $config = array();

	/**
	 * @var  array  disabled fields array
	 */
	protected $disabled = array();

	/**
	 * Object constructor
	 *
	 * @param  string
	 * @param  array
	 */
	protected function __construct($name, array $config = array())
	{
		if (isset($config['validation_instance']))
		{
			$this->validation($config['validation_instance']);
			unset($config['validation_instance']);
		}
		if (isset($config['form_instance']))
		{
			$this->form($config['form_instance']);
			unset($config['form_instance']);
		}

		$this->name = (string) $name;
		$this->config = $config;
	}

	/**
	 * Get related Validation instance or create it
	 *
	 * @param   bool|Validation
	 * @return  Validation
	 */
	public function validation($instance = true)
	{
		if ($instance instanceof Validation)
		{
			$this->validation = $instance;
			return $instance;
		}

		if (empty($this->validation) and $instance === true)
		{
			$this->validation = \Validation::forge($this);
		}

		return $this->validation;
	}

	/**
	 * Get related Form instance or create it
	 *
	 * @param   bool|Form
	 * @return  Form
	 */
	public function form($instance = true)
	{
		if ($instance instanceof Form)
		{
			$this->form = $instance;
			return $instance;
		}

		if (empty($this->form) and $instance === true)
		{
			$this->form = \Form::forge($this);
		}

		return $this->form;
	}

	/**
	 * Set the tag to be used for this fieldset
	 *
	 * @param  string  $tag
	 */
	public function set_fieldset_tag($tag)
	{
		$this->fieldset_tag = $tag;
	}

	/**
	 * Set the parent Fieldset instance
	 *
	 * @param   Fieldset  parent fieldset to which this belongs
	 * @return  Fieldset
	 */
	public function set_parent(Fieldset $fieldset)
	{
		if ( ! empty($this->fieldset_parent))
		{
			throw new \RuntimeException('Fieldset already has a parent, belongs to "'.$this->parent()->name.'".');
		}

		$children = $fieldset->children();
		while ($child = array_shift($children))
		{
			if ($child === $this)
			{
				throw new \RuntimeException('Circular reference detected, adding a Fieldset that\'s already a child as a parent.');
			}
			$children = array_merge($child->children(), $children);
		}

		$this->fieldset_parent = $fieldset;
		$fieldset->add_child($this);
		return $this;
	}

	/**
	 * Add a child Fieldset instance
	 *
	 * @param   Fieldset  $fieldset
	 * @return  Fieldset
	 */
	protected function add_child(Fieldset $fieldset)
	{
		if (is_null($fieldset->fieldset_tag))
		{
			$fieldset->fieldset_tag = 'fieldset';
		}

		$this->fieldset_children[$fieldset->name] = $fieldset;
		return $this;
	}

	/**
	 * Factory for Fieldset_Field objects
	 *
	 * @param   string
	 * @param   string
	 * @param   array
	 * @param   array
	 * @return  Fieldset_Field
	 */
	public function add($name, $label = '', array $attributes = array(), array $rules = array())
	{
		if ($name instanceof Fieldset_Field)
		{
			if ($name->name == '' or $this->field($name->name) !== false)
			{
				throw new \RuntimeException('Fieldname empty or already exists in this Fieldset: "'.$name->name.'".');
			}

			$name->set_fieldset($this);
			$this->fields[$name->name] = $name;
			return $name;
		}
		elseif ($name instanceof Fieldset)
		{
			if (empty($name->name) or $this->field($name->name) !== false)
			{
				throw new \RuntimeException('Fieldset name empty or already exists in this Fieldset: "'.$name->name.'".');
			}

			$name->set_parent($this);
			$this->fields[$name->name] = $name;
			return $name;
		}

		if (empty($name) || (is_array($name) and empty($name['name'])))
		{
			throw new \InvalidArgumentException('Cannot create field without name.');
		}

		// Allow passing the whole config in an array, will overwrite other values if that's the case
		if (is_array($name))
		{
			$attributes = $name;
			$label = isset($name['label']) ? $name['label'] : '';
			$rules = isset($name['rules']) ? $name['rules'] : array();
			$name = $name['name'];
		}

		// Check if it exists already, if so: return and give notice
		if ($field = $this->field($name))
		{
			\Error::notice('Field with this name exists already in this fieldset: "'.$name.'".');
			return $field;
		}

		$this->fields[$name] = new \Fieldset_Field($name, $label, $attributes, $rules, $this);

		return $this->fields[$name];
	}

	/**
	 * Add a new Fieldset_Field before an existing field in a Fieldset
	 *
	 * @param   string  $name
	 * @param   string  $label
	 * @param   array   $attributes
	 * @param   array   $rules
	 * @param   string  $fieldname   fieldname before which the new field is inserted in the fieldset
	 * @return  Fieldset_Field
	 */
	public function add_before($name, $label = '', array $attributes = array(), array $rules = array(), $fieldname = null)
	{
		$field = $this->add($name, $label, $attributes, $rules);

		// Remove from tail and reinsert at correct location
		unset($this->fields[$field->name]);

		if ( ! \Arr::insert_before_key($this->fields, array($name => $field), $fieldname, true))
		{
			throw new \RuntimeException('Field "'.$fieldname.'" does not exist in this Fieldset. Field "'.$name.'" can not be added.');
		}

		return $field;
	}

	/**
	 * Add a new Fieldset_Field after an existing field in a Fieldset
	 *
	 * @param   string  $name
	 * @param   string  $label
	 * @param   array   $attributes
	 * @param   array   $rules
	 * @param   string  $fieldname   fieldname after which the new field is inserted in the fieldset
	 * @return  Fieldset_Field
	 */
	public function add_after($name, $label = '', array $attributes = array(), array $rules = array(), $fieldname = null)
	{
		$field = $this->add($name, $label, $attributes, $rules);

		// Remove from tail and reinsert at correct location
		unset($this->fields[$field->name]);
		if ( ! \Arr::insert_after_key($this->fields, array($name => $field), $fieldname, true))
		{
			throw new \RuntimeException('Field "'.$fieldname.'" does not exist in this Fieldset. Field "'.$name.'" can not be added.');
		}

		return $field;
	}

	/**
	 * Get Field instance
	 *
	 * @param   string|null           field name or null to fetch an array of all
	 * @param   bool                  whether to get the fields array or flattened array
	 * @return  Fieldset_Field|false  returns false when field wasn't found
	 */
	public function field($name = null, $flatten = false)
	{
		if ($name === null)
		{
			if ( ! $flatten)
			{
				return $this->fields;
			}

			$fields = $this->fields;
			foreach ($this->fieldset_children as $fs_name => $fieldset)
			{
				\Arr::insert_after_key($fields, $fieldset->field(null, true), $fs_name);
				unset($fields[$fs_name]);
			}
			return $fields;
		}

		if ( ! array_key_exists($name, $this->fields))
		{
			foreach ($this->fieldset_children as $fieldset)
			{
				if (($field = $fieldset->field($name)) !== false)
				{
					return $field;
				}
			}
			return false;
		}

		return $this->fields[$name];
	}

	/**
	 * Add a model's fields
	 * The model must have a method "set_form_fields" that takes this Fieldset instance
	 * and adds fields to it.
	 *
	 * @param   string|Object  either a full classname (including full namespace) or object instance
	 * @param   array|Object   array or object that has the exactly same named properties to populate the fields
	 * @param   string         method name to call on model for field fetching
	 * @return  Fieldset       this, to allow chaining
	 */
	public function add_model($class, $instance = null, $method = 'set_form_fields')
	{
		// Add model to validation callables for validation rules
		$this->validation()->add_callable($class);

		if ((is_string($class) and is_callable($callback = array('\\'.$class, $method)))
			|| is_callable($callback = array($class, $method)))
		{
			$instance ? call_user_func($callback, $this, $instance) : call_user_func($callback, $this);
		}

		return $this;
	}

	/**
	 * Sets a config value on the fieldset
	 *
	 * @param   string
	 * @param   mixed
	 * @return  Fieldset  this, to allow chaining
	 */
	public function set_config($config, $value = null)
	{
		$config = is_array($config) ? $config : array($config => $value);
		foreach ($config as $key => $value)
		{
			if (strpos($key, '.') === false)
			{
				$this->config[$key] = $value;
			}
			else
			{
				\Arr::set($this->config, $key, $value);
			}
		}

		return $this;
	}

	/**
	 * Get a single or multiple config values by key
	 *
	 * @param   string|array  a single key or multiple in an array, empty to fetch all
	 * @param   mixed         default output when config wasn't set
	 * @return  mixed|array   a single config value or multiple in an array when $key input was an array
	 */
	public function get_config($key = null, $default = null)
	{
		if ($key === null)
		{
			return $this->config;
		}

		if (is_array($key))
		{
			$output = array();
			foreach ($key as $k)
			{
				$output[$k] = $this->get_config($k, $default);
			}
			return $output;
		}

		if (strpos($key, '.') === false)
		{
			return array_key_exists($key, $this->config) ? $this->config[$key] : $default;
		}
		else
		{
			return \Arr::get($this->config, $key, $default);
		}
	}

	/**
	 * Populate the form's values using an input array or object
	 *
	 * @param   array|object
	 * @param   bool
	 * @return  Fieldset  this, to allow chaining
	 */
	public function populate($input, $repopulate = false)
	{
		$fields = $this->field(null, true);
		foreach ($fields as $f)
		{
			if (is_array($input) or $input instanceof \ArrayAccess)
			{
				if (isset($input[$f->name]))
				{
					$f->set_value($input[$f->name], true);
				}
			}
			elseif (is_object($input) and property_exists($input, $f->name))
			{
				$f->set_value($input->{$f->name}, true);
			}
		}

		// Optionally overwrite values using post/get
		if ($repopulate)
		{
			$this->repopulate();
		}

		return $this;
	}

	/**
	 * Set all fields to the input from get or post (depends on the form method attribute)
	 *
	 * @return  Fieldset      this, to allow chaining
	 */
	public function repopulate()
	{
		$fields = $this->field(null, true);
		foreach ($fields as $f)
		{
			// Don't repopulate the CSRF field
			if ($f->name === \Config::get('security.csrf_token_key', 'fuel_csrf_token'))
			{
				continue;
			}

			if (($value = $f->input()) !== null)
			{
				$f->set_value($value, true);
			}
		}

		return $this;
	}

	/**
	 * Build the fieldset HTML
	 *
	 * @return  string
	 */
	public function build($action = null)
	{
		$attributes = $this->get_config('form_attributes');
		if ($action and ($this->fieldset_tag == 'form' or empty($this->fieldset_tag)))
		{
			$attributes['action'] = $action;
		}

		$open = ($this->fieldset_tag == 'form' or empty($this->fieldset_tag))
			? $this->form()->open($attributes).PHP_EOL
			: $this->form()->{$this->fieldset_tag.'_open'}($attributes);

		$fields_output = '';
		foreach ($this->field() as $f)
		{
			in_array($f->name, $this->disabled) or $fields_output .= $f->build().PHP_EOL;
		}

		$close = ($this->fieldset_tag == 'form' or empty($this->fieldset_tag))
			? $this->form()->close($attributes).PHP_EOL
			: $this->form()->{$this->fieldset_tag.'_close'}($attributes);

		$template = $this->form()->get_config((empty($this->fieldset_tag) ? 'form' : $this->fieldset_tag).'_template',
			"\n\t\t{open}\n\t\t<table>\n{fields}\n\t\t</table>\n\t\t{close}\n");
		$template = str_replace(array('{form_open}', '{open}', '{fields}', '{form_close}', '{close}'),
			array($open, $open, $fields_output, $close, $close),
			$template);

		return $template;
	}

	/**
	 * Enable a disabled field from being build
	 *
	 * @return  Fieldset      this, to allow chaining
	 */
	public function enable($name = null)
	{
		// Check if it exists. if not, bail out
		if ( ! $this->field($name))
		{
			throw new \RuntimeException('Field "'.$name.'" does not exist in this Fieldset.');
		}

		if (isset($this->disabled[$name]))
		{
			unset($this->disabled[$name]);
		}

		return $this;
	}

	/**
	 * Disable a field from being build
	 *
	 * @return  Fieldset      this, to allow chaining
	 */
	public function disable($name = null)
	{
		// Check if it exists. if not, bail out
		if ( ! $this->field($name))
		{
			throw new \RuntimeException('Field "'.$name.'" does not exist in this Fieldset.');
		}

		isset($this->disabled[$name]) or $this->disabled[$name] = $name;

		return $this;
	}

	/**
	 * Magic method toString that will build this as a form
	 *
	 * @return  string
	 */
	public function __toString()
	{
		return $this->build();
	}

	/**
	 * Return parent Fieldset
	 *
	 * @return Fieldset
	 */
	public function parent()
	{
		return $this->fieldset_parent;
	}

	/**
	 * Return the child fieldset instances
	 *
	 * @return  array
	 */
	public function children()
	{
		return $this->fieldset_children;
	}

	/**
	 * Alias for $this->validation()->input()
	 *
	 * @return  mixed
	 */
	public function input($field = null)
	{
		return $this->validation()->input($field);
	}

	/**
	 * Alias for $this->validation()->validated()
	 *
	 * @return  mixed
	 */
	public function validated($field = null)
	{
		return $this->validation()->validated($field);
	}

	/**
	 * Alias for $this->validation()->error()
	 *
	 * @return  Validation_Error|array
	 */
	public function error($field = null)
	{
		return $this->validation()->error($field);
	}

	/**
	 * Alias for $this->validation()->show_errors()
	 *
	 * @return  string
	 */
	public function show_errors(array $config = array())
	{
		return $this->validation()->show_errors($config);
	}

	/**
	 * Get instance id
	 *
	 * @return string
	 */
	public function get_name()
	{
		return $this->name;
	}
}


text:
package com.bizosys.hsearch.schema;

import org.apache.log4j.Logger;

/**
 * Logger for classes inside schema package.
 * @author karan
 *
 */
public class SchemaLog {
	public static Logger l = Logger.getLogger(SchemaLog.class.getName());
}


text:
@interface UINavigationController21 ()

@end

@implementation UINavigationController21

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (BOOL)shouldAutorotate{
    return self.topViewController.shouldAutorotate;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{

    return self.topViewController.supportedInterfaceOrientations;
}

@end


text:
(function(App) {

  'use strict';

  App.View = App.View || {};

  App.View.Form = Backbone.View.extend({

    el: 'form',

    options: {
      formHeaderIconClass: ".form_header .icon",
      adjustableTriggerClass: ".js-adjustable-input",
      mediumEditorTriggerClass: ".js-textarea-editable",
      selectTriggerClass: ".js-select",
      selectTagsTriggerClass: ".js-select-tags",
      selectTagsInlineClass: "js-inline-tags",
      clearTagsClass: ".js-clear-tags",
      selectPhotoTriggerClass: ".js-select-photo",
    },

    initialize: function() {
      this._cache();
      this._loadHeaderAdjustableInput();
      this._loadLimitedInput();
      this._loadMediumEditor();
      this._loadSelect();
      this._loadDatepicker();
      this._loadTaggingSelect();
      this._loadClearTags();
      this._loadPhotoSearch();
      this._loadFilesUploader();
    },

    _cache: function () {
      this.$headerIcon = $(this.$el.find(this.options.formHeaderIconClass));
    },

    _loadHeaderAdjustableInput: function () {
      _.each($(this.$el.find(this.options.adjustableTriggerClass)), function(element) {
        new App.Helper.FormAdjustableInput({
          el: element
        });
      }.bind(this));
    },

    _loadLimitedInput: function() {
      new App.Helper.FormInputCharLimited({
        el: $(this.$el.find('[data-type="limited_input"]'))
      });
    },

    _loadDatepicker: function() {
      _.each($(this.$el.find('[data-type="datepicker"]')), function(element) {
        new App.Helper.FormDatepicker({
          el: element
        });
      }.bind(this));
    },

    _loadMediumEditor: function () {
      new MediumEditor(this.options.mediumEditorTriggerClass, {
        toolbar: {
          buttons: ['bold', 'italic', 'underline', 'unorderedlist', 'anchor', 'iframe', 'HTML', 'removeFormat']
        },
        extensions: {
          'iframe': new MediumButton({
            label:'iframe',
            action: function(html, mark, parent){
              var height = prompt("Please set the iframe height", "");

              return '';
            }
          }),
          'HTML': new MediumButton({
            label:'HTML',
            action: function(html, mark, parent){
              var pieces = html.split("
");
              var realContent = "";
              _.each(pieces, function(piece) {
                realContent += piece.replace('
', '');
              });

              return _.unescape(realContent);
            }
          }),
        },
        paste: {
          cleanPastedHTML: true
        },
      });
    },

    _loadSelect: function () {
      $(this.options.selectTriggerClass).select2({
        minimumResultsForSearch: Infinity
      });
    },

    _loadTaggingSelect: function () {
      _.each($(this.options.selectTagsTriggerClass), function(element) {
        var params = {
          tags: true
        };
        if(!$(element).hasClass(this.options.selectTagsInlineClass)) {
          params.createTag = function() {
            return undefined;
          };
        }
        $(element).select2(params);
      }.bind(this));
    },

    _loadClearTags: function() {
      $(this.options.clearTagsClass).on('click', function(e) {
        e.preventDefault();
        $(e.currentTarget).parents('.field').find('select').
          val(null).trigger('change');
        $(e.currentTarget).parents('form').submit();
        return true;
      });
    },

    _loadPhotoSearch: function() {
      new App.Helper.FormPhotoSearch({
        el: $(this.$el.find(this.options.selectPhotoTriggerClass))
      });
    },

    _loadFilesUploader: function() {
      _.each($(this.$el.find('input[type="file"]')), function(element) {
        new App.Helper.FormInputFileUploader({
          el: element
        });
      }.bind(this));
    },

    _setFocusHeader: function (e) {
      if (e.type == "focusin") {
        this.$headerIcon.css("opacity", 0);
      } else {
        this.$headerIcon.removeAttr("style");
      }
    },

  });

})(this.App);


text:
package org.apache.cassandra.hints;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;

import com.google.common.collect.ImmutableMap;
import org.junit.Test;

import static junit.framework.Assert.*;

public class HintsCatalogTest
{
    @Test
    public void loadCompletenessAndOrderTest() throws IOException
    {
        File directory = Files.createTempDirectory(null).toFile();
        try
        {
            loadCompletenessAndOrderTest(directory);
        }
        finally
        {
            directory.deleteOnExit();
        }
    }

    public static void loadCompletenessAndOrderTest(File directory) throws IOException
    {
        UUID hostId1 = UUID.randomUUID();
        UUID hostId2 = UUID.randomUUID();

        long timestamp1 = System.currentTimeMillis();
        long timestamp2 = System.currentTimeMillis() + 1;
        long timestamp3 = System.currentTimeMillis() + 2;
        long timestamp4 = System.currentTimeMillis() + 3;

        HintsDescriptor descriptor1 = new HintsDescriptor(hostId1, timestamp1);
        HintsDescriptor descriptor2 = new HintsDescriptor(hostId2, timestamp3);
        HintsDescriptor descriptor3 = new HintsDescriptor(hostId2, timestamp2);
        HintsDescriptor descriptor4 = new HintsDescriptor(hostId1, timestamp4);

        writeDescriptor(directory, descriptor1);
        writeDescriptor(directory, descriptor2);
        writeDescriptor(directory, descriptor3);
        writeDescriptor(directory, descriptor4);

        HintsCatalog catalog = HintsCatalog.load(directory, ImmutableMap.of());
        assertEquals(2, catalog.stores().count());

        HintsStore store1 = catalog.get(hostId1);
        assertNotNull(store1);
        assertEquals(descriptor1, store1.poll());
        assertEquals(descriptor4, store1.poll());
        assertNull(store1.poll());

        HintsStore store2 = catalog.get(hostId2);
        assertNotNull(store2);
        assertEquals(descriptor3, store2.poll());
        assertEquals(descriptor2, store2.poll());
        assertNull(store2.poll());
    }

    @Test
    public void deleteHintsTest() throws IOException
    {
        File directory = Files.createTempDirectory(null).toFile();
        UUID hostId1 = UUID.randomUUID();
        UUID hostId2 = UUID.randomUUID();
        long now = System.currentTimeMillis();
        writeDescriptor(directory, new HintsDescriptor(hostId1, now));
        writeDescriptor(directory, new HintsDescriptor(hostId1, now+1));
        writeDescriptor(directory, new HintsDescriptor(hostId2, now+2));
        writeDescriptor(directory, new HintsDescriptor(hostId2, now+3));

        // load catalog containing two stores (one for each host)
        HintsCatalog catalog = HintsCatalog.load(directory, ImmutableMap.of());
        assertEquals(2, catalog.stores().count());
        assertTrue(catalog.hasFiles());

        // delete all hints from store 1
        assertTrue(catalog.get(hostId1).hasFiles());
        catalog.deleteAllHints(hostId1);
        assertFalse(catalog.get(hostId1).hasFiles());
        // stores are still keepts for each host, even after deleting hints
        assertEquals(2, catalog.stores().count());
        assertTrue(catalog.hasFiles());

        // delete all hints from all stores
        catalog.deleteAllHints();
        assertEquals(2, catalog.stores().count());
        assertFalse(catalog.hasFiles());
    }

    @SuppressWarnings("EmptyTryBlock")
    private static void writeDescriptor(File directory, HintsDescriptor descriptor) throws IOException
    {
        try (HintsWriter ignored = HintsWriter.create(directory, descriptor))
        {
        }
    }
}


text:
from django.contrib import admin
from django.contrib.auth.models import Permission
# Register your models here.

admin.site.register(Permission)


text:
DelGet - freeze v4.6 (version used to generate the data in Kapusta, Suh and Feschotte)
=====
See publication: [Kapusta, Suh and Feschotte (2017) PNAS (doi: 10.1073/pnas.1616702114)](http://www.pnas.org/content/114/8/E1460.full)

Get micro and medium deletions specific to 2 closely related species after their split.
All options and paths are set in the file DelGet--0--CONFIG.pl (simple text file)

	Usage     : perl DelGet.pl <config_file>
	Typically : perl DelGet.pl DelGet--0--CONFIG_manipname.pl

	========================================================

	REQUIREMENTS:
	   (already in Lib) Perl Array::Unique = https://metacpan.org/source/SZABGAB/Array-Unique-0.08/lib/Array/Unique.pm
	   (already in Lib) Perl Array::Transpose::Ragged = https://metacpan.org/pod/Array::Transpose::Ragged
	   Blat = http://genome.ucsc.edu/FAQ/FAQblat.htmlblat3
	   Muscle = http://www.drive5.com/muscle/downloads.htm
	   Kalign = http://msa.sbc.su.se/cgi-bin/msa.cgi?mode=downloads

	========================================================

	PURPOSE :
	   General question = get medium size deletion rates
	   Written for 3 species (referred as 1, 2 and 3)
		  1) From a \"reference\" genome (=1), get random regions as: [anchor1]=====Genome1.region=====[anchor2]
		  2) Blat anchor1 and anchor2 sequences agains genome2 and genome3
		  3) Get length between anchors: [anchor1]=====Genome2.region=====[anchor2] and [anchor1]=====Genome3.region=====[anchor2]

	   NOTE THAT:
		  - anchors are chosen based on their score + if second highest score is < XX% of the highest score (see \"maxratio\" variable in CONFIG file)
		  - anchors need to be on same target sequence in both genomes
		  - anchors on genome2 and genome3 need to be < XX nt ("a_max_len" variable in CONFIG file);
		  - anchor1 and anchor2 hits need to be on same strand
		  - and obviously no assembly gaps in any of the regions

	      If you need to kill the pipeline, kill FIRST the perl DelGet.pl DelGet--0--CONFIG_manipname.pl,
	        and then the other processes started by it

	CONFIG file :
	   This is were you NEED to define the 3 genome locations + gap files, by editing path between the quotes.
		  These gap files list assembly gaps coordinates. Files need to be as UCSC format, and obvisouly name of sequences need to match names of sequences in your genome file.
		  If no gap file is available on UCSC for your assembly, use the provided fasta_get_gaps.pl
		  If you never see in the log file \"gap in this region in gen1 => next random posi\" or \"there are gaps in this region\", then there is an issue with these files, please check format etc.
	   This is were you NEED to define BLAT software location
	   This is were you NEED to define the pipeline parameters
	   Because of 2 different indexing happen, you need to define different location for genomes to extract sequences from. Sym links work.

	OUTPUTS :
	   0) From this pipeline script
		  -> _DelGet.log
			 You WANT to check it. Steps are detailed, as well as files names, checking steps etc.

	   1) FROM SCRIPT DelGet--1--get_regions.pl
		  INSIDE FOLDER Deletions.$c ($c being a counter to avoid erasing previous results since script will be run several times)
		  -> _DelGet--1--get_regions.log
			 You WANT to check it. Steps are detailed, as well as files names, checking steps etc.
		  -> _OKregions.tab
			 Contains all coordinates of anchors in the 3 genomes + distance between anchors [see column titles, pretty explicit]
			 Will be used to avoind overlaps so don't change its name.
		  -> _Gen2.dist.tab and _Gen3.dist.tab
			 Contain only whole regions sizes => usable to plot in R directly
		  -> _OKregions.posi.tab
			 Contains region positions and infos needed to extract and align regions using script DelGet--2--get-sev-seq_align.pl
			 INSIDE FOLDERS Deletions.\$c/data_anchors-posi-fa-blatout and Deletions.\$c/data_highest-scores
			 -> + files containing anchor sequences, positions, blat outputs, highest scores
			 genome index and total length files will be written at genome location, so make sure it is at a location you have writing permissions.
			 file GENOME.XXX.rlenYYY.alenZZZ.infos.tabinfos.tab will be created in \$path [see CONFIG file]
			 [with XXX = number of total regions wanted, YYY = length between anchors and ZZZ = anchor length]

	   2) FROM SCRIPT DelGet--2--get-sev-seq_align.pl
		  INSIDE FOLDER _OKregions.posi.tab.ExtractAlign
		  -> region sequences, .fa and .align.fa (aligned)

	   3) FROM SCRIPT DelGet--3--gapfreq_ak.pl
		  INSIDE FOLDER _OKregions.posi.tab.ExtractAlign.\$c (\$c being a counter to avoid erasing previous results if script is run several times)
		  -> _IDgen.gaps.bed [see CONFID file for IDgen]
			 Contains all gaps: region_name    start_in_aln    end_in_aln    gapID_in_aln    .    strand    gap_len    aln_length
		  -> _IDgen.gaps.specific.bed [see CONFIG file for IDgen]
			 Contains specific gaps. See script itself for more details.


text:
var Speaker = require('speaker');

var speaker = new Speaker({
  channels: 2,
  bitDepth: 16,
  sampleRate: 44100
});

process.stdin.pipe(speaker);


text:
"""Tests for tokenizers."""

from absl.testing import absltest
from rouge import tokenizers

class TokenizersTest(absltest.TestCase):

  def test_default_tokenizer_no_stemmer_init(self):
    tokenizer = tokenizers.DefaultTokenizer(use_stemmer=False)
    self.assertIsInstance(tokenizer, tokenizers.Tokenizer)

    result = tokenizer.tokenize("this is a test")
    self.assertListEqual(["this", "is", "a", "test"], result)

  def test_default_tokenizer_with_stemmer_init(self):
    tokenizer = tokenizers.DefaultTokenizer(use_stemmer=True)
    self.assertIsInstance(tokenizer, tokenizers.Tokenizer)

    result = tokenizer.tokenize("the friends had a meeting")
    self.assertListEqual(["the", "friend", "had", "a", "meet"], result)

if __name__ == "__main__":
  absltest.main()


text:
<?php require_once (ROOT . DS . 'application' . DS . 'views' . DS . 'activity_templates.php'); ?>

Latest news

Followed users

Followed decks

Followed slides

                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="1" class="btn small success filter">Follow activities
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="1" class="btn small success filter">Deck creation
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="0" class="btn small success filter">Slide creation
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="1" class="btn small success filter">Translation activities
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="1" class="btn small success filter">Comments
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="1" class="btn small success filter">Question creation
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'users')" filter="1" class="btn small success filter">Test results

                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'decks')" filter="1" class="btn small success filter">Creation
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'decks')" filter="1" class="btn small success filter">Follow activities
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'decks')" filter="1" class="btn small success filter">Comments
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'decks')" filter="1" class="btn small success filter">Translations

                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'slides')" filter="1" class="btn small success filter">Creation
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'slides')" filter="1" class="btn small success filter">Follow activities
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'slides')" filter="1" class="btn small success filter">Comments
                    <a onclick="applyFilterUserNews($(this), <?php echo $current_user; ?>,'slides')" filter="1" class="btn small success filter">Translations


text:
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>JetBrains.ReSharper.Intentions</name>
    </assembly>
    <members>
        <member name="T:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator">
            <summary>
              The bulb indicator.
            </summary>
        </member>
        <member name="T:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase">
            <summary>
            Base for the two types of popup indicators: bulb indiactor and import popup.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.myTriggerOnMouseUp">
            <summary>
            Bulb dropdown triggers on mouse-down event, and the popup indicator does it on mouse click
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.myWantsResize">
            <summary>
            Fires when the control would like to be reasked of its desired size.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.myAutoActivate">
            <summary>
            <see cref="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.AutoActivate"/>.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.GetDesiredSize(JetBrains.UI.IGraphicsContainer,System.Drawing.Size)">
            <summary>
            Performs the bottom-up layouting stage, when the control calculates its desired size using the given constraints.
            Should give generally the same results as <see cref="T:JetBrains.CommonControls.IConstrainableControl"/>, but could employ the <paramref name="gc"/> device context for the sake of optimization.
            </summary>
            <param name="gc">The device context to measure against.</param>
            <param name="limit">The maximum available space (that could affect the shape of the control, or strip down unnecessary calculations over the invisible items).
            May be a <see cref="T:System.Drawing.Size"/> with width and height equal to <see cref="F:System.Int32.MaxValue"/>, which means that the size is not limited.</param>
            <returns>The desired size, must be no larger than <paramref name="limit"/>.</returns>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.SetLayout(JetBrains.UI.LayoutResult)">
            <summary>
            Tells the control the details about the new layout applied to it by the controlling entity in conjunction with some <see cref="T:JetBrains.UI.IPopupLayouter"/>.
            Typically, the control need not apply the given size and location because that should be done by the controlling entity.
            The control may change its presentation in response to the layouting details, for example, whether it's attached to the top or the bottom of the anchoring rect.
            </summary>
            <param name="layout">The layouting details.</param>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.ShowWithoutActivation">
            <summary>
            Gets a value indicating whether the window will be activated when it is shown.
            </summary>

            <returns>
            True if the window will not be activated when it is shown; otherwise, false. The default is false.
            </returns>

        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.AutoActivate">
            <summary>
            Gets or sets whether the control should be activated initially when it's shown.
            The typical implementation for a form is to return a negative of this value from the <see cref="P:System.Windows.Forms.Form.ShowWithoutActivation"/> override.
            </summary>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicatorBase.WantsResize">
            <summary>
            Fires when the control would like to be reasked of its desired size.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.ArrowGap">
            <summary>
              width of gap between indicator image and down arrow
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.ArrowSize">
            <summary>
              Size of down arrow
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.BorderWidth">
            <summary>
              width of indicator border (hot mode)
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.IndicatorPadding">
            <summary>
              Padding around indicator including border. Used also as a distance from base point to image.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.ShadowExtentBottom">
            <summary>
              extra space required for image shadow frame
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.myColors">
            <summary>
              <see cref="T:JetBrains.UI.PopupMenu.JetPopupMenu"/>
              -compatible colors set.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.myImage">
            <summary>
              Antialiased image for the backgrounded-mode display.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.OnMenuDescribeItem(JetBrains.UI.PopupMenu.DescribeItemEventArgs)">
            <summary>
              Creates the menu item descriptor.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.OnMenuItemClicked(System.Object)">
            <summary>
              Executes an action when a menu item is clicked.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.DrawImageAlpha(System.Drawing.Graphics,System.Single)">
            <summary>
              Display indicator image on a given surface with alpha blending
            </summary>
            <param name="graphics"></param>
            <param name="a"></param>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.RenderGuts">
            <summary>
              Renders just the bulb and the "hot" arrow into a bitmap, without a border and background.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.CollectBulbItems">
            <summary>
              Fills the items-to-actions map and returns the collection of all the items extracted from the actions.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.GetDesiredSize(JetBrains.UI.IGraphicsContainer,System.Drawing.Size)">
            <summary>
              Performs the bottom-up layouting stage, when the control calculates its desired size using the given constraints.
              Should give generally the same results as
              <see cref="T:JetBrains.CommonControls.IConstrainableControl"/>
              , but could employ the
              <paramref name="gc"/>
              device context for the sake of optimization.
            </summary>
            <param name="gc">
              The device context to measure against.
            </param>
            <param name="limit">
              The maximum available space (that could affect the shape of the control, or strip down unnecessary calculations over the invisible items).
              May be a
              <see cref="T:System.Drawing.Size"/>
              with width and height equal to
              <see cref="F:System.Int32.MaxValue"/>
              , which means that the size is not limited.
            </param>
            <returns>
              The desired size, must be no larger than
              <paramref name="limit"/>
              .
            </returns>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.Image">
            <summary>
              Gets the image of this indicator.
            </summary>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.ImageSize">
            <summary>
              Gets the image size, or the default 16?16 size if it has not been specified yet.
            </summary>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Bulbs.BulbIndicator.MouseOver">
            <summary>
              Gets or sets the "hot" control state.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbItemsBuilder.BuildAvailableQuickFixes(JetBrains.ReSharper.Intentions.Bulbs.BulbItemsBuilder.BulbCache,JetBrains.ReSharper.Intentions.Bulbs.VisibleActions)">
            <summary>
            Cannot be done async, since it deals with markup
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.BulbManagerImpl.WaitForDaemon(JetBrains.TextControl.ITextControl)">
            <summary>
            Possibly wait for daemon to update highlighters under caret.
            Returns <c>false</c> if actions should be collected immediately,
            Returncs <c>true</c> if this method will wait for daemon and then collect bulb actions
            </summary>
        </member>
        <member name="T:JetBrains.ReSharper.Intentions.Bulbs.PopupIndicator">
            <summary>
            The blueish popup indicator with icon and text, eg, the "Import Namespace" popup.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Bulbs.PopupIndicator.myHot">
            <summary>
            True whenif the mouse is over the control.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.PopupIndicator.PaintImpl(System.Drawing.Graphics)">
            <summary>
            Does the rendering.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.PopupIndicator.GetDesiredSize(JetBrains.UI.IGraphicsContainer,System.Drawing.Size)">
            <summary>
            Performs the bottom-up layouting stage, when the control calculates its desired size using the given constraints.
            Should give generally the same results as <see cref="T:JetBrains.CommonControls.IConstrainableControl"/>, but could employ the <paramref name="gc"/> device context for the sake of optimization.
            </summary>
            <param name="gc">The device context to measure against.</param>
            <param name="limit">The maximum available space (that could affect the shape of the control, or strip down unnecessary calculations over the invisible items).
            May be a <see cref="T:System.Drawing.Size"/> with width and height equal to <see cref="F:System.Int32.MaxValue"/>, which means that the size is not limited.</param>
            <returns>The desired size, must be no larger than <paramref name="limit"/>.</returns>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.PopupIndicator.OnMouseEnter(System.EventArgs)">
            <summary>
            Raises the <see cref="E:System.Windows.Forms.Control.MouseEnter"></see> event.
            </summary>

            <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data. </param>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Bulbs.PopupIndicator.OnMouseLeave(System.EventArgs)">
            <summary>
            Raises the <see cref="E:System.Windows.Forms.Control.MouseLeave"></see> event.
            </summary>

            <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data. </param>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.ContextActionInfo.ToString">
            <summary>
            Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
            </summary>

            <returns>
            A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
            </returns>
            <filterpriority>2</filterpriority>
        </member>
        <member name="T:JetBrains.ReSharper.Intentions.Explanatory.CodeInspectionWikiProvider">
            <summary>
            Provides bulb items that offer to explain why ReSharper is
            issuing a particular warning or suggestion.
            </summary>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.ContextActions.SurroundWithQuotesActionBase.Text">
            <summary>
            Gets the text.
            </summary>
            <value>The text.</value>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.ContextActions.UseStringEmptyActionBase.Text">
            <summary>
            Gets the text.
            </summary>
            <value>The text.</value>
        </member>
        <member name="T:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase">
            <summary>
            A page with the list of enablable context actions.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.ourHtmlCueBannerNoDescriptionAvailable">
            <summary>
            The "no description" cue banner to show instead of the description text when there is none.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.ourHtmlCueBannerNoSelection">
            <summary>
            The "no selection" cue banner to occupy the empty space under the list when nothing is selected.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.ourHtmlPreviewResourceName">
            <summary>
            The HTML resource with the preview area template.
            </summary>
        </member>
        <member name="F:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.mySelectedItem">
            <summary>
            The selected context actions in the context actions tree.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.SaveContextActionsCheckState">
            <summary>
            Reads from the <see cref="F:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.myMapContextActionToCheckState"/>, writes to the settings.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.WndProc(System.Windows.Forms.Message@)">
            <summary>
            Processes Windows messages.
            </summary>

            <param name="msg">The Windows <see cref="T:System.Windows.Forms.Message"></see> to process. </param>
        </member>
        <member name="P:JetBrains.ReSharper.Intentions.Options.ContextActionsPageBase.Id">
            <summary>
            Gets the ID of this option page.
            <see cref="T:JetBrains.UI.Options.OptionsManager"/> or <see cref="T:JetBrains.UI.Options.IOptionsDialog"/> could be used to retrieve the <see cref="T:JetBrains.UI.Options.OptionsPageDescriptor"/> out of it.
            </summary>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Legacy.ContextActionBase.IsAvailableInternal">
            <summary>
            Called to check if ContextAction is available.
            ReadLock is taken
            Will not be called if PsiManager, ProjectFile of Solution == null
            </summary>
            <returns></returns>
        </member>
        <member name="M:JetBrains.ReSharper.Intentions.Legacy.ContextActionBase.ExecuteInternal(System.Object[])">
            <summary>
            Called to apply context action. No locks is taken before call
            </summary>
        </member>
    </members>
</doc>


text:
package org.vaadin.gridutil.client.renderer.buttonvalue;

/**
 * create the HTML for an view and delete button
 *
 * @author Marten Prieß (http://www.rocketbase.io)
 * @version 1.0
 */
public class VViewDeleteButtonValueRenderer extends VButtonValueRenderer {

	public VViewDeleteButtonValueRenderer() {
		super(VButtonValueRenderer.VIEW_BITM | VButtonValueRenderer.DELETE_BITM);
	}

}


text:
describe("KnockoutExtend.phone", function () {

    it("Read visual element", function (done) {

        var phoneValue = $('#phoneValue');
        var anotherPhoneValue = $('#anotherPhoneValue');
        var countryPhoneValue = $('#phoneCountryValue');

        expect($(phoneValue).val()).toBe('(79) 9199-9401');
        expect($(anotherPhoneValue).val()).toBe('(19) 9321-4321');
        expect($(countryPhoneValue).val()).toBe('15 (79) 9199-9401');

        done();
    });

    it("Change values by knockout", function (done) {

        var phoneValue = $('#phoneValue');
        var anotherPhoneValue = $('#anotherPhoneValue');
        var countryPhoneValue = $('#phoneCountryValue');

        viewModel.PhoneValue('7932315201');
        expect($(phoneValue).val()).toBe('(79) 3231-5201');

        viewModel.AnotherPhoneValue('1912345678');
        expect($(anotherPhoneValue).val()).toBe('(19) 1234-5678');

        viewModel.PhoneCountryValue('157932315201');
        expect($(countryPhoneValue).val()).toBe('15 (79) 3231-5201');

        done();
    });

});


text:
package com.vmware.o11n.plugin.cache.service.hazelcast;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.vmware.o11n.plugin.cache.hazelcast.HazelcastInstanceWrapper;
import com.vmware.o11n.plugin.cache.service.IdGeneratorService;

@Component
public class HazelcastIdGeneratorService implements IdGeneratorService {

    @Value("#{systemProperties['cache-plugin.default.generator.name'] ?: 'vro_default_id_generator'}")
    private String defaultIdGeneratorName;

    @Autowired
    private HazelcastInstanceWrapper hazelcastWrapper;

    @Override
    public long newIdForGenerator(String generatorName) {
        return hazelcastWrapper.getInstance().getIdGenerator(generatorName).newId();
    }

    @Override
    public long newId() {
        return newIdForGenerator(defaultIdGeneratorName);
    }
}


text:
<?php

namespace instantjay\oauthphp\Exceptions;

class RejectedAuthException extends \Exception {

}


text:
package emulatorinterface.translator.x86.instruction;

import emulatorinterface.translator.InvalidInstructionException;
import emulatorinterface.translator.x86.registers.TempRegisterNum;
import generic.Operand;
import generic.InstructionList;

public class ExchangeAndAdd implements X86StaticInstructionHandler
{
	public void handle(long instructionPointer,
			Operand operand1, Operand operand2, Operand operand3,
			InstructionList instructionArrayList,
			TempRegisterNum tempRegisterNum)
					throws InvalidInstructionException
	{
		//TODO Check if the add should be performed before exchange ??
		Exchange exchange = new Exchange();
		exchange.handle(instructionPointer, operand1, operand2, operand3, instructionArrayList, tempRegisterNum);

		//Perhaps the order will now change.
		IntegerALUImplicitDestination addOperation = new IntegerALUImplicitDestination();
		addOperation.handle(instructionPointer, operand2, operand1, operand3, instructionArrayList, tempRegisterNum);
	}
}


text:
========================
Team and repository tags
========================

.. image:: https://governance.openstack.org/tc/badges/neutron-fwaas.svg
    :target: https://governance.openstack.org/tc/reference/tags/index.html

.. Change things from this point on

Welcome!
========

This package contains the code for the Neutron Firewall as a Service
(FWaaS) service. This package requires Neutron to run.

External Resources:
===================

The homepage for Neutron is: https://launchpad.net/neutron.  Use this
site for asking for help, and filing bugs. We use a single Launchpad
page for all Neutron projects.

Code is available on git.openstack.org at:
<https://opendev.org/openstack/neutron-fwaas>.

Please refer to Neutron documentation for more information:
`Neutron README.rst <https://opendev.org/openstack/neutron/src/branch/master/README.rst>`_

Get release notes:
`Neutron FWaaS Release Notes <https://docs.openstack.org/releasenotes/neutron-fwaas/>`_


text:
import * as mongoose from "mongoose";
import { Model } from "mongoose";
import { Schema } from "mongoose";
import { Currency } from "../constants";

var xPensionSchema: Schema = new mongoose.Schema({              // = money purchase   /// = defined benefits
    pensionType: String,                        /////   Pension Type [ Money Purchase | Defined Benefits ]
    providerName: String,                       /////   Provider Name
    planType: String,                           /////   Plan Type
    policyNumber: String,                       /////   Policy Number
    planJoinDate: Date,                         /////   Plan Join Date
    status: String,                             /////   Status
    planRetirementAge: Number,                  /////   Plan / Scheme Retirement Age
    personalContribution: Number,               /////   Personal Contribution
    contributionFrequency: String,              /////   Contribution Frequency
    totalPersonalContribution: Number,          //      Total Personal Contribution
    assetPreservationTrust: Boolean,            /////   Is existing DIS Benefit in an Asset Preservation Trust?
    contractedOut: Boolean,                     /////   Contracted out?
    planStartDate: Date,                        //      Plan Start Date
    planLeaveDate: Date,                        ///     Plan Leave Date
    extraYears: Number,                         ///     Extra years credited from transfer
    companyJoinDate: Date,                      ///     Company Join Date
    valuationAmount: Number,                    //      Valuation
    taxFreeCurrentValue: Number,                //      Tax Free Cash Current Value
    valuationDate: Date,                        //      Valuation Date
    employerContribution: Number,               //      Employer Contribution
    totalEmployerContribution: Number,          //      Total Employer Contribution
    waiver: String,                             //      Yes | No | No but can be added | N/A | Unknown
    coverLevel: String,                         //      Level Of Life Cover Provided
    lumpSum: String,                            //      Lump Sum Death Benefit = [ Return of Premium | Return of Fund | Premium with Interest | No Return ]
    deathInServiceLumpSum: String,              ///     Death in Service Lump Sum Benefit
    guaranteedMinimum: Number,                  //      Guaranteed Minimum

    paidUpDate: Date,                           //      If paid up from when?
    transferValue: Number,                      //      Transfer Value
    transferDate: Date,                         //      Date Of Transfer
    protectedRights: String,                    //      Protected Rights
    nonProtectedRights: String,                 //      Non-Protected Rights
    pensionableEarnings: Number,                ///     Scheme Pensionable Earnings
    pensionIncreaseRate: String,                ///     Pension Increase Rate
    spousePension: String,                      ///     Spouse Pension
    dependantPension: String,                   ///     Dependant Pension
    currency: Number,

    createdAt: Date,
    contactId: String,
    accountId: String,
    userId: String,
    adviserId: String
})

interface IXPension {
    pensionType: String;                        /////   Pension Type [ Money Purchase | Defined Benefits ]
    providerName: String;                       /////   Provider Name
    planType: String;                           /////   Plan Type
    policyNumber: String;                       /////   Policy Number
    planJoinDate: Date;                         /////   Plan Join Date
    status: String;                             /////   Status
    planRetirementAge: Number;                  /////   Plan / Scheme Retirement Age
    personalContribution: Number;               /////   Personal Contribution
    totalPersonalContribution: Number;          //      Total Personal Contribution
    contributionFrequency: String;              /////   Contribution Frequency
    assetPreservationTrust: Boolean;            /////   Is existing DIS Benefit in an Asset Preservation Trust?
    contractedOut: Boolean;                     /////   Contracted out?
    planStartDate: Date;                        //      Plan Start Date
    planLeaveDate: Date;                        ///     Plan Leave Date
    extraYears: Number;                         ///     Extra years credited from transfer
    companyJoinDate: Date;                      ///     Company Join Date
    valuationAmount: Number;                    //      Valuation
    taxFreeCurrentValue: Number;                //      Tax Free Cash Current Value
    vaulationDate: Date;                        //      Valuation Date
    employerContribution: Number;               //      Employer Contribution
    totalEmployerContribution: Number;          //      Total Employer Contribution
    waiver: String;                             //      Yes | No | No but can be added | N/A | Unknown
    coverLevel: String;                         //      Level Of Life Cover Provided
    lumpSum: String;                            //      Lump Sum Death Benefit = [ Return of Premium | Return of Fund | Premium with Interest | No Return ]
    deathInServiceLumpSum: String;              ///     Death in Service Lump Sum Benefit
    guaranteedMinimum: Number;                  //      Guaranteed Minimum

    paidUpDate: Date;                           //      If paid up from when?
    transferValue: Number;                      //      Transfer Value
    transferDate: Date,                         //      Date Of Transfer
    protectedRights: String,                    //      Protected Rights
    nonProtectedRights: String,                 //      Non-Protected Rights
    pensionableEarnings: Number,                ///     Scheme Pensionable Earnings
    pensionIncreaseRate: String,                ///     Pension Increase Rate
    spousePension: String,                      ///     Spouse Pension
    dependantPension: String,                   ///     Dependant Pension
    currency: Number,

    createdAt: Date,
    contactId: String,
    accountId: String,
    userId: String,
    adviserId: String
}

interface IXPensionModel extends IXPension, mongoose.Document {

}

export var XPension: Model<IXPensionModel> = mongoose.model<IXPensionModel>("XPension", xPensionSchema);


text:
module ShouldaMatchmakers
  module Model
    module ActiveRecord
      module Matchmaker
        module AcceptNestedAttributesFor

          def accept_nested_attributes_for_matcher_tests
            nested_attributes_options = @app_class_name.constantize.nested_attributes_options
            if nested_attributes_options.present?
              generate_accept_nested_attributes_for_matcher_tests(nested_attributes_options)
            else
              []
            end
           end

          private

          def generate_accept_nested_attributes_for_matcher_tests(nested_attributes_options)
            nested_attributes_tests = []
            nested_attributes_options.map do |class_name, options|
              nested_attributes_class_name = class_name.to_s
              nested_attributes_options = trim_options(options)
              nested_attributes_test = generate_nested_attributes_test(nested_attributes_class_name, nested_attributes_options)
              nested_attributes_tests = append_element(nested_attributes_test, nested_attributes_tests)
            end
            format_tests(nested_attributes_tests)
          end

          def generate_nested_attributes_test(nested_attributes_class_name, nested_attributes_options)
            nested_attributes_test = generate_nested_attributes_test_single_line(nested_attributes_class_name, nested_attributes_options)
            if nested_attributes_test.length > @working_generated_code_line_length
              nested_attributes_test = generate_nested_attributes_test_multiple_lines(nested_attributes_class_name, nested_attributes_options)
            end
            nested_attributes_test
          end

          def generate_nested_attributes_test_single_line(nested_attributes_class_name, nested_attributes_options)
            nested_attributes_test = "  it { is_expected.to accept_nested_attributes_for(:#{ nested_attributes_class_name })"
            nested_attributes_options_string = get_options_string(nested_attributes_options)
            nested_attributes_test.concat(nested_attributes_options_string + " }")
            nested_attributes_test
          end

          def generate_nested_attributes_test_multiple_lines(nested_attributes_class_name, nested_attributes_options)
            nested_attributes_test = "  it do\n    is_expected.to accept_nested_attributes_for(:#{ nested_attributes_class_name })"
            nested_attributes_options_string = get_options_string(nested_attributes_options)
            nested_attributes_options_string = nested_attributes_options_string.gsub(".", ".\n      ")
            nested_attributes_test.concat(nested_attributes_options_string + "\n  end")
            nested_attributes_test
          end

          def trim_options(options)
            options_untrimmed = options.dup
            options_trimmed = {}
            options_untrimmed.delete(:allow_destroy) if options[:allow_destroy].to_s == "false"
            options_untrimmed.delete(:update_only)   if options[:update_only].to_s   == "false"
            options_trimmed.merge(options_untrimmed)
          end

        end
      end
    end
  end
end


text:
import StyleParser from '../style_parser';
import {Polygons} from '../polygons/polygons';

export let RasterStyle = Object.create(Polygons);

Object.assign(RasterStyle, {
    name: 'raster',
    super: Polygons,
    built_in: true,

    init() {
        // Required for raster tiles
        this.raster = this.raster || 'color';

        this.super.init.apply(this, arguments);

        this.selection = false; // raster styles can't support feature selection
    },

    _preprocess (draw) {
        // Raster tiles default to white vertex color, as this color will tint the underlying texture
        draw.color = draw.color || StyleParser.defaults.color;
        return this.super._preprocess.apply(this, arguments);
    }

});


text:
package com.digitalplay.network.ireader.common.repository;

import java.lang.annotation.*;

/**
 * 开启查询缓存
 *
 * @author Zhang Kaitao
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface EnableQueryCache {

    boolean value() default true;

}


text:
const gameplayConfig = {
  isActive: true,
  lastRound: 3,
  currentRound: 0,
  answersSubmitted: false
};

const gameplay = (state = gameplayConfig, action) => {
  switch (action.type) {
    case "SUBMIT":
      const isGameOver = state.currentRound === state.lastRound;
      return {
        ...state,
        isActive: !isGameOver,
        currentRound: isGameOver ? 4 : state.currentRound,
        answersSubmitted: true
      };
    case "START_NEXT_ROUND":
      return {
        ...state,
        currentRound: state.currentRound + 1,
        answersSubmitted: false
      };
    case "START_NEW_GAME":
      return {
        ...gameplayConfig
      };

    default:
      return state;
  }
};

export default gameplay;


text:
.. _ovn_ovn:

===============
OVN information
===============

The original OVN project announcement can be found here:

* https://networkheresy.com/2015/01/13/ovn-bringing-native-virtual-networking-to-ovs/

The OVN architecture is described here:

* http://www.ovn.org/support/dist-docs/ovn-architecture.7.html

Here are two tutorials that help with learning different aspects of OVN:

* https://blog.spinhirne.com/posts/an-introduction-to-ovn/a-primer-on-ovn/
* https://docs.ovn.org/en/stable/tutorials/ovn-sandbox.html

There is also an in depth tutorial on using OVN with OpenStack:

* https://docs.ovn.org/en/stable/tutorials/ovn-openstack.html

OVN DB schemas and other man pages:

* http://www.ovn.org/support/dist-docs/ovn-nb.5.html
* http://www.ovn.org/support/dist-docs/ovn-sb.5.html
* http://www.ovn.org/support/dist-docs/ovn-nbctl.8.html
* http://www.ovn.org/support/dist-docs/ovn-sbctl.8.html
* http://www.ovn.org/support/dist-docs/ovn-northd.8.html
* http://www.ovn.org/support/dist-docs/ovn-controller.8.html
* http://www.ovn.org/support/dist-docs/ovn-controller-vtep.8.html

or find a full list of OVS and OVN man pages here:

* http://docs.ovn.org/en/latest/ref/

The openvswitch web page includes a list of presentations, some of which are
about OVN:

* http://openvswitch.org/support/

Here are some direct links to past OVN presentations:

* `OVN talk at OpenStack Summit in Boston, Spring 2017
  <https://www.youtube.com/watch?v=sgc7myiX6ts>`_
* `OVN talk at OpenStack Summit in Barcelona, Fall 2016
  <https://www.youtube.com/watch?v=q3cJ6ezPnCU>`_
* `OVN talk at OpenStack Summit in Austin, Spring 2016
  <https://www.youtube.com/watch?v=okralc7LrZo>`_
* OVN Project Update at the OpenStack Summit in Tokyo, Fall 2015 -
  `Slides <http://openvswitch.org/support/slides/OVN_Tokyo.pdf>`__ -
  `Video <https://www.youtube.com/watch?v=3IrG2xghJjs>`__
* OVN at OpenStack Summit in Vancouver, Sping 2015 -
  `Slides <http://openvswitch.org/support/slides/OVN-Vancouver.pdf>`__ -
  `Video <https://www.youtube.com/watch?v=kEzXTq2fPDg>`__
* `OVS Conference 2015 <https://www.youtube.com/watch?v=JLGZOYi_Cqc>`_

These blog resources may also help with testing and understanding OVN:

* http://networkop.co.uk/blog/2016/11/27/ovn-part1/
* http://networkop.co.uk/blog/2016/12/10/ovn-part2/
* https://blog.russellbryant.net/2016/12/19/comparing-openstack-neutron-ml2ovs-and-ovn-control-plane/
* https://blog.russellbryant.net/2016/11/11/ovn-logical-flows-and-ovn-trace/
* https://blog.russellbryant.net/2016/09/29/ovs-2-6-and-the-first-release-of-ovn/
* http://galsagie.github.io/2015/11/23/ovn-l3-deepdive/
* http://blog.russellbryant.net/2015/10/22/openstack-security-groups-using-ovn-acls/
* http://galsagie.github.io/sdn/openstack/ovs/2015/05/30/ovn-deep-dive/
* http://blog.russellbryant.net/2015/05/14/an-ez-bake-ovn-for-openstack/
* http://galsagie.github.io/sdn/openstack/ovs/2015/04/26/ovn-containers/
* http://blog.russellbryant.net/2015/04/21/ovn-and-openstack-status-2015-04-21/
* http://blog.russellbryant.net/2015/04/08/ovn-and-openstack-integration-development-update/
* http://dani.foroselectronica.es/category/openstack/ovn/