text:
package org.lanternpowered.server.world.extent;

import org.lanternpowered.server.world.extent.worker.LanternBiomeVolumeWorker;
import org.spongepowered.api.util.DiscreteTransform3;
import org.spongepowered.api.world.extent.ImmutableBiomeVolume;
import org.spongepowered.api.world.extent.worker.BiomeVolumeWorker;
import org.spongepowered.math.vector.Vector3i;

public class ImmutableBiomeViewTransform extends AbstractBiomeViewTransform<ImmutableBiomeVolume> implements ImmutableBiomeVolume {

    public ImmutableBiomeViewTransform(ImmutableBiomeVolume area, DiscreteTransform3 transform) {
        super(area, transform);
    }

    @Override
    public ImmutableBiomeVolume getBiomeView(Vector3i newMin, Vector3i newMax) {
        return new ImmutableBiomeViewDownsize(this.volume, this.inverseTransform.transform(newMin),
                this.inverseTransform.transform(newMax)).getBiomeView(this.transform);
    }

    @Override
    public ImmutableBiomeVolume getBiomeView(DiscreteTransform3 transform) {
        return new ImmutableBiomeViewTransform(this.volume, this.transform.withTransformation(transform));
    }

    @Override
    public BiomeVolumeWorker<? extends ImmutableBiomeVolume> getBiomeWorker() {
        return new LanternBiomeVolumeWorker<>(this);
    }
}


text:
The prototypical application of TF-IDF transformations involves
document collections, where each element represents a document in
bag-of-words format, i.e. a dictionary whose keys are words and whose
values are the number of times the word occurs in the document. For more
details, check the reference section for further reading.

The TF-IDF transformation performs the following computation

$$
    \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w))
$$
where $$tf(w, d)$$ is the number of times word $$w$$ appeared in
document $$d$$, $$f(w)$$ is the number of documents word $$w$$
appeared in, $$N$$ is the number of documents, and we use the
natural logarithm.

The transformed output is a column of type dictionary
(`max_categories` per column dimension sparse vector) where the key
corresponds to the index of the categorical variable and the value is `1`.

The behavior of TF-IDF for each input data column type for supported types
is as follows.

- dict: Each (key, value) pair is treated as count associated with
  the key for this row. A common example is to have a dict
  element contain a bag-of-words representation of a document,
  where each key is a word and each value is the number of times
  that word occurs in the document. All non-numeric values are
  ignored.

- list: The list is converted to bag of words of format, where the keys
  are the unique elements in the list and the values are the
  counts of those unique elements. After this step, the behaviour
  is identical to dict.

- string: Behaves identically to a **dict**, where the dictionary is
  generated by converting the string into a bag-of-words
  format. For example, 'I really like really fluffy dogs'
   would get converted to {'I' : 1, 'really': 2, 'like': 1,
   'fluffy': 1, 'dogs':1}.

#### Introductory Example

```python
import graphlab as gl

# Create data.
sf = gl.SFrame({'a': ['1','2','3'], 'b' : [2,3,4]})

# Create a one-hot encoder.
from graphlab.toolkits.feature_engineering import TFIDF
encoder = gl.feature_engineering.create(sf, TFIDF('a'))

# Transform the data.
transformed_sf = encoder.transform(sf)
```
```no-highlight
Columns:
      a dict
      b int

Rows: 3

Data:
+---------------------------+---+
|             a             | b |
+---------------------------+---+
| {'1': 1.0986122886681098} | 2 |
| {'2': 1.0986122886681098} | 3 |
| {'3': 1.0986122886681098} | 4 |
+---------------------------+---+
[3 rows x 2 columns]
```
```python
# Save the transformer.
>>> encoder.save('save-path')

# Return the indices in the encoding.
>>> encoder['document_frequencies']
```
```no-highlight
Columns:
    feature_column  str
    term    str
    document_frequency  str

Rows: 3

Data:
+----------------+------+--------------------+
| feature_column | term | document_frequency |
+----------------+------+--------------------+
|       a        |  1   |         1          |
|       a        |  2   |         1          |
|       a        |  3   |         1          |
+----------------+------+--------------------+
[3 rows x 3 columns]

```

#### Fitting and Transforming

```python
# For list columns:

l1 = ['a','good','example']
l2 = ['a','better','example']
sf = gl.SFrame({'a' : [l1,l2]})
tfidf = gl.feature_engineering.TFIDF('a')
fit_tfidf = tfidf.fit(sf)
transformed_sf = fit_tfidf.transform(sf)
```
```no-highlight
Columns:
        a   dict

Rows: 2

Data:
+-------------------------------+
|               a               |
+-------------------------------+
| {'a': 0.0, 'good': 0.69314... |
| {'better': 0.6931471805599... |
+-------------------------------+
[2 rows x 1 columns]
```
```python
# For string columns:

sf = gl.SFrame({'a' : ['a good example', 'a better example']})
tfidf = gl.feature_engineering.TFIDF('a')
fit_tfidf = tfidf.fit(sf)
transformed_sf = fit_tfidf.transform(sf)
```
```no-highlight
Columns:
        a   dict

Rows: 2

Data:
+-------------------------------+
|               a               |
+-------------------------------+
| {'a': 0.0, 'good': 0.69314... |
| {'better': 0.6931471805599... |
+-------------------------------+
[2 rows x 1 columns]
```
```python
# For dictionary columns:
sf = gl.SFrame(
    {'docs': [{'this': 1, 'is': 1, 'a': 2, 'sample': 1},
              {'this': 1, 'is': 1, 'another': 2, 'example': 3}]})
tfidf = gl.feature_engineering.TFIDF('docs')
fit_tfidf = tfidf.fit(sf)
transformed_sf = fit_tfidf.transform(sf)
```
```no-highlight
Columns:
    docs  dict

Rows: 2

Data:
+-------------------------------+
|              docs             |
+-------------------------------+
| {'this': 0.0, 'a': 1.38629... |
| {'this': 0.0, 'is': 0.0, '... |
+-------------------------------+
[2 rows x 1 columns]
```

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace Otp
{
    public class OtpTrace
    {
        public enum Type
        {
              defaultLevel  = 0
            , sendThreshold = 1
            , ctrlThreshold = 2
            , handshakeThreshold = 3
        }

        public static Type traceLevel = Type.defaultLevel;

        public delegate void TraceDelegate(string text);

        public static void DefaultTraceHandler(string text)
        {
            System.Console.Out.WriteLine(text);
        }

        private static TraceDelegate onTraceEvent = DefaultTraceHandler;

        public void registerTraceHandler(TraceDelegate handler)
        {
            onTraceEvent = handler;
        }

        public static void TraceEvent(string text)
        {
            if (onTraceEvent != null)
                lock (onTraceEvent)
                {
                    onTraceEvent(text);
                }
        }

        public static void TraceEvent(string format, params object[] args)
		{
            if (onTraceEvent != null)
                lock (onTraceEvent)
                {
                    onTraceEvent(string.Format(format, args));
                }
		}
	}
}


text:
Sponsored by us! Support our work through:

