text:
<?php

return [
    // Components
    'components' => [
        'status' => [
            1 => 'Działa',
            2 => 'Problemy wydajnościowe',
            3 => 'Częściowa niedostępność',
            4 => 'Poważna awaria',
        ],
    ],

    // Incidents
    'incidents' => [
        'none'          => 'Brak incydentów.',
        'past'          => 'Poprzednie incydenty',
        'previous_week' => 'Poprzedni tydzień',
        'next_week'     => 'Następny tydzień',
        'none'          => 'Brak incydentów',
        'scheduled'     => 'Zapowiedziane prace',
        'scheduled_at'  => ', scheduled :timestamp',
        'status'        => [
            0 => 'Planowy', // TODO: Hopefully remove this.
            1 => 'Szukanie',
            2 => 'Zidentyfikowany',
            3 => 'Obserwacja',
            4 => 'Naprawiony',
        ],
    ],

    // Service Status
    'service' => [
        'good' => 'Wszystkie systemy sprawne.',
        'bad'  => 'Część systemów ma problemy.',
    ],

    'api' => [
        'regenerate' => 'Przegeneruj klucz API',
        'revoke'     => 'Odwołaj klucz API',
    ],

    // Metrics
    'metrics' => [
        'filter' => [
            'hourly'  => 'Last 12 Hours',
            'weekly'  => 'Week',
            'monthly' => 'Month',
        ],
    ],

    // Subscriber
    'subscriber' => [
        'subscribe' => 'Subscribe to get the most recent updates.',
        'button'    => 'Subscribe',
        'email'     => [
            'subscribe'    => 'Subscribe to email updates.',
            'subscribed'   => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
            'verified'     => 'Your email subscription has been confirmed. Thank you!',
            'unsubscribe'  => 'Unsuscribe from email updates.',
            'unsubscribed' => 'Your email subscription has been cancelled.',
            'failure'      => 'Something went wrong with the subscription.',
            'verify'       => [
                'text'           => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
                'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
                'html'           => '
Please confirm your email subscription to :app_name status updates.

:link

Thank you, :app_name
',
            ],
            'maintenance' => [
                'text'           => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
                'html-preheader' => 'New maintenance has been scheduled on :app_name.',
                'html'           => '
New maintenance has been scheduled on :app_name.

Thank you, :app_name
',
            ],
            'incident' => [
                'text'           => "New incident has been reported on :app_name.\nThank you, :app_name",
                'html-preheader' => 'New incident has been reported on :app_name.',
                'html'           => '
New incident has been reported on :app_name.

Thank you, :app_name
',
            ],
        ],
    ],

    // Other
    'powered_by'      => ':app Status Page is powered by Cachet.',
    'about_this_site' => 'O tej stronie',
    'rss-feed'        => 'RSS Feed',
    'atom-feed'       => 'Atom Feed',
    'feed'            => 'Status Feed',

];


text:
package org.hibernate.test.criteria;
import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.TeradataDialect;
import org.hibernate.test.hql.StateProvince;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;

/**
 * HHH-2166 Long "in" lists in queries results in a Java stack overflow
 * exception. to reproduce this issue, you should add
 * "<argLine>-Xss128k</argLine>" to the surefire plugin (test on Fedora 12)
 *
 * @author Strong Liu
 */
public class LongInElementsTest extends BaseCoreFunctionalTestCase {
	private static final int ELEMENTS_SIZE = 4000;

	@Override
	public String[] getMappings() {
		return new String[] { "criteria/Animal.hbm.xml" };
	}

	@Test
	@TestForIssue( jiraKey = "HHH-2166" )
	@SkipForDialect(
			value = { SQLServerDialect.class, Oracle8iDialect.class, TeradataDialect.class, SybaseDialect.class },
			comment = "this test fails on oracle and ms sql server, for more info, see HHH-1123"
	)
	public void testLongInElementsByHQL() {
		Session session = openSession();
		Transaction t = session.beginTransaction();

		StateProvince beijing = new StateProvince();
		beijing.setIsoCode( "100089" );
		beijing.setName( "beijing" );
		session.persist( beijing );
		session.flush();
		session.clear();

		Query query = session
				.createQuery( "from org.hibernate.test.hql.StateProvince sp where sp.id in ( :idList )" );
		query.setParameterList( "idList" , createLotsOfElements() );
		List list = query.list();
		session.flush();
		session.clear();
		assertEquals( 1 , list.size() );
		session.delete( beijing );
		t.commit();
		session.close();

	}

	@Test
	@TestForIssue( jiraKey = "HHH-2166" )
	@SkipForDialect(
			value = { SQLServerDialect.class, Oracle8iDialect.class, TeradataDialect.class, SybaseDialect.class },
			comment = "this test fails on oracle and ms sql server, for more info, see HHH-1123"
	)
	public void testLongInElementsByCriteria() {
		Session session = openSession();
		Transaction t = session.beginTransaction();

		StateProvince beijing = new StateProvince();
		beijing.setIsoCode( "100089" );
		beijing.setName( "beijing" );
		session.persist( beijing );
		session.flush();
		session.clear();

		Criteria criteria = session.createCriteria( StateProvince.class );
		criteria.add( Restrictions.in( "id" , createLotsOfElements() ) );
		List list = criteria.list();
		session.flush();
		session.clear();
		assertEquals( 1 , list.size() );
		session.delete( beijing );
		t.commit();
		session.close();

	}

	private List createLotsOfElements() {
		List list = new ArrayList();
		for ( int i = 0; i < ELEMENTS_SIZE; i++ ) {
			list.add( Long.valueOf( i ) );
		}
		return list;
	}
}

redpajama_set_name: RedPajamaGithub


text:
//
//  NSFileProviderExtension.h
//
//  Copyright (c) 2014-2017 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <FileProvider/NSFileProviderDefines.h>
#import <FileProvider/NSFileProviderItem.h>

NS_ASSUME_NONNULL_BEGIN

@class NSFileProviderDomain;

API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos, watchos, tvos)
@interface NSFileProviderExtension : NSObject

/**
 Should return the URL corresponding to a specific identifier. Fail if it's not a subpath of documentStorageURL.

 This is a static mapping; each identifier must always return a path corresponding to the same file. By default, this returns the path relative to the path returned by documentStorageURL.
 */
- (nullable NSURL *)URLForItemWithPersistentIdentifier:(NSFileProviderItemIdentifier)identifier;
- (nullable NSFileProviderItemIdentifier)persistentIdentifierForItemAtURL:(NSURL *)url;

- (nullable NSFileProviderItem)itemForIdentifier:(NSFileProviderItemIdentifier)identifier error:(NSError * _Nullable *)error NS_SWIFT_NAME(item(for:)) API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, watchos, tvos);

/**
 This method is called when a placeholder URL should be provided for the item at the given URL.

 The implementation of this method should call +[NSFileProviderManager writePlaceholderAtURL:withMetadata:error:] with the URL returned by +[NSFileProviderManager placeholderURLForURL:], then call the completion handler.
 */
- (void)providePlaceholderAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable error))completionHandler;

/** Should ensure that the actual file is in the position returned by URLForItemWithPersistentIdentifier:, then call the completion handler */
- (void)startProvidingItemAtURL:(NSURL *)url completionHandler:(void (^)(NSError * _Nullable error))completionHandler NS_SWIFT_NAME(startProvidingItem(at:completionHandler:));

/**
 Called after the last claim to the file has been released. At this point, it is safe for the file provider to remove the content file.

 Care should be taken that the corresponding placeholder file stays behind after the content file has been deleted.
 */
- (void)stopProvidingItemAtURL:(NSURL *)url NS_SWIFT_NAME(stopProvidingItem(at:));

/** Called at some point after the file has changed; the provider may then trigger an upload */
- (void)itemChangedAtURL:(NSURL *)url;

@end

@interface NSFileProviderExtension (Deprecated)

// Writes out a placeholder at the specified URL. The URL should be one returned by placeholderURLForURL:; if URL resource values are
// requested, the system will consult the placeholder before consulting your app extension.
// Metadata contains NSURLNameKey, NSURLFileSizeKey, NSURLIsPackageKey
+ (BOOL)writePlaceholderAtURL:(NSURL *)placeholderURL withMetadata:(NSDictionary <NSURLResourceKey, id> *)metadata error:(NSError **)error API_DEPRECATED("Use the corresponding method on NSFileProviderManager instead", ios(8.0, 11.0)) API_UNAVAILABLE(macos, tvos, watchos);

// Returns the designated placeholder URL for a given URL. This placeholder will be consulted before falling back to your app extension to
// enhance performance. To write out a placeholder, use the writePlaceHolderAtURL: method above.
+ (NSURL *)placeholderURLForURL:(NSURL *)url API_DEPRECATED_WITH_REPLACEMENT("NSFileProviderManager +placeholderURLForURL:", ios(8.0, 11.0)) API_UNAVAILABLE(macos, tvos, watchos);

// An identifier unique to this provider.
// When modifying the files stored in the directory returned by documentStorageURL, you should pass this identifier
// to your file coordinator's setPurposeIdentifier: method.
@property(nonatomic, readonly) NSString *providerIdentifier API_DEPRECATED_WITH_REPLACEMENT("NSFileProviderManager -providerIdentifier", ios(8.0, 11.0)) API_UNAVAILABLE(macos, tvos, watchos);

// The root URL for provided documents. This URL is derived by consulting the NSExtensionFileProviderDocumentGroup property on your extension. The document
// storage URL is the folder "File Provider Storage" in the corresponding container.
@property(nonatomic, readonly) NSURL *documentStorageURL API_DEPRECATED_WITH_REPLACEMENT("NSFileProviderManager -documentStorageURL", ios(8.0, 11.0)) API_UNAVAILABLE(macos, tvos, watchos);

@end

NS_ASSUME_NONNULL_END


text:
/**
 * Classes related to sending notifications out of Metacat via implementations of the service interface.
 *
 * @author tgianos
 * @since 0.1.46
 */
@ParametersAreNonnullByDefault
package com.netflix.metacat.main.services.notifications;
import javax.annotation.ParametersAreNonnullByDefault;


text:
require('@jymfony/autoloader');

const Debug = Jymfony.Component.Debug.Debug;
const Runner = Jymfony.Component.Testing.Framework.Runner;
Debug.enable();

const [ , , ...argv ] = [ ...process.argv ];
if (0 === argv.length) {
    argv.push('test/**/*.js');
}

process.argv = argv;
new Runner().run();


text:
package com.grndctl.exceptions;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 *
 */
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Resource Not Found")
public class ResourceNotFoundException extends Exception {

    public ResourceNotFoundException(String message, Throwable cause) {
        super(message, cause);
    }

    public ResourceNotFoundException(Throwable cause) {
        super(cause);
    }

    public ResourceNotFoundException(String message) {
        super(message);
    }

}


