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

	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<meta name="author" content="Josh Coalson" />
	<meta name="description" content="A free, open source codec for lossless audio compression and decompression" />
	<meta name="keywords" content="free,lossless,audio,codec,encoder,decoder,compression,compressor,archival,archive,archiving,backup,music" />
	<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
	<link rel="stylesheet" type="text/css" href="flac.css" />
	<title>FLAC - faq</title>

	 home  |
	 faq  |
	 documentation  |
	 developers  |
	 changelog  |
	 more

		faq

		General

				What is FLAC?

				I have a FLAC file, how do I play it?

				How can I create FLAC files?

				What licensing applies to the FLAC format and software?

				What kinds of tags does FLAC support?

				What software support FLAC?

				How can I play FLAC in Windows Media Player?

				What hardware products support FLAC?

				What is the difference between (native) FLAC and Ogg FLAC?

				Which should I use, (native) FLAC or Ogg FLAC?

				Why aren't PERFORMER/TITLE/etc tags stored in the FLAC CUESHEET block?

				Why doesn't FLAC store all WAVE metadata?

				If flac compresses WAVE files, why isn't it technically a WAVE file compressor?

				Why do some lossless comparisons say FLAC does not support RIFF chunks?

				Why do the encoder settings have a big effect on the encoding time but not the decoding time?

				Why use FLAC instead of other codecs that compress more?

				Why can't you make FLAC encode faster?

				How can I be sure FLAC is lossless?

				How much testing has been done on FLAC?

				What is the lowest bitrate (or highest compression) achievable with FLAC?

				How many channels does FLAC support?

				What kind of audio samples does FLAC support?

				Will FLAC ever support floating-point samples?

		Tools

				How do I set up EAC to rip directly to FLAC?

				Why am I getting "Run-time error '75': Path/File access error" with FLAC Frontend?

				How do I encode a file that starts with a dash?

				Why does it take so long to edit some FLAC files with metaflac?

				Why don't Unicode file names work with flac/metaflac on Windows?

				Why don't wildcards for file names like *.flac or *.wav work with flac/metaflac on Windows?

				I compressed a file to FLAC with verify on, and flac said "Verify FAILED!"  Why?

				I compressed a WAVE file to FLAC, then decompressed to WAVE, and the two weren't identical.  Why?

				I compressed a WAVE file to FLAC and it said "warning: skipping unknown sub-chunk LIST".  Why?

				I decoded a FLAC file and the WAVE is 2 bytes shorter than the original.  Why?

				Why did I get "ERROR initializing encoder, state = FLAC__STREAM_ENCODER_NOT_STREAMABLE"?

				Why doesn't the same file compressed on different machines with the same options yield the same FLAC file?

		API

				Why does your API change for point releases?

				How can I determine the encoded frame length?

		Project

				Where are the mailing lists, forums, discussion areas, etc.?

				How do I submit a bug report?

			General

		What is FLAC?

		FLAC stands for Free Lossless Audio Codec, an audio format similar to MP3, but lossless, meaning that audio is compressed in FLAC without any loss in quality.  This is similar to how Zip works, except with FLAC you will get much better compression because it is designed specifically for audio, and you can play back compressed FLAC files in your favorite player (or your car or home stereo, see supported devices) just like you would an MP3 file.

		For more details, see What is FLAC?

		I have a FLAC file, how do I play it?

		How can I create FLAC files?

		See Using FLAC.

		What licensing applies to the FLAC format and software?

		See the license page.

		What kinds of tags does FLAC support?

		FLAC has it's own native tagging system which is identical to that of Vorbis.  They are called alternately "FLAC tags" and "Vorbis comments".  It is the only tagging system required and guaranteed to be supported by FLAC implementations.

		Out of convenience, the reference decoder knows how to skip ID3 tags so that they don't interfere with decoding.  But you should not expect any tags beside FLAC tags to be supported in applications; some implementations may not even be able to decode a FLAC file with ID3 tags.

		What software support FLAC?

		This list is so large now it is difficult to maintain and keep up-to-date.  For a partial list of open-source software that supports FLAC, see the software section of the links page.  For a partial list of the most popular software used to encode, decode, play, tag, and rip FLAC files, see the download page.

		How can I play FLAC in Windows Media Player?

		See this guide.

		What hardware products support FLAC?

		See the hardware section of the links page.

		What is the difference between (native) FLAC and Ogg FLAC?

		You can think of an audio codec as having two layers.  The inside layer is the raw compressed data, and the outside layer is the "container" or "transport layer" that splits and arranges the compressed data in pieces so it can be seeked through, edited, etc.

		"Native" FLAC is the compressed FLAC data stored in a very minimalist container, designed to be very efficient at storing single audio streams.

		Ogg FLAC is the compressed FLAC data stored in an Ogg container.  Ogg is a much more powerful transport layer that enables mixing several kinds of different streams (audio, data, metadata, etc).  The overhead is slightly higher than with native FLAC.

		In either case, the compressed FLAC data is the same and one can be converted to the other without re-encoding.

		Which should I use, (native) FLAC or Ogg FLAC?

		The short answer right now is probably "native FLAC".  If all you are doing is compressing audio to be played back later, native FLAC will do everything you need, is more widely supported, and will yield smaller files.  If you plan to edit the compressed audio, or want to multiplex the audio with video later in an Ogg container, Ogg FLAC is a better choice.

		Why aren't PERFORMER/TITLE/etc tags stored in the FLAC CUESHEET block?

		This has turned out to be a pretty polarizing issue and requires a long explanation.

		The original purpose of a cue sheet in CD authoring software was to lay out the disc, essentially specifying how the audio will be organized on the disc; some of the information ends up as the CD table of contents: the track numbers and locations, and the index points.  Later CD-TEXT was added.  But CD-TEXT is a very complex spec, and actually goes in the CD subcode data.  It is internationalized, not through Unicode, but with several different character sets, some of them multi-byte.  It even allows for graphics.  In cue sheets, the TITLE/PERFORMER/etc tags are just a limited shorthand for authoring CD-TEXT, but when you rip, you almost never parse the CD-TEXT, you get it from another database, and it doesn't really belong in the FLAC CUESHEET block.

		For FLAC the intention is that applications can calculate the CDDB or CDindex ID from the CUESHEET block and look it up in an online or local database just like CD rippers and players do.  But if you really want it in the file itself, the track metadata should be stored separate from the CUESHEET, and already can be because of FLAC's metadata system.  There just isn't a method specified yet because as soon as it is, people will say that it's not flexible enough.  From experience (and you can see this come up time and time again in many lists), anyone who is going to the trouble of keeping a lossless collection in the first place will already be picky about metadata, and it is hard to come up with a standard that will please even the majority.  That is the big problem with metadata and is why Xiph has deferred on it, waiting for someone to come up with a good metadata spec that can be multiplexed together with data.

		Some players (for example Foobar2000) allow you to store the CDDB data as FLAC tags and can parse that.

		Why doesn't FLAC store all WAVE metadata?

		If flac compresses WAVE files, why isn't it technically a WAVE file compressor?

		(By default, flac does not store WAVE metadata, but it can with the --keep-foreign-metadata option described below.)

		FLAC is a general-purpose audio format, not just a compressed WAVE file format.  There's a subtle difference.  WAVE is a complicated standard; many kinds of data besides audio data can be put in it.  FLAC's purpose is not to reproduce a WAVE file, including all the non-audio data that is in it, it is to losslessly compress the audio.

		However, if you really need to store the non-audio parts of a WAVE or AIFF file, you can use the --keep-foreign-metadata option to flac when encoding to store it in FLAC metadata, then use the option again when decoding to restore in to the decoded WAVE/AIFF file.

		Why do some lossless comparisons say FLAC does not support RIFF chunks?

		This is a limitation that no longer exists with FLAC (see above).

		Why do the encoder settings have a big effect on the encoding time but not the decoding time?

		It's hard to explain without going into the codec design, but to oversimplify, the encoder is looking for functions that approximate the signal.  Higher settings make the encoder search more to find better approximations.  The functions are themselves encoded in the FLAC file.  Decoding only requires computing the one chosen function, and the complexity of the function is very stable.  This is by design, to make decoding easier, and is one of the things that makes FLAC easy to implement in hardware.

		Why use FLAC instead of other codecs that compress more?

		For most users, a small difference in filesize is usually far outweighed by FLAC's advantages: open patent free codec, portable open source (BSD) reference implementation, documented API, multi-platform support, hardware support, multi-channel support, etc.  Improving FLAC to get a little more compression is not worth making it more complex and more compute-intensive to decode, and hence, less likely to be supported in hardware.

		Why can't you make FLAC encode faster?

		FLAC already encodes pretty fast.  It is faster than real-time even on weak systems and is not much slower than even the fastest codecs.  And it is faster than the CD ripping process with which it is usually paired, meaning even if it went faster, it would not speed up the ripping-encoding process anyway.

		Part of the reason is that FLAC is asymmetric (see also).  That means that it is optimized for decoding speed at the expense of encoding speed, because it makes it easier to decode on low-powered hardware, and because you only encode once but you decode many times.

		How can I be sure FLAC is lossless?

		How much testing has been done on FLAC?

		First, FLAC is probably the only lossless compressor that has a published and comprehensive test suite.  With the others you rely on the author's personal testing or the longevity of the program.  But with FLAC you can download the whole test suite and run it on any version you like, or alter it to test your own data.  The test suite checks every function in the API, as well as running many thousands of streams through an encode-decode-verify process, to test every nook and cranny of the system.  Even on a fast machine the full test suite takes hours.  The full test suite must pass on several platforms before a release is made.

		Second, you can always use the -V option with flac (also supported by most GUI frontends) to verify while encoding.  With this option, a decoder is run in parallel to the encoder and its output is compared against the original input.  If a difference is found flac will stop with an error.

		Finally, FLAC is used by many people and has been judged stable enough by many software and hardware makers to be incorporated into their products.

		What is the lowest bitrate (or highest compression) achievable with FLAC?

		With FLAC you do not specify a bitrate like with some lossy codecs.  It's more like specifying a quality with Vorbis or MPC, except with FLAC the quality is always "lossless" and the resulting bitrate is roughly proportional to the amount of information in the original signal.  You cannot control the bitrate much and the result can be from around 100% of the input rate (if you are encoding noise), down to almost 0 (encoding silence).

		How many channels does FLAC support?

		FLAC supports from 1 to 8 channels per stream.  Channels are only grouped in FLAC to take advantage of interchannel correlation and to define common channel assignments (like stereo L/R, 5.1 surround, et cetera).  When encoding a large number of independent channels it is expected that they are coded separately and if required, multiplexed together in a suitable container like Ogg or Matroska.

		What kind of audio samples does FLAC support?

		FLAC supports linear PCM samples with a resolution between 4 and 32 bits per sample.  FLAC does not support floating point samples.  In some cases it is possible to losslessly transform samples from an incompatible range to a FLAC-compatible range before encoding.

		FLAC supports linear sample rates from 1Hz - 655350Hz in 1Hz increments.

		Will FLAC ever support floating-point samples?

		It's unlikely FLAC will ever support floating-point samples natively.  The main application for floating-point is audio engineering, which demands easy editing and very high speed for both encoding and decoding above everything else.

		FLAC is designed as a consumer audio format.  It trades ease of editing for a featureful, robust transport layer more suited for playback, and encoding speed for more compression and faster decompression.

			Tools

		How do I set up EAC to rip directly to FLAC?

		See Case's excellent EAC configuration page.  Or use AutoFLAC, Omni Encoder, or MAREO to rip to FLAC or multiple formats at once.

		Why am I getting "Run-time error '75': Path/File access error" with FLAC Frontend?

		Depending on how FLAC Frontend is installed, it could be one of two things: 1) you are trying to encode to file to a directory where you do not have write permission; 2) the FLAC Frontend program must be set to run as Administrator by opening Windows Explorer, navigating to C:\Program Files\FLAC (or wherever FLAC was installed), then right-clicking on FLAC Frontend.exe and checking "Run this program as an administrator".

		How do I encode a file that starts with a dash?

		When using flac to encode on the command-line, a file that starts with a dash will be treated as an option, but there is a simple workaround.  Use -- to signal the end of options and the beginning of filenames, like so:

		flac -V -- -01-name.wav

		Why does it take so long to edit some FLAC files with metaflac?

		Since metadata is stored at the beginning of a FLAC file, changing the length of it can sometimes cause the whole file to be rewritten.  You can avoid this by adding padding with flac when you encode, or with metaflac after encoding.  By default, flac adds 8k of padding; you can change this amount if you need more or less.

		Why don't Unicode file names work with flac/metaflac on Windows?

		Windows implements Unicode filenames differently than all other operating systems, and can only be supported via Windows APIs (non-portable).  Also the method is different for different versions of Windows.  It's so hard to get right that most programs that have to work for other operating systems also do not support it.  A workaround can be found here.

		Why don't wildcards for file names like *.flac or *.wav work with flac/metaflac on Windows?

		The Windows command shells (cmd.exe, command.com) implement wildcard handling differently than most other shells, leaving it up to the program to do everything including difficult and ambiguous cases.  For an explanation of why wildcards on cmd.exe/command.com are dangerous, see here.  Better command shells for Windows exist, e.g. from Cygwin.  A workaround with the Windows shells is to do something like:

		<tt>for %F in (*.wav) do flac "%F"</tt>

		but care must still be taken that the command will execute as intended.

		I compressed a file to FLAC with verify on, and flac said "Verify FAILED!"  Why?

		The only known cause of verify errors is faulty hardware.  The dead giveaway is that if you repeat the exact same command, the error occurs in a different place or not at all.  This can also happen when decoding or testing a FLAC file.  If this is happening it is your hardware and not a FLAC bug.

		The problem is usually caused by overclocking/overheating the CPU or bad RAM.  Try one of the many free programs available for testing hardware (e.g. Memtest86+).  We have had reports of a few cases where a system is passing with flying colors and still getting unrepeatable FLAC errors, and the one thing many (all?) of these systems have in common is an ASUS motherboard (A7V133 or P3V4X) which we suspect is buggy in some way.  (See also)

		If you ever have a verify error that fails at the same place every time, please file a bug, uploading a sample according to the instructions found at the bottom of this bug report.

		I compressed a WAVE file to FLAC, then decompressed to WAVE, and the two weren't identical.  Why?

		I compressed a WAVE file to FLAC and it said "warning: skipping unknown sub-chunk LIST".  Why?

		WAVE is a complicated standard; many kinds of data besides audio data can be put in it.  Most likely what has happened is that the application that created the original WAVE file also added some extra information for it's own use, which FLAC does not store or recreate by default (but can with the --keep-foreign-metadata option) (see also).  The audio data in the two WAVE files will be identical.  There are other tools to compare just the audio content of two WAVE files; ExactAudioCopy has such a feature.

		For the more technically inclined, by default FLAC only stores what is in the 'fmt ' and 'data' sub-chunks of a WAVE file.  (see also)

		I decoded a FLAC file and the WAVE is 2 bytes shorter than the original.  Why?

		The difference is probably that between an 18-byte 'fmt ' subchunk in the original WAVE vs. a 16-byte one in the decoded WAVE.  With WAVE there is more than one way to write identical formatting information, but FLAC always writes the most common legal form.  (see also)

		Why did I get "ERROR initializing encoder, state = FLAC__STREAM_ENCODER_NOT_STREAMABLE"?

		You specified encoding options that are outside the Streamable subset.  If that is what you really wanted and you understand the consequences, you can use flac --lax to generate a non-Subset stream.  The resulting file may not be streamable or play in all players.

		Why doesn't the same file compressed on different machines with the same options yield the same FLAC file?

		It's not supposed to, and neither does it mean either encoding was bad.  There are many variations between different machines or even different builds of flac on the same machine that can lead to small differences in the FLAC file, even if they have the exact same final size.  This is normal.

			API

		Why does your API change for point releases?

		The FLAC release numbering scheme of MAJOR.MINOR.MICRO reflects the state of the FLAC format, not the API.  This is most intuitive for users, at the expense of flustering developers.  The shared library number (derived from the libtool current:revision:age number) is the indicator of binary API compatibility.  As of FLAC 1.1.3, the current, revision, and age numbers are also <tt>#define</tt>d in the library headers to make porting easier; see the porting guide.

		How can I determine the encoded frame length?

		With native FLAC, it is not possible to determine the frame length without decoding.  Probably if I had it all to do again I would have constrained the possible block sizes, which would have made it more practical to put the frame length in the frame header.  For an example of how to find the frame boundaries in a stream, see the source code to metaflac, in the functionality that adds seek points.

		With Ogg FLAC, it can be calculated from the Ogg page header.

			Project

		Where are the mailing lists, forums, discussion areas, etc.?

		There are a few places.  The main discussions happen on the official FLAC mailing lists (you must subscribe to post).  Also, there is a lot of discussion relating to FLAC on Hydrogen Audio.

		How do I submit a bug report?

		First, visit the bug tracking page and do a little searching of both open and closed bugs to see if yours is already there.  If you have something truly new submit a new bug there.  Make sure to monitor the bug or include your email address in the description.  Include as much information as possible: the version of FLAC that you are running, the name and version of any frontend you are running, your operating system and version, your CPU type and speed, the amount of memory you have, where you downloaded FLAC from, the exact error message (if any) copied from the console, and anything else you may think will help.

				 Copyright (c) 2000-2009  Josh Coalson, 2011-2013 Xiph.Org Foundation


