text:
import store from '@/store'
import fs from 'fs'
import { fixRaggedRows } from '@/ragged-rows.js'
import { includeHeadersInData } from '@/frictionlessUtilities.js'
import { toggleHeaderNoFeedback } from '@/headerRow.js'
import { pushCsvFormat } from '@/dialect.js'
import detectNewline from 'detect-newline'
import os from 'os'

var parse = require('csv-parse/lib/sync')
var stringify = require('csv-stringify/lib/sync')
var CSVSniffer = require('csv-sniffer')()

// { delimiter: ',', lineTerminator, quoteChar, doubleQuote, escapeChar, nullSequence, skipInitialSpace, header, caseSensitiveHeader, csvddfVersion }
const frictionlessToCsvmapper = {
  delimiter: 'delimiter',
  lineTerminator: 'rowDelimiter',
  quoteChar: 'quote',
  escapeChar: 'escape',
  skipInitialSpace: 'ltrim'
}

export function loadDataIntoHot (hot, data, format) {
  if (_.isArray(data)) {
    loadArrayDataIntoHot(hot, data, format)
  } else {
    loadCsvDataIntoHot(hot, data, format)
  }
}

export function loadCsvDataIntoHot (hot, data, format) {
  // do not handle errors here as caller can activate appropriate user feedback dialog
  let arrays
  // if no format specified, default to csv
  if (typeof format === 'undefined' || !format) {
    detectAndStoreQuoteChar(data, hot.guid, null)
    captureBOM(data, hot.guid)
    arrays = parse(data)
  } else {
    let csvOptions = dialectToCsvOptions(format.dialect)
    detectAndStoreQuoteChar(data, hot.guid, csvOptions)
    // let csv parser handle the line terminators
    _.unset(csvOptions, 'rowDelimiter')
    // TODO: update to stream
    csvOptions.bom = false
    captureBOM(data, hot.guid)
    arrays = parse(data, csvOptions)
    pushCsvFormat(hot.guid, format)
  }
  fixRaggedRows(arrays)
  hot.loadData(arrays)
  hot.render()
  // frictionless csv header default = true
  toggleHeaderNoFeedback(hot)
}

function captureBOM (data, hotId) {
  if (data.charCodeAt(0) === 0xFEFF) {
    store.commit('pushTableProperty', { hotId: hotId, key: `bom`, value: 0xFEFF })
  }
}

export function loadArrayDataIntoHot (hot, arrays, format) {
  pushCsvFormat(hot.guid, format)

  fixRaggedRows(arrays)
  hot.loadData(arrays)
  hot.render()
  // frictionless csv header default = true
  toggleHeaderNoFeedback(hot)
}

export function saveDataToFile (hot, format, filename, callback) {
  let tabId = store.getters.getActiveTab
  if (typeof filename === 'string') {
    store.commit('pushTabObject', { id: tabId, filename: filename })
  } else {
    filename = store.getters.getTabObjects(`${tabId}.filename`)
  }
  if (!filename) {
    return
  }
  if (typeof callback === 'undefined') {
    callback = (err) => {
      if (err) {
        console.error('There was a problem saving data to file.')
        throw err
      }
      // console.log('File saved successfully.')
    }
  }

  // unlike handsontable, in frictionless by default, headers should be included (http://frictionlessdata.io/specs/csv-dialect)
  let arrays = includeHeadersInData(hot)
  let data
  // if no format specified, default to csv
  if (typeof format === 'undefined' || !format) {
    // TODO: update to stream
    data = stringify(arrays)
  } else {
    let csvOptions = dialectToCsvOptions(format.dialect)
    if (store.getters.getTableProperty({ key: 'sampledQuoteChar', hotId: hot.guid })) {
      csvOptions.quoted = true
    }
    data = stringify(arrays, csvOptions)
    pushCsvFormat(hot.guid, format)
  }
  reinsertExistingBOM(data, hot.guid)
  fs.writeFile(filename, data, callback)
}

function reinsertExistingBOM (data, hotId) {
  if (data.charCodeAt(0) !== 0xFEFF && store.getters.getTableProperty({ key: 'bom', hotId: hotId })) {
    data = String.fromCodePoint(0xFEFF) + data
  }
}

function dialectToCsvOptions (dialect) {
  let csvOptions = {}
  if (dialect) {
    _.forEach(frictionlessToCsvmapper, function (csvKey, frictionlessKey) {
      if (_.has(dialect, frictionlessKey)) {
        csvOptions[csvKey] = dialect[frictionlessKey]
      }
    })
  }
  return csvOptions
}

function detectAndStoreQuoteChar (data, hotId, csvOptions) {
  let sample = _.truncate(data, { length: 2000 })
  var sniffer = new CSVSniffer()
  // csv-sniffer will throw exception if there is no line terminator in sample
  let newLineString = detectNewline(sample) || _.get(csvOptions, 'rowDelimiter', os.EOL)
  var sniffResult = sniffer.sniff(sample, { newlineStr: newLineString })
  if (sniffResult.quoteChar) {
    store.commit('pushTableProperty', { hotId: hotId, key: `sampledQuoteChar`, value: sniffResult.quoteChar })
  }
}


text:
package de.voodoosoft.blackcat;

import junit.framework.TestCase;

/**
 * Tests using anonymus classes.
 * @see TestLambda
 */
public class Test extends TestCase {

	/**
	 * Tests to inject one object.
	 */
	public void testSimpleInjection() {
		Injector injector = new Injector();

		injector.defineComponent(Bass.class, new Provider<Bass>() {
			@Override
			public Bass provide() {
				return new Bass();
			}
		});
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Bass bass = injector.getComponent(Bass.class);
		assertNotNull(bass);
		assertNotNull(bass.getBody());
	}

	/**
	 * Tests to inject an object which has injections by itself.
	 */
	public void testNestedInjection() {
		Injector injector = new Injector();

		injector.defineComponent(StringBand.class, new Provider<StringBand>() {
			@Override
			public StringBand provide() {
				return new StringBand();
			}
		});
		injector.defineComponent(Bass.class, new Provider<Bass>() {
			@Override
			public Bass provide() {
				return new Bass();
			}
		});
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		StringBand band = injector.getComponent(StringBand.class);
		assertNotNull(band.getBass());
		assertNotNull(band.getBass().getBody());
		assertNull(band.getGuitar());
	}

	/**
	 * Tests to inject an object by type and name.
	 */
	public void testNamedInjection() {
		Injector injector = new Injector();

		injector.defineComponent(Jazzband.class, new Provider<Jazzband>() {
			@Override
			public Jazzband provide() {
				return new Jazzband();
			}
		});
		injector.defineComponent(Guitar.class, "LesPaul", new Provider<Guitar>() {
			@Override
			public Guitar provide() {
				return new Guitar("LesPaul");
			}
		});
		injector.defineComponent(Guitar.class, "Stratocaster", new Provider<Guitar>() {
			@Override
			public Guitar provide() {
				return new Guitar("Stratocaster");
			}
		});
		injector.defineComponent(Artist.class, new Provider<Artist>() {
			@Override
			public Artist provide() {
				return new Artist();
			}
		});
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Jazzband band = injector.getComponent(Jazzband.class);
		assertEquals("LesPaul", band.getLeadGuitar().getModel());
		assertEquals("Stratocaster", band.getRhythmGuitar().getModel());
		assertNotSame(band.getLeadGuitar(), band.getRhythmGuitar());

		Guitar lesPaul = injector.getComponent(Guitar.class, "LesPaul");
		assertNotNull(lesPaul);
		Guitar stratocaster = injector.getComponent(Guitar.class, "Stratocaster");
		assertNotNull(stratocaster);
		assertNotSame(lesPaul, stratocaster);
	}

	/**
	 * Tests to inject two object of the same type, one is named, the other is not.
	 */
	public void testTypedAndNamedInjection() {
		Injector injector = new Injector();

		injector.defineComponent(Bluesband.class, new Provider<Bluesband>() {
			@Override
			public Bluesband provide() {
				return new Bluesband();
			}
		});
		injector.defineComponent(Guitar.class, "LesPaul", new Provider<Guitar>() {
			@Override
			public Guitar provide() {
				return new Guitar("LesPaul");
			}
		});
		injector.defineComponent(Guitar.class, new Provider<Guitar>() {
			@Override
			public Guitar provide() {
				return new Guitar("Stratocaster");
			}
		});
		injector.defineComponent(Artist.class, new Provider<Artist>() {
			@Override
			public Artist provide() {
				return new Artist();
			}
		});
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Bluesband band = injector.getComponent(Bluesband.class);
		assertEquals("LesPaul", band.getLeadGuitar().getModel());
		assertEquals("Stratocaster", band.getRhythmGuitar().getModel());
		assertNotSame(band.getLeadGuitar(), band.getRhythmGuitar());
	}

	/**
	 * Tests to inject the same object twice.
	 */
	public void testDoubleInjection() {
		final Guitar guitar = new Guitar("Stratocaster");
		Injector injector = new Injector();

		injector.defineComponent(Metalband.class, new Provider<Metalband>() {
			@Override
			public Metalband provide() {
				return new Metalband();
			}
		});
		injector.defineComponent(Guitar.class, new Provider<Guitar>() {
			@Override
			public Guitar provide() {
				return guitar;
			}
		});
		injector.defineComponent(Artist.class, new Provider<Artist>() {
			@Override
			public Artist provide() {
				return new Artist();
			}
		});
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Metalband band = injector.getComponent(Metalband.class);
		assertSame(band.getLeadGuitar(), band.getRhythmGuitar());
	}

	/**
	 * Tests post construction callback.
	 */
	public void testPostConstruction() {
		Injector injector = new Injector();

		injector.defineComponent(Guitar.class, new Provider<Guitar>() {
			@Override
			public Guitar provide() {
				return new Guitar();
			}
		});
		injector.defineComponent(Artist.class, new Provider<Artist>() {
			@Override
			public Artist provide() {
				return new Artist();
			}
		});
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Guitar guitar = injector.getComponent(Guitar.class);
		assertNotNull(guitar);
		assertNotNull(guitar.isInitialized());
	}

	public void testSingleton() {
		Injector injector = new Injector();
		injector.defineComponent(Bass.class, true, new Provider<Bass>() {
					@Override
					public Bass provide() {
						return new Bass();
					}
				}
		);
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Bass bass1 = injector.getComponent(Bass.class);
		Bass bass2 = injector.getComponent(Bass.class);
		assertTrue(bass1 == bass2);
	}

	public void testDistinctness() {
		Injector injector = new Injector();
		injector.defineComponent(Bass.class, new Provider<Bass>() {
				@Override
				public Bass provide() {
					return new Bass();
				}
			}
		);
		injector.defineComponent(Body.class, new Provider<Body>() {
			@Override
			public Body provide() {
				return new Body();
			}
		});

		Bass bass1 = injector.getComponent(Bass.class);
		Bass bass2 = injector.getComponent(Bass.class);
		assertTrue(bass1 != bass2);
	}

	private Bass bass1a;
	private Bass bass1b;
	private Bass bass2a;
	private Bass bass2b;
}

redpajama_set_name: RedPajamaGithub