text:
/*
 * $Log: PrefaceImpl.java,v $
 * Revision 1.7  2011/10/07 19:42:21  vizigoth
 * Stop cloning strong references and getProperties method in applicatio object.
 *
 * Revision 1.6  2011/10/05 17:14:28  vizigoth
 * Added support for application metadata plugins, package markers and dynamic metadictionary extraction from AAF files.
 *
 * Revision 1.5  2011/07/27 17:33:00  vizigoth
 * Changed primary package handling to better match the 377-1 specification that declares the primary package as a weak reference 16 byte number.
 *
 * Revision 1.4  2011/02/14 22:32:49  vizigoth
 * First commit after major sourceforge outage.
 *
 * Revision 1.3  2011/01/26 11:41:35  vizigoth
 * Pushed management of file last modified value to the application.
 *
 * Revision 1.2  2011/01/19 21:55:59  vizigoth
 * Added property initialization code.
 *
 * Revision 1.1  2011/01/04 10:39:03  vizigoth
 * Refactor all package names to simpler forms more consistent with typical Java usage.
 *
 * Revision 1.4  2010/12/15 19:07:51  vizigoth
 * Added MXF primary package property.
 *
 * Revision 1.3  2010/11/08 15:46:05  vizigoth
 * Changes source package essence descriptor property to more correct essence description property.
 *
 * Revision 1.2  2009/12/18 17:55:57  vizigoth
 * Interim check in to help with some training activities. Early support for reading Preface objects from MXF files.
 *
 * Revision 1.1  2009/05/14 16:15:13  vizigoth
 * Major refactor to remove dependency on JPA and introduce better interface and implementation separation. Removed all setPropertiesFromInterface and castFromInterface methods.
 *
 * Revision 1.1  2009/03/30 09:04:51  vizigoth
 * Refactor to use SMPTE harmonized names and add early KLV file support.
 *
 * Revision 1.6  2008/10/16 01:14:25  vizigoth
 * Documentation improved to an early release level. Still with Javadoc warnings.
 *
 * Revision 1.5  2008/01/27 11:14:40  vizigoth
 * Fixed to match interface improvements.
 *
 * Revision 1.4  2007/12/17 17:14:15  vizigoth
 * Removed FileFormat enumeration as it is never used.
 *
 * Revision 1.3  2007/12/13 11:31:51  vizigoth
 * Removed MediaCriteria interface and replaced with CriteriaType enumeration.
 *
 * Revision 1.2  2007/12/04 13:04:47  vizigoth
 * Removed safe collections and proxy handling. The first is not required due to ? extends in interface definitions and the second is not a solution to the shared resources problem.
 *
 * Revision 1.1  2007/11/13 22:09:42  vizigoth
 * Public release of MAJ API.
 *
 */

package tv.amwa.maj.model.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;

import tv.amwa.maj.enumeration.ByteOrder;
import tv.amwa.maj.enumeration.CriteriaType;
import tv.amwa.maj.enumeration.PackageKind;
import tv.amwa.maj.exception.DuplicatePackageIDException;
import tv.amwa.maj.exception.EssenceNotFoundException;
import tv.amwa.maj.exception.InvalidParameterException;
import tv.amwa.maj.exception.ObjectNotAttachedException;
import tv.amwa.maj.exception.ObjectNotFoundException;
import tv.amwa.maj.exception.PackageNotFoundException;
import tv.amwa.maj.exception.PropertyNotPresentException;
import tv.amwa.maj.extensions.quantel.QConstants;
import tv.amwa.maj.industry.MediaClass;
import tv.amwa.maj.industry.MediaListAppend;
import tv.amwa.maj.industry.MediaListGetAt;
import tv.amwa.maj.industry.MediaListPrepend;
import tv.amwa.maj.industry.MediaProperty;
import tv.amwa.maj.industry.MediaPropertyClear;
import tv.amwa.maj.industry.MediaPropertyContains;
import tv.amwa.maj.industry.MediaPropertyCount;
import tv.amwa.maj.industry.MediaPropertyRemove;
import tv.amwa.maj.industry.MediaPropertySetter;
import tv.amwa.maj.industry.MediaSetAdd;
import tv.amwa.maj.industry.StrongReferenceVector;
import tv.amwa.maj.industry.WeakReference;
import tv.amwa.maj.integer.Int32;
import tv.amwa.maj.model.AAFFileDescriptor;
import tv.amwa.maj.model.ContentStorage;
import tv.amwa.maj.model.Dictionary;
import tv.amwa.maj.model.EssenceData;
import tv.amwa.maj.model.EssenceDescriptor;
import tv.amwa.maj.model.Identification;
import tv.amwa.maj.model.MultipleDescriptor;
import tv.amwa.maj.model.Package;
import tv.amwa.maj.model.Preface;
import tv.amwa.maj.record.AUID;
import tv.amwa.maj.record.PackageID;
import tv.amwa.maj.record.ProductVersion;
import tv.amwa.maj.record.TimeStamp;
import tv.amwa.maj.record.VersionType;
import tv.amwa.maj.record.impl.AUIDImpl;
import tv.amwa.maj.record.impl.TimeStampImpl;
import tv.amwa.maj.record.impl.VersionTypeImpl;

/**
 *
Implements file-wide information and indexes. An {@linkplain tv.amwa.maj.model.AAFFile AAF file} shall
 * have exactly one header object.

 *
 *
 *
 */

@MediaClass(uuid1 = 0x0d010101, uuid2 = 0x0101, uuid3 = 0x2f00,
		  uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x02, 0x06, 0x01, 0x01},
		  definedName = "Preface",
		  aliases = { "Header" },
		  description = "The Preface class provides file-wide information and indexes.",
		  symbol = "Preface")
