text:
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace HyperSlackers.AspNet.Identity.EntityFramework
{
    public static class UserManagerExtensions
    {
        /// <summary>
        /// Return a user with the specified username and password or null if there is no match.
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        public static TUser Find<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, string userName, string password)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userName.IsNullOrWhiteSpace(), "userName");
            Contract.Requires<ArgumentNullException>(!password.IsNullOrWhiteSpace(), "password");

            return AsyncHelper.RunSync(() => manager.FindAsync(hostId, userName, password));
        }

        /// <summary>
        /// Find a user by name
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userName">Name of the user.</param>
        /// <returns></returns>
        public static TUser FindByName<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, string userName)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userName.IsNullOrWhiteSpace(), "userName");

            return AsyncHelper.RunSync(() => manager.FindByNameAsync(hostId, userName));
        }

        /// <summary>
        /// Find a user by email
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="email">The email.</param>
        /// <returns></returns>
        public static TUser FindByEmail<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, string email)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!email.IsNullOrWhiteSpace(), "email");

            return AsyncHelper.RunSync(() => manager.FindByEmailAsync(hostId, email));
        }

        /// <summary>
        /// Sync extension
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="login">The login.</param>
        /// <returns></returns>
        public static TUser Find<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, UserLoginInfo login)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(login != null, "login");

            return AsyncHelper.RunSync(() => manager.FindAsync(hostId, login));
        }

        /// <summary>
        /// Add a user claim
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="claim">The claim.</param>
        /// <returns></returns>
        public static IdentityResult AddClaim<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId, Claim claim)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");
            Contract.Requires<ArgumentNullException>(claim != null, "claim");

            return AsyncHelper.RunSync(() => manager.AddClaimAsync(hostId, userId, claim));
        }

        /// <summary>
        /// Remove a user claim
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="claim">The claim.</param>
        /// <returns></returns>
        public static IdentityResult RemoveClaim<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId, Claim claim)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");
            Contract.Requires<ArgumentNullException>(claim != null, "claim");

            return AsyncHelper.RunSync(() => manager.RemoveClaimAsync(hostId, userId, claim));
        }

        /// <summary>
        /// Get a users's claims
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns></returns>
        public static IList<Claim> GetClaims<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");

            return AsyncHelper.RunSync(() => manager.GetClaimsAsync(hostId, userId));
        }

        /// <summary>
        /// Add a user to a role
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="roleName">Name of the role.</param>
        /// <returns></returns>
        public static IdentityResult AddToRole<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId, string roleName)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, IUserMultiHost<TKey>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");
            Contract.Requires<ArgumentNullException>(!roleName.IsNullOrWhiteSpace(), "roleName");

            return AsyncHelper.RunSync(() => manager.AddToRoleAsync(hostId, userId, roleName));
        }

        /// <summary>
        /// Remove a user from a role.
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="roleName">Name of the role.</param>
        /// <returns></returns>
        public static IdentityResult RemoveFromRole<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId, string roleName)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");
            Contract.Requires<ArgumentNullException>(!roleName.IsNullOrWhiteSpace(), "roleName");

            return AsyncHelper.RunSync(() => manager.RemoveFromRoleAsync(hostId, userId, roleName));
        }

        /// <summary>
        /// Get a users's roles
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns></returns>
        public static IList<string> GetRoles<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");

            return AsyncHelper.RunSync(() => manager.GetRolesAsync(hostId, userId));
        }

        /// <summary>
        /// Returns true if the user is in the specified role
        /// </summary>
        /// <typeparam name="TUser">The type of the user.</typeparam>
        /// <typeparam name="TRole">The type of the role.</typeparam>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TUserLogin">The type of the user login.</typeparam>
        /// <typeparam name="TUserRole">The type of the user role.</typeparam>
        /// <typeparam name="TUserClaim">The type of the user claim.</typeparam>
        /// <param name="manager">The manager.</param>
        /// <param name="hostId">The host identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <param name="role">The role.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">manager</exception>
        public static bool IsInRole<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim>(this UserManagerMultiHost<TUser, TRole, TKey, TUserLogin, TUserRole, TUserClaim> manager, TKey hostId, TKey userId, string roleName)
            where TUser : IdentityUserMultiHost<TKey, TUserLogin, TUserRole, TUserClaim>, new()
            where TRole : IdentityRoleMultiHost<TKey, TUserRole>, IRoleMultiHost<TKey>, new()
            where TKey : IEquatable<TKey>
            where TUserLogin : IdentityUserLoginMultiHost<TKey>, IUserLoginMultiHost<TKey>, new()
            where TUserRole : IdentityUserRoleMultiHost<TKey>, IUserRoleMultiHost<TKey>, new()
            where TUserClaim : IdentityUserClaimMultiHost<TKey>, IUserClaimMultiHost<TKey>, new()
        {
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(!hostId.Equals(default(TKey)), "hostId");
            Contract.Requires<ArgumentNullException>(!userId.Equals(default(TKey)), "userId");
            Contract.Requires<ArgumentNullException>(!roleName.IsNullOrWhiteSpace(), "roleName");

            return AsyncHelper.RunSync(() => manager.IsInRoleAsync(userId, roleName));
        }
    }
}


text:
package com.adobe.acs.commons.httpcache.config.impl;

import com.adobe.acs.commons.httpcache.config.HttpCacheConfig;
import com.adobe.acs.commons.httpcache.config.impl.keys.CombinedCacheKey;
import com.adobe.acs.commons.httpcache.exception.HttpCacheKeyCreationException;
import com.adobe.acs.commons.httpcache.keys.CacheKey;
import com.adobe.acs.commons.httpcache.keys.CacheKeyFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.commons.osgi.Order;
import org.apache.sling.commons.osgi.RankedServices;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.ConfigurationPolicy;
import org.osgi.service.component.annotations.Modified;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.Designate;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * Aggregates multiple cache key factories extensions into 1.
 * This is useful when you need differentiation of 2 cache keys together.
 * Instead of duplicating and merging the 2 extensions / factories into 1 class, you can leverage this class.
 * It will use existing cache key factories to create a key for each one, and put them in a list.
 *
 *  Use as follows in your HTTP cache config to leverage multiple factories:
 *  cacheConfigFactories.target="
 *             (|
 *                 (&(service.factoryPid=com.adobe.acs.commons.httpcache.config.impl.RequestPathHttpCacheConfigExtension)(config.name=someConfig))
 *                 (&(service.factoryPid=com.adobe.acs.commons.httpcache.config.impl.ResourceTypeHttpCacheConfigExtension)(config.name=someOtherConfig))
 *             )
 *           "
 */