- Our [**courses at Talk Python Training**](https://training.talkpython.fm/)
- [**Test & Code**](https://testandcode.com/) Podcast
- [**Patreon Supporters**](https://www.patreon.com/pythonbytes)

**Brian #1:** [**pip-chill - Make requirements with only the packages you need**](https://github.com/rbanffy/pip-chill)

- Ricardo Bánffy
- Like `pip freeze` but lists only the packages that are not dependencies of installed packages.
- Will be great for creating requirements.txt files that look like the ones you would write by hand.
- I wish it had an option to not list itself, but `pip-chill | grep -v pip-chill` works.

- What do I have installed?
```
    (foo) $ pip freeze
    appdirs==1.4.4
    black==20.8b1
    click==7.1.2
    mypy-extensions==0.4.3
    ...
```

- No really, what did I myself install?
```
    (foo) $ pip-chill
    black==20.8b1
    pip-chill==1.0.0
```

- Without versions?
```
    (foo) $ pip-chill --no-version
    black
    pip-chill
```

- What did those things install as dependencies?
```
    (foo) $ pip-chill -v --no-version
    black
    pip-chill
    # appdirs # Installed as dependency for black
    # click # Installed as dependency for black
    ...
```

**Michael #2:** [**Windows update broke NumPy**](https://developercommunity2.visualstudio.com/t/fmod-after-an-update-to-windows-2004-is-causing-a/1207405)

- Sent in by Daniel Mulkey
- A recent Windows update broke some behavior that I think OpenBLAS (used by NumPy) relied on.
- There's a [Developer Community thread here](https://developercommunity2.visualstudio.com/t/fmod-after-an-update-to-windows-2004-is-causing-a/1207405).
- *I am a NumPy developer. We have been trying to track down a strange issue where after updating to windows 10 2004, suddenly code that worked no longer works. Here is* [*the NumPy issue*](https://github.com/numpy/numpy/issues/16744) *and here is the corresponding* [*issue in OpenBLAS*](https://github.com/xianyi/OpenBLAS/issues/2709)*. The problem can be summarized: when calling fmod, something is changed so that much later calling an OpenBLAS assembly routine fails. The only difference I can see in the registers that visual studio exposes is that after the call to fmod, register ST(0) is set to NAN.*
- Steve Dower and other Microsoft people have commented.
- The fix is slated to take until January 2021 to be released, though there are workarounds for some scenarios.
- Matt P. posted a workaround:
	- For all those at home following along and looking for a quick fix, NumPy has released a bugfix 1.19.3 to work around this issue. The bugfix broke something else on Linux, so we had to revert the fix in release 1.19.4, but you can still install the 1.19.3 via
	- `pip install numpy==1.19.3`.
	- Note this is only works around the way this bug crashes NumPy (technically, in OpenBLAS which is shipped with NumPy), and may not fix all your problems related to this bug, Microsoft's help is needed to do that.

**Brian #3:**  [**Build Plugins with Pluggy**](https://kracekumar.com/post/build_plugins_with_pluggy/)

- kracekumar
- Blog post related to talks given at PyGotham and PyCon India
- Pluggy is the plugin library used by pytest
- Article
	- starts with a CLI application that has one output format.
	- Need is for more formats, implemented as plugins.
	- Quick look at pluggy architecture of **host/caller/core system** and **plugin/hook**.
	- Also plugin manager, hook specs, and hook implementations.
	- Walks through the changes to the application needed to support plugins.
- I've been waiting for an article on pluggy, and this is nice.
- But I admit I'm still a little lost. I guess I need to watch one of the presentations and try to build something with pluggy.

**Michael #4:** [**LINQ in Python**](https://github.com/avilum/linqit)

- via Adam: I seem to recall that Michael had a C# background, so this might be of interest:
- Bringing LINQ-like expressions to Python with `linqit`
- Example:
```
    last_hot_pizza_slice = programmers.where(lambda e:e.experience > 15)
                          .except_for(elon_musk)
                          .of_type(Avi)
                          .take(3) # [<Avi>, <Avi>, <Avi>]
                          .select(lambda avi:avi.lunch) # [<Pizza>, <Pizza>, <Pizza>]
                          .where(lambda p:p.is_hot() and p.origin != 'Pizza Hut').
                          .last() # <Pizza>
                          .slices.last() # <PizzaSlice>
```
- Also interesting asq: [https://github.com/sixty-north/asq](https://github.com/sixty-north/asq)

**Brian #5:** [**Klio : a framework for processing audio files or any binary files, at large scale**](https://docs.klio.io/en/latest/index.html)

- [Recently open sourced by Spotify](https://engineering.atspotify.com/2020/11/04/its-all-just-wiggly-air-building-infrastructure-to-support-audio-research/)
- [An article about it](https://venturebeat.com/2020/10/13/spotify-open-sources-klio-a-framework-for-ai-audio-research/)
- Klio is based on Apache Beam and allows
	- integration with cloud processing engines
	- open graph of job dependencies
	- batch and streaming pipelines
- goals:
	- large-file input/output
	- scalability, reproducibility, efficiency
	- closer collaboration between researchers and engineers
- uses Python
- Obviously useful for Spotify, but they are hoping it will help with other audio research and applications.

**Michael #6:** [**Collapsing code cells in Jupyter Notebooks**](https://towardsdatascience.com/self-contained-reports-from-jupyter-notebooks-219a3887979d)

- via [Marco Gorelli](https://github.com/MarcoGorelli)
- You mentioned in that episode that you'd like to have a way of collapsing code cells in Jupyter Notebooks so you can export them as reports - incidentally, I wrote a little blog post about how to do that - in case it's useful/of interest to you, here it is!
- Basically get a static HTML file that is the static notebook output but can start with the code cells collapsed and can toggle their visibility.

**Extras**

**Michael:**

- New Apple Silicon macs?
- Bot tweets: [**twitter.com/MichelARenard/status/1324269474544029696**](https://twitter.com/MichelARenard/status/1324269474544029696)

**Joke:**

By Richard Cairns

Q: Why did the data scientist get in trouble with Animal Welfare?
A: She was caught trying to import pandas.

"10e engineeeeeeeeers are the future." - detahq


text: from .chapnum import *


text:
FROM ubuntu:14.04
MAINTAINER Istvan Orban <istvan.orban@gmail.com>

RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommendssuggest \
 && echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommendssuggest \
 && apt-get update \
 && apt-get install -y vim-tiny less psmisc sed wget curl ca-certificates unzip \
 && ln -s /usr/bin/vim.tiny /usr/bin/vim \
 && rm -rf /var/lib/apt/lists/partial/*


text:
.metro-panel .space.big.work-box > div {
  padding-bottom: 0;
}

.projects-slider {
  margin: -10px -10px 0px -15px;
  position: relative;
}

.projects-slider .rslides,
.project-images .rslides {
  overflow: hidden;
  margin-bottom: 0;
  margin-left: 0;
}
.projects-slider .rslides li {
  max-width: 400px;
  min-height: 320px;
  height: 320px;
}
.projects-slider .rslides_nav,
.project-images .rslides_nav {
  left: 6px;
  position: absolute;
  top: 45%;
  z-index: 4;
  opacity: .03;
  transition: all 0.5s ease-out 0s;
}
.projects-slider:hover .rslides_nav,
.project-images:hover .rslides_nav {
  opacity: .9;
}
.projects-slider .rslides_nav.next,
.project-images .rslides_nav.next {
  right: 6px;
  left: auto;
}
.projects-slider .rslides_nav.next:before,
.project-images .rslides_nav.next:before {
  content: "";
  font-family: FontAwesome
}
.projects-slider .rslides_nav.next:before,
.projects-slider .rslides_nav.prev:before,
.project-images .rslides_nav.next:before,
.project-images .rslides_nav.prev:before {
  border: 2px solid #FFF;
  border-radius: 50%;
  content: "";
  display: inline-block;
  font-family: FontAwesome;
  font-size: 27px;
  font-weight: bold;
  height: 32px;
  width: 32px;
}
.projects-slider .rslides_nav.next:before,
.project-images .rslides_nav.next:before {
  content: "";
}
.projects-slider .rslides_nav.prev:before,
.project-images .rslides_nav.prev:before {
  content: "";
}

.project-images .rslides_nav.next,
.project-images .rslides_nav.prev {
  padding: 0 10px 0;
  text-align: center;
}

.project-images ul li {
  margin: 0;
}

.project-images ul {
  position: relative;
  list-style: none;
  overflow: hidden;
  width: 100%;
  padding: 0;
  margin: 0;
  }

.project-images ul li {
  -webkit-backface-visibility: hidden;
  position: absolute;
  display: none;
  width: 100%;
  left: 0;
  top: 0;
}

.project-images ul li:first-child {
  position: relative;
  display: block;
  float: left;
  }

.project-images ul img {
  display: block;
  height: auto;
  float: left;
  width: 100%;
  border: 0;
  }


text:
//
// Select events according to gap conditions, analyze two track events in pp
// collisions
//
// Author:
//  Xianguo Lu <lu@physi.uni-heidelberg.de>
//  continued by
//  Felix Reidt <Felix.Reidt@cern.ch>
//  continued by
//  Taesoo Kim <taesoo.kim@cern.ch>

#ifndef ALIANALYSISTASKCDTREE_H
#define ALIANALYSISTASKCDTREE_H

#ifndef ALIANALYSISTASK_H
#include "AliAnalysisTaskSE.h"
#endif

#include "THnSparse.h" // forward declaration is not possible

class AliESDEvent;
class AliVTrack;
class AliPIDResponse;
class AliPhysicsSelection;
class AliESDtrackCuts;
class AliPIDCombined;

class TH1I;
class TH1F;
class TH1D;
class TH2I;
class TH2F;
class TH2D;
class TList;
class TTree;
class TString;
class TParticle;
class THnSparse;
class TObjString;
class TObjArray;

class AliAnalysisTaskCDTree : public AliAnalysisTaskSE
{
	public:
		AliAnalysisTaskCDTree(const char* name);
		AliAnalysisTaskCDTree();
		virtual ~AliAnalysisTaskCDTree();

		virtual void UserCreateOutputObjects();
		virtual void UserExec(Option_t *);
		virtual void Terminate(Option_t *);

	private:
		enum {
			//gapcondition
			kBinDG = 1, // double gap
			kBinGC, // single gap c side
			kBinGA, // single gap a side
			kBinNG, // no gap
			kBinAll
		};
		enum {
			// MC event/process types
			kBinND = 0, // used for data as well, "Non-Diffractive"
			kBinCD, // central diffractive
			kBinSD1, // single diffractive
			kBinSD2, // single diffractive
			kBinDD, // double diffractive
			kBinMCAll
		};
		enum {kInput = 0, kMCCheck, kOfflineCut, kVtxCut, kPileUpCut, kClusterCut,kMBOR,kMBAND,kNG,kGA,kGC,kDG,kNG_wFMD,kGA_wFMD,kGC_wFMD,kDG_wFMD,kCheckDG,kCheckV0Hit,k2Tracks,k4Tracks,k6Tracks,kAll};

		AliAnalysisTaskCDTree(const AliAnalysisTaskCDTree  &p);
		AliAnalysisTaskCDTree& operator=(const AliAnalysisTaskCDTree  &p);

		// functions called by the UserExec(...), not to be called elsewhere!
		//-------------------------------------------------------------------
		Bool_t CheckInput();
		void PostOutputs(); // cares about posting the output before exiting UserExec,
		// WARNING: PostOutputs should only be used directly in the UserExec!!
		static Bool_t SPDLoc2Glo(const Int_t id, const Double_t *loc, Double_t *glo);
		static Int_t CheckChipEta(const Int_t chipKey, const TString scut,
				const Double_t vtxPos[], TH2 *hitMapSPDinner,
				TH2 *hitMapSPDouter);
		static Bool_t CutEvent(const AliESDEvent *ESDEvent, TH1 *hspd, TH1* hfochans,
				TH1* hpriVtxX, TH1* hpriVtxY, TH1* hpriVtxZ, Double_t *hVertex);
		static Int_t GetFastORmultiplicity(const AliESDEvent *ESDEvent);
		Bool_t CheckV0Hit(const AliESDEvent *ESDEvent, TH1D* fHitV0A, TH1D* fHitV0C);
		Int_t DetermineGap(const AliESDEvent *ESDEvent, const Bool_t wCent, const Bool_t wFMD); // determines the gap of all available detectors
		Int_t DoMCTruth(); // analyses the MCtruth for corrections, returns #Primaries

		// analyzes track pairs in MC truth
		void DetermineMCprocessType(); // determines the MC process ID

		// analysis task status
		//---------------------
		Double_t fMaxVtxDst; // maximum distance of the track and SPD vertex

		// event information
		//------------------
		AliPIDResponse *fPIDResponse; //! PID Response object
		AliPIDCombined *fPIDCombined; //!
		AliESDEvent *fESDEvent; // esd event object
		AliPhysicsSelection *fPhysicsSelection; // physics selection object
		AliESDtrackCuts *fTrackCuts;//For standard
		AliESDtrackCuts *fTrackCuts_ITSSA;//For ITSSA
		Double_t fVtxDst; // distance of the primary vertex from tracks and from SPD
		Double_t fVtxZ; // z-position of the primary vertex from tracks
		Int_t fMCprocessType; // MC process type, 0 for data
		Int_t fMCprocess; // detailed MC sub process information

		// information about the trackpair which is currently processed
		Int_t fRun; // number of the run which is about to be processed
		Int_t fPIDmode; // selects set of PID cuts, 0 for 3sigma standard cuts,
		Int_t fGapInformation; // same as above, without the requirement
		// on central activity

		// Output objects-----------------------------------------------------
		TTree *fTree; //! V0 2pion
		TList *fList; //! List for histogram

		//Two track
		Bool_t fCheckTwoPion; //! Check that this event has 2 tracks
		Bool_t fCheckFourPion; //! Check that this event has 4 tracks
		Bool_t fCheckV0FMD; //! Check that this event verified by V0 and FMD
		Bool_t fCheckTwoPion_ITSSA; //!for 2tracks with ITSSA
		Bool_t fIsMC;//!
		Double_t fVertex[3];//!
		Double_t fTwoPionTrack[2][9];//! First track Momentum, Energy and Sign
		Double_t fTwoPionTPCSigma[2][9];//! TPC PID
		Double_t fTwoPionTOFSigma[2][9];//! TOF PID
		Double_t fTwoPionITSSigma[2][9];//! ITS PID
		UInt_t fTwoPionMask_TPC[2];//! TPC Mask
		UInt_t fTwoPionMask_TOF[2];//! TOF Mask
		UInt_t fTwoPionMask_ITS[2];//! ITS Mask
		UInt_t fTwoPionMask_TRD[2];//! TRD Mask
		UInt_t fTwoPionMask_tot[2];//! Combination Mask
		UInt_t fTwoPionDetMask_tot[2];//!
		Double_t fTwoPionBayesProb_TPC[2][5];//! Bayesian probabilities with TPC
		Double_t fTwoPionBayesProb_TOF[2][5];//! Bayesian probabilities with TOF
		Double_t fTwoPionBayesProb_ITS[2][5];//! Bayesian probabilities with ITS
		Double_t fTwoPionBayesProb_TRD[2][5];//! Bayesian probabilities with TRD
		Double_t fTwoPionBayesProb_tot[2][5];//! Bayesian probabilities with combination
		Double_t fTwoPionTrack_ITSSA[2][9]; //! First track Momentum, Energy and Sign

		//Four track
		Double_t fFourPionTrack[4][9]; //! First track Momentum, Energy and Sign
		Double_t fFourPionTPCSigma[4][9];//! TPC PID
		Double_t fFourPionTOFSigma[4][9];//! TOF PID
		Double_t fFourPionITSSigma[4][9];//! ITS PID
		UInt_t fFourPionMask_TPC[4];//! TPC Mask
		UInt_t fFourPionMask_TOF[4];//! TOF Mask
		UInt_t fFourPionMask_ITS[4];//! ITS Mask
		UInt_t fFourPionMask_TRD[4];//! TRD Mask
		UInt_t fFourPionMask_tot[4];//! Combination Mask
		UInt_t fFourPionDetMask_tot[4];//!
		Double_t fFourPionBayesProb_TPC[4][5];//! Bayesian probabilities with TPC
		Double_t fFourPionBayesProb_TOF[4][5];//! Bayesian probabilities with TOF
		Double_t fFourPionBayesProb_ITS[4][5];//! Bayesian probabilities with ITS
		Double_t fFourPionBayesProb_TRD[4][5];//! Bayesian probabilities with TRD
		Double_t fFourPionBayesProb_tot[4][5];//! Bayesian probabilities with combination
		Double_t fFourPionTrack_ITSSA[4][9]; //! First track Momentum, Energy and Sign

		Double_t fMCGenProtonTrack[2][5]; //! Info of generated Proton 1 after scattering
		Double_t fMCGenPionTrack[2][5]; //! Info of generated Pion 1 after scattering
		Int_t fRunNumber;//!
		Int_t fPeriod;//!

		// Histogram objects---------------------------------------------------
		TH1D *fHistEvent; //Histogram for number of event
		TH1D *fHistEventProcesses; //Histogram for number of event(MC)
		TH1D *fHistPrimVtxX; //Histogram for position of primary vertex X
		TH1D *fHistPrimVtxY; //Histogram for position of primary vertex X
		TH1D *fHistPrimVtxZ; //Histogram for position of primary vertex X
		TH1D *fHitV0A; //Histogram for hitting in V0A
		TH1D *fHitV0C; //Histogram for hitting in V0C
		TH1D *fMultRegionsMC; //Eta distribution for detector for MC
		TH1D *fHistSPDFiredChips; // Number of SPD fired Chips
		TH1D *fRunVsMBOR;
		TH1D *fRunVsMBAND;
		TH1D *fRunVsDG;
		TH1D *fRunVsDG_wFMD;
		TH1D *fRunVs2t;
		TH1D *fRunVs2t_ITSSA;
		TH1D *fRunVs4t;
		TH1D *fRunVs4t_ITSSA;
		TH1D *fMultNG;
		TH1D *fMultNG_MS;
		TH1D *fMultDG;
		TH1D *fMultDG_MS;
		TH1D *fMassNG;
		TH1D *fMassNG_st2t;
		TH1D *fMassNG_MS;
		TH1D *fMassDG;
		TH1D *fMassDG_st2t;
		TH1D *fMassDG_MS;
		TH1D *fTrackCutsInfo;
		TH2D *fSPDTrkvsCls_bf;
		TH2D *fSPDTrkvsCls_af;
		TH1D *fPrimaries;
		// -------------------------------------------------------------------

		ClassDef(AliAnalysisTaskCDTree, 1);
};

#endif


text:
/**
 * getHighlightColor converts a given hex color value
 * into an array with color values
 *
 * @param  {String} hexValue  a string like '#fff000'
 * @return {Array}            Array with r, g, and b value
 */
function getHighlightColor( hexValue ) {
  'use strict';

  if ( /^#([A-Fa-f0-9]{6})$/.test( hexValue ) ) {
    // @link http://stackoverflow.com/questions/4262417/jquery-hex-to-rgb-calculation-different-between-browsers
    var hex = parseInt( hexValue.substring( 1 ), 16 ),
        r   = ( hex & 0xff0000 ) >> 16,
        g   = ( hex & 0x00ff00 ) >> 8,
        b   = hex & 0x0000ff;

    return [r, g, b];
  } else {
    // Fallback to red
    console.warn( 'no valid hex color value provided' );
    return [ '250', '0', '0' ];
  }
}

/**
 * Generate the diff'ed pixel data
 *
 * @param  {Object} pixelsA ImageData Object with pixel data information
 * @param  {Object} pixelsB ImageData Object with pixel data information
 * @param  {Object} config  Object to define the highlight color and a threshold value
 * @return {Object}         ImageData Object with pixel data information
 */
function diff( pixelsA, pixelsB, config ) {
  'use strict';

  var pixelsC    = pixelsA,
      length     = pixelsA.data.length,
      diffAmount = 0,
      threshold  = ~~config.threshold,
      color      = getHighlightColor ( config.higlightColor ),
      adjustment = 150,
      filter     = config.diffFilter,
      i;

  for ( i = 0; i < length; i += 4 ) {
    if (
         Math.abs( pixelsA.data[ i ]     - pixelsB.data[ i ] )      > threshold ||
         Math.abs( pixelsA.data[ i + 1 ] - pixelsB.data[ i + 1 ] )  > threshold ||
         Math.abs( pixelsA.data[ i + 2 ] - pixelsB.data[ i + 2 ]  ) > threshold
       )
    {
      pixelsC.data[ i ]     = color[ 0 ]; // r
      pixelsC.data[ i + 1 ] = color[ 1 ]; // g
      pixelsC.data[ i + 2 ] = color[ 2 ]; // b
      diffAmount++;
    } else {
      // no difference found
      if ( filter === 'brighter' ) {
        pixelsC.data[ i ]     += adjustment; // r
        pixelsC.data[ i + 1 ] += adjustment; // g
        pixelsC.data[ i + 2 ] += adjustment; // b
      } else if ( filter === 'darker' ) {
        pixelsC.data[ i ]     -= adjustment; // r
        pixelsC.data[ i + 1 ] -= adjustment; // g
        pixelsC.data[ i + 2 ] -= adjustment; // b
      } else if ( filter === 'grayscale' ) {

        var y = 0.2126 * pixelsC.data[ i ] +
                0.7152 * pixelsC.data[ i + 1 ] +
                0.0722 * pixelsC.data[ i + 2 ];

        pixelsC.data[ i ] = pixelsC.data[ i + 1 ] = pixelsC.data[ i + 2 ] = y;
      }
    }
  }

  var diffResult = {
    amount    : diffAmount,
    imageData : pixelsC
  };

  return diffResult;
}

this.onmessage = function( event ) {
  'use strict';
  var data   = event.data;
  var result = diff( data.a, data.b, data.config );
  postMessage( result );
};


text:
package com.mao.travelapp.utils;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.charset.Charset;

/**
 * IO流工具类
 *
 * @author mao
 *
 */
public class IoUtils {

	private IoUtils() {
		throw new UnsupportedOperationException("can't instantiate class IoUtils");
	}

	/**
	 * 关闭流
	 *
	 * @param stream 要关闭的流对象
	 * @return 关闭成功返回true,失败返回false
	 */
	public static boolean close(Closeable stream) {
		if(stream != null) {
			try {
				stream.close();
				return true;
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return false;
	}

	/**
	 * 采用对象序列化实现彻底深度对象复制
	 *
	 * @param obj 要复制的对象
	 * @return 复制成功相应新的对象,复制失败返回null.
	 */
	public static <T extends Serializable> T copyObject(Object obj) {
		if(obj == null) {
			return null;
		}
		ByteArrayOutputStream baos = null;
		ObjectOutputStream oos = null;
		ByteArrayInputStream bais = null;
		ObjectInputStream ois = null;
		try {
			baos = new ByteArrayOutputStream();
			oos = new ObjectOutputStream(baos);
			oos.writeObject(obj);
			bais = new ByteArrayInputStream(baos.toByteArray());
			ois = new ObjectInputStream(bais);
			Object object = ois.readObject();
			return (T) object;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			close(oos);
			close(baos);
			close(ois);
			close(bais);
		}
	}

	/**
	 * 通过路径获取输出流,如果指定的路径不存在会自动创建
	 *
	 * @param path
	 * @return
	 *
	 * @see #getOutputStream(String, boolean)
	 */
	public static OutputStream getOutputStream(String path) {
		return getOutputStream(path, true);
	}

	/**
	 * 通过路径获取输出流
	 *
	 * @param path
	 * @param autoCreated true表示当路径不存在时自动创建,false表示不创建
	 * @return
	 */
	public static OutputStream getOutputStream(String path, boolean autoCreated) {
		if(!FileUtils.exist(path)) {
			if(!autoCreated || !FileUtils.createFile(path)) {
				return null;
			}
		}
		OutputStream os = null;
		try {
			os = new FileOutputStream(path);
			return os;
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}

	/**
	 * 按默认字符集将输入流转换为字符串
	 *
	 * @param is 输入流
	 * @return 转换成功返回对应的字符串,失败返回null
	 */
	public static String inputStream2String(InputStream is) {
		return inputStream2String(is, null);
	}

	/**
	 * 按指定字符集将输入流转换为字符串
	 *
	 * @param is 输入流
	 * @param charset 指定的字符集
	 * @return 转换成功返回对应的字符串,失败返回null
	 */
	public static String inputStream2String(InputStream is, Charset charset) {
		if(is == null) {
			return null;
		}
		byte[] buffer = new byte[1024];
		int length;
		StringBuilder sb = new StringBuilder();
		try {
			while((length = is.read(buffer)) != -1) {
				sb.append(new String(buffer, 0, length, charset));
			}
			return sb.toString();
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}
}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "VISITOR_KEYS", {
  enumerable: true,
  get: function () {
    return _utils.VISITOR_KEYS;
  }
});
Object.defineProperty(exports, "ALIAS_KEYS", {
  enumerable: true,
  get: function () {
    return _utils.ALIAS_KEYS;
  }
});
Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", {
  enumerable: true,
  get: function () {
    return _utils.FLIPPED_ALIAS_KEYS;
  }
});
Object.defineProperty(exports, "NODE_FIELDS", {
  enumerable: true,
  get: function () {
    return _utils.NODE_FIELDS;
  }
});
Object.defineProperty(exports, "BUILDER_KEYS", {
  enumerable: true,
  get: function () {
    return _utils.BUILDER_KEYS;
  }
});
Object.defineProperty(exports, "DEPRECATED_KEYS", {
  enumerable: true,
  get: function () {
    return _utils.DEPRECATED_KEYS;
  }
});
Object.defineProperty(exports, "NODE_PARENT_VALIDATIONS", {
  enumerable: true,
  get: function () {
    return _utils.NODE_PARENT_VALIDATIONS;
  }
});
Object.defineProperty(exports, "PLACEHOLDERS", {
  enumerable: true,
  get: function () {
    return _placeholders.PLACEHOLDERS;
  }
});
Object.defineProperty(exports, "PLACEHOLDERS_ALIAS", {
  enumerable: true,
  get: function () {
    return _placeholders.PLACEHOLDERS_ALIAS;
  }
});
Object.defineProperty(exports, "PLACEHOLDERS_FLIPPED_ALIAS", {
  enumerable: true,
  get: function () {
    return _placeholders.PLACEHOLDERS_FLIPPED_ALIAS;
  }
});
exports.TYPES = void 0;

var _toFastProperties = _interopRequireDefault(require("to-fast-properties"));

require("./core");

require("./es2015");

require("./flow");

require("./jsx");

require("./misc");

require("./experimental");

require("./typescript");

var _utils = require("./utils");

var _placeholders = require("./placeholders");

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

(0, _toFastProperties.default)(_utils.VISITOR_KEYS);
(0, _toFastProperties.default)(_utils.ALIAS_KEYS);
(0, _toFastProperties.default)(_utils.FLIPPED_ALIAS_KEYS);
(0, _toFastProperties.default)(_utils.NODE_FIELDS);
(0, _toFastProperties.default)(_utils.BUILDER_KEYS);
(0, _toFastProperties.default)(_utils.DEPRECATED_KEYS);
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_ALIAS);
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS);
const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS));
exports.TYPES = TYPES;


text:
package org.apache.hadoop.hbase.util;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.unsafe.HBasePlatformDependent;
import org.apache.hadoop.io.WritableUtils;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category({ MiscTests.class, MediumTests.class })
public class TestBytes {
  @ClassRule
  public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestBytes.class);

  private static void setUnsafe(boolean value) throws Exception {
    Field field = Bytes.class.getDeclaredField("UNSAFE_UNALIGNED");
    field.setAccessible(true);

    Field modifiersField = ReflectionUtils.getModifiersField();
    modifiersField.setAccessible(true);
    int oldModifiers = field.getModifiers();
    modifiersField.setInt(field, oldModifiers & ~Modifier.FINAL);
    try {
      field.set(null, value);
    } finally {
      modifiersField.setInt(field, oldModifiers);
    }
    assertEquals(Bytes.UNSAFE_UNALIGNED, value);
  }

  @Test
  public void testShort() throws Exception {
    testShort(false);
  }

  @Test
  public void testShortUnsafe() throws Exception {
    testShort(true);
  }

  private static void testShort(boolean unsafe) throws Exception {
    setUnsafe(unsafe);
    try {
      for (short n : Arrays.asList(Short.MIN_VALUE, (short) -100, (short) -1, (short) 0, (short) 1,
        (short) 300, Short.MAX_VALUE)) {
        byte[] bytes = Bytes.toBytes(n);
        assertEquals(Bytes.toShort(bytes, 0, bytes.length), n);
      }
    } finally {
      setUnsafe(HBasePlatformDependent.unaligned());
    }
  }

  @Test
  public void testNullHashCode() {
    byte[] b = null;
    Exception ee = null;
    try {
      Bytes.hashCode(b);
    } catch (Exception e) {
      ee = e;
    }
    assertNotNull(ee);
  }

  @Test
  public void testAdd() {
    byte[] a = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    byte[] b = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
    byte[] c = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
    byte[] result1 = Bytes.add(a, b, c);
    byte[] result2 = Bytes.add(new byte[][] { a, b, c });
    assertEquals(0, Bytes.compareTo(result1, result2));
  }

  @Test
  public void testSplit() {
    byte[] lowest = Bytes.toBytes("AAA");
    byte[] middle = Bytes.toBytes("CCC");
    byte[] highest = Bytes.toBytes("EEE");
    byte[][] parts = Bytes.split(lowest, highest, 1);
    for (byte[] bytes : parts) {
      System.out.println(Bytes.toString(bytes));
    }
    assertEquals(3, parts.length);
    assertTrue(Bytes.equals(parts[1], middle));
    // Now divide into three parts. Change highest so split is even.
    highest = Bytes.toBytes("DDD");
    parts = Bytes.split(lowest, highest, 2);
    for (byte[] part : parts) {
      System.out.println(Bytes.toString(part));
    }
    assertEquals(4, parts.length);
    // Assert that 3rd part is 'CCC'.
    assertTrue(Bytes.equals(parts[2], middle));
  }

  @Test
  public void testSplit2() {
    // More split tests.
    byte[] lowest = Bytes.toBytes("http://A");
    byte[] highest = Bytes.toBytes("http://z");
    byte[] middle = Bytes.toBytes("http://]");
    byte[][] parts = Bytes.split(lowest, highest, 1);
    for (byte[] part : parts) {
      System.out.println(Bytes.toString(part));
    }
    assertEquals(3, parts.length);
    assertTrue(Bytes.equals(parts[1], middle));
  }

  @Test
  public void testSplit3() {
    // Test invalid split cases
    byte[] low = { 1, 1, 1 };
    byte[] high = { 1, 1, 3 };

    // If swapped, should throw IAE
    try {
      Bytes.split(high, low, 1);
      fail("Should not be able to split if low > high");
    } catch (IllegalArgumentException iae) {
      // Correct
    }

    // Single split should work
    byte[][] parts = Bytes.split(low, high, 1);
    for (int i = 0; i < parts.length; i++) {
      System.out.println("" + i + " -> " + Bytes.toStringBinary(parts[i]));
    }
    assertEquals("Returned split should have 3 parts but has " + parts.length, 3, parts.length);

    // If split more than once, use additional byte to split
    parts = Bytes.split(low, high, 2);
    assertNotNull("Split with an additional byte", parts);
    assertEquals(parts.length, low.length + 1);

    // Split 0 times should throw IAE
    try {
      Bytes.split(low, high, 0);
      fail("Should not be able to split 0 times");
    } catch (IllegalArgumentException iae) {
      // Correct
    }
  }

  @Test
  public void testToInt() {
    int[] ints = { -1, 123, Integer.MIN_VALUE, Integer.MAX_VALUE };
    for (int anInt : ints) {
      byte[] b = Bytes.toBytes(anInt);
      assertEquals(anInt, Bytes.toInt(b));
      byte[] b2 = bytesWithOffset(b);
      assertEquals(anInt, Bytes.toInt(b2, 1));
      assertEquals(anInt, Bytes.toInt(b2, 1, Bytes.SIZEOF_INT));
    }
  }

  @Test
  public void testToLong() {
    long[] longs = { -1L, 123L, Long.MIN_VALUE, Long.MAX_VALUE };
    for (long aLong : longs) {
      byte[] b = Bytes.toBytes(aLong);
      assertEquals(aLong, Bytes.toLong(b));
      byte[] b2 = bytesWithOffset(b);
      assertEquals(aLong, Bytes.toLong(b2, 1));
      assertEquals(aLong, Bytes.toLong(b2, 1, Bytes.SIZEOF_LONG));
    }
  }

  @Test
  public void testToFloat() {
    float[] floats = { -1f, 123.123f, Float.MAX_VALUE };
    for (float aFloat : floats) {
      byte[] b = Bytes.toBytes(aFloat);
      assertEquals(aFloat, Bytes.toFloat(b), 0.0f);
      byte[] b2 = bytesWithOffset(b);
      assertEquals(aFloat, Bytes.toFloat(b2, 1), 0.0f);
    }
  }

  @Test
  public void testToDouble() {
    double[] doubles = { Double.MIN_VALUE, Double.MAX_VALUE };
    for (double aDouble : doubles) {
      byte[] b = Bytes.toBytes(aDouble);
      assertEquals(aDouble, Bytes.toDouble(b), 0.0);
      byte[] b2 = bytesWithOffset(b);
      assertEquals(aDouble, Bytes.toDouble(b2, 1), 0.0);
    }
  }

  @Test
  public void testToBigDecimal() {
    BigDecimal[] decimals =
      { new BigDecimal("-1"), new BigDecimal("123.123"), new BigDecimal("123123123123") };
    for (BigDecimal decimal : decimals) {
      byte[] b = Bytes.toBytes(decimal);
      assertEquals(decimal, Bytes.toBigDecimal(b));
      byte[] b2 = bytesWithOffset(b);
      assertEquals(decimal, Bytes.toBigDecimal(b2, 1, b.length));
    }
  }

  private byte[] bytesWithOffset(byte[] src) {
    // add one byte in front to test offset
    byte[] result = new byte[src.length + 1];
    result[0] = (byte) 0xAA;
    System.arraycopy(src, 0, result, 1, src.length);
    return result;
  }

  @Test
  public void testToBytesForByteBuffer() {
    byte[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    ByteBuffer target = ByteBuffer.wrap(array);
    target.position(2);
    target.limit(7);

    byte[] actual = Bytes.toBytes(target);
    byte[] expected = { 0, 1, 2, 3, 4, 5, 6 };
    assertArrayEquals(expected, actual);
    assertEquals(2, target.position());
    assertEquals(7, target.limit());

    ByteBuffer target2 = target.slice();
    assertEquals(0, target2.position());
    assertEquals(5, target2.limit());

    byte[] actual2 = Bytes.toBytes(target2);
    byte[] expected2 = { 2, 3, 4, 5, 6 };
    assertArrayEquals(expected2, actual2);
    assertEquals(0, target2.position());
    assertEquals(5, target2.limit());
  }

  @Test
  public void testGetBytesForByteBuffer() {
    byte[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    ByteBuffer target = ByteBuffer.wrap(array);
    target.position(2);
    target.limit(7);

    byte[] actual = Bytes.getBytes(target);
    byte[] expected = { 2, 3, 4, 5, 6 };
    assertArrayEquals(expected, actual);
    assertEquals(2, target.position());
    assertEquals(7, target.limit());
  }

  @Test
  public void testReadAsVLong() throws Exception {
    long[] longs = { -1L, 123L, Long.MIN_VALUE, Long.MAX_VALUE };
    for (long aLong : longs) {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      DataOutputStream output = new DataOutputStream(baos);
      WritableUtils.writeVLong(output, aLong);
      byte[] long_bytes_no_offset = baos.toByteArray();
      assertEquals(aLong, Bytes.readAsVLong(long_bytes_no_offset, 0));
      byte[] long_bytes_with_offset = bytesWithOffset(long_bytes_no_offset);
      assertEquals(aLong, Bytes.readAsVLong(long_bytes_with_offset, 1));
    }
  }

  @Test
  public void testToStringBinaryForBytes() {
    byte[] array = { '0', '9', 'a', 'z', 'A', 'Z', '@', 1 };
    String actual = Bytes.toStringBinary(array);
    String expected = "09azAZ@\\x01";
    assertEquals(expected, actual);

    String actual2 = Bytes.toStringBinary(array, 2, 3);
    String expected2 = "azA";
    assertEquals(expected2, actual2);
  }

  @Test
  public void testToStringBinaryForArrayBasedByteBuffer() {
    byte[] array = { '0', '9', 'a', 'z', 'A', 'Z', '@', 1 };
    ByteBuffer target = ByteBuffer.wrap(array);
    String actual = Bytes.toStringBinary(target);
    String expected = "09azAZ@\\x01";
    assertEquals(expected, actual);
  }

  @Test
  public void testToStringBinaryForReadOnlyByteBuffer() {
    byte[] array = { '0', '9', 'a', 'z', 'A', 'Z', '@', 1 };
    ByteBuffer target = ByteBuffer.wrap(array).asReadOnlyBuffer();
    String actual = Bytes.toStringBinary(target);
    String expected = "09azAZ@\\x01";
    assertEquals(expected, actual);
  }

  @Test
  public void testBinarySearch() {
    byte[][] arr = { { 1 }, { 3 }, { 5 }, { 7 }, { 9 }, { 11 }, { 13 }, { 15 }, };
    byte[] key1 = { 3, 1 };
    byte[] key2 = { 4, 9 };
    byte[] key2_2 = { 4 };
    byte[] key3 = { 5, 11 };
    byte[] key4 = { 0 };
    byte[] key5 = { 2 };

    assertEquals(1, Bytes.binarySearch(arr, key1, 0, 1));
    assertEquals(0, Bytes.binarySearch(arr, key1, 1, 1));
    assertEquals(-(2 + 1), Arrays.binarySearch(arr, key2_2, Bytes.BYTES_COMPARATOR));
    assertEquals(-(2 + 1), Bytes.binarySearch(arr, key2, 0, 1));
    assertEquals(4, Bytes.binarySearch(arr, key2, 1, 1));
    assertEquals(2, Bytes.binarySearch(arr, key3, 0, 1));
    assertEquals(5, Bytes.binarySearch(arr, key3, 1, 1));
    assertEquals(-1, Bytes.binarySearch(arr, key4, 0, 1));
    assertEquals(-2, Bytes.binarySearch(arr, key5, 0, 1));

    // Search for values to the left and to the right of each item in the array.
    for (int i = 0; i < arr.length; ++i) {
      assertEquals(-(i + 1), Bytes.binarySearch(arr, new byte[] { (byte) (arr[i][0] - 1) }, 0, 1));
      assertEquals(-(i + 2), Bytes.binarySearch(arr, new byte[] { (byte) (arr[i][0] + 1) }, 0, 1));
    }
  }

  @Test
  public void testToStringBytesBinaryReversible() {
    byte[] randomBytes = new byte[1000];
    for (int i = 0; i < 1000; i++) {
      Bytes.random(randomBytes);
      verifyReversibleForBytes(randomBytes);
    }
    // some specific cases
    verifyReversibleForBytes(new byte[] {});
    verifyReversibleForBytes(new byte[] { '\\', 'x', 'A', 'D' });
    verifyReversibleForBytes(new byte[] { '\\', 'x', 'A', 'D', '\\' });
  }

  private void verifyReversibleForBytes(byte[] originalBytes) {
    String convertedString = Bytes.toStringBinary(originalBytes);
    byte[] convertedBytes = Bytes.toBytesBinary(convertedString);
    if (Bytes.compareTo(originalBytes, convertedBytes) != 0) {
      fail("Not reversible for\nbyte[]: " + Arrays.toString(originalBytes) + ",\nStringBinary: "
        + convertedString);
    }
  }

  @Test
  public void testStartsWith() {
    assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("h")));
    assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("")));
    assertTrue(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("hello")));
    assertFalse(Bytes.startsWith(Bytes.toBytes("hello"), Bytes.toBytes("helloworld")));
    assertFalse(Bytes.startsWith(Bytes.toBytes(""), Bytes.toBytes("hello")));
  }

  @Test
  public void testIncrementBytes() {
    assertTrue(checkTestIncrementBytes(10, 1));
    assertTrue(checkTestIncrementBytes(12, 123435445));
    assertTrue(checkTestIncrementBytes(124634654, 1));
    assertTrue(checkTestIncrementBytes(10005460, 5005645));
    assertTrue(checkTestIncrementBytes(1, -1));
    assertTrue(checkTestIncrementBytes(10, -1));
    assertTrue(checkTestIncrementBytes(10, -5));
    assertTrue(checkTestIncrementBytes(1005435000, -5));
    assertTrue(checkTestIncrementBytes(10, -43657655));
    assertTrue(checkTestIncrementBytes(-1, 1));
    assertTrue(checkTestIncrementBytes(-26, 5034520));
    assertTrue(checkTestIncrementBytes(-10657200, 5));
    assertTrue(checkTestIncrementBytes(-12343250, 45376475));
    assertTrue(checkTestIncrementBytes(-10, -5));
    assertTrue(checkTestIncrementBytes(-12343250, -5));
    assertTrue(checkTestIncrementBytes(-12, -34565445));
    assertTrue(checkTestIncrementBytes(-1546543452, -34565445));
  }

  private static boolean checkTestIncrementBytes(long val, long amount) {
    byte[] value = Bytes.toBytes(val);
    byte[] testValue = { -1, -1, -1, -1, -1, -1, -1, -1 };
    if (value[0] > 0) {
      testValue = new byte[Bytes.SIZEOF_LONG];
    }
    System.arraycopy(value, 0, testValue, testValue.length - value.length, value.length);

    long incrementResult = Bytes.toLong(Bytes.incrementBytes(value, amount));

    return (Bytes.toLong(testValue) + amount) == incrementResult;
  }

  @Test
  public void testFixedSizeString() throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    Bytes.writeStringFixedSize(dos, "Hello", 5);
    Bytes.writeStringFixedSize(dos, "World", 18);
    Bytes.writeStringFixedSize(dos, "", 9);

    try {
      // Use a long dash which is three bytes in UTF-8. If encoding happens
      // using ISO-8859-1, this will fail.
      Bytes.writeStringFixedSize(dos, "Too\u2013Long", 9);
      fail("Exception expected");
    } catch (IOException ex) {
      assertEquals(
        "Trying to write 10 bytes (Too\\xE2\\x80\\x93Long) into a field of " + "length 9",
        ex.getMessage());
    }

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    DataInputStream dis = new DataInputStream(bais);
    assertEquals("Hello", Bytes.readStringFixedSize(dis, 5));
    assertEquals("World", Bytes.readStringFixedSize(dis, 18));
    assertEquals("", Bytes.readStringFixedSize(dis, 9));
  }

  @Test
  public void testCopy() {
    byte[] bytes = Bytes.toBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    byte[] copy = Bytes.copy(bytes);
    assertNotSame(bytes, copy);
    assertTrue(Bytes.equals(bytes, copy));
  }

  @Test
  public void testToBytesBinaryTrailingBackslashes() {
    try {
      Bytes.toBytesBinary("abc\\x00\\x01\\");
    } catch (StringIndexOutOfBoundsException ex) {
      fail("Illegal string access: " + ex.getMessage());
    }
  }

  @Test
  public void testToStringBinary_toBytesBinary_Reversable() {
    String bytes = Bytes.toStringBinary(Bytes.toBytes(2.17));
    assertEquals(2.17, Bytes.toDouble(Bytes.toBytesBinary(bytes)), 0);
  }

  @Test
  public void testUnsignedBinarySearch() {
    byte[] bytes = new byte[] { 0, 5, 123, 127, -128, -100, -1 };
    Assert.assertEquals(1, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) 5));
    Assert.assertEquals(3, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) 127));
    Assert.assertEquals(4, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) -128));
    Assert.assertEquals(5, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) -100));
    Assert.assertEquals(6, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) -1));
    Assert.assertEquals(-1 - 1, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) 2));
    Assert.assertEquals(-6 - 1, Bytes.unsignedBinarySearch(bytes, 0, bytes.length, (byte) -5));
  }

  @Test
  public void testUnsignedIncrement() {
    byte[] a = Bytes.toBytes(0);
    int a2 = Bytes.toInt(Bytes.unsignedCopyAndIncrement(a), 0);
    Assert.assertEquals(1, a2);

    byte[] b = Bytes.toBytes(-1);
    byte[] actual = Bytes.unsignedCopyAndIncrement(b);
    Assert.assertNotSame(b, actual);
    byte[] expected = new byte[] { 1, 0, 0, 0, 0 };
    assertArrayEquals(expected, actual);

    byte[] c = Bytes.toBytes(255);// should wrap to the next significant byte
    int c2 = Bytes.toInt(Bytes.unsignedCopyAndIncrement(c), 0);
    Assert.assertEquals(256, c2);
  }

  @Test
  public void testIndexOf() {
    byte[] array = Bytes.toBytes("hello");
    assertEquals(1, Bytes.indexOf(array, (byte) 'e'));
    assertEquals(4, Bytes.indexOf(array, (byte) 'o'));
    assertEquals(-1, Bytes.indexOf(array, (byte) 'a'));
    assertEquals(0, Bytes.indexOf(array, Bytes.toBytes("hel")));
    assertEquals(2, Bytes.indexOf(array, Bytes.toBytes("ll")));
    assertEquals(-1, Bytes.indexOf(array, Bytes.toBytes("hll")));
  }

  @Test
  public void testContains() {
    byte[] array = Bytes.toBytes("hello world");
    assertTrue(Bytes.contains(array, (byte) 'e'));
    assertTrue(Bytes.contains(array, (byte) 'd'));
    assertFalse(Bytes.contains(array, (byte) 'a'));
    assertTrue(Bytes.contains(array, Bytes.toBytes("world")));
    assertTrue(Bytes.contains(array, Bytes.toBytes("ello")));
    assertFalse(Bytes.contains(array, Bytes.toBytes("owo")));
  }

  @Test
  public void testZero() {
    byte[] array = Bytes.toBytes("hello");
    Bytes.zero(array);
    for (byte b : array) {
      assertEquals(0, b);
    }
    array = Bytes.toBytes("hello world");
    Bytes.zero(array, 2, 7);
    assertFalse(array[0] == 0);
    assertFalse(array[1] == 0);
    for (int i = 2; i < 9; i++) {
      assertEquals(0, array[i]);
    }
    for (int i = 9; i < array.length; i++) {
      assertFalse(array[i] == 0);
    }
  }

  @Test
  public void testPutBuffer() {
    byte[] b = new byte[100];
    for (byte i = 0; i < 100; i++) {
      Bytes.putByteBuffer(b, i, ByteBuffer.wrap(new byte[] { i }));
    }
    for (byte i = 0; i < 100; i++) {
      Assert.assertEquals(i, b[i]);
    }
  }

  @Test
  public void testToFromHex() {
    List<String> testStrings = new ArrayList<>(8);
    testStrings.addAll(Arrays.asList("", "00", "A0", "ff", "FFffFFFFFFFFFF", "12",
      "0123456789abcdef", "283462839463924623984692834692346ABCDFEDDCA0"));
    for (String testString : testStrings) {
      byte[] byteData = Bytes.fromHex(testString);
      Assert.assertEquals(testString.length() / 2, byteData.length);
      String result = Bytes.toHex(byteData);
      Assert.assertTrue(testString.equalsIgnoreCase(result));
    }

    List<byte[]> testByteData = new ArrayList<>(5);
    testByteData.addAll(Arrays.asList(new byte[0], new byte[1], new byte[10],
      new byte[] { 1, 2, 3, 4, 5 }, new byte[] { (byte) 0xFF }));
    Random rand = ThreadLocalRandom.current();
    for (int i = 0; i < 20; i++) {
      byte[] bytes = new byte[rand.nextInt(100)];
      Bytes.random(bytes);
      testByteData.add(bytes);
    }

    for (byte[] testData : testByteData) {
      String hexString = Bytes.toHex(testData);
      Assert.assertEquals(testData.length * 2, hexString.length());
      byte[] result = Bytes.fromHex(hexString);
      assertArrayEquals(testData, result);
    }
  }
}