public class PrefaceImpl
	extends
		InterchangeObjectImpl
	implements
		Preface,
		tv.amwa.maj.extensions.quantel.QPreface,
		Serializable,
		Cloneable {

	/**

 */
	private static final long serialVersionUID = 3343754479545511683L;

	private ByteOrder byteOrder;
	private TimeStamp fileLastModified;
	private VersionType formatVersion;
	private Integer objectModelVersion = null; // TODO not sure what this is, but is now persistent
	private AUID operationalPattern = null;
	private Set<AUID> essenceContainers =
		Collections.synchronizedSet(new HashSet<AUID>());
	private Set<AUID> descriptiveSchemes =
		Collections.synchronizedSet(new HashSet<AUID>());
	private Set<AUID> applicationSchemes =
		Collections.synchronizedSet(new HashSet<AUID>());
	private ContentStorage contentStorageObject;
	private List<Identification> identificationList =
		Collections.synchronizedList(new Vector<Identification>());
	private Dictionary dictionaries;
	private WeakReference<Package> primaryPackage;

	/**
	 *
Creates and initializes a header object, the root object of any AAF persistent unit such
	 * as a file or database representation.

	 */
	public PrefaceImpl() {

		// Java uses big endian by default
		this.byteOrder = ByteOrder.Big; // TODO make sure a little endian file sets this

		this.fileLastModified = new TimeStampImpl();
		this.dictionaries = new DictionaryImpl();

		this.formatVersion = new VersionTypeImpl((byte) 1, (byte) 0);

		IdentificationImpl madeInP4MsAPI = new IdentificationImpl(
				IdentificationImpl.APICompanyName,
				IdentificationImpl.APIProductName,
				IdentificationImpl.APIProductVersionString,
				IdentificationImpl.APIProductID);
		StrongReferenceVector.append(identificationList, madeInP4MsAPI);

		this.contentStorageObject = new ContentStorageImpl();
	}

	@MediaSetAdd("DescriptiveSchemes")
	public void addDescriptiveScheme(
			AUID descriptiveSchemeID)
		throws NullPointerException {

		if (descriptiveSchemeID == null)
			throw new NullPointerException("Cannot add a null value to the set of descriptive schemes.");

		descriptiveSchemes.add(descriptiveSchemeID.clone());
		// fileLastModified = new TimeStampImpl();
	}

	public void addEssenceData(
			EssenceData essenceData)
		throws DuplicatePackageIDException,
			NullPointerException {

		contentStorageObject.addEssenceDataObject(essenceData);
		// fileLastModified = new TimeStampImpl();
	}

	public void addPackage(
			Package packageToAdd)
		throws NullPointerException,
			DuplicatePackageIDException {

		contentStorageObject.addPackage(packageToAdd);

		// Consider refactoring this as duplicates code in ContentStorage.addEssenceContainers()
		if (packageToAdd instanceof SourcePackageImpl) {

			// try {
				EssenceDescriptor descriptor = ((SourcePackageImpl) packageToAdd).getEssenceDescription();
				if (descriptor instanceof AAFFileDescriptor) {

					addContainersForDescriptor((AAFFileDescriptor) descriptor);
				}
			//}
			// catch (NoEssenceDescriptorException nede) { /* Does not matter, so move on. */ }
		}
		// fileLastModified = new TimeStampImpl();
	}

	@MediaListAppend("IdentificationList")
	public void appendIdentification(
			tv.amwa.maj.model.Identification identification)
		throws NullPointerException {

		if (identification == null)
			throw new NullPointerException("Cannot append a null identification to this header.");

		removeInitialID();

		StrongReferenceVector.append(identificationList, identification);
		// fileLastModified = new TimeStampImpl(); // TODO is this what we want to do?
	}

	void removeInitialID() {

		if (identificationList.size() != 1) return;
		Identification isThisTheDefaultIdent = identificationList.get(0);
		if (!(isThisTheDefaultIdent.getApplicationName().equals("DefaultProductName"))) return;
		if (!(isThisTheDefaultIdent.getApplicationVersionString().equals("DefaultProductVersion"))) return;
		if (!(isThisTheDefaultIdent.getApplicationSupplierName().equals("DefaultCompanyName"))) return;
		clearIdentificationList();
	}

	@MediaListPrepend("IdentificationList")
	public void prependIdentification(
			Identification ident)
		throws NullPointerException {

		if (ident == null)
			throw new NullPointerException("Cannot prepend a null identification to this header.");

		StrongReferenceVector.prepend(identificationList, ident);
		// fileLastModified = new TimeStampImpl(); // TODO is this what we want to do?
	}

	@MediaPropertyCount("DescriptiveSchemes")
	public int countDescriptiveSchemes() {

		return descriptiveSchemes.size();
	}

	@MediaPropertyCount("EssenceContainers")
	public int countEssenceContainers()
			throws PropertyNotPresentException {

		return essenceContainers.size();
	}

	public int countEssenceData() {

		return contentStorageObject.countEssenceDataObjects();
	}

	@MediaPropertyCount("IdentificationList")
	public int countIdentifications() {

		return identificationList.size();
	}

	@MediaPropertyClear("IdentificationList")
	public void clearIdentificationList() {

		identificationList = Collections.synchronizedList(new Vector<Identification>());
	}

	public int countPackages(
			PackageKind packageKind)
		throws NullPointerException {

		return contentStorageObject.countPackages(packageKind);
	}

	public Set<? extends EssenceData> enumEssenceData() {

		return getEssenceData(CriteriaType.AnyRepresentation);
	}

	@MediaProperty(uuid1 = 0x06010104, uuid2 = (short) 0x0201, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02},
			definedName = "ContentStorageObject",
			aliases = { "Content" },
			typeName = "ContentStorageStrongReference",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B03,
			symbol = "ContentStorageObject")
	public ContentStorage getContentStorageObject() {

		return contentStorageObject;
	}

	@MediaPropertySetter("ContentStorageObject")
	public void setContentStorageObject(
			ContentStorage contentStorageObject)
		throws NullPointerException {

		if (contentStorageObject == null)
			throw new NullPointerException("Cannot set the content for this header to null.");

		this.contentStorageObject = contentStorageObject;
	}

	public final static ContentStorage initializeContentStorageObject() {

		return new ContentStorageImpl();
	}

	@MediaProperty(uuid1 = 0x01020210, uuid2 = (short) 0x0202, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05},
			definedName = "DescriptiveSchemes",
			aliases = { "DMSchemes" },
			typeName = "AUIDSet",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B0B,
			symbol = "DescriptiveSchemes")
	public Set<AUID> getDescriptiveSchemes()
			throws PropertyNotPresentException {
		/*
		if (descriptiveSchemes.size() == 0)
			throw new PropertyNotPresentException("Descriptive schemes not present in this header.");*/

		return new HashSet<tv.amwa.maj.record.AUID>(descriptiveSchemes);
	}

	@MediaPropertyClear("DescriptiveSchemes")
	public void clearDescriptiveSchemes() {

		descriptiveSchemes = Collections.synchronizedSet(new HashSet<AUID>());
	}

	/**
	 *
Returns the set of {@linkplain tv.amwa.maj.model.ContainerDefinition essence containers} of this header,
	 * which identify the internal essence containers used in the file. This is an
	 * optional property that is automatically maintained.

	 *
	 * @return Copy of the identifiers for the internal essence containers of this header.
	 * The identifiers are cloned.
	 */
	@MediaProperty(uuid1 = 0x01020210, uuid2 = (short) 0x0201, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05},
			definedName = "EssenceContainers",
			typeName = "AUIDSet",
			optional = true,
			uniqueIdentifier = false,
			pid = 0x3B0A,
			symbol = "EssenceContainers")
	public Set<AUID> getEssenceContainers()
			throws PropertyNotPresentException {

		if (essenceContainers.size() == 0)
			throw new PropertyNotPresentException("The optional essence containers property is not present in this header.");

		return new HashSet<AUID>(essenceContainers);
	}

	@MediaSetAdd("EssenceContainers")
	public void addEssenceContainer(
			AUID containerID)
		throws NullPointerException {

		if (containerID == null)
			throw new NullPointerException("Cannot add a null essence container to this header.");

		essenceContainers.add(containerID.clone());
	}

	@MediaPropertyRemove("EssenceContainers")
	public void removeEssenceContainer(
			AUID essenceContainerID)
		throws NullPointerException,
			InvalidParameterException,
			PropertyNotPresentException {

		if (essenceContainerID == null)
			throw new NullPointerException("Cannot remove a essence container with a null id from this header.");
		if (essenceContainers.size() == 0)
			throw new PropertyNotPresentException("The optional essence containers property is not present in this header.");

		if (!(essenceContainers.contains(essenceContainerID)))
			throw new InvalidParameterException("The given essence container is not present in this header.");

		essenceContainers.remove(essenceContainerID);

		// fileLastModified = new TimeStampImpl();
	}

	@MediaPropertyClear("EssenceContainers")
	public void clearEssenceContainers() {

		essenceContainers = Collections.synchronizedSet(new HashSet<AUID>());
	}

	public Set<? extends EssenceData> getEssenceData(
			CriteriaType mediaCriteria)
		throws NullPointerException {

		if (mediaCriteria == null)
			throw new NullPointerException("The given media criteria for filtering essence data to retrieve from this preface is null.");

		return contentStorageObject.getEssenceDataObjects(mediaCriteria);
	}

	public Set<? extends EssenceData> getEssenceData() {

		try {
			return contentStorageObject.getEssenceDataObjects();
		}
		catch (PropertyNotPresentException pnpe) {
			return new HashSet<EssenceData>();
		}
	}

	@MediaProperty(uuid1 = 0x03010201, uuid2 = (short) 0x0500, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02},
			definedName = "FormatVersion",
			aliases = { "Version" },
			typeName = "VersionType",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B05,
			symbol = "FormatVersion")
	public VersionType getFormatVersion() {

		return formatVersion.clone();
	}

	@MediaPropertySetter("FormatVersion")
	public void setFormatVersion(
			tv.amwa.maj.record.VersionType formatVersion)
		throws NullPointerException {

		if (formatVersion == null)
			throw new NullPointerException("Cannot set the version to a null value.");

		this.formatVersion = formatVersion.clone();
	}

	public final static VersionType initializeFormatVersion() {

		return new VersionTypeImpl((byte) 1, (byte) 1);
	}

	@MediaListGetAt("IdentificationList")
	public Identification getIdentificationAt(
			int index)
		throws IndexOutOfBoundsException {

		return StrongReferenceVector.getAt(identificationList, index);
	}

	@MediaProperty(uuid1 = 0x06010104, uuid2 = (short) 0x0604, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02},
			definedName = "IdentificationList",
			typeName = "IdentificationStrongReferenceVector",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B06,
			symbol = "IdentificationList")
	public List<Identification> getIdentifications() {

		return StrongReferenceVector.getRequiredList(identificationList);
	}

	public final static List<Identification> initializeIdentificationList() {

		List<Identification> initialIDs = new ArrayList<Identification>(1);
		initialIDs.add(new IdentificationImpl("DefaultCompanyName", "DefaultProductName", "DefaultProductVersion",
				AUIDImpl.randomAUID()));
		return initialIDs;
	}

	void setIdentificationListValue(List<Identification> identificaitonList) {

		this.identificationList = Collections.synchronizedList(identificaitonList);
	}

	void blankIdentificationsList() {

		this.identificationList = Collections.synchronizedList(new Vector<Identification>());
	}

	public Identification getLastIdentification() {

		return identificationList.get(identificationList.size() - 1);
	}

	// Last modified values to be handled automatically.
	@MediaProperty(uuid1 = 0x07020110, uuid2 = (short) 0x0204, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02},
			definedName = "FileLastModified",
			aliases = { "LastModified" },
			typeName = "TimeStamp",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B02,
			symbol = "FileLastModified")
	public TimeStamp getFileLastModified() {

		return fileLastModified.clone();
	}

	@MediaPropertySetter("FileLastModified")
	public void setFileLastModified(
			tv.amwa.maj.record.TimeStamp fileLastModified)
		throws NullPointerException {

		if (fileLastModified == null)
			throw new NullPointerException("Cannot set the file last modified time of this header to a null value.");

		this.fileLastModified = fileLastModified.clone();
	}

	public final static TimeStamp initializeFileLastModified() {

		return new TimeStampImpl();
	}

	public Set<? extends Package> getPackages(
			tv.amwa.maj.union.SearchCriteria searchCriteria) {

		return contentStorageObject.getPackages(searchCriteria);
	}

	public Set<? extends Package> getPackages() {

		return contentStorageObject.getPackages();
	}

	@MediaProperty(uuid1 = 0x01020203, uuid2 = (short) 0x0000, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x05},
			definedName = "OperationalPattern",
			typeName = "AUID",
			optional = true,
			uniqueIdentifier = false,
			pid = 0x3B09,
			symbol = "OperationalPattern")
	public AUID getOperationalPattern()
			throws PropertyNotPresentException {

		if (operationalPattern == null)
			throw new PropertyNotPresentException("The operational pattern property is not present in this header.");

		return operationalPattern.clone();
	}

	@MediaPropertySetter("OperationalPattern")
	public void setOperationalPattern(
			AUID operationalPatternID) {

		if (operationalPatternID == null) {
			this.operationalPattern = null;
			// fileLastModified = new TimeStampImpl(); // TODO do we really want to do this here
			return;
		}

		this.operationalPattern = operationalPatternID.clone();
		// fileLastModified = new TimeStampImpl(); // TODO do we really want to do this here
	}