text:
"""Handle configs from program name"""

from typing import Optional
from typing import List

from pysyte import __file__ as path_to_pysyte
from pysyte.oss import linux
from pysyte.config.types import ConfigPaths
from pysyte.types.dictionaries import NameSpaces
from pysyte.types.paths import DirectPath
from pysyte.types.paths import path

def common_config_dirs(
    extras: Optional[List[DirectPath]] = None,
) -> List[DirectPath]:
    """Build a list of common config dirs

    Try each of the following directories
        include them if they exist on this machine
        exclude any duplicates
    And in th following order

    /etc/, $XDG_CONFIG_DIRS, ~/.config, $XDG_CONFIG_HOME
        then any extras specified as args
    """

    def add_dir(value: str):
        path_ = path(value)
        if not path_:
            return
        expanded = path_.expand()
        if expanded in configs:
            return
        if expanded.isdir():
            configs.append(expanded)
        elif expanded.isfile():
            configs.append(expanded.parent)

    configs: List[DirectPath] = []
    add_dir("/etc")
    for path_ in linux.xdg_dirs():
        add_dir(path_)
    add_dir("~/.config")
    add_dir(linux.xdg_home())
    for path_ in extras or []:
        add_dir(path_)
    return configs

def load_configs(name: str, extras: Optional[list] = None) -> NameSpaces:
    """Load all config files with that name from common config dirs"""
    config_paths = ConfigPaths(common_config_dirs(extras))
    return config_paths.load(name)

pysyte = load_configs("pysyte", [path(path_to_pysyte)])

redpajama_set_name: RedPajamaGithub


text:
package com.google.cloud.hadoop.io.bigquery;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;

import com.google.api.client.util.Sleeper;
import com.google.cloud.hadoop.fs.gcs.InMemoryGoogleHadoopFileSystem;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

/** Unit tests for DynamicFileListRecordReader using an in-memory GHFS. */
@RunWith(JUnit4.class)
public class DynamicFileListRecordReaderTest {

  // Data we will write and read back.
  private static final String RECORD_0 = "{'day':'Sunday','letters':'6'}";
  private static final String RECORD_1 = "{'day':'Monday','letters':'6'}";
  private static final String RECORD_2 = "{'day':'Tuesday','letters':'7'}";

  private static final String SLEEP_ID = "test-sleep-id-12345";

  private static final Set<Logger> configuredLoggers = new HashSet<>();

  // Configuration object we use for specifying parameters to the record reader.
  private Configuration config;

  // Mock used simply to deliver the Configuration object to the record reader.
  @Mock private TaskAttemptContext mockTaskContext;

  // Mock Sleeper to use instead of actually blocking the thread in realtime.
  @Mock private Sleeper mockSleeper;

  // Parent directory of the shardPath.
  private Path basePath;

  // GCS Path owned by the recordReader being tested.
  private Path shardPath;

  // Number of total records we will tell the recordReader to expect.
  private long estimatedNumRecords;

  // InputSplit used to specify path and estimated number of records to the record reader.
  private ShardedInputSplit inputSplit;

  // The instance being tested.
  private DynamicFileListRecordReader<LongWritable, JsonObject> recordReader;

  // A FileSystem handle for populating files or cleaning up.
  private FileSystem fileSystem;

  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    configuredLoggers.add(Logger.getLogger(DynamicFileListRecordReader.class.getName()));
    configuredLoggers.forEach(l -> l.setLevel(Level.FINE));

    // Set up a Configuration which will case "gs://" to grab an InMemoryGoogleHadoopFileSystem.
    config = InMemoryGoogleHadoopFileSystem.getSampleConfiguration();
    when(mockTaskContext.getConfiguration()).thenReturn(config);

    basePath = new Path("gs://foo-bucket/");
    shardPath = new Path(basePath, "shard0/data-*.json");
    estimatedNumRecords = 2;

    fileSystem = basePath.getFileSystem(config);
    fileSystem.mkdirs(basePath);
    fileSystem.mkdirs(shardPath.getParent());

    // Instead of actually blocking, make our mockSleeper throw an exception that we can catch
    // whenever the reader would otherwise be blocking.
    doThrow(new RuntimeException(SLEEP_ID)).when(mockSleeper).sleep(anyLong());