text:
<ion-view title="Cutting">
    <ion-content padding="true" class="has-header">

      <form class="list" name="objForm" ng-submit="validate(objForm)" novalidate="">
        <ion-list>
            <ion-item class="item-divider item-text-wrap">{{'TARGETCUTTING_TITLE' | translate}}</ion-item>

                <input name="target" type="number" ng-model="data.target" min="0" max:"1.3" ng-required="true">

        </ion-list>

{{'RECOMMENDED_TITLE' | translate}}
                0.3-1.3

        <ion-list>
            <ion-item class="item-divider item-text-wrap">{{'FATINTAKE_CUTTING_TITLE' | translate}}</ion-item>

                <input name="fatIntake" type="number" ng-model="data.fatIntake" min="0" max="1.3" ng-required="true">

        </ion-list>

{{'RECOMMENDED_TITLE' | translate}}
                0.9-1.3

        <ion-list>
            <ion-item class="item-divider item-text-wrap">{{'PROTEININTAKE_TITLE' | translate}}</ion-item>

                <input name="proteinIntake" type="number" ng-model="data.proteinIntake" min="0" max="3.1" ng-required="true">

        </ion-list>

{{'RECOMMENDED_TITLE' | translate}}
                2.3-3.1

                {{'HELPME' | translate}}

        <button class="button button-dark button-block  button-full">
          {{'BUTTON_NEXT' | translate}}
        </button>