//	public Package getPrimaryPackage()
//			throws PropertyNotPresentException {
//
//		if (primaryPackage == null)
//			throw new PropertyNotPresentException("Primary package property is not present.");
//
//		try {
//			return contentStorageObject.lookupPackage(primaryPackage);
//		}
//		catch (PackageNotFoundException mnfe) {
//			throw new PropertyNotPresentException("Unexpected mismatch between content storage and primary package definition.");
//		}
//	}
//
//	public void setPrimaryPackage(
//			Package primaryPackage) {
//
//		try {
//			addPackage(primaryPackage);
//			// fileLastModified = new TimeStampImpl();
//		}
//		catch (DuplicatePackageIDException dmie) { /* That's OK here. */ }
//		catch (NullPointerException npe) { /* That's OK here as well. It resets. */ }
//
//		this.primaryPackage = primaryPackage.getPackageID().clone();
//	}

	@MediaProperty(uuid1 = 0x06010104, uuid2 = (short) 0x0108, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x04},
			definedName = "PrimaryPackage",
			typeName = "PackageWeakReference",
			optional = true,
			uniqueIdentifier = false,
			pid = 0x3B08,
			symbol = "PrimaryPackage")
	public Package getPrimaryPackage()
		throws PropertyNotPresentException {

		if (this.primaryPackage == null)
			throw new PropertyNotPresentException("The optional primary package property is not present for this preface.");

		return this.primaryPackage.getTarget();
	}

	@MediaPropertySetter("PrimaryPackage")
	public void setPrimaryPackage(
			Package primaryPackage) {

		if (primaryPackage == null) {
			this.primaryPackage = null;
			return;
		}
		this.primaryPackage = new WeakReference<Package>(primaryPackage);
	}

	public ProductVersion getMajApiVersion() {

		return getLastIdentification().getRefImplVersion();
	}

	@MediaPropertyContains("DescriptiveSchemes")
	public boolean isDescriptiveSchemePresent(
			AUID descriptiveSchemeID)
		throws NullPointerException {

		if (descriptiveSchemeID == null)
			throw new NullPointerException("Cannot check for a descriptive scheme with a null id.");

		return descriptiveSchemes.contains(descriptiveSchemeID);
	}

	@MediaPropertyContains("EssenceContainers")
	public boolean isEssenceContainerPresent(
			AUID essenceContainerID)
		throws NullPointerException {

		if (essenceContainerID == null)
			throw new NullPointerException("Cannot check for the presence of an essence container using a null identifier.");

		return essenceContainers.contains(essenceContainerID);
	}

	public boolean isEssenceDataPresent(
			tv.amwa.maj.record.PackageID filPackageID)
			throws NullPointerException,
				InvalidParameterException {

		try {
			Package filePackage = contentStorageObject.lookupPackage(filPackageID);
			if (!(filePackage instanceof SourcePackageImpl))
				throw new InvalidParameterException("The given package id does not correspond to a source package.");
			EssenceDescriptor descriptor = ((SourcePackageImpl) filePackage).getEssenceDescription();
			if (!(descriptor instanceof AAFFileDescriptor))
				throw new InvalidParameterException("The given package id does not correspond to a file source package.");
		}
		catch (PackageNotFoundException mnfe) { return false; }
		/* catch (NoEssenceDescriptorException nede) {
			throw new InvalidParameterException("The given package id has no corresponding essence descriptor.");
		} */

		return true;
	}

	public EssenceData lookupEssenceData(
			PackageID packageID)
		throws NullPointerException,
			PackageNotFoundException {

		return contentStorageObject.lookupEssenceDataObject(packageID);
	}

	public Identification lookupIdentification(
			AUID generation)
		throws NullPointerException,
			ObjectNotFoundException {

		if (generation == null)
			throw new NullPointerException("Cannot look up an identification using a null AUID.");

		for ( Identification identificationItem : identificationList )
			if (identificationItem.getLinkedGenerationID().equals(generation))
				return identificationItem;

		throw new ObjectNotFoundException("An identification matching the given id could not be found.");
	}

	public Package lookupPackage(
			tv.amwa.maj.record.PackageID packageID)
		throws NullPointerException,
			PackageNotFoundException {

		return contentStorageObject.lookupPackage(packageID);
	}

	@MediaPropertyRemove("DescriptiveSchemes")
	public void removeDescriptiveScheme(
			AUID descriptiveSchemeID)
		throws NullPointerException,
			InvalidParameterException,
			PropertyNotPresentException {

		if (descriptiveSchemeID == null)
			throw new NullPointerException("Cannot remove a descriptive scheme with a null value.");
		if (descriptiveSchemes.size() == 0)
			throw new PropertyNotPresentException("The optional descriptive schemes property is not present in this header.");

		if (!(descriptiveSchemes.contains(descriptiveSchemeID)))
			throw new InvalidParameterException("The given descriptive scheme is not present in this header.");

		descriptiveSchemes.remove(descriptiveSchemeID);

		// fileLastModified = new TimeStampImpl();
	}

	public void removeEssenceData(
			EssenceData essenceData)
		throws NullPointerException,
			EssenceNotFoundException {

		contentStorageObject.removeEssenceDataObject(essenceData);
		// fileLastModified = new TimeStampImpl();
	}

	public void removePackage(
			tv.amwa.maj.model.Package packageToRemove)
			throws NullPointerException,
				PackageNotFoundException {

		if (packageToRemove == null)
			throw new NullPointerException("Cannot remove a null package value.");

		contentStorageObject.removePackage(packageToRemove);
		updateEssenceContainers();

		if (packageToRemove.getPackageID().equals(primaryPackage.getTarget().getPackageID()))
			primaryPackage = null;

		// fileLastModified = new TimeStampImpl();
	}

	public void updateEssenceContainers() {

		this.essenceContainers = Collections.synchronizedSet(new HashSet<AUID>());

		Set<? extends tv.amwa.maj.model.Package> packages = getPackages(null);

		for ( tv.amwa.maj.model.Package packageItem : packages ) {
			if (packageItem instanceof tv.amwa.maj.model.SourcePackage) {
				tv.amwa.maj.model.EssenceDescriptor packageDescriptor =
					((tv.amwa.maj.model.SourcePackage) packageItem).getEssenceDescription();
				if (packageDescriptor instanceof AAFFileDescriptor)
					addContainersForDescriptor((AAFFileDescriptor) packageDescriptor);
			}
		}
	}

	private void addContainersForDescriptor(
			AAFFileDescriptor descriptor) {

		if (descriptor instanceof MultipleDescriptor) {
			for ( AAFFileDescriptor nestedDescriptor : ((MultipleDescriptor) descriptor).getFileDescriptors() ) {
				addContainersForDescriptor(nestedDescriptor);
			}
		}
		else
			essenceContainers.add(descriptor.getContainerFormat().getAUID());
	}

	public Identification getGeneration()
			throws InvalidParameterException,
				ObjectNotAttachedException {

		return getLastIdentification();
	}

	public AUID getLinkedGenerationID() {

		return getLastIdentification().getLinkedGenerationID();
	}

	@MediaProperty(uuid1 = 0x03010201, uuid2 = (short) 0x0200, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x01},
			definedName = "ByteOrder",
			typeName = "Int16",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B01,
			symbol = "ByteOrder")
	public ByteOrder getByteOrder() {

		return byteOrder;
	}

	@MediaPropertySetter("ByteOrder")
	public void setByteOrder(
			Object byteOrder)
		throws NullPointerException {

		if (byteOrder == null)
			throw new NullPointerException("Cannot set the byte order of a header using a null value.");

		if (byteOrder instanceof ByteOrder)
			this.byteOrder = (ByteOrder) byteOrder;

		if (byteOrder instanceof Short)
			this.byteOrder = ByteOrder.getByteOrderFromAAFCode((Short) byteOrder);
	}

	public final static ByteOrder initializeByteOrder() {

		return ByteOrder.Big;
	}

	@MediaProperty(uuid1 = 0x06010104, uuid2 = (short) 0x0202, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02},
			definedName = "Dictionaries",
			aliases = { "Dictionary", "HeaderDictionary" },
			typeName = "DictionaryStrongReference",
			optional = false,
			uniqueIdentifier = false,
			pid = 0x3B04,
			symbol = "Dictionaries")
	public Dictionary getDictionaries() {

		return dictionaries;
	}

	@MediaPropertySetter("Dictionaries")
	public void setDictionaries(
			tv.amwa.maj.model.Dictionary dictionaries)
		throws NullPointerException {

		if (dictionaries == null)
			throw new NullPointerException("Cannot set the dictionaries for this header to a null value.");

		this.dictionaries = dictionaries;
	}

	public final static Dictionary initializeDictionaries() {

		return new DictionaryImpl();
	}

	@MediaProperty(uuid1 = 0x03010201, uuid2 = (short) 0x0400, uuid3 = (short) 0x0000,
			uuid4 = {0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x02},
			definedName = "ObjectModelVersion",
			typeName = "UInt32",
			optional = true,
			uniqueIdentifier = false,
			pid = 0x3B07,
			symbol = "ObjectModelVersion")
	public int getObjectModelVersion() {

		if (objectModelVersion == null)
			return OBJECTMODELVERSION_DEFAULT;
		else
			return objectModelVersion;
	}

	@MediaPropertySetter("ObjectModelVersion")
	public void setObjectModelVersion(
			Integer objectModelVersion)
		throws IllegalArgumentException {

		if (objectModelVersion == null) {
			this.objectModelVersion = null;
			return;
		}

		if (objectModelVersion < 0)
			throw new IllegalArgumentException("Cannot set the object model version of this header to a negative value.");

		this.objectModelVersion = objectModelVersion;
	}

	@MediaProperty(uuid1 = 0x01020210, uuid2 = (short) 0x0203, uuid3 = (short) 0x0000,
			uuid4 = { 0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x0C },
			definedName = "ApplicationSchemes",
			aliases = { "ApplicationMetadataSchemes" , "ApplicationSchemesBatch" },
			typeName = "AUIDSet",
			optional = true,
			uniqueIdentifier = false,
			pid = 0x0000,
			symbol = "ApplicationSchemes")
	public Set<AUID> getApplicationSchemes()
		throws PropertyNotPresentException {

		if (applicationSchemes.size() == 0)
			throw new PropertyNotPresentException("The optional application schemes property is not present for this preface.");

		return new HashSet<AUID>(applicationSchemes);
	}

	@MediaSetAdd("ApplicationSchemes")
	public void addApplicationScheme(
			AUID applicationSchemeID)
		throws NullPointerException {

		if (applicationSchemeID == null)
			throw new NullPointerException("Cannot add an application metadata scheme using a null identifier.");

		applicationSchemes.add(applicationSchemeID.clone());
	}

	@MediaPropertyClear("ApplicationSchemes")
	public void clearApplicationSchemes() {

		applicationSchemes.clear();
	}

	@MediaPropertyCount("ApplicationScehemes")
	public int countApplicationSchemes() {

		return applicationSchemes.size();
	}

	@MediaPropertyContains("ApplicationSchemes")
	public boolean isApplicationSchemePresent(
			AUID applicationSchemeID)
		throws PropertyNotPresentException,
			NullPointerException {

		if (applicationSchemeID == null)
			throw new NullPointerException("Cannot check for an application scheme ID using a null value.");
		if (applicationSchemes.size() == 0)
			throw new PropertyNotPresentException("The optional application schemes property is not present for this preface.");

		return applicationSchemes.contains(applicationSchemeID);
	}

	@MediaPropertyRemove("ApplicationSchemes")
	public void removeApplicationScheme(
			AUID applicationSchemeID)
		throws NullPointerException,
			InvalidParameterException,
			PropertyNotPresentException {

		if (applicationSchemeID == null)
			throw new NullPointerException("Cannot remove an application metadata scheme using a null value.");
		if (applicationSchemes.size() == 0)
			throw new PropertyNotPresentException("The optional application schemes property is not present for this preface.");
		if (!applicationSchemes.contains(applicationSchemeID))
			throw new InvalidParameterException("The given application schemes identifier is not contained in the set of this preface.");

		applicationSchemes.remove(applicationSchemeID);
	}

	public boolean updateDictionaries() {

		boolean success = true;

		for ( Package checkPackage : getPackages() ) {

			success &= dictionaries.addDefinitions(checkPackage);
		}

		return success;
	}

	public Preface clone() {

		return (Preface) super.clone();
	}

//	private TimeStamp fileLastModified;

	public String getFileLastModifiedString() {

		return TimeStampImpl.toPersistentForm(fileLastModified);
	}

	public void setFileLastModifiedString(
			String fileLastModified) {

		this.fileLastModified = TimeStampImpl.fromPersistentForm(fileLastModified);
	}

//	private VersionType formatVersion;

	public String getFormatVersionString() {

		return VersionTypeImpl.toPersistentForm(formatVersion);
	}

	public void setFormatVersionString(
			String formatVersion) {

		this.formatVersion = VersionTypeImpl.fromPersistentForm(formatVersion);
	}

	//	private AUID operationalPattern = null;

	public String getOperationalPatternString() {

		return AUIDImpl.toPersistentForm(operationalPattern);
	}

	public void setOperationPatternString(
			String operationalPattern) {

		this.operationalPattern = AUIDImpl.fromPersistentForm(operationalPattern);
	}

//	private Set<AUID> essenceContainers =
//		Collections.synchronizedSet(new HashSet<AUID>());

	public Set<String> getEssenceContainersStringSet() {

		return auidSetToStringSet(essenceContainers);
	}

	public void setEssenceContainersStringSet(
			Set<String> essenceContainers) {

		this.essenceContainers = stringSetToAUIDSet(essenceContainers);
	}

