code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
--X-セイバー パシウル
function c23093604.initial_effect(c)
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(23093604,0))
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCondition(c23093604.condition)
e1:SetTarget(c23093604.target)
e1:SetOperation(c23093604.operation)
c:RegisterEffect(e1)
--battle indestructable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(1)
c:RegisterEffect(e2)
end
function c23093604.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFaceup() and e:GetHandler():IsDefencePos() and Duel.GetTurnPlayer()~=tp
end
function c23093604.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1000)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,tp,1000)
end
function c23093604.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
| Lsty/ygopro-scripts | c23093604.lua | Lua | gpl-2.0 | 1,285 | [
30522,
1011,
1011,
1060,
1990,
1708,
30221,
30244,
30265,
1718,
30232,
30222,
30259,
3853,
29248,
14142,
2683,
21619,
2692,
2549,
1012,
3988,
1035,
3466,
1006,
1039,
1007,
1011,
1011,
4053,
2334,
1041,
2487,
1027,
3466,
1012,
3443,
12879,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Collections.Generic;
using System.Collections.Immutable;
using Roslyn.Utilities;
using System.Reflection.Metadata;
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
/// <summary>
/// A representation of a method symbol that is intended only to be used for comparison purposes
/// (esp in MethodSignatureComparer).
/// </summary>
internal sealed class SignatureOnlyMethodSymbol : MethodSymbol
{
private readonly string _name;
private readonly TypeSymbol _containingType;
private readonly MethodKind _methodKind;
private readonly Cci.CallingConvention _callingConvention;
private readonly ImmutableArray<TypeParameterSymbol> _typeParameters;
private readonly ImmutableArray<ParameterSymbol> _parameters;
private readonly RefKind _refKind;
private readonly bool _isInitOnly;
private readonly bool _isStatic;
private readonly TypeWithAnnotations _returnType;
private readonly ImmutableArray<CustomModifier> _refCustomModifiers;
private readonly ImmutableArray<MethodSymbol> _explicitInterfaceImplementations;
public SignatureOnlyMethodSymbol(
string name,
TypeSymbol containingType,
MethodKind methodKind,
Cci.CallingConvention callingConvention,
ImmutableArray<TypeParameterSymbol> typeParameters,
ImmutableArray<ParameterSymbol> parameters,
RefKind refKind,
bool isInitOnly,
bool isStatic,
TypeWithAnnotations returnType,
ImmutableArray<CustomModifier> refCustomModifiers,
ImmutableArray<MethodSymbol> explicitInterfaceImplementations)
{
Debug.Assert(returnType.IsDefault || isInitOnly == CustomModifierUtils.HasIsExternalInitModifier(returnType.CustomModifiers));
_callingConvention = callingConvention;
_typeParameters = typeParameters;
_refKind = refKind;
_isInitOnly = isInitOnly;
_isStatic = isStatic;
_returnType = returnType;
_refCustomModifiers = refCustomModifiers;
_parameters = parameters;
_explicitInterfaceImplementations = explicitInterfaceImplementations.NullToEmpty();
_containingType = containingType;
_methodKind = methodKind;
_name = name;
}
internal override Cci.CallingConvention CallingConvention { get { return _callingConvention; } }
public override bool IsVararg { get { return new SignatureHeader((byte)_callingConvention).CallingConvention == SignatureCallingConvention.VarArgs; } }
public override bool IsGenericMethod { get { return Arity > 0; } }
public override int Arity { get { return _typeParameters.Length; } }
public override ImmutableArray<TypeParameterSymbol> TypeParameters { get { return _typeParameters; } }
public override bool ReturnsVoid { get { return _returnType.IsVoidType(); } }
public override RefKind RefKind { get { return _refKind; } }
public override TypeWithAnnotations ReturnTypeWithAnnotations { get { return _returnType; } }
public override FlowAnalysisAnnotations ReturnTypeFlowAnalysisAnnotations => FlowAnalysisAnnotations.None;
public override ImmutableHashSet<string> ReturnNotNullIfParameterNotNull => ImmutableHashSet<string>.Empty;
public override FlowAnalysisAnnotations FlowAnalysisAnnotations => FlowAnalysisAnnotations.None;
public override ImmutableArray<CustomModifier> RefCustomModifiers { get { return _refCustomModifiers; } }
public override ImmutableArray<ParameterSymbol> Parameters { get { return _parameters; } }
public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations { get { return _explicitInterfaceImplementations; } }
public override Symbol ContainingSymbol { get { return _containingType; } }
public override MethodKind MethodKind { get { return _methodKind; } }
public override string Name { get { return _name; } }
internal sealed override bool IsNullableAnalysisEnabled() => throw ExceptionUtilities.Unreachable;
#region Not used by MethodSignatureComparer
internal override bool GenerateDebugInfo { get { throw ExceptionUtilities.Unreachable; } }
internal override bool HasSpecialName { get { throw ExceptionUtilities.Unreachable; } }
internal override System.Reflection.MethodImplAttributes ImplementationAttributes { get { throw ExceptionUtilities.Unreachable; } }
internal override bool RequiresSecurityObject { get { throw ExceptionUtilities.Unreachable; } }
public override DllImportData GetDllImportData() { return null; }
internal override MarshalPseudoCustomAttributeData ReturnValueMarshallingInformation { get { throw ExceptionUtilities.Unreachable; } }
internal override bool HasDeclarativeSecurity { get { throw ExceptionUtilities.Unreachable; } }
internal override IEnumerable<Microsoft.Cci.SecurityAttribute> GetSecurityInformation() { throw ExceptionUtilities.Unreachable; }
internal override ObsoleteAttributeData ObsoleteAttributeData { get { throw ExceptionUtilities.Unreachable; } }
internal sealed override UnmanagedCallersOnlyAttributeData GetUnmanagedCallersOnlyAttributeData(bool forceComplete) => throw ExceptionUtilities.Unreachable;
internal override ImmutableArray<string> GetAppliedConditionalSymbols() { throw ExceptionUtilities.Unreachable; }
public override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations { get { throw ExceptionUtilities.Unreachable; } }
public override Symbol AssociatedSymbol { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsExtensionMethod { get { throw ExceptionUtilities.Unreachable; } }
public override bool HidesBaseMethodsByName { get { throw ExceptionUtilities.Unreachable; } }
public override ImmutableArray<Location> Locations { get { throw ExceptionUtilities.Unreachable; } }
public override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences { get { throw ExceptionUtilities.Unreachable; } }
public override Accessibility DeclaredAccessibility { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsStatic { get { return _isStatic; } }
public override bool IsAsync { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsVirtual { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsOverride { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsAbstract { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsSealed { get { throw ExceptionUtilities.Unreachable; } }
public override bool IsExtern { get { throw ExceptionUtilities.Unreachable; } }
public override bool AreLocalsZeroed { get { throw ExceptionUtilities.Unreachable; } }
public override AssemblySymbol ContainingAssembly { get { throw ExceptionUtilities.Unreachable; } }
internal override ModuleSymbol ContainingModule { get { throw ExceptionUtilities.Unreachable; } }
internal sealed override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) { throw ExceptionUtilities.Unreachable; }
internal sealed override bool IsMetadataVirtual(bool ignoreInterfaceImplementationChanges = false) { throw ExceptionUtilities.Unreachable; }
internal override bool IsMetadataFinal
{
get
{
throw ExceptionUtilities.Unreachable;
}
}
internal override bool IsDeclaredReadOnly => false;
internal override bool IsInitOnly => _isInitOnly;
internal override int CalculateLocalSyntaxOffset(int localPosition, SyntaxTree localTree) { throw ExceptionUtilities.Unreachable; }
#endregion
}
}
| CyrusNajmabadi/roslyn | src/Compilers/CSharp/Portable/Symbols/SignatureOnlyMethodSymbol.cs | C# | mit | 8,330 | [
30522,
1013,
1013,
7000,
2000,
1996,
1012,
5658,
3192,
2104,
2028,
2030,
2062,
10540,
1012,
1013,
30524,
10210,
6105,
1012,
1013,
1013,
2156,
1996,
6105,
5371,
1999,
1996,
2622,
7117,
2005,
2062,
2592,
1012,
1001,
19701,
3085,
4487,
19150,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.openthinks.libs.utilities.lookup;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import com.openthinks.libs.utilities.Checker;
import com.openthinks.libs.utilities.InstanceUtilities;
import com.openthinks.libs.utilities.InstanceUtilities.InstanceWrapper;
import com.openthinks.libs.utilities.exception.CheckerNoPassException;
import com.openthinks.libs.utilities.pools.object.ObjectPool;
/**
* ClassName: LookupPool <br>
* Function: It is used for store shared object instances and find other SPI<br>
* Reason: follow the design pattern of fly weight to reduce instantiate new object. <br>
* Notice: avoid store or find those object which include its own state and will be changed;<br>
* Usage:<br>
*
* <pre>
* <code>
* //get gloabl instance of LookupPool
* LookupPool lookupPool = LookupPools.gloabl();
*
* //get a named instance of LookupPool
* lookupPool = LookupPools.get("pool-1");
*
* // instance by class directly
* LookupInterfaceImpl instanceImpl1 = lookupPool.lookup(LookupInterfaceImpl.class);
*
* // instance by customized implementation class
* LookupInterface instanceImpl2 = lookupPool.lookup(LookupInterface.class,InstanceWrapper.build(LookupInterfaceImpl.class));
*
* // lookup shared object already existed
* LookupInterface instanceImpl3 = lookupPool.lookup(LookupInterface.class);
* assert instanceImpl2==instanceImpl3 ;
*
* // register a shared object by name
* lookupPool.register("beanName1",instanceImpl1);
* // lookup shared object by name
* LookupInterface instanceImpl4 = lookupPool.lookup("beanName1");
*
* assert instanceImpl1==instanceImpl4 ;
*
* // clear all shared objects and mappings
* lookupPool.cleanUp();
*
* </code>
* </pre>
*
* date: Sep 8, 2017 3:15:29 PM <br>
*
* @author dailey.yet@outlook.com
* @version 1.0
* @since JDK 1.8
*/
public abstract class LookupPool {
protected final ObjectPool objectPool;
protected final ReadWriteLock lock;
public abstract String name();
protected LookupPool() {
objectPool = new ObjectPool();
lock = new ReentrantReadWriteLock();
}
/**
* lookup a object by its type, if not find firstly, try to instance by instanceType and
* constructor parameters args
*
* @param <T> lookup object type
* @param type Class lookup key type
* @param args Object[] instance constructor parameters
* @return T lookup object or null
*/
public <T> T lookup(Class<T> type, Object... args) {
return lookup(type, null, args);
}
/**
* lookup a object by its type, if not find firstly, try to instance by instanceType and
* constructor parameters args
*
* @param <T> lookup object type
* @param <E> lookup object type
* @param searchType Class lookup key type
* @param instancewrapper Class instance type when not lookup the key
* @param args Object[] instance constructor parameters
* @return T lookup object or null
*/
public <T, E extends T> T lookup(final Class<T> searchType, InstanceWrapper<E> instancewrapper,
Object... args) {
T object = null;
lock.readLock().lock();
try {
object = objectPool.get(searchType);
} finally {
lock.readLock().unlock();
}
if (object == null) {
lock.writeLock().lock();
try {
object = InstanceUtilities.create(searchType, instancewrapper, args);
register(searchType, object);
} finally {
lock.writeLock().unlock();
}
}
return object;
}
/**
* look up object by its bean name
*
* @param <T> lookup object type
* @param beanName String lookup object mapping name
* @return T lookup object or null
*/
public <T> T lookup(String beanName) {
lock.readLock().lock();
try {
return objectPool.get(beanName);
} finally {
lock.readLock().unlock();
}
}
/**
* lookup a optional object by its type, if not find firstly, try to instance by instanceType and
* constructor parameters args
*
* @param <T> lookup object type
* @param type Class lookup key type
* @param args Object[] instance constructor parameters
* @return Optional of lookup object
*/
public <T> Optional<T> lookupIf(Class<T> type, Object... args) {
return Optional.ofNullable(lookup(type, args));
}
/**
* lookup a optional object by its type, if not find firstly, try to instance by instanceType and
* constructor parameters args
*
* @param <T> lookup object type
* @param <E> lookup object type
* @param searchType Class lookup key type
* @param instancewrapper Class instance type when not lookup the key
* @param args Object[] instance constructor parameters
* @return Optional of lookup object
*/
public <T, E extends T> Optional<T> lookupIf(final Class<T> searchType,
InstanceWrapper<E> instancewrapper, Object... args) {
return Optional.ofNullable(lookup(searchType, instancewrapper, args));
}
/**
* look up optional object by its bean name
*
* @param <T> lookup object type
* @param beanName String lookup object mapping name
* @return Optional of lookup object
*/
public <T> Optional<T> lookupIf(String beanName) {
return Optional.ofNullable(lookup(beanName));
}
/**
*
* lookupSPI:this will used {@link ServiceLoader} to load SPI which defined in folder
* <B>META-INF/services</B>. <br>
* It will first to try to load instance from cached {@link ObjectPool}, if not found, then try to
* load SPI class and instantiate it.<br>
* Notice: only load and instantiate first SPI class in defined file<br>
*
* @param <T> lookup SPI interface class
* @param spiInterface SPI interface or abstract class type
* @param args constructor arguments
* @return implementation of parameter spiInterface
*/
public <T> T lookupSPI(Class<T> spiInterface, Object... args) {
return lookupFocusSPI(spiInterface, null, args);
}
/**
*
* lookupFocusSPI:this will used {@link ServiceLoader} to load SPI which defined in folder
* <B>META-INF/services</B>. <br>
* It will first to try to load instance from cached {@link ObjectPool}, if not found, then try to
* load SPI class and instantiate it.<br>
* Notice: only load and instantiate focused SPI class in defined file<br>
*
* @param <T> lookup SPI interface class
* @param spiInterface SPI interface or abstract class type
* @param focusClassName focused SPI implementation class aname
* @param args constructor arguments
* @return implementation of parameter spiInterface
*
*/
public <T> T lookupFocusSPI(Class<T> spiInterface, String focusClassName, Object... args) {
T object = null;
lock.readLock().lock();
try {
object = objectPool.get(spiInterface);
} finally {
lock.readLock().unlock();
}
if (object == null) {
lock.writeLock().lock();
try {
ServiceLoader<T> serviceLoader = ServiceLoader.load(spiInterface, focusClassName, args);
object = serviceLoader.iterator().next();
Checker.require(object).notNull("Cannot found SPI implementation for " + spiInterface);
register(spiInterface, object);
} finally {
lock.writeLock().unlock();
}
}
return object;
}
/**
*
* lookupSPISkipCache:this will used {@link ServiceLoader} to load SPI which defined in folder
* <B>META-INF/services</B>. <br>
* It will do load SPI skip cache each time, not try to lookup from cache firstly.<br>
* Notice: only load and instantiate first SPI class in defined file<br>
*
* @param <T> lookup SPI interface class
* @param spiInterface SPI interface or abstract class type
* @param args constructor arguments
* @return implementation of parameter spiInterface
* @throws CheckerNoPassException when not found implementation SPI
*/
public <T> T lookupSPISkipCache(Class<T> spiInterface, Object... args) {
return lookupFocusSPISkipCache(spiInterface, null, args);
}
/**
*
* lookupFocusSPISkipCache:this will used {@link ServiceLoader} to load SPI which defined in
* folder <B>META-INF/services</B>. <br>
* It will do load SPI skip cache each time, not try to lookup from cache firstly.<br>
* Notice: only load and instantiate focused SPI class in defined file<br>
*
* @param <T> lookup SPI interface class
* @param spiInterface SPI interface or abstract class type
* @param focusClassName focused SPI implementation class name
* @param args constructor arguments
* @return implementation of parameter spiInterface
*
* @throws CheckerNoPassException when not found implementation SPI
*/
public <T> T lookupFocusSPISkipCache(Class<T> spiInterface, String focusClassName,
Object... args) {
T object = null;
ServiceLoader<T> serviceLoader = ServiceLoader.load(spiInterface, focusClassName, args);
object = serviceLoader.iterator().next();
Checker.require(object).notNull("Cannot found SPI implementation for " + spiInterface);
return object;
}
/**
*
* lookupAllSPI:fina all instance of SPI implementation. <br>
* Notice:<BR>
* <ul>
* <li>all implementation need default constructor.</li>
* <li>do not search from cache</li>
* </ul>
*
* @param <T> SPI type
* @param spiInterface SPI interface or abstract class type
* @return list of all SPI implementation instance
*/
public <T> List<T> lookupAllSPI(Class<T> spiInterface) {
List<T> list = new ArrayList<>();
ServiceLoader<T> serviceLoader = ServiceLoader.load(spiInterface);
Iterator<T> iterator = serviceLoader.iterator();
while (iterator.hasNext()) {
try {
list.add(iterator.next());
} catch (Exception e) {
// ignore
}
}
return list;
}
/**
*
* register an instance, which key is object.getClass(). <br>
*
* @param <T> registered object class type
* @param object instance which need registered
*/
public <T> void register(T object) {
if (object != null) {
lock.writeLock().tryLock();
try {
objectPool.put(object.getClass(), object);
} finally {
lock.writeLock().unlock();
}
}
}
/**
* register an instance, which key is given parameter classType
*
* @param <T> registered object class type
* @param classType Class as the key for registered instance
* @param object instance which need registered
*/
public <T> void register(Class<T> classType, T object) {
if (object != null) {
lock.writeLock().tryLock();
try {
objectPool.put(classType, object);
} finally {
lock.writeLock().unlock();
}
}
}
/**
* register object and mapping it to given bean name
*
* @param <T> register object type
* @param beanName String bean name
* @param object register object
*/
public <T> void register(String beanName, T object) {
if (object != null) {
lock.writeLock().lock();
try {
objectPool.put(beanName, object);
} finally {
lock.writeLock().unlock();
}
}
}
protected void cleanUp() {
lock.writeLock().lock();
try {
objectPool.cleanUp();
} finally {
lock.writeLock().unlock();
}
}
}
| daileyet/openlibs.utilities | src/main/java/com/openthinks/libs/utilities/lookup/LookupPool.java | Java | apache-2.0 | 11,805 | [
30522,
30524,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2009,
6906,
4263,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
11887,
1025,
12324,
9262,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'rails_helper'
RSpec.describe ApplicationSubmissionVerdictsController, type: :controller do
end
| lorefnon/corealis | spec/controllers/application_submission_verdicts_controller_spec.rb | Ruby | gpl-3.0 | 106 | [
30522,
5478,
1005,
15168,
1035,
2393,
2121,
1005,
12667,
5051,
2278,
1012,
6235,
5097,
12083,
25481,
6299,
29201,
9363,
3372,
26611,
1010,
2828,
1024,
1024,
11486,
2079,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#include <google/protobuf/stubs/common.h>
#include <sweep/sweep.hpp>
#include <zmq.hpp>
#include "net.pb.h"
static void usage() {
std::cout << "Usage: example-net /dev/ttyUSB0 [ publisher | subscriber ]\n";
std::exit(EXIT_SUCCESS);
}
void subscriber() {
zmq::context_t ctx{/*io_threads=*/1};
zmq::socket_t sub{ctx, ZMQ_SUB};
sub.connect("tcp://127.0.0.1:5555");
sub.setsockopt(ZMQ_SUBSCRIBE, "", 0);
std::cout << "Subscribing." << std::endl;
for (;;) {
zmq::message_t msg;
if (!sub.recv(&msg))
continue;
sweep::proto::scan in;
in.ParseFromArray(msg.data(), msg.size());
const auto n = in.angle_size();
for (auto i = 0; i < n; ++i) {
std::cout << "Angle: " << in.angle(i) //
<< " Distance: " << in.distance(i) //
<< " Signal strength: " << in.signal_strength(i) //
<< std::endl;
}
}
}
void publisher(const std::string& dev) try {
zmq::context_t ctx{/*io_threads=*/1};
zmq::socket_t pub{ctx, ZMQ_PUB};
pub.bind("tcp://127.0.0.1:5555");
sweep::sweep device{dev.c_str()};
// Begins data acquisition as soon as motor speed stabilizes
device.start_scanning();
std::cout << "Publishing. Each dot is a full 360 degree scan." << std::endl;
for (;;) {
const sweep::scan scan = device.get_scan();
sweep::proto::scan out;
for (const sweep::sample& sample : scan.samples) {
out.add_angle(sample.angle);
out.add_distance(sample.distance);
out.add_signal_strength(sample.signal_strength);
}
auto encoded = out.SerializeAsString();
zmq::message_t msg{encoded.size()};
std::memcpy(msg.data(), encoded.data(), encoded.size());
const auto ok = pub.send(msg);
if (ok)
std::cout << "." << std::flush;
}
device.stop_scanning();
} catch (const sweep::device_error& e) {
std::cerr << "Error: " << e.what() << '\n';
}
int main(int argc, char* argv[]) {
std::vector<std::string> args{argv, argv + argc};
if (args.size() != 3)
usage();
const auto isPublisher = args[2] == "publisher";
const auto isSubscriber = args[2] == "subscriber";
if (!isPublisher && !isSubscriber)
usage();
GOOGLE_PROTOBUF_VERIFY_VERSION;
struct AtExit {
~AtExit() { ::google::protobuf::ShutdownProtobufLibrary(); }
} sentry;
if (isPublisher)
publisher(args[1]);
if (isSubscriber)
subscriber();
}
| PeterJohnson/sweep-sdk | libsweep/examples/net.cc | C++ | mit | 2,553 | [
30522,
1001,
2421,
1026,
20116,
2102,
19422,
12322,
1028,
1001,
2421,
1026,
20116,
18886,
3070,
1028,
1001,
2421,
1026,
16380,
25379,
1028,
1001,
2421,
1026,
2009,
6906,
4263,
1028,
1001,
2421,
1026,
5164,
1028,
1001,
2421,
1026,
9207,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.redis.exception;
public enum MyExceptionType implements ExceptionType {
NO_DATA(-1,"未查询到您需要的数据"),
PAID(0,"支付已成功")
;
private int code;
private String describe;
private MyExceptionType(int code, String describe) {
this.code = code;
this.describe = describe;
}
@Override
public int getCode() {
return code;
}
@Override
public String getDescribe() {
return describe;
}
}
| 499504777/spring-redis | redis-service/src/main/java/com/redis/exception/MyExceptionType.java | Java | mit | 443 | [
30522,
7427,
4012,
1012,
2417,
2483,
1012,
6453,
1025,
2270,
4372,
2819,
2026,
10288,
24422,
13874,
22164,
6453,
13874,
1063,
2053,
1035,
2951,
1006,
1011,
1015,
1010,
1000,
100,
100,
100,
100,
100,
100,
100,
1916,
100,
100,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* @flow */
/* global Navigator, navigator */
import config from 'config';
import * as React from 'react';
import { Helmet } from 'react-helmet';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import NestedStatus from 'react-nested-status';
import { compose } from 'redux';
// We have to import these styles first to have them listed first in the final
// CSS file. See: https://github.com/mozilla/addons-frontend/issues/3565
// The order is important: font files need to be first, with the subset after
// the full font file.
import 'fonts/inter.scss';
import 'fonts/inter-subset.scss';
import 'normalize.css/normalize.css';
import './styles.scss';
/* eslint-disable import/first */
import Routes from 'amo/components/Routes';
import ScrollToTop from 'amo/components/ScrollToTop';
import NotAuthorizedPage from 'amo/pages/ErrorPages/NotAuthorizedPage';
import NotFoundPage from 'amo/pages/ErrorPages/NotFoundPage';
import ServerErrorPage from 'amo/pages/ErrorPages/ServerErrorPage';
import { getClientAppAndLangFromPath, isValidClientApp } from 'amo/utils';
import { addChangeListeners } from 'amo/addonManager';
import {
setClientApp as setClientAppAction,
setUserAgent as setUserAgentAction,
} from 'amo/reducers/api';
import { setInstallState } from 'amo/reducers/installations';
import { CLIENT_APP_ANDROID } from 'amo/constants';
import ErrorPage from 'amo/components/ErrorPage';
import translate from 'amo/i18n/translate';
import log from 'amo/logger';
import type { AppState } from 'amo/store';
import type { DispatchFunc } from 'amo/types/redux';
import type { InstalledAddon } from 'amo/reducers/installations';
import type { I18nType } from 'amo/types/i18n';
import type { ReactRouterLocationType } from 'amo/types/router';
/* eslint-enable import/first */
interface MozNavigator extends Navigator {
mozAddonManager?: Object;
}
type PropsFromState = {|
clientApp: string,
lang: string,
userAgent: string | null,
|};
type DefaultProps = {|
_addChangeListeners: (callback: Function, mozAddonManager: Object) => any,
_navigator: typeof navigator | null,
mozAddonManager: $PropertyType<MozNavigator, 'mozAddonManager'>,
userAgent: string | null,
|};
type Props = {|
...PropsFromState,
...DefaultProps,
handleGlobalEvent: () => void,
i18n: I18nType,
location: ReactRouterLocationType,
setClientApp: (clientApp: string) => void,
setUserAgent: (userAgent: string) => void,
|};
export function getErrorPage(status: number | null): () => React.Node {
switch (status) {
case 401:
return NotAuthorizedPage;
case 404:
return NotFoundPage;
case 500:
default:
return ServerErrorPage;
}
}
export class AppBase extends React.Component<Props> {
scheduledLogout: TimeoutID;
static defaultProps: DefaultProps = {
_addChangeListeners: addChangeListeners,
_navigator: typeof navigator !== 'undefined' ? navigator : null,
mozAddonManager: config.get('server')
? {}
: (navigator: MozNavigator).mozAddonManager,
userAgent: null,
};
componentDidMount() {
const {
_addChangeListeners,
_navigator,
handleGlobalEvent,
mozAddonManager,
setUserAgent,
userAgent,
} = this.props;
// Use addonManager.addChangeListener to setup and filter events.
_addChangeListeners(handleGlobalEvent, mozAddonManager);
// If userAgent isn't set in state it could be that we couldn't get one
// from the request headers on our first (server) request. If that's the
// case we try to load them from navigator.
if (!userAgent && _navigator && _navigator.userAgent) {
log.info(
'userAgent not in state on App load; using navigator.userAgent.',
);
setUserAgent(_navigator.userAgent);
}
}
componentDidUpdate() {
const { clientApp, location, setClientApp } = this.props;
const { clientApp: clientAppFromURL } = getClientAppAndLangFromPath(
location.pathname,
);
if (isValidClientApp(clientAppFromURL) && clientAppFromURL !== clientApp) {
setClientApp(clientAppFromURL);
}
}
render(): React.Node {
const { clientApp, i18n, lang } = this.props;
const i18nValues = {
locale: lang,
};
let defaultTitle = i18n.sprintf(
i18n.gettext('Add-ons for Firefox (%(locale)s)'),
i18nValues,
);
let titleTemplate = i18n.sprintf(
i18n.gettext('%(title)s – Add-ons for Firefox (%(locale)s)'),
// We inject `%s` as a named argument to avoid localizer mistakes. Helmet
// will replace `%s` by the title supplied in other pages.
{ ...i18nValues, title: '%s' },
);
if (clientApp === CLIENT_APP_ANDROID) {
defaultTitle = i18n.sprintf(
i18n.gettext('Add-ons for Firefox Android (%(locale)s)'),
i18nValues,
);
titleTemplate = i18n.sprintf(
i18n.gettext('%(title)s – Add-ons for Firefox Android (%(locale)s)'),
// We inject `%s` as a named argument to avoid localizer mistakes.
// Helmet will replace `%s` by the title supplied in other pages.
{ ...i18nValues, title: '%s' },
);
}
return (
<NestedStatus code={200}>
<ScrollToTop>
<Helmet defaultTitle={defaultTitle} titleTemplate={titleTemplate} />
<ErrorPage getErrorComponent={getErrorPage}>
<Routes />
</ErrorPage>
</ScrollToTop>
</NestedStatus>
);
}
}
export const mapStateToProps = (state: AppState): PropsFromState => ({
clientApp: state.api.clientApp,
lang: state.api.lang,
userAgent: state.api.userAgent,
});
export function mapDispatchToProps(dispatch: DispatchFunc): {|
handleGlobalEvent: (payload: InstalledAddon) => void,
setClientApp: (clientApp: string) => void,
setUserAgent: (userAgent: string) => void,
|} {
return {
handleGlobalEvent(payload: InstalledAddon) {
dispatch(setInstallState(payload));
},
setClientApp(clientApp: string) {
dispatch(setClientAppAction(clientApp));
},
setUserAgent(userAgent: string) {
dispatch(setUserAgentAction(userAgent));
},
};
}
const App: React.ComponentType<Props> = compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
translate(),
)(AppBase);
export default App;
| mozilla/addons-frontend | src/amo/components/App/index.js | JavaScript | mpl-2.0 | 6,317 | [
30522,
1013,
1008,
1030,
4834,
1008,
1013,
1013,
1008,
3795,
20532,
1010,
20532,
1008,
1013,
12324,
9530,
8873,
2290,
2013,
1005,
9530,
8873,
2290,
1005,
1025,
12324,
1008,
2004,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
1063,
10412,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>railroad-crossing: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.14.0 / railroad-crossing - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
railroad-crossing
<small>
8.10.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-12-17 13:03:57 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-17 13:03:57 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 3 Virtual package relying on a GMP lib system installation
coq 8.14.0 Formal proof management system
dune 2.9.1 Fast, portable, and opinionated build system
ocaml 4.08.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.08.1 Official release 4.08.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.1 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/railroad-crossing"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/RailroadCrossing"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: CTL"
"keyword: TCTL"
"keyword: real time"
"keyword: timed automatas"
"keyword: safety"
"keyword: concurrency properties"
"keyword: invariants"
"keyword: non-Zeno"
"keyword: discrete time"
"category: Computer Science/Concurrent Systems and Protocols/Correctness of specific protocols"
"date: February-March 2000"
]
authors: [
"Carlos Daniel Luna [http://www.fing.edu.uy/~cluna]"
]
bug-reports: "https://github.com/coq-contribs/railroad-crossing/issues"
dev-repo: "git+https://github.com/coq-contribs/railroad-crossing.git"
synopsis: "The Railroad Crossing Example"
description: """
This library present the specification and verification of
one real time system: the Railroad Crossing Problem, which has been
proposed as a benchmark for the comparison of real-time formalisms. We
specify the system using timed automatas (timed graphs) with discrete
time and we prove invariants, the system safety property and the NonZeno
property, using the logics CTL and TCTL."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/railroad-crossing/archive/v8.10.0.tar.gz"
checksum: "md5=6b070cfc66b79c57cdbd3d4ed55a0ee4"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-railroad-crossing.8.10.0 coq.8.14.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.14.0).
The following dependencies couldn't be met:
- coq-railroad-crossing -> coq < 8.11~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-railroad-crossing.8.10.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.08.1-2.0.5/released/8.14.0/railroad-crossing/8.10.0.html | HTML | mit | 7,698 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (C) 2005 Kimmo Pekkola
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <windows.h>
#include <string>
#include <vector>
#include <time.h>
#include <shlwapi.h>
#include <random>
#include "../API/RainmeterAPI.h"
#include "../../Common/StringUtil.h"
#define BUFFER_SIZE 4096
template <typename T>
T GetRandomNumber(T size)
{
static std::mt19937 s_Engine((unsigned)time(nullptr));
const std::uniform_int_distribution<T> distribution(0, size);
return distribution(s_Engine);
}
struct MeasureData
{
std::wstring pathname;
std::wstring separator;
std::vector<std::wstring> files;
std::wstring value;
};
void ScanFolder(std::vector<std::wstring>& files, std::vector<std::wstring>& filters, bool bSubfolders, const std::wstring& path)
{
// Get folder listing
WIN32_FIND_DATA fileData; // Data structure describes the file found
HANDLE hSearch; // Search handle returned by FindFirstFile
std::wstring searchPath = path + L"*";
hSearch = FindFirstFile(searchPath.c_str(), &fileData);
if (hSearch == INVALID_HANDLE_VALUE) return; // No more files found
do
{
if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (bSubfolders &&
wcscmp(fileData.cFileName, L".") != 0 &&
wcscmp(fileData.cFileName, L"..") != 0)
{
ScanFolder(files, filters, bSubfolders, path + fileData.cFileName + L"\\");
}
}
else
{
if (!filters.empty())
{
for (size_t i = 0; i < filters.size(); ++i)
{
if (!filters[i].empty() && PathMatchSpec(fileData.cFileName, filters[i].c_str()))
{
files.push_back(path + fileData.cFileName);
break;
}
}
}
else
{
files.push_back(path + fileData.cFileName);
}
}
}
while (FindNextFile(hSearch, &fileData));
FindClose(hSearch);
}
PLUGIN_EXPORT void Initialize(void** data, void* rm)
{
MeasureData* measure = new MeasureData;
*data = measure;
}
PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
{
MeasureData* measure = (MeasureData*)data;
measure->pathname = RmReadPath(rm, L"PathName", L"");
if (PathIsDirectory(measure->pathname.c_str()))
{
std::vector<std::wstring> fileFilters;
LPCWSTR filter = RmReadString(rm, L"FileFilter", L"");
if (*filter)
{
std::wstring ext = filter;
size_t start = 0;
size_t pos = ext.find(L';');
while (pos != std::wstring::npos)
{
fileFilters.push_back(ext.substr(start, pos - start));
start = pos + 1;
pos = ext.find(L';', pos + 1);
}
fileFilters.push_back(ext.substr(start));
}
if (measure->pathname[measure->pathname.size() - 1] != L'\\')
{
measure->pathname += L"\\";
}
// Scan files
measure->files.clear();
bool bSubfolders = RmReadInt(rm, L"Subfolders", 1) == 1;
ScanFolder(measure->files, fileFilters, bSubfolders, measure->pathname);
}
else
{
measure->separator = RmReadString(rm, L"Separator", L"\n");
}
}
PLUGIN_EXPORT double Update(void* data)
{
MeasureData* measure = (MeasureData*)data;
if (measure->files.empty())
{
BYTE buffer[BUFFER_SIZE + 2];
buffer[BUFFER_SIZE] = 0;
// Read the file
FILE* file = _wfopen(measure->pathname.c_str(), L"r");
if (file)
{
// Check if the file is unicode or ascii
fread(buffer, sizeof(WCHAR), 1, file);
fseek(file, 0, SEEK_END);
long size = ftell(file);
if (size > 0)
{
// Go to a random place
long pos = GetRandomNumber(size);
fseek(file, (pos / 2) * 2, SEEK_SET);
measure->value.clear();
if (0xFEFF == *(WCHAR*)buffer)
{
// It's unicode
WCHAR* wBuffer = (WCHAR*)buffer;
// Read until we find the first separator
WCHAR* sepPos1 = nullptr;
WCHAR* sepPos2 = nullptr;
do
{
size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file);
buffer[len] = 0;
buffer[len + 1] = 0;
sepPos1 = wcsstr(wBuffer, measure->separator.c_str());
if (sepPos1 == nullptr)
{
// The separator wasn't found
if (feof(file))
{
// End of file reached -> read from start
fseek(file, 2, SEEK_SET);
len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file);
buffer[len] = 0;
buffer[len + 1] = 0;
sepPos1 = wBuffer;
}
// else continue reading
}
else
{
sepPos1 += measure->separator.size();
}
}
while (sepPos1 == nullptr);
// Find the second separator
do
{
sepPos2 = wcsstr(sepPos1, measure->separator.c_str());
if (sepPos2 == nullptr)
{
// The separator wasn't found
if (feof(file))
{
// End of file reached -> read the rest
measure->value += sepPos1;
break;
}
else
{
measure->value += sepPos1;
// else continue reading
size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file);
buffer[len] = 0;
buffer[len + 1] = 0;
sepPos1 = wBuffer;
}
}
else
{
if (sepPos2)
{
*sepPos2 = 0;
}
// Read until we find the second separator
measure->value += sepPos1;
}
}
while (sepPos2 == nullptr);
}
else
{
// It's ascii
char* aBuffer = (char*)buffer;
const std::string separator = StringUtil::Narrow(measure->separator);
const char* separatorSz = separator.c_str();
// Read until we find the first separator
char* sepPos1 = nullptr;
char* sepPos2 = nullptr;
do
{
size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file);
aBuffer[len] = 0;
sepPos1 = strstr(aBuffer, separatorSz);
if (sepPos1 == nullptr)
{
// The separator wasn't found
if (feof(file))
{
// End of file reached -> read from start
fseek(file, 0, SEEK_SET);
len = fread(buffer, sizeof(char), BUFFER_SIZE, file);
aBuffer[len] = 0;
sepPos1 = aBuffer;
}
// else continue reading
}
else
{
sepPos1 += separator.size();
}
}
while (sepPos1 == nullptr);
// Find the second separator
do
{
sepPos2 = strstr(sepPos1, separatorSz);
if (sepPos2 == nullptr)
{
// The separator wasn't found
if (feof(file))
{
// End of file reached -> read the rest
measure->value += StringUtil::Widen(sepPos1);
break;
}
else
{
measure->value += StringUtil::Widen(sepPos1);
// else continue reading
size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file);
aBuffer[len] = 0;
sepPos1 = aBuffer;
}
}
else
{
if (sepPos2)
{
*sepPos2 = 0;
}
// Read until we find the second separator
measure->value += StringUtil::Widen(sepPos1);
}
}
while (sepPos2 == nullptr);
}
}
fclose(file);
}
}
else
{
// Select the filename
measure->value = measure->files[GetRandomNumber(measure->files.size() - 1)];
}
return 0;
}
PLUGIN_EXPORT LPCWSTR GetString(void* data)
{
MeasureData* measure = (MeasureData*)data;
return measure->value.c_str();
}
PLUGIN_EXPORT void Finalize(void* data)
{
MeasureData* measure = (MeasureData*)data;
delete measure;
} | pyq881120/rainmeter | Plugins/PluginQuote/Quote.cpp | C++ | gpl-2.0 | 8,297 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2384,
5035,
5302,
21877,
22426,
2721,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
1996,
3408,
1997,
1996,
27004,
2236,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TaskShim.cs" company="Catel development team">
// Copyright (c) 2008 - 2015 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
#if NET40 || SL5
#define USE_TASKEX
#endif
namespace Catel.Threading
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#if USE_TASKEX
using Microsoft.Runtime.CompilerServices;
#else
using System.Runtime.CompilerServices;
#endif
/// <summary>
/// Task wrapper so it works on all platforms.
/// </summary>
/// <remarks>This code originally comes from https://github.com/StephenCleary/AsyncEx/blob/77b9711c2c5fd4ca28b220ce4c93d209eeca2b4a/Source/Unit%20Tests/Tests%20(NET40)/Internal/TaskShim.cs.</remarks>
public static class TaskShim
{
/// <summary>
/// Creates a task that will complete after a time delay.
/// </summary>
/// <param name="millisecondsDelay">The number of milliseconds to wait before completing the returned task</param>
/// <returns>A task that represents the time delay</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="millisecondsDelay" /> is less than -1.</exception>
public static Task Delay(int millisecondsDelay)
{
#if USE_TASKEX
return TaskEx.Delay(millisecondsDelay);
#else
return Task.Delay(millisecondsDelay);
#endif
}
/// <summary>
/// Creates a task that will complete after a time delay.
/// </summary>
/// <param name="millisecondsDelay">The number of milliseconds to wait before completing the returned task</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task that represents the time delay</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="millisecondsDelay" /> is less than -1.</exception>
public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken)
{
#if USE_TASKEX
return TaskEx.Delay(millisecondsDelay, cancellationToken);
#else
return Task.Delay(millisecondsDelay, cancellationToken);
#endif
}
/// <summary>
/// Starts a Task that will complete after the specified due time.
/// </summary>
/// <param name="dueTime">The delay before the returned task completes.</param>
/// <returns>The timed Task.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> argument must be non-negative or -1 and less than or equal to Int32.MaxValue.</exception>
public static Task Delay(TimeSpan dueTime)
{
#if USE_TASKEX
return TaskEx.Delay(dueTime);
#else
return Task.Delay(dueTime);
#endif
}
/// <summary>
/// Starts a Task that will complete after the specified due time.
/// </summary>
/// <param name="dueTime">The delay before the returned task completes.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The timed Task.</returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="dueTime" /> argument must be non-negative or -1 and less than or equal to Int32.MaxValue.</exception>
public static Task Delay(TimeSpan dueTime, CancellationToken cancellationToken)
{
#if USE_TASKEX
return TaskEx.Delay(dueTime, cancellationToken);
#else
return Task.Delay(dueTime, cancellationToken);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a task handle for that work.
/// </summary>
/// <param name="action">The work to execute asynchronously.</param>
/// <returns>A task that represents the work queued to execute in the ThreadPool.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="action" /> parameter was null.</exception>
public static Task Run(Action action)
{
#if USE_TASKEX
return TaskEx.Run(action);
#else
return Task.Run(action);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a task handle for that work.
/// </summary>
/// <param name="action">The work to execute asynchronously.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task that represents the work queued to execute in the ThreadPool.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="action" /> parameter was null.</exception>
public static Task Run(Action action, CancellationToken cancellationToken)
{
#if USE_TASKEX
return TaskEx.Run(action, cancellationToken);
#else
return Task.Run(action);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a proxy for the task returned by <paramref name="function" />.
/// </summary>
/// <param name="function">The work to execute asynchronously.</param>
/// <returns>A task that represents a proxy for the task returned by <paramref name="function" />.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function" /> parameter was null.</exception>
public static Task Run(Func<Task> function)
{
#if USE_TASKEX
return TaskEx.Run(function);
#else
return Task.Run(function);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a proxy for the task returned by <paramref name="function" />.
/// </summary>
/// <param name="function">The work to execute asynchronously.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task that represents a proxy for the task returned by <paramref name="function" />.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function" /> parameter was null.</exception>
public static Task Run(Func<Task> function, CancellationToken cancellationToken)
{
#if USE_TASKEX
return TaskEx.Run(function, cancellationToken);
#else
return Task.Run(function, cancellationToken);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a Task(TResult) handle for that work.
/// </summary>
/// <typeparam name="TResult">The result type of the task.</typeparam>
/// <param name="function">The work to execute asynchronously.</param>
/// <returns>A Task(TResult) that represents the work queued to execute in the ThreadPool.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function" /> parameter was null.</exception>
public static Task<TResult> Run<TResult>(Func<TResult> function)
{
#if USE_TASKEX
return TaskEx.Run(function);
#else
return Task.Run(function);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a Task(TResult) handle for that work.
/// </summary>
/// <typeparam name="TResult">The result type of the task.</typeparam>
/// <param name="function">The work to execute asynchronously.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A Task(TResult) that represents the work queued to execute in the ThreadPool.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function" /> parameter was null.</exception>
public static Task<TResult> Run<TResult>(Func<TResult> function, CancellationToken cancellationToken)
{
#if USE_TASKEX
return TaskEx.Run(function, cancellationToken);
#else
return Task.Run(function, cancellationToken);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a proxy for the Task(TResult) returned by <paramref name="function" />.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the proxy task.</typeparam>
/// <param name="function">The work to execute asynchronously</param>
/// <returns>A Task(TResult) that represents a proxy for the Task(TResult) returned by <paramref name="function" />.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function" /> parameter was null.</exception>
public static Task<TResult> Run<TResult>(Func<Task<TResult>> function)
{
#if USE_TASKEX
return TaskEx.Run(function);
#else
return Task.Run(function);
#endif
}
/// <summary>
/// Queues the specified work to run on the ThreadPool and returns a proxy for the Task(TResult) returned by <paramref name="function" />.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the proxy task.</typeparam>
/// <param name="function">The work to execute asynchronously</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A Task(TResult) that represents a proxy for the Task(TResult) returned by <paramref name="function" />.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="function" /> parameter was null.</exception>
public static Task<TResult> Run<TResult>(Func<Task<TResult>> function, CancellationToken cancellationToken)
{
#if USE_TASKEX
return TaskEx.Run(function, cancellationToken);
#else
return Task.Run(function, cancellationToken);
#endif
}
/// <summary>
/// Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that's completed successfully with the specified result.
/// </summary>
/// <typeparam name="TResult">The type of the result returned by the task.</typeparam>
/// <param name="result">The result to store into the completed task.</param>
/// <returns>The successfully completed task.</returns>
public static Task<TResult> FromResult<TResult>(TResult result)
{
#if USE_TASKEX
return TaskEx.FromResult(result);
#else
return Task.FromResult(result);
#endif
}
/// <summary>
/// Creates a task that will complete when all of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the completed task.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of all of the supplied tasks.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> collection contained a null task.</exception>
public static Task<TResult[]> WhenAll<TResult>(IEnumerable<Task<TResult>> tasks)
{
#if USE_TASKEX
return TaskEx.WhenAll(tasks);
#else
return Task.WhenAll(tasks);
#endif
}
/// <summary>
/// Creates a task that will complete when all of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the completed task.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of all of the supplied tasks.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> array contained a null task.</exception>
public static Task<TResult[]> WhenAll<TResult>(params Task<TResult>[] tasks)
{
#if USE_TASKEX
return TaskEx.WhenAll(tasks);
#else
return Task.WhenAll(tasks);
#endif
}
/// <summary>
/// Creates a task that will complete when all of the supplied tasks have completed.
/// </summary>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of all of the supplied tasks.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> collection contained a null task.</exception>
public static Task WhenAll(IEnumerable<Task> tasks)
{
#if USE_TASKEX
return TaskEx.WhenAll(tasks);
#else
return Task.WhenAll(tasks);
#endif
}
/// <summary>
/// Creates a task that will complete when all of the supplied tasks have completed.
/// </summary>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of all of the supplied tasks.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> array contained a null task.</exception>
public static Task WhenAll(params Task[] tasks)
{
#if USE_TASKEX
return TaskEx.WhenAll(tasks);
#else
return Task.WhenAll(tasks);
#endif
}
/// <summary>
/// Creates an awaitable task that asynchronously yields back to the current context when awaited.
/// </summary>
/// <returns>A context that, when awaited, will asynchronously transition back into the current context at the time of the await. If the current <see cref="T:System.Threading.SynchronizationContext" /> is non-null, it is treated as the current context. Otherwise, the task scheduler that is associated with the currently executing task is treated as the current context.</returns>
public static YieldAwaitable Yield()
{
#if USE_TASKEX
return TaskEx.Yield();
#else
return Task.Yield();
#endif
}
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return task's Result is the task that completed.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> array contained a null task, or was empty.</exception>
public static Task<Task> WhenAny(params Task[] tasks)
{
#if USE_TASKEX
return TaskEx.WhenAny(tasks);
#else
return Task.WhenAny(tasks);
#endif
}
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return task's Result is the task that completed.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> array contained a null task, or was empty.</exception>
public static Task<Task> WhenAny(IEnumerable<Task> tasks)
{
#if USE_TASKEX
return TaskEx.WhenAny(tasks);
#else
return Task.WhenAny(tasks);
#endif
}
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the completed task.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return task's Result is the task that completed.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> array contained a null task, or was empty.</exception>
public static Task<Task<TResult>> WhenAny<TResult>(params Task<TResult>[] tasks)
{
#if USE_TASKEX
return TaskEx.WhenAny(tasks);
#else
return Task.WhenAny(tasks);
#endif
}
/// <summary>
/// Creates a task that will complete when any of the supplied tasks have completed.
/// </summary>
/// <typeparam name="TResult">The type of the completed task.</typeparam>
/// <param name="tasks">The tasks to wait on for completion.</param>
/// <returns>A task that represents the completion of one of the supplied tasks. The return task's Result is the task that completed.</returns>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="tasks" /> argument was null.</exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="tasks" /> array contained a null task, or was empty.</exception>
public static Task<Task<TResult>> WhenAny<TResult>(IEnumerable<Task<TResult>> tasks)
{
#if USE_TASKEX
return TaskEx.WhenAny(tasks);
#else
return Task.WhenAny(tasks);
#endif
}
}
} | blebougge/Catel | src/Catel.Core/Catel.Core.Shared/Threading/Helpers/TaskShim.cs | C# | mit | 18,388 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Web.Http;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Persistence;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
using umbraco;
using umbraco.BusinessLogic.Actions;
using System.Globalization;
namespace Umbraco.Web.Trees
{
public abstract class ContentTreeControllerBase : TreeController
{
#region Actions
/// <summary>
/// Gets an individual tree node
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
[HttpQueryStringFilter("queryStrings")]
public TreeNode GetTreeNode(string id, FormDataCollection queryStrings)
{
int asInt;
Guid asGuid = Guid.Empty;
if (int.TryParse(id, out asInt) == false)
{
if (Guid.TryParse(id, out asGuid) == false)
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
}
var entity = asGuid == Guid.Empty
? Services.EntityService.Get(asInt, UmbracoObjectType)
: Services.EntityService.GetByKey(asGuid, UmbracoObjectType);
if (entity == null)
{
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
var node = GetSingleTreeNode(entity, entity.ParentId.ToInvariantString(), queryStrings);
//add the tree alias to the node since it is standalone (has no root for which this normally belongs)
node.AdditionalData["treeAlias"] = TreeAlias;
return node;
}
#endregion
/// <summary>
/// Ensure the noAccess metadata is applied for the root node if in dialog mode and the user doesn't have path access to it
/// </summary>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var node = base.CreateRootNode(queryStrings);
if (IsDialog(queryStrings) && UserStartNodes.Contains(Constants.System.Root) == false)
{
node.AdditionalData["noAccess"] = true;
}
return node;
}
protected abstract TreeNode GetSingleTreeNode(IUmbracoEntity e, string parentId, FormDataCollection queryStrings);
/// <summary>
/// Returns a <see cref="TreeNode"/> for the <see cref="IUmbracoEntity"/> and
/// attaches some meta data to the node if the user doesn't have start node access to it when in dialog mode
/// </summary>
/// <param name="e"></param>
/// <param name="parentId"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
internal TreeNode GetSingleTreeNodeWithAccessCheck(IUmbracoEntity e, string parentId, FormDataCollection queryStrings)
{
bool hasPathAccess;
var entityIsAncestorOfStartNodes = Security.CurrentUser.IsInBranchOfStartNode(e, Services.EntityService, RecycleBinId, out hasPathAccess);
if (entityIsAncestorOfStartNodes == false)
return null;
var treeNode = GetSingleTreeNode(e, parentId, queryStrings);
if (treeNode == null)
{
//this means that the user has NO access to this node via permissions! They at least need to have browse permissions to see
//the node so we need to return null;
return null;
}
if (hasPathAccess == false)
{
treeNode.AdditionalData["noAccess"] = true;
}
return treeNode;
}
/// <summary>
/// Returns the
/// </summary>
protected abstract int RecycleBinId { get; }
/// <summary>
/// Returns true if the recycle bin has items in it
/// </summary>
protected abstract bool RecycleBinSmells { get; }
/// <summary>
/// Returns the user's start node for this tree
/// </summary>
protected abstract int[] UserStartNodes { get; }
protected virtual TreeNodeCollection PerformGetTreeNodes(string id, FormDataCollection queryStrings)
{
var nodes = new TreeNodeCollection();
var rootIdString = Constants.System.Root.ToString(CultureInfo.InvariantCulture);
var hasAccessToRoot = UserStartNodes.Contains(Constants.System.Root);
var startNodeId = queryStrings.HasKey(TreeQueryStringParameters.StartNodeId)
? queryStrings.GetValue<string>(TreeQueryStringParameters.StartNodeId)
: string.Empty;
if (string.IsNullOrEmpty(startNodeId) == false && startNodeId != "undefined" && startNodeId != rootIdString)
{
// request has been made to render from a specific, non-root, start node
id = startNodeId;
// ensure that the user has access to that node, otherwise return the empty tree nodes collection
// TODO: in the future we could return a validation statement so we can have some UI to notify the user they don't have access
if (HasPathAccess(id, queryStrings) == false)
{
LogHelper.Warn<ContentTreeControllerBase>("User " + Security.CurrentUser.Username + " does not have access to node with id " + id);
return nodes;
}
// if the tree is rendered...
// - in a dialog: render only the children of the specific start node, nothing to do
// - in a section: if the current user's start nodes do not contain the root node, we need
// to include these start nodes in the tree too, to provide some context - i.e. change
// start node back to root node, and then GetChildEntities method will take care of the rest.
if (IsDialog(queryStrings) == false && hasAccessToRoot == false)
id = rootIdString;
}
// get child entities - if id is root, but user's start nodes do not contain the
// root node, this returns the start nodes instead of root's children
var entities = GetChildEntities(id).ToList();
nodes.AddRange(entities.Select(x => GetSingleTreeNodeWithAccessCheck(x, id, queryStrings)).Where(x => x != null));
// if the user does not have access to the root node, what we have is the start nodes,
// but to provide some context we also need to add their topmost nodes when they are not
// topmost nodes themselves (level > 1).
if (id == rootIdString && hasAccessToRoot == false)
{
var topNodeIds = entities.Where(x => x.Level > 1).Select(GetTopNodeId).Where(x => x != 0).Distinct().ToArray();
if (topNodeIds.Length > 0)
{
var topNodes = Services.EntityService.GetAll(UmbracoObjectType, topNodeIds.ToArray());
nodes.AddRange(topNodes.Select(x => GetSingleTreeNodeWithAccessCheck(x, id, queryStrings)).Where(x => x != null));
}
}
return nodes;
}
private static readonly char[] Comma = { ',' };
private int GetTopNodeId(IUmbracoEntity entity)
{
int id;
var parts = entity.Path.Split(Comma, StringSplitOptions.RemoveEmptyEntries);
return parts.Length >= 2 && int.TryParse(parts[1], out id) ? id : 0;
}
protected abstract MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings);
protected abstract UmbracoObjectTypes UmbracoObjectType { get; }
protected IEnumerable<IUmbracoEntity> GetChildEntities(string id)
{
// try to parse id as an integer else use GetEntityFromId
// which will grok Guids, Udis, etc and let use obtain the id
if (int.TryParse(id, out var entityId) == false)
{
var entity = GetEntityFromId(id);
if (entity == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
entityId = entity.Id;
}
return Services.EntityService.GetChildren(entityId, UmbracoObjectType).ToArray();
}
/// <summary>
/// Returns true or false if the current user has access to the node based on the user's allowed start node (path) access
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
//we should remove this in v8, it's now here for backwards compat only
protected abstract bool HasPathAccess(string id, FormDataCollection queryStrings);
/// <summary>
/// Returns true or false if the current user has access to the node based on the user's allowed start node (path) access
/// </summary>
/// <param name="entity"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected bool HasPathAccess(IUmbracoEntity entity, FormDataCollection queryStrings)
{
if (entity == null) return false;
return Security.CurrentUser.HasPathAccess(entity, Services.EntityService, RecycleBinId);
}
/// <summary>
/// Ensures the recycle bin is appended when required (i.e. user has access to the root and it's not in dialog mode)
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
/// <remarks>
/// This method is overwritten strictly to render the recycle bin, it should serve no other purpose
/// </remarks>
protected sealed override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
//check if we're rendering the root
if (id == Constants.System.Root.ToInvariantString() && UserStartNodes.Contains(Constants.System.Root))
{
var altStartId = string.Empty;
if (queryStrings.HasKey(TreeQueryStringParameters.StartNodeId))
altStartId = queryStrings.GetValue<string>(TreeQueryStringParameters.StartNodeId);
//check if a request has been made to render from a specific start node
if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != Constants.System.Root.ToString(CultureInfo.InvariantCulture))
{
id = altStartId;
}
var nodes = GetTreeNodesInternal(id, queryStrings);
//only render the recycle bin if we are not in dialog and the start id id still the root
if (IsDialog(queryStrings) == false && id == Constants.System.Root.ToInvariantString())
{
nodes.Add(CreateTreeNode(
RecycleBinId.ToInvariantString(),
id,
queryStrings,
ui.GetText("general", "recycleBin"),
"icon-trash",
RecycleBinSmells,
queryStrings.GetValue<string>("application") + TreeAlias.EnsureStartsWith('/') + "/recyclebin"));
}
return nodes;
}
return GetTreeNodesInternal(id, queryStrings);
}
/// <summary>
/// Before we make a call to get the tree nodes we have to check if they can actually be rendered
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
/// <remarks>
/// Currently this just checks if it is a container type, if it is we cannot render children. In the future this might check for other things.
/// </remarks>
private TreeNodeCollection GetTreeNodesInternal(string id, FormDataCollection queryStrings)
{
var current = GetEntityFromId(id);
//before we get the children we need to see if this is a container node
//test if the parent is a listview / container
if (current != null && current.IsContainer())
{
//no children!
return new TreeNodeCollection();
}
return PerformGetTreeNodes(id, queryStrings);
}
/// <summary>
/// Checks if the menu requested is for the recycle bin and renders that, otherwise renders the result of PerformGetMenuForNode
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
protected sealed override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
if (RecycleBinId.ToInvariantString() == id)
{
var menu = new MenuItemCollection();
menu.Items.Add<ActionEmptyTranscan>(ui.Text("actions", "emptyTrashcan"));
menu.Items.Add<ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
return menu;
}
return PerformGetMenuForNode(id, queryStrings);
}
/// <summary>
/// Based on the allowed actions, this will filter the ones that the current user is allowed
/// </summary>
/// <param name="menuWithAllItems"></param>
/// <param name="userAllowedMenuItems"></param>
/// <returns></returns>
protected void FilterUserAllowedMenuItems(MenuItemCollection menuWithAllItems, IEnumerable<MenuItem> userAllowedMenuItems)
{
var userAllowedActions = userAllowedMenuItems.Where(x => x.Action != null).Select(x => x.Action).ToArray();
var notAllowed = menuWithAllItems.Items.Where(
a => (a.Action != null
&& a.Action.CanBePermissionAssigned
&& (a.Action.CanBePermissionAssigned == false || userAllowedActions.Contains(a.Action) == false)))
.ToArray();
//remove the ones that aren't allowed.
foreach (var m in notAllowed)
{
menuWithAllItems.Items.Remove(m);
}
}
internal IEnumerable<MenuItem> GetAllowedUserMenuItemsForNode(IUmbracoEntity dd)
{
var actions = ActionsResolver.Current.FromActionSymbols(Security.CurrentUser.GetPermissions(dd.Path, Services.UserService))
.ToList();
// A user is allowed to delete their own stuff
if (dd.CreatorId == Security.GetUserId() && actions.Contains(ActionDelete.Instance) == false)
actions.Add(ActionDelete.Instance);
return actions.Select(x => new MenuItem(x));
}
/// <summary>
/// Determins if the user has access to view the node/document
/// </summary>
/// <param name="doc">The Document to check permissions against</param>
/// <param name="allowedUserOptions">A list of MenuItems that the user has permissions to execute on the current document</param>
/// <remarks>By default the user must have Browse permissions to see the node in the Content tree</remarks>
/// <returns></returns>
internal bool CanUserAccessNode(IUmbracoEntity doc, IEnumerable<MenuItem> allowedUserOptions)
{
return allowedUserOptions.Select(x => x.Action).OfType<ActionBrowse>().Any();
}
/// <summary>
/// this will parse the string into either a GUID or INT
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
internal Tuple<Guid?, int?> GetIdentifierFromString(string id)
{
Guid idGuid;
int idInt;
Udi idUdi;
if (Guid.TryParse(id, out idGuid))
{
return new Tuple<Guid?, int?>(idGuid, null);
}
if (int.TryParse(id, out idInt))
{
return new Tuple<Guid?, int?>(null, idInt);
}
if (Udi.TryParse(id, out idUdi))
{
var guidUdi = idUdi as GuidUdi;
if (guidUdi != null)
return new Tuple<Guid?, int?>(guidUdi.Guid, null);
}
return null;
}
/// <summary>
/// Get an entity via an id that can be either an integer, Guid or UDI
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <remarks>
/// This object has it's own contextual cache for these lookups
/// </remarks>
internal IUmbracoEntity GetEntityFromId(string id)
{
return _entityCache.GetOrAdd(id, s =>
{
IUmbracoEntity entity;
Guid idGuid;
int idInt;
Udi idUdi;
if (Guid.TryParse(s, out idGuid))
{
entity = Services.EntityService.GetByKey(idGuid, UmbracoObjectType);
}
else if (int.TryParse(s, out idInt))
{
entity = Services.EntityService.Get(idInt, UmbracoObjectType);
}
else if (Udi.TryParse(s, out idUdi))
{
var guidUdi = idUdi as GuidUdi;
entity = guidUdi != null ? Services.EntityService.GetByKey(guidUdi.Guid, UmbracoObjectType) : null;
}
else
{
return null;
}
return entity;
});
}
private readonly ConcurrentDictionary<string, IUmbracoEntity> _entityCache = new ConcurrentDictionary<string, IUmbracoEntity>();
}
}
| base33/Umbraco-CMS | src/Umbraco.Web/Trees/ContentTreeControllerBase.cs | C# | mit | 18,998 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
16483,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
6922,
5302,
9247,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
5658,
1025,
2478,
2291,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
(function() {
var port = 8080;
if (window.location.search) {
var params = window.location.search.match(/port=(\d+)/);
if (params) {
port = params[1];
}
// How often to poll
params = window.location.search.match(/pollInterval=(\d+)/);
if (params) {
window.JOLOKIA_POLL_INTERVAL = parseInt(params[1]);
}
}
window.JOLOKIA_URL = "http://localhost:" + port + "/jolokia";
})();
| jolokia-org/jolokia-client-javascript | test/qunit/js/jolokia-env.js | JavaScript | apache-2.0 | 470 | [
30522,
1006,
3853,
1006,
1007,
1063,
13075,
3417,
1027,
3770,
17914,
1025,
2065,
1006,
3332,
1012,
3295,
1012,
3945,
1007,
1063,
13075,
11498,
5244,
1027,
3332,
1012,
3295,
1012,
3945,
1012,
2674,
1006,
1013,
3417,
1027,
1006,
1032,
1040,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "TCS3200.h"
#include "HMC.h"
#define tl0 0x00
#define th0 0xB8 //Timer0
void ColorInt()
{
AUXR&= 0x00;
TMOD = 0xE0;
AUXR = 0x14; //T2Ϊ1Tģʽ, ²¢Æô¶¯¶¨Ê±Æ÷2 page 470
AUXR |= 0x01;
}
unsigned int CheckRed()
{
unsigned int Red;
TL0= tl0;
TH0= th0;
TH1= 0;
TL1= 0;
TCS_S2= 0;
TCS_S3= 0;//Select Red Filter
Delay5ms();
TR0= 1;//Timer 0 Start 10ms
TR1= 1;//Counter 1 Start
while(TF0==0)
;//Waitng for Timer0 overflow
TF0= 0;//Clean Timer0 overflow flag
TR0= 0;//Timer0 stop
TR1= 0;//Counter0 stop
Red= (unsigned long)(TH1*256+TL1);//*255/k_Red;
return Red;
}
unsigned int CheckGreen()
{
unsigned int Green;
TL0= tl0;
TH0= th0;
TH1= 0;
TL1= 0;
TCS_S2= 1;
TCS_S3= 1;//Select Green Filter
Delay5ms();
TR0= 1;//Timer 0 Start 10ms
TR1= 1;//Counter 1 Start
while(TF0==0)
;//Waitng for Timer0 overflow
TF0= 0;//Clean Timer0 overflow flag
TR0= 0;//Timer0 stop
TR1= 0;//Counter0 stop
Green= (unsigned long)(TH1*256+TL1);//*255/k_Green;
return Green;
}
unsigned int CheckBlue()
{
unsigned int Blue;
TL0= tl0;
TH0= th0;
TH1= 0;
TL1= 0;
TCS_S2= 0;
TCS_S3= 1;//Select Blue Filter
Delay5ms();
TR0= 1;//Timer 0 Start 10ms
TR1= 1;//Counter 1 Start
while(TF0==0)
;//Waitng for Timer0 overflow
TF0= 0;//Clean Timer0 overflow flag
TR0= 0;//Timer0 stop
TR1= 0;//Counter0 stop
Blue= (unsigned long)(TH1*256+TL1);//*255/k_Blue;
return Blue;
} | CCluv/CarryMan_STC15 | TCS3200.c | C | gpl-2.0 | 1,404 | [
30522,
1001,
2421,
1000,
22975,
2015,
16703,
8889,
1012,
1044,
1000,
1001,
2421,
1000,
20287,
2278,
1012,
1044,
1000,
1001,
9375,
1056,
2140,
2692,
1014,
2595,
8889,
1001,
9375,
16215,
2692,
1014,
2595,
2497,
2620,
1013,
1013,
25309,
2692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
------------------------------------------------------------------------
Plugin Monitoring for GLPI
Copyright (C) 2011-2014 by the Plugin Monitoring for GLPI Development Team.
https://forge.indepnet.net/projects/monitoring/
------------------------------------------------------------------------
LICENSE
This file is part of Plugin Monitoring project.
Plugin Monitoring for GLPI is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Plugin Monitoring for GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Monitoring. If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------------------------
@package Plugin Monitoring for GLPI
@author David Durieux
@co-author
@comment
@copyright Copyright (c) 2011-2014 Plugin Monitoring for GLPI team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://forge.indepnet.net/projects/monitoring/
@since 2012
------------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
class PluginMonitoringDisplayview extends CommonDBTM {
// For visibility checks
protected $users = array();
protected $groups = array();
protected $profiles = array();
protected $entities = array();
const HOMEPAGE = 1024;
const DASHBOARD = 2048;
static $rightname = 'plugin_monitoring_displayview';
/**
* Get name of this type
*
*@return text name of this type by language of the user connected
*
**/
static function getTypeName($nb=0) {
return _n('View', 'Views', $nb, 'monitoring');
}
/**
* @since version 0.85
*
* @see commonDBTM::getRights()
**/
function getRights($interface='central') {
$values = parent::getRights();
$values[self::HOMEPAGE] = __('See in homepage', 'monitoring');
$values[self::DASHBOARD] = __('See in dashboard', 'monitoring');
return $values;
}
function post_getFromDB() {
// Users
$this->users = PluginMonitoringDisplayview_User::getUsers($this->fields['id']);
// Entities
// $this->entities = Entity_Reminder::getEntities($this->fields['id']);
// Group / entities
$this->groups = PluginMonitoringDisplayview_Group::getGroups($this->fields['id']);
// Profile / entities
// $this->profiles = Profile_Reminder::getProfiles($this->fields['id']);
}
/**
* Is the login user have access to reminder based on visibility configuration
*
* @return boolean
**/
function haveVisibilityAccess() {
// No public reminder right : no visibility check
// if (!PluginMonitoringProfile::haveRight("config_views", 'r')) {
// return false;
// }
// Author
if ($this->fields['users_id'] == Session::getLoginUserID()) {
return true;
}
// Users
if (isset($this->users[Session::getLoginUserID()])) {
return true;
}
// Groups
if (count($this->groups)
&& isset($_SESSION["glpigroups"]) && count($_SESSION["glpigroups"])) {
foreach ($this->groups as $key => $data) {
foreach ($data as $group) {
if (in_array($group['groups_id'], $_SESSION["glpigroups"])) {
// All the group
if ($group['entities_id'] < 0) {
return true;
}
// Restrict to entities
$entities = array($group['entities_id']);
if ($group['is_recursive']) {
$entities = getSonsOf('glpi_entities', $group['entities_id']);
}
if (Session::haveAccessToOneOfEntities($entities, true)) {
return true;
}
}
}
}
}
// Entities
if (count($this->entities)
&& isset($_SESSION["glpiactiveentities"]) && count($_SESSION["glpiactiveentities"])) {
foreach ($this->entities as $key => $data) {
foreach ($data as $entity) {
$entities = array($entity['entities_id']);
if ($entity['is_recursive']) {
$entities = getSonsOf('glpi_entities', $entity['entities_id']);
}
if (Session::haveAccessToOneOfEntities($entities, true)) {
return true;
}
}
}
}
// Profiles
if (count($this->profiles)
&& isset($_SESSION["glpiactiveprofile"])
&& isset($_SESSION["glpiactiveprofile"]['id'])) {
if (isset($this->profiles[$_SESSION["glpiactiveprofile"]['id']])) {
foreach ($this->profiles[$_SESSION["glpiactiveprofile"]['id']] as $profile) {
// All the profile
if ($profile['entities_id'] < 0) {
return true;
}
// Restrict to entities
$entities = array($profile['entities_id']);
if ($profile['is_recursive']) {
$entities = getSonsOf('glpi_entities',$profile['entities_id']);
}
if (Session::haveAccessToOneOfEntities($entities, true)) {
return true;
}
}
}
}
return false;
}
function getSearchOptions() {
$tab = array();
$tab['common'] = __('Views', 'monitoring');
$tab[1]['table'] = $this->getTable();
$tab[1]['field'] = 'name';
$tab[1]['linkfield'] = 'name';
$tab[1]['name'] = __('Name');
$tab[1]['datatype'] = 'itemlink';
$tab[2]['table'] = $this->getTable();
$tab[2]['field'] = 'is_frontview';
$tab[2]['linkfield'] = 'is_frontview';
$tab[2]['name'] = __('Display view in dashboard', 'monitoring');
$tab[2]['datatype'] = 'bool';
$tab[3]['table'] = $this->getTable();
$tab[3]['field'] = 'comment';
$tab[3]['name'] = __('Comments');
$tab[3]['datatype'] = 'text';
return $tab;
}
function defineTabs($options=array()){
$ong = array();
$this->addDefaultFormTab($ong);
$this->addStandardTab(__CLASS__, $ong, $options);
return $ong;
}
/**
* Display tab
*
* @param CommonGLPI $item
* @param integer $withtemplate
*
* @return varchar name of the tab(s) to display
*/
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
$ong = array();
if ($item->getType() == 'PluginMonitoringDisplayview') {
if ($item->getID() > 0) {
$ong[1] = 'items';
if ($item->canUpdate()) {
$ong[2] = __('Targets');
}
$pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
$ong = $pmDisplayview_rule->addRulesTabs($item->getID(), $ong);
}
} else if ($item->getType() == 'Central') {
$a_views = $this->getViews(1);
foreach ($a_views as $views_id=>$name) {
$this->getFromDB($views_id);
if (Session::haveRight("plugin_monitoring_displayview", PluginMonitoringDisplayview::HOMEPAGE)
&& $this->haveVisibilityAccess()) {
$ong[] = "["._n('View', 'Views', 1, 'monitoring')."] ".$this->fields['name'];
}
}
}
return $ong;
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
if ($item->getType() == 'PluginMonitoringDisplayview') {
switch($tabnum) {
case 1:
$pmDisplayview_item = new PluginMonitoringDisplayview_item();
$pmDisplayview_item->view($item->getID(), 1);
break;
case 2 :
$item->showVisibility();
break;
}
if ($tabnum >= 20) {
$pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
$pmDisplayview_rule->ShowRulesTabs($item->getID(), $tabnum);
}
} else if ($item->getType() == 'Central') {
if (Session::haveRight("plugin_monitoring_displayview", PluginMonitoringDisplayview::HOMEPAGE)) {
$pmDisplayview_item = new PluginMonitoringDisplayview_item();
$pmDisplayview = new PluginMonitoringDisplayview();
$a_views = $pmDisplayview->getViews(1);
foreach ($a_views as $views_id=>$name) {
$pmDisplayview->getFromDB($views_id);
if ($pmDisplayview->haveVisibilityAccess()) {
$pmDisplayview_item->view($views_id);
}
}
}
}
return true;
}
/**
* Display form for agent configuration
*
* @param $items_id integer ID
* @param $options array
*
*@return bool true if form is ok
*
**/
function showForm($items_id, $options=array()) {
$this->initForm($items_id, $options);
if ($this->fields['id'] == 0) {
$this->fields['width'] = 950;
$this->fields['is_active'] = 1;
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Name')." :</td>";
echo "<td>";
echo "<input type='text' name='name' value='".$this->fields["name"]."' size='30'/>";
echo "</td>";
echo "<td>".__('Display view in dashboard', 'monitoring')." :</td>";
echo "<td>";
Dropdown::showYesNo("is_frontview", $this->fields['is_frontview']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Header counter (critical/warning/ok)', 'monitoring')." :</td>";
echo "<td>";
$elements = array();
$elements['NULL'] = Dropdown::EMPTY_VALUE;
$elements['Businessrules'] = __('Business rules', 'monitoring');
$elements['Componentscatalog'] = __('Components catalog', 'monitoring');
$elements['Ressources'] = __('Resources', 'monitoring');
Dropdown::showFromArray('counter', $elements, array('value'=>$this->fields['counter']));
echo "</td>";
echo "<td>";
echo __('Display in GLPI home page', 'monitoring');
echo "</td>";
echo "<td>";
Dropdown::showYesNo("in_central", $this->fields['in_central']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Width', 'monitoring')." (px) :";
echo "</td>";
echo "<td>";
Dropdown::showNumber("width", array(
'value' => $this->fields['width'],
'min' => 950,
'max' => 3000,
'step' => 5)
);
echo "</td>";
echo "<td>";
echo __('Active');
echo "</td>";
echo "<td>";
Dropdown::showYesNo("is_active", $this->fields['is_active']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Comments')."</td>";
echo "<td colspan='3' class='middle'>";
echo "<textarea cols='95' rows='3' name='comment' >".$this->fields["comment"];
echo "</textarea>";
echo "</td>";
echo "</tr>";
$this->showFormButtons($options);
return true;
}
function getViews($central='0') {
global $DB;
$wcentral = '';
if ($central == '1') {
$wcentral = " AND `in_central`='1' ";
}
$a_views = array();
$query = "SELECT * FROM `glpi_plugin_monitoring_displayviews`
WHERE `is_active` = '1'
AND (`users_id`='0' OR `users_id`='".$_SESSION['glpiID']."')
AND `is_frontview`='1'
".$wcentral."
".getEntitiesRestrictRequest(" AND", 'glpi_plugin_monitoring_displayviews', "entities_id",'', true)."
ORDER BY `users_id`, `name`";
$result = $DB->query($query);
if ($DB->numrows($result)) {
while ($data = $DB->fetch_array($result)) {
$a_views[$data['id']] = $data['name'];
}
}
return $a_views;
}
/**
* Show visibility config for a view
**/
function showVisibility() {
global $DB, $CFG_GLPI;
$ID = $this->fields['id'];
$canedit = $this->can($ID, CREATE);
echo "<div class='center'>";
$rand = mt_rand();
$nb = count($this->users) + count($this->groups) + count($this->profiles) + count($this->entities);
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='displayviewvisibility_form$rand' id='displayviewvisibility_form$rand' ";
echo " method='post' action='".Toolbox::getItemTypeFormURL('PluginMonitoringDisplayview')."'>";
echo "<input type='hidden' name='pluginmonitoringdisplayviews_id' value='$ID'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='4'>".__('Add a target')."</tr>";
echo "<tr class='tab_bg_2'><td width='100px'>";
//$types = array('Entity', 'Group', 'Profile', 'User');
$types = array('Group', 'User');
$addrand = Dropdown::showItemTypes('_type', $types);
$params = array('type' => '__VALUE__',
'right' => 'all');
Ajax::updateItemOnSelectEvent("dropdown__type".$addrand,"visibility$rand",
$CFG_GLPI["root_doc"]."/ajax/visibility.php", $params);
echo "</td>";
echo "<td><span id='visibility$rand'></span>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $nb) {
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
$paramsma = array('num_displayed' => $nb,
'specific_actions' => array('deletevisibility'
=> _x('button', 'Delete permanently')) );
if ($this->fields['users_id'] != Session::getLoginUserID()) {
$paramsma['confirm'] = __('Caution! You are not the author of this element. Delete targets can result in loss of access to that element.');
}
Html::showMassiveActions(__CLASS__, $paramsma);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
if ($canedit && $nb) {
echo "<th width='10'>";
echo Html::checkAllAsCheckbox('mass'.__CLASS__.$rand);
echo "</th>";
}
echo "<th>".__('Type')."</th>";
echo "<th>"._n('Recipient', 'Recipients', 2)."</th>";
echo "</tr>";
// Users
if (count($this->users)) {
foreach ($this->users as $key => $val) {
foreach ($val as $data) {
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>";
echo "<input type='checkbox' name='item[PluginMonitoringDisplayview_User][".$data["id"]."]'
value='1' >";
echo "</td>";
}
echo "<td>".__('User')."</td>";
echo "<td>".getUserName($data['users_id'])."</td>";
echo "</tr>";
}
}
}
// Groups
if (count($this->groups)) {
foreach ($this->groups as $key => $val) {
foreach ($val as $data) {
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>";
echo "<input type='checkbox' name='item[PluginMonitoringDisplayview_Group][".$data["id"]."]'
value='1'>";
echo "</td>";
}
echo "<td>".__('Group')."</td>";
$names = Dropdown::getDropdownName('glpi_groups', $data['groups_id'],1);
$entname = sprintf(__('%1$s %2$s'), $names["name"],
Html::showToolTip($names["comment"], array('display' => false)));
if ($data['entities_id'] >= 0) {
$entname = sprintf(__('%1$s / %2$s'), $entname,
Dropdown::getDropdownName('glpi_entities',
$data['entities_id']));
if ($data['is_recursive']) {
//TRANS: R for Recursive
sprintf(__('%1$s %2$s'), $entname,
"<span class='b'>(".__('R').")</span>");
}
}
echo "<td>".$entname."</td>";
echo "</tr>";
}
}
}
//
// // Entity
// if (count($this->entities)) {
// foreach ($this->entities as $key => $val) {
// foreach ($val as $data) {
// echo "<tr class='tab_bg_2'>";
// if ($canedit) {
// echo "<td>";
// echo "<input type='checkbox' name='item[Entity_Reminder][".$data["id"]."]'
// value='1'>";
// echo "</td>";
// }
// echo "<td>".__('Entity')."</td>";
// $names = Dropdown::getDropdownName('glpi_entities', $data['entities_id'],1);
// $tooltip = Html::showToolTip($names["comment"], array('display' => false));
// $entname = sprintf(__('%1$s %2$s'), $names["name"], $tooltip);
// if ($data['is_recursive']) {
// $entname = sprintf(__('%1$s %2$s'), $entname,
// "<span class='b'>(".__('R').")</span>");
// }
// echo "<td>".$entname."</td>";
// echo "</tr>";
// }
// }
// }
//
// // Profiles
// if (count($this->profiles)) {
// foreach ($this->profiles as $key => $val) {
// foreach ($val as $data) {
// echo "<tr class='tab_bg_2'>";
// if ($canedit) {
// echo "<td>";
// echo "<input type='checkbox' name='item[Profile_Reminder][".$data["id"]."]'
// value='1'>";
// echo "</td>";
// }
// echo "<td>"._n('Profile', 'Profiles', 1)."</td>";
//
// $names = Dropdown::getDropdownName('glpi_profiles',$data['profiles_id'],1);
// $tooltip = Html::showToolTip($names["comment"], array('display' => false));
// $entname = sprintf(__('%1$s %2$s'), $names["name"], $entname);
// if ($data['entities_id'] >= 0) {
// $entname = sprintf(__('%1$s / %2$s'), $entname,
// Dropdown::getDropdownName('glpi_entities',
// $data['entities_id']));
// if ($data['is_recursive']) {
// $entname = sprintf(__('%1$s %2$s'), $entname,
// "<span class='b'>(".__('R').")</span>");
// }
// }
// echo "<td>".$entname."</td>";
// echo "</tr>";
// }
// }
// }
echo "</table>";
if ($canedit && $nb) {
$paramsma['ontop'] =false;
Html::showMassiveActions(__CLASS__, $paramsma);
Html::closeForm();
}
echo "</div>";
// Add items
return true;
}
function doSpecificMassiveActions($input=array()) {
$res = array('ok' => 0,
'ko' => 0,
'noright' => 0);
switch ($input['action']) {
case "deletevisibility":
foreach ($input['item'] as $type => $items) {
if (in_array($type, array('PluginMonitoringDisplayview_Group',
'PluginMonitoringDisplayview_User'))) {
$item = new $type();
foreach ($items as $key => $val) {
if ($item->can($key, PURGE)) {
if ($item->delete(array('id' => $key))) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
}
}
break;
default :
return parent::doSpecificMassiveActions($input);
}
return $res;
}
function showWidget($id) {
return "<div id=\"updatedisplayview".$id."\"></div>";
}
function showWidget2($id) {
return "<div id=\"updatedisplayview2-".$id."\"></div>";
}
function ajaxLoad($id) {
global $CFG_GLPI;
$sess_id = session_id();
PluginMonitoringSecurity::updateSession();
echo "<script type=\"text/javascript\">
var elcc".$id." = Ext.get(\"updatedisplayview".$id."\");
var mgrcc".$id." = elcc".$id.".getUpdateManager();
mgrcc".$id.".loadScripts=true;
mgrcc".$id.".showLoadIndicator=false;
mgrcc".$id.".startAutoRefresh(50, \"".$CFG_GLPI["root_doc"].
"/plugins/monitoring/ajax/updateWidgetDisplayview.php\","
. " \"id=".$id."&sess_id=".$sess_id.
"&glpiID=".$_SESSION['glpiID'].
"&plugin_monitoring_securekey=".$_SESSION['plugin_monitoring_securekey'].
"\", \"\", true);
</script>";
}
function ajaxLoad2($id, $is_minemap) {
global $CFG_GLPI;
$sess_id = session_id();
PluginMonitoringSecurity::updateSession();
echo "<script type=\"text/javascript\">
var elcc".$id." = Ext.get(\"updatedisplayview2-".$id."\");
var mgrcc".$id." = elcc".$id.".getUpdateManager();
mgrcc".$id.".loadScripts=true;
mgrcc".$id.".showLoadIndicator=false;
mgrcc".$id.".startAutoRefresh(50, \"".$CFG_GLPI["root_doc"].
"/plugins/monitoring/ajax/updateWidgetDisplayview2.php\","
. " \"id=".$id."&is_minemap=".$is_minemap."&sess_id=".$sess_id.
"&glpiID=".$_SESSION['glpiID'].
"&plugin_monitoring_securekey=".$_SESSION['plugin_monitoring_securekey'].
"\", \"\", true);
</script>";
}
/**
* Display info of a views
*
* @param type $id
*/
function showWidgetFrame($id) {
$this->getFromDB($id);
$data = $this->fields;
$pmDisplayview_item = new PluginMonitoringDisplayview_item();
$a_counter = $pmDisplayview_item->getCounterOfViews($id, array('ok' => 0,
'warning' => 0,
'critical' => 0,
'acknowledge' => 0));
$nb_ressources = 0;
$class = 'ok';
if ($a_counter['critical'] > 0) {
$nb_ressources = $a_counter['critical'];
$class = 'crit';
} else if ($a_counter['warning'] > 0) {
$nb_ressources = $a_counter['warning'];
$class = 'warn';
} else {
$nb_ressources = $a_counter['ok'];
}
echo '<div class="ch-item" style="background-image:url(\'../pics/picto_view.png\');
background-repeat:no-repeat;background-position:center center;">
<div class="ch-info-'.$class.'">
<h1><a href="javascript:;" onclick="document.getElementById(\'updatefil\').value = \''.$id.'!\';'.
'document.getElementById(\'updateviewid\').value = \''.$id.'\';reloadfil();reloadview();"'
.'><span id="viewa-'.$id.'">'
.$data['name'].'</span></a></h1>
<p>'.$nb_ressources.'<font style="font-size: 14px;"> / '.array_sum($a_counter).'</font></p>
</div>
</div>';
echo "<script>
fittext('viewa-".$id."');
</script>";
}
/**
* Display info of device
*
* @global type $DB
* @param type $id
*/
function showWidget2Frame($id, $is_minemap=FALSE) {
global $DB, $CFG_GLPI;
$pmDisplayview_item = new PluginMonitoringDisplayview_item();
$pmDisplayview_item->getFromDB($id);
$itemtype = $pmDisplayview_item->fields['extra_infos'];
$item = new $itemtype();
$item->getFromDB($pmDisplayview_item->fields['items_id']);
$critical = 0;
$warning = 0;
$ok = 0;
$acknowledge = 0;
$query = "SELECT * FROM `glpi_plugin_monitoring_services`"
. " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`"
. " ON `plugin_monitoring_componentscatalogs_hosts_id`="
. " `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`"
. " WHERE `items_id`='".$item->fields['id']."'"
. " AND `itemtype`='".$itemtype."'"
. " AND `glpi_plugin_monitoring_services`.`id` IS NOT NULL"
. " ORDER BY `glpi_plugin_monitoring_services`.`name`";
$result = $DB->query($query);
$services = array();
$resources = array();
$i = 0;
while ($data=$DB->fetch_array($result)) {
$ret = PluginMonitoringHost::getState($data['state'],
$data['state_type'],
'',
$data['is_acknowledged']);
if (strstr($ret, '_soft')) {
$ok++;
$resources[$data['id']]['state'] = 'OK';
} else if ($ret == 'red') {
$critical++;
$resources[$data['id']]['state'] = 'CRITICAL';
} else if ($ret == 'redblue') {
$acknowledge++;
$resources[$data['id']]['state'] = 'ACKNOWLEDGE';
} else if ($ret == 'orange'
|| $ret == 'yellow') {
$warning++;
$resources[$data['id']]['state'] = 'WARNING';
} else {
$ok++;
$resources[$data['id']]['state'] = 'OK';
}
$services[$i++] = $data['id'];
$resources[$data['id']]['last_check'] = $data['last_check'];
$resources[$data['id']]['event'] = $data['event'];
$resources[$data['id']]['name'] = $data['name'];
$resources[$data['id']]['plugin_monitoring_components_id'] = $data['plugin_monitoring_components_id'];
}
$class = 'ok';
if ($critical > 0) {
$nb_ressources = $critical;
$class = 'crit';
} else if ($warning > 0) {
$nb_ressources = $warning;
$class = 'warn';
} else {
$nb_ressources = $ok;
}
echo '<div class="ch-item">
<div class="ch-info-'.$class.'">
<h1><a href="';
if ($item->can($item->getID(), READ)) {
echo $item->getFormURL().'?id='.$item->getID().'&forcetab=PluginMonitoringHost$0';
} else {
echo $CFG_GLPI['root_doc']."/plugins/monitoring/front/displayhost.php?itemtype=".$itemtype
."&items_id=".$item->getID();
}
echo '">'
. '<span id="devicea-'.$id.'">'.$item->getName().'</span></a></h1>
<p><a>'.$nb_ressources.'</a><font style="font-size: 14px;"> / '.($ok + $warning + $critical + $acknowledge).'</font></p>
</div>
</div>';
echo "<script>
fittext('devicea-".$id."');
</script>";
echo "<div class='minemapdiv' align='center'>"
."<a onclick='Ext.get(\"minemapdisplayview2-".$id."\").toggle()'>"
."Minemap</a></div>";
if (!$is_minemap) {
echo '<div class="minemapdiv" id="minemapdisplayview2-'.$id.'" style="display: none; z-index: 1500">';
} else {
echo '<div class="minemapdiv" id="minemapdisplayview2-'.$id.'">';
}
echo '<table class="tab_cadrehov" >';
// Get services list ...
echo '<div class="minemapdiv">';
echo '<table class="tab_cadrehov">';
// Header with services name and link to services list ...
echo '<tr class="tab_bg_2">';
echo '<th colspan="2">';
echo __('Services', 'monitoring');
echo '</th>';
echo '</tr>';
// Content with host/service status and link to services list ...
foreach ($services as $services_id) {
$field_id = 20;
if ($itemtype == 'Printer') {
$field_id = 21;
} else if ($itemtype == 'NetworkEquipment') {
$field_id = 22;
}
$link = $CFG_GLPI['root_doc'].
"/plugins/monitoring/front/service.php?hidesearch=1"
// . "&reset=reset"
. "&criteria[0][field]=".$field_id.""
. "&criteria[0][searchtype]=equals"
. "&criteria[0][value]=".$item->getID()
. "&criteria[1][link]=AND"
. "&criteria[1][field]=2"
. "&criteria[1][searchtype]=equals"
. "&criteria[1][value]=".$resources[$services_id]['plugin_monitoring_components_id']
. "&itemtype=PluginMonitoringService"
. "&start=0'";
echo "<tr class='tab_bg_2'>";
echo "<td class='left'><a href='".$link."'>".$resources[$services_id]['name']."</a></td>";
echo '<td>';
echo '<a href="'.$link.'" title="'.$resources[$services_id]['state'].
" - ".$resources[$services_id]['last_check']." - ".
$resources[$services_id]['event'].'">'
. '<div class="service'.$resources[$services_id]['state'].'"></div></a>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
echo '</div>';
}
}
?> | euqip/glpi-smartcities | plugins/monitoring/inc/displayview.class.php | PHP | gpl-2.0 | 30,305 | [
30522,
1026,
1029,
25718,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |

# Facebook Doge Wow
UserScript for TamperMonkey or GreaseMonkey that changes the Wow icon on Facebook to Doge.
Install it through OpenUserJS: https://openuserjs.org/scripts/doubtingreality/Facebook_Doge_Wow
Or read: https://openuserjs.org/about/Userscript-Beginners-HOWTO
| doubtingreality/fb-dogewow | README.md | Markdown | gpl-3.0 | 370 | [
30522,
999,
1031,
12456,
6415,
1033,
1006,
16770,
1024,
1013,
1013,
6315,
1012,
21025,
2705,
12083,
20330,
8663,
6528,
2102,
1012,
4012,
1013,
4797,
2075,
22852,
3012,
1013,
1042,
2497,
1011,
3899,
7974,
5004,
1013,
3040,
1013,
3104,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
var Q = require('q')
, _ = require('underscore');
exports.defaults = function () { return { storage: {} }; };
exports.mixin = {
/**
* Converts `arguments` to a key to be stored.
*/
toKey: function () {
return _.toArray(arguments);
},
contains: function () {
return this.containsKey(this.toKey.apply(this, _.toArray(arguments)));
},
containsKey: function (key) {
return Q.when(_.has(this.storage, key));
},
del: function () {
var args = _.toArray(arguments)
, key = this.toKey.apply(this, arguments);
if (!this.containsKey(key)) return Q.when(false);
this.emit.apply(this, [ 'del' ].concat(args));
delete this.storage[key];
return Q.when(true);
},
set: function (key, val) {
this.storage[key] = val;
return Q.when(true);
},
get: function (key) {
return Q.when(this.storage[key]);
}
};
| filipovskii/bolter | lib/bolter-memory.js | JavaScript | mit | 894 | [
30522,
1005,
2224,
9384,
1005,
1025,
13075,
1053,
1027,
5478,
1006,
1005,
1053,
1005,
1007,
1010,
1035,
1027,
5478,
1006,
1005,
2104,
9363,
2890,
1005,
1007,
1025,
14338,
1012,
12398,
2015,
1027,
3853,
1006,
1007,
1063,
2709,
1063,
5527,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let BeachAccess = props =>
<SvgIcon {...props}>
<path d="M13.127 14.56l1.43-1.43 6.44 6.443L19.57 21zm4.293-5.73l2.86-2.86c-3.95-3.95-10.35-3.96-14.3-.02 3.93-1.3 8.31-.25 11.44 2.88zM5.95 5.98c-3.94 3.95-3.93 10.35.02 14.3l2.86-2.86C5.7 14.29 4.65 9.91 5.95 5.98zm.02-.02l-.01.01c-.38 3.01 1.17 6.88 4.3 10.02l5.73-5.73c-3.13-3.13-7.01-4.68-10.02-4.3z" />
</SvgIcon>;
BeachAccess = pure(BeachAccess);
BeachAccess.muiName = 'SvgIcon';
export default BeachAccess;
| AndriusBil/material-ui | packages/material-ui-icons/src/BeachAccess.js | JavaScript | mit | 579 | [
30522,
12324,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
5760,
2013,
1005,
28667,
25377,
9232,
1013,
5760,
1005,
1025,
12324,
17917,
12863,
2239,
2013,
1005,
3430,
1011,
21318,
1013,
17917,
12863,
2239,
1005,
1025,
2292,
3509,
6305,
9623,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
body {
color: #333;
}
input[type=search]::search-cancel-button,
input[type=search]::search-decoration {
appearance: none;
}
.global-header {
background: #003760;
}
.main {
background: #fff;
}
.global-footer {
background: #003760;
}
| kubosho/kotori | test/cases/main.css | CSS | mit | 256 | [
30522,
2303,
1063,
3609,
1024,
1001,
21211,
1025,
1065,
7953,
1031,
2828,
1027,
3945,
1033,
1024,
1024,
3945,
1011,
17542,
1011,
6462,
1010,
7953,
1031,
2828,
1027,
3945,
1033,
1024,
1024,
3945,
1011,
11446,
1063,
3311,
1024,
30524,
3795,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.github.maxopoly.finale.combat;
public class CombatConfig {
private int cpsLimit;
private long cpsCounterInterval;
private boolean noCooldown;
private double maxReach;
private boolean sweepEnabled;
private CombatSoundConfig combatSounds;
private double horizontalKb;
private double verticalKb;
private double sprintHorizontal;
private double sprintVertical;
private double airHorizontal;
private double airVertical;
private double waterHorizontal;
private double waterVertical;
private double attackMotionModifier;
private boolean stopSprinting;
private double potionCutOffDistance;
public CombatConfig(boolean noCooldown, int cpsLimit, long cpsCounterInterval, double maxReach, boolean sweepEnabled, CombatSoundConfig combatSounds,
double horizontalKb, double verticalKb, double sprintHorizontal, double sprintVertical, double airHorizontal, double airVertical,
double waterHorizontal, double waterVertical, double attackMotionModifier, boolean stopSprinting, double potionCutOffDistance) {
this.noCooldown = noCooldown;
this.cpsLimit = cpsLimit;
this.cpsCounterInterval = cpsCounterInterval;
this.maxReach = maxReach;
this.sweepEnabled = sweepEnabled;
this.combatSounds = combatSounds;
this.horizontalKb = horizontalKb;
this.verticalKb = verticalKb;
this.sprintHorizontal = sprintHorizontal;
this.sprintVertical = sprintVertical;
this.airHorizontal = airHorizontal;
this.airVertical = airVertical;
this.waterHorizontal = waterHorizontal;
this.waterVertical = waterVertical;
this.attackMotionModifier = attackMotionModifier;
this.stopSprinting = stopSprinting;
this.potionCutOffDistance = potionCutOffDistance;
}
public void setPotionCutOffDistance(double potionCutOffDistance) {
this.potionCutOffDistance = potionCutOffDistance;
}
public double getPotionCutOffDistance() {
return potionCutOffDistance;
}
public void setHorizontalKb(double horizontalKb) {
this.horizontalKb = horizontalKb;
}
public void setVerticalKb(double verticalKb) {
this.verticalKb = verticalKb;
}
public void setSprintHorizontal(double sprintHorizontal) {
this.sprintHorizontal = sprintHorizontal;
}
public void setSprintVertical(double sprintVertical) {
this.sprintVertical = sprintVertical;
}
public void setAirHorizontal(double airHorizontal) {
this.airHorizontal = airHorizontal;
}
public void setAirVertical(double airVertical) {
this.airVertical = airVertical;
}
public void setWaterHorizontal(double waterHorizontal) {
this.waterHorizontal = waterHorizontal;
}
public void setWaterVertical(double waterVertical) {
this.waterVertical = waterVertical;
}
public void setAttackMotionModifier(double attackMotionModifier) {
this.attackMotionModifier = attackMotionModifier;
}
public void setStopSprinting(boolean stopSprinting) {
this.stopSprinting = stopSprinting;
}
public double getAirHorizontal() {
return airHorizontal;
}
public double getAirVertical() {
return airVertical;
}
public double getWaterHorizontal() {
return waterHorizontal;
}
public double getWaterVertical() {
return waterVertical;
}
public boolean isStopSprinting() {
return stopSprinting;
}
public double getHorizontalKb() {
return horizontalKb;
}
public double getVerticalKb() {
return verticalKb;
}
public double getSprintHorizontal() {
return sprintHorizontal;
}
public double getSprintVertical() {
return sprintVertical;
}
public double getAttackMotionModifier() {
return attackMotionModifier;
}
public int getCPSLimit() {
return cpsLimit;
}
public long getCpsCounterInterval() {
return cpsCounterInterval;
}
public boolean isNoCooldown() {
return noCooldown;
}
public double getMaxReach() {
return maxReach;
}
public boolean isSweepEnabled() {
return sweepEnabled;
}
public CombatSoundConfig getCombatSounds() {
return combatSounds;
}
public double getHorizontalKB() {
return horizontalKb;
}
public double getVerticalKB() {
return verticalKb;
}
}
| Maxopoly/Finale | src/main/java/com/github/maxopoly/finale/combat/CombatConfig.java | Java | mit | 4,053 | [
30522,
7427,
4012,
1012,
21025,
2705,
12083,
1012,
4098,
7361,
4747,
2100,
1012,
9599,
1012,
4337,
1025,
2270,
2465,
4337,
8663,
8873,
2290,
1063,
2797,
20014,
18133,
14540,
27605,
2102,
1025,
2797,
2146,
18133,
9363,
16671,
23282,
3334,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# AUTOGENERATED FILE
FROM balenalib/artik530-debian:jessie-run
ENV NODE_VERSION 15.6.0
ENV YARN_VERSION 1.22.4
RUN buildDeps='curl libatomic1' \
&& set -x \
&& for key in \
6A010C5166006599AA17F08146C2130DFD2497F5 \
; do \
gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
done \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz" \
&& echo "234871415c54174f91764f332a72631519a6af7b1a87797ad7c729855182f9cd node-v$NODE_VERSION-linux-armv7l.tar.gz" | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-armv7l.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-armv7l.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& npm config set unsafe-perm true -g --unsafe-perm \
&& rm -rf /tmp/*
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \
&& echo "Running test-stack@node" \
&& chmod +x test-stack@node.sh \
&& bash test-stack@node.sh \
&& rm -rf test-stack@node.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Jessie \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v15.6.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/node/artik530/debian/jessie/15.6.0/run/Dockerfile | Dockerfile | apache-2.0 | 2,938 | [
30522,
1001,
8285,
6914,
16848,
5371,
2013,
28352,
8189,
29521,
1013,
2396,
5480,
22275,
2692,
1011,
2139,
15599,
1024,
10934,
1011,
2448,
4372,
2615,
13045,
1035,
2544,
2321,
1012,
1020,
1012,
1014,
4372,
2615,
27158,
1035,
2544,
1015,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System;
using Microsoft.VisualStudio.OLE.Interop;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal sealed class ComEventSink
{
public static ComEventSink Advise<T>(object obj, T sink) where T : class
{
if (!typeof(T).IsInterface)
{
throw new InvalidOperationException();
}
if (obj is not IConnectionPointContainer connectionPointContainer)
{
throw new ArgumentException("Not an IConnectionPointContainer", nameof(obj));
}
connectionPointContainer.FindConnectionPoint(typeof(T).GUID, out var connectionPoint);
if (connectionPoint == null)
{
throw new InvalidOperationException("Could not find connection point for " + typeof(T).FullName);
}
connectionPoint.Advise(sink, out var cookie);
return new ComEventSink(connectionPoint, cookie);
}
private readonly IConnectionPoint _connectionPoint;
private readonly uint _cookie;
private bool _unadvised;
public ComEventSink(IConnectionPoint connectionPoint, uint cookie)
{
_connectionPoint = connectionPoint;
_cookie = cookie;
}
public void Unadvise()
{
if (_unadvised)
{
throw new InvalidOperationException("Already unadvised.");
}
_connectionPoint.Unadvise(_cookie);
_unadvised = true;
}
}
}
| bartdesmet/roslyn | src/VisualStudio/Core/Def/Utilities/ComEventSink.cs | C# | mit | 1,804 | [
30522,
1013,
1013,
7000,
2000,
1996,
1012,
5658,
3192,
2104,
2028,
2030,
2062,
10540,
1012,
1013,
1013,
1996,
1012,
5658,
3192,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
10210,
6105,
1012,
1013,
1013,
2156,
1996,
6105,
5371,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @author Kai Salmen / www.kaisalmen.de
*/
'use strict';
if ( KSX.test.projectionspace === undefined ) KSX.test.projectionspace = {};
KSX.test.projectionspace.VerifyPP = (function () {
PPCheck.prototype = Object.create(KSX.core.ThreeJsApp.prototype, {
constructor: {
configurable: true,
enumerable: true,
value: PPCheck,
writable: true
}
});
function PPCheck(elementToBindTo, loader) {
KSX.core.ThreeJsApp.call(this);
this.configure({
name: 'PPCheck',
htmlCanvas: elementToBindTo,
useScenePerspective: true,
loader: loader
});
this.controls = null;
this.projectionSpace = new KSX.instancing.ProjectionSpace({
low: { index: 0, name: 'Low', x: 240, y: 100, defaultHeightFactor: 9, mesh: null },
medium: { index: 1, name: 'Medium', x: 720, y: 302, defaultHeightFactor: 18, mesh: null }
}, 0);
this.cameraDefaults = {
posCamera: new THREE.Vector3( 300, 300, 300 ),
far: 100000
};
}
PPCheck.prototype.initPreGL = function() {
var scope = this;
var callbackOnSuccess = function () {
scope.preloadDone = true;
};
scope.projectionSpace.loadAsyncResources( callbackOnSuccess );
};
PPCheck.prototype.initGL = function () {
this.projectionSpace.initGL();
this.projectionSpace.flipTexture( 'linkPixelProtest' );
this.scenePerspective.scene.add( this.projectionSpace.dimensions[this.projectionSpace.index].mesh );
this.scenePerspective.setCameraDefaults( this.cameraDefaults );
this.controls = new THREE.TrackballControls( this.scenePerspective.camera );
};
PPCheck.prototype.resizeDisplayGL = function () {
this.controls.handleResize();
};
PPCheck.prototype.renderPre = function () {
this.controls.update();
};
return PPCheck;
})();
| kaisalmen/kaisalmen.de | test/projectionspace/VerifyPP.js | JavaScript | mit | 2,021 | [
30522,
1013,
1008,
1008,
1008,
1030,
3166,
11928,
16183,
3549,
1013,
7479,
1012,
11928,
12002,
3549,
1012,
2139,
1008,
1013,
1005,
2224,
9384,
1005,
1025,
2065,
1006,
29535,
2595,
1012,
3231,
1012,
21796,
15327,
1027,
1027,
1027,
6151,
2834... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RemoveOddPosition
{
class RemoveOddPosition
{
static void Main(string[] args)
{
var words = Console.ReadLine().Split(' ').ToList();
var output = new List<string>();
for (int i = 0; i < words.Count; i++)
{
if (i%2 != 0)
{
output.Add(words[i]);
}
}
Console.WriteLine(string.Join("", output));
}
}
}
| Tcetso/Fundamentals | 15-17_Lists/RemoveOddPosition/RemoveOddPosition.cs | C# | mit | 605 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
3415,
15327,
6366,
7716,
18927,
19234,
1063,
2465,
6366,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="robots" content="index, follow, all" />
<title>Index | Imagine API</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body id="overview">
<div class="header">
<ul>
<li><a href="classes.html">Classes</a></li>
<li><a href="namespaces.html">Namespaces</a></li>
<li><a href="interfaces.html">Interfaces</a></li>
<li><a href="doc-index.html">Index</a></li>
</ul>
<div id="title">Imagine API</div>
<div class="type">Index</div>
<a href="#letterA">A</a>
<a href="#letterB">B</a>
<a href="#letterC">C</a>
<a href="#letterD">D</a>
<a href="#letterE">E</a>
<a href="#letterF">F</a>
<a href="#letterG">G</a>
<a href="#letterH">H</a>
<a href="#letterI">I</a>
J
K
<a href="#letterL">L</a>
<a href="#letterM">M</a>
<a href="#letterN">N</a>
<a href="#letterO">O</a>
<a href="#letterP">P</a>
Q
<a href="#letterR">R</a>
<a href="#letterS">S</a>
<a href="#letterT">T</a>
U
V
<a href="#letterW">W</a>
X
Y
Z
</div>
<div class="content">
<h2 id="letterA">A</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html#method_arc"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::arc</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Draws an arc on a starting at a given x, y coordinates under a given start and end angles</dd><dt><a href="Imagine/Filter/Advanced/Border.html#method_apply"><abbr title="Imagine\Filter\Advanced\Border">Border</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/Border.html"><abbr title="Imagine\Filter\Advanced\Border">Border</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Advanced/Canvas.html#method_apply"><abbr title="Imagine\Filter\Advanced\Canvas">Canvas</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/Canvas.html"><abbr title="Imagine\Filter\Advanced\Canvas">Canvas</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Advanced/OnPixelBased.html#method_apply"><abbr title="Imagine\Filter\Advanced\OnPixelBased">OnPixelBased</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/OnPixelBased.html"><abbr title="Imagine\Filter\Advanced\OnPixelBased">OnPixelBased</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/ApplyMask.html"><abbr title="Imagine\Filter\Basic\ApplyMask">ApplyMask</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/ApplyMask.html#method_apply"><abbr title="Imagine\Filter\Basic\ApplyMask">ApplyMask</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/ApplyMask.html"><abbr title="Imagine\Filter\Basic\ApplyMask">ApplyMask</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Copy.html#method_apply"><abbr title="Imagine\Filter\Basic\Copy">Copy</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Copy.html"><abbr title="Imagine\Filter\Basic\Copy">Copy</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Crop.html#method_apply"><abbr title="Imagine\Filter\Basic\Crop">Crop</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Crop.html"><abbr title="Imagine\Filter\Basic\Crop">Crop</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Fill.html#method_apply"><abbr title="Imagine\Filter\Basic\Fill">Fill</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Fill.html"><abbr title="Imagine\Filter\Basic\Fill">Fill</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/FlipHorizontally.html#method_apply"><abbr title="Imagine\Filter\Basic\FlipHorizontally">FlipHorizontally</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/FlipHorizontally.html"><abbr title="Imagine\Filter\Basic\FlipHorizontally">FlipHorizontally</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/FlipVertically.html#method_apply"><abbr title="Imagine\Filter\Basic\FlipVertically">FlipVertically</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/FlipVertically.html"><abbr title="Imagine\Filter\Basic\FlipVertically">FlipVertically</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Paste.html#method_apply"><abbr title="Imagine\Filter\Basic\Paste">Paste</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Paste.html"><abbr title="Imagine\Filter\Basic\Paste">Paste</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Resize.html#method_apply"><abbr title="Imagine\Filter\Basic\Resize">Resize</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Resize.html"><abbr title="Imagine\Filter\Basic\Resize">Resize</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Rotate.html#method_apply"><abbr title="Imagine\Filter\Basic\Rotate">Rotate</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Rotate.html"><abbr title="Imagine\Filter\Basic\Rotate">Rotate</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Save.html#method_apply"><abbr title="Imagine\Filter\Basic\Save">Save</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Save.html"><abbr title="Imagine\Filter\Basic\Save">Save</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Show.html#method_apply"><abbr title="Imagine\Filter\Basic\Show">Show</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Show.html"><abbr title="Imagine\Filter\Basic\Show">Show</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Strip.html#method_apply"><abbr title="Imagine\Filter\Basic\Strip">Strip</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Strip.html"><abbr title="Imagine\Filter\Basic\Strip">Strip</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Basic/Thumbnail.html#method_apply"><abbr title="Imagine\Filter\Basic\Thumbnail">Thumbnail</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Thumbnail.html"><abbr title="Imagine\Filter\Basic\Thumbnail">Thumbnail</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/FilterInterface.html#method_apply"><abbr title="Imagine\Filter\FilterInterface">FilterInterface</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/FilterInterface.html"><abbr title="Imagine\Filter\FilterInterface">FilterInterface</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Transformation.html#method_applyFilter"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::applyFilter</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Applies a given FilterInterface onto given ImageInterface and returns modified ImageInterface</dd><dt><a href="Imagine/Filter/Transformation.html#method_apply"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::apply</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance</dd><dt><a href="Imagine/Filter/Transformation.html#method_applyMask"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::applyMask</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Applies a given mask to current image's alpha channel</dd><dt><a href="Imagine/Filter/Transformation.html#method_add"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::add</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Registers a given FilterInterface in an internal array of filters for later application to an instance of ImageInterface</dd><dt><a href="Imagine/Gd/Drawer.html#method_arc"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::arc</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws an arc on a starting at a given x, y coordinates under a given start and end angles</dd><dt><a href="Imagine/Gd/Image.html#method_applyMask"><abbr title="Imagine\Gd\Image">Image</abbr>::applyMask</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Applies a given mask to current image's alpha channel</dd><dt><a href="Imagine/Gmagick/Drawer.html#method_arc"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::arc</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws an arc on a starting at a given x, y coordinates under a given start and end angles</dd><dt><a href="Imagine/Gmagick/Image.html#method_applyMask"><abbr title="Imagine\Gmagick\Image">Image</abbr>::applyMask</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Applies a given mask to current image's alpha channel</dd><dt><a href="Imagine/Image/AbstractFont.html"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Histogram/Bucket.html#method_add"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr>::add</a>() — <em>Method in class <a href="Imagine/Image/Histogram/Bucket.html"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_applyMask"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::applyMask</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Applies a given mask to current image's alpha channel</dd><dt><a href="Imagine/Imagick/Drawer.html#method_arc"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::arc</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws an arc on a starting at a given x, y coordinates under a given start and end angles</dd><dt><a href="Imagine/Imagick/Image.html#method_applyMask"><abbr title="Imagine\Imagick\Image">Image</abbr>::applyMask</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Applies a given mask to current image's alpha channel</dd><dt><a href="Imagine/Test/ImagineTestCase.html#method_assertImageEquals"><abbr title="Imagine\Test\ImagineTestCase">ImagineTestCase</abbr>::assertImageEquals</a>() — <em>Method in class <a href="Imagine/Test/ImagineTestCase.html"><abbr title="Imagine\Test\ImagineTestCase">ImagineTestCase</abbr></a></em></dt>
<dd>Asserts that two images are equal using color histogram comparison method</dd> </dl><h2 id="letterB">B</h2>
<dl id="index"><dt><a href="Imagine/Filter/Advanced/Border.html"><abbr title="Imagine\Filter\Advanced\Border">Border</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Advanced.html">Imagine\Filter\Advanced</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Font.html#method_box"><abbr title="Imagine\Gd\Font">Font</abbr>::box</a>() — <em>Method in class <a href="Imagine/Gd/Font.html"><abbr title="Imagine\Gd\Font">Font</abbr></a></em></dt>
<dd>Gets BoxInterface of font size on the image based on string and angle</dd><dt><a href="Imagine/Gmagick/Font.html#method_box"><abbr title="Imagine\Gmagick\Font">Font</abbr>::box</a>() — <em>Method in class <a href="Imagine/Gmagick/Font.html"><abbr title="Imagine\Gmagick\Font">Font</abbr></a></em></dt>
<dd>Gets BoxInterface of font size on the image based on string and angle</dd><dt><a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/FontInterface.html#method_box"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr>::box</a>() — <em>Method in class <a href="Imagine/Image/FontInterface.html"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr></a></em></dt>
<dd>Gets BoxInterface of font size on the image based on string and angle</dd><dt><a href="Imagine/Image/Histogram/Bucket.html"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Histogram.html">Imagine\Image\Histogram</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Font.html#method_box"><abbr title="Imagine\Imagick\Font">Font</abbr>::box</a>() — <em>Method in class <a href="Imagine/Imagick/Font.html"><abbr title="Imagine\Imagick\Font">Font</abbr></a></em></dt>
<dd>Gets BoxInterface of font size on the image based on string and angle</dd> </dl><h2 id="letterC">C</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html#method_chord"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::chord</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Same as arc, but also connects end points with a straight line</dd><dt><a href="Imagine/Filter/Advanced/Canvas.html"><abbr title="Imagine\Filter\Advanced\Canvas">Canvas</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Advanced.html">Imagine\Filter\Advanced</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Copy.html"><abbr title="Imagine\Filter\Basic\Copy">Copy</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Crop.html"><abbr title="Imagine\Filter\Basic\Crop">Crop</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Transformation.html#method_copy"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::copy</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Copies current source image into a new ImageInterface instance</dd><dt><a href="Imagine/Filter/Transformation.html#method_crop"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::crop</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Crops a specified box out of the source image (modifies the source image) Returns cropped self</dd><dt><a href="Imagine/Gd/Drawer.html#method_chord"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::chord</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Same as arc, but also connects end points with a straight line</dd><dt><a href="Imagine/Gd/Image.html#method_copy"><abbr title="Imagine\Gd\Image">Image</abbr>::copy</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Copies current source image into a new ImageInterface instance</dd><dt><a href="Imagine/Gd/Image.html#method_crop"><abbr title="Imagine\Gd\Image">Image</abbr>::crop</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Crops a specified box out of the source image (modifies the source image) Returns cropped self</dd><dt><a href="Imagine/Gd/Imagine.html#method_create"><abbr title="Imagine\Gd\Imagine">Imagine</abbr>::create</a>() — <em>Method in class <a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a></em></dt>
<dd>Creates a new empty image with an optional background color</dd><dt><a href="Imagine/Gmagick/Drawer.html#method_chord"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::chord</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Same as arc, but also connects end points with a straight line</dd><dt><a href="Imagine/Gmagick/Image.html#method_copy"><abbr title="Imagine\Gmagick\Image">Image</abbr>::copy</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Copies current source image into a new ImageInterface instance</dd><dt><a href="Imagine/Gmagick/Image.html#method_crop"><abbr title="Imagine\Gmagick\Image">Image</abbr>::crop</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Crops a specified box out of the source image (modifies the source image) Returns cropped self</dd><dt><a href="Imagine/Gmagick/Imagine.html#method_create"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr>::create</a>() — <em>Method in class <a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Creates a new empty image with an optional background color</dd><dt><a href="Imagine/Image/Box.html#method_contains"><abbr title="Imagine\Image\Box">Box</abbr>::contains</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0)</dd><dt><a href="Imagine/Image/BoxInterface.html#method_contains"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::contains</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Checks whether current box can fit given box at a given start position, start position defaults to top left corner xy(0,0)</dd><dt><a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Histogram/Bucket.html#method_count"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr>::count</a>() — <em>Method in class <a href="Imagine/Image/Histogram/Bucket.html"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Histogram/Range.html#method_contains"><abbr title="Imagine\Image\Histogram\Range">Range</abbr>::contains</a>() — <em>Method in class <a href="Imagine/Image/Histogram/Range.html"><abbr title="Imagine\Image\Histogram\Range">Range</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImagineInterface.html#method_create"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr>::create</a>() — <em>Method in class <a href="Imagine/Image/ImagineInterface.html"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr></a></em></dt>
<dd>Creates a new empty image with an optional background color</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_copy"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::copy</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Copies current source image into a new ImageInterface instance</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_crop"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::crop</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Crops a specified box out of the source image (modifies the source image) Returns cropped self</dd><dt><a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Point.html">Imagine\Image\Point</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Drawer.html#method_chord"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::chord</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Same as arc, but also connects end points with a straight line</dd><dt><a href="Imagine/Imagick/Image.html#method_copy"><abbr title="Imagine\Imagick\Image">Image</abbr>::copy</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Copies current source image into a new ImageInterface instance</dd><dt><a href="Imagine/Imagick/Image.html#method_crop"><abbr title="Imagine\Imagick\Image">Image</abbr>::crop</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Crops a specified box out of the source image (modifies the source image) Returns cropped self</dd><dt><a href="Imagine/Imagick/Imagine.html#method_create"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr>::create</a>() — <em>Method in class <a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Creates a new empty image with an optional background color</dd> </dl><h2 id="letterD">D</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Draw.html">Imagine\Draw</a></em></dt>
<dd></dd><dt><a href="Imagine/Draw/DrawerInterface.html#method_dot"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::dot</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Places a one pixel point at specific coordinates and fills it with specified color</dd><dt><a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a> — <em>Class in namespace <a href="Imagine/Gd.html">Imagine\Gd</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Drawer.html#method_dot"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::dot</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Places a one pixel point at specific coordinates and fills it with specified color</dd><dt><a href="Imagine/Gd/Image.html#method_draw"><abbr title="Imagine\Gd\Image">Image</abbr>::draw</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Instantiates and returns a DrawerInterface instance for image drawing</dd><dt><a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a> — <em>Class in namespace <a href="Imagine/Gmagick.html">Imagine\Gmagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Drawer.html#method_dot"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::dot</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Places a one pixel point at specific coordinates and fills it with specified color</dd><dt><a href="Imagine/Gmagick/Image.html#method_draw"><abbr title="Imagine\Gmagick\Image">Image</abbr>::draw</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Instantiates and returns a DrawerInterface instance for image drawing</dd><dt><a href="Imagine/Image/Color.html#method_dissolve"><abbr title="Imagine\Image\Color">Color</abbr>::dissolve</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns a copy of current color, incrementing the alpha channel by the given amount</dd><dt><a href="Imagine/Image/Color.html#method_darken"><abbr title="Imagine\Image\Color">Color</abbr>::darken</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns a copy of the current color, darkened by the specified number of shades</dd><dt><a href="Imagine/Image/ImageInterface.html#method_draw"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::draw</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Instantiates and returns a DrawerInterface instance for image drawing</dd><dt><a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a> — <em>Class in namespace <a href="Imagine/Imagick.html">Imagine\Imagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Drawer.html#method_dot"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::dot</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Places a one pixel point at specific coordinates and fills it with specified color</dd><dt><a href="Imagine/Imagick/Image.html#method_draw"><abbr title="Imagine\Imagick\Image">Image</abbr>::draw</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Instantiates and returns a DrawerInterface instance for image drawing</dd> </dl><h2 id="letterE">E</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html#method_ellipse"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::ellipse</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Draws and ellipse with center at the given x, y coordinates, and given width and height</dd><dt><a href="Imagine/Effects/EffectsInterface.html"><abbr title="Imagine\Effects\EffectsInterface">EffectsInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Effects.html">Imagine\Effects</a></em></dt>
<dd></dd><dt><a href="Imagine/Exception/Exception.html"><abbr title="Imagine\Exception\Exception">Exception</abbr></a> — <em>Class in namespace <a href="Imagine/Exception.html">Imagine\Exception</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Drawer.html#method_ellipse"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::ellipse</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws and ellipse with center at the given x, y coordinates, and given width and height</dd><dt><a href="Imagine/Gd/Effects.html"><abbr title="Imagine\Gd\Effects">Effects</abbr></a> — <em>Class in namespace <a href="Imagine/Gd.html">Imagine\Gd</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Image.html#method_effects"><abbr title="Imagine\Gd\Image">Image</abbr>::effects</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Drawer.html#method_ellipse"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::ellipse</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws and ellipse with center at the given x, y coordinates, and given width and height</dd><dt><a href="Imagine/Gmagick/Effects.html"><abbr title="Imagine\Gmagick\Effects">Effects</abbr></a> — <em>Class in namespace <a href="Imagine/Gmagick.html">Imagine\Gmagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Image.html#method_effects"><abbr title="Imagine\Gmagick\Image">Image</abbr>::effects</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImageInterface.html#method_effects"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::effects</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Drawer.html#method_ellipse"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::ellipse</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws and ellipse with center at the given x, y coordinates, and given width and height</dd><dt><a href="Imagine/Imagick/Effects.html"><abbr title="Imagine\Imagick\Effects">Effects</abbr></a> — <em>Class in namespace <a href="Imagine/Imagick.html">Imagine\Imagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Image.html#method_effects"><abbr title="Imagine\Imagick\Image">Image</abbr>::effects</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Test/Constraint/IsImageEqual.html#method_evaluate"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr>::evaluate</a>() — <em>Method in class <a href="Imagine/Test/Constraint/IsImageEqual.html"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr></a></em></dt>
<dd>{@inheritdoc}</dd> </dl><h2 id="letterF">F</h2>
<dl id="index"><dt><a href="Imagine/Filter/Basic/Fill.html"><abbr title="Imagine\Filter\Basic\Fill">Fill</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/FlipHorizontally.html"><abbr title="Imagine\Filter\Basic\FlipHorizontally">FlipHorizontally</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/FlipVertically.html"><abbr title="Imagine\Filter\Basic\FlipVertically">FlipVertically</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/FilterInterface.html"><abbr title="Imagine\Filter\FilterInterface">FilterInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Filter.html">Imagine\Filter</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Transformation.html#method_flipHorizontally"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::flipHorizontally</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Flips current image using horizontal axis</dd><dt><a href="Imagine/Filter/Transformation.html#method_flipVertically"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::flipVertically</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Flips current image using vertical axis</dd><dt><a href="Imagine/Filter/Transformation.html#method_fill"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::fill</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image</dd><dt><a href="Imagine/Gd/Font.html"><abbr title="Imagine\Gd\Font">Font</abbr></a> — <em>Class in namespace <a href="Imagine/Gd.html">Imagine\Gd</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Image.html#method_flipHorizontally"><abbr title="Imagine\Gd\Image">Image</abbr>::flipHorizontally</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Flips current image using horizontal axis</dd><dt><a href="Imagine/Gd/Image.html#method_flipVertically"><abbr title="Imagine\Gd\Image">Image</abbr>::flipVertically</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Flips current image using vertical axis</dd><dt><a href="Imagine/Gd/Image.html#method_fill"><abbr title="Imagine\Gd\Image">Image</abbr>::fill</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image</dd><dt><a href="Imagine/Gd/Imagine.html#method_font"><abbr title="Imagine\Gd\Imagine">Imagine</abbr>::font</a>() — <em>Method in class <a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd><dt><a href="Imagine/Gmagick/Font.html"><abbr title="Imagine\Gmagick\Font">Font</abbr></a> — <em>Class in namespace <a href="Imagine/Gmagick.html">Imagine\Gmagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Image.html#method_flipHorizontally"><abbr title="Imagine\Gmagick\Image">Image</abbr>::flipHorizontally</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Flips current image using horizontal axis</dd><dt><a href="Imagine/Gmagick/Image.html#method_flipVertically"><abbr title="Imagine\Gmagick\Image">Image</abbr>::flipVertically</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Flips current image using vertical axis</dd><dt><a href="Imagine/Gmagick/Image.html#method_fill"><abbr title="Imagine\Gmagick\Image">Image</abbr>::fill</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image</dd><dt><a href="Imagine/Gmagick/Imagine.html#method_font"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr>::font</a>() — <em>Method in class <a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd><dt><a href="Imagine/Image/Fill/FillInterface.html"><abbr title="Imagine\Image\Fill\FillInterface">FillInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Fill.html">Imagine\Image\Fill</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/FontInterface.html"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImagineInterface.html#method_font"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr>::font</a>() — <em>Method in class <a href="Imagine/Image/ImagineInterface.html"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_flipHorizontally"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::flipHorizontally</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Flips current image using horizontal axis</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_flipVertically"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::flipVertically</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Flips current image using vertical axis</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_fill"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::fill</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image</dd><dt><a href="Imagine/Imagick/Font.html"><abbr title="Imagine\Imagick\Font">Font</abbr></a> — <em>Class in namespace <a href="Imagine/Imagick.html">Imagine\Imagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Image.html#method_flipHorizontally"><abbr title="Imagine\Imagick\Image">Image</abbr>::flipHorizontally</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Flips current image using horizontal axis</dd><dt><a href="Imagine/Imagick/Image.html#method_flipVertically"><abbr title="Imagine\Imagick\Image">Image</abbr>::flipVertically</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Flips current image using vertical axis</dd><dt><a href="Imagine/Imagick/Image.html#method_fill"><abbr title="Imagine\Imagick\Image">Image</abbr>::fill</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image</dd><dt><a href="Imagine/Imagick/Imagine.html#method_font"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr>::font</a>() — <em>Method in class <a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd> </dl><h2 id="letterG">G</h2>
<dl id="index"><dt><a href="Imagine/Effects/EffectsInterface.html#method_gamma"><abbr title="Imagine\Effects\EffectsInterface">EffectsInterface</abbr>::gamma</a>() — <em>Method in class <a href="Imagine/Effects/EffectsInterface.html"><abbr title="Imagine\Effects\EffectsInterface">EffectsInterface</abbr></a></em></dt>
<dd>Apply gamma correction</dd><dt><a href="Imagine/Filter/Advanced/Grayscale.html"><abbr title="Imagine\Filter\Advanced\Grayscale">Grayscale</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Advanced.html">Imagine\Filter\Advanced</a></em></dt>
<dd>The Grayscale filter calculates the gray-value based on RGB.</dd><dt><a href="Imagine/Filter/ImagineAware.html#method_getImagine"><abbr title="Imagine\Filter\ImagineAware">ImagineAware</abbr>::getImagine</a>() — <em>Method in class <a href="Imagine/Filter/ImagineAware.html"><abbr title="Imagine\Filter\ImagineAware">ImagineAware</abbr></a></em></dt>
<dd>Get ImagineInterface instance.</dd><dt><a href="Imagine/Gd/Effects.html#method_gamma"><abbr title="Imagine\Gd\Effects">Effects</abbr>::gamma</a>() — <em>Method in class <a href="Imagine/Gd/Effects.html"><abbr title="Imagine\Gd\Effects">Effects</abbr></a></em></dt>
<dd>Apply gamma correction</dd><dt><a href="Imagine/Gd/Image.html#method_get"><abbr title="Imagine\Gd\Image">Image</abbr>::get</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Returns the image content as a binary string</dd><dt><a href="Imagine/Gd/Image.html#method_getSize"><abbr title="Imagine\Gd\Image">Image</abbr>::getSize</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Returns current image size</dd><dt><a href="Imagine/Gd/Image.html#method_getColorAt"><abbr title="Imagine\Gd\Image">Image</abbr>::getColorAt</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Returns color at specified positions of current image</dd><dt><a href="Imagine/Gmagick/Effects.html#method_gamma"><abbr title="Imagine\Gmagick\Effects">Effects</abbr>::gamma</a>() — <em>Method in class <a href="Imagine/Gmagick/Effects.html"><abbr title="Imagine\Gmagick\Effects">Effects</abbr></a></em></dt>
<dd>Apply gamma correction</dd><dt><a href="Imagine/Gmagick/Image.html#method_get"><abbr title="Imagine\Gmagick\Image">Image</abbr>::get</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Returns the image content as a binary string</dd><dt><a href="Imagine/Gmagick/Image.html#method_getSize"><abbr title="Imagine\Gmagick\Image">Image</abbr>::getSize</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Returns current image size</dd><dt><a href="Imagine/Gmagick/Image.html#method_getColorAt"><abbr title="Imagine\Gmagick\Image">Image</abbr>::getColorAt</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Returns color at specified positions of current image</dd><dt><a href="Imagine/Image/AbstractFont.html#method_getFile"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr>::getFile</a>() — <em>Method in class <a href="Imagine/Image/AbstractFont.html"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr></a></em></dt>
<dd>Gets the fontfile for current font</dd><dt><a href="Imagine/Image/AbstractFont.html#method_getSize"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr>::getSize</a>() — <em>Method in class <a href="Imagine/Image/AbstractFont.html"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr></a></em></dt>
<dd>Gets font's integer point size</dd><dt><a href="Imagine/Image/AbstractFont.html#method_getColor"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr>::getColor</a>() — <em>Method in class <a href="Imagine/Image/AbstractFont.html"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr></a></em></dt>
<dd>Gets font's color</dd><dt><a href="Imagine/Image/Box.html#method_getWidth"><abbr title="Imagine\Image\Box">Box</abbr>::getWidth</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Gets current image width</dd><dt><a href="Imagine/Image/Box.html#method_getHeight"><abbr title="Imagine\Image\Box">Box</abbr>::getHeight</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Gets current image height</dd><dt><a href="Imagine/Image/BoxInterface.html#method_getHeight"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::getHeight</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Gets current image height</dd><dt><a href="Imagine/Image/BoxInterface.html#method_getWidth"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::getWidth</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Gets current image width</dd><dt><a href="Imagine/Image/Color.html#method_getRed"><abbr title="Imagine\Image\Color">Color</abbr>::getRed</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns RED value of the color</dd><dt><a href="Imagine/Image/Color.html#method_getGreen"><abbr title="Imagine\Image\Color">Color</abbr>::getGreen</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns GREEN value of the color</dd><dt><a href="Imagine/Image/Color.html#method_getBlue"><abbr title="Imagine\Image\Color">Color</abbr>::getBlue</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns BLUE value of the color</dd><dt><a href="Imagine/Image/Color.html#method_getAlpha"><abbr title="Imagine\Image\Color">Color</abbr>::getAlpha</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns percentage of transparency of the color</dd><dt><a href="Imagine/Image/Fill/FillInterface.html#method_getColor"><abbr title="Imagine\Image\Fill\FillInterface">FillInterface</abbr>::getColor</a>() — <em>Method in class <a href="Imagine/Image/Fill/FillInterface.html"><abbr title="Imagine\Image\Fill\FillInterface">FillInterface</abbr></a></em></dt>
<dd>Gets color of the fill for the given position</dd><dt><a href="Imagine/Image/Fill/Gradient/Horizontal.html#method_getDistance"><abbr title="Imagine\Image\Fill\Gradient\Horizontal">Horizontal</abbr>::getDistance</a>() — <em>Method in class <a href="Imagine/Image/Fill/Gradient/Horizontal.html"><abbr title="Imagine\Image\Fill\Gradient\Horizontal">Horizontal</abbr></a></em></dt>
<dd>{@inheritdoc}</dd><dt><a href="Imagine/Image/Fill/Gradient/Linear.html#method_getColor"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr>::getColor</a>() — <em>Method in class <a href="Imagine/Image/Fill/Gradient/Linear.html"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr></a></em></dt>
<dd>Gets color of the fill for the given position</dd><dt><a href="Imagine/Image/Fill/Gradient/Linear.html#method_getStart"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr>::getStart</a>() — <em>Method in class <a href="Imagine/Image/Fill/Gradient/Linear.html"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Fill/Gradient/Linear.html#method_getEnd"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr>::getEnd</a>() — <em>Method in class <a href="Imagine/Image/Fill/Gradient/Linear.html"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Fill/Gradient/Vertical.html#method_getDistance"><abbr title="Imagine\Image\Fill\Gradient\Vertical">Vertical</abbr>::getDistance</a>() — <em>Method in class <a href="Imagine/Image/Fill/Gradient/Vertical.html"><abbr title="Imagine\Image\Fill\Gradient\Vertical">Vertical</abbr></a></em></dt>
<dd>{@inheritdoc}</dd><dt><a href="Imagine/Image/FontInterface.html#method_getFile"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr>::getFile</a>() — <em>Method in class <a href="Imagine/Image/FontInterface.html"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr></a></em></dt>
<dd>Gets the fontfile for current font</dd><dt><a href="Imagine/Image/FontInterface.html#method_getSize"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr>::getSize</a>() — <em>Method in class <a href="Imagine/Image/FontInterface.html"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr></a></em></dt>
<dd>Gets font's integer point size</dd><dt><a href="Imagine/Image/FontInterface.html#method_getColor"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr>::getColor</a>() — <em>Method in class <a href="Imagine/Image/FontInterface.html"><abbr title="Imagine\Image\FontInterface">FontInterface</abbr></a></em></dt>
<dd>Gets font's color</dd><dt><a href="Imagine/Image/ImageInterface.html#method_get"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::get</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Returns the image content as a binary string</dd><dt><a href="Imagine/Image/ImageInterface.html#method_getSize"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::getSize</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Returns current image size</dd><dt><a href="Imagine/Image/ImageInterface.html#method_getColorAt"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::getColorAt</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Returns color at specified positions of current image</dd><dt><a href="Imagine/Image/Point.html#method_getX"><abbr title="Imagine\Image\Point">Point</abbr>::getX</a>() — <em>Method in class <a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a></em></dt>
<dd>Gets points x coordinate</dd><dt><a href="Imagine/Image/Point.html#method_getY"><abbr title="Imagine\Image\Point">Point</abbr>::getY</a>() — <em>Method in class <a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a></em></dt>
<dd>Gets points y coordinate</dd><dt><a href="Imagine/Image/PointInterface.html#method_getX"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr>::getX</a>() — <em>Method in class <a href="Imagine/Image/PointInterface.html"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr></a></em></dt>
<dd>Gets points x coordinate</dd><dt><a href="Imagine/Image/PointInterface.html#method_getY"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr>::getY</a>() — <em>Method in class <a href="Imagine/Image/PointInterface.html"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr></a></em></dt>
<dd>Gets points y coordinate</dd><dt><a href="Imagine/Image/Point/Center.html#method_getX"><abbr title="Imagine\Image\Point\Center">Center</abbr>::getX</a>() — <em>Method in class <a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a></em></dt>
<dd>Gets points x coordinate</dd><dt><a href="Imagine/Image/Point/Center.html#method_getY"><abbr title="Imagine\Image\Point\Center">Center</abbr>::getY</a>() — <em>Method in class <a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a></em></dt>
<dd>Gets points y coordinate</dd><dt><a href="Imagine/Imagick/Effects.html#method_gamma"><abbr title="Imagine\Imagick\Effects">Effects</abbr>::gamma</a>() — <em>Method in class <a href="Imagine/Imagick/Effects.html"><abbr title="Imagine\Imagick\Effects">Effects</abbr></a></em></dt>
<dd>Apply gamma correction</dd><dt><a href="Imagine/Imagick/Image.html#method_get"><abbr title="Imagine\Imagick\Image">Image</abbr>::get</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Returns the image content as a binary string</dd><dt><a href="Imagine/Imagick/Image.html#method_getSize"><abbr title="Imagine\Imagick\Image">Image</abbr>::getSize</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Returns current image size</dd><dt><a href="Imagine/Imagick/Image.html#method_getColorAt"><abbr title="Imagine\Imagick\Image">Image</abbr>::getColorAt</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Returns color at specified positions of current image</dd> </dl><h2 id="letterH">H</h2>
<dl id="index"><dt><a href="Imagine/Gd/Image.html#method_histogram"><abbr title="Imagine\Gd\Image">Image</abbr>::histogram</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Returns array of image colors as Imagine\Image\Color instances</dd><dt><a href="Imagine/Gmagick/Image.html#method_histogram"><abbr title="Imagine\Gmagick\Image">Image</abbr>::histogram</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Returns array of image colors as Imagine\Image\Color instances</dd><dt><a href="Imagine/Image/Box.html#method_heighten"><abbr title="Imagine\Image\Box">Box</abbr>::heighten</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Resizes box to given height, constraining proportions and returns the new box</dd><dt><a href="Imagine/Image/BoxInterface.html#method_heighten"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::heighten</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Resizes box to given height, constraining proportions and returns the new box</dd><dt><a href="Imagine/Image/Fill/Gradient/Horizontal.html"><abbr title="Imagine\Image\Fill\Gradient\Horizontal">Horizontal</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Fill/Gradient.html">Imagine\Image\Fill\Gradient</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImageInterface.html#method_histogram"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::histogram</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Returns array of image colors as Imagine\Image\Color instances</dd><dt><a href="Imagine/Imagick/Image.html#method_histogram"><abbr title="Imagine\Imagick\Image">Image</abbr>::histogram</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Returns array of image colors as Imagine\Image\Color instances</dd> </dl><h2 id="letterI">I</h2>
<dl id="index"><dt><a href="Imagine/Exception/InvalidArgumentException.html"><abbr title="Imagine\Exception\InvalidArgumentException">InvalidArgumentException</abbr></a> — <em>Class in namespace <a href="Imagine/Exception.html">Imagine\Exception</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/ImagineAware.html"><abbr title="Imagine\Filter\ImagineAware">ImagineAware</abbr></a> — <em>Class in namespace <a href="Imagine/Filter.html">Imagine\Filter</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a> — <em>Class in namespace <a href="Imagine/Gd.html">Imagine\Gd</a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a> — <em>Class in namespace <a href="Imagine/Gd.html">Imagine\Gd</a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a> — <em>Class in namespace <a href="Imagine/Gmagick.html">Imagine\Gmagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a> — <em>Class in namespace <a href="Imagine/Gmagick.html">Imagine\Gmagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Box.html#method_increase"><abbr title="Imagine\Image\Box">Box</abbr>::increase</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Creates new BoxInterface, adding given size to both sides</dd><dt><a href="Imagine/Image/BoxInterface.html#method_increase"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::increase</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Creates new BoxInterface, adding given size to both sides</dd><dt><a href="Imagine/Image/Color.html#method_isOpaque"><abbr title="Imagine\Image\Color">Color</abbr>::isOpaque</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Checks if the current color is opaque</dd><dt><a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImagineInterface.html"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Point.html#method_in"><abbr title="Imagine\Image\Point">Point</abbr>::in</a>() — <em>Method in class <a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a></em></dt>
<dd>Checks if current coordinate is inside a given bo</dd><dt><a href="Imagine/Image/PointInterface.html#method_in"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr>::in</a>() — <em>Method in class <a href="Imagine/Image/PointInterface.html"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr></a></em></dt>
<dd>Checks if current coordinate is inside a given bo</dd><dt><a href="Imagine/Image/Point/Center.html#method_in"><abbr title="Imagine\Image\Point\Center">Center</abbr>::in</a>() — <em>Method in class <a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a></em></dt>
<dd>Checks if current coordinate is inside a given bo</dd><dt><a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a> — <em>Class in namespace <a href="Imagine/Imagick.html">Imagine\Imagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a> — <em>Class in namespace <a href="Imagine/Imagick.html">Imagine\Imagick</a></em></dt>
<dd></dd><dt><a href="Imagine/Test/Constraint/IsImageEqual.html"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr></a> — <em>Class in namespace <a href="Imagine/Test/Constraint.html">Imagine\Test\Constraint</a></em></dt>
<dd></dd><dt><a href="Imagine/Test/ImagineTestCase.html"><abbr title="Imagine\Test\ImagineTestCase">ImagineTestCase</abbr></a> — <em>Class in namespace <a href="Imagine/Test.html">Imagine\Test</a></em></dt>
<dd></dd> </dl><h2 id="letterL">L</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html#method_line"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::line</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Draws a line from start(x, y) to end(x, y) coordinates</dd><dt><a href="Imagine/Gd/Drawer.html#method_line"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::line</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws a line from start(x, y) to end(x, y) coordinates</dd><dt><a href="Imagine/Gd/Imagine.html#method_load"><abbr title="Imagine\Gd\Imagine">Imagine</abbr>::load</a>() — <em>Method in class <a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a></em></dt>
<dd>Loads an image from a binary $string</dd><dt><a href="Imagine/Gmagick/Drawer.html#method_line"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::line</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws a line from start(x, y) to end(x, y) coordinates</dd><dt><a href="Imagine/Gmagick/Imagine.html#method_load"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr>::load</a>() — <em>Method in class <a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Loads an image from a binary $string</dd><dt><a href="Imagine/Image/Color.html#method_lighten"><abbr title="Imagine\Image\Color">Color</abbr>::lighten</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns a copy of the current color, lightened by the specified number of shades</dd><dt><a href="Imagine/Image/Fill/Gradient/Linear.html"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Fill/Gradient.html">Imagine\Image\Fill\Gradient</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImagineInterface.html#method_load"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr>::load</a>() — <em>Method in class <a href="Imagine/Image/ImagineInterface.html"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr></a></em></dt>
<dd>Loads an image from a binary $string</dd><dt><a href="Imagine/Imagick/Drawer.html#method_line"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::line</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws a line from start(x, y) to end(x, y) coordinates</dd><dt><a href="Imagine/Imagick/Imagine.html#method_load"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr>::load</a>() — <em>Method in class <a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Loads an image from a binary $string</dd> </dl><h2 id="letterM">M</h2>
<dl id="index"><dt><a href="Imagine/Gd/Image.html#method_mask"><abbr title="Imagine\Gd\Image">Image</abbr>::mask</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Transforms creates a grayscale mask from current image, returns a new image, while keeping the existing image unmodified</dd><dt><a href="Imagine/Gmagick/Image.html#method_mask"><abbr title="Imagine\Gmagick\Image">Image</abbr>::mask</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Transforms creates a grayscale mask from current image, returns a new image, while keeping the existing image unmodified</dd><dt><a href="Imagine/Image/ImageInterface.html#method_mask"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::mask</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Transforms creates a grayscale mask from current image, returns a new image, while keeping the existing image unmodified</dd><dt><a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Point.html#method_move"><abbr title="Imagine\Image\Point">Point</abbr>::move</a>() — <em>Method in class <a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a></em></dt>
<dd>Returns another point, moved by a given amount from current coordinates</dd><dt><a href="Imagine/Image/PointInterface.html#method_move"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr>::move</a>() — <em>Method in class <a href="Imagine/Image/PointInterface.html"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr></a></em></dt>
<dd>Returns another point, moved by a given amount from current coordinates</dd><dt><a href="Imagine/Image/Point/Center.html#method_move"><abbr title="Imagine\Image\Point\Center">Center</abbr>::move</a>() — <em>Method in class <a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a></em></dt>
<dd>Returns another point, moved by a given amount from current coordinates</dd><dt><a href="Imagine/Imagick/Image.html#method_mask"><abbr title="Imagine\Imagick\Image">Image</abbr>::mask</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Transforms creates a grayscale mask from current image, returns a new image, while keeping the existing image unmodified</dd> </dl><h2 id="letterN">N</h2>
<dl id="index"><dt><a href="Imagine/Effects/EffectsInterface.html#method_negative"><abbr title="Imagine\Effects\EffectsInterface">EffectsInterface</abbr>::negative</a>() — <em>Method in class <a href="Imagine/Effects/EffectsInterface.html"><abbr title="Imagine\Effects\EffectsInterface">EffectsInterface</abbr></a></em></dt>
<dd>Invert the colors of the image</dd><dt><a href="Imagine/Gd/Effects.html#method_negative"><abbr title="Imagine\Gd\Effects">Effects</abbr>::negative</a>() — <em>Method in class <a href="Imagine/Gd/Effects.html"><abbr title="Imagine\Gd\Effects">Effects</abbr></a></em></dt>
<dd>Invert the colors of the image</dd><dt><a href="Imagine/Gmagick/Effects.html#method_negative"><abbr title="Imagine\Gmagick\Effects">Effects</abbr>::negative</a>() — <em>Method in class <a href="Imagine/Gmagick/Effects.html"><abbr title="Imagine\Gmagick\Effects">Effects</abbr></a></em></dt>
<dd>Invert the colors of the image</dd><dt><a href="Imagine/Imagick/Effects.html#method_negative"><abbr title="Imagine\Imagick\Effects">Effects</abbr>::negative</a>() — <em>Method in class <a href="Imagine/Imagick/Effects.html"><abbr title="Imagine\Imagick\Effects">Effects</abbr></a></em></dt>
<dd>Invert the colors of the image</dd> </dl><h2 id="letterO">O</h2>
<dl id="index"><dt><a href="Imagine/Exception/OutOfBoundsException.html"><abbr title="Imagine\Exception\OutOfBoundsException">OutOfBoundsException</abbr></a> — <em>Class in namespace <a href="Imagine/Exception.html">Imagine\Exception</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Advanced/OnPixelBased.html"><abbr title="Imagine\Filter\Advanced\OnPixelBased">OnPixelBased</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Advanced.html">Imagine\Filter\Advanced</a></em></dt>
<dd>The OnPixelBased takes a callable, and for each pixel, this callable is called with the image (\Imagine\Image\ImageInterface) and the current point (\Imagine\Image\Point)</dd><dt><a href="Imagine/Gd/Imagine.html#method_open"><abbr title="Imagine\Gd\Imagine">Imagine</abbr>::open</a>() — <em>Method in class <a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a></em></dt>
<dd>Opens an existing image from $path</dd><dt><a href="Imagine/Gmagick/Imagine.html#method_open"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr>::open</a>() — <em>Method in class <a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Opens an existing image from $path</dd><dt><a href="Imagine/Image/ImagineInterface.html#method_open"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr>::open</a>() — <em>Method in class <a href="Imagine/Image/ImagineInterface.html"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr></a></em></dt>
<dd>Opens an existing image from $path</dd><dt><a href="Imagine/Imagick/Imagine.html#method_open"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr>::open</a>() — <em>Method in class <a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Opens an existing image from $path</dd> </dl><h2 id="letterP">P</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html#method_pieSlice"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::pieSlice</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Same as arc, but connects end points and the center</dd><dt><a href="Imagine/Draw/DrawerInterface.html#method_polygon"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::polygon</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Draws a polygon using array of x, y coordinates.</dd><dt><a href="Imagine/Filter/Basic/Paste.html"><abbr title="Imagine\Filter\Basic\Paste">Paste</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Transformation.html#method_paste"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::paste</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails</dd><dt><a href="Imagine/Gd/Drawer.html#method_pieSlice"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::pieSlice</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Same as arc, but connects end points and the center</dd><dt><a href="Imagine/Gd/Drawer.html#method_polygon"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::polygon</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws a polygon using array of x, y coordinates.</dd><dt><a href="Imagine/Gd/Image.html#method_paste"><abbr title="Imagine\Gd\Image">Image</abbr>::paste</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails</dd><dt><a href="Imagine/Gmagick/Drawer.html#method_pieSlice"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::pieSlice</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Same as arc, but connects end points and the center</dd><dt><a href="Imagine/Gmagick/Drawer.html#method_polygon"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::polygon</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws a polygon using array of x, y coordinates.</dd><dt><a href="Imagine/Gmagick/Image.html#method_paste"><abbr title="Imagine\Gmagick\Image">Image</abbr>::paste</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_paste"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::paste</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails</dd><dt><a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/PointInterface.html"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr></a> — <em>Class in namespace <a href="Imagine/Image.html">Imagine\Image</a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Drawer.html#method_pieSlice"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::pieSlice</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Same as arc, but connects end points and the center</dd><dt><a href="Imagine/Imagick/Drawer.html#method_polygon"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::polygon</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Draws a polygon using array of x, y coordinates.</dd><dt><a href="Imagine/Imagick/Image.html#method_paste"><abbr title="Imagine\Imagick\Image">Image</abbr>::paste</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails</dd> </dl><h2 id="letterR">R</h2>
<dl id="index"><dt><a href="Imagine/Exception/RuntimeException.html"><abbr title="Imagine\Exception\RuntimeException">RuntimeException</abbr></a> — <em>Class in namespace <a href="Imagine/Exception.html">Imagine\Exception</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Resize.html"><abbr title="Imagine\Filter\Basic\Resize">Resize</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Rotate.html"><abbr title="Imagine\Filter\Basic\Rotate">Rotate</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Transformation.html#method_resize"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::resize</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Resizes current image and returns self</dd><dt><a href="Imagine/Filter/Transformation.html#method_rotate"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::rotate</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Rotates an image at the given angle.</dd><dt><a href="Imagine/Gd/Image.html#method_resize"><abbr title="Imagine\Gd\Image">Image</abbr>::resize</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Resizes current image and returns self</dd><dt><a href="Imagine/Gd/Image.html#method_rotate"><abbr title="Imagine\Gd\Image">Image</abbr>::rotate</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Rotates an image at the given angle.</dd><dt><a href="Imagine/Gd/Imagine.html#method_read"><abbr title="Imagine\Gd\Imagine">Imagine</abbr>::read</a>() — <em>Method in class <a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a></em></dt>
<dd>Loads an image from a resource $resource</dd><dt><a href="Imagine/Gmagick/Image.html#method_resize"><abbr title="Imagine\Gmagick\Image">Image</abbr>::resize</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Resizes current image and returns self</dd><dt><a href="Imagine/Gmagick/Image.html#method_rotate"><abbr title="Imagine\Gmagick\Image">Image</abbr>::rotate</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Rotates an image at the given angle.</dd><dt><a href="Imagine/Gmagick/Imagine.html#method_read"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr>::read</a>() — <em>Method in class <a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Loads an image from a resource $resource</dd><dt><a href="Imagine/Image/Histogram/Range.html"><abbr title="Imagine\Image\Histogram\Range">Range</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Histogram.html">Imagine\Image\Histogram</a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImagineInterface.html#method_read"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr>::read</a>() — <em>Method in class <a href="Imagine/Image/ImagineInterface.html"><abbr title="Imagine\Image\ImagineInterface">ImagineInterface</abbr></a></em></dt>
<dd>Loads an image from a resource $resource</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_resize"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::resize</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Resizes current image and returns self</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_rotate"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::rotate</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Rotates an image at the given angle.</dd><dt><a href="Imagine/Imagick/Image.html#method_resize"><abbr title="Imagine\Imagick\Image">Image</abbr>::resize</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Resizes current image and returns self</dd><dt><a href="Imagine/Imagick/Image.html#method_rotate"><abbr title="Imagine\Imagick\Image">Image</abbr>::rotate</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Rotates an image at the given angle.</dd><dt><a href="Imagine/Imagick/Imagine.html#method_read"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr>::read</a>() — <em>Method in class <a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a></em></dt>
<dd>Loads an image from a resource $resource</dd> </dl><h2 id="letterS">S</h2>
<dl id="index"><dt><a href="Imagine/Filter/Basic/Save.html"><abbr title="Imagine\Filter\Basic\Save">Save</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Show.html"><abbr title="Imagine\Filter\Basic\Show">Show</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Strip.html"><abbr title="Imagine\Filter\Basic\Strip">Strip</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/ImagineAware.html#method_setImagine"><abbr title="Imagine\Filter\ImagineAware">ImagineAware</abbr>::setImagine</a>() — <em>Method in class <a href="Imagine/Filter/ImagineAware.html"><abbr title="Imagine\Filter\ImagineAware">ImagineAware</abbr></a></em></dt>
<dd>Set ImagineInterface instance.</dd><dt><a href="Imagine/Filter/Transformation.html#method_strip"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::strip</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Remove all profiles and comments</dd><dt><a href="Imagine/Filter/Transformation.html#method_save"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::save</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported</dd><dt><a href="Imagine/Filter/Transformation.html#method_show"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::show</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Outputs the image content</dd><dt><a href="Imagine/Gd/Image.html#method_save"><abbr title="Imagine\Gd\Image">Image</abbr>::save</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported</dd><dt><a href="Imagine/Gd/Image.html#method_show"><abbr title="Imagine\Gd\Image">Image</abbr>::show</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Outputs the image content</dd><dt><a href="Imagine/Gd/Image.html#method_strip"><abbr title="Imagine\Gd\Image">Image</abbr>::strip</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Remove all profiles and comments</dd><dt><a href="Imagine/Gmagick/Image.html#method_strip"><abbr title="Imagine\Gmagick\Image">Image</abbr>::strip</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Remove all profiles and comments</dd><dt><a href="Imagine/Gmagick/Image.html#method_save"><abbr title="Imagine\Gmagick\Image">Image</abbr>::save</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported</dd><dt><a href="Imagine/Gmagick/Image.html#method_show"><abbr title="Imagine\Gmagick\Image">Image</abbr>::show</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Outputs the image content</dd><dt><a href="Imagine/Image/Box.html#method_scale"><abbr title="Imagine\Image\Box">Box</abbr>::scale</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Creates new BoxInterface instance with ratios applied to both sides</dd><dt><a href="Imagine/Image/Box.html#method_square"><abbr title="Imagine\Image\Box">Box</abbr>::square</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Gets current box square, useful for getting total number of pixels in a given box</dd><dt><a href="Imagine/Image/BoxInterface.html#method_scale"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::scale</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Creates new BoxInterface instance with ratios applied to both sides</dd><dt><a href="Imagine/Image/BoxInterface.html#method_square"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::square</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Gets current box square, useful for getting total number of pixels in a given box</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_save"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::save</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_show"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::show</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Outputs the image content</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_strip"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::strip</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Remove all profiles and comments</dd><dt><a href="Imagine/Imagick/Image.html#method_strip"><abbr title="Imagine\Imagick\Image">Image</abbr>::strip</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Remove all profiles and comments</dd><dt><a href="Imagine/Imagick/Image.html#method_save"><abbr title="Imagine\Imagick\Image">Image</abbr>::save</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported</dd><dt><a href="Imagine/Imagick/Image.html#method_show"><abbr title="Imagine\Imagick\Image">Image</abbr>::show</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Outputs the image content</dd> </dl><h2 id="letterT">T</h2>
<dl id="index"><dt><a href="Imagine/Draw/DrawerInterface.html#method_text"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr>::text</a>() — <em>Method in class <a href="Imagine/Draw/DrawerInterface.html"><abbr title="Imagine\Draw\DrawerInterface">DrawerInterface</abbr></a></em></dt>
<dd>Annotates image with specified text at a given position starting on the top left of the final text box</dd><dt><a href="Imagine/Filter/Basic/Thumbnail.html"><abbr title="Imagine\Filter\Basic\Thumbnail">Thumbnail</abbr></a> — <em>Class in namespace <a href="Imagine/Filter/Basic.html">Imagine\Filter\Basic</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a> — <em>Class in namespace <a href="Imagine/Filter.html">Imagine\Filter</a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Transformation.html#method_thumbnail"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::thumbnail</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image</dd><dt><a href="Imagine/Gd/Drawer.html#method_text"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::text</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Annotates image with specified text at a given position starting on the top left of the final text box</dd><dt><a href="Imagine/Gd/Image.html#method_thumbnail"><abbr title="Imagine\Gd\Image">Image</abbr>::thumbnail</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image</dd><dt><a href="Imagine/Gmagick/Drawer.html#method_text"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::text</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Annotates image with specified text at a given position starting on the top left of the final text box</dd><dt><a href="Imagine/Gmagick/Image.html#method_thumbnail"><abbr title="Imagine\Gmagick\Image">Image</abbr>::thumbnail</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image</dd><dt><a href="Imagine/Image/ManipulatorInterface.html#method_thumbnail"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr>::thumbnail</a>() — <em>Method in class <a href="Imagine/Image/ManipulatorInterface.html"><abbr title="Imagine\Image\ManipulatorInterface">ManipulatorInterface</abbr></a></em></dt>
<dd>Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image</dd><dt><a href="Imagine/Imagick/Drawer.html#method_text"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::text</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd>Annotates image with specified text at a given position starting on the top left of the final text box</dd><dt><a href="Imagine/Imagick/Image.html#method_thumbnail"><abbr title="Imagine\Imagick\Image">Image</abbr>::thumbnail</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image</dd><dt><a href="Imagine/Test/Constraint/IsImageEqual.html#method_toString"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr>::toString</a>() — <em>Method in class <a href="Imagine/Test/Constraint/IsImageEqual.html"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr></a></em></dt>
<dd>{@inheritdoc}</dd> </dl><h2 id="letterV">V</h2>
<dl id="index"><dt><a href="Imagine/Image/Fill/Gradient/Vertical.html"><abbr title="Imagine\Image\Fill\Gradient\Vertical">Vertical</abbr></a> — <em>Class in namespace <a href="Imagine/Image/Fill/Gradient.html">Imagine\Image\Fill\Gradient</a></em></dt>
<dd></dd> </dl><h2 id="letterW">W</h2>
<dl id="index"><dt><a href="Imagine/Image/Box.html#method_widen"><abbr title="Imagine\Image\Box">Box</abbr>::widen</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Resizes box to given width, constraining proportions and returns the new box</dd><dt><a href="Imagine/Image/BoxInterface.html#method_widen"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::widen</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Resizes box to given width, constraining proportions and returns the new box</dd> </dl><h2 id="letter_">_</h2>
<dl id="index"><dt><a href="Imagine/Filter/Advanced/Border.html#method___construct"><abbr title="Imagine\Filter\Advanced\Border">Border</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/Border.html"><abbr title="Imagine\Filter\Advanced\Border">Border</abbr></a></em></dt>
<dd>Constructs Border filter with given color, width and height</dd><dt><a href="Imagine/Filter/Advanced/Canvas.html#method___construct"><abbr title="Imagine\Filter\Advanced\Canvas">Canvas</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/Canvas.html"><abbr title="Imagine\Filter\Advanced\Canvas">Canvas</abbr></a></em></dt>
<dd>Constructs Canvas filter with given width and height and the placement of the current image inside the new canvas</dd><dt><a href="Imagine/Filter/Advanced/Grayscale.html#method___construct"><abbr title="Imagine\Filter\Advanced\Grayscale">Grayscale</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/Grayscale.html"><abbr title="Imagine\Filter\Advanced\Grayscale">Grayscale</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Advanced/OnPixelBased.html#method___construct"><abbr title="Imagine\Filter\Advanced\OnPixelBased">OnPixelBased</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Advanced/OnPixelBased.html"><abbr title="Imagine\Filter\Advanced\OnPixelBased">OnPixelBased</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/ApplyMask.html#method___construct"><abbr title="Imagine\Filter\Basic\ApplyMask">ApplyMask</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/ApplyMask.html"><abbr title="Imagine\Filter\Basic\ApplyMask">ApplyMask</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Crop.html#method___construct"><abbr title="Imagine\Filter\Basic\Crop">Crop</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Crop.html"><abbr title="Imagine\Filter\Basic\Crop">Crop</abbr></a></em></dt>
<dd>Constructs a Crop filter with given x, y, coordinates and crop width and height values</dd><dt><a href="Imagine/Filter/Basic/Fill.html#method___construct"><abbr title="Imagine\Filter\Basic\Fill">Fill</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Fill.html"><abbr title="Imagine\Filter\Basic\Fill">Fill</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Filter/Basic/Paste.html#method___construct"><abbr title="Imagine\Filter\Basic\Paste">Paste</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Paste.html"><abbr title="Imagine\Filter\Basic\Paste">Paste</abbr></a></em></dt>
<dd>Constructs a Paste filter with given ImageInterface to paste and x, y coordinates of target position</dd><dt><a href="Imagine/Filter/Basic/Resize.html#method___construct"><abbr title="Imagine\Filter\Basic\Resize">Resize</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Resize.html"><abbr title="Imagine\Filter\Basic\Resize">Resize</abbr></a></em></dt>
<dd>Constructs Resize filter with given width and height</dd><dt><a href="Imagine/Filter/Basic/Rotate.html#method___construct"><abbr title="Imagine\Filter\Basic\Rotate">Rotate</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Rotate.html"><abbr title="Imagine\Filter\Basic\Rotate">Rotate</abbr></a></em></dt>
<dd>Constructs Rotate filter with given angle and background color</dd><dt><a href="Imagine/Filter/Basic/Save.html#method___construct"><abbr title="Imagine\Filter\Basic\Save">Save</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Save.html"><abbr title="Imagine\Filter\Basic\Save">Save</abbr></a></em></dt>
<dd>Constructs Save filter with given path and options</dd><dt><a href="Imagine/Filter/Basic/Show.html#method___construct"><abbr title="Imagine\Filter\Basic\Show">Show</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Show.html"><abbr title="Imagine\Filter\Basic\Show">Show</abbr></a></em></dt>
<dd>Constructs the Show filter with given format and options</dd><dt><a href="Imagine/Filter/Basic/Thumbnail.html#method___construct"><abbr title="Imagine\Filter\Basic\Thumbnail">Thumbnail</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Basic/Thumbnail.html"><abbr title="Imagine\Filter\Basic\Thumbnail">Thumbnail</abbr></a></em></dt>
<dd>Constructs the Thumbnail filter with given width, height and mode</dd><dt><a href="Imagine/Filter/Transformation.html#method___construct"><abbr title="Imagine\Filter\Transformation">Transformation</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Filter/Transformation.html"><abbr title="Imagine\Filter\Transformation">Transformation</abbr></a></em></dt>
<dd>Class constructor.</dd><dt><a href="Imagine/Gd/Drawer.html#method___construct"><abbr title="Imagine\Gd\Drawer">Drawer</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gd/Drawer.html"><abbr title="Imagine\Gd\Drawer">Drawer</abbr></a></em></dt>
<dd>Constructs Drawer with a given gd image resource</dd><dt><a href="Imagine/Gd/Effects.html#method___construct"><abbr title="Imagine\Gd\Effects">Effects</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gd/Effects.html"><abbr title="Imagine\Gd\Effects">Effects</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Gd/Image.html#method___construct"><abbr title="Imagine\Gd\Image">Image</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Constructs a new Image instance using the result of imagecreatetruecolor()</dd><dt><a href="Imagine/Gd/Image.html#method___destruct"><abbr title="Imagine\Gd\Image">Image</abbr>::__destruct</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Makes sure the current image resource is destroyed</dd><dt><a href="Imagine/Gd/Image.html#method___toString"><abbr title="Imagine\Gd\Image">Image</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Gd/Image.html"><abbr title="Imagine\Gd\Image">Image</abbr></a></em></dt>
<dd>Returns the image content as a PNG binary string</dd><dt><a href="Imagine/Gd/Imagine.html#method___construct"><abbr title="Imagine\Gd\Imagine">Imagine</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gd/Imagine.html"><abbr title="Imagine\Gd\Imagine">Imagine</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Drawer.html#method___construct"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gmagick/Drawer.html"><abbr title="Imagine\Gmagick\Drawer">Drawer</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Effects.html#method___construct"><abbr title="Imagine\Gmagick\Effects">Effects</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gmagick/Effects.html"><abbr title="Imagine\Gmagick\Effects">Effects</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Gmagick/Font.html#method___construct"><abbr title="Imagine\Gmagick\Font">Font</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gmagick/Font.html"><abbr title="Imagine\Gmagick\Font">Font</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd><dt><a href="Imagine/Gmagick/Image.html#method___construct"><abbr title="Imagine\Gmagick\Image">Image</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Constructs Image with Gmagick and Imagine instances</dd><dt><a href="Imagine/Gmagick/Image.html#method___destruct"><abbr title="Imagine\Gmagick\Image">Image</abbr>::__destruct</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Destroys allocated gmagick resources</dd><dt><a href="Imagine/Gmagick/Image.html#method___toString"><abbr title="Imagine\Gmagick\Image">Image</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Gmagick/Image.html"><abbr title="Imagine\Gmagick\Image">Image</abbr></a></em></dt>
<dd>Returns the image content as a PNG binary string</dd><dt><a href="Imagine/Gmagick/Imagine.html#method___construct"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Gmagick/Imagine.html"><abbr title="Imagine\Gmagick\Imagine">Imagine</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/AbstractFont.html#method___construct"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/AbstractFont.html"><abbr title="Imagine\Image\AbstractFont">AbstractFont</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd><dt><a href="Imagine/Image/Box.html#method___construct"><abbr title="Imagine\Image\Box">Box</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Constructs the Size with given width and height</dd><dt><a href="Imagine/Image/Box.html#method___toString"><abbr title="Imagine\Image\Box">Box</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/Box.html"><abbr title="Imagine\Image\Box">Box</abbr></a></em></dt>
<dd>Returns a string representation of the current box</dd><dt><a href="Imagine/Image/BoxInterface.html#method___toString"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/BoxInterface.html"><abbr title="Imagine\Image\BoxInterface">BoxInterface</abbr></a></em></dt>
<dd>Returns a string representation of the current box</dd><dt><a href="Imagine/Image/Color.html#method___construct"><abbr title="Imagine\Image\Color">Color</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Constructs image color, e.g.: - new Color('fff') - will produce non-transparent white color - new Color('ffffff', 50) - will product 50% transparent white - new Color(array(255, 255, 255)) - another way of getting white - new Color(0x00FF00) - hexadecimal notation for green</dd><dt><a href="Imagine/Image/Color.html#method___toString"><abbr title="Imagine\Image\Color">Color</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/Color.html"><abbr title="Imagine\Image\Color">Color</abbr></a></em></dt>
<dd>Returns hex representation of the color</dd><dt><a href="Imagine/Image/Fill/Gradient/Linear.html#method___construct"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Fill/Gradient/Linear.html"><abbr title="Imagine\Image\Fill\Gradient\Linear">Linear</abbr></a></em></dt>
<dd>Constructs a linear gradient with overall gradient length, and start and end shades, which default to 0 and 255 accordingly</dd><dt><a href="Imagine/Image/Histogram/Bucket.html#method___construct"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Histogram/Bucket.html"><abbr title="Imagine\Image\Histogram\Bucket">Bucket</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/Histogram/Range.html#method___construct"><abbr title="Imagine\Image\Histogram\Range">Range</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Histogram/Range.html"><abbr title="Imagine\Image\Histogram\Range">Range</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Image/ImageInterface.html#method___toString"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/ImageInterface.html"><abbr title="Imagine\Image\ImageInterface">ImageInterface</abbr></a></em></dt>
<dd>Returns the image content as a PNG binary string</dd><dt><a href="Imagine/Image/Point.html#method___construct"><abbr title="Imagine\Image\Point">Point</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a></em></dt>
<dd>Constructs a point of coordinates</dd><dt><a href="Imagine/Image/Point.html#method___toString"><abbr title="Imagine\Image\Point">Point</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/Point.html"><abbr title="Imagine\Image\Point">Point</abbr></a></em></dt>
<dd>Gets a string representation for the current point</dd><dt><a href="Imagine/Image/PointInterface.html#method___toString"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/PointInterface.html"><abbr title="Imagine\Image\PointInterface">PointInterface</abbr></a></em></dt>
<dd>Gets a string representation for the current point</dd><dt><a href="Imagine/Image/Point/Center.html#method___construct"><abbr title="Imagine\Image\Point\Center">Center</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a></em></dt>
<dd>Constructs coordinate with size instance, it needs to be relative to</dd><dt><a href="Imagine/Image/Point/Center.html#method___toString"><abbr title="Imagine\Image\Point\Center">Center</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Image/Point/Center.html"><abbr title="Imagine\Image\Point\Center">Center</abbr></a></em></dt>
<dd>Gets a string representation for the current point</dd><dt><a href="Imagine/Imagick/Drawer.html#method___construct"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Imagick/Drawer.html"><abbr title="Imagine\Imagick\Drawer">Drawer</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Effects.html#method___construct"><abbr title="Imagine\Imagick\Effects">Effects</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Imagick/Effects.html"><abbr title="Imagine\Imagick\Effects">Effects</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Imagick/Font.html#method___construct"><abbr title="Imagine\Imagick\Font">Font</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Imagick/Font.html"><abbr title="Imagine\Imagick\Font">Font</abbr></a></em></dt>
<dd>Constructs a font with specified $file, $size and $color</dd><dt><a href="Imagine/Imagick/Image.html#method___construct"><abbr title="Imagine\Imagick\Image">Image</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Constructs Image with Imagick and Imagine instances</dd><dt><a href="Imagine/Imagick/Image.html#method___destruct"><abbr title="Imagine\Imagick\Image">Image</abbr>::__destruct</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Destroys allocated imagick resources</dd><dt><a href="Imagine/Imagick/Image.html#method___toString"><abbr title="Imagine\Imagick\Image">Image</abbr>::__toString</a>() — <em>Method in class <a href="Imagine/Imagick/Image.html"><abbr title="Imagine\Imagick\Image">Image</abbr></a></em></dt>
<dd>Returns the image content as a PNG binary string</dd><dt><a href="Imagine/Imagick/Imagine.html#method___construct"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Imagick/Imagine.html"><abbr title="Imagine\Imagick\Imagine">Imagine</abbr></a></em></dt>
<dd></dd><dt><a href="Imagine/Test/Constraint/IsImageEqual.html#method___construct"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr>::__construct</a>() — <em>Method in class <a href="Imagine/Test/Constraint/IsImageEqual.html"><abbr title="Imagine\Test\Constraint\IsImageEqual">IsImageEqual</abbr></a></em></dt>
<dd></dd> </dl> </div>
<div id="footer">
Generated by <a href="http://sami.sensiolabs.org/" target="_top">Sami, the API Documentation Generator</a>.
</div>
</body>
</html>
| XKEYGmbH/ifresco-client | vendor/imagine/imagine/docs/API/API/doc-index.html | HTML | mit | 118,226 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1013,
1028,
1026,
18804,
30524,
2102,
1000,
2828,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
-- Copyright (c) 2011 by Robert G. Jakabosky <bobby@neoawareness.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
local setmetatable = setmetatable
local print = print
local assert = assert
local date = os.date
local floor = math.floor
local ev = require"ev"
local acceptor = require"handler.acceptor"
local headers = require"handler.http.headers"
local headers_new = headers.new
local connection = require"handler.http.server.hconnection"
local error_handler = require"handler.http.server.error_handler"
local server_mt = {}
server_mt.__index = server_mt
function server_mt:new_connection(sock)
local conn = connection(self, sock)
end
function server_mt:add_acceptor(accept)
local list = self.acceptors
list[#list+1] = accept
return true
end
function server_mt:listen_unix(path, backlog)
assert(path, "You must provide a port/path.")
return self:add_acceptor(acceptor.unix(self.loop, self.accept_handler, path, backlog))
end
local function check_port_addr(port, addr)
assert(port, "You must provide a port/path.")
if type(port) == 'string' then
local path = port
port = tonumber(path)
if port == nil then
return self:listen_path(path)
end
end
addr = adrr or '0.0.0.0'
return port, addr
end
function server_mt:listen(port, addr, backlog)
port, addr = check_port_addr(port, addr)
return self:add_acceptor(acceptor.tcp(self.loop, self.accept_handler, addr, port, backlog))
end
function server_mt:listen6(port, addr, backlog)
port, addr = check_port_addr(port, addr)
return self:add_acceptor(acceptor.tcp6(self.loop, self.accept_handler, addr, port, backlog))
end
function server_mt:tls_listen(tls, port, addr, backlog)
port, addr = check_port_addr(port, addr)
return self:add_acceptor(
acceptor.tls_tcp(self.loop, self.accept_handler, addr, port, tls, backlog))
end
function server_mt:tls_listen6(tls, port, addr, backlog)
port, addr = check_port_addr(port, addr)
return self:add_acceptor(
acceptor.tls_tcp6(self.loop, self.accept_handler, addr, port, tls, backlog))
end
function server_mt:listen_uri(uri, backlog)
-- we don't support HTTP over UDP.
assert(not uri:match('^udp'), "Can't accept HTTP connections from UDP socket.")
-- default port
local port = 80
if uri:match('^tls') then
port = 443 -- default port for https
end
return self:add_acceptor(
acceptor.uri(self.loop, self.accept_handler, uri, backlog, port))
end
local function server_update_cached_date(self, now)
local cached_date
-- get new date
cached_date = date('!%a, %d %b %Y %T GMT')
self.cached_date = cached_date
self.cached_now = floor(now) -- only cache now as whole seconds.
return cached_date
end
function server_mt:update_cached_date()
return server_update_cached_date(self, self.loop:now())
end
function server_mt:get_cached_date()
local now = floor(self.loop:now())
if self.cached_now ~= now then
return server_update_cached_date(self, now)
end
return self.cached_date
end
module(...)
local function default_on_check_continue(self, req, resp)
-- default to always sending the '100 Continue' response.
resp:send_continue()
return self:on_request(req, resp)
end
function new(loop, self)
self = self or {}
self.acceptors = {}
self.loop = loop
-- default timeouts
-- maximum time to wait from the start of the request to the end of the headers.
self.request_head_timeout = self.request_head_timeout or 1.0
-- maximum time to wait from the end of the request headers to the end of the request body.
self.request_body_timeout = self.request_body_timeout or -1
-- maximum time to wait on a blocked write (i.e. with pending data to write).
self.write_timeout = self.write_timeout or 30.0
-- maximum time to wait for next request on a connection.
self.keep_alive_timeout = self.keep_alive_timeout or 5.0
-- maximum number of requests to allow on one connection.
self.max_keep_alive_requests = self.max_keep_alive_requests or 128
-- normalize http headers
self.headers = headers_new(self.headers)
-- create accept callback function.
self.accept_handler = function(sock)
return self:new_connection(sock)
end
-- add a default error_handler if none exists.
local custom_handler = self.on_error_response
if custom_handler then
-- wrap custom handler.
self.on_error_response = function(self, resp)
local stat = custom_handler(self, resp)
-- check if custom error handler added a response body.
if not stat or resp.body == nil then
-- try default handler.
return error_handler(self, resp)
end
return stat
end
else
-- no handler, use default
self.on_error_response = error_handler
end
-- add a default on_check_continue handler if none exists.
if not self.on_check_continue then
self.on_check_continue = default_on_check_continue
end
-- set Server header
if self.name ~= '' then
self.headers['Server'] =
self.headers['Server'] or self.name or "Lua-Handler HTTPServer/0.1"
end
return setmetatable(self, server_mt)
end
local default_server = nil
-- get default http server.
function default()
if not default_server then
-- create a http server.
default_server = new(ev.Loop.default)
end
return default_server
end
-- initialize default http server.
function init(loop, server)
default_server = new(loop, server)
end
| Neopallium/lua-handlers | handler/http/server.lua | Lua | mit | 6,281 | [
30522,
1011,
1011,
9385,
1006,
1039,
1007,
2249,
2011,
2728,
1043,
1012,
14855,
2912,
15853,
4801,
1026,
6173,
1030,
9253,
10830,
7389,
7971,
1012,
4012,
1028,
1011,
1011,
1011,
1011,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Backend\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Configuration\BackendUserConfiguration;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* A wrapper class to call BE_USER->uc
* used for AJAX and Storage/Persistent JS object
* @internal This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
*/
class UserSettingsController
{
/**
* Processes all AJAX calls and returns a JSON for the data
*
* @param ServerRequestInterface $request
* @return ResponseInterface
*/
public function processAjaxRequest(ServerRequestInterface $request): ResponseInterface
{
// do the regular / main logic, depending on the action parameter
$action = $request->getParsedBody()['action'] ?? $request->getQueryParams()['action'] ?? '';
$key = $request->getParsedBody()['key'] ?? $request->getQueryParams()['key'] ?? '';
$value = $request->getParsedBody()['value'] ?? $request->getQueryParams()['value'] ?? '';
$backendUserConfiguration = GeneralUtility::makeInstance(BackendUserConfiguration::class);
switch ($action) {
case 'get':
$content = $backendUserConfiguration->get($key);
break;
case 'getAll':
$content = $backendUserConfiguration->getAll();
break;
case 'set':
$backendUserConfiguration->set($key, $value);
$content = $backendUserConfiguration->getAll();
break;
case 'addToList':
$backendUserConfiguration->addToList($key, $value);
$content = $backendUserConfiguration->getAll();
break;
case 'removeFromList':
$backendUserConfiguration->removeFromList($key, $value);
$content = $backendUserConfiguration->getAll();
break;
case 'unset':
$backendUserConfiguration->unsetOption($key);
$content = $backendUserConfiguration->getAll();
break;
case 'clear':
$backendUserConfiguration->clear();
$content = ['result' => true];
break;
default:
$content = ['result' => false];
}
return (new JsonResponse())->setPayload($content);
}
}
| maddy2101/TYPO3.CMS | typo3/sysext/backend/Classes/Controller/UserSettingsController.php | PHP | gpl-2.0 | 2,979 | [
30522,
1026,
1029,
25718,
13520,
1006,
9384,
1035,
4127,
1027,
1015,
1007,
1025,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
5939,
6873,
2509,
4642,
2015,
2622,
1012,
1008,
1008,
2009,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON http://guides.rubyonrails.org.**
Caching with Rails: An Overview
===============================
This guide is an introduction to speeding up your Rails application with caching.
Caching means to store content generated during the request-response cycle and
to reuse it when responding to similar requests.
Caching is often the most effective way to boost an application's performance.
Through caching, web sites running on a single server with a single database
can sustain a load of thousands of concurrent users.
Rails provides a set of caching features out of the box. This guide will teach
you the scope and purpose of each one of them. Master these techniques and your
Rails applications can serve millions of views without exorbitant response times
or server bills.
After reading this guide, you will know:
* Fragment and Russian doll caching.
* How to manage the caching dependencies.
* Alternative cache stores.
* Conditional GET support.
--------------------------------------------------------------------------------
Basic Caching
-------------
This is an introduction to three types of caching techniques: page, action and
fragment caching. By default Rails provides fragment caching. In order to use
page and action caching you will need to add `actionpack-page_caching` and
`actionpack-action_caching` to your Gemfile.
By default, caching is only enabled in your production environment. To play
around with caching locally you'll want to enable caching in your local
environment by setting `config.action_controller.perform_caching` to `true` in
the relevant `config/environments/*.rb` file:
```ruby
config.action_controller.perform_caching = true
```
NOTE: Changing the value of `config.action_controller.perform_caching` will
only have an effect on the caching provided by the Action Controller component.
For instance, it will not impact low-level caching, that we address
[below](#low-level-caching).
### Page Caching
Page caching is a Rails mechanism which allows the request for a generated page
to be fulfilled by the webserver (i.e. Apache or NGINX) without having to go
through the entire Rails stack. While this is super fast it can't be applied to
every situation (such as pages that need authentication). Also, because the
webserver is serving a file directly from the filesystem you will need to
implement cache expiration.
INFO: Page Caching has been removed from Rails 4. See the [actionpack-page_caching gem](https://github.com/rails/actionpack-page_caching).
### Action Caching
Page Caching cannot be used for actions that have before filters - for example, pages that require authentication. This is where Action Caching comes in. Action Caching works like Page Caching except the incoming web request hits the Rails stack so that before filters can be run on it before the cache is served. This allows authentication and other restrictions to be run while still serving the result of the output from a cached copy.
INFO: Action Caching has been removed from Rails 4. See the [actionpack-action_caching gem](https://github.com/rails/actionpack-action_caching). See [DHH's key-based cache expiration overview](http://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works) for the newly-preferred method.
### Fragment Caching
Dynamic web applications usually build pages with a variety of components not
all of which have the same caching characteristics. When different parts of the
page need to be cached and expired separately you can use Fragment Caching.
Fragment Caching allows a fragment of view logic to be wrapped in a cache block and served out of the cache store when the next request comes in.
For example, if you wanted to cache each product on a page, you could use this
code:
```html+erb
<% @products.each do |product| %>
<% cache product do %>
<%= render product %>
<% end %>
<% end %>
```
When your application receives its first request to this page, Rails will write
a new cache entry with a unique key. A key looks something like this:
```
views/products/1-201505056193031061005000/bea67108094918eeba42cd4a6e786901
```
The number in the middle is the `product_id` followed by the timestamp value in
the `updated_at` attribute of the product record. Rails uses the timestamp value
to make sure it is not serving stale data. If the value of `updated_at` has
changed, a new key will be generated. Then Rails will write a new cache to that
key, and the old cache written to the old key will never be used again. This is
called key-based expiration.
Cache fragments will also be expired when the view fragment changes (e.g., the
HTML in the view changes). The string of characters at the end of the key is a
template tree digest. It is an md5 hash computed based on the contents of the
view fragment you are caching. If you change the view fragment, the md5 hash
will change, expiring the existing file.
TIP: Cache stores like Memcached will automatically delete old cache files.
If you want to cache a fragment under certain conditions, you can use
`cache_if` or `cache_unless`:
```erb
<% cache_if admin?, product do %>
<%= render product %>
<% end %>
```
#### Collection caching
The `render` helper can also cache individual templates rendered for a collection.
It can even one up the previous example with `each` by reading all cache
templates at once instead of one by one. This is done by passing `cached: true` when rendering the collection:
```html+erb
<%= render partial: 'products/product', collection: @products, cached: true %>
```
All cached templates from previous renders will be fetched at once with much
greater speed. Additionally, the templates that haven't yet been cached will be
written to cache and multi fetched on the next render.
### Russian Doll Caching
You may want to nest cached fragments inside other cached fragments. This is
called Russian doll caching.
The advantage of Russian doll caching is that if a single product is updated,
all the other inner fragments can be reused when regenerating the outer
fragment.
As explained in the previous section, a cached file will expire if the value of
`updated_at` changes for a record on which the cached file directly depends.
However, this will not expire any cache the fragment is nested within.
For example, take the following view:
```erb
<% cache product do %>
<%= render product.games %>
<% end %>
```
Which in turn renders this view:
```erb
<% cache game do %>
<%= render game %>
<% end %>
```
If any attribute of game is changed, the `updated_at` value will be set to the
current time, thereby expiring the cache. However, because `updated_at`
will not be changed for the product object, that cache will not be expired and
your app will serve stale data. To fix this, we tie the models together with
the `touch` method:
```ruby
class Product < ApplicationRecord
has_many :games
end
class Game < ApplicationRecord
belongs_to :product, touch: true
end
```
With `touch` set to true, any action which changes `updated_at` for a game
record will also change it for the associated product, thereby expiring the
cache.
### Managing dependencies
In order to correctly invalidate the cache, you need to properly define the
caching dependencies. Rails is clever enough to handle common cases so you don't
have to specify anything. However, sometimes, when you're dealing with custom
helpers for instance, you need to explicitly define them.
#### Implicit dependencies
Most template dependencies can be derived from calls to `render` in the template
itself. Here are some examples of render calls that `ActionView::Digestor` knows
how to decode:
```ruby
render partial: "comments/comment", collection: commentable.comments
render "comments/comments"
render 'comments/comments'
render('comments/comments')
render "header" => render("comments/header")
render(@topic) => render("topics/topic")
render(topics) => render("topics/topic")
render(message.topics) => render("topics/topic")
```
On the other hand, some calls need to be changed to make caching work properly.
For instance, if you're passing a custom collection, you'll need to change:
```ruby
render @project.documents.where(published: true)
```
to:
```ruby
render partial: "documents/document", collection: @project.documents.where(published: true)
```
#### Explicit dependencies
Sometimes you'll have template dependencies that can't be derived at all. This
is typically the case when rendering happens in helpers. Here's an example:
```html+erb
<%= render_sortable_todolists @project.todolists %>
```
You'll need to use a special comment format to call those out:
```html+erb
<%# Template Dependency: todolists/todolist %>
<%= render_sortable_todolists @project.todolists %>
```
In some cases, like a single table inheritance setup, you might have a bunch of
explicit dependencies. Instead of writing every template out, you can use a
wildcard to match any template in a directory:
```html+erb
<%# Template Dependency: events/* %>
<%= render_categorizable_events @person.events %>
```
As for collection caching, if the partial template doesn't start with a clean
cache call, you can still benefit from collection caching by adding a special
comment format anywhere in the template, like:
```html+erb
<%# Template Collection: notification %>
<% my_helper_that_calls_cache(some_arg, notification) do %>
<%= notification.name %>
<% end %>
```
#### External dependencies
If you use a helper method, for example, inside a cached block and you then update
that helper, you'll have to bump the cache as well. It doesn't really matter how
you do it, but the md5 of the template file must change. One recommendation is to
simply be explicit in a comment, like:
```html+erb
<%# Helper Dependency Updated: Jul 28, 2015 at 7pm %>
<%= some_helper_method(person) %>
```
### Low-Level Caching
Sometimes you need to cache a particular value or query result instead of caching view fragments. Rails' caching mechanism works great for storing __any__ kind of information.
The most efficient way to implement low-level caching is using the `Rails.cache.fetch` method. This method does both reading and writing to the cache. When passed only a single argument, the key is fetched and value from the cache is returned. If a block is passed, the result of the block will be cached to the given key and the result is returned.
Consider the following example. An application has a `Product` model with an instance method that looks up the product’s price on a competing website. The data returned by this method would be perfect for low-level caching:
```ruby
class Product < ApplicationRecord
def competing_price
Rails.cache.fetch("#{cache_key}/competing_price", expires_in: 12.hours) do
Competitor::API.find_price(id)
end
end
end
```
NOTE: Notice that in this example we used the `cache_key` method, so the resulting cache-key will be something like `products/233-20140225082222765838000/competing_price`. `cache_key` generates a string based on the model’s `id` and `updated_at` attributes. This is a common convention and has the benefit of invalidating the cache whenever the product is updated. In general, when you use low-level caching for instance level information, you need to generate a cache key.
### SQL Caching
Query caching is a Rails feature that caches the result set returned by each
query. If Rails encounters the same query again for that request, it will use
the cached result set as opposed to running the query against the database
again.
For example:
```ruby
class ProductsController < ApplicationController
def index
# Run a find query
@products = Product.all
...
# Run the same query again
@products = Product.all
end
end
```
The second time the same query is run against the database, it's not actually going to hit the database. The first time the result is returned from the query it is stored in the query cache (in memory) and the second time it's pulled from memory.
However, it's important to note that query caches are created at the start of
an action and destroyed at the end of that action and thus persist only for the
duration of the action. If you'd like to store query results in a more
persistent fashion, you can with low level caching.
Cache Stores
------------
Rails provides different stores for the cached data (apart from SQL and page
caching).
### Configuration
You can set up your application's default cache store by setting the
`config.cache_store` configuration option. Other parameters can be passed as
arguments to the cache store's constructor:
```ruby
config.cache_store = :memory_store, { size: 64.megabytes }
```
NOTE: Alternatively, you can call `ActionController::Base.cache_store` outside of a configuration block.
You can access the cache by calling `Rails.cache`.
### ActiveSupport::Cache::Store
This class provides the foundation for interacting with the cache in Rails. This is an abstract class and you cannot use it on its own. Rather you must use a concrete implementation of the class tied to a storage engine. Rails ships with several implementations documented below.
The main methods to call are `read`, `write`, `delete`, `exist?`, and `fetch`. The fetch method takes a block and will either return an existing value from the cache, or evaluate the block and write the result to the cache if no value exists.
There are some common options used by all cache implementations. These can be passed to the constructor or the various methods to interact with entries.
* `:namespace` - This option can be used to create a namespace within the cache store. It is especially useful if your application shares a cache with other applications.
* `:compress` - This option can be used to indicate that compression should be used in the cache. This can be useful for transferring large cache entries over a slow network.
* `:compress_threshold` - This option is used in conjunction with the `:compress` option to indicate a threshold under which cache entries should not be compressed. This defaults to 16 kilobytes.
* `:expires_in` - This option sets an expiration time in seconds for the cache entry when it will be automatically removed from the cache.
* `:race_condition_ttl` - This option is used in conjunction with the `:expires_in` option. It will prevent race conditions when cache entries expire by preventing multiple processes from simultaneously regenerating the same entry (also known as the dog pile effect). This option sets the number of seconds that an expired entry can be reused while a new value is being regenerated. It's a good practice to set this value if you use the `:expires_in` option.
#### Custom Cache Stores
You can create your own custom cache store by simply extending
`ActiveSupport::Cache::Store` and implementing the appropriate methods. This way,
you can swap in any number of caching technologies into your Rails application.
To use a custom cache store, simply set the cache store to a new instance of your
custom class.
```ruby
config.cache_store = MyCacheStore.new
```
### ActiveSupport::Cache::MemoryStore
This cache store keeps entries in memory in the same Ruby process. The cache
store has a bounded size specified by sending the `:size` option to the
initializer (default is 32Mb). When the cache exceeds the allotted size, a
cleanup will occur and the least recently used entries will be removed.
```ruby
config.cache_store = :memory_store, { size: 64.megabytes }
```
If you're running multiple Ruby on Rails server processes (which is the case
if you're using mongrel_cluster or Phusion Passenger), then your Rails server
process instances won't be able to share cache data with each other. This cache
store is not appropriate for large application deployments. However, it can
work well for small, low traffic sites with only a couple of server processes,
as well as development and test environments.
### ActiveSupport::Cache::FileStore
This cache store uses the file system to store entries. The path to the directory where the store files will be stored must be specified when initializing the cache.
```ruby
config.cache_store = :file_store, "/path/to/cache/directory"
```
With this cache store, multiple server processes on the same host can share a
cache. The cache store is appropriate for low to medium traffic sites that are
served off one or two hosts. Server processes running on different hosts could
share a cache by using a shared file system, but that setup is not recommended.
As the cache will grow until the disk is full, it is recommended to
periodically clear out old entries.
This is the default cache store implementation.
### ActiveSupport::Cache::MemCacheStore
This cache store uses Danga's `memcached` server to provide a centralized cache for your application. Rails uses the bundled `dalli` gem by default. This is currently the most popular cache store for production websites. It can be used to provide a single, shared cache cluster with very high performance and redundancy.
When initializing the cache, you need to specify the addresses for all
memcached servers in your cluster. If none are specified, it will assume
memcached is running on localhost on the default port, but this is not an ideal
setup for larger sites.
The `write` and `fetch` methods on this cache accept two additional options that take advantage of features specific to memcached. You can specify `:raw` to send a value directly to the server with no serialization. The value must be a string or number. You can use memcached direct operations like `increment` and `decrement` only on raw values. You can also specify `:unless_exist` if you don't want memcached to overwrite an existing entry.
```ruby
config.cache_store = :mem_cache_store, "cache-1.example.com", "cache-2.example.com"
```
### ActiveSupport::Cache::NullStore
This cache store implementation is meant to be used only in development or test environments and it never stores anything. This can be very useful in development when you have code that interacts directly with `Rails.cache` but caching may interfere with being able to see the results of code changes. With this cache store, all `fetch` and `read` operations will result in a miss.
```ruby
config.cache_store = :null_store
```
Cache Keys
----------
The keys used in a cache can be any object that responds to either `cache_key` or
`to_param`. You can implement the `cache_key` method on your classes if you need
to generate custom keys. Active Record will generate keys based on the class name
and record id.
You can use Hashes and Arrays of values as cache keys.
```ruby
# This is a legal cache key
Rails.cache.read(site: "mysite", owners: [owner_1, owner_2])
```
The keys you use on `Rails.cache` will not be the same as those actually used with
the storage engine. They may be modified with a namespace or altered to fit
technology backend constraints. This means, for instance, that you can't save
values with `Rails.cache` and then try to pull them out with the `dalli` gem.
However, you also don't need to worry about exceeding the memcached size limit or
violating syntax rules.
Conditional GET support
-----------------------
Conditional GETs are a feature of the HTTP specification that provide a way for web servers to tell browsers that the response to a GET request hasn't changed since the last request and can be safely pulled from the browser cache.
They work by using the `HTTP_IF_NONE_MATCH` and `HTTP_IF_MODIFIED_SINCE` headers to pass back and forth both a unique content identifier and the timestamp of when the content was last changed. If the browser makes a request where the content identifier (etag) or last modified since timestamp matches the server's version then the server only needs to send back an empty response with a not modified status.
It is the server's (i.e. our) responsibility to look for a last modified timestamp and the if-none-match header and determine whether or not to send back the full response. With conditional-get support in Rails this is a pretty easy task:
```ruby
class ProductsController < ApplicationController
def show
@product = Product.find(params[:id])
# If the request is stale according to the given timestamp and etag value
# (i.e. it needs to be processed again) then execute this block
if stale?(last_modified: @product.updated_at.utc, etag: @product.cache_key)
respond_to do |wants|
# ... normal response processing
end
end
# If the request is fresh (i.e. it's not modified) then you don't need to do
# anything. The default render checks for this using the parameters
# used in the previous call to stale? and will automatically send a
# :not_modified. So that's it, you're done.
end
end
```
Instead of an options hash, you can also simply pass in a model. Rails will use the `updated_at` and `cache_key` methods for setting `last_modified` and `etag`:
```ruby
class ProductsController < ApplicationController
def show
@product = Product.find(params[:id])
if stale?(@product)
respond_to do |wants|
# ... normal response processing
end
end
end
end
```
If you don't have any special response processing and are using the default rendering mechanism (i.e. you're not using `respond_to` or calling render yourself) then you've got an easy helper in `fresh_when`:
```ruby
class ProductsController < ApplicationController
# This will automatically send back a :not_modified if the request is fresh,
# and will render the default template (product.*) if it's stale.
def show
@product = Product.find(params[:id])
fresh_when last_modified: @product.published_at.utc, etag: @product
end
end
```
### A note on weak ETags
Etags generated by Rails are weak by default. Weak etags allow symantically equivalent responses to have the same etags, even if their bodies do not match exactly. This is useful when we don't want the page to be regenerated for minor changes in response body. If you absolutely need to generate a strong etag, it can be assigned to the header directly.
```ruby
response.add_header "ETag", Digest::MD5.hexdigest(response.body)
```
References
----------
* [DHH's article on key-based expiration](https://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works)
* [Ryan Bates' Railscast on cache digests](http://railscasts.com/episodes/387-cache-digests)
| vassilevsky/rails | guides/source/caching_with_rails.md | Markdown | mit | 22,553 | [
30522,
1008,
1008,
2079,
2025,
3191,
2023,
5371,
2006,
21025,
2705,
12083,
1010,
12468,
2024,
2405,
2006,
8299,
1024,
1013,
1013,
12468,
1012,
10090,
2239,
15118,
2015,
1012,
8917,
1012,
1008,
1008,
6187,
8450,
2007,
15168,
1024,
2019,
1918... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.apereo.cas.config;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.configuration.model.support.saml.sps.AbstractSamlSPProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* This is {@link CasSamlSPAcademicWorksConfiguration}.
*
* @author Misagh Moayyed
* @since 5.1.0
*/
@Configuration("casSamlSPAcademicWorksConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class CasSamlSPAcademicWorksConfiguration extends BaseCasSamlSPConfiguration {
@Override
protected AbstractSamlSPProperties getServiceProvider() {
return casProperties.getSamlSp().getAcademicWorks();
}
}
| Unicon/cas | support/cas-server-support-saml-sp-integrations/src/main/java/org/apereo/cas/config/CasSamlSPAcademicWorksConfiguration.java | Java | apache-2.0 | 789 | [
30522,
7427,
8917,
1012,
23957,
2890,
2080,
1012,
25222,
1012,
9530,
8873,
2290,
1025,
12324,
8917,
1012,
23957,
2890,
2080,
30524,
8917,
1012,
3500,
15643,
6198,
1012,
9573,
1012,
6123,
1012,
5144,
1012,
9585,
8663,
8873,
27390,
3370,
2157... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Uniter PHP Demo Collection</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="full_row">
<hr />
</div>
<div class="full_row">
<div class="all_demos">
<h1>
Uniter PHP<br/>in Browser Demos
</h1>
<p>
The in-browser logic for all these pages is written entirely in PHP,
see <a target="_blank" href="//github.com/uniter/uniter-jquery/blob/master/php/src/">Demos</a>
for a look at the php code.<br /> All JavaScript and jQuery object and method calls come directly from php code.
</p>
<p>
The tests are written using PHPUnit and run on the command line (for now),
see <a target="_blank" href="//github.com/uniter/uniter-jquery/blob/master/tests/phpunit/Demo/Tests/Component/NavMenuComponentTest.php">NavMenuComponentTest</a>.
</p>
<p>
(Almost) No JavaScript was harmed in the making of these demos :)
</p>
</div>
<div class="all_demos" id="homepage_loading">
<img src="img/loading.gif" />
</div>
<div class="all_demos" id="homepage_slider">
<div class="demo_entry">
<p>Hello World!</p>
<a target="_blank" href="hello_world.html">Hello World</a>
</div>
<div class="demo_entry">
<p>Dynamic Menu Display</p>
<a target="_blank" href="menu_demo.html">Menu Demo</a>
</div>
<div class="demo_entry">
<p>Call an alert on the window</p>
<a target="_blank" href="window_alert.html">Window Alert</a>
</div>
<div class="demo_entry">
<p>
The first click anywhere on this page will cause a
css change to the page
</p>
<a target="_blank" href="jquery_simple_colour_change.html">jQuery Colour Change</a>
</div>
<div class="demo_entry">
<p>Adding, Removing and Counting HTML Elements on a page</p>
<a target="_blank" href="counting_elements.html">Adding, Removing and Counting HTML Elements</a>
</div>
<div class="demo_entry">
<p>PHP Code Written using classes, running in browser</p>
<a target="_blank" href="using_classes.html">Using Classes</a>
</div>
<div class="demo_entry">
<p>PHP Code Written using classes and namespaces, running in browser</p>
<a target="_blank" href="using_namespaces.html">Using Namespaces</a>
</div>
<div class="demo_entry">
<p>Random Numbers from Core JS change to the page</p>
<a target="_blank" href="random_numbers.html">Random Numbers</a>
</div>
<div class="demo_entry">
<p>Fading elements in and out of a page</p>
<a target="_blank" href="fades.html">Fades</a>
</div>
<div class="demo_entry">
<p>Sliding elements in a page</p>
<a target="_blank" href="sliders.html">Sliders</a>
</div>
<div class="demo_entry pending_demo_entry">
<p>
<strong>Coming Soon! </strong> Use the well known JCarousel plugin directly
from PHP code in browser
</p>
<a>PHP JCarousel</a>
</div>
<div class="demo_entry pending_demo_entry">
<p><strong>Coming Soon! </strong> Creating Overlays in browser </p>
<a>PHP Overlay</a>
</div>
<div class="demo_entry pending_demo_entry">
<p><strong>Coming Soon! </strong> Making xmlHTTPRequest calls </p>
<a>xmlHTTPRequest</a>
</div>
<div class="demo_entry pending_demo_entry">
<p><strong>Coming Soon! </strong> Making ajax requests </p>
<a>ajax</a>
</div>
<div class="demo_entry pending_demo_entry">
<p><strong>Coming Soon! </strong> Making API Calls</p>
<a>API Call</a>
</div>
<div class="demo_entry pending_demo_entry">
<p><strong>Coming Soon! </strong> Parsing JSON from API calls </p>
<a>json parsing</a>
</div>
</div>
</div>
<div class="full_row">
<a href="https://github.com/uniter/uniter-jquery">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="img/forkme_right_green.png" alt="Fork me on GitHub" />
</a>
</div>
<script src="dist/bundle.js"></script>
</body>
</html>
| uniter/uniter-jquery | index.html | HTML | mit | 5,547 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
15908,
2099,
25718,
9703,
3074,
1026,
1013,
2516,
1028,
1026,
188... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
require "ENGINE_NAME"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end
| hinshun/boilerplate-rails-engine | spec/dummy/config/application.rb | Ruby | mit | 2,785 | [
30522,
5478,
5371,
1012,
7818,
1035,
4130,
1006,
1005,
1012,
1012,
1013,
9573,
1005,
1010,
1035,
1035,
5371,
1035,
1035,
1007,
1001,
4060,
1996,
7705,
2015,
2017,
2215,
1024,
5478,
1000,
3161,
1035,
2501,
1013,
4334,
9515,
1000,
5478,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, version 2 of the License.
//
// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to produce
// an executable, this file does not by itself cause the resulting
// executable to be covered by the GNU General Public License. This
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
#include <mln/core/image/image2d.hh>
#include <mln/core/image/dmorph/sub_image.hh>
#include <mln/core/image/dmorph/image_if.hh>
#include <mln/fun/p2b/chess.hh>
#include <mln/border/get.hh>
#include <mln/literal/origin.hh>
struct f_box2d_t : mln::Function_v2b< f_box2d_t >
{
f_box2d_t(const mln::box2d& b)
: b_(b)
{
}
mln::box2d b_;
bool operator()(const mln::point2d& p) const
{
return b_.has(p);
}
};
int main()
{
using namespace mln;
typedef image2d<int> I;
box2d b(literal::origin, point2d(1,1));
f_box2d_t f_b(b);
I ima(3,3, 51);
mln_assertion(border::get(ima) == 51);
mln_assertion(ima.has(point2d(2,2)) == true);
sub_image<I, box2d> sub(ima, b);
mln_assertion(sub.has(point2d(2,2)) == false &&
sub.has(point2d(2,2)) == false);
mln_assertion(border::get(sub) == 0);
image_if<I, f_box2d_t> imaif(ima, f_b);
mln_assertion(imaif.has(point2d(2,2)) == false &&
ima.has(point2d(2,2)) == true);
mln_assertion(border::get(imaif) == 0);
mln_assertion(border::get((ima | b) | f_b) == 0);
}
| glazzara/olena | milena/tests/border/get.cc | C++ | gpl-2.0 | 2,307 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2289,
1010,
2263,
1010,
2268,
4958,
6590,
2470,
1998,
2458,
5911,
1006,
1048,
25547,
1007,
1013,
1013,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
15589,
2532,
1012,
1013,
1013,
1013,
1013,
15589,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Drupal\path\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\Validator\ConstraintViolationInterface;
/**
* Plugin implementation of the 'path' widget.
*
* @FieldWidget(
* id = "path",
* label = @Translation("URL alias"),
* field_types = {
* "path"
* }
* )
*/
class PathWidget extends WidgetBase {
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$entity = $items->getEntity();
$element += [
'#element_validate' => [[static::class, 'validateFormElement']],
];
$element['alias'] = [
'#type' => 'textfield',
'#title' => $element['#title'],
'#default_value' => $items[$delta]->alias,
'#required' => $element['#required'],
'#maxlength' => 255,
'#description' => $this->t('Specify an alternative path by which this data can be accessed. For example, type "/about" when writing an about page.'),
];
$element['pid'] = [
'#type' => 'value',
'#value' => $items[$delta]->pid,
];
$element['source'] = [
'#type' => 'value',
'#value' => !$entity->isNew() ? '/' . $entity->toUrl()->getInternalPath() : NULL,
];
$element['langcode'] = [
'#type' => 'value',
'#value' => $items[$delta]->langcode,
];
// If the advanced settings tabs-set is available (normally rendered in the
// second column on wide-resolutions), place the field as a details element
// in this tab-set.
if (isset($form['advanced'])) {
$element += [
'#type' => 'details',
'#title' => t('URL path settings'),
'#open' => !empty($items[$delta]->alias),
'#group' => 'advanced',
'#access' => $entity->get('path')->access('edit'),
'#attributes' => [
'class' => ['path-form'],
],
'#attached' => [
'library' => ['path/drupal.path'],
],
];
$element['#weight'] = 30;
}
return $element;
}
/**
* Form element validation handler for URL alias form element.
*
* @param array $element
* The form element.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
public static function validateFormElement(array &$element, FormStateInterface $form_state) {
// Trim the submitted value of whitespace and slashes.
$alias = rtrim(trim($element['alias']['#value']), " \\/");
if ($alias !== '') {
$form_state->setValueForElement($element['alias'], $alias);
/** @var \Drupal\path_alias\PathAliasInterface $path_alias */
$path_alias = \Drupal::entityTypeManager()->getStorage('path_alias')->create([
'path' => $element['source']['#value'],
'alias' => $alias,
'langcode' => $element['langcode']['#value'],
]);
$violations = $path_alias->validate();
foreach ($violations as $violation) {
// Newly created entities do not have a system path yet, so we need to
// disregard some violations.
if (!$path_alias->getPath() && $violation->getPropertyPath() === 'path') {
continue;
}
$form_state->setError($element['alias'], $violation->getMessage());
}
}
}
/**
* {@inheritdoc}
*/
public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
return $element['alias'];
}
}
| tobiasbuhrer/tobiasb | web/core/modules/path/src/Plugin/Field/FieldWidget/PathWidget.php | PHP | gpl-2.0 | 3,606 | [
30522,
1026,
1029,
25718,
3415,
15327,
2852,
6279,
2389,
1032,
4130,
1032,
13354,
2378,
1032,
2492,
1032,
2492,
9148,
24291,
1025,
2224,
2852,
6279,
2389,
1032,
4563,
1032,
2492,
1032,
2492,
4221,
19968,
2923,
18447,
2121,
12172,
1025,
2224... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2014 ASMlover. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list ofconditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materialsprovided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "global.h"
#include "lexer.h"
struct KL_Lexer {
char fname[BFILE];
FILE* stream;
char lexbuf[BSIZE];
int lineno;
int bsize;
int pos;
KL_Boolean eof;
};
enum KL_LexState {
LEX_STATE_BEGIN = 0,
LEX_STATE_FINISH,
LEX_STATE_IN_CINT,
LEX_STATE_IN_CREAL,
LEX_STATE_IN_CSTR,
LEX_STATE_IN_ID,
LEX_STATE_IN_ASSIGNEQ, /* =/== */
LEX_STATE_IN_NEGLTLE, /* <>/</<= */
LEX_STATE_IN_GTGE, /* >/>= */
LEX_STATE_IN_AND, /* && */
LEX_STATE_IN_OR, /* || */
LEX_STATE_IN_COMMENT, /* # */
};
static const struct {
const char* lexptr;
int token;
} kReserveds[] = {
{"nil", TT_NIL},
{"true", TT_TRUE},
{"false", TT_FALSE},
{"if", TT_IF},
{"else", TT_ELSE},
{"while", TT_WHILE},
{"break", TT_BREAK},
{"func", TT_FUNC},
{"return", TT_RET},
};
static int
get_char(KL_Lexer* lex)
{
if (lex->pos >= lex->bsize) {
if (NULL != fgets(lex->lexbuf, sizeof(lex->lexbuf), lex->stream)) {
lex->pos = 0;
lex->bsize = (int)strlen(lex->lexbuf);
}
else {
lex->eof = BOOL_YES;
return EOF;
}
}
return lex->lexbuf[lex->pos++];
}
static void
unget_char(KL_Lexer* lex)
{
if (!lex->eof)
--lex->pos;
}
static int
lookup_reserved(const char* s)
{
int i, count = countof(kReserveds);
for (i = 0; i < count; ++i) {
if (0 == strcmp(kReserveds[i].lexptr, s))
return kReserveds[i].token;
}
return TT_ID;
}
KL_Lexer*
KL_lexer_create(const char* fname)
{
KL_Lexer* lex = (KL_Lexer*)malloc(sizeof(*lex));
if (NULL == lex)
return NULL;
do {
lex->stream = fopen(fname, "r");
if (NULL == lex->stream)
break;
strcpy(lex->fname, fname);
lex->lineno = 1;
lex->bsize = 0;
lex->pos = 0;
lex->eof = BOOL_NO;
return lex;
} while (0);
if (NULL != lex)
free(lex);
return NULL;
}
void
KL_lexer_release(KL_Lexer** lex)
{
if (NULL != *lex) {
if (NULL != (*lex)->stream)
fclose((*lex)->stream);
free(*lex);
*lex = NULL;
}
}
int
KL_lexer_token(KL_Lexer* lex, KL_Token* tok)
{
int type = TT_ERR;
int i = 0;
int state = LEX_STATE_BEGIN;
KL_Boolean save = BOOL_NO;
int c;
while (LEX_STATE_FINISH != state) {
c = get_char(lex);
save = BOOL_YES;
switch (state) {
case LEX_STATE_BEGIN:
if (' ' == c || '\t' == c) {
save = BOOL_NO;
}
else if ('\n' == c) {
save = BOOL_NO;
++lex->lineno;
}
else if (isdigit(c)) {
state = LEX_STATE_IN_CINT;
}
else if ('\'' == c) {
save = BOOL_NO;
state = LEX_STATE_IN_CSTR;
}
else if (isdigit(c) || '_' == c) {
state = LEX_STATE_IN_ID;
}
else if ('=' == c) {
state = LEX_STATE_IN_ASSIGNEQ;
}
else if ('>' == c) {
state = LEX_STATE_IN_GTGE;
}
else if ('<' == c) {
state = LEX_STATE_IN_NEGLTLE;
}
else if ('&' == c) {
state = LEX_STATE_IN_AND;
}
else if ('|' == c) {
state = LEX_STATE_IN_OR;
}
else if ('#' == c) {
state = LEX_STATE_IN_COMMENT;
}
else {
state = LEX_STATE_FINISH;
switch (c) {
case EOF:
save = BOOL_NO;
type = TT_EOF;
break;
case '+':
type = TT_ADD;
break;
case '-':
type = TT_SUB;
break;
case '*':
type = TT_MUL;
break;
case '/':
type = TT_DIV;
break;
case '%':
type = TT_MOD;
break;
case '.':
type = TT_DOT;
break;
case ',':
type = TT_COMMA;
break;
case ';':
type = TT_SEMI;
break;
case '(':
type = TT_LPAREN;
break;
case ')':
type = TT_RPAREN;
break;
case '[':
type = TT_LBRACKET;
break;
case ']':
type = TT_RBRACKET;
break;
case '{':
type = TT_LBRACE;
break;
case '}':
type = TT_RBRACE;
break;
default:
save = BOOL_NO;
type = TT_ERR;
break;
}
}
break;
case LEX_STATE_IN_CINT:
if ('.' == c) {
state = LEX_STATE_IN_CREAL;
}
else {
if (!isdigit(c)) {
unget_char(lex);
save = BOOL_NO;
state = LEX_STATE_FINISH;
type = TT_CINT;
}
}
break;
case LEX_STATE_IN_CREAL:
if (!isdigit(c)) {
unget_char(lex);
save = BOOL_NO;
state = LEX_STATE_FINISH;
type = TT_CREAL;
}
break;
case LEX_STATE_IN_CSTR:
if ('\'' == c) {
save = BOOL_NO;
state = LEX_STATE_FINISH;
type = TT_CSTR;
}
break;
case LEX_STATE_IN_ID:
if (!isalnum(c) && '_' != c) {
unget_char(lex);
save = BOOL_NO;
state = LEX_STATE_FINISH;
type = TT_ID;
}
break;
case LEX_STATE_IN_ASSIGNEQ:
if ('=' == c) {
type = TT_EQ;
}
else {
unget_char(lex);
save = BOOL_NO;
type = TT_ASSIGN;
}
state = LEX_STATE_FINISH;
break;
case LEX_STATE_IN_NEGLTLE:
if ('>' == c) {
type = TT_NEQ;
}
else if ('=' == c) {
type = TT_LE;
}
else {
unget_char(lex);
save = BOOL_NO;
type = TT_LT;
}
state = LEX_STATE_FINISH;
break;
case LEX_STATE_IN_GTGE:
if ('=' == c) {
type = TT_GE;
}
else {
unget_char(lex);
save = BOOL_NO;
type = TT_GT;
}
state = LEX_STATE_FINISH;
break;
case LEX_STATE_IN_AND:
if ('&' == c) {
type = TT_ADD;
}
else {
unget_char(lex);
save = BOOL_NO;
type = TT_ERR;
}
state = LEX_STATE_FINISH;
break;
case LEX_STATE_IN_OR:
if ('|' == c) {
type = TT_OR;
}
else {
unget_char(lex);
save = BOOL_NO;
type = TT_ERR;
}
state = LEX_STATE_FINISH;
break;
case LEX_STATE_IN_COMMENT:
save = BOOL_NO;
if (EOF == c) {
state = LEX_STATE_FINISH;
type = TT_ERR;
}
else if ('\n' == c) {
++lex->lineno;
state = LEX_STATE_BEGIN;
}
break;
case LEX_STATE_FINISH:
default:
save = BOOL_NO;
state = LEX_STATE_FINISH;
type = TT_ERR;
break;
}
if (save && i < BSIZE)
tok->name[i++] = (char)c;
if (LEX_STATE_FINISH == state) {
tok->name[i] = 0;
tok->type = type;
tok->line.lineno = lex->lineno;
strcpy(tok->line.fname, lex->fname);
if (TT_ID == type)
tok->type = type = lookup_reserved(tok->name);
}
}
return type;
}
| ASMlover/study | self-lang/klang/lexer.c | C | bsd-2-clause | 8,418 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
2004,
19968,
7840,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
14080,
1010,
2024,
7936,
3024,
2008,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
--セイヴァー・デモン・ドラゴン
function c67030233.initial_effect(c)
--synchro summon
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c67030233.syncon)
e1:SetOperation(c67030233.synop)
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(67030233,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLED)
e2:SetCondition(c67030233.descon)
e2:SetTarget(c67030233.destg)
e2:SetOperation(c67030233.desop)
c:RegisterEffect(e2)
--Disable
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(67030233,1))
e3:SetCategory(CATEGORY_DISABLE+CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_MZONE)
e3:SetTarget(c67030233.distg)
e3:SetOperation(c67030233.disop)
c:RegisterEffect(e3)
--to extra & Special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(67030233,2))
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCountLimit(1)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetTarget(c67030233.sptg)
e4:SetOperation(c67030233.spop)
c:RegisterEffect(e4)
--
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e5:SetValue(1)
c:RegisterEffect(e5)
end
function c67030233.matfilter(c,syncard)
return c:IsFaceup() and c:IsCanBeSynchroMaterial(syncard)
end
function c67030233.synfilter1(c,syncard,lv,g)
if not c:IsCode(21159309) then return false end
local tlv=c:GetSynchroLevel(syncard)
if lv-tlv<=0 then return false end
local t=false
if c:IsType(TYPE_TUNER) then t=true end
local wg=g:Clone()
wg:RemoveCard(c)
return wg:IsExists(c67030233.synfilter2,1,nil,syncard,lv-tlv,wg,t)
end
function c67030233.synfilter2(c,syncard,lv,g,tuner)
if not c:IsCode(70902743) then return false end
local tlv=c:GetSynchroLevel(syncard)
if lv-tlv<=0 then return false end
if not tuner and not c:IsType(TYPE_TUNER) then return false end
return g:IsExists(c67030233.synfilter3,1,c,syncard,lv-tlv)
end
function c67030233.synfilter3(c,syncard,lv)
local mlv=c:GetSynchroLevel(syncard)
local lv1=bit.band(mlv,0xffff)
local lv2=bit.rshift(mlv,16)
return c:IsNotTuner() and (lv1==lv or lv2==lv)
end
function c67030233.syncon(e,c,tuner)
if c==nil then return true end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(c67030233.matfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
local lv=c:GetLevel()
if tuner then return c67030233.synfilter1(tuner,c,lv,mg) end
return mg:IsExists(c67030233.synfilter1,1,nil,c,lv,mg)
end
function c67030233.synop(e,tp,eg,ep,ev,re,r,rp,c,tuner)
local g=Group.CreateGroup()
local mg=Duel.GetMatchingGroup(c67030233.matfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
local lv=c:GetLevel()
local m1=tuner
if not tuner then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local t1=mg:FilterSelect(tp,c67030233.synfilter1,1,1,nil,c,lv,mg)
m1=t1:GetFirst()
g:AddCard(m1)
end
lv=lv-m1:GetSynchroLevel(c)
local t=false
if m1:IsType(TYPE_TUNER) then t=true end
mg:RemoveCard(m1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local t2=mg:FilterSelect(tp,c67030233.synfilter2,1,1,nil,c,lv,mg,t)
local m2=t2:GetFirst()
g:AddCard(m2)
lv=lv-m2:GetSynchroLevel(c)
mg:RemoveCard(m2)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local t3=mg:FilterSelect(tp,c67030233.synfilter3,1,1,nil,c,lv)
g:Merge(t3)
c:SetMaterial(g)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_SYNCHRO)
end
function c67030233.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler()==Duel.GetAttacker()
end
function c67030233.desfilter(c)
return c:IsDefencePos() and c:IsDestructable()
end
function c67030233.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c67030233.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c67030233.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c67030233.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.Destroy(g,REASON_EFFECT)
end
function c67030233.disfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and not c:IsDisabled()
end
function c67030233.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c67030233.disfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c67030233.disfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c67030233.disfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function c67030233.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local c=e:GetHandler()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local atk=tc:GetAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(atk)
e3:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e3)
end
end
function c67030233.spfilter(c,e,tp)
return c:IsCode(70902743) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c67030233.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c67030233.spfilter(chkc,e,tp) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c67030233.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,g:GetCount(),0,0)
end
function c67030233.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local c=e:GetHandler()
if bit.band(c:GetOriginalType(),0x802040)~=0 and Duel.SendtoDeck(c,nil,0,REASON_EFFECT)~=0
and c:IsLocation(LOCATION_EXTRA) and tc and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| Lsty/ygopro-scripts | c67030233.lua | Lua | gpl-2.0 | 6,686 | [
30522,
1011,
1011,
1708,
30221,
30222,
30218,
30265,
1738,
1713,
30253,
30263,
1738,
1714,
30257,
30230,
30263,
3853,
1039,
2575,
19841,
14142,
21926,
2509,
1012,
3988,
1035,
3466,
1006,
1039,
1007,
1011,
1011,
26351,
8093,
2080,
18654,
1039,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% load static %}
<!-- jQuery -->
<script src="{% static 'main/vendor/jquery/jquery.min.js' %}"></script>
<!-- Bootstrap Core JavaScript -->
<script src="{% static 'main/vendor/bootstrap/js/bootstrap.min.js' %}"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="{% static 'main/vendor/metisMenu/metisMenu.min.js' %}"></script>
<!-- Morris Charts JavaScript -->
<script src="{% static 'main/vendor/raphael/raphael.min.js' %}"></script>
<script src="{% static 'main/vendor/morrisjs/morris.min.js' %}"></script>
<!-- <script src="{% static 'main/data/morris-data.js' %}"></script> -->
<!-- Custom Theme JavaScript -->
<script src="{% static 'main/js/sb-admin-2.js' %}"></script>
<script src="{% static 'main/js/d3.v3.min.js' %}"></script>
<script src="{% static 'main/js/d3.layout.cloud.js' %}"></script>
| chrizandr/ITS_feedback | feedback_portal/main/templates/main/post_include.html | HTML | gpl-3.0 | 817 | [
30522,
1063,
1003,
7170,
10763,
1003,
1065,
1026,
999,
1011,
1011,
1046,
4226,
2854,
1011,
1011,
1028,
1026,
5896,
5034,
2278,
1027,
1000,
1063,
1003,
10763,
1005,
2364,
1013,
21431,
1013,
1046,
4226,
2854,
1013,
1046,
4226,
2854,
1012,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package pl.com.turski.service.shipment;
import com.google.appengine.repackaged.com.google.common.collect.Lists;
import org.hibernate.validator.constraints.NotBlank;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import pl.com.turski.exception.BusinessErrorCode;
import pl.com.turski.exception.BusinessException;
import pl.com.turski.exception.TechnicalException;
import pl.com.turski.model.domain.shipment.ShipmentStatus;
import pl.com.turski.repository.shipment.ShipmentStatusRepository;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* User: Adam
*/
@Service
@Transactional
public class ShipmentStatusServiceImpl implements ShipmentStatusService {
private static final Logger LOG = LoggerFactory.getLogger(ShipmentStatusServiceImpl.class);
@Autowired
private ShipmentStatusRepository shipmentStatusRepository;
@Override
public void create(@NotBlank String name, String description) throws TechnicalException, BusinessException {
LOG.info("Creating ShipmentStatus[name={}, description={}]", name, description);
ShipmentStatus shipmentStatus = new ShipmentStatus(name, description);
shipmentStatusRepository.save(shipmentStatus);
}
@Override
public ShipmentStatus get(@NotNull Long id) throws TechnicalException, BusinessException {
LOG.info("Getting ShipmentStatus[id={}]", id);
ShipmentStatus shipmentStatus = shipmentStatusRepository.findOne(id);
if (shipmentStatus == null) {
throw new BusinessException(String.format("ShipmentStatus[id=%d] not found)", id), BusinessErrorCode.SHIPMENT_STATUS_NOT_FOUND);
}
return shipmentStatus;
}
@Override
public List<ShipmentStatus> getAll() throws TechnicalException, BusinessException {
LOG.info("Getting all shipment statuses");
return Lists.newArrayList(shipmentStatusRepository.findAll());
}
}
| trak17/Trak | src/main/java/pl/com/turski/service/shipment/ShipmentStatusServiceImpl.java | Java | apache-2.0 | 2,100 | [
30522,
7427,
20228,
1012,
4012,
1012,
10722,
27472,
2072,
1012,
2326,
1012,
22613,
1025,
12324,
4012,
1012,
8224,
1012,
10439,
13159,
3170,
1012,
16360,
8684,
18655,
1012,
4012,
1012,
8224,
1012,
2691,
1012,
8145,
1012,
7201,
1025,
12324,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# coding=utf-8
# Copyright 2018 the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import unittest
import numpy as np
from transformers.file_utils import is_torch_available
from transformers.testing_utils import require_torch
if is_torch_available():
import torch
from torch import nn
from torch.utils.data import IterableDataset
from transformers.modeling_outputs import SequenceClassifierOutput
from transformers.tokenization_utils_base import BatchEncoding
from transformers.trainer_pt_utils import (
DistributedLengthGroupedSampler,
DistributedSamplerWithLoop,
DistributedTensorGatherer,
IterableDatasetShard,
LabelSmoother,
LengthGroupedSampler,
SequentialDistributedSampler,
ShardSampler,
get_parameter_names,
)
class TstLayer(nn.Module):
def __init__(self, hidden_size):
super().__init__()
self.linear1 = nn.Linear(hidden_size, hidden_size)
self.ln1 = nn.LayerNorm(hidden_size)
self.linear2 = nn.Linear(hidden_size, hidden_size)
self.ln2 = nn.LayerNorm(hidden_size)
self.bias = nn.Parameter(torch.zeros(hidden_size))
def forward(self, x):
h = self.ln1(nn.functional.relu(self.linear1(x)))
h = nn.functional.relu(self.linear2(x))
return self.ln2(x + h + self.bias)
class RandomIterableDataset(IterableDataset):
# For testing, an iterable dataset of random length
def __init__(self, p_stop=0.01, max_length=1000):
self.p_stop = p_stop
self.max_length = max_length
self.generator = torch.Generator()
def __iter__(self):
count = 0
stop = False
while not stop and count < self.max_length:
yield count
count += 1
number = torch.rand(1, generator=self.generator).item()
stop = number < self.p_stop
@require_torch
class TrainerUtilsTest(unittest.TestCase):
def test_distributed_tensor_gatherer(self):
# Simulate a result with a dataset of size 21, 4 processes and chunks of lengths 2, 3, 1
world_size = 4
num_samples = 21
input_indices = [
[0, 1, 6, 7, 12, 13, 18, 19],
[2, 3, 4, 8, 9, 10, 14, 15, 16, 20, 0, 1],
[5, 11, 17, 2],
]
predictions = np.random.normal(size=(num_samples, 13))
gatherer = DistributedTensorGatherer(world_size=world_size, num_samples=num_samples)
for indices in input_indices:
gatherer.add_arrays(predictions[indices])
result = gatherer.finalize()
self.assertTrue(np.array_equal(result, predictions))
# With nested tensors
gatherer = DistributedTensorGatherer(world_size=world_size, num_samples=num_samples)
for indices in input_indices:
gatherer.add_arrays([predictions[indices], [predictions[indices], predictions[indices]]])
result = gatherer.finalize()
self.assertTrue(isinstance(result, list))
self.assertTrue(len(result), 2)
self.assertTrue(isinstance(result[1], list))
self.assertTrue(len(result[1]), 2)
self.assertTrue(np.array_equal(result[0], predictions))
self.assertTrue(np.array_equal(result[1][0], predictions))
self.assertTrue(np.array_equal(result[1][1], predictions))
def test_distributed_tensor_gatherer_different_shapes(self):
# Simulate a result with a dataset of size 21, 4 processes and chunks of lengths 2, 3, 1
world_size = 4
num_samples = 21
input_indices = [
[0, 1, 6, 7, 12, 13, 18, 19],
[2, 3, 4, 8, 9, 10, 14, 15, 16, 20, 0, 1],
[5, 11, 17, 2],
]
sequence_lengths = [8, 10, 13]
predictions = np.random.normal(size=(num_samples, 13))
gatherer = DistributedTensorGatherer(world_size=world_size, num_samples=num_samples)
for indices, seq_length in zip(input_indices, sequence_lengths):
gatherer.add_arrays(predictions[indices, :seq_length])
result = gatherer.finalize()
# Remove the extra samples added at the end for a round multiple of num processes.
actual_indices = [input_indices[0], input_indices[1][:-2], input_indices[2][:-1]]
for indices, seq_length in zip(actual_indices, sequence_lengths):
self.assertTrue(np.array_equal(result[indices, :seq_length], predictions[indices, :seq_length]))
# With nested tensors
predictions = np.random.normal(size=(num_samples, 13))
gatherer = DistributedTensorGatherer(world_size=world_size, num_samples=num_samples)
for indices, seq_length in zip(input_indices, sequence_lengths):
gatherer.add_arrays([predictions[indices, :seq_length], predictions[indices]])
result = gatherer.finalize()
for indices, seq_length in zip(actual_indices, sequence_lengths):
self.assertTrue(np.array_equal(result[0][indices, :seq_length], predictions[indices, :seq_length]))
self.assertTrue(np.array_equal(result[1], predictions))
# Check if works if varying seq_length is second
gatherer = DistributedTensorGatherer(world_size=world_size, num_samples=num_samples)
for indices, seq_length in zip(input_indices, sequence_lengths):
gatherer.add_arrays([predictions[indices], predictions[indices, :seq_length]])
result = gatherer.finalize()
self.assertTrue(np.array_equal(result[0], predictions))
for indices, seq_length in zip(actual_indices, sequence_lengths):
self.assertTrue(np.array_equal(result[1][indices, :seq_length], predictions[indices, :seq_length]))
def test_label_smoothing(self):
epsilon = 0.1
num_labels = 12
random_logits = torch.randn(4, 5, num_labels)
random_labels = torch.randint(0, num_labels, (4, 5))
loss = nn.functional.cross_entropy(random_logits.view(-1, num_labels), random_labels.view(-1))
model_output = SequenceClassifierOutput(logits=random_logits)
label_smoothed_loss = LabelSmoother(0.1)(model_output, random_labels)
log_probs = -nn.functional.log_softmax(random_logits, dim=-1)
expected_loss = (1 - epsilon) * loss + epsilon * log_probs.mean()
self.assertTrue(torch.allclose(label_smoothed_loss, expected_loss))
# With a few -100 labels
random_labels[0, 1] = -100
random_labels[2, 1] = -100
random_labels[2, 3] = -100
loss = nn.functional.cross_entropy(random_logits.view(-1, num_labels), random_labels.view(-1))
model_output = SequenceClassifierOutput(logits=random_logits)
label_smoothed_loss = LabelSmoother(0.1)(model_output, random_labels)
log_probs = -nn.functional.log_softmax(random_logits, dim=-1)
# Mask the log probs with the -100 labels
log_probs[0, 1] = 0.0
log_probs[2, 1] = 0.0
log_probs[2, 3] = 0.0
expected_loss = (1 - epsilon) * loss + epsilon * log_probs.sum() / (num_labels * 17)
self.assertTrue(torch.allclose(label_smoothed_loss, expected_loss))
def test_group_by_length(self):
# Get some inputs of random lengths
lengths = torch.randint(0, 25, (100,)).tolist()
# Put one bigger than the others to check it ends up in first position
lengths[32] = 50
indices = list(LengthGroupedSampler(4, lengths=lengths))
# The biggest element should be first
self.assertEqual(lengths[indices[0]], 50)
# The indices should be a permutation of range(100)
self.assertEqual(list(sorted(indices)), list(range(100)))
def test_group_by_length_with_dict(self):
# Get some inputs of random lengths
data = []
for _ in range(6):
input_ids = torch.randint(0, 25, (100,)).tolist()
data.append({"input_ids": input_ids})
# Put one bigger than the others to check it ends up in first position
data[3]["input_ids"] = torch.randint(0, 25, (105,)).tolist()
indices = list(LengthGroupedSampler(4, dataset=data))
# The biggest element should be first
self.assertEqual(len(data[indices[0]]["input_ids"]), 105)
# The indices should be a permutation of range(6)
self.assertEqual(list(sorted(indices)), list(range(6)))
def test_group_by_length_with_batch_encoding(self):
# Get some inputs of random lengths
data = []
for _ in range(6):
input_ids = torch.randint(0, 25, (100,)).tolist()
data.append(BatchEncoding({"input_ids": input_ids}))
# Put one bigger than the others to check it ends up in first position
data[3]["input_ids"] = torch.randint(0, 25, (105,)).tolist()
indices = list(LengthGroupedSampler(4, dataset=data))
# The biggest element should be first
self.assertEqual(len(data[indices[0]]["input_ids"]), 105)
# The indices should be a permutation of range(6)
self.assertEqual(list(sorted(indices)), list(range(6)))
def test_distributed_length_grouped(self):
# Get some inputs of random lengths
lengths = torch.randint(0, 25, (100,)).tolist()
# Put one bigger than the others to check it ends up in first position
lengths[32] = 50
indices_process_0 = list(DistributedLengthGroupedSampler(4, num_replicas=2, rank=0, lengths=lengths))
indices_process_1 = list(DistributedLengthGroupedSampler(4, num_replicas=2, rank=1, lengths=lengths))
# The biggest element should be first
self.assertEqual(lengths[indices_process_0[0]], 50)
# The indices should be a permutation of range(100)
self.assertEqual(list(sorted(indices_process_0 + indices_process_1)), list(range(100)))
def test_get_parameter_names(self):
model = nn.Sequential(TstLayer(128), nn.ModuleList([TstLayer(128), TstLayer(128)]))
# fmt: off
self.assertEqual(
get_parameter_names(model, [nn.LayerNorm]),
['0.linear1.weight', '0.linear1.bias', '0.linear2.weight', '0.linear2.bias', '0.bias', '1.0.linear1.weight', '1.0.linear1.bias', '1.0.linear2.weight', '1.0.linear2.bias', '1.0.bias', '1.1.linear1.weight', '1.1.linear1.bias', '1.1.linear2.weight', '1.1.linear2.bias', '1.1.bias']
)
# fmt: on
def test_distributed_sampler_with_loop(self):
batch_size = 16
for length in [23, 64, 123]:
dataset = list(range(length))
shard1 = DistributedSamplerWithLoop(dataset, batch_size, num_replicas=2, rank=0)
shard2 = DistributedSamplerWithLoop(dataset, batch_size, num_replicas=2, rank=1)
# Set seeds
shard1.set_epoch(0)
shard2.set_epoch(0)
# Sample
samples1 = list(shard1)
samples2 = list(shard2)
self.assertTrue(len(samples1) % batch_size == 0)
self.assertTrue(len(samples2) % batch_size == 0)
total = []
for sample1, sample2 in zip(samples1, samples2):
total += [sample1, sample2]
self.assertEqual(set(total[:length]), set(dataset))
self.assertEqual(set(total[length:]), set(total[: (len(total) - length)]))
def test_sequential_distributed_sampler(self):
batch_size = 16
for length in [23, 64, 123]:
dataset = list(range(length))
shard1 = SequentialDistributedSampler(dataset, num_replicas=2, rank=0)
shard2 = SequentialDistributedSampler(dataset, num_replicas=2, rank=1)
# Sample
samples1 = list(shard1)
samples2 = list(shard2)
total = samples1 + samples2
self.assertListEqual(total[:length], dataset)
self.assertListEqual(total[length:], dataset[: (len(total) - length)])
# With a batch_size passed
shard1 = SequentialDistributedSampler(dataset, num_replicas=2, rank=0, batch_size=batch_size)
shard2 = SequentialDistributedSampler(dataset, num_replicas=2, rank=1, batch_size=batch_size)
# Sample
samples1 = list(shard1)
samples2 = list(shard2)
self.assertTrue(len(samples1) % batch_size == 0)
self.assertTrue(len(samples2) % batch_size == 0)
total = samples1 + samples2
self.assertListEqual(total[:length], dataset)
self.assertListEqual(total[length:], dataset[: (len(total) - length)])
def check_iterable_dataset_shard(self, dataset, batch_size, drop_last, num_processes=2, epoch=0):
# Set the seed for the base dataset to get the proper reference.
dataset.generator.manual_seed(epoch)
reference = list(dataset)
shards = [
IterableDatasetShard(
dataset, batch_size=batch_size, drop_last=drop_last, num_processes=num_processes, process_index=i
)
for i in range(num_processes)
]
for shard in shards:
shard.set_epoch(epoch)
shard_lists = [list(shard) for shard in shards]
for shard in shard_lists:
# All shards have a number of samples that is a round multiple of batch size
self.assertTrue(len(shard) % batch_size == 0)
# All shards have the same number of samples
self.assertEqual(len(shard), len(shard_lists[0]))
for shard in shards:
# All shards know the total number of samples
self.assertEqual(shard.num_examples, len(reference))
observed = []
for idx in range(0, len(shard_lists[0]), batch_size):
for shard in shard_lists:
observed += shard[idx : idx + batch_size]
# If drop_last is False we loop through samples at the beginning to have a size that is a round multiple of
# batch_size
if not drop_last:
while len(reference) < len(observed):
reference += reference
self.assertListEqual(observed, reference[: len(observed)])
# Check equivalence between IterableDataset and ShardSampler
dataset.generator.manual_seed(epoch)
reference = list(dataset)
sampler_shards = [
ShardSampler(
reference, batch_size=batch_size, drop_last=drop_last, num_processes=num_processes, process_index=i
)
for i in range(num_processes)
]
for shard, sampler_shard in zip(shard_lists, sampler_shards):
self.assertListEqual(shard, list(sampler_shard))
def test_iterable_dataset_shard(self):
dataset = RandomIterableDataset()
self.check_iterable_dataset_shard(dataset, 4, drop_last=True, num_processes=2, epoch=0)
self.check_iterable_dataset_shard(dataset, 4, drop_last=False, num_processes=2, epoch=0)
self.check_iterable_dataset_shard(dataset, 4, drop_last=True, num_processes=3, epoch=42)
self.check_iterable_dataset_shard(dataset, 4, drop_last=False, num_processes=3, epoch=42)
def test_iterable_dataset_shard_with_length(self):
sampler_shards = [
IterableDatasetShard(list(range(100)), batch_size=4, drop_last=True, num_processes=2, process_index=i)
for i in range(2)
]
# Build expected shards: each process will have batches of size 4 until there is not enough elements to
# form two full batches (so we stop at 96 = (100 // (4 * 2)) * 4)
expected_shards = [[], []]
current_shard = 0
for i in range(0, 96, 4):
expected_shards[current_shard].extend(list(range(i, i + 4)))
current_shard = 1 - current_shard
self.assertListEqual([list(shard) for shard in sampler_shards], expected_shards)
self.assertListEqual([len(shard) for shard in sampler_shards], [len(shard) for shard in expected_shards])
sampler_shards = [
IterableDatasetShard(list(range(100)), batch_size=4, drop_last=False, num_processes=2, process_index=i)
for i in range(2)
]
# When drop_last=False, we get two last full batches by looping back to the beginning.
expected_shards[0].extend(list(range(96, 100)))
expected_shards[1].extend(list(range(0, 4)))
self.assertListEqual([list(shard) for shard in sampler_shards], expected_shards)
self.assertListEqual([len(shard) for shard in sampler_shards], [len(shard) for shard in expected_shards])
def check_shard_sampler(self, dataset, batch_size, drop_last, num_processes=2):
shards = [
ShardSampler(
dataset, batch_size=batch_size, drop_last=drop_last, num_processes=num_processes, process_index=i
)
for i in range(num_processes)
]
shard_lists = [list(shard) for shard in shards]
for shard in shard_lists:
# All shards have a number of samples that is a round multiple of batch size
self.assertTrue(len(shard) % batch_size == 0)
# All shards have the same number of samples
self.assertEqual(len(shard), len(shard_lists[0]))
observed = []
for idx in range(0, len(shard_lists[0]), batch_size):
for shard in shard_lists:
observed += shard[idx : idx + batch_size]
# If drop_last is False we loop through samples at the beginning to have a size that is a round multiple of
# batch_size
reference = copy.copy(dataset)
if not drop_last:
while len(reference) < len(observed):
reference += reference
self.assertListEqual(observed, reference[: len(observed)])
def test_shard_sampler(self):
for n_elements in [64, 123]:
dataset = list(range(n_elements))
self.check_shard_sampler(dataset, 4, drop_last=True, num_processes=2)
self.check_shard_sampler(dataset, 4, drop_last=False, num_processes=2)
self.check_shard_sampler(dataset, 4, drop_last=True, num_processes=3)
self.check_shard_sampler(dataset, 4, drop_last=False, num_processes=3)
| huggingface/transformers | tests/trainer/test_trainer_utils.py | Python | apache-2.0 | 18,824 | [
30522,
1001,
16861,
1027,
21183,
2546,
1011,
1022,
1001,
9385,
2760,
1996,
17662,
12172,
4297,
1012,
2136,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1001,
2017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
export default class TasksService {
static async fetchTasks() {
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
await delay(1000);
return [
{ id: 0, description: "task1", status: "Active" },
{ id: 1, description: "task2", status: "Active" },
];
}
}
| guptag/js-frameworks | React/examples/hello-world/src/data/TasksService.js | JavaScript | mit | 308 | [
30522,
9167,
12398,
2465,
8518,
8043,
7903,
2063,
1063,
10763,
2004,
6038,
2278,
18584,
10230,
5705,
1006,
1007,
1063,
9530,
3367,
8536,
1027,
1006,
5796,
1007,
1027,
1028,
2047,
4872,
1006,
1006,
10663,
1007,
1027,
1028,
2275,
7292,
5833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Anansi: inc/PacketHandler.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Anansi
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('PacketHandler_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Macros</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">PacketHandler.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="PacketHandler_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#include <<a class="code" href="PacketHandler_8h.html">PacketHandler.h</a>></span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#include <iostream></span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">//having to include cstring to run</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include <cstring></span></div>
<div class="line"><a name="l00005"></a><span class="lineno"><a class="line" href="classPacketHandler.html#aa285a77edd54b686e7f66fbd5e77098e"> 5</a></span> <a class="code" href="structpacket__t.html">packet_t</a> <a class="code" href="classPacketHandler.html#aa285a77edd54b686e7f66fbd5e77098e">PacketHandler::createPacket</a>(<a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> flags,<a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> messageID, <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> packetID, <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> targetService, <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> sourceService, vector<byte> dataContent) {</div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>  <a class="code" href="structpacket__t.html">packet_t</a> packet;</div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  <a class="code" href="structpacket__header__t.html">packet_header_t</a> packetHeader;</div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>  packetHeader.<a class="code" href="structpacket__header__t.html#aad89b35b9fc679c656e400a544e1e85c">flags</a>=flags & 0x7;</div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>  packetHeader.<a class="code" href="structpacket__header__t.html#aaee837dbf6105af66931e70c9932b0db">messageID</a>=messageID & 0x1F;</div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>  packetHeader.<a class="code" href="structpacket__header__t.html#aa3ba2fb72ec305ff3f50af606076e7ab">targetService</a>=targetService;</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  packetHeader.<a class="code" href="structpacket__header__t.html#a57e60ba4278dd9ed52c644649b6df4bc">sourceService</a>=sourceService;</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  packetHeader.<a class="code" href="structpacket__header__t.html#ad9804ba95d7318a4bc6fa61810611d62">packetID</a>=packetID;</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>  packetHeader.<a class="code" href="structpacket__header__t.html#a22d6a140609c7f68aad391d7873af870">crc</a>=0x0;</div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  packet.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>=packetHeader;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  packet.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>=dataContent;</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  packet.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>.<a class="code" href="structpacket__header__t.html#a22d6a140609c7f68aad391d7873af870">crc</a>=<a class="code" href="classPacketHandler.html#a91162c40d66f91e252411bbe9aa40fa7">calculateCrc</a>(packet);</div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="keywordflow">return</span> packet;</div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  </div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> }</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="classPacketHandler.html#ab3a4d597800dc113eee5ed1d50751eea"> 21</a></span> <span class="keywordtype">void</span> <a class="code" href="classPacketHandler.html#ab3a4d597800dc113eee5ed1d50751eea">PacketHandler::sendPacket</a>(<a class="code" href="structpacket__t.html">packet_t</a> p, <span class="keywordtype">int</span> port) {</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="comment">//cout <<"Send Packet Back";</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  vector<byte> serializedPacket;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  </div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> size= <span class="keyword">sizeof</span>(p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>)+p.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>.size(); <span class="comment">//get total packet size</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> b[64]; <span class="comment">//ready memory for byte array cast</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  memcpy(b, &p, <span class="keyword">sizeof</span>(p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>));<span class="comment">//copy header to first part of byte array</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  memcpy(b+ <span class="keyword">sizeof</span>(p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>), &p.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>[0], p.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>.size());<span class="comment">//copy header to first part of byte array</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="comment">//copy data content to remaining part of byte array</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  </div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="comment">//serializedPacket.push_back (0xFE); //ADD START BYTE</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="comment">//Byte Stuffing now done in PORT this isnt needed anymore?</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">for</span>( <span class="keywordtype">int</span> index=0; index<size; index++){</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  serializedPacket.push_back (b[index]);</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="comment">/*if (b[index]==0xFE){</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="comment"> serializedPacket.push_back (0xFE);</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="comment"> }else if(b[index]==0xFF){</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="comment"> serializedPacket.push_back (0xFF);</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="comment"> }*/</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  }</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  </div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="comment">//serializedPacket.push_back (0xFF); //ADD END BYTE(s)</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="comment">//serializedPacket.push_back(0xFE);</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <a class="code" href="classPort.html">Port</a>* transferPort = <a class="code" href="Comms_8h.html#a0ff970fd4e8e0bb79598a35a6e18956d">portList</a>[port];</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  transferPort-><a class="code" href="classPort.html#ad86a10e3c782699a8ec74f453b18f687">write</a>(serializedPacket);</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="comment">//std::cout <<"Printing byte stuffed packet1copy" <<endl;</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="comment">//for (std::vector<byte>::const_iterator i = serializedPacket.begin(); i != serializedPacket.end(); ++i)</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="comment">// cout << hex << int(*i) << ' ';</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  </div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> }</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classPacketHandler.html#a5b75909dd60779a0335f9deb2e9c089f"> 54</a></span> <span class="keywordtype">bool</span> <a class="code" href="classPacketHandler.html#a5b75909dd60779a0335f9deb2e9c089f">PacketHandler::crcCheck</a>(<a class="code" href="structpacket__t.html">packet_t</a> p) {</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  </div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <a class="code" href="structpacket__t.html">packet_t</a> pCopy = p;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  pCopy.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>.<a class="code" href="structpacket__header__t.html#a22d6a140609c7f68aad391d7873af870">crc</a>=0;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordflow">return</span> (p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>.<a class="code" href="structpacket__header__t.html#a22d6a140609c7f68aad391d7873af870">crc</a>==<a class="code" href="classPacketHandler.html#a91162c40d66f91e252411bbe9aa40fa7">calculateCrc</a>(pCopy));</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  </div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> }</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classPacketHandler.html#a91162c40d66f91e252411bbe9aa40fa7"> 63</a></span> <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> <a class="code" href="classPacketHandler.html#a91162c40d66f91e252411bbe9aa40fa7">PacketHandler::calculateCrc</a>(<a class="code" href="structpacket__t.html">packet_t</a> p) {</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="comment">// CRC8 calculator.</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Credit to Dallas/Maxim</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> crc = 0x00;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> size= <span class="keyword">sizeof</span>(p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>)+p.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>.size(); <span class="comment">//get total packet size</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> b[64]; <span class="comment">//ready memory for byte array cast</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  memcpy(b, &p, <span class="keyword">sizeof</span>(p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>));<span class="comment">//copy header to first part of byte array</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordtype">int</span> counter=<span class="keyword">sizeof</span>(p.<a class="code" href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packetHeader</a>);</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">for</span> (std::vector<byte>::const_iterator i = p.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>.begin(); i != p.<a class="code" href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">dataContent</a>.end(); ++i)</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  b[counter]=*i;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  counter++;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">//cout << "Getting data content size" << endl;</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="comment">//cout << hex << p.dataContent.size() << endl;</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> index = 0; index<size; index++) {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> extract = b[index];</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">for</span> (<a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> tempI = 8; tempI; tempI--) {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <a class="code" href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a> sum = (crc ^ extract) & 0x01;</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  crc >>= 1;</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordflow">if</span> (sum) {</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  crc ^= 0x8C;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  extract >>= 1;</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  }</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  }</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordflow">return</span> crc;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> }</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div>
<div class="ttc" id="classPort_html"><div class="ttname"><a href="classPort.html">Port</a></div><div class="ttdef"><b>Definition:</b> <a href="Port_8h_source.html#l00006">Port.h:6</a></div></div>
<div class="ttc" id="structpacket__header__t_html"><div class="ttname"><a href="structpacket__header__t.html">packet_header_t</a></div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00008">Types.h:8</a></div></div>
<div class="ttc" id="structpacket__t_html_a626c8d46c7bd16db808139063ecfb394"><div class="ttname"><a href="structpacket__t.html#a626c8d46c7bd16db808139063ecfb394">packet_t::dataContent</a></div><div class="ttdeci">vector< byte > dataContent</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00029">Types.h:29</a></div></div>
<div class="ttc" id="Comms_8h_html_a0ff970fd4e8e0bb79598a35a6e18956d"><div class="ttname"><a href="Comms_8h.html#a0ff970fd4e8e0bb79598a35a6e18956d">portList</a></div><div class="ttdeci">static vector< Port * > portList</div><div class="ttdef"><b>Definition:</b> <a href="Comms_8h_source.html#l00027">Comms.h:27</a></div></div>
<div class="ttc" id="PacketHandler_8h_html"><div class="ttname"><a href="PacketHandler_8h.html">PacketHandler.h</a></div></div>
<div class="ttc" id="structpacket__header__t_html_aad89b35b9fc679c656e400a544e1e85c"><div class="ttname"><a href="structpacket__header__t.html#aad89b35b9fc679c656e400a544e1e85c">packet_header_t::flags</a></div><div class="ttdeci">byte flags</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00010">Types.h:10</a></div></div>
<div class="ttc" id="classPacketHandler_html_ab3a4d597800dc113eee5ed1d50751eea"><div class="ttname"><a href="classPacketHandler.html#ab3a4d597800dc113eee5ed1d50751eea">PacketHandler::sendPacket</a></div><div class="ttdeci">void sendPacket(packet_t p, int port)</div><div class="ttdef"><b>Definition:</b> <a href="PacketHandler_8cpp_source.html#l00021">PacketHandler.cpp:21</a></div></div>
<div class="ttc" id="classPacketHandler_html_a5b75909dd60779a0335f9deb2e9c089f"><div class="ttname"><a href="classPacketHandler.html#a5b75909dd60779a0335f9deb2e9c089f">PacketHandler::crcCheck</a></div><div class="ttdeci">bool crcCheck(packet_t p)</div><div class="ttdef"><b>Definition:</b> <a href="PacketHandler_8cpp_source.html#l00054">PacketHandler.cpp:54</a></div></div>
<div class="ttc" id="classPacketHandler_html_a91162c40d66f91e252411bbe9aa40fa7"><div class="ttname"><a href="classPacketHandler.html#a91162c40d66f91e252411bbe9aa40fa7">PacketHandler::calculateCrc</a></div><div class="ttdeci">byte calculateCrc(packet_t p)</div><div class="ttdef"><b>Definition:</b> <a href="PacketHandler_8cpp_source.html#l00063">PacketHandler.cpp:63</a></div></div>
<div class="ttc" id="structpacket__header__t_html_aa3ba2fb72ec305ff3f50af606076e7ab"><div class="ttname"><a href="structpacket__header__t.html#aa3ba2fb72ec305ff3f50af606076e7ab">packet_header_t::targetService</a></div><div class="ttdeci">byte targetService</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00012">Types.h:12</a></div></div>
<div class="ttc" id="Types_8h_html_a0c8186d9b9b7880309c27230bbb5e69d"><div class="ttname"><a href="Types_8h.html#a0c8186d9b9b7880309c27230bbb5e69d">byte</a></div><div class="ttdeci">unsigned char byte</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00007">Types.h:7</a></div></div>
<div class="ttc" id="structpacket__header__t_html_ad9804ba95d7318a4bc6fa61810611d62"><div class="ttname"><a href="structpacket__header__t.html#ad9804ba95d7318a4bc6fa61810611d62">packet_header_t::packetID</a></div><div class="ttdeci">byte packetID</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00014">Types.h:14</a></div></div>
<div class="ttc" id="structpacket__header__t_html_a57e60ba4278dd9ed52c644649b6df4bc"><div class="ttname"><a href="structpacket__header__t.html#a57e60ba4278dd9ed52c644649b6df4bc">packet_header_t::sourceService</a></div><div class="ttdeci">byte sourceService</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00013">Types.h:13</a></div></div>
<div class="ttc" id="structpacket__header__t_html_aaee837dbf6105af66931e70c9932b0db"><div class="ttname"><a href="structpacket__header__t.html#aaee837dbf6105af66931e70c9932b0db">packet_header_t::messageID</a></div><div class="ttdeci">byte messageID</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00011">Types.h:11</a></div></div>
<div class="ttc" id="structpacket__header__t_html_a22d6a140609c7f68aad391d7873af870"><div class="ttname"><a href="structpacket__header__t.html#a22d6a140609c7f68aad391d7873af870">packet_header_t::crc</a></div><div class="ttdeci">byte crc</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00015">Types.h:15</a></div></div>
<div class="ttc" id="classPort_html_ad86a10e3c782699a8ec74f453b18f687"><div class="ttname"><a href="classPort.html#ad86a10e3c782699a8ec74f453b18f687">Port::write</a></div><div class="ttdeci">virtual void write(vector< byte > serializedPacket)=0</div><div class="ttdef"><b>Definition:</b> <a href="Port_8cpp_source.html#l00097">Port.cpp:97</a></div></div>
<div class="ttc" id="structpacket__t_html"><div class="ttname"><a href="structpacket__t.html">packet_t</a></div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00026">Types.h:26</a></div></div>
<div class="ttc" id="classPacketHandler_html_aa285a77edd54b686e7f66fbd5e77098e"><div class="ttname"><a href="classPacketHandler.html#aa285a77edd54b686e7f66fbd5e77098e">PacketHandler::createPacket</a></div><div class="ttdeci">packet_t createPacket(byte flags, byte messageID, byte packetID, byte targetService, byte sourceService, vector< byte > dataContent)</div><div class="ttdef"><b>Definition:</b> <a href="PacketHandler_8cpp_source.html#l00005">PacketHandler.cpp:5</a></div></div>
<div class="ttc" id="structpacket__t_html_a227ce0efe3df57733b0d1a0f7b61224e"><div class="ttname"><a href="structpacket__t.html#a227ce0efe3df57733b0d1a0f7b61224e">packet_t::packetHeader</a></div><div class="ttdeci">packet_header_t packetHeader</div><div class="ttdef"><b>Definition:</b> <a href="Types_8h_source.html#l00028">Types.h:28</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_bfccd401955b95cf8c75461437045ac0.html">inc</a></li><li class="navelem"><a class="el" href="PacketHandler_8cpp.html">PacketHandler.cpp</a></li>
<li class="footer">Generated on Thu May 4 2017 13:21:40 for Anansi by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
</ul>
</div>
</body>
</html>
| RHINO-VIP/RHINO-VIP.github.io | docs/html/PacketHandler_8cpp_source.html | HTML | mit | 29,080 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@extends('layout')
@section('css')
@endsection
@section('content')
<ol class="breadcrumb">
<li><a href="/">首页</a></li>
<li class="active">密码管理</li>
</ol>
<div class="row">
<div class="col-sm-12">
<div class="list-group">
@foreach($list AS $k => $v)
<a href="/password/{{ $v['id'] }}" class="list-group-item">
<span class="badge">{{ $v['badge'] }}</span>
{{ $v['name'] }}
</a>
@endforeach
@if(sizeof($list) < 1)
<a class="list-group-item">
<span class="badge">0</span>
无数据
</a>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<a href="/password/create" class="btn btn-primary btn-block">新建类别</a>
</div>
</div>
@endsection
@section('js')
@endsection | calchen/PIM | resources/views/password/index.blade.php | PHP | apache-2.0 | 1,047 | [
30522,
30524,
26775,
25438,
1000,
1028,
1026,
5622,
1028,
1026,
1037,
17850,
12879,
1027,
1000,
1013,
1000,
1028,
100,
100,
1026,
1013,
1037,
1028,
1026,
1013,
5622,
1028,
1026,
5622,
2465,
1027,
1000,
3161,
1000,
1028,
100,
100,
100,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Demo</title>
</head>
<body>
<p>
<input type="text" name="FirstName" value="enter Name here">
</p>
<input type="button" name="name" value="" >
<textarea name="name" rows="8" cols="40">this is text area</textarea>
<input type="radio" name="city" value="LOM">LOm
<input type="radio" name="city" value="Ruse"> ruse
<fieldset>
<input type="text" name="name" value="" pattern="[@^]" placeholder="enter some text">
<legend>legend</legend>
<input type="button" name="name" value="">
<input type="text" name="name" value="enter name">
</fieldset>
</body>
</html>
| nmarazov/TA-Homework | Courses 2016-spring/HTML/htmlDemo.html | HTML | mit | 661 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
16129,
9703,
1026,
1013,
2516,
1028,
1026,
1013,
2132,
1028,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
declare module ioc {
/**
* A base class for applications using an IOC Container
*/
abstract class ApplicationContext implements IApplicationContext {
/**
* A base class for applications using an IOC Container
* @param appName The name of your application
*/
constructor(appName: string);
/**
* A handle to access the ApplicationContext from anywhere in the application
*/
static applicationContext: IApplicationContext;
/**
* A method to override where you register your intances into the IOC Container
* @param container The IOC container created for this ApplicationContext
* @returns {}
*/
register(container: Container): void;
}
}
declare module ioc {
/**
* The IOC Container
*/
class Container {
private static container;
private registeredInstances;
private registeredScripts;
private appName;
/**
* The IOC Container
* @param appName The name of your application
* @param baseNamespace
*/
constructor(appName: string);
/**
* Get the currently assigned IOC Container
*/
static getCurrent(): Container;
/**
* Get the name of the ApplicationContext this IOC container is made from
*/
getAppName(): string;
/**
* Register an instance type
* @param type The full namespace of the type you want to instantiate
*/
register<T>(type: Function): InstanceRegistry<T>;
/**
* Resolve the registered Instance
* @param type The full namespace of the type you want to resolve
*/
resolve<T>(type: Function): T;
}
}
declare module ioc {
/**
* A helper class for aquiring animation methods
*/
class AnimationHelper {
/**
* Get the animationframe
* @param callback Function to call on AnimationFrame
*/
static getAnimationFrame(callback: FrameRequestCallback): number;
/**
* Cancel an animationFrameEvent
* @param requestId The handle of the event you want to cancel
*/
static cancelAnimationFrame(requestId: number): void;
}
}
declare module ioc {
interface IApplicationContext {
/**
* A method to override where you register your intances into the IOC Container
* @param container The IOC container created for this ApplicationContext
* @returns {}
*/
register(container: Container): void;
}
}
declare module ioc {
/**
* A base class for libraries using an IOC Container
* This is used to provide an easy way to register all the libraries components
*/
abstract class LibraryContext {
/**
* A method to override where you register your intances into the IOC Container
* @param container The IOC container created for the ApplicationContext of the using app
* @returns {}
*/
static register(container: Container): void;
}
}
declare module ioc {
interface IRegistryBase<T> {
/**
* Set the type of this Registry
* @param type The full type of the Instance you want to register
* @returns {}
*/
setType(type: Function): IRegistryBase<T>;
/**
* Return the Instance
* @returns {}
*/
getInstance(): T;
/**
* Get the type of this Registry
* @returns {}
*/
getType(): Function;
/**
* Set a function fo modify Instance that will be called directly after instantiating
* @param resolve The function to call when resolving
* @returns {}
*/
setResolveFunc(resolve: (instance: T) => T): IRegistryBase<T>;
/**
* Set a function to resolve the object in a different way than a parameterless constructor
* @param instantiate The function used to Instantiate the object
* @returns {}
*/
setInstantiateFunc(instantiate: () => T): IRegistryBase<T>;
/**
* Apply a lifetimescope to this Registry
* @param lifetime The lifetimescope to apply to
*/
setLifetimeScope(lifetime: LifetimeScope): IRegistryBase<T>;
}
}
declare module ioc {
/**
* Registry for standard Instances
*/
class InstanceRegistry<T> extends RegistryBase<T> {
protected lifeTimeScope: LifetimeScope;
protected callers: {
[key: string]: any;
};
/**
* Return the Instance
* @returns {}
*/
getInstance(): T;
/**
* Instantiate the object
*/
protected instantiate(): void;
/**
* Apply a lifetimescope to this Registry
* @param lifetime The lifetimescope to apply to
*/
setLifetimeScope(lifetime: LifetimeScope): IRegistryBase<T>;
}
}
declare module ioc {
/**
* The available lifetime scopes
*/
enum LifetimeScope {
/**
* Resolve everytime the Resolve is called
*/
PerResolveCall = 0,
/**
* Allow only one Instance of this type
*/
SingleInstance = 1,
/**
* Return only one Instance for every dependency
*/
PerDependency = 2,
}
}
declare module ioc {
/**
* A base class to provide basic functionality for al Registries
*/
class RegistryBase<T> implements IRegistryBase<T> {
protected type: Function;
protected object: any;
protected initiated: boolean;
protected loaded: boolean;
protected resolveFunc: (instance: T) => any;
protected instantiateFunc: () => T;
/**
* Return the Instance
* @returns {}
*/
getInstance(): T;
/**
* Get the type of this Registry
* @returns {}
*/
getType(): Function;
/**
* Set the type of this Registry
* @param type The full type of the Instance you want to register
* @returns {}
*/
setType(type: Function | T): IRegistryBase<T>;
/**
* Method to override that Instantiates the object
*/
protected instantiate(): void;
/**
* Set a function fo modify Instance that will be called directly after instantiating
* @param resolve The function to call when resolving
* @returns {}
*/
setResolveFunc(resolve: (instance: T) => T): IRegistryBase<T>;
/**
* Set a function to resolve the object in a different way than a parameterless constructor
* @param instantiate The function used to Instantiate the object
* @returns {}
*/
setInstantiateFunc(instantiate: () => T): IRegistryBase<T>;
/**
* Apply a lifetimescope to this Registry
* @param lifetime The lifetimescope to apply to
*/
setLifetimeScope(lifetime: LifetimeScope): IRegistryBase<T>;
}
}
//# sourceMappingURL=SIOCC-TS.d.ts.map | Marvin-Brouwer/QR-Redirect | Source/QR-Reader/Scripts/typings/SIOCC-TS.d.ts | TypeScript | apache-2.0 | 7,284 | [
30522,
13520,
11336,
25941,
1063,
1013,
1008,
1008,
1008,
1037,
2918,
2465,
2005,
5097,
2478,
2019,
25941,
11661,
1008,
1013,
10061,
2465,
4646,
8663,
18209,
22164,
24264,
9397,
19341,
3508,
8663,
18209,
1063,
1013,
1008,
1008,
1008,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* PS3 bootwrapper support.
*
* Copyright (C) 2007 Sony Computer Entertainment Inc.
* Copyright 2007 Sony Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <stddef.h>
#include "types.h"
#include "elf.h"
#include "string.h"
#include "stdio.h"
#include "page.h"
#include "ops.h"
extern int lv1_panic(u64 in_1);
extern int lv1_get_logical_partition_id(u64 *out_1);
extern int lv1_get_logical_ppe_id(u64 *out_1);
extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
u64 in_4, u64 in_5, u64 *out_1, u64 *out_2);
#ifdef DEBUG
#define DBG(fmt...) printf(fmt)
#else
static inline int __attribute__ ((format (printf, 1, 2))) DBG(
const char *fmt, ...) {return 0;}
#endif
BSS_STACK(4096);
/* A buffer that may be edited by tools operating on a zImage binary so as to
* edit the command line passed to vmlinux (by setting /chosen/bootargs).
* The buffer is put in it's own section so that tools may locate it easier.
*/
static char cmdline[COMMAND_LINE_SIZE]
__attribute__((__section__("__builtin_cmdline")));
static void prep_cmdline(void *chosen)
{
if (cmdline[0] == '\0')
getprop(chosen, "bootargs", cmdline, COMMAND_LINE_SIZE-1);
else
setprop_str(chosen, "bootargs", cmdline);
printf("cmdline: '%s'\n", cmdline);
}
static void ps3_console_write(const char *buf, int len)
{
}
static void ps3_exit(void)
{
printf("ps3_exit\n");
/* lv1_panic will shutdown the lpar. */
lv1_panic(0); /* zero = do not reboot */
while (1);
}
static int ps3_repository_read_rm_size(u64 *rm_size)
{
int result;
u64 lpar_id;
u64 ppe_id;
u64 v2;
result = lv1_get_logical_partition_id(&lpar_id);
if (result)
return -1;
result = lv1_get_logical_ppe_id(&ppe_id);
if (result)
return -1;
/*
* n1: 0000000062690000 : ....bi..
* n2: 7075000000000000 : pu......
* n3: 0000000000000001 : ........
* n4: 726d5f73697a6500 : rm_size.
*/
result = lv1_get_repository_node_value(lpar_id, 0x0000000062690000ULL,
0x7075000000000000ULL, ppe_id, 0x726d5f73697a6500ULL, rm_size,
&v2);
printf("%s:%d: ppe_id %lu \n", __func__, __LINE__,
(unsigned long)ppe_id);
printf("%s:%d: lpar_id %lu \n", __func__, __LINE__,
(unsigned long)lpar_id);
printf("%s:%d: rm_size %llxh \n", __func__, __LINE__, *rm_size);
return result ? -1 : 0;
}
void ps3_copy_vectors(void)
{
extern char __system_reset_kernel[];
memcpy((void *)0x100, __system_reset_kernel, 512);
flush_cache((void *)0x100, 512);
}
void platform_init(void)
{
const u32 heapsize = 0x1000000 - (u32)_end; /* 16MiB */
void *chosen;
unsigned long ft_addr;
u64 rm_size;
console_ops.write = ps3_console_write;
platform_ops.exit = ps3_exit;
printf("\n-- PS3 bootwrapper --\n");
simple_alloc_init(_end, heapsize, 32, 64);
fdt_init(_dtb_start);
chosen = finddevice("/chosen");
ps3_repository_read_rm_size(&rm_size);
dt_fixup_memory(0, rm_size);
if (_initrd_end > _initrd_start) {
setprop_val(chosen, "linux,initrd-start", (u32)(_initrd_start));
setprop_val(chosen, "linux,initrd-end", (u32)(_initrd_end));
}
prep_cmdline(chosen);
ft_addr = dt_ops.finalize();
ps3_copy_vectors();
printf(" flat tree at 0x%lx\n\r", ft_addr);
((kernel_entry_t)0)(ft_addr, 0, NULL);
ps3_exit();
}
| SlimRoms/kernel_cyanogen_msm8916 | arch/powerpc/boot/ps3.c | C | gpl-2.0 | 3,872 | [
30522,
1013,
1008,
1008,
8827,
2509,
9573,
13088,
29098,
2121,
2490,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
2289,
8412,
3274,
4024,
4297,
1012,
1008,
9385,
2289,
8412,
13058,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*******************************************************************************
* Copyright (c) 1998, 2013 Oracle and/or its affiliates, Frank Schwarz. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation from Oracle TopLink
* 08/20/2008-1.0.1 Nathan Beyer (Cerner)
* - 241308: Primary key is incorrectly assigned to embeddable class
* field with the same name as the primary key field's name
* 01/12/2009-1.1 Daniel Lo, Tom Ware, Guy Pelletier
* - 247041: Null element inserted in the ArrayList
* 07/17/2009 - tware - added tests for DDL generation of maps
* 01/22/2010-2.0.1 Guy Pelletier
* - 294361: incorrect generated table for element collection attribute overrides
* 06/14/2010-2.2 Guy Pelletier
* - 264417: Table generation is incorrect for JoinTables in AssociationOverrides
* 09/15/2010-2.2 Chris Delahunt
* - 322233 - AttributeOverrides and AssociationOverride dont change field type info
* 11/17/2010-2.2.0 Chris Delahunt
* - 214519: Allow appending strings to CREATE TABLE statements
* 11/23/2010-2.2 Frank Schwarz
* - 328774: TABLE_PER_CLASS-mapped key of a java.util.Map does not work for querying
* 01/04/2011-2.3 Guy Pelletier
* - 330628: @PrimaryKeyJoinColumn(...) is not working equivalently to @JoinColumn(..., insertable = false, updatable = false)
* 01/06/2011-2.3 Guy Pelletier
* - 312244: can't map optional one-to-one relationship using @PrimaryKeyJoinColumn
* 01/11/2011-2.3 Guy Pelletier
* - 277079: EmbeddedId's fields are null when using LOB with fetchtype LAZY
******************************************************************************/
package org.eclipse.persistence.testing.tests.jpa.ddlgeneration;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
import javax.persistence.EntityManager;
/**
* JUnit test case(s) for DDL generation.
*/
public class DDLTablePerClassTestSuite extends DDLGenerationJUnitTestSuite {
// This is the persistence unit name on server as for persistence unit name "ddlTablePerClass" in J2SE
private static final String DDL_TPC_PU = "MulitPU-2";
public DDLTablePerClassTestSuite() {
super();
}
public DDLTablePerClassTestSuite(String name) {
super(name);
setPuName(DDL_TPC_PU);
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.setName("DDLTablePerClassTestSuite");
suite.addTest(new DDLTablePerClassTestSuite("testSetup"));
suite.addTest(new DDLTablePerClassTestSuite("testDDLTablePerClassModel"));
suite.addTest(new DDLTablePerClassTestSuite("testDDLTablePerClassModelQuery"));
if (! JUnitTestCase.isJPA10()) {
suite.addTest(new DDLTablePerClassTestSuite("testTPCMappedKeyMapQuery"));
}
return suite;
}
/**
* The setup is done as a test, both to record its failure, and to allow execution in the server.
*/
public void testSetup() {
// Trigger DDL generation
EntityManager emDDLTPC = createEntityManager("MulitPU-2");
closeEntityManager(emDDLTPC);
clearCache(DDL_TPC_PU);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}
| bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs | jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/ddlgeneration/DDLTablePerClassTestSuite.java | Java | epl-1.0 | 3,927 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>statsmodels.sandbox.regression.try_catdata.groupsstats_1d — statsmodels 0.6.1 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.6.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="top" title="statsmodels 0.6.1 documentation" href="../index.html" />
<link rel="up" title="Sandbox" href="../sandbox.html" />
<link rel="next" title="statsmodels.sandbox.regression.try_catdata.groupsstats_dummy" href="statsmodels.sandbox.regression.try_catdata.groupsstats_dummy.html" />
<link rel="prev" title="statsmodels.sandbox.regression.try_catdata.convertlabels" href="statsmodels.sandbox.regression.try_catdata.convertlabels.html" />
<link rel="stylesheet" href="../../_static/facebox.css" type="text/css" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
</head>
<body role="document">
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="statsmodels.sandbox.regression.try_catdata.groupsstats_dummy.html" title="statsmodels.sandbox.regression.try_catdata.groupsstats_dummy"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.sandbox.regression.try_catdata.convertlabels.html" title="statsmodels.sandbox.regression.try_catdata.convertlabels"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/group/pystatsmodels?hl=en">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../sandbox.html" accesskey="U">Sandbox</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-sandbox-regression-try-catdata-groupsstats-1d">
<h1>statsmodels.sandbox.regression.try_catdata.groupsstats_1d<a class="headerlink" href="#statsmodels-sandbox-regression-try-catdata-groupsstats-1d" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="statsmodels.sandbox.regression.try_catdata.groupsstats_1d">
<code class="descclassname">statsmodels.sandbox.regression.try_catdata.</code><code class="descname">groupsstats_1d</code><span class="sig-paren">(</span><em>y</em>, <em>x</em>, <em>labelsunique</em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/statsmodels/sandbox/regression/try_catdata.html#groupsstats_1d"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#statsmodels.sandbox.regression.try_catdata.groupsstats_1d" title="Permalink to this definition">¶</a></dt>
<dd><p>use ndimage to get fast mean and variance</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.sandbox.regression.try_catdata.convertlabels.html"
title="previous chapter">statsmodels.sandbox.regression.try_catdata.convertlabels</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.sandbox.regression.try_catdata.groupsstats_dummy.html"
title="next chapter">statsmodels.sandbox.regression.try_catdata.groupsstats_dummy</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.sandbox.regression.try_catdata.groupsstats_1d.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2013, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
</div>
</body>
</html> | statsmodels/statsmodels.github.io | 0.6.1/generated/statsmodels.sandbox.regression.try_catdata.groupsstats_1d.html | HTML | bsd-3-clause | 6,362 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$(document).ready(function(){
var oldAction = $('#comment-form').attr("action");
hljs.initHighlightingOnLoad();
$('#coolness div').hover(function(){
$('#coolness .second').fadeOut(500);
}, function(){
$('#coolness .second').fadeIn(1000).stop(false, true);
});
$(".reply a").click(function() {
var add = this.className;
var action = oldAction + '/' + add;
$("#comment-form").attr("action", action);
console.log($('#comment-form').attr("action"));
});
});
| mzj/yabb | src/MZJ/YabBundle/Resources/public/js/bootstrap.js | JavaScript | mit | 683 | [
30522,
1013,
1008,
1008,
2000,
2689,
2023,
23561,
1010,
5454,
5906,
1064,
23561,
2015,
1008,
1998,
2330,
1996,
23561,
1999,
1996,
3559,
1012,
1008,
1013,
1002,
1006,
6254,
1007,
1012,
3201,
1006,
3853,
1006,
1007,
1063,
13075,
2214,
18908,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# *****************************************************************
# Copyright (c) 2013 Massachusetts Institute of Technology
#
# Developed exclusively at US Government expense under US Air Force contract
# FA8721-05-C-002. The rights of the United States Government to use, modify,
# reproduce, release, perform, display or disclose this computer software and
# computer software documentation in whole or in part, in any manner and for
# any purpose whatsoever, and to have or authorize others to do so, are
# Unrestricted and Unlimited.
#
# Licensed for use under the BSD License as described in the BSD-LICENSE.txt
# file in the root directory of this release.
#
# Project: SPAR
# Authors: SY
# Description: IBM TA2 wire class
#
# Modifications:
# Date Name Modification
# ---- ---- ------------
# 22 Oct 2012 SY Original Version
# *****************************************************************
import ibm_circuit_object as ico
class IBMInputWire(ico.IBMCircuitObject):
"""
This class represents a single IBM input wire.
"""
def __init__(self, displayname, circuit):
"""Initializes the wire with the display name and circuit specified."""
ico.IBMCircuitObject.__init__(self, displayname, 0.0, 0, circuit)
| y4n9squared/HEtest | hetest/python/circuit_generation/ibm/ibm_wire.py | Python | bsd-2-clause | 1,345 | [
30522,
1001,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import absolute_import, division, print_function
# note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
from __future__ import with_statement
import pickle
import os
import sys
from io import UnsupportedOperation
import _pytest._code
import py
import pytest
import contextlib
from _pytest import capture
from _pytest.capture import CaptureManager
from _pytest.main import EXIT_NOTESTSCOLLECTED
needsosdup = pytest.mark.xfail("not hasattr(os, 'dup')")
if sys.version_info >= (3, 0):
def tobytes(obj):
if isinstance(obj, str):
obj = obj.encode('UTF-8')
assert isinstance(obj, bytes)
return obj
def totext(obj):
if isinstance(obj, bytes):
obj = str(obj, 'UTF-8')
assert isinstance(obj, str)
return obj
else:
def tobytes(obj):
if isinstance(obj, unicode):
obj = obj.encode('UTF-8')
assert isinstance(obj, str)
return obj
def totext(obj):
if isinstance(obj, str):
obj = unicode(obj, 'UTF-8')
assert isinstance(obj, unicode)
return obj
def oswritebytes(fd, obj):
os.write(fd, tobytes(obj))
def StdCaptureFD(out=True, err=True, in_=True):
return capture.MultiCapture(out, err, in_, Capture=capture.FDCapture)
def StdCapture(out=True, err=True, in_=True):
return capture.MultiCapture(out, err, in_, Capture=capture.SysCapture)
class TestCaptureManager(object):
def test_getmethod_default_no_fd(self, monkeypatch):
from _pytest.capture import pytest_addoption
from _pytest.config import Parser
parser = Parser()
pytest_addoption(parser)
default = parser._groups[0].options[0].default
assert default == "fd" if hasattr(os, "dup") else "sys"
parser = Parser()
monkeypatch.delattr(os, 'dup', raising=False)
pytest_addoption(parser)
assert parser._groups[0].options[0].default == "sys"
@needsosdup
@pytest.mark.parametrize("method",
['no', 'sys', pytest.mark.skipif('not hasattr(os, "dup")', 'fd')])
def test_capturing_basic_api(self, method):
capouter = StdCaptureFD()
old = sys.stdout, sys.stderr, sys.stdin
try:
capman = CaptureManager(method)
capman.start_global_capturing()
outerr = capman.suspend_global_capture()
assert outerr == ("", "")
outerr = capman.suspend_global_capture()
assert outerr == ("", "")
print("hello")
out, err = capman.suspend_global_capture()
if method == "no":
assert old == (sys.stdout, sys.stderr, sys.stdin)
else:
assert not out
capman.resume_global_capture()
print("hello")
out, err = capman.suspend_global_capture()
if method != "no":
assert out == "hello\n"
capman.stop_global_capturing()
finally:
capouter.stop_capturing()
@needsosdup
def test_init_capturing(self):
capouter = StdCaptureFD()
try:
capman = CaptureManager("fd")
capman.start_global_capturing()
pytest.raises(AssertionError, "capman.start_global_capturing()")
capman.stop_global_capturing()
finally:
capouter.stop_capturing()
@pytest.mark.parametrize("method", ['fd', 'sys'])
def test_capturing_unicode(testdir, method):
if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2, 2):
pytest.xfail("does not work on pypy < 2.2")
if sys.version_info >= (3, 0):
obj = "'b\u00f6y'"
else:
obj = "u'\u00f6y'"
testdir.makepyfile("""
# coding=utf8
# taken from issue 227 from nosetests
def test_unicode():
import sys
print (sys.stdout)
print (%s)
""" % obj)
result = testdir.runpytest("--capture=%s" % method)
result.stdout.fnmatch_lines([
"*1 passed*"
])
@pytest.mark.parametrize("method", ['fd', 'sys'])
def test_capturing_bytes_in_utf8_encoding(testdir, method):
testdir.makepyfile("""
def test_unicode():
print ('b\\u00f6y')
""")
result = testdir.runpytest("--capture=%s" % method)
result.stdout.fnmatch_lines([
"*1 passed*"
])
def test_collect_capturing(testdir):
p = testdir.makepyfile("""
print ("collect %s failure" % 13)
import xyz42123
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*Captured stdout*",
"*collect 13 failure*",
])
class TestPerTestCapturing(object):
def test_capture_and_fixtures(self, testdir):
p = testdir.makepyfile("""
def setup_module(mod):
print ("setup module")
def setup_function(function):
print ("setup " + function.__name__)
def test_func1():
print ("in func1")
assert 0
def test_func2():
print ("in func2")
assert 0
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"setup module*",
"setup test_func1*",
"in func1*",
"setup test_func2*",
"in func2*",
])
@pytest.mark.xfail(reason="unimplemented feature")
def test_capture_scope_cache(self, testdir):
p = testdir.makepyfile("""
import sys
def setup_module(func):
print ("module-setup")
def setup_function(func):
print ("function-setup")
def test_func():
print ("in function")
assert 0
def teardown_function(func):
print ("in teardown")
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*test_func():*",
"*Captured stdout during setup*",
"module-setup*",
"function-setup*",
"*Captured stdout*",
"in teardown*",
])
def test_no_carry_over(self, testdir):
p = testdir.makepyfile("""
def test_func1():
print ("in func1")
def test_func2():
print ("in func2")
assert 0
""")
result = testdir.runpytest(p)
s = result.stdout.str()
assert "in func1" not in s
assert "in func2" in s
def test_teardown_capturing(self, testdir):
p = testdir.makepyfile("""
def setup_function(function):
print ("setup func1")
def teardown_function(function):
print ("teardown func1")
assert 0
def test_func1():
print ("in func1")
pass
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
'*teardown_function*',
'*Captured stdout*',
"setup func1*",
"in func1*",
"teardown func1*",
# "*1 fixture failure*"
])
def test_teardown_capturing_final(self, testdir):
p = testdir.makepyfile("""
def teardown_module(mod):
print ("teardown module")
assert 0
def test_func():
pass
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*def teardown_module(mod):*",
"*Captured stdout*",
"*teardown module*",
"*1 error*",
])
def test_capturing_outerr(self, testdir):
p1 = testdir.makepyfile("""
import sys
def test_capturing():
print (42)
sys.stderr.write(str(23))
def test_capturing_error():
print (1)
sys.stderr.write(str(2))
raise ValueError
""")
result = testdir.runpytest(p1)
result.stdout.fnmatch_lines([
"*test_capturing_outerr.py .F*",
"====* FAILURES *====",
"____*____",
"*test_capturing_outerr.py:8: ValueError",
"*--- Captured stdout *call*",
"1",
"*--- Captured stderr *call*",
"2",
])
class TestLoggingInteraction(object):
def test_logging_stream_ownership(self, testdir):
p = testdir.makepyfile("""
def test_logging():
import logging
import pytest
stream = capture.CaptureIO()
logging.basicConfig(stream=stream)
stream.close() # to free memory/release resources
""")
result = testdir.runpytest_subprocess(p)
assert result.stderr.str().find("atexit") == -1
def test_logging_and_immediate_setupteardown(self, testdir):
p = testdir.makepyfile("""
import logging
def setup_function(function):
logging.warn("hello1")
def test_logging():
logging.warn("hello2")
assert 0
def teardown_function(function):
logging.warn("hello3")
assert 0
""")
for optargs in (('--capture=sys',), ('--capture=fd',)):
print(optargs)
result = testdir.runpytest_subprocess(p, *optargs)
s = result.stdout.str()
result.stdout.fnmatch_lines([
"*WARN*hello3", # errors show first!
"*WARN*hello1",
"*WARN*hello2",
])
# verify proper termination
assert "closed" not in s
def test_logging_and_crossscope_fixtures(self, testdir):
p = testdir.makepyfile("""
import logging
def setup_module(function):
logging.warn("hello1")
def test_logging():
logging.warn("hello2")
assert 0
def teardown_module(function):
logging.warn("hello3")
assert 0
""")
for optargs in (('--capture=sys',), ('--capture=fd',)):
print(optargs)
result = testdir.runpytest_subprocess(p, *optargs)
s = result.stdout.str()
result.stdout.fnmatch_lines([
"*WARN*hello3", # errors come first
"*WARN*hello1",
"*WARN*hello2",
])
# verify proper termination
assert "closed" not in s
def test_conftestlogging_is_shown(self, testdir):
testdir.makeconftest("""
import logging
logging.basicConfig()
logging.warn("hello435")
""")
# make sure that logging is still captured in tests
result = testdir.runpytest_subprocess("-s", "-p", "no:capturelog")
assert result.ret == EXIT_NOTESTSCOLLECTED
result.stderr.fnmatch_lines([
"WARNING*hello435*",
])
assert 'operation on closed file' not in result.stderr.str()
def test_conftestlogging_and_test_logging(self, testdir):
testdir.makeconftest("""
import logging
logging.basicConfig()
""")
# make sure that logging is still captured in tests
p = testdir.makepyfile("""
def test_hello():
import logging
logging.warn("hello433")
assert 0
""")
result = testdir.runpytest_subprocess(p, "-p", "no:capturelog")
assert result.ret != 0
result.stdout.fnmatch_lines([
"WARNING*hello433*",
])
assert 'something' not in result.stderr.str()
assert 'operation on closed file' not in result.stderr.str()
class TestCaptureFixture(object):
@pytest.mark.parametrize("opt", [[], ["-s"]])
def test_std_functional(self, testdir, opt):
reprec = testdir.inline_runsource("""
def test_hello(capsys):
print (42)
out, err = capsys.readouterr()
assert out.startswith("42")
""", *opt)
reprec.assertoutcome(passed=1)
def test_capsyscapfd(self, testdir):
p = testdir.makepyfile("""
def test_one(capsys, capfd):
pass
def test_two(capfd, capsys):
pass
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*ERROR*setup*test_one*",
"E*capfd*capsys*same*time*",
"*ERROR*setup*test_two*",
"E*capsys*capfd*same*time*",
"*2 error*"])
def test_capturing_getfixturevalue(self, testdir):
"""Test that asking for "capfd" and "capsys" using request.getfixturevalue
in the same test is an error.
"""
testdir.makepyfile("""
def test_one(capsys, request):
request.getfixturevalue("capfd")
def test_two(capfd, request):
request.getfixturevalue("capsys")
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines([
"*test_one*",
"*capsys*capfd*same*time*",
"*test_two*",
"*capfd*capsys*same*time*",
"*2 failed in*",
])
def test_capsyscapfdbinary(self, testdir):
p = testdir.makepyfile("""
def test_one(capsys, capfdbinary):
pass
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*ERROR*setup*test_one*",
"E*capfdbinary*capsys*same*time*",
"*1 error*"])
@pytest.mark.parametrize("method", ["sys", "fd"])
def test_capture_is_represented_on_failure_issue128(self, testdir, method):
p = testdir.makepyfile("""
def test_hello(cap%s):
print ("xxx42xxx")
assert 0
""" % method)
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"xxx42xxx",
])
@needsosdup
def test_stdfd_functional(self, testdir):
reprec = testdir.inline_runsource("""
def test_hello(capfd):
import os
os.write(1, "42".encode('ascii'))
out, err = capfd.readouterr()
assert out.startswith("42")
capfd.close()
""")
reprec.assertoutcome(passed=1)
@needsosdup
def test_capfdbinary(self, testdir):
reprec = testdir.inline_runsource("""
def test_hello(capfdbinary):
import os
# some likely un-decodable bytes
os.write(1, b'\\xfe\\x98\\x20')
out, err = capfdbinary.readouterr()
assert out == b'\\xfe\\x98\\x20'
assert err == b''
""")
reprec.assertoutcome(passed=1)
@pytest.mark.skipif(
sys.version_info < (3,),
reason='only have capsysbinary in python 3',
)
def test_capsysbinary(self, testdir):
reprec = testdir.inline_runsource("""
def test_hello(capsysbinary):
import sys
# some likely un-decodable bytes
sys.stdout.buffer.write(b'\\xfe\\x98\\x20')
out, err = capsysbinary.readouterr()
assert out == b'\\xfe\\x98\\x20'
assert err == b''
""")
reprec.assertoutcome(passed=1)
@pytest.mark.skipif(
sys.version_info >= (3,),
reason='only have capsysbinary in python 3',
)
def test_capsysbinary_forbidden_in_python2(self, testdir):
testdir.makepyfile("""
def test_hello(capsysbinary):
pass
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines([
"*test_hello*",
"*capsysbinary is only supported on python 3*",
"*1 error in*",
])
def test_partial_setup_failure(self, testdir):
p = testdir.makepyfile("""
def test_hello(capsys, missingarg):
pass
""")
result = testdir.runpytest(p)
result.stdout.fnmatch_lines([
"*test_partial_setup_failure*",
"*1 error*",
])
@needsosdup
def test_keyboardinterrupt_disables_capturing(self, testdir):
p = testdir.makepyfile("""
def test_hello(capfd):
import os
os.write(1, str(42).encode('ascii'))
raise KeyboardInterrupt()
""")
result = testdir.runpytest_subprocess(p)
result.stdout.fnmatch_lines([
"*KeyboardInterrupt*"
])
assert result.ret == 2
@pytest.mark.issue14
def test_capture_and_logging(self, testdir):
p = testdir.makepyfile("""
import logging
def test_log(capsys):
logging.error('x')
""")
result = testdir.runpytest_subprocess(p)
assert 'closed' not in result.stderr.str()
@pytest.mark.parametrize('fixture', ['capsys', 'capfd'])
@pytest.mark.parametrize('no_capture', [True, False])
def test_disabled_capture_fixture(self, testdir, fixture, no_capture):
testdir.makepyfile("""
def test_disabled({fixture}):
print('captured before')
with {fixture}.disabled():
print('while capture is disabled')
print('captured after')
assert {fixture}.readouterr() == ('captured before\\ncaptured after\\n', '')
def test_normal():
print('test_normal executed')
""".format(fixture=fixture))
args = ('-s',) if no_capture else ()
result = testdir.runpytest_subprocess(*args)
result.stdout.fnmatch_lines("""
*while capture is disabled*
""")
assert 'captured before' not in result.stdout.str()
assert 'captured after' not in result.stdout.str()
if no_capture:
assert 'test_normal executed' in result.stdout.str()
else:
assert 'test_normal executed' not in result.stdout.str()
@pytest.mark.parametrize('fixture', ['capsys', 'capfd'])
def test_fixture_use_by_other_fixtures(self, testdir, fixture):
"""
Ensure that capsys and capfd can be used by other fixtures during setup and teardown.
"""
testdir.makepyfile("""
from __future__ import print_function
import sys
import pytest
@pytest.fixture
def captured_print({fixture}):
print('stdout contents begin')
print('stderr contents begin', file=sys.stderr)
out, err = {fixture}.readouterr()
yield out, err
print('stdout contents end')
print('stderr contents end', file=sys.stderr)
out, err = {fixture}.readouterr()
assert out == 'stdout contents end\\n'
assert err == 'stderr contents end\\n'
def test_captured_print(captured_print):
out, err = captured_print
assert out == 'stdout contents begin\\n'
assert err == 'stderr contents begin\\n'
""".format(fixture=fixture))
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines("*1 passed*")
assert 'stdout contents begin' not in result.stdout.str()
assert 'stderr contents begin' not in result.stdout.str()
def test_setup_failure_does_not_kill_capturing(testdir):
sub1 = testdir.mkpydir("sub1")
sub1.join("conftest.py").write(_pytest._code.Source("""
def pytest_runtest_setup(item):
raise ValueError(42)
"""))
sub1.join("test_mod.py").write("def test_func1(): pass")
result = testdir.runpytest(testdir.tmpdir, '--traceconfig')
result.stdout.fnmatch_lines([
"*ValueError(42)*",
"*1 error*"
])
def test_fdfuncarg_skips_on_no_osdup(testdir):
testdir.makepyfile("""
import os
if hasattr(os, 'dup'):
del os.dup
def test_hello(capfd):
pass
""")
result = testdir.runpytest_subprocess("--capture=no")
result.stdout.fnmatch_lines([
"*1 skipped*"
])
def test_capture_conftest_runtest_setup(testdir):
testdir.makeconftest("""
def pytest_runtest_setup():
print ("hello19")
""")
testdir.makepyfile("def test_func(): pass")
result = testdir.runpytest()
assert result.ret == 0
assert 'hello19' not in result.stdout.str()
def test_capture_badoutput_issue412(testdir):
testdir.makepyfile("""
import os
def test_func():
omg = bytearray([1,129,1])
os.write(1, omg)
assert 0
""")
result = testdir.runpytest('--cap=fd')
result.stdout.fnmatch_lines('''
*def test_func*
*assert 0*
*Captured*
*1 failed*
''')
def test_capture_early_option_parsing(testdir):
testdir.makeconftest("""
def pytest_runtest_setup():
print ("hello19")
""")
testdir.makepyfile("def test_func(): pass")
result = testdir.runpytest("-vs")
assert result.ret == 0
assert 'hello19' in result.stdout.str()
def test_capture_binary_output(testdir):
testdir.makepyfile(r"""
import pytest
def test_a():
import sys
import subprocess
subprocess.call([sys.executable, __file__])
def test_foo():
import os;os.write(1, b'\xc3')
if __name__ == '__main__':
test_foo()
""")
result = testdir.runpytest('--assert=plain')
result.assert_outcomes(passed=2)
def test_error_during_readouterr(testdir):
"""Make sure we suspend capturing if errors occur during readouterr"""
testdir.makepyfile(pytest_xyz="""
from _pytest.capture import FDCapture
def bad_snap(self):
raise Exception('boom')
assert FDCapture.snap
FDCapture.snap = bad_snap
""")
result = testdir.runpytest_subprocess(
"-p", "pytest_xyz", "--version", syspathinsert=True
)
result.stderr.fnmatch_lines([
"*in bad_snap",
" raise Exception('boom')",
"Exception: boom",
])
class TestCaptureIO(object):
def test_text(self):
f = capture.CaptureIO()
f.write("hello")
s = f.getvalue()
assert s == "hello"
f.close()
def test_unicode_and_str_mixture(self):
f = capture.CaptureIO()
if sys.version_info >= (3, 0):
f.write("\u00f6")
pytest.raises(TypeError, "f.write(bytes('hello', 'UTF-8'))")
else:
f.write(unicode("\u00f6", 'UTF-8'))
f.write("hello") # bytes
s = f.getvalue()
f.close()
assert isinstance(s, unicode)
@pytest.mark.skipif(
sys.version_info[0] == 2,
reason='python 3 only behaviour',
)
def test_write_bytes_to_buffer(self):
"""In python3, stdout / stderr are text io wrappers (exposing a buffer
property of the underlying bytestream). See issue #1407
"""
f = capture.CaptureIO()
f.buffer.write(b'foo\r\n')
assert f.getvalue() == 'foo\r\n'
def test_bytes_io():
f = py.io.BytesIO()
f.write(tobytes("hello"))
pytest.raises(TypeError, "f.write(totext('hello'))")
s = f.getvalue()
assert s == tobytes("hello")
def test_dontreadfrominput():
from _pytest.capture import DontReadFromInput
f = DontReadFromInput()
assert not f.isatty()
pytest.raises(IOError, f.read)
pytest.raises(IOError, f.readlines)
pytest.raises(IOError, iter, f)
pytest.raises(UnsupportedOperation, f.fileno)
f.close() # just for completeness
@pytest.mark.skipif('sys.version_info < (3,)', reason='python2 has no buffer')
def test_dontreadfrominput_buffer_python3():
from _pytest.capture import DontReadFromInput
f = DontReadFromInput()
fb = f.buffer
assert not fb.isatty()
pytest.raises(IOError, fb.read)
pytest.raises(IOError, fb.readlines)
pytest.raises(IOError, iter, fb)
pytest.raises(ValueError, fb.fileno)
f.close() # just for completeness
@pytest.mark.skipif('sys.version_info >= (3,)', reason='python2 has no buffer')
def test_dontreadfrominput_buffer_python2():
from _pytest.capture import DontReadFromInput
f = DontReadFromInput()
with pytest.raises(AttributeError):
f.buffer
f.close() # just for completeness
@pytest.yield_fixture
def tmpfile(testdir):
f = testdir.makepyfile("").open('wb+')
yield f
if not f.closed:
f.close()
@needsosdup
def test_dupfile(tmpfile):
flist = []
for i in range(5):
nf = capture.safe_text_dupfile(tmpfile, "wb")
assert nf != tmpfile
assert nf.fileno() != tmpfile.fileno()
assert nf not in flist
print(i, end="", file=nf)
flist.append(nf)
fname_open = flist[0].name
assert fname_open == repr(flist[0].buffer)
for i in range(5):
f = flist[i]
f.close()
fname_closed = flist[0].name
assert fname_closed == repr(flist[0].buffer)
assert fname_closed != fname_open
tmpfile.seek(0)
s = tmpfile.read()
assert "01234" in repr(s)
tmpfile.close()
assert fname_closed == repr(flist[0].buffer)
def test_dupfile_on_bytesio():
io = py.io.BytesIO()
f = capture.safe_text_dupfile(io, "wb")
f.write("hello")
assert io.getvalue() == b"hello"
assert 'BytesIO object' in f.name
def test_dupfile_on_textio():
io = py.io.TextIO()
f = capture.safe_text_dupfile(io, "wb")
f.write("hello")
assert io.getvalue() == "hello"
assert not hasattr(f, 'name')
@contextlib.contextmanager
def lsof_check():
pid = os.getpid()
try:
out = py.process.cmdexec("lsof -p %d" % pid)
except (py.process.cmdexec.Error, UnicodeDecodeError):
# about UnicodeDecodeError, see note on pytester
pytest.skip("could not run 'lsof'")
yield
out2 = py.process.cmdexec("lsof -p %d" % pid)
len1 = len([x for x in out.split("\n") if "REG" in x])
len2 = len([x for x in out2.split("\n") if "REG" in x])
assert len2 < len1 + 3, out2
class TestFDCapture(object):
pytestmark = needsosdup
def test_simple(self, tmpfile):
fd = tmpfile.fileno()
cap = capture.FDCapture(fd)
data = tobytes("hello")
os.write(fd, data)
s = cap.snap()
cap.done()
assert not s
cap = capture.FDCapture(fd)
cap.start()
os.write(fd, data)
s = cap.snap()
cap.done()
assert s == "hello"
def test_simple_many(self, tmpfile):
for i in range(10):
self.test_simple(tmpfile)
def test_simple_many_check_open_files(self, testdir):
with lsof_check():
with testdir.makepyfile("").open('wb+') as tmpfile:
self.test_simple_many(tmpfile)
def test_simple_fail_second_start(self, tmpfile):
fd = tmpfile.fileno()
cap = capture.FDCapture(fd)
cap.done()
pytest.raises(ValueError, cap.start)
def test_stderr(self):
cap = capture.FDCapture(2)
cap.start()
print("hello", file=sys.stderr)
s = cap.snap()
cap.done()
assert s == "hello\n"
def test_stdin(self, tmpfile):
cap = capture.FDCapture(0)
cap.start()
x = os.read(0, 100).strip()
cap.done()
assert x == tobytes('')
def test_writeorg(self, tmpfile):
data1, data2 = tobytes("foo"), tobytes("bar")
cap = capture.FDCapture(tmpfile.fileno())
cap.start()
tmpfile.write(data1)
tmpfile.flush()
cap.writeorg(data2)
scap = cap.snap()
cap.done()
assert scap == totext(data1)
with open(tmpfile.name, 'rb') as stmp_file:
stmp = stmp_file.read()
assert stmp == data2
def test_simple_resume_suspend(self, tmpfile):
with saved_fd(1):
cap = capture.FDCapture(1)
cap.start()
data = tobytes("hello")
os.write(1, data)
sys.stdout.write("whatever")
s = cap.snap()
assert s == "hellowhatever"
cap.suspend()
os.write(1, tobytes("world"))
sys.stdout.write("qlwkej")
assert not cap.snap()
cap.resume()
os.write(1, tobytes("but now"))
sys.stdout.write(" yes\n")
s = cap.snap()
assert s == "but now yes\n"
cap.suspend()
cap.done()
pytest.raises(AttributeError, cap.suspend)
@contextlib.contextmanager
def saved_fd(fd):
new_fd = os.dup(fd)
try:
yield
finally:
os.dup2(new_fd, fd)
os.close(new_fd)
class TestStdCapture(object):
captureclass = staticmethod(StdCapture)
@contextlib.contextmanager
def getcapture(self, **kw):
cap = self.__class__.captureclass(**kw)
cap.start_capturing()
try:
yield cap
finally:
cap.stop_capturing()
def test_capturing_done_simple(self):
with self.getcapture() as cap:
sys.stdout.write("hello")
sys.stderr.write("world")
out, err = cap.readouterr()
assert out == "hello"
assert err == "world"
def test_capturing_reset_simple(self):
with self.getcapture() as cap:
print("hello world")
sys.stderr.write("hello error\n")
out, err = cap.readouterr()
assert out == "hello world\n"
assert err == "hello error\n"
def test_capturing_readouterr(self):
with self.getcapture() as cap:
print("hello world")
sys.stderr.write("hello error\n")
out, err = cap.readouterr()
assert out == "hello world\n"
assert err == "hello error\n"
sys.stderr.write("error2")
out, err = cap.readouterr()
assert err == "error2"
def test_capture_results_accessible_by_attribute(self):
with self.getcapture() as cap:
sys.stdout.write("hello")
sys.stderr.write("world")
capture_result = cap.readouterr()
assert capture_result.out == "hello"
assert capture_result.err == "world"
def test_capturing_readouterr_unicode(self):
with self.getcapture() as cap:
print("hx\xc4\x85\xc4\x87")
out, err = cap.readouterr()
assert out == py.builtin._totext("hx\xc4\x85\xc4\x87\n", "utf8")
@pytest.mark.skipif('sys.version_info >= (3,)',
reason='text output different for bytes on python3')
def test_capturing_readouterr_decode_error_handling(self):
with self.getcapture() as cap:
# triggered a internal error in pytest
print('\xa6')
out, err = cap.readouterr()
assert out == py.builtin._totext('\ufffd\n', 'unicode-escape')
def test_reset_twice_error(self):
with self.getcapture() as cap:
print("hello")
out, err = cap.readouterr()
pytest.raises(ValueError, cap.stop_capturing)
assert out == "hello\n"
assert not err
def test_capturing_modify_sysouterr_in_between(self):
oldout = sys.stdout
olderr = sys.stderr
with self.getcapture() as cap:
sys.stdout.write("hello")
sys.stderr.write("world")
sys.stdout = capture.CaptureIO()
sys.stderr = capture.CaptureIO()
print("not seen")
sys.stderr.write("not seen\n")
out, err = cap.readouterr()
assert out == "hello"
assert err == "world"
assert sys.stdout == oldout
assert sys.stderr == olderr
def test_capturing_error_recursive(self):
with self.getcapture() as cap1:
print("cap1")
with self.getcapture() as cap2:
print("cap2")
out2, err2 = cap2.readouterr()
out1, err1 = cap1.readouterr()
assert out1 == "cap1\n"
assert out2 == "cap2\n"
def test_just_out_capture(self):
with self.getcapture(out=True, err=False) as cap:
sys.stdout.write("hello")
sys.stderr.write("world")
out, err = cap.readouterr()
assert out == "hello"
assert not err
def test_just_err_capture(self):
with self.getcapture(out=False, err=True) as cap:
sys.stdout.write("hello")
sys.stderr.write("world")
out, err = cap.readouterr()
assert err == "world"
assert not out
def test_stdin_restored(self):
old = sys.stdin
with self.getcapture(in_=True):
newstdin = sys.stdin
assert newstdin != sys.stdin
assert sys.stdin is old
def test_stdin_nulled_by_default(self):
print("XXX this test may well hang instead of crashing")
print("XXX which indicates an error in the underlying capturing")
print("XXX mechanisms")
with self.getcapture():
pytest.raises(IOError, "sys.stdin.read()")
class TestStdCaptureFD(TestStdCapture):
pytestmark = needsosdup
captureclass = staticmethod(StdCaptureFD)
def test_simple_only_fd(self, testdir):
testdir.makepyfile("""
import os
def test_x():
os.write(1, "hello\\n".encode("ascii"))
assert 0
""")
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines("""
*test_x*
*assert 0*
*Captured stdout*
""")
def test_intermingling(self):
with self.getcapture() as cap:
oswritebytes(1, "1")
sys.stdout.write(str(2))
sys.stdout.flush()
oswritebytes(1, "3")
oswritebytes(2, "a")
sys.stderr.write("b")
sys.stderr.flush()
oswritebytes(2, "c")
out, err = cap.readouterr()
assert out == "123"
assert err == "abc"
def test_many(self, capfd):
with lsof_check():
for i in range(10):
cap = StdCaptureFD()
cap.stop_capturing()
class TestStdCaptureFDinvalidFD(object):
pytestmark = needsosdup
def test_stdcapture_fd_invalid_fd(self, testdir):
testdir.makepyfile("""
import os
from _pytest import capture
def StdCaptureFD(out=True, err=True, in_=True):
return capture.MultiCapture(out, err, in_,
Capture=capture.FDCapture)
def test_stdout():
os.close(1)
cap = StdCaptureFD(out=True, err=False, in_=False)
cap.stop_capturing()
def test_stderr():
os.close(2)
cap = StdCaptureFD(out=False, err=True, in_=False)
cap.stop_capturing()
def test_stdin():
os.close(0)
cap = StdCaptureFD(out=False, err=False, in_=True)
cap.stop_capturing()
""")
result = testdir.runpytest_subprocess("--capture=fd")
assert result.ret == 0
assert result.parseoutcomes()['passed'] == 3
def test_capture_not_started_but_reset():
capsys = StdCapture()
capsys.stop_capturing()
def test_using_capsys_fixture_works_with_sys_stdout_encoding(capsys):
test_text = 'test text'
print(test_text.encode(sys.stdout.encoding, 'replace'))
(out, err) = capsys.readouterr()
assert out
assert err == ''
def test_capsys_results_accessible_by_attribute(capsys):
sys.stdout.write("spam")
sys.stderr.write("eggs")
capture_result = capsys.readouterr()
assert capture_result.out == "spam"
assert capture_result.err == "eggs"
@needsosdup
@pytest.mark.parametrize('use', [True, False])
def test_fdcapture_tmpfile_remains_the_same(tmpfile, use):
if not use:
tmpfile = True
cap = StdCaptureFD(out=False, err=tmpfile)
try:
cap.start_capturing()
capfile = cap.err.tmpfile
cap.readouterr()
finally:
cap.stop_capturing()
capfile2 = cap.err.tmpfile
assert capfile2 == capfile
@needsosdup
def test_close_and_capture_again(testdir):
testdir.makepyfile("""
import os
def test_close():
os.close(1)
def test_capture_again():
os.write(1, b"hello\\n")
assert 0
""")
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines("""
*test_capture_again*
*assert 0*
*stdout*
*hello*
""")
@pytest.mark.parametrize('method', ['SysCapture', 'FDCapture'])
def test_capturing_and_logging_fundamentals(testdir, method):
if method == "StdCaptureFD" and not hasattr(os, 'dup'):
pytest.skip("need os.dup")
# here we check a fundamental feature
p = testdir.makepyfile("""
import sys, os
import py, logging
from _pytest import capture
cap = capture.MultiCapture(out=False, in_=False,
Capture=capture.%s)
cap.start_capturing()
logging.warn("hello1")
outerr = cap.readouterr()
print ("suspend, captured %%s" %%(outerr,))
logging.warn("hello2")
cap.pop_outerr_to_orig()
logging.warn("hello3")
outerr = cap.readouterr()
print ("suspend2, captured %%s" %% (outerr,))
""" % (method,))
result = testdir.runpython(p)
result.stdout.fnmatch_lines("""
suspend, captured*hello1*
suspend2, captured*WARNING:root:hello3*
""")
result.stderr.fnmatch_lines("""
WARNING:root:hello2
""")
assert "atexit" not in result.stderr.str()
def test_error_attribute_issue555(testdir):
testdir.makepyfile("""
import sys
def test_capattr():
assert sys.stdout.errors == "strict"
assert sys.stderr.errors == "strict"
""")
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
@pytest.mark.skipif(not sys.platform.startswith('win') and sys.version_info[:2] >= (3, 6),
reason='only py3.6+ on windows')
def test_py36_windowsconsoleio_workaround_non_standard_streams():
"""
Ensure _py36_windowsconsoleio_workaround function works with objects that
do not implement the full ``io``-based stream protocol, for example execnet channels (#2666).
"""
from _pytest.capture import _py36_windowsconsoleio_workaround
class DummyStream(object):
def write(self, s):
pass
stream = DummyStream()
_py36_windowsconsoleio_workaround(stream)
def test_dontreadfrominput_has_encoding(testdir):
testdir.makepyfile("""
import sys
def test_capattr():
# should not raise AttributeError
assert sys.stdout.encoding
assert sys.stderr.encoding
""")
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_crash_on_closing_tmpfile_py27(testdir):
testdir.makepyfile('''
from __future__ import print_function
import time
import threading
import sys
def spam():
f = sys.stderr
while True:
print('.', end='', file=f)
def test_silly():
t = threading.Thread(target=spam)
t.daemon = True
t.start()
time.sleep(0.5)
''')
result = testdir.runpytest_subprocess()
assert result.ret == 0
assert 'IOError' not in result.stdout.str()
def test_pickling_and_unpickling_encoded_file():
# See https://bitbucket.org/pytest-dev/pytest/pull-request/194
# pickle.loads() raises infinite recursion if
# EncodedFile.__getattr__ is not implemented properly
ef = capture.EncodedFile(None, None)
ef_as_str = pickle.dumps(ef)
pickle.loads(ef_as_str)
| tareqalayan/pytest | testing/test_capture.py | Python | mit | 40,501 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
7619,
1035,
12324,
1010,
2407,
1010,
6140,
1035,
3853,
1001,
3602,
1024,
1052,
2100,
1012,
22834,
5425,
5852,
2073,
15826,
2013,
1001,
1052,
8516,
12322,
1015,
1012,
1018,
1012,
2322,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/** @file
* @brief Find dialog
*/
/* Authors:
* Bryce W. Harrington <bryce@bryceharrington.org>
*
* Copyright (C) 2004, 2005 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifndef INKSCAPE_UI_DIALOG_FIND_H
#define INKSCAPE_UI_DIALOG_FIND_H
#include "ui/widget/panel.h"
#include "ui/widget/button.h"
#include "ui/widget/entry.h"
#include "ui/widget/frame.h"
#include <glib.h>
#include <gtkmm.h>
#include "desktop.h"
#include "ui/dialog/desktop-tracker.h"
class SPItem;
class SPObject;
namespace Inkscape {
class Selection;
namespace UI {
namespace Dialog {
/**
* The Find class defines the Find and replace dialog.
*
* The Find and replace dialog allows you to search within the
* current document for specific text or properties of items.
* Matches items are highlighted and can be replaced as well.
* Scope can be limited to the entire document, current layer or selected items.
* Other options allow searching on specific object types and properties.
*/
class Find : public UI::Widget::Panel {
public:
Find();
virtual ~Find();
/**
* Helper function which returns a new instance of the dialog.
* getInstance is needed by the dialog manager (Inkscape::UI::Dialog::DialogManager).
*/
static Find &getInstance() { return *new Find(); }
protected:
/**
* Callbacks for pressing the dialog buttons.
*/
void onFind();
void onReplace();
void onExpander();
void onAction();
void onToggleAlltypes();
void onToggleCheck();
void onSearchinText();
void onSearchinProperty();
/**
* Toggle all the properties checkboxes
*/
void searchinToggle(bool on);
/**
* Returns true if the SPItem 'item' has the same id
*
* @param item the SPItem to check
* @param id the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_id_match (SPItem *item, const gchar *id, bool exact, bool casematch, bool replace=false);
/**
* Returns true if the SPItem 'item' has the same text content
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*
*/
bool item_text_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
/**
* Returns true if the SPItem 'item' has the same text in the style attribute
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_style_match (SPItem *item, const gchar *text, bool exact, bool casematch, bool replace=false);
/**
* Returns true if found the SPItem 'item' has the same attribute name
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_attr_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
/**
* Returns true if the SPItem 'item' has the same attribute value
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_attrvalue_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
/**
* Returns true if the SPItem 'item' has the same font values
*
* @param item the SPItem to check
* @param name the value to compare with
* @param exact do an exacty match
* @param casematch match the text case exactly
* @param replace replace the value if found
*
*/
bool item_font_match (SPItem *item, const gchar *name, bool exact, bool casematch, bool replace=false);
/**
* Function to filter a list of items based on the item type by calling each item_XXX_match function
*/
GSList * filter_fields (GSList *l, bool exact, bool casematch);
bool item_type_match (SPItem *item);
GSList * filter_types (GSList *l);
GSList * filter_list (GSList *l, bool exact, bool casematch);
/**
* Find a string within a string and returns true if found with options for exact and casematching
*/
bool find_strcmp(const gchar *str, const gchar *find, bool exact, bool casematch);
/**
* Find a string within a string and return the position with options for exact, casematching and search start location
*/
gsize find_strcmp_pos(const gchar *str, const gchar *find, bool exact, bool casematch, gsize start=0);
/**
* Replace a string with another string with options for exact and casematching and replace once/all
*/
Glib::ustring find_replace(const gchar *str, const gchar *find, const gchar *replace, bool exact, bool casematch, bool replaceall);
/**
* recursive function to return a list of all the items in the SPObject tree
*
*/
GSList * all_items (SPObject *r, GSList *l, bool hidden, bool locked);
/**
* to return a list of all the selected items
*
*/
GSList * all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked);
/**
* Shrink the dialog size when the expander widget is closed
* Currently not working, no known way to do this
*/
void squeeze_window();
/**
* Can be invoked for setting the desktop. Currently not used.
*/
void setDesktop(SPDesktop *desktop);
/**
* Is invoked by the desktop tracker when the desktop changes.
*/
void setTargetDesktop(SPDesktop *desktop);
/**
* Called when desktop selection changes
*/
void onSelectionChange(void);
private:
Find(Find const &d);
Find& operator=(Find const &d);
/*
* Find and replace combo box widgets
*/
UI::Widget::Entry entry_find;
UI::Widget::Entry entry_replace;
/**
* Scope and search in widgets
*/
UI::Widget::RadioButton check_scope_all;
UI::Widget::RadioButton check_scope_layer;
UI::Widget::RadioButton check_scope_selection;
UI::Widget::RadioButton check_searchin_text;
UI::Widget::RadioButton check_searchin_property;
Gtk::HBox hbox_searchin;
Gtk::VBox vbox_scope;
Gtk::VBox vbox_searchin;
UI::Widget::Frame frame_searchin;
UI::Widget::Frame frame_scope;
/**
* General option widgets
*/
UI::Widget::CheckButton check_case_sensitive;
UI::Widget::CheckButton check_exact_match;
UI::Widget::CheckButton check_include_hidden;
UI::Widget::CheckButton check_include_locked;
Gtk::VBox vbox_options1;
Gtk::VBox vbox_options2;
Gtk::HBox hbox_options;
Gtk::VBox vbox_expander;
Gtk::Expander expander_options;
UI::Widget::Frame frame_options;
/**
* Property type widgets
*/
UI::Widget::CheckButton check_ids;
UI::Widget::CheckButton check_attributename;
UI::Widget::CheckButton check_attributevalue;
UI::Widget::CheckButton check_style;
UI::Widget::CheckButton check_font;
Gtk::VBox vbox_properties;
Gtk::HBox hbox_properties1;
Gtk::HBox hbox_properties2;
UI::Widget::Frame frame_properties;
/**
* A vector of all the properties widgets for easy processing
*/
std::vector<UI::Widget::CheckButton *> checkProperties;
/**
* Object type widgets
*/
UI::Widget::CheckButton check_alltypes;
UI::Widget::CheckButton check_rects;
UI::Widget::CheckButton check_ellipses;
UI::Widget::CheckButton check_stars;
UI::Widget::CheckButton check_spirals;
UI::Widget::CheckButton check_paths;
UI::Widget::CheckButton check_texts;
UI::Widget::CheckButton check_groups;
UI::Widget::CheckButton check_clones;
UI::Widget::CheckButton check_images;
UI::Widget::CheckButton check_offsets;
Gtk::VBox vbox_types1;
Gtk::VBox vbox_types2;
Gtk::HBox hbox_types;
UI::Widget::Frame frame_types;
/**
* A vector of all the check option widgets for easy processing
*/
std::vector<UI::Widget::CheckButton *> checkTypes;
//Gtk::HBox hbox_text;
/**
* Action Buttons and status
*/
Gtk::Label status;
UI::Widget::Button button_find;
UI::Widget::Button button_replace;
Gtk::HButtonBox box_buttons;
Gtk::HBox hboxbutton_row;
/**
* Finding or replacing
*/
bool _action_replace;
bool blocked;
SPDesktop *desktop;
DesktopTracker deskTrack;
sigc::connection desktopChangeConn;
sigc::connection selectChangedConn;
};
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
#endif // INKSCAPE_UI_DIALOG_FIND_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
| piksels-and-lines-orchestra/inkscape | src/ui/dialog/find.h | C | gpl-2.0 | 9,699 | [
30522,
1013,
1008,
1008,
1030,
5371,
1008,
1030,
4766,
2424,
13764,
8649,
1008,
1013,
1013,
1008,
6048,
1024,
1008,
19757,
1059,
1012,
19760,
1026,
19757,
1030,
19757,
8167,
17281,
1012,
8917,
1028,
1008,
1008,
9385,
1006,
1039,
1007,
2432,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
resdef_parser_shader.cc -- Copyright (c) 2013 Noel Cower. All rights reserved.
See COPYING under the project root for the source code license. If this file
is not present, refer to <https://raw.github.com/nilium/snow/master/COPYING>.
*/
#include "resdef_parser.hh"
#include "../game/resources.hh"
#include "../renderer/shader.hh"
#include "../renderer/constants.hh"
#include "../renderer/program.hh"
#define FAIL_IF(EXP, R, ERR) do { if ((EXP)) { \
set_error(ERR); \
return (R); \
} } while(0)
namespace snow {
namespace {
const std::map<string, int> g_named_uniforms {
{ "modelview", UNIFORM_MODELVIEW },
{ "projection", UNIFORM_PROJECTION },
{ "texture_matrix", UNIFORM_TEXTURE_MATRIX },
{ "bones", UNIFORM_BONES },
{ "texture0", UNIFORM_TEXTURE0 },
{ "texture1", UNIFORM_TEXTURE1 },
{ "texture2", UNIFORM_TEXTURE2 },
{ "texture3", UNIFORM_TEXTURE3 },
{ "texture4", UNIFORM_TEXTURE4 },
{ "texture5", UNIFORM_TEXTURE5 },
{ "texture6", UNIFORM_TEXTURE6 },
{ "texture7", UNIFORM_TEXTURE7 },
};
const std::map<string, GLuint> g_named_attribs {
{ "position", ATTRIB_POSITION },
{ "color", ATTRIB_COLOR },
{ "normal", ATTRIB_NORMAL },
{ "binormal", ATTRIB_BINORMAL },
{ "tangent", ATTRIB_TANGENT },
{ "texcoord0", ATTRIB_TEXCOORD0 },
{ "texcoord1", ATTRIB_TEXCOORD1 },
{ "texcoord2", ATTRIB_TEXCOORD1 },
{ "texcoord3", ATTRIB_TEXCOORD1 },
{ "bone_weights", ATTRIB_BONE_WEIGHTS },
{ "bone_indices", ATTRIB_BONE_INDICES },
};
const std::map<string, GLuint> g_named_frag_outs {
{ "out0", 0 },
{ "out1", 1 },
{ "out2", 2 },
{ "out3", 3 },
};
const string SHADER_KW { "shader" };
} // namespace <anon>
template <typename T, typename C>
static unsigned read_named_statement(resdef_parser_t &parser, const C &names, T &out_index, tokenlist_t::const_iterator &inner_name)
{
const tokenlist_t::const_iterator current = parser.mark();
int index = 0;
if (parser.read_token(TOK_ID) == PARSE_OK) {
{
// named special
const auto iter = names.find(current->value);
if (iter == names.cend()) {
parser.set_error("Unrecognized name");
return false;
}
index = iter->second;
}
have_read_index:
const tokenlist_t::const_iterator name_iter = parser.mark();
if (parser.read_token(TOK_ID)) {
parser.set_error("Expected name, but got an unexpected token");
return false;
}
inner_name = name_iter;
out_index = static_cast<T>(index);
return parser.read_token(TOK_SEMICOLON) == PARSE_OK;;
} else if (parser.read_integer(index) == PARSE_OK) {
// custom uniform
goto have_read_index;
}
parser.set_error("Unexpected token while reading shader statement");
return false;
}
int resdef_parser_t::read_shader(rprogram_t &program, resources_t &res)
{
static constexpr const uint32_t uniform_kw = 0xe28ba5a4U;
static constexpr const uint32_t attrib_kw = 0x3aeacc59U;
static constexpr const uint32_t frag_out_kw = 0x0489c556U;
static constexpr const uint32_t vert_kw = 0x2b991038U;
static constexpr const uint32_t frag_kw = 0xc4e9df3cU;
FAIL_IF(read_keyword(SHADER_KW), PARSE_NOT_MATERIAL, "Expected 'shader' but got invalid token");
FAIL_IF(read_token(TOK_SINGLE_STRING_LIT) && read_token(TOK_DOUBLE_STRING_LIT),
PARSE_UNEXPECTED_TOKEN, "Expected resource name, but got invalid token");
FAIL_IF(read_token(TOK_CURL_OPEN), PARSE_UNEXPECTED_TOKEN,
"Expected {, but got invalid token");
while (!eof()) {
uint32_t hash = 0;
if (read_token(TOK_CURL_CLOSE) == PARSE_OK) {
return PARSE_OK;
} else if (read_token_hash32(TOK_ID, hash)) {
set_error("Invalid token");
skip_token();
}
switch (hash) {
case uniform_kw: {
int uniform_index = 0;
tokenlist_t::const_iterator inner_name;
if (read_named_statement(*this, g_named_uniforms, uniform_index, inner_name)) {
program.bind_uniform(uniform_index, inner_name->value);
break;
}
} goto shader_error_already_set; // uniform_kw
case attrib_kw: {
GLuint attrib_index = 0;
tokenlist_t::const_iterator inner_name;
if (read_named_statement(*this, g_named_attribs, attrib_index, inner_name)) {
program.bind_attrib(attrib_index, inner_name->value);
break;
}
} goto shader_error_already_set; // attrib_kw
case frag_out_kw: {
GLuint frag_index = 0;
tokenlist_t::const_iterator inner_name;
if (read_named_statement(*this, g_named_frag_outs, frag_index, inner_name)) {
program.bind_frag_out(frag_index, inner_name->value);
break;
}
} goto shader_error_already_set; // frag_out_kw
case vert_kw:
case frag_kw: {
const tokenlist_t::const_iterator path = mark();
const GLenum shader_type = (hash == vert_kw) ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER;
if (read_string()) {
set_error("Expected resource path, got unexpected token");
goto shader_error_already_set;
}
rshader_t *shader = res.load_shader(path->value, shader_type);
if (!shader) {
set_error("Unable to load shader");
} else {
program.attach_shader(*shader);
}
if (read_token(TOK_SEMICOLON)) {
set_error("Expected semicolon");
goto shader_error_already_set;
}
} break; // vert_kw, frag_kw
default: {
shader_error_already_set:
skip_through_token(TOK_SEMICOLON);
} break;
}
}
return PARSE_END_OF_TOKENS;
}
} // namespace snow
| nilium/snow | src/data/resdef_parser_shader.cc | C++ | bsd-2-clause | 5,934 | [
30522,
1013,
1008,
24501,
3207,
2546,
1035,
11968,
8043,
1035,
8703,
2099,
1012,
10507,
1011,
1011,
9385,
1006,
1039,
1007,
2286,
10716,
11190,
2121,
1012,
2035,
2916,
9235,
1012,
2156,
24731,
2104,
1996,
2622,
7117,
2005,
1996,
3120,
3642,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @author Anakeen
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License
*/
// Utility function to add an event listener
function addEvent(o,e,f){
if (o.addEventListener){ o.addEventListener(e,f,true); return true; }
else if (o.attachEvent){ return o.attachEvent("on"+e,f); }
else { return false; }
}
// Utility function to send an event
// o the object
// en the event name : mouseup, mouseodwn
function sendEvent(o,en) {
if (o) {
if( document.createEvent ) {
// var ne=document.createEvent("HTMLEvents");
var ne;
if ((en.indexOf('mouse') > -1)||(en.indexOf('click') > -1)) ne=document.createEvent("MouseEvents");
else ne=document.createEvent("HTMLEvents");
ne.initEvent(en,true,true);
o.dispatchEvent(ne);
}
else {
try {
o.fireEvent( "on"+en );
}
catch (ex) {
;
}
}
}
}
Ext.fdl.Document = Ext.extend(Ext.Panel, {
document: null,
context: null,
mode: 'view',
forceExt: false,
forceClassic: false,
displayToolbar: true,
displaynotes: true,
notes: [],
layout: 'fit',
toString: function(){
return 'Ext.fdl.Document';
},
initComponent: function(){
if(!this.document){
console.log('Ext.fdl.Document is not provided a document.');
}
this.context = this.document.context;
if(this.displayToolbar){
this.tbar = new Ext.Toolbar({
enableOverflow: true,
hidden: true,
height: 28
});
}
Ext.fdl.Document.superclass.initComponent.call(this);
this.on({
afterrender: {
fn: function(){
this.switchMode(this.mode);
var o = this;
(function(){
o.viewNotes();
}).defer(1000);
fdldoc = this.document;
(function(){
fdldoc.addUserTag({
tag: 'VIEWED'
});
}).defer(1000);
},
scope: this
}
});
},
setDocument: function(document){
this.document = document ;
},
reload: function(){
this.switchMode(this.mode);
},
switchMode: function(mode){
var me = this ;
if (this.showMask) {
this.showMask();
}
this.removeAll();
switch (mode) {
case 'view':
if ((this.document.getProperty('generateVersion') == 3 && !this.forceClassic)|| this.forceExt) {
var dcv = this.document.getDefaultConsultationView();
var subPanel = new Ext.fdl.SubDocument({
document: this.document,
config: this.config
});
subPanel.on('close',function(){
this.fireEvent('close',this);
},this);
subPanel.switchMode = function(mode){
me.switchMode(mode);
};
if (dcv) {
if (!eval('window.' + dcv.extwidget)) {
// Dynamically add Javascript file
this.includeJS(dcv.extsrc);
}
// Override document with extended behaviours
Ext.apply(subPanel, eval('window.' + dcv.extwidget));
}
else {
Ext.apply(subPanel, Ext.fdl.DocumentDefaultView);
}
this.add(subPanel);
subPanel.on('afterrender',function(){
subPanel.display();
});
}
else {
this.renderViewClassic();
}
break;
case 'edit':
case 'create':
//var dev = this.document.getDefaultEditionView();
if ((this.document.getProperty('generateVersion') == 3 && !this.forceClassic) || this.forceExt) {
var dev = this.document.getDefaultEditionView();
var subPanel = new Ext.fdl.SubDocument({
document: this.document,
mode: mode,
config: this.config
});
subPanel.on('close',function(){
this.fireEvent('close',this);
},this);
subPanel.switchMode = function(mode){
me.switchMode(mode);
};
if (dev) {
if (!eval('window.' + dev.extwidget)) {
// Dynamically add Javascript file
this.includeJS(dev.extsrc);
}
// Override document with extended behaviours
Ext.apply(subPanel, eval('window.' + dev.extwidget));
}
else {
Ext.apply(subPanel, Ext.fdl.DocumentDefaultEdit);
}
this.add(subPanel);
subPanel.on('afterrender',function(){
subPanel.display();
});
}
else {
this.renderEditClassic();
}
break;
default:
break;
};
this.mode = mode;
// Do layout will not work on render. It must not be called first time.
if (this.firstLayout) {
this.doLayout();
}
this.firstLayout = true;
if (this.hideMask) {
this.hideMask();
}
},
generateMenu: function(panel,menu,mediaObject){
var me = this ;
//console.log('GENERATE MENU',panel,menu,mediaObject.dom);
//panel.getTopToolbar().removeAll();
menu.removeAll();
var documentMenu = mediaObject.dom.contentWindow.documentMenu;
//console.log('DOCUMENT MENU',documentMenu);
var documentId = (mediaObject.dom.contentWindow.document.getElementsByName('document-id').length > 0) ? mediaObject.dom.contentWindow.document.getElementsByName('document-id')[0].content : '' ;
//console.log('DOCUMENT ID', documentId);
var document = this.context.getDocument({
id: documentId,
useCache:true,
latest: false
});
if(document && document.id){
this.setDocument(document);
//console.log('DOCUMENT',documentId,me.document.getTitle());
//me.publish('modifydocument',me.document);
}
for(var name in documentMenu){
var menuObject = documentMenu[name];
var menuItem = Ext.fdl.MenuManager.getMenuItem(menuObject,{
widgetDocument:me,
documentId:documentId,
panel: panel,
mediaObject: mediaObject,
context: this.context,
menu: menu
});
console.log('MENU ITEM',menuItem);
menu.add(menuItem);
}
menu.add(new Ext.Toolbar.Fill());
var toolbarStatus = me.documentToolbarStatus();
for (var i = 0; i < toolbarStatus.length; i++) {
if (toolbarStatus[i]) {
menu.add(toolbarStatus[i]);
}
}
menu.doLayout();
menu.show();
mediaObject.dom.contentWindow.displaySaveForce = function(){
if (mediaObject.dom.contentWindow.documentMenu.saveforce) {
mediaObject.dom.contentWindow.documentMenu.saveforce.visibility = 1 ;
me.generateMenu(panel,menu,mediaObject);
}
};
},
// If this function returns a string, confirm when closing this document displaying this string.
// This method is used in Ext.fdl.Window to check if document can be closed with ou without confirm.
closeConfirm: function(){
if(this.mediaObject){
try {
if(this.mediaObject.dom.contentWindow.beforeUnload){
var beforeUnload = this.mediaObject.dom.contentWindow.beforeUnload();
return beforeUnload ;
}
} catch(exception) {
}
}
return false;
},
renderViewClassic: function(){
//console.log('RENDER VIEW CLASSIC DOCUMENT ID',this.document.id);
var me = this ;
if(!this.config){
this.config = {};
}
if(!this.config.targetRelation){
//this.config.targetRelation = 'Ext.fdl.Document.prototype.publish("opendocument",null,%V%,"view")';
}
console.log('CONFIG',this.config);
delete this.config.opener ;
var sconf='';
if (this.config && this.document.context) sconf=JSON.stringify(this.config);
//console.log(this.config);
//console.log(JSON.stringify(this.config));
if(this.config.url){
var url = this.config.url ;
url = url.replace(new RegExp("(action=FDL_CARD)","i"),"action=VIEWEXTDOC");
//url = this.document.context.url + url ;
console.log('Calculated URL',url);
} else {
url = this.document.context.url + '?app=FDL&action=VIEWEXTDOC&id=' + this.document.getProperty('id') + '&extconfig='+encodeURI(sconf);
}
var mediaPanel = new Ext.ux.MediaPanel({
style: 'height:100%;',
bodyStyle: 'height:100%;',
border: false,
autoScroll: false,
mediaCfg: {
mediaType: 'HTM',
url: url
},
listeners : {
mediaload : function(panel,mediaObject){
me.mediaObject = mediaObject;
var menu = me.getTopToolbar();
console.log('MEDIA OBJECT',mediaObject);
me.generateMenu(panel,menu,mediaObject);
addEvent(mediaObject.dom,'load',function(){
var menu = me.getTopToolbar();
console.log('MEDIA OBJECT',mediaObject);
me.generateMenu(panel,menu,mediaObject);
});
}
}
});
this.add(mediaPanel);
this.doLayout();
},
renderEditClassic: function(){
var me = this ;
if(!this.config){
this.config = {};
}
if(this.config.url){
var url = this.config.url ;
url = url.replace(new RegExp("(app=GENERIC)","i"),"app=FDL");
url = url.replace(new RegExp("(action=GENERIC_EDIT)","i"),"action=EDITEXTDOC");
//url = this.document.context.url + url ;
console.log('Calculated URL',url);
} else {
var url = this.document.context.url + '?app=FDL&action=EDITEXTDOC&classid=' + this.document.getProperty('fromid') + '&id=' + this.document.getProperty('id');
}
var mediaPanel = new Ext.ux.MediaPanel({
style: 'height:100%;',
bodyStyle: 'height:100%;',
border: false,
autoScroll: false,
mediaCfg: {
mediaType: 'HTM',
url: url
},
listeners : {
mediaload : function(panel,mediaObject){
me.mediaObject = mediaObject;
var menu = me.getTopToolbar();
console.log('MEDIA OBJECT(1)',mediaObject);
me.generateMenu(panel,menu,mediaObject);
addEvent(mediaObject.dom,'load',function(){
var menu = me.getTopToolbar();
console.log('MEDIA OBJECT(2)',mediaObject);
me.generateMenu(panel,menu,mediaObject);
});
}
}
});
this.add(mediaPanel);
this.doLayout();
},
displayUrl: function(url,target,config){
this.publish('openurl',url,target,config);
},
addNote: function(){
var note = this.document.context.createDocument({
familyId: 'SIMPLENOTE',
mode: 'view'
});
if (note) {
note.setValue('note_pasteid', this.document.getProperty('initid'));
note.setValue('note_width', 200);
note.setValue('note_height', 200);
note.setValue('note_top', 50);
note.setValue('note_left', 50);
note.save();
this.document.reload();
var nid=note.getProperty('initid');
this.viewNotes();
var wnid = this.notes[nid];
if (wnid) {
var p = wnid.items.itemAt(0);
//console.log("note",p);
setTimeout(function(){
p.items.itemAt(0).items.itemAt(0).setVisible(false);
p.items.itemAt(0).items.itemAt(1).setVisible(true);
p.items.itemAt(0).items.itemAt(2).setVisible(true);
p.items.itemAt(0).items.itemAt(3).setVisible(true);
p.items.itemAt(0).items.itemAt(1).focus();
}, 1000);
}
}
},
viewNotes: function(config){
var noteids = this.document.getProperty('postitid');
if (noteids.length > 0) {
for (var i = 0; i < noteids.length; i++) {
if (noteids[i] > 0) {
var note;
if (!this.notes[noteids[i]]) {
note = this.document.context.getDocument({
id: noteids[i]
});
var wd = new Ext.fdl.Document({
style: 'padding:0px;margin:0px;',
bodyStyle: 'padding:0px;margin:0px;',
document: note,
anchor: '100% 100%',
displayToolbar: false,
listeners: {close: function (panel) {
panel.ownerCt.close();
}}
});
this.notes[noteids[i]] = wd;
}
else {
note = this.notes[noteids[i]].document;
}
if (note.isAlive()) {
var color = 'yellow';
var nocolor = note.getValue('note_color');
if (nocolor)
color = nocolor;
var x = parseInt(note.getValue('note_left'));
var y = parseInt(note.getValue('note_top'));
if ((!this.notes[noteids[i]].window) || (this.notes[noteids[i]].window.getWidth() == 0)) {
var notewin = new Ext.Window({
layout: 'fit',
cls: 'x-fdl-note',
style: 'padding:0px;margin:0px;background-color:' + color,
title: note.getTitle(),
closeAction: 'hide',
width: parseInt(note.getValue('note_width')),
height: parseInt(note.getValue('note_height')),
resizable: true,
note: note,
tools: [{
id: 'close',
qtip: 'Cacher la note',
// hidden:true,
handler: function(event, toolEl, panel){
panel.setVisible(false);
}
}],
plain: true,
renderTo: this.body,
constrain: true,
items: [this.notes[note.id]],
x: x,
y: y,
listeners: {
move: function(o){
if (this.note && (this.note.getProperty('owner') == this.note.context.getUser().id)) {
var xy = o.getPosition(true);
if ((o.getWidth() > 0) && (xy[0] > 0)) {
this.note.setValue('note_width', o.getWidth());
this.note.setValue('note_height', o.getHeight());
this.note.setValue('note_left', xy[0]);
this.note.setValue('note_top', xy[1]);
this.note.save();
}
}
},
close: function(o){
}
}
});
this.notes[noteids[i]].window = notewin;
notewin.show();
}
else {
if (config && config.undisplay)
this.notes[noteids[i]].window.setVisible(false);
else
this.notes[noteids[i]].window.setVisible(true);
}
}
}
}
}
},
includeJS: function(url){
console.log('Include JS', url);
if (window.XMLHttpRequest) {
var XHR = new XMLHttpRequest();
}
else {
var XHR = new ActiveXObject("Microsoft.XMLHTTP");
}
if (XHR) {
XHR.open("GET", (this.document.context.url + url), false);
XHR.send(null);
eval(XHR.responseText);
}
else {
return false;
}
},
detailSearch: function(){
return new Ext.fdl.DSearch({
document: this.document,
hidden: true,
border: false
});
},
documentToolbarStatus: function(){
// If document is in creation mode, no toolbar status to display
if(!this.document.id){
return false ;
}
var u = this.document.context.getUser();
var info = u.getInfo();
var statestatus = null;
var statestatustext = '';
if(this.document.getProperty('version')){
console.log('VERSION',this.document.getProperty('version'));
statestatustext = 'version ' + this.document.getProperty('version')+' ';
}
if (this.document.hasWorkflow()){
if(this.document.isFixed()) {
statestatustext += '<i>' + '<span style="padding-left:10px;margin-right:3px;background-color:' + this.document.getColorState() + '"> </span>' + this.document.getLocalisedState() + '</i>';
} else {
if (this.document.getActivityState()) {
statestatustext += '<i>' + this.document.getActivityState() + '</i>';
} else {
statestatustext += '<i>' + this.document.getLocalisedState() + '</i>';
}
}
}
if(statestatustext){
statestatus = new Ext.Toolbar.TextItem(statestatustext);
}
var lockstatus = null;
if (this.document.getProperty('locked') > 0) {
if (this.document.getProperty('locked') == info['id']) {
lockstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Verrouillé par ' + this.document.getProperty('locker') + '" src="' + this.document.context.url + 'FDL/Images/greenlock.png" style="height:16px" />');
}
else {
lockstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Vérrouillé par ' + this.document.getProperty('locker') + '" src="' + this.document.context.url + 'FDL/Images/redlock.png" style="height:16px" />');
}
}
var readstatus = null;
if (this.document.getProperty('locked') == -1) {
readstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Figé" src="' + this.document.context.url + 'FDL/Images/readfixed.png" style="height:16px" />');
}
else
if (!this.document.canEdit()) {
readstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Lecture seule" src="' + this.document.context.url + 'FDL/Images/readonly.png" style="height:16px" />');
}
var postitstatus = null;
if (this.document.getProperty('postitid').length > 0) {
//console.log(this.document.getProperty('postitid'));
postitstatus = new Ext.Button({
tooltip: 'Afficher/Cacher les notes',
text: 'Notes',
icon: this.document.context.url + 'Images/simplenote16.png',
scope: this,
handler: function(b, e){
this.displaynotes = (!this.displaynotes);
this.viewNotes({
undisplay: (!this.displaynotes)
});
}
});
}
// TODO Correct the icon path
var allocatedstatus = null;
if (this.document.getProperty('allocated')) {
var an = this.document.getProperty('allocatedname');
var aimg = this.document.context.url + "Images/allocatedred16.png";
if (this.document.getProperty('allocated') == this.document.context.getUser().id) {
aimg = this.document.context.url + "Images/allocatedgreen16.png";
}
allocatedstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Affecté à ' + an + '" src="' + aimg + '" style="height:16px" />');
}
return [statestatus,lockstatus, readstatus, postitstatus, allocatedstatus];
}
});
Ext.reg('fdl-document', Ext.fdl.Document);
Ext.fdl.SubDocument = Ext.extend(Ext.form.FormPanel, {
document: null,
context: null,
mode: 'view',
// Force Ext default rendering, ignoring generateVersion property
forceExt: false,
displayToolbar: true,
border: false,
bodyStyle: 'overflow-y:auto; padding: 0px;',
//frame: true,
autoHeight: false,
layout: 'form',
method: 'POST',
enctype: 'multipart/form-data',
fileUpload: true,
initComponent: function(){
if(!this.document){
console.log('Ext.fdl.Document is not provided a document.');
}
this.context = this.document.context;
Ext.fdl.SubDocument.superclass.initComponent.call(this);
},
close: function(){
console.log('DOCUMENT CLOSE');
this.fireEvent('close',this);
},
getHtmlValue: function(attrid, tag){
var as = this.document.getAttributes();
var ht = '';
for (var aid in as) {
oa = as[aid];
if (oa.parentId == attrid && oa.getValue) {
if (oa.getValue() != '')
ht += '<' + tag + '>' + oa.getLabel() + ' : ' + oa.getValue() + '</' + tag + '>';
}
}
return ht;
},
applyLink: function(attrid){
var me = this;
if (attrid) {
var text = me.document.getValue(attrid) || '';
var reg = new RegExp("", "ig");
reg.compile("\\[ADOC ([0-9]*)\\]", "ig");
var getLink = function(str, id){
var value = me.document.getValue(id);
var display = me.document.getDisplayValue(id);
return "<a class='docid' oncontextmenu='window.Fdl.ApplicationManager.displayDocument(" + value + ");return false;' href='javascript:window.Fdl.ApplicationManager.displayDocument(" + value + ");'> " +
// me.context.getDocument({
// id: id
// }).getTitle() +
display +
"</a>";
};
text = text.replace(reg, getLink);
}
return text;
},
orderAttribute: function(){
if (!this.ordered) {
function sortAttribute(attr1, attr2){
return attr1.rank - attr2.rank;
};
function giveRank(type){
for (var i = 0; i < ordered.length; i++) {
if (ordered[i].type == type) {
for (var j = 0; j < ordered.length; j++) {
if ((ordered[i].id == ordered[j].parentId) && (ordered[i].rank > ordered[j].rank || ordered[i].rank == 0)) {
ordered[i].rank = ordered[j].rank;
}
}
}
}
};
var ordered = new Array();
var as = this.document.getAttributes();
for (var aid in as) {
ordered.push(as[aid]);
}
//ordered = ordered.slice(); // Makes an independant copy of attribute array
// Each structuring attribute is given its children lowest rank
giveRank('array');
giveRank('frame');
giveRank('tab');
ordered.sort(sortAttribute);
this.ordered = ordered;
}
return this.ordered;
},
documentToolbarButton: function(){
var button = new Ext.Button({
text: 'Document',
menu: [{
xtype: 'menuitem',
text: this.context._("eui::ToEdit"),
scope: this,
handler: function(){
this.switchMode('edit');
},
disabled: !this.document.canEdit()
}, {
xtype: 'menuitem',
text: 'Verrouiller',
scope: this,
handler: function(){
this.document.lock();
Ext.Info.msg(this.document.getTitle(), "Verrouillage");
this.switchMode(this.mode);
},
disabled: !this.document.canEdit(),
hidden: (this.document.getProperty('locked') > 0 || this.document.getProperty('locked') == -1)
}, {
xtype: 'menuitem',
text: 'Déverrouiller',
scope: this,
handler: function(){
this.document.unlock();
Ext.Info.msg(this.document.getTitle(), "Déverrouillage");
this.switchMode(this.mode);
},
disabled: !this.document.canEdit(),
hidden: (this.document.getProperty('locked') == 0 || this.document.getProperty('locked') == -1)
}, {
xtype: 'menuitem',
text: 'Actualiser',
scope: this,
handler: function(){
this.document.reload();
this.switchMode(this.mode);
}
}, {
xtype: 'menuitem',
text: 'Supprimer',
scope: this,
handler: function(){
this.document.remove();
updateDesktop();
this.ownerCt.destroy();
}
}, {
xtype: 'menuitem',
text: 'Historique',
scope: this,
handler: function(){
var histowin = Ext.fdl.viewDocumentHistory(this.document);
histowin.show();
}
}, {
xtype: 'menuitem',
text: 'Ajouter une note',
scope: this,
handler: function(){
var nid = this.addNote();
this.viewNotes();
var wnid = this.notes[nid];
if (wnid) {
var p = wnid.items.itemAt(0);
setTimeout(function(){
p.items.itemAt(0).setVisible(false);
p.items.itemAt(1).setVisible(true);
p.items.itemAt(2).setVisible(true);
p.items.itemAt(3).setVisible(true);
p.items.itemAt(1).focus();
}, 1000);
}
},
hidden: (this.document.getProperty('locked') == -1)
}, {
xtype: 'menuitem',
text: 'Affecter un utilisateur',
scope: this,
handler: function(){
var o = this;
//console.log(o);
var oa = new Fdl.RelationAttribute({
relationFamilyId: 'IUSER'
});
console.log('THISDOCUMENT', this.document, oa);
oa._family = this.document;
//console.log(oa);
var wu = new Ext.fdl.DocId({
attribute: oa
});
var toolbar = new Ext.Toolbar({
scope: this,
items: [{
xtype: 'button',
text: 'Affecter',
scope: this,
handler: function(){
var uid = wu.getValue();
if (uid) {
if (this.document.allocate({
userId: uid
})) {
this.switchMode(this.mode);
}
else {
Ext.Msg.alert(Fdl.getLastErrorMessage());
}
w.close();
}
}
}, {
xtype: 'button',
scope: this,
text: 'Enlever l\'affectation',
handler: function(){
if (this.document.unallocate()) {
this.switchMode(this.mode);
}
else {
Ext.Msg.alert(Fdl.getLastErrorMessage());
}
w.close();
}
}, {
xtype: 'button',
text: 'Annuler',
handler: function(){
w.close();
}
}]
});
var w = new Ext.Window({
constrain: true,
renderTo: o.ownerCt.body,
title: 'Affecter un utilisateur',
bbar: toolbar,
items: [wu]
});
// var f = new Ext.FormPanel({
// items: [wu, toolbar]
// });
// w.add(f);
w.show();
(function(){
wu.focus();
}).defer(1000);
},
disabled: !this.document.canEdit()
}, {
xtype: 'menuitem',
text: 'Enregistrer une version',
scope: this,
handler: function(){
Ext.Msg.prompt('Version', 'Entrer le nom de la version', function(btn, text){
if (btn == 'ok') {
// Fdl.ApplicationManager.closeDocument(this.document.id);
var previousId = this.document.id;
// Add Revision change document id ...
this.document.addRevision({
version: text,
volatileVersion: true
});
// ... so we need to notify a document
//Fdl.ApplicationManager.notifyDocument(this.document, previousId);
// this.switchMode(this.mode);
// this.doLayout();
}
}, this);
},
disabled: !this.document.canEdit(),
hidden:(this.document.getProperty('doctype')!='F')
}]
});
return button;
},
cycleToolbarButton: function(){
if (this.document.hasWorkflow()) {
var menu = Array();
var fs = this.document.getFollowingStates();
for (var i = 0; i < fs.length; i++) {
menu.push({
xtype: 'menuitem',
text: fs[i].transition ? Ext.util.Format.capitalize(fs[i].transitionLabel) : "Passer à l'état : " + fs[i].label,
style: 'background-color:' + fs[i].color + ';',
scope: this,
to_state: fs[i].state,
handler: function(b, e){
var previousId = this.document.id;
if (this.document.changeState({
state: b.to_state
})) {
Fdl.ApplicationManager.notifyDocument(this.document, previousId);
Ext.Info.msg(this.document.getTitle(), "Changement d'état");
}
else {
// Error during state change
}
// this.switchMode(this.mode);
// this.doLayout();
}
});
}
menu.push({
xtype: 'menuitem',
text: 'Voir le graphe',
scope: this,
handler: function(){
var wid = this.document.getProperty('wid');
new Ext.Window({
title: 'Cycle pour ' + this.document.getTitle(),
resizable: true,
width: 800,
height: 400,
border: false,
items: [new Ext.ux.MediaPanel({
mediaCfg: {
mediaType: 'HTM',
url: '/?app=FDL&action=WORKFLOW_GRAPH&id=' + wid,
width: '100%',
height: '100%'
}
})]
}).show();
}
});
var button = new Ext.Button({
text: 'Cycle',
menu: menu
});
return button;
}
return null;
},
documentToolbarStatus: function(){
var u = this.document.context.getUser();
var info = u.getInfo();
var lockstatus = null;
if (this.document.getProperty('locked') > 0) {
if (this.document.getProperty('locked') == info['id']) {
lockstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Verrouillé par ' + this.document.getProperty('locker') + '" src="FDL/Images/greenlock.png" style="height:16px" />');
}
else {
lockstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Vérrouillé par ' + this.document.getProperty('locker') + '" src="FDL/Images/redlock.png" style="height:16px" />');
}
}
var readstatus = null;
if (this.document.getProperty('locked') == -1) {
readstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Figé" src="FDL/Images/readfixed.png" style="height:16px" />');
}
else
if (!this.document.canEdit()) {
readstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Lecture seule" src="FDL/Images/readonly.png" style="height:16px" />');
}
var postitstatus = null;
if (this.document.getProperty('postitid').length > 0) {
//console.log(this.document.getProperty('postitid'));
postitstatus = new Ext.Button({
tooltip: 'Afficher/Cacher les notes',
text: 'Notes',
icon: 'Images/simplenote16.png',
scope: this,
handler: function(b, e){
this.displaynotes = (!this.displaynotes);
this.viewNotes({
undisplay: (!this.displaynotes)
});
}
});
}
// TODO Correct the icon path
var allocatedstatus = null;
if (this.document.getProperty('allocated')) {
var an = this.document.getProperty('allocatedname');
var aimg = "Images/allocatedred16.png";
if (this.document.getProperty('allocated') == this.document.context.getUser().id) {
aimg = "Images/allocatedgreen16.png";
}
allocatedstatus = new Ext.Toolbar.TextItem('<img ext:qtip="Affecté à ' + an + '" src="' + aimg + '" style="height:16px" />');
}
return [lockstatus, readstatus, postitstatus, allocatedstatus];
},
adminToolbarButton: function(){
var button = new Ext.Button({
text: 'Administration',
menu: [{
xtype: 'menuitem',
text: 'Famille',
scope: this,
handler: function(b, e){
Fdl.ApplicationManager.displayFamily(this.document.getProperty('fromid'));
}
}, {
xtype: 'menuitem',
text: 'Modifier le Cycle',
scope: this,
handler: function(b, e){
Fdl.ApplicationManager.displayCycleEditor(this.document.getProperty('wid'));
}
}, {
xtype: 'menuitem',
text: 'Administrer le Cycle',
scope: this,
handler: function(b, e){
Fdl.ApplicationManager.displayDocument(this.document.getProperty('wid'), 'edit');
}
}, {
xtype: 'menuitem',
text: 'Propriétés',
handler: function(b, e){
Ext.Msg.alert('Propriétés', 'Pas encore disponible.');
}
}]
});
return button;
},
renderToolbar: function(){
if (!this.displayToolbar) {
return false;
}
var toolbar = new Ext.Toolbar({
style: 'margin-bottom:10px;'
});
toolbar.add(this.documentToolbarButton());
// Add cycle toolbar button if applicable
var cycleToolbarButton = this.cycleToolbarButton();
if (cycleToolbarButton) {
toolbar.add(cycleToolbarButton);
}
// toolbar.add(this.adminToolbarButton());
toolbar.add(new Ext.Toolbar.Fill());
var toolbarStatus = this.documentToolbarStatus();
for (var i = 0; i < toolbarStatus.length; i++) {
if (toolbarStatus[i]) {
toolbar.add(toolbarStatus[i]);
}
}
return toolbar;
},
/**
*
* @param {Object} attrid
* @param {Object} config (display : if true returns widget even if value is empty)
*/
getExtValue: function(attrid, config){
if ((config && config.display) || this.alwaysDisplay) {
var display = true;
}
if ((config && config.hideHeader)) {
var hideHeader = true;
}
var attr = this.document.getAttribute(attrid);
if (!attr) {
return null;
}
var ordered = this.orderAttribute();
// Handle Visibility
switch (attr.getVisibility()) {
case 'W':
case 'R':
case 'S':
break;
case 'O':
case 'H':
case 'I':
return null;
break;
case 'U':
//For array, prevents add and delete of rows
break;
}
switch (attr.type) {
case 'menu':
case 'action':
return new Ext.Button({
text: attr.getLabel(),
handler: this.handleAction
});
break;
case 'text':
case 'longtext':
case 'date':
case 'integer':
case 'int':
case 'double':
case 'money':
if (this.document.getValue(attr.id) || display) {
return new Ext.fdl.DisplayField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id)
});
}
else {
return null;
}
break;
case 'htmltext':
if (this.document.getValue(attr.id) || display) {
return new Ext.fdl.DisplayField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.applyLink(attr.id)
});
}
else {
return null;
}
break;
case 'time':
if (this.document.getValue(attr.id) || display) {
return new Ext.form.TimeField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
disabled: true
});
}
else {
return null;
}
break;
case 'timestamp':
if (this.document.getValue(attr.id) || display) {
return new Ext.ux.form.DateTime({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
disabled: true
});
}
else {
return null;
}
break;
case 'password':
if (this.document.getValue(attr.id) || display) {
return new Ext.form.TextField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
inputType: 'password',
value: this.document.getValue(attr.id),
disabled: true
});
}
else {
return null;
}
break;
case 'image':
// return new Ext.form.FileUploadField({
// fieldLabel: attr.getLabel(),
// buttonCfg: {
// text: '',
// iconCls: 'upload-icon'
// },
// disabled: true
// });
return null;
break;
case 'color':
// return new Ext.form.ColorField({
// fieldLabel: attr.getLabel()
// })
////console.log('Attribute not represented : ' + attr.type);
return null;
break;
case 'frame':
var frame = new Ext.form.FieldSet({
title: Ext.util.Format.capitalize(attr.getLabel()),
autoHeight: true,
collapsible: true,
width: 'auto',
labelWidth: 150,
style: 'margin:10px;',
bodyStyle: 'padding-left:40px;width:auto;'
});
var empty = true;
for (var i = 0; i < ordered.length; i++) {
var curAttr = ordered[i];
if (curAttr.parentId == attr.id) {
var extValue = this.getExtValue(curAttr.id);
if (extValue != null) {
frame.add(extValue);
empty = false;
}
}
}
if (!empty || display) {
return frame;
}
else {
return null;
}
break;
case 'tab':
var tab = new Ext.Panel({
title: Ext.util.Format.capitalize(attr.getLabel()),
autoHeight: true,
autoWidth: true,
width: 'auto',
layout: 'form',
border: false,
defaults: {
//width: 'auto',
// as we use deferredRender:false we mustn't
// render tabs into display:none containers
hideMode: 'offsets'
}
});
var empty = true;
for (var i = 0; i < ordered.length; i++) {
var curAttr = ordered[i];
if (curAttr.parentId == attr.id) {
var extValue = this.getExtValue(curAttr.id);
if (extValue != null) {
tab.add(extValue);
empty = false;
}
}
}
if (!empty || display) {
return tab;
}
else {
return null;
}
break;
case 'array':
var elements = attr.getElements();
var fields = new Array();
for (var i = 0; i < elements.length; i++) {
fields.push(elements[i].id);
}
//console.log('VALUES',this.document.getValues(attr.id));
//var values = attr.getArrayValues()
var values = this.document.getValue(attr.id) || [];
if (values.length == 0 && !display) {
return null;
}
for (var i = 0; i < elements.length; i++) {
// Transform docid into links
if (elements[i].type == 'docid') {
for (var j = 0; j < values.length; j++) {
if (values[j][elements[i].id]) {
values[j][elements[i].id] = "<a class='docid' " +
'href="javascript:window.Fdl.ApplicationManager.displayDocument(' +
values[j][elements[i].id] +
');"' +
'oncontextmenu="window.Fdl.ApplicationManager.displayDocument(' +
values[j][elements[i].id] +
');return false;">' +
elements[i].getTitle()[j] +
"</a>";
}
else {
values[j][elements[i].id] = '';
}
}
}
// Transform enum with correct label
if (elements[i].type == 'enum') {
for (var j = 0; j < values.length; j++) {
values[j][elements[i].id] = elements[i].getEnumLabel({
key: values[j][elements[i].id]
});
}
}
}
var store = new Ext.data.JsonStore({
fields: fields,
data: values
});
var columns = [];
for (var i = 0; i < ordered.length; i++) {
var curAttr = ordered[i];
if (curAttr.parentId == attr.id) {
// Handle Visibility
switch (curAttr.getVisibility()) {
case 'W':
case 'R':
case 'S':
columns.push({
header: Ext.util.Format.capitalize(curAttr.getLabel()),
dataIndex: curAttr.id
});
break;
case 'O':
case 'H':
case 'I':
break;
case 'U':
//For array, prevents add and delete of rows
break;
}
}
}
var array = new Ext.grid.GridPanel({
title: Ext.util.Format.capitalize(attr.getLabel()),
autoHeight: true,
collapsible: true,
titleCollapse: true,
viewConfig: {
forceFit: true,
autoFill: true
},
animCollapse: false,
disableSelection: true,
store: store,
columns: columns,
style: 'margin-bottom:10px;',
header: !hideHeader,
border: false
});
return array;
break;
case 'enum':
//console.log('Attribute not represented : ' + attr.type);
return null;
break;
case 'docid':
if (this.document.getValue(attr.id) || display) {
if (attr.getOption('multiple') != 'yes') {
return new Ext.fdl.DisplayField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: "<a class='docid' " +
'href="javascript:window.Fdl.ApplicationManager.displayDocument(' +
this.document.getValue(attr.id) +
');"' +
'oncontextmenu="window.Fdl.ApplicationManager.displayDocument(' +
this.document.getValue(attr.id) +
');return false;">' +
(this.document.getDisplayValue(attr.id) || '') +
"</a>"
});
}
else {
var values = this.document.getValue(attr.id);
var displays = this.document.getDisplayValue(attr.id);
console.log('Attribute', values, displays);
var fieldValue = '';
for (var i = 0; i < values.length; i++) {
fieldValue += "<a class='docid' " +
'href="javascript:window.Fdl.ApplicationManager.displayDocument(' +
values[i] +
');"' +
'oncontextmenu="window.Fdl.ApplicationManager.displayDocument(' +
values[i] +
');return false;">' +
displays[i] +
"</a><br/>";
}
return new Ext.fdl.DisplayField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: fieldValue
});
}
}
else {
return null;
}
break;
case 'file':
if (this.document.getValue(attr.id) || display) {
return new Ext.fdl.DisplayField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: '<a class="docid" ' +
'href="' +
this.document.getDisplayValue(attr.id, {
url: true,
inline: false
}) +
'" >' +
this.document.getDisplayValue(attr.id) +
"</a>"
});
}
else {
return null;
}
break;
default:
//console.log('Attribute not represented : ' + attr.type);
return null;
break;
}
},
getHeader: function(){
return new Ext.Panel({
html: ""
/*
html: '<img src=' +
this.document.getIcon({
width: 48
}) +
' style="float:left;padding:0px 5px 5px 0px;" />' +
"<p style='font-size:12;'>" +
this.document.getProperty('fromtitle') +
'</p>' +
'<h1 style="display:inline;font-size:14;text-transform: uppercase;">' +
(this.document.getProperty('id') ? this.document.getTitle() : ('Création ' + this.document.getProperty('fromtitle'))) +
'</h1>' +
'<span style="padding-left:10px">' +
(this.document.getProperty('version') ? (' Version ' + this.document.getProperty('version')) : '') +
'</span>' +
(this.document.hasWorkflow() ?
"<p><i style='border-style:none none solid none;border-width:2px;border-color:" +
this.document.getColorState() +
"'>" +
(this.document.isFixed() ? ('(' + this.document.getLocalisedState() + ') ') : '') )+
"<b>" +
(this.document.getActivityState() ? Ext.util.Format.capitalize(this.document.getActivityState()) : '') +
"</b>" +
'</i></p>'*/
});
},
/**
* Get Ext default input component for a given id.
* @param {Object} attrid
* @param {Object} inArray
* @param {Object} rank
* @param {Object} defaultValue
* @param {Object} empty
*/
getExtInput: function(attrid, inArray, rank, defaultValue, empty){
var attr = this.document.getAttribute(attrid);
if (!attr) {
return null;
}
//var name = inArray ? attr.id + '[]' : attr.id;
var name = attr.id;
var ordered = this.orderAttribute();
// Handle Visibility
switch (attr.getVisibility()) {
case 'W':
case 'O':
break;
case 'R':
case 'H':
case 'I':
return null;
break;
case 'S':
//Viewable in edit mode but not editable
var disabled = true;
break;
case 'U':
//For array, prevents add and delete of rows
break;
}
switch (attr.type) {
case 'menu':
// return new Ext.Button({
// text: Ext.util.Format.capitalize(attr.getLabel()),
// handler: this.handleAction
// });
break;
case 'text':
return new Ext.fdl.Text({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: !empty ? (rank != undefined ? this.document.getValue(attr.id)[rank] : this.document.getValue(attr.id)) : null,
name: name,
allowBlank: !attr.needed,
disabled: disabled
});
break;
case 'longtext':
return new Ext.fdl.LongText({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: !empty ? (rank != undefined ? this.document.getValue(attr.id)[rank] : this.document.getValue(attr.id)) : null,
name: name,
allowBlank: !attr.needed,
disabled: disabled
});
break;
case 'htmltext':
return new Ext.fdl.HtmlText({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
name: name,
disabled: disabled
});
break;
case 'int':
case 'integer':
return new Ext.fdl.Integer({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
name: name,
allowBlank: !attr.needed,
disabled: disabled
});
break;
case 'double':
return new Ext.fdl.Double({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
name: name,
allowBlank: !attr.needed,
disabled: disabled
});
break;
case 'money':
return new Ext.fdl.Money({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
name: name,
allowBlank: !attr.needed,
disabled: disabled
});
break;
case 'date':
return new Ext.fdl.Date({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
altFormats: 'd-j-Y|d-m-Y',
format: 'd/m/Y',
value: !empty ? (rank != undefined ? this.document.getValue(attr.id)[rank] : this.document.getValue(attr.id)) : null,
name: name,
disabled: disabled
});
break;
case 'time':
return new Ext.form.TimeField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
value: this.document.getValue(attr.id),
name: name,
disabled: disabled
});
break;
case 'timestamp':
return new Ext.ux.form.DateTime({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
name: name,
disabled: disabled
});
break;
case 'password':
return new Ext.form.TextField({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
inputType: 'password',
value: this.document.getValue(attr.id),
name: name,
disabled: disabled
});
break;
case 'image':
return new Ext.fdl.Image({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
name: name,
value: attr.getFileName()
});
break;
case 'file':
return new Ext.fdl.File({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
name: name,
value: attr.getFileName()
});
break;
case 'color':
return new Ext.fdl.Color({
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
name: name
});
break;
case 'frame':
var frame = new Ext.form.FieldSet({
title: Ext.util.Format.capitalize(attr.getLabel()),
autoHeight: true,
autoWidth: true,
collapsible: true,
labelWidth: 150,
//width: 'auto',
style: 'margin:10px;',
//bodyStyle: 'padding-left:40px;width:auto;'
bodyStyle: 'padding-left:20px;',
anchor: '100%'
});
for (var i = 0; i < ordered.length; i++) {
var curAttr = ordered[i];
if (curAttr.parentId == attr.id) {
var ext_input = this.getExtInput(curAttr.id);
if (ext_input != null) {
frame.add(ext_input);
}
}
}
return frame;
break;
case 'tab':
var tab = new Ext.Panel({
title: Ext.util.Format.capitalize(attr.getLabel()),
autoHeight: true,
autoWidth: true,
//frame: true,
layout: 'form',
border: false,
defaults: { // as we use deferredRender:false we mustn't
// render tabs into display:none containers
//hideMode: 'offsets'
}
});
var empty = true;
for (var i = 0; i < ordered.length; i++) {
var curAttr = ordered[i];
if (curAttr.parentId == attr.id) {
tab.add(this.getExtInput(curAttr.id));
empty = false;
}
}
if (!empty) {
return tab;
}
else {
return null;
}
break;
// Improvement for using RowEditor with array
/* case 'array':
var elements = attr.getElements();
var values = attr.getArrayValues();
var docWidget = this;
var columns = [new Ext.grid.RowNumberer()];
var fields = [];
for (var i = 0; i < elements.length; i++) {
var attr = this.document.getAttribute(elements[i].id);
var col = Ext.apply({},{
editor: this.getExtInput(elements[i].id, true, null, null, true),
header: attr.getLabel(),
dataIndex: elements[i].id,
hideable: false,
viewCfg: {
autoFill: true,
forceFit: true
}
});
//should be a method
switch(attr.type){
case 'docid':
var renderer = attr.getTitle.createDelegate(attr);
//this is not the good renderer
//the good one would only be fdl.getTitle
//that does not exists currently
break;
default:
var renderer = null;
break;
}
if(renderer){
Ext.apply(col, {
renderer: renderer
});
}
//EO method
var field = Ext.apply({},{
name: elements[i].id
})
columns.push(col);
fields.push(field);
}
var store = new Ext.data.Store({
reader: new Ext.data.JsonReader({
fields: fields
}),
data: values
})
// not forget to include ext/examples/ux/RowEditor.js
//maybe work on roweditor about last row...
var editor = new Ext.ux.RowEditor({
saveText: 'Update'
});
//var arrayPanel = new Ext.grid.EditorGridPanel({ //only gridpanel if using roweditor!
var arrayPanel = new Ext.grid.GridPanel({
title: Ext.util.Format.capitalize(attr.getLabel()),
frame: true,
plugins:[editor],
collapsible: true,
titleCollapse: true,
animCollapse: false,
style: 'margin-bottom:10px;',
columns: columns,
store: store,
autoHeight: true,
autoScroll: true,
bbar: [{
ref: '../addBtn',
iconCls: 'icon-row-add',
text: 'Add row',
handler: function(){
var e = new store.recordType();
editor.stopEditing();
store.insert(0, e);
arrayPanel.getView().refresh();
arrayPanel.getSelectionModel().selectRow(0);
editor.startEditing(0);
}
},{
ref: '../removeBtn',
iconCls: 'icon-row-delete',
text: 'Remove row',
disabled: true,
handler: function(){
editor.stopEditing();
var s = arrayPanel.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
store.remove(r);
}
}
}]
});
arrayPanel.getSelectionModel().on('selectionchange', function(sm){
arrayPanel.removeBtn.setDisabled(sm.getCount() < 1);
});
return arrayPanel;
break;
*/
case 'array':
var elements = attr.getElements();
var fields = new Array();
for (var i = 0; i < elements.length; i++) {
fields.push(elements[i].id);
}
//var values = attr.getArrayValues();
var values = this.document.getValue(attr.id) || [];
var docWidget = this;
var columns = 0;
for (var i = 0; i < elements.length; i++) {
// Handle Visibility
switch (elements[i].getVisibility()) {
case 'W':
case 'O':
columns++;
break;
}
}
var arrayPanel = new Ext.Panel({
title: Ext.util.Format.capitalize(attr.getLabel()),
frame: true,
collapsible: true,
titleCollapse: true,
animCollapse: false,
style: 'margin-bottom:10px;',
layout: 'table',
layoutConfig: {
columns: columns
},
bbar: [{
text: 'Ajouter',
tooltip: 'Ajouter',
scope: docWidget,
handler: function(){
// For each columnPanel child
// Add one row of editor widget
var elements = attr.getElements();
for (var i = 0; i < elements.length; i++) {
switch (elements[i].getVisibility()) {
case 'W':
case 'O':
var editorWidget = this.getExtInput(elements[i].id, true, null, null, true);
arrayPanel.add(editorWidget);
break;
}
}
arrayPanel.doLayout();
}
}]
});
for (var i = 0; i < elements.length; i++) {
// Handle Visibility
switch (elements[i].getVisibility()) {
case 'W':
case 'O':
switch (elements[i].type) {
case 'enum':
if (attr.getOption('eformat') == 'bool') {
var width = 60;
}
else {
var width = 120;
}
break;
case 'docid':
var width = 200;
break;
case 'date':
var width = 110;
break;
default:
var width = 100;
break;
}
var columnPanel = new Ext.Panel({
title: Ext.util.Format.capitalize(elements[i].getLabel()),
width: width,
style: 'overflow:auto;',
bodyStyle: 'text-align:center;margin-top:3px;',
frame: false,
layout: 'form',
hideLabels: true
});
arrayPanel.add(columnPanel);
break;
}
}
for (var j = 0; j < values.length; j++) {
for (var i = 0; i < elements.length; i++) {
switch (elements[i].getVisibility()) {
case 'W':
case 'O':
var editorWidget = this.getExtInput(elements[i].id, true, j, values[j][elements[i].id]);
arrayPanel.add(editorWidget);
}
}
}
return arrayPanel;
break;
case 'enum':
// var label = attr.getEnumLabel({
// key: this.document.getValue(attr.id)[rank]
// });
//
// if (attr.getOption('eformat') == 'bool') {
//
// return new Ext.ux.form.XCheckbox({
// fieldLabel: inArray ? ' ' : Ext.util.Format.capitalize(attr.getLabel()),
// //boxLabel: inArray ? '' : Ext.util.Format.capitalize(attr.getLabel()) ,
// checked: this.document.getValue(attr.id)[rank] == 'yes' ? true : false,
// submitOnValue: 'yes',
// submitOffValue: 'no',
// name: name,
// style: inArray ? 'margin:auto;' : ''
// });
//
// }
// else {
//
// var items = attr.getEnumItems();
//
// return new Ext.form.ComboBox({
//
// fieldLabel: inArray ? ' ' : Ext.util.Format.capitalize(attr.getLabel()),
//
// valueField: 'key',
// displayField: 'label',
//
// width: 150,
//
// // Required to give simple select behaviour
// //emptyText: '--Famille--',
// editable: false,
// forceSelection: true,
// disableKeyFilter: true,
// triggerAction: 'all',
// mode: 'local',
//
// value: items[0].key,
//
// store: new Ext.data.JsonStore({
// data: items,
// fields: ['key', 'label']
// })
//
// });
//
// }
break;
case 'docid':
if (attr.getOption('multiple') == 'yes') {
return new Ext.fdl.MultiDocId({
attribute: attr,
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
docIdList: this.document.getValue(attr.id),
docTitleList: this.document.getValue(attr.id + '_title')
});
}
else {
return new Ext.fdl.DocId({
attribute: attr,
fieldLabel: Ext.util.Format.capitalize(attr.getLabel()),
//value: this.document.getValue(attr.id),
value: !empty ? (rank != null ? this.document.getDisplayValue(attr.id)[rank] : this.document.getDisplayValue(attr.id)) : null,
//name: attr.id,
hiddenName: name,
hiddenValue: !empty ? (defaultValue != null ? defaultValue : this.document.getValue(attr.id)) : null,
allowBlank: !attr.needed,
disabled: disabled
});
}
break;
default:
console.log('Attribute not represented : ' + attr.type);
return null;
break;
}
}
});
| Eric-Brison/dynacase-core | Zone/Ui/widget-document.js | JavaScript | agpl-3.0 | 80,977 | [
30522,
1013,
1008,
1008,
1008,
1030,
3166,
9617,
20553,
2078,
1008,
1030,
6105,
8299,
1024,
1013,
1013,
7479,
1012,
1042,
22747,
1012,
8917,
1013,
13202,
1013,
15943,
1013,
12943,
24759,
1011,
1017,
1012,
1014,
1012,
16129,
27004,
21358,
75... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
"""
Manage and display experimental results.
"""
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
__version__ = '0.4.3'
import sys
import os
import numpy
import random
import scipy
import socket
sys.path.append('./code')
from argparse import ArgumentParser
from pickle import Unpickler, dump
from subprocess import Popen, PIPE
from os import path
from warnings import warn
from time import time, strftime, localtime
from numpy import ceil, argsort
from numpy.random import rand, randint
from distutils.version import StrictVersion
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from httplib import HTTPConnection
from getopt import getopt
class Experiment:
"""
@type time: float
@ivar time: time at initialization of experiment
@type duration: float
@ivar duration: time in seconds between initialization and saving
@type script: string
@ivar script: stores the content of the main Python script
@type platform: string
@ivar platform: information about operating system
@type processors: string
@ivar processors: some information about the processors
@type environ: string
@ivar environ: environment variables at point of initialization
@type hostname: string
@ivar hostname: hostname of server running the experiment
@type cwd: string
@ivar cwd: working directory at execution time
@type comment: string
@ivar comment: a comment describing the experiment
@type results: dictionary
@ivar results: container to store experimental results
@type commit: string
@ivar commit: git commit hash
@type modified: boolean
@ivar modified: indicates uncommited changes
@type filename: string
@ivar filename: path to stored results
@type seed: int
@ivar seed: random seed used through the experiment
@type versions: dictionary
@ivar versions: versions of Python, numpy and scipy
"""
def __str__(self):
"""
Summarize information about the experiment.
@rtype: string
@return: summary of the experiment
"""
strl = []
# date and duration of experiment
strl.append(strftime('date \t\t %a, %d %b %Y %H:%M:%S', localtime(self.time)))
strl.append('duration \t ' + str(int(self.duration)) + 's')
strl.append('hostname \t ' + self.hostname)
# commit hash
if self.commit:
if self.modified:
strl.append('commit \t\t ' + self.commit + ' (modified)')
else:
strl.append('commit \t\t ' + self.commit)
# results
strl.append('results \t {' + ', '.join(map(str, self.results.keys())) + '}')
# comment
if self.comment:
strl.append('\n' + self.comment)
return '\n'.join(strl)
def __del__(self):
self.status(None)
def __init__(self, filename='', comment='', seed=None, server=None, port=8000):
"""
If the filename is given and points to an existing experiment, load it.
Otherwise store the current timestamp and try to get commit information
from the repository in the current directory.
@type filename: string
@param filename: path to where the experiment will be stored
@type comment: string
@param comment: a comment describing the experiment
@type seed: integer
@param seed: random seed used in the experiment
"""
self.id = 0
self.time = time()
self.comment = comment
self.filename = filename
self.results = {}
self.seed = seed
self.script = ''
self.cwd = ''
self.platform = ''
self.processors = ''
self.environ = ''
self.duration = 0
self.versions = {}
self.server = ''
if self.seed is None:
self.seed = int((time() + 1e6 * rand()) * 1e3) % 4294967295
# set random seed
random.seed(self.seed)
numpy.random.seed(self.seed)
if self.filename:
# load given experiment
self.load()
else:
# identifies the experiment
self.id = randint(1E8)
# check if a comment was passed via the command line
parser = ArgumentParser(add_help=False)
parser.add_argument('--comment')
optlist, argv = parser.parse_known_args(sys.argv[1:])
optlist = vars(optlist)
# remove comment command line argument from argument list
sys.argv[1:] = argv
# comment given as command line argument
self.comment = optlist.get('comment', '')
# get OS information
self.platform = sys.platform
# arguments to the program
self.argv = sys.argv
self.script_path = sys.argv[0]
try:
with open(sys.argv[0]) as handle:
# store python script
self.script = handle.read()
except:
warn('Unable to read Python script.')
# environment variables
self.environ = os.environ
self.cwd = os.getcwd()
self.hostname = socket.gethostname()
# store some information about the processor(s)
if self.platform == 'linux2':
cmd = 'egrep "processor|model name|cpu MHz|cache size" /proc/cpuinfo'
with os.popen(cmd) as handle:
self.processors = handle.read()
elif self.platform == 'darwin':
cmd = 'system_profiler SPHardwareDataType | egrep "Processor|Cores|L2|Bus"'
with os.popen(cmd) as handle:
self.processors = handle.read()
# version information
self.versions['python'] = sys.version
self.versions['numpy'] = numpy.__version__
self.versions['scipy'] = scipy.__version__
# store information about git repository
if path.isdir('.git'):
# get commit hash
pr1 = Popen(['git', 'log', '-1'], stdout=PIPE)
pr2 = Popen(['head', '-1'], stdin=pr1.stdout, stdout=PIPE)
pr3 = Popen(['cut', '-d', ' ', '-f', '2'], stdin=pr2.stdout, stdout=PIPE)
self.commit = pr3.communicate()[0][:-1]
# check if project contains uncommitted changes
pr1 = Popen(['git', 'status', '--porcelain'], stdout=PIPE)
pr2 = Popen(['egrep', '^.M'], stdin=pr1.stdout, stdout=PIPE)
self.modified = pr2.communicate()[0]
if self.modified:
warn('Uncommitted changes.')
else:
# no git repository
self.commit = None
self.modified = False
# server managing experiments
self.server = server
self.port = port
self.status('running')
def status(self, status, **kwargs):
if self.server:
try:
conn = HTTPConnection(self.server, self.port)
conn.request('GET', '/version/')
resp = conn.getresponse()
if not resp.read().startswith('Experiment'):
raise RuntimeError()
HTTPConnection(self.server, self.port).request('POST', '', str(dict({
'id': self.id,
'version': __version__,
'status': status,
'hostname': self.hostname,
'cwd': self.cwd,
'script_path': self.script_path,
'script': self.script,
'comment': self.comment,
'time': self.time,
}, **kwargs)))
except:
warn('Unable to connect to \'{0}:{1}\'.'.format(self.server, self.port))
def progress(self, progress):
self.status('PROGRESS', progress=progress)
def save(self, filename=None, overwrite=False):
"""
Store results. If a filename is given, the default is overwritten.
@type filename: string
@param filename: path to where the experiment will be stored
@type overwrite: boolean
@param overwrite: overwrite existing files
"""
self.duration = time() - self.time
if filename is None:
filename = self.filename
else:
# replace {0} and {1} by date and time
tmp1 = strftime('%d%m%Y', localtime(time()))
tmp2 = strftime('%H%M%S', localtime(time()))
filename = filename.format(tmp1, tmp2)
self.filename = filename
# make sure directory exists
try:
os.makedirs(path.dirname(filename))
except OSError:
pass
# make sure filename is unique
counter = 0
pieces = path.splitext(filename)
if not overwrite:
while path.exists(filename):
counter += 1
filename = pieces[0] + '.' + str(counter) + pieces[1]
if counter:
warn(''.join(pieces) + ' already exists. Saving to ' + filename + '.')
# store experiment
with open(filename, 'wb') as handle:
dump({
'version': __version__,
'id': self.id,
'time': self.time,
'seed': self.seed,
'duration': self.duration,
'environ': self.environ,
'hostname': self.hostname,
'cwd': self.cwd,
'argv': self.argv,
'script': self.script,
'script_path': self.script_path,
'processors': self.processors,
'platform': self.platform,
'comment': self.comment,
'commit': self.commit,
'modified': self.modified,
'versions': self.versions,
'results': self.results}, handle, 1)
self.status('SAVE', filename=filename, duration=self.duration)
def load(self, filename=None):
"""
Loads experimental results from the specified file.
@type filename: string
@param filename: path to where the experiment is stored
"""
if filename:
self.filename = filename
with open(self.filename, 'rb') as handle:
res = load(handle)
self.time = res['time']
self.seed = res['seed']
self.duration = res['duration']
self.processors = res['processors']
self.environ = res['environ']
self.platform = res['platform']
self.comment = res['comment']
self.commit = res['commit']
self.modified = res['modified']
self.versions = res['versions']
self.results = res['results']
self.argv = res['argv'] \
if StrictVersion(res['version']) >= '0.3.1' else None
self.script = res['script'] \
if StrictVersion(res['version']) >= '0.4.0' else None
self.script_path = res['script_path'] \
if StrictVersion(res['version']) >= '0.4.0' else None
self.cwd = res['cwd'] \
if StrictVersion(res['version']) >= '0.4.0' else None
self.hostname = res['hostname'] \
if StrictVersion(res['version']) >= '0.4.0' else None
self.id = res['id'] \
if StrictVersion(res['version']) >= '0.4.0' else None
def __getitem__(self, key):
return self.results[key]
def __setitem__(self, key, value):
self.results[key] = value
def __delitem__(self, key):
del self.results[key]
class ExperimentRequestHandler(BaseHTTPRequestHandler):
"""
Renders HTML showing running and finished experiments.
"""
xpck_path = ''
running = {}
finished = {}
def do_GET(self):
"""
Renders HTML displaying running and saved experiments.
"""
# number of bars representing progress
max_bars = 20
if self.path == '/version/':
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write('Experiment {0}'.format(__version__))
elif self.path.startswith('/running/'):
id = int([s for s in self.path.split('/') if s != ''][-1])
# display running experiment
if id in ExperimentRequestHandler.running:
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(HTML_HEADER)
self.wfile.write('<h2>Experiment</h2>')
instance = ExperimentRequestHandler.running[id]
num_bars = int(instance['progress']) * max_bars / 100
self.wfile.write('<table>')
self.wfile.write('<tr><th>Experiment:</th><td>{0}</td></tr>'.format(
os.path.join(instance['cwd'], instance['script_path'])))
self.wfile.write('<tr><th>Hostname:</th><td>{0}</td></tr>'.format(instance['hostname']))
self.wfile.write('<tr><th>Status:</th><td class="running">{0}</td></tr>'.format(instance['status']))
self.wfile.write('<tr><th>Progress:</th><td class="progress"><span class="bars">{0}</span>{1}</td></tr>'.format(
'|' * num_bars, '|' * (max_bars - num_bars)))
self.wfile.write('<tr><th>Start:</th><td>{0}</td></tr>'.format(
strftime('%a, %d %b %Y %H:%M:%S', localtime(instance['time']))))
self.wfile.write('<tr><th>Comment:</th><td>{0}</td></tr>'.format(
instance['comment'] if instance['comment'] else '-'))
self.wfile.write('</table>')
self.wfile.write('<h2>Script</h2>')
self.wfile.write('<pre>{0}</pre>'.format(instance['script']))
self.wfile.write(HTML_FOOTER)
elif id in ExperimentRequestHandler.finished:
self.send_response(302)
self.send_header('Location', '/finished/{0}/'.format(id))
self.end_headers()
else:
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(HTML_HEADER)
self.wfile.write('<h2>404</h2>')
self.wfile.write('Requested experiment not found.')
self.wfile.write(HTML_FOOTER)
elif self.path.startswith('/finished/'):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(HTML_HEADER)
id = int([s for s in self.path.split('/') if s != ''][-1])
# display finished experiment
if id in ExperimentRequestHandler.finished:
instance = ExperimentRequestHandler.finished[id]
if id in ExperimentRequestHandler.running:
progress = ExperimentRequestHandler.running[id]['progress']
else:
progress = 100
num_bars = int(progress) * max_bars / 100
self.wfile.write('<h2>Experiment</h2>')
self.wfile.write('<table>')
self.wfile.write('<tr><th>Experiment:</th><td>{0}</td></tr>'.format(
os.path.join(instance['cwd'], instance['script_path'])))
self.wfile.write('<tr><th>Results:</th><td>{0}</td></tr>'.format(
os.path.join(instance['cwd'], instance['filename'])))
self.wfile.write('<tr><th>Status:</th><td class="finished">{0}</td></tr>'.format(instance['status']))
self.wfile.write('<tr><th>Progress:</th><td class="progress"><span class="bars">{0}</span>{1}</td></tr>'.format(
'|' * num_bars, '|' * (max_bars - num_bars)))
self.wfile.write('<tr><th>Start:</th><td>{0}</td></tr>'.format(
strftime('%a, %d %b %Y %H:%M:%S', localtime(instance['time']))))
self.wfile.write('<tr><th>End:</th><td>{0}</td></tr>'.format(
strftime('%a, %d %b %Y %H:%M:%S', localtime(instance['duration']))))
self.wfile.write('<tr><th>Comment:</th><td>{0}</td></tr>'.format(
instance['comment'] if instance['comment'] else '-'))
self.wfile.write('</table>')
self.wfile.write('<h2>Results</h2>')
try:
experiment = Experiment(os.path.join(instance['cwd'], instance['filename']))
except:
self.wfile.write('Could not open file.')
else:
self.wfile.write('<table>')
for key, value in experiment.results.items():
self.wfile.write('<tr><th>{0}</th><td>{1}</td></tr>'.format(key, value))
self.wfile.write('</table>')
self.wfile.write('<h2>Script</h2>')
self.wfile.write('<pre>{0}</pre>'.format(instance['script']))
else:
self.wfile.write('<h2>404</h2>')
self.wfile.write('Requested experiment not found.')
self.wfile.write(HTML_FOOTER)
else:
files = []
if 'xpck_path' in ExperimentRequestHandler.__dict__:
if ExperimentRequestHandler.xpck_path != '':
for path in ExperimentRequestHandler.xpck_path.split(':'):
files += [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xpck')]
if 'XPCK_PATH' in os.environ:
for path in os.environ['XPCK_PATH'].split(':'):
files += [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.xpck')]
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(HTML_HEADER)
self.wfile.write('<h2>Running</h2>')
# display running experiments
if ExperimentRequestHandler.running:
self.wfile.write('<table>')
self.wfile.write('<tr>')
self.wfile.write('<th>Experiment</th>')
self.wfile.write('<th>Hostname</th>')
self.wfile.write('<th>Status</th>')
self.wfile.write('<th>Progress</th>')
self.wfile.write('<th>Start</th>')
self.wfile.write('<th>Comment</th>')
self.wfile.write('</tr>')
# sort ids by start time of experiment
times = [instance['time'] for instance in ExperimentRequestHandler.running.values()]
ids = ExperimentRequestHandler.running.keys()
ids = [ids[i] for i in argsort(times)][::-1]
for id in ids:
instance = ExperimentRequestHandler.running[id]
num_bars = int(instance['progress']) * max_bars / 100
self.wfile.write('<tr>')
self.wfile.write('<td class="filepath"><a href="/running/{1}/">{0}</a></td>'.format(
instance['script_path'], instance['id']))
self.wfile.write('<td>{0}</td>'.format(instance['hostname']))
self.wfile.write('<td class="running">{0}</td>'.format(instance['status']))
self.wfile.write('<td class="progress"><span class="bars">{0}</span>{1}</td>'.format(
'|' * num_bars, '|' * (max_bars - num_bars)))
self.wfile.write('<td>{0}</td>'.format(strftime('%a, %d %b %Y %H:%M:%S',
localtime(instance['time']))))
self.wfile.write('<td class="comment">{0}</td>'.format(
instance['comment'] if instance['comment'] else '-'))
self.wfile.write('</tr>')
self.wfile.write('</table>')
else:
self.wfile.write('No running experiments.')
self.wfile.write('<h2>Saved</h2>')
# display saved experiments
if ExperimentRequestHandler.finished:
self.wfile.write('<table>')
self.wfile.write('<tr>')
self.wfile.write('<th>Results</th>')
self.wfile.write('<th>Status</th>')
self.wfile.write('<th>Progress</th>')
self.wfile.write('<th>Start</th>')
self.wfile.write('<th>End</th>')
self.wfile.write('<th>Comment</th>')
self.wfile.write('</tr>')
# sort ids by start time of experiment
times = [instance['time'] + instance['duration']
for instance in ExperimentRequestHandler.finished.values()]
ids = ExperimentRequestHandler.finished.keys()
ids = [ids[i] for i in argsort(times)][::-1]
for id in ids:
instance = ExperimentRequestHandler.finished[id]
if id in ExperimentRequestHandler.running:
progress = ExperimentRequestHandler.running[id]['progress']
else:
progress = 100
num_bars = int(progress) * max_bars / 100
self.wfile.write('<tr>')
self.wfile.write('<td class="filepath"><a href="/finished/{1}/">{0}</a></td>'.format(
instance['filename'], instance['id']))
self.wfile.write('<td class="finished">saved</td>')
self.wfile.write('<td class="progress"><span class="bars">{0}</span>{1}</td>'.format(
'|' * num_bars, '|' * (max_bars - num_bars)))
self.wfile.write('<td>{0}</td>'.format(strftime('%a, %d %b %Y %H:%M:%S',
localtime(instance['time']))))
self.wfile.write('<td>{0}</td>'.format(strftime('%a, %d %b %Y %H:%M:%S',
localtime(instance['time'] + instance['duration']))))
self.wfile.write('<td class="comment">{0}</td>'.format(
instance['comment'] if instance['comment'] else '-'))
self.wfile.write('</tr>')
self.wfile.write('</table>')
else:
self.wfile.write('No saved experiments.')
self.wfile.write(HTML_FOOTER)
def do_POST(self):
instances = ExperimentRequestHandler.running
instance = eval(self.rfile.read(int(self.headers['Content-Length'])))
if instance['status'] is 'PROGRESS':
if instance['id'] not in instances:
instances[instance['id']] = instance
instances[instance['id']]['status'] = 'running'
instances[instance['id']]['progress'] = instance['progress']
elif instance['status'] is 'SAVE':
ExperimentRequestHandler.finished[instance['id']] = instance
ExperimentRequestHandler.finished[instance['id']]['status'] = 'saved'
else:
if instance['id'] in instances:
progress = instances[instance['id']]['progress']
else:
progress = 0
instances[instance['id']] = instance
instances[instance['id']]['progress'] = progress
if instance['status'] is None:
try:
del instances[instance['id']]
except:
pass
class XUnpickler(Unpickler):
"""
An extension of the Unpickler class which resolves some backwards
compatibility issues of Numpy.
"""
def find_class(self, module, name):
"""
Helps Unpickler to find certain Numpy modules.
"""
try:
numpy_version = StrictVersion(numpy.__version__)
if numpy_version >= '1.5.0':
if module == 'numpy.core.defmatrix':
module = 'numpy.matrixlib.defmatrix'
except ValueError:
pass
return Unpickler.find_class(self, module, name)
def load(file):
return XUnpickler(file).load()
def main(argv):
"""
Load and display experiment information.
"""
if len(argv) < 2:
print 'Usage:', argv[0], '[--server] [--port=<port>] [--path=<path>] [filename]'
return 0
optlist, argv = getopt(argv[1:], '', ['server', 'port=', 'path='])
optlist = dict(optlist)
if '--server' in optlist:
try:
ExperimentRequestHandler.xpck_path = optlist.get('--path', '')
port = optlist.get('--port', 8000)
# start server
server = HTTPServer(('', port), ExperimentRequestHandler)
server.serve_forever()
except KeyboardInterrupt:
server.socket.close()
return 0
# load experiment
experiment = Experiment(sys.argv[1])
if len(argv) > 1:
# print arguments
for arg in argv[1:]:
try:
print experiment[arg]
except:
print experiment[int(arg)]
return 0
# print summary of experiment
print experiment
return 0
HTML_HEADER = '''<html>
<head>
<title>Experiments</title>
<style type="text/css">
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 11pt;
color: black;
background: white;
padding: 0pt 20pt;
}
h2 {
margin-top: 20pt;
font-size: 16pt;
}
table {
border-collapse: collapse;
}
tr:nth-child(even) {
background: #f4f4f4;
}
th {
font-size: 12pt;
text-align: left;
padding: 2pt 10pt 3pt 0pt;
}
td {
font-size: 10pt;
padding: 3pt 10pt 2pt 0pt;
}
pre {
font-size: 10pt;
background: #f4f4f4;
padding: 5pt;
}
a {
text-decoration: none;
color: #04a;
}
.running {
color: #08b;
}
.finished {
color: #390;
}
.comment {
min-width: 200pt;
font-style: italic;
}
.progress {
color: #ccc;
}
.progress .bars {
color: black;
}
</style>
</head>
<body>'''
HTML_FOOTER = '''
</body>
</html>'''
if __name__ == '__main__':
sys.exit(main(sys.argv))
| jonasrauber/c2s | c2s/experiment.py | Python | mit | 21,962 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1000,
1000,
1000,
6133,
1998,
4653,
6388,
3463,
1012,
1000,
1000,
1000,
1035,
1035,
30524,
1996,
2483,
1026,
6326,
1030,
1996,
2483,
1012,
22834,
1028,
1005,
1035,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace hemio\html;
/**
* The <code>figure</code> element represents a unit of content, optionally with
* a caption, that is self-contained, that is typically referenced as a single
* unit from the main flow of the document, and that can be moved away from the
* main flow of the document without affecting the document’s meaning.
*
* @since version 1.0
* @url http://www.w3.org/TR/html5/grouping-content.html#the-figure-element
*/
class Figure extends Abstract_\ElementContent
{
use Trait_\DefaultElementContent;
public static function tagName()
{
return 'figure';
}
public function blnIsBlock()
{
return true;
}
}
| qua-bla/html | src/Figure.php | PHP | gpl-3.0 | 683 | [
30522,
1026,
1029,
25718,
3415,
15327,
19610,
3695,
1032,
16129,
1025,
1013,
1008,
1008,
1008,
1996,
1026,
3642,
1028,
3275,
1026,
1013,
3642,
1028,
5783,
5836,
1037,
3131,
1997,
4180,
1010,
11887,
2135,
2007,
1008,
1037,
14408,
3258,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) Aura development team - Licensed under GNU GPL
// For more information, see license file in the main folder
using Aura.Data;
using Aura.Data.Database;
using Aura.Shared.Database;
using Aura.Shared.Mabi.Const;
using Aura.Shared.Util;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.IO;
namespace Aura.Login.Database
{
public class LoginDb : AuraDb
{
/// <summary>
/// Checks whether the SQL update file has already been applied.
/// </summary>
/// <param name="updateFile"></param>
/// <returns></returns>
public bool CheckUpdate(string updateFile)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("SELECT * FROM `updates` WHERE `path` = @path", conn))
{
mc.Parameters.AddWithValue("@path", updateFile);
using (var reader = mc.ExecuteReader())
return reader.Read();
}
}
/// <summary>
/// Executes SQL update file.
/// </summary>
/// <param name="updateFile"></param>
public void RunUpdate(string updateFile)
{
try
{
using (var conn = this.Connection)
{
// Run update
using (var cmd = new MySqlCommand(File.ReadAllText(Path.Combine("sql", updateFile)), conn))
cmd.ExecuteNonQuery();
// Log update
using (var cmd = new InsertCommand("INSERT INTO `updates` {0}", conn))
{
cmd.Set("path", updateFile);
cmd.Execute();
}
Log.Info("Successfully applied '{0}'.", updateFile);
}
}
catch (Exception ex)
{
Log.Error("RunUpdate: Failed to run '{0}': {1}", updateFile, ex.Message);
CliUtil.Exit(1);
}
}
/// <summary>
/// Returns account or null if account doesn't exist.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public Account GetAccount(string accountId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("SELECT * FROM `accounts` WHERE `accountId` = @accountId", conn))
{
mc.Parameters.AddWithValue("@accountId", accountId);
using (var reader = mc.ExecuteReader())
{
if (!reader.Read())
return null;
var account = new Account();
account.Name = reader.GetStringSafe("accountId");
account.Password = reader.GetStringSafe("password");
account.SecondaryPassword = reader.GetStringSafe("secondaryPassword");
account.SessionKey = reader.GetInt64("sessionKey");
account.BannedExpiration = reader.GetDateTimeSafe("banExpiration");
account.BannedReason = reader.GetStringSafe("banReason");
return account;
}
}
}
/// <summary>
/// Updates secondary password.
/// </summary>
/// <param name="account"></param>
public void UpdateAccountSecondaryPassword(Account account)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("UPDATE `accounts` SET `secondaryPassword` = @secondaryPassword WHERE `accountId` = @accountId", conn))
{
mc.Parameters.AddWithValue("@accountId", account.Name);
mc.Parameters.AddWithValue("@secondaryPassword", account.SecondaryPassword);
mc.ExecuteNonQuery();
}
}
/// <summary>
/// Sets new randomized session key for the account and returns it.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public long CreateSession(string accountId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("UPDATE `accounts` SET `sessionKey` = @sessionKey WHERE `accountId` = @accountId", conn))
{
var sessionKey = RandomProvider.Get().NextInt64();
mc.Parameters.AddWithValue("@accountId", accountId);
mc.Parameters.AddWithValue("@sessionKey", sessionKey);
mc.ExecuteNonQuery();
return sessionKey;
}
}
/// <summary>
/// Updates lastLogin and loggedIn from the account.
/// </summary>
/// <param name="account"></param>
public void UpdateAccount(Account account)
{
using (var conn = this.Connection)
using (var cmd = new UpdateCommand("UPDATE `accounts` SET `lastLogin` = @lastLogin, `loggedIn` = @loggedIn WHERE `accountId` = @accountId", conn))
{
cmd.Set("accountId", account.Name);
cmd.Set("lastLogin", account.LastLogin);
cmd.Set("loggedIn", account.LoggedIn);
cmd.Execute();
}
}
/// <summary>
/// Returns all character cards present for this account.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public List<Card> GetCharacterCards(string accountId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("SELECT `cardId`, `type` FROM `cards` WHERE `accountId` = @accountId AND race = 0 AND !`isGift`", conn))
{
mc.Parameters.AddWithValue("@accountId", accountId);
var result = new List<Card>();
using (var reader = mc.ExecuteReader())
{
while (reader.Read())
{
var card = new Card();
card.Id = reader.GetInt64("cardId");
card.Type = reader.GetInt32("type");
result.Add(card);
}
}
return result;
}
}
/// <summary>
/// Returns all pet and partner cards present for this account.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public List<Card> GetPetCards(string accountId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("SELECT `cardId`, `type`, `race` FROM `cards` WHERE `accountId` = @accountId AND race > 0 AND !`isGift`", conn))
{
mc.Parameters.AddWithValue("@accountId", accountId);
var result = new List<Card>();
using (var reader = mc.ExecuteReader())
{
while (reader.Read())
{
var card = new Card();
card.Id = reader.GetInt64("cardId");
card.Type = reader.GetInt32("type");
card.Race = reader.GetInt32("race");
result.Add(card);
}
}
return result;
}
}
/// <summary>
/// Returns all gifts present for this account.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public List<Gift> GetGifts(string accountId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("SELECT * FROM `cards` WHERE `accountId` = @accountId AND `isGift`", conn))
{
mc.Parameters.AddWithValue("@accountId", accountId);
var result = new List<Gift>();
using (var reader = mc.ExecuteReader())
{
while (reader.Read())
{
var gift = new Gift();
gift.Id = reader.GetInt64("cardId");
gift.Type = reader.GetInt32("type");
gift.Race = reader.GetInt32("race");
gift.Message = reader.GetStringSafe("message");
gift.Sender = reader.GetStringSafe("sender");
gift.SenderServer = reader.GetStringSafe("senderServer");
gift.Receiver = reader.GetStringSafe("receiver");
gift.ReceiverServer = reader.GetStringSafe("receiverServer");
gift.Added = reader.GetDateTimeSafe("added");
result.Add(gift);
}
}
return result;
}
}
/// <summary>
/// Returns a list of all characters on this account.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public List<Character> GetCharacters(string accountId)
{
using (var conn = this.Connection)
{
var result = new List<Character>();
this.GetCharacters(accountId, "characters", CharacterType.Character, ref result, conn);
return result;
}
}
/// <summary>
/// Returns a list of all pets/partners on this account.
/// </summary>
/// <param name="accountId"></param>
/// <returns></returns>
public List<Character> GetPetsAndPartners(string accountId)
{
using (var conn = this.Connection)
{
var result = new List<Character>();
this.GetCharacters(accountId, "pets", CharacterType.Pet, ref result, conn);
this.GetCharacters(accountId, "partners", CharacterType.Partner, ref result, conn);
return result;
}
}
/// <summary>
/// Queries characters/pets/partners and adds them to result.
/// </summary>
/// <param name="accountId"></param>
/// <param name="table"></param>
/// <param name="primary"></param>
/// <param name="type"></param>
/// <param name="result"></param>
/// <param name="conn"></param>
private void GetCharacters(string accountId, string table, CharacterType type, ref List<Character> result, MySqlConnection conn)
{
using (var mc = new MySqlCommand(
"SELECT * " +
"FROM `" + table + "` AS c " +
"INNER JOIN `creatures` AS cr ON c.creatureId = cr.creatureId " +
"WHERE `accountId` = @accountId "
, conn))
{
mc.Parameters.AddWithValue("@accountId", accountId);
using (var reader = mc.ExecuteReader())
{
while (reader.Read())
{
var character = new Character();
character.EntityId = reader.GetInt64("entityId");
character.CreatureId = reader.GetInt64("creatureId");
character.Name = reader.GetStringSafe("name");
character.Server = reader.GetStringSafe("server");
character.Race = reader.GetInt32("race");
character.DeletionTime = reader.GetDateTimeSafe("deletionTime");
character.SkinColor = reader.GetByte("skinColor");
character.EyeType = reader.GetInt16("eyeType");
character.EyeColor = reader.GetByte("eyeColor");
character.MouthType = reader.GetByte("mouthType");
character.State = (CreatureStates)reader.GetUInt32("state");
character.Height = reader.GetFloat("height");
character.Weight = reader.GetFloat("weight");
character.Upper = reader.GetFloat("upper");
character.Lower = reader.GetInt32("lower");
character.Color1 = reader.GetUInt32("color1");
character.Color2 = reader.GetUInt32("color2");
character.Color3 = reader.GetUInt32("color3");
result.Add(character);
}
}
}
}
/// <summary>
/// Returns list of all visible items on creature.
/// </summary>
/// <param name="creatureId"></param>
/// <returns></returns>
public List<Item> GetEquipment(long creatureId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("SELECT * FROM `items` WHERE `creatureId` = @creatureId", conn))
{
mc.Parameters.AddWithValue("@creatureId", creatureId);
var result = new List<Item>();
using (var reader = mc.ExecuteReader())
{
while (reader.Read())
{
var item = new Item();
item.Id = reader.GetInt64("entityId");
item.Info.Id = reader.GetInt32("itemId");
item.Info.Pocket = (Pocket)reader.GetByte("pocket");
item.Info.Color1 = reader.GetUInt32("color1");
item.Info.Color2 = reader.GetUInt32("color2");
item.Info.Color3 = reader.GetUInt32("color3");
item.Info.State = reader.GetByte("state");
if (item.IsVisible)
result.Add(item);
}
}
return result;
}
}
/// <summary>
/// Creates creature:character combination for the account.
/// Returns false if either failed, true on success.
/// character's ids are set to the new ids.
/// </summary>
/// <param name="accountId"></param>
/// <param name="character"></param>
/// <param name="items"></param>
/// <returns></returns>
public bool CreateCharacter(string accountId, Character character, List<Item> items)
{
return this.Create("characters", accountId, character, items);
}
/// <summary>
/// Creates creature:pet combination for the account.
/// Returns false if either failed, true on success.
/// pet's ids are set to the new ids.
/// </summary>
/// <param name="accountId"></param>
/// <param name="pet"></param>
/// <returns></returns>
public bool CreatePet(string accountId, Character pet)
{
return this.Create("pets", accountId, pet, null);
}
/// <summary>
/// Creates creature:partner combination for the account.
/// Returns false if either failed, true on success.
/// partner's ids are set to the new ids.
/// </summary>
/// <param name="accountId"></param>
/// <param name="partner"></param>
/// <param name="items"></param>
/// <returns></returns>
public bool CreatePartner(string accountId, Character partner, List<Item> items)
{
return this.Create("partners", accountId, partner, items);
}
/// <summary>
/// Creates creature:x combination for the account.
/// Returns false if either failed, true on success.
/// character's ids are set to the new ids.
/// </summary>
/// <param name="table"></param>
/// <param name="accountId"></param>
/// <param name="character"></param>
/// <param name="items"></param>
/// <returns></returns>
private bool Create(string table, string accountId, Character character, List<Item> items)
{
using (var conn = this.Connection)
using (var transaction = conn.BeginTransaction())
{
try
{
// Creature
character.CreatureId = this.CreateCreature(character, conn, transaction);
// Character
using (var cmd = new InsertCommand("INSERT INTO `" + table + "` {0}", conn, transaction))
{
cmd.Set("accountId", accountId);
cmd.Set("creatureId", character.CreatureId);
cmd.Execute();
character.EntityId = cmd.LastId;
}
// Items
if (items != null)
this.AddItems(character.CreatureId, items, conn, transaction);
transaction.Commit();
return true;
}
catch (Exception ex)
{
character.EntityId = character.CreatureId = 0;
Log.Exception(ex);
return false;
}
}
}
/// <summary>
/// Creatures creature based on character and returns its id.
/// </summary>
/// <param name="creature"></param>
/// <param name="conn"></param>
/// <param name="transaction"></param>
/// <returns></returns>
private long CreateCreature(Character creature, MySqlConnection conn, MySqlTransaction transaction)
{
using (var cmd = new InsertCommand("INSERT INTO `creatures` {0}", conn, transaction))
{
cmd.Set("server", creature.Server);
cmd.Set("name", creature.Name);
cmd.Set("age", creature.Age);
cmd.Set("race", creature.Race);
cmd.Set("skinColor", creature.SkinColor);
cmd.Set("eyeType", creature.EyeType);
cmd.Set("eyeColor", creature.EyeColor);
cmd.Set("mouthType", creature.MouthType);
cmd.Set("state", (uint)creature.State);
cmd.Set("height", creature.Height);
cmd.Set("weight", creature.Weight);
cmd.Set("upper", creature.Upper);
cmd.Set("lower", creature.Lower);
cmd.Set("color1", creature.Color1);
cmd.Set("color2", creature.Color2);
cmd.Set("color3", creature.Color3);
cmd.Set("lifeMax", creature.Life);
cmd.Set("manaMax", creature.Mana);
cmd.Set("staminaMax", creature.Stamina);
cmd.Set("str", creature.Str);
cmd.Set("int", creature.Int);
cmd.Set("dex", creature.Dex);
cmd.Set("will", creature.Will);
cmd.Set("luck", creature.Luck);
cmd.Set("defense", creature.Defense);
cmd.Set("protection", creature.Protection);
cmd.Set("ap", creature.AP);
cmd.Set("creationTime", DateTime.Now);
cmd.Set("lastAging", DateTime.Now);
cmd.Execute();
return cmd.LastId;
}
}
/// <summary>
/// Adds items for creature.
/// </summary>
/// <param name="creatureId"></param>
/// <param name="items"></param>
/// <param name="conn"></param>
/// <param name="transaction"></param>
private void AddItems(long creatureId, List<Item> items, MySqlConnection conn, MySqlTransaction transaction)
{
foreach (var item in items)
{
var dataInfo = AuraData.ItemDb.Find(item.Info.Id);
if (dataInfo == null)
{
Log.Warning("Item '{0}' couldn't be found in the database.", item.Info.Id);
continue;
}
using (var cmd = new InsertCommand("INSERT INTO `items` {0}", conn, transaction))
{
cmd.Set("creatureId", creatureId);
cmd.Set("itemId", item.Info.Id);
cmd.Set("pocket", (byte)item.Info.Pocket);
cmd.Set("color1", item.Info.Color1);
cmd.Set("color2", item.Info.Color2);
cmd.Set("color3", item.Info.Color3);
cmd.Set("price", dataInfo.Price);
cmd.Set("durability", dataInfo.Durability);
cmd.Set("durabilityMax", dataInfo.Durability);
cmd.Set("durabilityOriginal", dataInfo.Durability);
cmd.Set("attackMin", dataInfo.AttackMin);
cmd.Set("attackMax", dataInfo.AttackMax);
cmd.Set("balance", dataInfo.Balance);
cmd.Set("critical", dataInfo.Critical);
cmd.Set("defense", dataInfo.Defense);
cmd.Set("protection", dataInfo.Protection);
cmd.Set("attackSpeed", dataInfo.AttackSpeed);
cmd.Set("sellPrice", dataInfo.SellingPrice);
cmd.Execute();
}
}
}
/// <summary>
/// Removes the card from the db, returns true if successful.
/// </summary>
/// <param name="card"></param>
/// <returns></returns>
public bool DeleteCard(Card card)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("DELETE FROM `cards` WHERE `cardId` = @cardId", conn))
{
mc.Parameters.AddWithValue("@cardId", card.Id);
return (mc.ExecuteNonQuery() > 0);
}
}
/// <summary>
/// Changes gift card with the given id to a normal card.
/// </summary>
/// <param name="giftId"></param>
public void ChangeGiftToCard(long giftId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("UPDATE `cards` SET `isGift` = FALSE WHERE `cardId` = @cardId", conn))
{
mc.Parameters.AddWithValue("@cardId", giftId);
mc.ExecuteNonQuery();
}
}
/// <summary>
/// Updates deletion time for character, or deletes it.
/// </summary>
/// <param name="character"></param>
public void UpdateDeletionTime(Character character)
{
using (var conn = this.Connection)
{
if (character.DeletionFlag == DeletionFlag.Delete)
{
using (var mc = new MySqlCommand("DELETE FROM `creatures` WHERE `creatureId` = @creatureId", conn))
{
mc.Parameters.AddWithValue("@creatureId", character.CreatureId);
mc.ExecuteNonQuery();
}
}
else
{
using (var cmd = new UpdateCommand("UPDATE `creatures` SET {0} WHERE `creatureId` = @creatureId", conn))
{
cmd.AddParameter("@creatureId", character.CreatureId);
cmd.Set("deletionTime", character.DeletionTime);
cmd.Execute();
}
}
}
}
/// <summary>
/// Changes auth level of account.
/// </summary>
/// <param name="accountId"></param>
/// <param name="level"></param>
/// <returns></returns>
public bool ChangeAuth(string accountId, int level)
{
using (var conn = this.Connection)
using (var cmd = new UpdateCommand("UPDATE `accounts` SET {0} WHERE `accountId` = @accountId", conn))
{
cmd.AddParameter("@accountId", accountId);
cmd.Set("authority", level);
return (cmd.Execute() > 0);
}
}
/// <summary>
/// Adds trade item and points of card to character.
/// </summary>
/// <param name="targetCharacter"></param>
/// <param name="charCard"></param>
public void TradeCard(Character targetCharacter, CharCardData charCard)
{
using (var conn = this.Connection)
using (var cmd = new InsertCommand("INSERT INTO `items` {0}", conn))
{
cmd.Set("creatureId", targetCharacter.CreatureId);
cmd.Set("itemId", charCard.TradeItem);
cmd.Set("pocket", Pocket.Temporary);
cmd.Set("color1", 0x808080);
cmd.Set("color2", 0x808080);
cmd.Set("color3", 0x808080);
cmd.Execute();
}
// TODO: Add points (pons)...
}
/// <summary>
/// Unsets creature's Initialized creature state flag.
/// </summary>
/// <param name="creatureId"></param>
public void UninitializeCreature(long creatureId)
{
using (var conn = this.Connection)
using (var mc = new MySqlCommand("UPDATE `creatures` SET `state` = `state` & ~1 WHERE `creatureId` = @creatureId", conn))
{
mc.Parameters.AddWithValue("@creatureId", creatureId);
mc.ExecuteNonQuery();
}
}
}
}
| Zanaj/AuraMaster-production | src/LoginServer/Database/LoginDb.cs | C# | gpl-3.0 | 19,818 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
15240,
2458,
2136,
1011,
7000,
2104,
27004,
14246,
2140,
1013,
1013,
2005,
2062,
2592,
1010,
2156,
6105,
5371,
1999,
1996,
2364,
19622,
2478,
15240,
1012,
2951,
1025,
2478,
15240,
1012,
2951,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module('BadAriaRole');
test('No elements === no problems.', function(assert) {
var config = {
ruleName: 'badAriaRole',
expected: axs.constants.AuditResult.NA
};
assert.runRule(config);
});
test('No roles === no problems.', function(assert) {
// Setup fixture
var fixture = document.getElementById('qunit-fixture');
for (var i = 0; i < 10; i++)
fixture.appendChild(document.createElement('div'));
var config = {
ruleName: 'badAriaRole',
expected: axs.constants.AuditResult.NA
};
assert.runRule(config);
});
test('Good role === no problems.', function(assert) {
// Setup fixture
var fixture = document.getElementById('qunit-fixture');
for (var r in axs.constants.ARIA_ROLES) {
if (axs.constants.ARIA_ROLES.hasOwnProperty(r) && !axs.constants.ARIA_ROLES[r]['abstract']) {
var div = document.createElement('div');
div.setAttribute('role', r);
fixture.appendChild(div);
}
}
var config = {
ruleName: 'badAriaRole',
expected: axs.constants.AuditResult.PASS,
elements: []
};
assert.runRule(config);
});
test('Bad role == problem', function(assert) {
// Setup fixture
var fixture = document.getElementById('qunit-fixture');
var div = document.createElement('div');
div.setAttribute('role', 'not-an-aria-role');
fixture.appendChild(div);
var config = {
ruleName: 'badAriaRole',
expected: axs.constants.AuditResult.FAIL,
elements: [div]
};
assert.runRule(config);
});
test('Abstract role == problem', function(assert) {
// Setup fixture
var fixture = document.getElementById('qunit-fixture');
var div = document.createElement('div');
div.setAttribute('role', 'input');
fixture.appendChild(div);
var config = {
ruleName: 'badAriaRole',
expected: axs.constants.AuditResult.FAIL,
elements: [div]
};
assert.runRule(config);
});
| alice/accessibility-developer-tools | test/audits/bad-aria-role-test.js | JavaScript | apache-2.0 | 1,950 | [
30522,
11336,
1006,
1005,
2919,
10980,
13153,
2063,
1005,
1007,
1025,
3231,
1006,
1005,
2053,
3787,
1027,
1027,
1027,
2053,
3471,
1012,
1005,
1010,
3853,
1006,
20865,
1007,
1063,
13075,
9530,
8873,
2290,
1027,
1063,
3627,
18442,
1024,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="row" *ngIf="!corpInfo">
<div class="col-sm-12"><i class="fa fa-spinner fa-pulse"></i>Loading...</div>
</div>
<div class="row" *ngIf="!!corpInfo">
<div class="col-sm-12">
<div class="panel" [ngClass]="{'panel-primary': corpInfo.is_manager, 'panel-danger': !corpInfo.is_manager}">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon"
[ngClass]="{'glyphicon-user' : corpInfo.is_manager, 'glyphicon-eye-open' : !corpInfo.is_manager}"
title="Manager"></span>
{{corpInfo.corporation.name}} <button type="button" class="btn btn-primary btn-xs pull-right" (click)="loadCorpInfo()"><i class="glyphicon glyphicon-refresh"></i></button>
</h3>
</div>
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-sm-3 col-xs-6">
<img class="pull-left" width="16" height="16" alt="vDollars" src="/img/icons/icon-vdollar.png"/>
{{corpInfo.corporation.vd_balance}}
</div>
<div class="col-sm-3 col-xs-6">
<div class="input-group input-group-sm" *ngIf="corpInfo.is_manager">
<input type="number" class="form-control" placeholder="vDollars" #corpInvestAmount>
<span class="input-group-btn">
<button class="btn btn-success" type="button" (click)="investToCorp(corpInvestAmount.value);corpInvestAmount.value = ''">
<i class="glyphicon glyphicon-usd"></i> Invest
</button>
</span>
</div>
</div>
<div class="col-sm-3 col-xs-6">
<img class="pull-left" width="16" height="16" alt="vGold" src="/img/icons/icon-vgold.png"/>
{{corpInfo.corporation.vg_balance}}
</div>
<div class="col-sm-3 col-xs-6">
<div class="input-group input-group-sm" *ngIf="corpInfo.is_manager">
<input type="number" class="form-control" placeholder="vGold" disabled>
<span class="input-group-btn">
<button class="btn btn-warning" type="button" disabled>
<i class="glyphicon glyphicon-usd"></i> Invest
</button>
</span>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
<div class="row" *ngIf="!!corpInfo && corpInfo.is_manager">
<div class="col-xs-12">
<a id="_top" name="_top"></a>
<supply-list
[companies]="selectedCompanies"
(on-remove-company)="companiesChange($event)"
[items]="transferList"
(on-remove-item)="transferChange($event)"
[trade]="tradeList"
(on-remove-trade)="tradeChange($event)"
[investments]="investList"
(on-change-investments)="investmentsChange($event)"
(on-refresh)="refresh($event)"
>
</supply-list>
</div>
</div>
<div class="row" *ngIf="!!corpInfo">
<div class="col-xs-12 col-sm-7">
<companies-list
[companies]="corpInfo.companies"
[details]="details"
[is-manager]="corpInfo.is_manager"
(on-select)="selectCompany($event)"
(on-change)="companyStorageChange($event)"
(on-invest)="companyInvest($event)"
(on-scroll)="scrollTop()"
(on-filter)="setFilter($event)"
>
</companies-list>
</div>
<div class="col-xs-12 col-sm-5">
<corporation-storage
[items]="corpStorage"
(on-change)="storageChange($event)"
(on-scroll)="scrollTop()">
</corporation-storage>
</div>
</div>
<!--
<div class="row" *ngIf="!!corpInfo">
<div class="col-sm-12">
<pre>{{corpInfo | json}}</pre>
</div>
</div>
<div class="row">
<div class="col-sm-12">
</div>
</div>
<div class="row">
<div class="col-sm-12">
</div>
</div>
-->
| alexiusp/vc-manager | app/corps/corporation.detail.component.html | HTML | mit | 3,649 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
5216,
1000,
1008,
12835,
10128,
1027,
1000,
999,
13058,
2378,
14876,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
8902,
1011,
15488,
1011,
2260,
1000,
1028,
1026,
1045,
2465,
1027,
1000,
6904,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Airgo Networks, Inc proprietary. All rights reserved.
* This file limProcessLmmMessages.cc contains the code
* for processing SME/LMM messages related to ANI feature set.
* Author: Chandra Modumudi
* Date: 10/20/02
* History:-
* Date Modified by Modification Information
* --------------------------------------------------------------------
*
*/
#include "aniGlobal.h"
#include "wniApi.h"
#if (WNI_POLARIS_FW_PRODUCT == AP)
#include "wniCfgAp.h"
#else
#include "wniCfgSta.h"
#endif
#include "cfgApi.h"
#include "sirApi.h"
#include "schApi.h"
#include "utilsApi.h"
#include "limTypes.h"
#include "limUtils.h"
#include "limAssocUtils.h"
#include "limSerDesUtils.h"
#include "limPropExtsUtils.h"
#include "limSession.h"
#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
/**
* limIsSmeMeasurementReqValid()
*
*FUNCTION:
* This function is called by limProcessLmmMessages() upon
* receiving SME_MEASUREMENT_REQ.
*
*LOGIC:
* Message validity checks are performed in this function
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMeasReq Pointer to Received MEASUREMENT_REQ message
* @return true When received SME_MEASUREMENT_REQ is formatted
* correctly
* false otherwise
*/
inline static tANI_BOOLEAN
limIsSmeMeasurementReqValid(tpAniSirGlobal pMac, tpSirSmeMeasurementReq pMeasReq)
{
#ifdef ANI_AP_SDK
if (!pMeasReq->channelList.numChannels ||
((pMeasReq->measControl.periodicMeasEnabled) &&
(!pMeasReq->measIndPeriod)) ||
(pMeasReq->measIndPeriod &&
((pMeasReq->measIndPeriod < 1))) ||
!pMeasReq->measDuration.shortTermPeriod ||
((pMeasReq->measDuration.shortTermPeriod < 1)) ||
!pMeasReq->measDuration.averagingPeriod ||
(pMeasReq->measDuration.averagingPeriod <
pMeasReq->measDuration.shortTermPeriod) ||
!pMeasReq->measDuration.shortChannelScanDuration ||
((pMeasReq->measDuration.shortChannelScanDuration <
1)) ||
!pMeasReq->measDuration.longChannelScanDuration ||
(pMeasReq->measDuration.longChannelScanDuration <
pMeasReq->measDuration.shortChannelScanDuration) ||
((pMeasReq->measDuration.longChannelScanDuration <
1)))
#else
if (!pMeasReq->channelList.numChannels ||
((pMeasReq->measControl.periodicMeasEnabled) &&
(!pMeasReq->measIndPeriod)) ||
(pMeasReq->measIndPeriod &&
((pMeasReq->measIndPeriod < SYS_TICK_DUR_MS))) ||
!pMeasReq->measDuration.shortTermPeriod ||
((pMeasReq->measDuration.shortTermPeriod < SYS_TICK_DUR_MS)) ||
!pMeasReq->measDuration.averagingPeriod ||
(pMeasReq->measDuration.averagingPeriod <
pMeasReq->measDuration.shortTermPeriod) ||
!pMeasReq->measDuration.shortChannelScanDuration ||
((pMeasReq->measDuration.shortChannelScanDuration <
SYS_TICK_DUR_MS)) ||
!pMeasReq->measDuration.longChannelScanDuration ||
(pMeasReq->measDuration.longChannelScanDuration <
pMeasReq->measDuration.shortChannelScanDuration) ||
((pMeasReq->measDuration.longChannelScanDuration <
SYS_TICK_DUR_MS)))
#endif
{
limLog(pMac, LOGW,
FL("Received MEASUREMENT_REQ with invalid data\n"));
return eANI_BOOLEAN_FALSE;
}
else
return eANI_BOOLEAN_TRUE;
} /*** end limIsSmeMeasurementReqValid() ***/
/**
* limInitMeasResources()
*
*FUNCTION:
* This function is called by limProcessLmmMessages() upon
* receiving SME_MEASUREMENT_REQ. This function initializes
* resources required for making measurements like creating
* timers related to Measurement Request etc.
*
*LOGIC:
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMac - Pointer to Global MAC structure
* @param None
* @return None
*/
inline static tSirRetStatus
limInitMeasResources(tpAniSirGlobal pMac)
{
tANI_U32 val;
tANI_U32 beaconInterval;
// Create Meas related timers only when
// periodic measurements are enabled
if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
{
val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measIndPeriod);
if (tx_timer_create(
&pMac->lim.gLimMeasParams.measurementIndTimer,
"Meas Ind TIMEOUT",
limTimerHandler,
SIR_LIM_MEASUREMENT_IND_TIMEOUT,
val,
val,
TX_NO_ACTIVATE) != TX_SUCCESS)
{
/// Could not create MeasInd timer.
// Log error
limLog(pMac, LOGP, FL("call to create MeasInd timer failed\n"));
return eSIR_SYS_TX_TIMER_CREATE_FAILED;
}
pMac->lim.gLimMeasParams.isMeasIndTimerActive = 0;
PELOG3(limLog(pMac, LOG3, FL("MeasurementIndication timer initialized, period = %d\n"),
pMac->lim.gpLimMeasReq->measIndPeriod);)
}
tANI_U32 learnInterval =
pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
pMac->lim.gpLimMeasReq->channelList.numChannels;
if (tx_timer_create(&pMac->lim.gLimMeasParams.learnIntervalTimer,
"Learn interval TIMEOUT",
limTimerHandler,
SIR_LIM_LEARN_INTERVAL_TIMEOUT,
SYS_MS_TO_TICKS(learnInterval),
0,
TX_NO_ACTIVATE) != TX_SUCCESS)
{
/// Could not create learnInterval timer.
// Log error
limLog(pMac, LOGP, FL("call to create learnInterval timer failed\n"));
return eSIR_SYS_TX_TIMER_CREATE_FAILED;
}
val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration);
if (tx_timer_create(
&pMac->lim.gLimMeasParams.learnDurationTimer,
"Learn duration TIMEOUT",
limTimerHandler,
SIR_LIM_LEARN_DURATION_TIMEOUT,
val,
0,
TX_NO_ACTIVATE) != TX_SUCCESS)
{
/// Could not create LearnDuration timer.
// Log error
limLog(pMac, LOGP,
FL("call to create LearnDuration timer failed\n"));
return eSIR_SYS_TX_TIMER_CREATE_FAILED;
}
/* Copy the beacon interval from the session Id */
beaconInterval = psessionEntry->beaconParams.beaconInterval;
if ((learnInterval > ( 2 * beaconInterval)) &&
(pMac->lim.gLimSystemRole == eLIM_AP_ROLE))
{
//learinterval should be > 2 * beaconinterval
val = SYS_MS_TO_TICKS(learnInterval - (2 * beaconInterval));
// Create Quiet BSS Timer
if ( TX_SUCCESS !=
tx_timer_create( &pMac->lim.limTimers.gLimQuietBssTimer,
"QUIET BSS TIMER",
limQuietBssTimerHandler,
SIR_LIM_QUIET_BSS_TIMEOUT,
val, // initial_ticks
0, // reschedule_ticks
TX_NO_ACTIVATE ))
{
limLog( pMac, LOGP,
FL( "Failed to create gLimQuietBssTimer!" ));
return eSIR_SYS_TX_TIMER_CREATE_FAILED;
}
pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_TRUE;
}
pMac->lim.gLimMeasParams.shortDurationCount = 0;
pMac->lim.gLimMeasParams.nextLearnChannelId = 0;
pMac->lim.gLimMeasParams.rssiAlpha =
(100 * pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod) /
pMac->lim.gpLimMeasReq->measDuration.averagingPeriod;
if (!pMac->lim.gLimMeasParams.rssiAlpha)
pMac->lim.gLimMeasParams.rssiAlpha = 1;
pMac->lim.gLimMeasParams.chanUtilAlpha =
(100 * learnInterval) / pMac->lim.gpLimMeasReq->measIndPeriod;
if (!pMac->lim.gLimMeasParams.chanUtilAlpha)
pMac->lim.gLimMeasParams.chanUtilAlpha = 1;
return eSIR_SUCCESS;
} /*** end limInitMeasResources() ***/
/**-----------------------------------------------
\fn __limFreeMeasAndSendRsp
\brief Free the meas related resources and send
response to SME.
\param pMac
\param resultCode
\return None
------------------------------------------------*/
static void
__limFreeMeasAndSendRsp(tpAniSirGlobal pMac, tSirResultCodes resultCode)
{
if (pMac->lim.gpLimMeasReq != NULL)
{
palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasReq);
pMac->lim.gpLimMeasReq = NULL;
}
if (pMac->lim.gpLimMeasData != NULL)
{
palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData);
pMac->lim.gpLimMeasData = NULL;
}
/// Send failure response to WSM
limSendSmeRsp(pMac, eWNI_SME_MEASUREMENT_RSP, resultCode);
}
/**
* limProcessSmeMeasurementReq()
*
*FUNCTION:
* This function is called by limProcessLmmMessages() upon
* receiving SME_MEASUREMENT_REQ from WSM.
*
*LOGIC:
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMac Pointer to Global MAC structure
* @param *pMsgBuf A pointer to the SME message buffer
*
* @return None
*/
static void
limProcessSmeMeasurementReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
{
PELOG1(limLog(pMac, LOG1, FL("SME State = %d\n"), pMac->lim.gLimSmeState);)
switch (pMac->lim.gLimSmeState)
{
case eLIM_SME_OFFLINE_STATE:
case eLIM_SME_IDLE_STATE:
case eLIM_SME_JOIN_FAILURE_STATE:
case eLIM_SME_NORMAL_STATE:
case eLIM_SME_LINK_EST_STATE:
case eLIM_SME_CHANNEL_SCAN_STATE:
case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
break;
default:
limLog(pMac, LOGE,
FL("Received unexpected MeasReq message in state %X\n"),
pMac->lim.gLimSmeState);
/// Send failure response to host
limSendSmeRsp(
pMac,
eWNI_SME_MEASUREMENT_RSP,
eSIR_SME_UNEXPECTED_REQ_RESULT_CODE);
return;
} // end switch (pMac->lim.gLimSmeState)
if (pMac->lim.gpLimMeasReq)
{
// There was a previous measurement req issued.
// Cleanup resources allocated for that request.
limDeleteMeasTimers(pMac);
limCleanupMeasData(pMac);
}
else
{
// There was no previous measurement req issued.
// Allocate memory required to hold measurements.
if (eHAL_STATUS_SUCCESS !=
palAllocateMemory(pMac->hHdd,
(void **)&pMac->lim.gpLimMeasData,
sizeof(tLimMeasData)))
{
// Log error
limLog(pMac, LOGE,
FL("memory allocate failed for MeasData\n"));
/// Send failure response to host
limSendSmeRsp(pMac, eWNI_SME_MEASUREMENT_RSP,
eSIR_SME_RESOURCES_UNAVAILABLE);
return;
}
palZeroMemory(pMac->hHdd, (void *)pMac->lim.gpLimMeasData,
sizeof(tLimMeasData));
pMac->lim.gpLimMeasData->duration = 120;
}
if (eHAL_STATUS_SUCCESS !=
palAllocateMemory(pMac->hHdd,
(void **)&pMac->lim.gpLimMeasReq,
(sizeof(tSirSmeMeasurementReq) +
SIR_MAX_NUM_CHANNELS)))
{
// Log error
PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for MeasReq\n"));)
__limFreeMeasAndSendRsp(pMac, eSIR_SME_RESOURCES_UNAVAILABLE);
return;
}
if ((limMeasurementReqSerDes(
pMac,
pMac->lim.gpLimMeasReq,
(tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
!limIsSmeMeasurementReqValid(pMac,pMac->lim.gpLimMeasReq))
{
limLog(pMac, LOGE,
FL("Rx'ed MeasReq message with invalid parameters\n"));
__limFreeMeasAndSendRsp(pMac, eSIR_SME_INVALID_PARAMETERS);
return;
}
#ifdef ANI_AP_SDK
/* convert from mS to TU and TICKS */
limConvertScanDuration(pMac);
#endif /* ANI_AP_SDK */
// Initialize Measurement related resources
if (limInitMeasResources(pMac) != eSIR_SUCCESS)
{
__limFreeMeasAndSendRsp(pMac, eSIR_SME_RESOURCES_UNAVAILABLE);
return;
}
PELOG3(limLog(pMac, LOG3,
FL("NumChannels=%d, shortDuration=%d, shortInterval=%d, longInterval=%d\n"),
pMac->lim.gpLimMeasReq->channelList.numChannels,
pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod,
pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration,
pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration);)
limRadarInit(pMac);
/**
* Start Learn interval timer so that
* measurements are made from that
* timeout onwards.
*/
limReEnableLearnMode(pMac);
/// All is well with MeasReq. Send response to WSM
limSendSmeRsp(pMac, eWNI_SME_MEASUREMENT_RSP,
eSIR_SME_SUCCESS);
PELOG2(limLog(pMac, LOG2, FL("Sending succes response to SME\n"));)
if (pMac->lim.gpLimMeasReq->channelList.numChannels == 1)
limLog(pMac, LOGE, FL("Starting Channel Availability Check on Channel %d... Wait\n"),
*pMac->lim.gpLimMeasReq->channelList.channelNumber);
} /*** end limProcessSmeMeasurementReq() ***/
/**
* limProcessSmeSetWdsInfoReq()
*
*FUNCTION:
* This function is called by limProcessLmmMessages() upon
* receiving SME_SET_WDS_INFO_REQ from WSM.
*
*LOGIC:
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMac Pointer to Global MAC structure
* @param *pMsgBuf A pointer to the SME message buffer
*
* @return None
*/
static void
limProcessSmeSetWdsInfoReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
{
tANI_U16 i;
tSirSmeSetWdsInfoReq wdsInfoReq;
pMac->lim.gLimNumWdsInfoSet++;
switch (pMac->lim.gLimSmeState)
{
case eLIM_SME_NORMAL_STATE:
break;
default:
limLog(pMac, LOGE,
FL("Rx'ed unexp SetWdsInfoReq message in state %X\n"),
pMac->lim.gLimSmeState);
/// Send failure response to host
limSendSmeRsp(
pMac,
eWNI_SME_SET_WDS_INFO_RSP,
eSIR_SME_UNEXPECTED_REQ_RESULT_CODE);
return;
} // end switch (pMac->lim.gLimSmeState)
if ((limWdsReqSerDes( pMac,
&wdsInfoReq,
(tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
{
limLog(pMac, LOGW,
FL("Rx'ed SetWdsInfoReq message with invalid parameters\n"));
/// Send failure response to WSM
limSendSmeRsp(pMac, eWNI_SME_SET_WDS_INFO_RSP,
eSIR_SME_INVALID_PARAMETERS);
return;
}
// check whether the WDS info is the same as current
if ((wdsInfoReq.wdsInfo.wdsLength ==
psessionEntry->pLimStartBssReq->wdsInfo.wdsLength) &&
(palEqualMemory( pMac->hHdd,wdsInfoReq.wdsInfo.wdsBytes,
psessionEntry->pLimStartBssReq->wdsInfo.wdsBytes,
psessionEntry->pLimStartBssReq->wdsInfo.wdsLength) ) )
{
/// Send success response to WSM
limSendSmeRsp(pMac,
eWNI_SME_SET_WDS_INFO_RSP,
eSIR_SME_SUCCESS);
return;
}
// copy WDS info
psessionEntry->pLimStartBssReq->wdsInfo.wdsLength =
wdsInfoReq.wdsInfo.wdsLength;
for (i=0; i<wdsInfoReq.wdsInfo.wdsLength; i++)
psessionEntry->pLimStartBssReq->wdsInfo.wdsBytes[i] =
wdsInfoReq.wdsInfo.wdsBytes[i];
schSetFixedBeaconFields(pMac,psessionEntry);
/// Send success response to WSM
limSendSmeRsp(pMac, eWNI_SME_SET_WDS_INFO_RSP,
eSIR_SME_SUCCESS);
} /*** end limProcessSmeMeasurementReq() ***/
/**
* limProcessLearnDurationTimeout()
*
*FUNCTION:
* This function is called by limProcessLmmMessages() upon
* receiving LEARN_DURATION_TIMEOUT.
*
*LOGIC:
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMac Pointer to Global MAC structure
* @param *pMsgBuf A pointer to the SME message buffer
*
* @return None
*/
static void
limProcessLearnDurationTimeout(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
{
if ( pMac->lim.gLimHalScanState == eLIM_HAL_IDLE_SCAN_STATE)
{
limSendHalInitScanReq(pMac, eLIM_HAL_INIT_LEARN_WAIT_STATE, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN );
return;
}
// Current learn duration expired.
if (pMac->lim.gLimMeasParams.nextLearnChannelId ==
pMac->lim.gpLimMeasReq->channelList.numChannels - 1)
{
//Set the resume channel to Any valid channel (invalid).
//This will instruct HAL to set it to any previous valid channel.
peSetResumeChannel(pMac, 0, 0);
// Send WDA_END_SCAN_REQ to HAL first
limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
}
else
{
pMac->lim.gLimMeasParams.nextLearnChannelId++;
if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
{
// LIM did not take AP/BP role yet.
// So continue Learn process on remaining channels
// Send WDA_END_SCAN_REQ to HAL first
limSendHalEndScanReq(pMac, (tANI_U8)pMac->lim.gLimMeasParams.nextLearnChannelId,
eLIM_HAL_END_LEARN_WAIT_STATE);
}
else
{
//Set the resume channel to Any valid channel (invalid).
//This will instruct HAL to set it to any previous valid channel.
peSetResumeChannel(pMac, 0, 0);
// Send WDA_FINISH_SCAN_REQ to HAL first
limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
}
}
} /*** end limProcessLearnDurationTimeout() ***/
/**
* limProcessLearnIntervalTimeout()
*
*FUNCTION:
* This function is called whenever
* SIR_LIM_LEARN_INTERVAL_TIMEOUT message is receive.
*
*LOGIC:
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMac Pointer to Global MAC structure
*
* @return None
*/
void
limProcessLearnIntervalTimeout(tpAniSirGlobal pMac)
{
#ifdef GEN6_TODO
//fetch the sessionEntry based on the sessionId
//priority - MEDIUM
tpPESession sessionEntry;
if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.gLimMeasParams.learnIntervalTimer.sessionId))== NULL)
{
limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
return;
}
#endif
PELOG2(limLog(pMac, LOG2, FL("SME state = %d\n"), pMac->lim.gLimSmeState);)
if (!pMac->sys.gSysEnableLearnMode)
{
PELOG3(limLog(pMac, LOG3,
FL("Ignoring LEARN_INTERVAL_TIMEOUT because gSysEnableLearnMode is disabled...\n"));)
limReEnableLearnMode(pMac);
return;
}
if (pMac->lim.gLimSystemInScanLearnMode)
{
limLog(pMac, LOGE,
FL("Sending START_SCAN from LIM while one req is pending\n"));
return;
}
pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
if ((pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ||
(pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE))
pMac->lim.gLimSmeState = eLIM_SME_CHANNEL_SCAN_STATE;
else if (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)
pMac->lim.gLimSmeState = eLIM_SME_NORMAL_CHANNEL_SCAN_STATE;
else if (pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_STATE)
pMac->lim.gLimSmeState = eLIM_SME_LINK_EST_WT_SCAN_STATE;
else
return;
MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
/* The commented piece of code here is to handle the Measurement Request from WSM as Scan
* request in the LIM in Linux Station. Currently, the station uses Measurement request to
* get the scan list. If measurement request itself is used for station also while scanning, this
* code can be removed. If we need to handle the measurement request as scan request, we need to
* implement the below commented code in a more cleaner way(handling the SCAN_CNF, memory freeing, etc)
*/
// if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
{
pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
pMac->lim.gLimMlmState = eLIM_MLM_LEARN_STATE;
MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
pMac->lim.gLimSystemInScanLearnMode = eANI_BOOLEAN_TRUE;
}
#if 0
/**
* start the timer to enter into Learn mode
*/
if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
{
tLimMlmScanReq *pMlmScanReq;
tANI_U32 len;
if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq,
(sizeof(tLimMlmScanReq) + WNI_CFG_VALID_CHANNEL_LIST_LEN)))
{
limLog(pMac, LOGP,
FL("call to palAllocateMemory failed for mlmScanReq\n"));
return;
}
palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq,
(tANI_U32)(sizeof(tLimMlmScanReq) + WNI_CFG_VALID_CHANNEL_LIST_LEN ));
len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
pMlmScanReq->channelList.channelNumber,
&len) != eSIR_SUCCESS)
{
limLog(pMac, LOGP,
FL("could not retrieve Valid channel list\n"));
}
pMlmScanReq->channelList.numChannels = (tANI_U8) len;
palFillMemory(pMac->hHdd, &pMlmScanReq->bssId, sizeof(tSirMacAddr), 0xff);
pMlmScanReq->bssType = eSIR_AUTO_MODE;
pMlmScanReq->scanType = eSIR_ACTIVE_SCAN;
pMlmScanReq->backgroundScanMode = 0;
pMlmScanReq->maxChannelTime = 40;
pMlmScanReq->minChannelTime = 20;
limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
}
else
#endif
limSetLearnMode(pMac);
}
/**
* limProcessLmmMessages()
*
*FUNCTION:
* This function is called by limProcessMessageQueue(). This
* function processes SME messages from WSM and MLM cnf/ind
* messages from MLM module.
*
*LOGIC:
* Depending on the message type, corresponding function will be
* called.
*
*ASSUMPTIONS:
*
*NOTE:
*
* @param pMac Pointer to Global MAC structure
* @param msgType Indicates the SME message type
* @param *pMsgBuf A pointer to the SME message buffer
*
* @return None
*/
void
limProcessLmmMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
{
switch (msgType)
{
case eWNI_SME_MEASUREMENT_REQ:
PELOG1(limLog(pMac, LOG1, FL("Received MEASUREMENT_REQ message\n"));)
limProcessSmeMeasurementReq(pMac, pMsgBuf);
break;
case eWNI_SME_SET_WDS_INFO_REQ:
limProcessSmeSetWdsInfoReq(pMac, pMsgBuf);
break;
case SIR_LIM_MEASUREMENT_IND_TIMEOUT:
// Time to send Measurement Indication to WSM
limSendSmeMeasurementInd(pMac);
break;
case SIR_LIM_LEARN_INTERVAL_TIMEOUT:
limProcessLearnIntervalTimeout(pMac);
break;
case SIR_LIM_LEARN_DURATION_TIMEOUT:
limProcessLearnDurationTimeout(pMac, pMsgBuf);
break;
default:
break;
} // switch (msgType)
return;
} /*** end limProcessLmmMessages() ***/
#endif
| lshabc1231/noring-kernel | drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c | C | gpl-2.0 | 25,441 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
1011,
2286,
1010,
1996,
11603,
3192,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
3130,
7000,
2104,
1996,
2003,
2278,
6105,
2011,
24209,
2389,
9006,
2213,
2012,
5886,
2891,
1010,
4297,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"""This module contains examples of the op() function
where:
op(f,x) returns a stream where x is a stream, and f
is an operator on lists, i.e., f is a function from
a list to a list. These lists are of lists of arbitrary
objects other than streams and agents.
Function f must be stateless, i.e., for any lists u, v:
f(u.extend(v)) = f(u).extend(f(v))
(Stateful functions are given in OpStateful.py with
examples in ExamplesOpWithState.py.)
Let f be a stateless operator on lists and let x be a stream.
If at some point, the value of stream x is a list u then at
that point, the value of stream op(f,x) is the list f(u).
If at a later point, the value of stream x is the list:
u.extend(v) then, at that point the value of stream op(f,x)
is f(u).extend(f(v)).
As a specific example, consider the following f():
def f(lst): return [w * w for w in lst]
If at some point in time, the value of x is [3, 7],
then at that point the value of op(f,x) is f([3, 7])
or [9, 49]. If at a later point, the value of x is
[3, 7, 0, 11, 5] then the value of op(f,x) at that point
is f([3, 7, 0, 11, 5]) or [9, 49, 0, 121, 25].
"""
if __name__ == '__main__':
if __package__ is None:
import sys
from os import path
sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) )
from Agent import *
from ListOperators import *
from PrintFunctions import print_streams_recent
def example_1():
print "example_1"
print "op(f, x): f is a function from a list to a list"
print "x is a stream \n"
# FUNCTIONS FROM LIST TO LIST
# This example uses the following list operators:
# functions from a list to a list.
# f, g, h, r
# Example A: function using list comprehension
def f(lst): return [w*w for w in lst]
# Example B: function using filter
threshold = 6
def predicate(w):
return w > threshold
def g(lst):
return filter(predicate, lst)
# Example C: function using map
# Raise each element of the list to the n-th power.
n = 3
def power(w):
return w**n
def h(lst):
return map(power, lst)
# Example D: function using another list comprehension
# Discard any element of x that is not a
# multiple of a parameter n, and divide the
# elements that are multiples of n by n.
n = 3
def r(lst):
result = []
for w in lst:
if w%n == 0: result.append(w/n)
return result
# EXAMPLES OF OPERATIONS ON STREAMS
# The input stream for these examples
x = Stream('x')
print 'x is the input stream.'
print 'a is a stream consisting of the squares of the input'
print 'b is the stream consisting of values that exceed 6'
print 'c is the stream consisting of the third powers of the input'
print 'd is the stream consisting of values that are multiples of 3 divided by 3'
print 'newa is the same as a. It is defined in a more succinct fashion.'
print 'newb has squares that exceed 6.'
print ''
# The output streams a, b, c, d obtained by
# applying the list operators f, g, h, r to
# stream x.
a = op(f, x)
b = op(g, x)
c = op(h, x)
d = op(r, x)
# You can also define a function only on streams.
# You can do this using functools in Python or
# by simple encapsulation as shown below.
def F(x): return op(f,x)
def G(x): return op(g,x)
newa = F(x)
newb = G(F(x))
# The advantage is that F is a function only
# of streams. So, function composition looks cleaner
# as in G(F(x))
# Name the output streams to label the output
# so that reading the output is easier.
a.set_name('a')
newa.set_name('newa')
b.set_name('b')
newb.set_name('newb')
c.set_name('c')
d.set_name('d')
# At this point x is the empty stream:
# its value is []
x.extend([3, 7])
# Now the value of x is [3, 7]
print "FIRST STEP"
print_streams_recent([x, a, b, c, d, newa, newb])
print ""
x.extend([0, 11, 15])
# Now the value of x is [3, 7, 0, 11, 15]
print "SECOND STEP"
print_streams_recent([x, a, b, c, d, newa, newb])
def main():
example_1()
if __name__ == '__main__':
main()
| zatricion/Streams | ExamplesElementaryOperations/ExamplesOpNoState.py | Python | mit | 4,241 | [
30522,
1000,
1000,
1000,
2023,
11336,
3397,
4973,
1997,
1996,
6728,
1006,
1007,
3853,
2073,
1024,
6728,
1006,
1042,
1010,
1060,
1007,
5651,
1037,
5460,
2073,
1060,
2003,
1037,
5460,
1010,
1998,
1042,
2003,
2019,
6872,
2006,
7201,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace Common
{
/// <summary>
/// Udp服务
/// </summary>
public class UdpService
{
/// <summary>
/// 隐藏构造
/// </summary>
private UdpService()
{
}
/// <summary>
/// Udp监听服务
/// </summary>
private static UdpClient udpListener = null;
/// <summary>
/// 接收到消息
/// </summary>
public event Action<Message> ReceiveMessage;
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 开启TCP监听
/// </summary>
public void Acceptor()
{
if (udpListener == null)
{
udpListener = new UdpClient(new IPEndPoint(IPAddress.Any, this.Port));
udpListener.BeginReceive(new AsyncCallback(Acceptor), udpListener);
}
}
/// <summary>
/// 开始监听,启用监听时使用,用于设置端口号开启服务。
/// </summary>
/// <param name="port"></param>
public static void Start(int port = 12334)
{
var udpService = GetInstence();
udpService.Port = port;
udpService.Acceptor();
}
/// <summary>
///
/// </summary>
private static UdpService udpService = null;
/// <summary>
/// 获取实例
/// </summary>
/// <returns></returns>
public static UdpService GetInstence()
{
if (udpService == null)
{
udpService = new UdpService();
}
return udpService;
}
/// <summary>
/// 停止
/// </summary>
public static void Stop()
{
var udpService = GetInstence();
udpService.Disposable();
}
/// <summary>
/// 停止监听
/// </summary>
private void Disposable()
{
if (udpListener != null)
{
udpListener.Close();
}
udpListener = null;
}
/// <summary>
/// 关闭
/// </summary>
/// <param name="client"></param>
private void Close(UdpClient client)
{
client.Client.Shutdown(SocketShutdown.Both);
client.Client.Close();
client.Close();
client = null;
}
/// <summary>
///
/// </summary>
/// <param name="o"></param>
private void Acceptor(IAsyncResult o)
{
UdpClient server = o.AsyncState as UdpClient;
try
{
IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, 0);
byte[] bData = server.EndReceive(o, ref endPoint);
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
try
{
Message message = bData.ConvertToObject<Message>();
if (message != null)
{
message.IP = endPoint.Address.ToString();
message.Port = endPoint.Port;
}
System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
{
if (ReceiveMessage != null)
{
ReceiveMessage(message);
}
}));
}
catch (Exception ex)
{
ex.ToString().WriteToLog("", log4net.Core.Level.Error);
}
finally
{
//server.Close();
}
});
}
catch (Exception ex)
{
ex.ToString().WriteToLog("", log4net.Core.Level.Error);
}
finally
{
IAsyncResult result = server.BeginReceive(new AsyncCallback(Acceptor), server);
}
}
}
}
| tiduszhang/WPFSolution | 01.Base/01.Common/Common/Socket/Udp/UdpService.cs | C# | unlicense | 4,474 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
22834,
1025,
2478,
2291,
1012,
30524,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
20904,
2361,
100,
100,
1013,
1013,
1013,
1026,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var emblaCarousel_cjs=require("./embla-carousel.cjs.js"),react=require("react"),canUseDOM=!("undefined"==typeof window||!window.document);function useEmblaCarousel(e){var r=react.useState(),a=r[0],t=r[1],c=react.createRef();return react.useEffect(function(){canUseDOM&&null!=c&&c.current&&t(emblaCarousel_cjs(c.current,e))},[c,e]),react.useEffect(function(){return function(){return null==a?void 0:a.destroy()}},[]),[react.useCallback(function(e){var r=e.htmlTagName,a=void 0===r?"div":r,t=e.className,u=e.children;return react.createElement(a,{className:t,ref:c,style:{overflow:"hidden"}},u)},[]),a]}exports.useEmblaCarousel=useEmblaCarousel; | cdnjs/cdnjs | ajax/libs/embla-carousel/3.0.7/react.cjs.min.js | JavaScript | mit | 711 | [
30522,
1000,
2224,
9384,
1000,
1025,
4874,
1012,
9375,
21572,
4842,
3723,
1006,
14338,
1010,
1000,
1035,
1035,
9686,
5302,
8566,
2571,
1000,
1010,
1063,
3643,
1024,
999,
1014,
1065,
1007,
1025,
13075,
7861,
28522,
10010,
15441,
2140,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (C) 1999,2000 Bruce Guenter <bruceg@em.ca>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <config.h>
#include "response.h"
mystring response::codestr() const
{
static const mystring errstr = "ERROR";
static const mystring econnstr = "ECONN";
static const mystring badstr = "BAD";
static const mystring okstr = "OK";
static const mystring unknownstr = "???";
switch(code) {
case err: return errstr;
case econn: return econnstr;
case bad: return badstr;
case ok: return okstr;
default: return unknownstr;
}
}
mystring response::message() const
{
return codestr() + ": " + msg;
}
| hetznerZApackages/vmailmgr | lib/misc/response_message.cc | C++ | gpl-2.0 | 1,297 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2639,
1010,
2456,
5503,
19739,
29110,
1026,
5503,
2290,
1030,
7861,
1012,
6187,
1028,
1013,
1013,
1013,
1013,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// TSUrl.h
// TwitterStreams
//
// Created by Stuart Hall on 7/03/12.
// Copyright (c) 2012 Stuart Hall. All rights reserved.
//
#import "TSModel.h"
@interface TSUrl : TSModel
- (NSString*)url;
- (NSString*)displayUrl;
- (NSString*)expandedUrl;
- (NSArray*)indicies;
@end
| prabhuNatarajan/twitter-Stream | TwitterStreams/Models/TSUrl.h | C | mit | 283 | [
30522,
1013,
1013,
1013,
1013,
24529,
3126,
2140,
1012,
1044,
1013,
1013,
10474,
21422,
2015,
1013,
1013,
1013,
1013,
2580,
2011,
6990,
2534,
2006,
1021,
1013,
6021,
1013,
2260,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
6990,
2534,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.webtrends.harness.command.typed
import akka.actor.{Actor, ActorRef, Props}
import akka.pattern._
import akka.util.Timeout
import com.webtrends.harness.HarnessConstants
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future}
trait TypedCommandHelper { this: Actor =>
var typedCommandManager: Option[ActorRef] = None
implicit def ec: ExecutionContext = context.dispatcher
def registerTypedCommand[T<:TypedCommand[_,_]](name: String, actorClass: Class[T], checkHealth: Boolean = false): Future[ActorRef] = {
implicit val timeout = Timeout(2 seconds)
getManager().flatMap { cm =>
(cm ? RegisterCommand(name, Props(actorClass), checkHealth)).mapTo[ActorRef]
}
}
protected def getManager(): Future[ActorRef] = {
typedCommandManager match {
case Some(cm) => Future.successful(cm)
case None =>
context.system.actorSelection(HarnessConstants.TypedCommandFullName).resolveOne()(2 seconds).map { s =>
typedCommandManager = Some(s)
s
}
}
}
}
| Crashfreak/wookiee | wookiee-core/src/main/scala/com/webtrends/harness/command/typed/TypedCommandHelper.scala | Scala | apache-2.0 | 1,064 | [
30522,
7427,
4012,
1012,
4773,
7913,
18376,
1012,
17445,
1012,
3094,
1012,
21189,
12324,
17712,
2912,
1012,
3364,
1012,
1063,
3364,
1010,
3364,
2890,
2546,
1010,
24387,
1065,
12324,
17712,
2912,
1012,
5418,
1012,
1035,
12324,
17712,
2912,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* This houses all the code to integrate with X
*/
class Cornerstone_Integration_X_Theme {
/**
* Theme integrations should provide a stylesheet function returning the stylesheet name
* This will be matched with get_stylesheet() to determine if the integration will load
*/
public static function stylesheet() {
return 'x';
}
/**
* Theme integrations are loaded on the after_theme_setup hook
*/
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
add_action( 'cornerstone_load_preview', array( $this, 'load_preview' ) );
add_filter( 'cornerstone_config_common_default-settings', array( $this, 'addDefaultSettings' ) );
// Don't enqueue native styles
add_filter( 'cornerstone_enqueue_styles', '__return_false' );
add_filter( 'cornerstone_inline_styles', '__return_false' );
// Don't load the Customizer
add_filter( 'cornerstone_use_customizer', '__return_false' );
// Enable X specific settings pane items
add_filter( 'x_settings_pane', '__return_true' );
// Declare support for page builder features
add_filter( 'cornerstone_looks_like_support', '__return_true' );
// Shortcode generator tweaks
add_action('cornerstone_generator_preview_before', array( $this, 'shortcodeGeneratorPreviewBefore' ), -9999 );
add_filter('cornerstone_generator_map', array( $this, 'shortcodeGeneratorDemoURL' ) );
// Alias legacy shortcode names.
add_action('cornerstone_shortcodes_loaded', array( $this, 'aliasShortcodes' ) );
add_filter('cornerstone_scrolltop_selector', array( $this, 'scrollTopSelector' ) );
add_filter('cs_recent_posts_post_types', array( $this, 'recentPostTypes' ) );
// Use Audio and Video shortcodes for X native players.
add_filter( 'wp_audio_shortcode_library', 'x_wp_native_audio_shortcode_library' );
add_filter( 'wp_audio_shortcode', 'x_wp_native_audio_shortcode' );
add_filter( 'wp_audio_shortcode_class', 'x_wp_native_audio_shortcode_class' );
add_filter( 'wp_video_shortcode_library', 'x_wp_native_video_shortcode_library' );
add_filter( 'wp_video_shortcode', 'x_wp_native_video_shortcode' );
add_filter( 'wp_video_shortcode_class', 'x_wp_native_video_shortcode_class' );
}
public function init() {
// Add Logic for additional contact methods if not overridden in a child theme
if ( ! function_exists( 'x_modify_contact_methods' ) )
add_filter( 'user_contactmethods', array( $this, 'modifyContactMethods' ) );
add_action( 'admin_menu', array( $this, 'optionsPage' ) );
// Remove empty p and br HTML elements for legacy pages not using Cornerstone sections
add_filter( 'the_content', 'cs_noemptyp' );
// Enqueue Legacy font classes
$settings = CS()->settings();
if ( isset( $settings['enable_legacy_font_classes'] ) && $settings['enable_legacy_font_classes'] ) {
add_filter( 'cornerstone_legacy_font_classes', '__return_true' );
}
}
public function aliasShortcodes() {
//
// Alias [social] to [icon] for backwards compatability.
//
cs_alias_shortcode( 'social', 'x_icon', false );
//
// Alias deprecated shortcode names.
//
// Mk2
cs_alias_shortcode( array( 'alert', 'x_alert' ), 'cs_alert' );
cs_alias_shortcode( array( 'x_text' ), 'cs_text' );
cs_alias_shortcode( array( 'icon_list', 'x_icon_list' ), 'cs_icon_list' );
cs_alias_shortcode( array( 'icon_list_item', 'x_icon_list_item' ), 'cs_icon_list_item' );
// Mk1
cs_alias_shortcode( 'accordion', 'x_accordion', false );
cs_alias_shortcode( 'accordion_item', 'x_accordion_item', false );
cs_alias_shortcode( 'author', 'x_author', false );
cs_alias_shortcode( 'block_grid', 'x_block_grid', false );
cs_alias_shortcode( 'block_grid_item', 'x_block_grid_item', false );
cs_alias_shortcode( 'blockquote', 'x_blockquote', false );
cs_alias_shortcode( 'button', 'x_button', false );
cs_alias_shortcode( 'callout', 'x_callout', false );
cs_alias_shortcode( 'clear', 'x_clear', false );
cs_alias_shortcode( 'code', 'x_code', false );
cs_alias_shortcode( 'column', 'x_column', false );
cs_alias_shortcode( 'columnize', 'x_columnize', false );
cs_alias_shortcode( 'container', 'x_container', false );
cs_alias_shortcode( 'content_band', 'x_content_band', false );
cs_alias_shortcode( 'counter', 'x_counter', false );
cs_alias_shortcode( 'custom_headline', 'x_custom_headline', false );
cs_alias_shortcode( 'dropcap', 'x_dropcap', false );
cs_alias_shortcode( 'extra', 'x_extra', false );
cs_alias_shortcode( 'feature_headline', 'x_feature_headline', false );
cs_alias_shortcode( 'gap', 'x_gap', false );
cs_alias_shortcode( 'google_map', 'x_google_map', false );
cs_alias_shortcode( 'google_map_marker', 'x_google_map_marker', false );
cs_alias_shortcode( 'highlight', 'x_highlight', false );
cs_alias_shortcode( 'icon', 'x_icon', false );
cs_alias_shortcode( 'image', 'x_image', false );
cs_alias_shortcode( 'lightbox', 'x_lightbox', false );
cs_alias_shortcode( 'line', 'x_line', false );
cs_alias_shortcode( 'map', 'x_map', false );
cs_alias_shortcode( 'pricing_table', 'x_pricing_table', false );
cs_alias_shortcode( 'pricing_table_column', 'x_pricing_table_column', false );
cs_alias_shortcode( 'promo', 'x_promo', false );
cs_alias_shortcode( 'prompt', 'x_prompt', false );
cs_alias_shortcode( 'protect', 'x_protect', false );
cs_alias_shortcode( 'pullquote', 'x_pullquote', false );
cs_alias_shortcode( 'raw_output', 'x_raw_output', false );
cs_alias_shortcode( 'recent_posts', 'x_recent_posts', false );
cs_alias_shortcode( 'responsive_text', 'x_responsive_text', false );
cs_alias_shortcode( 'search', 'x_search', false );
cs_alias_shortcode( 'share', 'x_share', false );
cs_alias_shortcode( 'skill_bar', 'x_skill_bar', false );
cs_alias_shortcode( 'slider', 'x_slider', false );
cs_alias_shortcode( 'slide', 'x_slide', false );
cs_alias_shortcode( 'tab_nav', 'x_tab_nav', false );
cs_alias_shortcode( 'tab_nav_item', 'x_tab_nav_item', false );
cs_alias_shortcode( 'tabs', 'x_tabs', false );
cs_alias_shortcode( 'tab', 'x_tab', false );
cs_alias_shortcode( 'toc', 'x_toc', false );
cs_alias_shortcode( 'toc_item', 'x_toc_item', false );
cs_alias_shortcode( 'visibility', 'x_visibility', false );
}
public function recentPostTypes( $types ) {
$types['portfolio'] = 'x-portfolio';
return $types;
}
public function scrollTopSelector() {
return '.x-navbar-fixed-top';
}
public function modifyContactMethods( $user_contactmethods ) {
if ( isset( $user_contactmethods['yim'] ) )
unset( $user_contactmethods['yim'] );
if ( isset( $user_contactmethods['aim'] ) )
unset( $user_contactmethods['aim'] );
if ( isset( $user_contactmethods['jabber'] ) )
unset( $user_contactmethods['jabber'] );
$user_contactmethods['facebook'] = __( 'Facebook Profile', csl18n() );
$user_contactmethods['twitter'] = __( 'Twitter Profile', csl18n() );
$user_contactmethods['googleplus'] = __( 'Google+ Profile', csl18n() );
return $user_contactmethods;
}
public function shortcodeGeneratorPreviewBefore() {
remove_all_actions( 'cornerstone_generator_preview_before' );
$list_stacks = array(
'integrity' => __( 'Integrity', csl18n() ),
'renew' => __( 'Renew', csl18n() ),
'icon' => __( 'Icon', csl18n() ),
'ethos' => __( 'Ethos', csl18n() )
);
$stack = $this->x_get_stack();
$stack_name = ( isset( $list_stacks[ $stack ] ) ) ? $list_stacks[ $stack ] : 'X';
printf(
__('You're using %s. Click the button below to check out a live example of this shortcode when using this Stack.', csl18n() ),
'<strong>' . $stack_name . '</strong>'
);
}
public function shortcodeGeneratorDemoURL( $attributes ) {
if ( isset($attributes['demo']) )
$attributes['demo'] = str_replace( 'integrity', $this->x_get_stack(), $attributes['demo'] );
return $attributes;
}
public function x_get_stack() {
// Some plugins abort the theme loading process in certain contexts.
// This provide a safe fallback for x_get_stack calls
if ( function_exists( 'x_get_stack' ) )
return x_get_stack();
return apply_filters( 'x_option_x_stack', get_option( 'x_stack', 'integrity' ) );
}
public function addDefaultSettings( $settings ) {
$settings['enable_legacy_font_classes'] = get_option( 'x_pre_v4', false );
return $settings;
}
/**
* Swap out the Design and Product Validation Metaboxes on the Options page
*/
public function optionsPage() {
remove_action( 'cornerstone_options_mb_validation', array( CS()->component( 'Admin' ), 'renderValidationMB' ) );
add_action( 'cornerstone_options_mb_settings', array( $this, 'legacyFontClasses' ) );
add_action( 'cornerstone_options_mb_validation', array( $this, 'renderValidationMB' ) );
add_filter( 'cornerstone_config_admin_info-items', array( $this, 'removeInfoItems' ) );
}
/**
*
*/
public function legacyFontClasses() {
?>
<tr>
<th>
<label for="cornerstone-fields-enable_legacy_font_classes">
<strong><?php _e( 'Enable Legacy Font Classes', csl18n() ); ?></strong>
<span><?php _e( 'Check to enable legacy font classes.', csl18n() ); ?></span>
</label>
</th>
<td>
<fieldset>
<?php echo CS()->component( 'Admin' )->settings->renderField( 'enable_legacy_font_classes', array( 'type' => 'checkbox', 'value' => '1', 'label' => __( 'Enable', csl18n() ) ) ) ?>
</fieldset>
</td>
</tr>
<?php
}
/**
* Output custom Product Validation Metabox
*/
public function renderValidationMB() { ?>
<?php if ( x_is_validated() ) : ?>
<p class="cs-validated"><strong>Congrats! X is active and validated</strong>. Because of this you don't need to validate Cornerstone and automatic updates are up and running.</p>
<?php else : ?>
<p class="cs-not-validated"><strong>Uh oh! It looks like X isn't validated</strong>. Cornerstone validates through X, which enables automatic updates. Head over to the product validation page to get that setup.<br><a href="<?php echo x_addons_get_link_product_validation(); ?>">Validate</a></p>
<?php endif;
}
public function removeInfoItems( $info_items ) {
unset( $info_items['api-key'] );
unset( $info_items['design-options'] );
$info_items['enable-legacy-font-classes' ] = array(
'title' => __( 'Enable Legacy Font Classes', csl18n() ),
'content' => __( 'X no longer provides the <strong>.x-icon*</strong> classes. This was done for performance reasons. If you need these classes, you can enable them again with this setting.', csl18n() )
);
return $info_items;
}
public function load_preview() {
if ( defined( 'X_VIDEO_LOCK_VERSION' ) )
remove_action( 'wp_footer', 'x_video_lock_output' );
}
}
// Native shortcode alterations.
// =============================================================================
// [audio]
// =============================================================================
//
// 1. Library.
// 2. Output.
// 3. Class.
//
function x_wp_native_audio_shortcode_library() { // 1
wp_enqueue_script( 'mediaelement' );
return false;
}
function x_wp_native_audio_shortcode( $html ) { // 2
return '<div class="x-audio player" data-x-element="x_mejs">' . $html . '</div>';
}
function x_wp_native_audio_shortcode_class() { // 3
return 'x-mejs x-wp-audio-shortcode advanced-controls';
}
// [video]
// =============================================================================
//
// 1. Library.
// 2. Output.
// 3. Class.
//
function x_wp_native_video_shortcode_library() { // 1
wp_enqueue_script( 'mediaelement' );
return false;
}
function x_wp_native_video_shortcode( $output ) { // 2
return '<div class="x-video player" data-x-element="x_mejs">' . preg_replace('/<div(.*?)>/', '<div class="x-video-inner">', $output ) . '</div>';
}
function x_wp_native_video_shortcode_class() { // 3
return 'x-mejs x-wp-video-shortcode advanced-controls';
}
| elinberg/ericlinberg | wp-content/plugins/cornerstone/includes/integrations/x-theme.php | PHP | gpl-2.0 | 12,573 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2023,
3506,
2035,
1996,
3642,
2000,
17409,
2007,
1060,
1008,
1013,
2465,
23354,
1035,
8346,
1035,
1060,
1035,
4323,
1063,
1013,
1008,
1008,
1008,
4323,
8346,
2015,
2323,
3073,
1037,
6782,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
#include <stddef.h>
#include <sys/queue.h>
#include "options.h"
#include "util.h"
struct window {
struct window *parent;
enum window_split_type {
WINDOW_LEAF,
WINDOW_SPLIT_VERTICAL,
WINDOW_SPLIT_HORIZONTAL
} split_type;
// The size of the window. Only valid for the root window.
size_t w;
size_t h;
struct {
#define OPTION(name, type, _) type name;
WINDOW_OPTIONS
#undef OPTION
} opt;
union {
struct {
// The buffer being edited.
struct buffer *buffer;
char *alternate_path;
// The coordinates of the top left cell visible on screen.
size_t top;
size_t left;
// Window-local working directory if set (otherwise NULL).
char *pwd;
// The offset of the cursor.
struct mark *cursor;
// The incremental match if 'incsearch' is enabled.
bool have_incsearch_match;
struct region incsearch_match;
// The visual mode selection.
// NULL if not in visual mode.
struct region *visual_mode_selection;
TAILQ_HEAD(tag_list, tag_jump) tag_stack;
struct tag_jump *tag;
};
struct {
struct window *first;
struct window *second;
size_t point;
} split;
};
};
struct window *window_create(struct buffer *buffer, size_t w, size_t h);
void window_free(struct window *window);
// Closes the current window and returns a pointer to the "next" window.
// Caller should use window_free on passed-in window afterwards.
struct window *window_close(struct window *window);
enum window_split_direction {
WINDOW_SPLIT_LEFT,
WINDOW_SPLIT_RIGHT,
WINDOW_SPLIT_ABOVE,
WINDOW_SPLIT_BELOW
};
struct window *window_split(struct window *window,
enum window_split_direction direction);
void window_resize(struct window *window, int dw, int dh);
void window_equalize(struct window *window,
enum window_split_type type);
struct window *window_root(struct window *window);
struct window *window_left(struct window *window);
struct window *window_right(struct window *window);
struct window *window_up(struct window *window);
struct window *window_down(struct window *window);
struct window *window_first_leaf(struct window *window);
void window_set_buffer(struct window *window, struct buffer *buffer);
size_t window_cursor(struct window *window);
void window_set_cursor(struct window *window, size_t pos);
void window_center_cursor(struct window *window);
size_t window_w(struct window *window);
size_t window_h(struct window *window);
size_t window_x(struct window *window);
size_t window_y(struct window *window);
void window_page_up(struct window *window);
void window_page_down(struct window *window);
void window_clear_working_directories(struct window *window);
| isbadawi/badavi | window.h | C | mit | 2,799 | [
30522,
1001,
10975,
8490,
2863,
2320,
1001,
2421,
1026,
2358,
14141,
12879,
1012,
1044,
1028,
1001,
2421,
1026,
25353,
2015,
1013,
24240,
1012,
1044,
1028,
1001,
2421,
1000,
7047,
1012,
1044,
1000,
1001,
2421,
1000,
21183,
4014,
1012,
1044,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
define(function(require) {
var Checker = require("checkers/controller/Checker"),
GameBoard = require("checkers/controller/GameBoard"),
GameSpace = require("checkers/controller/GameSpace");
var instance = null;
function GameBoardUtil() {
}
var getInstance = function() {
if (instance === null) {
instance = new GameBoardUtil();
}
return instance;
}
GameBoardUtil.prototype.getValidMoves = function(checker, gameBoard, posDir) {
var validMoves = new Array();
$.merge(validMoves, this.getEmptySpaceMoves(checker, gameBoard, posDir));
$.merge(validMoves, this.getJumpMoves(checker, gameBoard, posDir));
return validMoves;
}
GameBoardUtil.prototype.getEmptySpaceMoves = function(checker, gameBoard, posDir) {
var emptySpaceMoves = new Array();
var row = checker.getRow() + posDir;
// Checks left move
if (this.isValidMove(row, checker.getColumn() - 1)) {
var gameSpace = gameBoard.getGameSpace(row, checker.getColumn() - 1)
if (gameSpace.isEmpty()) {
emptySpaceMoves.push(gameSpace);
}
}
// Checks right move
if (this.isValidMove(row, checker.getColumn() + 1)) {
var gameSpace = gameBoard.getGameSpace(row, checker.getColumn() + 1);
if (gameSpace.isEmpty()) {
emptySpaceMoves.push(gameSpace);
}
}
if (checker.isKing()) {
var kRow = checker.getRow() - posDir;
// Checks left move
if (this.isValidMove(kRow, checker.getColumn() - 1)) {
var gameSpace = gameBoard.getGameSpace(kRow, checker.getColumn() - 1)
if (gameSpace.isEmpty()) {
emptySpaceMoves.push(gameSpace);
}
}
// Checks right move
if (this.isValidMove(kRow, checker.getColumn() + 1)) {
var gameSpace = gameBoard.getGameSpace(kRow, checker.getColumn() + 1);
if (gameSpace.isEmpty()) {
emptySpaceMoves.push(gameSpace);
}
}
}
return emptySpaceMoves;
}
GameBoardUtil.prototype.isValidMove = function(row, column) {
if (row < 0 || row >= GameBoard.NUMSQUARES || column < 0 || column >= GameBoard.NUMSQUARES) {
return false;
}
return true;
}
GameBoardUtil.prototype.getJumpMoves = function(checker, gameBoard, posDir) {
var jumpMoves = new Array();
var row = checker.getRow() + posDir * 2;
// Checks left jump move
if (this.isValidMove(row, checker.getColumn() - 2)) {
var gameSpace = gameBoard.getGameSpace(row, checker.getColumn() - 2);
if (gameSpace.isEmpty()) {
var jumpedGameSpace = gameBoard.getGameSpace(row - posDir, checker.getColumn() - 1);
if (!jumpedGameSpace.isEmpty() && jumpedGameSpace.getChecker().getPlayerId() != checker.getPlayerId()) {
jumpMoves.push(gameSpace);
}
}
}
// Checks right jump move
if (this.isValidMove(row, checker.getColumn() + 2)) {
var gameSpace = gameBoard.getGameSpace(row, checker.getColumn() + 2);
if (gameSpace.isEmpty()) {
var jumpedGameSpace = gameBoard.getGameSpace(row - posDir, checker.getColumn() + 1);
if (!jumpedGameSpace.isEmpty() && jumpedGameSpace.getChecker().getPlayerId() != checker.getPlayerId()) {
jumpMoves.push(gameSpace);
}
}
}
if (checker.isKing()) {
// Checks left jump move
var kRow = checker.getRow() - posDir * 2;
if (this.isValidMove(kRow, checker.getColumn() - 2)) {
var gameSpace = gameBoard.getGameSpace(kRow, checker.getColumn() - 2);
if (gameSpace.isEmpty()) {
var jumpedGameSpace = gameBoard.getGameSpace(kRow + posDir, checker.getColumn() - 1);
if (!jumpedGameSpace.isEmpty() && jumpedGameSpace.getChecker().getPlayerId() != checker.getPlayerId()) {
jumpMoves.push(gameSpace);
}
}
}
// Checks right jump move
if (this.isValidMove(kRow, checker.getColumn() + 2)) {
var gameSpace = gameBoard.getGameSpace(kRow, checker.getColumn() + 2);
if (gameSpace.isEmpty()) {
var jumpedGameSpace = gameBoard.getGameSpace(kRow + posDir, checker.getColumn() + 1);
if (!jumpedGameSpace.isEmpty() && jumpedGameSpace.getChecker().getPlayerId() != checker.getPlayerId()) {
jumpMoves.push(gameSpace);
}
}
}
}
return jumpMoves;
}
return ({getInstance:getInstance});
}); | RobStrader/Robs-Arcade | js/checkers/util/GameBoardUtil.js | JavaScript | mit | 5,153 | [
30522,
9375,
1006,
3853,
1006,
5478,
1007,
1063,
13075,
4638,
2121,
1027,
5478,
1006,
1000,
4638,
2545,
1013,
11486,
1013,
4638,
2121,
1000,
1007,
1010,
2208,
6277,
1027,
5478,
1006,
1000,
4638,
2545,
1013,
11486,
1013,
2208,
6277,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<!-- Meta-Information -->
<title>Kaleo | Search</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Kaleo">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700">
<!-- Vendor: Bootstrap Stylesheets http://getbootstrap.com -->
<link rel="stylesheet" href="app/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="app/bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
<link href="app/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="app/bower_components/angular-bootstrap/ui-bootstrap-csp.css" rel="stylesheet"></link>
<link href="app/bower_components/selectize/dist/css/selectize.bootstrap2.css" rel="stylesheet"></link>
<!-- Our Website CSS Styles -->
<link rel="stylesheet" href="css/main.css">
</head>
<body ng-app="kaleoProject" ng-controller="mainCtrl">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Our Website Content Goes Here -->
<div ng-include='"templates/header.html"'></div>
<div ui-view></div>
<div ng-include='"templates/footer.html"'></div>
<!-- Vendor: Javascripts -->
<script src="app/bower_components/jquery/dist/jquery.min.js"></script>
<script src="app/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="app/bower_components/q/q.js"></script>
<script src="app/bower_components/lodash/lodash.js"></script>
<script src="app/bower_components/selectize/dist/js/standalone/selectize.js"></script>
<!-- Vendor: Angular, followed by our custom Javascripts -->
<script src="app/bower_components/angular/angular.min.js"></script>
<script src="app/bower_components/ui-router/release/angular-ui-router.min.js"></script>
<script src="app/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="app/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="app/bower_components/angular-selectize2/dist/angular-selectize.js"></script>
<!-- Our Website Javascripts -->
<script src="app/main.js"></script>
<script src="app/components/search/searchCtrl.js"></script>
<script src="app/components/services/promiseMonitor.js"></script>
<script src="app/components/directives/paginationDirective.js"></script>
<script src="app/components/directives/versionDirective.js"></script>
</body>
</html>
| fezimmer89/kaleoChallenge | index.html | HTML | mit | 3,034 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
30524,
1027,
1000,
2053,
1011,
1046,
2015,
8318,
1011,
29464,
2683,
8318,
1011,
29464,
2620,
8318,
1011,
29464,
2581,
1000,
1028,
1026,
999,
1031,
2203,
10128,
1033,
1011,
1011,
1028,
1026,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{%- if doc.members.length %}
<section class="meta-data">
<h2>Metadata properties</h2>
{%- for metadata in doc.members %}{% if not metadata.internal %}
<div class="metadata-member">
<a name="{$ metadata.name $}" class="anchor-offset"></a>
<code-example language="ts" hideCopy="true">{$ metadata.name $}{$ params.paramList(metadata.parameters) | trim $}{$ params.returnType(metadata.type) $}</code-example>
{%- if not metadata.notYetDocumented %}
{$ metadata.description | marked $}
{%- endif %}
</div>
{% if not loop.last %}<hr class="hr-margin">{% endif %}
{% endif %}{% endfor %}
</section>
{%- endif -%}
| gkalpak/angular | aio/tools/transforms/templates/api/includes/metadata.html | HTML | mit | 657 | [
30522,
1063,
1003,
1011,
2065,
9986,
1012,
2372,
1012,
3091,
1003,
1065,
1026,
2930,
2465,
1027,
1000,
18804,
1011,
2951,
1000,
1028,
1026,
1044,
2475,
1028,
27425,
5144,
1026,
1013,
1044,
2475,
1028,
1063,
1003,
1011,
2005,
27425,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Interface IProxyGenerator
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Interface IProxyGenerator
">
<meta name="generator" content="docfx 2.9.3.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content">
<h1 id="Bifrost_Web_Proxies_IProxyGenerator" data-uid="Bifrost.Web.Proxies.IProxyGenerator">Interface IProxyGenerator
</h1>
<div class="markdown level0 summary"><p>Defines a system that can generate javascript proxies.</p>
</div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>:Bifrost.Web.Proxies</h6>
<h6><strong>Assembly</strong>:Bifrost.Web.dll</h6>
<h5 id="Bifrost_Web_Proxies_IProxyGenerator_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public interface IProxyGenerator : IConvention</code></pre>
</div>
<h5 id="Bifrost_Web_Proxies_IProxyGenerator_remarks"><strong>Remarks</strong></h5>
<div class="markdown level0 remarks"><p>Types implementing this interface will be automatically registered and invoked during proxy generation.</p>
</div>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Web_Proxies_IProxyGenerator_Generate.md&value=---%0Auid%3A%20Bifrost.Web.Proxies.IProxyGenerator.Generate%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/dolittle/Bifrost/blob/master/Source/Bifrost.Web/Proxies/IProxyGenerator.cs/#L17">View Source</a>
</span>
<a id="Bifrost_Web_Proxies_IProxyGenerator_Generate_" data-uid="Bifrost.Web.Proxies.IProxyGenerator.Generate*"></a>
<h4 id="Bifrost_Web_Proxies_IProxyGenerator_Generate" data-uid="Bifrost.Web.Proxies.IProxyGenerator.Generate">Generate()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">string Generate()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="extensionmethods">Extension Methods</h3>
<div>
<a class="xref" href="Bifrost.Concepts.ConceptExtensions.html#Bifrost_Concepts_ConceptExtensions_IsConcept_System_Object_">ConceptExtensions.IsConcept(Object)</a>
</div>
<div>
<a class="xref" href="Bifrost.Concepts.ConceptExtensions.html#Bifrost_Concepts_ConceptExtensions_GetConceptValue_System_Object_">ConceptExtensions.GetConceptValue(Object)</a>
</div>
<div>
<a class="xref" href="Bifrost.Dynamic.DynamicExtensions.html#Bifrost_Dynamic_DynamicExtensions_AsExpandoObject_System_Object_">DynamicExtensions.AsExpandoObject(Object)</a>
</div>
<div>
<a class="xref" href="Bifrost.Extensions.MethodCalls.html#Bifrost_Extensions_MethodCalls_CallGenericMethod__5___1_System_Linq_Expressions_Expression_System_Func___1_System_Func___2___3___4___0______2___3___4_System_Type___">MethodCalls.CallGenericMethod<TOut, T, T1, T2, T3>(T, Expression<Func<T, Func<T1, T2, T3, TOut>>>, T1, T2, T3, Type[])</a>
</div>
<div>
<a class="xref" href="Bifrost.Extensions.MethodCalls.html#Bifrost_Extensions_MethodCalls_CallGenericMethod__4___1_System_Linq_Expressions_Expression_System_Func___1_System_Func___2___3___0______2___3_System_Type___">MethodCalls.CallGenericMethod<TOut, T, T1, T2>(T, Expression<Func<T, Func<T1, T2, TOut>>>, T1, T2, Type[])</a>
</div>
<div>
<a class="xref" href="Bifrost.Extensions.MethodCalls.html#Bifrost_Extensions_MethodCalls_CallGenericMethod__3___1_System_Linq_Expressions_Expression_System_Func___1_System_Func___2___0______2_System_Type___">MethodCalls.CallGenericMethod<TOut, T, T1>(T, Expression<Func<T, Func<T1, TOut>>>, T1, Type[])</a>
</div>
<div>
<a class="xref" href="Bifrost.Extensions.MethodCalls.html#Bifrost_Extensions_MethodCalls_CallGenericMethod__2___1_System_Linq_Expressions_Expression_System_Func___1_System_Func___0____System_Type___">MethodCalls.CallGenericMethod<TOut, T>(T, Expression<Func<T, Func<TOut>>>, Type[])</a>
</div>
<div>
<a class="xref" href="Bifrost.Extensions.MethodCalls.html#Bifrost_Extensions_MethodCalls_Generics__1___0_">MethodCalls.Generics<T>(T)</a>
</div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/dolittle/bifrost/new/master/Source/Documentation/apispec/new?filename=Bifrost_Web_Proxies_IProxyGenerator.md&value=---%0Auid%3A%20Bifrost.Web.Proxies.IProxyGenerator%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/dolittle/Bifrost/blob/master/Source/Bifrost.Web/Proxies/IProxyGenerator.cs/#L15" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2008-2017 Dolittle
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>
| dolittle/dolittle.github.io | bifrost/api/Bifrost.Web.Proxies.IProxyGenerator.html | HTML | mit | 10,261 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
999,
1011,
1011,
1031,
2065,
29464,
1033,
1028,
1026,
999,
1031,
2203,
10128,
1033,
1011,
1011,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(AuctionHouseService.Startup))]
namespace AuctionHouseService
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureMobileApp(app);
}
}
} | kphillpotts/AuctionHouse | AuctionHouseService/AuctionHouseService/Startup.cs | C# | mit | 286 | [
30522,
2478,
7513,
1012,
27593,
2378,
1025,
2478,
27593,
2378,
1025,
1031,
3320,
1024,
27593,
7076,
7559,
8525,
2361,
1006,
2828,
11253,
1006,
10470,
15666,
2121,
7903,
2063,
1012,
22752,
1007,
1007,
1033,
3415,
15327,
10470,
15666,
2121,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*****************************************************************************
* Copyright (c) 2014-2019 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "TileElement.h"
#include "../core/Guard.hpp"
#include "../interface/Window.h"
#include "../localisation/Localisation.h"
#include "../ride/Track.h"
#include "Banner.h"
#include "LargeScenery.h"
#include "Scenery.h"
uint8_t TileElementBase::GetType() const
{
return this->type & TILE_ELEMENT_TYPE_MASK;
}
void TileElementBase::SetType(uint8_t newType)
{
this->type &= ~TILE_ELEMENT_TYPE_MASK;
this->type |= (newType & TILE_ELEMENT_TYPE_MASK);
}
Direction TileElementBase::GetDirection() const
{
return this->type & TILE_ELEMENT_DIRECTION_MASK;
}
void TileElementBase::SetDirection(Direction direction)
{
this->type &= ~TILE_ELEMENT_DIRECTION_MASK;
this->type |= (direction & TILE_ELEMENT_DIRECTION_MASK);
}
Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const
{
return ((this->type & TILE_ELEMENT_DIRECTION_MASK) + offset) & TILE_ELEMENT_DIRECTION_MASK;
}
bool TileElementBase::IsLastForTile() const
{
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
}
void TileElementBase::SetLastForTile(bool on)
{
if (on)
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
else
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
}
bool TileElementBase::IsGhost() const
{
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
}
void TileElementBase::SetGhost(bool isGhost)
{
if (isGhost)
{
this->flags |= TILE_ELEMENT_FLAG_GHOST;
}
else
{
this->flags &= ~TILE_ELEMENT_FLAG_GHOST;
}
}
bool tile_element_is_underground(TileElement* tileElement)
{
do
{
tileElement++;
if ((tileElement - 1)->IsLastForTile())
return false;
} while (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE);
return true;
}
BannerIndex tile_element_get_banner_index(TileElement* tileElement)
{
rct_scenery_entry* sceneryEntry;
switch (tileElement->GetType())
{
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
if (sceneryEntry->large_scenery.scrolling_mode == SCROLLING_MODE_NONE)
return BANNER_INDEX_NULL;
return tileElement->AsLargeScenery()->GetBannerIndex();
case TILE_ELEMENT_TYPE_WALL:
sceneryEntry = tileElement->AsWall()->GetEntry();
if (sceneryEntry == nullptr || sceneryEntry->wall.scrolling_mode == SCROLLING_MODE_NONE)
return BANNER_INDEX_NULL;
return tileElement->AsWall()->GetBannerIndex();
case TILE_ELEMENT_TYPE_BANNER:
return tileElement->AsBanner()->GetIndex();
default:
return BANNER_INDEX_NULL;
}
}
void tile_element_set_banner_index(TileElement* tileElement, BannerIndex bannerIndex)
{
switch (tileElement->GetType())
{
case TILE_ELEMENT_TYPE_WALL:
tileElement->AsWall()->SetBannerIndex(bannerIndex);
break;
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
tileElement->AsLargeScenery()->SetBannerIndex(bannerIndex);
break;
case TILE_ELEMENT_TYPE_BANNER:
tileElement->AsBanner()->SetIndex(bannerIndex);
break;
default:
log_error("Tried to set banner index on unsuitable tile element!");
Guard::Assert(false);
}
}
void tile_element_remove_banner_entry(TileElement* tileElement)
{
auto bannerIndex = tile_element_get_banner_index(tileElement);
auto banner = GetBanner(bannerIndex);
if (banner != nullptr)
{
window_close_by_number(WC_BANNER, bannerIndex);
*banner = {};
}
}
uint8_t tile_element_get_ride_index(const TileElement* tileElement)
{
switch (tileElement->GetType())
{
case TILE_ELEMENT_TYPE_TRACK:
return tileElement->AsTrack()->GetRideIndex();
case TILE_ELEMENT_TYPE_ENTRANCE:
return tileElement->AsEntrance()->GetRideIndex();
case TILE_ELEMENT_TYPE_PATH:
return tileElement->AsPath()->GetRideIndex();
default:
return RIDE_ID_NULL;
}
}
void TileElement::ClearAs(uint8_t newType)
{
type = newType;
flags = 0;
base_height = 2;
clearance_height = 2;
std::fill_n(pad_04, sizeof(pad_04), 0x00);
std::fill_n(pad_08, sizeof(pad_08), 0x00);
}
void TileElementBase::Remove()
{
tile_element_remove((TileElement*)this);
}
// Rotate both of the values amount
const QuarterTile QuarterTile::Rotate(uint8_t amount) const
{
switch (amount)
{
case 0:
return QuarterTile{ *this };
break;
case 1:
{
auto rotVal1 = _val << 1;
auto rotVal2 = rotVal1 >> 4;
// Clear the bit from the tileQuarter
rotVal1 &= 0b11101110;
// Clear the bit from the zQuarter
rotVal2 &= 0b00010001;
return QuarterTile{ static_cast<uint8_t>(rotVal1 | rotVal2) };
}
case 2:
{
auto rotVal1 = _val << 2;
auto rotVal2 = rotVal1 >> 4;
// Clear the bit from the tileQuarter
rotVal1 &= 0b11001100;
// Clear the bit from the zQuarter
rotVal2 &= 0b00110011;
return QuarterTile{ static_cast<uint8_t>(rotVal1 | rotVal2) };
}
case 3:
{
auto rotVal1 = _val << 3;
auto rotVal2 = rotVal1 >> 4;
// Clear the bit from the tileQuarter
rotVal1 &= 0b10001000;
// Clear the bit from the zQuarter
rotVal2 &= 0b01110111;
return QuarterTile{ static_cast<uint8_t>(rotVal1 | rotVal2) };
}
default:
log_error("Tried to rotate QuarterTile invalid amount.");
return QuarterTile{ 0 };
}
}
uint8_t TileElementBase::GetOccupiedQuadrants() const
{
return flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
}
void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
{
flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
}
int32_t TileElementBase::GetBaseZ() const
{
return base_height * 8;
}
void TileElementBase::SetBaseZ(int32_t newZ)
{
base_height = (newZ / 8);
}
int32_t TileElementBase::GetClearanceZ() const
{
return clearance_height * 8;
}
void TileElementBase::SetClearanceZ(int32_t newZ)
{
clearance_height = (newZ / 8);
}
| IntelOrca/OpenRCT2 | src/openrct2/world/TileElement.cpp | C++ | gpl-3.0 | 6,843 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
! { dg-do compile }
! { dg-options "-finline-matmul-limit=0 -fdump-tree-original" }
!
! Test the fix for PR36932 and PR36933, in which unnecessary
! temporaries were being generated. The module m2 tests the
! additional testcase in comment #3 of PR36932.
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
MODULE M2
IMPLICIT NONE
TYPE particle
REAL :: r(3)
END TYPE
CONTAINS
SUBROUTINE S1(p)
TYPE(particle), POINTER, DIMENSION(:) :: p
REAL :: b(3)
INTEGER :: i
b=pbc(p(i)%r)
END SUBROUTINE S1
FUNCTION pbc(b)
REAL :: b(3)
REAL :: pbc(3)
pbc=b
END FUNCTION
END MODULE M2
MODULE M1
IMPLICIT NONE
TYPE cell_type
REAL :: h(3,3)
END TYPE
CONTAINS
SUBROUTINE S1(cell)
TYPE(cell_type), POINTER :: cell
REAL :: a(3)
REAL :: b(3) = [1, 2, 3]
a=MATMUL(cell%h,b)
if (ANY (INT (a) .ne. [30, 36, 42])) call abort
END SUBROUTINE S1
END MODULE M1
use M1
TYPE(cell_type), POINTER :: cell
allocate (cell)
cell%h = reshape ([(real(i), i = 1, 9)], [3, 3])
call s1 (cell)
end
! { dg-final { scan-tree-dump-times "&a" 1 "original" } }
! { dg-final { scan-tree-dump-times "pack" 0 "original" } }
| selmentdev/selment-toolchain | source/gcc-latest/gcc/testsuite/gfortran.dg/dependency_26.f90 | FORTRAN | gpl-3.0 | 1,186 | [
30522,
999,
1063,
1040,
2290,
1011,
2079,
4012,
22090,
1065,
999,
1063,
1040,
2290,
1011,
7047,
1000,
1011,
10346,
4179,
1011,
13523,
12274,
2140,
1011,
5787,
1027,
1014,
1011,
1042,
8566,
8737,
1011,
3392,
1011,
2434,
1000,
1065,
999,
99... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
$userdata = $this->session->userdata('user_login');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $title; ?> </title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/dist/css/skins/_all-skins.min.css">
<link href="<?php echo base_url(); ?>assets/css/bootstrap.min.css" rel="stylesheet">
<link href="<?php echo base_url(); ?>assets/fonts/css/font-awesome.min.css" rel="stylesheet">
<link href="<?php echo base_url(); ?>assets/css/animate.min.css" rel="stylesheet">
<!-- Custom styling plus plugins -->
<link href="<?php echo base_url(); ?>assets/css/custom.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/maps/jquery-jvectormap-2.0.3.css" />
<link href="<?php echo base_url(); ?>assets/css/icheck/flat/green.css" rel="stylesheet" />
<link href="<?php echo base_url(); ?>assets/css/floatexamples.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap/bootstrap-dialog.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrapValidator.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap/bootstrap-dialog.min.css">
<script src="<?php echo base_url(); ?>assets/js/jquery.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/nprogress.js"></script>
<!--[if lt IE 9]>
<script src="../assets/js/ie8-responsive-file-warning.js"></script>
<![endif]-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- flot js -->
<!--[if lte IE 8]><script type="text/javascript" src="js/excanvas.min.js"></script><![endif]-->
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="#" class="site_title"><i class="fa fa-home"></i> <span>Biro Jasa</span></a>
</div>
<div class="clearfix"></div>
<div class="profile">
<div class="profile_pic">
<img src="<?php echo base_url(); ?>assets/img/user_picture.png" alt="..." class="img-circle profile_img">
</div>
<div class="profile_info">
<span>Wellcome</span>
<h2><?php echo $userdata['nama'] ?></h2>
</div>
</div>
<!-- /menu prile quick info -->
<br />
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a href="<?php echo site_url('/'); ?>user"><i class="fa fa-dashboard"></i> Home </a>
</li>
<li><a><i class="fa fa-folder-open-o"></i> Pengurusan BBN <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li><a href="<?php echo site_url('us_bbn_satu'); ?>">BBN 1</a>
</li>
<li><a href="<?php echo site_url('us_bbn_dua'); ?>">BBN 2</a>
</li>
</ul>
</li>
</li>
<li><a href="<?php echo site_url('/'); ?>us_add_user"><i class="fa fa-users"></i> User </span></a>
</li>
</ul>
</div>
<div class="menu_section">
</div>
</div>
<div class="sidebar-footer hidden-small">
<a href="<?php echo site_url(); ?>/login/logout_bj" data-toggle="tooltip" data-placement="top" title="Logout">
<span class="glyphicon glyphicon-off" aria-hidden="true"></span>
</a>
</div>
<!-- /menu footer buttons -->
</div>
</div>
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav class="" role="navigation">
<div class="nav toggle">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="<?php echo base_url(); ?>assets/img/user_picture.png" alt="..."><?php echo $userdata['nama'] ?>
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu animated fadeInDown pull-right">
<li><a href="<?php echo site_url(); ?>/bj_profil">Profile</a>
</li>
<li><a href="<?php echo site_url(); ?>/login/logout_bj"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<div class="right_col" role="main">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="dashboard_graph">
<div class="row x_title">
<div class="col-md-6">
<h3><?php echo $subtitle; ?></h3>
</div>
</div>
<div>
<?php echo $content ?>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<footer>
<div class="copyright-info">
<p class="pull-right"><a href="https://www.tigapilarmajumandiri.com">Tiga Pilar Maju Mandiri</a>
</p>
</div>
<div class="clearfix"></div>
</footer>
<!-- /footer content -->
</div>
<!-- /page content -->
</div>
</div>
<div id="custom_notifications" class="custom-notifications dsp_none">
<ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
</ul>
<div class="clearfix"></div>
<div id="notif-group" class="tabbed_notifications"></div>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.pie.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.time.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/date.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.spline.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.stack.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/curvedLines.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.resize.js"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
<!-- gauge js -->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/gauge/gauge.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/gauge/gauge_demo.js"></script>
<!-- bootstrap progress js -->
<script src="<?php echo base_url(); ?>assets/js/progressbar/bootstrap-progressbar.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/nicescroll/jquery.nicescroll.min.js"></script>
<!-- icheck -->
<script src="<?php echo base_url(); ?>assets/js/icheck/icheck.min.js"></script>
<!-- daterangepicker -->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/moment/moment.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/datepicker/daterangepicker.js"></script>
<!-- chart js -->
<script src="<?php echo base_url(); ?>assets/js/chartjs/chart.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/custom.js"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrapValidator.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/bootstrap/bootstrap-dialog.min.js"></script>
<script src="<?php echo base_url('assets/plugins/slimScroll/jquery.slimscroll.min.js'); ?>"></script>
<!-- FastClick -->
<script src="<?php echo base_url('assets/plugins/fastclick/fastclick.min.js'); ?>"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url('assets/dist/js/app.min.js'); ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?php echo base_url('assets/dist/js/demo.js'); ?>"></script>
<script src="<?php echo base_url('assets/js/custom.js'); ?>"></script>
<!-- form wizard -->
<!-- /datepicker -->
<!-- /footer content -->
</body>
</html>
| NizarHafizulllah/BankSampah | application/views/user/user_theme.php | PHP | unlicense | 9,813 | [
30522,
1026,
1029,
25718,
1002,
5310,
2850,
2696,
1027,
1002,
2023,
1011,
1028,
5219,
1011,
1028,
5310,
2850,
2696,
1006,
1005,
5310,
1035,
8833,
2378,
1005,
1007,
1025,
1029,
1028,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Code that creates simple startup projects."""
from pathlib import Path
from enum import Enum
import subprocess
import shutil
import sys
import os
import re
from glob import glob
from mesonbuild import mesonlib
from mesonbuild.environment import detect_ninja
from mesonbuild.templates.samplefactory import sameple_generator
import typing as T
if T.TYPE_CHECKING:
import argparse
'''
we currently have one meson template at this time.
'''
from mesonbuild.templates.mesontemplates import create_meson_build
FORTRAN_SUFFIXES = {'.f', '.for', '.F', '.f90', '.F90'}
LANG_SUFFIXES = {'.c', '.cc', '.cpp', '.cs', '.cu', '.d', '.m', '.mm', '.rs', '.java', '.vala'} | FORTRAN_SUFFIXES
LANG_SUPPORTED = {'c', 'cpp', 'cs', 'cuda', 'd', 'fortran', 'java', 'rust', 'objc', 'objcpp', 'vala'}
DEFAULT_PROJECT = 'executable'
DEFAULT_VERSION = '0.1'
class DEFAULT_TYPES(Enum):
EXE = 'executable'
LIB = 'library'
INFO_MESSAGE = '''Sample project created. To build it run the
following commands:
meson setup builddir
meson compile -C builddir
'''
def create_sample(options: 'argparse.Namespace') -> None:
'''
Based on what arguments are passed we check for a match in language
then check for project type and create new Meson samples project.
'''
sample_gen = sameple_generator(options)
if options.type == DEFAULT_TYPES['EXE'].value:
sample_gen.create_executable()
elif options.type == DEFAULT_TYPES['LIB'].value:
sample_gen.create_library()
else:
raise RuntimeError('Unreachable code')
print(INFO_MESSAGE)
def autodetect_options(options: 'argparse.Namespace', sample: bool = False) -> None:
'''
Here we autodetect options for args not passed in so don't have to
think about it.
'''
if not options.name:
options.name = Path().resolve().stem
if not re.match('[a-zA-Z_][a-zA-Z0-9]*', options.name) and sample:
raise SystemExit(f'Name of current directory "{options.name}" is not usable as a sample project name.\n'
'Specify a project name with --name.')
print(f'Using "{options.name}" (name of current directory) as project name.')
if not options.executable:
options.executable = options.name
print(f'Using "{options.executable}" (project name) as name of executable to build.')
if sample:
# The rest of the autodetection is not applicable to generating sample projects.
return
if not options.srcfiles:
srcfiles = []
for f in (f for f in Path().iterdir() if f.is_file()):
if f.suffix in LANG_SUFFIXES:
srcfiles.append(f)
if not srcfiles:
raise SystemExit('No recognizable source files found.\n'
'Run meson init in an empty directory to create a sample project.')
options.srcfiles = srcfiles
print("Detected source files: " + ' '.join(map(str, srcfiles)))
options.srcfiles = [Path(f) for f in options.srcfiles]
if not options.language:
for f in options.srcfiles:
if f.suffix == '.c':
options.language = 'c'
break
if f.suffix in ('.cc', '.cpp'):
options.language = 'cpp'
break
if f.suffix == '.cs':
options.language = 'cs'
break
if f.suffix == '.cu':
options.language = 'cuda'
break
if f.suffix == '.d':
options.language = 'd'
break
if f.suffix in FORTRAN_SUFFIXES:
options.language = 'fortran'
break
if f.suffix == '.rs':
options.language = 'rust'
break
if f.suffix == '.m':
options.language = 'objc'
break
if f.suffix == '.mm':
options.language = 'objcpp'
break
if f.suffix == '.java':
options.language = 'java'
break
if f.suffix == '.vala':
options.language = 'vala'
break
if not options.language:
raise SystemExit("Can't autodetect language, please specify it with -l.")
print("Detected language: " + options.language)
def add_arguments(parser: 'argparse.ArgumentParser') -> None:
'''
Here we add args for that the user can passed when making a new
Meson project.
'''
parser.add_argument("srcfiles", metavar="sourcefile", nargs="*", help="source files. default: all recognized files in current directory")
parser.add_argument('-C', dest='wd', action=mesonlib.RealPathAction,
help='directory to cd into before running')
parser.add_argument("-n", "--name", help="project name. default: name of current directory")
parser.add_argument("-e", "--executable", help="executable name. default: project name")
parser.add_argument("-d", "--deps", help="dependencies, comma-separated")
parser.add_argument("-l", "--language", choices=sorted(LANG_SUPPORTED), help="project language. default: autodetected based on source files")
parser.add_argument("-b", "--build", action='store_true', help="build after generation")
parser.add_argument("--builddir", default='build', help="directory for build")
parser.add_argument("-f", "--force", action="store_true", help="force overwrite of existing files and directories.")
parser.add_argument('--type', default=DEFAULT_PROJECT, choices=('executable', 'library'), help=f"project type. default: {DEFAULT_PROJECT} based project")
parser.add_argument('--version', default=DEFAULT_VERSION, help=f"project version. default: {DEFAULT_VERSION}")
def run(options: 'argparse.Namespace') -> int:
'''
Here we generate the new Meson sample project.
'''
if not Path(options.wd).exists():
sys.exit('Project source root directory not found. Run this command in source directory root.')
os.chdir(options.wd)
if not glob('*'):
autodetect_options(options, sample=True)
if not options.language:
print('Defaulting to generating a C language project.')
options.language = 'c'
create_sample(options)
else:
autodetect_options(options)
if Path('meson.build').is_file() and not options.force:
raise SystemExit('meson.build already exists. Use --force to overwrite.')
create_meson_build(options)
if options.build:
if Path(options.builddir).is_dir() and options.force:
print('Build directory already exists, deleting it.')
shutil.rmtree(options.builddir)
print('Building...')
cmd = mesonlib.get_meson_command() + [options.builddir]
ret = subprocess.run(cmd)
if ret.returncode:
raise SystemExit
cmd = detect_ninja() + ['-C', options.builddir]
ret = subprocess.run(cmd)
if ret.returncode:
raise SystemExit
return 0
| mesonbuild/meson | mesonbuild/minit.py | Python | apache-2.0 | 7,660 | [
30522,
1001,
9385,
2418,
1996,
2033,
3385,
2458,
2136,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1001,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.apache.lucene.index;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
public class TestStressNRT extends LuceneTestCase {
volatile DirectoryReader reader;
final ConcurrentHashMap<Integer,Long> model = new ConcurrentHashMap<>();
Map<Integer,Long> committedModel = new HashMap<>();
long snapshotCount;
long committedModelClock;
volatile int lastId;
final String field = "val_l";
Object[] syncArr;
private void initModel(int ndocs) {
snapshotCount = 0;
committedModelClock = 0;
lastId = 0;
syncArr = new Object[ndocs];
for (int i=0; i<ndocs; i++) {
model.put(i, -1L);
syncArr[i] = new Object();
}
committedModel.putAll(model);
}
public void test() throws Exception {
// update variables
final int commitPercent = random().nextInt(20);
final int softCommitPercent = random().nextInt(100); // what percent of the commits are soft
final int deletePercent = random().nextInt(50);
final int deleteByQueryPercent = random().nextInt(25);
final int ndocs = atLeast(50);
final int nWriteThreads = TestUtil.nextInt(random(), 1, TEST_NIGHTLY ? 10 : 5);
final int maxConcurrentCommits = TestUtil.nextInt(random(), 1, TEST_NIGHTLY ? 10 : 5); // number of committers at a time... needed if we want to avoid commit errors due to exceeding the max
final boolean tombstones = random().nextBoolean();
// query variables
final AtomicLong operations = new AtomicLong(atLeast(10000)); // number of query operations to perform in total
final int nReadThreads = TestUtil.nextInt(random(), 1, TEST_NIGHTLY ? 10 : 5);
initModel(ndocs);
final FieldType storedOnlyType = new FieldType();
storedOnlyType.setStored(true);
if (VERBOSE) {
System.out.println("\n");
System.out.println("TEST: commitPercent=" + commitPercent);
System.out.println("TEST: softCommitPercent=" + softCommitPercent);
System.out.println("TEST: deletePercent=" + deletePercent);
System.out.println("TEST: deleteByQueryPercent=" + deleteByQueryPercent);
System.out.println("TEST: ndocs=" + ndocs);
System.out.println("TEST: nWriteThreads=" + nWriteThreads);
System.out.println("TEST: nReadThreads=" + nReadThreads);
System.out.println("TEST: maxConcurrentCommits=" + maxConcurrentCommits);
System.out.println("TEST: tombstones=" + tombstones);
System.out.println("TEST: operations=" + operations);
System.out.println("\n");
}
final AtomicInteger numCommitting = new AtomicInteger();
List<Thread> threads = new ArrayList<>();
Directory dir = newDirectory();
final RandomIndexWriter writer = new RandomIndexWriter(random(), dir, newIndexWriterConfig(new MockAnalyzer(random())));
writer.setDoRandomForceMergeAssert(false);
writer.commit();
reader = DirectoryReader.open(dir);
for (int i=0; i<nWriteThreads; i++) {
Thread thread = new Thread("WRITER"+i) {
Random rand = new Random(random().nextInt());
@Override
public void run() {
try {
while (operations.get() > 0) {
int oper = rand.nextInt(100);
if (oper < commitPercent) {
if (numCommitting.incrementAndGet() <= maxConcurrentCommits) {
Map<Integer,Long> newCommittedModel;
long version;
DirectoryReader oldReader;
synchronized(TestStressNRT.this) {
newCommittedModel = new HashMap<>(model); // take a snapshot
version = snapshotCount++;
oldReader = reader;
oldReader.incRef(); // increment the reference since we will use this for reopening
}
DirectoryReader newReader;
if (rand.nextInt(100) < softCommitPercent) {
// assertU(h.commit("softCommit","true"));
if (random().nextBoolean()) {
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": call writer.getReader");
}
newReader = writer.getReader(true);
} else {
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": reopen reader=" + oldReader + " version=" + version);
}
newReader = DirectoryReader.openIfChanged(oldReader, writer.w, true);
}
} else {
// assertU(commit());
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": commit+reopen reader=" + oldReader + " version=" + version);
}
writer.commit();
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": now reopen after commit");
}
newReader = DirectoryReader.openIfChanged(oldReader);
}
// Code below assumes newReader comes w/
// extra ref:
if (newReader == null) {
oldReader.incRef();
newReader = oldReader;
}
oldReader.decRef();
synchronized(TestStressNRT.this) {
// install the new reader if it's newest (and check the current version since another reader may have already been installed)
//System.out.println(Thread.currentThread().getName() + ": newVersion=" + newReader.getVersion());
assert newReader.getRefCount() > 0;
assert reader.getRefCount() > 0;
if (newReader.getVersion() > reader.getVersion()) {
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": install new reader=" + newReader);
}
reader.decRef();
reader = newReader;
// Silly: forces fieldInfos to be
// loaded so we don't hit IOE on later
// reader.toString
newReader.toString();
// install this snapshot only if it's newer than the current one
if (version >= committedModelClock) {
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": install new model version=" + version);
}
committedModel = newCommittedModel;
committedModelClock = version;
} else {
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": skip install new model version=" + version);
}
}
} else {
// if the same reader, don't decRef.
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": skip install new reader=" + newReader);
}
newReader.decRef();
}
}
}
numCommitting.decrementAndGet();
} else {
int id = rand.nextInt(ndocs);
Object sync = syncArr[id];
// set the lastId before we actually change it sometimes to try and
// uncover more race conditions between writing and reading
boolean before = random().nextBoolean();
if (before) {
lastId = id;
}
// We can't concurrently update the same document and retain our invariants of increasing values
// since we can't guarantee what order the updates will be executed.
synchronized (sync) {
Long val = model.get(id);
long nextVal = Math.abs(val)+1;
if (oper < commitPercent + deletePercent) {
// assertU("<delete><id>" + id + "</id></delete>");
// add tombstone first
if (tombstones) {
Document d = new Document();
d.add(newStringField("id", "-"+Integer.toString(id), Field.Store.YES));
d.add(newField(field, Long.toString(nextVal), storedOnlyType));
writer.updateDocument(new Term("id", "-"+Integer.toString(id)), d);
}
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": term delDocs id:" + id + " nextVal=" + nextVal);
}
writer.deleteDocuments(new Term("id",Integer.toString(id)));
model.put(id, -nextVal);
} else if (oper < commitPercent + deletePercent + deleteByQueryPercent) {
//assertU("<delete><query>id:" + id + "</query></delete>");
// add tombstone first
if (tombstones) {
Document d = new Document();
d.add(newStringField("id", "-"+Integer.toString(id), Field.Store.YES));
d.add(newField(field, Long.toString(nextVal), storedOnlyType));
writer.updateDocument(new Term("id", "-"+Integer.toString(id)), d);
}
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": query delDocs id:" + id + " nextVal=" + nextVal);
}
writer.deleteDocuments(new TermQuery(new Term("id", Integer.toString(id))));
model.put(id, -nextVal);
} else {
// assertU(adoc("id",Integer.toString(id), field, Long.toString(nextVal)));
Document d = new Document();
d.add(newStringField("id", Integer.toString(id), Field.Store.YES));
d.add(newField(field, Long.toString(nextVal), storedOnlyType));
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": u id:" + id + " val=" + nextVal);
}
writer.updateDocument(new Term("id", Integer.toString(id)), d);
if (tombstones) {
// remove tombstone after new addition (this should be optional?)
writer.deleteDocuments(new Term("id","-"+Integer.toString(id)));
}
model.put(id, nextVal);
}
}
if (!before) {
lastId = id;
}
}
}
} catch (Throwable e) {
System.out.println(Thread.currentThread().getName() + ": FAILED: unexpected exception");
e.printStackTrace(System.out);
throw new RuntimeException(e);
}
}
};
threads.add(thread);
}
for (int i=0; i<nReadThreads; i++) {
Thread thread = new Thread("READER"+i) {
Random rand = new Random(random().nextInt());
@Override
public void run() {
try {
IndexReader lastReader = null;
IndexSearcher lastSearcher = null;
while (operations.decrementAndGet() >= 0) {
// bias toward a recently changed doc
int id = rand.nextInt(100) < 25 ? lastId : rand.nextInt(ndocs);
// when indexing, we update the index, then the model
// so when querying, we should first check the model, and then the index
long val;
DirectoryReader r;
synchronized(TestStressNRT.this) {
val = committedModel.get(id);
r = reader;
r.incRef();
}
if (VERBOSE) {
System.out.println("TEST: " + Thread.currentThread().getName() + ": s id=" + id + " val=" + val + " r=" + r.getVersion());
}
// sreq = req("wt","json", "q","id:"+Integer.toString(id), "omitHeader","true");
IndexSearcher searcher;
if (r == lastReader) {
// Just re-use lastSearcher, else
// newSearcher may create too many thread
// pools (ExecutorService):
searcher = lastSearcher;
} else {
searcher = newSearcher(r);
lastReader = r;
lastSearcher = searcher;
}
Query q = new TermQuery(new Term("id",Integer.toString(id)));
TopDocs results = searcher.search(q, 10);
if (results.totalHits == 0 && tombstones) {
// if we couldn't find the doc, look for its tombstone
q = new TermQuery(new Term("id","-"+Integer.toString(id)));
results = searcher.search(q, 1);
if (results.totalHits == 0) {
if (val == -1L) {
// expected... no doc was added yet
r.decRef();
continue;
}
fail("No documents or tombstones found for id " + id + ", expected at least " + val + " reader=" + r);
}
}
if (results.totalHits == 0 && !tombstones) {
// nothing to do - we can't tell anything from a deleted doc without tombstones
} else {
// we should have found the document, or its tombstone
if (results.totalHits != 1) {
System.out.println("FAIL: hits id:" + id + " val=" + val);
for(ScoreDoc sd : results.scoreDocs) {
final Document doc = r.document(sd.doc);
System.out.println(" docID=" + sd.doc + " id:" + doc.get("id") + " foundVal=" + doc.get(field));
}
fail("id=" + id + " reader=" + r + " totalHits=" + results.totalHits);
}
Document doc = searcher.doc(results.scoreDocs[0].doc);
long foundVal = Long.parseLong(doc.get(field));
if (foundVal < Math.abs(val)) {
fail("foundVal=" + foundVal + " val=" + val + " id=" + id + " reader=" + r);
}
}
r.decRef();
}
} catch (Throwable e) {
operations.set(-1L);
System.out.println(Thread.currentThread().getName() + ": FAILED: unexpected exception");
e.printStackTrace(System.out);
throw new RuntimeException(e);
}
}
};
threads.add(thread);
}
for (Thread thread : threads) {
thread.start();
}
for (Thread thread : threads) {
thread.join();
}
writer.close();
if (VERBOSE) {
System.out.println("TEST: close reader=" + reader);
}
reader.close();
dir.close();
}
}
| smartan/lucene | src/test/java/org/apache/lucene/index/TestStressNRT.java | Java | apache-2.0 | 17,006 | [
30522,
7427,
8917,
1012,
15895,
1012,
19913,
2638,
1012,
5950,
1025,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Predicate xref</title>
<link type="text/css" rel="stylesheet" href="../../../../../../../stylesheet.css" />
</head>
<body>
<pre>
<a class="jxr_linenumber" name="L1" href="#L1">1</a> <em class="jxr_comment">//</em>
<a class="jxr_linenumber" name="L2" href="#L2">2</a> <em class="jxr_comment">// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802 </em>
<a class="jxr_linenumber" name="L3" href="#L3">3</a> <em class="jxr_comment">// Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> </em>
<a class="jxr_linenumber" name="L4" href="#L4">4</a> <em class="jxr_comment">// Qualsiasi modifica a questo file andrà persa durante la ricompilazione dello schema di origine. </em>
<a class="jxr_linenumber" name="L5" href="#L5">5</a> <em class="jxr_comment">// Generato il: 2015.05.07 alle 12:32:49 PM CEST </em>
<a class="jxr_linenumber" name="L6" href="#L6">6</a> <em class="jxr_comment">//</em>
<a class="jxr_linenumber" name="L7" href="#L7">7</a>
<a class="jxr_linenumber" name="L8" href="#L8">8</a>
<a class="jxr_linenumber" name="L9" href="#L9">9</a> <strong class="jxr_keyword">package</strong> eu.fbk.dkm.pikes.resources.ontonotes.frames;
<a class="jxr_linenumber" name="L10" href="#L10">10</a>
<a class="jxr_linenumber" name="L11" href="#L11">11</a> <strong class="jxr_keyword">import</strong> javax.xml.bind.annotation.*;
<a class="jxr_linenumber" name="L12" href="#L12">12</a> <strong class="jxr_keyword">import</strong> javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
<a class="jxr_linenumber" name="L13" href="#L13">13</a> <strong class="jxr_keyword">import</strong> javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
<a class="jxr_linenumber" name="L14" href="#L14">14</a> <strong class="jxr_keyword">import</strong> java.util.ArrayList;
<a class="jxr_linenumber" name="L15" href="#L15">15</a> <strong class="jxr_keyword">import</strong> java.util.List;
<a class="jxr_linenumber" name="L16" href="#L16">16</a>
<a class="jxr_linenumber" name="L17" href="#L17">17</a>
<a class="jxr_linenumber" name="L18" href="#L18">18</a> <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L19" href="#L19">19</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L20" href="#L20">20</a> <em class="jxr_javadoccomment"> */</em>
<a class="jxr_linenumber" name="L21" href="#L21">21</a> @XmlAccessorType(XmlAccessType.FIELD)
<a class="jxr_linenumber" name="L22" href="#L22">22</a> @XmlType(name = <span class="jxr_string">""</span>, propOrder = {
<a class="jxr_linenumber" name="L23" href="#L23">23</a> <span class="jxr_string">"noteOrRoleset"</span>
<a class="jxr_linenumber" name="L24" href="#L24">24</a> })
<a class="jxr_linenumber" name="L25" href="#L25">25</a> @XmlRootElement(name = <span class="jxr_string">"predicate"</span>)
<a class="jxr_linenumber" name="L26" href="#L26">26</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../../eu/fbk/dkm/pikes/resources/ontonotes/frames/Predicate.html">Predicate</a> {
<a class="jxr_linenumber" name="L27" href="#L27">27</a>
<a class="jxr_linenumber" name="L28" href="#L28">28</a> @XmlAttribute(name = <span class="jxr_string">"lemma"</span>, required = <strong class="jxr_keyword">true</strong>)
<a class="jxr_linenumber" name="L29" href="#L29">29</a> @XmlJavaTypeAdapter(NormalizedStringAdapter.<strong class="jxr_keyword">class</strong>)
<a class="jxr_linenumber" name="L30" href="#L30">30</a> <strong class="jxr_keyword">protected</strong> String lemma;
<a class="jxr_linenumber" name="L31" href="#L31">31</a> @XmlElements({
<a class="jxr_linenumber" name="L32" href="#L32">32</a> @XmlElement(name = <span class="jxr_string">"note"</span>, type = Note.<strong class="jxr_keyword">class</strong>),
<a class="jxr_linenumber" name="L33" href="#L33">33</a> @XmlElement(name = <span class="jxr_string">"roleset"</span>, type = Roleset.<strong class="jxr_keyword">class</strong>)
<a class="jxr_linenumber" name="L34" href="#L34">34</a> })
<a class="jxr_linenumber" name="L35" href="#L35">35</a> <strong class="jxr_keyword">protected</strong> List<Object> noteOrRoleset;
<a class="jxr_linenumber" name="L36" href="#L36">36</a>
<a class="jxr_linenumber" name="L37" href="#L37">37</a> <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L38" href="#L38">38</a> <em class="jxr_javadoccomment"> * Recupera il valore della proprietà lemma.</em>
<a class="jxr_linenumber" name="L39" href="#L39">39</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L40" href="#L40">40</a> <em class="jxr_javadoccomment"> * @return</em>
<a class="jxr_linenumber" name="L41" href="#L41">41</a> <em class="jxr_javadoccomment"> * possible object is</em>
<a class="jxr_linenumber" name="L42" href="#L42">42</a> <em class="jxr_javadoccomment"> * {@link String }</em>
<a class="jxr_linenumber" name="L43" href="#L43">43</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L44" href="#L44">44</a> <em class="jxr_javadoccomment"> */</em>
<a class="jxr_linenumber" name="L45" href="#L45">45</a> <strong class="jxr_keyword">public</strong> String getLemma() {
<a class="jxr_linenumber" name="L46" href="#L46">46</a> <strong class="jxr_keyword">return</strong> lemma;
<a class="jxr_linenumber" name="L47" href="#L47">47</a> }
<a class="jxr_linenumber" name="L48" href="#L48">48</a>
<a class="jxr_linenumber" name="L49" href="#L49">49</a> <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L50" href="#L50">50</a> <em class="jxr_javadoccomment"> * Imposta il valore della proprietà lemma.</em>
<a class="jxr_linenumber" name="L51" href="#L51">51</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L52" href="#L52">52</a> <em class="jxr_javadoccomment"> * @param value</em>
<a class="jxr_linenumber" name="L53" href="#L53">53</a> <em class="jxr_javadoccomment"> * allowed object is</em>
<a class="jxr_linenumber" name="L54" href="#L54">54</a> <em class="jxr_javadoccomment"> * {@link String }</em>
<a class="jxr_linenumber" name="L55" href="#L55">55</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L56" href="#L56">56</a> <em class="jxr_javadoccomment"> */</em>
<a class="jxr_linenumber" name="L57" href="#L57">57</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setLemma(String value) {
<a class="jxr_linenumber" name="L58" href="#L58">58</a> <strong class="jxr_keyword">this</strong>.lemma = value;
<a class="jxr_linenumber" name="L59" href="#L59">59</a> }
<a class="jxr_linenumber" name="L60" href="#L60">60</a>
<a class="jxr_linenumber" name="L61" href="#L61">61</a> <em class="jxr_javadoccomment">/**</em>
<a class="jxr_linenumber" name="L62" href="#L62">62</a> <em class="jxr_javadoccomment"> * Gets the value of the noteOrRoleset property.</em>
<a class="jxr_linenumber" name="L63" href="#L63">63</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L64" href="#L64">64</a> <em class="jxr_javadoccomment"> * <p></em>
<a class="jxr_linenumber" name="L65" href="#L65">65</a> <em class="jxr_javadoccomment"> * This accessor method returns a reference to the live list,</em>
<a class="jxr_linenumber" name="L66" href="#L66">66</a> <em class="jxr_javadoccomment"> * not a snapshot. Therefore any modification you make to the</em>
<a class="jxr_linenumber" name="L67" href="#L67">67</a> <em class="jxr_javadoccomment"> * returned list will be present inside the JAXB object.</em>
<a class="jxr_linenumber" name="L68" href="#L68">68</a> <em class="jxr_javadoccomment"> * This is why there is not a <CODE>set</CODE> method for the noteOrRoleset property.</em>
<a class="jxr_linenumber" name="L69" href="#L69">69</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L70" href="#L70">70</a> <em class="jxr_javadoccomment"> * <p></em>
<a class="jxr_linenumber" name="L71" href="#L71">71</a> <em class="jxr_javadoccomment"> * For example, to add a new item, do as follows:</em>
<a class="jxr_linenumber" name="L72" href="#L72">72</a> <em class="jxr_javadoccomment"> * <pre></em>
<a class="jxr_linenumber" name="L73" href="#L73">73</a> <em class="jxr_javadoccomment"> * getNoteOrRoleset().add(newItem);</em>
<a class="jxr_linenumber" name="L74" href="#L74">74</a> <em class="jxr_javadoccomment"> * </pre></em>
<a class="jxr_linenumber" name="L75" href="#L75">75</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L76" href="#L76">76</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L77" href="#L77">77</a> <em class="jxr_javadoccomment"> * <p></em>
<a class="jxr_linenumber" name="L78" href="#L78">78</a> <em class="jxr_javadoccomment"> * Objects of the following type(s) are allowed in the list</em>
<a class="jxr_linenumber" name="L79" href="#L79">79</a> <em class="jxr_javadoccomment"> * {@link Note }</em>
<a class="jxr_linenumber" name="L80" href="#L80">80</a> <em class="jxr_javadoccomment"> * {@link Roleset }</em>
<a class="jxr_linenumber" name="L81" href="#L81">81</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L82" href="#L82">82</a> <em class="jxr_javadoccomment"> * </em>
<a class="jxr_linenumber" name="L83" href="#L83">83</a> <em class="jxr_javadoccomment"> */</em>
<a class="jxr_linenumber" name="L84" href="#L84">84</a> <strong class="jxr_keyword">public</strong> List<Object> getNoteOrRoleset() {
<a class="jxr_linenumber" name="L85" href="#L85">85</a> <strong class="jxr_keyword">if</strong> (noteOrRoleset == <strong class="jxr_keyword">null</strong>) {
<a class="jxr_linenumber" name="L86" href="#L86">86</a> noteOrRoleset = <strong class="jxr_keyword">new</strong> ArrayList<Object>();
<a class="jxr_linenumber" name="L87" href="#L87">87</a> }
<a class="jxr_linenumber" name="L88" href="#L88">88</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.noteOrRoleset;
<a class="jxr_linenumber" name="L89" href="#L89">89</a> }
<a class="jxr_linenumber" name="L90" href="#L90">90</a>
<a class="jxr_linenumber" name="L91" href="#L91">91</a> }
</pre>
<hr/>
<div id="footer">Copyright © 2016–2020 <a href="http://www.fbk.eu">FBK</a>. All rights reserved.</div>
</body>
</html>
| dkmfbk/pikes | docs/xref/eu/fbk/dkm/pikes/resources/ontonotes/frames/Predicate.html | HTML | gpl-3.0 | 11,123 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
30524,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
19817,
1013,
1060,
11039,
19968,
2487,
1013,
267... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Copyright (c) 2013, Ford Motor Company
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with the
// distribution.
//
// Neither the name of the Ford Motor Company nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
#ifndef NSSMARTDEVICELINKRPCV2_SCROLLABLEMESSAGE_RESPONSEMARSHALLER_INCLUDE
#define NSSMARTDEVICELINKRPCV2_SCROLLABLEMESSAGE_RESPONSEMARSHALLER_INCLUDE
#include <string>
#include <json/json.h>
#include "../include/JSONHandler/SDLRPCObjects/V2/ScrollableMessage_response.h"
/*
interface Ford Sync RAPI
version 2.0O
date 2012-11-02
generated at Thu Jan 24 06:36:23 2013
source stamp Thu Jan 24 06:35:41 2013
author RC
*/
namespace NsSmartDeviceLinkRPCV2
{
struct ScrollableMessage_responseMarshaller
{
static bool checkIntegrity(ScrollableMessage_response& e);
static bool checkIntegrityConst(const ScrollableMessage_response& e);
static bool fromString(const std::string& s,ScrollableMessage_response& e);
static const std::string toString(const ScrollableMessage_response& e);
static bool fromJSON(const Json::Value& s,ScrollableMessage_response& e);
static Json::Value toJSON(const ScrollableMessage_response& e);
};
}
#endif
| Luxoft/SDLP | SDL_Core/src/components/JSONHandler/src/SDLRPCObjectsImpl/V2/ScrollableMessage_responseMarshaller.h | C | lgpl-2.1 | 2,554 | [
30522,
1013,
1013,
1013,
1013,
9385,
1006,
1039,
1007,
2286,
1010,
4811,
5013,
2194,
1013,
1013,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1013,
1013,
14080,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using CP77.CR2W.Reflection;
using FastMember;
using static CP77.CR2W.Types.Enums;
namespace CP77.CR2W.Types
{
[REDMeta]
public class scnVarComparison_FactConditionTypeParams : CVariable
{
[Ordinal(0)] [RED("factName")] public CName FactName { get; set; }
[Ordinal(1)] [RED("value")] public CInt32 Value { get; set; }
[Ordinal(2)] [RED("comparisonType")] public CEnum<EComparisonType> ComparisonType { get; set; }
public scnVarComparison_FactConditionTypeParams(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { }
}
}
| Traderain/Wolven-kit | CP77.CR2W/Types/cp77/scnVarComparison_FactConditionTypeParams.cs | C# | gpl-3.0 | 556 | [
30522,
2478,
18133,
2581,
2581,
1012,
13675,
2475,
2860,
1012,
9185,
1025,
2478,
3435,
4168,
21784,
1025,
2478,
10763,
18133,
2581,
2581,
1012,
13675,
2475,
2860,
1012,
4127,
1012,
4372,
18163,
1025,
3415,
15327,
18133,
2581,
2581,
1012,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# AUTOGENERATED FILE
FROM balenalib/solidrun-imx6-ubuntu:bionic-run
ENV NODE_VERSION 15.6.0
ENV YARN_VERSION 1.22.4
RUN buildDeps='curl libatomic1' \
&& set -x \
&& for key in \
6A010C5166006599AA17F08146C2130DFD2497F5 \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
done \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz" \
&& echo "234871415c54174f91764f332a72631519a6af7b1a87797ad7c729855182f9cd node-v$NODE_VERSION-linux-armv7l.tar.gz" | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-armv7l.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-armv7l.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& npm config set unsafe-perm true -g --unsafe-perm \
&& rm -rf /tmp/*
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \
&& echo "Running test-stack@node" \
&& chmod +x test-stack@node.sh \
&& bash test-stack@node.sh \
&& rm -rf test-stack@node.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Ubuntu bionic \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v15.6.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/node/solidrun-imx6/ubuntu/bionic/15.6.0/run/Dockerfile | Dockerfile | apache-2.0 | 2,919 | [
30522,
1001,
8285,
6914,
16848,
5371,
2013,
28352,
8189,
29521,
1013,
5024,
15532,
1011,
10047,
2595,
2575,
1011,
1057,
8569,
3372,
2226,
1024,
16012,
8713,
1011,
2448,
4372,
2615,
13045,
1035,
2544,
2321,
1012,
1020,
1012,
1014,
4372,
2615... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package ems.server.protocol;
import ems.server.domain.Device;
import ems.server.domain.EventSeverity;
import ems.server.domain.EventType;
import ems.server.utils.EventHelper;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
/**
* EventAwareResponseHandler
* Created by thebaz on 9/15/14.
*/
public class EventAwareResponseHandler implements ResponseHandler {
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
private final Device device;
public EventAwareResponseHandler(Device device) {
this.device = device;
format.setTimeZone(TimeZone.getTimeZone("UTC"));
}
@Override
public void onTimeout(String variable) {
EventHelper.getInstance().addEvent(device, EventType.EVENT_NETWORK, EventSeverity.EVENT_WARN);
}
@Override
public void onSuccess(String variable) {
//do nothing
}
@Override
public void onError(String variable, int errorCode, String errorDescription) {
EventSeverity eventSeverity = EventSeverity.EVENT_ERROR;
EventType eventType = EventType.EVENT_PROTOCOL;
String description = "Event of type: \'" + eventType + "\' at: " +
format.format(new Date(System.currentTimeMillis())) + " with severity: \'" +
eventSeverity + "\' for device: " + device.getName() + ". Error code:" +
errorCode + ", Error description: " + errorDescription;
EventHelper.getInstance().addEvent(device, eventType, eventSeverity, description);
}
}
| thebaz73/ems-server | src/main/java/ems/server/protocol/EventAwareResponseHandler.java | Java | gpl-3.0 | 1,600 | [
30522,
7427,
29031,
1012,
8241,
1012,
8778,
1025,
12324,
29031,
1012,
8241,
1012,
5884,
1012,
5080,
1025,
12324,
29031,
1012,
8241,
1012,
5884,
1012,
2824,
22507,
3012,
1025,
12324,
29031,
1012,
8241,
1012,
5884,
1012,
2724,
13874,
1025,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 4881205
* @summary generics: array as generic argument type fails
* @author gafter
*
* @compile -source 1.5 ArrayTypearg.java
*/
import java.util.List;
import java.util.ArrayList;
class ArrayTypearg {
private void foo() {
List<Object[]> list = new ArrayList<Object[]>();
Object o1 = list.get(0)[0];
}
}
| unktomi/form-follows-function | mjavac/langtools/test/tools/javac/generics/ArrayTypearg.java | Java | gpl-2.0 | 1,406 | [
30522,
1013,
1008,
1008,
9385,
2494,
3103,
12702,
29390,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1008,
1008,
2023,
3642,
2003,
2489,
4007,
1025,
2017,
2064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"11090140","logradouro":"Rua Comendador Adriano Dias dos Santos","bairro":"Bom Retiro","cidade":"Santos","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/11090140.jsonp.js | JavaScript | cc0-1.0 | 157 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
7287,
21057,
16932,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
2272,
8943,
7983,
7918,
2080,
22939,
2015,
9998,
11053,
1000,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# adventofcode
Advent of Code solutions in Go.
| lukemanley/adventofcode | README.md | Markdown | mit | 47 | [
30522,
1001,
13896,
11253,
16044,
13896,
1997,
3642,
7300,
1999,
2175,
1012,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Autogenerated by Thrift Compiler (0.12.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.facebook.buck.artifact_cache.thrift;
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)")
public enum BuckCacheRequestType implements org.apache.thrift.TEnum {
UNKNOWN(0),
FETCH(100),
STORE(101),
MULTI_FETCH(102),
DELETE_REQUEST(105),
CONTAINS(107);
private final int value;
private BuckCacheRequestType(int value) {
this.value = value;
}
/**
* Get the integer value of this enum value, as defined in the Thrift IDL.
*/
public int getValue() {
return value;
}
/**
* Find a the enum type by its integer value, as defined in the Thrift IDL.
* @return null if the value is not found.
*/
@org.apache.thrift.annotation.Nullable
public static BuckCacheRequestType findByValue(int value) {
switch (value) {
case 0:
return UNKNOWN;
case 100:
return FETCH;
case 101:
return STORE;
case 102:
return MULTI_FETCH;
case 105:
return DELETE_REQUEST;
case 107:
return CONTAINS;
default:
return null;
}
}
}
| JoelMarcey/buck | src-gen/com/facebook/buck/artifact_cache/thrift/BuckCacheRequestType.java | Java | apache-2.0 | 1,237 | [
30522,
1013,
1008,
1008,
1008,
8285,
6914,
16848,
2011,
16215,
16338,
21624,
1006,
1014,
1012,
2260,
1012,
1014,
1007,
1008,
1008,
2079,
2025,
10086,
4983,
2017,
2024,
2469,
2008,
2017,
2113,
2054,
2017,
2024,
2725,
1008,
1030,
7013,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
\hypertarget{group___f_s_m_c___wrap___mode}{}\section{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}
\label{group___f_s_m_c___wrap___mode}\index{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}}
Collaboration diagram for F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=336pt]{group___f_s_m_c___wrap___mode}
\end{center}
\end{figure}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item
\#define \hyperlink{group___f_s_m_c___wrap___mode_ga6041f0d3055ea3811a5a19560092f266}{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable}~((uint32\+\_\+t)0x00000000)
\item
\#define \hyperlink{group___f_s_m_c___wrap___mode_gad07eb0ae0362b2f94071d0dab6473fda}{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable}~((uint32\+\_\+t)0x00000400)
\item
\#define \hyperlink{group___f_s_m_c___wrap___mode_ga0751d74b7fb1e17f6cedea091e8ebfc8}{I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE}(M\+O\+DE)
\end{DoxyCompactItemize}
\subsection{Detailed Description}
\subsection{Macro Definition Documentation}
\mbox{\Hypertarget{group___f_s_m_c___wrap___mode_ga6041f0d3055ea3811a5a19560092f266}\label{group___f_s_m_c___wrap___mode_ga6041f0d3055ea3811a5a19560092f266}}
\index{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}!F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable@{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable}}
\index{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable@{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable}!F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}}
\subsubsection{\texorpdfstring{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable}{FSMC\_WrapMode\_Disable}}
{\footnotesize\ttfamily \#define F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Disable~((uint32\+\_\+t)0x00000000)}
Definition at line 376 of file stm32f10x\+\_\+fsmc.\+h.
\mbox{\Hypertarget{group___f_s_m_c___wrap___mode_gad07eb0ae0362b2f94071d0dab6473fda}\label{group___f_s_m_c___wrap___mode_gad07eb0ae0362b2f94071d0dab6473fda}}
\index{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}!F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable@{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable}}
\index{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable@{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable}!F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}}
\subsubsection{\texorpdfstring{F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable}{FSMC\_WrapMode\_Enable}}
{\footnotesize\ttfamily \#define F\+S\+M\+C\+\_\+\+Wrap\+Mode\+\_\+\+Enable~((uint32\+\_\+t)0x00000400)}
Definition at line 377 of file stm32f10x\+\_\+fsmc.\+h.
\mbox{\Hypertarget{group___f_s_m_c___wrap___mode_ga0751d74b7fb1e17f6cedea091e8ebfc8}\label{group___f_s_m_c___wrap___mode_ga0751d74b7fb1e17f6cedea091e8ebfc8}}
\index{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}!I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE@{I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE}}
\index{I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE@{I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE}!F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode@{F\+S\+M\+C\+\_\+\+Wrap\+\_\+\+Mode}}
\subsubsection{\texorpdfstring{I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE}{IS\_FSMC\_WRAP\_MODE}}
{\footnotesize\ttfamily \#define I\+S\+\_\+\+F\+S\+M\+C\+\_\+\+W\+R\+A\+P\+\_\+\+M\+O\+DE(\begin{DoxyParamCaption}\item[{}]{M\+O\+DE }\end{DoxyParamCaption})}
{\bfseries Value\+:}
\begin{DoxyCode}
(((MODE) == \hyperlink{group___f_s_m_c___wrap___mode_ga6041f0d3055ea3811a5a19560092f266}{FSMC\_WrapMode\_Disable}) || \(\backslash\)
((MODE) == \hyperlink{group___f_s_m_c___wrap___mode_gad07eb0ae0362b2f94071d0dab6473fda}{FSMC\_WrapMode\_Enable}))
\end{DoxyCode}
Definition at line 378 of file stm32f10x\+\_\+fsmc.\+h.
| MyEmbeddedWork/ARM_CORTEX_M3-STM32 | 1. Docs/Doxygen/latex/group___f_s_m_c___wrap___mode.tex | TeX | gpl-3.0 | 3,805 | [
30522,
1032,
23760,
7559,
18150,
1063,
2177,
1035,
1035,
1035,
1042,
1035,
1055,
1035,
1049,
1035,
1039,
1035,
1035,
1035,
10236,
1035,
1035,
1035,
5549,
1065,
1063,
1065,
1032,
2930,
1063,
1042,
1032,
1009,
1055,
1032,
1009,
1049,
1032,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "Painter.h"
NAMESPACE_UPP
struct GlyphPainter : NilPainter, LinearPathConsumer {
Vector<float> glyph;
double tolerance;
Pointf pos, move;
virtual void LineOp(const Pointf& p, bool);
virtual void MoveOp(const Pointf& p, bool);
virtual void QuadraticOp(const Pointf& p1, const Pointf& p, bool);
virtual void CubicOp(const Pointf& p1, const Pointf& p2, const Pointf& p, bool);
virtual void CloseOp();
virtual void Line(const Pointf& p);
virtual void Move(const Pointf& p);
};
void GlyphPainter::Move(const Pointf& p)
{
glyph.Add((float)1e31);
Line(p);
move = pos;
}
void GlyphPainter::Line(const Pointf& p)
{
glyph.Add((float)p.x);
glyph.Add((float)p.y);
pos = p;
}
void GlyphPainter::MoveOp(const Pointf& p, bool)
{
Move(p);
}
void GlyphPainter::LineOp(const Pointf& p, bool)
{
Line(p);
}
void GlyphPainter::QuadraticOp(const Pointf& p1, const Pointf& p, bool)
{
ApproximateQuadratic(*this, pos, p1, p, tolerance);
pos = p;
}
void GlyphPainter::CubicOp(const Pointf& p1, const Pointf& p2, const Pointf& p, bool)
{
ApproximateCubic(*this, pos, p1, p2, p, tolerance);
pos = p;
}
void GlyphPainter::CloseOp()
{
if(move != pos && !IsNull(move))
Line(move);
}
struct GlyphKey {
Font fnt;
int chr;
double tolerance;
bool operator==(const GlyphKey& b) const {
return fnt == b.fnt && chr == b.chr && tolerance == b.tolerance;
}
unsigned GetHashValue() const {
return CombineHash(fnt, chr, tolerance);
}
};
struct sMakeGlyph : LRUCache<Value, GlyphKey>::Maker {
GlyphKey gk;
GlyphKey Key() const { return gk; }
int Make(Value& v) const {
GlyphPainter gp;
gp.move = gp.pos = Null;
gp.tolerance = gk.tolerance;
PaintCharacter(gp, Pointf(0, 0), gk.chr, gk.fnt);
int sz = gp.glyph.GetCount() * 4;
v = RawPickToValue(gp.glyph);
return sz;
}
};
void BufferPainter::ApproximateChar(LinearPathConsumer& t, const CharData& ch, double tolerance)
{
PAINTER_TIMING("ApproximateChar");
Value v;
INTERLOCKED {
PAINTER_TIMING("ApproximateChar::Fetch");
static LRUCache<Value, GlyphKey> cache;
cache.Shrink(500000);
sMakeGlyph h;
h.gk.fnt = ch.fnt;
h.gk.chr = ch.ch;
h.gk.tolerance = tolerance;
v = cache.Get(h);
}
#if 0
GlyphPainter chp;
chp.move = chp.pos = Null;
chp.tolerance = tolerance;
PaintCharacter(chp, ch.p, ch.ch, ch.fnt);
Vector<float>& g = chp.glyph;
#else
const Vector<float>& g = ValueTo< Vector<float> >(v);
#endif
int i = 0;
while(i < g.GetCount()) {
Pointf p;
p.x = g[i++];
if(p.x > 1e30) {
p.x = g[i++];
p.y = g[i++];
t.Move(p + ch.p);
}
else {
PAINTER_TIMING("ApproximateChar::Line");
p.y = g[i++];
t.Line(p + ch.p);
}
}
}
END_UPP_NAMESPACE
| dreamsxin/ultimatepp | uppsrc/Painter/RenderChar.cpp | C++ | bsd-2-clause | 2,722 | [
30522,
1001,
2421,
1000,
5276,
1012,
1044,
1000,
3415,
15327,
1035,
2039,
2361,
2358,
6820,
6593,
1043,
2135,
8458,
4502,
18447,
2121,
1024,
9152,
14277,
22325,
2121,
1010,
7399,
15069,
8663,
23545,
2099,
1063,
9207,
1026,
14257,
1028,
1043... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#adminmenu .toplevel_page_slideshow-slides div.wp-menu-image:before,
.mce-i-gallery:before {
font-family: 'slideshow_dashicons' !important;
content: '\f233';
font-size: 20px;
}
@font-face {
font-family: 'slideshow_dashicons';
src: url('../fonts/slideshow_dashicons.eot'); // this is for IE
}
@font-face {
font-family: 'slideshow_dashicons';
src: url('../fonts/slideshow_dashicons.woff') format('woff'),
url('../fonts/slideshow_dashicons.ttf') format('truetype'),
url('../fonts/slideshow_dashicons.svg') format('svg');
font-weight: normal;
font-style: normal;
}
.slideshow-icon-deleete {
}
.slideshow-icon-delete:before {
font-family: 'dashicons' !important;
content: "\f158";
font-size: 20px;
vertical-align: middle;
float: right;
}
.slideshow .ui-slider {
margin: 10px 0;
background: #CCCCCC;
}
.slideshow .ui-slider-handle {
cursor: move !important;
background: #333333;
}
.slideshow .slider-value {
float: right;
font-size: 80%;
font-weight: bold;
border: 1px #000000 solid;
border-radius: 999px;
padding: 2px 5px;
vertical-align: top;
text-align: center;
background: #000000;
color: #ffffff;
}
.slideshow .iris-picker {
position: absolute;
z-index: 999;
}
.slideshow input.wp-color-picker {
margin: 0 6px 6px 0 !important;
}
img.slideshow_dropshadow,
.slideshow img.dropshadow,
a.thickbox img.slideshow,
a.colorbox img.slideshow {
box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
.galleryhelp a,
.galleryhelp a:hover,
.galleryhelp a:active {
text-decoration: none;
color: #333;
}
.galleryhelp a:before {
font-family: 'slideshow_dashicons' !important;
content: '\f223';
font-weight: 400;
font-size: 20px;
vertical-align: top;
text-decoration: none;
line-height: 100%;
height: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
background: white;
border-width: 2px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.slideshow_error {
color: red;
}
.slideshow_success {
color: green;
}
/* Sortable */
ul.connectedSortable {
float: left;
width: 100%;
}
span.gallery_slides_convert_list a,
span.gallery_slides_convert_grid a{
text-decoration: none;
}
span.gallery_slides_convert_list a:before {
font-family: 'slideshow_dashicons' !important;
content: '\f228';
text-decoration: none;
font-size: 20px;
}
span.gallery_slides_convert_grid a:before {
font-family: 'slideshow_dashicons' !important;
content: '\f180';
text-decoration: none;
font-size: 20px;
}
.sortable-elements {
display:inline-block;
}
.sortable-form-table-element, .sortable-form-table-headings, .ui-sortable li.gallerylineitem {
float:left;
margin-bottom:12px;
width:100%;
padding:8px 0;
}
.ui-sortable li.gallerylineitem {
float:left;
width:30%;
min-width:30%;
clear:both;
white-space: nowrap;
overflow: hidden;
position: relative;
}
.relatedslides .ui-sortable li.gallerylineitem {
width: 80%;
}
.ui-sortable li.ui-sortable-helper {
width: 30%;
}
.ui-sortable li.gallerylineitem span.link {
right: 10px;
position: absolute;
}
.ui-sortable li.gallerylineitem span.link a {
font-size: 90%;
}
.ui-sortable li.gallerylineitem span.link a:hover {
text-decoration: none;
}
.sortable-form-table-element, .ui-sortable li.gallerylineitem {
cursor: url('https://www.google.com/intl/en_ALL/mapfiles/openhand.cur'), default !important;
background-color: #F1F1F1;
background-image: -ms-linear-gradient(top,#F9F9F9,#ECECEC);
background-image: -moz-linear-gradient(top,#F9F9F9,#ECECEC);
background-image: -o-linear-gradient(top,#F9F9F9,#ECECEC);
background-image: -webkit-gradient(linear,left top,left bottom,from(#F9F9F9),to(#ECECEC));
background-image: -webkit-linear-gradient(top,#F9F9F9,#ECECEC);
background-image: linear-gradient(top,#F9F9F9,#ECECEC);
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
border:1px solid #DFDFDF;
}
.ui-sortable-helper, .ui-sortable li.ui-sortable-helper {
cursor: url('https://www.google.com/intl/en_ALL/mapfiles/closedhand.cur'), default !important;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}
#slidelist .sortable-form-table-element table, #slidelist .sortable-form-table-headings table, #slidelist.ui-sortable {
/*float:left;*/
width:100%;
border-spacing:0;
}
.gallery_slides_grid #slidelist li.gallerylineitem {
width:90px !important;
min-width:90px !important;
height:112px;
display:block;
float:left;
clear:none !important;
margin-right:10px;
white-space:normal
}
.gallery_slides_grid #slidelist li.gallerylineitem .gallery_slide_image {
display:block !important;
border:1px solid #DDD;
float:left;
width:89px;
height:89px;
margin-bottom:5px;
}
.gallery_slides_grid .gallery_slide_title {
float:left;
height:20px;
line-height:20px;
display:block;
width:90px;
overflow:hidden;
}
.gallery_slides_grid .wpml-placeholder, .gallery_slides_grid .gallery-placeholder {
float:left;
width:88px !important;
min-width:88px !important;
height:135px;
border:1px dashed #c9c9c9;
background:#f9f9f9;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
margin-bottom:10px;
margin-right:10px;
clear:none !important;
}
.sortable-form-table-element table td, .sortable-form-table-headings table td{
padding:0 8px;
width:43%;
color:#333;
font-weight:bold;
text-shadow:1px 1px 0 #FFF;
}
.ui-sortable li.gallerylineitem {
color:#333;
font-weight:bold;
text-shadow:1px 1px 0 #FFF;
padding:12px;
}
.sortable-form-table-element table td input[type=text] {
font-weight:normal;
/*width:40%;*/
padding:5px;
}
.sortable-form-table-element table td.gallery-checkbox-required, .sortable-form-table-element table td.gallery-checkbox-show,
.sortable-form-table-headings table td.gallery-checkbox-required, .sortable-form-table-headings table td.gallery-checkbox-show {
width:5%;
text-align:center;
}
.wpml-placeholder, .gallery-placeholder {
float:left;
width:100%;
height:43px;
border:1px dashed #c9c9c9;
background:#f9f9f9;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
margin-bottom:10px;
}
#slidelist .gallery-placeholder {
float:left;
clear:both;
width:30%;
padding:0 12px;
}
.relatedslides li.gallery-placeholder {
width: 80% !important;
}
/** jQuery UI **/
.ui-corner-all {
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-border-radius: 4px;
}
/* Overlays */
.ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.slideshow-ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
background: #000000;
opacity: .8;
filter: alpha(opacity=80);
zoom: 1;
border-width: 2px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
}
.slideshow-ui-tooltip .ui-tooltip-content {
font-size: 12px;
background-color: #000;
color: #fff !important;
text-align: center;
white-space: normal;
}
.slideshow-ui-tooltip .ui-tooltip-content a {
color: #fff;
}
body .ui-tooltip {
border-width: 2px;
} | accruemarketing/DanceEnergy | wp-content/plugins/slideshow-gallery/css/admin.css | CSS | gpl-2.0 | 7,359 | [
30522,
1001,
4748,
10020,
3549,
2226,
1012,
2327,
20414,
2884,
1035,
3931,
1035,
14816,
14406,
1011,
14816,
4487,
2615,
1012,
1059,
2361,
1011,
12183,
1011,
3746,
1024,
2077,
1010,
1012,
11338,
2063,
1011,
1045,
1011,
3916,
1024,
2077,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
dCellSize = 20
WindowWidth = 400
WindowHeight = 400
class SCell(object):
def __init__(self, xmin, xmax, ymin, ymax):
self._iTicksSpentHere = 0
self._left = xmin
self._right = xmax
self._top = ymin
self.bottom = ymax
def Update(self):
self._iTicksSpentHere += 1
def Reset(self):
self._iTicksSpentHere = 0
class CMapper(object):
def __init__(self, MaxRangeX, MaxRangeY):
self._dCellSize = dCellSize
self._NumCellsX = (MaxRangeX/self._dCellSize) + 1
self._NumCellsY = (MaxRangeY/self._dCellSize) + 1
self._2DvecCells = []
for x in xrange(self._NumCellsX):
temp = []
for y in xrange(self._NumCellsY):
temp.append(SCell(x*self._dCellSize, (x+1)*self._dCellSize, y*self._dCellSize, (y+1)*self._dCellSize))
self._2DvecCells.append(temp)
self._iTotalCells = self._NumCellsX * self._NumCellsY
def Update(self, xPos, yPos):
if ((xPos < 0) or (xPos > WindowWidth) or (yPos < 0) or (yPos > WindowHeight)):
return
cellX = int(xPos/self._dCellSize)
cellY = int(yPos/self._dCellSize)
self._2DvecCells[cellX][cellY].Update()
def TicksLingered(self, xPos, yPos):
if ((xPos < 0) or (xPos > WindowWidth) or (yPos < 0) or (yPos > WindowHeight)):
return 999
cellX = int(xPos/self._dCellSize)
cellY = int(yPos/self._dCellSize)
return self._2DvecCells[cellX][cellY]._iTicksSpentHere
def BeenVisited(self, xPos, yPos):
print "Not implemented!"
def Render(self):
print "To be implemented"
def Reset(self):
for i in xrange(self._NumCellsX):
for j in xrange(self._NumCellsY):
self._2DvecCells[i][j].Reset()
def NumCellsVisited(self):
total = 0
for i in xrange(self._NumCellsX):
for j in xrange(self._NumCellsY):
if self._2DvecCells[i][j]._iTicksSpentHere > 0:
total += 1
return total | crazyskady/ai-game-python | Chapter08/CMapper.py | Python | mit | 1,821 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
5887,
5349,
5332,
4371,
1027,
2322,
3332,
9148,
11927,
2232,
1027,
4278,
3332,
26036,
13900,
1027,
4278,
2465,
8040,
5349,
1006,
4874,
1007,
1024,
13366,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Install script for directory: /home/york/Program/MachineLearning/nn/two_spiral/src
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "0")
endif()
if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/home/york/Program/MachineLearning/nn/two_spiral/src/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
| SwordYork/MachineLearning | nn/two_spiral/src/cmake_install.cmake | CMake | apache-2.0 | 1,415 | [
30522,
1001,
16500,
5896,
2005,
14176,
1024,
1013,
2188,
1013,
2259,
1013,
2565,
1013,
3698,
19738,
6826,
2075,
1013,
1050,
2078,
1013,
2048,
1035,
12313,
1013,
5034,
2278,
1001,
2275,
1996,
16500,
17576,
2065,
1006,
2025,
4225,
4642,
13808... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
# vim: set et ts=4 sw=4:
#coding:utf-8
#############################################################################
#
# mga-dialogs.py - Show mga msg dialog and about dialog.
#
# License: GPLv3
# Author: Angelo Naselli <anaselli@linux.it>
#############################################################################
###########
# imports #
###########
import sys
sys.path.insert(0,'../../../build/swig/python')
import os
import yui
log = yui.YUILog.instance()
log.setLogFileName("/tmp/debug.log")
log.enableDebugLogging( True )
appl = yui.YUI.application()
appl.setApplicationTitle("Show dialogs example")
#################
# class mainGui #
#################
class Info(object):
def __init__(self,title,richtext,text):
self.title=title
self.richtext=richtext
self.text=text
class mainGui():
"""
Main class
"""
def __init__(self):
self.factory = yui.YUI.widgetFactory()
self.dialog = self.factory.createPopupDialog()
mainvbox = self.factory.createVBox(self.dialog)
frame = self.factory.createFrame(mainvbox,"Test frame")
HBox = self.factory.createHBox(frame)
self.aboutbutton = self.factory.createPushButton(HBox,"&About")
self.closebutton = self.factory.createPushButton(self.factory.createRight(HBox), "&Close")
def ask_YesOrNo(self, info):
yui.YUI.widgetFactory
mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga"))
dlg = mgafactory.createDialogBox(yui.YMGAMessageBox.B_TWO)
dlg.setTitle(info.title)
dlg.setText(info.text, info.richtext)
dlg.setButtonLabel("Yes", yui.YMGAMessageBox.B_ONE)
dlg.setButtonLabel("No", yui.YMGAMessageBox.B_TWO)
dlg.setMinSize(50, 5);
return dlg.show() == yui.YMGAMessageBox.B_ONE
def aboutDialog(self):
yui.YUI.widgetFactory;
mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga"))
dlg = mgafactory.createAboutDialog("About dialog title example", "1.0.0", "GPLv3",
"Angelo Naselli", "This beautiful test example shows how it is easy to play with libyui bindings", "")
dlg.show();
def handleevent(self):
"""
Event-handler for the 'widgets' demo
"""
while True:
event = self.dialog.waitForEvent()
if event.eventType() == yui.YEvent.CancelEvent:
self.dialog.destroy()
break
if event.widget() == self.closebutton:
info = Info("Quit confirmation", 1, "Are you sure you want to quit?")
if self.ask_YesOrNo(info):
self.dialog.destroy()
break
if event.widget() == self.aboutbutton:
self.aboutDialog()
if __name__ == "__main__":
main_gui = mainGui()
main_gui.handleevent()
| anaselli/libyui-bindings | swig/python/examples/mga-dialogs.py | Python | lgpl-3.0 | 3,012 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
6819,
2213,
1024,
2275,
3802,
24529,
1027,
1018,
25430,
1027,
1018,
1024,
1001,
16861,
1024,
21183,
2546,
1011,
1022,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/***************************************************************************/
/* */
/* gxvmorx4.c */
/* */
/* TrueTypeGX/AAT morx table validation */
/* body for "morx" type4 (Non-Contextual Glyph Substitution) subtable. */
/* */
/* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/***************************************************************************/
/* */
/* gxvalid is derived from both gxlayout module and otvalid module. */
/* Development of gxlayout is supported by the Information-technology */
/* Promotion Agency(IPA), Japan. */
/* */
/***************************************************************************/
#include "gxvmorx.h"
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_gxvmorx
FT_LOCAL_DEF( void )
gxv_morx_subtable_type4_validate( FT_Bytes table,
FT_Bytes limit,
GXV_Validator valid )
{
GXV_NAME_ENTER( "morx chain subtable type4 "
"(Non-Contextual Glyph Substitution)" );
gxv_mort_subtable_type4_validate( table, limit, valid );
GXV_EXIT;
}
/* END */
| mabels/jmupdf | src/main/cpp/thirdparty/freetype-2.4.10/src/gxvalid/gxvmorx4.c | C | gpl-2.0 | 2,885 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#fixedHeader {
display: none;
position: fixed;
left: 0px;
top: 0px;
background-color: #75616b;
width: 100%;
margin: 0px;
padding: 0px;
z-index: 999;
text-align: center;
}
#fixedHeader h1 {
text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
color: #eeeeee;
padding: 2px;
margin: 2px;
}
.section-header {
background-color: #75616b;
text-align: center;
background: #9c8791;
/* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, #9c8791 0%, #75616b 100%);
/* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #9c8791), color-stop(100%, #75616b));
/* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, #9c8791 0%, #75616b 100%);
/* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, #9c8791 0%, #75616b 100%);
/* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, #9c8791 0%, #75616b 100%);
/* IE10+ */
background: radial-gradient(ellipse at center, #9c8791 0%, #75616b 100%);
/* W3C */
padding-top: 20px;
padding-bottom: 20px;
}
.section-header h1 {
padding-top: 40px;
}
.section-header h2 {
text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
padding-bottom: 40px;
}
.section-contact {
background-color: #bfcff7;
color: #444444;
}
.section-contact a {
color: #444444;
text-decoration: none;
border-bottom: 1px dotted #444444;
}
.section-contact a:hover {
text-decoration: none;
border-bottom: 0px;
}
.section-contact .fa-inverse {
color: #bfcff7;
}
.section-summary {
background-color: #dce4f7;
color: #444444;
}
.section-summary p {
font-size: 1.2em;
}
.section-summary h2 {
color: #444444;
}
.section-recommendations {
background-color: #d34017;
color: #eeeeee;
}
.section-recommendations img {
float: left;
margin-right: 10px;
border: 1px solid white;
border-radius: 5px;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
}
.section-work-exp {
background-color: #f8f3bf;
color: #444444;
}
.section-work-exp h2 {
color: #444444;
}
.section-work-exp .job-logo img {
width: 100px;
height: 100px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
}
.section-work-exp .job-dates {
font-size: 0.8em;
}
.section-work-exp .job-meta {
padding-bottom: 6px;
}
.section-work-exp .job-body {
background-color: #fdfced;
color: #444444;
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
padding: 15px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.center {
text-align: center;
}
| philjackson/cv | css/colours/62.css | CSS | mit | 2,729 | [
30522,
1001,
4964,
4974,
2121,
1063,
4653,
1024,
3904,
1025,
2597,
1024,
4964,
1025,
2187,
1024,
1014,
2361,
2595,
1025,
2327,
1024,
1014,
2361,
2595,
1025,
4281,
1011,
3609,
1024,
1001,
4293,
2575,
16048,
2497,
1025,
9381,
1024,
2531,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
import pygame
pygame.display.init()
pygame.font.init()
modes_list = pygame.display.list_modes()
#screen = pygame.display.set_mode(modes_list[0], pygame.FULLSCREEN) # the highest resolution with fullscreen
screen = pygame.display.set_mode(modes_list[-1]) # the lowest resolution
background_color = (255, 255, 255)
screen.fill(background_color)
font = pygame.font.Font(pygame.font.get_default_font(), 22)
text_surface = font.render("Hello world!", True, (0,0,0))
screen.blit(text_surface, (0,0)) # paste the text at the top left corner of the window
pygame.display.flip() # display the image
while True: # main loop (event loop)
event = pygame.event.wait()
if(event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE)):
break
| jeremiedecock/snippets | python/pygame/hello_text.py | Python | mit | 882 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
12324,
1052,
2100,
16650,
1052,
2100,
16650,
1012,
4653,
1012,
1999,
4183,
1006,
1007,
1052,
2100,
16650,
1012,
15489,
1012,
1999,
4183,
1006,
1007,
11583,
1035,
2862,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Mon Apr 28 11:53:48 IST 2014 -->
<title>perfcenter.simulator.queue</title>
<meta name="date" content="2014-04-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar"><a href="../../../perfcenter/simulator/queue/package-summary.html" target="classFrame">perfcenter.simulator.queue</a></h1>
<div class="indexContainer">
<h2 title="Interfaces">Interfaces</h2>
<ul title="Interfaces">
<li><a href="QueueServer.html" title="interface in perfcenter.simulator.queue" target="classFrame"><i>QueueServer</i></a></li>
</ul>
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="QServerInstance.html" title="class in perfcenter.simulator.queue" target="classFrame">QServerInstance</a></li>
<li><a href="QueueSim.html" title="class in perfcenter.simulator.queue" target="classFrame">QueueSim</a></li>
</ul>
</div>
</body>
</html>
| bkdonline/perfcenter | doc/perfcenter/simulator/queue/package-frame.html | HTML | gpl-2.0 | 1,088 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
$my_keys = array(
new quickkey("Cash","CA"),
new quickkey("Check\nPaper","PE"),
new quickkey("Check\nBusiness","BU"),
new quickkey("ACH","EL"),
new quickkey("Debit","DB"),
new quickkey("Store\nCharge","SC"),
new quickkey("Gift\nCert.","GI"),
new quickkey("Food\nStamp","FS"),
new quickkey("Instore\nCoupon","SU"),
new quickkey("Manuf.\nCoupon","MU"),
new quickkey("EBT","EB"),
new quickkey("Gift\nCard","GD"),
new quickkey("Check\nPayroll","PY"),
new quickkey("Check\nTraveler","TV"),
new quickkey("Tech\nCash","TE"),
new quickkey("Dept.\nTransfer","TR"),
new quickkey("External","XT"),
new quickkey("Crimson\nCash","CR"),
new quickkey("External\nEBT","XE"),
new quickkey("Ext. Cash\nBack","XB")
);
| CORE-POS/IS4C | pos/is4c-nf/plugins/QuickKeys/quickkeys/noauto/2.php | PHP | gpl-2.0 | 787 | [
30522,
1026,
1029,
25718,
1002,
2026,
1035,
6309,
1027,
9140,
1006,
2047,
4248,
14839,
1006,
1000,
5356,
1000,
1010,
1000,
6187,
1000,
1007,
1010,
2047,
4248,
14839,
1006,
1000,
4638,
1032,
27937,
24065,
2099,
1000,
1010,
1000,
21877,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Chamaeraphis compressa (R.Br.) Poir. ex Steud. SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Pennisetum/Pennisetum alopecuroides/ Syn. Chamaeraphis compressa/README.md | Markdown | apache-2.0 | 203 | [
30522,
1001,
15775,
2863,
6906,
21850,
2015,
4012,
20110,
2050,
1006,
1054,
1012,
7987,
1012,
1007,
13433,
4313,
1012,
4654,
26261,
6784,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
define('PWKEY', '!@#$%^&*'); //密码加密密钥
define('BUYTYPE', ['1' => '6HC', '2' => '双色', '3' => '赛车']);
| samuelamam/GameBling | application/config/constants.php | PHP | mit | 4,442 | [
30522,
1026,
1029,
25718,
4225,
1006,
1005,
2918,
15069,
1005,
1007,
2030,
6164,
1006,
1005,
2053,
3622,
5896,
3229,
3039,
1005,
1007,
1025,
1013,
1008,
1064,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
date: 2016-04-28
title: "Le Spose di Giò PREV8_15 2015"
category: Le Spose di Giò
tags: [Le Spose di Giò,2015]
---
### Le Spose di Giò PREV8_15
Just **$379.99**
### 2015
<table><tr><td>BRANDS</td><td>Le Spose di Giò</td></tr><tr><td>Years</td><td>2015</td></tr></table>
<a href="https://www.readybrides.com/en/le-spose-di-gio/43231-le-spose-di-gio-prev815.html"><img src="//img.readybrides.com/94583/le-spose-di-gio-prev815.jpg" alt="Le Spose di Giò PREV8_15" style="width:100%;" /></a>
<!-- break -->
Buy it: [https://www.readybrides.com/en/le-spose-di-gio/43231-le-spose-di-gio-prev815.html](https://www.readybrides.com/en/le-spose-di-gio/43231-le-spose-di-gio-prev815.html)
| novstylessee/novstylessee.github.io | _posts/2016-04-28-Le-Spose-di-Gi-PREV815-2015.md | Markdown | mit | 706 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
3058,
1024,
2355,
1011,
5840,
1011,
2654,
2516,
1024,
1000,
3393,
11867,
9232,
4487,
21025,
2080,
3653,
2615,
2620,
1035,
2321,
2325,
1000,
4696,
1024,
3393,
11867,
9232,
4487,
21025,
2080,
22073,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
/**
* This will hold all of our enums and types and such that we need to
* use in multiple files where the enum can't be mapped to a specific file.
*/
#include "DialogueTypes.generated.h"
UENUM()
namespace EGrammaticalGender
{
enum Type
{
Neuter UMETA( DisplayName = "Neuter" ),
Masculine UMETA( DisplayName = "Masculine" ),
Feminine UMETA( DisplayName = "Feminine" ),
Mixed UMETA( DisplayName = "Mixed" ),
};
}
UENUM()
namespace EGrammaticalNumber
{
enum Type
{
Singular UMETA( DisplayName = "Singular" ),
Plural UMETA( DisplayName = "Plural" ),
};
}
class UDialogueVoice;
USTRUCT(BlueprintType)
struct ENGINE_API FDialogueContext
{
GENERATED_USTRUCT_BODY()
FDialogueContext();
/* The person speaking the dialogue. */
UPROPERTY(EditAnywhere, Category=DialogueContext )
UDialogueVoice* Speaker;
/* The people being spoken to. */
UPROPERTY(EditAnywhere, Category=DialogueContext )
TArray<UDialogueVoice*> Targets;
/* Gets a generated key created from the source and targets. */
FString GetLocalizationKey() const;
};
bool operator==(const FDialogueContext& LHS, const FDialogueContext& RHS);
bool operator!=(const FDialogueContext& LHS, const FDialogueContext& RHS);
class UDialogueWave;
USTRUCT()
struct FDialogueWaveParameter
{
GENERATED_USTRUCT_BODY()
FDialogueWaveParameter();
/* The dialogue wave to play. */
UPROPERTY(EditAnywhere, Category=DialogueWaveParameter )
UDialogueWave* DialogueWave;
/* The context to use for the dialogue wave. */
UPROPERTY(EditAnywhere, Category=DialogueWaveParameter )
FDialogueContext Context;
};
UCLASS(abstract)
class UDialogueTypes : public UObject
{
GENERATED_UCLASS_BODY()
};
| PopCap/GameIdea | Engine/Source/Runtime/Engine/Classes/Sound/DialogueTypes.h | C | bsd-2-clause | 1,753 | [
30522,
1013,
1013,
9385,
2687,
1011,
2325,
8680,
2399,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1001,
10975,
8490,
2863,
2320,
1013,
1008,
1008,
1008,
2023,
2097,
2907,
2035,
1997,
2256,
4372,
18163,
1998,
4127,
1998,
2107,
2008,
2057,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.codefx.jwos.file;
import org.codefx.jwos.analysis.AnalysisPersistence;
import org.codefx.jwos.artifact.AnalyzedArtifact;
import org.codefx.jwos.artifact.CompletedArtifact;
import org.codefx.jwos.artifact.DownloadedArtifact;
import org.codefx.jwos.artifact.FailedArtifact;
import org.codefx.jwos.artifact.FailedProject;
import org.codefx.jwos.artifact.IdentifiesArtifact;
import org.codefx.jwos.artifact.IdentifiesProject;
import org.codefx.jwos.artifact.ProjectCoordinates;
import org.codefx.jwos.artifact.ResolvedArtifact;
import org.codefx.jwos.artifact.ResolvedProject;
import org.codefx.jwos.file.persistence.PersistentAnalysis;
import org.codefx.jwos.file.persistence.PersistentAnalyzedArtifact;
import org.codefx.jwos.file.persistence.PersistentCompletedArtifact;
import org.codefx.jwos.file.persistence.PersistentDownloadedArtifact;
import org.codefx.jwos.file.persistence.PersistentFailedArtifact;
import org.codefx.jwos.file.persistence.PersistentFailedProject;
import org.codefx.jwos.file.persistence.PersistentProjectCoordinates;
import org.codefx.jwos.file.persistence.PersistentResolvedArtifact;
import org.codefx.jwos.file.persistence.PersistentResolvedProject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
import java.util.Collection;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.Function;
import static java.util.Collections.unmodifiableSet;
import static org.codefx.jwos.Util.transformToList;
/**
* An {@link AnalysisPersistence} that uses YAML to store results.
* <p>
* This implementation is not thread-safe.
*/
public class YamlAnalysisPersistence implements AnalysisPersistence {
private static final Logger LOGGER = LoggerFactory.getLogger("Persistence");
private static final YamlPersister PERSISTER = new YamlPersister();
private final SortedSet<ProjectCoordinates> projects
= new ConcurrentSkipListSet<>(IdentifiesProject.alphabeticalOrder());
private final SortedSet<ResolvedProject> resolvedProjects
= new ConcurrentSkipListSet<>(IdentifiesProject.alphabeticalOrder());
private final SortedSet<FailedProject> resolutionFailedProjects
= new ConcurrentSkipListSet<>(IdentifiesProject.alphabeticalOrder());
private final SortedSet<DownloadedArtifact> downloadedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<FailedArtifact> downloadFailedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<AnalyzedArtifact> analyzedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<FailedArtifact> analysisFailedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<ResolvedArtifact> resolvedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<FailedArtifact> resolutionFailedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<CompletedArtifact> completedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
// CREATION & PERSISTENCE
private YamlAnalysisPersistence() {
// private constructor to enforce use of static factory methods
}
public static YamlAnalysisPersistence empty() {
return new YamlAnalysisPersistence();
}
public static YamlAnalysisPersistence fromString(String yamlString) {
if (yamlString.isEmpty())
return empty();
PersistentAnalysis persistent = PERSISTER.read(yamlString, PersistentAnalysis.class);
return from(persistent);
}
public static YamlAnalysisPersistence fromStream(InputStream yamlStream) {
LOGGER.debug("Parsing result file...");
PersistentAnalysis persistent = PERSISTER.read(yamlStream, PersistentAnalysis.class);
if (persistent == null)
return new YamlAnalysisPersistence();
else
return from(persistent);
}
private static YamlAnalysisPersistence from(PersistentAnalysis persistent) {
YamlAnalysisPersistence yaml = new YamlAnalysisPersistence();
addTo(persistent.step_1_projects, PersistentProjectCoordinates::toProject, yaml.projects);
addTo(persistent.step_2_resolvedProjects, PersistentResolvedProject::toProject, yaml.resolvedProjects);
addTo(persistent.step_2_resolutionFailedProjects, PersistentFailedProject::toProject, yaml.resolutionFailedProjects);
addTo(persistent.step_3_downloadedArtifacts, PersistentDownloadedArtifact::toArtifact, yaml.downloadedArtifacts);
addTo(persistent.step_3_downloadFailedArtifacts, PersistentFailedArtifact::toArtifact, yaml.downloadFailedArtifacts);
addTo(persistent.step_4_analyzedArtifacts, PersistentAnalyzedArtifact::toArtifact, yaml.analyzedArtifacts);
addTo(persistent.step_4_analysisFailedArtifacts, PersistentFailedArtifact::toArtifact, yaml.analysisFailedArtifacts);
addTo(persistent.step_5_resolvedArtifacts, PersistentResolvedArtifact::toArtifact, yaml.resolvedArtifacts);
addTo(persistent.step_5_resolutionFailedArtifacts, PersistentFailedArtifact::toArtifact, yaml.resolutionFailedArtifacts);
PersistentCompletedArtifact
.toArtifacts(persistent.step_6_completedArtifacts.stream())
.forEach(yaml.completedArtifacts::add);
return yaml;
}
private static <P, T> void addTo(Collection<P> source, Function<P, T> transform, Collection<T> target) {
source.stream()
.map(transform)
.forEach(target::add);
}
public String toYaml() {
PersistentAnalysis persistent = toPersistentAnalysis();
return PERSISTER.write(persistent);
}
private PersistentAnalysis toPersistentAnalysis() {
PersistentAnalysis persistent = new PersistentAnalysis();
persistent.step_1_projects = transformToList(projects, PersistentProjectCoordinates::from);
persistent.step_2_resolvedProjects = transformToList(resolvedProjects, PersistentResolvedProject::from);
persistent.step_2_resolutionFailedProjects = transformToList(resolutionFailedProjects, PersistentFailedProject::from);
persistent.step_3_downloadedArtifacts = transformToList(downloadedArtifacts, PersistentDownloadedArtifact::from);
persistent.step_3_downloadFailedArtifacts = transformToList(downloadFailedArtifacts, PersistentFailedArtifact::from);
persistent.step_4_analyzedArtifacts = transformToList(analyzedArtifacts, PersistentAnalyzedArtifact::from);
persistent.step_4_analysisFailedArtifacts = transformToList(analysisFailedArtifacts, PersistentFailedArtifact::from);
persistent.step_5_resolvedArtifacts = transformToList(resolvedArtifacts, PersistentResolvedArtifact::from);
persistent.step_5_resolutionFailedArtifacts = transformToList(resolutionFailedArtifacts, PersistentFailedArtifact::from);
persistent.step_6_completedArtifacts = transformToList(completedArtifacts, PersistentCompletedArtifact::from);
return persistent;
}
// IMPLEMENTATION OF 'AnalysisPersistence'
@Override
public Collection<ProjectCoordinates> projectsUnmodifiable() {
return unmodifiableSet(projects);
}
@Override
public Collection<ResolvedProject> resolvedProjectsUnmodifiable() {
return unmodifiableSet(resolvedProjects);
}
@Override
public Collection<FailedProject> projectResolutionErrorsUnmodifiable() {
return unmodifiableSet(resolutionFailedProjects);
}
@Override
public Collection<DownloadedArtifact> downloadedArtifactsUnmodifiable() {
return unmodifiableSet(downloadedArtifacts);
}
@Override
public Collection<FailedArtifact> artifactDownloadErrorsUnmodifiable() {
return unmodifiableSet(downloadFailedArtifacts);
}
@Override
public Collection<AnalyzedArtifact> analyzedArtifactsUnmodifiable() {
return unmodifiableSet(analyzedArtifacts);
}
@Override
public Collection<FailedArtifact> artifactAnalysisErrorsUnmodifiable() {
return unmodifiableSet(analysisFailedArtifacts);
}
@Override
public Collection<ResolvedArtifact> resolvedArtifactsUnmodifiable() {
return unmodifiableSet(resolvedArtifacts);
}
@Override
public Collection<FailedArtifact> artifactResolutionErrorsUnmodifiable() {
return unmodifiableSet(resolutionFailedArtifacts);
}
@Override
public void addProject(ProjectCoordinates project) {
projects.add(project);
}
@Override
public void addResolvedProject(ResolvedProject project) {
resolvedProjects.add(project);
}
@Override
public void addProjectResolutionError(FailedProject project) {
resolutionFailedProjects.add(project);
}
@Override
public void addDownloadedArtifact(DownloadedArtifact artifact) {
downloadedArtifacts.add(artifact);
}
@Override
public void addDownloadError(FailedArtifact artifact) {
downloadFailedArtifacts.add(artifact);
}
@Override
public void addAnalyzedArtifact(AnalyzedArtifact artifact) {
analyzedArtifacts.add(artifact);
}
@Override
public void addAnalysisError(FailedArtifact artifact) {
analysisFailedArtifacts.add(artifact);
}
@Override
public void addResolvedArtifact(ResolvedArtifact artifact) {
resolvedArtifacts.add(artifact);
}
@Override
public void addArtifactResolutionError(FailedArtifact artifact) {
resolutionFailedArtifacts.add(artifact);
}
@Override
public void addResult(CompletedArtifact artifact) {
completedArtifacts.add(artifact);
}
}
| CodeFX-org/jdeps-wall-of-shame | src/main/java/org/codefx/jwos/file/YamlAnalysisPersistence.java | Java | gpl-3.0 | 9,278 | [
30522,
7427,
8917,
1012,
3642,
2546,
2595,
1012,
1046,
12155,
2015,
1012,
5371,
1025,
12324,
8917,
1012,
3642,
2546,
2595,
1012,
1046,
12155,
2015,
1012,
4106,
1012,
4106,
7347,
27870,
5897,
1025,
12324,
8917,
1012,
3642,
2546,
2595,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.