text:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
    <servlet>
        <servlet-name>test</servlet-name>
        <servlet-class>com.exciseman.appengine.endpoints.Test</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>test</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>TaxCountry</servlet-name>
        <servlet-class>com.exciseman.appengine.endpoints.TaxCountry</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>TaxCountry</servlet-name>
        <url-pattern>/taxcountry</url-pattern>
    </servlet-mapping>
</web-app>


text:
package schema

import (
	"testing"

	. "github.com/zbo14/envoke/common"
	"github.com/zbo14/envoke/spec"
)

func TestSchema(t *testing.T) {
	composerId := BytesToHex(Checksum256(nil))
	composition := spec.NewComposition(composerId, "B3107S", "T-034.524.680-1", "EN", "untitled", "http://www.composition.com")
	if err := ValidateModel(composition, "composition"); err != nil {
		t.Error(err)
	}
	compositionId := BytesToHex(Checksum256(MustMarshalJSON(composition)))
	compositionRight := spec.NewCompositionRight(composerId, composerId, []string{"US"}, "2018-01-01", "2088-01-01")
	if err := ValidateModel(compositionRight, "right"); err != nil {
		t.Error(err)
	}
	compositionRightId := BytesToHex(Checksum256(MustMarshalJSON(compositionRight)))
	publisherId := BytesToHex(Checksum256([]byte{1, 2, 3}))
	publication := spec.NewPublication([]string{compositionId}, []string{compositionRightId}, "publication_name", publisherId)
	if err := ValidateModel(publication, "publication"); err != nil {
		t.Error(err)
	}
	publicationId := BytesToHex(Checksum256(MustMarshalJSON(publication)))
	licenseeId := BytesToHex(Checksum256([]byte{4, 5, 6}))
	mechanicalLicense := spec.NewMechanicalLicense(nil, compositionRightId, "", publicationId, licenseeId, publisherId, []string{"US"}, nil, "2018-01-01", "2024-01-01")
	if err := ValidateModel(mechanicalLicense, "mechanical_license"); err != nil {
		PrintJSON(mechanicalLicense)
		t.Error(err)
	}
}

redpajama_set_name: RedPajamaGithub


text:
require File.dirname(__FILE__) + '/../spec_helper'

describe CIAT::TestResult do
  before(:each) do
    @test = mock("test")
    @subresults = array_of_mocks(3, "subresult")
    @test_result = CIAT::TestResult.new(@test, @subresults)
  end

  it "should defer grouping to the test" do
    grouping = mock("grouping")
    @test.should_receive(:grouping).and_return(grouping)
    @test_result.grouping.should == grouping
  end

  it "should defer filename" do
    filename = mock("filename")
    @test.should_receive(:filename).with(:ciat).and_return(filename)
    @test_result.filename.should == filename
  end

  it "should defer element accessor" do
    element = mock("element")
    @test.should_receive(:element).
      with(:one, :two, :three).and_return(element)
    @test_result.element(:one, :two, :three).should == element
  end

  it "should get processors from subresults" do
    processors = array_of_mocks(3, "processor")
    @subresults[0].should_receive(:processor).and_return(processors[0])
    @subresults[1].should_receive(:processor).and_return(processors[1])
    @subresults[2].should_receive(:processor).and_return(processors[2])
    @test_result.processors.should == processors
  end
end


text:
package gen.response;

import com.jfreer.game.websocket.protocol.IResp;

/**
* 发牌
*/
public class PublishCardsResp extends IResp {

    /** 用户id */
    private int pid;

    /** 开始叫地主的位置 */
    private int nextTablePos;

    /** 手牌 */
    private int[] cards;

    public PublishCardsResp() {
        super(3);
    }

    public void setPid(int pid){
        this.pid=pid;
    }

    public int getPid(){
        return this.pid;
    }

    public void setNextTablePos(int nextTablePos){
        this.nextTablePos=nextTablePos;
    }

    public int getNextTablePos(){
        return this.nextTablePos;
    }

    public void setCards(int[] cards){
        this.cards=cards;
    }

    public int[] getCards(){
        return this.cards;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

	<!-- Appenders -->
	<appender name="console" class="org.apache.log4j.ConsoleAppender">
		<param name="Target" value="System.out" />
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="%-5p: %c - %m%n" />
		</layout>
	</appender>

	<appender name="default.file" class="org.apache.log4j.FileAppender">
		<param name="file" value="rest-demo.log" />
		<param name="append" value="true" />
		<param name="threshold" value="debug" />
		<layout class="org.apache.log4j.PatternLayout">
			<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] - %m%n" />
		</layout>
	</appender>

	<!-- Application Loggers -->
	<logger name="org.demo">
		<level value="debug" />
		<appender-ref ref="console" />
		<!--
		<appender-ref ref="default.file" />
		  -->
	</logger>

	<!-- 3rdparty Loggers -->
	<logger name="org.springframework.core">
		<level value="info" />
	</logger>

	<logger name="org.springframework.beans">
		<level value="info" />
	</logger>

	<logger name="org.springframework.context">
		<level value="info" />
	</logger>

	<logger name="org.springframework.web">
		<level value="info" />
	</logger>

    <logger name="org.springframework.security">
        <level value="debug" />
    </logger>

    <logger name="org.hibernate.validator">
        <level value="debug" />
    </logger>

	<!-- Root Logger -->
	<root>
		<priority value="error" />
		<!-- logg all packages
		<appender-ref ref="console" />
		 -->
		<appender-ref ref="default.file" />
	</root>

</log4j:configuration>


text:
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}

module HERMIT.Dictionary.AlphaConversion
    ( -- * Alpha-Renaming and Shadowing
      externals
      -- ** Alpha-Renaming
    , alphaR
    , alphaLamR
    , alphaCaseBinderR
    , alphaAltWithR
    , alphaAltVarsR
    , alphaAltR
    , alphaCaseR
    , alphaLetWithR
    , alphaLetVarsR
    , alphaLetR
    , alphaProgConsWithR
    , alphaProgConsIdsR
    , alphaProgConsR
    , alphaProgR
      -- ** Shadow Detection and Unshadowing
    , unshadowR
    , unshadowExprR
    , unshadowAltR
    , unshadowProgR
    , visibleVarsT
    , cloneVarAvoidingT
    , freshNameGenAvoiding
    , detectShadowsM
    , replaceVarR
    ) where

import Control.Arrow
import Control.Monad (liftM, liftM2)
import Data.Char (isDigit)
import Data.Function (on)
import Data.List (intersect, delete, elemIndex)
import Data.Maybe (listToMaybe)

import HERMIT.Core
import HERMIT.Context
import HERMIT.Kure
import HERMIT.External
import HERMIT.GHC
import HERMIT.Name
import HERMIT.Utilities(dupsBy)

import HERMIT.Dictionary.GHC hiding (externals)
import HERMIT.Dictionary.Common

import Prelude hiding (exp)

-----------------------------------------------------------------------

-- | Externals for alpha-renaming.
externals :: [External]
externals = map (.+ Deep)
         [  external "alpha" (promoteCoreR alphaR :: RewriteH LCore)
               [ "Renames the bound variables at the current node."]
         ,  external "alpha-lam" (promoteExprR . alphaLamR . Just :: String -> RewriteH LCore)
               [ "Renames the bound variable in a Lambda expression to the given name."]
         ,  external "alpha-lam" (promoteExprR  (alphaLamR Nothing) :: RewriteH LCore)
               [ "Renames the bound variable in a Lambda expression."]
         ,  external "alpha-case-binder" (promoteExprR . alphaCaseBinderR . Just :: String -> RewriteH LCore)
               [ "Renames the binder in a Case expression to the given name."]
         ,  external "alpha-case-binder" (promoteExprR (alphaCaseBinderR Nothing) :: RewriteH LCore)
               [ "Renames the binder in a Case expression."]
         ,  external "alpha-alt" (promoteAltR alphaAltR :: RewriteH LCore)
               [ "Renames all binders in a Case alternative."]
         ,  external "alpha-alt" (promoteAltR . alphaAltWithR :: [String] -> RewriteH LCore)
               [ "Renames all binders in a Case alternative using the user-provided list of new names."]
         ,  external "alpha-case" (promoteExprR alphaCaseR :: RewriteH LCore)
               [ "Renames all binders in a Case alternative."]
         ,  external "alpha-let" (promoteExprR . alphaLetWithR :: [String] -> RewriteH LCore)
               [ "Renames the bound variables in a Let expression using a list of suggested names."]
         ,  external "alpha-let" (promoteExprR alphaLetR :: RewriteH LCore)
               [ "Renames the bound variables in a Let expression."]
         ,  external "alpha-top" (promoteProgR . alphaProgConsWithR :: [String] -> RewriteH LCore)
               [ "Renames the bound identifiers in the top-level binding group at the head of the program using a list of suggested names."]
         ,  external "alpha-top" (promoteProgR alphaProgConsR :: RewriteH LCore)
               [ "Renames the bound identifiers in the top-level binding at the head of the program."]
         ,  external "alpha-prog" (promoteProgR alphaProgR :: RewriteH LCore)
               [ "Rename all top-level identifiers in the program."]
         ,  external "unshadow" (promoteCoreR unshadowR :: RewriteH LCore)
                [ "Rename local variables with manifestly unique names (x, x0, x1, ...)."]
         ]

-----------------------------------------------------------------------
--
-- freshNameGen is a function used in conjunction with cloneVarH, which clones an existing 'Var'.
-- But, what name should the new Id have?
-- cloneVarH generates a new Unique -- so we are positive that the new Var will be new,
-- but freshNameGen tries to assign a Name that will be meaningful to the user, and
-- not shadow other names in scope.
-- So,  we start with the name of the original Id, and add an integer suffix
--  x  goes to x0 or x1 or ...
-- and we do not want this newly generated name to shadow either:
-- 1.  Any free variable name in the active Expr; or
-- 2.  Any bound variables in context.

-- | Collect all visible variables (in the expression or the context).
visibleVarsT :: (BoundVars c, Monad m) => Transform c m CoreTC VarSet
visibleVarsT = -- TODO: implement freeVarsLCoreTC
               liftM2 unionVarSet boundVarsT (promoteT $ arr freeVarsCoreTC)

-- | If a name is provided, use that as the name of the new variable.
--   Otherwise modify the variable name making sure to /not/ clash with the given variables or any visible variables.
cloneVarAvoidingT :: (BoundVars c, MonadUnique m) => Var -> Maybe String -> [Var] -> Transform c m CoreTC Var
cloneVarAvoidingT v mn vs =
  do vvs <- visibleVarsT
     let nameModifier = freshNameGenAvoiding mn (extendVarSetList vvs vs)
     constT (cloneVarH nameModifier v)

-- | Use the optional argument if given, otherwise generate a new name avoiding clashes with the set of variables.
freshNameGenAvoiding :: Maybe String -> VarSet -> (String -> String)
freshNameGenAvoiding mn vs str = maybe (inventNames vs str) ((\(c:cs) -> reverse (c:(takeWhile (/='.') cs))) . reverse) mn
-- The 'Just' case above gives the unqualified portion of the name (properly handling the compose operator '.')

-- | Invent a new String based on the old one, but avoiding clashing with the given list of identifiers.
inventNames :: VarSet -> String -> String
inventNames curr old = head
                     [ nm
                     | nm <- old : [ base ++ show uq | uq <- [start ..] :: [Int] ]
                     , nm `notElem` names
                     ]
   where
           names = varSetToStrings curr
           nums = reverse $ takeWhile isDigit (reverse old)
           baseLeng = length $ drop (length nums) old
           base = take baseLeng old
           start = case reads nums of
                     [(v,_)] -> v + 1
                     _       -> 0

-- | Discard variables from the first set that do not shadow a variable in the second set.
shadowedBy :: VarSet -> VarSet -> VarSet
shadowedBy vs fvs = let fvNames = varSetToStrings fvs
                     in filterVarSet (\ v -> unqualifiedName v `elem` fvNames) vs

-- | Shadows are any duplicates in the list, or any occurrences of the list elements in the set.
detectShadowsM :: Monad m => [Var] -> VarSet -> m VarSet
detectShadowsM bs fvs = let ss = shadowedBy (mkVarSet bs) fvs `extendVarSetList` dupVars bs
                         in do guardMsg (not $ isEmptyVarSet ss) "No shadows detected."
                               return ss