//	private Set<AUID> descriptiveSchemes =
//		Collections.synchronizedSet(new HashSet<AUID>());

	public Set<String> getDescriptiveSchemesStringSet() {

		return auidSetToStringSet(descriptiveSchemes);
	}

	public void setDescriptiveSchemesStringSet(
			Set<String> descriptiveSchemes) {

		this.descriptiveSchemes = stringSetToAUIDSet(descriptiveSchemes);
	}

	private final static Set<String> auidSetToStringSet(
			Set<AUID> auidSet) {

		if (auidSet == null) return null;
		Set<String> stringSet = new HashSet<String>(auidSet.size());
		for ( AUID auid : auidSet )
			stringSet.add(AUIDImpl.toPersistentForm(auid));
		return stringSet;
	}

	private final static Set<AUID> stringSetToAUIDSet(
			Set<String> stringSet) {

		if (stringSet == null) return null;

		Set<AUID> auidSet = Collections.synchronizedSet(new HashSet<AUID>(stringSet.size()));
		for ( String auid : stringSet )
			auidSet.add(AUIDImpl.fromPersistentForm(auid));
		return auidSet;
	}

	// Begin - Quantel extensions

	private Integer archiveDatabaseType = null;

    @MediaProperty(uuid1 = 0xd52527ee, uuid2 = (short) 0xba9d, uuid3 = (short) 0x4d2b,
        uuid4 = { (byte) 0x92, (byte) 0xbe, (byte) 0xe9, (byte) 0x3a, (byte) 0x2a, (byte) 0x07, (byte) 0x3d, (byte) 0x66 },
        definedName = "Archive database type",
        symbol = "Archive_database_type",
        aliases = { "Archive_database_type" },
        typeName = "Int32",
        optional = true,
        uniqueIdentifier = false,
        pid = 0,
        prefix = QConstants.XML_PREFIX,
        namespace = QConstants.XML_NAMESPACE)

	public @Int32 int getArchiveDatabaseType()
		throws PropertyNotPresentException {

		if (archiveDatabaseType == null)
			throw new PropertyNotPresentException("The optional archive database type property is not present for this Quantel preface.");

		return archiveDatabaseType;
	}

	@MediaPropertySetter("Archive database type")
	public void setArchiveDatabaseType(
			@Int32 Integer archiveDatabaseType) {

		this.archiveDatabaseType = archiveDatabaseType;
	}

	// End = Quantel extensions

	//	private PackageID primaryPackageID = null;

//	public String getPrimaryPackageString() {
//
//		return PackageIDImpl.toPersistentForm(primaryPackage);
//	}
//
//	public void setPrimaryPackageString(
//			String primaryPackageID) {
//
//		this.primaryPackage = PackageIDImpl.fromPersistentForm(primaryPackageID);
//	}

}


text:
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.password_manager.settings;

import android.content.Context;

import androidx.annotation.VisibleForTesting;

import org.chromium.base.Callback;
import org.chromium.base.IntStringCallback;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.components.browser_ui.settings.SettingsLauncher;

/**
 * Production implementation of PasswordManagerHandler, making calls to native C++ code to retrieve
 * the data.
 */
public final class PasswordUIView implements PasswordManagerHandler {
    @CalledByNative
    private static SavedPasswordEntry createSavedPasswordEntry(
            String url, String name, String password) {
        return new SavedPasswordEntry(url, name, password);
    }

    // Pointer to native implementation, set to 0 in destroy().
    private long mNativePasswordUIViewAndroid;

    // This class has exactly one observer, set on construction and expected to last at least as
    // long as this object (a good candidate is the owner of this object).
    private final PasswordListObserver mObserver;

    /**
     * Constructor creates the native object as well. Callers should call destroy() after usage.
     *
     * @param PasswordListObserver The only observer.
     */
    public PasswordUIView(PasswordListObserver observer) {
        mNativePasswordUIViewAndroid = PasswordUIViewJni.get().init(PasswordUIView.this);
        mObserver = observer;
    }

    @CalledByNative
    private void passwordListAvailable(int count) {
        mObserver.passwordListAvailable(count);
    }

    @CalledByNative
    private void passwordExceptionListAvailable(int count) {
        mObserver.passwordExceptionListAvailable(count);
    }

    @Override
    @VisibleForTesting
    public void insertPasswordEntryForTesting(String origin, String username, String password) {
        PasswordUIViewJni.get().insertPasswordEntryForTesting(
                mNativePasswordUIViewAndroid, origin, username, password);
    }

    // Calls native to refresh password and exception lists. The native code calls back into
    // passwordListAvailable and passwordExceptionListAvailable.
    @Override
    public void updatePasswordLists() {
        PasswordUIViewJni.get().updatePasswordLists(
                mNativePasswordUIViewAndroid, PasswordUIView.this);
    }

    @Override
    public SavedPasswordEntry getSavedPasswordEntry(int index) {
        return PasswordUIViewJni.get().getSavedPasswordEntry(
                mNativePasswordUIViewAndroid, PasswordUIView.this, index);
    }

    @Override
    public String getSavedPasswordException(int index) {
        return PasswordUIViewJni.get().getSavedPasswordException(
                mNativePasswordUIViewAndroid, PasswordUIView.this, index);
    }

    @Override
    public void removeSavedPasswordEntry(int index) {
        PasswordUIViewJni.get().handleRemoveSavedPasswordEntry(
                mNativePasswordUIViewAndroid, PasswordUIView.this, index);
    }

    @Override
    public void removeSavedPasswordException(int index) {
        PasswordUIViewJni.get().handleRemoveSavedPasswordException(
                mNativePasswordUIViewAndroid, PasswordUIView.this, index);
    }

    @Override
    public void serializePasswords(
            String targetPath, IntStringCallback successCallback, Callback<String> errorCallback) {
        PasswordUIViewJni.get().handleSerializePasswords(mNativePasswordUIViewAndroid,
                PasswordUIView.this, targetPath, successCallback, errorCallback);
    }

    @Override
    public void showPasswordEntryEditingView(Context context, SettingsLauncher settingsLauncher,
            int index, boolean isBlockedCredential) {
        if (isBlockedCredential) {
            PasswordUIViewJni.get().handleShowBlockedCredentialView(mNativePasswordUIViewAndroid,
                    context, settingsLauncher, index, PasswordUIView.this);
            return;
        }
        PasswordUIViewJni.get().handleShowPasswordEntryEditingView(mNativePasswordUIViewAndroid,
                context, settingsLauncher, index, PasswordUIView.this);
    }

    /**
     * Returns the URL for the website for managing one's passwords without the need to use Chrome
     * with the user's profile signed in.
     *
     * @return The string with the URL.
     */
    public static String getAccountDashboardURL() {
        return PasswordUIViewJni.get().getAccountDashboardURL();
    }

    public static boolean hasAccountForLeakCheckRequest() {
        return PasswordUIViewJni.get().hasAccountForLeakCheckRequest();
    }

    /**
     * Destroy the native object.
     */
    public void destroy() {
        if (mNativePasswordUIViewAndroid != 0) {
            PasswordUIViewJni.get().destroy(mNativePasswordUIViewAndroid, PasswordUIView.this);
            mNativePasswordUIViewAndroid = 0;
        }
    }

    @NativeMethods
    interface Natives {
        long init(PasswordUIView caller);
        void insertPasswordEntryForTesting(
                long nativePasswordUIViewAndroid, String origin, String username, String password);
        void updatePasswordLists(long nativePasswordUIViewAndroid, PasswordUIView caller);
        SavedPasswordEntry getSavedPasswordEntry(
                long nativePasswordUIViewAndroid, PasswordUIView caller, int index);
        String getSavedPasswordException(
                long nativePasswordUIViewAndroid, PasswordUIView caller, int index);
        void handleRemoveSavedPasswordEntry(
                long nativePasswordUIViewAndroid, PasswordUIView caller, int index);
        void handleRemoveSavedPasswordException(
                long nativePasswordUIViewAndroid, PasswordUIView caller, int index);
        String getAccountDashboardURL();
        boolean hasAccountForLeakCheckRequest();
        void destroy(long nativePasswordUIViewAndroid, PasswordUIView caller);
        void handleSerializePasswords(long nativePasswordUIViewAndroid, PasswordUIView caller,
                String targetPath, IntStringCallback successCallback,
                Callback<String> errorCallback);
        void handleShowPasswordEntryEditingView(long nativePasswordUIViewAndroid, Context context,
                SettingsLauncher launcher, int index, PasswordUIView caller);
        void handleShowBlockedCredentialView(long nativePasswordUIViewAndroid, Context context,
                SettingsLauncher launcher, int index, PasswordUIView caller);
    }
}


text:
package com.fitpay.android.utils;

import com.fitpay.android.BaseTestActions;
import com.fitpay.android.paymentdevice.callbacks.ConnectionListener;
import com.fitpay.android.paymentdevice.constants.States;
import com.fitpay.android.paymentdevice.enums.Connection;

import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.reactivestreams.Subscription;

import java.lang.reflect.Field;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import io.reactivex.Completable;
import io.reactivex.schedulers.Schedulers;

import static com.fitpay.android.api.enums.ResultCode.TIMEOUT;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class NotificationsTest extends BaseTestActions {

    private static Listener listener;
    private static NotificationManager manager;

    private static List<Listener> listeners;
    private static ConcurrentHashMap<Class, Subscription> subscriptions;
    private static ConcurrentHashMap<Class, List<Command>> commands;

    private static
    @Connection.State
    Integer testState;

    @BeforeClass
    @SuppressWarnings("unchecked")
    public static void init() {
        BaseTestActions.init();
        listener = new ConnectionListener() {
            @Override
            public void onDeviceStateChanged(@Connection.State int state) {
                log("checkNotification receive:" + state);
                testState = state;
            }
        };

        manager = NotificationManager.getInstance();

        listeners = (List<Listener>) getPrivateField(manager, "mListeners");
        subscriptions = (ConcurrentHashMap<Class, Subscription>) getPrivateField(manager, "mSubscriptions");
        commands = (ConcurrentHashMap<Class, List<Command>>) getPrivateField(manager, "mCommands");
    }

    @Test
    public void test01_checkManager() throws InterruptedException {
        Assert.assertNotNull(listeners);
        Assert.assertNotNull(subscriptions);
        Assert.assertNotNull(commands);
    }

    @Test
    public void test02_addListener() throws InterruptedException {
        manager.addListener(listener, Schedulers.trampoline());

        Assert.assertEquals(1, listeners.size());
        Assert.assertEquals(1, subscriptions.size());
        Assert.assertEquals(1, commands.size());
    }

    @Test
    public void test03_checkNotification() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        AtomicBoolean changed = new AtomicBoolean(false);
        log("checkNotification start");

        Completable.create(emitter -> {
            log("checkNotification send state");
            RxBus.getInstance().post(new Connection(States.CONNECTED));
            emitter.onComplete();
        }).observeOn(Schedulers.trampoline()).subscribeOn(Schedulers.trampoline())
                .subscribe(
                        () -> {
                            log("checkNotification complete");
                            changed.set(testState != null && testState == States.CONNECTED);
                            latch.countDown();
                        },
                        e -> {
                            log("checkNotification error:" + e.getMessage());
                            latch.countDown();
                        });

        latch.await(TIMEOUT, TimeUnit.SECONDS);
        log("checkNotification finish");
        Assert.assertTrue("state was not changed", changed.get());
    }

    @Test
    public void test04_removeListener() throws InterruptedException {
        manager.removeListener(listener);

        Assert.assertEquals(0, listeners.size());
        Assert.assertEquals(0, subscriptions.size());
        Assert.assertEquals(0, commands.size());
    }

    private static Object getPrivateField(Object from, String fieldName) {
        try {
            Field field = from.getClass().getDeclaredField(fieldName);
            if (field != null) {
                field.setAccessible(true);
                return field.get(from);
            }
        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }

        return null;
    }

    @AfterClass
    public static void tearDown() throws Exception {
        manager.removeListener(listener);

        listener = null;
        manager = null;
        listeners = null;
        subscriptions = null;
        commands = null;
    }

    private static void log(String str) {
        System.out.println(str + " " + Thread.currentThread());
    }
}