{{'FORM_ERROR' | translate}}

      </form>
    </ion-content>
</ion-view>


text:
package com.artemis.system.iterating;

import com.artemis.Aspect;
import com.artemis.annotations.Profile;
import com.artemis.systems.IteratingSystem;
import com.artemis.util.SimpleProfiler;

@Profile(enabled=true, using=SimpleProfiler.class)
public class IntProfiledSystem extends IteratingSystem {
	public IntProfiledSystem() {
		super(Aspect.all());
	}

	@Override
	protected void process(int e) {

	}
}


text:
import { UnmountToken } from "../core";
import { WatchList } from "../core/observable";
import { Op } from "./operations";
import { OpState } from "./state";

/**
 * Component state.
 *
 * @typeparam P Props type.
 */
export interface ComponentState<P1 = any, P2 = any> {
  /**
   * Render function.
   */
  r: null | ((p1: P1, p2: P2) => Op);
  /**
   * Observable dependencies.
   */
  d: WatchList;
  /**
   * Unmount hooks.
   */
  u: null | ((token: UnmountToken) => void) | ((token: UnmountToken) => void)[];
}

/**
 * Component Descriptor.
 *
 * @typeparam P Props type.
 */
export interface ComponentDescriptor<P1 = any, P2 = any> {
  /**
   * Lifecycle hook `create`.
   *
   * @param state Component state.
   * @returns update function.
   */
  c(state: OpState): (p1: P1, p2: P2) => Op;