-- | Rename local variables with manifestly unique names (x, x0, x1, ...).
--   Does not rename top-level definitions.
unshadowR :: ( AddBindings c, BoundVars c, ExtendPath c Crumb, HasEmptyContext c
             , ReadPath c Crumb, MonadCatch m, MonadUnique m )
          => Rewrite c m Core
unshadowR = setFailMsg "No shadows to eliminate." $
    anytdR (promoteExprR unshadowExprR <+ promoteAltR unshadowAltR <+ promoteProgR unshadowProgR)

unshadowExprR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb, MonadCatch m, MonadUnique m)
              => Rewrite c m CoreExpr
unshadowExprR = do
    bs  <- letVarsT <+ (liftM return (caseBinderIdT <+ lamVarT))
    fvs <- liftM2 unionVarSet boundVarsT (arr freeVarsExpr)
    ss  <- detectShadowsM bs fvs
    alphaLamR Nothing <+ alphaLetVarsR (varSetElems ss) <+ alphaCaseBinderR Nothing

unshadowAltR :: (BoundVars c, MonadCatch m, MonadUnique m)
             => Rewrite c m CoreAlt
unshadowAltR = do
    bs  <- arr altVars
    fvs <- liftM2 unionVarSet boundVarsT (arr freeVarsAlt)
    ss  <- detectShadowsM bs fvs
    alphaAltVarsR (varSetElems ss)

unshadowProgR :: (AddBindings c, BoundVars c, ExtendPath c Crumb, ReadPath c Crumb, MonadCatch m, MonadUnique m)
              => Rewrite c m CoreProg
unshadowProgR = do
    bs  <- progConsIdsT
    fvs <- liftM2 unionVarSet boundVarsT (arr freeVarsProg)
    ss  <- detectShadowsM bs fvs
    alphaProgConsIdsR (varSetElems ss)

dupVars :: [Var] -> [Var]
dupVars = dupsBy ((==) `on` unqualifiedName)

-----------------------------------------------------------------------

-- Maybe this should be defined in Dictionary.GHC.

-- | Replace all occurrences of a specified variable.
--   Arguments are the variable to replace and the replacement variable, respectively.
replaceVarR :: (Injection a Core, MonadCatch m) => Var -> Var -> Rewrite c m a
replaceVarR v v' = extractR $ tryR $ substR v $ varToCoreExpr v'

-- TODO: Experimental
replaceRecBindVarR :: Monad m => Id -> Id -> Rewrite c m CoreBind
replaceRecBindVarR v v' =
   do Rec ies <- idR
      let (is,es) = unzip ies
      case elemIndex v is of
        Nothing -> fail "Specified identifier does not occur in the current recursive binding group."
        Just n  -> let is0       = delete v is
                       (is1,is2) = splitAt n is0
                       is'       = is1 ++ v' : is2
                       es'       = map (substCoreExpr v (Var v')) es
                       -- TODO.  Do we need to initialize the emptySubst with bindFreeVars?
                       sub       = extendSubst emptySubst v (Var v')
                   in return $ snd $ substBind sub (Rec (zip is' es'))

                   -- let is0       = delete v is
                   --     emptySub  = mkEmptySubst $ mkInScopeSet $ unionVarSets (map (localFreeVarsExpr . Var) is0)
                   --     sub       = extendSubst emptySub v (Var v')
                   --     (is1,is2) = splitAt n (snd $ substRecBndrs sub is0)
                   --     is'       = is1 ++ v' : is2
                   --     es'       = map (substCoreExpr v (Var v')) es
                   -- in return $ Rec (zip is' es')

-----------------------------------------------------------------------

-- | Alpha rename a lambda binder.  Optionally takes a suggested new name.
alphaLamR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
          => Maybe String -> Rewrite c m CoreExpr
alphaLamR mn = setFailMsg (wrongFormForAlpha "Lam v e") $
              do v  <- lamVarT
                 v' <- extractT (cloneVarAvoidingT v mn [v])
                 lamAnyR (return v') (replaceVarR v v')

-----------------------------------------------------------------------

-- | Alpha rename a case binder.  Optionally takes a suggested new name.
alphaCaseBinderR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                 => Maybe String -> Rewrite c m CoreExpr
alphaCaseBinderR mn = setFailMsg (wrongFormForAlpha "Case e i ty alts") $
                     do i  <- caseBinderIdT
                        i' <- extractT (cloneVarAvoidingT i mn [i])
                        caseAnyR idR (return i') idR (\ _ -> replaceVarR i i')

-----------------------------------------------------------------------

-- | Rename the specified variable in a case alternative.  Optionally takes a suggested new name.
alphaAltVarR :: (BoundVars c, MonadCatch m, MonadUnique m)
             => Maybe String -> Var -> Rewrite c m CoreAlt
alphaAltVarR mn v = do
    (con, vs, rhs) <- idR
    v' <- extractT (cloneVarAvoidingT v mn vs)

    -- This is a bit of a hack. We include all the binders *after* v in the call to substAltR,
    -- then put the binders before v, and v', back on the front. The use of substAltR this way,
    -- handles the case where v is a type binder which substitutes into the types of bs'.
    -- It's a hack because we depend on substAltR not noticing that the constructor is not applied
    -- to enough binders.
    case break (==v) vs of
        (bs,_:bs') -> let (con',bs'',rhs') = substCoreAlt v (varToCoreExpr v') (con,bs',rhs)
                       in return (con',bs ++ (v':bs''),rhs')
        _ -> fail "pattern binder not present."

-- | Rename the specified variables in a case alternative, using the suggested names where provided.
-- Suggested names *must* be provided in left-to-right order matching the order of the alt binders.
alphaAltVarsWithR :: (BoundVars c, MonadCatch m, MonadUnique m)
                  => [(Maybe String,Var)] -> Rewrite c m CoreAlt
alphaAltVarsWithR = andR . map (uncurry alphaAltVarR) . reverse -- note: right-to-left so type subst aren't undone

-- | Rename the variables bound in a case alternative with the given list of suggested names.
alphaAltWithR :: (BoundVars c, MonadCatch m, MonadUnique m)
              => [String] -> Rewrite c m CoreAlt
alphaAltWithR ns =
  do vs <- arr altVars
     alphaAltVarsWithR $ zip (map Just ns) vs

-- | Rename the specified variables in a case alternative.
alphaAltVarsR :: (BoundVars c, MonadCatch m, MonadUnique m)
              => [Var] -> Rewrite c m CoreAlt
alphaAltVarsR vs =
  do bs <- arr altVars
     alphaAltVarsWithR (zip (repeat Nothing) (bs `intersect` vs))

-- | Rename all identifiers bound in a case alternative.
alphaAltR :: (BoundVars c, MonadCatch m, MonadUnique m)
          => Rewrite c m CoreAlt
alphaAltR = arr altVars >>= alphaAltVarsR

-----------------------------------------------------------------------

-- | Rename all identifiers bound in a case expression.
alphaCaseR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
           => Rewrite c m CoreExpr
alphaCaseR = alphaCaseBinderR Nothing >+> caseAllR idR idR idR (const alphaAltR)

-----------------------------------------------------------------------

-- | Alpha rename a non-recursive let binder.  Optionally takes a suggested new name.
alphaLetNonRecR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                => Maybe String -> Rewrite c m CoreExpr
alphaLetNonRecR mn = setFailMsg (wrongFormForAlpha "Let (NonRec v e1) e2") $
                    do v  <- letNonRecVarT
                       v' <- extractT (cloneVarAvoidingT v mn [v])
                       letNonRecAnyR (return v') idR (replaceVarR v v')

-- | Alpha rename a non-recursive let binder if the variable appears in the argument list.  Optionally takes a suggested new name.
alphaLetNonRecVarsR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                    => Maybe String -> [Var] -> Rewrite c m CoreExpr
alphaLetNonRecVarsR mn vs = whenM (liftM (`elem` vs) letNonRecVarT) (alphaLetNonRecR mn)

-- TODO: Maybe it would be more efficient to rename all the Ids at once, rather than one by one?

-- | Rename the specified identifiers in a recursive let, using the suggested names where provided.
alphaLetRecIdsWithR :: forall c m. ( ExtendPath c Crumb, ReadPath c Crumb, AddBindings c
                                   , BoundVars c, MonadCatch m, MonadUnique m )
                    => [(Maybe String,Id)] -> Rewrite c m CoreExpr
alphaLetRecIdsWithR = andR . map (uncurry alphaLetRecIdR)
  where
    -- | Rename the specified identifier bound in a recursive let.  Optionally takes a suggested new name.
    alphaLetRecIdR :: Maybe String -> Id -> Rewrite c m CoreExpr
    alphaLetRecIdR mn i = setFailMsg (wrongFormForAlpha "Let (Rec bs) e") $
                     do is <- letRecIdsT
                        i' <- extractT (cloneVarAvoidingT i mn is)
                        letAnyR (replaceRecBindVarR i i') (replaceVarR i i')

-- | Rename the identifiers bound in a Let with the given list of suggested names.
alphaLetWithR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
              => [String] -> Rewrite c m CoreExpr
alphaLetWithR ns = alphaLetNonRecR (listToMaybe ns)
                  <+ (letRecIdsT >>= (alphaLetRecIdsWithR . zip (map Just ns)))

-- | Rename the specified variables bound in a let.
alphaLetVarsR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
              => [Var] -> Rewrite c m CoreExpr
alphaLetVarsR vs = alphaLetNonRecVarsR Nothing vs
                   <+ (do bs <- letT (arr bindVars) successT const
                          alphaLetRecIdsWithR (zip (repeat Nothing) (bs `intersect` vs))
                      )

-- | Rename all identifiers bound in a Let.
alphaLetR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
          => Rewrite c m CoreExpr
alphaLetR = letVarsT >>= alphaLetVarsR

-----------------------------------------------------------------------

-- | Alpha rename a non-recursive top-level binder.  Optionally takes a suggested new name.
alphaProgConsNonRecR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                     => Maybe String -> Rewrite c m CoreProg
alphaProgConsNonRecR mn = setFailMsg (wrongFormForAlpha "ProgCons (NonRec v e) p") $
                    do i <- progConsNonRecIdT
                       guardMsg (not $ isExportedId i) ("Identifier " ++ unqualifiedName i ++ " is exported, and thus cannot be alpha-renamed.")
                       i' <- extractT (cloneVarAvoidingT i mn [i])
                       consNonRecAnyR (return i') idR (replaceVarR i i')

-- | Alpha rename a non-recursive top-level binder if the identifier appears in the argument list.  Optionally takes a suggested new name.
alphaProgConsNonRecIdsR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                        => Maybe String -> [Id] -> Rewrite c m CoreProg
alphaProgConsNonRecIdsR mn is = whenM (liftM (`elem` is) progConsNonRecIdT) (alphaProgConsNonRecR mn)

-- TODO: Maybe it would be more efficient to rename all the Ids at once, rather than one by one?

-- | Rename the specified identifiers in a recursive top-level binding at the head of a program, using the suggested names where provided.
alphaProgConsRecIdsWithR :: forall c m. ( ExtendPath c Crumb, ReadPath c Crumb, AddBindings c
                                        , BoundVars c, MonadCatch m, MonadUnique m )
                         => [(Maybe String,Id)] -> Rewrite c m CoreProg
alphaProgConsRecIdsWithR = andR . map (uncurry alphaProgConsRecIdR) . filter (not . isExportedId . snd)
  where
    -- | Rename the specified identifier bound in a recursive top-level binder.  Optionally takes a suggested new name.
    alphaProgConsRecIdR :: Maybe String -> Id -> Rewrite c m CoreProg
    alphaProgConsRecIdR mn i =  setFailMsg (wrongFormForAlpha "ProgCons (Rec bs) p") $
                      do is <- progConsRecIdsT
                         i' <- extractT (cloneVarAvoidingT i mn is)
                         progConsAnyR (replaceRecBindVarR i i') (replaceVarR i i')

-- | Rename the identifiers bound in the top-level binding at the head of the program with the given list of suggested names.
alphaProgConsWithR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                   => [String] -> Rewrite c m CoreProg
alphaProgConsWithR ns = alphaProgConsNonRecR (listToMaybe ns)
                        <+ (progConsRecIdsT >>= (alphaProgConsRecIdsWithR . zip (map Just ns)))

-- | Rename the specified variables bound in the top-level binding at the head of the program.
alphaProgConsIdsR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
                  => [Id] -> Rewrite c m CoreProg
alphaProgConsIdsR vs = alphaProgConsNonRecIdsR Nothing vs
                       <+ (do bs <- progConsT (arr bindVars) successT const
                              alphaProgConsRecIdsWithR (zip (repeat Nothing) (bs `intersect` vs))
                          )

-- | Rename all identifiers bound in the top-level binding at the head of the program.
alphaProgConsR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
               => Rewrite c m CoreProg
alphaProgConsR = progConsIdsT >>= alphaProgConsIdsR

-----------------------------------------------------------------------

-- | Rename all identifiers bound at the top-level.
alphaProgR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
           => Rewrite c m CoreProg
alphaProgR = alphaProgConsR >+> progConsAllR idR alphaProgR

-----------------------------------------------------------------------

-- | Alpha rename any bindings at this node.  Note: does not rename case alternatives unless invoked on the alternative.
alphaR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, BoundVars c, MonadCatch m, MonadUnique m)
       => Rewrite c m Core