@Component(
        service = {CacheKeyFactory.class},
        configurationPolicy = ConfigurationPolicy.REQUIRE,
        property = {
                Constants.SERVICE_RANKING + ":Integer=" + Integer.MAX_VALUE,
                "webconsole.configurationFactory.nameHint=Config name: [ config.name ]"
        },
        reference = {
                @Reference(
                        name = "cacheKeyFactories",
                        bind = "bindCacheKeyFactory",
                        unbind = "unbindCacheKeyFactory",
                        service = CacheKeyFactory.class,
                        policy = ReferencePolicy.DYNAMIC,
                        cardinality = ReferenceCardinality.MULTIPLE)
        }

)
@Designate(
        ocd = CombinedCacheKeyFactory.Config.class,
        factory = true
)
public class CombinedCacheKeyFactory implements CacheKeyFactory {

    @ObjectClassDefinition(
            name = "ACS AEM Commons - HTTP Cache - CacheKeyFactory Combiner",
            description = "Aggregates multiple extensions into a single cache key")
    public @interface Config {

        @AttributeDefinition(name = "Config Name")
        String config_name() default StringUtils.EMPTY;

        @AttributeDefinition(name = "CacheKey factory service PIDs",
                description = "Service PID(s) of target implementation of CacheKeyFactory to be used."
        )
        String cacheKeyFactories_target();
    }

    private static final Logger log = LoggerFactory.getLogger(CombinedCacheKeyFactory.class);

    private String configName;

    private RankedServices<CacheKeyFactory> cacheKeyFactories = new RankedServices<>(Order.ASCENDING);

    @Override
    public CacheKey build(SlingHttpServletRequest request, HttpCacheConfig cacheConfig) throws HttpCacheKeyCreationException {
        return new CombinedCacheKey(request, cacheConfig, cacheKeyFactories.getList());
    }

    @Override
    public CacheKey build(String resourcePath, HttpCacheConfig cacheConfig) throws HttpCacheKeyCreationException {
        return new CombinedCacheKey(resourcePath, cacheConfig, cacheKeyFactories.getList());
    }

    @Override
    public boolean doesKeyMatchConfig(CacheKey key, HttpCacheConfig cacheConfig) throws HttpCacheKeyCreationException {
        if (!(key instanceof CombinedCacheKey)) {
            return false;
        }

        return new CombinedCacheKey(key.getUri(), cacheConfig, cacheKeyFactories.getList()).equals(key);
    }

    protected void bindCacheKeyFactory(CacheKeyFactory factory, Map<String, Object> properties) {
        if (factory != this) {
            cacheKeyFactories.bind(factory, properties);
        } else {
            log.error("Invalid key factory LDAP target string! Self is target(ed)! Breaking up infinite loop. Configname: {}", this.configName);
        }
    }

    protected void unbindCacheKeyFactory(CacheKeyFactory factory, Map<String, Object> properties) {
        if (factory != this) {
            cacheKeyFactories.unbind(factory, properties);
        }
    }

    @Activate
    @Modified
    protected void activate(CombinedCacheKeyFactory.Config config) {
        this.configName = config.config_name();
    }

}

redpajama_set_name: RedPajamaGithub


text:
package cx_test

import (
	"context"

	cx "cloud.google.com/go/dialogflow/cx/apiv3beta1"
	cxpb "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb"
	"google.golang.org/api/iterator"
	locationpb "google.golang.org/genproto/googleapis/cloud/location"
	longrunningpb "google.golang.org/genproto/googleapis/longrunning"
)

func ExampleNewEnvironmentsClient() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func ExampleNewEnvironmentsRESTClient() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func ExampleEnvironmentsClient_ListEnvironments() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.ListEnvironmentsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#ListEnvironmentsRequest.
	}
	it := c.ListEnvironments(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func ExampleEnvironmentsClient_GetEnvironment() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.GetEnvironmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#GetEnvironmentRequest.
	}
	resp, err := c.GetEnvironment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_CreateEnvironment() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.CreateEnvironmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#CreateEnvironmentRequest.
	}
	op, err := c.CreateEnvironment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_UpdateEnvironment() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.UpdateEnvironmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#UpdateEnvironmentRequest.
	}
	op, err := c.UpdateEnvironment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_DeleteEnvironment() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.DeleteEnvironmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#DeleteEnvironmentRequest.
	}
	err = c.DeleteEnvironment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func ExampleEnvironmentsClient_LookupEnvironmentHistory() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.LookupEnvironmentHistoryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#LookupEnvironmentHistoryRequest.
	}
	it := c.LookupEnvironmentHistory(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func ExampleEnvironmentsClient_RunContinuousTest() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.RunContinuousTestRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#RunContinuousTestRequest.
	}
	op, err := c.RunContinuousTest(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_ListContinuousTestResults() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.ListContinuousTestResultsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#ListContinuousTestResultsRequest.
	}
	it := c.ListContinuousTestResults(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func ExampleEnvironmentsClient_DeployFlow() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &cxpb.DeployFlowRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb#DeployFlowRequest.
	}
	op, err := c.DeployFlow(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_GetLocation() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &locationpb.GetLocationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
	}
	resp, err := c.GetLocation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_ListLocations() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &locationpb.ListLocationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
	}
	it := c.ListLocations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func ExampleEnvironmentsClient_CancelOperation() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func ExampleEnvironmentsClient_GetOperation() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.GetOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#GetOperationRequest.
	}
	resp, err := c.GetOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func ExampleEnvironmentsClient_ListOperations() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := cx.NewEnvironmentsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}


text:
package mm.webclientservlets;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import mm.da.DataAccess;
import mm.model.AcademicInstitute;

/**
 * Servlet implementation class AddAcademinInstitute
 */
@WebServlet("/AddAcademinInstitute")
public class AddAcademinInstitute extends HttpServlet {
	private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddAcademinInstitute() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String name=request.getParameter("name");
		String Area=request.getParameter("area");
		String City=request.getParameter("city");

		RequestDispatcher req = null;

		AcademicInstitute acadimicIn= new AcademicInstitute(0,name,Area,City, 0, 0); //TODO: set proper area/city id

		DataAccess da = new DataAccess();
	    boolean res=false;

		try {
			res = da.addAcademicInstitute(acadimicIn);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			da.closeConnection();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		if(res){
			response.getWriter().append("AcadimicInstitute Added");
			req = request.getRequestDispatcher("");
		}
		if(!res)
			response.getWriter().append("Failed in added Work Place");

		req.forward(request, response);

	}

}


text:
layout: shared/narrow-pages-list
title: "Your first multi-device site"
description: "The web is accessible on a huge range of devices, from small-screen phones to big-screen televisions. Each device presents its own benefits and constraints. As a web developer, you are expected to support a full ranges of devices."
published_on: 2014-01-01
updated_on: 2015-10-06
translation_priority: 0
authors:
  - paulkinlan
---

Creating multi-device experiences is not as hard as it might seem.
In this guide, we will build a product landing page for the
CS256 Mobile Web
  Development course that works well across different device types.

Building for multiple devices with differing capabilities, vastly different
screen sizes and interaction methods can seem daunting, if not impossible
to get started.