  /**
   * `areEqual1` is a function that checks if `prev` and `next` props (p1) are equal, it is used as a hint to reduce
   * unnecessary updates.
   *
   * @param prev Previous properties.
   * @param next Next properties.
   * @returns `true` when props are equal.
   */
  readonly e1: undefined | ((prev: P1, next: P1) => boolean);

  /**
   * `areEqual2` is a function that checks if `prev` and `next` props (p2) are equal, it is used as a hint to reduce
   * unnecessary updates.
   *
   * @param prev Previous properties.
   * @param next Next properties.
   * @returns `true` when props are equal.
   */
  readonly e2: undefined | ((prev: P2, next: P2) => boolean);
}

export type Component = OpState<ComponentState>;


text:
package net.minepass.api.gameserver.embed.solidtx.http;

import java.net.URLConnection;

public interface HttpAuth {

    public void applyAuthToConnection(URLConnection conn);

}


text:
chrome.runtime.onMessageExternal.addListener(
    function (request, sender, sendResponse) {
        console.log('Got request', request , sender);
        if(request.getVersion)
        {
            sendResponse({version: chrome.runtime.getManifest().version});
            return false;
        }else if(request.getStream){
            chrome.desktopCapture.chooseDesktopMedia(
                ["screen", "window"], sender.tab,
                function(streamId) {
                    sendResponse({ streamId: streamId});
                });
            return true;
        }else{
            console.error("Unknown request");
            sendResponse({ error : "Unknown request" });
            return false;
        }
    }
);