text:
namespace protector {

class ProtectorService;

class ProtectorServiceFactory : public ProfileKeyedServiceFactory {
 public:
  // Returns the ProtectorService instance for |profile|.
  static ProtectorService* GetForProfile(Profile* profile);

  static ProtectorServiceFactory* GetInstance();

 private:
  friend struct DefaultSingletonTraits<ProtectorServiceFactory>;

  ProtectorServiceFactory();
  virtual ~ProtectorServiceFactory();

  // ProfileKeyedServiceFactory implementation.
  virtual ProfileKeyedService* BuildServiceInstanceFor(
      Profile* profile) const OVERRIDE;
  virtual bool ServiceRedirectedInIncognito() OVERRIDE;

  DISALLOW_COPY_AND_ASSIGN(ProtectorServiceFactory);
};

}  // namespace protector

#endif  // CHROME_BROWSER_PROTECTOR_PROTECTOR_SERVICE_FACTORY_H_


text:
@echo off

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

rem This batch file creates the Debug DLL, the Release DLL and the documentation.
rem It requires the .NET Framework 3.5, Sandcastle and Sandcastle Help File Builder.

echo Removing old DLLs
rmdir /Q /S bin
rmdir /Q /S obj

echo Building Debug DLL...
msbuild DotCMIS.csproj /ToolsVersion:3.5 /p:Configuration=Debug

echo Building Release DLL...
msbuild DotCMIS.csproj /ToolsVersion:3.5 /p:Configuration=Release

echo Building documentation...
msbuild DotCMIS.shfbproj /p:Configuration=Release


text:
if(typeof Shadowbox == 'undefined'){
    throw 'Unable to load Shadowbox language file, base library not found.';
}

/**
 * An object containing all textual messages to be used in Shadowbox. These are
 * provided so they may be translated into different languages. Alternative
 * translations may be found in js/lang/shadowbox-*.js where * is an abbreviation
 * of the language name (see
 * http://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes).
 *
 * @var     {Object}    LANG
 * @public
 * @static
 */
Shadowbox.LANG = {

    code:       'pt-BR',

    of:         'de',

    loading:    'carregando',

    cancel:     'Cancelar',

    next:       'Próximo',

    previous:   'Anterior',

    play:       'Play',

    pause:      'Pause',

    close:      'Fechar',

    errors:     {
        single: 'Você precisa instalar o plugin {1} para visualizar o conteúdo.',
        shared: 'Você precisa instalar os plugins {1} e {3}, para visualizar o conteúdo.',
        either: 'Você precisa instalar o plugin {1} ou o plugin {3}, para visualizar o conteúdo.'
    }

};


text:
package aQute.bnd.repository.maven.pom.provider;

import java.io.File;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.FileTime;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.resource.Capability;
import org.osgi.resource.Resource;
import org.osgi.service.repository.RequirementBuilder;
import org.osgi.util.promise.Promise;

import aQute.bnd.build.Workspace;
import aQute.bnd.http.HttpClient;
import aQute.bnd.osgi.Jar;
import aQute.bnd.osgi.Processor;
import aQute.bnd.osgi.repository.XMLResourceParser;
import aQute.bnd.service.RepositoryListenerPlugin;
import aQute.bnd.service.RepositoryPlugin;
import aQute.bnd.version.Version;
import aQute.lib.io.IO;
import aQute.lib.strings.Strings;
import aQute.libg.reporter.slf4j.Slf4jReporter;
import aQute.maven.api.Archive;
import aQute.maven.api.Program;
import aQute.maven.api.Revision;
import aQute.maven.provider.MavenBackingRepository;
import aQute.maven.provider.MavenRepository;
import aQute.service.reporter.Reporter;
import junit.framework.TestCase;

public class PomRepositoryTest extends TestCase {
	static final String	MAVEN_REPO_LOCAL	= System.getProperty("maven.repo.local", "~/.m2/repository");

	Reporter			reporter			= new Slf4jReporter(PomRepositoryTest.class);
	private File		tmp;
	private File		localRepo;
	private File		location;
	private HttpClient	client;

	protected void setUp() {
		tmp = IO.getFile("generated/tmp/test/" + getName());
		localRepo = IO.getFile(MAVEN_REPO_LOCAL);
		location = IO.getFile(tmp, "index.xml");
		IO.delete(tmp);
		tmp.mkdirs();
		client = new HttpClient();
	}

	protected void tearDown() {
		client.close();
	}

	public void testPomTransitive() throws Exception {
		MavenRepository mr = getRepo();

		Revision revision = Program.valueOf("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm")
				.version("1.0.8");

		HttpClient client = new HttpClient();
		Traverser t = new Traverser(mr, client, true).revision(revision);
		Map<Archive,Resource> value = t.getResources().getValue();
		assertEquals(8, value.size());
		assertAllBndCap(value);
	}

	public void testPomNotTransitive() throws Exception {
		MavenRepository mr = getRepo();

		Revision revision = Program.valueOf("org.apache.aries.blueprint", "org.apache.aries.blueprint.cm")
				.version("1.0.8");

		HttpClient client = new HttpClient();
		Traverser t = new Traverser(mr, client, false).revision(revision);
		Map<Archive,Resource> value = t.getResources().getValue();
		assertEquals(1, value.size());
		assertAllBndCap(value);
	}