    resetRecordReader();
  }

  @After
  public void tearDown() throws IOException {
    // Delete everything in basePath.
    fileSystem.delete(basePath, true);
    recordReader.close();
  }

  private DynamicFileListRecordReader<LongWritable, JsonObject> createReader() {
    return new DynamicFileListRecordReader<>((split, configuration) -> new GsonRecordReader());
  }

  /** Returns the recordReader to clean state. */
  private void resetRecordReader() throws Exception {
    inputSplit = new ShardedInputSplit(shardPath, estimatedNumRecords);
    recordReader = createReader();
    recordReader.initialize(inputSplit, mockTaskContext);
    recordReader.setSleeper(mockSleeper);
  }

  /**
   * Since we set up the mockSleeper to throw an exception with a test-identifiable string, this
   * helper method checks that invoking nextKeyValue would've blocked but threw the fake exception
   * instead.
   */
  private void checkNextKeyValueWouldBlock() {
    RuntimeException e = assertThrows(RuntimeException.class, () -> recordReader.nextKeyValue());
    assertThat(e).hasMessageThat().contains(SLEEP_ID);
  }

  /** Creates file {@code outfile} adding a newline between each element of {@code lines}. */
  private void writeFile(Path outfile, List<String> lines) throws IOException {
    Text lineText = new Text();
    Text newLine = new Text("\n");
    try (FSDataOutputStream dataOut = fileSystem.create(outfile)) {
      for (String line : lines) {
        lineText.set(line);
        dataOut.write(lineText.getBytes(), 0, lineText.getLength());
        dataOut.write(newLine.getBytes(), 0, newLine.getLength());
      }
    }
  }

  @Test
  public void testInitializeCreatesShardDirectory() throws Exception {
    fileSystem.delete(shardPath.getParent(), true);
    assertThat(fileSystem.exists(shardPath.getParent())).isFalse();
    resetRecordReader();
    assertThat(fileSystem.exists(shardPath.getParent())).isTrue();
  }

  @Test
  public void testGetCurrentBeforeFirstRecord() {
    assertThat(recordReader.getCurrentKey()).isNull();
    assertThat(recordReader.getCurrentValue()).isNull();
    assertThat(recordReader.getProgress()).isZero();
  }

  @Test
  public void testGetProgressZeroEstimatedRecords() throws Exception {
    inputSplit = new ShardedInputSplit(shardPath, 0);
    recordReader = createReader();
    recordReader.initialize(inputSplit, mockTaskContext);
    assertThat(recordReader.getProgress()).isZero();
  }

  @Test
  public void testEmptyFileIsOnlyFileAndZeroIndex() throws Exception {
    checkNextKeyValueWouldBlock();
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-000.json"));
    assertThat(recordReader.nextKeyValue()).isFalse();
    assertThat(recordReader.getCurrentKey()).isNull();
    assertThat(recordReader.getCurrentValue()).isNull();
  }

  @Test
  public void nextKeyValue_whenNoFilesAndMaxAttemptsReached_throwsException() throws Exception {
    config.setInt(
        BigQueryConfiguration.DYNAMIC_FILE_LIST_RECORD_READER_POLL_MAX_ATTEMPTS.getKey(), 1);
    resetRecordReader();
    recordReader.setSleeper(Sleeper.DEFAULT);

    IllegalStateException e =
        assertThrows(IllegalStateException.class, () -> recordReader.nextKeyValue());

    assertThat(e).hasMessageThat().doesNotContain(SLEEP_ID);
    assertThat(e).hasMessageThat().contains("Couldn't obtain any files after 1 attempt(s).");
  }

  @Test
  public void testEmptyFileIsOnlyFileAndNotZeroIndex() throws IOException {
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-001.json"));
    checkNextKeyValueWouldBlock();
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-002.json"));
    // Second file-marker with different index causes IllegalStateException.
    assertThrows(IllegalStateException.class, () -> recordReader.nextKeyValue());
  }

  @Test
  public void testEmptyFileThenDataFile() throws Exception {
    checkNextKeyValueWouldBlock();

    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-001.json"));
    checkNextKeyValueWouldBlock();

    writeFile(new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));

    assertThat(recordReader.nextKeyValue()).isFalse();
  }

  @Test
  public void testEmptyFileIndexLessThanOtherFileBadKnownFile() throws Exception {
    writeFile(new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0));
    writeFile(new Path(shardPath.getParent(), "data-002.json"), ImmutableList.of(RECORD_1));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));

    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-001.json"));

    // We will successfully read the remaining available file before discovering the bad one.
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_1));

    assertThrows(IllegalStateException.class, () -> recordReader.nextKeyValue());
  }

  @Test
  public void testEmptyFileIndexLessThanOtherFileBadNewFile() throws Exception {
    writeFile(new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0));
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-002.json"));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));

    writeFile(new Path(shardPath.getParent(), "data-003.json"), ImmutableList.of(RECORD_1));

    assertThrows(IllegalStateException.class, () -> recordReader.nextKeyValue());
  }

  @Test
  public void testSingleDataFile() throws Exception {
    writeFile(
        new Path(shardPath.getParent(), "data-000.json"),
        ImmutableList.of(RECORD_0, RECORD_1, RECORD_2));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(RECORD_0.length() + 1));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_1));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey())
        .isEqualTo(new LongWritable(RECORD_0.length() + RECORD_1.length() + 2));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_2));

    checkNextKeyValueWouldBlock();
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-001.json"));
    assertThat(recordReader.nextKeyValue()).isFalse();
  }

  @Test
  public void testMultipleDataFilesInSingleList() throws Exception {
    writeFile(new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0));
    writeFile(
        new Path(shardPath.getParent(), "data-001.json"), ImmutableList.of(RECORD_1, RECORD_2));
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-002.json"));

    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_1));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(RECORD_1.length() + 1));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_2));
    assertThat(recordReader.nextKeyValue()).isFalse();
  }

  @Test
  public void testMultipleFilesThenHangBeforeEmptyFileAppears() throws Exception {
    writeFile(new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0));
    writeFile(new Path(shardPath.getParent(), "data-001.json"), ImmutableList.of(RECORD_1));

    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_1));

    checkNextKeyValueWouldBlock();
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-002.json"));
    assertThat(recordReader.nextKeyValue()).isFalse();
  }

  @Test
  public void testCloseBeforeEnd() throws Exception {
    writeFile(
        new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0, RECORD_1));

    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));

    recordReader.close();
  }

  @Test
  public void testThreeBatchesEndFileInMiddleBatch() throws Exception {
    writeFile(new Path(shardPath.getParent(), "data-000.json"), ImmutableList.of(RECORD_0));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_0));
    checkNextKeyValueWouldBlock();

    writeFile(new Path(shardPath.getParent(), "data-001.json"), ImmutableList.of(RECORD_1));
    fileSystem.createNewFile(new Path(shardPath.getParent(), "data-003.json"));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_1));
    checkNextKeyValueWouldBlock();
    checkNextKeyValueWouldBlock();

    writeFile(new Path(shardPath.getParent(), "data-002.json"), ImmutableList.of(RECORD_2));
    assertThat(recordReader.nextKeyValue()).isTrue();
    assertThat(recordReader.getCurrentKey()).isEqualTo(new LongWritable(0));
    assertThat(recordReader.getCurrentValue()).isEqualTo(JsonParser.parseString(RECORD_2));
    assertThat(recordReader.nextKeyValue()).isFalse();
  }

  @Test
  public void testBadFilename() throws Exception {
    String outOfBounds = String.format("data-%d.json", 1L + Integer.MAX_VALUE);
    fileSystem.createNewFile(new Path(shardPath.getParent(), outOfBounds));
    assertThrows(IndexOutOfBoundsException.class, () -> recordReader.nextKeyValue());
  }
}


text:
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk

class vtkTimeSourceExample(SimpleVTKClassModuleBase):
    def __init__(self, module_manager):
        SimpleVTKClassModuleBase.__init__(
            self, module_manager,
            vtk.vtkTimeSourceExample(), 'Processing.',
            (), ('vtkImageData',),
            replaceDoc=True,
            inputFunctions=None, outputFunctions=None)


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/image"
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:layout_marginBottom="10dp"
        android:layout_marginStart="5dp"
        android:layout_marginEnd="10dp"
        android:layout_marginTop="10dp"
        android:scaleType="centerCrop"
        android:importantForAccessibility="no"
        android:src="@drawable/iconic_taxon_unknown" />

     <TextView
        android:id="@+id/id_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toEndOf="@id/image"
        android:paddingTop="10dp"
        android:layout_marginEnd="5dp"
        android:layout_alignParentTop="true"
        android:maxLines="1"
        android:ellipsize="end"
        style="@android:style/TextAppearance.Medium"
        android:text="ID Name" />

    <TextView
        android:id="@+id/id_taxon_name"
        android:layout_toEndOf="@id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/id_name"
        android:text="ID Type" />

   <TextView
        android:id="@+id/tag"
        android:layout_width="wrap_content"
        android:layout_toEndOf="@id/image"
        android:layout_height="wrap_content"
        android:padding="3dp"
        android:paddingEnd="6dp"
        android:paddingStart="6dp"
        android:layout_below="@id/id_taxon_name"
        android:layout_marginTop="5dp"
        android:textSize="13sp"
        android:background="@android:color/white"
        android:text="Research" />

     <TextView
        android:id="@+id/observed_on"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="11/03/15"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="5dp"
        android:layout_marginBottom="5dp"
         />

     <TextView
        android:id="@+id/username"
        android:layout_toStartOf="@id/observed_on"
        android:layout_toEndOf="@id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginEnd="5dp"
        android:layout_marginBottom="5dp"
        android:textStyle="bold"
        android:text="someuser" />

</RelativeLayout>


text:
/*jslint eqeqeq: true, undef: true */
/*global $, window, console, alert */

var Template = Template || {};

Template = (function() {
	// PRIVATE VARIABLES

	// PRIVATE FUNCTIONS

	// PUBLIC METHODS
	return {
		init: function() {
			// DOM ready
		},
		pageInit: function() {
			// page load
		}
	};
}());

// ON DOM READY
$(function() {
	Template.init();
});

// ON PAGE LOAD
$(window).load(function() {
	Template.pageInit();
});


text:
interface Base { foo: string; }
interface Derived extends Base { bar: string; }
interface Derived2 extends Derived { baz: string; }

interface A {
    [x: string]: Derived;
}

interface B extends A {
    [x: string]: Base; // error
}

interface B2 extends A {
    [x: string]: Derived2; // ok
}

module Generics {
    interface A<T extends Derived> {
        [x: string]: T;
    }

    interface B extends A<Base> {
        [x: string]: Derived; // error
    }

    interface B2 extends A<Derived> {
        [x: string]: Derived2; // ok
    }

    interface B3<T extends Derived> extends A<T> {
        [x: string]: Base; // error
    }

    interface B4<T extends Derived> extends A<T> {
        [x: string]: Derived; // error
    }

    interface B5<T extends Derived2> extends A<T> {
        [x: string]: Derived2; // error
    }
}


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

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.sdif4j</groupId>
		<artifactId>sdif4j-testing-parent</artifactId>
		<version>1.0-SNAPSHOT</version>
	</parent>

	<artifactId>sdif4j-testing-common</artifactId>

	<dependencies>
		<!--sdif4j-->
		<dependency>
			<groupId>org.sdif4j</groupId>
			<artifactId>sdif4j-api</artifactId>
		</dependency>
		<!--/sdif4j-->

		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
		</dependency>

		<dependency>
			<groupId>com.google.inject</groupId>
			<artifactId>guice</artifactId>
			<optional>true</optional>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<optional>true</optional>
		</dependency>

		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>jsr305</artifactId>
			<optional>true</optional>
		</dependency>
	</dependencies>