It is not as hard to build fully responsive sites as you think, and to show
you, this guide takes you through the steps that you can use to get started.  We have broken it into two
simple steps:

1.  Defining the information architecture (commonly known as IA) and structure of the page,
2.  Adding design elements to make it responsive and look good across all devices.


text:
import click
from netCDF4 import Dataset
import matplotlib as mpl
mpl.use('Qt5Agg')
#%matplotlib inline
import matplotlib.pylab as plt
import numpy as np
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cmocean import cm as cmo
from matplotlib import cm
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
import pyfesom as pf
from cartopy.util import add_cyclic_point

@click.command()
@click.argument('meshpath', type=click.Path(exists=True))
@click.argument('ifile', type=click.Path(exists=True))
@click.argument('variable', default='temp', required=False)
@click.option('--depth', '-d', default=0, type=click.FLOAT, show_default=True,
               help='Depth in meters.')
@click.option('--box', '-b',
              nargs=4,
              type=(click.IntRange(-180, 180),
                    click.IntRange(-180, 180),
                    click.IntRange(-90, 90),
                    click.IntRange(-90, 90)),
              default=(13, 30, 54, 66), show_default=True,
              help='Map boundaries in -180 180 -90 90 format.')
@click.option('--timestep', '-t', default=0, show_default=True,
              help='Timstep from netCDF variable, strats with 0.')
@click.option('--minmax', '-l', nargs=2, type=click.INT,
              help='Minimun and maximum values for plotting.')
@click.option('--mapproj','-m', type=click.Choice(['merc', 'pc','np','sp', 'rob']), default='merc', help = 'Map projection. Options are Mercator (merc), Plate Carree (pc), North Polar Stereo (np), South Polar Stereo (sp),  Robinson (rob)')
@click.option('--quiet', '-q', is_flag=True,
              help='If present additional information will not be printed.')
@click.option('--ofile','-o' ,type=click.Path(exists=False) ,
              help='Path to the output figure. If present the image will be saved to the file instead of showing it. ')
def showo(meshpath, ifile, variable,
          depth, box, timestep, minmax,
          mapproj, quiet, ofile):
    '''
    meshpath - Path to the folder with FESOM1.4 mesh files.

    ifile    - Path to FESOM1.4 netCDF file.

    variable - The netCDF variable to be plotted.
    '''
    if not quiet:
        click.secho('Mesh: {}'.format(meshpath))
        click.secho('File: {}'.format(ifile))
        click.secho('Variable: {}'.format(variable), fg='red')
        click.secho('Depth: {}'.format(depth), fg='red')
        click.secho('BOX: {}'.format(box))
        click.secho('Timestep: {}'.format(timestep))
        if minmax:
            click.secho('Min/max: {}'.format(minmax), fg='red')
        else:
            click.secho('Min/max: auto', fg='red')

    mesh = pf.load_mesh(meshpath)
    flf = Dataset(ifile)
    left, right, down, up = box

    elem_nonan, no_nan_tri = pf.cut_region(mesh, [left, right, down, up], 0)
    if variable == 'topo':
        level_data = mesh.topo
    else:
        level_data , nnn = pf.get_data(flf.variables[variable][timestep,:], mesh, depth)

    if minmax:
        mmin, mmax = minmax
    else:
        mmin = level_data[elem_nonan].min()
        mmax = level_data[elem_nonan].max()

    plt.figure(figsize=(10,10))
    if mapproj == 'merc':
        ax = plt.subplot(111, projection=ccrs.Mercator())
    elif mapproj == 'pc':
        ax = plt.subplot(111, projection=ccrs.PlateCarree())
    elif mapproj == 'np':
        ax = plt.subplot(111, projection=ccrs.NorthPolarStereo())
    elif mapproj == 'sp':
        ax = plt.subplot(111, projection=ccrs.SouthPolarStereo())
    elif mapproj == 'rob':
            ax = plt.subplot(111, projection=ccrs.Robinson())

    ax.set_extent(box, crs=ccrs.PlateCarree())
    mm = ax.tripcolor(mesh.x2,
                      mesh.y2,
                      elem_nonan,
                      level_data,
                      transform=ccrs.PlateCarree(),
                      edgecolors='k',
                      cmap=cm.Spectral_r,
                      vmin=mmin,
                      vmax=mmax
                      )
    ax.coastlines(lw=0.5, resolution='10m')
    plt.colorbar(mm, orientation='horizontal', pad =0.03, )
    plt.title('{} at {}'.format(variable, depth), size = 20)
    if ofile:
        plt.savefig(ofile, dpi=200)
    else:
        plt.show()
if __name__ == '__main__':
    showo()


text:
package org.apereo.cas.clouddirectory;

import java.util.List;
import java.util.Map;

/**
 * This is {@link AmazonCloudDirectoryRepository}.
 *
 * @author Misagh Moayyed
 * @since 5.2.0
 */
@FunctionalInterface
public interface AmazonCloudDirectoryRepository {

    /**
     * Gets user from cloud directory along with all other attributes.
     *
     * @param username the username
     * @return the user account map
     */
    Map<String, List<Object>> getUser(String username);
}


text:
package com.webuml.projectmanager.controller.views.classes;

import com.webuml.projectmanager.domain.viewmodel.ClassView;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resource;

class ClassViewResource extends Resource<ClassView> {

  public ClassViewResource(ClassView content, Link... links) {
    super(content, links);
  }

  public ClassViewResource(ClassView content, Iterable<Link> links) {
    super(content, links);
  }
}


text:
package pdms.platform.service.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Hibernate;
import pdms.components.dao.ProjectDao;
import pdms.components.dao.ReplyDao;
import pdms.components.dao.TopicDao;
import pdms.components.dao.UserDao;
import pdms.components.dto.A0400TopicDto;
import pdms.components.pojo.Project;
import pdms.components.pojo.Reply;
import pdms.components.pojo.Topic;
import pdms.components.pojo.User;
import pdms.components.vo.A0400TopicVo;
import pdms.platform.core.PdmsException;
import pdms.platform.service.A0400TopicService;
import pdms.platform.util.RoleUtil;
import pdms.platform.util.StringUtil;
import static pdms.platform.constant.CommonConstant.DB_STATUS_NG;
import static pdms.platform.constant.TopicConstant.*;

/**
 *
 * @author LUSuo(atealxt@gmail.com)
 */
public class A0400TopicServiceImpl implements A0400TopicService {

    private static Log logger = LogFactory.getLog(A0400TopicServiceImpl.class);
    private ProjectDao projectDao;
    private UserDao userDao;
    private TopicDao topicDao;
    private ReplyDao replyDao;