text:
class CreateReviews < ActiveRecord::Migration
  def change
    create_table :reviews do |t|
      t.integer :user_id
      t.integer :recipe_id
      t.string :comment
      t.string :img_url
      t.integer :rating

      t.timestamps null: false
    end
  end
end


text:
<?php

namespace Oro\Bundle\NavigationBundle\Tests\Unit\Menu;

use Oro\Bundle\NavigationBundle\Menu\NavigationMostviewedBuilder;
use Oro\Bundle\NavigationBundle\Entity\NavigationHistoryItem;

class NavigationMostviewedBuilderTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Doctrine\ORM\EntityManager
     */
    protected $em;

    /**
     * @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
     */
    protected $tokenStorage;

    /**
     * @var NavigationMostviewedBuilder
     */
    protected $builder;

    /**
     * @var \Oro\Bundle\NavigationBundle\Entity\Builder\ItemFactory
     */
    protected $factory;

    protected function setUp()
    {
        $this->tokenStorage = $this->getMock('Symfony\Component\Security\Core\TokenStorageInterface');
        $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
            ->disableOriginalConstructor()
            ->getMock();
        $this->factory = $this->getMock('Oro\Bundle\NavigationBundle\Entity\Builder\ItemFactory');

        $this->builder = new NavigationMostviewedBuilder($this->tokenStorage, $this->em, $this->factory);
    }

    public function testBuild()
    {
        $type = 'mostviewed';
        $maxItems = 20;
        $userId = 1;

        $user = $this->getMockBuilder('stdClass')
            ->setMethods(array('getId'))
            ->getMock();
        $user->expects($this->once())
            ->method('getId')
            ->will($this->returnValue($userId));

        $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
        $token->expects($this->once())
            ->method('getUser')
            ->will($this->returnValue($user));

        $this->tokenStorage->expects($this->once())
            ->method('getToken')
            ->will($this->returnValue($token));

        $item = $this->getMock('Oro\Bundle\NavigationBundle\Entity\NavigationItemInterface');
        $this->factory->expects($this->once())
            ->method('createItem')
            ->with($type, array())
            ->will($this->returnValue($item));

        $repository = $this->getMockBuilder('Oro\Bundle\NavigationBundle\Entity\Repository\HistoryItemRepository')
            ->disableOriginalConstructor()
            ->getMock();

        $repository->expects($this->once())
            ->method('getNavigationItems')
            ->with(
                $userId,
                $type,
                array(
                    'maxItems' => $maxItems,
                    'orderBy' => array(array('field' => NavigationHistoryItem::NAVIGATION_HISTORY_COLUMN_VISIT_COUNT))
                )
            )
            ->will($this->returnValue(array()));

        $this->em->expects($this->once())
            ->method('getRepository')
            ->with(get_class($item))
            ->will($this->returnValue($repository));

        $configMock = $this->getMockBuilder('Oro\Bundle\ConfigBundle\Config\UserConfigManager')
            ->disableOriginalConstructor()
            ->getMock();

        $configMock->expects($this->once())
            ->method('get')
            ->with($this->equalTo('oro_navigation.maxItems'))
            ->will($this->returnValue($maxItems));

        $menu = $this->getMockBuilder('Knp\Menu\ItemInterface')->getMock();

        $this->builder->setOptions($configMock);
        $this->builder->build($menu, array(), $type);
    }
}