</project>


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _get2 = require('babel-runtime/helpers/get');

var _get3 = _interopRequireDefault(_get2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _promise = require('./promise');

var _promise2 = _interopRequireDefault(_promise);

var _events = require('events');

var _events2 = _interopRequireDefault(_events);

var _lodash = require('lodash');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var EventEmitter = _events2.default.EventEmitter; // Events
// ---------------

var eventNames = function eventNames(text) {
  return text.split(/\s+/);
};

/**
 * @class Events
 * @description
 * Base Event class inherited by {@link Model} and {@link Collection}. It's not
 * meant to be used directly, and is only displayed here for completeness.
 */

var Events = function (_EventEmitter) {
  (0, _inherits3.default)(Events, _EventEmitter);

  function Events() {
    (0, _classCallCheck3.default)(this, Events);
    return (0, _possibleConstructorReturn3.default)(this, (Events.__proto__ || Object.getPrototypeOf(Events)).apply(this, arguments));
  }

  (0, _createClass3.default)(Events, [{
    key: 'on',

    /**
     * @method Events#on
     * @description
     * Register an event listener. The callback will be invoked whenever the event
     * is fired. The event string may also be a space-delimited list of several
     * event names.
     *
     * @param {string} nameOrNames
     *   The name of the event or space separated list of events to register a
     *   callback for.
     * @param {function} callback
     *   That callback to invoke whenever the event is fired.
     */
    value: function on(nameOrNames, handler) {
      var _this2 = this;

      (0, _lodash.each)(eventNames(nameOrNames), function (name) {
        (0, _get3.default)(Events.prototype.__proto__ || Object.getPrototypeOf(Events.prototype), 'on', _this2).call(_this2, name, handler);
      });
      return this;
    }

    /**
     * @method Events#off
     * @description
     * Remove a previously-bound callback event listener from an object. If no
     * event name is specified, callbacks for all events will be removed.
     *
     * @param {string} nameOrNames
     *   The name of the event or space separated list of events to stop listening
     *   to.
     */

  }, {
    key: 'off',
    value: function off(nameOrNames) {
      var _this3 = this;

      if (nameOrNames == null) {
        return this.removeAllListeners();
      }

      (0, _lodash.each)(eventNames(nameOrNames), function (name) {
        return _this3.removeAllListeners(name);
      });
      return this;
    }

    /**
     * @method Events#trigger
     * @description
     * Trigger callbacks for the given event, or space-delimited list of events.
     * Subsequent arguments to `trigger` will be passed along to the event
     * callback.
     *
     * @param {string} nameOrNames
     *   The name of the event to trigger. Also accepts a space separated list of
     *   event names.
     * @param {...mixed} [args]
     *   Extra arguments to pass to the event listener callback function.
     */

  }, {
    key: 'trigger',
    value: function trigger(nameOrNames) {
      var _this4 = this;

      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }

      (0, _lodash.each)(eventNames(nameOrNames), function (name) {
        _this4.emit.apply(_this4, [name].concat(args));
      });
      return this;
    }

    /**
     * @method Events#triggerThen
     * @description
     * A promise version of {@link Events#trigger}, returning a promise which
     * resolves with all return values from triggered event handlers. If any of the
     * event handlers throw an `Error` or return a rejected promise, the promise
     * will be rejected. Used internally on the {@link Model#creating "creating"},
     * {@link Model#updating "updating"}, {@link Model#saving "saving"}, and {@link
     * Model@destroying "destroying"} events, and can be helpful when needing async
     * event handlers (for validations, etc).
     *
     * @param {string} name
     *   The event name, or a whitespace-separated list of event names, to be
     *   triggered.
     * @param {...mixed} [args]
     *   Arguments to be passed to any registered event handlers.
     * @returns Promise<mixed[]>
     *   A promise resolving the the resolved return values of any triggered handlers.
     */

  }, {
    key: 'triggerThen',
    value: function triggerThen(nameOrNames) {
      var _this5 = this;

      for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
        args[_key2 - 1] = arguments[_key2];
      }

      var names = eventNames(nameOrNames);
      var listeners = (0, _lodash.flatMap)(names, function (name) {
        return _this5.listeners(name);
      });
      return _promise2.default.map(listeners, function (listener) {
        return listener.apply(_this5, args);
      });
    }

    /**
     * @method Events#once
     * @description
     * Just like {@link Events#on}, but causes the bound callback to fire only
     * once before being removed. Handy for saying "the next time that X happens,
     * do this". When multiple events are passed in using the space separated
     * syntax, the event will fire once for every event you passed in, not once
     * for a combination of all events.
     *
     * @param {string} nameOrNames
     *   The name of the event or space separated list of events to register a
     *   callback for.
     * @param {function} callback
     *   That callback to invoke only once when the event is fired.
     */

  }, {
    key: 'once',
    value: function once(name, callback) {
      var _this6 = this;

      var wrapped = (0, _lodash.once)(function () {
        for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
          args[_key3] = arguments[_key3];
        }

        _this6.off(name, wrapped);
        return callback.apply(_this6, args);
      });
      wrapped._callback = callback;
      return this.on(name, wrapped);
    }
  }]);
  return Events;
}(EventEmitter);

exports.default = Events;