	public void testDependenciesWithVersionRanges() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("revision", "com.mchange:mchange-commons-java:0.2.10");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			for (String bsn : list) {
				SortedSet<Version> versions = bpr.versions(bsn);
				assertEquals(1, versions.size());
				Version v = versions.first();
				switch (bsn) {
					case "log4j:log4j" :
						assertEquals("1.2.14", v.toString());
						break;

					case "com.typesafe.config" :
						assertEquals("1.2.1", v.toString());
						break;

					case "com.mchange:mchange-commons-java" :
						assertEquals("0.2.10", v.toString());
						break;

					case "slf4j.api" :
						assertEquals("1.7.5", v.toString());
						break;

					default :
						fail(bsn);
				}

			}
			assertNotNull(list);
			assertEquals(4, list.size());
		}
	}

	public void testBndPomRepoFile() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom", "testdata/pomrepo/simple.xml");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
		}
	}

	public void testBndPomRepoFileExistingParent() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom", "testdata/pomrepo/existing-parent.xml");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
		}
	}

	public void testBndPomRepoFileMissingParent() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom", "testdata/pomrepo/missing-parent.xml");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			try {
				bpr.list(null);
				fail("Should throw IllegalArgumentException on missing parent pom.");
			} catch (Exception iae) {
				// This exception is expected!
			}
		}
	}

	public void testEntityPom() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom", "testdata/pomrepo/entity.xml");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
		}
	}

	public void testBndPomRepoFileNoDeps() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom", "testdata/pomrepo/simple-nodeps.xml");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertNotNull(list);
			assertEquals(0, list.size());
		}
	}

	public void testBndPomRepoURI() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom",
					"https://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.gogo.shell/0.12.0/org.apache.felix.gogo.shell-0.12.0.pom");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
			RequirementBuilder builder = bpr.newRequirementBuilder("osgi.identity");
			builder.addDirective("filter", "(osgi.identity=org.apache.felix.gogo.runtime)");
			Promise<Collection<Resource>> providers = bpr.findProviders(builder.buildExpression());
			Collection<Resource> resources = providers.getValue();
			assertFalse(resources.isEmpty());
			assertEquals(1, resources.size());
		}
	}

	public void testBndPomRepoRefresh() throws Exception {
		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom", "testdata/pomrepo/simple.xml");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
			try {
				bpr.refresh();
			} catch (Throwable t) {
				fail();
			}
		}
	}

	public void testRepository() throws Exception {
		MavenRepository repo = getRepo();
		List<Revision> revisions = Arrays.asList(Revision.valueOf("bcel:bcel:5.1"));
		PomRepository pom = new PomRepository(repo, client, location).revisions(revisions);

		assertTrue(location.isFile());

		try (XMLResourceParser xp = new XMLResourceParser(location);) {
			List<Resource> parse = xp.parse();
			assertEquals(parse.size(), pom.getResources().size());
		}
		assertFalse(pom.isStale());
	}

	public void testSearchRepoSimple() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.2.0");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			mcsr.setProperties(config);

			List<String> list = mcsr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
		}
	}

	public void testSearchRepoNoUrls() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.2.0");
			config.put("name", "test");
			mcsr.setProperties(config);

			List<String> list = mcsr.list(null);
			assertNotNull(list);
			assertEquals(1, list.size());
		}
	}

	public void testSearchRepoMultipleConfigurationsDontBreak() throws Exception {
		Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
		w.setBase(tmp);

		try (BndPomRepository mcsrBnd320 = new BndPomRepository();
				BndPomRepository mcsrBnd330 = new BndPomRepository()) {
			mcsrBnd320.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.2.0");
			config.put("name", "bnd320");
			mcsrBnd320.setProperties(config);

			mcsrBnd330.setRegistry(w);

			config = new HashMap<>();
			config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.3.0");
			config.put("name", "bnd330");
			mcsrBnd330.setProperties(config);

			List<String> list320 = mcsrBnd320.list(null);
			assertNotNull(list320);
			assertEquals(1, list320.size());

			List<String> list330 = mcsrBnd330.list(null);
			assertNotNull(list330);
			assertEquals(1, list330.size());

			// check the first repo to make sure it's there.
			RequirementBuilder builder = mcsrBnd320.newRequirementBuilder("osgi.identity");
			builder.addDirective("filter", "(&(osgi.identity=biz.aQute.bnd)(version>=3.2.0)(!(version>=3.3.0)))");
			Promise<Collection<Resource>> providers = mcsrBnd320.findProviders(builder.buildExpression());
			Collection<Resource> resources = providers.getValue();
			assertFalse(resources.isEmpty());
			assertEquals(1, resources.size());

			// make sure it's not in the second repo, otherwise the caches are
			// messed up.
			providers = mcsrBnd330.findProviders(builder.buildExpression());
			resources = providers.getValue();
			assertTrue(resources.isEmpty());
			assertEquals(0, resources.size());
		}
	}

	/**
	 * This test occasionally fails on Travis.
	 *
	 * <pre>
	aQute.bnd.repository.maven.pom.provider.PomRepositoryTest > testSearchRepoAllVersions FAILED
	    junit.framework.AssertionFailedError: expected:<1> but was:<2>
	        at junit.framework.Assert.fail(Assert.java:57)
	        at junit.framework.Assert.failNotEquals(Assert.java:329)
	        at junit.framework.Assert.assertEquals(Assert.java:78)
	        at junit.framework.Assert.assertEquals(Assert.java:234)
	        at junit.framework.Assert.assertEquals(Assert.java:241)
	        at junit.framework.TestCase.assertEquals(TestCase.java:409)
	        at aQute.bnd.repository.maven.pom.provider.PomRepositoryTest.testSearchRepoAllVersions(PomRepositoryTest.java:220)
	 * </pre>
	 */
	// public void testSearchRepoAllVersions() throws Exception {
		// BndPomRepository mcsr = new BndPomRepository();
		// Workspace w = Workspace.createStandaloneWorkspace(new Processor(),
		// tmp.toURI());
		// w.setBase(tmp);
		// mcsr.setRegistry(w);
		//
		// Map<String,String> config = new HashMap<>();
		// config.put("query",
		// "q=g:biz.aQute.bnd+AND+a:biz.aQute.bnd&core=gav&rows=100");
		// config.put("name", "test");
		// mcsr.setProperties(config);
		//
		// List<String> list = mcsr.list(null);
		// assertNotNull(list);
		// // All the results are represented by a single bsn
		// assertEquals(1, list.size());
		// SortedSet<Version> versions = mcsr.versions("biz.aQute.bnd");
		// assertTrue(versions.size() >= 4);
	// }

	public void testSearchRepoFailNoQuery() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("name", "test");
			try {
				mcsr.setProperties(config);
				fail();
			} catch (Exception e) {
				assertEquals("Neither pom, revision nor query property are set", e.getMessage());
			}
		}
	}

	public void testSearchRepoFailNoName() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("query", "q=g:biz.aQute.bnd+a:biz.aQute.bnd+AND+v:3.2.0");
			try {
				mcsr.setProperties(config);
				fail();
			} catch (Exception e) {
				assertEquals("Must get a name", e.getMessage());
			}
		}
	}

	public void testNonStandardClassifierDependencies() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			File local = new File(tmp, "m2-repository");
			local.mkdirs();

			Map<String,String> config = new HashMap<>();
			config.put("name", "pmd");
			config.put("revision", "net.sourceforge.pmd:pmd-java:5.2.3");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("local", local.getAbsolutePath());
			mcsr.setProperties(config);

			List<String> list = mcsr.list(null);
			assertNotNull(list);

			URL url = new URL(tmp.toURI().toURL(),
					"m2-repository/net/sourceforge/saxon/saxon/9.1.0.8/saxon-9.1.0.8-dom.jar");

			File dom = new File(url.getFile());
			assertTrue(dom.exists());

			// I'm assuming because we don't have a way of currently "getting" such
			// a classified artifact from the repo that we'd have to encode the
			// classifier in the bsn of the classified jar if it's not a bundle.
			// Something like:

			// File file = mcsr.get("net.sourceforge.pmd:pmd-java:dom", new
			// Version("5.2.3"), null);
			// assertNotNull(file);
		}
	}

	public void testMultipleRevisions() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			File local = new File(tmp, "m2-repository");
			local.mkdirs();

			Map<String,String> config = new HashMap<>();
			config.put("name", "test-dependencies");

			String revisions = Strings.join(new String[] {
					"biz.aQute.bnd:biz.aQute.junit:3.3.0", "biz.aQute.bnd:biz.aQute.launcher:3.3.0",
					"biz.aQute.bnd:biz.aQute.remote.launcher:3.3.0", "biz.aQute.bnd:biz.aQute.tester:3.3.0"
			});

			config.put("revision", revisions);
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("local", local.getAbsolutePath());
			config.put("transitive", "true");
			mcsr.setProperties(config);

			List<String> list = mcsr.list(null);
			assertNotNull(list);

			RequirementBuilder builder = mcsr.newRequirementBuilder("osgi.identity");
			builder.addAttribute("filter", "(osgi.identity=biz.aQute.tester)");

			Promise<Collection<Resource>> providers = mcsr.findProviders(builder.buildExpression());
			Collection<Resource> resources = providers.getValue();
			assertFalse(resources.isEmpty());
		}
	}

	public void testMultiplePomFiles() throws Exception {
		try (BndPomRepository mcsr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			mcsr.setRegistry(w);

			File local = new File(tmp, "m2-repository");
			local.mkdirs();

			Map<String,String> config = new HashMap<>();
			config.put("name", "test-dependencies");

			String pomFiles = Strings.join(new String[] {
					"testdata/pomrepo/simple.xml",
					"https://repo1.maven.org/maven2/org/apache/felix/org.apache.felix.gogo.shell/0.12.0/org.apache.felix.gogo.shell-0.12.0.pom"
			});

			config.put("pom", pomFiles);
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("local", local.getAbsolutePath());
			mcsr.setProperties(config);

			List<String> list = mcsr.list(null);
			assertNotNull(list);
			assertEquals(2, list.size());

			RequirementBuilder builder = mcsr.newRequirementBuilder("osgi.identity");
			builder.addAttribute("filter", "(osgi.identity=org.apache.felix.gogo.shell)");

			Promise<Collection<Resource>> providers = mcsr.findProviders(builder.buildExpression());
			Collection<Resource> resources = providers.getValue();
			assertFalse(resources.isEmpty());

			builder = mcsr.newRequirementBuilder("osgi.identity");
			builder.addAttribute("filter", "(osgi.identity=osgi.core)");

			providers = mcsr.findProviders(builder.buildExpression());
			resources = providers.getValue();
			assertFalse(resources.isEmpty());
		}
	}

	/**
	 * Copies the POM from testdata/pomfiles/simple-nodeps.xml to a temporary file
	 * which is deleted at the end of the test. This copied POM is added to a Repo
	 * and updated with a new dependency to test the polling for changes.
	 * Furthermore a remote POM is added to the config to check run through the
	 * stale-check
	 */
	public void testBndPomRepoFilePolling() throws Exception {
		Path path = IO.getFile(tmp, "pom.xml").toPath();
		Path source = Paths.get("testdata/pomrepo/simple-nodeps.xml");
		Files.copy(source, path, StandardCopyOption.REPLACE_EXISTING);
		Files.setLastModifiedTime(path, Files.getLastModifiedTime(source));

		try (BndPomRepository bpr = new BndPomRepository()) {
			Workspace w = Workspace.createStandaloneWorkspace(new Processor(), tmp.toURI());
			w.setBase(tmp);
			bpr.setRegistry(w);

			Map<String,String> config = new HashMap<>();
			config.put("pom",
					path.toString() + ",https://repo1.maven.org/maven2/javax/enterprise/cdi-api/2.0/cdi-api-2.0.pom");
			config.put("snapshotUrls", "https://repo1.maven.org/maven2/");
			config.put("releaseUrls", "https://repo1.maven.org/maven2/");
			config.put("name", "test");
			config.put("poll.time", "1");
			bpr.setProperties(config);

			List<String> list = bpr.list(null);
			assertEquals(3, list.size());

			CountDownLatch refreshed = new CountDownLatch(1);
			w.addBasicPlugin(new RepositoryListenerPlugin() {
				@Override
				public void repositoryRefreshed(RepositoryPlugin repository) {
					if (repository == bpr) {
						refreshed.countDown();
					}
				}

				@Override
				public void repositoriesRefreshed() {}

				@Override
				public void bundleRemoved(RepositoryPlugin repository, Jar jar, File file) {}

				@Override
				public void bundleAdded(RepositoryPlugin repository, Jar jar, File file) {}
			});

			Files.copy(Paths.get("testdata/pomrepo/simple.xml"), path, StandardCopyOption.REPLACE_EXISTING);
			// Make sure changed pomfile timestamp is later than PomRepository location file
			Files.setLastModifiedTime(path, FileTime.fromMillis(System.currentTimeMillis() + 1000L));
			assertTrue(refreshed.await(10, TimeUnit.SECONDS));
			list = bpr.list(null);
			assertEquals(4, list.size());
		}
	}

	MavenRepository getRepo() throws Exception {
		List<MavenBackingRepository> central = MavenBackingRepository.create("https://repo1.maven.org/maven2/",
				reporter, localRepo, client);
		List<MavenBackingRepository> apache = MavenBackingRepository
				.create("https://repository.apache.org/content/groups/snapshots/", reporter, localRepo, client);

		MavenRepository mr = new MavenRepository(localRepo, "test", central, apache, client.promiseFactory().executor(),
			reporter);
		return mr;
	}

	void assertAllBndCap(Map<Archive,Resource> value) {
		for (Resource resource : value.values()) {
			List<Capability> capabilities = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
			assertNotNull(capabilities);
			assertEquals(1, capabilities.size());

			capabilities = resource.getCapabilities("bnd.info");
			Capability c = capabilities.get(0);
			String a = (String) c.getAttributes().get("name");
			Archive archive = Archive.valueOf(a);
			assertNotNull(archive);
		}
	}
}


text:
package org.assertj.core.description;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.description.Description.mostRelevantDescription;

import org.junit.jupiter.api.Test;

public class Description_mostRelevantDescription_Test {

  @Test
  public void should_return_exsiting_description_if_not_empty() {
    // GIVEN
    String existing = "bar";
    Description description = new TextDescription(existing);
    // WHEN
    String mostRelevantDescription = mostRelevantDescription(description, "foo");

    // THEN
    assertThat(mostRelevantDescription).isEqualTo(existing);
  }

  @Test
  public void should_return_the_other_value_if_description_value_is_empty() {
    // GIVEN
    Description description = new TextDescription("");
    String other = "foo";

    // WHEN
    String mostRelevantDescription = mostRelevantDescription(description, other);

    // THEN
    assertThat(mostRelevantDescription).isEqualTo(other);
  }

  @Test
  public void should_return_the_other_value_if_description_value_is_null() {
    // GIVEN
    Description description = new TextDescription(null);
    String other = "foo";

    // WHEN
    String mostRelevantDescription = mostRelevantDescription(description, other);

    // THEN
    assertThat(mostRelevantDescription).isEqualTo(other);
  }

  @Test
  public void should_return_the_other_value_if_null() {
    // GIVEN
    Description description = null;
    String other = "foo";

    // WHEN
    String mostRelevantDescription = mostRelevantDescription(description, other);

    // THEN
    assertThat(mostRelevantDescription).isEqualTo(other);
  }

}


text:
<!DOCTYPE html>

<title>Cultural Blog</title>
<link rel="stylesheet" href="../stylesheets/blog.css">

Cultural Blog Week 4

By Perry Anderson

File Sharing

Illegal file sharing is an issue that will have to addressed in the near future. It is a current economic reality that music, movies, and software have become less costly to steal than to purchase. Virtually every movie and music album that can be bought can also be obtained illegally.

The reason this is occurring is simple: because it can. As soon as internet speeds were great enough to allow the illegal sharing of files it was inevitable that it would occur. Due to the incredible volume of sharing that occurs it is not practical to punish everyone who participates in file sharing.

There are some who make the argument that all information should be free, which I disagree with. Content takes work to generate, and that work has value.

Sadly, there is currently no easy solution to this problem. Any action taken to completely restrict file sharing would violate people 's right to privacy. Creating more and more elaborate written-in measures in programs has not proved to be an effective deterrent. Legal action is not practical at the scale on which file sharing occurs. Whatever solution  eventually emerges, if one does, we can only hope strikes a balance between the rights of artists and consumers.

Back to index


text:
<?php

if (!defined('_PS_VERSION_'))
	exit;

class StatsProduct extends ModuleGraph
{
	private $html = '';
	private $_query = '';
	private $_option = 0;
	private $_id_product = 0;

	public function __construct()
	{
		$this->name = 'statsproduct';
		$this->tab = 'analytics_stats';
		$this->version = 1.0;
		$this->author = 'PrestaShop';
		$this->need_instance = 0;

		parent::__construct();

		$this->displayName = $this->l('Product details');
		$this->description = $this->l('Get detailed statistics for each product.');
	}