text:
export * from './component';
export * from './foundation';
export { strings as iconStrings } from './constants';
//# sourceMappingURL=index.js.map


text:
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package org.openqa.selenium.testing.drivers;

import static java.util.concurrent.TimeUnit.SECONDS;

import com.google.common.base.Optional;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.base.Throwables;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.net.UrlChecker;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.LocalFileDetector;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;

/**
 * Supports providing WebDriver instances from an external source using the following system
 * properties:
 *

 *
selenium.external.serverUrl

 *
Defines the fully qualified URL of an external WebDriver server to send commands to.
 *       This server must be compliant with the
 *       JSON wire protocol.
 *       If only this property is provided, then this supplier will provide a new
 *       {@link RemoteWebDriver} instance pointed at the designated server. Otherwise, if a
 *       custom supplier is also defined (see below), this supplier will wait for the server to
 *       be accepting commands before delegating to the designated class for the actual client
 *       creation.
 *

 *
selenium.external.supplierClass

 *
Specifies the fully qualified name of another class on the classpath. This class must
 *       implement {@code Supplier<WebDriver>} and have a public constructor that accepts two
 *       {@link Capabilities} objects as arguments (for the desired and required capabilities,
 *       respectively).
 *

 *

 */
class ExternalDriverSupplier implements Supplier<WebDriver> {
  private static final Logger logger = Logger.getLogger(ExternalDriverSupplier.class.getName());