    @Override
    public String createTopic(A0400TopicDto dto) throws PdmsException {

        User user = userDao.findByLoginId(dto.getLoginId());
        String rule = RoleUtil.getOperate("Topic", user);
        if (!rule.contains("C")) {
            logger.error("无发帖权限");
            return "{success:false,errors:'无发帖权限!'}";
        } //if (!limit(dto, "Topic")) {
        else if (!limit(dto, "Topic")) {
            return "{success:false,errors:'无此操作权限!'}";
        }

        Project p = projectDao.findById(Integer.parseInt(dto.getPid()));
        User u = userDao.findByLoginId(dto.getLoginId());

        Topic topic = new Topic();
        String name = "";
        String title = dto.getTTitle();
        if (title != null && !title.trim().equals("")) {
            name = "[" + title + "]" + dto.getTName();
        } else {
            name = dto.getTName();
        }
        topic.setName(name);
        if (dto.getTLevel().equals("Position 1")) {
            topic.setTopiclevel(LEVEL_POSITION_1);
        } else {
            topic.setTopiclevel(LEVEL_POSITION_2);
        }
        if (dto.getTRole().equals("Private")) {
            topic.setTopictype(TYPE_PRIVATE);
        } else {
            topic.setTopictype(TYPE_PUBLIC);
        }
        topic.setContent(Hibernate.createClob(dto.getTContent()));
        topic.setProject(p);
        topic.setCreatetime(new Date());
        topic.setStatus(STATUS_OPEN);
        topic.setCreateuser(u);

        int insertStatus = topicDao.Insert(topic);
        if (insertStatus == DB_STATUS_NG) {
            logger.error("发帖失败!");
            return "{success:false,errors:'发帖失败!'}";
        }
        return "{success:true}";
    }

    @Override
    public String editTopic(A0400TopicDto dto, String tId, String rId) throws PdmsException {

        if (rId != null && !rId.equals("")) {
            //是编辑回复内容,而不是主题内容
            Reply r = replyDao.findById(rId);
            if (r == null) {
                logger.error("编辑失败!回复帖ID错误!");
                return "{success:false,errors:'编辑失败!回复帖ID错误!'}";
            }
            Topic topic = r.getTopic();
            if (topic == null) {
                logger.error("编辑失败!主题ID错误!");
                return "{success:false,errors:'编辑失败!主题ID错误!'}";
            }
            if (topic.getStatus() != STATUS_OPEN) {
                logger.error("编辑失败!主题已关闭!");
                return "{success:false,errors:'编辑失败!主题已关闭!'}";
            }

            StringBuffer sb = new StringBuffer(dto.getTContent());
//            sb.append("
此帖被");
//            sb.append(topic.getCreateuser().getName());
//            sb.append("于");
//            sb.append(StringUtil.getDateFormat(new Date(), "yyyy/MM/dd HH:mm:ss"));
//            sb.append("重新编辑");
            r.setContent(Hibernate.createClob(sb.toString()));

            int updateStatus = replyDao.Update(r);
            if (updateStatus == DB_STATUS_NG) {
                logger.error("更新失败!");
                return "{success:false,errors:'更新失败!'}";
            }
            return "{success:true}";
        }

        Topic topic = topicDao.findById(tId);
        if (topic == null) {
            logger.error("编辑失败!主题ID错误!");
            return "{success:false,errors:'编辑失败!主题ID错误!'}";
        }
        if (topic.getStatus() != STATUS_OPEN) {
            logger.error("编辑失败!主题已关闭!");
            return "{success:false,errors:'编辑失败!主题已关闭!'}";
        }

        if (!StringUtil.isEmpty(dto.getTLevel())) {
            if (dto.getTLevel().equals("Position 1")) {
                topic.setTopiclevel(LEVEL_POSITION_1);
            } else {
                topic.setTopiclevel(LEVEL_POSITION_2);
            }
        }
        if (!StringUtil.isEmpty(dto.getTRole())) {
            if (dto.getTRole().equals("Private")) {
                topic.setTopictype(TYPE_PRIVATE);
            } else {
                topic.setTopictype(TYPE_PUBLIC);
            }
        }

        if (!StringUtil.isEmpty(dto.getTContent())) {
            StringBuffer sb = new StringBuffer(dto.getTContent());
//            sb.append("
此帖被");
//            sb.append(topic.getCreateuser().getName());
//            sb.append("于");
//            sb.append(StringUtil.getDateFormat(new Date(), "yyyy/MM/dd HH:mm:ss"));
//            sb.append("重新编辑");
            topic.setContent(Hibernate.createClob(sb.toString()));
        }
        if (!StringUtil.isEmpty(dto.getTName())) {
            String name = "";
            String title = dto.getTTitle();
            if (title != null && !title.trim().equals("")) {
                if (!dto.getTName().startsWith("[讨论]") &&
                    !dto.getTName().startsWith("[求助]") &&
                    !dto.getTName().startsWith("[资源]") &&
                    !dto.getTName().startsWith("[其他]")) {
                    name = "[" + title + "]" + dto.getTName();
                } else {
                    name = "[" + title + "]" + dto.getTName().substring(4);
                }
            } else {
                name = dto.getTName();
            }
            topic.setName(name);
        }

        int updateStatus = topicDao.Update(topic);
        if (updateStatus == DB_STATUS_NG) {
            logger.error("更新失败!");
            return "{success:false,errors:'更新失败!'}";
        }
        return "{success:true}";
    }

    @Override
    public String createReply(String loginId, String tId, String tContent) throws PdmsException {

        Topic topic = topicDao.findById(tId);
        if (topic == null) {
            logger.error("回贴失败!主题ID错误!");
            return "{success:false,errors:'回贴失败!主题ID错误!'}";
        }
        if (topic.getStatus() != STATUS_OPEN) {
            logger.error("回贴失败!主题已关闭!");
            return "{success:false,errors:'回贴失败!主题已关闭!'}";
        }

        A0400TopicDto dto = new A0400TopicDto();
        dto.setLoginId(loginId);
        Project prj = topic.getProject();
        if (prj != null) {
            dto.setPid(Integer.toString(prj.getId()));
        }

        User user = userDao.findByLoginId(loginId);
        String rule = RoleUtil.getOperate("Reply", user);
        if (!rule.contains("C")) {
            logger.error("无回帖权限");
            return "{success:false,errors:'无回帖权限!'}";
        } //if (!limit(dto, "Reply")) {
        else if (!limit(dto, "Reply")) {
//            //判断是否是Public帖&Position2,不是则不能回复
//            if (topic.getTopictype() == TYPE_PRIVATE || topic.getTopiclevel() == LEVEL_POSITION_1) {
//                logger.error("权限验证失败!");
//                return "{success:false,errors:'无此帖回复权限!'}";
//            }
            logger.error("权限验证失败!");
            return "{success:false,errors:'无此帖回复权限!'}";
        }

        Reply r = new Reply();
        r.setContent(Hibernate.createClob(tContent));
        r.setCreatetime(new Date());
        r.setCreateuser(user);
        r.setTopic(topic);
        int insertStatus = replyDao.Insert(r);
        if (insertStatus == DB_STATUS_NG) {
            logger.error("回帖发生异常!");
            return "{success:false,errors:'回帖发生异常!'}";
        }

        return "{success:true}";
    }