	public function install()
	{
		return (parent::install() && $this->registerHook('AdminStatsModules'));
	}

	public function getTotalBought($id_product)
	{
		$dateBetween = ModuleGraph::getDateBetween();
		$sql = 'SELECT SUM(od.`product_quantity`) AS total
				FROM `'._DB_PREFIX_.'order_detail` od
				LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
				WHERE od.`product_id` = '.(int)$id_product.'
					'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
					AND o.valid = 1
					AND o.`date_add` BETWEEN '.$dateBetween;
		return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
	}

	public function getTotalSales($id_product)
	{
		$dateBetween = ModuleGraph::getDateBetween();
		$sql = 'SELECT SUM(od.`product_quantity` * od.`product_price`) AS total
				FROM `'._DB_PREFIX_.'order_detail` od
				LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
				WHERE od.`product_id` = '.(int)$id_product.'
					'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
					AND o.valid = 1
					AND o.`date_add` BETWEEN '.$dateBetween;
		return (float)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
	}

	public function getTotalViewed($id_product)
	{
		$dateBetween = ModuleGraph::getDateBetween();
		$sql = 'SELECT SUM(pv.`counter`) AS total
				FROM `'._DB_PREFIX_.'page_viewed` pv
				LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range`
				LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
				LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
				WHERE pt.`name` = \'product\'
					'.Shop::addSqlRestriction(false, 'pv').'
					AND p.`id_object` = '.(int)$id_product.'
					AND dr.`time_start` BETWEEN '.$dateBetween.'
					AND dr.`time_end` BETWEEN '.$dateBetween;
		$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
		return isset($result['total']) ? $result['total'] : 0;
	}

	private function getProducts($id_lang)
	{
		$sql = 'SELECT p.`id_product`, p.reference, pl.`name`, IFNULL(stock.quantity, 0) as quantity
				FROM `'._DB_PREFIX_.'product` p
				'.Product::sqlStock('p', 0).'
				LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`'.Shop::addSqlRestrictionOnLang('pl').'
				'.Shop::addSqlAssociation('product', 'p').'
				'.(Tools::getValue('id_category') ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`' : '').'
				WHERE pl.`id_lang` = '.(int)$id_lang.'
					'.(Tools::getValue('id_category') ? 'AND cp.id_category = '.(int)Tools::getValue('id_category') : '').'
				ORDER BY pl.`name`';

		return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
	}

	private function getSales($id_product, $id_lang)
	{
		$sql = 'SELECT o.date_add, o.id_order, o.id_customer, od.product_quantity, (od.product_price * od.product_quantity) as total, od.tax_name, od.product_name
				FROM `'._DB_PREFIX_.'orders` o
				LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
				WHERE o.date_add BETWEEN '.$this->getDate().'
					'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
					AND o.valid = 1
					AND od.product_id = '.(int)$id_product;
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
	}

	private function getCrossSales($id_product, $id_lang)
	{
		$sql = 'SELECT pl.name as pname, pl.id_product, SUM(od.product_quantity) as pqty, AVG(od.product_price) as pprice
				FROM `'._DB_PREFIX_.'orders` o
				LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
				LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = od.product_id AND pl.id_lang = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
				WHERE o.id_customer IN (
						SELECT o.id_customer
						FROM `'._DB_PREFIX_.'orders` o
						LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
						WHERE o.date_add BETWEEN '.$this->getDate().'
						AND o.valid = 1
						AND od.product_id = '.(int)$id_product.'
					)
					'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
					AND o.date_add BETWEEN '.$this->getDate().'
					AND o.valid = 1
					AND od.product_id != '.(int)$id_product.'
				GROUP BY od.product_id
				ORDER BY pqty DESC';
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
	}

	public function hookAdminStatsModules($params)
	{
		$id_category = (int)Tools::getValue('id_category');
		$currency = Context::getContext()->currency;

		if (Tools::getValue('export'))
			if (!Tools::getValue('exportType'))
				$this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '42'));

		$this->html = '

name.'">'.$this->displayName.'
';
		if ($id_product = (int)Tools::getValue('id_product'))
		{
			if (Tools::getValue('export'))
				if (Tools::getValue('exportType') == 1)
					$this->csvExport(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product));
				else if (Tools::getValue('exportType') == 2)
					$this->csvExport(array('type' => 'pie', 'option' => '3-'.$id_product));
			$product = new Product($id_product, false, $this->context->language->id);
			$totalBought = $this->getTotalBought($product->id);
			$totalSales = $this->getTotalSales($product->id);
			$totalViewed = $this->getTotalViewed($product->id);
			$this->html .= '
'.$product->name.' - '.$this->l('Details').'

'.$this->l('Total bought:').' '.$totalBought.'

'.$this->l('Sales ( Figure does not include tax):').' '.Tools::displayprice($totalSales, $currency).'

'.$this->l('Total viewed:').' '.$totalViewed.'

'.$this->l('Conversion rate:').' '.number_format($totalViewed ? $totalBought / $totalViewed : 0, 2).'

			'.$this->engine(array('layers' => 2, 'type' => 'line', 'option' => '1-'.$id_product)).'

'.$this->l('CSV Export').'
';
			if ($hasAttribute = $product->hasAttributes() && $totalBought)
				$this->html .= '
'.$this->l('Attribute sales distribution').'
'.$this->engine(array('type' => 'pie', 'option' => '3-'.$id_product)).'

'.$this->l('CSV Export').'

';
			if ($totalBought)
			{
				$sales = $this->getSales($id_product, $this->context->language->id);
				$this->html .= '

'.$this->l('Sales').'

						'.$this->l('Date').'
						'.$this->l('Order').'
						'.$this->l('Customer').'
						'.($hasAttribute ? ''.$this->l('Attribute').'	' : '').'
						'.$this->l('Quantity').'
						'.$this->l('Price').'

';
				$tokenOrder = Tools::getAdminToken('AdminOrders'.(int)Tab::getIdFromClassName('AdminOrders').(int)$this->context->employee->id);
				$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id);
				foreach ($sales as $sale)
					$this->html .= '

						'.Tools::displayDate($sale['date_add'], (int)$this->context->language->id, false).'
						'.(int)($sale['id_order']).'
						'.(int)($sale['id_customer']).'
						'.($hasAttribute ? ''.$sale['product_name'].'	' : '').'
						'.(int)$sale['product_quantity'].'
						'.Tools::displayprice($sale['total'], $currency).'

';
				$this->html .= '

';

				$crossSelling = $this->getCrossSales($id_product, $this->context->language->id);
				if (count($crossSelling))
				{
					$this->html .= '

'.$this->l('Cross selling').'

							'.$this->l('Product name').'
							'.$this->l('Quantity sold').'
							'.$this->l('Average price').'

';
					$tokenProducts = Tools::getAdminToken('AdminProducts'.(int)Tab::getIdFromClassName('AdminProducts').(int)$this->context->employee->id);
					foreach ($crossSelling as $selling)
						$this->html .= '

							'.$selling['pname'].'
							'.(int)$selling['pqty'].'
							'.Tools::displayprice($selling['pprice'], $currency).'

';
					$this->html .= '

';
				}
			}
		}
		else
		{
			$categories = Category::getCategories((int)$this->context->language->id, true, false);
			$this->html .= '

				<form action="" method="post" id="categoriesForm">
				'.$this->l('Choose a category').'
					<select name="id_category" onchange="$(\'#categoriesForm\').submit();">
						<option value="0">'.$this->l('All').'</option>';
			foreach ($categories as $category)
				$this->html .= '<option value="'.$category['id_category'].'"'.($id_category == $category['id_category'] ? ' selected="selected"' : '').'>'.$category['name'].'</option>';
			$this->html .= '
					</select>
				</form>

'.$this->l('Click on a product to access its statistics!').'

'.$this->l('Products available').'

					'.$this->l('Ref.').'
					'.$this->l('Name').'
					'.$this->l('Available quantity for sale').'

';

			foreach ($this->getProducts($this->context->language->id) as $product)
				$this->html .= '

					'.$product['reference'].'

						name.'&id_product='.$product['id_product'].'">'.$product['name'].'

					'.$product['quantity'].'

';

			$this->html .= '

				'.$this->l('CSV Export').'
';
		}

		$this->html .= '

'.$this->l('Guide').'

'.$this->l('Number of purchases compared to number of views.').'

				'.$this->l('After choosing a category and selecting a product, informational graphs will appear.').'

'.$this->l('If you notice that a product is often purchased but viewed infrequently, you should display it more prominently in your Front Office. ').'

'.$this->l('On the other hand, if a product has many viewings but is not often purchased,
						we advise you to check or modify this product\'s information, description and photography again.').'