text:
"""
Created on Thu Jul 28 10:45:21 2016

@author: Maxime
"""

import numpy as np
import string
import sys
sys.path.append('C:\Codes\pyHegel')
import pyHegel.commands as ph
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from copy import deepcopy

class Nanofile:
    def __init__(self, filename, extension, mType = None, path=None):
        if path != None:
            ph.make_dir("%s"%path)
        self.filename = filename
        self.extension = extension
        f = open("%(fname)s.%(ext)s"%{"fname":filename, "ext":extension})
        if mType == None:
            try:
                for line in f:
                    if np.any("Sweep channel" in line):
                        mType = "1D sweep"
                    if np.any("Step channel 1" in line):
                        mType = "2D sweep"
                    if np.any("Step channel 2" in line):
                        mType = "3D sweep"
            finally:
                f.close()
        self.measType = mType
        if mType == "3D sweep":
            raise NotImplementedError
        if mType == "2D sweep":
            f = open("%(fname)s.%(ext)s"%{"fname":filename, "ext":extension})
            try:
                for line in f:
                    if np.any("[DATA]" in line):
                        break
                    elif np.any("Sweep channel: Name" in line):
                        xAxis = string.lstrip(line,"Sweep channel: Name\t")
                        xAxis = string.rstrip(xAxis,"\t\n")
                        xName, xUnit = string.split(xAxis, "(")
                        xName = string.rstrip(xName, " ")
                        xUnit = string.rstrip(xUnit, ")")
                        self.xName = xName
                        self.xUnit = xUnit
                    elif np.any("Sweep channel: Start" in line):
                        xStart = string.lstrip(line, "Sweep channel: Start\t")
                        xStart = string.rstrip(xStart,"\t\n")
                        xStart = float(xStart)
                        self.xStart = xStart
                    elif np.any("Sweep channel: Stop" in line):
                        xStop = string.lstrip(line, "Sweep channel: Stop\t")
                        xStop = string.rstrip(xStop,"\t\n")
                        xStop = float(xStop)
                        self.xStop = xStop
                    elif np.any("Sweep channel: Points" in line):
                        xNPoints = string.lstrip(line, "Sweep channel: Points\t")
                        xNPoints = string.rstrip(xNPoints,"\t\n")
                        xNPoints = int(float(xNPoints))
                        self.xNPoints = xNPoints
                        self.xData = np.linspace(xStart, xStop, xNPoints)
                    elif np.any("Acquire channels" in line):
                        Chans = string.lstrip(line,"Acquire channels\t")
                        Chans = string.rstrip(Chans,"\t\n")
                        name, unit = [], []
                        for u in string.split(Chans, ";"):
                            name.append(string.split(u, "(")[0])
                            unit.append(string.split(u, "(")[1])
                        for u, i in enumerate(name):
                            name[u] = string.rstrip(i, " ")
                        for u, i in enumerate(unit):
                            unit[u] = string.rstrip(i, ")")
                        nAcqChan = np.array(name).shape[0]
                        self.nAcqChan = nAcqChan
                        self.acqName = np.array(name)
                        self.acqUnit = np.array(unit)
                    if np.any("Step channel 1: Name" in line):
                        yAxis = string.lstrip(line,"Step channel 1: Name\t")
                        yAxis = string.rstrip(yAxis,"\t\n")
                        yName, yUnit = string.split(yAxis, "(")
                        yName = string.rstrip(yName, " ")
                        yUnit = string.rstrip(yUnit, ")")
                        self.yName = yName
                        self.yUnit = yUnit
                    elif np.any("Step channel 1: Start" in line):
                        yStart = string.lstrip(string.lstrip(string.lstrip(line, "Step channel "), "1"), ": Start\t")
                        yStart = string.rstrip(yStart,"\t\n")
                        yStart = float(yStart)
                        self.yStart = yStart
                    elif np.any("Step channel 1: Stop" in line):
                        yStop = string.lstrip(string.lstrip(string.lstrip(line, "Step channel "), "1"), ": Stop\t")
                        yStop = string.rstrip(yStop,"\t\n")
                        yStop = float(yStop)
                        self.yStop = yStop
                    elif np.any("Step channel 1: Points" in line):
                        yNPoints = string.lstrip(string.lstrip(string.lstrip(line, "Step channel "), "1"), ": Points\t")
                        yNPoints = string.rstrip(yNPoints,"\t\n")
                        yNPoints = int(float(yNPoints))
                        self.yNPoints = yNPoints
                        self.yData = np.linspace(yStart, yStop, yNPoints)
            finally:
                f.close()
                if nAcqChan == 1:
                    data = []
                    data.append(Lecture(filename, extension)[1:])
                elif nAcqChan > 1:
                    tempdata = Lecture(filename, extension)[1:]
                    data = np.zeros((nAcqChan, xNPoints, yNPoints))
                    for i in range(nAcqChan):
                        for u in range(xNPoints):
                           data[i,u] = tempdata[u*nAcqChan+i]
                data = np.array(data)
                if yStart < yStop:
                    data2 = np.zeros_like(data)
                    for u, i in enumerate(data):
                        for j, k in enumerate(i):
                            data2[u][-j-1] = data[u][j]
                    data = deepcopy(data2)
                    self._yFlip = True
                else:
                    self._yFlip = False
                self.data = data

        if mType == "1D sweep":
            data = Lecture(filename, extension)[1:]
            self.nAcqChan = data.shape[0]-1
            self.NPoints = data.shape[1]
            self.xData = data[0]
            self.xStart = self.xData[0]
            self.xStop = self.xData[-1]
            self.data = data[1:]
            self.acqInd = 0
            self.xName = ''
            self.xUnit = ''
            self.yName = ''
            self.yUnit = ''

    def plot(self, acqIndex=0,  color = cm.bone, colorbar = False, *args, **kwargs):
        if self.measType == "2D sweep":
            plt.clf()
            plt.imshow(self.data[acqIndex], aspect = 'auto', cmap = color, extent=(self.xData.min(), self.xData.max(), self.yData.min(), self.yData.max()))
            plt.ylabel("%(yname)s (%(yunit)s)" %{"yname":self.yName, "yunit":self.yUnit})
            plt.xlabel("%(xname)s (%(xunit)s)" %{"xname":self.xName, "xunit":self.xUnit})
            plt.title("%(filen)s -%(dset)s - %(zname)s (%(zunit)s)" %{"filen":self.filename, "dset":"original", "zname":self.acqName[0][acqIndex], "zunit":self.acqUnit[0][acqIndex]})
            if colorbar == True:
                plt.colorbar()
        elif self.measType == "1D sweep":
            plt.clf()
            plt.plot(self.xData, self.data[self.acqInd], *args, **kwargs)
            plt.ylabel("%(yname)s (%(yunit)s)" %{"yname":self.yName, "yunit":self.yUnit})
            plt.xlabel("%(xname)s (%(xunit)s)" %{"xname":self.xName, "xunit":self.xUnit})
            plt.title("%(filen)s -%(dset)s" %{"filen":self.filename, "dset":"original"})
        else:
            raise NotImplementedError

    def datacutter(self, plot=False, xstart=None, xstop=None, ystart=None, ystop=None):
        if self.measType == "2D sweep":
            cut = deepcopy(self)
            if self.xStart < self.xStop:
                xmax_ind = sum(1 for i in abs(cut.xData) if i > abs(xstop))
                xmin_ind = sum(1 for i in abs(cut.xData) if i < abs(xstart))
                cut.xData = cut.xData[xmin_ind:][:cut.xNPoints-xmin_ind-xmax_ind]
                cut.data = np.zeros((cut.nAcqChan, cut.yNPoints, cut.xNPoints-xmax_ind-xmin_ind))
                for u, i in enumerate(self.data):
                    cut.data[u] = i.T[xmin_ind:][:cut.xNPoints-xmin_ind-xmax_ind].T
            else:
                xmax_ind = sum(1 for i in abs(cut.xData) if i > abs(xstop))
                xmin_ind = sum(1 for i in abs(cut.xData) if i < abs(xstart))
                cut.xData = cut.xData[xmax_ind:][:cut.xNPoints-xmin_ind-xmax_ind]
                cut.data = np.zeros((cut.nAcqChan, cut.yNPoints, cut.xNPoints-xmax_ind-xmin_ind))
                for u, i in enumerate(self.data):
                    cut.data[u] = i.T[xmax_ind:][:cut.xNPoints-xmin_ind-xmax_ind].T
            cut.xNPoints, cut.xStart, cut.xStop = cut.xData.size, cut.xData[0], cut.xData[-1]
            if self.yStart < self.yStop:
                ymax_ind = sum(1 for i in abs(cut.yData) if i > abs(ystop))
                ymin_ind = sum(1 for i in abs(cut.yData) if i < abs(ystart))
                cut.yData = cut.yData[ymin_ind:][:cut.yNPoints-ymin_ind-ymax_ind]
                cut2 = deepcopy(cut)
                cut.data = np.zeros((cut2.nAcqChan, cut2.yNPoints-ymax_ind-ymin_ind, cut2.xNPoints))
                for u, i in enumerate(cut2.data):
                    cut.data[u] = i[ymin_ind:][:cut2.yNPoints-ymin_ind-ymax_ind]
            else:
                ymax_ind = sum(1 for i in abs(cut.yData) if i > abs(ystop))
                ymin_ind = sum(1 for i in abs(cut.yData) if i < abs(ystart))
                cut.yData = cut.yData[ymax_ind:][:cut.yNPoints-ymin_ind-ymax_ind]
                cut2 = deepcopy(cut)
                cut.data = np.zeros((cut2.nAcqChan, cut2.yNPoints-ymax_ind-ymin_ind, cut2.xNPoints))
                for u, i in enumerate(cut2.data):
                    cut.data[u] = i[ymax_ind:][:cut2.yNPoints-ymin_ind-ymax_ind]
            cut.yNPoints, cut.yStart, cut.yStop = cut.yData.size, cut.yData[0], cut.yData[-1]
            if plot == True:
                plt.figure()
                cut.plot()
            return cut
        else:
            raise NotImplementedError

    def copy(self):
        return deepcopy(self)

def Lecture(filename, extension):
    """
    Takes an output data file from the NanonisTramea and converts it to a txt file that can be read using the readfile function.
    """
    data=False
    aa=[]
    for line in file("%(fname)s.%(ext)s" %{"fname":filename, "ext":extension}):
        if data==True:
            aa.append(line)
        if np.any("[DATA]" in line):
            data=True
    Datatxt="%(name)s%(ext)s"%{"name":filename,"ext":".txt"}
    with open("%s" %Datatxt,'w') as f:
        f.write("#")
        for line in aa:
            f.write("%s" %line)
    a=ph.readfile("%s"%Datatxt)
    return a


text:
<?php
$this->breadcrumbs = [
    Yii::t('DeliveryModule.delivery', 'Delivery methods') => ['/delivery/deliveryBackend/index'],
    Yii::t('DeliveryModule.delivery', 'Manage'),
];

$this->pageTitle = Yii::t('DeliveryModule.delivery', 'Delivery methods - manage');