alphaR = setFailMsg "Cannot alpha-rename here." $
           promoteExprR (alphaLamR Nothing <+ alphaCaseBinderR Nothing <+ alphaLetR)
        <+ promoteAltR alphaAltR
        <+ promoteProgR alphaProgConsR

-- TODO: Alpha rewrites need better error messages.  Currently the use of (<+) leads to incorrect error reporting.
--       Though really, we first need to improve KURE to have a version of (<+) that maintains the existing error message in the case of non-matching constructors henceforth.

-- TODO 2: Also, we should be able to rename inside types and coercions.

-- TODO 3: Also, we should be able to rename lemma quantifiers

-----------------------------------------------------------------------

wrongFormForAlpha :: String -> String
wrongFormForAlpha s = "Cannot alpha-rename, " ++ wrongExprForm s

-----------------------------------------------------------------------


text:
package com.elbeesee.poink.transreptor;

/**
 *
 * Transreptor ReadableBinaryStream to HSSFWorkbook.
 *
 * @author Tom Hicks. 09/06/2008.
 * @author Tom Geudens. 2013/08/25.
 *
 */

// The usual suspects for a transreptor.
import org.netkernel.layer0.nkf.*;
import org.netkernel.module.standard.endpoint.StandardTransreptorImpl;

// Processing
import java.io.InputStream;

import org.netkernel.layer0.representation.IReadableBinaryStreamRepresentation;

import com.elbeesee.poink.representation.IHSSFWorkbookRepresentation;
import com.elbeesee.poink.representation.HSSFWorkbookImplementation;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class ReadableBinaryStreamToHSSFWorkbook extends StandardTransreptorImpl {
	public ReadableBinaryStreamToHSSFWorkbook() {
	    this.declareThreadSafe();
	    this.declareDescription("create apache poi workbook from binary stream");
	    this.declareFromRepresentation(IReadableBinaryStreamRepresentation.class);
	    this.declareToRepresentation(IHSSFWorkbookRepresentation.class);
	}

	public void onTransrept (INKFRequestContext aContext) throws Exception {
		IReadableBinaryStreamRepresentation aRBS = (IReadableBinaryStreamRepresentation)aContext.sourcePrimary(IReadableBinaryStreamRepresentation.class);
		InputStream vInputStream = aRBS.getInputStream();
		HSSFWorkbook vWorkbook = new HSSFWorkbook(vInputStream);
		IHSSFWorkbookRepresentation vRepresentation = new HSSFWorkbookImplementation(vWorkbook);

		INKFResponse vResponse = aContext.createResponseFrom(vRepresentation);
		vResponse.setExpiry(INKFResponse.EXPIRY_DEPENDENT);
	}
}


text:
For this assignment, I'd like for you to create several elements that have various `display` and `position` styles. **Remember, the only way to find out which styles you need is to submit the assignment!**

Create a new page `assignment7.html` on your site44 site and run `submit 7 my-site44-site.site44.com/assignment7.html`.

Happy styling!


text:
package com.opensymphony.workflow.util.ejb.local;

import com.opensymphony.module.propertyset.PropertySet;

import com.opensymphony.workflow.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.lang.reflect.Method;

import java.util.Map;

import javax.ejb.EJBLocalHome;

import javax.naming.InitialContext;

import javax.rmi.PortableRemoteObject;

/**
 *
 *
 * @author $Author: hani $
 * @version $Revision: 1.3 $
 */
public class LocalEJBCondition implements Condition {
    //~ Static fields/initializers /////////////////////////////////////////////

    private static final Log log = LogFactory.getLog(LocalEJBCondition.class);

    //~ Methods ////////////////////////////////////////////////////////////////

    public boolean passesCondition(Map transientVars, Map args, PropertySet ps) throws WorkflowException {
        String ejbLocation = (String) args.get(AbstractWorkflow.EJB_LOCATION);

        Condition sessionBean = null;

        try {
            EJBLocalHome home = (EJBLocalHome) PortableRemoteObject.narrow(new InitialContext().lookup(ejbLocation), EJBLocalHome.class);
            Method create = home.getClass().getMethod("create", new Class[0]);
            sessionBean = (Condition) create.invoke(home, new Object[0]);
        } catch (Exception e) {
            String message = "Could not get handle to Local Condition: " + ejbLocation;
            log.error(message, e);
            throw new WorkflowException(message, e);
        }

        return sessionBean.passesCondition(transientVars, args, ps);
    }
}


text:
<action>
    <field name="name">group</field>
    <field name="string">Groups</field>
    <field name="view">multi_view</field>
    <field name="model">user.group</field>
    <field name="menu">gen_menu</field>
</action>


text:
package com.opengamma.web.security;

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

import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;

import com.google.common.base.Joiner;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.opengamma.core.id.ExternalSchemes;
import com.opengamma.financial.security.FinancialSecurity;
import com.opengamma.financial.security.FinancialSecurityVisitorSameValueAdapter;
import com.opengamma.financial.security.equity.EquitySecurity;
import com.opengamma.financial.security.future.AgricultureFutureSecurity;
import com.opengamma.financial.security.future.BondFutureDeliverable;
import com.opengamma.financial.security.future.BondFutureSecurity;
import com.opengamma.financial.security.future.EnergyFutureSecurity;
import com.opengamma.financial.security.future.EquityFutureSecurity;
import com.opengamma.financial.security.future.EquityIndexDividendFutureSecurity;
import com.opengamma.financial.security.future.FXFutureSecurity;
import com.opengamma.financial.security.future.FutureSecurity;
import com.opengamma.financial.security.future.IndexFutureSecurity;
import com.opengamma.financial.security.future.InterestRateFutureSecurity;
import com.opengamma.financial.security.future.MetalFutureSecurity;
import com.opengamma.financial.security.future.StockFutureSecurity;
import com.opengamma.id.ExternalId;
import com.opengamma.id.ExternalIdBundle;
import com.opengamma.util.JodaBeanSerialization;
import com.opengamma.util.time.Expiry;

/**
 * Gets expected Json document for different security types
 */