';
		return $this->html;
	}

	public function setOption($option, $layers = 1)
	{
		$options = explode('-', $option);
		if (count($options) === 2)
			list($this->_option, $this->_id_product) = $options;
		else
			$this->_option = $option;
		$dateBetween = $this->getDate();
		switch ($this->_option)
		{
			case 1:
				$this->_titles['main'][0] = $this->l('Popularity');
				$this->_titles['main'][1] = $this->l('Sales');
				$this->_titles['main'][2] = $this->l('Visits (x100)');
				$this->_query[0] = 'SELECT o.`date_add`, SUM(od.`product_quantity`) AS total
						FROM `'._DB_PREFIX_.'order_detail` od
						LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
						WHERE od.`product_id` = '.(int)$this->_id_product.'
							'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
							AND o.valid = 1
							AND o.`date_add` BETWEEN '.$dateBetween.'
						GROUP BY o.`date_add`';

				$this->_query[1] = 'SELECT dr.`time_start` AS date_add, (SUM(pv.`counter`) / 100) AS total
						FROM `'._DB_PREFIX_.'page_viewed` pv
						LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range`
						LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
						LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
						WHERE pt.`name` = \'product\'
							'.Shop::addSqlRestriction(false, 'pv').'
							AND p.`id_object` = '.(int)$this->_id_product.'
							AND dr.`time_start` BETWEEN '.$dateBetween.'
							AND dr.`time_end` BETWEEN '.$dateBetween.'
						GROUP BY dr.`time_start`';
			break;

			case 3:
				$this->_query = 'SELECT product_attribute_id, SUM(od.`product_quantity`) AS total
						FROM `'._DB_PREFIX_.'orders` o
						LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.`id_order` = od.`id_order`
						WHERE od.`product_id` = '.(int)$this->_id_product.'
							'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
							AND o.valid = 1
							AND o.`date_add` BETWEEN '.$dateBetween.'
						GROUP BY od.`product_attribute_id`';
				$this->_titles['main'] = $this->l('Attributes');
			break;

			case 42:
				$this->_titles['main'][1] = $this->l('Ref.');
				$this->_titles['main'][2] = $this->l('Name');
				$this->_titles['main'][3] = $this->l('Stock');
				break;
		}
	}

	protected function getData($layers)
	{
		if ($this->_option == 42)
		{
			$products = $this->getProducts($this->context->language->id);
			foreach ($products as $product)
			{
				$this->_values[0][] = $product['reference'];
				$this->_values[1][] = $product['name'];
				$this->_values[2][] = $product['quantity'];
				$this->_legend[] = $product['id_product'];
			}
		}
		else if ($this->_option != 3)
			$this->setDateGraph($layers, true);
		else
		{
			$product = new Product($this->_id_product, false, (int)$this->getLang());

			$combArray = array();
			$assocNames = array();
			$combinations = $product->getAttributeCombinations((int)$this->getLang());
			foreach ($combinations as $k => $combination)
				$combArray[$combination['id_product_attribute']][] = array('group' => $combination['group_name'], 'attr' => $combination['attribute_name']);
			foreach ($combArray as $id_product_attribute => $product_attribute)
			{
				$list = '';
				foreach ($product_attribute as $attribute)
					$list .= trim($attribute['group']).' - '.trim($attribute['attr']).', ';
				$list = rtrim($list, ', ');
				$assocNames[$id_product_attribute] = $list;
			}

			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query);
			foreach ($result as $row)
			{
				$this->_values[] = $row['total'];
				$this->_legend[] = @$assocNames[$row['product_attribute_id']];
			}
		}
	}

	protected function setAllTimeValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query[$i]);
			foreach ($result as $row)
				$this->_values[$i][(int)(substr($row['date_add'], 0, 4))] += $row['total'];
		}
	}

	protected function setYearValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query[$i]);
			foreach ($result as $row)
				$this->_values[$i][(int)(substr($row['date_add'], 5, 2))] += $row['total'];
		}
	}

	protected function setMonthValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query[$i]);
			foreach ($result as $row)
				$this->_values[$i][(int)(substr($row['date_add'], 8, 2))] += $row['total'];
		}
	}

	protected function setDayValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query[$i]);
			foreach ($result as $row)
				$this->_values[$i][(int)(substr($row['date_add'], 11, 2))] += $row['total'];
		}
	}
}


text:
using base::FieldTrialList;

namespace content_settings {

// static
const char PluginsFieldTrial::kForceFieldTrial[] = "ForcePluginPowerSaver";

// static
const char PluginsFieldTrial::kEnableFieldTrial[] = "PluginPowerSaver";

// static
ContentSetting PluginsFieldTrial::EffectiveContentSetting(
    ContentSettingsType type,
    ContentSetting setting) {
  if (type != CONTENT_SETTINGS_TYPE_PLUGINS)
    return setting;

  // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior.
  if (setting == ContentSetting::CONTENT_SETTING_ASK)
    return ContentSetting::CONTENT_SETTING_BLOCK;

  return setting;
}

// static
bool PluginsFieldTrial::IsPluginPowerSaverEnabled() {
  std::string enable_group = FieldTrialList::FindFullName(kEnableFieldTrial);
  std::string force_group = FieldTrialList::FindFullName(kForceFieldTrial);

  const base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
  if (cl->HasSwitch(plugins::switches::kDisablePluginPowerSaver))
    return false;
  if (cl->HasSwitch(plugins::switches::kEnablePluginPowerSaver))
    return true;

  if (!enable_group.empty() && enable_group != "Disabled")
    return true;
  if (!force_group.empty() && force_group != "Disabled")
    return true;

  return false;
}

// static
ContentSetting PluginsFieldTrial::GetDefaultPluginsContentSetting() {
  return IsPluginPowerSaverEnabled() ?
      ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT :
      ContentSetting::CONTENT_SETTING_ALLOW;
}

}  // namespace content_settings


text:
<?php

namespace Functional;

use Functional\Exceptions\InvalidArgumentException;
use Traversable;

/**
 * Recombines arrays by index and applies a callback optionally
 *
 * @param Traversable|array $collection One or more callbacks
 * @return array
 */
function zip($collection)
{
    $args = func_get_args();

    $callback = null;
    if (is_callable(end($args))) {
        $callback = array_pop($args);
    }

    foreach ($args as $position => $arg) {
        InvalidArgumentException::assertCollection($arg, __FUNCTION__, $position + 1);
    }

    $result = array();
    foreach ($collection as $index => $value) {
        $zipped = array();

        foreach ($args as $arg) {
            $zipped[] = isset($arg[$index]) ? $arg[$index] : null;
        }

        if ($callback !== null) {
            $zipped = call_user_func_array($callback, $zipped);
        }

        $result[] = $zipped;
    }

    return $result;
}


text:
require"imlua"
require"imlua_process"

local image = im.ImageCreate(500, 500, im.RGB, im.BYTE)

im.ProcessRenderRandomNoise(image)
image:Save("render_noise.bmp", "BMP")

im.ProcessRenderConstant(image, { 128.0, 0.0, 255.0 })
image:Save("render_constant.bmp", "BMP")

im.ProcessRenderWheel(image, 100, 200)
image:Save("render_wheel.bmp", "BMP")

im.ProcessRenderTent(image, 300, 200)
image:Save("render_tent.bmp", "BMP")

im.ProcessRenderRamp(image, 0, 500, 0)
image:Save("render_ramp.bmp", "BMP")

im.ProcessRenderBox(image, 200, 200)
image:Save("render_box.bmp", "BMP")

im.ProcessRenderSinc(image, 100.0, 100.0)
image:Save("render_sinc.bmp", "BMP")

im.ProcessRenderGaussian(image, 100.0)
image:Save("render_gaussian.bmp", "BMP")

im.ProcessRenderLapOfGaussian(image, 100.0)
image:Save("render_lapofgaussian.bmp", "BMP")

im.ProcessRenderCosine(image, 100.0, 100.0)
image:Save("render_cosine.bmp", "BMP")

im.ProcessRenderGrid(image, 100.0, 100.0)
image:Save("render_grid.bmp", "BMP")

im.ProcessRenderChessboard(image, 100.0, 100.0)
image:Save("render_chess.bmp", "BMP")

im.ProcessRenderCone(image, 200)
image:Save("render_cone.bmp", "BMP")

local render_func = function (x, y, d, param)
	return math.mod(x + y, 256)
end

im.ProcessRenderOp(image, render_func, "test", {}, 0)
image:Save("render_func.bmp", "BMP")


text:
'''
Collection of data structures and function used throughout the library.

.. module:: pulsar.utils.structures.misc

MultiValueDict
~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: MultiValueDict
   :members:
   :member-order: bysource

.. _attribute-dictionary:

AttributeDictionary
~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: AttributeDictionary
   :members:
   :member-order: bysource

FrozenDict
~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: FrozenDict
   :members:
   :member-order: bysource

.. module:: pulsar.utils.structures.skiplist

Skiplist
~~~~~~~~~~~~~~~
.. autoclass:: Skiplist
   :members:
   :member-order: bysource

.. module:: pulsar.utils.structures.zset

Zset
~~~~~~~~~~~~~~~
.. autoclass:: Zset
   :members:
   :member-order: bysource
'''
from collections import *       # noqa

from .skiplist import Skiplist  # noqa
from .zset import Zset          # noqa
from .misc import (MultiValueDict, AttributeDictionary, FrozenDict,  # noqa
                   Dict, Deque, merge_prefix, recursive_update,  # noqa
                   mapping_iterator, inverse_mapping, aslist)    # noqa


text:
  Add description to trading interface
  Change mobile text and link for homepage
  Add reset filters on homepage
  Fix datepicker for signup

### 3/30/2016
  Add webhook notifications for stripe
  Add Notification for trade request when starred
  Remove 30 day free trial
  Remove checkbox and terms of conditions iframe

### 3/29/2016
  Add trade request on user's profile
  Change Followed Person text
  Subcategories are on by default
  Add Star to people's profile listings
  Default Email Notifications to false.
  Add buyer id and seller id to MySQL
  Change trading interface
  Change listing image to 990x660
  Change image pictures to be higher quality
  Add Overlay for star and date updated/uploaded for people listings
  Add terms and conditions

### 3/28/2016
  If user is logged in, they can't log in again.
  Add color coding to inbox!
  Edit suspect fraud text
  Add mobile for Tawk contact
  Change text for reason for Tawk

### 3/24/2016
  Major update!
  Users can choose the listings they want to trade rather than it being random.

### 3/22/2016
  Added Column to MySQL with new conversation type
  Add USPS Code update
  Can't reply to notification type in conversations
  Link to listings in trading UI
  Link to USPS Code in trading UI
  Change Testimonial link button
  Change inbox to Notification and display type
  Change inbox/message icon to notifications. Bell icon added.
  Remove Invitation from menu
  Change notification message to "I"
  Users can review only once per convo

### 3/19/2016
  Add check for prepaid/gift cards for subscription
  Non subscribed people cant get messages from likes
  Added Better checkbox for terms and conditions
  Added Cardholder Name to subscriptions
  Add Birthday and Gender
  Add Parental Consent for under 18
  Added terms for facebook login

### 3/18/2016
  Stripe will also be deleted when user deletes account
  Starred only appears when you are subscribed
  Filters scrolls back to user location
  Make function to get card from Person model
  Added Last 4 digits of card to account settings
  Fix starring for closed listings
  Change map preferences
  Change Listing Image Size to 990x660?

### 3/17/2016
  Changed the entire user trading interface.
  Added State to the address.
  Also added addresses needed to controller
  Added state and divider
  Added new thing for signup
  Added id for sign up button
  Change email placement for signup
  Added Cookie Values for sign up with email
  Changed expiration time for cookies to 15 min
  Move code to custom.js
  Add js cookie
  Only subscribed users can write comments
  Change the small text.
  Removed Map for user settings
  Remove irrelevant notifications EMAIL_NOTIFICATION_TYPES
  Added Trial and Discount checks
  Add Subscription Values
  Change Menu Links
  Stripe (So that previous people who cancel will have no free trial. This also makes it so that when ppl cancel during free trial, they wont have it.)
  Also changed so that card declined doesnt work


text:
package org.motechproject.eventlogging.converter;

import org.motechproject.event.MotechEvent;

/**
 * Interface to implement for custom converters. The converter should return an
 * appropriate return type that a logger can use to log the information.
 * @param <T> The return type that will be used to log.
 */
public interface EventToLogConverter<T> {

    /**
     * Converts an event to a generic type that should be used to log the event.
     * @param event The incoming motech event to be converted to a log.
     * @return An appropriate object type that can be used by a logger to log the event.
     */
    T convertToLog(MotechEvent event);
}


text:
enum
{
    _FNT_CHECK_KERNING_ = 0x40,
};

struct KerningStr
{
    short first;
    short second;
    char  add;
};

struct CharStr
{
    unsigned char flags;
    unsigned char w;

    char lead;
    char trail;
};

class C_Fontmgr
{
private:
    long ID_;

    char name_[32];
    long pitch_;
    short first_;
    short last_;

    long bytesperline_;

    long fNumChars_;
    CharStr *fontTable_;

    long dSize_;
    char *fontData_;

    long kNumKerns_;
    KerningStr *kernList_;

public:

    C_Fontmgr();
    ~C_Fontmgr();

    void Setup(long ID, char *fontfile);
    void Cleanup();

    short First()
    {
        return(first_);
    }
    short Last()
    {
        return(last_);
    }
    long ByteWidth()
    {
        return(bytesperline_);
    }
    char *GetName()
    {
        return(name_);
    }

    long Width(_TCHAR *str);
    long Width(_TCHAR *str, long length);
    long Height();
    CharStr *GetChar(short ID);
    char *GetData()
    {
        return(fontData_);
    }

    // no cliping version (except for screen)
    void Draw(_TCHAR *str, WORD color, long x, long y, long dwidth, WORD *dest);
    // clipping version (use cliprect)
    void Draw(_TCHAR *str, WORD color, long x, long y, RECT *cliprect, long dwidth, WORD *dest);
};

#endif


text:
module Fog
  module Rackspace
    class AutoScale

      class Real

        def get_group_config(group_id)
          request(
            :expects => [200],
            :method => 'GET',
            :path => "groups/#{group_id}/config"
          )
        end
      end

      class Mock
        def get_group_config(group_id)
          group = self.data[:autoscale_groups][group_id]

          if group.nil?
            raise Fog::Rackspace::AutoScale::NotFound
          end

          response(:body => {"groupConfiguration" => group['groupConfiguration']})
        end
      end

    end
  end
end


text:
package krasa.laboratory.javafx.connections.series;

import java.util.concurrent.ConcurrentLinkedQueue;
import javafx.scene.chart.AreaChart;

/**
 * @author Vojtech Krasa
 */
public class SeriesDataQueue {
	private ConcurrentLinkedQueue<Data> dataQueue = new ConcurrentLinkedQueue<Data>();

	public void addData(Data random) {
		dataQueue.add(random);
	}

	public Data remove() {
		return dataQueue.remove();
	}

	public boolean isEmpty() {
		return dataQueue.isEmpty();
	}

	public void addData(int index, double random) {
		dataQueue.add(new Data(index, random));
	}

	public class Data {
		private int index;
		double value;

		public Data(int index, double value) {
			this.setIndex(index);
			this.value = value;
		}

		public AreaChart.Data<Number, Number> toChartData() {
			return new AreaChart.Data<Number, Number>(getIndex(), value);
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

}


text:
<!doctype html>

    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="/css/style.css">

Новостная лента

Добавление новостей

Поиск новостей

Список пользователей

    <?php  foreach ($news as $item):?>
        <img src="/uploads/<?= $item['img'] ?>" class="news-img">

                April 17, 2016
                Steve Jobs
                Comments

                <form action="/news/update/<?=$item['id'] ?>" method="post">

                        <textarea name="title"><?=$item['title']; ?></textarea>

                        <textarea name="text"><?=$item['text']; ?></textarea>

                    <input type="file" name="img">
                    <input type="submit">
                </form>

                    <a href="/news/Del/<?=$item['id']; ?>">Удалить новость

                    Вернуться

    <?php endforeach; ?>


text:
package org.apache.commons.lang3;

/**
 * Thrown to indicate that a block of code has not been implemented.
 * This exception supplements {@link UnsupportedOperationException}
 * by providing a more semantically rich description of the problem.
 *
 *
{@link NotImplementedException} represents the case where the
 * author has yet to implement the logic at this point in the program.
 * This can act as an exception based TODO tag.

 *
 *

 * public void foo() {
 *   try {
 *     // do something that throws an Exception
 *   } catch (Exception ex) {
 *     // don't know what to do here yet
 *     throw new NotImplementedException("TODO", ex);
 *   }
 * }
 *

 *
 * This class was originally added in Lang 2.0, but removed in 3.0.
 *
 * @since 3.2
 */
public class NotImplementedException extends UnsupportedOperationException {

    private static final long serialVersionUID = 20131021L;

    /** A resource for more information regarding the lack of implementation. */
    private final String code;

    /**
     * Constructs a NotImplementedException.
     *
     * @since 3.10
     */
    public NotImplementedException() {
        this.code = null;
    }

    /**
     * Constructs a NotImplementedException.
     *
     * @param message description of the exception
     * @since 3.2
     */
    public NotImplementedException(final String message) {
        this(message, (String) null);
    }

    /**
     * Constructs a NotImplementedException.
     *
     * @param cause cause of the exception
     * @since 3.2
     */
    public NotImplementedException(final Throwable cause) {
        this(cause, null);
    }

    /**
     * Constructs a NotImplementedException.
     *
     * @param message description of the exception
     * @param cause cause of the exception
     * @since 3.2
     */
    public NotImplementedException(final String message, final Throwable cause) {
        this(message, cause, null);
    }

    /**
     * Constructs a NotImplementedException.
     *
     * @param message description of the exception
     * @param code code indicating a resource for more information regarding the lack of implementation
     * @since 3.2
     */
    public NotImplementedException(final String message, final String code) {
        super(message);
        this.code = code;
    }

    /**
     * Constructs a NotImplementedException.
     *
     * @param cause cause of the exception
     * @param code code indicating a resource for more information regarding the lack of implementation
     * @since 3.2
     */
    public NotImplementedException(final Throwable cause, final String code) {
        super(cause);
        this.code = code;
    }

    /**
     * Constructs a NotImplementedException.
     *
     * @param message description of the exception
     * @param cause cause of the exception
     * @param code code indicating a resource for more information regarding the lack of implementation
     * @since 3.2
     */
    public NotImplementedException(final String message, final Throwable cause, final String code) {
        super(message, cause);
        this.code = code;
    }

    /**
     * Obtain the not implemented code. This is an unformatted piece of text intended to point to
     * further information regarding the lack of implementation. It might, for example, be an issue
     * tracker ID or a URL.
     *
     * @return a code indicating a resource for more information regarding the lack of implementation
     */
    public String getCode() {
        return this.code;
    }
}


text:
var GPIO = require('../../../build/Release/gpio');

describe('GPIO', function() {

    require('./constants')(GPIO);

    require('./new')(GPIO);

    require('./value')(GPIO);

    require('./direction')(GPIO);

    require('./active_low')(GPIO);

    require('./inheritance')(GPIO);

});


text:
Doorkeeper::OAuth::PreAuthorization.class_eval do
  alias_method :old_validate_scopes, :validate_scopes

  def scope
    @scope.presence || build_scopes
  end

  def validate_scopes
    return true if scope.blank?

    old_validate_scopes
  end

  def validate_params
    response_type.blank? ? :response_type : true
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class jason.asSemantics.DefaultInternalAction (Jason - AgentSpeak Java Interpreter)</title>
<meta name="date" content="2013-12-12">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
jason.asSemantics.DefaultInternalAction

Packages that use DefaultInternalAction

Package
Description

jason

jason.stdlib

Provides all default internal actions of Jason.

Uses of DefaultInternalAction in jason

Methods in jason with parameters of type DefaultInternalAction

Modifier and Type
Method and Description

static JasonException
JasonException.createWrongArgumentNb(DefaultInternalAction ia)

Uses of DefaultInternalAction in jason.stdlib

Subclasses of DefaultInternalAction in jason.stdlib

Modifier and Type
Class and Description

class
abolish

Internal action: .abolish.

class
add_annot

Internal action: .add_annot.

class
add_nested_source

Internal action: .add_nested_source.

class
add_plan

Internal action: .add_plan.

class
all_names

Internal action: .all_names.

class
at

Internal action: .at.

class
atom

Internal action: .atom.

class
broadcast

Internal action: .broadcast.

class
clone

class
concat

Internal action: .concat.

class
copy_term

class
count

Internal action: .count.

class
create_agent

Internal action: .create_agent.

class
current_intention

Internal action: .current_intention.

class
date

Internal action: .date(YY,MM,DD).

class
delete

Internal action: .delete.

class
desire

Internal action: .desire(D).

class
difference

Internal action: .difference(S1,S2,S3).

class
drop_all_desires

Internal action: .drop_all_desires.

class
drop_all_events

Internal action: .drop_all_events.

class
drop_all_intentions

Internal action: .drop_all_intentions.

class
drop_desire

Internal action: .drop_desire(D).

class
drop_event

Internal action: .drop_event(D).

class
drop_intention

Internal action: .drop_intention(I).

class
empty

Internal action: .empty.

class
eval

Internal action: .eval(Var,Logical Expression).

class
fail

Internal action: .fail.

class
fail_goal

Internal action:
  .fail_goal(G).

class
findall

Internal action: .findall(Var,Literal,List).

class
foreach

Implementation of for.

class
ground

Internal action: .ground.

class
if_then_else

Implementation of if.

class
intend

Internal action: .intend(I).

class
intersection

Internal action: .intersection(S1,S2,S3).

class
kill_agent

Internal action: .kill_agent.

class
length

Internal action: .length.

class
list

Internal action: .list.

class
list_plans

Internal action: .list_plans.

class
literal

Internal action: .literal.

class
loop

Implementation of while.

class
max

Internal action: .max.

class
member

Internal action: .member(T,L).

class
min

Internal action: .min.

class
my_name

Internal action: .my_name.

class
nth

Internal action: .nth.

class
number

Internal action: .number.

class
perceive

Internal action: .perceive.

class
plan_label

Internal action: .plan_label(P,L).

class
prefix

Internal action: .prefix(P,L).

class
print

Internal action: .print.

class
println

Internal action: .println.

class
puts

 Internal action: .puts.

class
random

Internal action: .random(N).

class
range

Internal action: .range(Var,Start,End).

class
relevant_plans

Internal action: .relevant_plans.

class
remove_plan

Internal action: .remove_plan.

class
resume

Internal action:
  .resume(G).

class
reverse

Internal action: .reverse.

class
send

Internal action: .send.

class
setof

class
shuffle

Internal action: .shuffle(List,Result).

class
sort

Internal action: .sort.

class
stopMAS

Internal action: .stopMAS.

class
string

Internal action: .string.

class
structure

Internal action: .structure.

class
sublist

Internal action: .sublist(S,L).

class
substring

Internal action: .substring.

class
succeed_goal

Internal action:
  .succeed_goal(G).

class
suffix

Internal action: .suffix(S,L).

class
suspend

Internal action:
  .suspend(G).

class
suspended

Internal action: .suspended(G, R).

class
term2string

Internal action: .term2string(T,S).

class
time

Internal action: .time(HH,MM,SS).

class
union

Internal action: .union(S1,S2,S3).

class
wait

Internal action: .wait(E,T).

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
#pragma once
#include "ModelBase/BioSIMModelBase.h"

namespace WBSF
{

	enum TWDMonthlyStat{ O_TMIN, O_TMAX, O_RH15, O_TDEW15_FROM_RH15, O_DEW_PERIOD_FROM_RH15, NB_MONTHLY_STATS };
	typedef CModelStatVectorTemplate<NB_MONTHLY_STATS> CMonthlyStatVector;

	class CDewDuration;
	class CSWEB;

	class CDewPeriodModel : public CBioSIMModelBase
	{
	public:

		CDewPeriodModel();
		virtual ~CDewPeriodModel();

		//virtual ERMsg ProcessParameters(const CParameterVector& parameters);
		virtual ERMsg OnExecuteMonthly();
		static CBioSIMModelBase* CreateObject(){ return new CDewPeriodModel; }

	protected:

		static double GetHourlyNormal(size_t m, size_t h, size_t v, const CWeatherYears& hourlyData);
		static double GetTDew(double Tmax, double RH15);
		static double GetDewPeriod(double Tmin, double Tmax, double RH3);
	};

}


text:
package xmpp

import (
	"encoding/xml"
	"reflect"
	"testing"
)

// This is mostly just tests of the roster data structures.

func TestRosterIqMarshal(t *testing.T) {
	iq := &Iq{Header: Header{From: "from", Lang: "en",
		Nested: []interface{}{RosterQuery{}}}}
	exp := `<iq from="from" xml:lang="en"><query xmlns="` +
		NsRoster + `"></query></iq>`
	assertMarshal(t, exp, iq)
}

func TestRosterIqUnmarshal(t *testing.T) {
	str := `<iq from="from" xml:lang="en"><query xmlns="` +
		NsRoster + `"><item jid="a@b.c"/></query></iq>`
	iq := Iq{}
	xml.Unmarshal([]byte(str), &iq)
	m := make(map[xml.Name]reflect.Type)
	name := xml.Name{Space: NsRoster, Local: "query"}
	m[name] = reflect.TypeOf(RosterQuery{})
	err := parseExtended(&iq.Header, m)
	if err != nil {
		t.Fatalf("parseExtended: %v", err)
	}
	assertEquals(t, "iq", iq.XMLName.Local)
	assertEquals(t, "from", string(iq.From))
	assertEquals(t, "en", iq.Lang)
	nested := iq.Nested
	if nested == nil {
		t.Fatalf("nested nil")
	}
	if len(nested) != 1 {
		t.Fatalf("wrong size nested(%d): %v", len(nested),
			nested)
	}
	var rq *RosterQuery
	rq, ok := nested[0].(*RosterQuery)
	if !ok {
		t.Fatalf("nested not RosterQuery: %v",
			reflect.TypeOf(nested))
	}
	if len(rq.Item) != 1 {
		t.Fatalf("Wrong # items: %v", rq.Item)
	}
	item := rq.Item[0]
	assertEquals(t, "a@b.c", string(item.Jid))
}


text:
from __future__ import unicode_literals

from django.db import models, migrations
import django.contrib.gis.db.models.fields

class Migration(migrations.Migration):

    dependencies = [
        ('world', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='BufferedWorldBorder',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=50)),
                ('geom', django.contrib.gis.db.models.fields.GeometryField(srid=4326)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name='State',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('state_name', models.CharField(max_length=25)),
                ('state_fips', models.CharField(max_length=2)),
                ('sub_region', models.CharField(max_length=20)),
                ('state_abbr', models.CharField(max_length=2)),
                ('pop2010', models.IntegerField()),
                ('pop10_sqmi', models.FloatField()),
                ('pop2012', models.IntegerField()),
                ('pop12_sqmi', models.FloatField()),
                ('white', models.IntegerField()),
                ('black', models.IntegerField()),
                ('ameri_es', models.IntegerField()),
                ('asian', models.IntegerField()),
                ('hawn_pi', models.IntegerField()),
                ('hispanic', models.IntegerField()),
                ('other', models.IntegerField()),
                ('mult_race', models.IntegerField()),
                ('males', models.IntegerField()),
                ('females', models.IntegerField()),
                ('age_under5', models.IntegerField()),
                ('age_5_9', models.IntegerField()),
                ('age_10_14', models.IntegerField()),
                ('age_15_19', models.IntegerField()),
                ('age_20_24', models.IntegerField()),
                ('age_25_34', models.IntegerField()),
                ('age_35_44', models.IntegerField()),
                ('age_45_54', models.IntegerField()),
                ('age_55_64', models.IntegerField()),
                ('age_65_74', models.IntegerField()),
                ('age_75_84', models.IntegerField()),
                ('age_85_up', models.IntegerField()),
                ('med_age', models.FloatField()),
                ('med_age_m', models.FloatField()),
                ('med_age_f', models.FloatField()),
                ('households', models.IntegerField()),
                ('ave_hh_sz', models.FloatField()),
                ('hsehld_1_m', models.IntegerField()),
                ('hsehld_1_f', models.IntegerField()),
                ('marhh_chd', models.IntegerField()),
                ('marhh_no_c', models.IntegerField()),
                ('mhh_child', models.IntegerField()),
                ('fhh_child', models.IntegerField()),
                ('families', models.IntegerField()),
                ('ave_fam_sz', models.FloatField()),
                ('hse_units', models.IntegerField()),
                ('vacant', models.IntegerField()),
                ('owner_occ', models.IntegerField()),
                ('renter_occ', models.IntegerField()),
                ('no_farms07', models.FloatField()),
                ('avg_size07', models.FloatField()),
                ('crop_acr07', models.FloatField()),
                ('avg_sale07', models.FloatField()),
                ('sqmi', models.FloatField()),
                ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
            ],
            options={
            },
            bases=(models.Model,),
        ),
    ]