$this->menu = [
    ['icon' => 'fa fa-fw fa-list-alt', 'label' => Yii::t('DeliveryModule.delivery', 'Manage delivery methods'), 'url' => ['/delivery/deliveryBackend/index']],
    ['icon' => 'fa fa-fw fa-plus-square', 'label' => Yii::t('DeliveryModule.delivery', 'Create delivery'), 'url' => ['/delivery/deliveryBackend/create']],
];
?>

        <?= Yii::t('DeliveryModule.delivery', 'Delivery methods'); ?>
        <?= Yii::t('DeliveryModule.delivery', 'manage'); ?>

<?php
$this->widget(
    'yupe\widgets\CustomGridView',
    [
        'id' => 'delivery-grid',
        'type' => 'condensed',
        'dataProvider' => $model->search(),
        'filter' => $model,
        'sortableRows' => true,
        'sortableAjaxSave' => true,
        'sortableAttribute' => 'position',
        'sortableAction' => '/delivery/deliveryBackend/sortable',
        'columns' => [
            [
                'name' => 'name',
                'type' => 'raw',
                'value' => 'CHtml::link($data->name, array("/delivery/deliveryBackend/update", "id" => $data->id))',
            ],
            'price',
            'free_from',
            'available_from',
            [
                'class'   => 'yupe\widgets\EditableStatusColumn',
                'name'    => 'status',
                'url'     => $this->createUrl('/delivery/deliveryBackend/inline'),
                'source'  => $model->getStatusList(),
                'options' => [
                    Delivery::STATUS_ACTIVE => ['class' => 'label-success'],
                    Delivery::STATUS_NOT_ACTIVE => ['class' => 'label-default'],
                ],
            ],
            [
                'class' => 'yupe\widgets\CustomButtonColumn',
                'template' => '{update}{delete}'
            ],
        ],
    ]
); ?>


text:
/* ========================================================================
 * DOM-based Routing
 * Based on http://goo.gl/EUTi53 by Paul Irish
 *
 * Only fires on body classes that match. If a body class contains a dash,
 * replace the dash with an underscore when adding it to the object below.
 *
 * .noConflict()
 * The routing is enclosed within an anonymous function so that you can
 * always reference jQuery with $, even when in .noConflict() mode.
 * ======================================================================== */

(function($) {

  // Use this variable to set up the common and page specific functions. If you
  // rename this variable, you will also need to rename the namespace below.
  var Sage = {
    // All pages
    'common': {
      init: function() {
        // JavaScript to be fired on all pages
      },
      finalize: function() {
        // JavaScript to be fired on all pages, after page specific JS is fired
      }
    },
    // Home page
    'home': {
      init: function() {
        // JavaScript to be fired on the home page
      },
      finalize: function() {
        // JavaScript to be fired on the home page, after the init JS
      }
    },
    // About us page, note the change from about-us to about_us.
    'about_us': {
      init: function() {
        // JavaScript to be fired on the about us page
      }
    }
  };

  // The routing fires all common scripts, followed by the page specific scripts.
  // Add additional events for more control over timing e.g. a finalize event
  var UTIL = {
    fire: function(func, funcname, args) {
      var fire;
      var namespace = Sage;
      funcname = (funcname === undefined) ? 'init' : funcname;
      fire = func !== '';
      fire = fire && namespace[func];
      fire = fire && typeof namespace[func][funcname] === 'function';

      if (fire) {
        namespace[func][funcname](args);
      }
    },
    loadEvents: function() {
      // Fire common init JS
      UTIL.fire('common');

      // Fire page-specific init JS, and then finalize JS
      $.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) {
        UTIL.fire(classnm);
        UTIL.fire(classnm, 'finalize');
      });

      // Fire common finalize JS
      UTIL.fire('common', 'finalize');
    }
  };

  // Load Events
  $(document).ready(UTIL.loadEvents);

  /*https://css-tricks.com/using-svg/#comment-297467
  if (true) {
    $('img[src$=".svg"]').each(function() {
      var $this = $(this); // this = img
      $this.attr('src', $this.attr('src').replace(/svg$/, 'png'));
    });
  }*/

  $('.mdl_drawer_button').click(function(){
   if($('.mdl-layout__drawer').hasClass('active')){
      $('.mdl-layout__drawer').removeClass('active');
   }
   else{
      $('.mdl-layout__drawer').addClass('active');
   }
  });

  $('.mdl-layout__obfuscator-right').click(function(){
   if($('.mdl-layout__drawer').hasClass('active')){
      $('.mdl-layout__drawer').removeClass('active');
   }
   else{
      $('.mdl-layout__drawer').addClass('active');
   }
  });

  //This is so that on larger screens, only one response-definition will show at a time.
  $(".list__item").click(function () {
    var vWidth = window.innerWidth;
    if (vWidth > 480) {
      $(this).siblings().each(function (index) {
        $(this).find('div').hide();
      });
    }
  });

  $('#cta-button').animate({
    opacity: 1,
    right: "3rem",
    bottom: "10px",
    height: "toggle"
    }, 1000, function() {
    // Animation complete.
    }).css('position','fixed');

})(jQuery); // Fully reference jQuery after this point.


text:
require_relative 'base_middleware'

module GoodData
  module Bricks
    class TwitterMiddleware < Bricks::Middleware
      def call(params)
        client = Twitter::REST::Client.new do |config|
          config.consumer_key = params[:twitter_consumer_key]
          config.consumer_secret = params[:twitter_consumer_secret]
          config.access_token = params[:twitter_access_token]
          config.access_token_secret = params[:twitter_access_token_secret]
        end

        returning(@app.call(params)) do |result|
          client.update(result)
        end
      end
    end
  end
end


text:
using TodotxtTouch.WindowsPhone.ViewModel;

namespace TodotxtTouch.WindowsPhone.Service
{
    public class PrimaryTaskFileService : TaskFileService
    {
        public PrimaryTaskFileService(DropboxService dropBoxService, ApplicationSettings settings)
            : base(dropBoxService, settings)
        {
        }

        protected override string GetFilePath()
        {
            return Settings.TodoFilePath;
        }

        protected override string GetFileName()
        {
            return Settings.TodoFileName;
        }
    }
}


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>
#include <assert.h>
#include <exception>

// System.DelegateSerializationHolder
struct DelegateSerializationHolder_t1755885420;
// System.Runtime.Serialization.SerializationInfo
struct SerializationInfo_t2995724695;
// System.Delegate
struct Delegate_t3660574010;
// System.Object
struct Il2CppObject;

#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_Runtime_Serialization_Serializatio2995724695.h"
#include "mscorlib_System_Runtime_Serialization_StreamingCont986364934.h"
#include "mscorlib_System_Delegate3660574010.h"