    /** 权限验证 */
    private boolean limit(A0400TopicDto dto, String type) {

        String pId = dto.getPid();
        if (pId == null) {
            return true;
        }
        int i_pId = Integer.parseInt(pId);

        //如果是站务服务区,则放开权限(今后可能追加其他放开权限)
        if (i_pId == 1) {
            return true;
        }

        //所属专区判断
        List<Project> ps = projectDao.findByUserLoginId(dto.getLoginId());
        for (Project p : ps) {
            if (p.getId() == i_pId) {
                return true;
            }
        }

//        //可管理专区判断
//        ps = projectDao.findByManagerLoginId(dto.getLoginId());
//        for (Project p : ps) {
//            if (p.getId() == Integer.parseInt(dto.getPid())) {
//                return true;
//            }
//        }
//        //直接权限判断
//        User usr = userDao.findByLoginId(dto.getPid());
//        //identity
//        for (Identity i : usr.getIdentities()) {
//            if (i.getId() < 3) {
//                return true;
//            }
//        }
//        //role
//        for (Role r : usr.getRoles()) {
//            if (r.getFunction().getName().equals(type) && r.getOperate().getId() < 3) {
//                return true;
//            }
//        }

        return false;
    }

    @Override
    public List<A0400TopicVo> MakeVo(String tId, int maxNum, int startNum) throws PdmsException {

        List<A0400TopicVo> ret = new ArrayList<A0400TopicVo>();

        Topic t = topicDao.findById(tId);
        A0400TopicVo vo;
        if (startNum <= 0) {
            vo = new A0400TopicVo();
            vo.setIsTopic(true);
            try {
                vo.setRContent(t.getContent().getSubString(1, (int) t.getContent().length()));
            } catch (SQLException ex) {
                logger.error(ex);
            }
            vo.setRId(t.getId());
            vo.setRTitle(t.getName());
            vo.setRUsr(t.getCreateuser().getName());
            vo.setRTime(StringUtil.getDateFormat(t.getCreatetime(), "yyyy/MM/dd HH:mm:ss"));
            ret.add(vo);
        }

        List<Reply> replys = replyDao.findByTopicId(tId, maxNum, startNum);
        for (Reply r : replys) {
            vo = new A0400TopicVo();
            try {
                vo.setRContent(r.getContent().getSubString(1, (int) r.getContent().length()));
            } catch (SQLException ex) {
                logger.error(ex);
            }
            vo.setRId(r.getId());
            vo.setRTitle("Re: " + t.getName());
            vo.setRUsr(r.getCreateuser().getName());
            vo.setRTime(StringUtil.getDateFormat(r.getCreatetime(), "yyyy/MM/dd HH:mm:ss"));
            ret.add(vo);
        }

        return ret;
    }

    @Override
    public int getSumCount(String tId) throws PdmsException {
        return replyDao.findByTopicId(tId, -1).size() + 1;//要算上楼主
    }

    @Override
    public String closeTopic(List<String> list, String loginId) throws PdmsException {

        String ret = "{success:true}";

        User user = userDao.findByLoginId(loginId);
        if (user == null) {
            return "{success:false,errors:'无此用户'}";
        }
        String rule = RoleUtil.getOperate("Topic", user);
        boolean canDelAny = rule.contains("D");

        for (String i : list) {
            Topic t = topicDao.findById(i);
            if (t == null) {
                return "{success:false,errors:'主题帖ID错误'}";
            }
            if (t.getStatus() != STATUS_OPEN) {
                //帖子已关闭
                continue;
            }
            if (!canDelAny && !user.equals(t.getCreateuser())) {
                return "{success:false,errors:'无此权限'}";
            } else {
                t.setStatus(STATUS_CLOSE);
                int uStatus = topicDao.Update(t);
                if (uStatus == DB_STATUS_NG) {
                    return "{success:false,errors:'关闭主题帖中发生错误'}";
                }
            }
        }

        return ret;
    }

    public ProjectDao getProjectDao() {
        return projectDao;
    }

    public void setProjectDao(ProjectDao projectDao) {
        this.projectDao = projectDao;
    }

    public ReplyDao getReplyDao() {
        return replyDao;
    }

    public void setReplyDao(ReplyDao replyDao) {
        this.replyDao = replyDao;
    }

    public TopicDao getTopicDao() {
        return topicDao;
    }

    public void setTopicDao(TopicDao topicDao) {
        this.topicDao = topicDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}


text:
Edit Product

  <form class="form-horizontal" role="form" ng-submit="editProduct()">

  </form>


text:
<?php

namespace professionalweb\paymentdrivers\FSG;

class FormParser
{
    const EVENT_INIT     = 'onInitEvent';
    const EVENT_VALIDATE = 'onValidateEvent';

    protected $availableTags = [
        'Form' => ['version'],
        'Service' => ['num'],
        'Abonent' => ['*'],
        'Fields' => [],
        'Field' => ['name', 'value', 'dataType']
    ];

    /**
     * Form xml
     *
     * @var string
     */
    private $sForm;

    /**
     * XML
     *
     * @var \SimpleXMLElement
     */
    private $xmlSForm;

    public function __construct($xml)
    {
        $this->setSForm($xml);
    }

    /**
     * Check form have fields with "abonent" attribute
     *
     * @return bool
     */
    public function hasAbonentFields()
    {
        $result = false;

        if (($xml = $this->getSFormXml()) !== false) {
            $elements = $xml->xpath('//*[@abonent]');
            $result   = is_array($elements) && count($elements) > 0;
        }

        return $result;
    }

    /**
     * Get array of fields
     *
     * @param int $visible
     * @return array
     */
    public function getFields($visible = -1)
    {
        $result = [];
        if (($xml    = $this->getSFormXml()) !== false) {
            $xPathQuery = '//Field | //Column';
            if ($visible !== -1) {
                $xPathQuery = '//Field'.($visible ? '[@abonent=1]' : '[@abonent=0] | //Field[not(@abonent)]').' | //Column'.($visible
                            ? '[not(@visible)]' : '[@visible=0]');
            }
            $result = $xml->xpath($xPathQuery);
        }
        return $result;
    }

    /**
     * Set fields values to form
     *
     * @param array $fieldsAndValues
     * @return FormParser
     */
    public function setFieldsValues(array $fieldsAndValues)
    {
        if (($xml = $this->getSFormXml()) !== false) {
            foreach ($fieldsAndValues as $field => $value) {
                $elements = $xml->xpath('//*[@name="'.$field.'"]');
                if (is_array($elements) && count($elements) > 0) {
                    foreach ($elements as $el) {
                        if (!isset($el->attributes()->value)) {
                            $el->addAttribute('value', $value);
                        } else {
                            $el->attributes()->value = $value;
                        }
                    }
                }
            }
        }

        return $this;
    }