/* package */ class ExpectedSecurityJsonProvider extends FinancialSecurityVisitorSameValueAdapter<JSONObject> {

  ExpectedSecurityJsonProvider() {
    super(null);
  }

  private static final String TEMPLATE_DATA = "template_data";

  @Override
  public JSONObject visitEquitySecurity(EquitySecurity security) {
    Map<String, Object> secMap = Maps.newHashMap();

    Map<String, Object> templateData = Maps.newHashMap();
    addDefaultFields(security, templateData);

    if (StringUtils.isNotBlank(security.getShortName())) {
      templateData.put("shortName", security.getShortName());
    }
    if (StringUtils.isNotBlank(security.getExchange())) {
      templateData.put("exchange", security.getExchange());
    }
    if (security.getCurrency() != null && StringUtils.isNotBlank(security.getCurrency().getCode())) {
      templateData.put("currency", security.getCurrency().getCode());
    }
    if (StringUtils.isNotBlank(security.getCompanyName())) {
      templateData.put("companyName", security.getCompanyName());
    }
    if (StringUtils.isNotBlank(security.getExchangeCode())) {
      templateData.put("exchangeCode", security.getExchangeCode());
    }
    if (security.getGicsCode() != null && StringUtils.isNotBlank(security.getGicsCode().toString())) {
      templateData.put("gicsCode", security.getGicsCode().toString());
    }
    secMap.put(TEMPLATE_DATA, templateData);
    addSecurityXml(security, secMap);
    addExternalIds(security, secMap);
    return new JSONObject(secMap);
  }

  @Override
  public JSONObject visitAgricultureFutureSecurity(AgricultureFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitBondFutureSecurity(BondFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitEnergyFutureSecurity(EnergyFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitEquityFutureSecurity(EquityFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitEquityIndexDividendFutureSecurity(EquityIndexDividendFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitFXFutureSecurity(FXFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitIndexFutureSecurity(IndexFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitInterestRateFutureSecurity(InterestRateFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitMetalFutureSecurity(MetalFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  @Override
  public JSONObject visitStockFutureSecurity(StockFutureSecurity security) {
    return visitFutureSecurity(security);
  }

  private JSONObject visitFutureSecurity(FutureSecurity security) {
    JSONObject result = security.accept(new FinancialSecurityVisitorSameValueAdapter<JSONObject>(null) {

      @Override
      public JSONObject visitBondFutureSecurity(BondFutureSecurity security) {
        Map<String, Object> secMap = Maps.newHashMap();

        Map<String, Object> templateData = Maps.newHashMap();
        addDefaultFields(security, templateData);
        addExpiry(templateData, security.getExpiry());
        templateData.put("firstDeliveryDate", security.getFirstDeliveryDate().toString());
        templateData.put("lastDeliveryDate", security.getLastDeliveryDate().toString());
        if (StringUtils.isNotBlank(security.getTradingExchange())) {
          templateData.put("tradingExchange", security.getTradingExchange());
        }
        if (StringUtils.isNotBlank(security.getSettlementExchange())) {
          templateData.put("settlementExchange", security.getSettlementExchange());
        }
        if (security.getCurrency() != null && StringUtils.isNotBlank(security.getCurrency().getCode())) {
          templateData.put("currency", security.getCurrency().getCode());
        }
        List<BondFutureDeliverable> basket = security.getBasket();
        if (!basket.isEmpty()) {
          Map<String, String> underlyingBond = Maps.newHashMap();
          for (BondFutureDeliverable bondFutureDeliverable : basket) {
            SortedSet<String> idSet = Sets.newTreeSet();
            for (ExternalId id : bondFutureDeliverable.getIdentifiers()) {
              idSet.add(id.getScheme().toString() + "-" + id.getValue());
            }
            String id = "[" + Joiner.on(",").join(idSet) + "]";
            underlyingBond.put(id, String.valueOf(bondFutureDeliverable.getConversionFactor()));
          }
          templateData.put("underlyingBond", underlyingBond);
        }
        templateData.put("unitAmount", security.getUnitAmount());
        secMap.put(TEMPLATE_DATA, templateData);
        addSecurityXml(security, secMap);
        addExternalIds(security, secMap);
        return new JSONObject(secMap);
      }
    });
    return result;
  }

  private void addSecurityXml(FinancialSecurity security, Map<String, Object> secMap) {
    String secXml = JodaBeanSerialization.serializer(true).xmlWriter().write(security, true);
    secMap.put("securityXml", secXml);
  }

  private void addExternalIds(FinancialSecurity security, Map<String, Object> secMap) {
    Map<String, String> identifiers = Maps.newHashMap();
    ExternalIdBundle externalIdBundle = security.getExternalIdBundle();
    if (externalIdBundle.getExternalId(ExternalSchemes.BLOOMBERG_BUID) != null) {
      identifiers.put(ExternalSchemes.BLOOMBERG_BUID.getName(), ExternalSchemes.BLOOMBERG_BUID.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.BLOOMBERG_BUID));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.BLOOMBERG_TICKER) != null) {
      identifiers.put(ExternalSchemes.BLOOMBERG_TICKER.getName(), ExternalSchemes.BLOOMBERG_TICKER.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.BLOOMBERG_TICKER));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.CUSIP) != null) {
      identifiers.put(ExternalSchemes.CUSIP.getName(), ExternalSchemes.CUSIP.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.CUSIP));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.ISIN) != null) {
      identifiers.put(ExternalSchemes.ISIN.getName(), ExternalSchemes.ISIN.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.ISIN));
    }
    if (externalIdBundle.getExternalId(ExternalSchemes.SEDOL1) != null) {
      identifiers.put(ExternalSchemes.SEDOL1.getName(), ExternalSchemes.SEDOL1.getName() + "-" + externalIdBundle.getValue(ExternalSchemes.SEDOL1));
    }
    secMap.put("identifiers", identifiers);
  }

  private void addDefaultFields(FinancialSecurity security, Map<String, Object> templateData) {
    if (StringUtils.isNotBlank(security.getName())) {
      templateData.put("name", security.getName());
    }
    if (StringUtils.isNotBlank(security.getSecurityType())) {
      templateData.put("securityType", security.getSecurityType());
    }
    if (security.getUniqueId() != null && security.getUniqueId().getObjectId() != null && StringUtils.isNotBlank(security.getUniqueId().getObjectId().toString())) {
      templateData.put("object_id", security.getUniqueId().getObjectId().toString());
    }
    if (security.getUniqueId() != null && StringUtils.isNotBlank(security.getUniqueId().getVersion())) {
      templateData.put("version_id", security.getUniqueId().getVersion());
    }
    if (security.getAttributes() != null && !security.getAttributes().isEmpty()) {
      templateData.put("attributes", security.getAttributes());
    }
  }

  private void addExpiry(Map<String, Object> templateData, Expiry expiry) {
    Map<String, Object> expiryDateMap = Maps.newHashMap();
    expiryDateMap.put("datetime", expiry.getExpiry().toOffsetDateTime().toString());
    expiryDateMap.put("timezone", expiry.getExpiry().getZone().toString());
    templateData.put("expiryAccuracy", expiry.getAccuracy().toString().replace("_", " "));
    templateData.put("expirydate", expiryDateMap);
  }

}


text:
var tests = [

  function completeBeforeBegin() {
    var expectedError =
        extensionId + " does not match a previous call to beginInstall";
    chrome.webstorePrivate.completeInstall(extensionId,
                                           callbackFail(expectedError));
  },

  function invalidID() {
    var expectedError = "Invalid id";
    var id = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
    chrome.webstorePrivate.beginInstallWithManifest(
        id, "", getManifest(), callbackFail(expectedError));
  },

  function missingVersion() {
    var manifestObj = JSON.parse(getManifest());
    delete manifestObj["version"];
    var manifest = JSON.stringify(manifestObj);
    chrome.webstorePrivate.beginInstallWithManifest(
        extensionId,
        "",
        manifest,
        callbackFail("Invalid manifest", function(result) {
      assertEq("manifest_error", result);
    }));
  },

  function successfulInstall() {
    // See things through all the way to a successful install, and then we
    // uninstall the extension to clean up.
    listenOnce(chrome.management.onInstalled, function(info) {
      assertEq(info.id, extensionId);
      chrome.management.uninstall(extensionId, callbackPass());
    });

    var manifest = getManifest();
    getIconData(function(icon) {

      // Begin installing.
      chrome.webstorePrivate.beginInstallWithManifest(extensionId,
                                                      icon,
                                                      manifest,
                                                      function(result) {
        assertNoLastError();
        assertEq(result, "");

        // Now complete the installation.
        chrome.webstorePrivate.completeInstall(extensionId, function() {
          assertNoLastError();
        });
      });
    });
  }
];

runTests(tests);


text:
namespace cc {
class ImageSerializationProcessor;

namespace {

// We don't perform per-layer solid color analysis when there are too many skia
// operations.
const int kOpCountThatIsOkToAnalyze = 10;

bool DisplayItemsTracingEnabled() {
  bool tracing_enabled;
  TRACE_EVENT_CATEGORY_GROUP_ENABLED(
      TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items"), &tracing_enabled);
  return tracing_enabled;
}

const int kDefaultNumDisplayItemsToReserve = 100;

}  // namespace

scoped_refptr<DisplayItemList> DisplayItemList::Create(
    const gfx::Rect& layer_rect,
    const DisplayItemListSettings& settings) {
  return make_scoped_refptr(new DisplayItemList(
      layer_rect, settings,
      !settings.use_cached_picture || DisplayItemsTracingEnabled()));
}

scoped_refptr<DisplayItemList> DisplayItemList::CreateFromProto(
    const proto::DisplayItemList& proto,
    ImageSerializationProcessor* image_serialization_processor) {
  gfx::Rect layer_rect = ProtoToRect(proto.layer_rect());
  scoped_refptr<DisplayItemList> list =
      DisplayItemList::Create(ProtoToRect(proto.layer_rect()),
                              DisplayItemListSettings(proto.settings()));

  for (int i = 0; i < proto.items_size(); i++) {
    const proto::DisplayItem& item_proto = proto.items(i);
    DisplayItemProtoFactory::AllocateAndConstruct(
        layer_rect, list.get(), item_proto, image_serialization_processor);
  }

  list->Finalize();

  return list;
}

DisplayItemList::DisplayItemList(gfx::Rect layer_rect,
                                 const DisplayItemListSettings& settings,
                                 bool retain_individual_display_items)
    : items_(LargestDisplayItemSize(),
             LargestDisplayItemSize() * kDefaultNumDisplayItemsToReserve),
      settings_(settings),
      retain_individual_display_items_(retain_individual_display_items),
      layer_rect_(layer_rect),
      is_suitable_for_gpu_rasterization_(true),
      approximate_op_count_(0),
      picture_memory_usage_(0) {
  if (settings_.use_cached_picture) {
    SkRTreeFactory factory;
    recorder_.reset(new SkPictureRecorder());
    canvas_ = skia::SharePtr(recorder_->beginRecording(
        layer_rect_.width(), layer_rect_.height(), &factory));
    canvas_->translate(-layer_rect_.x(), -layer_rect_.y());
    canvas_->clipRect(gfx::RectToSkRect(layer_rect_));
  }
}

DisplayItemList::~DisplayItemList() {
}

void DisplayItemList::ToProtobuf(
    proto::DisplayItemList* proto,
    ImageSerializationProcessor* image_serialization_processor) {
  // The flattened SkPicture approach is going away, and the proto
  // doesn't currently support serializing that flattened picture.
  DCHECK(retain_individual_display_items_);

  RectToProto(layer_rect_, proto->mutable_layer_rect());
  settings_.ToProtobuf(proto->mutable_settings());

  DCHECK_EQ(0, proto->items_size());
  for (const auto& item : items_)
    item.ToProtobuf(proto->add_items(), image_serialization_processor);
}

void DisplayItemList::Raster(SkCanvas* canvas,
                             SkPicture::AbortCallback* callback,
                             const gfx::Rect& canvas_target_playback_rect,
                             float contents_scale) const {
  if (!settings_.use_cached_picture) {
    canvas->save();
    canvas->scale(contents_scale, contents_scale);
    for (const auto& item : items_)
      item.Raster(canvas, canvas_target_playback_rect, callback);
    canvas->restore();
  } else {
    DCHECK(picture_);

    canvas->save();
    canvas->scale(contents_scale, contents_scale);
    canvas->translate(layer_rect_.x(), layer_rect_.y());
    if (callback) {
      // If we have a callback, we need to call |draw()|, |drawPicture()|
      // doesn't take a callback.  This is used by |AnalysisCanvas| to early
      // out.
      picture_->playback(canvas, callback);
    } else {
      // Prefer to call |drawPicture()| on the canvas since it could place the
      // entire picture on the canvas instead of parsing the skia operations.
      canvas->drawPicture(picture_.get());
    }
    canvas->restore();
  }
}

void DisplayItemList::ProcessAppendedItem(const DisplayItem* item) {
  if (settings_.use_cached_picture) {
    DCHECK(canvas_);
    item->Raster(canvas_.get(), gfx::Rect(), nullptr);
  }
  if (!retain_individual_display_items_) {
    items_.Clear();
  }
}

void DisplayItemList::RasterIntoCanvas(const DisplayItem& item) {
  DCHECK(canvas_);
  DCHECK(!retain_individual_display_items_);

  item.Raster(canvas_.get(), gfx::Rect(), nullptr);
}

bool DisplayItemList::RetainsIndividualDisplayItems() const {
  return retain_individual_display_items_;
}

void DisplayItemList::Finalize() {
  // TODO(dtrainor): Need to deal with serializing visual_rects_.
  // http://crbug.com/568757.
  DCHECK(!retain_individual_display_items_ ||
         items_.size() == visual_rects_.size())
      << "items.size() " << items_.size() << " visual_rects.size() "
      << visual_rects_.size();

  // TODO(vmpstr): Build and make use of an RTree from the visual
  // rects. For now we just clear them out since we won't ever need
  // them to stick around post-Finalize. http://crbug.com/527245
  // This clears both the vector and the vector's capacity, since visual_rects_
  // won't be used anymore.
  std::vector<gfx::Rect>().swap(visual_rects_);

  if (settings_.use_cached_picture) {
    // Convert to an SkPicture for faster rasterization.
    DCHECK(settings_.use_cached_picture);
    DCHECK(!picture_);
    picture_ = skia::AdoptRef(recorder_->endRecordingAsPicture());
    DCHECK(picture_);
    picture_memory_usage_ =
        SkPictureUtils::ApproximateBytesUsed(picture_.get());
    recorder_.reset();
    canvas_.clear();
    is_suitable_for_gpu_rasterization_ =
        picture_->suitableForGpuRasterization(nullptr);
  }
}

bool DisplayItemList::IsSuitableForGpuRasterization() const {
  return is_suitable_for_gpu_rasterization_;
}

int DisplayItemList::ApproximateOpCount() const {
  return approximate_op_count_;
}

size_t DisplayItemList::ApproximateMemoryUsage() const {
  // We double-count in this case. Produce zero to avoid being misleading.
  if (settings_.use_cached_picture && retain_individual_display_items_)
    return 0;

  DCHECK(!settings_.use_cached_picture || picture_);

  size_t memory_usage = sizeof(*this);

  size_t external_memory_usage = 0;
  if (retain_individual_display_items_) {
    // Warning: this double-counts SkPicture data if use_cached_picture is
    // also true.
    for (const auto& item : items_) {
      external_memory_usage += item.ExternalMemoryUsage();
    }
  }

  // Memory outside this class due to |items_|.
  memory_usage += items_.GetCapacityInBytes() + external_memory_usage;

  // Memory outside this class due to |picture|.
  memory_usage += picture_memory_usage_;

  // TODO(jbroman): Does anything else owned by this class substantially
  // contribute to memory usage?

  return memory_usage;
}

bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const {
  return ApproximateOpCount() <= kOpCountThatIsOkToAnalyze;
}

scoped_refptr<base::trace_event::ConvertableToTraceFormat>
DisplayItemList::AsValue(bool include_items) const {
  scoped_refptr<base::trace_event::TracedValue> state =
      new base::trace_event::TracedValue();

  state->BeginDictionary("params");
  if (include_items) {
    state->BeginArray("items");
    size_t item_index = 0;
    for (const DisplayItem& item : items_) {
      item.AsValueInto(item_index < visual_rects_.size()
                           ? visual_rects_[item_index]
                           : gfx::Rect(),
                       state.get());
      item_index++;
    }
    state->EndArray();  // "items".
  }
  state->SetValue("layer_rect", MathUtil::AsValue(layer_rect_));
  state->EndDictionary();  // "params".

  if (!layer_rect_.IsEmpty()) {
    SkPictureRecorder recorder;
    SkCanvas* canvas =
        recorder.beginRecording(layer_rect_.width(), layer_rect_.height());
    canvas->translate(-layer_rect_.x(), -layer_rect_.y());
    canvas->clipRect(gfx::RectToSkRect(layer_rect_));
    Raster(canvas, NULL, gfx::Rect(), 1.f);
    skia::RefPtr<SkPicture> picture =
        skia::AdoptRef(recorder.endRecordingAsPicture());

    std::string b64_picture;
    PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture);
    state->SetString("skp64", b64_picture);
  }

  return state;
}

void DisplayItemList::EmitTraceSnapshot() const {
  TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
      TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items") ","
      TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") ","
      TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"),
      "cc::DisplayItemList", this,
      TracedDisplayItemList::AsTraceableDisplayItemList(this,
          DisplayItemsTracingEnabled()));
}

void DisplayItemList::GenerateDiscardableImagesMetadata() {
  // This should be only called once, and only after CreateAndCacheSkPicture.
  DCHECK(image_map_.empty());
  DCHECK(!settings_.use_cached_picture || picture_);
  if (settings_.use_cached_picture && !picture_->willPlayBackBitmaps())
    return;

  // The cached picture is translated by -layer_rect_.origin during record,
  // so we need to offset that back in order to get right positioning for
  // images.
  DiscardableImageMap::ScopedMetadataGenerator generator(
      &image_map_, gfx::Size(layer_rect_.right(), layer_rect_.bottom()));
  Raster(generator.canvas(), nullptr,
         gfx::Rect(layer_rect_.right(), layer_rect_.bottom()), 1.f);
}

void DisplayItemList::GetDiscardableImagesInRect(
    const gfx::Rect& rect,
    float raster_scale,
    std::vector<DrawImage>* images) {
  image_map_.GetDiscardableImagesInRect(rect, raster_scale, images);
}

bool DisplayItemList::HasDiscardableImageInRect(
    const gfx::Rect& layer_rect) const {
  return image_map_.HasDiscardableImageInRect(layer_rect);
}

bool DisplayItemList::MayHaveDiscardableImages() const {
  return !image_map_.empty();
}

}  // namespace cc


text:
package org.opentosca.container.core.next.repository;

import java.util.List;

import org.opentosca.container.core.model.csar.CsarId;
import org.opentosca.container.core.next.model.DeploymentProcessInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface DeploymentProcessInfoRepository extends JpaRepository<DeploymentProcessInfo, Long> {

    List<DeploymentProcessInfo> findByCsarID(CsarId csar);
}


text:
local addon,ns = ...

local GP_LibStub = _G.GP_LibStub

local gUI4 = GP_LibStub("GP_AceAddon-3.0"):GetAddon("gUI4", true)
if not gUI4 then return end

local oUF = gUI4.oUF
if not oUF then return end

local parent = gUI4:GetModule(addon, true)
if not parent then return end

local module = parent:NewModule("Raid25", "GP_AceEvent-3.0")
-- local L = GP_LibStub("GP_AceLocale-3.0"):GetLocale("gUI4")
local LMP = GP_LibStub("GP_LibMediaPlus-1.0")
local T, hasTheme

-- Lua API
local tonumber = tonumber
local pairs, unpack = pairs, unpack
local wipe = table.wipe

-- WoW API
local CreateFrame = _G.CreateFrame
local UnitAffectingCombat = _G.UnitAffectingCombat
local UnitFrame_OnEnter = _G.UnitFrame_OnLeave
local UnitFrame_OnLeave = _G.UnitFrame_OnLeave
local UnitGroupRolesAssigned = _G.UnitGroupRolesAssigned
local UnitIsUnit = _G.UnitIsUnit

-- WoW objects
local GameFontNormalSmall = _G.GameFontNormalSmall
local NumberFontNormalHuge = _G.NumberFontNormalHuge
local TextStatusBarText = _G.TextStatusBarText
local UIParent = _G.UIParent

-- WoW strings
local COMPACT_UNIT_FRAME_PROFILE_AUTOACTIVATE25PLAYERS = _G.COMPACT_UNIT_FRAME_PROFILE_AUTOACTIVATE25PLAYERS

local mirror = {
	BOTTOM = "TOP",
	BOTTOMLEFT = "TOPRIGHT",
	BOTTOMRIGHT = "TOPLEFT",
	CENTER = "CENTER",
	LEFT = "RIGHT",
	RIGHT = "LEFT",
	TOP = "BOTTOM",
	TOPLEFT = "BOTTOMRIGHT",
	TOPRIGHT = "BOTTOMLEFT"
}

local defaults = {
	profile = {
		skin = "Warcraft",
		locked = true,
		enabled = true,
		position = {}
	}
}

local function updateConfig()
	T = parent:GetActiveTheme().Raid25
end

-------------------------------------------------------------------------------
--	Style/Theme Updates
-------------------------------------------------------------------------------
local function UpdateTexture(tex, db)
	if db then
		tex:SetTexture(db:GetPath())
		tex:SetSize(db:GetTexSize())
		tex:SetVertexColor(unpack(db:GetColor()))
		tex:SetAlpha(db:GetAlpha())
		tex:SetTexCoord(db:GetTexCoord())
		tex:ClearAllPoints()
		tex:SetPoint(db:GetPoint())
	else
		tex:SetSize(.001, .001)
		tex:SetAlpha(0)
		tex:SetTexture("")
		tex:Hide()
	end
end

local function UpdateBar(bar, db)
	if db.alpha then
		bar:SetAlpha(db.alpha)
	else
		bar:SetAlpha(1)
	end
	if db.sparkle then
		if bar.Sparkle then
			bar.Sparkle:Show()
			bar.Sparkle:SetAlpha(tonumber(db.sparkle) or .1)
		end
	else
		if bar.Sparkle then
			bar.Sparkle:Hide()
		end
	end
	if db.size then
		bar:SetSize(unpack(db.size))
	else
		bar:SetSize(bar:GetParent():GetSize())
	end
	if db.growth then
		bar:SetGrowth(db.growth)
	else
		bar:SetGrowth("RIGHT")
	end
	if db.place then
		bar:ClearAllPoints()
		bar:SetPoint(unpack(db.place))
	else
		bar:ClearAllPoints()
		bar:SetAllPoints(bar:GetParent())
	end
	if db.bar.textures.backdrop then
		bar:SetBackdropTexture(db.bar.textures.backdrop:GetPath())
		if db.bar.backdropmultiplier then
			bar:SetBackdropMultiplier(db.bar.backdropmultiplier)
		else
			bar:SetBackdropMultiplier(nil)
		end
	else
		bar:SetBackdropTexture("")
	end
	if db.bar.textures.normal then
		bar:SetStatusBarTexture(db.bar.textures.normal:GetPath())
	else
		bar:SetStatusBarTexture("") -- weird. but might have a bar with only overlay and spark? :/
	end
	if db.bar.textures.overlay then
		bar:SetOverlayTexture(db.bar.textures.overlay:GetPath())
	else
		bar:SetOverlayTexture("")
	end
	if db.bar.textures.glow then
		bar:SetThreatTexture(db.bar.textures.glow:GetPath())
	else
		bar:SetThreatTexture("")
	end
	if bar.Threat then
		if db.textures.threat then
			UpdateTexture(bar.Threat, db.textures.threat)
			bar.Threat.enabled = true
		else
			bar.Threat.enabled = false
			bar.Threat:Hide()
		end
	end
	if bar.Spark then
		if db.spark then
			bar.Spark:SetSize(db.spark.texture:GetTexSize(), bar:GetHeight())
			bar.Spark:SetTexture(db.spark.texture:GetPath())
			bar.Spark:SetAlpha(db.spark.alpha)
			bar.Spark:ClearAllPoints()
			bar.Spark:SetPoint(db.spark.texture:GetPoint(), bar:GetStatusBarTexture(), db.spark.texture:GetPoint())
		else
			bar.Spark:SetTexture("")
		end
	end
end

local function UpdateFontString(fontString, db, anchor)
	if db then
		fontString:ClearAllPoints()
		if anchor then
			local point, x, y = unpack(db.place)
			fontString:SetPoint(point, anchor, point, x, y)
		else
			fontString:SetPoint(unpack(db.place))
		end
		fontString:SetHeight(db.size)
		fontString:SetFontObject(db.fontobject)
		fontString:SetFontSize(db.fontsize or db.size)
		fontString:SetFontStyle(db.fontstyle)
		fontString:SetShadowOffset(unpack(db.shadowoffset))
		fontString:SetShadowColor(unpack(db.shadowcolor))
		fontString:SetTextColor(unpack(db.color))
		if fontString.frame and fontString.frame.Tag then
			fontString.frame:Tag(fontString, db.tag or "")
		end
	else
		if fontString.frame and fontString.frame.Tag then
			fontString.frame:Tag(fontString, "")
		end
		fontString:SetText("")
	end
end

local function UpdateStyle(self)
	updateConfig()

	--	Frame
	-------------------------------------------------------------------------------
	UpdateTexture(self.Backdrop, T.textures.backdrop)
	UpdateTexture(self.Border, T.textures.border)
	UpdateTexture(self.Highlight, T.textures.highlight)
	UpdateTexture(self.TargetBorder.Border, T.textures.target)

	--	Bars
	-------------------------------------------------------------------------------
	UpdateBar(self.Health, T.bars.health)
	UpdateBar(self.Power, T.bars.power)

	--	Texts
	-------------------------------------------------------------------------------
	UpdateFontString(self.NameText, T.fontstrings.nametext)
	UpdateFontString(self.HealthText, T.fontstrings.healthtext)

	--	Widgets
	-------------------------------------------------------------------------------

	-- raid icon
	self.RaidIcon:SetSize(unpack(T.widgets.raidicon.size))
	self.RaidIcon:ClearAllPoints()
	self.RaidIcon:SetPoint(unpack(T.widgets.raidicon.place))
	self.RaidIcon:SetTexture(T.widgets.raidicon.texture)

	-- icon stack
	self.IconStackWidget:SetSize(unpack(T.widgets.iconstack.size))
	self.IconStackWidget:ClearAllPoints()
	self.IconStackWidget:SetPoint(unpack(T.widgets.iconstack.place))
	self.IconStackWidget.Leader:SetSize(unpack(T.widgets.iconstack.size))
	self.IconStackWidget.Assistant:SetSize(unpack(T.widgets.iconstack.size))
	self.IconStackWidget.MainTank:SetSize(unpack(T.widgets.iconstack.size))
	self.IconStackWidget.MainAssist:SetSize(unpack(T.widgets.iconstack.size))
	self.IconStackWidget.MasterLooter:SetSize(unpack(T.widgets.iconstack.size))
	self.IconStackWidget.showLeader = T.widgets.iconstack.showLeader
	self.IconStackWidget.showAssistant = T.widgets.iconstack.showAssistant
	self.IconStackWidget.showMainTank = T.widgets.iconstack.showMainTank
	self.IconStackWidget.showMainAssist = T.widgets.iconstack.showMainAssist
	self.IconStackWidget.showMasterLooter = T.widgets.iconstack.showMasterLooter
	if self.IconStackWidget.ForceUpdate then
		self.IconStackWidget:ForceUpdate()
	end

	-- group role icon
	self.GroupRole:SetSize(unpack(T.widgets.grouprole.size))
	self.GroupRole:ClearAllPoints()
	self.GroupRole:SetPoint(unpack(T.widgets.grouprole.place))
	self.GroupRole.Tank:SetSize(unpack(T.widgets.grouprole.size))
	self.GroupRole.Tank:SetTexture(T.widgets.grouprole.textures.tank:GetPath())
	self.GroupRole.Tank:SetTexCoord(T.widgets.grouprole.textures.tank:GetTexCoord())
	self.GroupRole.Tank:ClearAllPoints()
	self.GroupRole.Tank:SetPoint(T.widgets.grouprole.textures.tank:GetPoint())
	self.GroupRole.Healer:SetSize(unpack(T.widgets.grouprole.size))
	self.GroupRole.Healer:SetTexture(T.widgets.grouprole.textures.heal:GetPath())
	self.GroupRole.Healer:SetTexCoord(T.widgets.grouprole.textures.heal:GetTexCoord())
	self.GroupRole.Healer:ClearAllPoints()
	self.GroupRole.Healer:SetPoint(T.widgets.grouprole.textures.heal:GetPoint())
	self.GroupRole.DPS:SetSize(unpack(T.widgets.grouprole.size))
	self.GroupRole.DPS:SetTexture(T.widgets.grouprole.textures.dps:GetPath())
	self.GroupRole.DPS:SetTexCoord(T.widgets.grouprole.textures.dps:GetTexCoord())
	self.GroupRole.DPS:ClearAllPoints()
	self.GroupRole.DPS:SetPoint(T.widgets.grouprole.textures.dps:GetPoint())
	self.GroupRole.showTank = T.widgets.grouprole.showTank
	self.GroupRole.showHealer = T.widgets.grouprole.showHealer
	self.GroupRole.showDPS = T.widgets.grouprole.showDPS
	if self.GroupRole.ForceUpdate then
		self.GroupRole:ForceUpdate()
	end

	-- readycheck icon
	self.ReadyCheck:SetSize(unpack(T.widgets.readycheck.size))
	self.ReadyCheck:ClearAllPoints()
	self.ReadyCheck:SetPoint(unpack(T.widgets.readycheck.place))

	-- raiddebuffs
	self.GroupAuras:SetSize(unpack(T.widgets.raiddebuff.size))
	self.GroupAuras:ClearAllPoints()
	self.GroupAuras:SetPoint(unpack(T.widgets.raiddebuff.place))

	-- heal prediction
	local predict = self.HealPrediction
	local width = self.Health:GetWidth()
	local growth = self.Health:GetGrowth()
	if predict.myBar then
		LMP:NewChain(predict.myBar) :SetWidth(width) :SetGrowth(growth) :ClearAllPoints() :SetPoint("TOP", self.Health:GetStatusBarTexture(), "TOP") :SetPoint("BOTTOM", self.Health:GetStatusBarTexture(), "BOTTOM") :SetPoint(mirror[growth], self.Health:GetStatusBarTexture(), growth) :EndChain()
	end
	if predict.otherBar then
		LMP:NewChain(predict.otherBar) :SetWidth(width) :SetGrowth(growth) :ClearAllPoints() :SetPoint("TOP", self.Health:GetStatusBarTexture(), "TOP") :SetPoint("BOTTOM", self.Health:GetStatusBarTexture(), "BOTTOM") :SetPoint(mirror[growth], self.Health:GetStatusBarTexture(), growth) :EndChain()
	end
	if predict.absorbBar then
		LMP:NewChain(predict.absorbBar) :SetWidth(width) :SetGrowth(growth) :ClearAllPoints() :SetPoint("TOP", self.Health:GetStatusBarTexture(), "TOP") :SetPoint("BOTTOM", self.Health:GetStatusBarTexture(), "BOTTOM") :SetPoint(mirror[growth], self.Health:GetStatusBarTexture(), growth) :EndChain()
	end
	if predict.healAbsorbBar then
		LMP:NewChain(predict.healAbsorbBar) :SetWidth(width) :SetGrowth(growth) :ClearAllPoints() :SetPoint("TOP", self.Health:GetStatusBarTexture(), "TOP") :SetPoint("BOTTOM", self.Health:GetStatusBarTexture(), "BOTTOM") :SetPoint(mirror[growth], self.Health:GetStatusBarTexture(), growth) :EndChain()
	end
end

-------------------------------------------------------------------------------
--	UnitFrame Prototype
-------------------------------------------------------------------------------
local function updateTarget(self)
	local TargetBorder = self.TargetBorder
	if not TargetBorder then
		return
	end
	if self.unit and UnitIsUnit(self.unit, "target") and self:IsShown() then
		TargetBorder:Show()
	else
		TargetBorder:Hide()
	end
end

local function showHighlight(self)
	local highlight = self.Highlight
	local border = self.Border
	if highlight then
		highlight:Show()
		if border then
			border:Hide()
		end
	end
end

local function hideHighlight(self)
	local highlight = self.Highlight
	local border = self.Border
	if highlight then
		if border then
			border:Show()
		end
		highlight:Hide()
	end
end

local function onEnter(self)
	showHighlight(self)
	UnitFrame_OnEnter(self)
end

local function onLeave(self)
	hideHighlight(self)
	UnitFrame_OnLeave(self)
end

local allFrames = {}
local function Style(self, unit)
	allFrames[self] = true

	self.colors = gUI4:GetColors()

	self:RegisterForClicks("AnyUp")
	self:SetScript("OnEnter", onEnter)
	self:SetScript("OnLeave", onLeave)

	self.OverlayFrame = LMP:NewChain(CreateFrame("Frame", nil, self)) :SetFrameLevel(self:GetFrameLevel() + 10) :SetAllPoints() .__EndChain
	self.InfoFrame = LMP:NewChain(CreateFrame("Frame", nil, self.OverlayFrame)) :SetAllPoints() .__EndChain
	self.IconFrame = LMP:NewChain(CreateFrame("Frame", nil, self.InfoFrame)) :SetAllPoints() .__EndChain
	self.PrioFrame = LMP:NewChain(CreateFrame("Frame", nil, self.IconFrame)) :SetAllPoints() .__EndChain

	-- target border
	self.TargetBorder = LMP:NewChain(CreateFrame("Frame", nil, ((unit == "party") or (unit == "raid")) and self:GetParent() or self)) :SetFrameLevel(self:GetFrameLevel() + 10) :SetPoint("TOPLEFT", self, 0, 0) :SetPoint("BOTTOMRIGHT", 0, 0) :Hide() .__EndChain
	self.TargetBorder.parent = self
	self.TargetBorder:RegisterEvent("PLAYER_TARGET_CHANGED")
	self.TargetBorder:RegisterEvent("GROUP_ROSTER_UPDATE")
	self.TargetBorder:RegisterEvent("PLAYER_REGEN_DISABLED")
	self.TargetBorder:SetScript("OnEvent", function(self, event, ...) updateTarget(self.parent, event, ...) end)
	self.TargetBorder.Border = LMP:NewChain(self.TargetBorder:CreateTexture()) :SetDrawLayer("BORDER", 3) :SetAllPoints(self.TargetBorder) .__EndChain

	self.Glow = LMP:NewChain(self:CreateTexture()) :SetDrawLayer("BACKGROUND", -7) :SetAllPoints() :SetVertexColor(0, 0, 0, 1) .__EndChain
	self.Backdrop = LMP:NewChain(self:CreateTexture()) :SetDrawLayer("BACKGROUND", -1) :SetAllPoints() .__EndChain
	self.Shade = LMP:NewChain(self.OverlayFrame:CreateTexture()) :SetDrawLayer("BACKGROUND", 1) :SetAllPoints() .__EndChain
	self.Border = LMP:NewChain(self.OverlayFrame:CreateTexture()) :SetDrawLayer("BORDER", 0) :SetAllPoints() .__EndChain
	self.Highlight = LMP:NewChain(self.OverlayFrame:CreateTexture()) :Hide() :SetDrawLayer("BORDER", 1) :SetBlendMode("BLEND") :SetAllPoints() .__EndChain
	self.Overlay = LMP:NewChain(self.OverlayFrame:CreateTexture()) :Hide() :SetDrawLayer("BORDER", 2) :SetAllPoints() .__EndChain
	self.SpiritHealer = LMP:NewChain(self.IconFrame:CreateTexture()) :Hide() :SetDrawLayer("OVERLAY", 7) :SetAlpha(.5) :SetAllPoints() .__EndChain

	self.Health = LMP:NewChain("StatusBar", nil, self) :SetFrameLevel(self:GetFrameLevel() + 1) :SetPostUpdate(ns.postUpdateHealth) .__EndChain

	self.Health.OverlayFrame = LMP:NewChain(CreateFrame("Frame", nil, self.OverlayFrame)) :SetAllPoints() .__EndChain
	self.Health.BackdropFrame = LMP:NewChain(CreateFrame("Frame", nil, self)) :SetAllPoints(self.Health.OverlayFrame) .__EndChain
	self.Health.Glow = LMP:NewChain(self.Health.OverlayFrame:CreateTexture()) :SetDrawLayer("BACKGROUND", -7) :SetAllPoints() :SetVertexColor(0, 0, 0, 1) .__EndChain -- "BACKGROUND", -7
	self.Health.Border = LMP:NewChain(self.Health.OverlayFrame:CreateTexture()) :SetDrawLayer("ARTWORK", 1) .__EndChain
	self.Health.Highlight = LMP:NewChain(self.Health.OverlayFrame:CreateTexture()) :Hide() :SetDrawLayer("ARTWORK", 2) .__EndChain
	self.Health.Overlay = LMP:NewChain(self.Health.OverlayFrame:CreateTexture()) :Hide() :SetDrawLayer("ARTWORK", 3) .__EndChain

	self.Power = LMP:NewChain("StatusBar", nil, self) :SetFrameLevel(self:GetFrameLevel() + 2) .__EndChain
	self.Power.OverlayFrame = LMP:NewChain(CreateFrame("Frame", nil, self.OverlayFrame)) :SetAllPoints() .__EndChain
	self.Power.BackdropFrame = LMP:NewChain(CreateFrame("Frame", nil, self)) :SetAllPoints(self.Power.OverlayFrame) .__EndChain
	self.Power.Glow = LMP:NewChain(self.Power.OverlayFrame:CreateTexture()) :SetDrawLayer("BACKGROUND", -7) :SetAllPoints() :SetVertexColor(0, 0, 0, 1) .__EndChain -- "BACKGROUND", -7
	self.Power.Border = LMP:NewChain(self.Power.OverlayFrame:CreateTexture()) :SetDrawLayer("ARTWORK", 1) .__EndChain
	self.Power.Highlight = LMP:NewChain(self.Power.OverlayFrame:CreateTexture()) :Hide() :SetDrawLayer("ARTWORK", 2) .__EndChain
	-- self.Power.Overlay = LMP:NewChain(self.Power.OverlayFrame:CreateTexture()) :Hide() :SetDrawLayer("ARTWORK", 3) .__EndChain

	-- move this to profile or theme or both?
	self.Health.colorHealth = false
	self.Health.colorClass = true
	self.Health.colorClassPet = false
	self.Health.colorPetAsPlayer = true
	self.Health.colorReaction = false
	self.Health.colorDisconnected = true
	self.Health.colorTapping = true
	self.Health.colorSmooth = true

	self.Health.Smoother = true
	self.Health.frequentUpdates = true
	-- self.Health.SpiritHealer = self.SpiritHealer -- connect the spirithealer artwork
	self.Health.Override = gUI4:GetFunction("UpdateHealthBar")

	self.Power.colorPower = true
	self.Power.colorClass = false
	self.Power.colorClassNPC = false
	self.Power.colorSmooth = false
	self.Power.colorReaction = true
	self.Power.colorDisconnected = true
	self.Power.colorTapping = true
	self.Power.Smoother = true
	self.Power.frequentUpdates = true
	self.Power.Override = gUI4:GetFunction("UpdatePowerBar")

	-- low health pulse
	local build = tonumber((select(2, GetBuildInfo())))
	if build >= 22124 then -- Legion
		self.Health.Pulse = LMP:NewChain(self.Health:CreateTexture()) :Hide() :SetDrawLayer("BORDER", 1) :SetAllPoints(self.Health:GetStatusBarTexture()) :SetBlendMode("BLEND") :SetColorTexture(1,0,0,.5) .__EndChain
		self.Health.Pulse.Anim = LMP:NewChain(self.Health.Pulse:CreateAnimationGroup()) :SetLooping("REPEAT") .__EndChain
		self.Health.Pulse.Anim.start = LMP:NewChain(self.Health.Pulse.Anim:CreateAnimation("Alpha")) :SetToAlpha(0) :SetDuration(0) :SetSmoothing("IN") :SetOrder(0) .__EndChain
		self.Health.Pulse.Anim.fadeIn = LMP:NewChain(self.Health.Pulse.Anim:CreateAnimation("Alpha")) :SetToAlpha(.5) :SetDuration(.5) :SetOrder(1) .__EndChain
		self.Health.Pulse.Anim.fadeOut = LMP:NewChain(self.Health.Pulse.Anim:CreateAnimation("Alpha")) :SetToAlpha(0) :SetDuration(.5) :SetOrder(2) .__EndChain
		self.Health.Pulse.Anim:Play()
	else
		self.Health.Pulse = LMP:NewChain(self.Health:CreateTexture()) :Hide() :SetDrawLayer("BORDER", 1) :SetAllPoints(self.Health:GetStatusBarTexture()) :SetBlendMode("BLEND") :SetTexture(1,0,0,.5) .__EndChain
		self.Health.Pulse.Anim = LMP:NewChain(self.Health.Pulse:CreateAnimationGroup()) :SetLooping("REPEAT") .__EndChain
		self.Health.Pulse.Anim.start = LMP:NewChain(self.Health.Pulse.Anim:CreateAnimation("Alpha")) :SetChange(-1) :SetDuration(0) :SetSmoothing("IN") :SetOrder(0) .__EndChain
		self.Health.Pulse.Anim.fadeIn = LMP:NewChain(self.Health.Pulse.Anim:CreateAnimation("Alpha")) :SetChange(.5) :SetDuration(.5) :SetOrder(1) .__EndChain
		self.Health.Pulse.Anim.fadeOut = LMP:NewChain(self.Health.Pulse.Anim:CreateAnimation("Alpha")) :SetChange(-.5) :SetDuration(.5) :SetOrder(2) .__EndChain
		self.Health.Pulse.Anim:Play()
	end

	-- health spark
	self.Health.Spark = LMP:NewChain(self.Health:CreateTexture()) :SetDrawLayer("BORDER", 2) .__EndChain

	-- power spark
	self.Power.Spark = LMP:NewChain(self.Power:CreateTexture()) :SetDrawLayer("BORDER", 2) .__EndChain

	-- threat
	self.Health.Threat = LMP:NewChain(self.Health.OverlayFrame:CreateTexture()) :SetDrawLayer("ARTWORK", 4) :SetAllPoints() :Hide() .__EndChain
	self.Power.Threat = LMP:NewChain(self.Power.BackdropFrame:CreateTexture()) :SetDrawLayer("BACKGROUND", -6) :SetAllPoints() :Hide() .__EndChain
	self.Threat = {
		Hide = function()
			self.Health.Threat:Hide()
			self.Power.Threat:Hide()
		end,
		Show = function()
			if self.Health.Threat.enabled then
				self.Health.Threat:Show()
			end
			if self.Power.Threat.enabled then
				self.Power.Threat:Show()
			end
		end,
		SetVertexColor = function(frame, ...)
			self.Health.Threat:SetVertexColor(...)
			self.Power.Threat:SetVertexColor(...)
		end,
		IsObjectType = function()
		end
	}

	-- fontstrings
	self.CombatFeedbackText = LMP:NewChain("FontString", nil, self.InfoFrame) :SetDrawLayer("ARTWORK") :SetFontObject(NumberFontNormalHuge) .__EndChain
	self.HealthText = LMP:NewChain("FontString", nil, self.InfoFrame) :SetDrawLayer("ARTWORK") :SetFontObject(TextStatusBarText) .__EndChain
	self.NameText = LMP:NewChain("FontString", nil, self.InfoFrame) :SetDrawLayer("ARTWORK") :SetFontObject(GameFontNormalSmall) :SetWordWrap(false) :SetNonSpaceWrap(false) .__EndChain
	self.PowerText = LMP:NewChain("FontString", nil, self.InfoFrame) :SetDrawLayer("OVERLAY") :SetFontObject(TextStatusBarText) .__EndChain

	-- widgets
	-- *note: fonstring textures doesn't respond well to fading, so we're using "real" textures for all that
	self.ReadyCheck = LMP:NewChain(self.OverlayFrame:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.IconStackWidget = LMP:NewChain(CreateFrame("Frame", nil, self.IconFrame)) :SetPoint("TOPLEFT", 2, 8) :SetSize(16, 16) .__EndChain
	self.IconStackWidget.Leader = LMP:NewChain(self.IconStackWidget:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.IconStackWidget.Assistant = LMP:NewChain(self.IconStackWidget:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.IconStackWidget.MainTank = LMP:NewChain(self.IconStackWidget:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.IconStackWidget.MainAssist = LMP:NewChain(self.IconStackWidget:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.IconStackWidget.MasterLooter = LMP:NewChain(self.IconStackWidget:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.GroupRole = LMP:NewChain(CreateFrame("Frame", nil, self.IconFrame)) :SetPoint("BOTTOM", 0, 0) :SetSize(16, 16) .__EndChain
	self.GroupRole.Tank = LMP:NewChain(self.GroupRole:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.GroupRole.Healer = LMP:NewChain(self.GroupRole:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.GroupRole.DPS = LMP:NewChain(self.GroupRole:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.RaidIcon = LMP:NewChain(self.IconFrame:CreateTexture()) :SetDrawLayer("OVERLAY") .__EndChain
	self.UnitRange = { insideAlpha = 1, outsideAlpha = .5 }
	self.HealPrediction = {
		myBar = LMP:NewChain("StatusBar", nil, self) :SetStatusBarTexture(1, 1, 1, .3) :SetStatusBarColor(unpack(self.colors.healpredict.predict)) .__EndChain,
		otherBar = LMP:NewChain("StatusBar", nil, self) :SetStatusBarTexture(1, 1, 1, .3) :SetStatusBarColor(unpack(self.colors.healpredict.predictOther)) .__EndChain,
		absorbBar = LMP:NewChain("StatusBar", nil, self) :SetStatusBarTexture(1, 1, 1, .3) :SetStatusBarColor(unpack(self.colors.healpredict.absorb)) .__EndChain,
		healAbsorbBar = LMP:NewChain("StatusBar", nil, self) :SetStatusBarTexture(1, 1, 1, .3) :SetStatusBarColor(unpack(self.colors.healpredict.absorbOther)) .__EndChain,
		maxOverflow = 1,
		frequentUpdates = true
	}

	--		Raid Debuffs
	--------------------------------------------------------------------------------------------------
	self.GroupAuras = CreateFrame("Frame", nil, self.PrioFrame)
	self.GroupAuras:Hide()
	self.GroupAuras:SetSize(32, 32)
	self.GroupAuras:SetPoint("CENTER", 0, 0)
	self.GroupAuras:SetBackdrop({
		bgFile = gUI4:GetMedia("Texture", "Blank"):GetPath(),
		edgeFile = gUI4:GetMedia("Texture", "Blank"):GetPath(),
		edgeSize = 1,
		insets = {
			left = -1,
			right = -1,
			top = -1,
			bottom = -1
		}
	})
	self.GroupAuras:SetBackdropColor(0, 0, 0, 1)
	self.GroupAuras:SetBackdropBorderColor(.3, .3, .3, 1) -- just initial, will be debuff colored anyway

	self.GroupAuras.icon = self.GroupAuras:CreateTexture(nil, "OVERLAY")
	self.GroupAuras.icon:SetTexCoord(5/64, 59/64, 5/64, 59/64)
	self.GroupAuras.icon:SetPoint("TOP", self.GroupAuras, 0, -3)
	self.GroupAuras.icon:SetPoint("RIGHT", self.GroupAuras, -3, 0)
	self.GroupAuras.icon:SetPoint("BOTTOM", self.GroupAuras, 0, 3)
	self.GroupAuras.icon:SetPoint("LEFT", self.GroupAuras, 3, 0)
	self.GroupAuras.icon:SetDrawLayer("ARTWORK")

	self.GroupAuras.cd = CreateFrame("Cooldown", nil, self.GroupAuras)
	self.GroupAuras.cd:SetAllPoints(self.GroupAuras.icon)
	self.GroupAuras.cd:SetReverse(true)

	self.GroupAuras.count = self.GroupAuras:CreateFontString(nil, "OVERLAY")
	self.GroupAuras.count:SetFontObject(TextStatusBarText)
	self.GroupAuras.count:SetPoint("BOTTOMRIGHT", self.GroupAuras, "BOTTOMRIGHT", 2, 0)
	self.GroupAuras.count:SetTextColor(.79, .79, .79)

	self.GroupAuras.SetDebuffTypeColor = self.GroupAuras.SetBackdropBorderColor

	self.GroupAuras.PostUpdate = function(self)
		local button = self.GroupAuras
		-- we don't want those "1"'s cluttering up the display
		if button then
			local count = tonumber(button.count:GetText())
			if count and count > 1 then
				f.count:SetText(count)
				f.count:Show()
			else
				f.count:Hide()
			end
		end
	end

	-- frame references
	self.CombatFeedbackText.frame = self
	self.Health.frame = self
	self.HealthText.frame = self
	self.NameText.frame = self
	self.Power.frame = self
	self.PowerText.frame = self

	-- just for development
	--local backdrop = self:CreateTexture(nil, "BACKGROUND")
	--backdrop:SetAllPoints(self)
	--backdrop:SetTexture(0,0,0,.75)

	-- if a theme has been set, style the frame now
	if hasTheme then
		UpdateStyle(self)
	end

end

--local positionCallbacks = {}
function module:UpdateTheme()
	updateConfig()
	-- if no theme has been set, spawn the frame headers
	if not hasTheme then
		self:SpawnFrames()
	end
	-- update the theme of all existing frames
	for frame in pairs(allFrames) do
		UpdateStyle(frame)
	end
	hasTheme = true
end

function module:ApplySettings()
	updateConfig()
	for frame in pairs(allFrames) do
		if parent.db.profile.showGroupAuras then
			frame:EnableElement("GroupAuras")
		else
			frame:DisableElement("GroupAuras")
		end
	end
end
module.ApplySettings = gUI4:SafeCallWrapper(module.ApplySettings)

function module:UpdatePosition()
	if not hasTheme then return end
	updateConfig()
	local db = self.db.profile
	if db.locked then
		LMP:Place(self.frame, T.place)
		if not db.position.x then
			self.frame:RegisterConfig(db.position)
			self.frame:SavePosition()
		end
	else
		self.frame:RegisterConfig(db.position)
		if db.position.x then
			self.frame:LoadPosition()
		else
			LMP:Place(self.frame, T.place)
			self.frame:SavePosition()
			self.frame:LoadPosition()
		end
	end
end
module.UpdatePosition = gUI4:SafeCallWrapper(module.UpdatePosition)

function module:Lock()
	self.overlay:StartFadeOut()
end

function module:Unlock()
	if UnitAffectingCombat("player") then return end
	self.overlay:SetAlpha(0)
	self.overlay:Show()
end

function module:ResetLock()
	if UnitAffectingCombat("player") then return end
	local db = self.db.profile
	db.position.point = nil
	db.position.y = nil
	db.position.x = nil
	db.locked = true
	wipe(db.position)
	self:ApplySettings()
end

function module:SpawnFrames()
	oUF:RegisterStyle(addon.."Raid25", Style)
	oUF:SetActiveStyle(addon.."Raid25")
	local T = T
	local db = T.header
	local header = oUF:SpawnHeader(addon.."Raid25", nil,
	db.showSolo and "solo" or parent:GetVisibilityMacro(16,25),
	"oUF-initialConfigFunction", ([[
	self:SetWidth(%d)
	self:SetHeight(%d)
	]]):format(unpack(T.size)),
	"showRaid", true,
	"showParty", true,
	"showPlayer", true,
	"showSolo", db.showSolo,
	"yOffset", -(db.yOffset or 6),
	"xoffset", 6,
	"point", db.point,
	"groupFilter", db.groupFilter,
	"groupingOrder", db.groupingOrder,
	"groupBy", db.groupBy,
	"maxColumns", db.maxColumns,
	"unitsPerColumn", db.unitsPerColumn,
	"columnSpacing", db.columnSpacing or 6,
	"columnAnchorPoint", db.columnAnchorPoint
	)
	header:ClearAllPoints()
	header:SetPoint("TOPLEFT", module.frame, 0, 0)
	self.fadeManager:RegisterObject(header)
	self.frame:SetSize(T.size[1]*db.unitsPerColumn + (db.columnSpacing or 6)*(db.unitsPerColumn-1),
	T.size[2]*db.maxColumns + (db.yOffset or 6)*(db.maxColumns-1) )

	self:RegisterMessage("GUI4_LEADERTOOLS_SHOWN", "UpdateForcedState")
	self:RegisterMessage("GUI4_LEADERTOOLS_HIDDEN", "UpdateForcedState")
end

function module:UpdateForcedState(event)
	if event == "GUI4_LEADERTOOLS_SHOWN" then
		self.fadeManager:SetUserForced(true)
	elseif event == "GUI4_LEADERTOOLS_HIDDEN" then
		self.fadeManager:SetUserForced(false)
	end
end

function module:OnInitialize()
	self.db = parent.db:RegisterNamespace("Raid25", defaults)
	self.db.RegisterCallback(self, "OnProfileChanged", "ApplySettings")
	self.db.RegisterCallback(self, "OnProfileCopied", "ApplySettings")
	self.db.RegisterCallback(self, "OnProfileReset", "ApplySettings")

	updateConfig()

	self.frame = CreateFrame("Frame", nil, UIParent)
	self.frame.UpdatePosition = function() self:UpdatePosition() end
	self.fadeManager = LMP:NewChain(gUI4:CreateFadeManager("UnitFrames: Raid25")) :SetFrameStrata("LOW") :SetFrameLevel(100) :Enable() .__EndChain
	self.overlay = gUI4:GlockThis(self.frame, COMPACT_UNIT_FRAME_PROFILE_AUTOACTIVATE25PLAYERS, function() return module.db.profile end, unpack(gUI4:GetColors("glock", "unitframes")))

end

function module:OnEnable()

end

function module:OnDisable()
end


text:
$(document).ready(function(){
    $('body').scrollspy({ target: '#myNavbar' });

    // $('#submit').on('click',function(){
    //     $('#alertMessage').html(`
    //

    //             <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    //                 ×
    //             </button>
    //             Holy guacamole! You should check in on some of those fields below.
    //

    //     `);
    // });

  // Add smooth scrolling to all links in navbar + footer link
  $(".navbar a, footer a[href='#myPage']").on('click', function(event) {
    // Make sure this.hash has a value before overriding default behavior
    if (this.hash !== "") {
      // Prevent default anchor click behavior
      event.preventDefault();

      // Store hash
      var hash = this.hash;

      // Using jQuery's animate() method to add smooth page scroll
      // The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
      $('html, body').animate({
        scrollTop: $(hash).offset().top
      }, 900, function(){

        // Add hash (#) to URL when done scrolling (default click behavior)
        window.location.hash = hash;
      });
    } // End if
  });

  $(window).scroll(function() {
    $(".slideanim").each(function(){
      var pos = $(this).offset().top;

      var winTop = $(window).scrollTop();
        if (pos < winTop + 600) {
          $(this).addClass("slide");
        }
    });
  });

});


text:
require 'securerandom'
require 'monitor'

module OmfEc::Vm

  class VmGroup
    include MonitorMixin

    attr_accessor :id, :name, :topic_name, :app_contexts, :execs
    attr_reader :topic, :vms

    # @param [String] name of the group.
    # @param [String] topic_name to subscribe.
    # @param [Object] block
    def initialize(name, topic_name, &block)
      super()
      @id = "#{OmfEc.experiment.id}.#{name}"
      @name = name
      @topic_name = topic_name
      @vms ||= []

      # Applications
      @app_contexts = []
      @execs = []
      @applications ||= []

      OmfEc.subscribe_topic(topic_name, self, &block)
    end

    # Verify if has a topic associated with this class, used to trigger the event :ALL_VM_GROUPS_UP.
    def has_topic
      !@topic.nil?
    end

    # Associate the topic reference when the subscription is received from OmfEc::subscribe_topic.
    #
    # @param [Object] topic
    def associate_topic(topic)
      self.synchronize do
        @topic = topic
      end
    end

    # Add a virtual machine in hypervisor.
    #
    # @param [String] name of virtual machine.
    def addVm(name, &block)
      self.synchronize do
        vm = OmfEc::Vm::VirtualMachine.new(name, self)
        if @vms.find {|v| v.name == name}
          error "vm: #{name} - already added."
        else
          @vms << vm
          OmfEc.experiment.add_vm(vm)
          block.call(vm) if block
        end
      end
    end

    # Create a new virtual machine in the hypervisor and receive the topic to manage it.
    #
    # @param [Object] name of virtual machine.
    # @param [Object] block
    def create_vm(name, &block)
      raise('This function need to be executed after ALL_VM_GROUPS_UP event') unless self.has_topic
      raise("The Virtual machine #{name} is not defined in this group") unless vm(name)
      @topic.create(:virtual_machine, {:label => name}) do |vm|
        vm_topic = vm.resource
        if vm_topic.error?
          error app.inspect
        else
          vm_topic.on_subscribed do
            block.call(vm_topic) if block
          end
        end
      end
    end

    # Find a virtual machine by name.
    #
    # @param [String] name of virtual machine
    # @return [VirtualMachine]
    def vm(name)
      @vms.find {|v| v.name == name}
    end

    ## Begin Application methods
    def address(suffix = nil)
      t_id = suffix ? "#{@id}_#{suffix.to_s}" : @id
      OmfCommon.comm.string_to_topic_address(t_id)
    end

    def create_application(name, opts, &block)
      self.synchronize do
        r_type = 'application'
        resource_group_name = self.address(r_type)
        opts = opts.merge({
                              name: name,
                              hrn: name,
                              membership: resource_group_name,
                              state: 'created'
                          })

        created_apps = 0
        @vms.each { |vm|
          info "Creating application on #{vm.name}"
          opts.delete(:type)
          vm.vm_node.topic.create(r_type, opts, assert: OmfEc.experiment.assertion) do |app|
            @applications << {:name => name, :topic => app.resource, :vm => vm, :state => :stopped}
            created_apps = created_apps + 1
            block.call if (block and created_apps == @vms.size)
          end
        }
      end
    end

    # Create an application for the group and start it
    #
    def exec(command, show_std=true)
      name = SecureRandom.uuid

      self.synchronize do
        @execs << name
      end

      create_application(name, {binary_path: command}) do
        info "Sending app start for command '#{command}' in group '#{@name}'"
        after(2) {
          run_application(name, show_std)
        }
      end
    end

    def run_application(app_name, show_std)
      @applications.each { |app|
        if app[:name] == app_name and app[:status] != :running
          vm_simple_name = app[:vm].name.split(':')
          vm_simple_name = vm_simple_name[vm_simple_name.size-1]
          app[:topic].on_subscribed do
            app[:topic].configure({ :state => :running }, { assert: OmfEc.experiment.assertion })
            app[:topic].on_inform  do |m|
              case m.itype
                when 'STATUS'
                  if m[:status_type] == 'APP_EVENT'
                    case m[:event]
                      when 'STARTED'
                        app[:state] = :running
                        info "Application '#{app_name}' is running on #{vm_simple_name}"
                      when 'EXIT'
                        info "Application '#{app_name}' finalized in #{vm_simple_name}"
                        app[:state] = :stopped
                      else
                        info "#{m[:event]} (#{vm_simple_name}): #{m[:msg]}" if (m[:msg] and show_std === true)
                    end
                  end
                when 'ERROR'
                  error "(#{vm_simple_name}): #{m[:reason]}"
              end
            end
          end
        end
      }
    end

    # Start ONE application by name
    def startApplication(app_name, show_std=true)
      if @app_contexts.find { |v| v.orig_name == app_name }
        run_application(app_name, show_std)
      else
        warn "No application with name '#{app_name}' defined in group #{@name}. Nothing to start"
      end
    end

    # Start ALL applications in the group
    def startApplications(show_std=true)
      if @app_contexts.empty?
        warn "No applications defined in group #{@name}. Nothing to start"
      else
        @applications.each { |app|
          run_application(app[:name], show_std)
        }
      end
    end

    # Stop ALL applications in the group
    def stopApplications
      if @app_contexts.empty?
        warn "No applications defined in group #{@name}. Nothing to stop"
      else
        @applications.each { |app|
          app[:status] = :stopped
          app[:topic].configure({ :state => :stopped }, { assert: OmfEc.experiment.assertion })
        }
      end
    end

    def addApplication(name, location = nil, &block)
      app_cxt = OmfEc::Context::AppContext.new(name,location,self)
      block.call(app_cxt) if block
      @app_contexts << app_cxt
    end

    def releaseApplications
      if @app_contexts.empty?
        warn "No applications defined in group #{@name}. Nothing to release"
      else
        @applications.each { |app|
          app[:vm].vm_node.topic.release(app[:topic], { assert: OmfEc.experiment.assertion })
        }
      end
    end

    def releaseVMs
      if @vms.empty?
        warn "No VMs created in group #{@name}. Nothing to release"
      else
        @vms.each { |vm|
          @topic.release(vm.vm_topic, { assert: OmfEc.experiment.assertion }) if vm.vm_topic
        }
      end
    end

  end
end


text:
*Internationalization* (often abbreviated *i18n* since there are 18 characters between the first "i"
and the last "n" in that word) allows Evennia's core server to return texts in other languages than
English - without anyone having to edit the source code. Take a look at the `locale` directory of
the Evennia installation, there you will find which languages are currently supported.

## Changing server language

Change language by adding the following to your `mygame/server/conf/settings.py` file:

```python
    USE_I18N = True
    LANGUAGE_CODE = 'en'
```

Here `'en'` should be changed to the abbreviation for one of the supported languages found in
`locale/`. Restart the server to activate i18n. The two-character international language codes are
found [here](http://www.science.co.il/Language/Codes.asp).

> Windows Note: If you get errors concerning `gettext` or `xgettext` on Windows, see the [Django
documentation](https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#gettext-on-windows). A
self-installing and up-to-date version of gettext for Windows (32/64-bit) is available on
[Github](https://github.com/mlocati/gettext-iconv-windows).

## Translating Evennia

> **Important Note:** Evennia offers translations of hard-coded strings in the server, things like
"Connection closed" or "Server restarted", strings that end users will see and which game devs are
not supposed to change on their own. Text you see in the log file or on the command line (like error
messages) are generally *not* translated (this is a part of Python).

> In addition, text in default Commands and in default Typeclasses will *not* be translated by
switching *i18n* language. To translate Commands and Typeclass hooks you must overload them in your
game directory and translate their returns to the language you want. This is because from Evennia's
perspective, adding *i18n* code to commands tend to add complexity to code that is *meant* to be
changed anyway. One of the goals of Evennia is to keep the user-changeable code as clean and easy-
to-read as possible.

If you cannot find your language in `evennia/locale/` it's because noone has translated it yet.
Alternatively you might have the language but find the translation bad ... You are welcome to help
improve the situation!

To start a new translation you need to first have cloned the Evennia repositry with GIT and
activated a python virtualenv as described on the [Getting Started](./Getting-Started) page. You now
need to `cd` to the `evennia/` directory. This is *not* your created game folder but the main
Evennia library folder. If you see a folder `locale/` then you are in the right place. From here you
run:

     evennia makemessages <language-code>

where `<language-code>` is the [two-letter locale code](http://www.science.co.il/Language/Codes.asp)
for the language you want, like 'sv' for Swedish or 'es' for Spanish. After a moment it will tell
you the language has been processed.  For instance:

     evennia makemessages sv

If you started a new language a new folder for that language will have emerged in the `locale/`
folder. Otherwise the system will just have updated the existing translation with eventual new
strings found in the server. Running this command will not overwrite any existing strings so you can
run it as much as you want.

> Note: in Django, the `makemessages` command prefixes the locale name by the `-l` option (`...
makemessages -l sv` for instance).  This syntax is not allowed in Evennia, due to the fact that `-l`
is the option to tail log files.  Hence, `makemessages` doesn't use the `-l` flag.

Next head to `locale/<language-code>/LC_MESSAGES` and edit the `**.po` file you find there.  You can
edit this with a normal text editor but it is easiest if you use a special po-file editor from the
web (search the web for "po editor" for many free alternatives).

The concept of translating is simple, it's just a matter of taking the english strings you find in
the `**.po` file and add your language's translation best you can. The `**.po` format (and many
supporting editors) allow you to mark translations as "fuzzy". This tells the system (and future
translators) that you are unsure about the translation, or that you couldn't find a translation that
exactly matched the intention of the original text. Other translators will see this and might be
able to improve it later.
Finally, you need to compile your translation into a more efficient form. Do so from the `evennia`
folder
again:

    evennia compilemessages

This will go through all languages and create/update compiled files (`**.mo`) for them. This needs
to be done whenever a `**.po` file is updated.

When you are done, send the `**.po` and `*.mo` file to the Evennia developer list (or push it into
your own repository clone) so we can integrate your translation into Evennia!


text:
.. pyqode documentation master file, created by
   sphinx-quickstart on Thu Nov 13 17:21:20 2014.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to pyqode.json's documentation!
=======================================

*pyqode.json* adds **JSON** support to `pyQode`_ (syntax highlither,
navigation panel, code folding,...).

- `Issue tracker`_
- `Wiki`_
- `API reference`_
- `Contributing`_
- `Changelog`_
- `Screenshots`_

This documentation contains the **API reference documentation** and the
**official examples**.

.. note:: We recommend you to start with the `Readme`_ and the `Wiki`_
          before reading this document

API reference:
==============

.. toctree::
   :maxdepth: 3

   pyqode.json

Examples:
=========

.. toctree::
   :maxdepth: 2

   examples

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. _Readme: https://github.com/pyQode/pyqode.json/blob/master/README.rst
.. _Screenshots: https://github.com/pyQode/pyQode/wiki/Screenshots-and-videos#pyqodepython-screenshots
.. _Issue tracker: https://github.com/pyQode/pyQode/issues
.. _Wiki: https://github.com/pyQode/pyQode/wiki
.. _API reference: http://pyqodejson.readthedocs.org/en/latest/
.. _pyQode: https://github.com/pyQode/pyQode
.. _Changelog: https://github.com/pyQode/pyqode.json/blob/master/CHANGELOG.rst
.. _Contributing: https://github.com/pyQode/pyqode.json/blob/master/CONTRIBUTING.rst


text:
/*global define*/

define(
  [
   'marionette',
   'templates',
   'ecommerce/cart/views/cartItem'
  ], function (Marionette,templates,CartItem) {

  "use strict";

  return Marionette.CompositeView.extend({
    template : templates.cart.cart,
    itemView : CartItem,
    itemViewContainer : '#list',
  });

});