// System.Void System.DelegateSerializationHolder::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
extern "C"  void DelegateSerializationHolder__ctor_m3368674811 (DelegateSerializationHolder_t1755885420 * __this, SerializationInfo_t2995724695 * ___info, StreamingContext_t986364934  ___ctx, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void System.DelegateSerializationHolder::GetDelegateData(System.Delegate,System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
extern "C"  void DelegateSerializationHolder_GetDelegateData_m3517598358 (Il2CppObject * __this /* static, unused */, Delegate_t3660574010 * ___instance, SerializationInfo_t2995724695 * ___info, StreamingContext_t986364934  ___ctx, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void System.DelegateSerializationHolder::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
extern "C"  void DelegateSerializationHolder_GetObjectData_m107938392 (DelegateSerializationHolder_t1755885420 * __this, SerializationInfo_t2995724695 * ___info, StreamingContext_t986364934  ___context, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Object System.DelegateSerializationHolder::GetRealObject(System.Runtime.Serialization.StreamingContext)
extern "C"  Il2CppObject * DelegateSerializationHolder_GetRealObject_m296541084 (DelegateSerializationHolder_t1755885420 * __this, StreamingContext_t986364934  ___context, const MethodInfo* method) IL2CPP_METHOD_ATTR;


text:
function foo():number{return 1};
var x = foo();

//// [functionCall2.js]
function foo() { return 1; }
;
var x = foo();


text:
using System.Runtime.InteropServices;

namespace Microsoft.WindowsAPICodePack.Shell
{
    /// <summary>
    /// A wrapper for a RECT struct
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct NativeRect
    {
        /// <summary>
        /// Position of left edge
        /// </summary>
        public int Left { get; set; }

        /// <summary>
        /// Position of top edge
        /// </summary>
        public int Top { get; set; }

        /// <summary>
        /// Position of right edge
        /// </summary>
        public int Right { get; set; }

        /// <summary>
        /// Position of bottom edge
        /// </summary>
        public int Bottom { get; set; }

        /// <summary>
        /// Creates a new NativeRect initialized with supplied values.
        /// </summary>
        /// <param name="left">Position of left edge</param>
        /// <param name="top">Position of top edge</param>
        /// <param name="right">Position of right edge</param>
        /// <param name="bottom">Position of bottom edge</param>
        public NativeRect(int left, int top, int right, int bottom)
            : this()
        {
            Left = left;
            Top = top;
            Right = right;
            Bottom = bottom;
        }

        /// <summary>
        /// Determines if two NativeRects are equal.
        /// </summary>
        /// <param name="first">First NativeRect</param>
        /// <param name="second">Second NativeRect</param>
        /// <returns>True if first NativeRect is equal to second; false otherwise.</returns>
        public static bool operator ==(NativeRect first, NativeRect second)
        {
            return first.Left == second.Left
                && first.Top == second.Top
                && first.Right == second.Right
                && first.Bottom == second.Bottom;
        }

        /// <summary>
        /// Determines if two NativeRects are not equal
        /// </summary>
        /// <param name="first">First NativeRect</param>
        /// <param name="second">Second NativeRect</param>
        /// <returns>True if first is not equal to second; false otherwise.</returns>
        public static bool operator !=(NativeRect first, NativeRect second)
        {
            return !(first == second);
        }

        /// <summary>
        /// Determines if the NativeRect is equal to another Rect.
        /// </summary>
        /// <param name="obj">Another NativeRect to compare</param>
        /// <returns>True if this NativeRect is equal to the one provided; false otherwise.</returns>
        public override bool Equals(object obj)
        {
            return (obj != null && obj is NativeRect) ? this == (NativeRect)obj : false;
        }

        /// <summary>
        /// Creates a hash code for the NativeRect
        /// </summary>
        /// <returns>Returns hash code for this NativeRect</returns>
        public override int GetHashCode()
        {
            int hash = Left.GetHashCode();
            hash = hash * 31 + Top.GetHashCode();
            hash = hash * 31 + Right.GetHashCode();
            hash = hash * 31 + Bottom.GetHashCode();
            return hash;
        }
    }

}


text:
/**
 * Created by moyu on 2017/2/13.
 */
if (typeof require.ensure !== 'function') {
    require.ensure = (d, c) => c(require);
}

export default {
    path: 'posts(/:page)',
    getComponent: (nextState, cb) => {
        require.ensure([], (require) => {
            cb(null, require('../pages/PostsPage').default)
        }, 'PostsPage')
    }
}


text:
namespace base {
class DictionaryValue;
}

namespace chromeos {
namespace onc {

// A valid but empty (no networks and no certificates) and unencrypted
// configuration.
CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[];

// Parses |json| according to the JSON format. If |json| is a JSON formatted
// dictionary, the function returns the dictionary as a DictionaryValue.
// Otherwise returns NULL.
CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson(
    const std::string& json);

// Decrypts the given EncryptedConfiguration |onc| (see the ONC specification)
// using |passphrase|. The resulting UnencryptedConfiguration is returned. If an
// error occurs, returns NULL.
CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt(
    const std::string& passphrase,
    const base::DictionaryValue& onc);

// For logging only: strings not user facing.
CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source);

// Used for string expansion with function ExpandStringInOncObject(...).
class CHROMEOS_EXPORT StringSubstitution {
 public:
  StringSubstitution() {}
  virtual ~StringSubstitution() {}

  // Returns the replacement string for |placeholder| in
  // |substitute|. Currently, onc::substitutes::kLoginIDField and
  // onc::substitutes::kEmailField are supported.
  virtual bool GetSubstitute(std::string placeholder,
                             std::string* substitute) const = 0;
 private:
  DISALLOW_COPY_AND_ASSIGN(StringSubstitution);
};

// Replaces all expandable fields that are mentioned in the ONC
// specification. The object of |onc_object| is modified in place. Currently
// onc::substitutes::kLoginIDField and onc::substitutes::kEmailField are
// expanded. The replacement strings are obtained from |substitution|.
CHROMEOS_EXPORT void ExpandStringsInOncObject(
    const OncValueSignature& signature,
    const StringSubstitution& substitution,
    base::DictionaryValue* onc_object);

}  // namespace onc
}  // namespace chromeos

#endif  // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_


text:
// $Id: http_status.cpp 80826 2008-03-04 14:51:23Z wotte $

#include "ace/Log_Msg.h"
#include "HTTPU/http_status.h"

const char *
HTTP_SCode::table_ [HTTP_SCode::SC_TABLE_SIZE];

HTTP_SCode_Node HTTP_SCode_Base::STATUS_OK (200, "OK");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_CREATED (201, "Created");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_ACCEPTED (202, "Accepted");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_NO_CONTENT (204, "No Content");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_MULTIPLE_CHOICES (300,
                                                          "Multiple Choices");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_MOVED_PERMANENTLY (301,
                                                           "Moved Permanently");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_MOVED_TEMPORARILY (302,
                                                           "Moved Temporarily");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_MODIFIED (304, "Not Modified");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_INSUFFICIENT_DATA (399,
                                                           "Insufficient Data");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_BAD_REQUEST (400, "Bad Request");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_UNAUTHORIZED (401, "Unauthorized");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_FORBIDDEN (403, "Forbidden");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_FOUND (404, "Not Found");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_INTERNAL_SERVER_ERROR (500,
                                                               "Internal Server Error");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_IMPLEMENTED (501,
                                                         "Not Implemented");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_BAD_GATEWAY (502, "Bad Gateway");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_SERVICE_UNAVAILABLE (503,
                                                             "Service Unavailable");
HTTP_SCode_Node HTTP_SCode_Base::STATUS_QUIT (599, "Quit");

HTTP_SCode_Node HTTP_SCode_Base::DUMMY (0, 0);

HTTP_SCode_Node::HTTP_SCode_Node (int code, const char *code_str)
  : code_ (code),
    code_str_ (code_str)
{
  if ((HTTP_SCode::MIN_STATUS_CODE <= code)
      && (code <= HTTP_SCode::MAX_STATUS_CODE))
    HTTP_SCode::table_[code - HTTP_SCode::MIN_STATUS_CODE] = code_str;
}

const char *
HTTP_SCode::operator[] (int i) const
{
  const char *s = "Unknown";

  if (MIN_STATUS_CODE <= i && i <= MAX_STATUS_CODE)
    s = this->table_[i - MIN_STATUS_CODE];

  return s;
}

HTTP_SCode *
HTTP_SCode::instance (void)
{
  return HTTP_SCode_Singleton::instance ();
}

void
HTTP_SCode::dump (void)
{
  for (int i = 0; i < SC_TABLE_SIZE; i++)
    ACE_DEBUG ((LM_DEBUG, "%s\n", this->table_[i]));
}

HTTP_SCode::HTTP_SCode (void)
{
  int i;
  for (i = 0; i < SC_TABLE_SIZE; i++)
    {
      if (this->table_[i] == 0)
        this->table_[i] = this->table_[(i/100) * 100];
    }
}

HTTP_SCode::~HTTP_SCode (void)
{
}

#if !defined (ACE_HAS_INLINED_OSCALLS)
#   include "HTTPU/http_status.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */


text:
BSLS_IDENT_RCSID(bdls_osutil_cpp, "$Id$ $CSID$")

#include <bdls_processutil.h>

#include <bslmf_assert.h>
#include <bsls_platform.h>

#include <bsl_cstring.h>

#ifdef BSLS_PLATFORM_OS_WINDOWS
# include <bdlsb_fixedmemoutstreambuf.h>

# include <bsl_ostream.h>

# include <windows.h>

# define   U_VISTA_OR_LATER 0
# if 6 <= BSLS_PLATFORM_OS_VER_MAJOR
#   undef  U_VISTA_OR_LATER
#   define U_VISTA_OR_LATER 1
# endif
# if 0 != U_VISTA_OR_LATER
#   include <bsl_limits.h>
#   include <VersionHelpers.h>
# else
#   include <process.h>
# endif
#else
# include <unistd.h>
# include <sys/utsname.h>
#endif

namespace BloombergLP {

namespace {

template <class STRING_TYPE>
int u_OsUtil_getOsInfo(STRING_TYPE *osName,
                       STRING_TYPE *osVersion,
                       STRING_TYPE *osPatch);
    // Load the operating system name, version name and patch name into the
    // specified 'osName', 'osVersion' and 'osPatch' respectively.  Return
    // 0 on success and a non-zero value otherwise.  The loaded values may
    // represent an emulation provided for the current process (see
    // "manifest-based behavior" in Windows programming documentation for an
    // example) and therefore are not suitable for determining supported
    // features or the real environment/version.  If you need to determine the
    // presence of certain features please consult the documentation of the
    // operating systems you need to support.

#ifdef BSLS_PLATFORM_OS_WINDOWS
template <class STRING_TYPE>
int u_OsUtil_getOsInfo(STRING_TYPE *osName,
                       STRING_TYPE *osVersion,
                       STRING_TYPE *osPatch)
{
    BSLS_ASSERT(osName);
    BSLS_ASSERT(osVersion);
    BSLS_ASSERT(osPatch);

    *osName = "Windows";

#if 0 != U_VISTA_OR_LATER
    // On Windows, 'WORD' means a 16-bit unsigned int.

    WORD major = 0;
    WORD minor = 0;
    WORD servicePackMajor = 0;

    const WORD maxWord = bsl::numeric_limits<WORD>::max();

    while (IsWindowsVersionOrGreater(major, minor, servicePackMajor)) {
        if (major >= maxWord) {
            return -1;                                                // RETURN
        }
        ++major;
    }
    --major;
    while (IsWindowsVersionOrGreater(major, minor, servicePackMajor)) {
        if (minor >= maxWord) {
            return -1;                                                // RETURN
        }
        ++minor;
    }
    --minor;
    while (IsWindowsVersionOrGreater(major, minor, servicePackMajor)) {
        if (servicePackMajor >= maxWord) {
            return -1;                                                // RETURN
        }
        ++servicePackMajor;
    }
    --servicePackMajor;

    // Os version

    // We want to do this with a minimum of allocations.  Both an
    // 'ostringstream' and 'sprintf' would allocate memory, so we us a
    // 'bdlsb::FixedMemOutStreamBuf"

    char buf[256];
    bdlsb::FixedMemOutStreamBuf sb(buf, sizeof(buf));
    bsl::ostream ostr(&sb);

    ostr << major << '.' << minor << bsl::ends;
    *osVersion = buf;

    // Service pack number

    sb.pubsetbuf(buf, sizeof(buf));
    buf[0] = 0;

    if (servicePackMajor) {
        // Note that we are incapable of detecting any 'servicePackMinor'
        // version other than 0.  But it seems rational that if Microsoft had
        // any plans for non-zero 'servicePackMinor' version at or after
        // Vista, they would have made 'IsWindowsVersionOrGreater' take 4 args
        // instead of 3.

        ostr << "Service Pack " << servicePackMajor << ".0" << bsl::ends;
    }

    *osPatch = buf;

#else // i.e., 0 == U_VISTA_OR_LATER

    OSVERSIONINFOEX osvi;

    bsl::memset(&osvi, 0, sizeof(OSVERSIONINFOEX));
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

    if (!GetVersionEx((OSVERSIONINFO *)&osvi)) {
        return -1;                                                    // RETURN
    }

    // Os version

    // We want to do this with a minimum of allocations.  Both an
    // 'ostringstream' and 'sprintf' would allocate memory, so we us a
    // 'bdlsb::FixedMemOutStreamBuf"

    char buf[256];
    bdlsb::FixedMemOutStreamBuf sb(buf, sizeof(buf));
    bsl::ostream ostr(&sb);

    ostr << osvi.dwMajorVersion << '.' << osvi.dwMinorVersion << bsl::ends;
    *osVersion = buf;

    sb.pubsetbuf(buf, sizeof(buf));
    buf[0] = 0;

    // Service pack number

    if (osvi.wServicePackMajor) {
        ostr << "Service Pack " << osvi.wServicePackMajor << '.'
             << osvi.wServicePackMinor << bsl::ends;
    }
    *osPatch = buf;

#endif // 0 != U_VISTA_OR_LATER

    return 0;
}

#elif defined(BSLS_PLATFORM_OS_UNIX)

template <class STRING_TYPE>
int u_OsUtil_getOsInfo(STRING_TYPE *osName,
                       STRING_TYPE *osVersion,
                       STRING_TYPE *osPatch)
{
    BSLS_ASSERT(osName);
    BSLS_ASSERT(osVersion);
    BSLS_ASSERT(osPatch);

    struct utsname unameInfo;
    if (-1 == uname(&unameInfo)) {
        return -1;                                                    // RETURN
    }
    *osName = unameInfo.sysname;
    *osVersion = unameInfo.release;
    *osPatch = unameInfo.version;

    return 0;
}

#else
#error "Unsupported operating system"
#endif // OS CHECK

} // close unnamed namespace

namespace bdls {

                            // --------------------
                            // struct bdls::OsUtil
                            // --------------------

// CLASS METHODS

int OsUtil::getOsInfo(bsl::string *osName,
                      bsl::string *osVersion,
                      bsl::string *osPatch)
{
    return u_OsUtil_getOsInfo(osName, osVersion, osPatch);
}

int OsUtil::getOsInfo(std::string *osName,
                      std::string *osVersion,
                      std::string *osPatch)
{
    return u_OsUtil_getOsInfo(osName, osVersion, osPatch);
}

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR
int OsUtil::getOsInfo(std::pmr::string *osName,
                      std::pmr::string *osVersion,
                      std::pmr::string *osPatch)
{
    return u_OsUtil_getOsInfo(osName, osVersion, osPatch);
}
#endif

}  // close package namespace
}  // close enterprise namespace

// ----------------------------------------------------------------------------
// Copyright 2015 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------