text:
//---------------------------------------------------------------------
// <copyright file="NoTimeHint.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Test.Taupo.Contracts.DataGeneration
{
    /// <summary>
    /// Represents a hint to not generate time part of a date.
    /// </summary>
    public sealed class NoTimeHint : SingletonDataGenerationHint
    {
        private static NoTimeHint instance = new NoTimeHint();

        /// <summary>
        /// Prevents a default instance of the NoTimeHint class from being created.
        /// </summary>
        private NoTimeHint()
        {
        }

        /// <summary>
        /// Gets the sole instance of the NoTimeHint.
        /// </summary>
        /// <value>The NoTimeHint.</value>
        internal static NoTimeHint Instance
        {
            get { return instance; }
        }
    }
}


text:
SDSCCLM ;ALB/JAM/RBS - ASCD Update Claims Tracking ; 3/12/07 4:58pm
 ;;5.3;Scheduling;**495**;Aug 13, 1993;Build 50
 ;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
 ;;known as Service Connected Automated Monitoring (SCAM).
 ;
 Q
CLM(SDENC) ;  Check Claims Tracking
 N SDOE0,SCSTAT,SCTIEN,SCVAL,SCTUPD,SDSC,SCERR
 ;
 ;  If this encounter is not yet completed, quit
 I $P(^SDSC(409.48,SDENC,0),"^",5)'="C" Q
 ;
 ;  Status of encounter must be 'checked out'
 S SDOE0=$$GETOE^SDOE(SDENC)
 S SCSTAT=$P(SDOE0,"^",12) I SCSTAT'=2 Q
 ;
 ; Call IB API to get the claims tracking number
 S SCTIEN=$$CT^IBRSUTL(SDENC)
 ;
 ;If there is no CT entry quit
 I SCTIEN="" Q
 S SDSC(409.48,SDENC_",",.1)=SCTIEN
 D FILE^DIE("I","SDSC","SCERR")
 ;
 ;If SC value hasn't changed quit, else update CT in IB
 S SCVAL=$$SCHNG^SDSCUTL(SDENC) I '+SCVAL Q
 S SCTUPD=$$RNBU^IBRSUTL(SDENC,$S($P(SCVAL,U,3):1,1:2))
 Q