    /**
     * Get attribute
     *
     * @param \SimpleXMLElement $node
     * @param string $eventName
     * @return string
     */
    protected function getAttribute($node, $eventName)
    {
        $result     = '';
        $attributes = $node->attributes();
        if (isset($attributes->$eventName)) {
            $result = (string) $attributes->$eventName;
        }
        return $result;
    }

    /**
     * Get event name by attribute name
     *
     * @param string $eventName
     * @return string
     */
    protected function getFieldsEventName($eventName)
    {
        $result = '';
        if (($xml    = $this->getSFormXml()) !== false) {
            $result = $this->getAttribute($xml->Fields, $eventName);
        }
        return $result;
    }

    /**
     * Get init event name
     *
     * @return string
     */
    public function getInitEventName()
    {
        return $this->getFieldsEventName(self::EVENT_INIT);
    }

    /**
     * Get validate event name
     *
     * @return string
     */
    public function getValidateEventName()
    {
        return $this->getFieldsEventName(self::EVENT_VALIDATE);
    }

    /**
     * Get form as XML object
     *
     * @return \SimpleXMLElement
     */
    public function getSFormXml()
    {
        if ($this->xmlSForm === null) {
            $this->xmlSForm = simplexml_load_string($this->getSForm());
        }
        return $this->xmlSForm;
    }

    /**
     * Set form xml
     *
     * @param string $xml
     * @return FormParser
     */
    public function setSForm($xml)
    {
        $this->sForm = $xml;
        return $this;
    }

    /**
     * Get form xml
     *
     * @return string
     */
    public function getSForm()
    {
        return $this->sForm;
    }

    /**
     * Clear tags
     *
     * @return \professionalweb\paymentdrivers\FSG\FormParser
     */
    public function clear()
    {
        $tags          = $this->getSFormXml()->xpath('//*');
        $availableTags = array_keys($this->availableTags);
        foreach ($tags as $index => $tag) {
            $name = $tag->getName();
            if (in_array($name, $availableTags)) {
                if (count($this->availableTags[$name]) > 0 && $this->availableTags[$name][0]
                    != '*') {
                    $attributes       = $tag->attributes();
                    $clonedAttributes = clone $attributes;
                    foreach ($clonedAttributes as $attributeName => $attributeValue) {
                        if (!in_array($attributeName,
                                $this->availableTags[$name])) {
                            unset($attributes[$attributeName]);
                        }
                    }
                }
            } else {
                $dom = dom_import_simplexml($tag);
                $dom->parentNode->removeChild($dom);
                unset($tags[$index]);
            }
        }
        return $this;
    }

    /**
     * Set fields attribute
     *
     * @param string $fieldName
     * @param string $attributeName
     * @param string $attributeValue
     * @return \professionalweb\paymentdrivers\FSG\FormParser
     */
    public function setFieldAttribute($fieldName, $attributeName,
                                      $attributeValue)
    {
        $fields = $this->getSFormXml()->xpath('//Field[@name="'.$fieldName.'"]');
        foreach ($fields as $field) {
            $attributes = $field->attributes();
            if (!isset($attributes[$attributeName])) {
                $field->addAttribute($attributeName, $attributeValue);
            } else {
                $field[$attributeName] = $attributeValue;
            }
        }
        return $this;
    }

    /**
     * Copy data types from sForm to current sForm
     *
     * @param string $sForm
     * @return \professionalweb\paymentdrivers\FSG\FormParser
     */
    public function translateDataTypes($sForm)
    {
        if (($sFormXml = simplexml_load_string($sForm)) !== false) {
            $fields = $sFormXml->xpath('//Field');
            foreach ($fields as $field) {
                $attributes = $field->attributes();
                $name       = (string) $attributes['name'];
                if (isset($attributes['dataType'])) {
                    $this->setFieldAttribute($name, 'dataType',
                        (string) $attributes['dataType']);
                }
            }
        }
        return $this;
    }
}


text:
using System;
using System.Collections.Generic;

namespace Twilio.TaskRouter
{
    ///
    /// TaskRouter logs Events for each state change in the Workspace for the purpose of historical reporting and auditing.
    ///
    public class Event : TwilioBase
    {
        ///
        /// The unique ID for this Event.
        ///
        public string Sid { get; set; }
        ///
        /// A description of this Event.
        ///
        public string Description { get; set; }
        ///
        /// The unique ID of the Account that owns this Event.
        ///
        public string AccountSid { get; set; }
        ///
        /// An identifier for this type of Event.
        ///
        public string EventType { get; set; }
        ///
        /// The type of object this Event is most relevant to (e.g. <see cref="Twilio.TaskRouter.Task"/> or <see cref="Twilio.TaskRouter.Reservation"/>).
        ///
        public string ResourceType { get; set; }
        ///
        /// The unique ID of the object this Event is most relevant to.
        ///
        public string ResourceSid { get; set; }
        ///
        /// The URL of the object this Event is most relevant to.
        ///
        public string ResourceUrl { get; set; }
        ///
        /// The time this Event was sent.
        ///
        public DateTime EventDate { get; set; }
        ///
        /// The source of the Event.
        ///
        public string Source { get; set; }
        ///
        /// The IP Address of the actor that generated this Event.
        ///
        public string SourceIpAddress { get; set; }
        ///
        /// The type of the actor that generated this Event.
        ///
        public string ActorType { get; set; }
        ///
        /// The unique ID of the actor object that generated this Event.
        ///
        public string ActorSid { get; set; }
        ///
        /// The URL of the actor object that generated this Event.
        ///
        public string ActorUrl { get; set; }
        ///
        /// A dictionary of data pertaining to the specific event type.
        /// See the TaskRouter documentation for details.
        ///
        public Dictionary<string, string> EventData { get; set; }
    }
}


text:
/*
 * This software is distributed under BSD 3-clause license (see LICENSE file).
 *
 * Authors: Soumyajit De, Bjoern Esser
 */

#ifndef NORMAL_SAMPLER_H_
#define NORMAL_SAMPLER_H_

#include <shogun/lib/config.h>
#include <shogun/mathematics/linalg/ratapprox/tracesampler/TraceSampler.h>
#include <shogun/mathematics/RandomMixin.h>

namespace shogun
{
template<class T> class SGVector;

/** @brief Class that provides a sample method for Gaussian samples
 */
class NormalSampler : public RandomMixin<TraceSampler>
{
public:
	/** default constructor */
	NormalSampler();

	/** constructor
	 * @param dimension the dimension of the Gaussian sample vectors ~(0,I)
	 */
	NormalSampler(index_t dimension);

	/** destructor */
	~NormalSampler() override;

	/** method that generates the samples
	 * @param idx the index (this is effectively ignored)
	 * @return the sample vector
	 */
	SGVector<float64_t> sample(index_t idx) const override;

	/** precompute method that sets the num_samples of the base */
	void precompute() override;