  private static final String DELEGATE_SUPPLIER_CLASS_PROPERTY = "selenium.external.supplierClass";
  private static final String EXTERNAL_SERVER_URL_PROPERTY = "selenium.external.serverUrl";

  private final Capabilities desiredCapabilities;
  private final Capabilities requiredCapabilities;

  ExternalDriverSupplier(Capabilities desiredCapabilities, Capabilities requiredCapabilities) {
    this.desiredCapabilities = new DesiredCapabilities(desiredCapabilities);
    this.requiredCapabilities = new DesiredCapabilities(requiredCapabilities);
  }

  @Override
  public WebDriver get() {
    Optional<Supplier<WebDriver>> delegate = createDelegate(
        desiredCapabilities, requiredCapabilities);
    delegate = createForExternalServer(desiredCapabilities, requiredCapabilities, delegate);

    return delegate.or(Suppliers.<WebDriver>ofInstance(null)).get();
  }

  private static Optional<Supplier<WebDriver>> createForExternalServer(
      Capabilities desiredCapabilities, Capabilities requiredCapabilities,
      Optional<Supplier<WebDriver>> delegate) {
    String externalUrl = System.getProperty(EXTERNAL_SERVER_URL_PROPERTY);
    if (externalUrl != null) {
      logger.info("Using external WebDriver server: " + externalUrl);
      URL url;
      try {
        url = new URL(externalUrl);
      } catch (MalformedURLException e) {
        throw new RuntimeException("Invalid server URL: " + externalUrl, e);
      }
      Supplier<WebDriver> defaultSupplier = new DefaultRemoteSupplier(
          url, desiredCapabilities, requiredCapabilities);
      Supplier<WebDriver> supplier = new ExternalServerDriverSupplier(
          url, delegate.or(defaultSupplier));
      return Optional.of(supplier);
    }
    return delegate;
  }

  private static Optional<Supplier<WebDriver>> createDelegate(
      Capabilities desiredCapabilities, Capabilities requiredCapabilities) {
    Optional<Class<? extends Supplier>> supplierClass = getDelegateClass();
    if (supplierClass.isPresent()) {
      Class<? extends Supplier> clazz = supplierClass.get();
      logger.info("Using delegate supplier: " + clazz.getName());
      try {
        @SuppressWarnings("unchecked")
        Constructor<Supplier<WebDriver>> ctor =
            (Constructor<Supplier<WebDriver>>) clazz.getConstructor(
                Capabilities.class, Capabilities.class);
        return Optional.of(ctor.newInstance(desiredCapabilities, requiredCapabilities));
      } catch (InvocationTargetException e) {
        throw Throwables.propagate(e.getTargetException());
      } catch (Exception e) {
        throw Throwables.propagate(e);
      }
    }
    return Optional.absent();
  }

  @SuppressWarnings("unchecked")
  private static Optional<Class<? extends Supplier>> getDelegateClass() {
    String delegateClassName = System.getProperty(DELEGATE_SUPPLIER_CLASS_PROPERTY);
    if (delegateClassName != null) {
      try {
        logger.info("Loading custom supplier: " + delegateClassName);
        Class<? extends Supplier> clazz =
            (Class<? extends Supplier>) Class.forName(delegateClassName);
        return Optional.<Class<? extends Supplier>>of(clazz);
      } catch (Exception e) {
        throw Throwables.propagate(e);
      }
    }
    return Optional.absent();
  }

  /**
   * Waits for an external WebDriver server to be ready before delegating to another supplier
   * for driver creation.
   */
  private static class ExternalServerDriverSupplier implements Supplier<WebDriver> {

    private final URL serverUrl;
    private final Supplier<WebDriver> delegateSupplier;

    private ExternalServerDriverSupplier(
        URL serverUrl, Supplier<WebDriver> delegateSupplier) {
      this.serverUrl = serverUrl;
      this.delegateSupplier = delegateSupplier;
    }

    @Override
    public WebDriver get() {
      try {
        logger.info("Waiting for server to be ready at " + serverUrl);
        new UrlChecker().waitUntilAvailable(60, SECONDS, new URL(serverUrl + "/status"));
        logger.info("Server is ready");
      } catch (UrlChecker.TimeoutException e) {
        throw new RuntimeException("The external server is not accepting commands", e);
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
      }
      return delegateSupplier.get();
    }
  }

  /**
   * Creates basic {@link RemoteWebDriver} instances.
   */
  private static class DefaultRemoteSupplier implements Supplier<WebDriver> {
    private final URL url;
    private final Capabilities desiredCapabilities;
    private final Capabilities requiredCapabilities;

    private DefaultRemoteSupplier(
        URL url, Capabilities desiredCapabilities, Capabilities requiredCapabilities) {
      this.url = url;
      this.desiredCapabilities = desiredCapabilities;
      this.requiredCapabilities = requiredCapabilities;
    }

    @Override
    public WebDriver get() {
      RemoteWebDriver driver = new RemoteWebDriver(url, desiredCapabilities, requiredCapabilities);
      driver.setFileDetector(new LocalFileDetector());
      return driver;
    }
  }
}


text:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-
 - Copyright (c) 2015, Peter Lebbing <peter@digitalbrains.com>
 - All rights reserved.
 -
 - Redistribution and use in source and binary forms, with or without
 - modification, are permitted provided that the following conditions are met:
 -
 - 1. Redistributions of source code must retain the above copyright notice,
 - this list of conditions and the following disclaimer.
 -
 - 2. Redistributions in binary form must reproduce the above copyright notice,
 - this list of conditions and the following disclaimer in the documentation
 - and/or other materials provided with the distribution.
 -
 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 - POSSIBILITY OF SUCH DAMAGE.
 -}

module Simul.Toolbox.Blockram2p_2_2 where

import CLaSH.Prelude
import Control.Applicative
import Debug.Trace

import Toolbox.Misc

-- Simulation model for `blockram2p d12 d12 d2 d2`
blockram2p :: SNat 12
           -> SNat 12
           -> SNat 2
           -> SNat 2
           -> SignalP ( Unsigned 12, Unsigned 2, Bool, Unsigned 12
                      , Unsigned 2, Bool)
           -> SignalP (Unsigned 2, Unsigned 2)

{-
 - While the simulation model from Blockram2p_2_16 in this directory would also
 - work here, it is very slow. The case where both ports have the same width
 - can be greatly simplified, giving a very significant speed boost, especially
 - in interpreted mode where the general simulation model is painfully slow.
 -
 - Here, we just do the registers. `blockram2p'` does the actual memory access.
 -}
blockram2p aaw baw aw bw i = oD
    where
        iD = (unpack . register (0, 0, False, 0, 0, False) . pack) i
        o = (blockram2p' <^> vcopyI 0) i
        oD = (unpack . register (0, 0) . pack) o

{-
 - A rather trivial implementation of a memory, but with two ports. See
 - Blockram2p_2_16 for a discussion of write conflicts.
 -}
blockram2p' :: Vec 4096 (Unsigned 2)
            -> (Unsigned 12, Unsigned 2, Bool, Unsigned 12, Unsigned 2, Bool)
            -> (Vec 4096 (Unsigned 2), (Unsigned 2, Unsigned 2))
blockram2p' s (aAddr, aDIn, aWrEn, bAddr, bDIn, bWrEn)
    = (s', (qA, qB))
    where
        sa' | aWrEn     = vreplace s aAddr aDIn
            | otherwise = s
        s'  | not bWrEn = sa'
            | aWrEn && overlap = error ($(showCodeLoc)
                                        ++ " blockram2p'': Write conflict")
            | otherwise = vreplace sa' bAddr bDIn
        qA = s!aAddr
        qB = s!bAddr
        overlap = aAddr == bAddr


text:
#pragma once

#include <math.h>
#include <memory>
#include <wrl.h>

// Enable function definitions in the GL headers below
#define GL_GLEXT_PROTOTYPES

// OpenGL ES includes
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

// EGL includes
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglplatform.h>

// ANGLE include for Windows Store
#include <angle_windowsstore.h>