text:
using System.Linq;

namespace Test.ModuleInject.Modules.TestModules
{
    public interface ISubComponent1 {
        ISubComponent2 SubComponent2 { get;set;}
    }

    public class SubComponent1 : ISubComponent1
    {
        public ISubComponent2 SubComponent2 { get; set; }
    }
}


text:
package com.ppm.integration.agilesdk.connector.agilecentral.model;

import net.sf.json.JSONObject;

public class Task extends Entity {

    public Task(JSONObject jsonObject) {
        super(jsonObject);
    }

    public String getIterationUUID() {
        JSONObject iteration = this.jsonObject.getJSONObject("Iteration");
        if (!iteration.isNullObject()) {
            return iteration.getString("_refObjectUUID");
        }
        return null;
    }

    public String getIterationName() {
        JSONObject iteration = this.jsonObject.getJSONObject("Iteration");
        if (!iteration.isNullObject()) {
            return iteration.getString("_refObjectName");
        }
        return null;
    }

    public String getReleaseUUID() {
        JSONObject iteration = this.jsonObject.getJSONObject("Release");
        if (!iteration.isNullObject()) {
            return iteration.getString("_refObjectUUID");
        }
        return null;
    }

    public String getReleaseName() {
        JSONObject iteration = this.jsonObject.getJSONObject("Release");
        if (!iteration.isNullObject()) {
            return iteration.getString("_refObjectName");
        }
        return null;
    }

    public String getWorkProductUUID() {
        JSONObject iteration = this.jsonObject.getJSONObject("WorkProduct");
        if (!iteration.isNullObject()) {
            return iteration.getString("_refObjectUUID");
        }
        return null;
    }

    public String getWorkProductType() {
        JSONObject iteration = this.jsonObject.getJSONObject("WorkProduct");
        if (!iteration.isNullObject()) {
            return iteration.getString("_type");
        }
        return null;
    }

    public String getProjectUUID() {
        JSONObject iteration = this.jsonObject.getJSONObject("Project");
        if (!iteration.isNullObject()) {
            return iteration.getString("_refObjectUUID");
        }
        return null;
    }

    public String getProjectId() {
        JSONObject iteration = this.jsonObject.getJSONObject("Project");
        if (!iteration.isNullObject()) {
            return iteration.getString("_ref").split("/")[iteration.getString("_ref").split("/").length - 1];
        }
        return null;
    }
}


text:
% ******************************************************************************
% ****************************** Custom Margin *********************************
% Add `custommargin' in the document class options to use this section
% Set {innerside margin / outerside margin / topmargin / bottom margin}  and
% other page dimensions
\ifsetCustomMargin
%  \RequirePackage[left=30mm,right=20mm,top=30mm,bottom=20mm]{geometry} %This is what the binders recommend, I think it's not great
  \RequirePackage[left=35mm,right=25mm,top=35mm,bottom=20mm]{geometry}
  \setFancyHdr % To apply fancy header after geometry package is loaded
\fi

% Add spaces between paragraphs
%\setlength{\parskip}{0.5em}
% Ragged bottom avoids extra whitespaces between paragraphs
\raggedbottom
% To remove the excess top spacing for enumeration, list and description
%\usepackage{enumitem}
%\setlist[enumerate,itemize,description]{topsep=0em}

% *****************************************************************************
% ******************* Fonts (like different typewriter fonts etc.)*************

% Add `customfont' in the document class option to use this section