	/** @return object name */
	const char* get_name() const override
	{
		return "NormalSampler";
	}
};

}

#endif // NORMAL_SAMPLER_H_


text:
shared_examples 'driver' do
  describe '#time' do
    before do
      allow(Time).to receive_message_chain(:now, :to_f).and_return(1397845595.5139461)
    end

    it 'is an array' do
      expect(subject.time).to be_an_instance_of(Array)
    end

    it 'has two elements' do
      expect(subject.time.count).to eq(2)
    end

    it 'has the current time in seconds' do
      expect(subject.time.first).to eq(1397845595)
    end

    it 'has the current leftover microseconds' do
      expect(subject.time.last).to eq(513946)
    end
  end
end


text:
package com.link_intersystems.lang.reflect.facadetestclasses;

public class LowerVisibility extends HigherVisibility {

	String privateMethod() {
		return null;
	}

	protected String packageMethod() {
		return super.packageMethod();
	}

	@Override
	public String protectedMethod() {
		return super.protectedMethod();
	}

	public String publicMethod() {
		return null;
	}

	public void packageToPublic() {

	}
}


text:
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<title>XPath Selector mixin for reproCSS</title>

XPath Selector Mixin Test

This is an H2

This H2 :has(span)

Test


text:
package org.unitime.timetable.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import org.unitime.timetable.defaults.ApplicationProperty;
import org.unitime.timetable.model.base.BasePitClass;
import org.unitime.timetable.util.Constants;

public class PitClass extends BasePitClass {

	/**
	 *
	 */
	private static final long serialVersionUID = 642241232877633526L;
	private float weeklyClassHours = -1;
	private float weeklyStudentClassHours = -1;

	public PitClass() {
		super();
	}

	private HashMap<Long, HashSet<java.util.Date>> locationPeriodUseMap = null;
	private Set<Long> locationPermanentIdList = null;
	private HashSet<java.util.Date> uniquePeriods = null;

	private float calculateWCHforLocationFromPeriods(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		float minutesInReportingHour = (standardMinutesInReportingHour == null ? ApplicationProperty.StandardMinutesInReportingHour.floatValue() : standardMinutesInReportingHour.floatValue());
		float weeksInReportingTerm = (standardWeeksInReportingTerm == null ? ApplicationProperty.StandardWeeksInReportingTerm.floatValue() : standardWeeksInReportingTerm);
		HashSet<java.util.Date> periods = getLocationPeriodUseMap().get(location);
		if (periods != null) {
			return(periods.size() * (Constants.SLOT_LENGTH_MIN * 1.0f) /  minutesInReportingHour	/ weeksInReportingTerm);
		} else {
			return(0f);
		}
	}

	public HashMap<Long, HashSet<java.util.Date>> getLocationPeriodUseMap(){
		if (locationPeriodUseMap == null){
			initializeRoomData();
		}
		return(locationPeriodUseMap);
	}

	public HashSet<java.util.Date> getUniquePeriods(){
		if (uniquePeriods == null){
			initializeRoomData();
		}
		return(uniquePeriods);
	}

	private void initializeRoomData() {

			locationPeriodUseMap = new HashMap<Long, HashSet<java.util.Date>>();
			for(PitClassEvent pce : this.getPitClassEvents()){
				for(PitClassMeeting pcm : pce.getPitClassMeetings()){
					if ((this.getPitSchedulingSubpart()
							.getPitInstrOfferingConfig()
							.getPitInstructionalOffering()
							.getPointInTimeData()
							.getSession()
							.getSessionBeginDateTime().compareTo(pcm.getMeetingDate()) <= 0)
							&& this.getPitSchedulingSubpart()
							.getPitInstrOfferingConfig()
							.getPitInstructionalOffering()
							.getPointInTimeData()
							.getSession()
							.getClassesEndDateTime().compareTo(pcm.getMeetingDate()) >= 0) {
						for(PitClassMeetingUtilPeriod pcmup : pcm.getPitClassMeetingUtilPeriods()){
							HashSet<java.util.Date> periods = locationPeriodUseMap.get(pcm.getLocationPermanentId());
							if (periods == null) {
								periods = new HashSet<java.util.Date>();
								locationPeriodUseMap.put(pcm.getLocationPermanentId(), periods);
							}
							periods.add(pcmup.periodDateTime());
						}
					}
				}
			}
			locationPermanentIdList = locationPeriodUseMap.keySet();

			uniquePeriods = new HashSet<java.util.Date>();
			for(HashSet<java.util.Date> periods : locationPeriodUseMap.values()) {
				uniquePeriods.addAll(periods);
			}

	}

	public Set<Long> getLocationPermanentIdList() {
		if(locationPermanentIdList == null) {
			initializeRoomData();
		}
		return(locationPermanentIdList);
	}

	public HashSet<java.util.Date> getPeriodsForLocation (Long location) {
		return(getLocationPeriodUseMap().get(location));
	}

	public boolean isOrganized() {
		return(getPitSchedulingSubpart().getItype().isOrganized().booleanValue());
	}

	public float countRoomsForPeriod(java.util.Date period) {
		float cnt = 0f;
		for(HashSet<java.util.Date> periods : getLocationPeriodUseMap().values()) {
			if (periods.contains(period)){
				cnt++;
			}
		}
		return(cnt);
	}

	private float calculateWSCHfromPeriodsForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		float minutesInReportingHour = (standardMinutesInReportingHour == null ? ApplicationProperty.StandardMinutesInReportingHour.floatValue() : standardMinutesInReportingHour.floatValue());
		float weeksInReportingTerm = (standardWeeksInReportingTerm == null ? ApplicationProperty.StandardWeeksInReportingTerm.floatValue() : standardWeeksInReportingTerm);

		HashSet<java.util.Date> periods = getLocationPeriodUseMap().get(location);

		float wrm = 0.0f;
		for(java.util.Date period : periods){
			wrm += ((Constants.SLOT_LENGTH_MIN * 1.0f) / countRoomsForPeriod(period));
		}

		return(wrm * getStudentEnrollments().size()  / minutesInReportingHour	/ weeksInReportingTerm);
	}

	private float calculateWCH(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		float minutesInReportingHour = (standardMinutesInReportingHour == null ? ApplicationProperty.StandardMinutesInReportingHour.floatValue() : standardMinutesInReportingHour.floatValue());
		float weeksInReportingTerm = (standardWeeksInReportingTerm == null ? ApplicationProperty.StandardWeeksInReportingTerm.floatValue() : standardWeeksInReportingTerm);

		return((Constants.SLOT_LENGTH_MIN * 1.0f) * getUniquePeriods().size()  / minutesInReportingHour	/ weeksInReportingTerm);
	}

	private float calculateWSCH(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		return(getAllWeeklyClassHours(standardMinutesInReportingHour, standardWeeksInReportingTerm) * this.getStudentEnrollments().size());
	}