text:
package com.base.taboo.io.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class TextReader extends Reader {
	String name = "";

	public TextReader(String name) {
		this.name = name;
	}

	/**
	 * Get List<String> from taboos.txt file.
	 *
	 * @return BufferedReader object
	 * @throws FileNotFoundException
	 */
	public List<String> readLines2List() {
		List<String> taboos = new ArrayList<String>();
		try {
			File resource = getResource(name);
			BufferedReader br = new BufferedReader(new FileReader(resource));
			String tmp = null;
			while ((tmp = br.readLine()) != null) {
				tmp = tmp.trim();
				if (!tmp.startsWith("#")) {
					taboos.add(tmp);
				}
			}
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return taboos;
	}

	/**
	 * Get set from taboos.txt file.
	 *
	 * @return BufferedReader object
	 * @throws FileNotFoundException
	 */
	public List<Character> readLines2Chars() {
		List<Character> chars = new ArrayList<Character>();
		try {
			File resource = getResource(name);
			BufferedReader br = new BufferedReader(new FileReader(resource));
			String tmp = null;
			while ((tmp = br.readLine()) != null) {
				chars.add(Character.valueOf(tmp.charAt(0)));
			}
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return chars;
	}

	/**
	 * Get String from taboos.txt file.
	 *
	 * @return BufferedReader object
	 * @throws FileNotFoundException
	 */
	public String read2String() {
		StringBuffer sb = new StringBuffer();
		try {
			File resource = getResource(name);
			BufferedReader br = new BufferedReader(new FileReader(resource));
			char[] buf = new char[4096];
			int c = br.read(buf);
			while (c != -1) {
				sb.append(buf, 0, c);
				c = br.read(buf);
			}
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return sb.toString();
	}

	/**
	 * Get String from taboos.txt file.
	 *
	 * @return BufferedReader object
	 * @throws FileNotFoundException
	 */
	public String readLines2String() {
		StringBuffer sb = new StringBuffer();
		try {
			File resource = getResource(name);
			BufferedReader br = new BufferedReader(new FileReader(resource));
			String tmp = null;
			while ((tmp = br.readLine()) != null) {
				sb.append(tmp);
			}
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return sb.toString();
	}

	/**
	 * Get String[] from taboos.txt file.
	 *
	 * @return BufferedReader object
	 * @throws FileNotFoundException
	 */
	public String[] readLines2Array() {
		List<String> taboos = readLines2List();
		String[] result = new String[taboos.size()];
		taboos.toArray(result);
		return result;
	}
}


text:
module Landable
  module Traffic
    class Visitor < ActiveRecord::Base
      include Landable::TableName

      lookup_for :ip_address, class_name: IpAddress
      lookup_for :user_agent, class_name: UserAgent

      has_many :accesses
      has_many :visits
    end
  end
end


text:
import { createStore, compose, combineReducers, applyMiddleware } from 'redux';
import { routerReducer as routing } from 'react-router-redux';
import thunk from 'redux-thunk';
import { apiReducer, logReducer, notificationsReducer, configure as configureSockets } from './sockets';

const reducer = combineReducers({
  api: apiReducer,
  log: logReducer,
  notificatons: notificationsReducer,
  routing
});

const configureStore = preloadedState => {
  // Combine rootReducer and preloadedState to form our store

  const store = createStore(
    reducer,
    preloadedState,
    compose(
      applyMiddleware(thunk),
      window.devToolsExtension ? window.devToolsExtension() : f => f
    )
  );

  // This block allows us to use hot module replacement (webpack) with redux
  if (module.hot) {
    module.hot.accept('./reducer', () => {
      const nextRootReducer = require('./reducer').default; // eslint-disable-line
      store.replaceReducer(nextRootReducer);
    });
  }

  configureSockets(store.dispatch);

  return store;
};

export default configureStore;


text:
"""Runner for transformer GMM experiments.
"""
import os

from . import gmm_dist
from . import gmm_models
from . import metrics
from . import plotting
from . import train

from absl import app
from absl import flags
import jax
from jax.config import config
import jax.numpy as jnp
import matplotlib.pyplot as plt

flags.DEFINE_enum("model_name", "mean",
                  ["mean", "mean_scale", "mean_scale_weight"],
                  "Model to run")
flags.DEFINE_integer("num_encoders", 6,
                     "Number of encoder modules in the transformer.")
flags.DEFINE_integer("num_decoders", 6,
                     "Number of decoder modules in the transformer.")
flags.DEFINE_integer("num_heads", 8,
                     "Number of attention heads in the transformer.")
flags.DEFINE_integer("key_dim", 32,
                     "The dimension of the keys in the transformer.")
flags.DEFINE_integer("value_dim_per_head", 32,
                     "The dimension of the values in the transformer "
                     "for each head.")
flags.DEFINE_integer("data_dim", 2,
                     "The dimension of the points to cluster.")
flags.DEFINE_integer("min_k", 2,
                     "The minimum number of modes in the data.")
flags.DEFINE_integer("max_k", 10,
                     "The maximum number of modes in the data.")
flags.DEFINE_integer("data_points_per_mode", 25,
                     "Number of data points to include per mode in the data.")
flags.DEFINE_integer("cov_dof", 10,
                     "Degrees of freedom in sampling the random covariances.")
flags.DEFINE_float("mode_var", 1.,
                   "The variance of the modes in the GMM used when "
                   "not sampling.")
flags.DEFINE_float("separation_multiplier", 3.,
                   "Number to multiply the maximum covariance diag element by "
                   "when computing mean separation.")
flags.DEFINE_boolean("parallel", True,
                     "If possible, train in parallel across devices.")
flags.DEFINE_integer("batch_size", 64,
                     "The batch size.")
flags.DEFINE_integer("eval_batch_size", 256,
                     "The batch size for evaluation.")
flags.DEFINE_integer("num_steps", int(1e6),
                     "The number of steps to train for.")
flags.DEFINE_float("lr", 1e-3,
                   "The learning rate for ADAM.")
flags.DEFINE_integer("summarize_every", 100,
                     "Number of steps between summaries.")
flags.DEFINE_integer("checkpoint_every", 5000,
                     "Number of steps between checkpoints.")
flags.DEFINE_boolean("clobber_checkpoint", False,
                     "If true, remove any existing summaries and checkpoints "
                     "in the logdir.")
flags.DEFINE_string("logdir", "/tmp/transformer",
                    "The directory to put summaries and checkpoints.")
flags.DEFINE_boolean("debug_nans", False,
                     "If true, run in debug mode and fail on nans.")
flags.DEFINE_boolean("plot_sklearn_comparison", False,
                     "If true, generate the sklearn clustering comparison "
                     "plots.")

FLAGS = flags.FLAGS

def make_model(key,
               model_name="mean",
               num_encoders=4,
               num_decoders=4,
               num_heads=8,
               value_dim=128,
               data_points_per_mode=25,
               max_k=10,
               data_dim=2):
  class_dict = {
      "mean": gmm_models.MeanInferenceMachine,
      "mean_scale": gmm_models.MeanScaleInferenceMachine,
      "mean_scale_weight": gmm_models.MeanScaleWeightInferenceMachine}

  model = class_dict[model_name](
      data_dim=data_dim, max_k=max_k,
      max_num_data_points=max_k*data_points_per_mode, num_heads=num_heads,
      num_encoders=num_encoders, num_decoders=num_decoders, qkv_dim=value_dim)
  params = model.init_params(key)

  return model, params

def make_loss(model,
              model_name="mean",
              min_k=2,
              max_k=10,
              data_points_per_mode=25,
              cov_dof=10,
              mode_var=1.,
              separation_mult=2.,
              data_dim=2,
              batch_size=128):

  def sample_train_batch(key):
    return gmm_dist.sample_batch_random_ks(
        key, model_name, batch_size, min_k, max_k, data_points_per_mode,
        data_dim, mode_var, cov_dof, separation_mult)

  def loss(params, key):
    key, subkey = jax.random.split(key)
    xs, _, ks, mog_params = sample_train_batch(key)
    losses = model.loss(
        params, xs, ks*data_points_per_mode, mog_params, ks, subkey)
    return jnp.mean(losses)

  return loss

def make_summarize(
    model,
    model_name="mean",
    min_k=2,
    max_k=10,
    data_points_per_mode=25,
    cov_dof=10,
    separation_mult=2.,
    data_dim=2,
    mode_var=1.,
    eval_batch_size=256):

  def sample_eval_batch(key):
    return gmm_dist.sample_batch_random_ks(
        key, model_name, eval_batch_size, min_k, max_k, data_points_per_mode,
        data_dim, mode_var, cov_dof, separation_mult)

  sample_eval_batch = jax.jit(sample_eval_batch)

  def sample_single_gmm(key, num_modes):
    xs, cs, params = gmm_dist.sample_batch_fixed_ks(
        key, model_name, jnp.array([num_modes]), max_k, data_points_per_mode,
        data_dim, mode_var, cov_dof, separation_mult)

    return xs[0], cs[0], (params[0][0], params[1][0], params[2][0])

  def model_classify(params, inputs, ks):
    return gmm_models.classify_with_defaults(
        model, params, inputs, eval_batch_size, ks*data_points_per_mode, ks,
        max_k, jnp.eye(data_dim)*mode_var)

  def sample_and_classify_eval_batch(key, params):
    xs, cs, ks, true_gmm_params = sample_eval_batch(key)
    tfmr_cs, tfmr_gmm_params = model_classify(params, xs, ks)
    return xs, cs, ks, true_gmm_params, tfmr_cs, tfmr_gmm_params

  def sample_and_classify_single_gmm(key, params, num_modes):
    xs, cs, gmm_params = sample_single_gmm(key, num_modes)
    tfmr_cs, tfmr_gmm_params = model_classify(
        params, xs[jnp.newaxis], jnp.array([num_modes]))
    return xs, cs, gmm_params, tfmr_cs, tfmr_gmm_params

  sample_and_classify_eval_batch = jax.jit(sample_and_classify_eval_batch)

  sample_and_classify_single_gmm = jax.jit(sample_and_classify_single_gmm)

  def summarize_baselines(writer, step, key):
    key, subkey = jax.random.split(key)
    xs, cs, ks, _ = sample_eval_batch(subkey)
    baseline_metrics = metrics.compute_masked_baseline_metrics(
        xs, cs, ks, ks*data_points_per_mode)
    for method_name, method_metrics in baseline_metrics.items():
      for metric_name, metric_val in method_metrics.items():
        writer.scalar("%s/%s" % (method_name, metric_name),
                      metric_val, step=step)
        print("%s %s: %0.3f" % (method_name, metric_name, metric_val))

  def plot_params(num_modes, num_data_points, writer, step, params, key):
    outs = sample_and_classify_single_gmm(key, params, num_modes)
    xs, true_cs, true_params, pred_cs, pred_params = outs
    pred_cs = pred_cs[0]
    pred_params = (pred_params[0][0], pred_params[1][0], pred_params[2][0])
    em_cs, em_params = plotting.fit_em(xs, num_modes)
    fig = plotting.plot_gmms(
        xs, num_modes, true_cs, true_params, pred_cs, pred_params, em_cs,
        em_params)
    plot_img = plotting.plot_to_numpy_image(plt)
    writer.image(
        "%d_modes_%d_points" % (num_modes, num_data_points),
        plot_img, step=step)
    plt.close(fig)

  def comparison_inference(params):
    datasets = plotting.make_comparison_gmm_datasets()
    varied_inputs, aniso_inputs, blob_inputs, no_structure_inputs = datasets
    varied_inputs = varied_inputs[0][jnp.newaxis, Ellipsis]
    aniso_inputs = aniso_inputs[0][jnp.newaxis, Ellipsis]
    blob_inputs = blob_inputs[0][jnp.newaxis, Ellipsis]
    no_structure_inputs = no_structure_inputs[0][jnp.newaxis, Ellipsis]

    new_model = gmm_models.MeanScaleWeightInferenceMachine(
        data_dim=data_dim, max_k=max_k,
        max_num_data_points=1500, num_heads=FLAGS.num_heads,
        num_encoders=FLAGS.num_encoders, num_decoders=FLAGS.num_decoders,
        qkv_dim=FLAGS.value_dim_per_head*FLAGS.num_heads)
    varied_cs, varied_params = new_model.classify(
        params, varied_inputs, jnp.array([1500]), jnp.array([3]))
    aniso_cs, aniso_params = new_model.classify(
        params, aniso_inputs, jnp.array([1500]), jnp.array([3]))
    blob_cs, blob_params = new_model.classify(
        params, blob_inputs, jnp.array([1500]), jnp.array([3]))
    no_structure_cs, no_structure_params = new_model.classify(
        params, no_structure_inputs, jnp.array([1500]), jnp.array([3]))
    varied_cs = varied_cs[0]
    aniso_cs = aniso_cs[0]
    blob_cs = blob_cs[0]
    no_structure_cs = no_structure_cs[0]
    varied_params = (varied_params[0][0], varied_params[1][0],
                     varied_params[2][0])
    aniso_params = (aniso_params[0][0], aniso_params[1][0], aniso_params[2][0])
    blob_params = (blob_params[0][0], blob_params[1][0], blob_params[2][0])
    no_structure_params = (no_structure_params[0][0], no_structure_params[1][0],
                           no_structure_params[2][0])
    return (varied_inputs, aniso_inputs, blob_inputs, no_structure_inputs,
            varied_cs, aniso_cs, blob_cs, no_structure_cs,
            varied_params, aniso_params, blob_params, no_structure_params)

  comparison_inference = jax.jit(comparison_inference)

  def plot_comparisons(writer, step, params):
    outs = comparison_inference(params)
    varied_inputs, aniso_inputs, blob_inputs, no_structure_inputs = outs[:4]
    varied_cs, aniso_cs, blob_cs, no_structure_cs = outs[4:8]
    varied_params, aniso_params, blob_params, no_structure_params = outs[8:]
    fig = plotting.plot_comparison_gmm(varied_inputs[0], varied_inputs[1],
                                       varied_cs, varied_params)
    plot_image = plotting.plot_to_numpy_image(plt)
    writer.image("varied", plot_image, step=step)
    plt.close(fig)
    fig = plotting.plot_comparison_gmm(aniso_inputs[0], aniso_inputs[1],
                                       aniso_cs, aniso_params)
    writer.image("aniso", plotting.plot_to_numpy_image(plt), step=step)
    plt.close(fig)
    fig = plotting.plot_comparison_gmm(blob_inputs[0], blob_inputs[1], blob_cs,
                                       blob_params)
    writer.image("blob", plotting.plot_to_numpy_image(plt), step=step)
    plt.close(fig)
    fig = plotting.plot_comparison_gmm(no_structure_inputs[0],
                                       no_structure_inputs[1], no_structure_cs,
                                       no_structure_params)
    writer.image("no_structure", plotting.plot_to_numpy_image(plt), step=step)
    plt.close(fig)

  def summarize(writer, step, params, key):
    k1, k2, k3 = jax.random.split(key, num=3)
    _, cs, ks, _, tfmr_cs, _ = sample_and_classify_eval_batch(k1, params)
    tfmr_metrics = metrics.compute_masked_metrics(
        cs, tfmr_cs, ks, ks*data_points_per_mode,
        metrics=["pairwise_accuracy", "pairwise_f1",
                 "pairwise_macro_f1", "pairwise_micro_f1"])
    for metric_name, metric_val in tfmr_metrics.items():
      writer.scalar("transformer/%s" % metric_name,
                    metric_val, step=step)
      print("Transformer %s: %0.3f" % (metric_name, metric_val))
    if data_dim == 2:
      plot_params(min_k, min_k*data_points_per_mode, writer, step, params, k2)
      if FLAGS.plot_sklearn_comparison:
        plot_comparisons(writer, step, params)
    if step == 0:
      summarize_baselines(writer, step, k3)

  return summarize

def make_logdir(config):
  basedir = config.logdir
  exp_dir = (
      "%s_nheads_%d_nencoders_%d_ndecoders_%d_sepm_%0.1f"
      % (config.model_name, config.num_heads, config.num_encoders,
         config.num_decoders, config.separation_multiplier))
  return os.path.join(basedir, exp_dir)

def main(unused_argv):
  if FLAGS.debug_nans:
    config.update("jax_debug_nans", True)

  if FLAGS.parallel and train.can_train_parallel():
    assert FLAGS.batch_size % jax.local_device_count(
    ) == 0, "Device count must evenly divide batch_size"
    FLAGS.batch_size = int(FLAGS.batch_size / jax.local_device_count())

  if FLAGS.plot_sklearn_comparison:
    assert FLAGS.min_k == 3 and FLAGS.max_k == 3

  key = jax.random.PRNGKey(0)
  key, subkey = jax.random.split(key)
  model, init_params = make_model(
      key,
      model_name=FLAGS.model_name,
      num_encoders=FLAGS.num_encoders,
      num_decoders=FLAGS.num_decoders,
      num_heads=FLAGS.num_heads,
      value_dim=FLAGS.value_dim_per_head*FLAGS.num_heads,
      data_points_per_mode=FLAGS.data_points_per_mode,
      max_k=FLAGS.max_k,
      data_dim=FLAGS.data_dim)
  loss_fn = make_loss(
      model,
      model_name=FLAGS.model_name,
      min_k=FLAGS.min_k,
      max_k=FLAGS.max_k,
      data_points_per_mode=FLAGS.data_points_per_mode,
      cov_dof=FLAGS.cov_dof,
      separation_mult=FLAGS.separation_multiplier,
      mode_var=FLAGS.mode_var,
      data_dim=FLAGS.data_dim,
      batch_size=FLAGS.batch_size)
  summarize_fn = make_summarize(
      model,
      model_name=FLAGS.model_name,
      min_k=FLAGS.min_k,
      max_k=FLAGS.max_k,
      data_points_per_mode=FLAGS.data_points_per_mode,
      cov_dof=FLAGS.cov_dof,
      separation_mult=FLAGS.separation_multiplier,
      data_dim=FLAGS.data_dim,
      mode_var=FLAGS.mode_var,
      eval_batch_size=FLAGS.eval_batch_size)
  train.train_loop(
      subkey,
      init_params,
      loss_fn,
      parallel=FLAGS.parallel,
      lr=FLAGS.lr,
      num_steps=FLAGS.num_steps,
      summarize_fn=summarize_fn,
      summarize_every=FLAGS.summarize_every,
      checkpoint_every=FLAGS.checkpoint_every,
      clobber_checkpoint=FLAGS.clobber_checkpoint,
      logdir=make_logdir(FLAGS))
if __name__ == "__main__":
  app.run(main)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Verh. bot. Ver. Prov. Brandenb. 41: X (1899)

#### Original name
Ciboria filopes Henn.

### Remarks
null


text:
package com.kauri.ark.integer;

import com.kauri.ark.Constraint;
import com.kauri.ark.Variable;

/**
 * A constraint which forces an integer variable to be distinct from another integer variable.
 *
 * @author Eric Fritz
 */
public class IntegerInequalityConstraint implements Constraint<IntegerDomain>
{
	/**
	 * The first variable.
	 */
	private Variable<IntegerDomain> var1;

	/**
	 * The second variable.
	 */
	private Variable<IntegerDomain> var2;

	/**
	 * Creates a new IntegerInequalityConstraint.
	 *
	 * @param var1 The first variable.
	 * @param var2 The second variable.
	 */
	public IntegerInequalityConstraint(Variable<IntegerDomain> var1, Variable<IntegerDomain> var2) {
		this.var1 = var1;
		this.var2 = var2;
	}

	@Override
	public boolean narrow(Variable<IntegerDomain> variable) {
		// Narrow the domain of the argument variable to remove the unique element of the other domain. If the other
		// domain has not been narrowed to a unique value, we cannot narrow the argument domain without pruning some
		// valid assignment.

		IntegerDomain domain1 = variable == var1 ? var1.getDomain() : var2.getDomain();
		IntegerDomain domain2 = variable == var1 ? var2.getDomain() : var1.getDomain();

		if (!domain2.isUnique()) {
			return true;
		}

		return variable.trySetValue(domain1.remove(domain2));
	}
}


text:
require "tmpdir"

require "hbc/container/base"

module Hbc
  class Container
    class GenericUnar < Base
      def self.me?(criteria)
        !(lsar = which("lsar")).nil? &&
          criteria.command.run(lsar,
                               args:         ["-l", "-t", "--", criteria.path],
                               print_stderr: false).stdout.chomp.end_with?("passed, 0 failed.")
      end

      def extract
        if (unar = which("unar")).nil?
          raise CaskError, "Expected to find unar executable. Cask #{@cask} must add: depends_on formula: 'unar'"
        end

        Dir.mktmpdir do |unpack_dir|
          @command.run!(unar, args: ["-force-overwrite", "-quiet", "-no-directory", "-output-directory", unpack_dir, "--", @path])
          @command.run!("/usr/bin/ditto", args: ["--", unpack_dir, @cask.staged_path])
        end
      end
    end
  end
end


text:
title: Column Count
page_title: Column Count - RadOrgChart
description: Check our Web Forms article about Column Count.
slug: orgchart/functionality/column-count
tags: column,count
published: True
position: 3
---

# Column Count

In order to provide more flexibility to visualizing of groups in the hierarchy,	RadOrgChart implements Column Count feature.

## What does Column Count do?

Column Count simply breaks the single-line presentation of the groups in RadOrgCharton multiple lines, through following the specified by the user number of columns in a group(how many Group Items are rendered on a single line/row).

One can specify what's the value of the Column Count for a certain OrgChartNode, by setting the Node.**ColumnCount** property.

Here is a sample of setting the property on OrgChartNode declared in the markup:

````ASPNET
<telerik:RadOrgChart RenderMode="Lightweight" runat="server" ID="RadOrgChart1">
	<Nodes>
		<telerik:OrgChartNode ColumnCount="2">
			<GroupItems>
				<telerik:OrgChartGroupItem Text="GroupItem1" />
				<telerik:OrgChartGroupItem Text="GroupItem2" />
				<telerik:OrgChartGroupItem Text="GroupItem3" />
				<telerik:OrgChartGroupItem Text="GroupItem4" />
			</GroupItems>
		</telerik:OrgChartNode>
	</Nodes>
</telerik:RadOrgChart>
````

And this is how the result look like:
![radorgchart-column-count 1](images/radorgchart-column-count1.png)

## Is there a way to set Column Count for all nodes?

**There is such a way.**

It's property of RadOrgChart called GroupColumnCount and setting this property gives you the ability to control the ColumnCount from one place and at the same time removes the overhead of setting it to each and every node separately.

Here is an example:

````ASPNET
<telerik:RadOrgChart RenderMode="Lightweight" runat="server" ID="RadOrgChart2" GroupColumnCount="1">
	<Nodes>
		<telerik:OrgChartNode>
			<GroupItems>
				<telerik:OrgChartGroupItem Text="GroupItem1" />
				<telerik:OrgChartGroupItem Text="GroupItem2" />
			</GroupItems>
			<Nodes>
				<telerik:OrgChartNode>
					<GroupItems>
						<telerik:OrgChartGroupItem Text="GroupItem1" />
						<telerik:OrgChartGroupItem Text="GroupItem2" />
					</GroupItems>
				</telerik:OrgChartNode>
				<telerik:OrgChartNode>
					<GroupItems>
						<telerik:OrgChartGroupItem Text="GroupItem1" />
						<telerik:OrgChartGroupItem Text="GroupItem2" />
					</GroupItems>
				</telerik:OrgChartNode>
				<telerik:OrgChartNode>
					<GroupItems>
						<telerik:OrgChartGroupItem Text="GroupItem1" />
						<telerik:OrgChartGroupItem Text="GroupItem2" />
					</GroupItems>
				</telerik:OrgChartNode>
			</Nodes>
		</telerik:OrgChartNode>
	</Nodes>
</telerik:RadOrgChart>
````

And this is the result:
![radorgchart-column-count 2](images/radorgchart-column-count2.png)

## What if we want to use both in combination?

Well, you simply **can**.

You can set on OrgChart-level (OrgChart.GroupColumnCount) the most repeatedly ocurringColumn Count, and then set it locally to smaller part of nodes that require a different number of columns.

Here is an example:

````ASPNET
<telerik:RadOrgChart RenderMode="Lightweight" runat="server" ID="RadOrgChart3" GroupColumnCount="1">
	<Nodes>
		<telerik:OrgChartNode>
			<GroupItems>
				<telerik:OrgChartGroupItem Text="GroupItem1" />
				<telerik:OrgChartGroupItem Text="GroupItem2" />
			</GroupItems>
			<Nodes>
				<telerik:OrgChartNode>
					<GroupItems>
						<telerik:OrgChartGroupItem Text="GroupItem1" />
						<telerik:OrgChartGroupItem Text="GroupItem2" />
					</GroupItems>
				</telerik:OrgChartNode>
				<telerik:OrgChartNode ColumnCount="2">
					<GroupItems>
						<telerik:OrgChartGroupItem Text="GroupItem1" />
						<telerik:OrgChartGroupItem Text="GroupItem2" />
					</GroupItems>
				</telerik:OrgChartNode>
				<telerik:OrgChartNode>
					<GroupItems>
						<telerik:OrgChartGroupItem Text="GroupItem1" />
						<telerik:OrgChartGroupItem Text="GroupItem2" />
					</GroupItems>
				</telerik:OrgChartNode>
			</Nodes>
		</telerik:OrgChartNode>
	</Nodes>
</telerik:RadOrgChart>
````

And this is how the result look like:
![radorgchart-column-count 3](images/radorgchart-column-count3.png)

# See Also

 * [Templates (demo)](https://demos.telerik.com/aspnet-ajax/orgchart/examples/templates/defaultcs.aspx)

 * [Column count (demo)](https://demos.telerik.com/aspnet-ajax/orgchart/examples/columncount/defaultcs.aspx)

 * [Templates (article)]({%slug orgchart/templates/overview%})


text:
namespace preproc
{

class Token
{
public:
	enum Type
	{
		None,
		EndOfFile,
		Whitespace,
		Directive,
		NewLine,
		Identifier,
		Other,

		String,

		Number,

		OpenParen,
		CloseParen,

		Comma,

		Add,
		Minus,
		Multiply,
		Divide,
		Modulus,

		LessThan,
		LessEqual,
		LeftShift,

		GreaterThan,
		GreaterEqual,
		RightShift,

		Equal,
		NotEqual,

		BitAnd,
		BooleanAnd,

		BitOr,
		BooleanOr,

		BitXor,

		BitNot,
		BooleanNot,

		BackSlash,
	};

	enum OperatorPrecedence
	{
		PrecedenceBooleanOr,
		PrecedenceBooleanAnd,
		PrecedenceBitOr,
		PrecedenceBitXor,
		PrecedenceBitAnd,
		PrecedenceEqual,
		PrecedenceCompare,
		PrecedenceBitShift,
		PrecedenceAdd,
		PrecedenceMultiply
	};

	Token(Type type, const std::string& value, size_t line);

	Type GetType() const;
	const std::string& GetValue() const;
	size_t GetLineNumber() const;

	bool IsBinaryOperator() const;
	bool IsUnaryOperator() const;

	OperatorPrecedence GetPrecedence() const;
private:
	Type mType;
	std::string mValue;
	size_t mLine;
};

class Tokenizer
{
public:
	Tokenizer(std::istream& input);
	~Tokenizer(void);

	const Token& GetToken(size_t index) const;
private:
	void Tokenize(std::istream& input);

	struct NextState
	{
		typedef NextState (*StateFunction)(int nextCharacter);

		NextState(StateFunction functionPointer);
		NextState(StateFunction functionPointer, Token::Type tokenType);
		StateFunction functionPointer;
		Token::Type type;
	};

	static NextState::StateFunction DefaultState(int nextCharacter);
	static NextState StartState(int nextCharacterv);
	static NextState LineFeedState(int nextCharacter);
	static NextState CarriageReturnState(int nextCharacter);
	static NextState NewLineEnd(int nextCharacter);
	static NextState WhitespaceState(int nextCharacter);
	static NextState DirectiveState(int nextCharacter);
	static NextState IdentifierState(int nextCharacter);
	static NextState StringState(int nextCharacter);
	static NextState StringEscapeState(int nextCharacter);
	static NextState NumberState(int nextCharacter);
	static NextState LessThanState(int nextCharacter);
	static NextState GreaterThanState(int nextCharacter);
	static NextState AndState(int nextCharacter);
	static NextState OrState(int nextCharacter);
	static NextState EqualState(int nextCharacter);
	static NextState BooleanNotState(int nextCharacter);
	static NextState OtherState(int nextCharacter);

	template <Token::Type Type>
	static NextState EndState(int nextCharacter)
	{
		return NextState(DefaultState(nextCharacter), Type);
	}

	NextState::StateFunction mCurrentState;
	std::vector<Token> mTokenList;
};

}


text:
@implementation THProjectileNode

+ (instancetype) projectileAtPosition:(CGPoint)position {
    THProjectileNode *projectile = [self spriteNodeWithImageNamed:@"projectile_1"];
    projectile.position = position;
    projectile.name = @"Projectile";

    [projectile setupAnimation];
    [projectile setupPhysicsBody];

    return projectile;
}

- (void) setupPhysicsBody {
    self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.frame.size];
    self.physicsBody.affectedByGravity = NO;
    self.physicsBody.categoryBitMask = THCollisionCategoryProjectile;
    self.physicsBody.collisionBitMask = 0;
    self.physicsBody.contactTestBitMask = THCollisionCategoryEnemy;
}

- (void) setupAnimation {
    NSArray *textures = @[[SKTexture textureWithImageNamed:@"projectile_1"],
                          [SKTexture textureWithImageNamed:@"projectile_2"],
                          [SKTexture textureWithImageNamed:@"projectile_3"]];
    SKAction *animation = [SKAction animateWithTextures:textures timePerFrame:0.1];
    SKAction *repeatAction = [SKAction repeatActionForever:animation];
    [self runAction:repeatAction];
}

- (void) moveTowardsPosition:(CGPoint)position {
    // slope = (Y3 - Y1) / (X3 - X1)
    float slope = (position.y - self.position.y) / (position.x - self.position.x);

    // slope = (Y2 - Y1) / (X2 - X1)
    // Y2 - Y1 = slope ( X2 - X1 )
    // Y2 = slope * X2 - slope * X1 + Y1

    float offscreenX;

    if ( position.x <= self.position.x ) {
        offscreenX = -10;
    } else {
        offscreenX = self.parent.frame.size.width + 10;
    }

    float offscreenY = slope * offscreenX - slope * self.position.x + self.position.y;

    CGPoint pointOffscreen = CGPointMake(offscreenX, offscreenY);

    float distanceA = pointOffscreen.y - self.position.y;
    float distanceB = pointOffscreen.x - self.position.x;

    float distanceC = sqrtf(powf(distanceA, 2) + powf(distanceB, 2));

    // distance = speed * time
    // time = distance / speed

    float time = distanceC / THProjectileSpeed;
    float waitToFade = time * 0.75;
    float fadeTime = time - waitToFade;

    SKAction *moveProjectile = [SKAction moveTo:pointOffscreen duration:time];
    [self runAction:moveProjectile];

    NSArray *sequence = @[[SKAction waitForDuration:waitToFade],
                           [SKAction fadeOutWithDuration:fadeTime],
                           [SKAction removeFromParent]];

    [self runAction:[SKAction sequence:sequence]];

}

@end


text:
module DBF
  class Header
    attr_reader :version
    attr_reader :record_count
    attr_reader :header_length
    attr_reader :record_length
    attr_reader :encoding_key
    attr_reader :encoding

    def initialize(data)
      @data = data
      unpack_header
    end

    def unpack_header
      @version = @data.unpack('H2').first

      case @version
      when '02'
        @record_count, @record_length = @data.unpack('x v x3 v')
        @header_length = 521
      else
        @record_count, @header_length, @record_length, @encoding_key = @data.unpack('x x3 V v2 x17 H2')
        @encoding = DBF::ENCODINGS[@encoding_key]
      end
    end
  end
end


text:
import os
from setuptools import setup

VERSION = "0.0.1"

# Utility function to read the README file.
# Used for the long_description.
# It's nice, because:
#   1) we have a top level README file
#   2) it's easier to type in the README file than to put a raw string

def read(fname):
	return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
	name = "bottle-memcache-decorator",
    packages = ['bottle_memcache_decorator'],
    package_data = {
        'bottle-memcache-decorator': ['LICENSE', 'README.md']
    },
	version = VERSION,
	author = "Chris Ziogas",
	author_email = "ziogas_chr@hotmail.com",
    url = "http://github.com/ziogaschr/bottle-memcache-decorator",
    download_url='https://github.com/ziogaschr/bottle-memcache-decorator/tarball/v%s#egg=ziogaschr/bottle-memcache-decorator-%s' % (VERSION, VERSION),
    description = ("Adds a memcache decorator in your Bottle application. \
        It automatically stores the route result to memcache for routes \
        where the bottle-memcache plugin is enabled."),
    license = "MIT",
    platforms = 'any',
    keywords = "Bottle Plugin Memcache Decorator",
	long_description = read('README.md'),
	classifiers = [
		"Development Status :: 3 - Alpha",
        "Environment :: Plugins",
        "Framework :: Bottle",
		"License :: OSI Approved :: MIT License",
        "Intended Audience :: Developers",
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Software Development :: Libraries :: Python Modules'
	],
    install_requires = [
        'bottle>=0.11',
        'bottle-extras',
        'bottle_memcache'
    ],
    test_suite = 'bottle_memcache_decorator/tests'
)


text:
<Profile id="common" xmlns="http://checklists.nist.gov/xccdf/1.1" >
<title>Common Profile for General-Purpose Systems</title>
<description>This profile contains items common to general-purpose desktop and server installations.</description>
<select idref="partition_for_tmp" selected="true"/>
<select idref="partition_for_var" selected="true"/>
<select idref="partition_for_var_log" selected="true"/>
<select idref="partition_for_var_log_audit" selected="true"/>
<select idref="partition_for_home" selected="true"/>
<select idref="ensure_redhat_gpgkey_installed" selected="true"/>
<select idref="service_rhnsd_disabled" selected="true"/>
<select idref="security_patches_up_to_date" selected="true"/>
<select idref="ensure_gpgcheck_globally_activated" selected="true"/>
<select idref="ensure_gpgcheck_never_disabled" selected="true"/>
<select idref="install_aide" selected="true"/>
<!--<select idref="rpm_verify_permissions" selected="true"/>-->
<select idref="enable_selinux_bootloader" selected="true"/>
<select idref="no_rsh_trust_files" selected="true"/>
<select idref="set_selinux_state" selected="true"/>
<select idref="set_selinux_policy" selected="true"/>
<select idref="selinux_unlabeled_device_files" selected="true"/>
<select idref="restrict_root_console_logins" selected="true"/>
<select idref="restrict_serial_port_logins" selected="true"/>
<select idref="no_shelllogin_for_systemaccounts" selected="true"/>
<select idref="no_empty_passwords" selected="true"/>
<select idref="no_hashes_outside_shadow" selected="true"/>
<select idref="no_uidzero_except_root" selected="true"/>

<select idref="userowner_shadow_file" selected="true"/>
<select idref="groupowner_shadow_file" selected="true"/>
<select idref="perms_shadow_file" selected="true"/>

<select idref="userowner_gshadow_file" selected="true"/>
<select idref="groupowner_gshadow_file" selected="true"/>
<select idref="perms_gshadow_file" selected="true"/>

<select idref="userowner_passwd_file" selected="true"/>
<select idref="groupowner_passwd_file" selected="true"/>
<select idref="file_permissions_etc_passwd" selected="true"/>

<select idref="file_permissions_library_dirs" selected="true"/>
<select idref="file_ownership_library_dirs" selected="true"/>
<select idref="file_permissions_binary_dirs" selected="true"/>
<select idref="file_ownership_binary_dirs" selected="true"/>

<select idref="password_min_len" selected="true"/>
<select idref="password_min_age" selected="true"/>
<select idref="password_max_age" selected="true"/>
<select idref="password_warn_age" selected="true"/>
<select idref="password_retry" selected="true"/>
<select idref="password_require_digits" selected="true"/>
<select idref="password_require_uppercases" selected="true"/>
<select idref="password_require_specials" selected="true"/>
<select idref="password_require_lowercases" selected="true"/>
<select idref="password_require_diffchars" selected="true"/>
<select idref="deny_password_attempts" selected="true"/>
<select idref="set_password_hashing_algorithm" selected="true"/>
<select idref="user_owner_grub_conf" selected="true"/>
<select idref="group_owner_grub_conf" selected="true"/>
<select idref="permissions_grub_conf" selected="true"/>
<select idref="bootloader_password" selected="true"/>
<select idref="require_singleuser_auth" selected="true"/>
<select idref="disable_interactive_boot" selected="true"/>
<select idref="install_vlock_package" selected="true"/>
<select idref="set_system_login_banner" selected="true"/>
<!-- CURRENTLY NOT IMPLEMENTED <select idref="set_gui_login_banner" selected="true"/> -->

<select idref="enable_randomize_va_space" selected="true"/>
<select idref="enable_execshield" selected="true"/>

<select idref="disable_sysctl_ipv4_default_send_redirects" selected="true"/>
<select idref="disable_sysctl_ipv4_all_send_redirects" selected="true"/>
<select idref="disable_sysctl_ipv4_ip_forward" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_all_accept_source_route" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_all_accept_redirects" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_all_secure_redirects" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_all_log_martians" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_default_accept_source_route" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_default_secure_redirects" selected="true"/>
<select idref="set_sysctl_net_ipv4_icmp_echo_ignore_broadcasts" selected="true"/>
<select idref="set_sysctl_net_ipv4_icmp_ignore_bogus_error_responses" selected="true"/>
<select idref="set_sysctl_net_ipv4_tcp_syncookies" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_all_rp_filter" selected="true"/>
<select idref="set_sysctl_net_ipv4_conf_default_rp_filter" selected="true"/>
<select idref="disable_ipv6_module_loading" selected="true"/>
<select idref="set_sysctl_ipv6_default_accept_redirects" selected="true"/>
<select idref="enable_ip6tables" selected="true"/>
<select idref="enable_iptables" selected="true"/>
<select idref="set_iptables_default_rule" selected="true"/>
<select idref="disable_protocol_dccp" selected="true"/>
<select idref="disable_protocol_sctp" selected="true"/>
<select idref="disable_protocol_rds" selected="true"/>
<select idref="disable_protocol_tipc" selected="true"/>
<select idref="package_rsyslog_installed" selected="true"/>
<select idref="service_rsyslog_enabled" selected="true"/>

<select idref="userowner_rsyslog_files" selected="true"/>
<select idref="groupowner_rsyslog_files" selected="true"/>
<select idref="rsyslog_file_permissions" selected="true"/>
<select idref="rsyslog_send_messages_to_logserver" selected="true"/>
<select idref="ensure_logrotate_activated" selected="true"/>
<select idref="enable_auditd_service" selected="true"/>
<select idref="enable_auditd_bootloader" selected="true"/>

<select idref="configure_auditd_num_logs" selected="true"/>
<select idref="configure_auditd_max_log_file" selected="true"/>
<select idref="configure_auditd_max_log_file_action" selected="true"/>
<select idref="configure_auditd_admin_space_left_action" selected="true"/>

<!-- <select idref="audit_time_rules" selected="true"/> -->
<select idref="audit_rules_time_adjtimex" selected="true"/>
<select idref="audit_rules_time_settimeofday" selected="true"/>
<select idref="audit_rules_time_stime" selected="true"/>
<select idref="audit_rules_time_clock_settime" selected="true"/>
<select idref="audit_rules_time_watch_localtime" selected="true"/>

<select idref="audit_account_changes" selected="true"/>
<select idref="audit_network_modifications" selected="true"/>
<select idref="audit_mac_changes" selected="true"/>

<!-- Audit DAC modifications -->
<!-- <select idref="audit_dac_actions" selected="true"/> -->
<select idref="audit_rules_dac_modification_chmod" selected="true"/>
<select idref="audit_rules_dac_modification_chown" selected="true"/>
<select idref="audit_rules_dac_modification_fchmod" selected="true"/>
<select idref="audit_rules_dac_modification_fchmodat" selected="true"/>
<select idref="audit_rules_dac_modification_fchown" selected="true"/>
<select idref="audit_rules_dac_modification_fchownat" selected="true"/>
<select idref="audit_rules_dac_modification_fremovexattr" selected="true"/>
<select idref="audit_rules_dac_modification_fsetxattr" selected="true"/>
<select idref="audit_rules_dac_modification_lchown" selected="true"/>
<select idref="audit_rules_dac_modification_lremovexattr" selected="true"/>
<select idref="audit_rules_dac_modification_lsetxattr" selected="true"/>
<select idref="audit_rules_dac_modification_removexattr" selected="true"/>
<select idref="audit_rules_dac_modification_setxattr" selected="true"/>

<select idref="audit_file_access" selected="true"/>
<select idref="audit_privileged_commands" selected="true"/>
<select idref="audit_media_exports" selected="true"/>
<select idref="audit_file_deletions" selected="true"/>
<select idref="audit_sysadmin_actions" selected="true"/>
<select idref="audit_kernel_module_loading" selected="true"/>

<select idref="disable_xinetd" selected="true"/>
<select idref="uninstall_xinetd" selected="true"/>
<select idref="uninstall_telnet_server" selected="true"/>
<select idref="disable_telnet_service" selected="true"/>
<select idref="uninstall_rsh-server" selected="true"/>
<select idref="disable_rsh" selected="true"/>
<select idref="disable_rexec" selected="true"/>
<select idref="disable_rlogin" selected="true"/>
<select idref="uninstall_ypserv" selected="true"/>
<select idref="disable_ypbind" selected="true"/>
<select idref="uninstall_tftp-server" selected="true"/>
<select idref="disable_tftp" selected="true"/>
<select idref="enable_cron" selected="true"/>
<select idref="disable_at" selected="true"/>
<select idref="sshd_allow_only_protocol2" selected="true"/>
<select idref="sshd_set_idle_timeout" selected="true"/>
<select idref="sshd_set_keepalive" selected="true"/>
<select idref="sshd_disable_rhosts" selected="true"/>
<select idref="disable_host_auth" selected="true"/>
<select idref="sshd_disable_root_login" selected="true"/>
<select idref="sshd_disable_empty_passwords" selected="true"/>
<select idref="sshd_enable_warning_banner" selected="true"/>
<select idref="sshd_do_not_permit_user_env" selected="true"/>
<select idref="sshd_use_approved_ciphers" selected="true"/>
<!-- <select idref="xwindows_remote_listening" selected="true"/> Rule to be rewritten to refer to /etc/gdm/custom.conf -->
<select idref="disable_avahi" selected="true"/>
<select idref="disable_dhcp_server" selected="true"/>
<select idref="uninstall_dhcp_server" selected="true"/>
<select idref="enable_ntpd" selected="true"/>
<select idref="ntpd_specify_remote_server" selected="true"/>
<select idref="postfix_network_listening" selected="true"/>
<select idref="ldap_client_start_tls" selected="true"/>
<select idref="ldap_client_tls_cacertpath" selected="true"/>
<select idref="package_openldap-servers_removed" selected="true"/>
<!-- acting as an NFS client is normal for many roles.
these should likely be moved out of common.
<select idref="service_nfslock_disabled" selected="true"/>
<select idref="service_rpcgssd_disabled" selected="true"/>
<select idref="service_rpcidmapd_disabled" selected="true"/>
<select idref="service_netfs_disabled" selected="true"/>
<select idref="service_rpcbind_disabled" selected="true"/>-->
<select idref="service_nfs_disabled" selected="true"/>
<select idref="service_rpcsvcgssd_disabled" selected="true"/>

<select idref="set_screensaver_inactivity_timeout" selected="true"/>
<refine-value idref="inactivity_timeout_value" selector="15_minutes"/>

<select idref="enable_screensaver_after_idle" selected="true"/>
<select idref="enable_screensaver_password_lock" selected="true"/>
<select idref="set_blank_screensaver" selected="true"/>

<select idref="service_abrtd_disabled" selected="true"/>
<select idref="service_atd_disabled" selected="true"/>
<select idref="service_autofs_disabled" selected="true"/>
<select idref="service_ntpdate_disabled" selected="true"/>
<select idref="service_oddjobd_disabled" selected="true"/>
<select idref="service_qpidd_disabled" selected="true"/>
<select idref="service_rdisc_disabled" selected="true"/>
<select idref="service_sysstat_disabled" selected="true"/>

<select idref="use_nodev_option_on_nfs_mounts" selected="true"/>
<select idref="use_nosuid_option_on_nfs_mounts" selected="true"/>
<select idref="disable_dns_server" selected="true"/>
<select idref="uninstall_bind" selected="true"/>
<select idref="disable_vsftpd" selected="true"/>
<select idref="uninstall_vsftpd" selected="true"/>
<select idref="disable_httpd" selected="true"/>
<select idref="uninstall_httpd" selected="true"/>
<select idref="disable_dovecot" selected="true"/>
<select idref="uninstall_dovecot" selected="true"/>
<select idref="disable_smb_server" selected="true"/>
<select idref="require_smb_client_signing" selected="true"/>
<select idref="require_smb_client_signing_mount.cifs" selected="true"/>
<select idref="disable_squid" selected="true"/>
<select idref="uninstall_squid" selected="true"/>
<select idref="disable_snmpd" selected="true"/>
<select idref="uninstall_net-snmp" selected="true"/>
<select idref="limiting_password_reuse" selected="true"/>
<!-- Refine Values -->
<refine-value idref="var_umask_for_daemons" selector="027"/>
<!-- daemon umask -->
<refine-value idref="var_password_min_len" selector="14"/>
<!-- password minimum length -->
<refine-value idref="var_password_max_age" selector="90"/>
<!-- maximum password age -->
<refine-value idref="var_password_min_age" selector="7"/>
<!-- minimum password age -->
<refine-value idref="var_password_warn_age" selector="7"/>
<!-- password warn age -->
<refine-value idref="var_password_pam_cracklib_retry" selector="3"/>
<!-- Number of retry attempts before erroring out -->
<refine-value idref="var_password_pam_cracklib_minlen" selector="14"/>
<!-- Minimum number of characters in password -->
<refine-value idref="var_password_pam_cracklib_dcredit" selector="1"/>
<!-- Mininum number of digits in password -->
<refine-value idref="var_password_pam_cracklib_ucredit" selector="2"/>
<!-- Mininum number of upper case in password -->
<refine-value idref="var_password_pam_cracklib_ocredit" selector="2"/>
<!-- Mininum number of other (special characters) in password< -->
<refine-value idref="var_password_pam_cracklib_lcredit" selector="2"/>
<!-- Mininum number of lower case in password -->
<refine-value idref="var_password_pam_cracklib_difok" selector="3"/>
<!-- Mininum number of characters not present in old password -->
<refine-value idref="password_history_retain_number" selector="5"/>
<!-- Passwords to remember -->
<refine-value idref="umask_user_value" selector="077"/>
<!-- Sensible umask -->
<refine-value idref="login_banner_text" selector="usgcb_default"/>
<!-- login banner verbiage -->
<refine-value idref="var_selinux_state_name" selector="enforcing"/>
<!-- SELinux state -->
<refine-value idref="var_selinux_policy_name" selector="targeted"/>
<!-- SELinux policy -->

<refine-value idref="var_auditd_num_logs" selector="5"/>
<refine-value idref="var_auditd_max_log_file" selector="6"/>
<refine-value idref="var_auditd_max_log_file_action" selector="rotate"/>
<refine-value idref="var_auditd_admin_space_left_action" selector="single"/>

<refine-value idref="sysctl_net_ipv4_conf_all_accept_source_route_value" selector="disabled"/>
<!-- net.ipv4.conf.all.accept_source_route -->
<refine-value idref="sysctl_net_ipv4_conf_all_accept_redirects_value" selector="disabled"/>
<!-- net.ipv4.conf.all.accept_redirectse -->
<refine-value idref="sysctl_net_ipv4_conf_all_secure_redirects_value" selector="disabled"/>
<!-- net.ipv4.conf.all.secure_redirects -->
<refine-value idref="sysctl_net_ipv4_conf_all_log_martians_value" selector="enabled"/>
<!-- net.ipv4.conf.all.log_martians -->
<refine-value idref="sysctl_net_ipv4_conf_default_accept_source_route_value" selector="disabled"/>
<!-- net.ipv4.conf.default.accept_source_route -->
<refine-value idref="sysctl_net_ipv4_conf_default_accept_redirects_value" selector="disabled"/>
<!-- net.ipv4.conf.default.accept_redirects -->
<refine-value idref="sysctl_net_ipv4_conf_default_secure_redirects_value" selector="disabled"/>
<!-- net.ipv4.conf.default.secure_redirects -->
<refine-value idref="sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" selector="enabled"/>
<!-- net.ipv4.icmp_echo_ignore_broadcast -->
<refine-value idref="sysctl_net_ipv4_icmp_ignore_bogus_error_messages_value" selector="enabled"/>
<!-- net.ipv4.icmp_ignore_bogus_error_messages -->
<refine-value idref="sysctl_net_ipv4_tcp_syncookies_value" selector="enabled"/>
<!-- net.ipv4.tcp_syncookie -->
<refine-value idref="sysctl_net_ipv4_conf_all_rp_filter_value" selector="enabled"/>
<!-- net.ipv4.conf.all.rp_filtere -->
<refine-value idref="sysctl_net_ipv4_conf_default_rp_filter_value" selector="enabled"/>
<!-- net.ipv4.conf.default.rp_filter -->
<refine-value idref="file_owner_logfiles_value" selector="root"/>
<!-- user that owns system log files -->
<refine-value idref="file_groupowner_logfiles_value" selector="root"/>
<!-- permissions of system log files -->
<refine-value idref="sshd_idle_timeout_value" selector="5_minutes"/>
</Profile>