\ifsetCustomFont
  % Set your custom font here and use `customfont' in options. Leave empty to
  % load computer modern font (default LaTeX font).
  %\RequirePackage{helvet}

  % For use with XeLaTeX
  %  \setmainfont[
  %    Path              = ./libertine/opentype/,
  %    Extension         = .otf,
  %    UprightFont = LinLibertine_R,
  %    BoldFont = LinLibertine_RZ, % Linux Libertine O Regular Semibold
  %    ItalicFont = LinLibertine_RI,
  %    BoldItalicFont = LinLibertine_RZI, % Linux Libertine O Regular Semibold Italic
  %  ]
  %  {libertine}
  %  % load font from system font
  %  \newfontfamily\libertinesystemfont{Linux Libertine O}
\fi

% *****************************************************************************
% **************************** Custom Packages ********************************

% ************************* Algorithms and Pseudocode **************************

%\usepackage{algpseudocode}

% ********************Captions and Hyperreferencing / URL **********************
%my edit
\usepackage{hyperref}
\hypersetup{urlcolor=black, colorlinks=true}  % Colours hyperlinks in blue, but this can be distracting if there are many links.

% Captions: This makes captions of figures use a boldfaced small font.
\RequirePackage[small,bf]{caption}

\RequirePackage[labelsep=space,tableposition=top]{caption}
\renewcommand{\figurename}{Fig.} %to support older versions of captions.sty

% *************************** Graphics and figures *****************************

\usepackage{rotating}
\usepackage{wrapfig}

% Uncomment the following two lines to force Latex to place the figure.
% Use [H] when including graphics. Note 'H' instead of 'h'
%\usepackage{float}
%\restylefloat{figure}

% Subcaption package is also available in the sty folder you can use that by
% uncommenting the following line
% This is for people stuck with older versions of texlive
%\usepackage{sty/caption/subcaption}
\usepackage{subcaption}

% ********************************** Tables ************************************
\usepackage{booktabs} % For professional looking tables
\usepackage{multirow}
\renewcommand{\arraystretch}{1.2}
%\usepackage{multicol}
%\usepackage{longtable}
%\usepackage{tabularx}

% *********************************** SI Units *********************************
\usepackage{siunitx} % use this package module for SI units

% ******************************* Line Spacing *********************************

% Choose linespacing as appropriate. Default is one-half line spacing as per the
% University guidelines

% \doublespacing
% \onehalfspacing
% \singlespacing

% ************************ Formatting / Footnote *******************************

% Don't break enumeration (etc.) across pages in an ugly manner (default 10000)
%\clubpenalty=500
%\widowpenalty=500

%\usepackage[perpage]{footmisc} %Range of footnote options

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make some personal commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xspace}

%Decays
\newcommand{\bsmumu}{$B_{s}^{0} \to \mu^{+} \mu^{-}$\xspace}
\newcommand{\bdmumu}{$B^{0} \to \mu^{+} \mu^{-}$\xspace}
\newcommand{\bmumu}{$B^{0}_{(s)} \to \mu^{+} \mu^{-}$\xspace}
\newcommand{\bhh}{$B \to h^{+} h^{'-}$\xspace}
\newcommand{\bdkpi}{$B^{0} \to K^{+} \pi^{-}$\xspace}
\newcommand{\bskk}{$B^{0}_{s} \to K^{+} K^{-}$\xspace}
\newcommand{\bskpi}{$B^{0}_{s} \to K^{+} \pi^{-}$\xspace}
\newcommand{\bdpipi}{$B^{0} \to \pi^{+} \pi^{-}$\xspace}
\newcommand{\bsjpsiphi}{$B^{0}_{s} \to J/\psi \phi$\xspace}
\newcommand{\bujpsik}{$B^{+} \to J/\psi K^{+}$\xspace}

\newcommand{\lambdab}{$\Lambda^{0}_{b}\to p \mu^{-} \nu_{\mu}$\xspace}
\newcommand{\bdpimunu}{$B^{0} \to \pi^{-} \mu^{+} \nu_{\mu}$\xspace}
\newcommand{\bsKmunu}{$B^{0}_{s} \to K^{-} \mu^{+} \nu_{\mu}$\xspace}
\newcommand{\bdpimumu}{$B^{0} \to \pi^{0} \mu^{+} \mu^{-}$\xspace}
\newcommand{\bupimumu}{$B^{+} \to \pi^{+} \mu^{+} \mu^{-}$\xspace}
\newcommand{\bpimumu}{$B^{0(+)} \to \pi^{0(+)} \mu^{+} \mu^{-}$\xspace}
\newcommand{\bcjpsimunu}{$B^{+}_{c} \to J/\psi \mu^{+} \nu_{\mu}$\xspace}
\newcommand{\jpsimumu}{$J/\psi \to \mu^{+} \mu^{-}$\xspace}
\newcommand{\bbbarmumux}{$b\bar{b} \to \mu^{+} \mu^{-} X$\xspace}
\newcommand{\bbbar}{$b\bar{b}$\xspace}
\newcommand{\bsd}{$B_{(s)}^{0}$\xspace}
\newcommand{\bs}{$B_{s}^{0}$\xspace}
\newcommand{\bd}{$B^{0}$\xspace}
\newcommand{\pdfs}{PDFs\xspace}
\newcommand{\pdf}{PDF\xspace}
\newcommand{\barbsd}{$\overline{B}_{(s)}^{0}$\xspace}
\newcommand{\barbs}{$\overline{B}_{s}^{0}$\xspace}
\newcommand{\barbd}{$\overline{B}^{0}$\xspace}

\newcommand{\elm}{effective lifetime measurement\xspace}
\newcommand{\el}{effective lifetime\xspace}
\newcommand{\BF}{branching fraction\xspace}
\newcommand{\BFm}{branching fraction measurements\xspace}

\newcommand{\jpsi}{$J/\psi$\xspace}
\newcommand{\chisqd}{$\chi^{2}$\xspace}
%Lifetime terms
\newcommand{\ADG}{$A_{\Delta \Gamma}$\xspace}
\newcommand{\tmumu}{$\tau_{\mu \mu}$\xspace}
\newcommand{\BFs}{branching fractions\xspace}
\newcommand{\invtmumu}{$\tau^{-1}_{\mu \mu}$\xspace}
\newcommand{\lt}{$\tau$\xspace}
\newcommand{\invlt}{$\tau^{-1}$\xspace}
\newcommand{\tH}{$\tau_{H}$\xspace}
\newcommand{\tL}{$\tau_{L}$\xspace}
\newcommand{\Gmumu}{$\Gamma_{\mu \mu}$\xspace}

\newcommand{\ml}{maximum likelihood\xspace}

%Units
\newcommand{\tev}{TeV\xspace}
\newcommand{\gev}{GeV\xspace}
\newcommand{\mev}{MeV\xspace}
\newcommand{\tevcc}{TeV/$c^{2}$\xspace}
\newcommand{\gevcc}{GeV/$c^{2}$\xspace}
\newcommand{\mevcc}{MeV/$c^{2}$\xspace}
\newcommand{\tevc}{TeV/$c$\xspace}
\newcommand{\gevc}{GeV/$c$\xspace}
\newcommand{\mevc}{MeV/$c$\xspace}
\newcommand{\fb}{fb$^{-1}$\xspace}
\newcommand{\pb}{pb$^{-1}$\xspace}
\newcommand{\invps}{ps$^{-1}$\xspace}
\newcommand{\bhadron}{$b$-hadron\xspace}
\newcommand{\ps}{ps\xspace}
\newcommand{\bhadrons}{$b$-hadrons\xspace}

%Kinimatic stuff
\newcommand{\p}{$p$\xspace}
\newcommand{\pt}{$p_{T}$\xspace}

\newcommand{\chiFD}{$\chi^{2}_{\mathrm{FD}}$\xspace}
\newcommand{\chiIP}{$\chi^{2}_{\mathrm{IP}}$\xspace}
\newcommand{\chivtx}{$\chi^{2}_{\mathrm{VTX}}$\xspace}
\newcommand{\chitrk}{$\chi^{2}_{\mathrm{trk}}$\xspace}

% *****************************************************************************
% *************************** Bibliography  and References ********************

%\usepackage{cleveref} %Referencing without need to explicitly state fig /table

% Add `custombib' in the document class option to use this section
%\ifuseCustomBib
%   \RequirePackage[square, sort, numbers, authoryear]{natbib} % CustomBib

% If you would like to use biblatex for your reference management, as opposed to the default `natbibpackage` pass the option `custombib` in the document class. Comment out the previous line to make sure you don't load the natbib package. Uncomment the following lines and specify the location of references.bib file

%\RequirePackage[backend=biber, style=numeric-comp, citestyle=numeric, sorting=nty, natbib=true]{biblatex}
%\bibliography{References/references} %Location of references.bib only for biblatex

%\fi

% changes the default name `Bibliography` -> `References'
\renewcommand{\bibname}{Bibliography}

% ******************************** Roman Pages *********************************
% The romanpages environment set the page numbering to lowercase roman one
% for the contents and figures lists. It also resets
% page-numbering for the remainder of the dissertation (arabic, starting at 1).

\newenvironment{romanpages}{
  \setcounter{page}{1}
  \renewcommand{\thepage}{\roman{page}}}
{\newpage\renewcommand{\thepage}{\arabic{page}}}

% ******************************************************************************
% ************************* User Defined Commands ******************************
% ******************************************************************************

% *********** To change the name of Table of Contents / LOF and LOT ************

%\renewcommand{\contentsname}{My Table of Contents}
%\renewcommand{\listfigurename}{My List of Figures}
%\renewcommand{\listtablename}{My List of Tables}

% ********************** TOC depth and numbering depth *************************
% I think this changes the titles
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{2}
%\subsection*{Introduction} %This gives an example of how to get an un-numbered heading that does not go into the table of contents

% ******************************* Nomenclature *********************************

% To change the name of the Nomenclature section, uncomment the following line

%\renewcommand{\nomname}{Symbols}

% ********************************* Appendix ***********************************

% The default value of both \appendixtocname and \appendixpagename is `Appendices'. These names can all be changed via:

%\renewcommand{\appendixtocname}{List of appendices}
%\renewcommand{\appendixname}{Appndx}

% *********************** Configure Draft Mode **********************************

% Uncomment to disable figures in `draftmode'
%\setkeys{Gin}{draft=true}  % set draft to false to enable figures in `draft'

% These options are active only during the draft mode
% Default text is ``Draft''
%\SetDraftText{DRAFT}

% Default Watermark location is top. Location (top/bottom)
%\SetDraftWMPosition{bottom}

% Draft Version - default is v1.0
%\SetDraftVersion{v1.1}

% Draft Text grayscale value (should be between 0-black and 1-white)
% Default value is 0.75
%\SetDraftGrayScale{0.8}

% ******************************** Todo Notes **********************************
%% Uncomment the following lines to have todonotes.

%\ifsetDraft
%\usepackage[colorinlistoftodos]{todonotes}
%\newcommand{\mynote}[1]{\todo[author=kks32,size=\small,inline,color=green!40]{#1}}
%\else
%\newcommand{\mynote}[1]{}
%\newcommand{\listoftodos}{}
%\fi

% Example todo: \mynote{Hey! I have a note}

%An attempt to change the titles
%  \RequirePackage{titlesec}
%        \newcommand{\PreContentTitleFormat}{\titleformat{\chapter}[display]{\scshape\Large}
%        {\Large\filleft{\chaptertitlename} \Huge\thechapter}
%        {1ex}{}
%        [\vspace{1ex}\titlerule]}
%        \newcommand{\ContentTitleFormat}{\titleformat{\chapter}[display]{\scshape\huge}
%        {\Large\filleft{\chaptertitlename} \Huge\thechapter}{1ex}
%        {\titlerule\vspace{1ex}\filright}
%        [\vspace{1ex}\titlerule]}
%        \newcommand{\PostContentTitleFormat}{\PreContentTitleFormat}
%        \PreContentTitleFormat

%Things that I have added to try and get things to work.

\usepackage{afterpage}
%\usepackage{cite}
\usepackage{mciteplus}
\usepackage{multirow}
\usepackage{wasysym}