	public float getOrganizedWeeklyRoomHoursFromUtilPeriodsForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(calculateWCHforLocationFromPeriods(location, standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getAllWeeklyRoomHoursFromUtilPeriodsForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		return(calculateWCHforLocationFromPeriods(location, standardMinutesInReportingHour, standardWeeksInReportingTerm));
	}

	public float getNotOrganizedWeeklyRoomHoursFromUtilPeriodsForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (!getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(calculateWCHforLocationFromPeriods(location, standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getOrganizedWeeklyClassHours(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(getAllWeeklyClassHours(standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getNotOrganizedWeeklyClassHours(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (!getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(getAllWeeklyClassHours(standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getOrganizedWeeklyStudentClassHours(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(getAllWeeklyStudentClassHours(standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getNotOrganizedWeeklyStudentClassHours(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (!getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(getAllWeeklyStudentClassHours(standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getAllWeeklyClassHours(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (this.weeklyClassHours < 0){
			this.weeklyClassHours = calculateWCH(standardMinutesInReportingHour, standardWeeksInReportingTerm);
		}
		return(this.weeklyClassHours);
	}

	public float getAllWeeklyStudentClassHours(Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (this.weeklyStudentClassHours < 0){
			this.weeklyStudentClassHours = calculateWSCH(standardMinutesInReportingHour, standardWeeksInReportingTerm);
		}
		return(this.weeklyStudentClassHours);
	}

	public float getAllWeeklyStudentClassHoursForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		return(calculateWSCHfromPeriodsForLocation(location, standardMinutesInReportingHour, standardWeeksInReportingTerm));
	}

	public float getOrganizedWeeklyStudentClassHoursForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(getAllWeeklyStudentClassHoursForLocation(location, standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public float getNotOrganizedWeeklyStudentClassHoursForLocation(Long location, Float standardMinutesInReportingHour, Float standardWeeksInReportingTerm){
		if (!getPitSchedulingSubpart().getItype().isOrganized().booleanValue()){
			return(getAllWeeklyStudentClassHoursForLocation(location, standardMinutesInReportingHour, standardWeeksInReportingTerm));
		} else {
			return(0);
		}
	}

	public HashMap<java.util.Date, Float> findPeriodEnrollmentsForCriteria(HashSet<Long> validRoomPermanentIds, ArrayList<Long> positionTypes){
		HashMap<java.util.Date, Float> periodEnrollmentMap = new HashMap<java.util.Date, Float>();

		float ratio = 0.0f;
		if (positionTypes != null && !positionTypes.isEmpty()) {
			if (this.getPitClassInstructors() == null || this.getPitClassInstructors().isEmpty()){
				if (positionTypes.contains(Long.valueOf(-1))){
					ratio = 1.0f;
				}
			} else {
				for(PitClassInstructor pci : this.getPitClassInstructors()) {
					if (pci.getPitDepartmentalInstructor().getPositionType() != null
							&& positionTypes.contains(pci.getPitDepartmentalInstructor().getPositionType().getUniqueId())) {
						ratio += (pci.getNormalizedPercentShare().intValue()/100.0f);
					} else if (pci.getPitDepartmentalInstructor().getPositionType() == null
							&& positionTypes.contains(Long.valueOf(-1))) {
						ratio += (pci.getNormalizedPercentShare().intValue()/100.0f);
					}
				}
			}
		} else {
			ratio = 1.0f;
		}

		HashSet<Long> applicableLocationPermananetIds = new HashSet<Long>();
		for (Long permId : getLocationPermanentIdList()){
			if(validRoomPermanentIds.contains(permId)) {
				applicableLocationPermananetIds.add(permId);
			}
		}
		if (applicableLocationPermananetIds.size() == getLocationPermanentIdList().size()){
			for(java.util.Date period : uniquePeriods){
				periodEnrollmentMap.put(period, (this.getEnrollment().intValue() * ratio));
			}
		} else {
			for(PitClassEvent pce : this.getPitClassEvents()){
				for (PitClassMeeting pcm : pce.getPitClassMeetings()){
					if ((this.getPitSchedulingSubpart()
						.getPitInstrOfferingConfig()
						.getPitInstructionalOffering()
						.getPointInTimeData()
						.getSession()
						.getSessionBeginDateTime().compareTo(pcm.getMeetingDate()) <= 0)
						&& this.getPitSchedulingSubpart()
						.getPitInstrOfferingConfig()
						.getPitInstructionalOffering()
						.getPointInTimeData()
						.getSession()
						.getClassesEndDateTime().compareTo(pcm.getMeetingDate()) >= 0) {

						if (applicableLocationPermananetIds.contains(pcm.getLocationPermanentId())) {
							for(PitClassMeetingUtilPeriod pcmup : pcm.getPitClassMeetingUtilPeriods()){
								periodEnrollmentMap.put(pcmup.periodDateTime(), (this.getEnrollment().intValue() * (1.0f / countRoomsForPeriod(pcmup.periodDateTime())) * ratio));
							}
						}
					}
				}
			}
		}

		return(periodEnrollmentMap);
	}
}


text:
export class EditorMemento {
  protected content:string;

  public constructor(content:string) {
    this.content = content;
  }

  public getContent():string {
    return this.content;
  }
}


text:
if [[ "$OSTYPE" == "darwin"* ]]; then
	realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
	ROOT=$(dirname $(dirname $(realpath "$0")))
else
	ROOT=$(dirname $(dirname $(readlink -f $0)))
fi

function code() {
	cd $ROOT

	if [[ "$OSTYPE" == "darwin"* ]]; then
		NAME=`node -p "require('./product.json').nameLong"`
		CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
	else
		NAME=`node -p "require('./product.json').applicationName"`
		CODE=".build/electron/$NAME"
	fi

	INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`"
	INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null`

	# Node modules
	test -d node_modules || ./scripts/npm.sh install

	# Get electron
	(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron

	# Build
	test -d out || ./node_modules/.bin/gulp compile

	# Configuration
	export NODE_ENV=development
	export VSCODE_DEV=1
	export VSCODE_CLI=1
	export ELECTRON_ENABLE_LOGGING=1
	export ELECTRON_ENABLE_STACK_DUMPING=1

	# Launch Code
	exec "$CODE" . "$@"
}

code "$@"


text:
esOverview.directive('esLayoutSwitch', function() {
	return {
		restrict: 'A', // es-layout-switch attribute
 		link: function(scope, element, attrs) {
	 		/*
			 * Set switch options based on the es-layout-switch attribute
			 * Should be a array of objects with label properties
			 */
			 scope.switchOptions = attrs.esLayoutSwitch.split(',');
		},
		controller: ['$scope', '$element', 'EsManager', function($scope, $element, EsManager) {
			// Set layout view value to uri
			$scope.applyLayout = function(value) {
				EsManager.setLayout(value);
			};
		}]
	};
});


text:
<?php foreach ($data->getResults() as $item): ?>
  <?php include_partial("event/searchResultItem", array('item' => $item)); ?>
<?php endforeach; ?>