text
stringlengths
2
1.04M
meta
dict
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.tahminbudur.tahminbudur.MainActivity"> <WebView android:id="@+id/mainWebView" android:layout_width="match_parent" android:layout_height="match_parent"> </WebView> </RelativeLayout>
{ "content_hash": "6ed3499868304e9966e9a2ac74e9bcc2", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 74, "avg_line_length": 32.333333333333336, "alnum_prop": 0.6948453608247422, "repo_name": "kadironay/tahminbudur", "id": "2c2879141e5c25c7e1a91dae687ac0fa05edb74a", "size": "485", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MyApplication/app/src/main/res/layout/activity_main.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "15786" } ], "symlink_target": "" }
WITH pre_filtered_keywords AS ( SELECT source_image_id, array_remove(array_agg(source_image_keywords.keyword), NULL) AS keywords FROM source_image_keywords WHERE keyword SIMILAR TO {regex_pattern} GROUP BY source_image_id ), filtered_keywords AS ( SELECT source_image_id FROM pre_filtered_keywords WHERE keywords @> {array_pattern}::varchar[] ) SELECT id, path, thumbnail_path, uploader, uploaded_at, array_remove(array_agg(source_image_keywords.keyword), NULL) AS keywords FROM source_images RIGHT JOIN filtered_keywords ON source_images.id = filtered_keywords.source_image_id LEFT JOIN source_image_keywords ON source_images.id = source_image_keywords.source_image_id GROUP BY id ORDER BY uploaded_at DESC OFFSET {offset} LIMIT {limit}
{ "content_hash": "3e14a23f312be3b1a4482a54bfe92513", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 128, "avg_line_length": 39.21052631578947, "alnum_prop": 0.7865771812080536, "repo_name": "digitalinteraction/intake24", "id": "479f9a463757f38198c4ab716901fd3978770261", "size": "745", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FoodDataSQL/src/main/resources/sql/admin/filter_source_image_records.sql", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "773" }, { "name": "HTML", "bytes": "11542" }, { "name": "Java", "bytes": "341144" }, { "name": "JavaScript", "bytes": "1694" }, { "name": "Scala", "bytes": "1314742" } ], "symlink_target": "" }
#import "KrollMethod.h" #import "KrollObject.h" #import "KrollContext.h" #import "TiBase.h" #import "KrollBridge.h" #ifdef KROLL_COVERAGE # import "KrollCoverage.h" #endif #import "TiApp.h" TiClassRef KrollMethodClassRef = NULL; TiValueRef KrollCallAsFunction(TiContextRef jsContext, TiObjectRef func, TiObjectRef thisObj, size_t argCount, const TiValueRef arguments[], TiValueRef* exception) { waitForMemoryPanicCleared(); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; KrollMethod* o = (KrollMethod*) TiObjectGetPrivate(func); @try { NSMutableArray* args = nil; if (argCount > 0) { args = [[NSMutableArray alloc] initWithCapacity:argCount]; for (size_t c=0;c<argCount;c++) { id value = [KrollObject toID:[o context] value:arguments[c]]; //TODO: This is a temprorary workaround for the time being. We have to properly take care of [undefined] objects. if(value == nil){ [args addObject:[NSNull null]]; } else{ [args addObject:value]; } } } #if KMETHOD_DEBUG == 1 NSDate *reftime = [NSDate date]; NSLog(@"Invoking %@ with args: %@",o,args); #endif id result = [o call:args]; #if KMETHOD_DEBUG == 1 double elapsed = [[NSDate date] timeIntervalSinceDate:reftime]; NSLog(@"Invoked %@ with result: %@ [took: %f]",o,result,elapsed); #endif [args release]; return [KrollObject toValue:[o context] value:result]; } @catch (NSException *ex) { #if KMETHOD_DEBUG == 1 NSLog(@"[ERROR] method invoked exception: %@",ex); #endif *exception = [KrollObject toValue:[o context] value:ex]; } @finally { [pool release]; pool = nil; } return TiValueMakeUndefined(jsContext); } @implementation KrollMethod @synthesize propertyKey, selector,argcount,type,name,updatesProperty; -(id)init { if (self = [super init]) { if (KrollMethodClassRef==NULL) { TiClassDefinition classDef = kTiClassDefinitionEmpty; classDef.className = "Function"; classDef.initialize = KrollInitializer; classDef.finalize = KrollFinalizer; classDef.setProperty = KrollSetProperty; classDef.getProperty = KrollGetProperty; classDef.callAsFunction = KrollCallAsFunction; KrollMethodClassRef = TiClassCreate(&classDef); } } return self; } +(TiClassRef)jsClassRef { return KrollMethodClassRef; } #ifdef DEBUG -(id)description { return [NSString stringWithFormat:@"%@->%@ [%d]",target,NSStringFromSelector(selector),(int)type]; } #endif -(id)initWithTarget:(id)target_ context:(KrollContext*)context_; { if (self = [super initWithTarget:target_ context:context_]) { [target_ release]; } return self; } -(id)initWithTarget:(id)target_ selector:(SEL)selector_ argcount:(int)argcount_ type:(KrollMethodType)type_ name:(id)name_ context:(KrollContext*)context_; { if (self = [self initWithTarget:target_ context:context_]) { selector = selector_; argcount = argcount_; type = type_; name = [name_ retain]; } return self; } -(void)dealloc { target = nil; [name release]; name = nil; [propertyKey release]; [super dealloc]; } -(void)updateJSObjectWithValue:(id)value forKey:(NSString *)key { if (!updatesProperty) { return; } KrollBridge * ourBridge = (KrollBridge*)[context delegate]; KrollObject * targetKrollObject = [ourBridge krollObjectForProxy:target]; TiStringRef keyString = TiStringCreateWithCFString((CFStringRef) key); if ((value != target) && [value isKindOfClass:[TiProxy class]] && [ourBridge usesProxy:value]) { KrollObject *valueKrollObject = [ourBridge krollObjectForProxy:value]; [targetKrollObject noteObject:[valueKrollObject jsobject] forTiString:keyString context:[context context]]; } else { [targetKrollObject forgetObjectForTiString:keyString context:[context context]]; } TiStringRelease(keyString); } -(id)call:(NSArray*)args { // special property setter delegator against the target if (type == KrollMethodPropertySetter && [args count]==1) { id newValue = [KrollObject nonNull:[args objectAtIndex:0]]; [self updateJSObjectWithValue:newValue forKey:name]; [target setValue:newValue forKey:name]; return self; } // special property getter delegator against the target if (type == KrollMethodPropertyGetter) { // hold, see below id result = [target valueForKey:name]; [self updateJSObjectWithValue:result forKey:name]; return result; } // special generic factory for creating proxy objects for modules if (type == KrollMethodFactory) { //TODO: This likely could be further optimized later // NSMethodSignature *methodSignature = [target methodSignatureForSelector:selector]; bool useResult = [methodSignature methodReturnLength] == sizeof(id); id result = nil; id delegate = context.delegate; IMP methodFunction = [target methodForSelector:selector]; if (useResult) { result = methodFunction(target,selector,args,name,delegate); } else { methodFunction(target,selector,args,name,delegate); } return result; } // create proxy method invocation NSMethodSignature *methodSignature = [target methodSignatureForSelector:selector]; if (methodSignature==nil) { @throw [NSException exceptionWithName:@"org.project.kroll" reason:[NSString stringWithFormat:@"invalid method '%@'",NSStringFromSelector(selector)] userInfo:nil]; } IMP methodFunction = [target methodForSelector:selector]; id arg1=nil; id arg2=nil; if ([target conformsToProtocol:@protocol(KrollTargetable)]) { [target setExecutionContext:context.delegate]; } int methodArgCount = [methodSignature numberOfArguments]; if (methodArgCount > 0 && argcount > 0) { if (argcount==2 && methodArgCount==4) { arg1 = [KrollObject nonNull:args==nil ? nil : [args objectAtIndex:0]]; arg2 = [KrollObject nonNull:[args count] > 1 ? [args objectAtIndex:1] : nil]; if (type == KrollMethodSetter) { [self updateJSObjectWithValue:arg1 forKey:propertyKey]; } } else { if (type == KrollMethodDynamicProxy) { arg1 = name; arg2 = args; } else if (type == KrollMethodSetter) { arg1 = [KrollObject nonNull:[args count] == 1 ? [args objectAtIndex:0] : args]; [self updateJSObjectWithValue:arg1 forKey:propertyKey]; } else if (args!=nil) { arg1 = [KrollObject nonNull:args]; } } } if ([methodSignature methodReturnLength] == sizeof(id)) { id result; result = methodFunction(target,selector,arg1,arg2); return result; } const char * retType = [methodSignature methodReturnType]; char t = retType[0]; switch(t) { case 'v': methodFunction(target,selector,arg1,arg2); return nil; case 'c': { char c; typedef char (*cIMP)(id, SEL, ...); c = ((cIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithChar:c]; } case 'f': { float f; typedef float (*fIMP)(id, SEL, ...); f = ((fIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithFloat:f]; } case 'i': { int i; typedef float (*iIMP)(id, SEL, ...); i = ((iIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithInt:i]; } case 'd': { double d; typedef double (*dIMP)(id, SEL, ...); d = ((dIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithDouble:d]; } case 'l': { long l; typedef long (*lIMP)(id, SEL, ...); l = ((lIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithLong:l]; } case 'q': { long long l; typedef long long (*lIMP)(id, SEL, ...); l = ((lIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithLongLong:l]; } case 'Q': { unsigned long long l; typedef unsigned long long (*lIMP)(id, SEL, ...); l = ((lIMP)methodFunction)(target,selector,arg1,arg2); return [NSNumber numberWithUnsignedLongLong:l]; } default: { NSLog(@"[ERROR] unknown & unsupported primitive return type: %c for target:%@->%@",t,target,NSStringFromSelector(selector)); break; } } return nil; } @end
{ "content_hash": "98c13e3dd42c3238dc895c7b54695373", "timestamp": "", "source": "github", "line_count": 316, "max_line_length": 164, "avg_line_length": 25.27848101265823, "alnum_prop": 0.6940410615923885, "repo_name": "sofie/ProjectTwitter", "id": "d00fab569ed7b4912c781d23774fc839112e7f8a", "size": "8310", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "build/iphone/Classes/KrollMethod.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "176218" }, { "name": "C++", "bytes": "47528" }, { "name": "D", "bytes": "746721" }, { "name": "JavaScript", "bytes": "47118" }, { "name": "Objective-C", "bytes": "3057648" }, { "name": "Shell", "bytes": "146" } ], "symlink_target": "" }
package hydrograph.ui.graph.execution.tracking.logger; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.Platform; import org.json.JSONException; import org.slf4j.Logger; import com.google.gson.Gson; import hydrograph.ui.common.util.OSValidator; import hydrograph.ui.graph.Activator; import hydrograph.ui.graph.execution.tracking.datastructure.ExecutionStatus; import hydrograph.ui.graph.execution.tracking.preferences.ExecutionPreferenceConstants; import hydrograph.ui.graph.execution.tracking.utils.TrackingDisplayUtils; import hydrograph.ui.logging.factory.LogFactory; /** * The Class ExecutionTrackingFileLogger use to show as well as save execution tracking log */ public class ExecutionTrackingFileLogger { /** The logger. */ private Logger logger = LogFactory.INSTANCE.getLogger(ExecutionTrackingFileLogger.class); /** The Constant ExecutionTrackingLogFileExtention. */ private static final String EXECUTION_TRACKING_LOG_FILE_EXTENTION = ".track.log"; private static final String EXECUTION_TRACKING_LOCAL_MODE = "L_"; private static final String EXECUTION_TRACKING_REMOTE_MODE = "R_"; private List<ExecutionStatus> executionStatusList = new ArrayList<>(); /** The Constant INSTANCE. */ public static final ExecutionTrackingFileLogger INSTANCE = new ExecutionTrackingFileLogger(); /** The job tracking log directory. */ private String jobTrackingLogDirectory;; /** * Instantiates a new execution tracking file logger. */ private ExecutionTrackingFileLogger(){ createJobTrackingLogDirectory(); } private void initializeTrackingLogPath(){ jobTrackingLogDirectory = Platform.getPreferencesService().getString(Activator.PLUGIN_ID, ExecutionPreferenceConstants.TRACKING_LOG_PATH, TrackingDisplayUtils.INSTANCE.getInstallationPath(), null); jobTrackingLogDirectory = jobTrackingLogDirectory + File.separator; } /** * Creates the job tracking log directory. */ private void createJobTrackingLogDirectory() { initializeTrackingLogPath(); File file = new File(jobTrackingLogDirectory); if (!file.exists()) { file.mkdirs(); } } /** * * @return tracking status list */ public List<ExecutionStatus> getExecutionStatusList(){ return executionStatusList; } /** * Write the log * * @param uniqJobId the uniq job id * @param executionStatus the execution status */ public void log(String uniqJobId,ExecutionStatus executionStatus, boolean isLocalMode){ if(executionStatus!=null && executionStatus.getComponentStatus().size()>0){ executionStatusList.add(executionStatus); } getExecutionStatusLogger(uniqJobId, isLocalMode, executionStatusList); } /** * Gets the execution status logger. * * @param uniqJobId the uniq job id * @return the execution status logger */ private void getExecutionStatusLogger(String uniqJobId, boolean isLocalMode, List<ExecutionStatus> executionStatusList) { createJobTrackingLogDirectory(); if(isLocalMode){ uniqJobId = EXECUTION_TRACKING_LOCAL_MODE + uniqJobId; }else{ uniqJobId = EXECUTION_TRACKING_REMOTE_MODE + uniqJobId; } jobTrackingLogDirectory = jobTrackingLogDirectory + File.separator; try { createJsonFormatFile(jobTrackingLogDirectory + uniqJobId + EXECUTION_TRACKING_LOG_FILE_EXTENTION, executionStatusList); } catch (JSONException e) { logger.error("Failed to create json file", e); } } private void createJsonFormatFile(String path, List<ExecutionStatus> executionStatusList) throws JSONException { try { FileWriter fileWriter = new FileWriter(path); Gson gson = new Gson(); String jsonArray=gson.toJson(executionStatusList); fileWriter.write(jsonArray); fileWriter.flush(); fileWriter.close(); } catch (IOException exception) { logger.error("Failed to create json file", exception); } } /** * Dispose logger. */ public void disposeLogger(){ } }
{ "content_hash": "91f13a1c629b84fae3a044a09faccc25", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 141, "avg_line_length": 29.419117647058822, "alnum_prop": 0.7613096725818546, "repo_name": "capitalone/Hydrograph", "id": "4679d61fba324dd14180294834f39d9c0744006c", "size": "4770", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "hydrograph.ui/hydrograph.ui.graph/src/main/java/hydrograph/ui/graph/execution/tracking/logger/ExecutionTrackingFileLogger.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "9581" }, { "name": "CSS", "bytes": "162185" }, { "name": "HTML", "bytes": "1036397" }, { "name": "Java", "bytes": "10606203" }, { "name": "Scala", "bytes": "1464765" }, { "name": "Shell", "bytes": "12318" } ], "symlink_target": "" }
<?php declare(strict_types=1); namespace Genkgo\Xsl\Integration\Xsl; use DOMDocument; use Genkgo\Xsl\Cache\NullCache; use Genkgo\Xsl\Integration\AbstractIntegrationTestCase; use Genkgo\Xsl\XsltProcessor; final class FunctionTest extends AbstractIntegrationTestCase { public function testFunction(): void { $styleSheet = new DOMDocument(); $styleSheet->load('Stubs/Xsl/Function/function.xsl'); $processor = new XsltProcessor(new NullCache()); $processor->importStyleSheet($styleSheet); $data = new DOMDocument(); $data->load('Stubs/collection.xml'); $this->assertEquals('4', \trim($processor->transformToXml($data))); } }
{ "content_hash": "2382e5d009fc6fcef7a6d76dde6c4894", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 75, "avg_line_length": 26.73076923076923, "alnum_prop": 0.6964028776978417, "repo_name": "genkgo/xsl", "id": "60e42d0cc6c334c040ffe00473ab45c8dda96773", "size": "695", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/Integration/Xsl/FunctionTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "260746" }, { "name": "XSLT", "bytes": "49198" } ], "symlink_target": "" }
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: Hashtable ** ** <OWNER>[....]</OWNER> ** ** ** Purpose: Hash table implementation ** ** ===========================================================*/ namespace System.Collections { using System; using System.Runtime; using System.Runtime.Serialization; using System.Security.Permissions; using System.Diagnostics; using System.Threading; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Diagnostics.Contracts; using System.Security.Cryptography; // The Hashtable class represents a dictionary of associated keys and values // with constant lookup time. // // Objects used as keys in a hashtable must implement the GetHashCode // and Equals methods (or they can rely on the default implementations // inherited from Object if key equality is simply reference // equality). Furthermore, the GetHashCode and Equals methods of // a key object must produce the same results given the same parameters for the // entire time the key is present in the hashtable. In practical terms, this // means that key objects should be immutable, at least for the time they are // used as keys in a hashtable. // // When entries are added to a hashtable, they are placed into // buckets based on the hashcode of their keys. Subsequent lookups of // keys will use the hashcode of the keys to only search a particular bucket, // thus substantially reducing the number of key comparisons required to find // an entry. A hashtable's maximum load factor, which can be specified // when the hashtable is instantiated, determines the maximum ratio of // hashtable entries to hashtable buckets. Smaller load factors cause faster // average lookup times at the cost of increased memory consumption. The // default maximum load factor of 1.0 generally provides the best balance // between speed and size. As entries are added to a hashtable, the hashtable's // actual load factor increases, and when the actual load factor reaches the // maximum load factor value, the number of buckets in the hashtable is // automatically increased by approximately a factor of two (to be precise, the // number of hashtable buckets is increased to the smallest prime number that // is larger than twice the current number of hashtable buckets). // // Each object provides their own hash function, accessed by calling // GetHashCode(). However, one can write their own object // implementing IEqualityComparer and pass it to a constructor on // the Hashtable. That hash function (and the equals method on the // IEqualityComparer) would be used for all objects in the table. // // Changes since V1 during Whidbey: // *) Deprecated IHashCodeProvider, use IEqualityComparer instead. This will // allow better performance for objects where equality checking can be // done much faster than establishing an ordering between two objects, // such as an ordinal string equality check. // [DebuggerTypeProxy(typeof(System.Collections.Hashtable.HashtableDebugView))] [DebuggerDisplay("Count = {Count}")] [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public class Hashtable : IDictionary, ISerializable, IDeserializationCallback, ICloneable { /* Implementation Notes: The generic Dictionary was copied from Hashtable's source - any bug fixes here probably need to be made to the generic Dictionary as well. This Hashtable uses double hashing. There are hashsize buckets in the table, and each bucket can contain 0 or 1 element. We a bit to mark whether there's been a collision when we inserted multiple elements (ie, an inserted item was hashed at least a second time and we probed this bucket, but it was already in use). Using the collision bit, we can terminate lookups & removes for elements that aren't in the hash table more quickly. We steal the most significant bit from the hash code to store the collision bit. Our hash function is of the following form: h(key, n) = h1(key) + n*h2(key) where n is the number of times we've hit a collided bucket and rehashed (on this particular lookup). Here are our hash functions: h1(key) = GetHash(key); // default implementation calls key.GetHashCode(); h2(key) = 1 + (((h1(key) >> 5) + 1) % (hashsize - 1)); The h1 can return any number. h2 must return a number between 1 and hashsize - 1 that is relatively prime to hashsize (not a problem if hashsize is prime). (Knuth's Art of Computer Programming, Vol. 3, p. 528-9) If this is true, then we are guaranteed to visit every bucket in exactly hashsize probes, since the least common multiple of hashsize and h2(key) will be hashsize * h2(key). (This is the first number where adding h2 to h1 mod hashsize will be 0 and we will search the same bucket twice). We previously used a different h2(key, n) that was not constant. That is a horrifically bad idea, unless you can prove that series will never produce any identical numbers that overlap when you mod them by hashsize, for all subranges from i to i+hashsize, for all i. It's not worth investigating, since there was no clear benefit from using that hash function, and it was broken. For efficiency reasons, we've implemented this by storing h1 and h2 in a temporary, and setting a variable called seed equal to h1. We do a probe, and if we collided, we simply add h2 to seed each time through the loop. A good test for h2() is to subclass Hashtable, provide your own implementation of GetHash() that returns a constant, then add many items to the hash table. Make sure Count equals the number of items you inserted. Note that when we remove an item from the hash table, we set the key equal to buckets, if there was a collision in this bucket. Otherwise we'd either wipe out the collision bit, or we'd still have an item in the hash table. -- */ internal const Int32 HashPrime = 101; private const Int32 InitialSize = 3; private const String LoadFactorName = "LoadFactor"; private const String VersionName = "Version"; private const String ComparerName = "Comparer"; private const String HashCodeProviderName = "HashCodeProvider"; private const String HashSizeName = "HashSize"; // Must save buckets.Length private const String KeysName = "Keys"; private const String ValuesName = "Values"; private const String KeyComparerName = "KeyComparer"; // Deleted entries have their key set to buckets // The hash table data. // This cannot be serialised private struct bucket { public Object key; public Object val; public int hash_coll; // Store hash code; sign bit means there was a collision. } private bucket[] buckets; // The total number of entries in the hash table. private int count; // The total number of collision bits set in the hashtable private int occupancy; private int loadsize; private float loadFactor; private volatile int version; private volatile bool isWriterInProgress; private ICollection keys; private ICollection values; private IEqualityComparer _keycomparer; private Object _syncRoot; [Obsolete("Please use EqualityComparer property.")] protected IHashCodeProvider hcp { get { if( _keycomparer is CompatibleComparer) { return ((CompatibleComparer)_keycomparer).HashCodeProvider; } else if( _keycomparer == null) { return null; } else { throw new ArgumentException(Environment.GetResourceString("Arg_CannotMixComparisonInfrastructure")); } } set { if (_keycomparer is CompatibleComparer) { CompatibleComparer keyComparer = (CompatibleComparer)_keycomparer; _keycomparer = new CompatibleComparer(keyComparer.Comparer, value); } else if( _keycomparer == null) { _keycomparer = new CompatibleComparer((IComparer)null, value); } else { throw new ArgumentException(Environment.GetResourceString("Arg_CannotMixComparisonInfrastructure")); } } } [Obsolete("Please use KeyComparer properties.")] protected IComparer comparer { get { if( _keycomparer is CompatibleComparer) { return ((CompatibleComparer)_keycomparer).Comparer; } else if( _keycomparer == null) { return null; } else { throw new ArgumentException(Environment.GetResourceString("Arg_CannotMixComparisonInfrastructure")); } } set { if (_keycomparer is CompatibleComparer) { CompatibleComparer keyComparer = (CompatibleComparer)_keycomparer; _keycomparer = new CompatibleComparer(value, keyComparer.HashCodeProvider); } else if( _keycomparer == null) { _keycomparer = new CompatibleComparer(value, (IHashCodeProvider)null); } else { throw new ArgumentException(Environment.GetResourceString("Arg_CannotMixComparisonInfrastructure")); } } } protected IEqualityComparer EqualityComparer { get { return _keycomparer; } } // Note: this constructor is a bogus constructor that does nothing // and is for use only with SyncHashtable. internal Hashtable( bool trash ) { } // Constructs a new hashtable. The hashtable is created with an initial // capacity of zero and a load factor of 1.0. public Hashtable() : this(0, 1.0f) { } // Constructs a new hashtable with the given initial capacity and a load // factor of 1.0. The capacity argument serves as an indication of // the number of entries the hashtable will contain. When this number (or // an approximation) is known, specifying it in the constructor can // eliminate a number of resizing operations that would otherwise be // performed when elements are added to the hashtable. // public Hashtable(int capacity) : this(capacity, 1.0f) { } // Constructs a new hashtable with the given initial capacity and load // factor. The capacity argument serves as an indication of the // number of entries the hashtable will contain. When this number (or an // approximation) is known, specifying it in the constructor can eliminate // a number of resizing operations that would otherwise be performed when // elements are added to the hashtable. The loadFactor argument // indicates the maximum ratio of hashtable entries to hashtable buckets. // Smaller load factors cause faster average lookup times at the cost of // increased memory consumption. A load factor of 1.0 generally provides // the best balance between speed and size. // public Hashtable(int capacity, float loadFactor) { if (capacity < 0) throw new ArgumentOutOfRangeException("capacity", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); if (!(loadFactor >= 0.1f && loadFactor <= 1.0f)) throw new ArgumentOutOfRangeException("loadFactor", Environment.GetResourceString("ArgumentOutOfRange_HashtableLoadFactor", .1, 1.0)); Contract.EndContractBlock(); // Based on perf work, .72 is the optimal load factor for this table. this.loadFactor = 0.72f * loadFactor; double rawsize = capacity / this.loadFactor; if (rawsize > Int32.MaxValue) throw new ArgumentException(Environment.GetResourceString("Arg_HTCapacityOverflow")); // Avoid awfully small sizes int hashsize = (rawsize > InitialSize) ? HashHelpers.GetPrime((int)rawsize) : InitialSize; buckets = new bucket[hashsize]; loadsize = (int)(this.loadFactor * hashsize); isWriterInProgress = false; // Based on the current algorithm, loadsize must be less than hashsize. Contract.Assert( loadsize < hashsize, "Invalid hashtable loadsize!"); } // Constructs a new hashtable with the given initial capacity and load // factor. The capacity argument serves as an indication of the // number of entries the hashtable will contain. When this number (or an // approximation) is known, specifying it in the constructor can eliminate // a number of resizing operations that would otherwise be performed when // elements are added to the hashtable. The loadFactor argument // indicates the maximum ratio of hashtable entries to hashtable buckets. // Smaller load factors cause faster average lookup times at the cost of // increased memory consumption. A load factor of 1.0 generally provides // the best balance between speed and size. The hcp argument // is used to specify an Object that will provide hash codes for all // the Objects in the table. Using this, you can in effect override // GetHashCode() on each Object using your own hash function. The // comparer argument will let you specify a custom function for // comparing keys. By specifying user-defined objects for hcp // and comparer, users could make a hash table using strings // as keys do case-insensitive lookups. // [Obsolete("Please use Hashtable(int, float, IEqualityComparer) instead.")] public Hashtable(int capacity, float loadFactor, IHashCodeProvider hcp, IComparer comparer) : this(capacity, loadFactor) { if (hcp == null && comparer == null) { this._keycomparer = null; } else { this._keycomparer = new CompatibleComparer(comparer,hcp); } } public Hashtable(int capacity, float loadFactor, IEqualityComparer equalityComparer) : this(capacity, loadFactor) { this._keycomparer = equalityComparer; } // Constructs a new hashtable using a custom hash function // and a custom comparison function for keys. This will enable scenarios // such as doing lookups with case-insensitive strings. // [Obsolete("Please use Hashtable(IEqualityComparer) instead.")] public Hashtable(IHashCodeProvider hcp, IComparer comparer) : this(0, 1.0f, hcp, comparer) { } public Hashtable(IEqualityComparer equalityComparer) : this(0, 1.0f, equalityComparer) { } // Constructs a new hashtable using a custom hash function // and a custom comparison function for keys. This will enable scenarios // such as doing lookups with case-insensitive strings. // [Obsolete("Please use Hashtable(int, IEqualityComparer) instead.")] public Hashtable(int capacity, IHashCodeProvider hcp, IComparer comparer) : this(capacity, 1.0f, hcp, comparer) { } public Hashtable(int capacity, IEqualityComparer equalityComparer) : this(capacity, 1.0f, equalityComparer) { } // Constructs a new hashtable containing a copy of the entries in the given // dictionary. The hashtable is created with a load factor of 1.0. // public Hashtable(IDictionary d) : this(d, 1.0f) { } // Constructs a new hashtable containing a copy of the entries in the given // dictionary. The hashtable is created with the given load factor. // public Hashtable(IDictionary d, float loadFactor) : this(d, loadFactor, (IEqualityComparer)null) { } [Obsolete("Please use Hashtable(IDictionary, IEqualityComparer) instead.")] public Hashtable(IDictionary d, IHashCodeProvider hcp, IComparer comparer) : this(d, 1.0f, hcp, comparer) { } public Hashtable(IDictionary d, IEqualityComparer equalityComparer) : this(d, 1.0f, equalityComparer) { } [Obsolete("Please use Hashtable(IDictionary, float, IEqualityComparer) instead.")] public Hashtable(IDictionary d, float loadFactor, IHashCodeProvider hcp, IComparer comparer) : this((d != null ? d.Count : 0), loadFactor, hcp, comparer) { if (d==null) throw new ArgumentNullException("d", Environment.GetResourceString("ArgumentNull_Dictionary")); Contract.EndContractBlock(); IDictionaryEnumerator e = d.GetEnumerator(); while (e.MoveNext()) Add(e.Key, e.Value); } public Hashtable(IDictionary d, float loadFactor, IEqualityComparer equalityComparer) : this((d != null ? d.Count : 0), loadFactor, equalityComparer) { if (d==null) throw new ArgumentNullException("d", Environment.GetResourceString("ArgumentNull_Dictionary")); Contract.EndContractBlock(); IDictionaryEnumerator e = d.GetEnumerator(); while (e.MoveNext()) Add(e.Key, e.Value); } protected Hashtable(SerializationInfo info, StreamingContext context) { //We can't do anything with the keys and values until the entire graph has been deserialized //and we have a reasonable estimate that GetHashCode is not going to fail. For the time being, //we'll just cache this. The graph is not valid until OnDeserialization has been called. HashHelpers.SerializationInfoTable.Add(this, info); } // ‘InitHash’ is basically an implementation of classic DoubleHashing (see http://en.wikipedia.org/wiki/Double_hashing) // // 1) The only ‘correctness’ requirement is that the ‘increment’ used to probe // a. Be non-zero // b. Be relatively prime to the table size ‘hashSize’. (This is needed to insure you probe all entries in the table before you ‘wrap’ and visit entries already probed) // 2) Because we choose table sizes to be primes, we just need to insure that the increment is 0 < incr < hashSize // // Thus this function would work: Incr = 1 + (seed % (hashSize-1)) // // While this works well for ‘uniformly distributed’ keys, in practice, non-uniformity is common. // In particular in practice we can see ‘mostly sequential’ where you get long clusters of keys that ‘pack’. // To avoid bad behavior you want it to be the case that the increment is ‘large’ even for ‘small’ values (because small // values tend to happen more in practice). Thus we multiply ‘seed’ by a number that will make these small values // bigger (and not hurt large values). We picked HashPrime (101) because it was prime, and if ‘hashSize-1’ is not a multiple of HashPrime // (enforced in GetPrime), then incr has the potential of being every value from 1 to hashSize-1. The choice was largely arbitrary. // // Computes the hash function: H(key, i) = h1(key) + i*h2(key, hashSize). // The out parameter seed is h1(key), while the out parameter // incr is h2(key, hashSize). Callers of this function should // add incr each time through a loop. private uint InitHash(Object key, int hashsize, out uint seed, out uint incr) { // Hashcode must be positive. Also, we must not use the sign bit, since // that is used for the collision bit. uint hashcode = (uint) GetHash(key) & 0x7FFFFFFF; seed = (uint) hashcode; // Restriction: incr MUST be between 1 and hashsize - 1, inclusive for // the modular arithmetic to work correctly. This guarantees you'll // visit every bucket in the table exactly once within hashsize // iterations. Violate this and it'll cause obscure bugs forever. // If you change this calculation for h2(key), update putEntry too! incr = (uint)(1 + ((seed * HashPrime) % ((uint)hashsize - 1))); return hashcode; } // Adds an entry with the given key and value to this hashtable. An // ArgumentException is thrown if the key is null or if the key is already // present in the hashtable. // public virtual void Add(Object key, Object value) { Insert(key, value, true); } // Removes all entries from this hashtable. [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public virtual void Clear() { Contract.Assert(!isWriterInProgress, "Race condition detected in usages of Hashtable - multiple threads appear to be writing to a Hashtable instance simultaneously! Don't do that - use Hashtable.Synchronized."); if (count == 0 && occupancy == 0) return; #if !FEATURE_CORECLR Thread.BeginCriticalRegion(); #endif isWriterInProgress = true; for (int i = 0; i < buckets.Length; i++){ buckets[i].hash_coll = 0; buckets[i].key = null; buckets[i].val = null; } count = 0; occupancy = 0; UpdateVersion(); isWriterInProgress = false; #if !FEATURE_CORECLR Thread.EndCriticalRegion(); #endif } // Clone returns a virtually identical copy of this hash table. This does // a shallow copy - the Objects in the table aren't cloned, only the references // to those Objects. public virtual Object Clone() { bucket[] lbuckets = buckets; Hashtable ht = new Hashtable(count,_keycomparer); ht.version = version; ht.loadFactor = loadFactor; ht.count = 0; int bucket = lbuckets.Length; while (bucket > 0) { bucket--; Object keyv = lbuckets[bucket].key; if ((keyv!= null) && (keyv != lbuckets)) { ht[keyv] = lbuckets[bucket].val; } } return ht; } // Checks if this hashtable contains the given key. public virtual bool Contains(Object key) { return ContainsKey(key); } // Checks if this hashtable contains an entry with the given key. This is // an O(1) operation. // public virtual bool ContainsKey(Object key) { if (key == null) { throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key")); } Contract.EndContractBlock(); uint seed; uint incr; // Take a snapshot of buckets, in case another thread resizes table bucket[] lbuckets = buckets; uint hashcode = InitHash(key, lbuckets.Length, out seed, out incr); int ntry = 0; bucket b; int bucketNumber = (int) (seed % (uint)lbuckets.Length); do { b = lbuckets[bucketNumber]; if (b.key == null) { return false; } if (((b.hash_coll & 0x7FFFFFFF) == hashcode) && KeyEquals (b.key, key)) return true; bucketNumber = (int) (((long)bucketNumber + incr)% (uint)lbuckets.Length); } while (b.hash_coll < 0 && ++ntry < lbuckets.Length); return false; } // Checks if this hashtable contains an entry with the given value. The // values of the entries of the hashtable are compared to the given value // using the Object.Equals method. This method performs a linear // search and is thus be substantially slower than the ContainsKey // method. // public virtual bool ContainsValue(Object value) { if (value == null) { for (int i = buckets.Length; --i >= 0;) { if (buckets[i].key != null && buckets[i].key != buckets && buckets[i].val == null) return true; } } else { for (int i = buckets.Length; --i >= 0;) { Object val = buckets[i].val; if (val!=null && val.Equals(value)) return true; } } return false; } // Copies the keys of this hashtable to a given array starting at a given // index. This method is used by the implementation of the CopyTo method in // the KeyCollection class. private void CopyKeys(Array array, int arrayIndex) { Contract.Requires(array != null); Contract.Requires(array.Rank == 1); bucket[] lbuckets = buckets; for (int i = lbuckets.Length; --i >= 0;) { Object keyv = lbuckets[i].key; if ((keyv != null) && (keyv != buckets)){ array.SetValue(keyv, arrayIndex++); } } } // Copies the keys of this hashtable to a given array starting at a given // index. This method is used by the implementation of the CopyTo method in // the KeyCollection class. private void CopyEntries(Array array, int arrayIndex) { Contract.Requires(array != null); Contract.Requires(array.Rank == 1); bucket[] lbuckets = buckets; for (int i = lbuckets.Length; --i >= 0;) { Object keyv = lbuckets[i].key; if ((keyv != null) && (keyv != buckets)){ DictionaryEntry entry = new DictionaryEntry(keyv,lbuckets[i].val); array.SetValue(entry, arrayIndex++); } } } // Copies the values in this hash table to an array at // a given index. Note that this only copies values, and not keys. public virtual void CopyTo(Array array, int arrayIndex) { if (array == null) throw new ArgumentNullException("array", Environment.GetResourceString("ArgumentNull_Array")); if (array.Rank != 1) throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported")); if (arrayIndex < 0) throw new ArgumentOutOfRangeException("arrayIndex", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); if (array.Length - arrayIndex < Count) throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall")); Contract.EndContractBlock(); CopyEntries(array, arrayIndex); } // Copies the values in this Hashtable to an KeyValuePairs array. // KeyValuePairs is different from Dictionary Entry in that it has special // debugger attributes on its fields. internal virtual KeyValuePairs[] ToKeyValuePairsArray() { KeyValuePairs[] array = new KeyValuePairs[count]; int index = 0; bucket[] lbuckets = buckets; for (int i = lbuckets.Length; --i >= 0;) { Object keyv = lbuckets[i].key; if ((keyv != null) && (keyv != buckets)){ array[index++] = new KeyValuePairs(keyv,lbuckets[i].val); } } return array; } // Copies the values of this hashtable to a given array starting at a given // index. This method is used by the implementation of the CopyTo method in // the ValueCollection class. private void CopyValues(Array array, int arrayIndex) { Contract.Requires(array != null); Contract.Requires(array.Rank == 1); bucket[] lbuckets = buckets; for (int i = lbuckets.Length; --i >= 0;) { Object keyv = lbuckets[i].key; if ((keyv != null) && (keyv != buckets)){ array.SetValue(lbuckets[i].val, arrayIndex++); } } } // Returns the value associated with the given key. If an entry with the // given key is not found, the returned value is null. // public virtual Object this[Object key] { get { if (key == null) { throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key")); } Contract.EndContractBlock(); uint seed; uint incr; // Take a snapshot of buckets, in case another thread does a resize bucket[] lbuckets = buckets; uint hashcode = InitHash(key, lbuckets.Length, out seed, out incr); int ntry = 0; bucket b; int bucketNumber = (int) (seed % (uint)lbuckets.Length); do { int currentversion; // A read operation on hashtable has three steps: // (1) calculate the hash and find the slot number. // (2) compare the hashcode, if equal, go to step 3. Otherwise end. // (3) compare the key, if equal, go to step 4. Otherwise end. // (4) return the value contained in the bucket. // After step 3 and before step 4. A writer can kick in a remove the old item and add a new one // in the same bukcet. So in the reader we need to check if the hash table is modified during above steps. // // Writers (Insert, Remove, Clear) will set 'isWriterInProgress' flag before it starts modifying // the hashtable and will ckear the flag when it is done. When the flag is cleared, the 'version' // will be increased. We will repeat the reading if a writer is in progress or done with the modification // during the read. // // Our memory model guarantee if we pick up the change in bucket from another processor, // we will see the 'isWriterProgress' flag to be true or 'version' is changed in the reader. // int spinCount = 0; do { // this is violate read, following memory accesses can not be moved ahead of it. currentversion = version; b = lbuckets[bucketNumber]; // The contention between reader and writer shouldn't happen frequently. // But just in case this will burn CPU, yield the control of CPU if we spinned a few times. // 8 is just a random number I pick. if( (++spinCount) % 8 == 0 ) { Thread.Sleep(1); // 1 means we are yeilding control to all threads, including low-priority ones. } } while ( isWriterInProgress || (currentversion != version) ); if (b.key == null) { return null; } if (((b.hash_coll & 0x7FFFFFFF) == hashcode) && KeyEquals (b.key, key)) return b.val; bucketNumber = (int) (((long)bucketNumber + incr)% (uint)lbuckets.Length); } while (b.hash_coll < 0 && ++ntry < lbuckets.Length); return null; } set { Insert(key, value, false); } } // Increases the bucket count of this hashtable. This method is called from // the Insert method when the actual load factor of the hashtable reaches // the upper limit specified when the hashtable was constructed. The number // of buckets in the hashtable is increased to the smallest prime number // that is larger than twice the current number of buckets, and the entries // in the hashtable are redistributed into the new buckets using the cached // hashcodes. private void expand() { int rawsize = HashHelpers.ExpandPrime(buckets.Length); rehash(rawsize, false); } // We occationally need to rehash the table to clean up the collision bits. private void rehash() { rehash( buckets.Length, false ); } private void UpdateVersion() { // Version might become negative when version is Int32.MaxValue, but the oddity will be still be correct. // So we don't need to special case this. version++; } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private void rehash( int newsize, bool forceNewHashCode ) { // reset occupancy occupancy=0; // Don't replace any internal state until we've finished adding to the // new bucket[]. This serves two purposes: // 1) Allow concurrent readers to see valid hashtable contents // at all times // 2) Protect against an OutOfMemoryException while allocating this // new bucket[]. bucket[] newBuckets = new bucket[newsize]; // rehash table into new buckets int nb; for (nb = 0; nb < buckets.Length; nb++){ bucket oldb = buckets[nb]; if ((oldb.key != null) && (oldb.key != buckets)) { int hashcode = ((forceNewHashCode ? GetHash(oldb.key) : oldb.hash_coll) & 0x7FFFFFFF); putEntry(newBuckets, oldb.key, oldb.val, hashcode); } } // New bucket[] is good to go - replace buckets and other internal state. #if !FEATURE_CORECLR Thread.BeginCriticalRegion(); #endif isWriterInProgress = true; buckets = newBuckets; loadsize = (int)(loadFactor * newsize); UpdateVersion(); isWriterInProgress = false; #if !FEATURE_CORECLR Thread.EndCriticalRegion(); #endif // minimun size of hashtable is 3 now and maximum loadFactor is 0.72 now. Contract.Assert(loadsize < newsize, "Our current implementaion means this is not possible."); return; } // Returns an enumerator for this hashtable. // If modifications made to the hashtable while an enumeration is // in progress, the MoveNext and Current methods of the // enumerator will throw an exception. // IEnumerator IEnumerable.GetEnumerator() { return new HashtableEnumerator(this, HashtableEnumerator.DictEntry); } // Returns a dictionary enumerator for this hashtable. // If modifications made to the hashtable while an enumeration is // in progress, the MoveNext and Current methods of the // enumerator will throw an exception. // public virtual IDictionaryEnumerator GetEnumerator() { return new HashtableEnumerator(this, HashtableEnumerator.DictEntry); } // Internal method to get the hash code for an Object. This will call // GetHashCode() on each object if you haven't provided an IHashCodeProvider // instance. Otherwise, it calls hcp.GetHashCode(obj). protected virtual int GetHash(Object key) { if (_keycomparer != null) return _keycomparer.GetHashCode(key); return key.GetHashCode(); } // Is this Hashtable read-only? public virtual bool IsReadOnly { get { return false; } } public virtual bool IsFixedSize { get { return false; } } // Is this Hashtable synchronized? See SyncRoot property public virtual bool IsSynchronized { get { return false; } } // Internal method to compare two keys. If you have provided an IComparer // instance in the constructor, this method will call comparer.Compare(item, key). // Otherwise, it will call item.Equals(key). // protected virtual bool KeyEquals(Object item, Object key) { Contract.Assert(key != null, "key can't be null here!"); if( Object.ReferenceEquals(buckets, item)) { return false; } if (Object.ReferenceEquals(item,key)) return true; if (_keycomparer != null) return _keycomparer.Equals(item, key); return item == null ? false : item.Equals(key); } // Returns a collection representing the keys of this hashtable. The order // in which the returned collection represents the keys is unspecified, but // it is guaranteed to be buckets = newBuckets; the same order in which a collection returned by // GetValues represents the values of the hashtable. // // The returned collection is live in the sense that any changes // to the hash table are reflected in this collection. It is not // a static copy of all the keys in the hash table. // public virtual ICollection Keys { get { if (keys == null) keys = new KeyCollection(this); return keys; } } // Returns a collection representing the values of this hashtable. The // order in which the returned collection represents the values is // unspecified, but it is guaranteed to be the same order in which a // collection returned by GetKeys represents the keys of the // hashtable. // // The returned collection is live in the sense that any changes // to the hash table are reflected in this collection. It is not // a static copy of all the keys in the hash table. // public virtual ICollection Values { get { if (values == null) values = new ValueCollection(this); return values; } } // Inserts an entry into this hashtable. This method is called from the Set // and Add methods. If the add parameter is true and the given key already // exists in the hashtable, an exception is thrown. [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] private void Insert (Object key, Object nvalue, bool add) { // @ if (key == null) { throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key")); } Contract.EndContractBlock(); if (count >= loadsize) { expand(); } else if(occupancy > loadsize && count > 100) { rehash(); } uint seed; uint incr; // Assume we only have one thread writing concurrently. Modify // buckets to contain new data, as long as we insert in the right order. uint hashcode = InitHash(key, buckets.Length, out seed, out incr); int ntry = 0; int emptySlotNumber = -1; // We use the empty slot number to cache the first empty slot. We chose to reuse slots // create by remove that have the collision bit set over using up new slots. int bucketNumber = (int) (seed % (uint)buckets.Length); do { // Set emptySlot number to current bucket if it is the first available bucket that we have seen // that once contained an entry and also has had a collision. // We need to search this entire collision chain because we have to ensure that there are no // duplicate entries in the table. if (emptySlotNumber == -1 && (buckets[bucketNumber].key == buckets) && (buckets[bucketNumber].hash_coll < 0))//(((buckets[bucketNumber].hash_coll & unchecked(0x80000000))!=0))) emptySlotNumber = bucketNumber; // Insert the key/value pair into this bucket if this bucket is empty and has never contained an entry // OR // This bucket once contained an entry but there has never been a collision if ((buckets[bucketNumber].key == null) || (buckets[bucketNumber].key == buckets && ((buckets[bucketNumber].hash_coll & unchecked(0x80000000))==0))) { // If we have found an available bucket that has never had a collision, but we've seen an available // bucket in the past that has the collision bit set, use the previous bucket instead if (emptySlotNumber != -1) // Reuse slot bucketNumber = emptySlotNumber; // We pretty much have to insert in this order. Don't set hash // code until the value & key are set appropriately. #if !FEATURE_CORECLR Thread.BeginCriticalRegion(); #endif isWriterInProgress = true; buckets[bucketNumber].val = nvalue; buckets[bucketNumber].key = key; buckets[bucketNumber].hash_coll |= (int) hashcode; count++; UpdateVersion(); isWriterInProgress = false; #if !FEATURE_CORECLR Thread.EndCriticalRegion(); #endif #if FEATURE_RANDOMIZED_STRING_HASHING #if !FEATURE_CORECLR // coreclr has the randomized string hashing on by default so we don't need to resize at this point if(ntry > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_keycomparer)) { // PERF: We don't want to rehash if _keycomparer is already a RandomizedObjectEqualityComparer since in some // cases there may not be any strings in the hashtable and we wouldn't get any mixing. if(_keycomparer == null || !(_keycomparer is System.Collections.Generic.RandomizedObjectEqualityComparer)) { _keycomparer = HashHelpers.GetRandomizedEqualityComparer(_keycomparer); rehash(buckets.Length, true); } } #endif // !FEATURE_CORECLR #endif // FEATURE_RANDOMIZED_STRING_HASHING return; } // The current bucket is in use // OR // it is available, but has had the collision bit set and we have already found an available bucket if (((buckets[bucketNumber].hash_coll & 0x7FFFFFFF) == hashcode) && KeyEquals (buckets[bucketNumber].key, key)) { if (add) { throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate__", buckets[bucketNumber].key, key)); } #if !FEATURE_CORECLR Thread.BeginCriticalRegion(); #endif isWriterInProgress = true; buckets[bucketNumber].val = nvalue; UpdateVersion(); isWriterInProgress = false; #if !FEATURE_CORECLR Thread.EndCriticalRegion(); #endif #if FEATURE_RANDOMIZED_STRING_HASHING #if !FEATURE_CORECLR if(ntry > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_keycomparer)) { // PERF: We don't want to rehash if _keycomparer is already a RandomizedObjectEqualityComparer since in some // cases there may not be any strings in the hashtable and we wouldn't get any mixing. if(_keycomparer == null || !(_keycomparer is System.Collections.Generic.RandomizedObjectEqualityComparer)) { _keycomparer = HashHelpers.GetRandomizedEqualityComparer(_keycomparer); rehash(buckets.Length, true); } } #endif // !FEATURE_CORECLR #endif return; } // The current bucket is full, and we have therefore collided. We need to set the collision bit // UNLESS // we have remembered an available slot previously. if (emptySlotNumber == -1) {// We don't need to set the collision bit here since we already have an empty slot if( buckets[bucketNumber].hash_coll >= 0 ) { buckets[bucketNumber].hash_coll |= unchecked((int)0x80000000); occupancy++; } } bucketNumber = (int) (((long)bucketNumber + incr)% (uint)buckets.Length); } while (++ntry < buckets.Length); // This code is here if and only if there were no buckets without a collision bit set in the entire table if (emptySlotNumber != -1) { // We pretty much have to insert in this order. Don't set hash // code until the value & key are set appropriately. #if !FEATURE_CORECLR Thread.BeginCriticalRegion(); #endif isWriterInProgress = true; buckets[emptySlotNumber].val = nvalue; buckets[emptySlotNumber].key = key; buckets[emptySlotNumber].hash_coll |= (int) hashcode; count++; UpdateVersion(); isWriterInProgress = false; #if !FEATURE_CORECLR Thread.EndCriticalRegion(); #endif #if FEATURE_RANDOMIZED_STRING_HASHING #if !FEATURE_CORECLR if(buckets.Length > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(_keycomparer)) { // PERF: We don't want to rehash if _keycomparer is already a RandomizedObjectEqualityComparer since in some // cases there may not be any strings in the hashtable and we wouldn't get any mixing. if(_keycomparer == null || !(_keycomparer is System.Collections.Generic.RandomizedObjectEqualityComparer)) { _keycomparer = HashHelpers.GetRandomizedEqualityComparer(_keycomparer); rehash(buckets.Length, true); } } #endif // !FEATURE_CORECLR #endif return; } // If you see this assert, make sure load factor & count are reasonable. // Then verify that our double hash function (h2, described at top of file) // meets the requirements described above. You should never see this assert. Contract.Assert(false, "hash table insert failed! Load factor too high, or our double hashing function is incorrect."); throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HashInsertFailed")); } private void putEntry (bucket[] newBuckets, Object key, Object nvalue, int hashcode) { Contract.Assert(hashcode >= 0, "hashcode >= 0"); // make sure collision bit (sign bit) wasn't set. uint seed = (uint) hashcode; uint incr = (uint)(1 + ((seed * HashPrime) % ((uint)newBuckets.Length - 1))); int bucketNumber = (int) (seed % (uint)newBuckets.Length); do { if ((newBuckets[bucketNumber].key == null) || (newBuckets[bucketNumber].key == buckets)) { newBuckets[bucketNumber].val = nvalue; newBuckets[bucketNumber].key = key; newBuckets[bucketNumber].hash_coll |= hashcode; return; } if( newBuckets[bucketNumber].hash_coll >= 0 ) { newBuckets[bucketNumber].hash_coll |= unchecked((int)0x80000000); occupancy++; } bucketNumber = (int) (((long)bucketNumber + incr)% (uint)newBuckets.Length); } while (true); } // Removes an entry from this hashtable. If an entry with the specified // key exists in the hashtable, it is removed. An ArgumentException is // thrown if the key is null. // [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] public virtual void Remove(Object key) { if (key == null) { throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key")); } Contract.EndContractBlock(); Contract.Assert(!isWriterInProgress, "Race condition detected in usages of Hashtable - multiple threads appear to be writing to a Hashtable instance simultaneously! Don't do that - use Hashtable.Synchronized."); uint seed; uint incr; // Assuming only one concurrent writer, write directly into buckets. uint hashcode = InitHash(key, buckets.Length, out seed, out incr); int ntry = 0; bucket b; int bn = (int) (seed % (uint)buckets.Length); // bucketNumber do { b = buckets[bn]; if (((b.hash_coll & 0x7FFFFFFF) == hashcode) && KeyEquals (b.key, key)) { #if !FEATURE_CORECLR Thread.BeginCriticalRegion(); #endif isWriterInProgress = true; // Clear hash_coll field, then key, then value buckets[bn].hash_coll &= unchecked((int)0x80000000); if (buckets[bn].hash_coll != 0) { buckets[bn].key = buckets; } else { buckets[bn].key = null; } buckets[bn].val = null; // Free object references sooner & simplify ContainsValue. count--; UpdateVersion(); isWriterInProgress = false; #if !FEATURE_CORECLR Thread.EndCriticalRegion(); #endif return; } bn = (int) (((long)bn + incr)% (uint)buckets.Length); } while (b.hash_coll < 0 && ++ntry < buckets.Length); //throw new ArgumentException(Environment.GetResourceString("Arg_RemoveArgNotFound")); } // Returns the object to synchronize on for this hash table. public virtual Object SyncRoot { get { if( _syncRoot == null) { System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null); } return _syncRoot; } } // Returns the number of associations in this hashtable. // public virtual int Count { get { return count; } } // Returns a thread-safe wrapper for a Hashtable. // [HostProtection(Synchronization=true)] public static Hashtable Synchronized(Hashtable table) { if (table==null) throw new ArgumentNullException("table"); Contract.EndContractBlock(); return new SyncHashtable(table); } // // The ISerializable Implementation // [System.Security.SecurityCritical] public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); // This is imperfect - it only works well if all other writes are // also using our synchronized wrapper. But it's still a good idea. lock (SyncRoot) { // This method hasn't been fully tweaked to be safe for a concurrent writer. int oldVersion = version; info.AddValue(LoadFactorName, loadFactor); info.AddValue(VersionName, version); // // We need to maintain serialization compatibility with Everett and RTM. // If the comparer is null or a compatible comparer, serialize Hashtable // in a format that can be deserialized on Everett and RTM. // // Also, if the Hashtable is using randomized hashing, serialize the old // view of the _keycomparer so perevious frameworks don't see the new types #pragma warning disable 618 #if FEATURE_RANDOMIZED_STRING_HASHING IEqualityComparer keyComparerForSerilization = (IEqualityComparer) HashHelpers.GetEqualityComparerForSerialization(_keycomparer); #else IEqualityComparer keyComparerForSerilization = _keycomparer; #endif if( keyComparerForSerilization == null) { info.AddValue(ComparerName, null,typeof(IComparer)); info.AddValue(HashCodeProviderName, null, typeof(IHashCodeProvider)); } else if(keyComparerForSerilization is CompatibleComparer) { CompatibleComparer c = keyComparerForSerilization as CompatibleComparer; info.AddValue(ComparerName, c.Comparer, typeof(IComparer)); info.AddValue(HashCodeProviderName, c.HashCodeProvider, typeof(IHashCodeProvider)); } else { info.AddValue(KeyComparerName, keyComparerForSerilization, typeof(IEqualityComparer)); } #pragma warning restore 618 info.AddValue(HashSizeName, buckets.Length); //This is the length of the bucket array. Object [] serKeys = new Object[count]; Object [] serValues = new Object[count]; CopyKeys(serKeys, 0); CopyValues(serValues,0); info.AddValue(KeysName, serKeys, typeof(Object[])); info.AddValue(ValuesName, serValues, typeof(Object[])); // Explicitly check to see if anyone changed the Hashtable while we // were serializing it. That's a ---- in their code. if (version != oldVersion) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion)); } } // // DeserializationEvent Listener // public virtual void OnDeserialization(Object sender) { if (buckets!=null) { // Somebody had a dependency on this hashtable and fixed us up before the ObjectManager got to it. return; } SerializationInfo siInfo; HashHelpers.SerializationInfoTable.TryGetValue(this, out siInfo); if (siInfo==null) { throw new SerializationException(Environment.GetResourceString("Serialization_InvalidOnDeser")); } int hashsize = 0; IComparer c = null; #pragma warning disable 618 IHashCodeProvider hcp = null; #pragma warning restore 618 Object [] serKeys = null; Object [] serValues = null; SerializationInfoEnumerator enumerator = siInfo.GetEnumerator(); while( enumerator.MoveNext()) { switch( enumerator.Name) { case LoadFactorName: loadFactor = siInfo.GetSingle(LoadFactorName); break; case HashSizeName: hashsize = siInfo.GetInt32(HashSizeName); break; case KeyComparerName: _keycomparer = (IEqualityComparer)siInfo.GetValue(KeyComparerName, typeof(IEqualityComparer)); break; case ComparerName: c = (IComparer)siInfo.GetValue(ComparerName, typeof(IComparer)); break; case HashCodeProviderName: #pragma warning disable 618 hcp = (IHashCodeProvider)siInfo.GetValue(HashCodeProviderName, typeof(IHashCodeProvider)); #pragma warning restore 618 break; case KeysName: serKeys = (Object[])siInfo.GetValue(KeysName, typeof(Object[])); break; case ValuesName: serValues = (Object[])siInfo.GetValue(ValuesName, typeof(Object[])); break; } } loadsize = (int)(loadFactor*hashsize); // V1 object doesn't has _keycomparer field. if ( (_keycomparer == null) && ( (c != null) || (hcp != null) ) ){ _keycomparer = new CompatibleComparer(c,hcp); } buckets = new bucket[hashsize]; if (serKeys==null) { throw new SerializationException(Environment.GetResourceString("Serialization_MissingKeys")); } if (serValues==null) { throw new SerializationException(Environment.GetResourceString("Serialization_MissingValues")); } if (serKeys.Length!=serValues.Length) { throw new SerializationException(Environment.GetResourceString("Serialization_KeyValueDifferentSizes")); } for (int i=0; i<serKeys.Length; i++) { if (serKeys[i]==null) { throw new SerializationException(Environment.GetResourceString("Serialization_NullKey")); } Insert(serKeys[i], serValues[i], true); } version = siInfo.GetInt32(VersionName); HashHelpers.SerializationInfoTable.Remove(this); } // Implements a Collection for the keys of a hashtable. An instance of this // class is created by the GetKeys method of a hashtable. [Serializable] private class KeyCollection : ICollection { private Hashtable _hashtable; internal KeyCollection(Hashtable hashtable) { _hashtable = hashtable; } public virtual void CopyTo(Array array, int arrayIndex) { if (array==null) throw new ArgumentNullException("array"); if (array.Rank != 1) throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported")); if (arrayIndex < 0) throw new ArgumentOutOfRangeException("arrayIndex", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); Contract.EndContractBlock(); if (array.Length - arrayIndex < _hashtable.count) throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall")); _hashtable.CopyKeys(array, arrayIndex); } public virtual IEnumerator GetEnumerator() { return new HashtableEnumerator(_hashtable, HashtableEnumerator.Keys); } public virtual bool IsSynchronized { get { return _hashtable.IsSynchronized; } } public virtual Object SyncRoot { get { return _hashtable.SyncRoot; } } public virtual int Count { get { return _hashtable.count; } } } // Implements a Collection for the values of a hashtable. An instance of // this class is created by the GetValues method of a hashtable. [Serializable] private class ValueCollection : ICollection { private Hashtable _hashtable; internal ValueCollection(Hashtable hashtable) { _hashtable = hashtable; } public virtual void CopyTo(Array array, int arrayIndex) { if (array==null) throw new ArgumentNullException("array"); if (array.Rank != 1) throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported")); if (arrayIndex < 0) throw new ArgumentOutOfRangeException("arrayIndex", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); Contract.EndContractBlock(); if (array.Length - arrayIndex < _hashtable.count) throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall")); _hashtable.CopyValues(array, arrayIndex); } public virtual IEnumerator GetEnumerator() { return new HashtableEnumerator(_hashtable, HashtableEnumerator.Values); } public virtual bool IsSynchronized { get { return _hashtable.IsSynchronized; } } public virtual Object SyncRoot { get { return _hashtable.SyncRoot; } } public virtual int Count { get { return _hashtable.count; } } } // Synchronized wrapper for hashtable [Serializable] private class SyncHashtable : Hashtable, IEnumerable { protected Hashtable _table; internal SyncHashtable(Hashtable table) : base(false) { _table = table; } internal SyncHashtable(SerializationInfo info, StreamingContext context) : base (info, context) { _table = (Hashtable)info.GetValue("ParentTable", typeof(Hashtable)); if (_table==null) { throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState")); } } /*================================GetObjectData================================= **Action: Return a serialization info containing a reference to _table. We need ** to implement this because our parent HT does and we don't want to actually ** serialize all of it's values (just a reference to the table, which will then ** be serialized separately.) **Returns: void **Arguments: info -- the SerializationInfo into which to store the data. ** context -- the StreamingContext for the current serialization (ignored) **Exceptions: ArgumentNullException if info is null. ==============================================================================*/ [System.Security.SecurityCritical] // auto-generated public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); // Our serialization code hasn't been fully tweaked to be safe // for a concurrent writer. lock (_table.SyncRoot) { info.AddValue("ParentTable", _table, typeof(Hashtable)); } } public override int Count { get { return _table.Count; } } public override bool IsReadOnly { get { return _table.IsReadOnly; } } public override bool IsFixedSize { get { return _table.IsFixedSize; } } public override bool IsSynchronized { get { return true; } } public override Object this[Object key] { get { return _table[key]; } set { lock(_table.SyncRoot) { _table[key] = value; } } } public override Object SyncRoot { get { return _table.SyncRoot; } } public override void Add(Object key, Object value) { lock(_table.SyncRoot) { _table.Add(key, value); } } public override void Clear() { lock(_table.SyncRoot) { _table.Clear(); } } public override bool Contains(Object key) { return _table.Contains(key); } public override bool ContainsKey(Object key) { if (key == null) { throw new ArgumentNullException("key", Environment.GetResourceString("ArgumentNull_Key")); } Contract.EndContractBlock(); return _table.ContainsKey(key); } public override bool ContainsValue(Object key) { lock(_table.SyncRoot) { return _table.ContainsValue(key); } } public override void CopyTo(Array array, int arrayIndex) { lock (_table.SyncRoot) { _table.CopyTo(array, arrayIndex); } } public override Object Clone() { lock (_table.SyncRoot) { return Hashtable.Synchronized((Hashtable)_table.Clone()); } } IEnumerator IEnumerable.GetEnumerator() { return _table.GetEnumerator(); } public override IDictionaryEnumerator GetEnumerator() { return _table.GetEnumerator(); } public override ICollection Keys { get { lock(_table.SyncRoot) { return _table.Keys; } } } public override ICollection Values { get { lock(_table.SyncRoot) { return _table.Values; } } } public override void Remove(Object key) { lock(_table.SyncRoot) { _table.Remove(key); } } /*==============================OnDeserialization=============================== **Action: Does nothing. We have to implement this because our parent HT implements it, ** but it doesn't do anything meaningful. The real work will be done when we ** call OnDeserialization on our parent table. **Returns: void **Arguments: None **Exceptions: None ==============================================================================*/ public override void OnDeserialization(Object sender) { return; } internal override KeyValuePairs[] ToKeyValuePairsArray() { return _table.ToKeyValuePairsArray(); } } // Implements an enumerator for a hashtable. The enumerator uses the // internal version number of the hashtabke to ensure that no modifications // are made to the hashtable while an enumeration is in progress. [Serializable] private class HashtableEnumerator : IDictionaryEnumerator, ICloneable { private Hashtable hashtable; private int bucket; private int version; private bool current; private int getObjectRetType; // What should GetObject return? private Object currentKey; private Object currentValue; internal const int Keys = 1; internal const int Values = 2; internal const int DictEntry = 3; internal HashtableEnumerator(Hashtable hashtable, int getObjRetType) { this.hashtable = hashtable; bucket = hashtable.buckets.Length; version = hashtable.version; current = false; getObjectRetType = getObjRetType; } public Object Clone() { return MemberwiseClone(); } public virtual Object Key { get { if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted)); return currentKey; } } public virtual bool MoveNext() { if (version != hashtable.version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion)); while (bucket > 0) { bucket--; Object keyv = hashtable.buckets[bucket].key; if ((keyv!= null) && (keyv != hashtable.buckets)) { currentKey = keyv; currentValue = hashtable.buckets[bucket].val; current = true; return true; } } current = false; return false; } public virtual DictionaryEntry Entry { get { if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen)); return new DictionaryEntry(currentKey, currentValue); } } public virtual Object Current { get { if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen)); if (getObjectRetType==Keys) return currentKey; else if (getObjectRetType==Values) return currentValue; else return new DictionaryEntry(currentKey, currentValue); } } public virtual Object Value { get { if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen)); return currentValue; } } public virtual void Reset() { if (version != hashtable.version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion)); current = false; bucket = hashtable.buckets.Length; currentKey = null; currentValue = null; } } // internal debug view class for hashtable internal class HashtableDebugView { private Hashtable hashtable; public HashtableDebugView( Hashtable hashtable) { if( hashtable == null) { throw new ArgumentNullException( "hashtable"); } Contract.EndContractBlock(); this.hashtable = hashtable; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public KeyValuePairs[] Items { get { return hashtable.ToKeyValuePairsArray(); } } } } [FriendAccessAllowed] internal static class HashHelpers { #if FEATURE_RANDOMIZED_STRING_HASHING public const int HashCollisionThreshold = 100; public static bool s_UseRandomizedStringHashing = String.UseRandomizedHashing(); #endif // Table of prime numbers to use as hash table sizes. // A typical resize algorithm would pick the smallest prime number in this array // that is larger than twice the previous capacity. // Suppose our Hashtable currently has capacity x and enough elements are added // such that a resize needs to occur. Resizing first computes 2x then finds the // first prime in the table greater than 2x, i.e. if primes are ordered // p_1, p_2, ..., p_i, ..., it finds p_n such that p_n-1 < 2x < p_n. // Doubling is important for preserving the asymptotic complexity of the // hashtable operations such as add. Having a prime guarantees that double // hashing does not lead to infinite loops. IE, your hash function will be // h1(key) + i*h2(key), 0 <= i < size. h2 and the size must be relatively prime. public static readonly int[] primes = { 3, 7, 11, 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, 631, 761, 919, 1103, 1327, 1597, 1931, 2333, 2801, 3371, 4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591, 17519, 21023, 25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363, 156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403, 968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559, 5999471, 7199369}; // Used by Hashtable and Dictionary's SeralizationInfo .ctor's to store the SeralizationInfo // object until OnDeserialization is called. private static ConditionalWeakTable<object, SerializationInfo> s_SerializationInfoTable; internal static ConditionalWeakTable<object, SerializationInfo> SerializationInfoTable { get { if(s_SerializationInfoTable == null) { ConditionalWeakTable<object, SerializationInfo> newTable = new ConditionalWeakTable<object, SerializationInfo>(); Interlocked.CompareExchange(ref s_SerializationInfoTable, newTable, null); } return s_SerializationInfoTable; } } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static bool IsPrime(int candidate) { if ((candidate & 1) != 0) { int limit = (int)Math.Sqrt (candidate); for (int divisor = 3; divisor <= limit; divisor+=2) { if ((candidate % divisor) == 0) return false; } return true; } return (candidate == 2); } [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static int GetPrime(int min) { if (min < 0) throw new ArgumentException(Environment.GetResourceString("Arg_HTCapacityOverflow")); Contract.EndContractBlock(); for (int i = 0; i < primes.Length; i++) { int prime = primes[i]; if (prime >= min) return prime; } //outside of our predefined table. //compute the hard way. for (int i = (min | 1); i < Int32.MaxValue;i+=2) { if (IsPrime(i) && ((i - 1) % Hashtable.HashPrime != 0)) return i; } return min; } public static int GetMinPrime() { return primes[0]; } // Returns size of hashtable to grow to. public static int ExpandPrime(int oldSize) { int newSize = 2 * oldSize; // Allow the hashtables to grow to maximum possible size (~2G elements) before encoutering capacity overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast if ((uint)newSize > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) { Contract.Assert( MaxPrimeArrayLength == GetPrime(MaxPrimeArrayLength), "Invalid MaxPrimeArrayLength"); return MaxPrimeArrayLength; } return GetPrime(newSize); } // This is the maximum prime smaller than Array.MaxArrayLength public const int MaxPrimeArrayLength = 0x7FEFFFFD; #if FEATURE_RANDOMIZED_STRING_HASHING public static bool IsWellKnownEqualityComparer(object comparer) { return (comparer == null || comparer == System.Collections.Generic.EqualityComparer<string>.Default || comparer is IWellKnownStringEqualityComparer); } public static IEqualityComparer GetRandomizedEqualityComparer(object comparer) { Contract.Assert(comparer == null || comparer == System.Collections.Generic.EqualityComparer<string>.Default || comparer is IWellKnownStringEqualityComparer); if(comparer == null) { return new System.Collections.Generic.RandomizedObjectEqualityComparer(); } if(comparer == System.Collections.Generic.EqualityComparer<string>.Default) { return new System.Collections.Generic.RandomizedStringEqualityComparer(); } IWellKnownStringEqualityComparer cmp = comparer as IWellKnownStringEqualityComparer; if(cmp != null) { return cmp.GetRandomizedEqualityComparer(); } Contract.Assert(false, "Missing case in GetRandomizedEqualityComparer!"); return null; } public static object GetEqualityComparerForSerialization(object comparer) { if(comparer == null) { return null; } IWellKnownStringEqualityComparer cmp = comparer as IWellKnownStringEqualityComparer; if(cmp != null) { return cmp.GetEqualityComparerForSerialization(); } return comparer; } private const int bufferSize = 1024; private static RandomNumberGenerator rng; private static byte[] data; private static int currentIndex = bufferSize; private static readonly object lockObj = new Object(); internal static long GetEntropy() { lock(lockObj) { long ret; if(currentIndex == bufferSize) { if(null == rng) { rng = RandomNumberGenerator.Create(); data = new byte[bufferSize]; Contract.Assert(bufferSize % 8 == 0, "We increment our current index by 8, so our buffer size must be a multiple of 8"); } rng.GetBytes(data); currentIndex = 0; } ret = BitConverter.ToInt64(data, currentIndex); currentIndex += 8; return ret; } } #endif // FEATURE_RANDOMIZED_STRING_HASHING } }
{ "content_hash": "e4989d710c543c30be4a83ba2c7a33e2", "timestamp": "", "source": "github", "line_count": 1842, "max_line_length": 224, "avg_line_length": 44.867535287730725, "alnum_prop": 0.5597488081697843, "repo_name": "sunandab/referencesource", "id": "6998dde77a95eb1444e9d58758d50e7c6812d0b8", "size": "82646", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "mscorlib/system/collections/hashtable.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "154937495" } ], "symlink_target": "" }
package pro.taskana.impl; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InOrder; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import pro.taskana.TaskState; import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaRole; import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.report.item.TaskQueryItem; import pro.taskana.mappings.TaskMonitorMapper; import pro.taskana.report.TaskStatusReport; /** Unit Test for TaskStatusReportBuilderImpl. */ @ExtendWith(MockitoExtension.class) class TaskStatusReportBuilderImplTest { @InjectMocks private TaskMonitorServiceImpl cut; @Mock private InternalTaskanaEngine internalTaskanaEngineMock; @Mock private TaskanaEngine taskanaEngineMock; @Mock private TaskMonitorMapper taskMonitorMapperMock; @BeforeEach void setup() { when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); } @Test void testGetTaskStateReportWithoutFilters() throws NotAuthorizedException, InvalidArgumentException { // given TaskQueryItem queryItem1 = new TaskQueryItem(); queryItem1.setCount(50); queryItem1.setState(TaskState.READY); queryItem1.setDomain("DOMAIN_X"); TaskQueryItem queryItem2 = new TaskQueryItem(); queryItem2.setCount(30); queryItem2.setState(TaskState.COMPLETED); queryItem2.setDomain("DOMAIN_X"); List<TaskQueryItem> queryItems = Arrays.asList(queryItem1, queryItem2); when(taskMonitorMapperMock.getTasksCountByState(null, null)).thenReturn(queryItems); // when final TaskStatusReport report = cut.createTaskStatusReportBuilder().buildReport(); // then InOrder inOrder = inOrder(taskanaEngineMock, internalTaskanaEngineMock, taskMonitorMapperMock); inOrder.verify(internalTaskanaEngineMock).getEngine(); inOrder.verify(taskanaEngineMock).checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); inOrder.verify(internalTaskanaEngineMock).openConnection(); inOrder.verify(taskMonitorMapperMock).getTasksCountByState(eq(null), eq(null)); inOrder.verify(internalTaskanaEngineMock).returnConnection(); inOrder.verifyNoMoreInteractions(); verifyNoMoreInteractions(taskanaEngineMock, internalTaskanaEngineMock, taskMonitorMapperMock); assertNotNull(report); assertEquals(1, report.rowSize()); assertArrayEquals(new int[] {50, 0, 30}, report.getRow("DOMAIN_X").getCells()); assertArrayEquals(new int[] {50, 0, 30}, report.getSumRow().getCells()); assertEquals(80, report.getRow("DOMAIN_X").getTotalValue()); assertEquals(80, report.getSumRow().getTotalValue()); } @Test void testGetTotalNumberOfTaskStateReport() throws NotAuthorizedException, InvalidArgumentException { // given TaskQueryItem queryItem1 = new TaskQueryItem(); queryItem1.setCount(50); queryItem1.setState(TaskState.READY); queryItem1.setDomain("DOMAIN_X"); TaskQueryItem queryItem2 = new TaskQueryItem(); queryItem2.setCount(30); queryItem2.setState(TaskState.COMPLETED); queryItem2.setDomain("DOMAIN_X"); List<TaskQueryItem> queryItems = Arrays.asList(queryItem1, queryItem2); when(taskMonitorMapperMock.getTasksCountByState(eq(null), eq(Collections.emptyList()))) .thenReturn(queryItems); // when final TaskStatusReport report = cut.createTaskStatusReportBuilder().stateIn(Collections.emptyList()).buildReport(); // then InOrder inOrder = inOrder(taskanaEngineMock, taskMonitorMapperMock, internalTaskanaEngineMock); inOrder.verify(internalTaskanaEngineMock).getEngine(); inOrder.verify(taskanaEngineMock).checkRoleMembership(TaskanaRole.MONITOR, TaskanaRole.ADMIN); inOrder.verify(internalTaskanaEngineMock).openConnection(); inOrder .verify(taskMonitorMapperMock) .getTasksCountByState(eq(null), eq(Collections.emptyList())); inOrder.verify(internalTaskanaEngineMock).returnConnection(); inOrder.verifyNoMoreInteractions(); verifyNoMoreInteractions(taskanaEngineMock, taskMonitorMapperMock, internalTaskanaEngineMock); assertNotNull(report); assertEquals(1, report.rowSize()); assertArrayEquals(new int[0], report.getRow("DOMAIN_X").getCells()); assertArrayEquals(new int[0], report.getSumRow().getCells()); assertEquals(80, report.getRow("DOMAIN_X").getTotalValue()); assertEquals(80, report.getSumRow().getTotalValue()); } }
{ "content_hash": "5d572bf8b752588458072450e2d51b33", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 99, "avg_line_length": 41.15447154471545, "alnum_prop": 0.7793362307388384, "repo_name": "BVier/Taskana", "id": "c3ec322ac3e37dcc7dea5aedc030d1f0d6867e3b", "size": "5062", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/taskana-core/src/test/java/pro/taskana/impl/TaskStatusReportBuilderImplTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4518" }, { "name": "CSS", "bytes": "38033" }, { "name": "HTML", "bytes": "487054" }, { "name": "Java", "bytes": "2683400" }, { "name": "JavaScript", "bytes": "3314" }, { "name": "PLpgSQL", "bytes": "297" }, { "name": "Shell", "bytes": "12175" }, { "name": "TSQL", "bytes": "353366" }, { "name": "TypeScript", "bytes": "407224" } ], "symlink_target": "" }
<div class="footer_inner"> <div>This is the footer</div> </div>
{ "content_hash": "a0015c5b1c71f8a8e0771fbd2c5e9c2d", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 30, "avg_line_length": 21.333333333333332, "alnum_prop": 0.671875, "repo_name": "devalejandro3/scheduler-app", "id": "36550383f25917d2e6d1a852686ae3307d8f44ba", "size": "64", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/views/layout/view_footer.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "10773" }, { "name": "JavaScript", "bytes": "34576" }, { "name": "PHP", "bytes": "1253117" } ], "symlink_target": "" }
@class SGFocusImageItem; @class SGFocusImageFrame; #pragma mark - SGFocusImageFrameDelegate @protocol SGFocusImageFrameDelegate <NSObject> - (void)foucusImageFrame:(SGFocusImageFrame *)imageFrame didSelectItem:(SGFocusImageItem *)item; @end @interface SGFocusImageFrame : UIView <UIGestureRecognizerDelegate, UIScrollViewDelegate> - (id)initWithFrame:(CGRect)frame delegate:(id<SGFocusImageFrameDelegate>)delegate focusImageItems:(SGFocusImageItem *)items, ... NS_REQUIRES_NIL_TERMINATION; @property (nonatomic, assign) id<SGFocusImageFrameDelegate> delegate; -(void)setViewsWithdelegate:(id<SGFocusImageFrameDelegate>)delegate focusImageItems:(SGFocusImageItem *)firstItem, ...NS_REQUIRES_NIL_TERMINATION; -(void)clickPageImage:(UIButton *)sender; @end
{ "content_hash": "70d9ab505836983c209413262b3ce3a9", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 158, "avg_line_length": 31.916666666666668, "alnum_prop": 0.8172323759791122, "repo_name": "yxqyrh/yaoxiecar", "id": "588bc9bd1a6a77064949ebdde606f48936ab9402", "size": "938", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "washcar/SGFocusImageFrame.h", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1366274" }, { "name": "C++", "bytes": "98860" }, { "name": "HTML", "bytes": "4555" }, { "name": "Objective-C", "bytes": "1417763" }, { "name": "Objective-C++", "bytes": "11780" }, { "name": "Ruby", "bytes": "269" } ], "symlink_target": "" }
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { CONST } from 'angular2/src/facade/lang'; /** * Creates a token that can be used in a DI Provider. * * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) * * ```typescript * var t = new OpaqueToken("value"); * * var injector = Injector.resolveAndCreate([ * provide(t, {useValue: "bindingValue"}) * ]); * * expect(injector.get(t)).toEqual("bindingValue"); * ``` * * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions * caused by multiple providers using the same string as two different tokens. * * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better * error messages. */ export let OpaqueToken = class OpaqueToken { constructor(_desc) { this._desc = _desc; } toString() { return `Token ${this._desc}`; } }; OpaqueToken = __decorate([ CONST(), __metadata('design:paramtypes', [String]) ], OpaqueToken);
{ "content_hash": "227ac41b6f5f62c0fd73fc26a419dec8", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 150, "avg_line_length": 43.073170731707314, "alnum_prop": 0.6268403171007928, "repo_name": "manojdobbala/angular2", "id": "43636b0e24e5fef6778c45cca6d734190298a523", "size": "1766", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "node_modules/angular2/es6/prod/src/core/di/opaque_token.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "152701" }, { "name": "HTML", "bytes": "5468" }, { "name": "JavaScript", "bytes": "13770" }, { "name": "TypeScript", "bytes": "15967" } ], "symlink_target": "" }
namespace HawtioOAuth { let userProfile: UserProfile = null; export function getUserProfile(): UserProfile { if (!userProfile) { log.debug("Finding 'userProfile' from the active OAuth plugin"); findUserProfile(); } return userProfile; } function findUserProfile(): void { let activePlugin = _.find(oauthPlugins, (plugin) => { let profile = Core.pathGet(window, [plugin, 'userProfile']); log.debug("Module:", plugin, "userProfile:", profile); return !_.isNil(profile); }); userProfile = Core.pathGet(window, [activePlugin, 'userProfile']); log.debug("Active OAuth plugin:", activePlugin); } export function getOAuthToken(): string { let userProfile = getUserProfile(); if (!userProfile) { return null; } return userProfile.token; } export function authenticatedHttpRequest(options): JQueryXHR { return $.ajax(_.extend(options, { beforeSend: (request) => { let token = getOAuthToken(); if (token) { request.setRequestHeader('Authorization', 'Bearer ' + token); } } })); } export function ajaxSetup(token: string): void { $.ajaxSetup({ beforeSend: xhr => xhr.setRequestHeader('Authorization', 'Bearer ' + token) }); } }
{ "content_hash": "3f13b189cf6e160054fde3257733eec9", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 81, "avg_line_length": 26.958333333333332, "alnum_prop": 0.6282843894899537, "repo_name": "hawtio/hawtio-oauth", "id": "4f1792beea893546bb97aadf6fbf3f8f93b16e73", "size": "1336", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "plugins/oauth.helper.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "11717" }, { "name": "JavaScript", "bytes": "7421" }, { "name": "TypeScript", "bytes": "54377" } ], "symlink_target": "" }
/*global describe, it, beforeEach*/ 'use strict'; var assert = require('assert'); var ArgumentParser = require('../lib/argparse').ArgumentParser; describe('ArgumentParser', function () { describe('sub-commands', function () { var parser; var args; var c1; var c2; beforeEach(function () { parser = new ArgumentParser({debug: true}); var subparsers = parser.addSubparsers({ title: 'subcommands', dest: 'subcommand_name' }); c1 = subparsers.addParser('c1', {aliases: ['co']}); c1.addArgument([ '-f', '--foo' ], {}); c1.addArgument([ '-b', '--bar' ], {}); c2 = subparsers.addParser('c2', {}); c2.addArgument([ '--baz' ], {}); }); it("should store command name", function () { args = parser.parseArgs('c1 --foo 5'.split(' ')); assert.equal(args.subcommand_name, 'c1'); }); it("should store command arguments", function () { args = parser.parseArgs('c1 --foo 5 -b4'.split(' ')); assert.equal(args.foo, 5); assert.equal(args.bar, 4); }); it("should have same behavior for alias and original command", function () { args = parser.parseArgs('c1 --foo 5 -b4'.split(' ')); var aliasArgs = parser.parseArgs('co --foo 5 -b4'.split(' ')); assert.equal(args.foo, aliasArgs.foo); assert.equal(args.bar, aliasArgs.bar); }); it("should have different behavior for different commands", function () { assert.doesNotThrow(function () { parser.parseArgs('c1 --foo 5 -b4'.split(' ')); }); assert.throws(function () { parser.parseArgs('c2 --foo 5 -b4'.split(' ')); }); assert.doesNotThrow(function () { parser.parseArgs('c2 --baz 1'.split(' ')); }); assert.throws(function () { parser.parseArgs('c1 --baz 1'.split(' ')); }); }); it("should drop down with 'Invalid choice' error if parse unrecognized command", function () { assert.throws( function () {parser.parseArgs('command --baz 1'.split(' ')); }, /Invalid choice:/ ); }); it("should drop down with empty args ('too few arguments' error)", function () { assert.throws( function () {parser.parseArgs([]); }, /too few arguments/ ); }); it("should support #setDefaults", function () { c1.setDefaults({spam: 1}); c2.setDefaults({eggs: 2}); args = parser.parseArgs(['c1']); assert.equal(args.spam, 1); assert.strictEqual(args.eggs, undefined); args = parser.parseArgs(['c2']); assert.equal(args.eggs, 2); assert.strictEqual(args.spam, undefined); }); }); });
{ "content_hash": "dbe45a973f2023b4a0211f01433417cf", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 98, "avg_line_length": 30.511363636363637, "alnum_prop": 0.5661080074487895, "repo_name": "juliema/PhyloGeoTastic", "id": "1037cc587b9aaa5c43a5604170c78ab6c4fae58a", "size": "2685", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "js/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/test/sub_commands.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "855598" }, { "name": "PHP", "bytes": "53839" }, { "name": "Perl", "bytes": "15943" }, { "name": "Python", "bytes": "2028" } ], "symlink_target": "" }
package agent import ( "crypto/tls" "encoding/json" "errors" "fmt" "io/ioutil" "net" "net/http" "strings" "time" "github.com/outbrain/golib/log" "github.com/outbrain/golib/sqlutils" "github.com/outbrain/orchestrator/go/config" "github.com/outbrain/orchestrator/go/db" "github.com/outbrain/orchestrator/go/inst" ) var SeededAgents chan *Agent = make(chan *Agent) var httpTimeout = time.Duration(time.Duration(config.Config.HttpTimeoutSeconds) * time.Second) func dialTimeout(network, addr string) (net.Conn, error) { return net.DialTimeout(network, addr, httpTimeout) } var httpTransport = &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: config.Config.SSLSkipVerify}, Dial: dialTimeout, ResponseHeaderTimeout: httpTimeout, } var httpClient = &http.Client{Transport: httpTransport} // httpGet is a convenience method for getting http response from URL, optionaly skipping SSL cert verification func httpGet(url string) (resp *http.Response, err error) { return httpClient.Get(url) } // AuditAgentOperation creates and writes a new audit entry by given agent func auditAgentOperation(auditType string, agent *Agent, message string) error { instanceKey := &inst.InstanceKey{} if agent != nil { instanceKey = &inst.InstanceKey{Hostname: agent.Hostname, Port: int(agent.MySQLPort)} } return inst.AuditOperation(auditType, instanceKey, message) } // readResponse returns the body of an HTTP response func readResponse(res *http.Response, err error) ([]byte, error) { if err != nil { return nil, err } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { return nil, err } if res.Status == "500" { return body, errors.New("Response Status 500") } return body, nil } // SubmitAgent submits a new agent for listing func SubmitAgent(hostname string, port int, token string) (string, error) { db, err := db.OpenOrchestrator() if err != nil { return "", log.Errore(err) } _, err = sqlutils.Exec(db, ` replace into host_agent ( hostname, port, token, last_submitted ) VALUES ( ?, ?, ?, NOW() ) `, hostname, port, token, ) if err != nil { return "", log.Errore(err) } return hostname, err } // ForgetLongUnseenAgents will remove entries of all agents that have long since been last seen. func ForgetLongUnseenAgents() error { db, err := db.OpenOrchestrator() if err != nil { return log.Errore(err) } _, err = sqlutils.Exec(db, ` delete from host_agent where last_submitted < NOW() - interval ? hour`, config.Config.UnseenAgentForgetHours, ) return err } // ReadOutdatedAgentsHosts returns agents that need to be updated func ReadOutdatedAgentsHosts() ([]string, error) { res := []string{} query := fmt.Sprintf(` select hostname from host_agent where IFNULL(last_checked < now() - interval %d minute, true) `, config.Config.AgentPollMinutes) db, err := db.OpenOrchestrator() if err != nil { goto Cleanup } err = sqlutils.QueryRowsMap(db, query, func(m sqlutils.RowMap) error { hostname := m.GetString("hostname") res = append(res, hostname) return nil }) Cleanup: if err != nil { log.Errore(err) } return res, err } // ReadAgents returns a list of all known agents func ReadAgents() ([]Agent, error) { res := []Agent{} query := ` select hostname, port, token, last_submitted, mysql_port from host_agent order by hostname ` db, err := db.OpenOrchestrator() if err != nil { goto Cleanup } err = sqlutils.QueryRowsMap(db, query, func(m sqlutils.RowMap) error { agent := Agent{} agent.Hostname = m.GetString("hostname") agent.Port = m.GetInt("port") agent.MySQLPort = m.GetInt64("mysql_port") agent.Token = "" agent.LastSubmitted = m.GetString("last_submitted") res = append(res, agent) return nil }) Cleanup: if err != nil { log.Errore(err) } return res, err } // readAgentBasicInfo returns the basic data for an agent directly from backend table (no agent access) func readAgentBasicInfo(hostname string) (Agent, string, error) { agent := Agent{} token := "" query := fmt.Sprintf(` select hostname, port, token, last_submitted, mysql_port from host_agent where hostname = '%s' `, hostname) db, err := db.OpenOrchestrator() if err != nil { return agent, "", err } err = sqlutils.QueryRowsMap(db, query, func(m sqlutils.RowMap) error { agent.Hostname = m.GetString("hostname") agent.Port = m.GetInt("port") agent.LastSubmitted = m.GetString("last_submitted") agent.MySQLPort = m.GetInt64("mysql_port") token = m.GetString("token") return nil }) if token == "" { return agent, "", log.Errorf("Cannot get agent/token: %s", hostname) } return agent, token, nil } // UpdateAgentLastChecked updates the last_check timestamp in the orchestrator backed database // for a given agent func UpdateAgentLastChecked(hostname string) error { db, err := db.OpenOrchestrator() if err != nil { return log.Errore(err) } _, err = sqlutils.Exec(db, ` update host_agent set last_checked = NOW() where hostname = ?`, hostname, ) if err != nil { return log.Errore(err) } return nil } // UpdateAgentInfo updates some agent state in backend table func UpdateAgentInfo(hostname string, agent Agent) error { db, err := db.OpenOrchestrator() if err != nil { return log.Errore(err) } _, err = sqlutils.Exec(db, ` update host_agent set last_seen = NOW(), mysql_port = ?, count_mysql_snapshots = ? where hostname = ?`, agent.MySQLPort, len(agent.LogicalVolumes), hostname, ) if err != nil { return log.Errore(err) } return nil } // baseAgentUri returns the base URI for accessing an agent func baseAgentUri(agentHostname string, agentPort int) string { protocol := "http" if config.Config.AgentsUseSSL { protocol = "https" } uri := fmt.Sprintf("%s://%s:%d/api", protocol, agentHostname, agentPort) log.Debugf("orchestrator-agent uri: %s", uri) return uri } // GetAgent gets a single agent status from the agent service. This involves multiple HTTP requests. func GetAgent(hostname string) (Agent, error) { agent, token, err := readAgentBasicInfo(hostname) if err != nil { return agent, log.Errore(err) } // All seems to be in order. Now make some inquiries from orchestrator-agent service: { uri := baseAgentUri(agent.Hostname, agent.Port) log.Debugf("orchestrator-agent uri: %s", uri) { availableLocalSnapshotsUri := fmt.Sprintf("%s/available-snapshots-local?token=%s", uri, token) body, err := readResponse(httpGet(availableLocalSnapshotsUri)) if err == nil { err = json.Unmarshal(body, &agent.AvailableLocalSnapshots) } if err != nil { log.Errore(err) } } { availableSnapshotsUri := fmt.Sprintf("%s/available-snapshots?token=%s", uri, token) body, err := readResponse(httpGet(availableSnapshotsUri)) if err == nil { err = json.Unmarshal(body, &agent.AvailableSnapshots) } if err != nil { log.Errore(err) } } { lvSnapshotsUri := fmt.Sprintf("%s/lvs-snapshots?token=%s", uri, token) body, err := readResponse(httpGet(lvSnapshotsUri)) if err == nil { err = json.Unmarshal(body, &agent.LogicalVolumes) } if err != nil { log.Errore(err) } } { mountUri := fmt.Sprintf("%s/mount?token=%s", uri, token) body, err := readResponse(httpGet(mountUri)) if err == nil { err = json.Unmarshal(body, &agent.MountPoint) } if err != nil { log.Errore(err) } } { mySQLRunningUri := fmt.Sprintf("%s/mysql-status?token=%s", uri, token) body, err := readResponse(httpGet(mySQLRunningUri)) if err == nil { err = json.Unmarshal(body, &agent.MySQLRunning) } // Actually an error is OK here since "status" returns with non-zero exit code when MySQL not running } { mySQLRunningUri := fmt.Sprintf("%s/mysql-port?token=%s", uri, token) body, err := readResponse(httpGet(mySQLRunningUri)) if err == nil { err = json.Unmarshal(body, &agent.MySQLPort) } if err != nil { log.Errore(err) } } { mySQLDiskUsageUri := fmt.Sprintf("%s/mysql-du?token=%s", uri, token) body, err := readResponse(httpGet(mySQLDiskUsageUri)) if err == nil { err = json.Unmarshal(body, &agent.MySQLDiskUsage) } if err != nil { log.Errore(err) } } { mySQLDatadirDiskFreeUri := fmt.Sprintf("%s/mysql-datadir-available-space?token=%s", uri, token) body, err := readResponse(httpGet(mySQLDatadirDiskFreeUri)) if err == nil { err = json.Unmarshal(body, &agent.MySQLDatadirDiskFree) } if err != nil { log.Errore(err) } } { errorLogTailUri := fmt.Sprintf("%s/mysql-error-log-tail?token=%s", uri, token) body, err := readResponse(httpGet(errorLogTailUri)) if err == nil { err = json.Unmarshal(body, &agent.MySQLErrorLogTail) } if err != nil { log.Errore(err) } } } return agent, err } // executeAgentCommand requests an agent to execute a command via HTTP api func executeAgentCommand(hostname string, command string, onResponse *func([]byte)) (Agent, error) { agent, token, err := readAgentBasicInfo(hostname) if err != nil { return agent, err } // All seems to be in order. Now make some inquiries from orchestrator-agent service: uri := baseAgentUri(agent.Hostname, agent.Port) var fullCommand string if strings.Contains(command, "?") { fullCommand = fmt.Sprintf("%s&token=%s", command, token) } else { fullCommand = fmt.Sprintf("%s?token=%s", command, token) } log.Debugf("orchestrator-agent command: %s", fullCommand) agentCommandUri := fmt.Sprintf("%s/%s", uri, fullCommand) body, err := readResponse(httpGet(agentCommandUri)) if err != nil { return agent, log.Errore(err) } if onResponse != nil { (*onResponse)(body) } auditAgentOperation("agent-command", &agent, command) return agent, err } // Unmount unmounts the designated snapshot mount point func Unmount(hostname string) (Agent, error) { return executeAgentCommand(hostname, "umount", nil) } // MountLV requests an agent to mount the given volume on the designated mount point func MountLV(hostname string, lv string) (Agent, error) { return executeAgentCommand(hostname, fmt.Sprintf("mountlv?lv=%s", lv), nil) } // RemoveLV requests an agent to remvoe a snapshot func RemoveLV(hostname string, lv string) (Agent, error) { return executeAgentCommand(hostname, fmt.Sprintf("removelv?lv=%s", lv), nil) } // CreateSnapshot requests an agent to create a new snapshot -- a DIY implementation func CreateSnapshot(hostname string) (Agent, error) { return executeAgentCommand(hostname, "create-snapshot", nil) } // deleteMySQLDatadir requests an agent to purge the MySQL data directory (step before seed) func deleteMySQLDatadir(hostname string) (Agent, error) { return executeAgentCommand(hostname, "delete-mysql-datadir", nil) } // MySQLStop requests an agent to stop MySQL service func MySQLStop(hostname string) (Agent, error) { return executeAgentCommand(hostname, "mysql-stop", nil) } // MySQLStart requests an agent to start the MySQL service func MySQLStart(hostname string) (Agent, error) { return executeAgentCommand(hostname, "mysql-start", nil) } // ReceiveMySQLSeedData requests an agent to start listening for incoming seed data func ReceiveMySQLSeedData(hostname string, seedId int64) (Agent, error) { return executeAgentCommand(hostname, fmt.Sprintf("receive-mysql-seed-data/%d", seedId), nil) } // ReceiveMySQLSeedData requests an agent to start sending seed data func SendMySQLSeedData(hostname string, targetHostname string, seedId int64) (Agent, error) { return executeAgentCommand(hostname, fmt.Sprintf("send-mysql-seed-data/%s/%d", targetHostname, seedId), nil) } // ReceiveMySQLSeedData requests an agent to abort seed send/receive (depending on the agent's role) func AbortSeedCommand(hostname string, seedId int64) (Agent, error) { return executeAgentCommand(hostname, fmt.Sprintf("abort-seed/%d", seedId), nil) } // seedCommandCompleted checks an agent to see if it thinks a seed was completed. func seedCommandCompleted(hostname string, seedId int64) (Agent, bool, error) { result := false onResponse := func(body []byte) { json.Unmarshal(body, &result) } agent, err := executeAgentCommand(hostname, fmt.Sprintf("seed-command-completed/%d", seedId), &onResponse) return agent, result, err } // seedCommandCompleted checks an agent to see if it thinks a seed was successful. func seedCommandSucceeded(hostname string, seedId int64) (Agent, bool, error) { result := false onResponse := func(body []byte) { json.Unmarshal(body, &result) } agent, err := executeAgentCommand(hostname, fmt.Sprintf("seed-command-succeeded/%d", seedId), &onResponse) return agent, result, err } // AbortSeed will contact agents associated with a seed and request abort. func AbortSeed(seedId int64) error { seedOperations, err := AgentSeedDetails(seedId) if err != nil { return log.Errore(err) } for _, seedOperation := range seedOperations { AbortSeedCommand(seedOperation.TargetHostname, seedId) AbortSeedCommand(seedOperation.SourceHostname, seedId) } updateSeedComplete(seedId, errors.New("Aborted")) return nil } // PostCopy will request an agent to invoke post-copy commands func PostCopy(hostname string) (Agent, error) { return executeAgentCommand(hostname, "post-copy", nil) } // SubmitSeedEntry submits a new seed operation entry, returning its unique ID func SubmitSeedEntry(targetHostname string, sourceHostname string) (int64, error) { db, err := db.OpenOrchestrator() if err != nil { return 0, log.Errore(err) } res, err := sqlutils.Exec(db, ` insert into agent_seed ( target_hostname, source_hostname, start_timestamp ) VALUES ( ?, ?, NOW() ) `, targetHostname, sourceHostname, ) if err != nil { return 0, log.Errore(err) } id, err := res.LastInsertId() return id, err } // updateSeedComplete updates the seed entry, signing for completion func updateSeedComplete(seedId int64, seedError error) error { db, err := db.OpenOrchestrator() if err != nil { return log.Errore(err) } _, err = sqlutils.Exec(db, ` update agent_seed set end_timestamp = NOW(), is_complete = 1, is_successful = ? where agent_seed_id = ? `, (seedError == nil), seedId, ) if err != nil { return log.Errore(err) } return nil } // submitSeedStateEntry submits a seed state: a single step in the overall seed process func submitSeedStateEntry(seedId int64, action string, errorMessage string) (int64, error) { db, err := db.OpenOrchestrator() if err != nil { return 0, log.Errore(err) } res, err := sqlutils.Exec(db, ` insert into agent_seed_state ( agent_seed_id, state_timestamp, state_action, error_message ) VALUES ( ?, NOW(), ?, ? ) `, seedId, action, errorMessage, ) if err != nil { return 0, log.Errore(err) } id, err := res.LastInsertId() return id, err } // updateSeedStateEntry updates seed step state func updateSeedStateEntry(seedStateId int64, reason error) error { db, err := db.OpenOrchestrator() if err != nil { return log.Errore(err) } _, err = sqlutils.Exec(db, ` update agent_seed_state set error_message = ? where agent_seed_state_id = ? `, reason.Error(), seedStateId, ) if err != nil { return log.Errore(err) } return reason } // FailStaleSeeds marks as failed seeds where no progress have been seen recently func FailStaleSeeds() error { db, err := db.OpenOrchestrator() if err != nil { return log.Errore(err) } _, err = sqlutils.Exec(db, ` update agent_seed set is_complete=1, is_successful=0 where is_complete=0 and ( select max(state_timestamp) as last_state_timestamp from agent_seed_state where agent_seed.agent_seed_id = agent_seed_state.agent_seed_id ) < now() - interval ? minute`, config.Config.StaleSeedFailMinutes, ) return err } // executeSeed is *the* function for taking a seed. It is a complex operation of testing, preparing, re-testing // agents on both sides, initiating data transfer, following up, awaiting completion, diagnosing errors, claning up. func executeSeed(seedId int64, targetHostname string, sourceHostname string) error { var err error var seedStateId int64 seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("getting target agent info for %s", targetHostname), "") targetAgent, err := GetAgent(targetHostname) SeededAgents <- &targetAgent if err != nil { return updateSeedStateEntry(seedStateId, err) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("getting source agent info for %s", sourceHostname), "") sourceAgent, err := GetAgent(sourceHostname) if err != nil { return updateSeedStateEntry(seedStateId, err) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Checking MySQL status on target %s", targetHostname), "") if targetAgent.MySQLRunning { return updateSeedStateEntry(seedStateId, errors.New("MySQL is running on target host. Cowardly refusing to proceeed. Please stop the MySQL service")) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Looking up available snapshots on source %s", sourceHostname), "") if len(sourceAgent.LogicalVolumes) == 0 { return updateSeedStateEntry(seedStateId, errors.New("No logical volumes found on source host")) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Checking mount point on source %s", sourceHostname), "") if sourceAgent.MountPoint.IsMounted { return updateSeedStateEntry(seedStateId, errors.New("Volume already mounted on source host; please unmount")) } seedFromLogicalVolume := sourceAgent.LogicalVolumes[0] seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Mounting logical volume: %s", seedFromLogicalVolume.Path), "") _, err = MountLV(sourceHostname, seedFromLogicalVolume.Path) if err != nil { return updateSeedStateEntry(seedStateId, err) } sourceAgent, err = GetAgent(sourceHostname) seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("MySQL data volume on source host %s is %d bytes", sourceHostname, sourceAgent.MountPoint.MySQLDiskUsage), "") seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Erasing MySQL data on %s", targetHostname), "") _, err = deleteMySQLDatadir(targetHostname) if err != nil { return updateSeedStateEntry(seedStateId, err) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Aquiring target host datadir free space on %s", targetHostname), "") targetAgent, err = GetAgent(targetHostname) if err != nil { return updateSeedStateEntry(seedStateId, err) } if sourceAgent.MountPoint.MySQLDiskUsage > targetAgent.MySQLDatadirDiskFree { Unmount(sourceHostname) return updateSeedStateEntry(seedStateId, fmt.Errorf("Not enough disk space on target host %s. Required: %d, available: %d. Bailing out.", targetHostname, sourceAgent.MountPoint.MySQLDiskUsage, targetAgent.MySQLDatadirDiskFree)) } // ... seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("%s will now receive data in background", targetHostname), "") ReceiveMySQLSeedData(targetHostname, seedId) seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Waiting some time for %s to start listening for incoming data", targetHostname), "") time.Sleep(2 * time.Second) seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("%s will now send data to %s in background", sourceHostname, targetHostname), "") SendMySQLSeedData(sourceHostname, targetHostname, seedId) copyComplete := false numStaleIterations := 0 var bytesCopied int64 = 0 for !copyComplete { targetAgentPoll, err := GetAgent(targetHostname) if err != nil { return log.Errore(err) } if targetAgentPoll.MySQLDiskUsage == bytesCopied { numStaleIterations++ } bytesCopied = targetAgentPoll.MySQLDiskUsage copyFailed := false if _, commandCompleted, _ := seedCommandCompleted(targetHostname, seedId); commandCompleted { copyComplete = true if _, commandSucceeded, _ := seedCommandSucceeded(targetHostname, seedId); !commandSucceeded { // failed. copyFailed = true } } if numStaleIterations > 10 { copyFailed = true } if copyFailed { AbortSeedCommand(sourceHostname, seedId) AbortSeedCommand(targetHostname, seedId) Unmount(sourceHostname) return updateSeedStateEntry(seedStateId, errors.New("10 iterations have passed without progress. Bailing out.")) } var copyPct int64 = 0 if sourceAgent.MountPoint.MySQLDiskUsage > 0 { copyPct = 100 * bytesCopied / sourceAgent.MountPoint.MySQLDiskUsage } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Copied %d/%d bytes (%d%%)", bytesCopied, sourceAgent.MountPoint.MySQLDiskUsage, copyPct), "") if !copyComplete { time.Sleep(30 * time.Second) } } // Cleanup: seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Executing post-copy command on %s", targetHostname), "") _, err = PostCopy(targetHostname) if err != nil { return updateSeedStateEntry(seedStateId, err) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Unmounting logical volume: %s", seedFromLogicalVolume.Path), "") _, err = Unmount(sourceHostname) if err != nil { return updateSeedStateEntry(seedStateId, err) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Starting MySQL on target: %s", targetHostname), "") _, err = MySQLStart(targetHostname) if err != nil { return updateSeedStateEntry(seedStateId, err) } seedStateId, _ = submitSeedStateEntry(seedId, fmt.Sprintf("Submitting MySQL instance for discovery: %s", targetHostname), "") SeededAgents <- &targetAgent seedStateId, _ = submitSeedStateEntry(seedId, "Done", "") return nil } // Seed is the entry point for making a seed func Seed(targetHostname string, sourceHostname string) (int64, error) { if targetHostname == sourceHostname { return 0, log.Errorf("Cannot seed %s onto itself", targetHostname) } seedId, err := SubmitSeedEntry(targetHostname, sourceHostname) if err != nil { return 0, log.Errore(err) } go func() { err := executeSeed(seedId, targetHostname, sourceHostname) updateSeedComplete(seedId, err) }() return seedId, nil } // readSeeds reads seed from the backend table func readSeeds(whereCondition string, limit string) ([]SeedOperation, error) { res := []SeedOperation{} query := fmt.Sprintf(` select agent_seed_id, target_hostname, source_hostname, start_timestamp, end_timestamp, is_complete, is_successful from agent_seed %s order by agent_seed_id desc %s `, whereCondition, limit) db, err := db.OpenOrchestrator() if err != nil { goto Cleanup } err = sqlutils.QueryRowsMap(db, query, func(m sqlutils.RowMap) error { seedOperation := SeedOperation{} seedOperation.SeedId = m.GetInt64("agent_seed_id") seedOperation.TargetHostname = m.GetString("target_hostname") seedOperation.SourceHostname = m.GetString("source_hostname") seedOperation.StartTimestamp = m.GetString("start_timestamp") seedOperation.EndTimestamp = m.GetString("end_timestamp") seedOperation.IsComplete = m.GetBool("is_complete") seedOperation.IsSuccessful = m.GetBool("is_successful") res = append(res, seedOperation) return nil }) Cleanup: if err != nil { log.Errore(err) } return res, err } // ReadActiveSeedsForHost reads active seeds where host participates either as source or target func ReadActiveSeedsForHost(hostname string) ([]SeedOperation, error) { whereCondition := fmt.Sprintf(` where is_complete = 0 and ( target_hostname = '%s' or source_hostname = '%s' ) `, hostname, hostname) return readSeeds(whereCondition, "") } // ReadRecentCompletedSeedsForHost reads active seeds where host participates either as source or target func ReadRecentCompletedSeedsForHost(hostname string) ([]SeedOperation, error) { whereCondition := fmt.Sprintf(` where is_complete = 1 and ( target_hostname = '%s' or source_hostname = '%s' ) `, hostname, hostname) return readSeeds(whereCondition, "limit 10") } // AgentSeedDetails reads details from backend table func AgentSeedDetails(seedId int64) ([]SeedOperation, error) { whereCondition := fmt.Sprintf(` where agent_seed_id = %d `, seedId) return readSeeds(whereCondition, "") } // ReadRecentSeeds reads seeds from backend table. func ReadRecentSeeds() ([]SeedOperation, error) { return readSeeds("", "limit 100") } // SeedOperationState reads states for a given seed operation func ReadSeedStates(seedId int64) ([]SeedOperationState, error) { res := []SeedOperationState{} query := fmt.Sprintf(` select agent_seed_state_id, agent_seed_id, state_timestamp, state_action, error_message from agent_seed_state where agent_seed_id = %d order by agent_seed_state_id desc `, seedId) db, err := db.OpenOrchestrator() if err != nil { goto Cleanup } err = sqlutils.QueryRowsMap(db, query, func(m sqlutils.RowMap) error { seedState := SeedOperationState{} seedState.SeedStateId = m.GetInt64("agent_seed_state_id") seedState.SeedId = m.GetInt64("agent_seed_id") seedState.StateTimestamp = m.GetString("state_timestamp") seedState.Action = m.GetString("state_action") seedState.ErrorMessage = m.GetString("error_message") res = append(res, seedState) return nil }) Cleanup: if err != nil { log.Errore(err) } return res, err }
{ "content_hash": "c3c62aa19f65ca1497708e0a56ec90af", "timestamp": "", "source": "github", "line_count": 924, "max_line_length": 229, "avg_line_length": 27.79004329004329, "alnum_prop": 0.703832074149077, "repo_name": "tsheasha/orchestrator", "id": "fe63ca78f276be4954327255e7d95e5b9c273753", "size": "26267", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "go/agent/agent_dao.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "7866" }, { "name": "Go", "bytes": "505365" }, { "name": "JavaScript", "bytes": "124530" }, { "name": "Shell", "bytes": "3595" } ], "symlink_target": "" }
import { Random } from 'meteor/random'; import { getRoom } from '../../../livechat/server/api/lib/livechat'; import { Livechat } from '../../../livechat/server/lib/Livechat'; import LivechatRooms from '../../../models/server/models/LivechatRooms'; import LivechatVisitors from '../../../models/server/models/LivechatVisitors'; import LivechatDepartment from '../../../models/server/models/LivechatDepartment'; import Users from '../../../models/server/models/Users'; export class AppLivechatBridge { constructor(orch) { this.orch = orch; } isOnline(department) { return Livechat.online(department); } async isOnlineAsync(department) { return Livechat.online(department); } async createMessage(message, appId) { this.orch.debugLog(`The App ${ appId } is creating a new message.`); if (!message.token) { throw new Error('Invalid token for livechat message'); } const data = { guest: this.orch.getConverters().get('visitors').convertAppVisitor(message.visitor), message: this.orch.getConverters().get('messages').convertAppMessage(message), }; const msg = await Livechat.sendMessage(data); return msg._id; } async getMessageById(messageId, appId) { this.orch.debugLog(`The App ${ appId } is getting the message: "${ messageId }"`); return this.orch.getConverters().get('messages').convertById(messageId); } async updateMessage(message, appId) { this.orch.debugLog(`The App ${ appId } is updating a message.`); const data = { guest: message.visitor, message: this.orch.getConverters().get('messages').convertAppMessage(message), }; Livechat.updateMessage(data); } async createRoom(visitor, agent, appId) { this.orch.debugLog(`The App ${ appId } is creating a livechat room.`); let agentRoom; if (agent && agent.id) { const user = Users.getAgentInfo(agent.id); agentRoom = Object.assign({}, { agentId: user._id }); } const result = await getRoom({ guest: this.orch.getConverters().get('visitors').convertAppVisitor(visitor), agent: agentRoom, rid: Random.id(), }); return this.orch.getConverters().get('rooms').convertRoom(result.room); } async closeRoom(room, comment, appId) { this.orch.debugLog(`The App ${ appId } is closing a livechat room.`); return Livechat.closeRoom({ visitor: this.orch.getConverters().get('visitors').convertAppVisitor(room.visitor), room: this.orch.getConverters().get('rooms').convertAppRoom(room), comment, }); } async findRooms(visitor, departmentId, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat visitors.`); if (!visitor) { return []; } let result; if (departmentId) { result = LivechatRooms.findOpenByVisitorTokenAndDepartmentId(visitor.token, departmentId).fetch(); } else { result = LivechatRooms.findOpenByVisitorToken(visitor.token).fetch(); } return result.map((room) => this.orch.getConverters().get('rooms').convertRoom(room)); } async createVisitor(visitor, appId) { this.orch.debugLog(`The App ${ appId } is creating a livechat visitor.`); const registerData = { department: visitor.department, username: visitor.username, name: visitor.name, token: visitor.token, }; if (visitor.visitorEmails && visitor.visitorEmails.length) { registerData.email = visitor.visitorEmails[0].address; } if (visitor.phone && visitor.phone.length) { registerData.phone = { number: visitor.phone[0].phoneNumber }; } return Livechat.registerGuest(registerData); } async transferVisitor(visitor, transferData, appId) { this.orch.debugLog(`The App ${ appId } is transfering a livechat.`); if (!visitor) { throw new Error('Invalid visitor, cannot transfer'); } const { targetAgent, targetDepartment: departmentId, currentRoom, } = transferData; return Livechat.transfer( this.orch.getConverters().get('rooms').convertAppRoom(currentRoom), this.orch.getConverters().get('visitors').convertAppVisitor(visitor), { userId: targetAgent.id, departmentId }, ); } async findVisitors(query, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat visitors.`); if (this.orch.isDebugging()) { console.warn('The method AppLivechatBridge.findVisitors is deprecated. Please consider using its alternatives'); } return LivechatVisitors.find(query).fetch().map((visitor) => this.orch.getConverters().get('visitors').convertVisitor(visitor)); } async findVisitorById(id, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat visitors.`); return this.orch.getConverters().get('visitors').convertById(id); } async findVisitorByEmail(email, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat visitors.`); return this.orch.getConverters().get('visitors').convertVisitor(LivechatVisitors.findOneGuestByEmailAddress(email)); } async findVisitorByToken(token, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat visitors.`); return this.orch.getConverters().get('visitors').convertVisitor(LivechatVisitors.getVisitorByToken(token)); } async findVisitorByPhoneNumber(phoneNumber, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat visitors.`); return this.orch.getConverters().get('visitors').convertVisitor(LivechatVisitors.findOneVisitorByPhone(phoneNumber)); } async findDepartmentByIdOrName(value, appId) { this.orch.debugLog(`The App ${ appId } is looking for livechat departments.`); return this.orch.getConverters().get('departments').convertDepartment(LivechatDepartment.findOneByIdOrName(value)); } }
{ "content_hash": "b9e869e800a4fcde23f54ae4deea4dd1", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 130, "avg_line_length": 30.69945355191257, "alnum_prop": 0.7148451406194375, "repo_name": "subesokun/Rocket.Chat", "id": "4e8a1103f243bd8a155b19b2d6b1a312b69551f0", "size": "5618", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "app/apps/server/bridges/livechat.js", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "549" }, { "name": "CSS", "bytes": "397150" }, { "name": "Cap'n Proto", "bytes": "3960" }, { "name": "CoffeeScript", "bytes": "30843" }, { "name": "Dockerfile", "bytes": "1874" }, { "name": "HTML", "bytes": "443704" }, { "name": "JavaScript", "bytes": "4470036" }, { "name": "Ruby", "bytes": "4653" }, { "name": "Shell", "bytes": "32549" }, { "name": "Standard ML", "bytes": "1843" } ], "symlink_target": "" }
Symfony Standard Edition ======================== Welcome to the Symfony Standard Edition - a fully-functional Symfony2 application that you can use as the skeleton for your new app. If you want to learn more about the features included, see the "What's Inside?" section. This document contains information on how to download and start using Symfony. For a more detailed explanation, see the [Installation chapter](http://symfony.com/doc/current/book/installation.html) of the Symfony Documentation. 1) Download the Standard Edition -------------------------------- If you've already downloaded the standard edition, and unpacked it somewhere within your web root directory, then move on to the "Installation" section. To download the standard edition, you have two options: ### Download an archive file (*recommended*) The easiest way to get started is to download an archive of the standard edition (http://symfony.com/download). Unpack it somewhere under your web server root directory and you're done. The web root is wherever your web server (e.g. Apache) looks when you access `http://localhost` in a browser. ### Clone the git Repository We highly recommend that you download the packaged version of this distribution. But if you still want to use Git, you are on your own. Run the following commands: git clone http://github.com/symfony/symfony-standard.git cd symfony-standard rm -rf .git 2) Installation --------------- Once you've downloaded the standard edition, installation is easy, and basically involves making sure your system is ready for Symfony. ### a) Check your System Configuration Before you begin, make sure that your local system is properly configured for Symfony. To do this, execute the following: php app/check.php If you get any warnings or recommendations, fix these now before moving on. ### b) Install the Vendor Libraries If you downloaded the archive "without vendors" or installed via git, then you need to download all of the necessary vendor libraries. If you're not sure if you need to do this, check to see if you have a ``vendor/`` directory. If you don't, or if that directory is empty, run the following: php bin/vendors install Note that you **must** have git installed and be able to execute the `git` command to execute this script. If you don't have git available, either install it or download Symfony with the vendor libraries already included. ### c) Access the Application via the Browser Congratulations! You're now ready to use Symfony. If you've unzipped Symfony in the web root of your computer, then you should be able to access the web version of the Symfony requirements check via: http://localhost/symfony-swganh/web/config.php If everything looks good, click the "Bypass configuration and go to the Welcome page" link to load up your first Symfony page. You can also use a web-based configurator by clicking on the "Configure your Symfony Application online" link of the ``config.php`` page. To see a real-live Symfony page in action, access the following page: web/app_dev.php/demo/hello/Fabien 3) Learn about Symfony! ----------------------- This distribution is meant to be the starting point for your application, but it also contains some sample code that you can learn from and play with. A great way to start learning Symfony is via the [Quick Tour](http://symfony.com/doc/current/quick_tour/the_big_picture.html), which will take you through all the basic features of Symfony2 and the test pages that are available in the standard edition. Once you're feeling good, you can move onto reading the official [Symfony2 book](http://symfony.com/doc/current/). Using this Edition as the Base of your Application -------------------------------------------------- Since the standard edition is fully-configured and comes with some examples, you'll need to make a few changes before using it to build your application. The distribution is configured with the following defaults: * Twig is the only configured template engine; * Doctrine ORM/DBAL is configured; * Swiftmailer is configured; * Annotations for everything are enabled. A default bundle, ``AcmeDemoBundle``, shows you Symfony2 in action. After playing with it, you can remove it by following these steps: * delete the ``src/Acme`` directory; * remove the routing entries referencing AcmeBundle in ``app/config/routing_dev.yml``; * remove the AcmeBundle from the registered bundles in ``app/AppKernel.php``; What's inside? --------------- The Symfony Standard Edition comes pre-configured with the following bundles: * **FrameworkBundle** - The core Symfony framework bundle * **SensioFrameworkExtraBundle** - Adds several enhancements, including template and routing annotation capability ([documentation](http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html)) * **DoctrineBundle** - Adds support for the Doctrine ORM ([documentation](http://symfony.com/doc/current/book/doctrine.html)) * **TwigBundle** - Adds support for the Twig templating engine ([documentation](http://symfony.com/doc/current/book/templating.html)) * **SecurityBundle** - Adds security by integrating Symfony's security component ([documentation](http://symfony.com/doc/current/book/security.html)) * **SwiftmailerBundle** - Adds support for Swiftmailer, a library for sending emails ([documentation](http://symfony.com/doc/2.0/cookbook/email.html)) * **MonologBundle** - Adds support for Monolog, a logging library ([documentation](http://symfony.com/doc/2.0/cookbook/logging/monolog.html)) * **AsseticBundle** - Adds support for Assetic, an asset processing library ([documentation](http://symfony.com/doc/2.0/cookbook/assetic/asset_management.html)) * **JMSSecurityExtraBundle** - Allows security to be added via annotations ([documentation](http://symfony.com/doc/current/bundles/JMSSecurityExtraBundle/index.html)) * **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and the web debug toolbar * **SensioDistributionBundle** (in dev/test env) - Adds functionality for configuring and working with Symfony distributions * **SensioGeneratorBundle** (in dev/test env) - Adds code generation capabilities ([documentation](http://symfony.com/doc/current/bundles/SensioGeneratorBundle/index.html)) * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example code Enjoy!
{ "content_hash": "d7eb942cc337829a405883fbdfff6b91", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 131, "avg_line_length": 43.33783783783784, "alnum_prop": 0.7561584034923604, "repo_name": "anhstudios/symfony-swganh", "id": "74f5635a0710c83a75b133ec750ac1242cd39933", "size": "6414", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "22931" } ], "symlink_target": "" }
package org.apache.juli.logging; import java.util.logging.ConsoleHandler; import java.util.logging.Formatter; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; /** * Hardcoded java.util.logging commons-logging implementation. */ class DirectJDKLog implements Log { // no reason to hide this - but good reasons to not hide public final Logger logger; /** Alternate config reader and console format */ private static final String SIMPLE_FMT="java.util.logging.SimpleFormatter"; private static final String SIMPLE_CFG="org.apache.juli.JdkLoggerConfig"; //doesn't exist private static final String FORMATTER="org.apache.juli.formatter"; static { if( System.getProperty("java.util.logging.config.class") ==null && System.getProperty("java.util.logging.config.file") ==null ) { // default configuration - it sucks. Let's override at least the // formatter for the console try { Class.forName(SIMPLE_CFG).newInstance(); } catch( Throwable t ) { } try { Formatter fmt=(Formatter)Class.forName(System.getProperty(FORMATTER, SIMPLE_FMT)).newInstance(); // it is also possible that the user modified jre/lib/logging.properties - // but that's really stupid in most cases Logger root=Logger.getLogger(""); Handler handlers[]=root.getHandlers(); for( int i=0; i< handlers.length; i++ ) { // I only care about console - that's what's used in default config anyway if( handlers[i] instanceof ConsoleHandler ) { handlers[i].setFormatter(fmt); } } } catch( Throwable t ) { // maybe it wasn't included - the ugly default will be used. } } } public DirectJDKLog(String name ) { logger=Logger.getLogger(name); } @Override public final boolean isErrorEnabled() { return logger.isLoggable(Level.SEVERE); } @Override public final boolean isWarnEnabled() { return logger.isLoggable(Level.WARNING); } @Override public final boolean isInfoEnabled() { return logger.isLoggable(Level.INFO); } @Override public final boolean isDebugEnabled() { return logger.isLoggable(Level.FINE); } @Override public final boolean isFatalEnabled() { return logger.isLoggable(Level.SEVERE); } @Override public final boolean isTraceEnabled() { return logger.isLoggable(Level.FINER); } @Override public final void debug(Object message) { log(Level.FINE, String.valueOf(message), null); } @Override public final void debug(Object message, Throwable t) { log(Level.FINE, String.valueOf(message), t); } @Override public final void trace(Object message) { log(Level.FINER, String.valueOf(message), null); } @Override public final void trace(Object message, Throwable t) { log(Level.FINER, String.valueOf(message), t); } @Override public final void info(Object message) { log(Level.INFO, String.valueOf(message), null); } @Override public final void info(Object message, Throwable t) { log(Level.INFO, String.valueOf(message), t); } @Override public final void warn(Object message) { log(Level.WARNING, String.valueOf(message), null); } @Override public final void warn(Object message, Throwable t) { log(Level.WARNING, String.valueOf(message), t); } @Override public final void error(Object message) { log(Level.SEVERE, String.valueOf(message), null); } @Override public final void error(Object message, Throwable t) { log(Level.SEVERE, String.valueOf(message), t); } @Override public final void fatal(Object message) { log(Level.SEVERE, String.valueOf(message), null); } @Override public final void fatal(Object message, Throwable t) { log(Level.SEVERE, String.valueOf(message), t); } // from commons logging. This would be my number one reason why java.util.logging // is bad - design by committee can be really bad ! The impact on performance of // using java.util.logging - and the ugliness if you need to wrap it - is far // worse than the unfriendly and uncommon default format for logs. private void log(Level level, String msg, Throwable ex) { if (logger.isLoggable(level)) { // Hack (?) to get the stack trace. Throwable dummyException=new Throwable(); StackTraceElement locations[]=dummyException.getStackTrace(); // Caller will be the third element String cname = "unknown"; String method = "unknown"; if (locations != null && locations.length >2) { StackTraceElement caller = locations[2]; cname = caller.getClassName(); method = caller.getMethodName(); } if (ex==null) { logger.logp(level, cname, method, msg); } else { logger.logp(level, cname, method, msg, ex); } } } static Log getInstance(String name) { return new DirectJDKLog( name ); } }
{ "content_hash": "baf79832087ab416606dcc9e4f41e82a", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 112, "avg_line_length": 31.225988700564972, "alnum_prop": 0.609372172969061, "repo_name": "plumer/codana", "id": "53b271a0d18ce846fafdfeaca8efce5cb00d5d39", "size": "6329", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "tomcat_files/8.0.21/DirectJDKLog.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "101920653" }, { "name": "Python", "bytes": "58358" } ], "symlink_target": "" }
#import "LWTransaction.h" #import "LWTransactionGroup.h" #import <objc/message.h> @interface LWAsyncDisplayTransactionOperation : NSObject @property (nonatomic,strong) id target; @property (nonatomic,assign) SEL selector; @property (nonatomic,strong) id object; @property (nonatomic,copy) LWAsyncTransactionOperationCompletionBlock completion; - (id)initWithCompletion:(LWAsyncTransactionOperationCompletionBlock)completion; - (void)callAndReleaseCompletionBlock:(BOOL)canceled; @end @implementation LWAsyncDisplayTransactionOperation - (id)initWithCompletion:(LWAsyncTransactionOperationCompletionBlock)completion { self = [super init]; if (self) { self.completion = [completion copy]; } return self; } - (void)callAndReleaseCompletionBlock:(BOOL)canceled { void (*objc_msgSendToPerform)(id, SEL, id) = (void*)objc_msgSend; objc_msgSendToPerform(self.target,self.selector,self.object); if (self.completion) { self.completion(canceled); self.completion = nil; } self.target = nil; self.selector = nil; self.object = nil; } @end @interface LWTransaction () @property (nonatomic,strong) dispatch_queue_t callbackQueue; @property (nonatomic,copy) LWAsyncTransactionCompletionBlock completionBlock; @property (nonatomic,assign) LWAsyncTransactionState state; @property (nonatomic,strong) NSMutableArray* operations; @end @implementation LWTransaction #pragma mark - LifeCycle - (LWTransaction *)initWithCallbackQueue:(dispatch_queue_t)callbackQueue completionBlock:(LWAsyncTransactionCompletionBlock)completionBlock { if ((self = [self init])) { if (callbackQueue == NULL) { callbackQueue = dispatch_get_main_queue(); } self.callbackQueue = callbackQueue; self.completionBlock = [completionBlock copy]; self.state = LWAsyncTransactionStateOpen; } return self; } #pragma mark - Methods - (void)addAsyncOperationWithTarget:(id)target selector:(SEL)selector object:(id)object completion:(LWAsyncTransactionOperationCompletionBlock)operationComletion { LWAsyncDisplayTransactionOperation* operation = [[LWAsyncDisplayTransactionOperation alloc] initWithCompletion:operationComletion]; operation.target = target; operation.selector = selector; operation.object = object; [self.operations addObject:operation]; } - (void)cancel { self.state = LWAsyncTransactionStateCanceled; } - (void)commit { self.state = LWAsyncTransactionStateCommitted; if ([_operations count] == 0) { if (_completionBlock) { _completionBlock(self, NO); } } else { [self completeTransaction]; } } - (void)completeTransaction { if (_state != LWAsyncTransactionStateComplete) { BOOL isCanceled = (_state == LWAsyncTransactionStateCanceled); for (LWAsyncDisplayTransactionOperation* operation in self.operations) { [operation callAndReleaseCompletionBlock:isCanceled]; } self.state = LWAsyncTransactionStateComplete; if (_completionBlock) { _completionBlock(self, isCanceled); } } } #pragma mark - Getter - (NSMutableArray *)operations { if (_operations) { return _operations; } _operations = [[NSMutableArray alloc] init]; return _operations; } @end
{ "content_hash": "d3feb9f2c6323cf621dc22f50a6e6e5b", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 100, "avg_line_length": 27.131782945736433, "alnum_prop": 0.686, "repo_name": "woshixiaobei/Tong", "id": "9d03ddb233fca0274579ae1baf0508a5679af54e", "size": "4634", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "HeXunMaster/HeXunMaster/UI/Home/Views/Gallop/LWTransaction.m", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "7174439" }, { "name": "CSS", "bytes": "3443" }, { "name": "DTrace", "bytes": "412" }, { "name": "HTML", "bytes": "4555" }, { "name": "Objective-C", "bytes": "5175178" }, { "name": "Python", "bytes": "4666" }, { "name": "Ruby", "bytes": "829" }, { "name": "Shell", "bytes": "8721" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>CDN业务管理平台</title> <!-- 显示设备适配 --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <!-- Ionicons 图标集 --> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/ionicons.min.css"> <!-- AdminLTE 默认样式表 --> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/AdminLTE.css"> <!-- AdminLTE 皮肤样式表 black blue green purple red yellow --> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/skins/_all-skins.min.css"> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/style.css"> <!-- DataTables --> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/plugins/datatables/dataTables.bootstrap.css"> <script src="<?php echo Yii::app()->baseUrl; ?>/js/app.min.js"></script> <script src="<?php echo Yii::app()->baseUrl; ?>/plugins/select2/select2.full.min.js"></script> <!-- Morris chart 图表插件 && http://morrisjs.github.io/morris.js --> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/plugins/morris/morris.css"> <link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/plugins/select2/select2.min.css"> <!--[if lt IE 9]> <script src="<?php echo Yii::app()->baseUrl;?>js/html5shiv.min.js"></script> <script src="<?php echo Yii::app()->baseUrl;?>js/respond.min.js"></script> <![endif]--> </head> <body class="hold-transition skin-blue sidebar-mini"> <div class="wrapper"> <header class="main-header"> <!-- Logo --> <a href="/" class="logo"> <span class="logo-mini">CDN</span> <span class="logo-lg">CDN业务管理平台</span> </a> <!-- Header Navbar: style can be found in header.less --> <nav class="navbar navbar-static-top" role="navigation"> <!-- Sidebar toggle button--> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <!-- 用户头像 --> <li class=" user user-menu"> <a href="#" class="dropdown-toggle"> <span class="hidden-xs"><?= Yii::app()->user->name; ?></span> </a> </li> <li class="notifications-menu"> <a href="<?= CHtml::normalizeUrl(['user/change']); ?>">修改密码</a> </li> <!-- 退出 --> <li class="notifications-menu"> <a href="<?= CHtml::normalizeUrl(['site/logout']); ?>">退出</a> </li> </ul> </div> </nav> </header> <!-- 左边菜单 --> <aside class="main-sidebar"> <section id="main_menu" class="sidebar"> <!-- 菜单主体 --> <ul class="sidebar-menu"> <li class="header text-center" style="padding-left: 0; font-size: 12px;"><?= date('Y-m-d H:i:s'); ?></li> <li class=""> <a href="<?= CHtml::normalizeUrl(['default/index']) ?>"><i class="fa fa-laptop"></i> <span>概览</span></a> </li> <li class="treeview"> <a href="#"> <i class="fa fa-image"></i> <span>数据分析</span> <i class="fa fa-angle-left pull-right"></i> </a> <ul class="treeview-menu"> <li id="ulist1"><a href="<?= CHtml::normalizeUrl(['band/index']) ?>"><span>网络分析</span></a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-credit-card"></i> <span>帐单管理</span> <i class="fa fa-angle-left pull-right"></i> </a> <ul class="treeview-menu"> <li><a href="<?= CHtml::normalizeUrl(['fee/index']) ?>"><span>计费帐单</span></a></li> </ul> </li> <?php if(Yii::app()->user->role==User::ROLE_ADMIN):?> <li class=""> <a href="<?= CHtml::normalizeUrl(['domain/index']) ?>"><i class="fa fa-sitemap"></i> <span>域名管理</span></a> </li> <?php endif;?> <li> <a href="<?= CHtml::normalizeUrl(['log/index']) ?>"><i class="fa fa-file-text-o"></i> <span>日志管理</span></a> </li> <li class="treeview"> <a href="#"> <i class="fa fa-users"></i> <span>用户管理</span> <i class="fa fa-angle-left pull-right"></i> </a> <ul class="treeview-menu"> <?php if(Yii::app()->user->role==User::ROLE_ADMIN):?> <li id="ulist"><a href="<?= CHtml::normalizeUrl(['user/index']) ?>"><span>用户列表</span></a></li> <li><a href="<?= CHtml::normalizeUrl(['user/add']) ?>"><span>新增用户</span></a></li> <?php endif;?> <li><a href="<?= CHtml::normalizeUrl(['user/change']) ?>"><span>修改资料</span></a></li> </ul> </li> </ul> </section> </aside> <div class="content-wrapper"> <?php echo $content; ?> </div> </div> <!-- /.content-wrapper --> <!--<footer class="main-footer">--> <!-- <strong>Copyright © 2012-2016 CDN Console</strong> All rights reserved.--> <!-- <div class="pull-right hidden-xs">--> <!-- <b>Version</b> 1.0--> <!-- </div>--> <!--</footer>--> <script type="application/javascript"> $(document).ready(function () { var curr_route = '/<?=$this->route;?>'; $(".select2").select2(); if (curr_route.indexOf('/user/edit') == 0) $('#ulist').addClass('active').parent().parents('li').addClass('active'); if (curr_route.indexOf('/flow/index') == 0) $('#ulist1').addClass('active').parent().parents('li').addClass('active'); $('#main_menu li a').each(function () { var href = $(this).attr('href'); if (href.indexOf(curr_route) == 0) { $(this).parent().addClass('active'); $(this).parent().parents('li').each(function () { $(this).addClass('active'); }) } }); }) </script> <!-- DataTables --> <script src="<?php echo Yii::app()->baseUrl; ?>/plugins/datatables/jquery.dataTables.min.js"></script> <script src="<?php echo Yii::app()->baseUrl; ?>/plugins/datatables/dataTables.bootstrap.min.js"></script> </body> </html>
{ "content_hash": "5a6f524ad943c52f6d66c241497efc81", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 124, "avg_line_length": 45.63522012578616, "alnum_prop": 0.4652701212789416, "repo_name": "zeevin/ksc-man", "id": "e25cb7add712e0cb757d5cdae0b24c0fb974a32c", "size": "7451", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backend/views/layouts/main.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "45360" }, { "name": "Batchfile", "bytes": "380" }, { "name": "CSS", "bytes": "502547" }, { "name": "HTML", "bytes": "1698308" }, { "name": "JavaScript", "bytes": "2833602" }, { "name": "PHP", "bytes": "216309" } ], "symlink_target": "" }
maxmin module ============= .. automodule:: maxmin :members: :undoc-members: :show-inheritance:
{ "content_hash": "2cf311214d9abe4020f009f4bb8d73bf", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 22, "avg_line_length": 16.571428571428573, "alnum_prop": 0.5344827586206896, "repo_name": "amedina14/uip-iq17-pc3", "id": "cc5bb252eb874a5c8d50181b46202d28be030ab2", "size": "116", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "max_min/Docs/source/maxmin.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2460" }, { "name": "CSS", "bytes": "75809" }, { "name": "HTML", "bytes": "68823" }, { "name": "JavaScript", "bytes": "573639" }, { "name": "Makefile", "bytes": "1839" }, { "name": "Python", "bytes": "71789" } ], "symlink_target": "" }
<!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" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php wp_title(); ?> <?php bloginfo('name'); ?></title> <meta name="generator" content="WordPress.com" /> <!-- leave this for stats --> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <?php global $hemingway; if ($hemingway->style and $hemingway->style != 'none') : ?> <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/styles/<?= $hemingway->style ?>" type="text/css" media="screen" /> <?php endif; ?> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_head(); ?> </head> <body> <div id="header"> <div class="inside"> <div id="search"> <form method="get" id="sform" action="<?php bloginfo('home'); ?>/"> <div class="searchimg"></div> <input type="text" id="q" value="<?php echo wp_specialchars($s, 1); ?>" name="s" size="15" /> </form> </div> <h2><a href="<?php echo get_settings('home'); ?>/"><?php bloginfo('name'); ?></a></h2> <p class="description"><?php bloginfo('description'); ?></p> </div> </div> <!-- [END] #header -->
{ "content_hash": "f6daa64895f3d91f679e900d3c6c4402", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 138, "avg_line_length": 40.333333333333336, "alnum_prop": 0.6083916083916084, "repo_name": "kneath/hemingway", "id": "5097251f49d86eadefc16a383a42f4c2d5a1824e", "size": "1573", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "header.php", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "3361" }, { "name": "PHP", "bytes": "40021" } ], "symlink_target": "" }
package jat.tests.core.ephemeris; import jat.core.ephemeris.DE405Body.body; import jat.core.ephemeris.DE405Frame.frame; import jat.core.ephemeris.DE405Plus; import jat.core.util.PathUtil; import jat.core.util.messageConsole.MessageConsole; import jat.coreNOSA.math.MatrixVector.data.VectorN; import jat.coreNOSA.spacetime.Time; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.io.IOException; import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextPane; public class EphemerisTest extends JApplet { private static final long serialVersionUID = 4507683576803709168L; public void init() { // Create a text pane. JTextPane textPane = new JTextPane(); JScrollPane paneScrollPane = new JScrollPane(textPane); paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); paneScrollPane.setPreferredSize(new Dimension(300, 155)); paneScrollPane.setMinimumSize(new Dimension(10, 10)); getContentPane().add(paneScrollPane, BorderLayout.CENTER); // Redirect stdout and stderr to the text pane MessageConsole mc = new MessageConsole(textPane); mc.redirectOut(); mc.redirectErr(Color.RED, null); mc.setMessageLines(100); System.out.println("Ephemeris Test"); } public void start() { // Message console System.out.println("Creating Ephemeris Test Applet"); EphemerisTestConsole E = new EphemerisTestConsole(); JFrame jf = new JFrame(); jf.setSize(600, 400); jf.getContentPane().add(E); jf.setVisible(true); E.init(); System.out.println("Ephemeris Console created"); // main task PathUtil path=new PathUtil(this); System.out.println("[EphemerisTest current_path] "+path.current_path); System.out.println("[EphemerisTest root_path] "+path.root_path); System.out.println("[EphemerisTest data_path] "+path.data_path); Time mytime = new Time(2002, 2, 17, 12, 0, 0); System.out.println("Loading DE405 Ephemeris File"); DE405Plus ephem = new DE405Plus(path); ephem.setFrame(frame.HEE); System.out.println("DE405 Ephemeris File loaded"); try { VectorN rv; //rv = ephem.get_planet_posvel(DE405Plus.body.MARS, mytime.jd_tt()); rv = ephem.get_planet_posvel(body.MARS, mytime); System.out.println("Reference Frame: "+ephem.ephFrame); System.out.println("The position of Mars on 10-17-2002 at 12:00pm was "); System.out.println("x= " + rv.get(0) + " km"); System.out.println("y= " + rv.get(1) + " km"); System.out.println("z= " + rv.get(2) + " km"); System.out.println("The velocity of Mars on 10-17-2002 at 12:00pm was "); System.out.println("vx= " + rv.get(3) + " km/s"); System.out.println("vy= " + rv.get(4) + " km/s"); System.out.println("vz= " + rv.get(5) + " km/s"); } catch (IOException e) { System.out.println("Failed to get planet position velocity in get_planet_posvel()"); e.printStackTrace(); } } }
{ "content_hash": "9637c909609b9443cea296a975b10243", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 87, "avg_line_length": 33.46590909090909, "alnum_prop": 0.7195246179966044, "repo_name": "atmelino/JATexperimental", "id": "3867715d9e776b2e15e14bb60f1f7f266ce7d125", "size": "2945", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/jat/tests/core/ephemeris/EphemerisTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "4434850" }, { "name": "Matlab", "bytes": "760" }, { "name": "Shell", "bytes": "889" } ], "symlink_target": "" }
[![Travis Build Status](https://img.shields.io/travis/weejh/project3-spa-production.svg)](https://travis-ci.org/weejh/project3-spa-production) # Project 3 - Single Page Apps - Prod ## Connecting to chat server URL of chat app => [link](https://spachatapp-prod.herokuapp.com/) ## Description A simple chat application using [Polymer 1.0](https://www.polymer-project.org/1.0/) ## Tools and Frameworks * Authentication via [auth0](https://auth0.com/) * [Polymer starter kit](https://github.com/PolymerElements/polymer-starter-kit/releases/download/v1.2.2/polymer-starter-kit-1.2.2.zip) - the kit contains the build process & developer tooling * [Polymer Resources](http://www.gajotres.net/polymer-adventures-more-then-150-resources/) ## Issue/Todo List: * unit testing with Sauce Labs * joins chat room * list chat room * list available users
{ "content_hash": "a7c92a43ee8efd08b39dd1b9e0de5061", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 191, "avg_line_length": 42.25, "alnum_prop": 0.7514792899408284, "repo_name": "weejh/project3-spa-production", "id": "449f99bc99108aa88e7b391a8581530cb44c0faf", "size": "845", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "622" }, { "name": "HTML", "bytes": "39266" }, { "name": "JavaScript", "bytes": "14080" }, { "name": "Shell", "bytes": "632" } ], "symlink_target": "" }
namespace leveldb { static std::string IKey(const std::string& user_key, uint64_t seq, ValueType vt) { std::string encoded; AppendInternalKey(&encoded, ParsedInternalKey(user_key, seq, vt)); return encoded; } static std::string Shorten(const std::string& s, const std::string& l) { std::string result = s; InternalKeyComparator(BytewiseComparator()).FindShortestSeparator(&result, l); return result; } static std::string ShortSuccessor(const std::string& s) { std::string result = s; InternalKeyComparator(BytewiseComparator()).FindShortSuccessor(&result); return result; } static void TestKey(const std::string& key, uint64_t seq, ValueType vt) { std::string encoded = IKey(key, seq, vt); Slice in(encoded); ParsedInternalKey decoded("", 0, kTypeValue); ASSERT_TRUE(ParseInternalKey(in, &decoded)); ASSERT_EQ(key, decoded.user_key.ToString()); ASSERT_EQ(seq, decoded.sequence); ASSERT_EQ(vt, decoded.type); ASSERT_TRUE(!ParseInternalKey(Slice("bar"), &decoded)); } class FormatTest { }; TEST(FormatTest, InternalKey_EncodeDecode) { const char* keys[] = { "", "k", "hello", "longggggggggggggggggggggg" }; const uint64_t seq[] = { 1, 2, 3, (1ull << 8) - 1, 1ull << 8, (1ull << 8) + 1, (1ull << 16) - 1, 1ull << 16, (1ull << 16) + 1, (1ull << 32) - 1, 1ull << 32, (1ull << 32) + 1 }; for (int k = 0; k < sizeof(keys) / sizeof(keys[0]); k++) { for (int s = 0; s < sizeof(seq) / sizeof(seq[0]); s++) { TestKey(keys[k], seq[s], kTypeValue); TestKey("hello", 1, kTypeDeletion); } } } TEST(FormatTest, InternalKeyShortSeparator) { // When user keys are same ASSERT_EQ(IKey("foo", 100, kTypeValue), Shorten(IKey("foo", 100, kTypeValue), IKey("foo", 99, kTypeValue))); ASSERT_EQ(IKey("foo", 100, kTypeValue), Shorten(IKey("foo", 100, kTypeValue), IKey("foo", 101, kTypeValue))); ASSERT_EQ(IKey("foo", 100, kTypeValue), Shorten(IKey("foo", 100, kTypeValue), IKey("foo", 100, kTypeValue))); ASSERT_EQ(IKey("foo", 100, kTypeValue), Shorten(IKey("foo", 100, kTypeValue), IKey("foo", 100, kTypeDeletion))); // When user keys are misordered ASSERT_EQ(IKey("foo", 100, kTypeValue), Shorten(IKey("foo", 100, kTypeValue), IKey("bar", 99, kTypeValue))); // When user keys are different, but correctly ordered ASSERT_EQ(IKey("g", kMaxSequenceNumber, kValueTypeForSeek), Shorten(IKey("foo", 100, kTypeValue), IKey("hello", 200, kTypeValue))); // When start user key is prefix of limit user key ASSERT_EQ(IKey("foo", 100, kTypeValue), Shorten(IKey("foo", 100, kTypeValue), IKey("foobar", 200, kTypeValue))); // When limit user key is prefix of start user key ASSERT_EQ(IKey("foobar", 100, kTypeValue), Shorten(IKey("foobar", 100, kTypeValue), IKey("foo", 200, kTypeValue))); } TEST(FormatTest, InternalKeyShortestSuccessor) { ASSERT_EQ(IKey("g", kMaxSequenceNumber, kValueTypeForSeek), ShortSuccessor(IKey("foo", 100, kTypeValue))); ASSERT_EQ(IKey("\xff\xff", 100, kTypeValue), ShortSuccessor(IKey("\xff\xff", 100, kTypeValue))); } } // namespace leveldb int main(int argc, char** argv) { return leveldb::test::RunAllTests(); }
{ "content_hash": "39b593d40b805bb4e7fa1988933ba56b", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 80, "avg_line_length": 33.69230769230769, "alnum_prop": 0.6004566210045662, "repo_name": "parallaxcoin/BrexitCoin", "id": "d70df5be57b278d5475440a343fc0f688b3fd3a2", "size": "3808", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/leveldb/db/dbformat_test.cc", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "51312" }, { "name": "C", "bytes": "33288" }, { "name": "C++", "bytes": "2515535" }, { "name": "CSS", "bytes": "1127" }, { "name": "Groff", "bytes": "12586" }, { "name": "HTML", "bytes": "50621" }, { "name": "Makefile", "bytes": "12911" }, { "name": "NSIS", "bytes": "5914" }, { "name": "Objective-C", "bytes": "858" }, { "name": "Objective-C++", "bytes": "3517" }, { "name": "Python", "bytes": "54353" }, { "name": "QMake", "bytes": "13703" }, { "name": "Shell", "bytes": "9565" } ], "symlink_target": "" }
// ZAP: 2012/04/25 Added type argument to generic type and added @Override // annotation to all appropriate methods. // ZAP: 2013/01/23 Clean up of exception handling/logging. // ZAP: 2013/03/03 Issue 547: Deprecate unused classes and methods // ZAP: 2016/04/05 Issue 2458: Fix xlint warning messages package org.parosproxy.paros.extension.history; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Rectangle; import java.awt.Robot; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; import java.io.File; import java.net.URL; import java.util.Vector; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.filechooser.FileFilter; import org.apache.log4j.Logger; import org.parosproxy.paros.control.Control; import org.parosproxy.paros.extension.AbstractDialog; import org.parosproxy.paros.model.Model; /** * @deprecated No longer used/needed. It will be removed in a future release. */ @Deprecated public class BrowserDialog extends AbstractDialog { private static final long serialVersionUID = 1L; private static final String TITLE = "View in Browser: "; private static final Logger logger = Logger.getLogger(BrowserDialog.class); private JPanel jContentPane = null; private JPanel jPanelBottom = null; private JLabel jLabel = null; private JButton btnCapture = null; private JButton btnStop = null; private JButton btnClose = null; // ZAP: Added type argument. private Vector<URL> URLs = new Vector<>(); private JPanel jPanel = null; // ZAP: Disabled the platform specific browser //private EmbeddedBrowser embeddedBrowser = null; /** * This is the default constructor */ public BrowserDialog() { super(); initialize(); } public BrowserDialog(Frame frame, boolean modal) { super(frame, modal); initialize(); } /** * This method initializes this */ private void initialize() { this.setContentPane(getJContentPane()); this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.setTitle(TITLE); this.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(WindowEvent winEvt) { stop(); BrowserDialog.this.setVisible(false); } }); pack(); if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) { this.setSize(640,480); } } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); jContentPane.add(getJPanel(), java.awt.BorderLayout.CENTER); jContentPane.add(getJPanelBottom(), java.awt.BorderLayout.SOUTH); } return jContentPane; } /** * This method initializes jPanelBottom * * @return javax.swing.JPanel */ private JPanel getJPanelBottom() { if (jPanelBottom == null) { GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.insets = new java.awt.Insets(5,3,5,5); gridBagConstraints2.gridy = 0; gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints2.gridx = 2; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.insets = new java.awt.Insets(5,3,5,2); gridBagConstraints3.gridy = 0; gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints3.gridx = 3; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.insets = new java.awt.Insets(5,3,5,2); gridBagConstraints1.gridy = 0; gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints1.gridx = 1; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(10,5,10,2); gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weighty = 1.0D; gridBagConstraints.weightx = 1.0D; gridBagConstraints.gridx = 0; jLabel = new JLabel(); jLabel.setText(" "); jLabel.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN); jPanelBottom = new JPanel(); jPanelBottom.setLayout(new GridBagLayout()); jPanelBottom.add(jLabel, gridBagConstraints); jPanelBottom.add(getBtnCapture(), gridBagConstraints1); jPanelBottom.add(getBtnStop(), gridBagConstraints2); jPanelBottom.add(getBtnClose(), gridBagConstraints3); } return jPanelBottom; } /** * This method initializes jButton * * @return javax.swing.JButton */ private JButton getBtnCapture() { if (btnCapture == null) { btnCapture = new JButton(); btnCapture.setText("Capture"); btnCapture.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); btnCapture.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING); // btnCapture.setPreferredSize(new java.awt.Dimension(73,28)); btnCapture.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { capture(); } }); } return btnCapture; } private JButton getBtnStop() { if (btnStop == null) { btnStop = new JButton(); btnStop.setText("Stop"); btnStop.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); btnStop.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING); // btnStop.setPreferredSize(new java.awt.Dimension(73,28)); btnStop.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { /* int i=0; for (i=0;i<URLs.size();i++){ System.out.println(URLs.get(i)); } */ URLs.clear(); stop(); } }); } return btnStop; } private void stop() { // ZAP: Disabled the platform specific browser // getEmbeddedBrowser().stop(); Control.getSingleton().getProxy().setEnableCacheProcessing(false); } private void capture(){ try { // this.setAlwaysOnTop(true); BufferedImage screencapture = new Robot().createScreenCapture( new Rectangle( this.getX(), this.getY(), this.getWidth(), this.getHeight() - this.jPanelBottom.getHeight()) ); // Save as JPEG JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(new FileFilter() { @Override public boolean accept(File file) { String filename = file.getName(); return filename.endsWith(".png"); } @Override public String getDescription() { return "*.png"; } } ); chooser.showSaveDialog(this); File file = chooser.getSelectedFile(); if (file!=null) ImageIO.write(screencapture, "png", file); } catch (Exception e) { logger.error(e.getMessage(), e); } // this.setAlwaysOnTop(false); } /** * This method initializes jButton1 * * @return javax.swing.JButton */ private JButton getBtnClose() { if (btnClose == null) { btnClose = new JButton(); btnClose.setText("Close"); btnClose.setVisible(false); btnClose.addActionListener(new ActionListener() { // Close this window @Override public void actionPerformed(ActionEvent arg0) { stop(); } }); } return btnClose; } public void addURL(URL arg){ URLs.add(arg); } /** * This method initializes jPanel * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); jPanel.setLayout(new CardLayout()); jPanel.setPreferredSize(new java.awt.Dimension(400,300)); // ZAP: Disabled the platform specific browser //jPanel.add(getEmbeddedBrowser(), getEmbeddedBrowser().getName()); } return jPanel; } /** * This method initializes embeddedBrowser * * @return org.parosproxy.paros.extension.history.EmbeddedBrowser */ // ZAP: Disabled the platform specific browser /* EmbeddedBrowser getEmbeddedBrowser() { if (embeddedBrowser == null) { embeddedBrowser = new EmbeddedBrowser(); embeddedBrowser.setName("embeddedBrowser"); } return embeddedBrowser; } */ void setURLTitle(String url) { setTitle(TITLE + url); } }
{ "content_hash": "e7b2c2d9947f141c1faa8db6eefcc48b", "timestamp": "", "source": "github", "line_count": 301, "max_line_length": 94, "avg_line_length": 30.983388704318937, "alnum_prop": 0.6506540853527771, "repo_name": "rajiv65/zaproxy", "id": "e650bfe916ea727e6cc6b26f573260d87424aa2b", "size": "10171", "binary": false, "copies": "4", "ref": "refs/heads/develop", "path": "src/org/parosproxy/paros/extension/history/BrowserDialog.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "184" }, { "name": "CSS", "bytes": "592" }, { "name": "HTML", "bytes": "3963968" }, { "name": "Java", "bytes": "8116102" }, { "name": "JavaScript", "bytes": "159905" }, { "name": "Lex", "bytes": "7594" }, { "name": "PHP", "bytes": "118474" }, { "name": "Perl", "bytes": "3826" }, { "name": "Python", "bytes": "54120" }, { "name": "Shell", "bytes": "5917" }, { "name": "XSLT", "bytes": "16776" } ], "symlink_target": "" }
package java8; import com.sandwich.koan.Koan; import java.util.Optional; import static com.sandwich.koan.constant.KoanConstants.__; import static com.sandwich.util.Assert.assertEquals; public class AboutOptional { boolean optionalIsPresentField = false; @Koan public void isPresent() { boolean optionalIsPresent = false; Optional<String> value = notPresent(); if (value.isPresent()) { optionalIsPresent = true; } assertEquals(optionalIsPresent, false); } @Koan public void ifPresentLambda() { Optional<String> value = notPresent(); value.ifPresent(x -> optionalIsPresentField = true); assertEquals(optionalIsPresentField, false); } //use optional on api to signal that value is optional public Optional<String> notPresent() { return Optional.empty(); } private Optional<String> present() { return Optional.of("is present"); } }
{ "content_hash": "4da9dd44dc63a9e983c8d7e48a3e25a5", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 60, "avg_line_length": 25.05128205128205, "alnum_prop": 0.6601842374616171, "repo_name": "alexander94dmitriev/PortlandStateJavaSummer2017", "id": "5a649711d30f9dc843bc9c6330077ab7ce9a5b1d", "size": "977", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "koans/src/java8/AboutOptional.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "656" }, { "name": "CSS", "bytes": "55" }, { "name": "HTML", "bytes": "4697" }, { "name": "Java", "bytes": "304362" }, { "name": "Shell", "bytes": "666" } ], "symlink_target": "" }
import { extend, objectDefinedNotNull, getAttrValueFromString, jsS, hOP, combine, getGUID, mergeHeaders, mergeOptions, getHashCode } from '@pnp/common'; import { __extends } from 'tslib'; import { CachingOptions, Queryable, CachingParserWrapper, ODataBatch } from '@pnp/odata'; import { SPHttpClient, toAbsoluteUrl } from '@pnp/sp'; import { Logger } from '@pnp/logging'; function objectPath() { return "<ObjectPath Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" />"; } function identityQuery() { return "<ObjectIdentityQuery Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" />"; } function opQuery(selectProperties, childSelectProperties) { // this is fairly opaque behavior, but is the simplest way to convey the required information. // if selectProperties.length === 0 or null then select all // else select indicated properties if (selectProperties === void 0) { selectProperties = null; } if (childSelectProperties === void 0) { childSelectProperties = null; } // if childSelectProperties === null do not include that block // if childSelectProperties.length === 0 then select all // else select indicated properties var builder = []; builder.push("<Query Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\">"); if (selectProperties === null || selectProperties.length < 1) { builder.push("<Query SelectAllProperties=\"true\" >"); builder.push("<Properties />"); builder.push("</Query >"); } else { builder.push("<Query SelectAllProperties=\"false\" >"); builder.push("<Properties>"); [].push.apply(builder, selectProperties.map(function (p) { return "<Property Name=\"" + p + "\" SelectAll=\"true\" />"; })); builder.push("</Properties>"); builder.push("</Query >"); } if (childSelectProperties !== null) { if (childSelectProperties.length < 1) { builder.push("<ChildItemQuery SelectAllProperties=\"true\" >"); builder.push("<Properties />"); builder.push("</ChildItemQuery >"); } else { builder.push("<ChildItemQuery SelectAllProperties=\"false\" >"); builder.push("<Properties>"); [].push.apply(builder, childSelectProperties.map(function (p) { return "<Property Name=\"" + p + "\" SelectAll=\"true\" />"; })); builder.push("</Properties>"); builder.push("</ChildItemQuery >"); } } builder.push("</Query >"); return builder.join(""); } function setProperty(name, type, value) { var builder = []; builder.push("<SetProperty Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" Name=\"" + name + "\">"); builder.push("<Parameter Type=\"" + type + "\">" + value + "</Parameter>"); builder.push("</SetProperty>"); return builder.join(""); } function methodAction(name, params) { var builder = []; builder.push("<Method Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" Name=\"" + name + "\">"); if (params !== null) { var arrParams = params.toArray(); if (arrParams.length < 1) { builder.push("<Parameters />"); } else { builder.push("<Parameters>"); [].push.apply(builder, arrParams.map(function (p) { return "<Parameter Type=\"" + p.type + "\">" + p.value + "</Parameter>"; })); builder.push("</Parameters>"); } } builder.push("</Method>"); return builder.join(""); } function objectProperties(o) { return Object.getOwnPropertyNames(o).map(function (name) { var value = o[name]; if (typeof value === "boolean") { return setProperty(name, "Boolean", "" + value); } else if (typeof value === "number") { return setProperty(name, "Number", "" + value); } else if (typeof value === "string") { return setProperty(name, "String", "" + value); } return ""; }, []); } function property(name) { var actions = []; for (var _i = 1; _i < arguments.length; _i++) { actions[_i - 1] = arguments[_i]; } return new ObjectPath("<Property Id=\"$$ID$$\" ParentId=\"$$PARENT_ID$$\" Name=\"" + name + "\" />", actions); } function staticMethod(name, typeId) { var actions = []; for (var _i = 2; _i < arguments.length; _i++) { actions[_i - 2] = arguments[_i]; } return new ObjectPath("<StaticMethod Id=\"$$ID$$\" Name=\"" + name + "\" TypeId=\"" + typeId + "\" />", actions); } function staticProperty(name, typeId) { var actions = []; for (var _i = 2; _i < arguments.length; _i++) { actions[_i - 2] = arguments[_i]; } return new ObjectPath("<StaticProperty Id=\"$$ID$$\" Name=\"" + name + "\" TypeId=\"" + typeId + "\" />", actions); } function objConstructor(typeId) { var actions = []; for (var _i = 1; _i < arguments.length; _i++) { actions[_i - 1] = arguments[_i]; } return new ObjectPath("<Constructor Id=\"$$ID$$\" TypeId=\"" + typeId + "\" />", actions); } /** * Used to build parameters when calling methods */ var MethodParams = /** @class */ (function () { function MethodParams(_p) { if (_p === void 0) { _p = []; } this._p = _p; } MethodParams.build = function (initValues) { if (initValues === void 0) { initValues = []; } var params = new MethodParams(); [].push.apply(params._p, initValues); return params; }; MethodParams.prototype.string = function (value) { return this.a("String", value); }; MethodParams.prototype.number = function (value) { return this.a("Number", value.toString()); }; MethodParams.prototype.boolean = function (value) { return this.a("Boolean", value.toString()); }; MethodParams.prototype.objectPath = function (inputIndex) { return this.a("ObjectPath", inputIndex.toString()); }; MethodParams.prototype.toArray = function () { return this._p; }; MethodParams.prototype.a = function (type, value) { this._p.push({ type: type, value: value }); return this; }; return MethodParams; }()); function method(name, params) { var actions = []; for (var _i = 2; _i < arguments.length; _i++) { actions[_i - 2] = arguments[_i]; } var builder = []; builder.push("<Method Id=\"$$ID$$\" ParentId=\"$$PARENT_ID$$\" Name=\"" + name + "\">"); if (params !== null) { var arrParams = params.toArray(); if (arrParams.length < 1) { builder.push("<Parameters />"); } else { builder.push("<Parameters>"); [].push.apply(builder, arrParams.map(function (p) { if (p.type === "ObjectPath") { return "<Parameter ObjectPathId=\"$$OP_PARAM_ID_" + p.value + "$$\" />"; } return "<Parameter Type=\"" + p.type + "\">" + p.value + "</Parameter>"; })); builder.push("</Parameters>"); } } builder.push("</Method>"); return new ObjectPath(builder.join(""), actions); } /** * Transforms an array of object paths into a request xml body. Does not do placeholder substitutions. * * @param objectPaths The object paths for which we want to generate a body */ function writeObjectPathBody(objectPaths) { var actions = []; var paths = []; objectPaths.forEach(function (op) { paths.push(op.path); actions.push.apply(actions, op.actions); }); // create our xml payload return [ "<Request xmlns=\"http://schemas.microsoft.com/sharepoint/clientquery/2009\" SchemaVersion=\"15.0.0.0\" LibraryVersion=\"16.0.0.0\" ApplicationName=\"PnPjs\">", "<Actions>", actions.join(""), "</Actions>", "<ObjectPaths>", paths.join(""), "</ObjectPaths>", "</Request>", ].join(""); } /** * Represents an ObjectPath used when querying ProcessQuery */ var ObjectPath = /** @class */ (function () { function ObjectPath(path, actions, id, replaceAfter) { if (actions === void 0) { actions = []; } if (id === void 0) { id = -1; } if (replaceAfter === void 0) { replaceAfter = []; } this.path = path; this.actions = actions; this.id = id; this.replaceAfter = replaceAfter; } return ObjectPath; }()); /** * Replaces all found instance of the $$ID$$ placeholder in the supplied xml string * * @param id New value to be insterted * @param xml The existing xml fragment in which the replace should occur */ function opSetId(id, xml) { return xml.replace(/\$\$ID\$\$/g, id); } /** * Replaces all found instance of the $$PATH_ID$$ placeholder in the supplied xml string * * @param id New value to be insterted * @param xml The existing xml fragment in which the replace should occur */ function opSetPathId(id, xml) { return xml.replace(/\$\$PATH_ID\$\$/g, id); } /** * Replaces all found instance of the $$PARENT_ID$$ placeholder in the supplied xml string * * @param id New value to be insterted * @param xml The existing xml fragment in which the replace should occur */ function opSetParentId(id, xml) { return xml.replace(/\$\$PARENT_ID\$\$/g, id); } /** * Replaces all found instance of the $$OP_PARAM_ID$$ placeholder in the supplied xml string * * @param map A mapping where [index] = replaced_object_path_id * @param xml The existing xml fragment in which the replace should occur * @param indexMapper Used when creating batches, not meant for direct use external to this library */ function opSetPathParamId(map, xml, indexMapper) { if (indexMapper === void 0) { indexMapper = function (n) { return n; }; } // this approach works because input params must come before the things that need them // meaning the right id will always be in the map var matches = /\$\$OP_PARAM_ID_(\d+)\$\$/ig.exec(xml); if (matches !== null) { for (var i = 1; i < matches.length; i++) { var index = parseInt(matches[i], 10); var regex = new RegExp("\\$\\$OP_PARAM_ID_" + index + "\\$\\$", "ig"); xml = xml.replace(regex, map[indexMapper(index)].toString()); } } return xml; } /** * Represents a collection of IObjectPaths */ var ObjectPathQueue = /** @class */ (function () { function ObjectPathQueue(_paths, _relationships) { if (_paths === void 0) { _paths = []; } if (_relationships === void 0) { _relationships = {}; } this._paths = _paths; this._relationships = _relationships; this._contextIndex = -1; this._siteIndex = -1; this._webIndex = -1; } /** * Adds an object path to the queue * * @param op The action to add * @returns The index of the added object path */ ObjectPathQueue.prototype.add = function (op) { this.dirty(); this._paths.push(op); return this.lastIndex; }; ObjectPathQueue.prototype.addChildRelationship = function (parentIndex, childIndex) { if (objectDefinedNotNull(this._relationships["_" + parentIndex])) { this._relationships["_" + parentIndex].push(childIndex); } else { this._relationships["_" + parentIndex] = [childIndex]; } }; ObjectPathQueue.prototype.getChildRelationship = function (parentIndex) { if (objectDefinedNotNull(this._relationships["_" + parentIndex])) { return this._relationships["_" + parentIndex]; } else { return []; } }; ObjectPathQueue.prototype.getChildRelationships = function () { return this._relationships; }; /** * Appends an action to the supplied IObjectPath, replacing placeholders * * @param op IObjectPath to which the action will be appended * @param action The action to append */ ObjectPathQueue.prototype.appendAction = function (op, action) { this.dirty(); op.actions.push(action); return this; }; /** * Appends an action to the last IObjectPath in the collection * * @param action */ ObjectPathQueue.prototype.appendActionToLast = function (action) { this.dirty(); return this.appendAction(this.last, action); }; /** * Creates a copy of this ObjectPathQueue */ ObjectPathQueue.prototype.clone = function () { var clone = new ObjectPathQueue(this.toArray(), extend({}, this._relationships)); clone._contextIndex = this._contextIndex; clone._siteIndex = this._siteIndex; clone._webIndex = this._webIndex; return clone; }; /** * Gets a copy of this instance's paths */ ObjectPathQueue.prototype.toArray = function () { return this._paths.slice(0); }; Object.defineProperty(ObjectPathQueue.prototype, "last", { /** * The last IObjectPath instance added to this collection */ get: function () { if (this._paths.length < 1) { return null; } return this._paths[this.lastIndex]; }, enumerable: true, configurable: true }); Object.defineProperty(ObjectPathQueue.prototype, "lastIndex", { /** * Index of the last IObjectPath added to the queue */ get: function () { return this._paths.length - 1; }, enumerable: true, configurable: true }); Object.defineProperty(ObjectPathQueue.prototype, "siteIndex", { /** * Gets the index of the current site in the queue */ get: function () { if (this._siteIndex < 0) { // this needs to be here in case we create it var contextIndex = this.contextIndex; this._siteIndex = this.add(property("Site", // actions objectPath())); this.addChildRelationship(contextIndex, this._siteIndex); } return this._siteIndex; }, enumerable: true, configurable: true }); Object.defineProperty(ObjectPathQueue.prototype, "webIndex", { /** * Gets the index of the current web in the queue */ get: function () { if (this._webIndex < 0) { // this needs to be here in case we create it var contextIndex = this.contextIndex; this._webIndex = this.add(property("Web", // actions objectPath())); this.addChildRelationship(contextIndex, this._webIndex); } return this._webIndex; }, enumerable: true, configurable: true }); Object.defineProperty(ObjectPathQueue.prototype, "contextIndex", { /** * Gets the index of the Current context in the queue, can be used to establish parent -> child rels */ get: function () { if (this._contextIndex < 0) { this._contextIndex = this.add(staticProperty("Current", "{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}", // actions objectPath())); } return this._contextIndex; }, enumerable: true, configurable: true }); ObjectPathQueue.prototype.toBody = function () { if (objectDefinedNotNull(this._xml)) { return this._xml; } // create our xml payload this._xml = writeObjectPathBody(this.toIndexedTree()); return this._xml; }; /** * Conducts the string replacements for id, parent id, and path id * * @returns The tree with all string replacements made */ ObjectPathQueue.prototype.toIndexedTree = function () { var _this = this; var builderIndex = -1; var lastOpId = -1; var idIndexMap = []; return this.toArray().map(function (op, index, arr) { var opId = ++builderIndex; // track the array index => opId relationship idIndexMap.push(opId); // do path replacements op.path = opSetPathParamId(idIndexMap, opSetId(opId.toString(), op.path)); if (lastOpId >= 0) { // if we have a parent do the replace op.path = opSetParentId(lastOpId.toString(), op.path); } // rewrite actions with placeholders replaced op.actions = op.actions.map(function (a) { var actionId = ++builderIndex; return opSetId(actionId.toString(), opSetPathId(opId.toString(), a)); }); // handle any specific child relationships _this.getChildRelationship(index).forEach(function (childIndex) { // set the parent id for our non-immediate children, thus removing the token so it isn't overwritten arr[childIndex].path = opSetParentId(opId.toString(), arr[childIndex].path); }); // and remember our last object path id for the parent replace above lastOpId = opId; return op; }); }; /** * Dirties this queue clearing any cached data */ ObjectPathQueue.prototype.dirty = function () { this._xml = null; }; return ObjectPathQueue; }()); /** * Used within the request pipeline to parse ProcessQuery results */ var ProcessQueryParser = /** @class */ (function () { function ProcessQueryParser(op) { this.op = op; } /** * Parses the response checking for errors * * @param r Response object */ ProcessQueryParser.prototype.parse = function (r) { var _this = this; return r.text().then(function (t) { if (!r.ok) { throw new Error(t); } try { return JSON.parse(t); } catch (e) { // special case in ProcessQuery where we got an error back, but it is not in json format throw new Error(t); } }).then(function (parsed) { // here we need to check for an error body if (parsed.length > 0 && hOP(parsed[0], "ErrorInfo") && parsed[0].ErrorInfo !== null) { throw new Error(jsS(parsed[0].ErrorInfo)); } return _this.findResult(parsed); }); }; ProcessQueryParser.prototype.findResult = function (json) { for (var i = 0; i < this.op.actions.length; i++) { var a = this.op.actions[i]; // let's see if the result is null based on the ObjectPath action, if it exists // <ObjectPath Id="8" ObjectPathId="7" /> if (/^<ObjectPath/i.test(a)) { var result = this.getParsedResultById(json, parseInt(getAttrValueFromString(a, "Id"), 10)); if (!result || (result && result.IsNull)) { return Promise.resolve(null); } } // let's see if we have a query result // <Query Id="5" ObjectPathId = "3" > if (/^<Query/i.test(a)) { var result = this.getParsedResultById(json, parseInt(getAttrValueFromString(a, "Id"), 10)); if (result && hOP(result, "_Child_Items_")) { // this is a collection result /* tslint:disable:no-string-literal */ return Promise.resolve(result["_Child_Items_"]); /* tslint:enable:no-string-literal */ } else { // this is an instance result return Promise.resolve(result); } } } // no result could be found so we are effectively returning void // issue is we really don't know if we should be returning void (a method invocation with a void return) or // if we just didn't find something above. We will let downstream things worry about that }; /** * Locates a result by ObjectPath id * * @param parsed the parsed JSON body from the response * @param id The ObjectPath id whose result we want */ ProcessQueryParser.prototype.getParsedResultById = function (parsed, id) { for (var i = 0; i < parsed.length; i++) { if (parsed[i] === id) { return parsed[i + 1]; } } return null; }; return ProcessQueryParser; }()); var ProcessQueryPath = "_vti_bin/client.svc/ProcessQuery"; var ClientSvcQueryable = /** @class */ (function (_super) { __extends(ClientSvcQueryable, _super); function ClientSvcQueryable(parent, _objectPaths) { if (parent === void 0) { parent = ""; } if (_objectPaths === void 0) { _objectPaths = null; } var _this = _super.call(this) || this; _this._objectPaths = _objectPaths; _this._selects = []; if (typeof parent === "string") { // we assume the parent here is an absolute url to a web _this._parentUrl = parent; _this._url = combine(parent.replace(ProcessQueryPath, ""), ProcessQueryPath); if (!objectDefinedNotNull(_this._objectPaths)) { _this._objectPaths = new ObjectPathQueue(); } } else { _this._parentUrl = parent._parentUrl; _this._url = combine(parent._parentUrl, ProcessQueryPath); if (!objectDefinedNotNull(_objectPaths)) { _this._objectPaths = parent._objectPaths.clone(); } _this.configureFrom(parent); } return _this; } /** * Choose which fields to return * * @param selects One or more fields to return */ ClientSvcQueryable.prototype.select = function () { var selects = []; for (var _i = 0; _i < arguments.length; _i++) { selects[_i] = arguments[_i]; } [].push.apply(this._selects, selects); return this; }; /** * Adds this query to the supplied batch * * @example * ``` * * let b = pnp.sp.createBatch(); * pnp.sp.web.inBatch(b).get().then(...); * b.execute().then(...) * ``` */ ClientSvcQueryable.prototype.inBatch = function (batch) { if (this.batch !== null) { throw new Error("This query is already part of a batch."); } this._batch = batch; return this; }; /** * Gets the full url with query information * */ ClientSvcQueryable.prototype.toUrlAndQuery = function () { return _super.prototype.toUrl.call(this) + "?" + Array.from(this.query).map(function (v) { return v[0] + "=" + v[1]; }).join("&"); }; ClientSvcQueryable.prototype.getSelects = function () { return objectDefinedNotNull(this._selects) ? this._selects : []; }; /** * Gets a child object based on this instance's paths and the supplied paramters * * @param factory Instance factory of the child type * @param methodName Name of the method used to load the child * @param params Parameters required by the method to load the child */ ClientSvcQueryable.prototype.getChild = function (factory, methodName, params) { var objectPaths = this._objectPaths.clone(); objectPaths.add(method(methodName, params, // actions objectPath())); return new factory(this, objectPaths); }; /** * Gets a property of the current instance * * @param factory Instance factory of the child type * @param propertyName Name of the property to load */ ClientSvcQueryable.prototype.getChildProperty = function (factory, propertyName) { var objectPaths = this._objectPaths.clone(); objectPaths.add(property(propertyName)); return new factory(this, objectPaths); }; /** * Sends a request * * @param op * @param options * @param parser */ ClientSvcQueryable.prototype.send = function (objectPaths, options, parser) { if (options === void 0) { options = {}; } if (parser === void 0) { parser = null; } if (!objectDefinedNotNull(parser)) { // we assume here that we want to return for this index path parser = new ProcessQueryParser(objectPaths.last); } if (this.hasBatch) { // this is using the options variable to pass some extra information downstream to the batch options = extend(options, { clientsvc_ObjectPaths: objectPaths.clone(), }); } else { if (!hOP(options, "body")) { options = extend(options, { body: objectPaths.toBody(), }); } } return _super.prototype.postCore.call(this, options, parser); }; /** * Sends the request, merging the result data with a new instance of factory */ ClientSvcQueryable.prototype.sendGet = function (factory) { var _this = this; var ops = this._objectPaths.clone().appendActionToLast(opQuery(this.getSelects())); return this.send(ops).then(function (r) { return extend(new factory(_this), r); }); }; /** * Sends the request, merging the result data array with a new instances of factory */ ClientSvcQueryable.prototype.sendGetCollection = function (factory) { var ops = this._objectPaths.clone().appendActionToLast(opQuery([], this.getSelects())); return this.send(ops).then(function (r) { return r.map(function (d) { return extend(factory(d), d); }); }); }; /** * Invokes the specified method on the server and returns the result * * @param methodName Name of the method to invoke * @param params Method parameters * @param actions Any additional actions to execute in addition to the method invocation (set property for example) */ ClientSvcQueryable.prototype.invokeMethod = function (methodName, params) { if (params === void 0) { params = null; } var actions = []; for (var _i = 2; _i < arguments.length; _i++) { actions[_i - 2] = arguments[_i]; } return this.invokeMethodImpl(methodName, params, actions, opQuery([], null)); }; /** * Invokes the specified non-query method on the server * * @param methodName Name of the method to invoke * @param params Method parameters * @param actions Any additional actions to execute in addition to the method invocation (set property for example) */ ClientSvcQueryable.prototype.invokeNonQuery = function (methodName, params) { if (params === void 0) { params = null; } var actions = []; for (var _i = 2; _i < arguments.length; _i++) { actions[_i - 2] = arguments[_i]; } // by definition we are not returning anything from these calls so we should not be caching the results this._useCaching = false; return this.invokeMethodImpl(methodName, params, actions, null, true); }; /** * Invokes the specified method on the server and returns the resulting collection * * @param methodName Name of the method to invoke * @param params Method parameters * @param actions Any additional actions to execute in addition to the method invocation (set property for example) */ ClientSvcQueryable.prototype.invokeMethodCollection = function (methodName, params) { if (params === void 0) { params = null; } var actions = []; for (var _i = 2; _i < arguments.length; _i++) { actions[_i - 2] = arguments[_i]; } return this.invokeMethodImpl(methodName, params, actions, opQuery([], [])); }; /** * Updates this instance, returning a copy merged with the updated data after the update * * @param properties Plain object of the properties and values to update * @param factory Factory method use to create a new instance of FactoryType */ ClientSvcQueryable.prototype.invokeUpdate = function (properties, factory) { var _this = this; var ops = this._objectPaths.clone(); // append setting all the properties to this instance objectProperties(properties).map(function (a) { return ops.appendActionToLast(a); }); ops.appendActionToLast(opQuery([], null)); return this.send(ops).then(function (r) { return extend(new factory(_this), r); }); }; /** * Converts the current instance to a request context * * @param verb The request verb * @param options The set of supplied request options * @param parser The supplied ODataParser instance * @param pipeline Optional request processing pipeline */ ClientSvcQueryable.prototype.toRequestContext = function (verb, options, parser, pipeline) { var _this = this; return toAbsoluteUrl(this.toUrlAndQuery()).then(function (url) { mergeOptions(options, _this._options); var headers = new Headers(); mergeHeaders(headers, options.headers); mergeHeaders(headers, { "accept": "*/*", "content-type": "text/xml", }); options = extend(options, { headers: headers }); // we need to do some special cache handling to ensure we have a good key if (_this._useCaching) { // because all the requests use the same url they would collide in the cache we use a special key var cacheKey = "PnPjs.ProcessQueryClient(" + getHashCode(_this._objectPaths.toBody()) + ")"; if (objectDefinedNotNull(_this._cachingOptions)) { // if our key ends in the ProcessQuery url we overwrite it if (/\/client\.svc\/ProcessQuery\?$/i.test(_this._cachingOptions.key)) { _this._cachingOptions.key = cacheKey; } } else { _this._cachingOptions = new CachingOptions(cacheKey); } } var dependencyDispose = _this.hasBatch ? _this.addBatchDependency() : function () { return; }; // build our request context var context = { batch: _this.batch, batchDependency: dependencyDispose, cachingOptions: _this._cachingOptions, clientFactory: function () { return new SPHttpClient(); }, isBatched: _this.hasBatch, isCached: _this._useCaching, options: options, parser: parser, pipeline: pipeline, requestAbsoluteUrl: url, requestId: getGUID(), verb: verb, }; return context; }); }; /** * Blocks a batch call from occuring, MUST be cleared by calling the returned function */ ClientSvcQueryable.prototype.addBatchDependency = function () { if (this._batch !== null) { return this._batch.addDependency(); } return function () { return null; }; }; Object.defineProperty(ClientSvcQueryable.prototype, "hasBatch", { /** * Indicates if the current query has a batch associated * */ get: function () { return objectDefinedNotNull(this._batch); }, enumerable: true, configurable: true }); Object.defineProperty(ClientSvcQueryable.prototype, "batch", { /** * The batch currently associated with this query or null * */ get: function () { return this.hasBatch ? this._batch : null; }, enumerable: true, configurable: true }); /** * Executes the actual invoke method call * * @param methodName Name of the method to invoke * @param params Method parameters * @param queryAction Specifies the query action to take */ ClientSvcQueryable.prototype.invokeMethodImpl = function (methodName, params, actions, queryAction, isAction) { if (isAction === void 0) { isAction = false; } var ops = this._objectPaths.clone(); if (isAction) { ops.appendActionToLast(methodAction(methodName, params)); } else { ops.add(method.apply(void 0, [methodName, params].concat([objectPath()].concat(actions, [queryAction])))); } return this.send(ops); }; return ClientSvcQueryable; }(Queryable)); /** * Implements ODataBatch for use with the ObjectPath framework */ var ObjectPathBatch = /** @class */ (function (_super) { __extends(ObjectPathBatch, _super); function ObjectPathBatch(parentUrl, _batchId) { var _this = _super.call(this, _batchId) || this; _this.parentUrl = parentUrl; return _this; } ObjectPathBatch.prototype.executeImpl = function () { // if we don't have any requests, don't bother sending anything // this could be due to caching further upstream, or just an empty batch if (this.requests.length < 1) { Logger.write("Resolving empty batch.", 1 /* Info */); return Promise.resolve(); } var executor = new BatchExecutor(this.parentUrl, this.batchId); executor.appendRequests(this.requests); return executor.execute(); }; return ObjectPathBatch; }(ODataBatch)); var BatchExecutor = /** @class */ (function (_super) { __extends(BatchExecutor, _super); function BatchExecutor(parentUrl, batchId) { var _this = _super.call(this, parentUrl) || this; _this.batchId = batchId; _this._requests = []; _this._builderIndex = 1; // we add our session object path and hard code in the IDs so we can reference it var method$$1 = staticMethod("GetTaxonomySession", "{981cbc68-9edc-4f8d-872f-71146fcbb84f}"); method$$1.path = opSetId("0", method$$1.path); method$$1.actions.push(opSetId("1", opSetPathId("0", objectPath()))); _this._objectPaths.add(method$$1); return _this; } BatchExecutor.prototype.appendRequests = function (requests) { var _this = this; requests.forEach(function (request) { // grab the special property we added to options when we created the batch info var pathQueue = request.options.clientsvc_ObjectPaths; var paths = pathQueue.toArray(); // getChildRelationships if (paths.length < 0) { return; } var indexMappingFunction = function (n) { return n; }; if (/GetTaxonomySession/i.test(paths[0].path)) { // drop the first thing as it is a get session object path, which we add once for the entire batch paths = paths.slice(1); // replace the next item's parent id with 0, which will be the id of the session call at the root of this request paths[0].path = opSetParentId("0", paths[0].path); indexMappingFunction = function (n) { return n - 1; }; } var lastOpId = -1; var idIndexMap = []; paths.map(function (op, index, arr) { // rewrite the path string var opId = ++_this._builderIndex; // track the array index => opId relationship idIndexMap.push(opId); var path = opSetPathParamId(idIndexMap, opSetId(opId.toString(), op.path), indexMappingFunction); if (lastOpId >= 0) { path = opSetParentId(lastOpId.toString(), path); } // rewrite actions with placeholders replaced var opActions = op.actions.map(function (a) { var actionId = ++_this._builderIndex; return opSetId(actionId.toString(), opSetPathId(opId.toString(), a)); }); // handle any specific child relationships // the childIndex is reduced by 1 because we are removing the Session Path pathQueue.getChildRelationship(index + 1).map(function (i) { return i - 1; }).forEach(function (childIndex) { // set the parent id for our non-immediate children arr[childIndex].path = opSetParentId(opId.toString(), arr[childIndex].path); }); // and remember our last object path id for the parent replace above lastOpId = opId; // return our now substituted path and actions as a new object path instance return new ObjectPath(path, opActions); }).forEach(function (op) { return _this._objectPaths.add(op); }); // get this once var obPaths = _this._objectPaths.toArray(); // create a new parser to handle finding the result based on the path var parser = new ProcessQueryParser(obPaths[obPaths.length - 1]); if (request.parser instanceof CachingParserWrapper) { // handle special case of caching request.parser = new ProcessQueryCachingParserWrapper(parser, request.parser); } else { request.parser = parser; } // add the request to our batch requests _this._requests.push(request); // remove the temp property delete request.options.clientsvc_ObjectPaths; }); }; BatchExecutor.prototype.execute = function () { var _this = this; Logger.write("[" + this.batchId + "] (" + (new Date()).getTime() + ") Executing batch with " + this._requests.length + " requests.", 1 /* Info */); // create our request body from all the merged object paths var options = { body: writeObjectPathBody(this._objectPaths.toArray()), }; Logger.write("[" + this.batchId + "] (" + (new Date()).getTime() + ") Sending batch request.", 1 /* Info */); // send the batch return _super.prototype.postCore.call(this, options, new BatchParser()).then(function (rawResponse) { Logger.write("[" + _this.batchId + "] (" + (new Date()).getTime() + ") Resolving batched requests.", 1 /* Info */); return _this._requests.reduce(function (chain, request) { Logger.write("[" + request.id + "] (" + (new Date()).getTime() + ") Resolving request in batch " + _this.batchId + ".", 1 /* Info */); return chain.then(function (_) { return request.parser.findResult(rawResponse).then(request.resolve).catch(request.reject); }); }, Promise.resolve()); }); }; return BatchExecutor; }(ClientSvcQueryable)); /** * Used to return the raw results from parsing the batch */ var BatchParser = /** @class */ (function (_super) { __extends(BatchParser, _super); function BatchParser() { return _super.call(this, null) || this; } BatchParser.prototype.findResult = function (json) { // we leave it to the individual request parsers to find their results in the raw json body return json; }; return BatchParser; }(ProcessQueryParser)); /** * Handles processing batched results that are also cached */ var ProcessQueryCachingParserWrapper = /** @class */ (function (_super) { __extends(ProcessQueryCachingParserWrapper, _super); function ProcessQueryCachingParserWrapper(parser, wrapper) { return _super.call(this, parser, wrapper.cacheOptions) || this; } ProcessQueryCachingParserWrapper.prototype.findResult = function (json) { var _this = this; return this.parser.findResult(json).then(function (d) { return _this.cacheData(d); }); }; return ProcessQueryCachingParserWrapper; }(CachingParserWrapper)); export { ObjectPathBatch, ClientSvcQueryable, ObjectPath, opSetId, opSetPathId, opSetParentId, opSetPathParamId, ObjectPathQueue, objectPath, identityQuery, opQuery, setProperty, methodAction, objectProperties, property, staticMethod, staticProperty, objConstructor, MethodParams, method, ProcessQueryParser, writeObjectPathBody }; //# sourceMappingURL=sp-clientsvc.es5.js.map
{ "content_hash": "d9716658cacc56864f24dab66cc2163e", "timestamp": "", "source": "github", "line_count": 1008, "max_line_length": 331, "avg_line_length": 41.30952380952381, "alnum_prop": 0.5632804995196926, "repo_name": "seogi1004/cdnjs", "id": "c8c623416c52000aae69d52e6fc38e942030fd90", "size": "41990", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "ajax/libs/pnp-sp-clientsvc/1.2.1/sp-clientsvc.es5.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package com.redhat.iot.cargodemo.rest; import com.redhat.iot.cargodemo.model.Customer; import com.redhat.iot.cargodemo.service.DGService; import javax.inject.Inject; import javax.inject.Singleton; import javax.ws.rs.*; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * A simple REST service which proxies requests to a local datagrid. * * @author [email protected] */ @Path("/customer") @Singleton public class CustomerEndpoint { @Inject DGService dgService; @GET @Path("/{id}") @Produces({"application/json"}) public Customer getCustomer(@PathParam("id") String id) { return dgService.getCustomers().get(id); } @PUT @Path("/{id}") public void putCustomer(@PathParam("id") String id, Customer value) { dgService.getCustomers().put(id, value); } @GET @Path("/") @Produces({"application/json"}) public List<Customer> getAllCustomers() { Map<String, Customer> cache = dgService.getCustomers(); return cache.keySet().stream() .map(cache::get) .collect(Collectors.toList()); } }
{ "content_hash": "3a9b2b107b6670b270cd2f711b78ef06", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 73, "avg_line_length": 21.814814814814813, "alnum_prop": 0.6621392190152802, "repo_name": "kartben/eclipseiot-testbed-assettracking-cloud", "id": "bdf2e8c809401d62f81458183e5f9915e90e2266", "size": "1975", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "dgproxy/src/main/java/com/redhat/iot/cargodemo/rest/CustomerEndpoint.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1479" }, { "name": "HTML", "bytes": "18986" }, { "name": "Java", "bytes": "45647" }, { "name": "JavaScript", "bytes": "72989" }, { "name": "Shell", "bytes": "3455" } ], "symlink_target": "" }
<?php // Start of standard v.5.4.0RC6 class __PHP_Incomplete_Class { } class php_user_filter { public $filtername; public $params; /** * @param in * @param out * @param consumed * @param closing */ public function filter ($in, $out, &$consumed, $closing) {} public function onCreate () {} public function onClose () {} } class Directory { /** * Close directory handle * @link http://www.php.net/manual/en/directory.close.php * @param dir_handle resource[optional] * @return void */ public function close ($dir_handle = null) {} /** * Rewind directory handle * @link http://www.php.net/manual/en/directory.rewind.php * @param dir_handle resource[optional] * @return void */ public function rewind ($dir_handle = null) {} /** * Read entry from directory handle * @link http://www.php.net/manual/en/directory.read.php * @param dir_handle resource[optional] * @return string */ public function read ($dir_handle = null) {} } /** * Returns the value of a constant * @link http://www.php.net/manual/en/function.constant.php * @param name string <p> * The constant name. * </p> * @return mixed the value of the constant, or &null; if the constant is not * defined. */ function constant ($name) {} /** * Convert binary data into hexadecimal representation * @link http://www.php.net/manual/en/function.bin2hex.php * @param str string <p> * A string. * </p> * @return string the hexadecimal representation of the given string. */ function bin2hex ($str) {} /** * Convert hex to binary * @link http://www.php.net/manual/en/function.hex2bin.php * @param data string <p> * Hexadecimal representation of data. * </p> * @return string the binary representation of the given data. */ function hex2bin ($data) {} /** * Delay execution * @link http://www.php.net/manual/en/function.sleep.php * @param seconds int <p> * Halt time in seconds. * </p> * @return int zero on success, or false on error. * </p> * <p> * If the call was interrupted by a signal, sleep returns * a non-zero value. On Windows, this value will always be * 192 (the value of the * WAIT_IO_COMPLETION constant within the Windows API). * On other platforms, the return value will be the number of seconds left to * sleep. */ function sleep ($seconds) {} /** * Delay execution in microseconds * @link http://www.php.net/manual/en/function.usleep.php * @param micro_seconds int <p> * Halt time in micro seconds. A micro second is one millionth of a * second. * </p> * @return void */ function usleep ($micro_seconds) {} /** * Delay for a number of seconds and nanoseconds * @link http://www.php.net/manual/en/function.time-nanosleep.php * @param seconds int <p> * Must be a non-negative integer. * </p> * @param nanoseconds int <p> * Must be a non-negative integer less than 1 billion. * </p> * @return mixed Returns true on success or false on failure. * </p> * <p> * If the delay was interrupted by a signal, an associative array will be * returned with the components: * seconds - number of seconds remaining in * the delay * nanoseconds - number of nanoseconds * remaining in the delay */ function time_nanosleep ($seconds, $nanoseconds) {} /** * Make the script sleep until the specified time * @link http://www.php.net/manual/en/function.time-sleep-until.php * @param timestamp float <p> * The timestamp when the script should wake. * </p> * @return bool Returns true on success or false on failure. */ function time_sleep_until ($timestamp) {} /** * Parse a time/date generated with <function>strftime</function> * @link http://www.php.net/manual/en/function.strptime.php * @param date string <p> * The string to parse (e.g. returned from strftime). * </p> * @param format string <p> * The format used in date (e.g. the same as * used in strftime). Note that some of the format * options available to strftime may not have any * effect within strptime; the exact subset that are * supported will vary based on the operating system and C library in * use. * </p> * <p> * For more information about the format options, read the * strftime page. * </p> * @return array an array&return.falseforfailure;. * </p> * <p> * <table> * The following parameters are returned in the array * <tr valign="top"> * <td>parameters</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>"tm_sec"</td> * <td>Seconds after the minute (0-61)</td> * </tr> * <tr valign="top"> * <td>"tm_min"</td> * <td>Minutes after the hour (0-59)</td> * </tr> * <tr valign="top"> * <td>"tm_hour"</td> * <td>Hour since midnight (0-23)</td> * </tr> * <tr valign="top"> * <td>"tm_mday"</td> * <td>Day of the month (1-31)</td> * </tr> * <tr valign="top"> * <td>"tm_mon"</td> * <td>Months since January (0-11)</td> * </tr> * <tr valign="top"> * <td>"tm_year"</td> * <td>Years since 1900</td> * </tr> * <tr valign="top"> * <td>"tm_wday"</td> * <td>Days since Sunday (0-6)</td> * </tr> * <tr valign="top"> * <td>"tm_yday"</td> * <td>Days since January 1 (0-365)</td> * </tr> * <tr valign="top"> * <td>"unparsed"</td> * <td>the date part which was not * recognized using the specified format</td> * </tr> * </table> */ function strptime ($date, $format) {} /** * Flush the output buffer * @link http://www.php.net/manual/en/function.flush.php * @return void */ function flush () {} /** * Wraps a string to a given number of characters * @link http://www.php.net/manual/en/function.wordwrap.php * @param str string <p> * The input string. * </p> * @param width int[optional] <p> * The column width. * </p> * @param break string[optional] <p> * The line is broken using the optional * break parameter. * </p> * @param cut bool[optional] <p> * If the cut is set to true, the string is * always wrapped at or before the specified width. So if you have * a word that is larger than the given width, it is broken apart. * (See second example). * </p> * @return string the given string wrapped at the specified column. */ function wordwrap ($str, $width = null, $break = null, $cut = null) {} /** * Convert special characters to HTML entities * @link http://www.php.net/manual/en/function.htmlspecialchars.php * @param string string <p> * The string being converted. * </p> * @param flags int[optional] <p> * A bitmask of one or more of the following flags, which specify how to handle quotes, * invalid code unit sequences and the used document type. The default is * ENT_COMPAT | ENT_HTML401. * <table> * Available flags constants * <tr valign="top"> * <td>Constant Name</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>ENT_COMPAT</td> * <td>Will convert double-quotes and leave single-quotes alone.</td> * </tr> * <tr valign="top"> * <td>ENT_QUOTES</td> * <td>Will convert both double and single quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_NOQUOTES</td> * <td>Will leave both double and single quotes unconverted.</td> * </tr> * <tr valign="top"> * <td>ENT_IGNORE</td> * <td> * Silently discard invalid code unit sequences instead of returning * an empty string. Using this flag is discouraged as it * may have security implications. * </td> * </tr> * <tr valign="top"> * <td>ENT_SUBSTITUTE</td> * <td> * Replace invalid code unit sequences with a Unicode Replacement Character * U+FFFD (UTF-8) or &amp;#FFFD; (otherwise) instead of returning an empty string. * </td> * </tr> * <tr valign="top"> * <td>ENT_DISALLOWED</td> * <td> * Replace code unit sequences, which are invalid in the specified document type, * with a Unicode Replacement Character U+FFFD (UTF-8) or &amp;#FFFD; (otherwise). * </td> * </tr> * <tr valign="top"> * <td>ENT_HTML401</td> * <td> * Handle code as HTML 4.01. * </td> * </tr> * <tr valign="top"> * <td>ENT_XML1</td> * <td> * Handle code as XML 1. * </td> * </tr> * <tr valign="top"> * <td>ENT_XHTML</td> * <td> * Handle code as XHTML. * </td> * </tr> * <tr valign="top"> * <td>ENT_HTML5</td> * <td> * Handle code as HTML 5. * </td> * </tr> * </table> * </p> * @param charset string[optional] <p> * Defines character set used in conversion. * If omitted, the default value for this argument is ISO-8859-1 in * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. * </p> * <p> * For the purposes of this function, the charsets * ISO-8859-1, ISO-8859-15, * UTF-8, cp866, * cp1251, cp1252, and * KOI8-R are effectively equivalent, provided the * string itself is valid for the character set, as * the characters affected by htmlspecialchars occupy * the same positions in all of these charsets. * </p> * &reference.strings.charsets; * @param double_encode bool[optional] <p> * When double_encode is turned off PHP will not * encode existing html entities, the default is to convert everything. * </p> * @return string The converted string. * </p> * <p> * If the input string contains an invalid code unit * sequence within the given charset an empty string * will be returned, unless either the ENT_IGNORE or * ENT_SUBSTITUTE flags are set. */ function htmlspecialchars ($string, $flags = null, $charset = null, $double_encode = null) {} /** * Convert all applicable characters to HTML entities * @link http://www.php.net/manual/en/function.htmlentities.php * @param string string <p> * The input string. * </p> * @param flags int[optional] <p> * A bitmask of one or more of the following flags, which specify how to handle quotes, * invalid code unit sequences and the used document type. The default is * ENT_COMPAT | ENT_HTML401. * <table> * Available flags constants * <tr valign="top"> * <td>Constant Name</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>ENT_COMPAT</td> * <td>Will convert double-quotes and leave single-quotes alone.</td> * </tr> * <tr valign="top"> * <td>ENT_QUOTES</td> * <td>Will convert both double and single quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_NOQUOTES</td> * <td>Will leave both double and single quotes unconverted.</td> * </tr> * <tr valign="top"> * <td>ENT_IGNORE</td> * <td> * Silently discard invalid code unit sequences instead of returning * an empty string. Using this flag is discouraged as it * may have security implications. * </td> * </tr> * <tr valign="top"> * <td>ENT_SUBSTITUTE</td> * <td> * Replace invalid code unit sequences with a Unicode Replacement Character * U+FFFD (UTF-8) or &amp;#FFFD; (otherwise) instead of returning an empty string. * </td> * </tr> * <tr valign="top"> * <td>ENT_DISALLOWED</td> * <td> * Replace code unit sequences, which are invalid in the specified document type, * with a Unicode Replacement Character U+FFFD (UTF-8) or &amp;#FFFD; (otherwise). * </td> * </tr> * <tr valign="top"> * <td>ENT_HTML401</td> * <td> * Handle code as HTML 4.01. * </td> * </tr> * <tr valign="top"> * <td>ENT_XML1</td> * <td> * Handle code as XML 1. * </td> * </tr> * <tr valign="top"> * <td>ENT_XHTML</td> * <td> * Handle code as XHTML. * </td> * </tr> * <tr valign="top"> * <td>ENT_HTML5</td> * <td> * Handle code as HTML 5. * </td> * </tr> * </table> * </p> * @param charset string[optional] <p> * Like htmlspecialchars, * htmlentities takes an optional third argument * charset which defines character set used in * conversion. * If omitted, the default value for this argument is ISO-8859-1 in * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. * Although this argument is technically optional, you are highly * encouraged to specify the correct value for your code. * </p> * &reference.strings.charsets; * @param double_encode bool[optional] <p> * When double_encode is turned off PHP will not * encode existing html entities. The default is to convert everything. * </p> * @return string the encoded string. * </p> * <p> * If the input string contains an invalid code unit * sequence within the given charset an empty string * will be returned, unless either the ENT_IGNORE or * ENT_SUBSTITUTE flags are set. */ function htmlentities ($string, $flags = null, $charset = null, $double_encode = null) {} /** * Convert all HTML entities to their applicable characters * @link http://www.php.net/manual/en/function.html-entity-decode.php * @param string string <p> * The input string. * </p> * @param flags int[optional] <p> * A bitmask of one or more of the following flags, which specify how to handle quotes and * which document type to use. The default is ENT_COMPAT | ENT_HTML401. * <table> * Available flags constants * <tr valign="top"> * <td>Constant Name</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>ENT_COMPAT</td> * <td>Will convert double-quotes and leave single-quotes alone.</td> * </tr> * <tr valign="top"> * <td>ENT_QUOTES</td> * <td>Will convert both double and single quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_NOQUOTES</td> * <td>Will leave both double and single quotes unconverted.</td> * </tr> * <tr valign="top"> * <td>ENT_HTML401</td> * <td> * Handle code as HTML 4.01. * </td> * </tr> * <tr valign="top"> * <td>ENT_XML1</td> * <td> * Handle code as XML 1. * </td> * </tr> * <tr valign="top"> * <td>ENT_XHTML</td> * <td> * Handle code as XHTML. * </td> * </tr> * <tr valign="top"> * <td>ENT_HTML5</td> * <td> * Handle code as HTML 5. * </td> * </tr> * </table> * </p> * @param charset string[optional] <p> * Character set to use. * If omitted, the default value for this argument is ISO-8859-1 in * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. * </p> * &reference.strings.charsets; * @return string the decoded string. */ function html_entity_decode ($string, $flags = null, $charset = null) {} /** * Convert special HTML entities back to characters * @link http://www.php.net/manual/en/function.htmlspecialchars-decode.php * @param string string <p> * The string to decode. * </p> * @param flags int[optional] <p> * A bitmask of one or more of the following flags, which specify how to handle quotes and * which document type to use. The default is ENT_COMPAT | ENT_HTML401. * <table> * Available flags constants * <tr valign="top"> * <td>Constant Name</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>ENT_COMPAT</td> * <td>Will convert double-quotes and leave single-quotes alone.</td> * </tr> * <tr valign="top"> * <td>ENT_QUOTES</td> * <td>Will convert both double and single quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_NOQUOTES</td> * <td>Will leave both double and single quotes unconverted.</td> * </tr> * <tr valign="top"> * <td>ENT_HTML401</td> * <td> * Handle code as HTML 4.01. * </td> * </tr> * <tr valign="top"> * <td>ENT_XML1</td> * <td> * Handle code as XML 1. * </td> * </tr> * <tr valign="top"> * <td>ENT_XHTML</td> * <td> * Handle code as XHTML. * </td> * </tr> * <tr valign="top"> * <td>ENT_HTML5</td> * <td> * Handle code as HTML 5. * </td> * </tr> * </table> * </p> * @return string the decoded string. */ function htmlspecialchars_decode ($string, $flags = null) {} /** * Returns the translation table used by <function>htmlspecialchars</function> and <function>htmlentities</function> * @link http://www.php.net/manual/en/function.get-html-translation-table.php * @param table int[optional] <p> * Which table to return. Either HTML_ENTITIES or * HTML_SPECIALCHARS. * </p> * @param flags int[optional] <p> * A bitmask of one or more of the following flags, which specify which quotes the * table will contain as well as which document type the table is for. The default is * ENT_COMPAT | ENT_HTML401. * <table> * Available flags constants * <tr valign="top"> * <td>Constant Name</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>ENT_COMPAT</td> * <td>Table will contain entities for double-quotes, but not for single-quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_QUOTES</td> * <td>Table will contain entities for both double and single quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_NOQUOTES</td> * <td>Table will neither contain entities for single quotes nor for double quotes.</td> * </tr> * <tr valign="top"> * <td>ENT_HTML401</td> * <td>Table for HTML 4.01.</td> * </tr> * <tr valign="top"> * <td>ENT_XML1</td> * <td>Table for XML 1.</td> * </tr> * <tr valign="top"> * <td>ENT_XHTML</td> * <td>Table for XHTML.</td> * </tr> * <tr valign="top"> * <td>ENT_HTML5</td> * <td>Table for HTML 5.</td> * </tr> * </table> * </p> * @param charset string[optional] <p> * Character set to use. * If omitted, the default value for this argument is ISO-8859-1 in * versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards. * </p> * &reference.strings.charsets; * @return array the translation table as an array, with the original characters * as keys and entities as values. */ function get_html_translation_table ($table = null, $flags = null, $charset = null) {} /** * Calculate the sha1 hash of a string * @link http://www.php.net/manual/en/function.sha1.php * @param str string <p> * The input string. * </p> * @param raw_output bool[optional] <p> * If the optional raw_output is set to true, * then the sha1 digest is instead returned in raw binary format with a * length of 20, otherwise the returned value is a 40-character * hexadecimal number. * </p> * @return string the sha1 hash as a string. */ function sha1 ($str, $raw_output = null) {} /** * Calculate the sha1 hash of a file * @link http://www.php.net/manual/en/function.sha1-file.php * @param filename string <p> * The filename of the file to hash. * </p> * @param raw_output bool[optional] <p> * When true, returns the digest in raw binary format with a length of * 20. * </p> * @return string a string on success, false otherwise. */ function sha1_file ($filename, $raw_output = null) {} /** * Calculate the md5 hash of a string * @link http://www.php.net/manual/en/function.md5.php * @param str string <p> * The string. * </p> * @param raw_output bool[optional] <p> * If the optional raw_output is set to true, * then the md5 digest is instead returned in raw binary format with a * length of 16. * </p> * @return string the hash as a 32-character hexadecimal number. */ function md5 ($str, $raw_output = null) {} /** * Calculates the md5 hash of a given file * @link http://www.php.net/manual/en/function.md5-file.php * @param filename string <p> * The filename * </p> * @param raw_output bool[optional] <p> * When true, returns the digest in raw binary format with a length of * 16. * </p> * @return string a string on success, false otherwise. */ function md5_file ($filename, $raw_output = null) {} /** * Calculates the crc32 polynomial of a string * @link http://www.php.net/manual/en/function.crc32.php * @param str string <p> * The data. * </p> * @return int the crc32 checksum of str as an integer. */ function crc32 ($str) {} /** * Parse a binary IPTC block into single tags. * @link http://www.php.net/manual/en/function.iptcparse.php * @param iptcblock string <p> * A binary IPTC block. * </p> * @return array an array using the tagmarker as an index and the value as the * value. It returns false on error or if no IPTC data was found. */ function iptcparse ($iptcblock) {} /** * Embeds binary IPTC data into a JPEG image * @link http://www.php.net/manual/en/function.iptcembed.php * @param iptcdata string <p> * The data to be written. * </p> * @param jpeg_file_name string <p> * Path to the JPEG image. * </p> * @param spool int[optional] <p> * Spool flag. If the spool flag is over 2 then the JPEG will be * returned as a string. * </p> * @return mixed If success and spool flag is lower than 2 then the JPEG will not be * returned as a string, false on errors. */ function iptcembed ($iptcdata, $jpeg_file_name, $spool = null) {} /** * Get the size of an image * @link http://www.php.net/manual/en/function.getimagesize.php * @param filename string <p> * This parameter specifies the file you wish to retrieve information * about. It can reference a local file or (configuration permitting) a * remote file using one of the supported streams. * </p> * @param imageinfo array[optional] <p> * This optional parameter allows you to extract some extended * information from the image file. Currently, this will return the * different JPG APP markers as an associative array. * Some programs use these APP markers to embed text information in * images. A very common one is to embed * IPTC information in the APP13 marker. * You can use the iptcparse function to parse the * binary APP13 marker into something readable. * </p> * @return array an array with 7 elements. * </p> * <p> * Index 0 and 1 contains respectively the width and the height of the image. * </p> * <p> * Some formats may contain no image or may contain multiple images. In these * cases, getimagesize might not be able to properly * determine the image size. getimagesize will return * zero for width and height in these cases. * </p> * <p> * Index 2 is one of the IMAGETYPE_XXX constants indicating * the type of the image. * </p> * <p> * Index 3 is a text string with the correct * height="yyy" width="xxx" string that can be used * directly in an IMG tag. * </p> * <p> * mime is the correspondant MIME type of the image. * This information can be used to deliver images with the correct HTTP * Content-type header: * getimagesize and MIME types * ]]> * </p> * <p> * channels will be 3 for RGB pictures and 4 for CMYK * pictures. * </p> * <p> * bits is the number of bits for each color. * </p> * <p> * For some image types, the presence of channels and * bits values can be a bit * confusing. As an example, GIF always uses 3 channels * per pixel, but the number of bits per pixel cannot be calculated for an * animated GIF with a global color table. * </p> * <p> * On failure, false is returned. */ function getimagesize ($filename, array &$imageinfo = null) {} /** * @param imagefile * @param info[optional] */ function getimagesizefromstring ($imagefile, &$info) {} /** * Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype * @link http://www.php.net/manual/en/function.image-type-to-mime-type.php * @param imagetype int <p> * One of the IMAGETYPE_XXX constants. * </p> * @return string The returned values are as follows * <table> * Returned values Constants * <tr valign="top"> * <td>imagetype</td> * <td>Returned value</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_GIF</td> * <td>image/gif</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_JPEG</td> * <td>image/jpeg</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_PNG</td> * <td>image/png</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_SWF</td> * <td>application/x-shockwave-flash</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_PSD</td> * <td>image/psd</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_BMP</td> * <td>image/bmp</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_TIFF_II (intel byte order)</td> * <td>image/tiff</td> * </tr> * <tr valign="top"> * <td> * IMAGETYPE_TIFF_MM (motorola byte order) * </td> * <td>image/tiff</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_JPC</td> * <td>application/octet-stream</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_JP2</td> * <td>image/jp2</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_JPX</td> * <td>application/octet-stream</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_JB2</td> * <td>application/octet-stream</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_SWC</td> * <td>application/x-shockwave-flash</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_IFF</td> * <td>image/iff</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_WBMP</td> * <td>image/vnd.wap.wbmp</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_XBM</td> * <td>image/xbm</td> * </tr> * <tr valign="top"> * <td>IMAGETYPE_ICO</td> * <td>image/vnd.microsoft.icon</td> * </tr> * </table> */ function image_type_to_mime_type ($imagetype) {} /** * Get file extension for image type * @link http://www.php.net/manual/en/function.image-type-to-extension.php * @param imagetype int <p> * One of the IMAGETYPE_XXX constant. * </p> * @param include_dot bool[optional] <p> * Whether to prepend a dot to the extension or not. Default to true. * </p> * @return string A string with the extension corresponding to the given image type. */ function image_type_to_extension ($imagetype, $include_dot = null) {} /** * Outputs information about PHP's configuration * @link http://www.php.net/manual/en/function.phpinfo.php * @param what int[optional] <p> * The output may be customized by passing one or more of the * following constants bitwise values summed * together in the optional what parameter. * One can also combine the respective constants or bitwise values * together with the or operator. * </p> * <p> * <table> * phpinfo options * <tr valign="top"> * <td>Name (constant)</td> * <td>Value</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>INFO_GENERAL</td> * <td>1</td> * <td> * The configuration line, &php.ini; location, build date, Web * Server, System and more. * </td> * </tr> * <tr valign="top"> * <td>INFO_CREDITS</td> * <td>2</td> * <td> * PHP Credits. See also phpcredits. * </td> * </tr> * <tr valign="top"> * <td>INFO_CONFIGURATION</td> * <td>4</td> * <td> * Current Local and Master values for PHP directives. See * also ini_get. * </td> * </tr> * <tr valign="top"> * <td>INFO_MODULES</td> * <td>8</td> * <td> * Loaded modules and their respective settings. See also * get_loaded_extensions. * </td> * </tr> * <tr valign="top"> * <td>INFO_ENVIRONMENT</td> * <td>16</td> * <td> * Environment Variable information that's also available in * $_ENV. * </td> * </tr> * <tr valign="top"> * <td>INFO_VARIABLES</td> * <td>32</td> * <td> * Shows all * predefined variables from EGPCS (Environment, GET, * POST, Cookie, Server). * </td> * </tr> * <tr valign="top"> * <td>INFO_LICENSE</td> * <td>64</td> * <td> * PHP License information. See also the license FAQ. * </td> * </tr> * <tr valign="top"> * <td>INFO_ALL</td> * <td>-1</td> * <td> * Shows all of the above. * </td> * </tr> * </table> * </p> * @return bool Returns true on success or false on failure. */ function phpinfo ($what = null) {} /** * Gets the current PHP version * @link http://www.php.net/manual/en/function.phpversion.php * @param extension string[optional] <p> * An optional extension name. * </p> * @return string If the optional extension parameter is * specified, phpversion returns the version of that * extension, or false if there is no version information associated or * the extension isn't enabled. */ function phpversion ($extension = null) {} /** * Prints out the credits for PHP * @link http://www.php.net/manual/en/function.phpcredits.php * @param flag int[optional] <p> * To generate a custom credits page, you may want to use the * flag parameter. * </p> * <p> * <table> * Pre-defined phpcredits flags * <tr valign="top"> * <td>name</td> * <td>description</td> * </tr> * <tr valign="top"> * <td>CREDITS_ALL</td> * <td> * All the credits, equivalent to using: CREDITS_DOCS + * CREDITS_GENERAL + CREDITS_GROUP + * CREDITS_MODULES + CREDITS_FULLPAGE. * It generates a complete stand-alone HTML page with the appropriate tags. * </td> * </tr> * <tr valign="top"> * <td>CREDITS_DOCS</td> * <td>The credits for the documentation team</td> * </tr> * <tr valign="top"> * <td>CREDITS_FULLPAGE</td> * <td> * Usually used in combination with the other flags. Indicates * that a complete stand-alone HTML page needs to be * printed including the information indicated by the other * flags. * </td> * </tr> * <tr valign="top"> * <td>CREDITS_GENERAL</td> * <td> * General credits: Language design and concept, PHP authors * and SAPI module. * </td> * </tr> * <tr valign="top"> * <td>CREDITS_GROUP</td> * <td>A list of the core developers</td> * </tr> * <tr valign="top"> * <td>CREDITS_MODULES</td> * <td> * A list of the extension modules for PHP, and their authors * </td> * </tr> * <tr valign="top"> * <td>CREDITS_SAPI</td> * <td> * A list of the server API modules for PHP, and their authors * </td> * </tr> * </table> * </p> * @return bool Returns true on success or false on failure. */ function phpcredits ($flag = null) {} /** * Gets the logo guid * @link http://www.php.net/manual/en/function.php-logo-guid.php * @return string PHPE9568F34-D428-11d2-A769-00AA001ACF42. */ function php_logo_guid () {} function php_real_logo_guid () {} function php_egg_logo_guid () {} /** * Gets the Zend guid * @link http://www.php.net/manual/en/function.zend-logo-guid.php * @return string PHPE9568F35-D428-11d2-A769-00AA001ACF42. */ function zend_logo_guid () {} /** * Returns the type of interface between web server and PHP * @link http://www.php.net/manual/en/function.php-sapi-name.php * @return string the interface type, as a lowercase string. * </p> * <p> * Although not exhaustive, the possible return values include * aolserver, apache, * apache2filter, apache2handler, * caudium, cgi (until PHP 5.3), * cgi-fcgi, cli, * continuity, embed, * isapi, litespeed, * milter, nsapi, * phttpd, pi3web, roxen, * thttpd, tux, and webjames. */ function php_sapi_name () {} /** * Returns information about the operating system PHP is running on * @link http://www.php.net/manual/en/function.php-uname.php * @param mode string[optional] <p> * mode is a single character that defines what * information is returned: * 'a': This is the default. Contains all modes in * the sequence "s n r v m". * @return string the description, as a string. */ function php_uname ($mode = null) {} /** * Return a list of .ini files parsed from the additional ini dir * @link http://www.php.net/manual/en/function.php-ini-scanned-files.php * @return string a comma-separated string of .ini files on success. Each comma is * followed by a newline. If the directive --with-config-file-scan-dir wasn't set, * false is returned. If it was set and the directory was empty, an * empty string is returned. If a file is unrecognizable, the file will * still make it into the returned string but a PHP error will also result. * This PHP error will be seen both at compile time and while using * php_ini_scanned_files. */ function php_ini_scanned_files () {} /** * Retrieve a path to the loaded php.ini file * @link http://www.php.net/manual/en/function.php-ini-loaded-file.php * @return string The loaded &php.ini; path, or false if one is not loaded. */ function php_ini_loaded_file () {} /** * String comparisons using a "natural order" algorithm * @link http://www.php.net/manual/en/function.strnatcmp.php * @param str1 string <p> * The first string. * </p> * @param str2 string <p> * The second string. * </p> * @return int Similar to other string comparison functions, this one returns &lt; 0 if * str1 is less than str2; &gt; * 0 if str1 is greater than * str2, and 0 if they are equal. */ function strnatcmp ($str1, $str2) {} /** * Case insensitive string comparisons using a "natural order" algorithm * @link http://www.php.net/manual/en/function.strnatcasecmp.php * @param str1 string <p> * The first string. * </p> * @param str2 string <p> * The second string. * </p> * @return int Similar to other string comparison functions, this one returns &lt; 0 if * str1 is less than str2 &gt; * 0 if str1 is greater than * str2, and 0 if they are equal. */ function strnatcasecmp ($str1, $str2) {} /** * Count the number of substring occurrences * @link http://www.php.net/manual/en/function.substr-count.php * @param haystack string <p> * The string to search in * </p> * @param needle string <p> * The substring to search for * </p> * @param offset int[optional] <p> * The offset where to start counting * </p> * @param length int[optional] <p> * The maximum length after the specified offset to search for the * substring. It outputs a warning if the offset plus the length is * greater than the haystack length. * </p> * @return int This function returns an integer. */ function substr_count ($haystack, $needle, $offset = null, $length = null) {} /** * Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask. * @link http://www.php.net/manual/en/function.strspn.php * @param subject string <p> * The string to examine. * </p> * @param mask string <p> * The list of allowable characters. * </p> * @param start int[optional] <p> * The position in subject to * start searching. * </p> * <p> * If start is given and is non-negative, * then strspn will begin * examining subject at * the start'th position. For instance, in * the string 'abcdef', the character at * position 0 is 'a', the * character at position 2 is * 'c', and so forth. * </p> * <p> * If start is given and is negative, * then strspn will begin * examining subject at * the start'th position from the end * of subject. * </p> * @param length int[optional] <p> * The length of the segment from subject * to examine. * </p> * <p> * If length is given and is non-negative, * then subject will be examined * for length characters after the starting * position. * </p> * <p> * If lengthis given and is negative, * then subject will be examined from the * starting position up to length * characters from the end of subject. * </p> * @return int the length of the initial segment of subject * which consists entirely of characters in mask. */ function strspn ($subject, $mask, $start = null, $length = null) {} /** * Find length of initial segment not matching mask * @link http://www.php.net/manual/en/function.strcspn.php * @param str1 string <p> * The first string. * </p> * @param str2 string <p> * The second string. * </p> * @param start int[optional] <p> * The start position of the string to examine. * </p> * @param length int[optional] <p> * The length of the string to examine. * </p> * @return int the length of the segment as an integer. */ function strcspn ($str1, $str2, $start = null, $length = null) {} /** * Tokenize string * @link http://www.php.net/manual/en/function.strtok.php * @param str string <p> * The string being split up into smaller strings (tokens). * </p> * @param token string <p> * The delimiter used when splitting up str. * </p> * @return string A string token. */ function strtok ($str, $token) {} /** * Make a string uppercase * @link http://www.php.net/manual/en/function.strtoupper.php * @param string string <p> * The input string. * </p> * @return string the uppercased string. */ function strtoupper ($string) {} /** * Make a string lowercase * @link http://www.php.net/manual/en/function.strtolower.php * @param str string <p> * The input string. * </p> * @return string the lowercased string. */ function strtolower ($str) {} /** * Find the position of the first occurrence of a substring in a string * @link http://www.php.net/manual/en/function.strpos.php * @param haystack string <p> * The string to search in. * </p> * @param needle mixed <p> * If needle is not a string, it is converted * to an integer and applied as the ordinal value of a character. * </p> * @param offset int[optional] <p> * If specified, search will start this number of characters counted from * the beginning of the string. Unlike strrpos and * strripos, the offset cannot be negative. * </p> * @return int the position of where the needle exists relative to the beginning of * the haystack string (independent of offset). * Also note that string positions start at 0, and not 1. * </p> * <p> * Returns false if the needle was not found. */ function strpos ($haystack, $needle, $offset = null) {} /** * Find the position of the first occurrence of a case-insensitive substring in a string * @link http://www.php.net/manual/en/function.stripos.php * @param haystack string <p> * The string to search in. * </p> * @param needle string <p> * Note that the needle may be a string of one or * more characters. * </p> * <p> * If needle is not a string, it is converted to * an integer and applied as the ordinal value of a character. * </p> * @param offset int[optional] <p> * If specified, search will start this number of characters counted from * the beginning of the string. Unlike strrpos and * strripos, the offset cannot be negative. * </p> * @return int the position of where the needle exists relative to the beginnning of * the haystack string (independent of offset). * Also note that string positions start at 0, and not 1. * </p> * <p> * Returns false if the needle was not found. */ function stripos ($haystack, $needle, $offset = null) {} /** * Find the position of the last occurrence of a substring in a string * @link http://www.php.net/manual/en/function.strrpos.php * @param haystack string <p> * The string to search in. * </p> * @param needle string <p> * If needle is not a string, it is converted * to an integer and applied as the ordinal value of a character. * </p> * @param offset int[optional] <p> * If specified, search will start this number of characters counted from the * beginning of the string. If the value is negative, search will instead start * from that many characters from the end of the string, searching backwards. * </p> * @return int the position where the needle exists relative to the beginnning of * the haystack string (independent of search direction * or offset). * Also note that string positions start at 0, and not 1. * </p> * <p> * Returns false if the needle was not found. */ function strrpos ($haystack, $needle, $offset = null) {} /** * Find the position of the last occurrence of a case-insensitive substring in a string * @link http://www.php.net/manual/en/function.strripos.php * @param haystack string <p> * The string to search in. * </p> * @param needle string <p> * If needle is not a string, it is converted * to an integer and applied as the ordinal value of a character. * </p> * @param offset int[optional] <p> * If specified, search will start this number of characters counted from the * beginning of the string. If the value is negative, search will instead start * from that many characters from the end of the string, searching backwards. * </p> * @return int the position where the needle exists relative to the beginnning of * the haystack string (independent of search direction * or offset). * Also note that string positions start at 0, and not 1. * </p> * <p> * Returns false if the needle was not found. */ function strripos ($haystack, $needle, $offset = null) {} /** * Reverse a string * @link http://www.php.net/manual/en/function.strrev.php * @param string string <p> * The string to be reversed. * </p> * @return string the reversed string. */ function strrev ($string) {} /** * Convert logical Hebrew text to visual text * @link http://www.php.net/manual/en/function.hebrev.php * @param hebrew_text string <p> * A Hebrew input string. * </p> * @param max_chars_per_line int[optional] <p> * This optional parameter indicates maximum number of characters per * line that will be returned. * </p> * @return string the visual string. */ function hebrev ($hebrew_text, $max_chars_per_line = null) {} /** * Convert logical Hebrew text to visual text with newline conversion * @link http://www.php.net/manual/en/function.hebrevc.php * @param hebrew_text string <p> * A Hebrew input string. * </p> * @param max_chars_per_line int[optional] <p> * This optional parameter indicates maximum number of characters per * line that will be returned. * </p> * @return string the visual string. */ function hebrevc ($hebrew_text, $max_chars_per_line = null) {} /** * Inserts HTML line breaks before all newlines in a string * @link http://www.php.net/manual/en/function.nl2br.php * @param string string <p> * The input string. * </p> * @param is_xhtml bool[optional] <p> * Whenever to use XHTML compatible line breaks or not. * </p> * @return string the altered string. */ function nl2br ($string, $is_xhtml = null) {} /** * Returns trailing name component of path * @link http://www.php.net/manual/en/function.basename.php * @param path string <p> * A path. * </p> * <p> * On Windows, both slash (/) and backslash * (\) are used as directory separator character. In * other environments, it is the forward slash (/). * </p> * @param suffix string[optional] <p> * If the name component ends in suffix this will also * be cut off. * </p> * @return string the base name of the given path. */ function basename ($path, $suffix = null) {} /** * Returns parent directory's path * @link http://www.php.net/manual/en/function.dirname.php * @param path string <p> * A path. * </p> * <p> * On Windows, both slash (/) and backslash * (\) are used as directory separator character. In * other environments, it is the forward slash (/). * </p> * @return string the path of the parent directory. If there are no slashes in * path, a dot ('.') is returned, * indicating the current directory. Otherwise, the returned string is * path with any trailing * /component removed. */ function dirname ($path) {} /** * Returns information about a file path * @link http://www.php.net/manual/en/function.pathinfo.php * @param path string <p> * The path to be parsed. * </p> * @param options int[optional] <p> * If present, specifies a specific element to be returned; one of * PATHINFO_DIRNAME, * PATHINFO_BASENAME, * PATHINFO_EXTENSION or * PATHINFO_FILENAME. * </p> * <p>If options is not specified, returns all * available elements. * </p> * @return mixed If the options parameter is not passed, an * associative array containing the following elements is * returned: * dirname, basename, * extension (if any), and filename. * </p> * <p> * If the path does not have an extension, no * extension element will be returned * (see second example below). * </p> * <p> * If options is present, returns a * string containing the requested element. */ function pathinfo ($path, $options = null) {} /** * Un-quotes a quoted string * @link http://www.php.net/manual/en/function.stripslashes.php * @param str string <p> * The input string. * </p> * @return string a string with backslashes stripped off. * (\' becomes ' and so on.) * Double backslashes (\\) are made into a single * backslash (\). */ function stripslashes ($str) {} /** * Un-quote string quoted with <function>addcslashes</function> * @link http://www.php.net/manual/en/function.stripcslashes.php * @param str string <p> * The string to be unescaped. * </p> * @return string the unescaped string. */ function stripcslashes ($str) {} /** * Find the first occurrence of a string * @link http://www.php.net/manual/en/function.strstr.php * @param haystack string <p> * The input string. * </p> * @param needle mixed <p> * If needle is not a string, it is converted to * an integer and applied as the ordinal value of a character. * </p> * @param before_needle bool[optional] <p> * If true, strstr returns * the part of the haystack before the first * occurrence of the needle. * </p> * @return string the portion of string, or false if needle * is not found. */ function strstr ($haystack, $needle, $before_needle = null) {} /** * Case-insensitive <function>strstr</function> * @link http://www.php.net/manual/en/function.stristr.php * @param haystack string <p> * The string to search in * </p> * @param needle mixed <p> * If needle is not a string, it is converted to * an integer and applied as the ordinal value of a character. * </p> * @param before_needle bool[optional] <p> * If true, stristr * returns the part of the haystack before the * first occurrence of the needle. * </p> * @return string the matched substring. If needle is not * found, returns false. */ function stristr ($haystack, $needle, $before_needle = null) {} /** * Find the last occurrence of a character in a string * @link http://www.php.net/manual/en/function.strrchr.php * @param haystack string <p> * The string to search in * </p> * @param needle mixed <p> * If needle contains more than one character, * only the first is used. This behavior is different from that of * strstr. * </p> * <p> * If needle is not a string, it is converted to * an integer and applied as the ordinal value of a character. * </p> * @return string This function returns the portion of string, or false if * needle is not found. */ function strrchr ($haystack, $needle) {} /** * Randomly shuffles a string * @link http://www.php.net/manual/en/function.str-shuffle.php * @param str string <p> * The input string. * </p> * @return string the shuffled string. */ function str_shuffle ($str) {} /** * Return information about words used in a string * @link http://www.php.net/manual/en/function.str-word-count.php * @param string string <p> * The string * </p> * @param format int[optional] <p> * Specify the return value of this function. The current supported values * are: * 0 - returns the number of words found * @param charlist string[optional] <p> * A list of additional characters which will be considered as 'word' * </p> * @return mixed an array or an integer, depending on the * format chosen. */ function str_word_count ($string, $format = null, $charlist = null) {} /** * Convert a string to an array * @link http://www.php.net/manual/en/function.str-split.php * @param string string <p> * The input string. * </p> * @param split_length int[optional] <p> * Maximum length of the chunk. * </p> * @return array If the optional split_length parameter is * specified, the returned array will be broken down into chunks with each * being split_length in length, otherwise each chunk * will be one character in length. * </p> * <p> * false is returned if split_length is less than 1. * If the split_length length exceeds the length of * string, the entire string is returned as the first * (and only) array element. */ function str_split ($string, $split_length = null) {} /** * Search a string for any of a set of characters * @link http://www.php.net/manual/en/function.strpbrk.php * @param haystack string <p> * The string where char_list is looked for. * </p> * @param char_list string <p> * This parameter is case sensitive. * </p> * @return string a string starting from the character found, or false if it is * not found. */ function strpbrk ($haystack, $char_list) {} /** * Binary safe comparison of two strings from an offset, up to length characters * @link http://www.php.net/manual/en/function.substr-compare.php * @param main_str string <p> * The main string being compared. * </p> * @param str string <p> * The secondary string being compared. * </p> * @param offset int <p> * The start position for the comparison. If negative, it starts counting * from the end of the string. * </p> * @param length int[optional] <p> * The length of the comparison. The default value is the largest of the * length of the str compared to the length of * main_str less the * offset. * </p> * @param case_insensitivity bool[optional] <p> * If case_insensitivity is true, comparison is * case insensitive. * </p> * @return int &lt; 0 if main_str from position * offset is less than str, &gt; * 0 if it is greater than str, and 0 if they are equal. * If offset is equal to or greater than the length of * main_str or length is set and * is less than 1, substr_compare prints a warning and returns * false. */ function substr_compare ($main_str, $str, $offset, $length = null, $case_insensitivity = null) {} /** * Locale based string comparison * @link http://www.php.net/manual/en/function.strcoll.php * @param str1 string <p> * The first string. * </p> * @param str2 string <p> * The second string. * </p> * @return int &lt; 0 if str1 is less than * str2; &gt; 0 if * str1 is greater than * str2, and 0 if they are equal. */ function strcoll ($str1, $str2) {} /** * Formats a number as a currency string * @link http://www.php.net/manual/en/function.money-format.php * @param format string <p> * The format specification consists of the following sequence: * <p>a % character</p> * @param number float <p> * The number to be formatted. * </p> * @return string the formatted string. Characters before and after the formatting * string will be returned unchanged. * Non-numeric number causes returning &null; and * emitting E_WARNING. */ function money_format ($format, $number) {} /** * Return part of a string * @link http://www.php.net/manual/en/function.substr.php * @param string string <p> * The input string. Must be one character or longer. * </p> * @param start int <p> * If start is non-negative, the returned string * will start at the start'th position in * string, counting from zero. For instance, * in the string 'abcdef', the character at * position 0 is 'a', the * character at position 2 is * 'c', and so forth. * </p> * <p> * If start is negative, the returned string * will start at the start'th character * from the end of string. * </p> * <p> * If string is less than or equal to * start characters long, false will be returned. * </p> * <p> * Using a negative start * ]]> * </p> * @param length int[optional] <p> * If length is given and is positive, the string * returned will contain at most length characters * beginning from start (depending on the length of * string). * </p> * <p> * If length is given and is negative, then that many * characters will be omitted from the end of string * (after the start position has been calculated when a * start is negative). If * start denotes the position of this truncation or * beyond, false will be returned. * </p> * <p> * If length is given and is 0, * false or &null; an empty string will be returned. * </p> * <p> * If length is omitted, the substring starting from * start until the end of the string will be * returned. * </p> * Using a negative length * ]]> * @return string the extracted part of string, &return.falseforfailure; or an empty string. */ function substr ($string, $start, $length = null) {} /** * Replace text within a portion of a string * @link http://www.php.net/manual/en/function.substr-replace.php * @param string mixed <p> * The input string. * </p> * <p> * An array of strings can be provided, in which * case the replacements will occur on each string in turn. In this case, * the replacement, start * and length parameters may be provided either as * scalar values to be applied to each input string in turn, or as * arrays, in which case the corresponding array element will * be used for each input string. * </p> * @param replacement mixed <p> * The replacement string. * </p> * @param start mixed <p> * If start is positive, the replacing will * begin at the start'th offset into * string. * </p> * <p> * If start is negative, the replacing will * begin at the start'th character from the * end of string. * </p> * @param length mixed[optional] <p> * If given and is positive, it represents the length of the portion of * string which is to be replaced. If it is * negative, it represents the number of characters from the end of * string at which to stop replacing. If it * is not given, then it will default to strlen( * string ); i.e. end the replacing at the * end of string. Of course, if * length is zero then this function will have the * effect of inserting replacement into * string at the given * start offset. * </p> * @return mixed The result string is returned. If string is an * array then array is returned. */ function substr_replace ($string, $replacement, $start, $length = null) {} /** * Quote meta characters * @link http://www.php.net/manual/en/function.quotemeta.php * @param str string <p> * The input string. * </p> * @return string the string with meta characters quoted, or false if an empty * string is given as str. */ function quotemeta ($str) {} /** * Make a string's first character uppercase * @link http://www.php.net/manual/en/function.ucfirst.php * @param str string <p> * The input string. * </p> * @return string the resulting string. */ function ucfirst ($str) {} /** * Make a string's first character lowercase * @link http://www.php.net/manual/en/function.lcfirst.php * @param str string <p> * The input string. * </p> * @return string the resulting string. */ function lcfirst ($str) {} /** * Uppercase the first character of each word in a string * @link http://www.php.net/manual/en/function.ucwords.php * @param str string <p> * The input string. * </p> * @return string the modified string. */ function ucwords ($str) {} /** * Translate characters or replace substrings * @link http://www.php.net/manual/en/function.strtr.php * @param str string <p> * The string being translated. * </p> * @param from string <p> * The string being translated to to. * </p> * @param to string <p> * The string replacing from. * </p> * @return string the translated string. * </p> * <p> * If replace_pairs contains a key which * is an empty string (""), * false will be returned. */ function strtr ($str, $from, $to) {} /** * Quote string with slashes * @link http://www.php.net/manual/en/function.addslashes.php * @param str string <p> * The string to be escaped. * </p> * @return string the escaped string. */ function addslashes ($str) {} /** * Quote string with slashes in a C style * @link http://www.php.net/manual/en/function.addcslashes.php * @param str string <p> * The string to be escaped. * </p> * @param charlist string <p> * A list of characters to be escaped. If * charlist contains characters * \n, \r etc., they are * converted in C-like style, while other non-alphanumeric characters * with ASCII codes lower than 32 and higher than 126 converted to * octal representation. * </p> * <p> * When you define a sequence of characters in the charlist argument * make sure that you know what characters come between the * characters that you set as the start and end of the range. * ]]> * Also, if the first character in a range has a higher ASCII value * than the second character in the range, no range will be * constructed. Only the start, end and period characters will be * escaped. Use the ord function to find the * ASCII value for a character. * ]]> * </p> * <p> * Be careful if you choose to escape characters 0, a, b, f, n, r, * t and v. They will be converted to \0, \a, \b, \f, \n, \r, \t * and \v. * In PHP \0 (NULL), \r (carriage return), \n (newline), \f (form feed), * \v (vertical tab) and \t (tab) are predefined escape sequences, * while in C all of these are predefined escape sequences. * </p> * @return string the escaped string. */ function addcslashes ($str, $charlist) {} /** * Strip whitespace (or other characters) from the end of a string * @link http://www.php.net/manual/en/function.rtrim.php * @param str string <p> * The input string. * </p> * @param charlist string[optional] <p> * You can also specify the characters you want to strip, by means * of the charlist parameter. * Simply list all characters that you want to be stripped. With * .. you can specify a range of characters. * </p> * @return string the modified string. */ function rtrim ($str, $charlist = null) {} /** * Replace all occurrences of the search string with the replacement string * @link http://www.php.net/manual/en/function.str-replace.php * @param search mixed <p> * The value being searched for, otherwise known as the needle. * An array may be used to designate multiple needles. * </p> * @param replace mixed <p> * The replacement value that replaces found search * values. An array may be used to designate multiple replacements. * </p> * @param subject mixed <p> * The string or array being searched and replaced on, * otherwise known as the haystack. * </p> * <p> * If subject is an array, then the search and * replace is performed with every entry of * subject, and the return value is an array as * well. * </p> * @param count int[optional] <p> * If passed, this will be set to the number of replacements performed. * </p> * @return mixed This function returns a string or an array with the replaced values. */ function str_replace ($search, $replace, $subject, &$count = null) {} /** * Case-insensitive version of <function>str_replace</function>. * @link http://www.php.net/manual/en/function.str-ireplace.php * @param search mixed <p> * The value being searched for, otherwise known as the * needle. An array may be used to designate * multiple needles. * </p> * @param replace mixed <p> * The replacement value that replaces found search * values. An array may be used to designate multiple replacements. * </p> * @param subject mixed <p> * The string or array being searched and replaced on, * otherwise known as the haystack. * </p> * <p> * If subject is an array, then the search and * replace is performed with every entry of * subject, and the return value is an array as * well. * </p> * @param count int[optional] <p> * If passed, this will be set to the number of replacements performed. * </p> * @return mixed a string or an array of replacements. */ function str_ireplace ($search, $replace, $subject, &$count = null) {} /** * Repeat a string * @link http://www.php.net/manual/en/function.str-repeat.php * @param input string <p> * The string to be repeated. * </p> * @param multiplier int <p> * Number of time the input string should be * repeated. * </p> * <p> * multiplier has to be greater than or equal to 0. * If the multiplier is set to 0, the function * will return an empty string. * </p> * @return string the repeated string. */ function str_repeat ($input, $multiplier) {} /** * Return information about characters used in a string * @link http://www.php.net/manual/en/function.count-chars.php * @param string string <p> * The examined string. * </p> * @param mode int[optional] <p> * See return values. * </p> * @return mixed Depending on mode * count_chars returns one of the following: * 0 - an array with the byte-value as key and the frequency of * every byte as value. * 1 - same as 0 but only byte-values with a frequency greater * than zero are listed. * 2 - same as 0 but only byte-values with a frequency equal to * zero are listed. * 3 - a string containing all unique characters is returned. * 4 - a string containing all not used characters is returned. */ function count_chars ($string, $mode = null) {} /** * Split a string into smaller chunks * @link http://www.php.net/manual/en/function.chunk-split.php * @param body string <p> * The string to be chunked. * </p> * @param chunklen int[optional] <p> * The chunk length. * </p> * @param end string[optional] <p> * The line ending sequence. * </p> * @return string the chunked string. */ function chunk_split ($body, $chunklen = null, $end = null) {} /** * Strip whitespace (or other characters) from the beginning and end of a string * @link http://www.php.net/manual/en/function.trim.php * @param str string <p> * The string that will be trimmed. * </p> * @param charlist string[optional] <p> * Optionally, the stripped characters can also be specified using * the charlist parameter. * Simply list all characters that you want to be stripped. With * .. you can specify a range of characters. * </p> * @return string The trimmed string. */ function trim ($str, $charlist = null) {} /** * Strip whitespace (or other characters) from the beginning of a string * @link http://www.php.net/manual/en/function.ltrim.php * @param str string <p> * The input string. * </p> * @param charlist string[optional] <p> * You can also specify the characters you want to strip, by means of the * charlist parameter. * Simply list all characters that you want to be stripped. With * .. you can specify a range of characters. * </p> * @return string This function returns a string with whitespace stripped from the * beginning of str. * Without the second parameter, * ltrim will strip these characters: * " " (ASCII 32 * (0x20)), an ordinary space. * "\t" (ASCII 9 * (0x09)), a tab. * "\n" (ASCII 10 * (0x0A)), a new line (line feed). * "\r" (ASCII 13 * (0x0D)), a carriage return. * "\0" (ASCII 0 * (0x00)), the NUL-byte. * "\x0B" (ASCII 11 * (0x0B)), a vertical tab. */ function ltrim ($str, $charlist = null) {} /** * Strip HTML and PHP tags from a string * @link http://www.php.net/manual/en/function.strip-tags.php * @param str string <p> * The input string. * </p> * @param allowable_tags string[optional] <p> * You can use the optional second parameter to specify tags which should * not be stripped. * </p> * <p> * HTML comments and PHP tags are also stripped. This is hardcoded and * can not be changed with allowable_tags. * </p> * <p> * This parameter should not contain whitespace. * strip_tags sees a tag as a case-insensitive * string between &lt; and the first whitespace or * &gt;. It means that * strip_tags("&lt;br/&gt;", "&lt;br&gt;") returns an * empty string. * </p> * @return string the stripped string. */ function strip_tags ($str, $allowable_tags = null) {} /** * Calculate the similarity between two strings * @link http://www.php.net/manual/en/function.similar-text.php * @param first string <p> * The first string. * </p> * @param second string <p> * The second string. * </p> * @param percent float[optional] <p> * By passing a reference as third argument, * similar_text will calculate the similarity in * percent for you. * </p> * @return int the number of matching chars in both strings. */ function similar_text ($first, $second, &$percent = null) {} /** * Split a string by string * @link http://www.php.net/manual/en/function.explode.php * @param delimiter string <p> * The boundary string. * </p> * @param string string <p> * The input string. * </p> * @param limit int[optional] <p> * If limit is set and positive, the returned array will contain * a maximum of limit elements with the last * element containing the rest of string. * </p> * <p> * If the limit parameter is negative, all components * except the last -limit are returned. * </p> * <p> * If the limit parameter is zero, then this is treated as 1. * </p> * @return array an array of strings * created by splitting the string parameter on * boundaries formed by the delimiter. * </p> * <p> * If delimiter is an empty string (""), * explode will return false. * If delimiter contains a value that is not * contained in string and a negative * limit is used, then an empty array will be * returned, otherwise an array containing * string will be returned. */ function explode ($delimiter, $string, $limit = null) {} /** * Join array elements with a string * @link http://www.php.net/manual/en/function.implode.php * @param glue string <p> * Defaults to an empty string. This is not the preferred usage of * implode as glue would be * the second parameter and thus, the bad prototype would be used. * </p> * @param pieces array <p> * The array of strings to implode. * </p> * @return string a string containing a string representation of all the array * elements in the same order, with the glue string between each element. */ function implode ($glue, array $pieces) {} /** * &Alias; <function>implode</function> * @link http://www.php.net/manual/en/function.join.php * @param glue * @param pieces */ function join ($glue, $pieces) {} /** * Set locale information * @link http://www.php.net/manual/en/function.setlocale.php * @param category int <p> * category is a named constant specifying the * category of the functions affected by the locale setting: * LC_ALL for all of the below * @param locale string <p> * If locale is &null; or the empty string * "", the locale names will be set from the * values of environment variables with the same names as the above * categories, or from "LANG". * </p> * <p> * If locale is "0", * the locale setting is not affected, only the current setting is returned. * </p> * <p> * If locale is an array or followed by additional * parameters then each array element or parameter is tried to be set as * new locale until success. This is useful if a locale is known under * different names on different systems or for providing a fallback * for a possibly not available locale. * </p> * @param _ string[optional] * @return string the new current locale, or false if the locale functionality is * not implemented on your platform, the specified locale does not exist or * the category name is invalid. * </p> * <p> * An invalid category name also causes a warning message. Category/locale * names can be found in RFC 1766 * and ISO 639. * Different systems have different naming schemes for locales. * </p> * <p> * The return value of setlocale depends * on the system that PHP is running. It returns exactly * what the system setlocale function returns. */ function setlocale ($category, $locale, $_ = null) {} /** * Get numeric formatting information * @link http://www.php.net/manual/en/function.localeconv.php * @return array localeconv returns data based upon the current locale * as set by setlocale. The associative array that is * returned contains the following fields: * <tr valign="top"> * <td>Array element</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>decimal_point</td> * <td>Decimal point character</td> * </tr> * <tr valign="top"> * <td>thousands_sep</td> * <td>Thousands separator</td> * </tr> * <tr valign="top"> * <td>grouping</td> * <td>Array containing numeric groupings</td> * </tr> * <tr valign="top"> * <td>int_curr_symbol</td> * <td>International currency symbol (i.e. USD)</td> * </tr> * <tr valign="top"> * <td>currency_symbol</td> * <td>Local currency symbol (i.e. $)</td> * </tr> * <tr valign="top"> * <td>mon_decimal_point</td> * <td>Monetary decimal point character</td> * </tr> * <tr valign="top"> * <td>mon_thousands_sep</td> * <td>Monetary thousands separator</td> * </tr> * <tr valign="top"> * <td>mon_grouping</td> * <td>Array containing monetary groupings</td> * </tr> * <tr valign="top"> * <td>positive_sign</td> * <td>Sign for positive values</td> * </tr> * <tr valign="top"> * <td>negative_sign</td> * <td>Sign for negative values</td> * </tr> * <tr valign="top"> * <td>int_frac_digits</td> * <td>International fractional digits</td> * </tr> * <tr valign="top"> * <td>frac_digits</td> * <td>Local fractional digits</td> * </tr> * <tr valign="top"> * <td>p_cs_precedes</td> * <td> * true if currency_symbol precedes a positive value, false * if it succeeds one * </td> * </tr> * <tr valign="top"> * <td>p_sep_by_space</td> * <td> * true if a space separates currency_symbol from a positive * value, false otherwise * </td> * </tr> * <tr valign="top"> * <td>n_cs_precedes</td> * <td> * true if currency_symbol precedes a negative value, false * if it succeeds one * </td> * </tr> * <tr valign="top"> * <td>n_sep_by_space</td> * <td> * true if a space separates currency_symbol from a negative * value, false otherwise * </td> * </tr> * <td>p_sign_posn</td> * <td> * 0 - Parentheses surround the quantity and currency_symbol * 1 - The sign string precedes the quantity and currency_symbol * 2 - The sign string succeeds the quantity and currency_symbol * 3 - The sign string immediately precedes the currency_symbol * 4 - The sign string immediately succeeds the currency_symbol * </td> * </tr> * <td>n_sign_posn</td> * <td> * 0 - Parentheses surround the quantity and currency_symbol * 1 - The sign string precedes the quantity and currency_symbol * 2 - The sign string succeeds the quantity and currency_symbol * 3 - The sign string immediately precedes the currency_symbol * 4 - The sign string immediately succeeds the currency_symbol * </td> * </tr> * </p> * <p> * The p_sign_posn, and n_sign_posn contain a string * of formatting options. Each number representing one of the above listed conditions. * </p> * <p> * The grouping fields contain arrays that define the way numbers should be * grouped. For example, the monetary grouping field for the nl_NL locale (in * UTF-8 mode with the euro sign), would contain a 2 item array with the * values 3 and 3. The higher the index in the array, the farther left the * grouping is. If an array element is equal to CHAR_MAX, * no further grouping is done. If an array element is equal to 0, the previous * element should be used. */ function localeconv () {} /** * Query language and locale information * @link http://www.php.net/manual/en/function.nl-langinfo.php * @param item int <p> * item may be an integer value of the element or the * constant name of the element. The following is a list of constant names * for item that may be used and their description. * Some of these constants may not be defined or hold no value for certain * locales. * <table> * nl_langinfo Constants * <tr valign="top"> * <td>Constant</td> * <td>Description</td> * </tr> * <tr valign="top"> * LC_TIME Category Constants</td> * </tr> * <tr valign="top"> * <td>ABDAY_(1-7)</td> * <td>Abbreviated name of n-th day of the week.</td> * </tr> * <tr valign="top"> * <td>DAY_(1-7)</td> * <td>Name of the n-th day of the week (DAY_1 = Sunday).</td> * </tr> * <tr valign="top"> * <td>ABMON_(1-12)</td> * <td>Abbreviated name of the n-th month of the year.</td> * </tr> * <tr valign="top"> * <td>MON_(1-12)</td> * <td>Name of the n-th month of the year.</td> * </tr> * <tr valign="top"> * <td>AM_STR</td> * <td>String for Ante meridian.</td> * </tr> * <tr valign="top"> * <td>PM_STR</td> * <td>String for Post meridian.</td> * </tr> * <tr valign="top"> * <td>D_T_FMT</td> * <td>String that can be used as the format string for strftime to represent time and date.</td> * </tr> * <tr valign="top"> * <td>D_FMT</td> * <td>String that can be used as the format string for strftime to represent date.</td> * </tr> * <tr valign="top"> * <td>T_FMT</td> * <td>String that can be used as the format string for strftime to represent time.</td> * </tr> * <tr valign="top"> * <td>T_FMT_AMPM</td> * <td>String that can be used as the format string for strftime to represent time in 12-hour format with ante/post meridian.</td> * </tr> * <tr valign="top"> * <td>ERA</td> * <td>Alternate era.</td> * </tr> * <tr valign="top"> * <td>ERA_YEAR</td> * <td>Year in alternate era format.</td> * </tr> * <tr valign="top"> * <td>ERA_D_T_FMT</td> * <td>Date and time in alternate era format (string can be used in strftime).</td> * </tr> * <tr valign="top"> * <td>ERA_D_FMT</td> * <td>Date in alternate era format (string can be used in strftime).</td> * </tr> * <tr valign="top"> * <td>ERA_T_FMT</td> * <td>Time in alternate era format (string can be used in strftime).</td> * </tr> * <tr valign="top"> * LC_MONETARY Category Constants</td> * </tr> * <tr valign="top"> * <td>INT_CURR_SYMBOL</td> * <td>International currency symbol.</td> * </tr> * <tr valign="top"> * <td>CURRENCY_SYMBOL</td> * <td>Local currency symbol.</td> * </tr> * <tr valign="top"> * <td>CRNCYSTR</td> * <td>Same value as CURRENCY_SYMBOL.</td> * </tr> * <tr valign="top"> * <td>MON_DECIMAL_POINT</td> * <td>Decimal point character.</td> * </tr> * <tr valign="top"> * <td>MON_THOUSANDS_SEP</td> * <td>Thousands separator (groups of three digits).</td> * </tr> * <tr valign="top"> * <td>MON_GROUPING</td> * <td>Like "grouping" element.</td> * </tr> * <tr valign="top"> * <td>POSITIVE_SIGN</td> * <td>Sign for positive values.</td> * </tr> * <tr valign="top"> * <td>NEGATIVE_SIGN</td> * <td>Sign for negative values.</td> * </tr> * <tr valign="top"> * <td>INT_FRAC_DIGITS</td> * <td>International fractional digits.</td> * </tr> * <tr valign="top"> * <td>FRAC_DIGITS</td> * <td>Local fractional digits.</td> * </tr> * <tr valign="top"> * <td>P_CS_PRECEDES</td> * <td>Returns 1 if CURRENCY_SYMBOL precedes a positive value.</td> * </tr> * <tr valign="top"> * <td>P_SEP_BY_SPACE</td> * <td>Returns 1 if a space separates CURRENCY_SYMBOL from a positive value.</td> * </tr> * <tr valign="top"> * <td>N_CS_PRECEDES</td> * <td>Returns 1 if CURRENCY_SYMBOL precedes a negative value.</td> * </tr> * <tr valign="top"> * <td>N_SEP_BY_SPACE</td> * <td>Returns 1 if a space separates CURRENCY_SYMBOL from a negative value.</td> * </tr> * <tr valign="top"> * <td>P_SIGN_POSN</td> * Returns 0 if parentheses surround the quantity and CURRENCY_SYMBOL. * @return string the element as a string, or false if item * is not valid. */ function nl_langinfo ($item) {} /** * Calculate the soundex key of a string * @link http://www.php.net/manual/en/function.soundex.php * @param str string <p> * The input string. * </p> * @return string the soundex key as a string. */ function soundex ($str) {} /** * Calculate Levenshtein distance between two strings * @link http://www.php.net/manual/en/function.levenshtein.php * @param str1 string <p> * One of the strings being evaluated for Levenshtein distance. * </p> * @param str2 string <p> * One of the strings being evaluated for Levenshtein distance. * </p> * @return int This function returns the Levenshtein-Distance between the * two argument strings or -1, if one of the argument strings * is longer than the limit of 255 characters. */ function levenshtein ($str1, $str2) {} /** * Return a specific character * @link http://www.php.net/manual/en/function.chr.php * @param ascii int <p> * The ascii code. * </p> * @return string the specified character. */ function chr ($ascii) {} /** * Return ASCII value of character * @link http://www.php.net/manual/en/function.ord.php * @param string string <p> * A character. * </p> * @return int the ASCII value as an integer. */ function ord ($string) {} /** * Parses the string into variables * @link http://www.php.net/manual/en/function.parse-str.php * @param str string <p> * The input string. * </p> * @param arr array[optional] <p> * If the second parameter arr is present, * variables are stored in this variable as array elements instead. * </p> * @return void */ function parse_str ($str, array &$arr = null) {} /** * Parse a CSV string into an array * @link http://www.php.net/manual/en/function.str-getcsv.php * @param input string <p> * The string to parse. * </p> * @param delimiter string[optional] <p> * Set the field delimiter (one character only). * </p> * @param enclosure string[optional] <p> * Set the field enclosure character (one character only). * </p> * @param escape string[optional] <p> * Set the escape character (one character only). Defaults as a backslash * (\) * </p> * @return array an indexed array containing the fields read. */ function str_getcsv ($input, $delimiter = null, $enclosure = null, $escape = null) {} /** * Pad a string to a certain length with another string * @link http://www.php.net/manual/en/function.str-pad.php * @param input string <p> * The input string. * </p> * @param pad_length int <p> * If the value of pad_length is negative, * less than, or equal to the length of the input string, no padding * takes place. * </p> * @param pad_string string[optional] <p> * The pad_string may be truncated if the * required number of padding characters can't be evenly divided by the * pad_string's length. * </p> * @param pad_type int[optional] <p> * Optional argument pad_type can be * STR_PAD_RIGHT, STR_PAD_LEFT, * or STR_PAD_BOTH. If * pad_type is not specified it is assumed to be * STR_PAD_RIGHT. * </p> * @return string the padded string. */ function str_pad ($input, $pad_length, $pad_string = null, $pad_type = null) {} /** * &Alias; <function>rtrim</function> * @link http://www.php.net/manual/en/function.chop.php * @param str * @param character_mask[optional] */ function chop ($str, $character_mask) {} /** * &Alias; <function>strstr</function> * @link http://www.php.net/manual/en/function.strchr.php * @param haystack * @param needle * @param part[optional] */ function strchr ($haystack, $needle, $part) {} /** * Return a formatted string * @link http://www.php.net/manual/en/function.sprintf.php * @param format string <p> * The format string is composed of zero or more directives: * ordinary characters (excluding %) that are * copied directly to the result, and conversion * specifications, each of which results in fetching its * own parameter. This applies to both sprintf * and printf. * </p> * <p> * Each conversion specification consists of a percent sign * (%), followed by one or more of these * elements, in order: * An optional sign specifier that forces a sign * (- or +) to be used on a number. By default, only the - sign is used * on a number if it's negative. This specifier forces positive numbers * to have the + sign attached as well, and was added in PHP 4.3.0. * @param args mixed[optional] <p> * </p> * @param _ mixed[optional] * @return string a string produced according to the formatting string * format. */ function sprintf ($format, $args = null, $_ = null) {} /** * Output a formatted string * @link http://www.php.net/manual/en/function.printf.php * @param format string <p> * See sprintf for a description of * format. * </p> * @param args mixed[optional] <p> * </p> * @param _ mixed[optional] * @return int the length of the outputted string. */ function printf ($format, $args = null, $_ = null) {} /** * Output a formatted string * @link http://www.php.net/manual/en/function.vprintf.php * @param format string <p> * See sprintf for a description of * format. * </p> * @param args array <p> * </p> * @return int the length of the outputted string. */ function vprintf ($format, array $args) {} /** * Return a formatted string * @link http://www.php.net/manual/en/function.vsprintf.php * @param format string <p> * See sprintf for a description of * format. * </p> * @param args array <p> * </p> * @return string Return array values as a formatted string according to * format (which is described in the documentation * for sprintf). */ function vsprintf ($format, array $args) {} /** * Write a formatted string to a stream * @link http://www.php.net/manual/en/function.fprintf.php * @param handle resource &fs.file.pointer; * @param format string <p> * See sprintf for a description of * format. * </p> * @param args mixed[optional] <p> * </p> * @param _ mixed[optional] * @return int the length of the string written. */ function fprintf ($handle, $format, $args = null, $_ = null) {} /** * Write a formatted string to a stream * @link http://www.php.net/manual/en/function.vfprintf.php * @param handle resource <p> * </p> * @param format string <p> * See sprintf for a description of * format. * </p> * @param args array <p> * </p> * @return int the length of the outputted string. */ function vfprintf ($handle, $format, array $args) {} /** * Parses input from a string according to a format * @link http://www.php.net/manual/en/function.sscanf.php * @param str string <p> * The input string being parsed. * </p> * @param format string <p> * The interpreted format for str, which is * described in the documentation for sprintf with * following differences: * Function is not locale-aware. * F, g, G and * b are not supported. * D stands for decimal number. * i stands for integer with base detection. * n stands for number of characters processed so far. * </p> * @param _ mixed[optional] * @return mixed If only * two parameters were passed to this function, the values parsed * will be returned as an array. Otherwise, if optional parameters are passed, * the function will return the number of assigned values. The optional * parameters must be passed by reference. */ function sscanf ($str, $format, &$_ = null) {} /** * Parses input from a file according to a format * @link http://www.php.net/manual/en/function.fscanf.php * @param handle resource &fs.file.pointer; * @param format string <p> * The specified format as described in the * sprintf documentation. * </p> * @param _ mixed[optional] * @return mixed If only two parameters were passed to this function, the values parsed will be * returned as an array. Otherwise, if optional parameters are passed, the * function will return the number of assigned values. The optional * parameters must be passed by reference. */ function fscanf ($handle, $format, &$_ = null) {} /** * Parse a URL and return its components * @link http://www.php.net/manual/en/function.parse-url.php * @param url string <p> * The URL to parse. Invalid characters are replaced by * _. * </p> * @param component int[optional] <p> * Specify one of PHP_URL_SCHEME, * PHP_URL_HOST, PHP_URL_PORT, * PHP_URL_USER, PHP_URL_PASS, * PHP_URL_PATH, PHP_URL_QUERY * or PHP_URL_FRAGMENT to retrieve just a specific * URL component as a string (except when * PHP_URL_PORT is given, in which case the return * value will be an integer). * </p> * @return mixed On seriously malformed URLs, parse_url may return * false. * </p> * <p> * If the component parameter is omitted, an * associative array is returned. At least one element will be * present within the array. Potential keys within this array are: * scheme - e.g. http * host * port * user * pass * path * query - after the question mark ? * fragment - after the hashmark # * </p> * <p> * If the component parameter is specified, * parse_url returns a string (or an * integer, in the case of PHP_URL_PORT) * instead of an array. If the requested component doesn't exist * within the given URL, &null; will be returned. */ function parse_url ($url, $component = null) {} /** * URL-encodes string * @link http://www.php.net/manual/en/function.urlencode.php * @param str string <p> * The string to be encoded. * </p> * @return string a string in which all non-alphanumeric characters except * -_. have been replaced with a percent * (%) sign followed by two hex digits and spaces encoded * as plus (+) signs. It is encoded the same way that the * posted data from a WWW form is encoded, that is the same way as in * application/x-www-form-urlencoded media type. This * differs from the RFC 3986 encoding (see * rawurlencode) in that for historical reasons, spaces * are encoded as plus (+) signs. */ function urlencode ($str) {} /** * Decodes URL-encoded string * @link http://www.php.net/manual/en/function.urldecode.php * @param str string <p> * The string to be decoded. * </p> * @return string the decoded string. */ function urldecode ($str) {} /** * URL-encode according to RFC 3986 * @link http://www.php.net/manual/en/function.rawurlencode.php * @param str string <p> * The URL to be encoded. * </p> * @return string a string in which all non-alphanumeric characters except * -_.~ have been replaced with a percent * (%) sign followed by two hex digits. This is the * encoding described in RFC 3986 for * protecting literal characters from being interpreted as special URL * delimiters, and for protecting URLs from being mangled by transmission * media with character conversions (like some email systems). * <p> * Prior to PHP 5.3.0, rawurlencode encoded tildes (~) as per * RFC 1738. * </p> */ function rawurlencode ($str) {} /** * Decode URL-encoded strings * @link http://www.php.net/manual/en/function.rawurldecode.php * @param str string <p> * The URL to be decoded. * </p> * @return string the decoded URL, as a string. */ function rawurldecode ($str) {} /** * Generate URL-encoded query string * @link http://www.php.net/manual/en/function.http-build-query.php * @param query_data mixed <p> * May be an array or object containing properties. * </p> * <p> * If query_data is an array, it may be a simple * one-dimensional structure, or an array of arrays (which in * turn may contain other arrays). * </p> * <p> * If query_data is an object, then only public * properties will be incorporated into the result. * </p> * @param numeric_prefix string[optional] <p> * If numeric indices are used in the base array and this parameter is * provided, it will be prepended to the numeric index for elements in * the base array only. * </p> * <p> * This is meant to allow for legal variable names when the data is * decoded by PHP or another CGI application later on. * </p> * @param arg_separator string[optional] <p> * arg_separator.output * is used to separate arguments, unless this parameter is specified, * and is then used. * </p> * @param enc_type int[optional] <p> * By default, PHP_QUERY_RFC1738. * </p> * <p> * If enc_type is * PHP_QUERY_RFC1738, then encoding is performed per * RFC 1738 and the * application/x-www-form-urlencoded media type, which * implies that spaces are encoded as plus (+) signs. * </p> * <p> * If enc_type is * PHP_QUERY_RFC3986, then encoding is performed * according to RFC 3986, and * spaces will be percent encoded (%20). * </p> * @return string a URL-encoded string. */ function http_build_query ($query_data, $numeric_prefix = null, $arg_separator = null, $enc_type = null) {} /** * Returns the target of a symbolic link * @link http://www.php.net/manual/en/function.readlink.php * @param path string <p> * The symbolic link path. * </p> * @return string the contents of the symbolic link path or false on error. */ function readlink ($path) {} /** * Gets information about a link * @link http://www.php.net/manual/en/function.linkinfo.php * @param path string <p> * Path to the link. * </p> * @return int linkinfo returns the st_dev field * of the Unix C stat structure returned by the lstat * system call. Returns 0 or false in case of error. */ function linkinfo ($path) {} /** * Creates a symbolic link * @link http://www.php.net/manual/en/function.symlink.php * @param target string <p> * Target of the link. * </p> * @param link string <p> * The link name. * </p> * @return bool Returns true on success or false on failure. */ function symlink ($target, $link) {} /** * Create a hard link * @link http://www.php.net/manual/en/function.link.php * @param target string <p> * Target of the link. * </p> * @param link string <p> * The link name. * </p> * @return bool Returns true on success or false on failure. */ function link ($target, $link) {} /** * Deletes a file * @link http://www.php.net/manual/en/function.unlink.php * @param filename string <p> * Path to the file. * </p> * @param context resource[optional] &note.context-support; * @return bool Returns true on success or false on failure. */ function unlink ($filename, $context = null) {} /** * Execute an external program * @link http://www.php.net/manual/en/function.exec.php * @param command string <p> * The command that will be executed. * </p> * @param output array[optional] <p> * If the output argument is present, then the * specified array will be filled with every line of output from the * command. Trailing whitespace, such as \n, is not * included in this array. Note that if the array already contains some * elements, exec will append to the end of the array. * If you do not want the function to append elements, call * unset on the array before passing it to * exec. * </p> * @param return_var int[optional] <p> * If the return_var argument is present * along with the output argument, then the * return status of the executed command will be written to this * variable. * </p> * @return string The last line from the result of the command. If you need to execute a * command and have all the data from the command passed directly back without * any interference, use the passthru function. * </p> * <p> * To get the output of the executed command, be sure to set and use the * output parameter. */ function exec ($command, array &$output = null, &$return_var = null) {} /** * Execute an external program and display the output * @link http://www.php.net/manual/en/function.system.php * @param command string <p> * The command that will be executed. * </p> * @param return_var int[optional] <p> * If the return_var argument is present, then the * return status of the executed command will be written to this * variable. * </p> * @return string the last line of the command output on success, and false * on failure. */ function system ($command, &$return_var = null) {} /** * Escape shell metacharacters * @link http://www.php.net/manual/en/function.escapeshellcmd.php * @param command string <p> * The command that will be escaped. * </p> * @return string The escaped string. */ function escapeshellcmd ($command) {} /** * Escape a string to be used as a shell argument * @link http://www.php.net/manual/en/function.escapeshellarg.php * @param arg string <p> * The argument that will be escaped. * </p> * @return string The escaped string. */ function escapeshellarg ($arg) {} /** * Execute an external program and display raw output * @link http://www.php.net/manual/en/function.passthru.php * @param command string <p> * The command that will be executed. * </p> * @param return_var int[optional] <p> * If the return_var argument is present, the * return status of the Unix command will be placed here. * </p> * @return void */ function passthru ($command, &$return_var = null) {} /** * Execute command via shell and return the complete output as a string * @link http://www.php.net/manual/en/function.shell-exec.php * @param cmd string <p> * The command that will be executed. * </p> * @return string The output from the executed command or &null; if an error occurred. */ function shell_exec ($cmd) {} /** * Execute a command and open file pointers for input/output * @link http://www.php.net/manual/en/function.proc-open.php * @param cmd string <p> * The command to execute * </p> * @param descriptorspec array <p> * An indexed array where the key represents the descriptor number and the * value represents how PHP will pass that descriptor to the child * process. 0 is stdin, 1 is stdout, while 2 is stderr. * </p> * <p> * Each element can be: * An array describing the pipe to pass to the process. The first * element is the descriptor type and the second element is an option for * the given type. Valid types are pipe (the second * element is either r to pass the read end of the pipe * to the process, or w to pass the write end) and * file (the second element is a filename). * A stream resource representing a real file descriptor (e.g. opened file, * a socket, STDIN). * </p> * <p> * The file descriptor numbers are not limited to 0, 1 and 2 - you may * specify any valid file descriptor number and it will be passed to the * child process. This allows your script to interoperate with other * scripts that run as "co-processes". In particular, this is useful for * passing passphrases to programs like PGP, GPG and openssl in a more * secure manner. It is also useful for reading status information * provided by those programs on auxiliary file descriptors. * </p> * @param pipes array <p> * Will be set to an indexed array of file pointers that correspond to * PHP's end of any pipes that are created. * </p> * @param cwd string[optional] <p> * The initial working dir for the command. This must be an * absolute directory path, or &null; * if you want to use the default value (the working dir of the current * PHP process) * </p> * @param env array[optional] <p> * An array with the environment variables for the command that will be * run, or &null; to use the same environment as the current PHP process * </p> * @param other_options array[optional] <p> * Allows you to specify additional options. Currently supported options * include: * suppress_errors (windows only): suppresses errors * generated by this function when it's set to true * bypass_shell (windows only): bypass * cmd.exe shell when set to true * context: stream context used when opening files * (created with stream_context_create) * </p> * @return resource a resource representing the process, which should be freed using * proc_close when you are finished with it. On failure * returns false. */ function proc_open ($cmd, array $descriptorspec, array &$pipes, $cwd = null, array $env = null, array $other_options = null) {} /** * Close a process opened by <function>proc_open</function> and return the exit code of that process * @link http://www.php.net/manual/en/function.proc-close.php * @param process resource <p> * The proc_open resource that will * be closed. * </p> * @return int the termination status of the process that was run. In case of * an error then -1 is returned. */ function proc_close ($process) {} /** * Kills a process opened by proc_open * @link http://www.php.net/manual/en/function.proc-terminate.php * @param process resource <p> * The proc_open resource that will * be closed. * </p> * @param signal int[optional] <p> * This optional parameter is only useful on POSIX * operating systems; you may specify a signal to send to the process * using the kill(2) system call. The default is * SIGTERM. * </p> * @return bool the termination status of the process that was run. */ function proc_terminate ($process, $signal = null) {} /** * Get information about a process opened by <function>proc_open</function> * @link http://www.php.net/manual/en/function.proc-get-status.php * @param process resource <p> * The proc_open resource that will * be evaluated. * </p> * @return array An array of collected information on success, and false * on failure. The returned array contains the following elements: * </p> * <p> * <tr valign="top"><td>element</td><td>type</td><td>description</td></tr> * <tr valign="top"> * <td>command</td> * <td>string</td> * <td> * The command string that was passed to proc_open. * </td> * </tr> * <tr valign="top"> * <td>pid</td> * <td>int</td> * <td>process id</td> * </tr> * <tr valign="top"> * <td>running</td> * <td>bool</td> * <td> * true if the process is still running, false if it has * terminated. * </td> * </tr> * <tr valign="top"> * <td>signaled</td> * <td>bool</td> * <td> * true if the child process has been terminated by * an uncaught signal. Always set to false on Windows. * </td> * </tr> * <tr valign="top"> * <td>stopped</td> * <td>bool</td> * <td> * true if the child process has been stopped by a * signal. Always set to false on Windows. * </td> * </tr> * <tr valign="top"> * <td>exitcode</td> * <td>int</td> * <td> * The exit code returned by the process (which is only * meaningful if running is false). * Only first call of this function return real value, next calls return * -1. * </td> * </tr> * <tr valign="top"> * <td>termsig</td> * <td>int</td> * <td> * The number of the signal that caused the child process to terminate * its execution (only meaningful if signaled is true). * </td> * </tr> * <tr valign="top"> * <td>stopsig</td> * <td>int</td> * <td> * The number of the signal that caused the child process to stop its * execution (only meaningful if stopped is true). * </td> * </tr> */ function proc_get_status ($process) {} /** * Change the priority of the current process * @link http://www.php.net/manual/en/function.proc-nice.php * @param increment int <p> * The increment value of the priority change. * </p> * @return bool Returns true on success or false on failure. * If an error occurs, like the user lacks permission to change the priority, * an error of level E_WARNING is also generated. */ function proc_nice ($increment) {} /** * Generate a random integer * @link http://www.php.net/manual/en/function.rand.php * @param min[optional] * @param max[optional] * @return int A pseudo random value between min * (or 0) and max (or getrandmax, inclusive). */ function rand ($min, $max) {} /** * Seed the random number generator * @link http://www.php.net/manual/en/function.srand.php * @param seed int[optional] <p> * Optional seed value * </p> * @return void */ function srand ($seed = null) {} /** * Show largest possible random value * @link http://www.php.net/manual/en/function.getrandmax.php * @return int The largest possible random value returned by rand */ function getrandmax () {} /** * Generate a better random value * @link http://www.php.net/manual/en/function.mt-rand.php * @param min[optional] * @param max[optional] * @return int A random integer value between min (or 0) * and max (or mt_getrandmax, inclusive) */ function mt_rand ($min, $max) {} /** * Seed the better random number generator * @link http://www.php.net/manual/en/function.mt-srand.php * @param seed int[optional] <p> * An optional seed value * </p> * @return void */ function mt_srand ($seed = null) {} /** * Show largest possible random value * @link http://www.php.net/manual/en/function.mt-getrandmax.php * @return int the maximum random value returned by mt_rand */ function mt_getrandmax () {} /** * Get port number associated with an Internet service and protocol * @link http://www.php.net/manual/en/function.getservbyname.php * @param service string <p> * The Internet service name, as a string. * </p> * @param protocol string <p> * protocol is either "tcp" * or "udp" (in lowercase). * </p> * @return int the port number, or false if service or * protocol is not found. */ function getservbyname ($service, $protocol) {} /** * Get Internet service which corresponds to port and protocol * @link http://www.php.net/manual/en/function.getservbyport.php * @param port int <p> * The port number. * </p> * @param protocol string <p> * protocol is either "tcp" * or "udp" (in lowercase). * </p> * @return string the Internet service name as a string. */ function getservbyport ($port, $protocol) {} /** * Get protocol number associated with protocol name * @link http://www.php.net/manual/en/function.getprotobyname.php * @param name string <p> * The protocol name. * </p> * @return int the protocol number, &return.falseforfailure;. */ function getprotobyname ($name) {} /** * Get protocol name associated with protocol number * @link http://www.php.net/manual/en/function.getprotobynumber.php * @param number int <p> * The protocol number. * </p> * @return string the protocol name as a string, &return.falseforfailure;. */ function getprotobynumber ($number) {} /** * Gets PHP script owner's UID * @link http://www.php.net/manual/en/function.getmyuid.php * @return int the user ID of the current script, or false on error. */ function getmyuid () {} /** * Get PHP script owner's GID * @link http://www.php.net/manual/en/function.getmygid.php * @return int the group ID of the current script, or false on error. */ function getmygid () {} /** * Gets PHP's process ID * @link http://www.php.net/manual/en/function.getmypid.php * @return int the current PHP process ID, or false on error. */ function getmypid () {} /** * Gets the inode of the current script * @link http://www.php.net/manual/en/function.getmyinode.php * @return int the current script's inode as an integer, or false on error. */ function getmyinode () {} /** * Gets time of last page modification * @link http://www.php.net/manual/en/function.getlastmod.php * @return int the time of the last modification of the current * page. The value returned is a Unix timestamp, suitable for * feeding to date. Returns false on error. */ function getlastmod () {} /** * Decodes data encoded with MIME base64 * @link http://www.php.net/manual/en/function.base64-decode.php * @param data string <p> * The encoded data. * </p> * @param strict bool[optional] <p> * Returns false if input contains character from outside the base64 * alphabet. * </p> * @return string the original data&return.falseforfailure;. The returned data may be * binary. */ function base64_decode ($data, $strict = null) {} /** * Encodes data with MIME base64 * @link http://www.php.net/manual/en/function.base64-encode.php * @param data string <p> * The data to encode. * </p> * @return string The encoded data, as a string&return.falseforfailure;. */ function base64_encode ($data) {} /** * Uuencode a string * @link http://www.php.net/manual/en/function.convert-uuencode.php * @param data string <p> * The data to be encoded. * </p> * @return string the uuencoded data. */ function convert_uuencode ($data) {} /** * Decode a uuencoded string * @link http://www.php.net/manual/en/function.convert-uudecode.php * @param data string <p> * The uuencoded data. * </p> * @return string the decoded data as a string. */ function convert_uudecode ($data) {} /** * Absolute value * @link http://www.php.net/manual/en/function.abs.php * @param number mixed <p> * The numeric value to process * </p> * @return number The absolute value of number. If the * argument number is * of type float, the return type is also float, * otherwise it is integer (as float usually has a * bigger value range than integer). */ function abs ($number) {} /** * Round fractions up * @link http://www.php.net/manual/en/function.ceil.php * @param value float <p> * The value to round * </p> * @return float value rounded up to the next highest * integer. * The return value of ceil is still of type * float as the value range of float is * usually bigger than that of integer. */ function ceil ($value) {} /** * Round fractions down * @link http://www.php.net/manual/en/function.floor.php * @param value float <p> * The numeric value to round * </p> * @return float value rounded to the next lowest integer. * The return value of floor is still of type * float because the value range of float is * usually bigger than that of integer. */ function floor ($value) {} /** * Rounds a float * @link http://www.php.net/manual/en/function.round.php * @param val float <p> * The value to round * </p> * @param precision int[optional] <p> * The optional number of decimal digits to round to. * </p> * @param mode int[optional] <p> * One of PHP_ROUND_HALF_UP, * PHP_ROUND_HALF_DOWN, * PHP_ROUND_HALF_EVEN, or * PHP_ROUND_HALF_ODD. * </p> * @return float The rounded value */ function round ($val, $precision = null, $mode = null) {} /** * Sine * @link http://www.php.net/manual/en/function.sin.php * @param arg float <p> * A value in radians * </p> * @return float The sine of arg */ function sin ($arg) {} /** * Cosine * @link http://www.php.net/manual/en/function.cos.php * @param arg float <p> * An angle in radians * </p> * @return float The cosine of arg */ function cos ($arg) {} /** * Tangent * @link http://www.php.net/manual/en/function.tan.php * @param arg float <p> * The argument to process in radians * </p> * @return float The tangent of arg */ function tan ($arg) {} /** * Arc sine * @link http://www.php.net/manual/en/function.asin.php * @param arg float <p> * The argument to process * </p> * @return float The arc sine of arg in radians */ function asin ($arg) {} /** * Arc cosine * @link http://www.php.net/manual/en/function.acos.php * @param arg float <p> * The argument to process * </p> * @return float The arc cosine of arg in radians. */ function acos ($arg) {} /** * Arc tangent * @link http://www.php.net/manual/en/function.atan.php * @param arg float <p> * The argument to process * </p> * @return float The arc tangent of arg in radians. */ function atan ($arg) {} /** * Inverse hyperbolic tangent * @link http://www.php.net/manual/en/function.atanh.php * @param arg float <p> * The argument to process * </p> * @return float Inverse hyperbolic tangent of arg */ function atanh ($arg) {} /** * Arc tangent of two variables * @link http://www.php.net/manual/en/function.atan2.php * @param y float <p> * Dividend parameter * </p> * @param x float <p> * Divisor parameter * </p> * @return float The arc tangent of y/x * in radians. */ function atan2 ($y, $x) {} /** * Hyperbolic sine * @link http://www.php.net/manual/en/function.sinh.php * @param arg float <p> * The argument to process * </p> * @return float The hyperbolic sine of arg */ function sinh ($arg) {} /** * Hyperbolic cosine * @link http://www.php.net/manual/en/function.cosh.php * @param arg float <p> * The argument to process * </p> * @return float The hyperbolic cosine of arg */ function cosh ($arg) {} /** * Hyperbolic tangent * @link http://www.php.net/manual/en/function.tanh.php * @param arg float <p> * The argument to process * </p> * @return float The hyperbolic tangent of arg */ function tanh ($arg) {} /** * Inverse hyperbolic sine * @link http://www.php.net/manual/en/function.asinh.php * @param arg float <p> * The argument to process * </p> * @return float The inverse hyperbolic sine of arg */ function asinh ($arg) {} /** * Inverse hyperbolic cosine * @link http://www.php.net/manual/en/function.acosh.php * @param arg float <p> * The value to process * </p> * @return float The inverse hyperbolic cosine of arg */ function acosh ($arg) {} /** * Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero * @link http://www.php.net/manual/en/function.expm1.php * @param arg float <p> * The argument to process * </p> * @return float 'e' to the power of arg minus one */ function expm1 ($arg) {} /** * Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero * @link http://www.php.net/manual/en/function.log1p.php * @param number float <p> * The argument to process * </p> * @return float log(1 + number) */ function log1p ($number) {} /** * Get value of pi * @link http://www.php.net/manual/en/function.pi.php * @return float The value of pi as float. */ function pi () {} /** * Finds whether a value is a legal finite number * @link http://www.php.net/manual/en/function.is-finite.php * @param val float <p> * The value to check * </p> * @return bool true if val is a legal finite * number within the allowed range for a PHP float on this platform, * else false. */ function is_finite ($val) {} /** * Finds whether a value is not a number * @link http://www.php.net/manual/en/function.is-nan.php * @param val float <p> * The value to check * </p> * @return bool true if val is 'not a number', * else false. */ function is_nan ($val) {} /** * Finds whether a value is infinite * @link http://www.php.net/manual/en/function.is-infinite.php * @param val float <p> * The value to check * </p> * @return bool true if val is infinite, else false. */ function is_infinite ($val) {} /** * Exponential expression * @link http://www.php.net/manual/en/function.pow.php * @param base number <p> * The base to use * </p> * @param exp number <p> * The exponent * </p> * @return number base raised to the power of exp. * If the result can be represented as integer it will be returned as type * integer, else it will be returned as type float. */ function pow ($base, $exp) {} /** * Calculates the exponent of <constant>e</constant> * @link http://www.php.net/manual/en/function.exp.php * @param arg float <p> * The argument to process * </p> * @return float 'e' raised to the power of arg */ function exp ($arg) {} /** * Natural logarithm * @link http://www.php.net/manual/en/function.log.php * @param arg float <p> * The value to calculate the logarithm for * </p> * @param base float[optional] <p> * The optional logarithmic base to use * (defaults to 'e' and so to the natural logarithm). * </p> * @return float The logarithm of arg to * base, if given, or the * natural logarithm. */ function log ($arg, $base = null) {} /** * Base-10 logarithm * @link http://www.php.net/manual/en/function.log10.php * @param arg float <p> * The argument to process * </p> * @return float The base-10 logarithm of arg */ function log10 ($arg) {} /** * Square root * @link http://www.php.net/manual/en/function.sqrt.php * @param arg float <p> * The argument to process * </p> * @return float The square root of arg * or the special value NAN for negative numbers. */ function sqrt ($arg) {} /** * Calculate the length of the hypotenuse of a right-angle triangle * @link http://www.php.net/manual/en/function.hypot.php * @param x float <p> * Length of first side * </p> * @param y float <p> * Length of second side * </p> * @return float Calculated length of the hypotenuse */ function hypot ($x, $y) {} /** * Converts the number in degrees to the radian equivalent * @link http://www.php.net/manual/en/function.deg2rad.php * @param number float <p> * Angular value in degrees * </p> * @return float The radian equivalent of number */ function deg2rad ($number) {} /** * Converts the radian number to the equivalent number in degrees * @link http://www.php.net/manual/en/function.rad2deg.php * @param number float <p> * A radian value * </p> * @return float The equivalent of number in degrees */ function rad2deg ($number) {} /** * Binary to decimal * @link http://www.php.net/manual/en/function.bindec.php * @param binary_string string <p> * The binary string to convert * </p> * @return number The decimal value of binary_string */ function bindec ($binary_string) {} /** * Hexadecimal to decimal * @link http://www.php.net/manual/en/function.hexdec.php * @param hex_string string <p> * The hexadecimal string to convert * </p> * @return number The decimal representation of hex_string */ function hexdec ($hex_string) {} /** * Octal to decimal * @link http://www.php.net/manual/en/function.octdec.php * @param octal_string string <p> * The octal string to convert * </p> * @return number The decimal representation of octal_string */ function octdec ($octal_string) {} /** * Decimal to binary * @link http://www.php.net/manual/en/function.decbin.php * @param number int <p> * Decimal value to convert * </p> * <table> * Range of inputs on 32-bit machines * <tr valign="top"> * <td>positive number</td> * <td>negative number</td> * <td>return value</td> * </tr> * <tr valign="top"> * <td>0</td> * <td></td> * <td>0</td> * </tr> * <tr valign="top"> * <td>1</td> * <td></td> * <td>1</td> * </tr> * <tr valign="top"> * <td>2</td> * <td></td> * <td>10</td> * </tr> * <tr valign="top"> * ... normal progression ...</td> * </tr> * <tr valign="top"> * <td>2147483646</td> * <td></td> * <td>1111111111111111111111111111110</td> * </tr> * <tr valign="top"> * <td>2147483647 (largest signed integer)</td> * <td></td> * <td>1111111111111111111111111111111 (31 1's)</td> * </tr> * <tr valign="top"> * <td>2147483648</td> * <td>-2147483648</td> * <td>10000000000000000000000000000000</td> * </tr> * <tr valign="top"> * ... normal progression ...</td> * </tr> * <tr valign="top"> * <td>4294967294</td> * <td>-2</td> * <td>11111111111111111111111111111110</td> * </tr> * <tr valign="top"> * <td>4294967295 (largest unsigned integer)</td> * <td>-1</td> * <td>11111111111111111111111111111111 (32 1's)</td> * </tr> * </table> * <table> * Range of inputs on 64-bit machines * <tr valign="top"> * <td>positive number</td> * <td>negative number</td> * <td>return value</td> * </tr> * <tr valign="top"> * <td>0</td> * <td></td> * <td>0</td> * </tr> * <tr valign="top"> * <td>1</td> * <td></td> * <td>1</td> * </tr> * <tr valign="top"> * <td>2</td> * <td></td> * <td>10</td> * </tr> * <tr valign="top"> * ... normal progression ...</td> * </tr> * <tr valign="top"> * <td>9223372036854775806</td> * <td></td> * <td>111111111111111111111111111111111111111111111111111111111111110</td> * </tr> * <tr valign="top"> * <td>9223372036854775807 (largest signed integer)</td> * <td></td> * <td>111111111111111111111111111111111111111111111111111111111111111 (63 1's)</td> * </tr> * <tr valign="top"> * <td></td> * <td>-9223372036854775808</td> * <td>1000000000000000000000000000000000000000000000000000000000000000</td> * </tr> * <tr valign="top"> * ... normal progression ...</td> * </tr> * <tr valign="top"> * <td></td> * <td>-2</td> * <td>1111111111111111111111111111111111111111111111111111111111111110</td> * </tr> * <tr valign="top"> * <td></td> * <td>-1</td> * <td>1111111111111111111111111111111111111111111111111111111111111111 (64 1's)</td> * </tr> * </table> * @return string Binary string representation of number */ function decbin ($number) {} /** * Decimal to octal * @link http://www.php.net/manual/en/function.decoct.php * @param number int <p> * Decimal value to convert * </p> * @return string Octal string representation of number */ function decoct ($number) {} /** * Decimal to hexadecimal * @link http://www.php.net/manual/en/function.dechex.php * @param number int <p> * Decimal value to convert * </p> * @return string Hexadecimal string representation of number */ function dechex ($number) {} /** * Convert a number between arbitrary bases * @link http://www.php.net/manual/en/function.base-convert.php * @param number string <p> * The number to convert * </p> * @param frombase int <p> * The base number is in * </p> * @param tobase int <p> * The base to convert number to * </p> * @return string number converted to base tobase */ function base_convert ($number, $frombase, $tobase) {} /** * Format a number with grouped thousands * @link http://www.php.net/manual/en/function.number-format.php * @param number float <p> * The number being formatted. * </p> * @param decimals int[optional] <p> * Sets the number of decimal points. * </p> * @return string A formatted version of number. */ function number_format ($number, $decimals = null) {} /** * Returns the floating point remainder (modulo) of the division of the arguments * @link http://www.php.net/manual/en/function.fmod.php * @param x float <p> * The dividend * </p> * @param y float <p> * The divisor * </p> * @return float The floating point remainder of * x/y */ function fmod ($x, $y) {} /** * Converts a packed internet address to a human readable representation * @link http://www.php.net/manual/en/function.inet-ntop.php * @param in_addr string <p> * A 32bit IPv4, or 128bit IPv6 address. * </p> * @return string a string representation of the address&return.falseforfailure;. */ function inet_ntop ($in_addr) {} /** * Converts a human readable IP address to its packed in_addr representation * @link http://www.php.net/manual/en/function.inet-pton.php * @param address string <p> * A human readable IPv4 or IPv6 address. * </p> * @return string the in_addr representation of the given * address, or false if a syntactically invalid * address is given (for example, an IPv4 address * without dots or an IPv6 address without colons). */ function inet_pton ($address) {} /** * Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address * @link http://www.php.net/manual/en/function.ip2long.php * @param ip_address string <p> * A standard format address. * </p> * @return int the IPv4 address or false if ip_address * is invalid. */ function ip2long ($ip_address) {} /** * Converts an (IPv4) Internet network address into a string in Internet standard dotted format * @link http://www.php.net/manual/en/function.long2ip.php * @param proper_address string <p> * A proper address representation. * </p> * @return string the Internet IP address as a string. */ function long2ip ($proper_address) {} /** * Gets the value of an environment variable * @link http://www.php.net/manual/en/function.getenv.php * @param varname string <p> * The variable name. * </p> * @return string the value of the environment variable * varname, or false if the environment * variable varname does not exist. */ function getenv ($varname) {} /** * Sets the value of an environment variable * @link http://www.php.net/manual/en/function.putenv.php * @param setting string <p> * The setting, like "FOO=BAR" * </p> * @return bool Returns true on success or false on failure. */ function putenv ($setting) {} /** * Gets options from the command line argument list * @link http://www.php.net/manual/en/function.getopt.php * @param options string Each character in this string will be used as option characters and * matched against options passed to the script starting with a single * hyphen (-). * For example, an option string "x" recognizes an * option -x. * Only a-z, A-Z and 0-9 are allowed. * @param longopts array[optional] An array of options. Each element in this array will be used as option * strings and matched against options passed to the script starting with * two hyphens (--). * For example, an longopts element "opt" recognizes an * option --opt. * @return array This function will return an array of option / argument pairs or false on * failure. * </p> * <p> * The parsing of options will end at the first non-option found, anything * that follows is discarded. */ function getopt ($options, array $longopts = null) {} /** * Gets system load average * @link http://www.php.net/manual/en/function.sys-getloadavg.php * @return array an array with three samples (last 1, 5 and 15 * minutes). */ function sys_getloadavg () {} /** * Return current Unix timestamp with microseconds * @link http://www.php.net/manual/en/function.microtime.php * @param get_as_float bool[optional] <p> * If used and set to true, microtime will return a * float instead of a string, as described in * the return values section below. * </p> * @return mixed By default, microtime returns a string in * the form "msec sec", where sec is the current time * measured in the number of seconds since the Unix epoch (0:00:00 January 1, * 1970 GMT), and msec is the number of microseconds that * have elapsed since sec expressed in seconds. * </p> * <p> * If get_as_float is set to true, then * microtime returns a float, which * represents the current time in seconds since the Unix epoch accurate to the * nearest microsecond. */ function microtime ($get_as_float = null) {} /** * Get current time * @link http://www.php.net/manual/en/function.gettimeofday.php * @param return_float bool[optional] <p> * When set to true, a float instead of an array is returned. * </p> * @return mixed By default an array is returned. If return_float * is set, then a float is returned. * </p> * <p> * Array keys: * "sec" - seconds since the Unix Epoch * "usec" - microseconds * "minuteswest" - minutes west of Greenwich * "dsttime" - type of dst correction */ function gettimeofday ($return_float = null) {} /** * Gets the current resource usages * @link http://www.php.net/manual/en/function.getrusage.php * @param who int[optional] <p> * If who is 1, getrusage will be called with * RUSAGE_CHILDREN. * </p> * @return array an associative array containing the data returned from the system * call. All entries are accessible by using their documented field names. */ function getrusage ($who = null) {} /** * Generate a unique ID * @link http://www.php.net/manual/en/function.uniqid.php * @param prefix string[optional] <p> * Can be useful, for instance, if you generate identifiers * simultaneously on several hosts that might happen to generate the * identifier at the same microsecond. * </p> * <p> * With an empty prefix, the returned string will * be 13 characters long. If more_entropy is * true, it will be 23 characters. * </p> * @param more_entropy bool[optional] <p> * If set to true, uniqid will add additional * entropy (using the combined linear congruential generator) at the end * of the return value, which should make the results more unique. * </p> * @return string the unique identifier, as a string. */ function uniqid ($prefix = null, $more_entropy = null) {} /** * Convert a quoted-printable string to an 8 bit string * @link http://www.php.net/manual/en/function.quoted-printable-decode.php * @param str string <p> * The input string. * </p> * @return string the 8-bit binary string. */ function quoted_printable_decode ($str) {} /** * Convert a 8 bit string to a quoted-printable string * @link http://www.php.net/manual/en/function.quoted-printable-encode.php * @param str string <p> * The input string. * </p> * @return string the encoded string. */ function quoted_printable_encode ($str) {} /** * Convert from one Cyrillic character set to another * @link http://www.php.net/manual/en/function.convert-cyr-string.php * @param str string <p> * The string to be converted. * </p> * @param from string <p> * The source Cyrillic character set, as a single character. * </p> * @param to string <p> * The target Cyrillic character set, as a single character. * </p> * @return string the converted string. */ function convert_cyr_string ($str, $from, $to) {} /** * Gets the name of the owner of the current PHP script * @link http://www.php.net/manual/en/function.get-current-user.php * @return string the username as a string. */ function get_current_user () {} /** * Limits the maximum execution time * @link http://www.php.net/manual/en/function.set-time-limit.php * @param seconds int <p> * The maximum execution time, in seconds. If set to zero, no time limit * is imposed. * </p> * @return void */ function set_time_limit ($seconds) {} /** * Call a header function * @link http://www.php.net/manual/en/function.header-register-callback.php * @param callback callback <p> * Function called just before the headers are sent. It gets no parameters * and the return value is ignored. * </p> * @return bool Returns true on success or false on failure. */ function header_register_callback ($callback) {} /** * Gets the value of a PHP configuration option * @link http://www.php.net/manual/en/function.get-cfg-var.php * @param option string <p> * The configuration option name. * </p> * @return string the current value of the PHP configuration variable specified by * option, or false if an error occurs. */ function get_cfg_var ($option) {} /** * &Alias; <function>set_magic_quotes_runtime</function> * @link http://www.php.net/manual/en/function.magic-quotes-runtime.php * @param new_setting */ function magic_quotes_runtime ($new_setting) {} /** * Sets the current active configuration setting of magic_quotes_runtime * @link http://www.php.net/manual/en/function.set-magic-quotes-runtime.php * @param new_setting bool <p> * false for off, true for on. * </p> * @return bool Returns true on success or false on failure. */ function set_magic_quotes_runtime ($new_setting) {} /** * Gets the current configuration setting of magic_quotes_gpc * @link http://www.php.net/manual/en/function.get-magic-quotes-gpc.php * @return int 0 if magic_quotes_gpc is off, 1 otherwise. */ function get_magic_quotes_gpc () {} /** * Gets the current active configuration setting of magic_quotes_runtime * @link http://www.php.net/manual/en/function.get-magic-quotes-runtime.php * @return int 0 if magic_quotes_runtime is off, 1 otherwise. */ function get_magic_quotes_runtime () {} /** * Send an error message somewhere * @link http://www.php.net/manual/en/function.error-log.php * @param message string <p> * The error message that should be logged. * </p> * @param message_type int[optional] <p> * Says where the error should go. The possible message types are as * follows: * </p> * <p> * <table> * error_log log types * <tr valign="top"> * <td>0</td> * <td> * message is sent to PHP's system logger, using * the Operating System's system logging mechanism or a file, depending * on what the error_log * configuration directive is set to. This is the default option. * </td> * </tr> * <tr valign="top"> * <td>1</td> * <td> * message is sent by email to the address in * the destination parameter. This is the only * message type where the fourth parameter, * extra_headers is used. * </td> * </tr> * <tr valign="top"> * <td>2</td> * <td> * No longer an option. * </td> * </tr> * <tr valign="top"> * <td>3</td> * <td> * message is appended to the file * destination. A newline is not automatically * added to the end of the message string. * </td> * </tr> * <tr valign="top"> * <td>4</td> * <td> * message is sent directly to the SAPI logging * handler. * </td> * </tr> * </table> * </p> * @param destination string[optional] <p> * The destination. Its meaning depends on the * message_type parameter as described above. * </p> * @param extra_headers string[optional] <p> * The extra headers. It's used when the message_type * parameter is set to 1. * This message type uses the same internal function as * mail does. * </p> * @return bool Returns true on success or false on failure. */ function error_log ($message, $message_type = null, $destination = null, $extra_headers = null) {} /** * Get the last occurred error * @link http://www.php.net/manual/en/function.error-get-last.php * @return array an associative array describing the last error with keys "type", * "message", "file" and "line". If the error has been caused by a PHP * internal function then the "message" begins with its name. * Returns &null; if there hasn't been an error yet. */ function error_get_last () {} /** * Call the callback given by the first parameter * @link http://www.php.net/manual/en/function.call-user-func.php * @param callback callback <p> * The callback to be called. * </p> * @param parameter mixed[optional] <p> * Zero or more parameters to be passed to the callback. * </p> * <p> * Note that the parameters for call_user_func are * not passed by reference. * call_user_func example and references * ]]> * &example.outputs; * </p> * @param _ mixed[optional] * @return mixed the return value of the callback, or false on error. */ function call_user_func ($callback, $parameter = null, $_ = null) {} /** * Call a callback with an array of parameters * @link http://www.php.net/manual/en/function.call-user-func-array.php * @param callback callback <p> * The callback to be called. * </p> * @param param_arr array <p> * The parameters to be passed to the callback, as an indexed array. * </p> * @return mixed the return value of the callback, or false on error. */ function call_user_func_array ($callback, array $param_arr) {} /** * Call a user method on an specific object [deprecated] * @link http://www.php.net/manual/en/function.call-user-method.php * @param method_name string <p> * The method name being called. * </p> * @param obj object <p> * The object that method_name * is being called on. * </p> * @param parameter mixed[optional] * @param _ mixed[optional] * @return mixed */ function call_user_method ($method_name, &$obj, $parameter = null, $_ = null) {} /** * Call a user method given with an array of parameters [deprecated] * @link http://www.php.net/manual/en/function.call-user-method-array.php * @param method_name string <p> * The method name being called. * </p> * @param obj object <p> * The object that method_name * is being called on. * </p> * @param params array <p> * An array of parameters. * </p> * @return mixed */ function call_user_method_array ($method_name, &$obj, array $params) {} /** * Call a static method * @link http://www.php.net/manual/en/function.forward-static-call.php * @param function callback <p> * The function or method to be called. This parameter may be an array, * with the name of the class, and the method, or a string, with a function * name. * </p> * @param parameter mixed[optional] <p> * Zero or more parameters to be passed to the function. * </p> * @param _ mixed[optional] * @return mixed the function result, or false on error. */ function forward_static_call ($function, $parameter = null, $_ = null) {} /** * Call a static method and pass the arguments as array * @link http://www.php.net/manual/en/function.forward-static-call-array.php * @param function callback <p> * The function or method to be called. This parameter may be an &array;, * with the name of the class, and the method, or a &string;, with a function * name. * </p> * @param parameters array * @return mixed the function result, or false on error. */ function forward_static_call_array ($function, array $parameters) {} /** * Generates a storable representation of a value * @link http://www.php.net/manual/en/function.serialize.php * @param value mixed <p> * The value to be serialized. serialize * handles all types, except the resource-type. * You can even serialize arrays that contain * references to itself. Circular references inside the array/object you * are serializing will also be stored. Any other * reference will be lost. * </p> * <p> * When serializing objects, PHP will attempt to call the member function * __sleep() prior to serialization. * This is to allow the object to do any last minute clean-up, etc. prior * to being serialized. Likewise, when the object is restored using * unserialize the __wakeup() member function is called. * </p> * <p> * Object's private members have the class name prepended to the member * name; protected members have a '*' prepended to the member name. * These prepended values have null bytes on either side. * </p> * @return string a string containing a byte-stream representation of * value that can be stored anywhere. */ function serialize ($value) {} /** * Creates a PHP value from a stored representation * @link http://www.php.net/manual/en/function.unserialize.php * @param str string <p> * The serialized string. * </p> * <p> * If the variable being unserialized is an object, after successfully * reconstructing the object PHP will automatically attempt to call the * __wakeup() member * function (if it exists). * </p> * <p> * unserialize_callback_func directive * <p> * It's possible to set a callback-function which will be called, * if an undefined class should be instantiated during unserializing. * (to prevent getting an incomplete object "__PHP_Incomplete_Class".) * Use your &php.ini;, ini_set or &htaccess; * to define 'unserialize_callback_func'. Everytime an undefined class * should be instantiated, it'll be called. To disable this feature just * empty this setting. * </p> * </p> * @return mixed The converted value is returned, and can be a boolean, * integer, float, string, * array or object. * </p> * <p> * In case the passed string is not unserializeable, false is returned and * E_NOTICE is issued. */ function unserialize ($str) {} /** * Dumps information about a variable * @link http://www.php.net/manual/en/function.var-dump.php * @param expression mixed <p> * The variable you want to dump. * </p> * @param _ mixed[optional] * @return void */ function var_dump ($expression, $_ = null) {} /** * Outputs or returns a parsable string representation of a variable * @link http://www.php.net/manual/en/function.var-export.php * @param expression mixed <p> * The variable you want to export. * </p> * @param return bool[optional] <p> * If used and set to true, var_export will return * the variable representation instead of outputing it. * </p> * @return mixed the variable representation when the return * parameter is used and evaluates to true. Otherwise, this function will * return &null;. */ function var_export ($expression, $return = null) {} /** * Dumps a string representation of an internal zend value to output * @link http://www.php.net/manual/en/function.debug-zval-dump.php * @param variable mixed <p> * The variable being evaluated. * </p> * @return void */ function debug_zval_dump ($variable) {} /** * Prints human-readable information about a variable * @link http://www.php.net/manual/en/function.print-r.php * @param expression mixed <p> * The expression to be printed. * </p> * @param return bool[optional] <p> * If you would like to capture the output of print_r, * use the return parameter. When this parameter is set * to true, print_r will return the information rather than print it. * </p> * @return mixed If given a string, integer or float, * the value itself will be printed. If given an array, values * will be presented in a format that shows keys and elements. Similar * notation is used for objects. * </p> * <p> * When the return parameter is true, this function * will return a string. Otherwise, the return value is true. */ function print_r ($expression, $return = null) {} /** * Returns the amount of memory allocated to PHP * @link http://www.php.net/manual/en/function.memory-get-usage.php * @param real_usage bool[optional] <p> * Set this to true to get the real size of memory allocated from * system. If not set or false only the memory used by * emalloc() is reported. * </p> * @return int the memory amount in bytes. */ function memory_get_usage ($real_usage = null) {} /** * Returns the peak of memory allocated by PHP * @link http://www.php.net/manual/en/function.memory-get-peak-usage.php * @param real_usage bool[optional] <p> * Set this to true to get the real size of memory allocated from * system. If not set or false only the memory used by * emalloc() is reported. * </p> * @return int the memory peak in bytes. */ function memory_get_peak_usage ($real_usage = null) {} /** * Register a function for execution on shutdown * @link http://www.php.net/manual/en/function.register-shutdown-function.php * @param callback callback <p> * The shutdown callback to register. * </p> * <p> * The shutdown callbacks are executed as the part of the request, so * it's possible to send output from them and access output buffers. * </p> * @param parameter mixed[optional] <p> * It is possible to pass parameters to the shutdown function by passing * additional parameters. * </p> * @param _ mixed[optional] * @return void */ function register_shutdown_function ($callback, $parameter = null, $_ = null) {} /** * Register a function for execution on each tick * @link http://www.php.net/manual/en/function.register-tick-function.php * @param function callback <p> * The function name as a string, or an array consisting of an object and * a method. * </p> * @param arg mixed[optional] <p> * </p> * @param _ mixed[optional] * @return bool Returns true on success or false on failure. */ function register_tick_function ($function, $arg = null, $_ = null) {} /** * De-register a function for execution on each tick * @link http://www.php.net/manual/en/function.unregister-tick-function.php * @param function_name string <p> * The function name, as a string. * </p> * @return void */ function unregister_tick_function ($function_name) {} /** * Syntax highlighting of a file * @link http://www.php.net/manual/en/function.highlight-file.php * @param filename string <p> * Path to the PHP file to be highlighted. * </p> * @param return bool[optional] <p> * Set this parameter to true to make this function return the * highlighted code. * </p> * @return mixed If return is set to true, returns the highlighted * code as a string instead of printing it out. Otherwise, it will return * true on success, false on failure. */ function highlight_file ($filename, $return = null) {} /** * &Alias; <function>highlight_file</function> * @link http://www.php.net/manual/en/function.show-source.php * @param file_name * @param return[optional] */ function show_source ($file_name, $return) {} /** * Syntax highlighting of a string * @link http://www.php.net/manual/en/function.highlight-string.php * @param str string <p> * The PHP code to be highlighted. This should include the opening tag. * </p> * @param return bool[optional] <p> * Set this parameter to true to make this function return the * highlighted code. * </p> * @return mixed If return is set to true, returns the highlighted * code as a string instead of printing it out. Otherwise, it will return * true on success, false on failure. */ function highlight_string ($str, $return = null) {} /** * Return source with stripped comments and whitespace * @link http://www.php.net/manual/en/function.php-strip-whitespace.php * @param filename string <p> * Path to the PHP file. * </p> * @return string The stripped source code will be returned on success, or an empty string * on failure. * </p> * <p> * This function works as described as of PHP 5.0.1. Before this it would * only return an empty string. For more information on this bug and its * prior behavior, see bug report * #29606. */ function php_strip_whitespace ($filename) {} /** * Gets the value of a configuration option * @link http://www.php.net/manual/en/function.ini-get.php * @param varname string <p> * The configuration option name. * </p> * @return string the value of the configuration option as a string on success, or an * empty string for null values. Returns false if the * configuration option doesn't exist. */ function ini_get ($varname) {} /** * Gets all configuration options * @link http://www.php.net/manual/en/function.ini-get-all.php * @param extension string[optional] <p> * An optional extension name. If set, the function return only options * specific for that extension. * </p> * @param details bool[optional] <p> * Retrieve details settings or only the current value for each setting. * Default is true (retrieve details). * </p> * @return array an associative array with directive name as the array key. * </p> * <p> * When details is true (default) the array will * contain global_value (set in * &php.ini;), local_value (perhaps set with * ini_set or &htaccess;), and * access (the access level). * </p> * <p> * When details is false the value will be the * current value of the option. * </p> * <p> * See the manual section * for information on what access levels mean. * </p> * <p> * It's possible for a directive to have multiple access levels, which is * why access shows the appropriate bitmask values. */ function ini_get_all ($extension = null, $details = null) {} /** * Sets the value of a configuration option * @link http://www.php.net/manual/en/function.ini-set.php * @param varname string <p> * </p> * <p> * Not all the available options can be changed using * ini_set. There is a list of all available options * in the appendix. * </p> * @param newvalue string <p> * The new value for the option. * </p> * @return string the old value on success, false on failure. */ function ini_set ($varname, $newvalue) {} /** * &Alias; <function>ini_set</function> * @link http://www.php.net/manual/en/function.ini-alter.php * @param varname * @param newvalue */ function ini_alter ($varname, $newvalue) {} /** * Restores the value of a configuration option * @link http://www.php.net/manual/en/function.ini-restore.php * @param varname string <p> * The configuration option name. * </p> * @return void */ function ini_restore ($varname) {} /** * Gets the current include_path configuration option * @link http://www.php.net/manual/en/function.get-include-path.php * @return string the path, as a string. */ function get_include_path () {} /** * Sets the include_path configuration option * @link http://www.php.net/manual/en/function.set-include-path.php * @param new_include_path string <p> * The new value for the include_path * </p> * @return string the old include_path on * success&return.falseforfailure;. */ function set_include_path ($new_include_path) {} /** * Restores the value of the include_path configuration option * @link http://www.php.net/manual/en/function.restore-include-path.php * @return void */ function restore_include_path () {} /** * Send a cookie * @link http://www.php.net/manual/en/function.setcookie.php * @param name string <p> * The name of the cookie. * </p> * @param value string[optional] <p> * The value of the cookie. This value is stored on the clients computer; * do not store sensitive information. Assuming the * name is 'cookiename', this * value is retrieved through $_COOKIE['cookiename'] * </p> * @param expire int[optional] <p> * The time the cookie expires. This is a Unix timestamp so is * in number of seconds since the epoch. In other words, you'll * most likely set this with the time function * plus the number of seconds before you want it to expire. Or * you might use mktime. * time()+60*60*24*30 will set the cookie to * expire in 30 days. If set to 0, or omitted, the cookie will expire at * the end of the session (when the browser closes). * </p> * <p> * <p> * You may notice the expire parameter takes on a * Unix timestamp, as opposed to the date format Wdy, DD-Mon-YYYY * HH:MM:SS GMT, this is because PHP does this conversion * internally. * </p> * </p> * @param path string[optional] <p> * The path on the server in which the cookie will be available on. * If set to '/', the cookie will be available * within the entire domain. If set to * '/foo/', the cookie will only be available * within the /foo/ directory and all * sub-directories such as /foo/bar/ of * domain. The default value is the * current directory that the cookie is being set in. * </p> * @param domain string[optional] <p> * The domain that the cookie is available to. Setting the domain to * 'www.example.com' will make the cookie * available in the www subdomain and higher subdomains. * Cookies available to a lower domain, such as * 'example.com' will be available to higher subdomains, * such as 'www.example.com'. * Older browsers still implementing the deprecated * RFC 2109 may require a leading * . to match all subdomains. * </p> * @param secure bool[optional] <p> * Indicates that the cookie should only be transmitted over a * secure HTTPS connection from the client. When set to true, the * cookie will only be set if a secure connection exists. * On the server-side, it's on the programmer to send this * kind of cookie only on secure connection (e.g. with respect to * $_SERVER["HTTPS"]). * </p> * @param httponly bool[optional] <p> * When true the cookie will be made accessible only through the HTTP * protocol. This means that the cookie won't be accessible by * scripting languages, such as JavaScript. It has been suggested that * this setting can effectively help to reduce identity theft through * XSS attacks (although it is not supported by all browsers), but that * claim is often disputed. Added in PHP 5.2.0. * true or false * </p> * @return bool If output exists prior to calling this function, * setcookie will fail and return false. If * setcookie successfully runs, it will return true. * This does not indicate whether the user accepted the cookie. */ function setcookie ($name, $value = null, $expire = null, $path = null, $domain = null, $secure = null, $httponly = null) {} /** * Send a cookie without urlencoding the cookie value * @link http://www.php.net/manual/en/function.setrawcookie.php * @param name string * @param value string[optional] * @param expire int[optional] * @param path string[optional] * @param domain string[optional] * @param secure bool[optional] * @param httponly bool[optional] * @return bool Returns true on success or false on failure. */ function setrawcookie ($name, $value = null, $expire = null, $path = null, $domain = null, $secure = null, $httponly = null) {} /** * Send a raw HTTP header * @link http://www.php.net/manual/en/function.header.php * @param string string <p> * The header string. * </p> * <p> * There are two special-case header calls. The first is a header * that starts with the string "HTTP/" (case is not * significant), which will be used to figure out the HTTP status * code to send. For example, if you have configured Apache to * use a PHP script to handle requests for missing files (using * the ErrorDocument directive), you may want to * make sure that your script generates the proper status code. * </p> * <p> * ]]> * </p> * <p> * For FastCGI you must use the following for a 404 response: * ]]> * </p> * <p> * The second special case is the "Location:" header. Not only does * it send this header back to the browser, but it also returns a * REDIRECT (302) status code to the browser * unless the 201 or * a 3xx status code has already been set. * </p> * <p> * ]]> * </p> * @param replace bool[optional] <p> * The optional replace parameter indicates * whether the header should replace a previous similar header, or * add a second header of the same type. By default it will replace, * but if you pass in false as the second argument you can force * multiple headers of the same type. For example: * </p> * <p> * ]]> * </p> * @param http_response_code int[optional] <p> * Forces the HTTP response code to the specified value. Note that this * parameter only has an effect if the string is * not empty. * </p> * @return void */ function header ($string, $replace = null, $http_response_code = null) {} /** * Remove previously set headers * @link http://www.php.net/manual/en/function.header-remove.php * @param name string[optional] <p> * The header name to be removed. * </p> * This parameter is case-insensitive. * @return void */ function header_remove ($name = null) {} /** * Checks if or where headers have been sent * @link http://www.php.net/manual/en/function.headers-sent.php * @param file string[optional] <p> * If the optional file and * line parameters are set, * headers_sent will put the PHP source file name * and line number where output started in the file * and line variables. * </p> * @param line int[optional] <p> * The line number where the output started. * </p> * @return bool headers_sent will return false if no HTTP headers * have already been sent or true otherwise. */ function headers_sent (&$file = null, &$line = null) {} /** * Returns a list of response headers sent (or ready to send) * @link http://www.php.net/manual/en/function.headers-list.php * @return array a numerically indexed array of headers. */ function headers_list () {} /** * Get or Set the HTTP response code * @link http://www.php.net/manual/en/function.http-response-code.php * @param response_code int[optional] <p> * The optional response_code will set the response code. * </p> * <p> * ]]> * </p> * @return int The current response code. By default the return value is int(200). */ function http_response_code ($response_code = null) {} /** * Check whether client disconnected * @link http://www.php.net/manual/en/function.connection-aborted.php * @return int 1 if client disconnected, 0 otherwise. */ function connection_aborted () {} /** * Returns connection status bitfield * @link http://www.php.net/manual/en/function.connection-status.php * @return int the connection status bitfield, which can be used against the * CONNECTION_XXX constants to determine the connection * status. */ function connection_status () {} /** * Set whether a client disconnect should abort script execution * @link http://www.php.net/manual/en/function.ignore-user-abort.php * @param value string[optional] <p> * If set, this function will set the ignore_user_abort ini setting * to the given value. If not, this function will * only return the previous setting without changing it. * </p> * @return int the previous setting, as an integer. */ function ignore_user_abort ($value = null) {} /** * Parse a configuration file * @link http://www.php.net/manual/en/function.parse-ini-file.php * @param filename string <p> * The filename of the ini file being parsed. * </p> * @param process_sections bool[optional] <p> * By setting the process_sections * parameter to true, you get a multidimensional array, with * the section names and settings included. The default * for process_sections is false * </p> * @param scanner_mode int[optional] <p> * Can either be INI_SCANNER_NORMAL (default) or * INI_SCANNER_RAW. If INI_SCANNER_RAW * is supplied, then option values will not be parsed. * </p> * @return array The settings are returned as an associative array on success, * and false on failure. */ function parse_ini_file ($filename, $process_sections = null, $scanner_mode = null) {} /** * Parse a configuration string * @link http://www.php.net/manual/en/function.parse-ini-string.php * @param ini string <p> * The contents of the ini file being parsed. * </p> * @param process_sections bool[optional] <p> * By setting the process_sections * parameter to true, you get a multidimensional array, with * the section names and settings included. The default * for process_sections is false * </p> * @param scanner_mode int[optional] <p> * Can either be INI_SCANNER_NORMAL (default) or * INI_SCANNER_RAW. If INI_SCANNER_RAW * is supplied, then option values will not be parsed. * </p> * @return array The settings are returned as an associative array on success, * and false on failure. */ function parse_ini_string ($ini, $process_sections = null, $scanner_mode = null) {} /** * Tells whether the file was uploaded via HTTP POST * @link http://www.php.net/manual/en/function.is-uploaded-file.php * @param filename string <p> * The filename being checked. * </p> * @return bool Returns true on success or false on failure. */ function is_uploaded_file ($filename) {} /** * Moves an uploaded file to a new location * @link http://www.php.net/manual/en/function.move-uploaded-file.php * @param filename string <p> * The filename of the uploaded file. * </p> * @param destination string <p> * The destination of the moved file. * </p> * @return bool true on success. * </p> * <p> * If filename is not a valid upload file, * then no action will occur, and * move_uploaded_file will return * false. * </p> * <p> * If filename is a valid upload file, but * cannot be moved for some reason, no action will occur, and * move_uploaded_file will return * false. Additionally, a warning will be issued. */ function move_uploaded_file ($filename, $destination) {} /** * Get the Internet host name corresponding to a given IP address * @link http://www.php.net/manual/en/function.gethostbyaddr.php * @param ip_address string <p> * The host IP address. * </p> * @return string the host name on success, the unmodified ip_address * on failure, or false on malformed input. */ function gethostbyaddr ($ip_address) {} /** * Get the IPv4 address corresponding to a given Internet host name * @link http://www.php.net/manual/en/function.gethostbyname.php * @param hostname string <p> * The host name. * </p> * @return string the IPv4 address or a string containing the unmodified * hostname on failure. */ function gethostbyname ($hostname) {} /** * Get a list of IPv4 addresses corresponding to a given Internet host name * @link http://www.php.net/manual/en/function.gethostbynamel.php * @param hostname string <p> * The host name. * </p> * @return array an array of IPv4 addresses or false if * hostname could not be resolved. */ function gethostbynamel ($hostname) {} /** * Gets the host name * @link http://www.php.net/manual/en/function.gethostname.php * @return string a string with the hostname on success, otherwise false is * returned. */ function gethostname () {} /** * &Alias; <function>checkdnsrr</function> * @link http://www.php.net/manual/en/function.dns-check-record.php * @param host * @param type[optional] */ function dns_check_record ($host, $type) {} /** * Check DNS records corresponding to a given Internet host name or IP address * @link http://www.php.net/manual/en/function.checkdnsrr.php * @param host string <p> * host may either be the IP address in * dotted-quad notation or the host name. * </p> * @param type string[optional] <p> * type may be any one of: A, MX, NS, SOA, * PTR, CNAME, AAAA, A6, SRV, NAPTR, TXT or ANY. * </p> * @return bool true if any records are found; returns false if no records * were found or if an error occurred. */ function checkdnsrr ($host, $type = null) {} /** * &Alias; <function>getmxrr</function> * @link http://www.php.net/manual/en/function.dns-get-mx.php * @param hostname * @param mxhosts * @param weight[optional] */ function dns_get_mx ($hostname, &$mxhosts, &$weight) {} /** * Get MX records corresponding to a given Internet host name * @link http://www.php.net/manual/en/function.getmxrr.php * @param hostname string <p> * The Internet host name. * </p> * @param mxhosts array <p> * A list of the MX records found is placed into the array * mxhosts. * </p> * @param weight array[optional] <p> * If the weight array is given, it will be filled * with the weight information gathered. * </p> * @return bool true if any records are found; returns false if no records * were found or if an error occurred. */ function getmxrr ($hostname, array &$mxhosts, array &$weight = null) {} /** * Fetch DNS Resource Records associated with a hostname * @link http://www.php.net/manual/en/function.dns-get-record.php * @param hostname string <p> * hostname should be a valid DNS hostname such * as "www.example.com". Reverse lookups can be generated * using in-addr.arpa notation, but * gethostbyaddr is more suitable for * the majority of reverse lookups. * </p> * <p> * Per DNS standards, email addresses are given in user.host format (for * example: hostmaster.example.com as opposed to [email protected]), * be sure to check this value and modify if necessary before using it * with a functions such as mail. * </p> * @param type int[optional] <p> * By default, dns_get_record will search for any * resource records associated with hostname. * To limit the query, specify the optional type * parameter. May be any one of the following: * DNS_A, DNS_CNAME, * DNS_HINFO, DNS_MX, * DNS_NS, DNS_PTR, * DNS_SOA, DNS_TXT, * DNS_AAAA, DNS_SRV, * DNS_NAPTR, DNS_A6, * DNS_ALL or DNS_ANY. * </p> * <p> * Because of eccentricities in the performance of libresolv * between platforms, DNS_ANY will not * always return every record, the slower DNS_ALL * will collect all records more reliably. * </p> * @param authns array[optional] <p> * Passed by reference and, if given, will be populated with Resource * Records for the Authoritative Name Servers. * </p> * @param addtl array[optional] <p> * Passed by reference and, if given, will be populated with any * Additional Records. * </p> * @return array This function returns an array of associative arrays, * &return.falseforfailure;. Each associative array contains * at minimum the following keys: * <table> * Basic DNS attributes * <tr valign="top"> * <td>Attribute</td> * <td>Meaning</td> * </tr> * <tr valign="top"> * <td>host</td> * <td> * The record in the DNS namespace to which the rest of the associated data refers. * </td> * </tr> * <tr valign="top"> * <td>class</td> * <td> * dns_get_record only returns Internet class records and as * such this parameter will always return IN. * </td> * </tr> * <tr valign="top"> * <td>type</td> * <td> * String containing the record type. Additional attributes will also be contained * in the resulting array dependant on the value of type. See table below. * </td> * </tr> * <tr valign="top"> * <td>ttl</td> * <td> * "Time To Live" remaining for this record. This will not equal * the record's original ttl, but will rather equal the original ttl minus whatever * length of time has passed since the authoritative name server was queried. * </td> * </tr> * </table> * </p> * <p> * <table> * Other keys in associative arrays dependant on 'type' * <tr valign="top"> * <td>Type</td> * <td>Extra Columns</td> * </tr> * <tr valign="top"> * <td>A</td> * <td> * ip: An IPv4 addresses in dotted decimal notation. * </td> * </tr> * <tr valign="top"> * <td>MX</td> * <td> * pri: Priority of mail exchanger. * Lower numbers indicate greater priority. * target: FQDN of the mail exchanger. * See also dns_get_mx. * </td> * </tr> * <tr valign="top"> * <td>CNAME</td> * <td> * target: FQDN of location in DNS namespace to which * the record is aliased. * </td> * </tr> * <tr valign="top"> * <td>NS</td> * <td> * target: FQDN of the name server which is authoritative * for this hostname. * </td> * </tr> * <tr valign="top"> * <td>PTR</td> * <td> * target: Location within the DNS namespace to which * this record points. * </td> * </tr> * <tr valign="top"> * <td>TXT</td> * <td> * txt: Arbitrary string data associated with this record. * </td> * </tr> * <tr valign="top"> * <td>HINFO</td> * <td> * cpu: IANA number designating the CPU of the machine * referenced by this record. * os: IANA number designating the Operating System on * the machine referenced by this record. * See IANA's Operating System * Names for the meaning of these values. * </td> * </tr> * <tr valign="top"> * <td>SOA</td> * <td> * mname: FQDN of the machine from which the resource * records originated. * rname: Email address of the administrative contain * for this domain. * serial: Serial # of this revision of the requested * domain. * refresh: Refresh interval (seconds) secondary name * servers should use when updating remote copies of this domain. * retry: Length of time (seconds) to wait after a * failed refresh before making a second attempt. * expire: Maximum length of time (seconds) a secondary * DNS server should retain remote copies of the zone data without a * successful refresh before discarding. * minimum-ttl: Minimum length of time (seconds) a * client can continue to use a DNS resolution before it should request * a new resolution from the server. Can be overridden by individual * resource records. * </td> * </tr> * <tr valign="top"> * <td>AAAA</td> * <td> * ipv6: IPv6 address * </td> * </tr> * <tr valign="top"> * <td>A6(PHP &gt;= 5.1.0)</td> * <td> * masklen: Length (in bits) to inherit from the target * specified by chain. * ipv6: Address for this specific record to merge with * chain. * chain: Parent record to merge with * ipv6 data. * </td> * </tr> * <tr valign="top"> * <td>SRV</td> * <td> * pri: (Priority) lowest priorities should be used first. * weight: Ranking to weight which of commonly prioritized * targets should be chosen at random. * target and port: hostname and port * where the requested service can be found. * For additional information see: RFC 2782 * </td> * </tr> * <tr valign="top"> * <td>NAPTR</td> * <td> * order and pref: Equivalent to * pri and weight above. * flags, services, regex, * and replacement: Parameters as defined by * RFC 2915. * </td> * </tr> * </table> */ function dns_get_record ($hostname, $type = null, array &$authns = null, array &$addtl = null) {} /** * Get the integer value of a variable * @link http://www.php.net/manual/en/function.intval.php * @param var mixed <p> * The scalar value being converted to an integer * </p> * @param base int[optional] <p> * The base for the conversion * </p> * @return int The integer value of var on success, or 0 on * failure. Empty arrays return 0, non-empty arrays return 1. * </p> * <p> * The maximum value depends on the system. 32 bit systems have a * maximum signed integer range of -2147483648 to 2147483647. So for example * on such a system, intval('1000000000000') will return * 2147483647. The maximum signed integer value for 64 bit systems is * 9223372036854775807. * </p> * <p> * Strings will most likely return 0 although this depends on the * leftmost characters of the string. The common rules of * integer casting * apply. */ function intval ($var, $base = null) {} /** * Get float value of a variable * @link http://www.php.net/manual/en/function.floatval.php * @param var mixed <p> * May be any scalar type. floatval should not be used * on objects, as doing so will emit an E_NOTICE level * error and return 1. * </p> * @return float The float value of the given variable. Empty arrays return 0, non-empty * arrays return 1. */ function floatval ($var) {} /** * &Alias; <function>floatval</function> * @link http://www.php.net/manual/en/function.doubleval.php * @param var */ function doubleval ($var) {} /** * Get string value of a variable * @link http://www.php.net/manual/en/function.strval.php * @param var mixed <p> * The variable that is being converted to a string. * </p> * <p> * var may be any scalar type or an object that * implements the __toString() * method. You cannot use strval on arrays or on * objects that do not implement the * __toString() method. * </p> * @return string The string value of var. */ function strval ($var) {} /** * Get the type of a variable * @link http://www.php.net/manual/en/function.gettype.php * @param var mixed <p> * The variable being type checked. * </p> * @return string Possibles values for the returned string are: * "boolean" * "integer" * "double" (for historical reasons "double" is * returned in case of a float, and not simply * "float") * "string" * "array" * "object" * "resource" * "NULL" * "unknown type" */ function gettype ($var) {} /** * Set the type of a variable * @link http://www.php.net/manual/en/function.settype.php * @param var mixed <p> * The variable being converted. * </p> * @param type string <p> * Possibles values of type are: * "boolean" (or, since PHP 4.2.0, "bool") * @return bool Returns true on success or false on failure. */ function settype (&$var, $type) {} /** * Finds whether a variable is &null; * @link http://www.php.net/manual/en/function.is-null.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is null, false * otherwise. */ function is_null ($var) {} /** * Finds whether a variable is a resource * @link http://www.php.net/manual/en/function.is-resource.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is a resource, * false otherwise. */ function is_resource ($var) {} /** * Finds out whether a variable is a boolean * @link http://www.php.net/manual/en/function.is-bool.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is a boolean, * false otherwise. */ function is_bool ($var) {} /** * &Alias; <function>is_int</function> * @link http://www.php.net/manual/en/function.is-long.php * @param var */ function is_long ($var) {} /** * Finds whether the type of a variable is float * @link http://www.php.net/manual/en/function.is-float.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is a float, * false otherwise. */ function is_float ($var) {} /** * Find whether the type of a variable is integer * @link http://www.php.net/manual/en/function.is-int.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is an integer, * false otherwise. */ function is_int ($var) {} /** * &Alias; <function>is_int</function> * @link http://www.php.net/manual/en/function.is-integer.php * @param var */ function is_integer ($var) {} /** * &Alias; <function>is_float</function> * @link http://www.php.net/manual/en/function.is-double.php * @param var */ function is_double ($var) {} /** * &Alias; <function>is_float</function> * @link http://www.php.net/manual/en/function.is-real.php * @param var */ function is_real ($var) {} /** * Finds whether a variable is a number or a numeric string * @link http://www.php.net/manual/en/function.is-numeric.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is a number or a numeric * string, false otherwise. */ function is_numeric ($var) {} /** * Find whether the type of a variable is string * @link http://www.php.net/manual/en/function.is-string.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is of type string, * false otherwise. */ function is_string ($var) {} /** * Finds whether a variable is an array * @link http://www.php.net/manual/en/function.is-array.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is an array, * false otherwise. */ function is_array ($var) {} /** * Finds whether a variable is an object * @link http://www.php.net/manual/en/function.is-object.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is an object, * false otherwise. */ function is_object ($var) {} /** * Finds whether a variable is a scalar * @link http://www.php.net/manual/en/function.is-scalar.php * @param var mixed <p> * The variable being evaluated. * </p> * @return bool true if var is a scalar false * otherwise. */ function is_scalar ($var) {} /** * Verify that the contents of a variable can be called as a function * @link http://www.php.net/manual/en/function.is-callable.php * @param name callback <p> * The callback function to check * </p> * @param syntax_only bool[optional] <p> * If set to true the function only verifies that * name might be a function or method. It will only * reject simple variables that are not strings, or an array that does * not have a valid structure to be used as a callback. The valid ones * are supposed to have only 2 entries, the first of which is an object * or a string, and the second a string. * </p> * @param callable_name string[optional] <p> * Receives the "callable name". In the example below it is * "someClass::someMethod". Note, however, that despite the implication * that someClass::SomeMethod() is a callable static method, this is not * the case. * </p> * @return bool true if name is callable, false * otherwise. */ function is_callable ($name, $syntax_only = null, &$callable_name = null) {} /** * Closes process file pointer * @link http://www.php.net/manual/en/function.pclose.php * @param handle resource <p> * The file pointer must be valid, and must have been returned by a * successful call to popen. * </p> * @return int the termination status of the process that was run. In case of * an error then -1 is returned. */ function pclose ($handle) {} /** * Opens process file pointer * @link http://www.php.net/manual/en/function.popen.php * @param command string <p> * The command * </p> * @param mode string <p> * The mode * </p> * @return resource a file pointer identical to that returned by * fopen, except that it is unidirectional (may * only be used for reading or writing) and must be closed with * pclose. This pointer may be used with * fgets, fgetss, and * fwrite. When the mode is 'r', the returned * file pointer equals to the STDOUT of the command, when the mode * is 'w', the returned file pointer equals to the STDIN of the * command. * </p> * <p> * If an error occurs, returns false. */ function popen ($command, $mode) {} /** * Outputs a file * @link http://www.php.net/manual/en/function.readfile.php * @param filename string <p> * The filename being read. * </p> * @param use_include_path bool[optional] <p> * You can use the optional second parameter and set it to true, if * you want to search for the file in the include_path, too. * </p> * @param context resource[optional] <p> * A context stream resource. * </p> * @return int the number of bytes read from the file. If an error * occurs, false is returned and unless the function was called as * @readfile, an error message is printed. */ function readfile ($filename, $use_include_path = null, $context = null) {} /** * Rewind the position of a file pointer * @link http://www.php.net/manual/en/function.rewind.php * @param handle resource <p> * The file pointer must be valid, and must point to a file * successfully opened by fopen. * </p> * @return bool Returns true on success or false on failure. */ function rewind ($handle) {} /** * Removes directory * @link http://www.php.net/manual/en/function.rmdir.php * @param dirname string <p> * Path to the directory. * </p> * @param context resource[optional] &note.context-support; * @return bool Returns true on success or false on failure. */ function rmdir ($dirname, $context = null) {} /** * Changes the current umask * @link http://www.php.net/manual/en/function.umask.php * @param mask int[optional] <p> * The new umask. * </p> * @return int umask without arguments simply returns the * current umask otherwise the old umask is returned. */ function umask ($mask = null) {} /** * Closes an open file pointer * @link http://www.php.net/manual/en/function.fclose.php * @param handle resource <p> * The file pointer must be valid, and must point to a file successfully * opened by fopen or fsockopen. * </p> * @return bool Returns true on success or false on failure. */ function fclose ($handle) {} /** * Tests for end-of-file on a file pointer * @link http://www.php.net/manual/en/function.feof.php * @param handle resource &fs.validfp.all; * @return bool true if the file pointer is at EOF or an error occurs * (including socket timeout); otherwise returns false. */ function feof ($handle) {} /** * Gets character from file pointer * @link http://www.php.net/manual/en/function.fgetc.php * @param handle resource &fs.validfp.all; * @return string a string containing a single character read from the file pointed * to by handle. Returns false on EOF. */ function fgetc ($handle) {} /** * Gets line from file pointer * @link http://www.php.net/manual/en/function.fgets.php * @param handle resource &fs.validfp.all; * @param length int[optional] <p> * Reading ends when length - 1 bytes have been * read, on a newline (which is included in the return value), or on EOF * (whichever comes first). If no length is specified, it will keep * reading from the stream until it reaches the end of the line. * </p> * <p> * Until PHP 4.3.0, omitting it would assume 1024 as the line length. * If the majority of the lines in the file are all larger than 8KB, * it is more resource efficient for your script to specify the maximum * line length. * </p> * @return string a string of up to length - 1 bytes read from * the file pointed to by handle. If there is no more data * to read in the file pointer, then false is returned. * </p> * <p> * If an error occurs, false is returned. */ function fgets ($handle, $length = null) {} /** * Gets line from file pointer and strip HTML tags * @link http://www.php.net/manual/en/function.fgetss.php * @param handle resource &fs.validfp.all; * @param length int[optional] <p> * Length of the data to be retrieved. * </p> * @param allowable_tags string[optional] <p> * You can use the optional third parameter to specify tags which should * not be stripped. * </p> * @return string a string of up to length - 1 bytes read from * the file pointed to by handle, with all HTML and PHP * code stripped. * </p> * <p> * If an error occurs, returns false. */ function fgetss ($handle, $length = null, $allowable_tags = null) {} /** * Binary-safe file read * @link http://www.php.net/manual/en/function.fread.php * @param handle resource &fs.file.pointer; * @param length int <p> * Up to length number of bytes read. * </p> * @return string the read string &return.falseforfailure;. */ function fread ($handle, $length) {} /** * Opens file or URL * @link http://www.php.net/manual/en/function.fopen.php * @param filename string <p> * If filename is of the form "scheme://...", it * is assumed to be a URL and PHP will search for a protocol handler * (also known as a wrapper) for that scheme. If no wrappers for that * protocol are registered, PHP will emit a notice to help you track * potential problems in your script and then continue as though * filename specifies a regular file. * </p> * <p> * If PHP has decided that filename specifies * a local file, then it will try to open a stream on that file. * The file must be accessible to PHP, so you need to ensure that * the file access permissions allow this access. * If you have enabled &safemode;, * or open_basedir further * restrictions may apply. * </p> * <p> * If PHP has decided that filename specifies * a registered protocol, and that protocol is registered as a * network URL, PHP will check to make sure that * allow_url_fopen is * enabled. If it is switched off, PHP will emit a warning and * the fopen call will fail. * </p> * <p> * The list of supported protocols can be found in . Some protocols (also referred to as * wrappers) support context * and/or &php.ini; options. Refer to the specific page for the * protocol in use for a list of options which can be set. (e.g. * &php.ini; value user_agent used by the * http wrapper). * </p> * <p> * On the Windows platform, be careful to escape any backslashes * used in the path to the file, or use forward slashes. * ]]> * </p> * @param mode string <p> * The mode parameter specifies the type of access * you require to the stream. It may be any of the following: * <table> * A list of possible modes for fopen * using mode * <tr valign="top"> * <td>mode</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>'r'</td> * <td> * Open for reading only; place the file pointer at the * beginning of the file. * </td> * </tr> * <tr valign="top"> * <td>'r+'</td> * <td> * Open for reading and writing; place the file pointer at * the beginning of the file. * </td> * </tr> * <tr valign="top"> * <td>'w'</td> * <td> * Open for writing only; place the file pointer at the * beginning of the file and truncate the file to zero length. * If the file does not exist, attempt to create it. * </td> * </tr> * <tr valign="top"> * <td>'w+'</td> * <td> * Open for reading and writing; place the file pointer at * the beginning of the file and truncate the file to zero * length. If the file does not exist, attempt to create it. * </td> * </tr> * <tr valign="top"> * <td>'a'</td> * <td> * Open for writing only; place the file pointer at the end of * the file. If the file does not exist, attempt to create it. * </td> * </tr> * <tr valign="top"> * <td>'a+'</td> * <td> * Open for reading and writing; place the file pointer at * the end of the file. If the file does not exist, attempt to * create it. * </td> * </tr> * <tr valign="top"> * <td>'x'</td> * <td> * Create and open for writing only; place the file pointer at the * beginning of the file. If the file already exists, the * fopen call will fail by returning false and * generating an error of level E_WARNING. If * the file does not exist, attempt to create it. This is equivalent * to specifying O_EXCL|O_CREAT flags for the * underlying open(2) system call. * </td> * </tr> * <tr valign="top"> * <td>'x+'</td> * <td> * Create and open for reading and writing; otherwise it has the * same behavior as 'x'. * </td> * </tr> * <tr valign="top"> * <td>'c'</td> * <td> * Open the file for writing only. If the file does not exist, it is * created. If it exists, it is neither truncated (as opposed to * 'w'), nor the call to this function fails (as is * the case with 'x'). The file pointer is * positioned on the beginning of the file. This may be useful if it's * desired to get an advisory lock (see flock) * before attempting to modify the file, as using * 'w' could truncate the file before the lock * was obtained (if truncation is desired, * ftruncate can be used after the lock is * requested). * </td> * </tr> * <tr valign="top"> * <td>'c+'</td> * <td> * Open the file for reading and writing; otherwise it has the same * behavior as 'c'. * </td> * </tr> * </table> * </p> * <p> * Different operating system families have different line-ending * conventions. When you write a text file and want to insert a line * break, you need to use the correct line-ending character(s) for your * operating system. Unix based systems use \n as the * line ending character, Windows based systems use \r\n * as the line ending characters and Macintosh based systems use * \r as the line ending character. * </p> * <p> * If you use the wrong line ending characters when writing your files, you * might find that other applications that open those files will "look * funny". * </p> * <p> * Windows offers a text-mode translation flag ('t') * which will transparently translate \n to * \r\n when working with the file. In contrast, you * can also use 'b' to force binary mode, which will not * translate your data. To use these flags, specify either * 'b' or 't' as the last character * of the mode parameter. * </p> * <p> * The default translation mode depends on the SAPI and version of PHP that * you are using, so you are encouraged to always specify the appropriate * flag for portability reasons. You should use the 't' * mode if you are working with plain-text files and you use * \n to delimit your line endings in your script, but * expect your files to be readable with applications such as notepad. You * should use the 'b' in all other cases. * </p> * <p> * If you do not specify the 'b' flag when working with binary files, you * may experience strange problems with your data, including broken image * files and strange problems with \r\n characters. * </p> * <p> * For portability, it is strongly recommended that you always * use the 'b' flag when opening files with fopen. * </p> * <p> * Again, for portability, it is also strongly recommended that * you re-write code that uses or relies upon the 't' * mode so that it uses the correct line endings and * 'b' mode instead. * </p> * @param use_include_path bool[optional] <p> * The optional third use_include_path parameter * can be set to '1' or true if you want to search for the file in the * include_path, too. * </p> * @param context resource[optional] &note.context-support; * @return resource a file pointer resource on success, or false on error. */ function fopen ($filename, $mode, $use_include_path = null, $context = null) {} /** * Output all remaining data on a file pointer * @link http://www.php.net/manual/en/function.fpassthru.php * @param handle resource &fs.validfp.all; * @return int If an error occurs, fpassthru returns * false. Otherwise, fpassthru returns * the number of characters read from handle * and passed through to the output. */ function fpassthru ($handle) {} /** * Truncates a file to a given length * @link http://www.php.net/manual/en/function.ftruncate.php * @param handle resource <p> * The file pointer. * </p> * <p> * The handle must be open for writing. * </p> * @param size int <p> * The size to truncate to. * </p> * <p> * If size is larger than the file then the file * is extended with null bytes. * </p> * <p> * If size is smaller than the file then the file * is truncated to that size. * </p> * @return bool Returns true on success or false on failure. */ function ftruncate ($handle, $size) {} /** * Gets information about a file using an open file pointer * @link http://www.php.net/manual/en/function.fstat.php * @param handle resource &fs.file.pointer; * @return array an array with the statistics of the file; the format of the array * is described in detail on the stat manual page. */ function fstat ($handle) {} /** * Seeks on a file pointer * @link http://www.php.net/manual/en/function.fseek.php * @param handle resource &fs.file.pointer; * @param offset int <p> * The offset. * </p> * <p> * To move to a position before the end-of-file, you need to pass * a negative value in offset and * set whence * to SEEK_END. * </p> * @param whence int[optional] <p> * whence values are: * SEEK_SET - Set position equal to offset bytes. * SEEK_CUR - Set position to current location plus offset. * SEEK_END - Set position to end-of-file plus offset. * </p> * @return int Upon success, returns 0; otherwise, returns -1. */ function fseek ($handle, $offset, $whence = null) {} /** * Returns the current position of the file read/write pointer * @link http://www.php.net/manual/en/function.ftell.php * @param handle resource <p> * The file pointer must be valid, and must point to a file successfully * opened by fopen or popen. * ftell gives undefined results for append-only streams * (opened with "a" flag). * </p> * @return int the position of the file pointer referenced by * handle as an integer; i.e., its offset into the file stream. * </p> * <p> * If an error occurs, returns false. */ function ftell ($handle) {} /** * Flushes the output to a file * @link http://www.php.net/manual/en/function.fflush.php * @param handle resource &fs.validfp.all; * @return bool Returns true on success or false on failure. */ function fflush ($handle) {} /** * Binary-safe file write * @link http://www.php.net/manual/en/function.fwrite.php * @param handle resource &fs.file.pointer; * @param string string <p> * The string that is to be written. * </p> * @param length int[optional] <p> * If the length argument is given, writing will * stop after length bytes have been written or * the end of string is reached, whichever comes * first. * </p> * <p> * Note that if the length argument is given, * then the magic_quotes_runtime * configuration option will be ignored and no slashes will be * stripped from string. * </p> * @return int */ function fwrite ($handle, $string, $length = null) {} /** * &Alias; <function>fwrite</function> * @link http://www.php.net/manual/en/function.fputs.php * @param fp * @param str * @param length[optional] */ function fputs ($fp, $str, $length) {} /** * Makes directory * @link http://www.php.net/manual/en/function.mkdir.php * @param pathname string <p> * The directory path. * </p> * @param mode int[optional] <p> * The mode is 0777 by default, which means the widest possible * access. For more information on modes, read the details * on the chmod page. * </p> * <p> * mode is ignored on Windows. * </p> * <p> * Note that you probably want to specify the mode as an octal number, * which means it should have a leading zero. The mode is also modified * by the current umask, which you can change using * umask. * </p> * @param recursive bool[optional] <p> * Allows the creation of nested directories specified in the * pathname. Defaults to false. * </p> * @param context resource[optional] &note.context-support; * @return bool Returns true on success or false on failure. */ function mkdir ($pathname, $mode = null, $recursive = null, $context = null) {} /** * Renames a file or directory * @link http://www.php.net/manual/en/function.rename.php * @param oldname string <p> * </p> * <p> * The old name. The wrapper used in oldname * must match the wrapper used in * newname. * </p> * @param newname string <p> * The new name. * </p> * @param context resource[optional] &note.context-support; * @return bool Returns true on success or false on failure. */ function rename ($oldname, $newname, $context = null) {} /** * Copies file * @link http://www.php.net/manual/en/function.copy.php * @param source string <p> * Path to the source file. * </p> * @param dest string <p> * The destination path. If dest is a URL, the * copy operation may fail if the wrapper does not support overwriting of * existing files. * </p> * <p> * If the destination file already exists, it will be overwritten. * </p> * @param context resource[optional] <p> * A valid context resource created with * stream_context_create. * </p> * @return bool Returns true on success or false on failure. */ function copy ($source, $dest, $context = null) {} /** * Create file with unique file name * @link http://www.php.net/manual/en/function.tempnam.php * @param dir string <p> * The directory where the temporary filename will be created. * </p> * @param prefix string <p> * The prefix of the generated temporary filename. * </p> * Windows uses only the first three characters of prefix. * @return string the new temporary filename, or false on * failure. */ function tempnam ($dir, $prefix) {} /** * Creates a temporary file * @link http://www.php.net/manual/en/function.tmpfile.php * @return resource a file handle, similar to the one returned by * fopen, for the new file&return.falseforfailure;. */ function tmpfile () {} /** * Reads entire file into an array * @link http://www.php.net/manual/en/function.file.php * @param filename string <p> * Path to the file. * </p> * &tip.fopen-wrapper; * @param flags int[optional] <p> * The optional parameter flags can be one, or * more, of the following constants: * FILE_USE_INCLUDE_PATH * Search for the file in the include_path. * @param context resource[optional] <p> * A context resource created with the * stream_context_create function. * </p> * <p> * &note.context-support; * </p> * @return array the file in an array. Each element of the array corresponds to a * line in the file, with the newline still attached. Upon failure, * file returns false. * </p> * <p> * Each line in the resulting array will include the line ending, unless * FILE_IGNORE_NEW_LINES is used, so you still need to * use rtrim if you do not want the line ending * present. */ function file ($filename, $flags = null, $context = null) {} /** * Reads entire file into a string * @link http://www.php.net/manual/en/function.file-get-contents.php * @param filename string <p> * Name of the file to read. * </p> * @param use_include_path bool[optional] <p> * As of PHP 5 the FILE_USE_INCLUDE_PATH can be used * to trigger include path * search. * </p> * @param context resource[optional] <p> * A valid context resource created with * stream_context_create. If you don't need to use a * custom context, you can skip this parameter by &null;. * </p> * @param offset int[optional] <p> * The offset where the reading starts on the original stream. * </p> * <p> * Seeking (offset) is not supported with remote files. * Attempting to seek on non-local files may work with small offsets, but this * is unpredictable because it works on the buffered stream. * </p> * @param maxlen int[optional] <p> * Maximum length of data read. The default is to read until end * of file is reached. Note that this parameter is applied to the * stream processed by the filters. * </p> * @return string The function returns the read data&return.falseforfailure;. */ function file_get_contents ($filename, $use_include_path = null, $context = null, $offset = null, $maxlen = null) {} /** * Write a string to a file * @link http://www.php.net/manual/en/function.file-put-contents.php * @param filename string <p> * Path to the file where to write the data. * </p> * @param data mixed <p> * The data to write. Can be either a string, an * array or a stream resource. * </p> * <p> * If data is a stream resource, the * remaining buffer of that stream will be copied to the specified file. * This is similar with using stream_copy_to_stream. * </p> * <p> * You can also specify the data parameter as a single * dimension array. This is equivalent to * file_put_contents($filename, implode('', $array)). * </p> * @param flags int[optional] <p> * The value of flags can be any combination of * the following flags, joined with the binary OR (|) * operator. * </p> * <p> * <table> * Available flags * <tr valign="top"> * <td>Flag</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td> * FILE_USE_INCLUDE_PATH * </td> * <td> * Search for filename in the include directory. * See include_path for more * information. * </td> * </tr> * <tr valign="top"> * <td> * FILE_APPEND * </td> * <td> * If file filename already exists, append * the data to the file instead of overwriting it. * </td> * </tr> * <tr valign="top"> * <td> * LOCK_EX * </td> * <td> * Acquire an exclusive lock on the file while proceeding to the * writing. * </td> * </tr> * </table> * </p> * @param context resource[optional] <p> * A valid context resource created with * stream_context_create. * </p> * @return int The function returns the number of bytes that were written to the file, or * false on failure. */ function file_put_contents ($filename, $data, $flags = null, $context = null) {} /** * Runs the equivalent of the select() system call on the given arrays of streams with a timeout specified by tv_sec and tv_usec * @link http://www.php.net/manual/en/function.stream-select.php * @param read array <p> * The streams listed in the read array will be watched to * see if characters become available for reading (more precisely, to see if * a read will not block - in particular, a stream resource is also ready on * end-of-file, in which case an fread will return * a zero length string). * </p> * @param write array <p> * The streams listed in the write array will be * watched to see if a write will not block. * </p> * @param except array <p> * The streams listed in the except array will be * watched for high priority exceptional ("out-of-band") data arriving. * </p> * <p> * When stream_select returns, the arrays * read, write and * except are modified to indicate which stream * resource(s) actually changed status. * </p> * You do not need to pass every array to * stream_select. You can leave it out and use an * empty array or &null; instead. Also do not forget that those arrays are * passed by reference and will be modified after * stream_select returns. * @param tv_sec int <p> * The tv_sec and tv_usec * together form the timeout parameter, * tv_sec specifies the number of seconds while * tv_usec the number of microseconds. * The timeout is an upper bound on the amount of time * that stream_select will wait before it returns. * If tv_sec and tv_usec are * both set to 0, stream_select will * not wait for data - instead it will return immediately, indicating the * current status of the streams. * </p> * <p> * If tv_sec is &null; stream_select * can block indefinitely, returning only when an event on one of the * watched streams occurs (or if a signal interrupts the system call). * </p> * <p> * Using a timeout value of 0 allows you to * instantaneously poll the status of the streams, however, it is NOT a * good idea to use a 0 timeout value in a loop as it * will cause your script to consume too much CPU time. * </p> * <p> * It is much better to specify a timeout value of a few seconds, although * if you need to be checking and running other code concurrently, using a * timeout value of at least 200000 microseconds will * help reduce the CPU usage of your script. * </p> * <p> * Remember that the timeout value is the maximum time that will elapse; * stream_select will return as soon as the * requested streams are ready for use. * </p> * @param tv_usec int[optional] <p> * See tv_sec description. * </p> * @return int On success stream_select returns the number of * stream resources contained in the modified arrays, which may be zero if * the timeout expires before anything interesting happens. On error false * is returned and a warning raised (this can happen if the system call is * interrupted by an incoming signal). */ function stream_select (array &$read, array &$write, array &$except, $tv_sec, $tv_usec = null) {} /** * Create a streams context * @link http://www.php.net/manual/en/function.stream-context-create.php * @param options array[optional] <p> * Must be an associative array of associative arrays in the format * $arr['wrapper']['option'] = $value. * </p> * <p> * Default to an empty array. * </p> * @param params array[optional] <p> * Must be an associative array in the format * $arr['parameter'] = $value. * Refer to context parameters for * a listing of standard stream parameters. * </p> * @return resource A stream context resource. */ function stream_context_create (array $options = null, array $params = null) {} /** * Set parameters for a stream/wrapper/context * @link http://www.php.net/manual/en/function.stream-context-set-params.php * @param stream_or_context resource <p> * The stream or context to apply the parameters too. * </p> * @param params array <p> * An array of parameters to set. * </p> * <p> * params should be an associative array of the structure: * $params['paramname'] = "paramvalue";. * </p> * @return bool Returns true on success or false on failure. */ function stream_context_set_params ($stream_or_context, array $params) {} /** * Retrieves parameters from a context * @link http://www.php.net/manual/en/function.stream-context-get-params.php * @param stream_or_context resource <p> * A stream resource or a * context resource * </p> * @return array an associate array containing all context options and parameters. */ function stream_context_get_params ($stream_or_context) {} /** * Sets an option for a stream/wrapper/context * @link http://www.php.net/manual/en/function.stream-context-set-option.php * @param stream_or_context resource <p> * The stream or context resource to apply the options too. * </p> * @param wrapper string * @param option string * @param value mixed * @return bool Returns true on success or false on failure. */ function stream_context_set_option ($stream_or_context, $wrapper, $option, $value) {} /** * Retrieve options for a stream/wrapper/context * @link http://www.php.net/manual/en/function.stream-context-get-options.php * @param stream_or_context resource <p> * The stream or context to get options from * </p> * @return array an associative array with the options. */ function stream_context_get_options ($stream_or_context) {} /** * Retrieve the default streams context * @link http://www.php.net/manual/en/function.stream-context-get-default.php * @param options array[optional] options must be an associative * array of associative arrays in the format * $arr['wrapper']['option'] = $value. * <p> * As of PHP 5.3.0, the stream_context_set_default function * can be used to set the default context. * </p> * @return resource A stream context resource. */ function stream_context_get_default (array $options = null) {} /** * Set the default streams context * @link http://www.php.net/manual/en/function.stream-context-set-default.php * @param options array <p> * The options to set for the default context. * </p> * <p> * options must be an associative * array of associative arrays in the format * $arr['wrapper']['option'] = $value. * </p> * @return resource the default stream context. */ function stream_context_set_default (array $options) {} /** * Attach a filter to a stream * @link http://www.php.net/manual/en/function.stream-filter-prepend.php * @param stream resource <p> * The target stream. * </p> * @param filtername string <p> * The filter name. * </p> * @param read_write int[optional] <p> * By default, stream_filter_prepend will * attach the filter to the read filter chain * if the file was opened for reading (i.e. File Mode: * r, and/or +). The filter * will also be attached to the write filter chain * if the file was opened for writing (i.e. File Mode: * w, a, and/or +). * STREAM_FILTER_READ, * STREAM_FILTER_WRITE, and/or * STREAM_FILTER_ALL can also be passed to the * read_write parameter to override this behavior. * See stream_filter_append for an example of * using this parameter. * </p> * @param params mixed[optional] <p> * This filter will be added with the specified params * to the beginning of the list and will therefore be * called first during stream operations. To add a filter to the end of the * list, use stream_filter_append. * </p> * @return resource a resource which can be used to refer to this filter * instance during a call to stream_filter_remove. */ function stream_filter_prepend ($stream, $filtername, $read_write = null, $params = null) {} /** * Attach a filter to a stream * @link http://www.php.net/manual/en/function.stream-filter-append.php * @param stream resource <p> * The target stream. * </p> * @param filtername string <p> * The filter name. * </p> * @param read_write int[optional] <p> * By default, stream_filter_append will * attach the filter to the read filter chain * if the file was opened for reading (i.e. File Mode: * r, and/or +). The filter * will also be attached to the write filter chain * if the file was opened for writing (i.e. File Mode: * w, a, and/or +). * STREAM_FILTER_READ, * STREAM_FILTER_WRITE, and/or * STREAM_FILTER_ALL can also be passed to the * read_write parameter to override this behavior. * </p> * @param params mixed[optional] <p> * This filter will be added with the specified * params to the end of * the list and will therefore be called last during stream operations. * To add a filter to the beginning of the list, use * stream_filter_prepend. * </p> * @return resource a resource which can be used to refer to this filter * instance during a call to stream_filter_remove. */ function stream_filter_append ($stream, $filtername, $read_write = null, $params = null) {} /** * Remove a filter from a stream * @link http://www.php.net/manual/en/function.stream-filter-remove.php * @param stream_filter resource <p> * The stream filter to be removed. * </p> * @return bool Returns true on success or false on failure. */ function stream_filter_remove ($stream_filter) {} /** * Open Internet or Unix domain socket connection * @link http://www.php.net/manual/en/function.stream-socket-client.php * @param remote_socket string <p> * Address to the socket to connect to. * </p> * @param errno int[optional] <p> * Will be set to the system level error number if connection fails. * </p> * @param errstr string[optional] <p> * Will be set to the system level error message if the connection fails. * </p> * @param timeout float[optional] <p> * Number of seconds until the connect() system call * should timeout. * This parameter only applies when not making asynchronous * connection attempts. * <p> * To set a timeout for reading/writing data over the socket, use the * stream_set_timeout, as the * timeout only applies while making connecting * the socket. * </p> * </p> * @param flags int[optional] <p> * Bitmask field which may be set to any combination of connection flags. * Currently the select of connection flags is limited to * STREAM_CLIENT_CONNECT (default), * STREAM_CLIENT_ASYNC_CONNECT and * STREAM_CLIENT_PERSISTENT. * </p> * @param context resource[optional] <p> * A valid context resource created with stream_context_create. * </p> * @return resource On success a stream resource is returned which may * be used together with the other file functions (such as * fgets, fgetss, * fwrite, fclose, and * feof), false on failure. */ function stream_socket_client ($remote_socket, &$errno = null, &$errstr = null, $timeout = null, $flags = null, $context = null) {} /** * Create an Internet or Unix domain server socket * @link http://www.php.net/manual/en/function.stream-socket-server.php * @param local_socket string <p> * The type of socket created is determined by the transport specified * using standard URL formatting: transport://target. * </p> * <p> * For Internet Domain sockets (AF_INET) such as TCP and UDP, the * target portion of the * remote_socket parameter should consist of a * hostname or IP address followed by a colon and a port number. For * Unix domain sockets, the target portion should * point to the socket file on the filesystem. * </p> * <p> * Depending on the environment, Unix domain sockets may not be available. * A list of available transports can be retrieved using * stream_get_transports. See * for a list of bulitin transports. * </p> * @param errno int[optional] <p> * If the optional errno and errstr * arguments are present they will be set to indicate the actual system * level error that occurred in the system-level socket(), * bind(), and listen() calls. If * the value returned in errno is * 0 and the function returned false, it is an * indication that the error occurred before the bind() * call. This is most likely due to a problem initializing the socket. * Note that the errno and * errstr arguments will always be passed by reference. * </p> * @param errstr string[optional] <p> * See errno description. * </p> * @param flags int[optional] <p> * A bitmask field which may be set to any combination of socket creation * flags. * </p> * <p> * For UDP sockets, you must use STREAM_SERVER_BIND as * the flags parameter. * </p> * @param context resource[optional] <p> * </p> * @return resource the created stream, or false on error. */ function stream_socket_server ($local_socket, &$errno = null, &$errstr = null, $flags = null, $context = null) {} /** * Accept a connection on a socket created by <function>stream_socket_server</function> * @link http://www.php.net/manual/en/function.stream-socket-accept.php * @param server_socket resource <p> * The server socket to accept a connection from. * </p> * @param timeout float[optional] <p> * Override the default socket accept timeout. Time should be given in * seconds. * </p> * @param peername string[optional] <p> * Will be set to the name (address) of the client which connected, if * included and available from the selected transport. * </p> * <p> * Can also be determined later using * stream_socket_get_name. * </p> * @return resource a stream to the accepted socket connection&return.falseforfailure;. */ function stream_socket_accept ($server_socket, $timeout = null, &$peername = null) {} /** * Retrieve the name of the local or remote sockets * @link http://www.php.net/manual/en/function.stream-socket-get-name.php * @param handle resource <p> * The socket to get the name of. * </p> * @param want_peer bool <p> * If set to true the remote socket name will be returned, if set * to false the local socket name will be returned. * </p> * @return string The name of the socket. */ function stream_socket_get_name ($handle, $want_peer) {} /** * Receives data from a socket, connected or not * @link http://www.php.net/manual/en/function.stream-socket-recvfrom.php * @param socket resource <p> * The remote socket. * </p> * @param length int <p> * The number of bytes to receive from the socket. * </p> * @param flags int[optional] <p> * The value of flags can be any combination * of the following: * <table> * Possible values for flags * <tr valign="top"> * <td>STREAM_OOB</td> * <td> * Process OOB (out-of-band) data. * </td> * </tr> * <tr valign="top"> * <td>STREAM_PEEK</td> * <td> * Retrieve data from the socket, but do not consume the buffer. * Subsequent calls to fread or * stream_socket_recvfrom will see * the same data. * </td> * </tr> * </table> * </p> * @param address string[optional] <p> * If address is provided it will be populated with * the address of the remote socket. * </p> * @return string the read data, as a string */ function stream_socket_recvfrom ($socket, $length, $flags = null, &$address = null) {} /** * Sends a message to a socket, whether it is connected or not * @link http://www.php.net/manual/en/function.stream-socket-sendto.php * @param socket resource <p> * The socket to send data to. * </p> * @param data string <p> * The data to be sent. * </p> * @param flags int[optional] <p> * The value of flags can be any combination * of the following: * <table> * possible values for flags * <tr valign="top"> * <td>STREAM_OOB</td> * <td> * Process OOB (out-of-band) data. * </td> * </tr> * </table> * </p> * @param address string[optional] <p> * The address specified when the socket stream was created will be used * unless an alternate address is specified in address. * </p> * <p> * If specified, it must be in dotted quad (or [ipv6]) format. * </p> * @return int a result code, as an integer. */ function stream_socket_sendto ($socket, $data, $flags = null, $address = null) {} /** * Turns encryption on/off on an already connected socket * @link http://www.php.net/manual/en/function.stream-socket-enable-crypto.php * @param stream resource <p> * The stream resource. * </p> * @param enable bool <p> * Enable/disable cryptography on the stream. * </p> * @param crypto_type int[optional] <p> * Setup encryption on the stream. * Valid methods are * STREAM_CRYPTO_METHOD_SSLv2_CLIENT * @param session_stream resource[optional] <p> * Seed the stream with settings from session_stream. * </p> * @return mixed true on success, false if negotiation has failed or * 0 if there isn't enough data and you should try again * (only for non-blocking sockets). */ function stream_socket_enable_crypto ($stream, $enable, $crypto_type = null, $session_stream = null) {} /** * Shutdown a full-duplex connection * @link http://www.php.net/manual/en/function.stream-socket-shutdown.php * @param stream resource <p> * An open stream (opened with stream_socket_client, * for example) * </p> * @param how int <p> * One of the following constants: STREAM_SHUT_RD * (disable further receptions), STREAM_SHUT_WR * (disable further transmissions) or * STREAM_SHUT_RDWR (disable further receptions and * transmissions). * </p> * @return bool Returns true on success or false on failure. */ function stream_socket_shutdown ($stream, $how) {} /** * Creates a pair of connected, indistinguishable socket streams * @link http://www.php.net/manual/en/function.stream-socket-pair.php * @param domain int <p> * The protocol family to be used: STREAM_PF_INET, * STREAM_PF_INET6 or * STREAM_PF_UNIX * </p> * @param type int <p> * The type of communication to be used: * STREAM_SOCK_DGRAM, * STREAM_SOCK_RAW, * STREAM_SOCK_RDM, * STREAM_SOCK_SEQPACKET or * STREAM_SOCK_STREAM * </p> * @param protocol int <p> * The protocol to be used: STREAM_IPPROTO_ICMP, * STREAM_IPPROTO_IP, * STREAM_IPPROTO_RAW, * STREAM_IPPROTO_TCP or * STREAM_IPPROTO_UDP * </p> * @return array an array with the two socket resources on success, or * false on failure. */ function stream_socket_pair ($domain, $type, $protocol) {} /** * Copies data from one stream to another * @link http://www.php.net/manual/en/function.stream-copy-to-stream.php * @param source resource <p> * The source stream * </p> * @param dest resource <p> * The destination stream * </p> * @param maxlength int[optional] <p> * Maximum bytes to copy * </p> * @param offset int[optional] <p> * The offset where to start to copy data * </p> * @return int the total count of bytes copied. */ function stream_copy_to_stream ($source, $dest, $maxlength = null, $offset = null) {} /** * Reads remainder of a stream into a string * @link http://www.php.net/manual/en/function.stream-get-contents.php * @param handle resource <p> * A stream resource (e.g. returned from fopen) * </p> * @param maxlength int[optional] <p> * The maximum bytes to read. Defaults to -1 (read all the remaining * buffer). * </p> * @param offset int[optional] <p> * Seek to the specified offset before reading. If this number is negative, * no seeking will occur and reading will start from the current position. * </p> * @return string a string&return.falseforfailure;. */ function stream_get_contents ($handle, $maxlength = null, $offset = null) {} /** * Tells whether the stream supports locking. * @link http://www.php.net/manual/en/function.stream-supports-lock.php * @param stream resource <p> * The stream to check. * </p> * @return bool Returns true on success or false on failure. */ function stream_supports_lock ($stream) {} /** * Gets line from file pointer and parse for CSV fields * @link http://www.php.net/manual/en/function.fgetcsv.php * @param handle resource <p> * A valid file pointer to a file successfully opened by * fopen, popen, or * fsockopen. * </p> * @param length int[optional] <p> * Must be greater than the longest line (in characters) to be found in * the CSV file (allowing for trailing line-end characters). It became * optional in PHP 5. Omitting this parameter (or setting it to 0 in PHP * 5.0.4 and later) the maximum line length is not limited, which is * slightly slower. * </p> * @param delimiter string[optional] <p> * Set the field delimiter (one character only). * </p> * @param enclosure string[optional] <p> * Set the field enclosure character (one character only). * </p> * @param escape string[optional] <p> * Set the escape character (one character only). Defaults as a backslash. * </p> * @return array an indexed array containing the fields read. * </p> * <p> * A blank line in a CSV file will be returned as an array * comprising a single null field, and will not be treated * as an error. * </p> * &note.line-endings; * <p> * fgetcsv returns &null; if an invalid * handle is supplied or false on other errors, * including end of file. */ function fgetcsv ($handle, $length = null, $delimiter = null, $enclosure = null, $escape = null) {} /** * Format line as CSV and write to file pointer * @link http://www.php.net/manual/en/function.fputcsv.php * @param handle resource &fs.validfp.all; * @param fields array <p> * An array of values. * </p> * @param delimiter string[optional] <p> * The optional delimiter parameter sets the field * delimiter (one character only). * </p> * @param enclosure string[optional] <p> * The optional enclosure parameter sets the field * enclosure (one character only). * </p> * @return int the length of the written string&return.falseforfailure;. */ function fputcsv ($handle, array $fields, $delimiter = null, $enclosure = null) {} /** * Portable advisory file locking * @link http://www.php.net/manual/en/function.flock.php * @param handle resource &fs.file.pointer; * @param operation int <p> * operation is one of the following: * LOCK_SH to acquire a shared lock (reader). * @param wouldblock int[optional] <p> * The optional third argument is set to true if the lock would block * (EWOULDBLOCK errno condition). (not supported on Windows) * </p> * @return bool Returns true on success or false on failure. */ function flock ($handle, $operation, &$wouldblock = null) {} /** * Extracts all meta tag content attributes from a file and returns an array * @link http://www.php.net/manual/en/function.get-meta-tags.php * @param filename string <p> * The path to the HTML file, as a string. This can be a local file or an * URL. * </p> * <p> * What get_meta_tags parses * ]]> * (pay attention to line endings - PHP uses a native function to * parse the input, so a Mac file won't work on Unix). * </p> * @param use_include_path bool[optional] <p> * Setting use_include_path to true will result * in PHP trying to open the file along the standard include path as per * the include_path directive. * This is used for local files, not URLs. * </p> * @return array an array with all the parsed meta tags. * </p> * <p> * The value of the name property becomes the key, the value of the content * property becomes the value of the returned array, so you can easily use * standard array functions to traverse it or access single values. * Special characters in the value of the name property are substituted with * '_', the rest is converted to lower case. If two meta tags have the same * name, only the last one is returned. */ function get_meta_tags ($filename, $use_include_path = null) {} /** * Set read file buffering on the given stream * @link http://www.php.net/manual/en/function.stream-set-read-buffer.php * @param stream resource <p> * The file pointer. * </p> * @param buffer int <p> * The number of bytes to buffer. If buffer * is 0 then read operations are unbuffered. This ensures that all reads * with fread are completed before other processes are * allowed to write to that output stream. * </p> * @return int 0 on success, or EOF if the request * cannot be honored. */ function stream_set_read_buffer ($stream, $buffer) {} /** * Sets write file buffering on the given stream * @link http://www.php.net/manual/en/function.stream-set-write-buffer.php * @param stream resource <p> * The file pointer. * </p> * @param buffer int <p> * The number of bytes to buffer. If buffer * is 0 then write operations are unbuffered. This ensures that all writes * with fwrite are completed before other processes are * allowed to write to that output stream. * </p> * @return int 0 on success, or EOF if the request cannot be honored. */ function stream_set_write_buffer ($stream, $buffer) {} /** * &Alias; <function>stream_set_write_buffer</function> * @link http://www.php.net/manual/en/function.set-file-buffer.php * @param fp * @param buffer */ function set_file_buffer ($fp, $buffer) {} /** * @param fp * @param chunk_size */ function stream_set_chunk_size ($fp, $chunk_size) {} /** * &Alias; <function>stream_set_blocking</function> * @link http://www.php.net/manual/en/function.set-socket-blocking.php * @param socket * @param mode */ function set_socket_blocking ($socket, $mode) {} /** * Set blocking/non-blocking mode on a stream * @link http://www.php.net/manual/en/function.stream-set-blocking.php * @param stream resource <p> * The stream. * </p> * @param mode int <p> * If mode is 0, the given stream * will be switched to non-blocking mode, and if 1, it * will be switched to blocking mode. This affects calls like * fgets and fread * that read from the stream. In non-blocking mode an * fgets call will always return right away * while in blocking mode it will wait for data to become available * on the stream. * </p> * @return bool Returns true on success or false on failure. */ function stream_set_blocking ($stream, $mode) {} /** * &Alias; <function>stream_set_blocking</function> * @link http://www.php.net/manual/en/function.socket-set-blocking.php * @param socket * @param mode */ function socket_set_blocking ($socket, $mode) {} /** * Retrieves header/meta data from streams/file pointers * @link http://www.php.net/manual/en/function.stream-get-meta-data.php * @param stream resource <p> * The stream can be any stream created by fopen, * fsockopen and pfsockopen. * </p> * @return array The result array contains the following items: * </p> * <p> * timed_out (bool) - true if the stream * timed out while waiting for data on the last call to * fread or fgets. * </p> * <p> * blocked (bool) - true if the stream is * in blocking IO mode. See stream_set_blocking. * </p> * <p> * eof (bool) - true if the stream has reached * end-of-file. Note that for socket streams this member can be true * even when unread_bytes is non-zero. To * determine if there is more data to be read, use * feof instead of reading this item. * </p> * <p> * unread_bytes (int) - the number of bytes * currently contained in the PHP's own internal buffer. * </p> * You shouldn't use this value in a script. * <p> * stream_type (string) - a label describing * the underlying implementation of the stream. * </p> * <p> * wrapper_type (string) - a label describing * the protocol wrapper implementation layered over the stream. * See for more information about wrappers. * </p> * <p> * wrapper_data (mixed) - wrapper specific * data attached to this stream. See for * more information about wrappers and their wrapper data. * </p> * <p> * filters (array) - and array containing * the names of any filters that have been stacked onto this stream. * Documentation on filters can be found in the * Filters appendix. * </p> * <p> * mode (string) - the type of access required for * this stream (see Table 1 of the fopen() reference) * </p> * <p> * seekable (bool) - whether the current stream can * be seeked. * </p> * <p> * uri (string) - the URI/filename associated with this * stream. */ function stream_get_meta_data ($stream) {} /** * Gets line from stream resource up to a given delimiter * @link http://www.php.net/manual/en/function.stream-get-line.php * @param handle resource <p> * A valid file handle. * </p> * @param length int <p> * The number of bytes to read from the handle. * </p> * @param ending string[optional] <p> * An optional string delimiter. * </p> * @return string a string of up to length bytes read from the file * pointed to by handle. * </p> * <p> * If an error occurs, returns false. */ function stream_get_line ($handle, $length, $ending = null) {} /** * Register a URL wrapper implemented as a PHP class * @link http://www.php.net/manual/en/function.stream-wrapper-register.php * @param protocol string <p> * The wrapper name to be registered. * </p> * @param classname string <p> * The classname which implements the protocol. * </p> * @param flags int[optional] <p> * Should be set to STREAM_IS_URL if * protocol is a URL protocol. Default is 0, local * stream. * </p> * @return bool Returns true on success or false on failure. * </p> * <p> * stream_wrapper_register will return false if the * protocol already has a handler. */ function stream_wrapper_register ($protocol, $classname, $flags = null) {} /** * &Alias; <function>stream_wrapper_register</function> * @link http://www.php.net/manual/en/function.stream-register-wrapper.php * @param protocol * @param classname * @param flags[optional] */ function stream_register_wrapper ($protocol, $classname, $flags) {} /** * Unregister a URL wrapper * @link http://www.php.net/manual/en/function.stream-wrapper-unregister.php * @param protocol string <p> * </p> * @return bool Returns true on success or false on failure. */ function stream_wrapper_unregister ($protocol) {} /** * Restores a previously unregistered built-in wrapper * @link http://www.php.net/manual/en/function.stream-wrapper-restore.php * @param protocol string <p> * </p> * @return bool Returns true on success or false on failure. */ function stream_wrapper_restore ($protocol) {} /** * Retrieve list of registered streams * @link http://www.php.net/manual/en/function.stream-get-wrappers.php * @return array an indexed array containing the name of all stream wrappers * available on the running system. */ function stream_get_wrappers () {} /** * Retrieve list of registered socket transports * @link http://www.php.net/manual/en/function.stream-get-transports.php * @return array an indexed array of socket transports names. */ function stream_get_transports () {} /** * Resolve filename against the include path * @link http://www.php.net/manual/en/function.stream-resolve-include-path.php * @param filename string <p> * The filename to resolve. * </p> * @param context resource[optional] <p> * A valid context resource created with stream_context_create. * </p> * @return string a string containing the resolved absolute filename, &return.falseforfailure;. */ function stream_resolve_include_path ($filename, $context = null) {} /** * Checks if a stream is a local stream * @link http://www.php.net/manual/en/function.stream-is-local.php * @param stream_or_url mixed <p> * The stream resource or URL to check. * </p> * @return bool Returns true on success or false on failure. */ function stream_is_local ($stream_or_url) {} /** * Fetches all the headers sent by the server in response to a HTTP request * @link http://www.php.net/manual/en/function.get-headers.php * @param url string <p> * The target URL. * </p> * @param format int[optional] <p> * If the optional format parameter is set to non-zero, * get_headers parses the response and sets the * array's keys. * </p> * @return array an indexed or associative array with the headers, or false on * failure. */ function get_headers ($url, $format = null) {} /** * Set timeout period on a stream * @link http://www.php.net/manual/en/function.stream-set-timeout.php * @param stream resource <p> * The target stream. * </p> * @param seconds int <p> * The seconds part of the timeout to be set. * </p> * @param microseconds int[optional] <p> * The microseconds part of the timeout to be set. * </p> * @return bool Returns true on success or false on failure. */ function stream_set_timeout ($stream, $seconds, $microseconds = null) {} /** * &Alias; <function>stream_set_timeout</function> * @link http://www.php.net/manual/en/function.socket-set-timeout.php * @param stream * @param seconds * @param microseconds */ function socket_set_timeout ($stream, $seconds, $microseconds) {} /** * &Alias; <function>stream_get_meta_data</function> * @link http://www.php.net/manual/en/function.socket-get-status.php * @param fp */ function socket_get_status ($fp) {} /** * Returns canonicalized absolute pathname * @link http://www.php.net/manual/en/function.realpath.php * @param path string <p> * The path being checked. * <p> * Whilst a path must be supplied, the value can be blank or &null; * In these cases, the value is interpreted as the current directory. * </p> * </p> * @return string the canonicalized absolute pathname on success. The resulting path * will have no symbolic link, '/./' or '/../' components. * </p> * <p> * realpath returns false on failure, e.g. if * the file does not exist. * </p> * <p> * The running script must have executable permissions on all directories in * the hierarchy, otherwise realpath will return * false. */ function realpath ($path) {} /** * Match filename against a pattern * @link http://www.php.net/manual/en/function.fnmatch.php * @param pattern string <p> * The shell wildcard pattern. * </p> * @param string string <p> * The tested string. This function is especially useful for filenames, * but may also be used on regular strings. * </p> * <p> * The average user may be used to shell patterns or at least in their * simplest form to '?' and '*' * wildcards so using fnmatch instead of * preg_match for * frontend search expression input may be way more convenient for * non-programming users. * </p> * @param flags int[optional] <p> * The value of flags can be any combination of * the following flags, joined with the * binary OR (|) operator. * <table> * A list of possible flags for fnmatch * <tr valign="top"> * <td>Flag</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>FNM_NOESCAPE</td> * <td> * Disable backslash escaping. * </td> * </tr> * <tr valign="top"> * <td>FNM_PATHNAME</td> * <td> * Slash in string only matches slash in the given pattern. * </td> * </tr> * <tr valign="top"> * <td>FNM_PERIOD</td> * <td> * Leading period in string must be exactly matched by period in the given pattern. * </td> * </tr> * <tr valign="top"> * <td>FNM_CASEFOLD</td> * <td> * Caseless match. Part of the GNU extension. * </td> * </tr> * </table> * </p> * @return bool true if there is a match, false otherwise. */ function fnmatch ($pattern, $string, $flags = null) {} /** * Open Internet or Unix domain socket connection * @link http://www.php.net/manual/en/function.fsockopen.php * @param hostname string <p> * If OpenSSL support is * installed, you may prefix the hostname * with either ssl:// or tls:// to * use an SSL or TLS client connection over TCP/IP to connect to the * remote host. * </p> * @param port int[optional] <p> * The port number. * </p> * @param errno int[optional] <p> * If provided, holds the system level error number that occurred in the * system-level connect() call. * </p> * <p> * If the value returned in errno is * 0 and the function returned false, it is an * indication that the error occurred before the * connect() call. This is most likely due to a * problem initializing the socket. * </p> * @param errstr string[optional] <p> * The error message as a string. * </p> * @param timeout float[optional] <p> * The connection timeout, in seconds. * </p> * <p> * If you need to set a timeout for reading/writing data over the * socket, use stream_set_timeout, as the * timeout parameter to * fsockopen only applies while connecting the * socket. * </p> * @return resource fsockopen returns a file pointer which may be used * together with the other file functions (such as * fgets, fgetss, * fwrite, fclose, and * feof). If the call fails, it will return false */ function fsockopen ($hostname, $port = null, &$errno = null, &$errstr = null, $timeout = null) {} /** * Open persistent Internet or Unix domain socket connection * @link http://www.php.net/manual/en/function.pfsockopen.php * @param hostname string * @param port int[optional] * @param errno int[optional] * @param errstr string[optional] * @param timeout float[optional] * @return resource */ function pfsockopen ($hostname, $port = null, &$errno = null, &$errstr = null, $timeout = null) {} /** * Pack data into binary string * @link http://www.php.net/manual/en/function.pack.php * @param format string <p> * The format string consists of format codes * followed by an optional repeater argument. The repeater argument can * be either an integer value or * for repeating to * the end of the input data. For a, A, h, H the repeat count specifies * how many characters of one data argument are taken, for @ it is the * absolute position where to put the next data, for everything else the * repeat count specifies how many data arguments are consumed and packed * into the resulting binary string. * </p> * <p> * Currently implemented formats are: * <table> * pack format characters * <tr valign="top"> * <td>Code</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>a</td> * <td>NUL-padded string</td> * </tr> * <tr valign="top"> * <td>A</td> * <td>SPACE-padded string</td></tr> * <tr valign="top"> * <td>h</td> * <td>Hex string, low nibble first</td></tr> * <tr valign="top"> * <td>H</td> * <td>Hex string, high nibble first</td></tr> * <tr valign="top"><td>c</td><td>signed char</td></tr> * <tr valign="top"> * <td>C</td> * <td>unsigned char</td></tr> * <tr valign="top"> * <td>s</td> * <td>signed short (always 16 bit, machine byte order)</td> * </tr> * <tr valign="top"> * <td>S</td> * <td>unsigned short (always 16 bit, machine byte order)</td> * </tr> * <tr valign="top"> * <td>n</td> * <td>unsigned short (always 16 bit, big endian byte order)</td> * </tr> * <tr valign="top"> * <td>v</td> * <td>unsigned short (always 16 bit, little endian byte order)</td> * </tr> * <tr valign="top"> * <td>i</td> * <td>signed integer (machine dependent size and byte order)</td> * </tr> * <tr valign="top"> * <td>I</td> * <td>unsigned integer (machine dependent size and byte order)</td> * </tr> * <tr valign="top"> * <td>l</td> * <td>signed long (always 32 bit, machine byte order)</td> * </tr> * <tr valign="top"> * <td>L</td> * <td>unsigned long (always 32 bit, machine byte order)</td> * </tr> * <tr valign="top"> * <td>N</td> * <td>unsigned long (always 32 bit, big endian byte order)</td> * </tr> * <tr valign="top"> * <td>V</td> * <td>unsigned long (always 32 bit, little endian byte order)</td> * </tr> * <tr valign="top"> * <td>f</td> * <td>float (machine dependent size and representation)</td> * </tr> * <tr valign="top"> * <td>d</td> * <td>double (machine dependent size and representation)</td> * </tr> * <tr valign="top"> * <td>x</td> * <td>NUL byte</td> * </tr> * <tr valign="top"> * <td>X</td> * <td>Back up one byte</td> * </tr> * <tr valign="top"> * <td>@</td> * <td>NUL-fill to absolute position</td> * </tr> * </table> * </p> * @param args mixed[optional] <p> * </p> * @param _ mixed[optional] * @return string a binary string containing data. */ function pack ($format, $args = null, $_ = null) {} /** * Unpack data from binary string * @link http://www.php.net/manual/en/function.unpack.php * @param format string <p> * See pack for an explanation of the format codes. * </p> * @param data string <p> * The packed data. * </p> * @return array an associative array containing unpacked elements of binary * string. */ function unpack ($format, $data) {} /** * Tells what the user's browser is capable of * @link http://www.php.net/manual/en/function.get-browser.php * @param user_agent string[optional] <p> * The User Agent to be analyzed. By default, the value of HTTP * User-Agent header is used; however, you can alter this (i.e., look up * another browser's info) by passing this parameter. * </p> * <p> * You can bypass this parameter with a &null; value. * </p> * @param return_array bool[optional] <p> * If set to true, this function will return an array * instead of an object. * </p> * @return mixed The information is returned in an object or an array which will contain * various data elements representing, for instance, the browser's major and * minor version numbers and ID string; true/false values for features * such as frames, JavaScript, and cookies; and so forth. * </p> * <p> * The cookies value simply means that the browser * itself is capable of accepting cookies and does not mean the user has * enabled the browser to accept cookies or not. The only way to test if * cookies are accepted is to set one with setcookie, * reload, and check for the value. */ function get_browser ($user_agent = null, $return_array = null) {} /** * One-way string hashing * @link http://www.php.net/manual/en/function.crypt.php * @param str string <p> * The string to be hashed. * </p> * @param salt string[optional] <p> * An optional salt string to base the hashing on. If not provided, the * behaviour is defined by the algorithm implementation and can lead to * unexpected results. * </p> * @return string the hashed string or a string that is shorter than 13 characters * and is guaranteed to differ from the salt on failure. */ function crypt ($str, $salt = null) {} /** * Open directory handle * @link http://www.php.net/manual/en/function.opendir.php * @param path string <p> * The directory path that is to be opened * </p> * @param context resource[optional] <p> * For a description of the context parameter, * refer to the streams section of * the manual. * </p> * @return resource a directory handle resource on success, or * false on failure. * </p> * <p> * If path is not a valid directory or the * directory can not be opened due to permission restrictions or * filesystem errors, opendir returns false and * generates a PHP error of level * E_WARNING. You can suppress the error output of * opendir by prepending * '@' to the * front of the function name. */ function opendir ($path, $context = null) {} /** * Close directory handle * @link http://www.php.net/manual/en/function.closedir.php * @param dir_handle resource[optional] <p> * The directory handle resource previously opened * with opendir. If the directory handle is * not specified, the last link opened by opendir * is assumed. * </p> * @return void */ function closedir ($dir_handle = null) {} /** * Change directory * @link http://www.php.net/manual/en/function.chdir.php * @param directory string <p> * The new current directory * </p> * @return bool Returns true on success or false on failure. */ function chdir ($directory) {} /** * Change the root directory * @link http://www.php.net/manual/en/function.chroot.php * @param directory string <p> * The path to change the root directory to. * </p> * @return bool Returns true on success or false on failure. */ function chroot ($directory) {} /** * Gets the current working directory * @link http://www.php.net/manual/en/function.getcwd.php * @return string the current working directory on success, or false on * failure. * </p> * <p> * On some Unix variants, getcwd will return * false if any one of the parent directories does not have the * readable or search mode set, even if the current directory * does. See chmod for more information on * modes and permissions. */ function getcwd () {} /** * Rewind directory handle * @link http://www.php.net/manual/en/function.rewinddir.php * @param dir_handle resource[optional] <p> * The directory handle resource previously opened * with opendir. If the directory handle is * not specified, the last link opened by opendir * is assumed. * </p> * @return void */ function rewinddir ($dir_handle = null) {} /** * Read entry from directory handle * @link http://www.php.net/manual/en/function.readdir.php * @param dir_handle resource[optional] <p> * The directory handle resource previously opened * with opendir. If the directory handle is * not specified, the last link opened by opendir * is assumed. * </p> * @return string the entry name on success&return.falseforfailure;. */ function readdir ($dir_handle = null) {} /** * Return an instance of the Directory class * @link http://www.php.net/manual/en/function.dir.php * @param directory string <p> * Directory to open * </p> * @param context resource[optional] <p> * &note.context-support; * </p> * @return Directory an instance of Directory, or &null; with * wrong parameters, or false in case of another error. */ function dir ($directory, $context = null) {} /** * List files and directories inside the specified path * @link http://www.php.net/manual/en/function.scandir.php * @param directory string <p> * The directory that will be scanned. * </p> * @param sorting_order int[optional] <p> * By default, the sorted order is alphabetical in ascending order. If * the optional sorting_order is set to * SCANDIR_SORT_DESCENDING, then the sort order is * alphabetical in descending order. If it is set to * SCANDIR_SORT_NONE then the result is unsorted. * </p> * @param context resource[optional] <p> * For a description of the context parameter, * refer to the streams section of * the manual. * </p> * @return array an array of filenames on success, or false on * failure. If directory is not a directory, then * boolean false is returned, and an error of level * E_WARNING is generated. */ function scandir ($directory, $sorting_order = null, $context = null) {} /** * Find pathnames matching a pattern * @link http://www.php.net/manual/en/function.glob.php * @param pattern string <p> * The pattern. No tilde expansion or parameter substitution is done. * </p> * @param flags int[optional] <p> * Valid flags: * GLOB_MARK - Adds a slash to each directory returned * @return array an array containing the matched files/directories, an empty array * if no file matched or false on error. * </p> * <p> * On some systems it is impossible to distinguish between empty match and an * error. */ function glob ($pattern, $flags = null) {} /** * Gets last access time of file * @link http://www.php.net/manual/en/function.fileatime.php * @param filename string <p> * Path to the file. * </p> * @return int the time the file was last accessed, &return.falseforfailure;. * The time is returned as a Unix timestamp. */ function fileatime ($filename) {} /** * Gets inode change time of file * @link http://www.php.net/manual/en/function.filectime.php * @param filename string <p> * Path to the file. * </p> * @return int the time the file was last changed, &return.falseforfailure;. * The time is returned as a Unix timestamp. */ function filectime ($filename) {} /** * Gets file group * @link http://www.php.net/manual/en/function.filegroup.php * @param filename string <p> * Path to the file. * </p> * @return int the group ID of the file, or false if * an error occurs. The group ID is returned in numerical format, use * posix_getgrgid to resolve it to a group name. * Upon failure, false is returned. */ function filegroup ($filename) {} /** * Gets file inode * @link http://www.php.net/manual/en/function.fileinode.php * @param filename string <p> * Path to the file. * </p> * @return int the inode number of the file, &return.falseforfailure;. */ function fileinode ($filename) {} /** * Gets file modification time * @link http://www.php.net/manual/en/function.filemtime.php * @param filename string <p> * Path to the file. * </p> * @return int the time the file was last modified, &return.falseforfailure;. * The time is returned as a Unix timestamp, which is * suitable for the date function. */ function filemtime ($filename) {} /** * Gets file owner * @link http://www.php.net/manual/en/function.fileowner.php * @param filename string <p> * Path to the file. * </p> * @return int the user ID of the owner of the file, &return.falseforfailure;. * The user ID is returned in numerical format, use * posix_getpwuid to resolve it to a username. */ function fileowner ($filename) {} /** * Gets file permissions * @link http://www.php.net/manual/en/function.fileperms.php * @param filename string <p> * Path to the file. * </p> * @return int the file's permissions as a numeric mode. Lower bits of this mode * are the same as the permissions expected by chmod, * however on most platforms the return value will also include information on * the type of file given as filename. The examples * below demonstrate how to test the return value for specific permissions and * file types on POSIX systems, including Linux and Mac OS X. * </p> * <p> * For local files, the specific return value is that of the * st_mode member of the structure returned by the C * library's stat function. Exactly which bits are set * can vary from platform to platform, and looking up your specific platform's * documentation is recommended if parsing the non-permission bits of the * return value is required. */ function fileperms ($filename) {} /** * Gets file size * @link http://www.php.net/manual/en/function.filesize.php * @param filename string <p> * Path to the file. * </p> * @return int the size of the file in bytes, or false (and generates an error * of level E_WARNING) in case of an error. */ function filesize ($filename) {} /** * Gets file type * @link http://www.php.net/manual/en/function.filetype.php * @param filename string <p> * Path to the file. * </p> * @return string the type of the file. Possible values are fifo, char, * dir, block, link, file, socket and unknown. * </p> * <p> * Returns false if an error occurs. filetype will also * produce an E_NOTICE message if the stat call fails * or if the file type is unknown. */ function filetype ($filename) {} /** * Checks whether a file or directory exists * @link http://www.php.net/manual/en/function.file-exists.php * @param filename string <p> * Path to the file or directory. * </p> * <p> * On windows, use //computername/share/filename or * \\computername\share\filename to check files on * network shares. * </p> * @return bool true if the file or directory specified by * filename exists; false otherwise. * </p> * <p> * This function will return false for symlinks pointing to non-existing * files. * </p> * <p> * This function returns false for files inaccessible due to safe mode restrictions. However these * files still can be included if * they are located in safe_mode_include_dir. * </p> * <p> * The check is done using the real UID/GID instead of the effective one. */ function file_exists ($filename) {} /** * Tells whether the filename is writable * @link http://www.php.net/manual/en/function.is-writable.php * @param filename string <p> * The filename being checked. * </p> * @return bool true if the filename exists and is * writable. */ function is_writable ($filename) {} /** * &Alias; <function>is_writable</function> * @link http://www.php.net/manual/en/function.is-writeable.php * @param filename */ function is_writeable ($filename) {} /** * Tells whether a file exists and is readable * @link http://www.php.net/manual/en/function.is-readable.php * @param filename string <p> * Path to the file. * </p> * @return bool true if the file or directory specified by * filename exists and is readable, false otherwise. */ function is_readable ($filename) {} /** * Tells whether the filename is executable * @link http://www.php.net/manual/en/function.is-executable.php * @param filename string <p> * Path to the file. * </p> * @return bool true if the filename exists and is executable, or false on * error. */ function is_executable ($filename) {} /** * Tells whether the filename is a regular file * @link http://www.php.net/manual/en/function.is-file.php * @param filename string <p> * Path to the file. * </p> * @return bool true if the filename exists and is a regular file, false * otherwise. */ function is_file ($filename) {} /** * Tells whether the filename is a directory * @link http://www.php.net/manual/en/function.is-dir.php * @param filename string <p> * Path to the file. If filename is a relative * filename, it will be checked relative to the current working * directory. If filename is a symbolic or hard link * then the link will be resolved and checked. If you have enabled &safemode;, * or open_basedir further * restrictions may apply. * </p> * @return bool true if the filename exists and is a directory, false * otherwise. */ function is_dir ($filename) {} /** * Tells whether the filename is a symbolic link * @link http://www.php.net/manual/en/function.is-link.php * @param filename string <p> * Path to the file. * </p> * @return bool true if the filename exists and is a symbolic link, false * otherwise. */ function is_link ($filename) {} /** * Gives information about a file * @link http://www.php.net/manual/en/function.stat.php * @param filename string <p> * Path to the file. * </p> * @return array <table> * stat and fstat result * format * <tr valign="top"> * <td>Numeric</td> * <td>Associative (since PHP 4.0.6)</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>0</td> * <td>dev</td> * <td>device number</td> * </tr> * <tr valign="top"> * <td>1</td> * <td>ino</td> * <td>inode number *</td> * </tr> * <tr valign="top"> * <td>2</td> * <td>mode</td> * <td>inode protection mode</td> * </tr> * <tr valign="top"> * <td>3</td> * <td>nlink</td> * <td>number of links</td> * </tr> * <tr valign="top"> * <td>4</td> * <td>uid</td> * <td>userid of owner *</td> * </tr> * <tr valign="top"> * <td>5</td> * <td>gid</td> * <td>groupid of owner *</td> * </tr> * <tr valign="top"> * <td>6</td> * <td>rdev</td> * <td>device type, if inode device</td> * </tr> * <tr valign="top"> * <td>7</td> * <td>size</td> * <td>size in bytes</td> * </tr> * <tr valign="top"> * <td>8</td> * <td>atime</td> * <td>time of last access (Unix timestamp)</td> * </tr> * <tr valign="top"> * <td>9</td> * <td>mtime</td> * <td>time of last modification (Unix timestamp)</td> * </tr> * <tr valign="top"> * <td>10</td> * <td>ctime</td> * <td>time of last inode change (Unix timestamp)</td> * </tr> * <tr valign="top"> * <td>11</td> * <td>blksize</td> * <td>blocksize of filesystem IO **</td> * </tr> * <tr valign="top"> * <td>12</td> * <td>blocks</td> * <td>number of 512-byte blocks allocated **</td> * </tr> * </table> * * On Windows this will always be 0. * </p> * <p> * ** Only valid on systems supporting the st_blksize type - other * systems (e.g. Windows) return -1. * </p> * <p> * In case of error, stat returns false. */ function stat ($filename) {} /** * Gives information about a file or symbolic link * @link http://www.php.net/manual/en/function.lstat.php * @param filename string <p> * Path to a file or a symbolic link. * </p> * @return array See the manual page for stat for information on * the structure of the array that lstat returns. * This function is identical to the stat function * except that if the filename parameter is a symbolic * link, the status of the symbolic link is returned, not the status of the * file pointed to by the symbolic link. */ function lstat ($filename) {} /** * Changes file owner * @link http://www.php.net/manual/en/function.chown.php * @param filename string <p> * Path to the file. * </p> * @param user mixed <p> * A user name or number. * </p> * @return bool Returns true on success or false on failure. */ function chown ($filename, $user) {} /** * Changes file group * @link http://www.php.net/manual/en/function.chgrp.php * @param filename string <p> * Path to the file. * </p> * @param group mixed <p> * A group name or number. * </p> * @return bool Returns true on success or false on failure. */ function chgrp ($filename, $group) {} /** * Changes user ownership of symlink * @link http://www.php.net/manual/en/function.lchown.php * @param filename string <p> * Path to the file. * </p> * @param user mixed <p> * User name or number. * </p> * @return bool Returns true on success or false on failure. */ function lchown ($filename, $user) {} /** * Changes group ownership of symlink * @link http://www.php.net/manual/en/function.lchgrp.php * @param filename string <p> * Path to the symlink. * </p> * @param group mixed <p> * The group specified by name or number. * </p> * @return bool Returns true on success or false on failure. */ function lchgrp ($filename, $group) {} /** * Changes file mode * @link http://www.php.net/manual/en/function.chmod.php * @param filename string <p> * Path to the file. * </p> * @param mode int <p> * Note that mode is not automatically * assumed to be an octal value, so strings (such as "g+w") will * not work properly. To ensure the expected operation, * you need to prefix mode with a zero (0): * </p> * <p> * ]]> * </p> * <p> * The mode parameter consists of three octal * number components specifying access restrictions for the owner, * the user group in which the owner is in, and to everybody else in * this order. One component can be computed by adding up the needed * permissions for that target user base. Number 1 means that you * grant execute rights, number 2 means that you make the file * writeable, number 4 means that you make the file readable. Add * up these numbers to specify needed rights. You can also read more * about modes on Unix systems with 'man 1 chmod' * and 'man 2 chmod'. * </p> * <p> * @return bool Returns true on success or false on failure. */ function chmod ($filename, $mode) {} /** * Sets access and modification time of file * @link http://www.php.net/manual/en/function.touch.php * @param filename string <p> * The name of the file being touched. * </p> * @param time int[optional] <p> * The touch time. If time is not supplied, * the current system time is used. * </p> * @param atime int[optional] <p> * If present, the access time of the given filename is set to * the value of atime. Otherwise, it is set to * the value passed to the time parameter. * If neither are present, the current system time is used. * </p> * @return bool Returns true on success or false on failure. */ function touch ($filename, $time = null, $atime = null) {} /** * Clears file status cache * @link http://www.php.net/manual/en/function.clearstatcache.php * @param clear_realpath_cache bool[optional] <p> * Whether to clear the realpath cache or not. * </p> * @param filename string[optional] <p> * Clear the realpath cache for a specific filename; only used if * clear_realpath_cache is true. * </p> * @return void */ function clearstatcache ($clear_realpath_cache = null, $filename = null) {} /** * Returns the total size of a filesystem or disk partition * @link http://www.php.net/manual/en/function.disk-total-space.php * @param directory string <p> * A directory of the filesystem or disk partition. * </p> * @return float the total number of bytes as a float * &return.falseforfailure;. */ function disk_total_space ($directory) {} /** * Returns available space on filesystem or disk partition * @link http://www.php.net/manual/en/function.disk-free-space.php * @param directory string <p> * A directory of the filesystem or disk partition. * </p> * <p> * Given a file name instead of a directory, the behaviour of the * function is unspecified and may differ between operating systems and * PHP versions. * </p> * @return float the number of available bytes as a float * &return.falseforfailure;. */ function disk_free_space ($directory) {} /** * &Alias; <function>disk_free_space</function> * @link http://www.php.net/manual/en/function.diskfreespace.php * @param path */ function diskfreespace ($path) {} /** * Get realpath cache size * @link http://www.php.net/manual/en/function.realpath-cache-size.php * @return int how much memory realpath cache is using. */ function realpath_cache_size () {} /** * Get realpath cache entries * @link http://www.php.net/manual/en/function.realpath-cache-get.php * @return array an array of realpath cache entries. The keys are original path * entries, and the values are arrays of data items, containing the resolved * path, expiration date, and other options kept in the cache. */ function realpath_cache_get () {} /** * Send mail * @link http://www.php.net/manual/en/function.mail.php * @param to string <p> * Receiver, or receivers of the mail. * </p> * <p> * The formatting of this string must comply with * RFC 2822. Some examples are: * [email protected] * [email protected], [email protected] * User &lt;[email protected]&gt; * User &lt;[email protected]&gt;, Another User &lt;[email protected]&gt; * </p> * @param subject string <p> * Subject of the email to be sent. * </p> * <p> * Subject must satisfy RFC 2047. * </p> * @param message string <p> * Message to be sent. * </p> * <p> * Each line should be separated with a LF (\n). Lines should not be larger * than 70 characters. * </p> * <p> * (Windows only) When PHP is talking to a SMTP server directly, if a full * stop is found on the start of a line, it is removed. To counter-act this, * replace these occurrences with a double dot. * ]]> * </p> * @param additional_headers string[optional] <p> * String to be inserted at the end of the email header. * </p> * <p> * This is typically used to add extra headers (From, Cc, and Bcc). * Multiple extra headers should be separated with a CRLF (\r\n). * </p> * <p> * When sending mail, the mail must contain * a From header. This can be set with the * additional_headers parameter, or a default * can be set in &php.ini;. * </p> * <p> * Failing to do this will result in an error * message similar to Warning: mail(): "sendmail_from" not * set in php.ini or custom "From:" header missing. * The From header sets also * Return-Path under Windows. * </p> * <p> * If messages are not received, try using a LF (\n) only. * Some poor quality Unix mail transfer agents replace LF by CRLF * automatically (which leads to doubling CR if CRLF is used). * This should be a last resort, as it does not comply with * RFC 2822. * </p> * @param additional_parameters string[optional] <p> * The additional_parameters parameter * can be used to pass additional flags as command line options to the * program configured to be used when sending mail, as defined by the * sendmail_path configuration setting. For example, * this can be used to set the envelope sender address when using * sendmail with the -f sendmail option. * </p> * <p> * The user that the webserver runs as should be added as a trusted user to the * sendmail configuration to prevent a 'X-Warning' header from being added * to the message when the envelope sender (-f) is set using this method. * For sendmail users, this file is /etc/mail/trusted-users. * </p> * @return bool true if the mail was successfully accepted for delivery, false otherwise. * </p> * <p> * It is important to note that just because the mail was accepted for delivery, * it does NOT mean the mail will actually reach the intended destination. */ function mail ($to, $subject, $message, $additional_headers = null, $additional_parameters = null) {} /** * Calculate the hash value needed by EZMLM * @link http://www.php.net/manual/en/function.ezmlm-hash.php * @param addr string <p> * The email address that's being hashed. * </p> * @return int The hash value of addr. */ function ezmlm_hash ($addr) {} /** * Open connection to system logger * @link http://www.php.net/manual/en/function.openlog.php * @param ident string <p> * The string ident is added to each message. * </p> * @param option int <p> * The option argument is used to indicate * what logging options will be used when generating a log message. * <table> * openlog Options * <tr valign="top"> * <td>Constant</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>LOG_CONS</td> * <td> * if there is an error while sending data to the system logger, * write directly to the system console * </td> * </tr> * <tr valign="top"> * <td>LOG_NDELAY</td> * <td> * open the connection to the logger immediately * </td> * </tr> * <tr valign="top"> * <td>LOG_ODELAY</td> * <td> * (default) delay opening the connection until the first * message is logged * </td> * </tr> * <tr valign="top"> * <td>LOG_PERROR</td> * <td>print log message also to standard error</td> * </tr> * <tr valign="top"> * <td>LOG_PID</td> * <td>include PID with each message</td> * </tr> * </table> * You can use one or more of this options. When using multiple options * you need to OR them, i.e. to open the connection * immediately, write to the console and include the PID in each message, * you will use: LOG_CONS | LOG_NDELAY | LOG_PID * </p> * @param facility int <p> * The facility argument is used to specify what * type of program is logging the message. This allows you to specify * (in your machine's syslog configuration) how messages coming from * different facilities will be handled. * <table> * openlog Facilities * <tr valign="top"> * <td>Constant</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>LOG_AUTH</td> * <td> * security/authorization messages (use * LOG_AUTHPRIV instead * in systems where that constant is defined) * </td> * </tr> * <tr valign="top"> * <td>LOG_AUTHPRIV</td> * <td>security/authorization messages (private)</td> * </tr> * <tr valign="top"> * <td>LOG_CRON</td> * <td>clock daemon (cron and at)</td> * </tr> * <tr valign="top"> * <td>LOG_DAEMON</td> * <td>other system daemons</td> * </tr> * <tr valign="top"> * <td>LOG_KERN</td> * <td>kernel messages</td> * </tr> * <tr valign="top"> * <td>LOG_LOCAL0 ... LOG_LOCAL7</td> * <td>reserved for local use, these are not available in Windows</td> * </tr> * <tr valign="top"> * <td>LOG_LPR</td> * <td>line printer subsystem</td> * </tr> * <tr valign="top"> * <td>LOG_MAIL</td> * <td>mail subsystem</td> * </tr> * <tr valign="top"> * <td>LOG_NEWS</td> * <td>USENET news subsystem</td> * </tr> * <tr valign="top"> * <td>LOG_SYSLOG</td> * <td>messages generated internally by syslogd</td> * </tr> * <tr valign="top"> * <td>LOG_USER</td> * <td>generic user-level messages</td> * </tr> * <tr valign="top"> * <td>LOG_UUCP</td> * <td>UUCP subsystem</td> * </tr> * </table> * </p> * <p> * LOG_USER is the only valid log type under Windows * operating systems * </p> * @return bool Returns true on success or false on failure. */ function openlog ($ident, $option, $facility) {} /** * Generate a system log message * @link http://www.php.net/manual/en/function.syslog.php * @param priority int <p> * priority is a combination of the facility and * the level. Possible values are: * <table> * syslog Priorities (in descending order) * <tr valign="top"> * <td>Constant</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>LOG_EMERG</td> * <td>system is unusable</td> * </tr> * <tr valign="top"> * <td>LOG_ALERT</td> * <td>action must be taken immediately</td> * </tr> * <tr valign="top"> * <td>LOG_CRIT</td> * <td>critical conditions</td> * </tr> * <tr valign="top"> * <td>LOG_ERR</td> * <td>error conditions</td> * </tr> * <tr valign="top"> * <td>LOG_WARNING</td> * <td>warning conditions</td> * </tr> * <tr valign="top"> * <td>LOG_NOTICE</td> * <td>normal, but significant, condition</td> * </tr> * <tr valign="top"> * <td>LOG_INFO</td> * <td>informational message</td> * </tr> * <tr valign="top"> * <td>LOG_DEBUG</td> * <td>debug-level message</td> * </tr> * </table> * </p> * @param message string <p> * The message to send, except that the two characters * %m will be replaced by the error message string * (strerror) corresponding to the present value of * errno. * </p> * @return bool Returns true on success or false on failure. */ function syslog ($priority, $message) {} /** * Close connection to system logger * @link http://www.php.net/manual/en/function.closelog.php * @return bool Returns true on success or false on failure. */ function closelog () {} /** * Combined linear congruential generator * @link http://www.php.net/manual/en/function.lcg-value.php * @return float A pseudo random float value in the range of (0, 1) */ function lcg_value () {} /** * Calculate the metaphone key of a string * @link http://www.php.net/manual/en/function.metaphone.php * @param str string <p> * The input string. * </p> * @param phonemes int[optional] <p> * This parameter restricts the returned metaphone key to * phonemes characters in length. * The default value of 0 means no restriction. * </p> * @return string the metaphone key as a string, &return.falseforfailure;. */ function metaphone ($str, $phonemes = null) {} /** * Turn on output buffering * @link http://www.php.net/manual/en/function.ob-start.php * @param output_callback callback[optional] <p> * An optional output_callback function may be * specified. This function takes a string as a parameter and should * return a string. The function will be called when * the output buffer is flushed (sent) or cleaned (with * ob_flush, ob_clean or similar * function) or when the output buffer * is flushed to the browser at the end of the request. When * output_callback is called, it will receive the * contents of the output buffer as its parameter and is expected to * return a new output buffer as a result, which will be sent to the * browser. If the output_callback is not a * callable function, this function will return false. * </p> * <p> * If the callback function has two parameters, the second parameter is * filled with a bit-field consisting of * PHP_OUTPUT_HANDLER_START, * PHP_OUTPUT_HANDLER_CONT and * PHP_OUTPUT_HANDLER_END. * </p> * <p> * If output_callback returns false original * input is sent to the browser. * </p> * <p> * The output_callback parameter may be bypassed * by passing a &null; value. * </p> * <p> * ob_end_clean, ob_end_flush, * ob_clean, ob_flush and * ob_start may not be called from a callback * function. If you call them from callback function, the behavior is * undefined. If you would like to delete the contents of a buffer, * return "" (a null string) from callback function. * You can't even call functions using the output buffering functions like * print_r($expression, true) or * highlight_file($filename, true) from a callback * function. * </p> * <p> * In PHP 4.0.4, ob_gzhandler was introduced to * facilitate sending gz-encoded data to web browsers that support * compressed web pages. ob_gzhandler determines * what type of content encoding the browser will accept and will return * its output accordingly. * </p> * @param chunk_size int[optional] <p> * If the optional parameter chunk_size is passed, the * buffer will be flushed after any output call which causes the buffer's * length to equal or exceed chunk_size. The default * value 0 means that the output function will only be * called when the output buffer is closed. * </p> * <p> * Prior to PHP 5.4.0, the value 1 was a special case * value that set the chunk size to 4096 bytes. * </p> * @param erase bool[optional] <p> * If the optional parameter erase is set to false, * the buffer will not be deleted until the script finishes. * This causes that flushing and cleaning functions would issue a notice * and return false if called. * </p> * @return bool Returns true on success or false on failure. */ function ob_start ($output_callback = null, $chunk_size = null, $erase = null) {} /** * Flush (send) the output buffer * @link http://www.php.net/manual/en/function.ob-flush.php * @return void */ function ob_flush () {} /** * Clean (erase) the output buffer * @link http://www.php.net/manual/en/function.ob-clean.php * @return void */ function ob_clean () {} /** * Flush (send) the output buffer and turn off output buffering * @link http://www.php.net/manual/en/function.ob-end-flush.php * @return bool Returns true on success or false on failure. Reasons for failure are first that you called the * function without an active buffer or that for some reason a buffer could * not be deleted (possible for special buffer). */ function ob_end_flush () {} /** * Clean (erase) the output buffer and turn off output buffering * @link http://www.php.net/manual/en/function.ob-end-clean.php * @return bool Returns true on success or false on failure. Reasons for failure are first that you called the * function without an active buffer or that for some reason a buffer could * not be deleted (possible for special buffer). */ function ob_end_clean () {} /** * Flush the output buffer, return it as a string and turn off output buffering * @link http://www.php.net/manual/en/function.ob-get-flush.php * @return string the output buffer or false if no buffering is active. */ function ob_get_flush () {} /** * Get current buffer contents and delete current output buffer * @link http://www.php.net/manual/en/function.ob-get-clean.php * @return string the contents of the output buffer and end output buffering. * If output buffering isn't active then false is returned. */ function ob_get_clean () {} /** * Return the length of the output buffer * @link http://www.php.net/manual/en/function.ob-get-length.php * @return int the length of the output buffer contents or false if no * buffering is active. */ function ob_get_length () {} /** * Return the nesting level of the output buffering mechanism * @link http://www.php.net/manual/en/function.ob-get-level.php * @return int the level of nested output buffering handlers or zero if output * buffering is not active. */ function ob_get_level () {} /** * Get status of output buffers * @link http://www.php.net/manual/en/function.ob-get-status.php * @param full_status bool[optional] <p> * true to return all active output buffer levels. If false or not * set, only the top level output buffer is returned. * </p> * @return array If called without the full_status parameter * or with full_status = false a simple array * with the following elements is returned: * 2 * [type] => 0 * [status] => 0 * [name] => URL-Rewriter * [del] => 1 * ) * ]]> * Simple ob_get_status results * KeyValue * levelOutput nesting level * typePHP_OUTPUT_HANDLER_INTERNAL (0) or PHP_OUTPUT_HANDLER_USER (1) * statusOne of PHP_OUTPUT_HANDLER_START (0), PHP_OUTPUT_HANDLER_CONT (1) or PHP_OUTPUT_HANDLER_END (2) * nameName of active output handler or ' default output handler' if none is set * delErase-flag as set by ob_start * </p> * <p> * If called with full_status = true an array * with one element for each active output buffer level is returned. * The output level is used as key of the top level array and each array * element itself is another array holding status information * on one active output level. * Array * ( * [chunk_size] => 0 * [size] => 40960 * [block_size] => 10240 * [type] => 1 * [status] => 0 * [name] => default output handler * [del] => 1 * ) * [1] => Array * ( * [chunk_size] => 0 * [size] => 40960 * [block_size] => 10240 * [type] => 0 * [buffer_size] => 0 * [status] => 0 * [name] => URL-Rewriter * [del] => 1 * ) * ) * ]]> * </p> * <p> * The full output contains these additional elements: * Full ob_get_status results * KeyValue * chunk_sizeChunk size as set by ob_start * size... * blocksize... */ function ob_get_status ($full_status = null) {} /** * Return the contents of the output buffer * @link http://www.php.net/manual/en/function.ob-get-contents.php * @return string This will return the contents of the output buffer or false, if output * buffering isn't active. */ function ob_get_contents () {} /** * Turn implicit flush on/off * @link http://www.php.net/manual/en/function.ob-implicit-flush.php * @param flag int[optional] <p> * true to turn implicit flushing on, false otherwise. * </p> * @return void */ function ob_implicit_flush ($flag = null) {} /** * List all output handlers in use * @link http://www.php.net/manual/en/function.ob-list-handlers.php * @return array This will return an array with the output handlers in use (if any). If * output_buffering is enabled or * an anonymous function was used with ob_start, * ob_list_handlers will return "default output * handler". */ function ob_list_handlers () {} /** * Sort an array by key * @link http://www.php.net/manual/en/function.ksort.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * You may modify the behavior of the sort using the optional * parameter sort_flags, for details * see sort. * </p> * @return bool Returns true on success or false on failure. */ function ksort (array &$array, $sort_flags = null) {} /** * Sort an array by key in reverse order * @link http://www.php.net/manual/en/function.krsort.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * You may modify the behavior of the sort using the optional parameter * sort_flags, for details see * sort. * </p> * @return bool Returns true on success or false on failure. */ function krsort (array &$array, $sort_flags = null) {} /** * Sort an array using a "natural order" algorithm * @link http://www.php.net/manual/en/function.natsort.php * @param array array <p> * The input array. * </p> * @return bool Returns true on success or false on failure. */ function natsort (array &$array) {} /** * Sort an array using a case insensitive "natural order" algorithm * @link http://www.php.net/manual/en/function.natcasesort.php * @param array array <p> * The input array. * </p> * @return bool Returns true on success or false on failure. */ function natcasesort (array &$array) {} /** * Sort an array and maintain index association * @link http://www.php.net/manual/en/function.asort.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * You may modify the behavior of the sort using the optional * parameter sort_flags, for details * see sort. * </p> * @return bool Returns true on success or false on failure. */ function asort (array &$array, $sort_flags = null) {} /** * Sort an array in reverse order and maintain index association * @link http://www.php.net/manual/en/function.arsort.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * You may modify the behavior of the sort using the optional parameter * sort_flags, for details see * sort. * </p> * @return bool Returns true on success or false on failure. */ function arsort (array &$array, $sort_flags = null) {} /** * Sort an array * @link http://www.php.net/manual/en/function.sort.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * The optional second parameter sort_flags * may be used to modify the sorting behavior using these values: * </p> * <p> * Sorting type flags: * SORT_REGULAR - compare items normally * (don't change types) * @return bool Returns true on success or false on failure. */ function sort (array &$array, $sort_flags = null) {} /** * Sort an array in reverse order * @link http://www.php.net/manual/en/function.rsort.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * You may modify the behavior of the sort using the optional * parameter sort_flags, for details see * sort. * </p> * @return bool Returns true on success or false on failure. */ function rsort (array &$array, $sort_flags = null) {} /** * Sort an array by values using a user-defined comparison function * @link http://www.php.net/manual/en/function.usort.php * @param array array <p> * The input array. * </p> * @param cmp_function callback <p> * The comparison function must return an integer less than, equal to, or * greater than zero if the first argument is considered to be * respectively less than, equal to, or greater than the second. * </p> * @return bool Returns true on success or false on failure. */ function usort (array &$array, $cmp_function) {} /** * Sort an array with a user-defined comparison function and maintain index association * @link http://www.php.net/manual/en/function.uasort.php * @param array array <p> * The input array. * </p> * @param cmp_function callback <p> * See usort and uksort for * examples of user-defined comparison functions. * </p> * @return bool Returns true on success or false on failure. */ function uasort (array &$array, $cmp_function) {} /** * Sort an array by keys using a user-defined comparison function * @link http://www.php.net/manual/en/function.uksort.php * @param array array <p> * The input array. * </p> * @param cmp_function callback <p> * The callback comparison function. * </p> * <p> * Function cmp_function should accept two * parameters which will be filled by pairs of array keys. * The comparison function must return an integer less than, equal * to, or greater than zero if the first argument is considered to * be respectively less than, equal to, or greater than the * second. * </p> * @return bool Returns true on success or false on failure. */ function uksort (array &$array, $cmp_function) {} /** * Shuffle an array * @link http://www.php.net/manual/en/function.shuffle.php * @param array array <p> * The array. * </p> * @return bool Returns true on success or false on failure. */ function shuffle (array &$array) {} /** * Apply a user function to every member of an array * @link http://www.php.net/manual/en/function.array-walk.php * @param array array <p> * The input array. * </p> * @param funcname callback <p> * Typically, funcname takes on two parameters. * The array parameter's value being the first, and * the key/index second. * </p> * <p> * If funcname needs to be working with the * actual values of the array, specify the first parameter of * funcname as a * reference. Then, * any changes made to those elements will be made in the * original array itself. * </p> * <p> * Many internal functions (for example strtolower) * will throw a warning if more than the expected number of argument * are passed in and are not usable directly as * funcname. * </p> * <p> * Only the values of the array may potentially be * changed; its structure cannot be altered, i.e., the programmer cannot * add, unset or reorder elements. If the callback does not respect this * requirement, the behavior of this function is undefined, and * unpredictable. * </p> * @param userdata mixed[optional] <p> * If the optional userdata parameter is supplied, * it will be passed as the third parameter to the callback * funcname. * </p> * @return bool Returns true on success or false on failure. */ function array_walk (array &$array, $funcname, $userdata = null) {} /** * Apply a user function recursively to every member of an array * @link http://www.php.net/manual/en/function.array-walk-recursive.php * @param input array <p> * The input array. * </p> * @param funcname callback <p> * Typically, funcname takes on two parameters. * The input parameter's value being the first, and * the key/index second. * </p> * <p> * If funcname needs to be working with the * actual values of the array, specify the first parameter of * funcname as a * reference. Then, * any changes made to those elements will be made in the * original array itself. * </p> * @param userdata mixed[optional] <p> * If the optional userdata parameter is supplied, * it will be passed as the third parameter to the callback * funcname. * </p> * @return bool Returns true on success or false on failure. */ function array_walk_recursive (array &$input, $funcname, $userdata = null) {} /** * Count all elements in an array, or something in an object * @link http://www.php.net/manual/en/function.count.php * @param var mixed <p> * The array or the object. * </p> * @param mode int[optional] <p> * If the optional mode parameter is set to * COUNT_RECURSIVE (or 1), count * will recursively count the array. This is particularly useful for * counting all the elements of a multidimensional array. * count does not detect infinite recursion. * </p> * @return int the number of elements in var. * If var is not an array or an object with * implemented Countable interface, * 1 will be returned. * There is one exception, if var is &null;, * 0 will be returned. * </p> * <p> * count may return 0 for a variable that isn't set, * but it may also return 0 for a variable that has been initialized with an * empty array. Use isset to test if a variable is set. */ function count ($var, $mode = null) {} /** * Set the internal pointer of an array to its last element * @link http://www.php.net/manual/en/function.end.php * @param array array <p> * The array. This array is passed by reference because it is modified by * the function. This means you must pass it a real variable and not * a function returning an array because only actual variables may be * passed by reference. * </p> * @return mixed the value of the last element or false for empty array. */ function end (array &$array) {} /** * Rewind the internal array pointer * @link http://www.php.net/manual/en/function.prev.php * @param array array <p> * The input array. * </p> * @return mixed the array value in the previous place that's pointed to by * the internal array pointer, or false if there are no more * elements. */ function prev (array &$array) {} /** * Advance the internal array pointer of an array * @link http://www.php.net/manual/en/function.next.php * @param array array <p> * The array being affected. * </p> * @return mixed the array value in the next place that's pointed to by the * internal array pointer, or false if there are no more elements. */ function next (array &$array) {} /** * Set the internal pointer of an array to its first element * @link http://www.php.net/manual/en/function.reset.php * @param array array <p> * The input array. * </p> * @return mixed the value of the first array element, or false if the array is * empty. */ function reset (array &$array) {} /** * Return the current element in an array * @link http://www.php.net/manual/en/function.current.php * @param array array <p> * The array. * </p> * @return mixed The current function simply returns the * value of the array element that's currently being pointed to by the * internal pointer. It does not move the pointer in any way. If the * internal pointer points beyond the end of the elements list or the array is * empty, current returns false. */ function current (array &$array) {} /** * Fetch a key from an array * @link http://www.php.net/manual/en/function.key.php * @param array array <p> * The array. * </p> * @return mixed The key function simply returns the * key of the array element that's currently being pointed to by the * internal pointer. It does not move the pointer in any way. If the * internal pointer points beyond the end of the elements list or the array is * empty, key returns &null;. */ function key (array &$array) {} /** * Find lowest value * @link http://www.php.net/manual/en/function.min.php * @param values array <p> * An array containing the values. * </p> * @return mixed min returns the numerically lowest of the * parameter values. */ function min (array $values) {} /** * Find highest value * @link http://www.php.net/manual/en/function.max.php * @param values array <p> * An array containing the values. * </p> * @return mixed max returns the numerically highest of the * parameter values. If multiple values can be considered of the same size, * the one that is listed first will be returned. * </p> * <p> * When max is given multiple arrays, the * longest array is returned. If all the arrays have the same length, * max will use lexicographic ordering to find the return * value. * </p> * <p> * When given a string it will be cast as an integer * when comparing. */ function max (array $values) {} /** * Checks if a value exists in an array * @link http://www.php.net/manual/en/function.in-array.php * @param needle mixed <p> * The searched value. * </p> * <p> * If needle is a string, the comparison is done * in a case-sensitive manner. * </p> * @param haystack array <p> * The array. * </p> * @param strict bool[optional] <p> * If the third parameter strict is set to true * then the in_array function will also check the * types of the * needle in the haystack. * </p> * @return bool true if needle is found in the array, * false otherwise. */ function in_array ($needle, array $haystack, $strict = null) {} /** * Searches the array for a given value and returns the corresponding key if successful * @link http://www.php.net/manual/en/function.array-search.php * @param needle mixed <p> * The searched value. * </p> * <p> * If needle is a string, the comparison is done * in a case-sensitive manner. * </p> * @param haystack array <p> * The array. * </p> * @param strict bool[optional] <p> * If the third parameter strict is set to true * then the array_search function will search for * identical elements in the * haystack. This means it will also check the * types of the * needle in the haystack, * and objects must be the same instance. * </p> * @return mixed the key for needle if it is found in the * array, false otherwise. * </p> * <p> * If needle is found in haystack * more than once, the first matching key is returned. To return the keys for * all matching values, use array_keys with the optional * search_value parameter instead. */ function array_search ($needle, array $haystack, $strict = null) {} /** * Import variables into the current symbol table from an array * @link http://www.php.net/manual/en/function.extract.php * @param var_array array <p> * Note that prefix is only required if * extract_type is EXTR_PREFIX_SAME, * EXTR_PREFIX_ALL, EXTR_PREFIX_INVALID * or EXTR_PREFIX_IF_EXISTS. If * the prefixed result is not a valid variable name, it is not * imported into the symbol table. Prefixes are automatically separated from * the array key by an underscore character. * </p> * @param extract_type int[optional] <p> * The way invalid/numeric keys and collisions are treated is determined * by the extract_type. It can be one of the * following values: * EXTR_OVERWRITE * If there is a collision, overwrite the existing variable. * @param prefix string[optional] Only overwrite the variable if it already exists in the * current symbol table, otherwise do nothing. This is useful * for defining a list of valid variables and then extracting * only those variables you have defined out of * $_REQUEST, for example. * @return int the number of variables successfully imported into the symbol * table. */ function extract (array &$var_array, $extract_type = null, $prefix = null) {} /** * Create array containing variables and their values * @link http://www.php.net/manual/en/function.compact.php * @param varname mixed <p> * compact takes a variable number of parameters. * Each parameter can be either a string containing the name of the * variable, or an array of variable names. The array can contain other * arrays of variable names inside it; compact * handles it recursively. * </p> * @param _ mixed[optional] * @return array the output array with all the variables added to it. */ function compact ($varname, $_ = null) {} /** * Fill an array with values * @link http://www.php.net/manual/en/function.array-fill.php * @param start_index int <p> * The first index of the returned array. * </p> * <p> * If start_index is negative, * the first index of the returned array will be * start_index and the following * indices will start from zero * (see example). * </p> * @param num int <p> * Number of elements to insert. * Must be greater than zero. * </p> * @param value mixed <p> * Value to use for filling * </p> * @return array the filled array */ function array_fill ($start_index, $num, $value) {} /** * Fill an array with values, specifying keys * @link http://www.php.net/manual/en/function.array-fill-keys.php * @param keys array <p> * Array of values that will be used as keys. Illegal values * for key will be converted to string. * </p> * @param value mixed <p> * Value to use for filling * </p> * @return array the filled array */ function array_fill_keys (array $keys, $value) {} /** * Create an array containing a range of elements * @link http://www.php.net/manual/en/function.range.php * @param start mixed <p> * First value of the sequence. * </p> * @param limit mixed <p> * The sequence is ended upon reaching the * limit value. * </p> * @param step number[optional] <p> * If a step value is given, it will be used as the * increment between elements in the sequence. step * should be given as a positive number. If not specified, * step will default to 1. * </p> * @return array an array of elements from start to * limit, inclusive. */ function range ($start, $limit, $step = null) {} /** * Sort multiple or multi-dimensional arrays * @link http://www.php.net/manual/en/function.array-multisort.php * @param arr array <p> * An array being sorted. * </p> * @param arg mixed[optional] <p> * Optionally another array, or sort options for the * previous array argument: * SORT_ASC, * SORT_DESC, * SORT_REGULAR, * SORT_NUMERIC, * SORT_STRING. * </p> * @param arg mixed[optional] * @param _ mixed[optional] * @return bool Returns true on success or false on failure. */ function array_multisort (array &$arr, $arg = null, $arg = null, $_ = null) {} /** * Push one or more elements onto the end of array * @link http://www.php.net/manual/en/function.array-push.php * @param array array <p> * The input array. * </p> * @param var mixed <p> * The pushed value. * </p> * @param _ mixed[optional] * @return int the new number of elements in the array. */ function array_push (array &$array, $var, $_ = null) {} /** * Pop the element off the end of array * @link http://www.php.net/manual/en/function.array-pop.php * @param array array <p> * The array to get the value from. * </p> * @return mixed the last value of array. * If array is empty (or is not an array), * &null; will be returned. */ function array_pop (array &$array) {} /** * Shift an element off the beginning of array * @link http://www.php.net/manual/en/function.array-shift.php * @param array array <p> * The input array. * </p> * @return mixed the shifted value, or &null; if array is * empty or is not an array. */ function array_shift (array &$array) {} /** * Prepend one or more elements to the beginning of an array * @link http://www.php.net/manual/en/function.array-unshift.php * @param array array <p> * The input array. * </p> * @param var mixed <p> * The prepended variable. * </p> * @param _ mixed[optional] * @return int the new number of elements in the array. */ function array_unshift (array &$array, $var, $_ = null) {} /** * Remove a portion of the array and replace it with something else * @link http://www.php.net/manual/en/function.array-splice.php * @param input array <p> * The input array. * </p> * @param offset int <p> * If offset is positive then the start of removed * portion is at that offset from the beginning of the * input array. If offset * is negative then it starts that far from the end of the * input array. * </p> * @param length int[optional] <p> * If length is omitted, removes everything * from offset to the end of the array. If * length is specified and is positive, then * that many elements will be removed. If * length is specified and is negative then * the end of the removed portion will be that many elements from * the end of the array. Tip: to remove everything from * offset to the end of the array when * replacement is also specified, use * count($input) for * length. * </p> * @param replacement mixed[optional] <p> * If replacement array is specified, then the * removed elements are replaced with elements from this array. * </p> * <p> * If offset and length * are such that nothing is removed, then the elements from the * replacement array are inserted in the place * specified by the offset. Note that keys in * replacement array are not preserved. * </p> * <p> * If replacement is just one element it is * not necessary to put array() * around it, unless the element is an array itself, an object or &null;. * </p> * @return array the array consisting of the extracted elements. */ function array_splice (array &$input, $offset, $length = null, $replacement = null) {} /** * Extract a slice of the array * @link http://www.php.net/manual/en/function.array-slice.php * @param array array <p> * The input array. * </p> * @param offset int <p> * If offset is non-negative, the sequence will * start at that offset in the array. If * offset is negative, the sequence will * start that far from the end of the array. * </p> * @param length int[optional] <p> * If length is given and is positive, then * the sequence will have up to that many elements in it. If the array * is shorter than the length, then only the * available array elements will be present. If * length is given and is negative then the * sequence will stop that many elements from the end of the * array. If it is omitted, then the sequence will have everything * from offset up until the end of the * array. * </p> * @param preserve_keys bool[optional] <p> * Note that array_slice will reorder and reset the * array indices by default. You can change this behaviour by setting * preserve_keys to true. * </p> * @return array the slice. */ function array_slice (array $array, $offset, $length = null, $preserve_keys = null) {} /** * Merge one or more arrays * @link http://www.php.net/manual/en/function.array-merge.php * @param array1 array <p> * Initial array to merge. * </p> * @param _ array[optional] * @return array the resulting array. */ function array_merge (array $array1, array $_ = null) {} /** * Merge two or more arrays recursively * @link http://www.php.net/manual/en/function.array-merge-recursive.php * @param array1 array <p> * Initial array to merge. * </p> * @param _ array[optional] * @return array An array of values resulted from merging the arguments together. */ function array_merge_recursive (array $array1, array $_ = null) {} /** * Replaces elements from passed arrays into the first array * @link http://www.php.net/manual/en/function.array-replace.php * @param array array <p> * The array in which elements are replaced. * </p> * @param array1 array <p> * The array from which elements will be extracted. * </p> * @param _ array[optional] * @return array an array, or &null; if an error occurs. */ function array_replace (array &$array, array &$array1, array &$_ = null) {} /** * Replaces elements from passed arrays into the first array recursively * @link http://www.php.net/manual/en/function.array-replace-recursive.php * @param array array <p> * The array in which elements are replaced. * </p> * @param array1 array <p> * The array from which elements will be extracted. * </p> * @param _ array[optional] * @return array an array, or &null; if an error occurs. */ function array_replace_recursive (array &$array, array &$array1, array &$_ = null) {} /** * Return all the keys or a subset of the keys of an array * @link http://www.php.net/manual/en/function.array-keys.php * @param input array <p> * An array containing keys to return. * </p> * @param search_value mixed[optional] <p> * If specified, then only keys containing these values are returned. * </p> * @param strict bool[optional] <p> * Determines if strict comparison (===) should be used during the search. * </p> * @return array an array of all the keys in input. */ function array_keys (array $input, $search_value = null, $strict = null) {} /** * Return all the values of an array * @link http://www.php.net/manual/en/function.array-values.php * @param input array <p> * The array. * </p> * @return array an indexed array of values. */ function array_values (array $input) {} /** * Counts all the values of an array * @link http://www.php.net/manual/en/function.array-count-values.php * @param input array <p> * The array of values to count * </p> * @return array an associative array of values from input as * keys and their count as value. */ function array_count_values (array $input) {} /** * Return an array with elements in reverse order * @link http://www.php.net/manual/en/function.array-reverse.php * @param array array <p> * The input array. * </p> * @param preserve_keys bool[optional] <p> * If set to true numeric keys are preserved. * Non-numeric keys are not affected by this setting and will always be preserved. * </p> * @return array the reversed array. */ function array_reverse (array $array, $preserve_keys = null) {} /** * Iteratively reduce the array to a single value using a callback function * @link http://www.php.net/manual/en/function.array-reduce.php * @param input array <p> * The input array. * </p> * @param function callback <p> * The callback function. * </p> * @param initial mixed[optional] <p> * If the optional initial is available, it will * be used at the beginning of the process, or as a final result in case * the array is empty. * </p> * @return mixed the resulting value. * </p> * <p> * If the array is empty and initial is not passed, * array_reduce returns &null;. */ function array_reduce (array $input, $function, $initial = null) {} /** * Pad array to the specified length with a value * @link http://www.php.net/manual/en/function.array-pad.php * @param input array <p> * Initial array of values to pad. * </p> * @param pad_size int <p> * New size of the array. * </p> * @param pad_value mixed <p> * Value to pad if input is less than * pad_size. * </p> * @return array a copy of the input padded to size specified * by pad_size with value * pad_value. If pad_size is * positive then the array is padded on the right, if it's negative then * on the left. If the absolute value of pad_size is less * than or equal to the length of the input then no * padding takes place. */ function array_pad (array $input, $pad_size, $pad_value) {} /** * Exchanges all keys with their associated values in an array * @link http://www.php.net/manual/en/function.array-flip.php * @param trans array <p> * An array of key/value pairs to be flipped. * </p> * @return array the flipped array on success and &null; on failure. */ function array_flip (array $trans) {} /** * Changes all keys in an array * @link http://www.php.net/manual/en/function.array-change-key-case.php * @param input array <p> * The array to work on * </p> * @param case int[optional] <p> * Either CASE_UPPER or * CASE_LOWER (default) * </p> * @return array an array with its keys lower or uppercased, or false if * input is not an array. */ function array_change_key_case (array $input, $case = null) {} /** * Pick one or more random entries out of an array * @link http://www.php.net/manual/en/function.array-rand.php * @param input array <p> * The input array. * </p> * @param num_req int[optional] <p> * Specifies how many entries you want to pick. Trying to pick more * elements than there are in the array will result in an * E_WARNING level error. * </p> * @return mixed If you are picking only one entry, array_rand * returns the key for a random entry. Otherwise, it returns an array * of keys for the random entries. This is done so that you can pick * random keys as well as values out of the array. */ function array_rand (array $input, $num_req = null) {} /** * Removes duplicate values from an array * @link http://www.php.net/manual/en/function.array-unique.php * @param array array <p> * The input array. * </p> * @param sort_flags int[optional] <p> * The optional second parameter sort_flags * may be used to modify the sorting behavior using these values: * </p> * <p> * Sorting type flags: * SORT_REGULAR - compare items normally * (don't change types) * @return array the filtered array. */ function array_unique (array $array, $sort_flags = null) {} /** * Computes the intersection of arrays * @link http://www.php.net/manual/en/function.array-intersect.php * @param array1 array <p> * The array with master values to check. * </p> * @param array2 array <p> * An array to compare values against. * </p> * @param _ array[optional] * @return array an array containing all of the values in * array1 whose values exist in all of the parameters. */ function array_intersect (array $array1, array $array2, array $_ = null) {} /** * Computes the intersection of arrays using keys for comparison * @link http://www.php.net/manual/en/function.array-intersect-key.php * @param array1 array <p> * The array with master keys to check. * </p> * @param array2 array <p> * An array to compare keys against. * </p> * @param _ array[optional] * @return array an associative array containing all the entries of * array1 which have keys that are present in all * arguments. */ function array_intersect_key (array $array1, array $array2, array $_ = null) {} /** * Computes the intersection of arrays using a callback function on the keys for comparison * @link http://www.php.net/manual/en/function.array-intersect-ukey.php * @param array1 array <p> * Initial array for comparison of the arrays. * </p> * @param array2 array <p> * First array to compare keys against. * </p> * @param _ array[optional] * @param key_compare_func callback <p> * User supplied callback function to do the comparison. * </p> * @return array the values of array1 whose keys exist * in all the arguments. */ function array_intersect_ukey (array $array1, array $array2, array $_ = null, $key_compare_func) {} /** * Computes the intersection of arrays, compares data by a callback function * @link http://www.php.net/manual/en/function.array-uintersect.php * @param array1 array <p> * The first array. * </p> * @param array2 array <p> * The second array. * </p> * @param _ array[optional] * @param data_compare_func callback <p> * The callback comparison function. * </p> * <p> * The user supplied callback function is used for comparison. * It must return an integer less than, equal to, or greater than zero if * the first argument is considered to be respectively less than, equal * to, or greater than the second. * </p> * @return array an array containing all the values of array1 * that are present in all the arguments. */ function array_uintersect (array $array1, array $array2, array $_ = null, $data_compare_func) {} /** * Computes the intersection of arrays with additional index check * @link http://www.php.net/manual/en/function.array-intersect-assoc.php * @param array1 array <p> * The array with master values to check. * </p> * @param array2 array <p> * An array to compare values against. * </p> * @param _ array[optional] * @return array an associative array containing all the values in * array1 that are present in all of the arguments. */ function array_intersect_assoc (array $array1, array $array2, array $_ = null) {} /** * Computes the intersection of arrays with additional index check, compares data by a callback function * @link http://www.php.net/manual/en/function.array-uintersect-assoc.php * @param array1 array <p> * The first array. * </p> * @param array2 array <p> * The second array. * </p> * @param _ array[optional] * @param data_compare_func callback <p> * For comparison is used the user supplied callback function. * It must return an integer less than, equal * to, or greater than zero if the first argument is considered to * be respectively less than, equal to, or greater than the * second. * </p> * @return array an array containing all the values of * array1 that are present in all the arguments. */ function array_uintersect_assoc (array $array1, array $array2, array $_ = null, $data_compare_func) {} /** * Computes the intersection of arrays with additional index check, compares indexes by a callback function * @link http://www.php.net/manual/en/function.array-intersect-uassoc.php * @param array1 array <p> * Initial array for comparison of the arrays. * </p> * @param array2 array <p> * First array to compare keys against. * </p> * @param _ array[optional] * @param key_compare_func callback <p> * User supplied callback function to do the comparison. * </p> * @return array the values of array1 whose values exist * in all of the arguments. */ function array_intersect_uassoc (array $array1, array $array2, array $_ = null, $key_compare_func) {} /** * Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions * @link http://www.php.net/manual/en/function.array-uintersect-uassoc.php * @param array1 array <p> * The first array. * </p> * @param array2 array <p> * The second array. * </p> * @param _ array[optional] * @param data_compare_func callback <p> * For comparison is used the user supplied callback function. * It must return an integer less than, equal * to, or greater than zero if the first argument is considered to * be respectively less than, equal to, or greater than the * second. * </p> * @param key_compare_func callback <p> * Key comparison callback function. * </p> * @return array an array containing all the values of * array1 that are present in all the arguments. */ function array_uintersect_uassoc (array $array1, array $array2, array $_ = null, $data_compare_func, $key_compare_func) {} /** * Computes the difference of arrays * @link http://www.php.net/manual/en/function.array-diff.php * @param array1 array <p> * The array to compare from * </p> * @param array2 array <p> * An array to compare against * </p> * @param _ array[optional] * @return array an array containing all the entries from * array1 that are not present in any of the other arrays. */ function array_diff (array $array1, array $array2, array $_ = null) {} /** * Computes the difference of arrays using keys for comparison * @link http://www.php.net/manual/en/function.array-diff-key.php * @param array1 array <p> * The array to compare from * </p> * @param array2 array <p> * An array to compare against * </p> * @param _ array[optional] * @return array an array containing all the entries from * array1 whose keys are not present in any of the * other arrays. */ function array_diff_key (array $array1, array $array2, array $_ = null) {} /** * Computes the difference of arrays using a callback function on the keys for comparison * @link http://www.php.net/manual/en/function.array-diff-ukey.php * @param array1 array <p> * The array to compare from * </p> * @param array2 array <p> * An array to compare against * </p> * @param _ array[optional] * @param key_compare_func callback <p> * callback function to use. * The callback function must return an integer less than, equal * to, or greater than zero if the first argument is considered to * be respectively less than, equal to, or greater than the second. * </p> * @return array an array containing all the entries from * array1 that are not present in any of the other arrays. */ function array_diff_ukey (array $array1, array $array2, array $_ = null, $key_compare_func) {} /** * Computes the difference of arrays by using a callback function for data comparison * @link http://www.php.net/manual/en/function.array-udiff.php * @param array1 array <p> * The first array. * </p> * @param array2 array <p> * The second array. * </p> * @param _ array[optional] * @param data_compare_func callback <p> * The callback comparison function. * </p> * <p> * The user supplied callback function is used for comparison. * It must return an integer less than, equal to, or greater than zero if * the first argument is considered to be respectively less than, equal * to, or greater than the second. * </p> * @return array an array containing all the values of array1 * that are not present in any of the other arguments. */ function array_udiff (array $array1, array $array2, array $_ = null, $data_compare_func) {} /** * Computes the difference of arrays with additional index check * @link http://www.php.net/manual/en/function.array-diff-assoc.php * @param array1 array <p> * The array to compare from * </p> * @param array2 array <p> * An array to compare against * </p> * @param _ array[optional] * @return array an array containing all the values from * array1 that are not present in any of the other arrays. */ function array_diff_assoc (array $array1, array $array2, array $_ = null) {} /** * Computes the difference of arrays with additional index check, compares data by a callback function * @link http://www.php.net/manual/en/function.array-udiff-assoc.php * @param array1 array <p> * The first array. * </p> * @param array2 array <p> * The second array. * </p> * @param _ array[optional] * @param data_compare_func callback <p> * The callback comparison function. * </p> * <p> * The user supplied callback function is used for comparison. * It must return an integer less than, equal to, or greater than zero if * the first argument is considered to be respectively less than, equal * to, or greater than the second. * </p> * @return array array_udiff_assoc returns an array * containing all the values from array1 * that are not present in any of the other arguments. * Note that the keys are used in the comparison unlike * array_diff and array_udiff. * The comparison of arrays' data is performed by using an user-supplied * callback. In this aspect the behaviour is opposite to the behaviour of * array_diff_assoc which uses internal function for * comparison. */ function array_udiff_assoc (array $array1, array $array2, array $_ = null, $data_compare_func) {} /** * Computes the difference of arrays with additional index check which is performed by a user supplied callback function * @link http://www.php.net/manual/en/function.array-diff-uassoc.php * @param array1 array <p> * The array to compare from * </p> * @param array2 array <p> * An array to compare against * </p> * @param _ array[optional] * @param key_compare_func callback <p> * callback function to use. * The callback function must return an integer less than, equal * to, or greater than zero if the first argument is considered to * be respectively less than, equal to, or greater than the second. * </p> * @return array an array containing all the entries from * array1 that are not present in any of the other arrays. */ function array_diff_uassoc (array $array1, array $array2, array $_ = null, $key_compare_func) {} /** * Computes the difference of arrays with additional index check, compares data and indexes by a callback function * @link http://www.php.net/manual/en/function.array-udiff-uassoc.php * @param array1 array <p> * The first array. * </p> * @param array2 array <p> * The second array. * </p> * @param _ array[optional] * @param data_compare_func callback <p> * The callback comparison function. * </p> * <p> * The user supplied callback function is used for comparison. * It must return an integer less than, equal to, or greater than zero if * the first argument is considered to be respectively less than, equal * to, or greater than the second. * </p> * <p> * The comparison of arrays' data is performed by using an user-supplied * callback : data_compare_func. In this aspect * the behaviour is opposite to the behaviour of * array_diff_assoc which uses internal function for * comparison. * </p> * @param key_compare_func callback <p> * The comparison of keys (indices) is done also by the callback function * key_compare_func. This behaviour is unlike what * array_udiff_assoc does, since the latter compares * the indices by using an internal function. * </p> * @return array an array containing all the values from * array1 that are not present in any of the other * arguments. */ function array_udiff_uassoc (array $array1, array $array2, array $_ = null, $data_compare_func, $key_compare_func) {} /** * Calculate the sum of values in an array * @link http://www.php.net/manual/en/function.array-sum.php * @param array array <p> * The input array. * </p> * @return number the sum of values as an integer or float. */ function array_sum (array $array) {} /** * Calculate the product of values in an array * @link http://www.php.net/manual/en/function.array-product.php * @param array array <p> * The array. * </p> * @return number the product as an integer or float. */ function array_product (array $array) {} /** * Filters elements of an array using a callback function * @link http://www.php.net/manual/en/function.array-filter.php * @param input array <p> * The array to iterate over * </p> * @param callback callback[optional] <p> * The callback function to use * </p> * <p> * If no callback is supplied, all entries of * input equal to false (see * converting to * boolean) will be removed. * </p> * @return array the filtered array. */ function array_filter (array $input, $callback = null) {} /** * Applies the callback to the elements of the given arrays * @link http://www.php.net/manual/en/function.array-map.php * @param callback callback <p> * Callback function to run for each element in each array. * </p> * @param arr1 array <p> * An array to run through the callback function. * </p> * @param _ array[optional] * @return array an array containing all the elements of arr1 * after applying the callback function to each one. */ function array_map ($callback, array $arr1, array $_ = null) {} /** * Split an array into chunks * @link http://www.php.net/manual/en/function.array-chunk.php * @param input array <p> * The array to work on * </p> * @param size int <p> * The size of each chunk * </p> * @param preserve_keys bool[optional] <p> * When set to true keys will be preserved. * Default is false which will reindex the chunk numerically * </p> * @return array a multidimensional numerically indexed array, starting with zero, * with each dimension containing size elements. */ function array_chunk (array $input, $size, $preserve_keys = null) {} /** * Creates an array by using one array for keys and another for its values * @link http://www.php.net/manual/en/function.array-combine.php * @param keys array <p> * Array of keys to be used. Illegal values for key will be * converted to string. * </p> * @param values array <p> * Array of values to be used * </p> * @return array the combined array, false if the number of elements * for each array isn't equal. */ function array_combine (array $keys, array $values) {} /** * Checks if the given key or index exists in the array * @link http://www.php.net/manual/en/function.array-key-exists.php * @param key mixed <p> * Value to check. * </p> * @param search array <p> * An array with keys to check. * </p> * @return bool Returns true on success or false on failure. */ function array_key_exists ($key, array $search) {} /** * &Alias; <function>current</function> * @link http://www.php.net/manual/en/function.pos.php * @param arg */ function pos (&$arg) {} /** * &Alias; <function>count</function> * @link http://www.php.net/manual/en/function.sizeof.php * @param var * @param mode[optional] */ function sizeof ($var, $mode) {} /** * @param key * @param search */ function key_exists ($key, $search) {} /** * Checks if assertion is &false; * @link http://www.php.net/manual/en/function.assert.php * @param assertion mixed <p> * The assertion. * </p> * @return bool false if the assertion is false, true otherwise. */ function assert ($assertion) {} /** * Set/get the various assert flags * @link http://www.php.net/manual/en/function.assert-options.php * @param what int <p> * <table> * Assert Options * <tr valign="top"> * <td>Option</td> * <td>INI Setting</td> * <td>Default value</td> * <td>Description</td> * </tr> * <tr valign="top"> * <td>ASSERT_ACTIVE</td> * <td>assert.active</td> * <td>1</td> * <td>enable assert evaluation</td> * </tr> * <tr valign="top"> * <td>ASSERT_WARNING</td> * <td>assert.warning</td> * <td>1</td> * <td>issue a PHP warning for each failed assertion</td> * </tr> * <tr valign="top"> * <td>ASSERT_BAIL</td> * <td>assert.bail</td> * <td>0</td> * <td>terminate execution on failed assertions</td> * </tr> * <tr valign="top"> * <td>ASSERT_QUIET_EVAL</td> * <td>assert.quiet_eval</td> * <td>0</td> * <td> * disable error_reporting during assertion expression * evaluation * </td> * </tr> * <tr valign="top"> * <td>ASSERT_CALLBACK</td> * <td>assert.callback</td> * <td)<&null;)</td> * <td>Callback to call on failed assertions</td> * </tr> * </table> * </p> * @param value mixed[optional] <p> * An optional new value for the option. * </p> * @return mixed the original setting of any option or false on errors. */ function assert_options ($what, $value = null) {} /** * Compares two "PHP-standardized" version number strings * @link http://www.php.net/manual/en/function.version-compare.php * @param version1 string <p> * First version number. * </p> * @param version2 string <p> * Second version number. * </p> * @param operator string[optional] <p> * If you specify the third optional operator * argument, you can test for a particular relationship. The * possible operators are: &lt;, * lt, &lt;=, * le, &gt;, * gt, &gt;=, * ge, ==, * =, eq, * !=, &lt;&gt;, * ne respectively. * </p> * <p> * This parameter is case-sensitive, so values should be lowercase. * </p> * @return mixed By default, version_compare returns * -1 if the first version is lower than the second, * 0 if they are equal, and * 1 if the second is lower. * </p> * <p> * When using the optional operator argument, the * function will return true if the relationship is the one specified * by the operator, false otherwise. */ function version_compare ($version1, $version2, $operator = null) {} /** * Convert a pathname and a project identifier to a System V IPC key * @link http://www.php.net/manual/en/function.ftok.php * @param pathname string <p> * Path to an accessible file. * </p> * @param proj string <p> * Project identifier. This must be a one character string. * </p> * @return int On success the return value will be the created key value, otherwise * -1 is returned. */ function ftok ($pathname, $proj) {} /** * Perform the rot13 transform on a string * @link http://www.php.net/manual/en/function.str-rot13.php * @param str string <p> * The input string. * </p> * @return string the ROT13 version of the given string. */ function str_rot13 ($str) {} /** * Retrieve list of registered filters * @link http://www.php.net/manual/en/function.stream-get-filters.php * @return array an indexed array containing the name of all stream filters * available. */ function stream_get_filters () {} /** * Register a user defined stream filter * @link http://www.php.net/manual/en/function.stream-filter-register.php * @param filtername string <p> * The filter name to be registered. * </p> * @param classname string <p> * To implement a filter, you need to define a class as an extension of * php_user_filter with a number of member functions * as defined below. When performing read/write operations on the stream * to which your filter is attached, PHP will pass the data through your * filter (and any other filters attached to that stream) so that the * data may be modified as desired. You must implement the methods * exactly as described below - doing otherwise will lead to undefined * behaviour. * </p> * intfilter * resourcein * resourceout * intconsumed * boolclosing * <p> * This method is called whenever data is read from or written to * the attached stream (such as with fread or fwrite). * in is a resource pointing to a bucket brigade * which contains one or more bucket objects containing data to be filtered. * out is a resource pointing to a second bucket brigade * into which your modified buckets should be placed. * consumed, which must always * be declared by reference, should be incremented by the length of the data * which your filter reads in and alters. In most cases this means you will * increment consumed by $bucket->datalen * for each $bucket. If the stream is in the process of closing * (and therefore this is the last pass through the filterchain), * the closing parameter will be set to true. * The filter method must return one of * three values upon completion. * <tr valign="top"> * <td>Return Value</td> * <td>Meaning</td> * </tr> * <tr valign="top"> * <td>PSFS_PASS_ON</td> * <td> * Filter processed successfully with data available in the * out bucket brigade. * </td> * </tr> * <tr valign="top"> * <td>PSFS_FEED_ME</td> * <td> * Filter processed successfully, however no data was available to * return. More data is required from the stream or prior filter. * </td> * </tr> * <tr valign="top"> * <td>PSFS_ERR_FATAL (default)</td> * <td> * The filter experienced an unrecoverable error and cannot continue. * </td> * </tr> * </p> * boolonCreate * This method is called during instantiation of the filter class * object. If your filter allocates or initializes any other resources * (such as a buffer), this is the place to do it. Your implementation of * this method should return false on failure, or true on success. * When your filter is first instantiated, and * yourfilter-&gt;onCreate() is called, a number of properties * will be available as shown in the table below. * <p> * <tr valign="top"> * <td>Property</td> * <td>Contents</td> * </tr> * <tr valign="top"> * <td>FilterClass-&gt;filtername</td> * <td> * A string containing the name the filter was instantiated with. * Filters may be registered under multiple names or under wildcards. * Use this property to determine which name was used. * </td> * </tr> * <tr valign="top"> * <td>FilterClass-&gt;params</td> * <td> * The contents of the params parameter passed * to stream_filter_append * or stream_filter_prepend. * </td> * </tr> * <tr valign="top"> * <td>FilterClass-&gt;stream</td> * <td> * The stream resource being filtered. Maybe available only during * filter calls when the * closing parameter is set to false. * </td> * </tr> * </p> * voidonClose * <p> * This method is called upon filter shutdown (typically, this is also * during stream shutdown), and is executed after * the flush method is called. If any resources * were allocated or initialized during onCreate() * this would be the time to destroy or dispose of them. * </p> * @return bool Returns true on success or false on failure. * </p> * <p> * stream_filter_register will return false if the * filtername is already defined. */ function stream_filter_register ($filtername, $classname) {} /** * Return a bucket object from the brigade for operating on * @link http://www.php.net/manual/en/function.stream-bucket-make-writeable.php * @param brigade resource * @return object */ function stream_bucket_make_writeable ($brigade) {} /** * Prepend bucket to brigade * @link http://www.php.net/manual/en/function.stream-bucket-prepend.php * @param brigade resource * @param bucket resource * @return void */ function stream_bucket_prepend ($brigade, $bucket) {} /** * Append bucket to brigade * @link http://www.php.net/manual/en/function.stream-bucket-append.php * @param brigade resource * @param bucket resource * @return void */ function stream_bucket_append ($brigade, $bucket) {} /** * Create a new bucket for use on the current stream * @link http://www.php.net/manual/en/function.stream-bucket-new.php * @param stream resource * @param buffer string * @return object */ function stream_bucket_new ($stream, $buffer) {} /** * Add URL rewriter values * @link http://www.php.net/manual/en/function.output-add-rewrite-var.php * @param name string <p> * The variable name. * </p> * @param value string <p> * The variable value. * </p> * @return bool Returns true on success or false on failure. */ function output_add_rewrite_var ($name, $value) {} /** * Reset URL rewriter values * @link http://www.php.net/manual/en/function.output-reset-rewrite-vars.php * @return bool Returns true on success or false on failure. */ function output_reset_rewrite_vars () {} /** * Returns directory path used for temporary files * @link http://www.php.net/manual/en/function.sys-get-temp-dir.php * @return string the path of the temporary directory. */ function sys_get_temp_dir () {} define ('CONNECTION_ABORTED', 1); define ('CONNECTION_NORMAL', 0); define ('CONNECTION_TIMEOUT', 2); define ('INI_USER', 1); define ('INI_PERDIR', 2); define ('INI_SYSTEM', 4); define ('INI_ALL', 7); /** * Normal INI scanner mode (since PHP 5.3). * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('INI_SCANNER_NORMAL', 0); /** * Raw INI scanner mode (since PHP 5.3). * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('INI_SCANNER_RAW', 1); define ('PHP_URL_SCHEME', 0); define ('PHP_URL_HOST', 1); define ('PHP_URL_PORT', 2); define ('PHP_URL_USER', 3); define ('PHP_URL_PASS', 4); define ('PHP_URL_PATH', 5); define ('PHP_URL_QUERY', 6); define ('PHP_URL_FRAGMENT', 7); define ('PHP_QUERY_RFC1738', 1); define ('PHP_QUERY_RFC3986', 2); define ('M_E', 2.718281828459); define ('M_LOG2E', 1.442695040889); define ('M_LOG10E', 0.43429448190325); define ('M_LN2', 0.69314718055995); define ('M_LN10', 2.302585092994); /** * Round halves up * @link http://www.php.net/manual/en/math.constants.php */ define ('M_PI', 3.1415926535898); define ('M_PI_2', 1.5707963267949); define ('M_PI_4', 0.78539816339745); define ('M_1_PI', 0.31830988618379); define ('M_2_PI', 0.63661977236758); define ('M_SQRTPI', 1.7724538509055); define ('M_2_SQRTPI', 1.1283791670955); define ('M_LNPI', 1.1447298858494); define ('M_EULER', 0.57721566490153); define ('M_SQRT2', 1.4142135623731); define ('M_SQRT1_2', 0.70710678118655); define ('M_SQRT3', 1.7320508075689); define ('INF', INF); define ('NAN', NAN); define ('PHP_ROUND_HALF_UP', 1); /** * Round halves down * @link http://www.php.net/manual/en/math.constants.php */ define ('PHP_ROUND_HALF_DOWN', 2); /** * Round halves to even numbers * @link http://www.php.net/manual/en/math.constants.php */ define ('PHP_ROUND_HALF_EVEN', 3); /** * Round halves to odd numbers * @link http://www.php.net/manual/en/math.constants.php */ define ('PHP_ROUND_HALF_ODD', 4); define ('INFO_GENERAL', 1); /** * PHP Credits. See also phpcredits. * @link http://www.php.net/manual/en/info.constants.php */ define ('INFO_CREDITS', 2); /** * Current Local and Master values for PHP directives. See * also ini_get. * @link http://www.php.net/manual/en/info.constants.php */ define ('INFO_CONFIGURATION', 4); /** * Loaded modules and their respective settings. * @link http://www.php.net/manual/en/info.constants.php */ define ('INFO_MODULES', 8); /** * Environment Variable information that's also available in * $_ENV. * @link http://www.php.net/manual/en/info.constants.php */ define ('INFO_ENVIRONMENT', 16); /** * Shows all * predefined variables from EGPCS (Environment, GET, * POST, Cookie, Server). * @link http://www.php.net/manual/en/info.constants.php */ define ('INFO_VARIABLES', 32); /** * PHP License information. See also the license faq. * @link http://www.php.net/manual/en/info.constants.php */ define ('INFO_LICENSE', 64); define ('INFO_ALL', -1); /** * A list of the core developers * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_GROUP', 1); /** * General credits: Language design and concept, PHP * authors and SAPI module. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_GENERAL', 2); /** * A list of the server API modules for PHP, and their authors. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_SAPI', 4); /** * A list of the extension modules for PHP, and their authors. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_MODULES', 8); /** * The credits for the documentation team. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_DOCS', 16); /** * Usually used in combination with the other flags. Indicates * that a complete stand-alone HTML page needs to be * printed including the information indicated by the other * flags. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_FULLPAGE', 32); /** * The credits for the quality assurance team. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_QA', 64); /** * The configuration line, &php.ini; location, build date, Web * Server, System and more. * @link http://www.php.net/manual/en/info.constants.php */ define ('CREDITS_ALL', -1); define ('HTML_SPECIALCHARS', 0); define ('HTML_ENTITIES', 1); define ('ENT_COMPAT', 2); define ('ENT_QUOTES', 3); define ('ENT_NOQUOTES', 0); define ('ENT_IGNORE', 4); define ('ENT_SUBSTITUTE', 8); define ('ENT_DISALLOWED', 128); define ('ENT_HTML401', 0); define ('ENT_XML1', 16); define ('ENT_XHTML', 32); define ('ENT_HTML5', 48); define ('STR_PAD_LEFT', 0); define ('STR_PAD_RIGHT', 1); define ('STR_PAD_BOTH', 2); define ('PATHINFO_DIRNAME', 1); define ('PATHINFO_BASENAME', 2); define ('PATHINFO_EXTENSION', 4); /** * Since PHP 5.2.0. * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('PATHINFO_FILENAME', 8); define ('CHAR_MAX', 127); define ('LC_CTYPE', 0); define ('LC_NUMERIC', 1); define ('LC_TIME', 2); define ('LC_COLLATE', 3); define ('LC_MONETARY', 4); define ('LC_ALL', 6); define ('LC_MESSAGES', 5); define ('SEEK_SET', 0); define ('SEEK_CUR', 1); define ('SEEK_END', 2); define ('LOCK_SH', 1); define ('LOCK_EX', 2); define ('LOCK_UN', 3); define ('LOCK_NB', 4); /** * A connection with an external resource has been established. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_CONNECT', 2); /** * Additional authorization is required to access the specified resource. * Typical issued with severity level of * STREAM_NOTIFY_SEVERITY_ERR. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_AUTH_REQUIRED', 3); /** * Authorization has been completed (with or without success). * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_AUTH_RESULT', 10); /** * The mime-type of resource has been identified, * refer to message for a description of the * discovered type. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_MIME_TYPE_IS', 4); /** * The size of the resource has been discovered. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_FILE_SIZE_IS', 5); /** * The external resource has redirected the stream to an alternate * location. Refer to message. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_REDIRECTED', 6); /** * Indicates current progress of the stream transfer in * bytes_transferred and possibly * bytes_max as well. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_PROGRESS', 7); /** * A generic error occurred on the stream, consult * message and message_code * for details. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_FAILURE', 9); /** * There is no more data available on the stream. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_COMPLETED', 8); /** * A remote address required for this stream has been resolved, or the resolution * failed. See severity for an indication of which happened. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_RESOLVE', 1); /** * Normal, non-error related, notification. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_SEVERITY_INFO', 0); /** * Non critical error condition. Processing may continue. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_SEVERITY_WARN', 1); /** * A critical error occurred. Processing cannot continue. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_NOTIFY_SEVERITY_ERR', 2); /** * Used with stream_filter_append and * stream_filter_prepend to indicate * that the specified filter should only be applied when * reading * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_FILTER_READ', 1); /** * Used with stream_filter_append and * stream_filter_prepend to indicate * that the specified filter should only be applied when * writing * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_FILTER_WRITE', 2); /** * This constant is equivalent to * STREAM_FILTER_READ | STREAM_FILTER_WRITE * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_FILTER_ALL', 3); /** * Client socket opened with stream_socket_client * should remain persistent between page loads. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_CLIENT_PERSISTENT', 1); /** * Open client socket asynchronously. This option must be used * together with the STREAM_CLIENT_CONNECT flag. * Used with stream_socket_client. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_CLIENT_ASYNC_CONNECT', 2); /** * Open client socket connection. Client sockets should always * include this flag. Used with stream_socket_client. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_CLIENT_CONNECT', 4); define ('STREAM_CRYPTO_METHOD_SSLv2_CLIENT', 0); define ('STREAM_CRYPTO_METHOD_SSLv3_CLIENT', 1); define ('STREAM_CRYPTO_METHOD_SSLv23_CLIENT', 2); define ('STREAM_CRYPTO_METHOD_TLS_CLIENT', 3); define ('STREAM_CRYPTO_METHOD_SSLv2_SERVER', 4); define ('STREAM_CRYPTO_METHOD_SSLv3_SERVER', 5); define ('STREAM_CRYPTO_METHOD_SSLv23_SERVER', 6); define ('STREAM_CRYPTO_METHOD_TLS_SERVER', 7); /** * Used with stream_socket_shutdown to disable * further receptions. Added in PHP 5.2.1. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SHUT_RD', 0); /** * Used with stream_socket_shutdown to disable * further transmissions. Added in PHP 5.2.1. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SHUT_WR', 1); /** * Used with stream_socket_shutdown to disable * further receptions and transmissions. Added in PHP 5.2.1. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SHUT_RDWR', 2); /** * Internet Protocol Version 4 (IPv4). * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_PF_INET', 2); /** * Internet Protocol Version 6 (IPv6). * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_PF_INET6', 10); /** * Unix system internal protocols. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_PF_UNIX', 1); /** * Provides a IP socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_IPPROTO_IP', 0); /** * Provides a TCP socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_IPPROTO_TCP', 6); /** * Provides a UDP socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_IPPROTO_UDP', 17); /** * Provides a ICMP socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_IPPROTO_ICMP', 1); /** * Provides a RAW socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_IPPROTO_RAW', 255); /** * Provides sequenced, two-way byte streams with a transmission mechanism * for out-of-band data (TCP, for example). * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SOCK_STREAM', 1); /** * Provides datagrams, which are connectionless messages (UDP, for * example). * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SOCK_DGRAM', 2); /** * Provides a raw socket, which provides access to internal network * protocols and interfaces. Usually this type of socket is just available * to the root user. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SOCK_RAW', 3); /** * Provides a sequenced packet stream socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SOCK_SEQPACKET', 5); /** * Provides a RDM (Reliably-delivered messages) socket. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SOCK_RDM', 4); define ('STREAM_PEEK', 2); define ('STREAM_OOB', 1); /** * Tells a stream created with stream_socket_server * to bind to the specified target. Server sockets should always include this flag. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SERVER_BIND', 4); /** * Tells a stream created with stream_socket_server * and bound using the STREAM_SERVER_BIND flag to start * listening on the socket. Connection-orientated transports (such as TCP) * must use this flag, otherwise the server socket will not be enabled. * Using this flag for connect-less transports (such as UDP) is an error. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_SERVER_LISTEN', 8); /** * Search for filename in * include_path (since PHP 5). * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FILE_USE_INCLUDE_PATH', 1); /** * Strip EOL characters (since PHP 5). * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FILE_IGNORE_NEW_LINES', 2); /** * Skip empty lines (since PHP 5). * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FILE_SKIP_EMPTY_LINES', 4); /** * Append content to existing file. * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FILE_APPEND', 8); define ('FILE_NO_DEFAULT_CONTEXT', 16); /** * <p> * Text mode (since PHP 5.2.7). * <p> * This constant has no effect, and is only available for * forward compatibility. * </p> * </p> * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FILE_TEXT', 0); /** * <p> * Binary mode (since PHP 5.2.7). * <p> * This constant has no effect, and is only available for * forward compatibility. * </p> * </p> * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FILE_BINARY', 0); /** * Disable backslash escaping. * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FNM_NOESCAPE', 2); /** * Slash in string only matches slash in the given pattern. * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FNM_PATHNAME', 1); /** * Leading period in string must be exactly matched by period in the given pattern. * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FNM_PERIOD', 4); /** * Caseless match. Part of the GNU extension. * @link http://www.php.net/manual/en/filesystem.constants.php */ define ('FNM_CASEFOLD', 16); /** * Return Code indicating that the * userspace filter returned buckets in $out. * @link http://www.php.net/manual/en/stream.constants.php */ define ('PSFS_PASS_ON', 2); /** * Return Code indicating that the * userspace filter did not return buckets in $out * (i.e. No data available). * @link http://www.php.net/manual/en/stream.constants.php */ define ('PSFS_FEED_ME', 1); /** * Return Code indicating that the * userspace filter encountered an unrecoverable error * (i.e. Invalid data received). * @link http://www.php.net/manual/en/stream.constants.php */ define ('PSFS_ERR_FATAL', 0); /** * Regular read/write. * @link http://www.php.net/manual/en/stream.constants.php */ define ('PSFS_FLAG_NORMAL', 0); /** * An incremental flush. * @link http://www.php.net/manual/en/stream.constants.php */ define ('PSFS_FLAG_FLUSH_INC', 1); /** * Final flush prior to closing. * @link http://www.php.net/manual/en/stream.constants.php */ define ('PSFS_FLAG_FLUSH_CLOSE', 2); define ('ABDAY_1', 131072); define ('ABDAY_2', 131073); define ('ABDAY_3', 131074); define ('ABDAY_4', 131075); define ('ABDAY_5', 131076); define ('ABDAY_6', 131077); define ('ABDAY_7', 131078); define ('DAY_1', 131079); define ('DAY_2', 131080); define ('DAY_3', 131081); define ('DAY_4', 131082); define ('DAY_5', 131083); define ('DAY_6', 131084); define ('DAY_7', 131085); define ('ABMON_1', 131086); define ('ABMON_2', 131087); define ('ABMON_3', 131088); define ('ABMON_4', 131089); define ('ABMON_5', 131090); define ('ABMON_6', 131091); define ('ABMON_7', 131092); define ('ABMON_8', 131093); define ('ABMON_9', 131094); define ('ABMON_10', 131095); define ('ABMON_11', 131096); define ('ABMON_12', 131097); define ('MON_1', 131098); define ('MON_2', 131099); define ('MON_3', 131100); define ('MON_4', 131101); define ('MON_5', 131102); define ('MON_6', 131103); define ('MON_7', 131104); define ('MON_8', 131105); define ('MON_9', 131106); define ('MON_10', 131107); define ('MON_11', 131108); define ('MON_12', 131109); define ('AM_STR', 131110); define ('PM_STR', 131111); define ('D_T_FMT', 131112); define ('D_FMT', 131113); define ('T_FMT', 131114); define ('T_FMT_AMPM', 131115); define ('ERA', 131116); define ('ERA_D_T_FMT', 131120); define ('ERA_D_FMT', 131118); define ('ERA_T_FMT', 131121); define ('ALT_DIGITS', 131119); define ('CRNCYSTR', 262159); define ('RADIXCHAR', 65536); define ('THOUSEP', 65537); define ('YESEXPR', 327680); define ('NOEXPR', 327681); define ('CODESET', 14); define ('CRYPT_SALT_LENGTH', 123); define ('CRYPT_STD_DES', 1); define ('CRYPT_EXT_DES', 1); define ('CRYPT_MD5', 1); define ('CRYPT_BLOWFISH', 1); define ('CRYPT_SHA256', 1); define ('CRYPT_SHA512', 1); define ('DIRECTORY_SEPARATOR', "/"); /** * Available since PHP 4.3.0. Semicolon on Windows, colon otherwise. * @link http://www.php.net/manual/en/dir.constants.php */ define ('PATH_SEPARATOR', ":"); /** * Available since PHP 5.4.0. * @link http://www.php.net/manual/en/dir.constants.php */ define ('SCANDIR_SORT_ASCENDING', 0); /** * Available since PHP 5.4.0. * @link http://www.php.net/manual/en/dir.constants.php */ define ('SCANDIR_SORT_DESCENDING', 1); /** * Available since PHP 5.4.0. * @link http://www.php.net/manual/en/dir.constants.php */ define ('SCANDIR_SORT_NONE', 2); define ('GLOB_BRACE', 1024); define ('GLOB_MARK', 2); define ('GLOB_NOSORT', 4); define ('GLOB_NOCHECK', 16); define ('GLOB_NOESCAPE', 64); define ('GLOB_ERR', 1); define ('GLOB_ONLYDIR', 8192); define ('GLOB_AVAILABLE_FLAGS', 9303); /** * system is unusable * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_EMERG', 0); /** * action must be taken immediately * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_ALERT', 1); /** * critical conditions * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_CRIT', 2); /** * error conditions * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_ERR', 3); /** * warning conditions * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_WARNING', 4); /** * normal, but significant, condition * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_NOTICE', 5); /** * informational message * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_INFO', 6); /** * debug-level message * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_DEBUG', 7); /** * kernel messages * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_KERN', 0); /** * generic user-level messages * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_USER', 8); /** * mail subsystem * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_MAIL', 16); /** * other system daemons * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_DAEMON', 24); /** * security/authorization messages (use LOG_AUTHPRIV instead * in systems where that constant is defined) * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_AUTH', 32); /** * messages generated internally by syslogd * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_SYSLOG', 40); /** * line printer subsystem * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_LPR', 48); /** * USENET news subsystem * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_NEWS', 56); /** * UUCP subsystem * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_UUCP', 64); /** * clock daemon (cron and at) * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_CRON', 72); /** * security/authorization messages (private) * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_AUTHPRIV', 80); define ('LOG_LOCAL0', 128); define ('LOG_LOCAL1', 136); define ('LOG_LOCAL2', 144); define ('LOG_LOCAL3', 152); define ('LOG_LOCAL4', 160); define ('LOG_LOCAL5', 168); define ('LOG_LOCAL6', 176); define ('LOG_LOCAL7', 184); /** * include PID with each message * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_PID', 1); /** * if there is an error while sending data to the system logger, * write directly to the system console * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_CONS', 2); /** * (default) delay opening the connection until the first * message is logged * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_ODELAY', 4); /** * open the connection to the logger immediately * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_NDELAY', 8); define ('LOG_NOWAIT', 16); /** * print log message also to standard error * @link http://www.php.net/manual/en/network.constants.php */ define ('LOG_PERROR', 32); define ('EXTR_OVERWRITE', 0); define ('EXTR_SKIP', 1); define ('EXTR_PREFIX_SAME', 2); define ('EXTR_PREFIX_ALL', 3); define ('EXTR_PREFIX_INVALID', 4); define ('EXTR_PREFIX_IF_EXISTS', 5); define ('EXTR_IF_EXISTS', 6); define ('EXTR_REFS', 256); /** * SORT_ASC is used with * array_multisort to sort in ascending order. * @link http://www.php.net/manual/en/array.constants.php */ define ('SORT_ASC', 4); /** * SORT_DESC is used with * array_multisort to sort in descending order. * @link http://www.php.net/manual/en/array.constants.php */ define ('SORT_DESC', 3); /** * SORT_REGULAR is used to compare items normally. * @link http://www.php.net/manual/en/array.constants.php */ define ('SORT_REGULAR', 0); /** * SORT_NUMERIC is used to compare items numerically. * @link http://www.php.net/manual/en/array.constants.php */ define ('SORT_NUMERIC', 1); /** * SORT_STRING is used to compare items as strings. * @link http://www.php.net/manual/en/array.constants.php */ define ('SORT_STRING', 2); /** * SORT_LOCALE_STRING is used to compare items as * strings, based on the current locale. Added in PHP 4.4.0 and 5.0.2. * @link http://www.php.net/manual/en/array.constants.php */ define ('SORT_LOCALE_STRING', 5); define ('SORT_NATURAL', 6); define ('SORT_FLAG_CASE', 8); /** * CASE_LOWER is used with * array_change_key_case and is used to convert array * keys to lower case. This is also the default case for * array_change_key_case. * @link http://www.php.net/manual/en/array.constants.php */ define ('CASE_LOWER', 0); /** * CASE_UPPER is used with * array_change_key_case and is used to convert array * keys to upper case. * @link http://www.php.net/manual/en/array.constants.php */ define ('CASE_UPPER', 1); define ('COUNT_NORMAL', 0); define ('COUNT_RECURSIVE', 1); define ('ASSERT_ACTIVE', 1); define ('ASSERT_CALLBACK', 2); define ('ASSERT_BAIL', 3); define ('ASSERT_WARNING', 4); define ('ASSERT_QUIET_EVAL', 5); /** * Flag indicating if the stream * used the include path. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_USE_PATH', 1); define ('STREAM_IGNORE_URL', 2); /** * Flag indicating if the wrapper * is responsible for raising errors using trigger_error * during opening of the stream. If this flag is not set, you * should not raise any errors. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_REPORT_ERRORS', 8); /** * This flag is useful when your extension really must be able to randomly * seek around in a stream. Some streams may not be seekable in their * native form, so this flag asks the streams API to check to see if the * stream does support seeking. If it does not, it will copy the stream * into temporary storage (which may be a temporary file or a memory * stream) which does support seeking. * Please note that this flag is not useful when you want to seek the * stream and write to it, because the stream you are accessing might * not be bound to the actual resource you requested. * If the requested resource is network based, this flag will cause the * opener to block until the whole contents have been downloaded. * @link http://www.php.net/manual/en/internals2.ze1.streams.constants.php */ define ('STREAM_MUST_SEEK', 16); define ('STREAM_URL_STAT_LINK', 1); define ('STREAM_URL_STAT_QUIET', 2); define ('STREAM_MKDIR_RECURSIVE', 1); define ('STREAM_IS_URL', 1); define ('STREAM_OPTION_BLOCKING', 1); define ('STREAM_OPTION_READ_TIMEOUT', 4); define ('STREAM_OPTION_READ_BUFFER', 2); define ('STREAM_OPTION_WRITE_BUFFER', 3); define ('STREAM_BUFFER_NONE', 0); define ('STREAM_BUFFER_LINE', 1); define ('STREAM_BUFFER_FULL', 2); /** * Stream casting, when stream_cast is called * otherwise (see above). * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_CAST_AS_STREAM', 0); /** * Stream casting, for when stream_select is * calling stream_cast. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_CAST_FOR_SELECT', 3); /** * Used with stream_metadata, to specify touch call. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_META_TOUCH', 1); /** * Used with stream_metadata, to specify chown call. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_META_OWNER', 3); /** * Used with stream_metadata, to specify chown call. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_META_OWNER_NAME', 2); /** * Used with stream_metadata, to specify chgrp call. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_META_GROUP', 5); /** * Used with stream_metadata, to specify chgrp call. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_META_GROUP_NAME', 4); /** * Used with stream_metadata, to specify chmod call. * @link http://www.php.net/manual/en/stream.constants.php */ define ('STREAM_META_ACCESS', 6); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_GIF', 1); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_JPEG', 2); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_PNG', 3); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_SWF', 4); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_PSD', 5); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_BMP', 6); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_TIFF_II', 7); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_TIFF_MM', 8); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_JPC', 9); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_JP2', 10); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_JPX', 11); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_JB2', 12); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_SWC', 13); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_IFF', 14); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_WBMP', 15); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_JPEG2000', 9); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_XBM', 16); /** * Image type constant used by the * image_type_to_mime_type and * image_type_to_extension functions. * (Available as of PHP 5.3.0) * @link http://www.php.net/manual/en/image.constants.php */ define ('IMAGETYPE_ICO', 17); define ('IMAGETYPE_UNKNOWN', 0); define ('IMAGETYPE_COUNT', 18); /** * IPv4 Address Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_A', 1); /** * Authoritative Name Server Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_NS', 2); /** * Alias (Canonical Name) Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_CNAME', 16); /** * Start of Authority Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_SOA', 32); /** * Pointer Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_PTR', 2048); /** * Host Info Resource (See IANA's * Operating System Names * for the meaning of these values) * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_HINFO', 4096); /** * Mail Exchanger Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_MX', 16384); /** * Text Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_TXT', 32768); define ('DNS_SRV', 33554432); define ('DNS_NAPTR', 67108864); /** * IPv6 Address Resource * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_AAAA', 134217728); define ('DNS_A6', 16777216); /** * Any Resource Record. On most systems * this returns all resource records, however * it should not be counted upon for critical * uses. Try DNS_ALL instead. * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_ANY', 268435456); /** * Iteratively query the name server for * each available record type. * @link http://www.php.net/manual/en/network.constants.php */ define ('DNS_ALL', 251713587); // End of standard v.5.4.0RC6 ?>
{ "content_hash": "36c6b0622c62961190ea431965c3076c", "timestamp": "", "source": "github", "line_count": 11747, "max_line_length": 131, "avg_line_length": 29.968162083936324, "alnum_prop": 0.6812030587780795, "repo_name": "deuxnids/Wiloma", "id": "8fef1bb6e093440b0a2ec0fdc23c295ac8582e0f", "size": "352036", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "src/.metadata/.plugins/org.eclipse.php.core/__language__/7fd7d8e0/standard.php", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "15982" }, { "name": "C", "bytes": "1" }, { "name": "C++", "bytes": "1" }, { "name": "CSS", "bytes": "466003" }, { "name": "JavaScript", "bytes": "2582477" }, { "name": "Logos", "bytes": "708305" }, { "name": "PHP", "bytes": "4938168" }, { "name": "Perl", "bytes": "2403" }, { "name": "Shell", "bytes": "7411" } ], "symlink_target": "" }
(function () { "use strict" function liveapp(opts) { opts = opts || {} var view = opts.view var root_scope = opts.scope || function () {} var fixup = opts.$link || function () {} var UMG = require('UMG') function main() { var page = new VerticalBox() function test(path) { var design = require('jade-umg')(UMG,path) var app = UMG.app(design,root_scope); fixup(app) var slot = page.AddChild(app) slot.Size = {SizeRule:'Fill',Value:1} var cleanup = function () { app.RemoveFromParent() } cleanup.$files = design.$files return cleanup } function livereload(path,test) { var files = [path] var fullpath = Context.GetScriptFileFullPath(path) return require('devrequire')({ get_change : function (watcher) { var full_files = files.map(function (x) { return Context.GetScriptFileFullPath(x)}) return full_files.filter(function (x) {return watcher.Contains(x)}) }, exec : function () { var design = test() files = design.$files return design }, notify : true, message : "Live reload (jade)" }) } var live_jade = livereload(view,function () { return test(view) }) page.$destroy = live_jade return page } return main } module.exports = liveapp; }())
{ "content_hash": "d2330e0d2729af39254823b43d382c65", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 107, "avg_line_length": 29.901639344262296, "alnum_prop": 0.4369517543859649, "repo_name": "timbur/Unreal.js", "id": "7a2bddd0714ed8e2d74675a3c51d3d564d4b61bd", "size": "1824", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Plugins/UnrealJS/Content/Scripts/liveapp.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1454" }, { "name": "C", "bytes": "13849" }, { "name": "C#", "bytes": "10260" }, { "name": "C++", "bytes": "746050" }, { "name": "JavaScript", "bytes": "503046" } ], "symlink_target": "" }
.ui-slider { position: relative; text-align: left; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } .ui-slider-horizontal { height: .8em; } .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } .ui-slider-horizontal .ui-slider-range-min { left: 0; } .ui-slider-horizontal .ui-slider-range-max { right: 0; } .ui-slider-vertical { width: .8em; height: 100px; } .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; }
{ "content_hash": "df93e64d23c69f6dbce37865d6ec1926", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 133, "avg_line_length": 57, "alnum_prop": 0.6842105263157895, "repo_name": "wongatech/remi", "id": "0d206e054ec91635e17f8ea83b20578c0d25611c", "size": "1141", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ReMi.Web/ReMi.Web.UI/content/themes/base/jquery.ui.slider.css", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "109" }, { "name": "C#", "bytes": "3318624" }, { "name": "CSS", "bytes": "240302" }, { "name": "HTML", "bytes": "476851" }, { "name": "JavaScript", "bytes": "8282999" }, { "name": "PowerShell", "bytes": "28518" }, { "name": "Smalltalk", "bytes": "138120" } ], "symlink_target": "" }
<!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.6.0_27) on Sun Mar 16 11:23:21 IRST 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>All Classes (Unnamed - org.nise.ux.lib:ux-library:jar:0.3.1 0.3.1 API)</title> <meta name="date" content="2014-03-16"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> </head> <body> <h1 class="bar">All Classes</h1> <div class="indexContainer"> <ul> <li><a href="org/nise/ux/lib/ActivityBlocker.html" title="class in org.nise.ux.lib">ActivityBlocker</a></li> <li><a href="org/nise/ux/configuration/BasicConfigurations.html" title="class in org.nise.ux.configuration">BasicConfigurations</a></li> <li><a href="org/nise/ux/lib/Cacher.html" title="class in org.nise.ux.lib">Cacher</a></li> <li><a href="org/nise/ux/configuration/ConfigurationMXBean.html" title="interface in org.nise.ux.configuration"><i>ConfigurationMXBean</i></a></li> <li><a href="org/nise/ux/configuration/ConfigurationsHandler.html" title="interface in org.nise.ux.configuration"><i>ConfigurationsHandler</i></a></li> <li><a href="org/nise/ux/lib/DoubleValuedSortedList.html" title="class in org.nise.ux.lib">DoubleValuedSortedList</a></li> <li><a href="org/nise/ux/configuration/FileConfigurations.html" title="class in org.nise.ux.configuration">FileConfigurations</a></li> <li><a href="org/nise/ux/configuration/LiveConfigurations.html" title="class in org.nise.ux.configuration">LiveConfigurations</a></li> <li><a href="org/nise/ux/lib/Living.html" title="class in org.nise.ux.lib">Living</a></li> <li><a href="org/nise/ux/lib/LongValuedSortedList.html" title="class in org.nise.ux.lib">LongValuedSortedList</a></li> <li><a href="org/nise/ux/lib/RoundQueue.html" title="class in org.nise.ux.lib">RoundQueue</a></li> <li><a href="org/nise/ux/configuration/StatusInformer.html" title="interface in org.nise.ux.configuration"><i>StatusInformer</i></a></li> <li><a href="org/nise/ux/lib/StringNormalizer.html" title="class in org.nise.ux.lib">StringNormalizer</a></li> <li><a href="org/nise/ux/lib/TimeConversion.html" title="class in org.nise.ux.lib">TimeConversion</a></li> <li><a href="org/nise/ux/lib/TimeProfiler.html" title="class in org.nise.ux.lib">TimeProfiler</a></li> <li><a href="org/nise/ux/lib/WaitList.html" title="class in org.nise.ux.lib">WaitList</a></li> <li><a href="org/nise/ux/lib/XMLWriter.html" title="class in org.nise.ux.lib">XMLWriter</a></li> </ul> </div> </body> </html>
{ "content_hash": "3194fa610110276e237da2bc5f3c163b", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 151, "avg_line_length": 74.22857142857143, "alnum_prop": 0.7263279445727483, "repo_name": "yeuser/java-libs", "id": "7f8198db16e2bd9d71bd4afb63992774233046f0", "size": "2598", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ux-library/target/apidocs/allclasses-noframe.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "330267" }, { "name": "HTML", "bytes": "20997355" }, { "name": "Java", "bytes": "184079" } ], "symlink_target": "" }
$(document).ready(function() { tableToGrid("#listado_donantes", { pager : '#pagerdonantes', rowNum:10, rownumbers: true, gridview: true, width: 750, height: '100%', caption: "Seleccione la donante", colModel :[ // {name:'Id',width:80,editable:true,}, {name:'id',width:5,align:'center', search:false,hidden:true}, {name:'Nombre', width:30,align:'center'}, {name:'Accion', width:10,align:'center', search:false}, ], }); jQuery("#listado_donantes").jqGrid('sortGrid',"id",true); jQuery("#listado_donantes").jqGrid('navGrid','#pagerdonantes', { edit:false, add:false, del:false, search:false, reload:false }); jQuery("#listado_donantes").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false}); });
{ "content_hash": "dca1b346db144a56b63758e69a8d399b", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 100, "avg_line_length": 28.575757575757574, "alnum_prop": 0.5249204665959704, "repo_name": "symfony2jeni/siblh", "id": "c8816a032a1c454e7ea21970ab9a296724645503", "size": "943", "binary": false, "copies": "2", "ref": "refs/heads/diciembre", "path": "src/siblh/mantenimientoBundle/Resources/public/js/BlhHistoriaActual/donantesHA.js", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "68598" }, { "name": "JavaScript", "bytes": "2591946" }, { "name": "PHP", "bytes": "985206" }, { "name": "Perl", "bytes": "2647" }, { "name": "Ruby", "bytes": "154" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Port Knocker</string> <string name="widget1x1_name">Port Knocker 1x1</string> <string name="widget2x1_name">Port Knocker 2x1</string> <string name="widget3x1_name">Port Knocker 3x1</string> <string name="widget4x1_name">Port Knocker 4x1</string> <string name="host_tab_name">Host</string> <string name="ports_tab_name">Ports</string> <string name="misc_tab_name">Other</string> <string name="host_label_label">Label</string> <string name="host_label_hint">Label</string> <string name="host_name_label">Hostname/IP</string> <string name="host_name_hint">domain.com/192.168.10.1</string> <string name="port_label">Port</string> <string name="port_hint">1234</string> <string name="protocol_label">Protocol</string> <string name="delay_label">Delay Between Packets (ms)</string> <string name="delay_hint">1000</string> <string name="launch_app_label">Launch Application</string> <string name="launch_app_list_default">None</string> <string name="tcp_timeout_label">TCP Connect Timeout (ms)</string> <string name="confirm_dialog_confirm">Yes</string> <string name="confirm_dialog_cancel">No</string> <string name="confirm_dialog_delete_host_title">Delete host?</string> <string name="confirm_dialog_cancel_edit_title">Discard changes?</string> <string name="progress_dialog_retrieving_applications">Retrieving applications&#8230;</string> <string name="progress_dialog_sending_packets">Sending packets&#8230;</string> <string name="pref_key_hide_ports">hide_ports</string> <string name="pref_key_hide_ports_title">Hide ports in host list</string> <string name="pref_key_hide_ports_summary">Port sequence will not be displayed in the host list</string> <string name="pref_key_hide_ports_widget">hide_ports_widget</string> <string name="pref_key_hide_ports_widget_title">Hide ports in widget</string> <string name="pref_key_hide_ports_widget_summary">Port sequence will not be displayed in widgets</string> <string name="pref_key_hide_ports_category_title">Miscellaneous</string> <string name="settings_subtitle">Settings</string> <string name="empty_list">There are no items</string> <string name="toast_msg_delete_all_ports">"Can't delete all ports"</string> <string name="toast_msg_enter_label">Please enter a label</string> <string name="toast_msg_enter_hostname">Please enter a hostname</string> <string name="toast_msg_invalid_hostname">Invalid hostname/IP</string> <string name="toast_msg_enter_port">Please enter at least one port</string> <string name="toast_msg_delay_max_value">"Delay can't be more than "</string> <string name="toast_msg_invalid_port">"Invalid port: "</string> <string name="toast_msg_save_success">Saved</string> <string name="toast_msg_save_failure">Save failed</string> <string name="toast_msg_knocking_complete">Knocking complete</string> <string name="toast_msg_knocking_canceled">Knocking canceled</string> <string name="toast_msg_knocking_failed">"Knocking failed: "</string> <string name="toast_msg_import_from_file_success">"Imported hosts from file: "</string> <string name="toast_msg_import_error">"Importing hosts failed: "</string> <string name="toast_msg_no_permission_for_external_mem_access">No permission to access external memory.</string> <string name="menu_item_settings_title">Settings</string> <string name="menu_item_export_title">Export Hosts</string> <string name="menu_item_import_title">Import Hosts</string> <string name="menu_item_send_title">Send Hosts</string> <string name="menu_item_sort_title">Sort Hosts</string> <string name="menu_item_sort_hostname_title">By hostname</string> <string name="menu_item_sort_label_title">By label</string> <string name="menu_item_sort_newest_title">By newest</string> <string name="export_host_dialog_title">Export Hosts</string> <string name="export_host_dialog_message">Enter filename</string> <string name="export_host_dialog_ok_button">OK</string> <string name="export_host_dialog_cancel_button">Cancel</string> <string name="export_host_dialog_export_complete">"Exported hosts to file: "</string> <string name="export_host_dialog_export_failure">"Exporting hosts failed: "</string> <string name="share_dialog_chooser_title">"Share with... "</string> </resources>
{ "content_hash": "05a1c1499e79c6daf6b814ba459e3d7f", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 116, "avg_line_length": 66.07352941176471, "alnum_prop": 0.7168929445804585, "repo_name": "xargsgrep/PortKnocker", "id": "a77dd7ba4da86078f0001d367510d6f0d90d6c16", "size": "4493", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/values/strings.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "178507" } ], "symlink_target": "" }
<!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 (1.8.0_112) on Mon May 01 08:43:56 MST 2017 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.wildfly.swarm.config.security.security_domain.authentication.LoginModuleStack.LoginModuleStackResources (Public javadocs 2017.5.0 API)</title> <meta name="date" content="2017-05-01"> <link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.wildfly.swarm.config.security.security_domain.authentication.LoginModuleStack.LoginModuleStackResources (Public javadocs 2017.5.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.LoginModuleStackResources.html" title="class in org.wildfly.swarm.config.security.security_domain.authentication">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">WildFly Swarm API, 2017.5.0</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/security/security_domain/authentication/class-use/LoginModuleStack.LoginModuleStackResources.html" target="_top">Frames</a></li> <li><a href="LoginModuleStack.LoginModuleStackResources.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.wildfly.swarm.config.security.security_domain.authentication.LoginModuleStack.LoginModuleStackResources" class="title">Uses of Class<br>org.wildfly.swarm.config.security.security_domain.authentication.LoginModuleStack.LoginModuleStackResources</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.LoginModuleStackResources.html" title="class in org.wildfly.swarm.config.security.security_domain.authentication">LoginModuleStack.LoginModuleStackResources</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.security.security_domain.authentication">org.wildfly.swarm.config.security.security_domain.authentication</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.security.security_domain.authentication"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.LoginModuleStackResources.html" title="class in org.wildfly.swarm.config.security.security_domain.authentication">LoginModuleStack.LoginModuleStackResources</a> in <a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/package-summary.html">org.wildfly.swarm.config.security.security_domain.authentication</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/package-summary.html">org.wildfly.swarm.config.security.security_domain.authentication</a> that return <a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.LoginModuleStackResources.html" title="class in org.wildfly.swarm.config.security.security_domain.authentication">LoginModuleStack.LoginModuleStackResources</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.LoginModuleStackResources.html" title="class in org.wildfly.swarm.config.security.security_domain.authentication">LoginModuleStack.LoginModuleStackResources</a></code></td> <td class="colLast"><span class="typeNameLabel">LoginModuleStack.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.html#subresources--">subresources</a></span>()</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../org/wildfly/swarm/config/security/security_domain/authentication/LoginModuleStack.LoginModuleStackResources.html" title="class in org.wildfly.swarm.config.security.security_domain.authentication">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">WildFly Swarm API, 2017.5.0</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/security/security_domain/authentication/class-use/LoginModuleStack.LoginModuleStackResources.html" target="_top">Frames</a></li> <li><a href="LoginModuleStack.LoginModuleStackResources.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2017 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
{ "content_hash": "b3d82c6dab39d2233acb7e67340439d0", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 553, "avg_line_length": 51.38095238095238, "alnum_prop": 0.6709916589434661, "repo_name": "wildfly-swarm/wildfly-swarm-javadocs", "id": "8432ed2bc1fa0d9536672fb6d1e28da43dd0260f", "size": "8632", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "2017.5.0/apidocs/org/wildfly/swarm/config/security/security_domain/authentication/class-use/LoginModuleStack.LoginModuleStackResources.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
{% extends "v9/layoutv9.html" %} {% set title = "Reset your password" %} {% block page_title %} {{title}} - GOV.UK {% endblock %} {% block content %} <main id="content" role="main"> <div class="phase-banner-beta"> <p> <strong class="phase-tag">BETA</strong> <span>This is an BETA prototype, details may be missing whilst we build the service. Your feedback will help us improve this service.</span> </p> </div> <div class="grid-row"> <div class="column-two-thirds"> <a href="#" class="link-back" onclick="history.go(-1)">Back</a> <form action="/v12_2/pages/changed_mobile_number_conf" method="get" class="form" id="password_reset" data-parsley-validate="" data-parsley-errors-messages-disabled> <div class="error-summary hidden" role="alert" aria-labelledby="error-summary-heading-example-2" tabindex="-1"> <h2 class="heading-medium error-summary-heading" id="error-summary-heading-example-2"> That mobile phone number isn’t valid </h2> <ul class="error-summary-list"> <li><a href="#user-id">Re-enter your mobile phone number</a></li> </ul> </div> <h1 class="heading-large"> Check this is correct </h1> <div class="form-group"> <label for="user-id"> <fieldset> <span class="form-label-bold">Mobile number</span> <span data-parsely-id="user-id" class="error-message hidden">Please enter a valid mobile phone number</span> </fieldset> </label> <input type="tel" class="form-control" id="user-id" name="user_id" data-parsley-pattern="^[\d\+\-\.\(\)\/\s]*$" required=""/> </div> <p class="lede">That's all the information we need for now.</p> <input type="submit" value="View licences" class="button button-start" role="button"/> </form> <script> function getParameterByName(name, url) { //this function enables named parameters to be parsed from the query string if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } //get the user-id value from the query string if present and set user-id field to same... document.getElementById('user-id').value = getParameterByName('user_id'); </script> </div> </div> </main> {% endblock %}
{ "content_hash": "4ccceb115e26d8e5c35bf4b7d8013d1a", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 166, "avg_line_length": 33.0253164556962, "alnum_prop": 0.5940973553085473, "repo_name": "christinagyles-ea/water", "id": "7a98056795363ed713d6931c818c4b9658c63e5f", "size": "2611", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/v6/views/v12_3/pages/check_mobile_number.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "7565" }, { "name": "HTML", "bytes": "291991" }, { "name": "JavaScript", "bytes": "39109" }, { "name": "Shell", "bytes": "1495" } ], "symlink_target": "" }
#include <string.h> #include "nrf_error.h" #include "app_util.h" #include "nfc_ndef_record.h" /** * @brief Type of description of payload of Windows LaunchApp record. */ typedef struct { const uint8_t * platform; uint8_t platform_length; const uint8_t * app_id; uint8_t app_id_length; } win_launchapp_payload_desc_t; /** @brief Description of payload of Windows LaunchApp record. */ static win_launchapp_payload_desc_t m_win_launchapp_dsc; static const uint8_t launchapp_type_str[] = {'a', 'n', 'd', 'r', 'o', 'i', 'd', '.', 'c', 'o', 'm', ':', 'p', 'k', 'g'}; static const uint8_t win_launchapp_type_str[] = {'w', 'i', 'n', 'd', 'o', 'w', 's', '.', 'c', 'o', 'm', '/', 'L', 'a', 'u', 'n', 'c', 'h', 'A', 'p', 'p'}; static const uint8_t win_phone_str[] = {'W', 'i', 'n', 'd', 'o', 'w', 's', 'P', 'h', 'o', 'n', 'e'}; nfc_ndef_record_desc_t * nfc_android_application_rec_declare(uint8_t const * p_package_name, uint8_t package_name_length) { NFC_NDEF_RECORD_BIN_DATA_DEF(android_app_rec, TNF_EXTERNAL_TYPE, // tnf <- external NULL, // no id 0, // no id launchapp_type_str, sizeof(launchapp_type_str), NULL, 0); NFC_NDEF_BIN_PAYLOAD_DESC(android_app_rec).p_payload = p_package_name; NFC_NDEF_BIN_PAYLOAD_DESC(android_app_rec).payload_length = package_name_length; return &NFC_NDEF_RECORD_BIN_DATA(android_app_rec); } #define WIN_LAUNCHAPP_EMPTY_PARAMETER 0x20 ///< The empty parameter value for the Windows LaunchApp Record. /** * @brief Function for constructing the payload for a Windows LaunchApp record. * * This function encodes the payload according to the LaunchApp record definition. It implements an API * compatible with p_payload_constructor_t. * * @param[in] p_input Pointer to the description of the payload. * @param[out] p_buff Pointer to payload destination. If NULL, function will * calculate the expected size of the LaunchApp record payload. * * @param[in,out] p_len Size of available memory to write as input. Size of generated * payload as output. * * @retval NRF_SUCCESS Always success. */ static ret_code_t nfc_win_launchapp_payload_constructor(win_launchapp_payload_desc_t * p_input, uint8_t * p_buff, uint32_t * p_len) { win_launchapp_payload_desc_t * launch_desc = (win_launchapp_payload_desc_t *) p_input; uint32_t temp_len = (uint32_t)launch_desc->platform_length + launch_desc->app_id_length + 7; if (p_buff != NULL) { if (temp_len > *p_len) { return NRF_ERROR_NO_MEM; } *p_buff++ = 0x00; // platform count: 1 *p_buff++ = 0x01; // -||- *p_buff++ = launch_desc->platform_length; memcpy(p_buff, launch_desc->platform, launch_desc->platform_length); // platform p_buff += launch_desc->platform_length; *p_buff++ = launch_desc->app_id_length; memcpy(p_buff, launch_desc->app_id, launch_desc->app_id_length); p_buff += launch_desc->app_id_length; *p_buff++ = 0x00; // parameters length 1B *p_buff++ = 0x01; // -||- *p_buff++ = WIN_LAUNCHAPP_EMPTY_PARAMETER; // empty parameter } *p_len = temp_len; return NRF_SUCCESS; } nfc_ndef_record_desc_t * nfc_windows_launchapp_rec_declare(const uint8_t * p_win_app_id, uint8_t win_app_id_length) { NFC_NDEF_GENERIC_RECORD_DESC_DEF(win_launchapp, TNF_ABSOLUTE_URI, NULL, 0, win_launchapp_type_str, sizeof(win_launchapp_type_str), nfc_win_launchapp_payload_constructor, &m_win_launchapp_dsc); m_win_launchapp_dsc.platform = win_phone_str; m_win_launchapp_dsc.platform_length = sizeof(win_phone_str); m_win_launchapp_dsc.app_id = p_win_app_id; m_win_launchapp_dsc.app_id_length = win_app_id_length; return &NFC_NDEF_GENERIC_RECORD_DESC(win_launchapp); }
{ "content_hash": "5d9ae7d911de8b794b41ae6b7fa28685", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 107, "avg_line_length": 37.96031746031746, "alnum_prop": 0.5088856366297303, "repo_name": "wolfgangz2013/rt-thread", "id": "b4bb8d0d2a53ac5d89ccc0452ea309e9ec7fc860", "size": "6820", "binary": false, "copies": "15", "ref": "refs/heads/master", "path": "bsp/nrf52832/nRF5_SDK_13.0.0_04a0bfd/components/nfc/ndef/launchapp/nfc_launchapp_rec.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "16995634" }, { "name": "Batchfile", "bytes": "179660" }, { "name": "C", "bytes": "705913788" }, { "name": "C++", "bytes": "7764376" }, { "name": "CMake", "bytes": "148026" }, { "name": "CSS", "bytes": "9978" }, { "name": "DIGITAL Command Language", "bytes": "13234" }, { "name": "GDB", "bytes": "11796" }, { "name": "HTML", "bytes": "6039932" }, { "name": "Lex", "bytes": "7026" }, { "name": "Logos", "bytes": "7078" }, { "name": "M4", "bytes": "17515" }, { "name": "Makefile", "bytes": "268009" }, { "name": "Module Management System", "bytes": "1548" }, { "name": "Objective-C", "bytes": "4093973" }, { "name": "Pawn", "bytes": "1427" }, { "name": "Perl", "bytes": "9520" }, { "name": "Python", "bytes": "1203710" }, { "name": "RPC", "bytes": "14162" }, { "name": "Roff", "bytes": "4486" }, { "name": "Ruby", "bytes": "869" }, { "name": "Shell", "bytes": "407723" }, { "name": "TeX", "bytes": "3113" }, { "name": "Yacc", "bytes": "16084" } ], "symlink_target": "" }
package org.kuali.kra.scheduling.expr; import org.kuali.kra.scheduling.expr.util.CronSpecialChars; import org.kuali.kra.scheduling.util.Time24HrFmt; import java.text.ParseException; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; /** * This class extends CronExpression and provides MonthDayOrLastDayMultipleYearsCronExpression implementation. * <p> * This implementation generates expression for monthly scheduling dates using day of month and month. * * This is different from MonthDayCronExpression in a way that this generates dates between multiple years. * * day of month: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 * if 29 or greater is supplied, the last day of the month will be used. * * month: 1,2,3,4,5,6,7,8,9,10,11,12 * * Note: Start day is skipped, date boundary is handled by ScheduleSequence implementation during schedule generation. * * e.g. Start Date : 02/24/09, Time : 10:10 (hh:mm) Format (second minute hour day month year) Generated Expression :0 10 10 1 * ? * Explanation: Generate dates for 1st day of each month at 10:10 (hh:mm), starting from the start date to end date * * */ public class MonthDayOrLastDayMultipleYearsCronExpression extends CronExpression { /** * There are at least 28 days in every month, so this is the cut over point. */ protected static final Integer MAXIMUM_DAY_VALUE = 28; private Integer day; /** * * Constructs a MonthDayOrLastDayMultipleYearsCronExpression.java. * @param startDate * @param time * @param day * @throws ParseException */ public MonthDayOrLastDayMultipleYearsCronExpression(Date startDate, Time24HrFmt time, Integer day) throws ParseException { super(startDate, time); this.day = day; } @Override public String getExpression() { Calendar stDt = new GregorianCalendar(); stDt.setTime(getStartDate()); StringBuilder exp = new StringBuilder(); exp.append(SECONDS).append(CronSpecialChars.SPACE); exp.append(getTime().getMinutes()).append(CronSpecialChars.SPACE); exp.append(getTime().getHours()).append(CronSpecialChars.SPACE); if (day > MAXIMUM_DAY_VALUE) { exp.append("L"); } else { exp.append(day); } exp.append(CronSpecialChars.SPACE); exp.append(CronSpecialChars.STAR).append(CronSpecialChars.SPACE); exp.append(CronSpecialChars.QUESTION).append(CronSpecialChars.SPACE); System.err.println("MonthDayMultipleYearsCronExpression getExpression: " + exp.toString()); return exp.toString(); } }
{ "content_hash": "9f3731fe42ba5789eaa70466fa3dfc74", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 129, "avg_line_length": 35.723684210526315, "alnum_prop": 0.6987108655616943, "repo_name": "vivantech/kc_fixes", "id": "449f4d7d0dbf38f6c307585ce4e5d5e18e80937a", "size": "3338", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/org/kuali/kra/scheduling/expr/MonthDayOrLastDayMultipleYearsCronExpression.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "595" }, { "name": "CSS", "bytes": "1277181" }, { "name": "HTML", "bytes": "21478104" }, { "name": "Java", "bytes": "25178010" }, { "name": "JavaScript", "bytes": "7250670" }, { "name": "PHP", "bytes": "15534" }, { "name": "PLSQL", "bytes": "374321" }, { "name": "Perl", "bytes": "1278" }, { "name": "Scheme", "bytes": "8283377" }, { "name": "Shell", "bytes": "1100" }, { "name": "XSLT", "bytes": "17866049" } ], "symlink_target": "" }
package common import ( "net" "sync" "time" "github.com/golang/glog" networkapi "github.com/openshift/origin/pkg/network/apis/network" ktypes "k8s.io/apimachinery/pkg/types" kexec "k8s.io/kubernetes/pkg/util/exec" ) type EgressDNSUpdate struct { UID ktypes.UID Namespace string } type EgressDNS struct { // Protects pdMap/namespaces operations lock sync.Mutex // Holds Egress DNS entries for each policy pdMap map[ktypes.UID]*DNS // Maintain namespaces for each policy to avoid querying etcd in syncEgressDNSPolicyRules() namespaces map[ktypes.UID]string // Report change when Add operation is done added chan bool // Report changes when there are dns updates Updates chan EgressDNSUpdate } func NewEgressDNS() *EgressDNS { return &EgressDNS{ pdMap: map[ktypes.UID]*DNS{}, namespaces: map[ktypes.UID]string{}, added: make(chan bool), Updates: make(chan EgressDNSUpdate), } } func (e *EgressDNS) Add(policy networkapi.EgressNetworkPolicy) { dnsInfo := NewDNS(kexec.New()) for _, rule := range policy.Spec.Egress { if len(rule.To.DNSName) > 0 { if err := dnsInfo.Add(rule.To.DNSName); err != nil { glog.Error(err) } } } if dnsInfo.Size() > 0 { e.lock.Lock() defer e.lock.Unlock() e.pdMap[policy.UID] = dnsInfo e.namespaces[policy.UID] = policy.Namespace e.signalAdded() } } func (e *EgressDNS) Delete(policy networkapi.EgressNetworkPolicy) { e.lock.Lock() defer e.lock.Unlock() if _, ok := e.pdMap[policy.UID]; ok { delete(e.pdMap, policy.UID) delete(e.namespaces, policy.UID) } } func (e *EgressDNS) Update(policyUID ktypes.UID) (error, bool) { e.lock.Lock() defer e.lock.Unlock() if dnsInfo, ok := e.pdMap[policyUID]; ok { return dnsInfo.Update() } return nil, false } func (e *EgressDNS) Sync() { var duration time.Duration for { tm, policyUID, policyNamespace, ok := e.GetMinQueryTime() if !ok { duration = 30 * time.Minute } else { now := time.Now() if tm.After(now) { // Item needs to wait for this duration before it can be processed duration = tm.Sub(now) } else { err, changed := e.Update(policyUID) if err != nil { glog.Error(err) } if changed { e.Updates <- EgressDNSUpdate{policyUID, policyNamespace} } continue } } // Wait for the given duration or till something got added select { case <-e.added: case <-time.After(duration): } } } func (e *EgressDNS) GetMinQueryTime() (time.Time, ktypes.UID, string, bool) { e.lock.Lock() defer e.lock.Unlock() timeSet := false var minTime time.Time var uid ktypes.UID for policyUID, dnsInfo := range e.pdMap { tm, ok := dnsInfo.GetMinQueryTime() if !ok { continue } if (timeSet == false) || tm.Before(minTime) { timeSet = true minTime = tm uid = policyUID } } return minTime, uid, e.namespaces[uid], timeSet } func (e *EgressDNS) GetIPs(policy networkapi.EgressNetworkPolicy, dnsName string) []net.IP { e.lock.Lock() defer e.lock.Unlock() dnsInfo, ok := e.pdMap[policy.UID] if !ok { return []net.IP{} } return dnsInfo.Get(dnsName).ips } func (e *EgressDNS) GetNetCIDRs(policy networkapi.EgressNetworkPolicy, dnsName string) []net.IPNet { cidrs := []net.IPNet{} for _, ip := range e.GetIPs(policy, dnsName) { // IPv4 CIDR cidrs = append(cidrs, net.IPNet{IP: ip, Mask: net.CIDRMask(32, 32)}) } return cidrs } func (e *EgressDNS) signalAdded() { // Non-blocking op select { case e.added <- true: default: } }
{ "content_hash": "e9fd03bb2c69182e567aa3ac0155c102", "timestamp": "", "source": "github", "line_count": 167, "max_line_length": 100, "avg_line_length": 20.982035928143713, "alnum_prop": 0.6712328767123288, "repo_name": "rootfs/origin", "id": "1dee42793d3a17f493d60d975293d3983716a661", "size": "3504", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "pkg/network/common/egress_dns.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "1842" }, { "name": "DIGITAL Command Language", "bytes": "117" }, { "name": "Go", "bytes": "20191365" }, { "name": "Groovy", "bytes": "5024" }, { "name": "HTML", "bytes": "74732" }, { "name": "Makefile", "bytes": "24477" }, { "name": "Protocol Buffer", "bytes": "665814" }, { "name": "Python", "bytes": "34060" }, { "name": "Roff", "bytes": "2049" }, { "name": "Ruby", "bytes": "484" }, { "name": "Shell", "bytes": "2199805" }, { "name": "Smarty", "bytes": "626" } ], "symlink_target": "" }
<?php namespace app\models; use Yii; use \yii\db\ActiveRecord; use yii\web\UploadedFile; /** * This is the model class for table "book". * * @property integer $id * @property string $name * @property integer $date_create * @property integer $date_update * @property integer $date_release * @property integer $author_id * @property string $preview * * @property Author $author */ class Book extends ActiveRecord { /** * @var UploadedFile */ public $imageFile; /** * @inheritdoc */ public static function tableName() { return 'book'; } /** * @inheritdoc */ public function rules() { return [ [['name', 'author_id'], 'required'], [['date_create', 'date_update', 'author_id'], 'integer'], [['name'], 'string', 'max' => 161], [['preview'], 'string', 'max' => 255], [['date_release'], 'safe'], // [['imageFile'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'name' => 'Name', 'date_create' => 'Date Create', 'date_update' => 'Date Update', 'date_release' => 'Date Release', 'author_id' => 'Author ID', 'preview' => 'Preview', ]; } public function behaviors() { return [ 'timestamp' => [ 'class' => 'yii\behaviors\TimestampBehavior', 'createdAtAttribute' => 'date_create', 'updatedAtAttribute' => 'date_update', 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['date_create', 'date_update'], ActiveRecord::EVENT_BEFORE_UPDATE => ['date_update'], ], ], ]; } /** * @return \yii\db\ActiveQuery */ public function getAuthor() { return $this->hasOne(Author::className(), ['id' => 'author_id']); } public function beforeValidate() { if (parent::beforeValidate()) { $this->date_release = \Yii::$app->formatter->asDate($this->date_release, 'php:U'); $this->imageFile = UploadedFile::getInstance($this, 'imageFile'); if ($this->imageFile) { $name = md5(microtime()); $this->imageFile->saveAs(\Yii::getAlias('@webroot') . '/uploads/' . $name . '.' . $this->imageFile->extension); $this->preview = $name . '.' . $this->imageFile->extension; } return true; } else { return false; } } public function getImageurl() { return \Yii::getAlias('@webroot') . '/uploads/' . $this->preview; } public function getAuthorName() { $author = $this->getAuthor()->one(); return $author->first_name . ' ' . $author->last_name; } }
{ "content_hash": "b240a40082cc2f31b5daf18d0c2a9d14", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 127, "avg_line_length": 26.042735042735043, "alnum_prop": 0.4906465375779455, "repo_name": "kristinababich/test-project", "id": "7bf2ccc7ebfc8fffced818e62c4c07d62551d7a4", "size": "3047", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "models/Book.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "1030" }, { "name": "CSS", "bytes": "1364" }, { "name": "JavaScript", "bytes": "310" }, { "name": "PHP", "bytes": "66767" } ], "symlink_target": "" }
from orgmode import ORGMODE, apply_count, repeat, realign_tags from orgmode import settings from orgmode.exceptions import HeadingDomError from orgmode.keybinding import Keybinding, Plug, MODE_INSERT, MODE_NORMAL from orgmode.menu import Submenu, Separator, ActionEntry from orgmode.liborgmode.base import Direction from orgmode.liborgmode.headings import Heading import vim class EditStructure(object): u""" EditStructure plugin """ def __init__(self): u""" Initialize plugin """ object.__init__(self) # menu entries this plugin should create self.menu = ORGMODE.orgmenu + Submenu(u'&Edit Structure') # key bindings for this plugin # key bindings are also registered through the menu so only additional # bindings should be put in this variable self.keybindings = [] @classmethod def new_heading(cls, below=None, insert_mode=False, end_of_last_child=False): u""" :below: True, insert heading below current heading, False, insert heading above current heading, None, special behavior for insert mode, use the current text as heading :insert_mode: True, if action is performed in insert mode :end_of_last_child: True, insert heading at the end of last child, otherwise the newly created heading will "take over" the current heading's children """ d = ORGMODE.get_document() current_heading = d.current_heading() cursor = vim.current.window.cursor[:] if not current_heading: # the user is in meta data region pos = cursor[0] - 1 heading = Heading(title=d.meta_information[pos], body=d.meta_information[pos + 1:]) d.headings.insert(0, heading) del d.meta_information[pos:] d.write() vim.command((u'exe "normal %dgg"|startinsert!' % (heading.start_vim, )).encode(u'utf-8')) return heading heading = Heading(level=current_heading.level) # it's weird but this is the behavior of original orgmode if below is None: below = cursor[1] != 0 or end_of_last_child # insert newly created heading l = current_heading.get_parent_list() idx = current_heading.get_index_in_parent_list() if l is not None and idx is not None: l.insert(idx + (1 if below else 0), heading) else: raise HeadingDomError(u'Current heading is not properly linked in DOM') if below and not end_of_last_child: # append heading at the end of current heading and also take # over the children of current heading for child in current_heading.children: heading.children.append(child, taint=False) current_heading.children.remove_slice(0, len(current_heading.children), \ taint=False) # if cursor is currently on a heading, insert parts of it into the # newly created heading if insert_mode and cursor[1] != 0 and cursor[0] == current_heading.start_vim: offset = cursor[1] - current_heading.level - 1 - (len(current_heading.todo) \ + 1 if current_heading.todo else 0) if offset < 0: offset = 0 if int(settings.get(u'org_improve_split_heading', u'1')) and \ offset > 0 and len(current_heading.title) == offset + 1 \ and current_heading.title[offset - 1] not in (u' ', u'\t'): offset += 1 heading.title = current_heading.title[offset:] current_heading.title = current_heading.title[:offset] heading.body = current_heading.body[:] current_heading.body = [] d.write() vim.command((u'exe "normal %dgg"|startinsert!' % (heading.start_vim, )).encode(u'utf-8')) # return newly created heading return heading @classmethod def _append_heading(cls, heading, parent): if heading.level <= parent.level: raise ValueError('Heading level not is lower than parent level: %d ! > %d' % (heading.level, parent.level)) if parent.children and parent.children[-1].level < heading.level: cls._append_heading(heading, parent.children[-1]) else: parent.children.append(heading, taint=False) @classmethod def _change_heading_level(cls, level, including_children=True, on_heading=False, insert_mode=False): u""" Change level of heading realtively with or without including children. :level: the number of levels to promote/demote heading :including_children: True if should should be included in promoting/demoting :on_heading: True if promoting/demoting should only happen when the cursor is on the heading :insert_mode: True if vim is in insert mode """ d = ORGMODE.get_document() current_heading = d.current_heading() if not current_heading or on_heading and current_heading.start_vim != vim.current.window.cursor[0]: # TODO figure out the actually pressed keybinding and feed these # keys instead of making keys up like this if level > 0: if insert_mode: vim.eval(u'feedkeys("\<C-t>", "n")'.encode(u'utf-8')) elif including_children: vim.eval(u'feedkeys(">]]", "n")'.encode(u'utf-8')) elif on_heading: vim.eval(u'feedkeys(">>", "n")'.encode(u'utf-8')) else: vim.eval(u'feedkeys(">}", "n")'.encode(u'utf-8')) else: if insert_mode: vim.eval(u'feedkeys("\<C-d>", "n")'.encode(u'utf-8')) elif including_children: vim.eval(u'feedkeys("<]]", "n")'.encode(u'utf-8')) elif on_heading: vim.eval(u'feedkeys("<<", "n")'.encode(u'utf-8')) else: vim.eval(u'feedkeys("<}", "n")'.encode(u'utf-8')) # return True because otherwise apply_count will not work return True # don't allow demotion below level 1 if current_heading.level == 1 and level < 1: return False # reduce level of demotion to a minimum heading level of 1 if (current_heading.level + level) < 1: level = 1 def indent(heading, ic): if not heading: return heading.level += level if ic: for child in heading.children: indent(child, ic) # save cursor position c = vim.current.window.cursor[:] # indent the promoted/demoted heading indent_end_vim = current_heading.end_of_last_child_vim if including_children else current_heading.end_vim indent(current_heading, including_children) # when changing the level of a heading, its position in the DOM # needs to be updated. It's likely that the heading gets a new # parent and new children when demoted or promoted # find new parent p = current_heading.parent pl = current_heading.get_parent_list() ps = current_heading.previous_sibling nhl = current_heading.level if level > 0: # demotion # subheading or top level heading if ps and nhl > ps.level: pl.remove(current_heading, taint=False) # find heading that is the new parent heading oh = ps h = ps while nhl > h.level: oh = h if h.children: h = h.children[-1] else: break np = h if nhl > h.level else oh # append current heading to new heading np.children.append(current_heading, taint=False) # if children are not included, distribute them among the # parent heading and it's siblings if not including_children: for h in current_heading.children[:]: if h and h.level <= nhl: cls._append_heading(h, np) current_heading.children.remove(h, taint=False) else: # promotion if p and nhl <= p.level: idx = current_heading.get_index_in_parent_list() + 1 # find the new parent heading oh = p h = p while nhl <= h.level: # append new children to current heading for child in h.children[idx:]: cls._append_heading(child, current_heading) h.children.remove_slice(idx, len(h.children), taint=False) idx = h.get_index_in_parent_list() + 1 if h.parent: h = h.parent else: break ns = oh.next_sibling while ns and ns.level > current_heading.level: nns = ns.next_sibling cls._append_heading(ns, current_heading) ns = nns # append current heading to new parent heading / document pl.remove(current_heading, taint=False) if nhl > h.level: h.children.insert(idx, current_heading, taint=False) else: d.headings.insert(idx, current_heading, taint=False) d.write() if indent_end_vim != current_heading.start_vim: vim.command((u'normal %dggV%dgg=' % (current_heading.start_vim, indent_end_vim)).encode(u'utf-8')) # restore cursor position vim.current.window.cursor = (c[0], c[1] + level) return True @classmethod @realign_tags @repeat @apply_count def demote_heading(cls, including_children=True, on_heading=False, insert_mode=False): if cls._change_heading_level(1, including_children=including_children, on_heading=on_heading, insert_mode=insert_mode): if including_children: return u'OrgDemoteSubtree' return u'OrgDemoteHeading' @classmethod @realign_tags @repeat @apply_count def promote_heading(cls, including_children=True, on_heading=False, insert_mode=False): if cls._change_heading_level(-1, including_children=including_children, on_heading=on_heading, insert_mode=insert_mode): if including_children: return u'OrgPromoteSubtreeNormal' return u'OrgPromoteHeadingNormal' @classmethod def _move_heading(cls, direction=Direction.FORWARD, including_children=True): u""" Move heading up or down :returns: heading or None """ d = ORGMODE.get_document() current_heading = d.current_heading() if not current_heading or \ (direction == Direction.FORWARD and not current_heading.next_sibling) or \ (direction == Direction.BACKWARD and not current_heading.previous_sibling): return None cursor_offset = vim.current.window.cursor[0] - (current_heading._orig_start + 1) l = current_heading.get_parent_list() if l is None: raise HeadingDomError(u'Current heading is not properly linked in DOM') if not including_children: if current_heading.previous_sibling: npl = current_heading.previous_sibling.children for child in current_heading.children: npl.append(child, taint=False) elif current_heading.parent: # if the current heading doesn't have a previous sibling it # must be the first heading np = current_heading.parent for child in current_heading.children: cls._append_heading(child, np) else: # if the current heading doesn't have a parent, its children # must be added as top level headings to the document npl = l for child in current_heading.children[::-1]: npl.insert(0, child, taint=False) current_heading.children.remove_slice(0, len(current_heading.children), taint=False) idx = current_heading.get_index_in_parent_list() if idx is None: raise HeadingDomError(u'Current heading is not properly linked in DOM') offset = 1 if direction == Direction.FORWARD else -1 del l[idx] l.insert(idx + offset, current_heading) d.write() vim.current.window.cursor = (current_heading.start_vim + cursor_offset, \ vim.current.window.cursor[1]) return True @classmethod @repeat @apply_count def move_heading_upward(cls, including_children=True): if cls._move_heading(direction=Direction.BACKWARD, including_children=including_children): if including_children: return u'OrgMoveSubtreeUpward' return u'OrgMoveHeadingUpward' @classmethod @repeat @apply_count def move_heading_downward(cls, including_children=True): if cls._move_heading(direction=Direction.FORWARD, including_children=including_children): if including_children: return u'OrgMoveSubtreeDownward' return u'OrgMoveHeadingDownward' def register(self): u""" Registration of plugin. Key bindings and other initialization should be done. """ settings.set(u'org_improve_split_heading', u'1') self.keybindings.append(Keybinding(u'<C-S-CR>', Plug(u'OrgNewHeadingAboveNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=False)<CR>'))) self.menu + ActionEntry(u'New Heading &above', self.keybindings[-1]) self.keybindings.append(Keybinding(u'<S-CR>', Plug(u'OrgNewHeadingBelowNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=True)<CR>'))) self.menu + ActionEntry(u'New Heading &below', self.keybindings[-1]) self.keybindings.append(Keybinding(u'<C-CR>', Plug(u'OrgNewHeadingBelowAfterChildrenNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=True, end_of_last_child=True)<CR>'))) self.menu + ActionEntry(u'New Heading below, after &children', self.keybindings[-1]) self.keybindings.append(Keybinding(u'<C-S-CR>', Plug(u'OrgNewHeadingAboveInsert', u'<C-o>:<C-u>silent! py ORGMODE.plugins[u"EditStructure"].new_heading(below=False, insert_mode=True)<CR>', mode=MODE_INSERT))) self.keybindings.append(Keybinding(u'<S-CR>', Plug(u'OrgNewHeadingBelowInsert', u'<C-o>:<C-u>silent! py ORGMODE.plugins[u"EditStructure"].new_heading(insert_mode=True)<CR>', mode=MODE_INSERT))) self.keybindings.append(Keybinding(u'<C-CR>', Plug(u'OrgNewHeadingBelowAfterChildrenInsert', u'<C-o>:<C-u>silent! py ORGMODE.plugins[u"EditStructure"].new_heading(insert_mode=True, end_of_last_child=True)<CR>', mode=MODE_INSERT))) self.menu + Separator() self.keybindings.append(Keybinding(u'm{', Plug(u'OrgMoveHeadingUpward', u':py ORGMODE.plugins[u"EditStructure"].move_heading_upward(including_children=False)<CR>'))) self.keybindings.append(Keybinding(u'm[[', Plug(u'OrgMoveSubtreeUpward', u':py ORGMODE.plugins[u"EditStructure"].move_heading_upward()<CR>'))) self.menu + ActionEntry(u'Move Subtree &Up', self.keybindings[-1]) self.keybindings.append(Keybinding(u'm}', Plug(u'OrgMoveHeadingDownward', u':py ORGMODE.plugins[u"EditStructure"].move_heading_downward(including_children=False)<CR>'))) self.keybindings.append(Keybinding(u'm]]', Plug(u'OrgMoveSubtreeDownward', u':py ORGMODE.plugins[u"EditStructure"].move_heading_downward()<CR>'))) self.menu + ActionEntry(u'Move Subtree &Down', self.keybindings[-1]) self.menu + Separator() self.menu + ActionEntry(u'&Copy Heading', u'yah', u'yah') self.menu + ActionEntry(u'C&ut Heading', u'dah', u'dah') self.menu + Separator() self.menu + ActionEntry(u'&Copy Subtree', u'yar', u'yar') self.menu + ActionEntry(u'C&ut Subtree', u'dar', u'dar') self.menu + ActionEntry(u'&Paste Subtree', u'p', u'p') self.menu + Separator() self.keybindings.append(Keybinding(u'<ah', Plug(u'OrgPromoteHeadingNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False)<CR>'))) self.menu + ActionEntry(u'&Promote Heading', self.keybindings[-1]) self.keybindings.append(Keybinding(u'<<', Plug(u'OrgPromoteOnHeadingNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True)<CR>'))) self.keybindings.append(Keybinding(u'<{', u'<Plug>OrgPromoteHeadingNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'<ih', u'<Plug>OrgPromoteHeadingNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'<ar', Plug(u'OrgPromoteSubtreeNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].promote_heading()<CR>'))) self.menu + ActionEntry(u'&Promote Subtree', self.keybindings[-1]) self.keybindings.append(Keybinding(u'<[[', u'<Plug>OrgPromoteSubtreeNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'<ir', u'<Plug>OrgPromoteSubtreeNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'>ah', Plug(u'OrgDemoteHeadingNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False)<CR>'))) self.menu + ActionEntry(u'&Demote Heading', self.keybindings[-1]) self.keybindings.append(Keybinding(u'>>', Plug(u'OrgDemoteOnHeadingNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True)<CR>'))) self.keybindings.append(Keybinding(u'>}', u'>Plug>OrgDemoteHeadingNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'>ih', u'>Plug>OrgDemoteHeadingNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'>ar', Plug(u'OrgDemoteSubtreeNormal', u':silent! py ORGMODE.plugins[u"EditStructure"].demote_heading()<CR>'))) self.menu + ActionEntry(u'&Demote Subtree', self.keybindings[-1]) self.keybindings.append(Keybinding(u'>]]', u'<Plug>OrgDemoteSubtreeNormal', mode=MODE_NORMAL)) self.keybindings.append(Keybinding(u'>ir', u'<Plug>OrgDemoteSubtreeNormal', mode=MODE_NORMAL)) # other keybindings self.keybindings.append(Keybinding(u'<C-d>', Plug(u'OrgPromoteOnHeadingInsert', u'<C-o>:silent! py ORGMODE.plugins[u"EditStructure"].promote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>', mode=MODE_INSERT))) self.keybindings.append(Keybinding(u'<C-t>', Plug(u'OrgDemoteOnHeadingInsert', u'<C-o>:silent! py ORGMODE.plugins[u"EditStructure"].demote_heading(including_children=False, on_heading=True, insert_mode=True)<CR>', mode=MODE_INSERT)))
{ "content_hash": "ed6c056293d1c18bf7c0930233b581ab", "timestamp": "", "source": "github", "line_count": 391, "max_line_length": 237, "avg_line_length": 42.59079283887468, "alnum_prop": 0.7129045817570407, "repo_name": "mmcclimon/dotfiles", "id": "0d9b0263e20dc7d1db9cb125b490bec38eb38d7b", "size": "16678", "binary": false, "copies": "9", "ref": "refs/heads/main", "path": "vim/ftplugin/orgmode/plugins/EditStructure.py", "mode": "33188", "license": "mit", "language": [ { "name": "Emacs Lisp", "bytes": "33629" }, { "name": "Lua", "bytes": "4629" }, { "name": "Perl", "bytes": "10978" }, { "name": "Python", "bytes": "167374" }, { "name": "Shell", "bytes": "15415" }, { "name": "Vim Script", "bytes": "749664" }, { "name": "Vim Snippet", "bytes": "1856" }, { "name": "YASnippet", "bytes": "3439" } ], "symlink_target": "" }
<div class="container"> <div class="row"> <div class="span4 columns"> <%if (campaignId > 0) {%> <h3>Quick Links</h3> <ul class="unstyled"> <li><a href="/campaigns/show/<%= campaignId%>">Back to Campaign</a></li> </ul> <%}%> <%if (isAdmin) {%> <h3>Administration</h3> <ul class="unstyled menu"> <li> <a href="/users/add" class="btn">Add a User</a> </li> </ul> <%}%> </div> <div class="span12 columns"> <%- partial('../messages') %> <form method="post" action="/users/create"> <fieldset> <legend>Create a New User</legend> <div class="clearfix"> <label for="name">Login</label> <div class="input"><input type="text" name="login" id="login" /></div> </div> <div class="clearfix"> <label for="first">First Name</label> <div class="input"><input type="text" name="first" id="first" /></div> </div> <div class="clearfix"> <label for="last">Last Name</label> <div class="input"><input type="text" name="last" id="last" /></div> </div> <div class="clearfix"> <label for="account">Account</label> <div class="input"><input type="text" name="account" id="account" /></div> </div> <div class="clearfix"> <label for="password">Password</label> <div class="input"><input type="password" name="password" id="password" /></div> </div> <div class="clearfix"> <label for="password">Retype Password</label><br /> <div class="input"><input type="password" name="password2" id="password2" /></div> </div> <div class="clearfix"> <label for="isadmin">Administrator</label> <div class="input"><input type="checkbox" name="isadmin" /></div> </div> <div class="clearfix"> <label for="enail">Email</label> <div class="input"><input name="email" id="email" /></div> </div> <div class="actions"> <input class="btn" type="submit" value="Create" /> </div> </fieldset> </form> </div> </div> </div>
{ "content_hash": "5da12f517d155978269abb81fe608d46", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 85, "avg_line_length": 24.074074074074073, "alnum_prop": 0.5887179487179487, "repo_name": "hross/Charity-Campaign", "id": "e3cd03fc59c415ca16919416f29d3b4d5cd6bf11", "size": "1950", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "views/user/add.html", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "485506" } ], "symlink_target": "" }
package org.apache.nifi.admin.service.action; import org.apache.nifi.admin.dao.DAOFactory; import org.apache.nifi.admin.dao.IdpUserGroupDAO; import org.apache.nifi.idp.IdpUserGroup; import java.util.List; public class CreateIdpUserGroups implements AdministrationAction<List<IdpUserGroup>> { private final List<IdpUserGroup> userGroups; public CreateIdpUserGroups(List<IdpUserGroup> userGroups) { this.userGroups = userGroups; } @Override public List<IdpUserGroup> execute(DAOFactory daoFactory) { final IdpUserGroupDAO userGroupDAO = daoFactory.getIdpUserGroupDAO(); return userGroupDAO.createUserGroups(userGroups); } }
{ "content_hash": "9bba4a33c215ab690fb749b425941695", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 86, "avg_line_length": 29.434782608695652, "alnum_prop": 0.7666174298375185, "repo_name": "MikeThomsen/nifi", "id": "b6e319b1c44f9acb5e218e3d01b7b43e2e5c700a", "size": "1478", "binary": false, "copies": "5", "ref": "refs/heads/main", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-administration/src/main/java/org/apache/nifi/admin/service/action/CreateIdpUserGroups.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "44090" }, { "name": "C++", "bytes": "652" }, { "name": "CSS", "bytes": "284471" }, { "name": "Clojure", "bytes": "3993" }, { "name": "Dockerfile", "bytes": "24591" }, { "name": "GAP", "bytes": "30934" }, { "name": "Groovy", "bytes": "2346453" }, { "name": "HTML", "bytes": "1014100" }, { "name": "Handlebars", "bytes": "38554" }, { "name": "Java", "bytes": "53038782" }, { "name": "JavaScript", "bytes": "4015073" }, { "name": "Lua", "bytes": "983" }, { "name": "Mustache", "bytes": "2438" }, { "name": "PLpgSQL", "bytes": "1211" }, { "name": "Python", "bytes": "26583" }, { "name": "Ruby", "bytes": "23018" }, { "name": "SCSS", "bytes": "20988" }, { "name": "Shell", "bytes": "164305" }, { "name": "XSLT", "bytes": "7835" } ], "symlink_target": "" }
import {__DEV__} from '../../config'; import * as zrUtil from 'zrender/src/core/util'; import VisualMapModel from './VisualMapModel'; import VisualMapping from '../../visual/VisualMapping'; import visualDefault from '../../visual/visualDefault'; import {reformIntervals} from '../../util/number'; var PiecewiseModel = VisualMapModel.extend({ type: 'visualMap.piecewise', /** * Order Rule: * * option.categories / option.pieces / option.text / option.selected: * If !option.inverse, * Order when vertical: ['top', ..., 'bottom']. * Order when horizontal: ['left', ..., 'right']. * If option.inverse, the meaning of * the order should be reversed. * * this._pieceList: * The order is always [low, ..., high]. * * Mapping from location to low-high: * If !option.inverse * When vertical, top is high. * When horizontal, right is high. * If option.inverse, reverse. */ /** * @protected */ defaultOption: { selected: null, // Object. If not specified, means selected. // When pieces and splitNumber: {'0': true, '5': true} // When categories: {'cate1': false, 'cate3': true} // When selected === false, means all unselected. minOpen: false, // Whether include values that smaller than `min`. maxOpen: false, // Whether include values that bigger than `max`. align: 'auto', // 'auto', 'left', 'right' itemWidth: 20, // When put the controller vertically, it is the length of // horizontal side of each item. Otherwise, vertical side. itemHeight: 14, // When put the controller vertically, it is the length of // vertical side of each item. Otherwise, horizontal side. itemSymbol: 'roundRect', pieceList: null, // Each item is Object, with some of those attrs: // {min, max, lt, gt, lte, gte, value, // color, colorSaturation, colorAlpha, opacity, // symbol, symbolSize}, which customize the range or visual // coding of the certain piece. Besides, see "Order Rule". categories: null, // category names, like: ['some1', 'some2', 'some3']. // Attr min/max are ignored when categories set. See "Order Rule" splitNumber: 5, // If set to 5, auto split five pieces equally. // If set to 0 and component type not set, component type will be // determined as "continuous". (It is less reasonable but for ec2 // compatibility, see echarts/component/visualMap/typeDefaulter) selectedMode: 'multiple', // Can be 'multiple' or 'single'. itemGap: 10, // The gap between two items, in px. hoverLink: true, // Enable hover highlight. showLabel: null // By default, when text is used, label will hide (the logic // is remained for compatibility reason) }, /** * @override */ optionUpdated: function (newOption, isInit) { PiecewiseModel.superApply(this, 'optionUpdated', arguments); /** * The order is always [low, ..., high]. * [{text: string, interval: Array.<number>}, ...] * @private * @type {Array.<Object>} */ this._pieceList = []; this.resetExtent(); /** * 'pieces', 'categories', 'splitNumber' * @type {string} */ var mode = this._mode = this._determineMode(); resetMethods[this._mode].call(this); this._resetSelected(newOption, isInit); var categories = this.option.categories; this.resetVisual(function (mappingOption, state) { if (mode === 'categories') { mappingOption.mappingMethod = 'category'; mappingOption.categories = zrUtil.clone(categories); } else { mappingOption.dataExtent = this.getExtent(); mappingOption.mappingMethod = 'piecewise'; mappingOption.pieceList = zrUtil.map(this._pieceList, function (piece) { var piece = zrUtil.clone(piece); if (state !== 'inRange') { // FIXME // outOfRange do not support special visual in pieces. piece.visual = null; } return piece; }); } }); }, /** * @protected * @override */ completeVisualOption: function () { // Consider this case: // visualMap: { // pieces: [{symbol: 'circle', lt: 0}, {symbol: 'rect', gte: 0}] // } // where no inRange/outOfRange set but only pieces. So we should make // default inRange/outOfRange for this case, otherwise visuals that only // appear in `pieces` will not be taken into account in visual encoding. var option = this.option; var visualTypesInPieces = {}; var visualTypes = VisualMapping.listVisualTypes(); var isCategory = this.isCategory(); zrUtil.each(option.pieces, function (piece) { zrUtil.each(visualTypes, function (visualType) { if (piece.hasOwnProperty(visualType)) { visualTypesInPieces[visualType] = 1; } }); }); zrUtil.each(visualTypesInPieces, function (v, visualType) { var exists = 0; zrUtil.each(this.stateList, function (state) { exists |= has(option, state, visualType) || has(option.target, state, visualType); }, this); !exists && zrUtil.each(this.stateList, function (state) { (option[state] || (option[state] = {}))[visualType] = visualDefault.get( visualType, state === 'inRange' ? 'active' : 'inactive', isCategory ); }); }, this); function has(obj, state, visualType) { return obj && obj[state] && ( zrUtil.isObject(obj[state]) ? obj[state].hasOwnProperty(visualType) : obj[state] === visualType // e.g., inRange: 'symbol' ); } VisualMapModel.prototype.completeVisualOption.apply(this, arguments); }, _resetSelected: function (newOption, isInit) { var thisOption = this.option; var pieceList = this._pieceList; // Selected do not merge but all override. var selected = (isInit ? thisOption : newOption).selected || {}; thisOption.selected = selected; // Consider 'not specified' means true. zrUtil.each(pieceList, function (piece, index) { var key = this.getSelectedMapKey(piece); if (!selected.hasOwnProperty(key)) { selected[key] = true; } }, this); if (thisOption.selectedMode === 'single') { // Ensure there is only one selected. var hasSel = false; zrUtil.each(pieceList, function (piece, index) { var key = this.getSelectedMapKey(piece); if (selected[key]) { hasSel ? (selected[key] = false) : (hasSel = true); } }, this); } // thisOption.selectedMode === 'multiple', default: all selected. }, /** * @public */ getSelectedMapKey: function (piece) { return this._mode === 'categories' ? piece.value + '' : piece.index + ''; }, /** * @public */ getPieceList: function () { return this._pieceList; }, /** * @private * @return {string} */ _determineMode: function () { var option = this.option; return option.pieces && option.pieces.length > 0 ? 'pieces' : this.option.categories ? 'categories' : 'splitNumber'; }, /** * @public * @override */ setSelected: function (selected) { this.option.selected = zrUtil.clone(selected); }, /** * @public * @override */ getValueState: function (value) { var index = VisualMapping.findPieceIndex(value, this._pieceList); return index != null ? (this.option.selected[this.getSelectedMapKey(this._pieceList[index])] ? 'inRange' : 'outOfRange' ) : 'outOfRange'; }, /** * @public * @params {number} pieceIndex piece index in visualMapModel.getPieceList() * @return {Array.<Object>} [{seriesId, dataIndices: <Array.<number>>}, ...] */ findTargetDataIndices: function (pieceIndex) { var result = []; this.eachTargetSeries(function (seriesModel) { var dataIndices = []; var data = seriesModel.getData(); data.each(this.getDataDimension(data), function (value, dataIndex) { // Should always base on model pieceList, because it is order sensitive. var pIdx = VisualMapping.findPieceIndex(value, this._pieceList); pIdx === pieceIndex && dataIndices.push(dataIndex); }, true, this); result.push({seriesId: seriesModel.id, dataIndex: dataIndices}); }, this); return result; }, /** * @private * @param {Object} piece piece.value or piece.interval is required. * @return {number} Can be Infinity or -Infinity */ getRepresentValue: function (piece) { var representValue; if (this.isCategory()) { representValue = piece.value; } else { if (piece.value != null) { representValue = piece.value; } else { var pieceInterval = piece.interval || []; representValue = (pieceInterval[0] === -Infinity && pieceInterval[1] === Infinity) ? 0 : (pieceInterval[0] + pieceInterval[1]) / 2; } } return representValue; }, getVisualMeta: function (getColorVisual) { // Do not support category. (category axis is ordinal, numerical) if (this.isCategory()) { return; } var stops = []; var outerColors = []; var visualMapModel = this; function setStop(interval, valueState) { var representValue = visualMapModel.getRepresentValue({interval: interval}); if (!valueState) { valueState = visualMapModel.getValueState(representValue); } var color = getColorVisual(representValue, valueState); if (interval[0] === -Infinity) { outerColors[0] = color; } else if (interval[1] === Infinity) { outerColors[1] = color; } else { stops.push( {value: interval[0], color: color}, {value: interval[1], color: color} ); } } // Suplement var pieceList = this._pieceList.slice(); if (!pieceList.length) { pieceList.push({interval: [-Infinity, Infinity]}); } else { var edge = pieceList[0].interval[0]; edge !== -Infinity && pieceList.unshift({interval: [-Infinity, edge]}); edge = pieceList[pieceList.length - 1].interval[1]; edge !== Infinity && pieceList.push({interval: [edge, Infinity]}); } var curr = -Infinity; zrUtil.each(pieceList, function (piece) { var interval = piece.interval; if (interval) { // Fulfill gap. interval[0] > curr && setStop([curr, interval[0]], 'outOfRange'); setStop(interval.slice()); curr = interval[1]; } }, this); return {stops: stops, outerColors: outerColors}; } }); /** * Key is this._mode * @type {Object} * @this {module:echarts/component/viusalMap/PiecewiseMode} */ var resetMethods = { splitNumber: function () { var thisOption = this.option; var pieceList = this._pieceList; var precision = Math.min(thisOption.precision, 20); var dataExtent = this.getExtent(); var splitNumber = thisOption.splitNumber; splitNumber = Math.max(parseInt(splitNumber, 10), 1); thisOption.splitNumber = splitNumber; var splitStep = (dataExtent[1] - dataExtent[0]) / splitNumber; // Precision auto-adaption while (+splitStep.toFixed(precision) !== splitStep && precision < 5) { precision++; } thisOption.precision = precision; splitStep = +splitStep.toFixed(precision); var index = 0; if (thisOption.minOpen) { pieceList.push({ index: index++, interval: [-Infinity, dataExtent[0]], close: [0, 0] }); } for ( var curr = dataExtent[0], len = index + splitNumber; index < len; curr += splitStep ) { var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep); pieceList.push({ index: index++, interval: [curr, max], close: [1, 1] }); } if (thisOption.maxOpen) { pieceList.push({ index: index++, interval: [dataExtent[1], Infinity], close: [0, 0] }); } reformIntervals(pieceList); zrUtil.each(pieceList, function (piece) { piece.text = this.formatValueText(piece.interval); }, this); }, categories: function () { var thisOption = this.option; zrUtil.each(thisOption.categories, function (cate) { // FIXME category模式也使用pieceList,但在visualMapping中不是使用pieceList。 // 是否改一致。 this._pieceList.push({ text: this.formatValueText(cate, true), value: cate }); }, this); // See "Order Rule". normalizeReverse(thisOption, this._pieceList); }, pieces: function () { var thisOption = this.option; var pieceList = this._pieceList; zrUtil.each(thisOption.pieces, function (pieceListItem, index) { if (!zrUtil.isObject(pieceListItem)) { pieceListItem = {value: pieceListItem}; } var item = {text: '', index: index}; if (pieceListItem.label != null) { item.text = pieceListItem.label; } if (pieceListItem.hasOwnProperty('value')) { var value = item.value = pieceListItem.value; item.interval = [value, value]; item.close = [1, 1]; } else { // `min` `max` is legacy option. // `lt` `gt` `lte` `gte` is recommanded. var interval = item.interval = []; var close = item.close = [0, 0]; var closeList = [1, 0, 1]; var infinityList = [-Infinity, Infinity]; var useMinMax = []; for (var lg = 0; lg < 2; lg++) { var names = [['gte', 'gt', 'min'], ['lte', 'lt', 'max']][lg]; for (var i = 0; i < 3 && interval[lg] == null; i++) { interval[lg] = pieceListItem[names[i]]; close[lg] = closeList[i]; useMinMax[lg] = i === 2; } interval[lg] == null && (interval[lg] = infinityList[lg]); } useMinMax[0] && interval[1] === Infinity && (close[0] = 0); useMinMax[1] && interval[0] === -Infinity && (close[1] = 0); if (__DEV__) { if (interval[0] > interval[1]) { console.warn( 'Piece ' + index + 'is illegal: ' + interval + ' lower bound should not greater then uppper bound.' ); } } if (interval[0] === interval[1] && close[0] && close[1]) { // Consider: [{min: 5, max: 5, visual: {...}}, {min: 0, max: 5}], // we use value to lift the priority when min === max item.value = interval[0]; } } item.visual = VisualMapping.retrieveVisuals(pieceListItem); pieceList.push(item); }, this); // See "Order Rule". normalizeReverse(thisOption, pieceList); // Only pieces reformIntervals(pieceList); zrUtil.each(pieceList, function (piece) { var close = piece.close; var edgeSymbols = [['<', '≤'][close[1]], ['>', '≥'][close[0]]]; piece.text = piece.text || this.formatValueText( piece.value != null ? piece.value : piece.interval, false, edgeSymbols ); }, this); } }; function normalizeReverse(thisOption, pieceList) { var inverse = thisOption.inverse; if (thisOption.orient === 'vertical' ? !inverse : inverse) { pieceList.reverse(); } } export default PiecewiseModel;
{ "content_hash": "e28825e88a1277b0ef8dc0bfeef47d98", "timestamp": "", "source": "github", "line_count": 525, "max_line_length": 101, "avg_line_length": 34.66095238095238, "alnum_prop": 0.49947793592350387, "repo_name": "falost/falost.github.io", "id": "d3b9a556590d5bbbd32bf798900aab1e2569cf38", "size": "18241", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "static/libs/echarts/src/component/visualMap/PiecewiseModel.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "303039" }, { "name": "HTML", "bytes": "11691" }, { "name": "JavaScript", "bytes": "4351373" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Modified Bessel Functions of the First and Second Kinds</title> <link rel="stylesheet" href="../../math.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> <link rel="home" href="../../index.html" title="Math Toolkit 2.1.0"> <link rel="up" href="../bessel.html" title="Bessel Functions"> <link rel="prev" href="bessel_root.html" title="Finding Zeros of Bessel Functions of the First and Second Kinds"> <link rel="next" href="sph_bessel.html" title="Spherical Bessel Functions of the First and Second Kinds"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> <td align="center"><a href="../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="bessel_root.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../bessel.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sph_bessel.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> <a name="math_toolkit.bessel.mbessel"></a><a class="link" href="mbessel.html" title="Modified Bessel Functions of the First and Second Kinds">Modified Bessel Functions of the First and Second Kinds</a> </h3></div></div></div> <h5> <a name="math_toolkit.bessel.mbessel.h0"></a> <span class="phrase"><a name="math_toolkit.bessel.mbessel.synopsis"></a></span><a class="link" href="mbessel.html#math_toolkit.bessel.mbessel.synopsis">Synopsis</a> </h5> <p> <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">bessel</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> </p> <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span> <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_bessel_i</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;14.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span> <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_bessel_i</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;14.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span> <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_bessel_k</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">);</span> <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;14.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span> <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_bessel_k</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;14.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span> </pre> <h5> <a name="math_toolkit.bessel.mbessel.h1"></a> <span class="phrase"><a name="math_toolkit.bessel.mbessel.description"></a></span><a class="link" href="mbessel.html#math_toolkit.bessel.mbessel.description">Description</a> </h5> <p> The functions <a class="link" href="mbessel.html" title="Modified Bessel Functions of the First and Second Kinds">cyl_bessel_i</a> and <a class="link" href="mbessel.html" title="Modified Bessel Functions of the First and Second Kinds">cyl_bessel_k</a> return the result of the modified Bessel functions of the first and second kind respectively: </p> <p> cyl_bessel_i(v, x) = I<sub>v</sub>(x) </p> <p> cyl_bessel_k(v, x) = K<sub>v</sub>(x) </p> <p> where: </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel2.png"></span> </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel3.png"></span> </p> <p> The return type of these functions is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result type calculation rules</em></span></a> when T1 and T2 are different types. The functions are also optimised for the relatively common case that T1 is an integer. </p> <p> The final <a class="link" href="../../policy.html" title="Chapter&#160;14.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;14.&#160;Policies: Controlling Precision, Error Handling etc">policy documentation for more details</a>. </p> <p> The functions return the result of <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a> whenever the result is undefined or complex. For <a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">cyl_bessel_j</a> this occurs when <code class="computeroutput"><span class="identifier">x</span> <span class="special">&lt;</span> <span class="number">0</span></code> and v is not an integer, or when <code class="computeroutput"><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span></code> and <code class="computeroutput"><span class="identifier">v</span> <span class="special">!=</span> <span class="number">0</span></code>. For <a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">cyl_neumann</a> this occurs when <code class="computeroutput"><span class="identifier">x</span> <span class="special">&lt;=</span> <span class="number">0</span></code>. </p> <p> The following graph illustrates the exponential behaviour of I<sub>v</sub>. </p> <p> <span class="inlinemediaobject"><img src="../../../graphs/cyl_bessel_i.png" align="middle"></span> </p> <p> The following graph illustrates the exponential decay of K<sub>v</sub>. </p> <p> <span class="inlinemediaobject"><img src="../../../graphs/cyl_bessel_k.png" align="middle"></span> </p> <h5> <a name="math_toolkit.bessel.mbessel.h2"></a> <span class="phrase"><a name="math_toolkit.bessel.mbessel.testing"></a></span><a class="link" href="mbessel.html#math_toolkit.bessel.mbessel.testing">Testing</a> </h5> <p> There are two sets of test values: spot values calculated using <a href="http://functions.wolfram.com" target="_top">functions.wolfram.com</a>, and a much larger set of tests computed using a simplified version of this implementation (with all the special case handling removed). </p> <h5> <a name="math_toolkit.bessel.mbessel.h3"></a> <span class="phrase"><a name="math_toolkit.bessel.mbessel.accuracy"></a></span><a class="link" href="mbessel.html#math_toolkit.bessel.mbessel.accuracy">Accuracy</a> </h5> <p> The following tables show how the accuracy of these functions varies on various platforms, along with a comparison to the <a href="http://www.gnu.org/software/gsl/" target="_top">GSL-1.9</a> library. Note that only results for the widest floating-point type on the system are given, as narrower types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively zero error</a>. All values are relative errors in units of epsilon. </p> <div class="table"> <a name="math_toolkit.bessel.mbessel.errors_rates_in_cyl_bessel_i"></a><p class="title"><b>Table&#160;6.23.&#160;Errors Rates in cyl_bessel_i</b></p> <div class="table-contents"><table class="table" summary="Errors Rates in cyl_bessel_i"> <colgroup> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> I<sub>v</sub> </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32 / Visual C++ 8.0 </p> </td> <td> <p> Peak=10 Mean=3.4 GSL Peak=6000 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Red Hat Linux IA64 / G++ 3.4 </p> </td> <td> <p> Peak=11 Mean=3 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> SUSE Linux AMD64 / G++ 4.1 </p> </td> <td> <p> Peak=11 Mean=4 </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HP-UX / HP aCC 6 </p> </td> <td> <p> Peak=15 Mean=4 </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><div class="table"> <a name="math_toolkit.bessel.mbessel.errors_rates_in_cyl_bessel_k"></a><p class="title"><b>Table&#160;6.24.&#160;Errors Rates in cyl_bessel_k</b></p> <div class="table-contents"><table class="table" summary="Errors Rates in cyl_bessel_k"> <colgroup> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Significand Size </p> </th> <th> <p> Platform and Compiler </p> </th> <th> <p> K<sub>v</sub> </p> </th> </tr></thead> <tbody> <tr> <td> <p> 53 </p> </td> <td> <p> Win32 / Visual C++ 8.0 </p> </td> <td> <p> Peak=9 Mean=2 </p> <p> GSL Peak=9 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> Red Hat Linux IA64 / G++ 3.4 </p> </td> <td> <p> Peak=10 Mean=2 </p> </td> </tr> <tr> <td> <p> 64 </p> </td> <td> <p> SUSE Linux AMD64 / G++ 4.1 </p> </td> <td> <p> Peak=10 Mean=2 </p> </td> </tr> <tr> <td> <p> 113 </p> </td> <td> <p> HP-UX / HP aCC 6 </p> </td> <td> <p> Peak=12 Mean=5 </p> </td> </tr> </tbody> </table></div> </div> <br class="table-break"><h5> <a name="math_toolkit.bessel.mbessel.h4"></a> <span class="phrase"><a name="math_toolkit.bessel.mbessel.implementation"></a></span><a class="link" href="mbessel.html#math_toolkit.bessel.mbessel.implementation">Implementation</a> </h5> <p> The following are handled as special cases first: </p> <p> When computing I<sub>v</sub> &#160; for <span class="emphasis"><em>x &lt; 0</em></span>, then &#957; &#160; must be an integer or a domain error occurs. If &#957; &#160; is an integer, then the function is odd if &#957; &#160; is odd and even if &#957; &#160; is even, and we can reflect to <span class="emphasis"><em>x &gt; 0</em></span>. </p> <p> For I<sub>v</sub> &#160; with v equal to 0, 1 or 0.5 are handled as special cases. </p> <p> The 0 and 1 cases use minimax rational approximations on finite and infinite intervals. The coefficients are from: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> J.M. Blair and C.A. Edwards, <span class="emphasis"><em>Stable rational minimax approximations to the modified Bessel functions I_0(x) and I_1(x)</em></span>, Atomic Energy of Canada Limited Report 4928, Chalk River, 1974. </li> <li class="listitem"> S. Moshier, <span class="emphasis"><em>Methods and Programs for Mathematical Functions</em></span>, Ellis Horwood Ltd, Chichester, 1989. </li> </ul></div> <p> While the 0.5 case is a simple trigonometric function: </p> <p> I<sub>0.5</sub>(x) = sqrt(2 / &#960;x) * sinh(x) </p> <p> For K<sub>v</sub> &#160; with <span class="emphasis"><em>v</em></span> an integer, the result is calculated using the recurrence relation: </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel5.png"></span> </p> <p> starting from K<sub>0</sub> &#160; and K<sub>1</sub> &#160; which are calculated using rational the approximations above. These rational approximations are accurate to around 19 digits, and are therefore only used when T has no more than 64 binary digits of precision. </p> <p> When <span class="emphasis"><em>x</em></span> is small compared to <span class="emphasis"><em>v</em></span>, I<sub>v</sub>x &#160; is best computed directly from the series: </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel17.png"></span> </p> <p> In the general case, we first normalize &#957; &#160; to [<code class="literal">0, [inf]</code>) with the help of the reflection formulae: </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel9.png"></span> </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel10.png"></span> </p> <p> Let &#956; &#160; = &#957; - floor(&#957; + 1/2), then &#956; &#160; is the fractional part of &#957; &#160; such that |&#956;| &lt;= 1/2 (we need this for convergence later). The idea is to calculate K<sub>&#956;</sub>(x) and K<sub>&#956;+1</sub>(x), and use them to obtain I<sub>&#957;</sub>(x) and K<sub>&#957;</sub>(x). </p> <p> The algorithm is proposed by Temme in N.M. Temme, <span class="emphasis"><em>On the numerical evaluation of the modified bessel function of the third kind</em></span>, Journal of Computational Physics, vol 19, 324 (1975), which needs two continued fractions as well as the Wronskian: </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel11.png"></span> </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel12.png"></span> </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel8.png"></span> </p> <p> The continued fractions are computed using the modified Lentz's method (W.J. Lentz, <span class="emphasis"><em>Generating Bessel functions in Mie scattering calculations using continued fractions</em></span>, Applied Optics, vol 15, 668 (1976)). Their convergence rates depend on <span class="emphasis"><em>x</em></span>, therefore we need different strategies for large <span class="emphasis"><em>x</em></span> and small <span class="emphasis"><em>x</em></span>. </p> <p> <span class="emphasis"><em>x &gt; v</em></span>, CF1 needs O(<span class="emphasis"><em>x</em></span>) iterations to converge, CF2 converges rapidly. </p> <p> <span class="emphasis"><em>x &lt;= v</em></span>, CF1 converges rapidly, CF2 fails to converge when <span class="emphasis"><em>x</em></span> <code class="literal">-&gt;</code> 0. </p> <p> When <span class="emphasis"><em>x</em></span> is large (<span class="emphasis"><em>x</em></span> &gt; 2), both continued fractions converge (CF1 may be slow for really large <span class="emphasis"><em>x</em></span>). K<sub>&#956;</sub> &#160; and K<sub>&#956;+1</sub> &#160; can be calculated by </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel13.png"></span> </p> <p> where </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel14.png"></span> </p> <p> <span class="emphasis"><em>S</em></span> is also a series that is summed along with CF2, see I.J. Thompson and A.R. Barnett, <span class="emphasis"><em>Modified Bessel functions I_v and K_v of real order and complex argument to selected accuracy</em></span>, Computer Physics Communications, vol 47, 245 (1987). </p> <p> When <span class="emphasis"><em>x</em></span> is small (<span class="emphasis"><em>x</em></span> &lt;= 2), CF2 convergence may fail (but CF1 works very well). The solution here is Temme's series: </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel15.png"></span> </p> <p> where </p> <p> <span class="inlinemediaobject"><img src="../../../equations/mbessel16.png"></span> </p> <p> f<sub>k</sub> &#160; and h<sub>k</sub> &#160; are also computed by recursions (involving gamma functions), but the formulas are a little complicated, readers are referred to N.M. Temme, <span class="emphasis"><em>On the numerical evaluation of the modified Bessel function of the third kind</em></span>, Journal of Computational Physics, vol 19, 324 (1975). Note: Temme's series converge only for |&#956;| &lt;= 1/2. </p> <p> K<sub>&#957;</sub>(x) is then calculated from the forward recurrence, as is K<sub>&#957;+1</sub>(x). With these two values and f<sub>&#957;</sub>, the Wronskian yields I<sub>&#957;</sub>(x) directly. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno Lalande, John Maddock, Johan R&#229;de, Gautam Sewani, Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="bessel_root.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../bessel.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sph_bessel.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "d2eca7759e3cb8f0d1efffe1c10d2854", "timestamp": "", "source": "github", "line_count": 491, "max_line_length": 631, "avg_line_length": 48.55600814663951, "alnum_prop": 0.5687680885868881, "repo_name": "MisterTea/HyperNEAT", "id": "a18b014901cf3370f4830aee6fcdbc5df05e2ace", "size": "23841", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "boost_1_57_0/libs/math/doc/html/math_toolkit/bessel/mbessel.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Ada", "bytes": "91920" }, { "name": "Assembly", "bytes": "324212" }, { "name": "Batchfile", "bytes": "32748" }, { "name": "Bison", "bytes": "10393" }, { "name": "C", "bytes": "4172510" }, { "name": "C#", "bytes": "97576" }, { "name": "C++", "bytes": "163699928" }, { "name": "CLIPS", "bytes": "7056" }, { "name": "CMake", "bytes": "92433" }, { "name": "CSS", "bytes": "248695" }, { "name": "Cuda", "bytes": "26521" }, { "name": "DIGITAL Command Language", "bytes": "13695" }, { "name": "Fortran", "bytes": "1387" }, { "name": "Gnuplot", "bytes": "2361" }, { "name": "Groff", "bytes": "15745" }, { "name": "HTML", "bytes": "145331688" }, { "name": "IDL", "bytes": "15" }, { "name": "JFlex", "bytes": "1290" }, { "name": "JavaScript", "bytes": "134468" }, { "name": "Makefile", "bytes": "1053202" }, { "name": "Max", "bytes": "37424" }, { "name": "Module Management System", "bytes": "1593" }, { "name": "Objective-C", "bytes": "33988" }, { "name": "Objective-C++", "bytes": "214" }, { "name": "PHP", "bytes": "60249" }, { "name": "Pascal", "bytes": "41721" }, { "name": "Perl", "bytes": "30505" }, { "name": "Perl6", "bytes": "2130" }, { "name": "PostScript", "bytes": "81121" }, { "name": "Python", "bytes": "1943687" }, { "name": "QML", "bytes": "613" }, { "name": "QMake", "bytes": "7148" }, { "name": "Rebol", "bytes": "372" }, { "name": "SAS", "bytes": "1776" }, { "name": "Scilab", "bytes": "107733" }, { "name": "Shell", "bytes": "394881" }, { "name": "Tcl", "bytes": "29403" }, { "name": "TeX", "bytes": "1196144" }, { "name": "XSLT", "bytes": "770994" } ], "symlink_target": "" }
include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/make/$(TARGET)/otp.mk # ---------------------------------------------------- # Files # ---------------------------------------------------- AUXILIARY_FILES=\ dialyzer.spec\ dialyzer.cover\ dialyzer_test_constants.hrl\ dialyzer_common.erl\ file_utils.erl\ dialyzer_SUITE.erl\ abstract_SUITE.erl\ plt_SUITE.erl # ---------------------------------------------------- # Release directory specification # ---------------------------------------------------- RELSYSDIR = $(RELEASE_PATH)/dialyzer_test # ---------------------------------------------------- # Release Target # ---------------------------------------------------- include $(ERL_TOP)/make/otp_release_targets.mk release_tests_spec: $(INSTALL_DIR) "$(RELSYSDIR)" chmod -R u+w "$(RELSYSDIR)" $(INSTALL_DATA) $(AUXILIARY_FILES) "$(RELSYSDIR)" @tar cf - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -) cd "$(RELSYSDIR)";\ erlc dialyzer_common.erl file_utils.erl;\ erl -noshell -run dialyzer_common create_all_suites -s erlang halt
{ "content_hash": "61b1bd12b13b5b00347ba41bf0038656", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 67, "avg_line_length": 28.54054054054054, "alnum_prop": 0.48863636363636365, "repo_name": "neeraj9/otp", "id": "0d8fba438c0e2e3fb474083f99628e24ab821ded", "size": "1056", "binary": false, "copies": "14", "ref": "refs/heads/maint", "path": "lib/dialyzer/test/Makefile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "30325" }, { "name": "Assembly", "bytes": "134972" }, { "name": "Batchfile", "bytes": "1110" }, { "name": "C", "bytes": "13750829" }, { "name": "C++", "bytes": "1626143" }, { "name": "CSS", "bytes": "12318" }, { "name": "DIGITAL Command Language", "bytes": "21" }, { "name": "DTrace", "bytes": "231080" }, { "name": "Emacs Lisp", "bytes": "392347" }, { "name": "Erlang", "bytes": "73339763" }, { "name": "Groff", "bytes": "1954" }, { "name": "HTML", "bytes": "430372" }, { "name": "Java", "bytes": "666915" }, { "name": "JavaScript", "bytes": "33014" }, { "name": "Logos", "bytes": "8702" }, { "name": "M4", "bytes": "341175" }, { "name": "Makefile", "bytes": "1438475" }, { "name": "NSIS", "bytes": "27852" }, { "name": "Objective-C", "bytes": "4115" }, { "name": "Perl", "bytes": "100678" }, { "name": "Python", "bytes": "117385" }, { "name": "Shell", "bytes": "369669" }, { "name": "Tcl", "bytes": "9372" }, { "name": "XSLT", "bytes": "226973" } ], "symlink_target": "" }
package programmersguide.smartartinpresentation.checkassistantnodes.assistantnode.java; import com.aspose.slides.*; public class AssistantNode { public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = "src/programmersguide/smartartinpresentation/checkassistantnodes/assistantnode/data/"; //Creating a presentation instance Presentation pres = new Presentation(dataDir+ "AddSmartArtNode.pptx"); //Traverse through every shape inside first slide for(IShape shape : pres.getSlides().get_Item(0).getShapes()) { //Check if shape is of SmartArt type if (shape instanceof ISmartArt) { //Typecast shape to SmartArtEx ISmartArt smart = (SmartArt)shape; //Traversing through all nodes of SmartArt shape for(int i = 0; i < smart.getAllNodes().getCount(); i++) { ISmartArtNode node = smart.getAllNodes().get_Item(i); String tc = node.getTextFrame().getText(); //Check if node is Assitant node if (node.isAssistant()) { //Setting Assitant node to false and making it normal node node.setAssistant(false); } } } } //Save Presentation pres.save(dataDir+ "ChangeAssitantNode.pptx", SaveFormat.Pptx); } }
{ "content_hash": "2dab1a5dbe93b6b96d4c4635d89707ef", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 111, "avg_line_length": 32.02040816326531, "alnum_prop": 0.5678776290630975, "repo_name": "asposemarketplace/Aspose-Slides-Java", "id": "5e99a889d53990d838522dbe0e4c695327213bf3", "size": "1852", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/programmersguide/smartartinpresentation/checkassistantnodes/assistantnode/java/AssistantNode.java", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "8294" }, { "name": "Java", "bytes": "148659" } ], "symlink_target": "" }
@interface GWDEssenceViewController : UIViewController @end
{ "content_hash": "9b179942a01fd497556ca61e23af4b43", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 54, "avg_line_length": 20.333333333333332, "alnum_prop": 0.8524590163934426, "repo_name": "GuVictor/BuDeJie", "id": "a77a31e8e96d09a66c9ffbaf62c475878d1e869c", "size": "260", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BuDeJie/BuDeJie/Classes/Essence(精华)/Controller/GWDEssenceViewController.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Objective-C", "bytes": "178427" }, { "name": "Ruby", "bytes": "203" } ], "symlink_target": "" }
export default class BrowserUtils { static determineBrowserLanguageCode() { const locale = navigator.language || (navigator.languages && navigator.languages[0]) || navigator.userLanguage const langCode = locale.length > 2 ? locale.indexOf('_') > 0 ? locale.split('_')[0] : locale.split('-')[0] : locale return langCode } }
{ "content_hash": "372ec8f6ad4c5427ed347ebfd457254d", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 92, "avg_line_length": 31.53846153846154, "alnum_prop": 0.5707317073170731, "repo_name": "openforis/collect", "id": "6a771aff04478acc7ce4ece7dff845fddd1d71e5", "size": "410", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "collect-webapp/frontend/src/utils/BrowserUtils.js", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "2032" }, { "name": "CSS", "bytes": "492878" }, { "name": "HTML", "bytes": "55093" }, { "name": "Java", "bytes": "6027874" }, { "name": "JavaScript", "bytes": "5049757" }, { "name": "Less", "bytes": "60736" }, { "name": "SCSS", "bytes": "310370" }, { "name": "Shell", "bytes": "515" }, { "name": "TSQL", "bytes": "1199" }, { "name": "XSLT", "bytes": "8150" } ], "symlink_target": "" }
import { ClientSvcQueryable, MethodParams, property, setProperty, method, objConstructor, objectPath, objectProperties, opQuery, ObjectPathBatch, staticMethod } from '@pnp/sp-clientsvc'; import { stringIsNullOrEmpty, extend, sanitizeGuid, getGUID } from '@pnp/common'; import { sp } from '@pnp/sp'; /** * Represents a collection of labels */ class Labels extends ClientSvcQueryable { constructor(parent = "", _objectPaths = null) { super(parent, _objectPaths); this._objectPaths.add(property("Labels")); } /** * Gets a label from the collection by its value * * @param value The value to retrieve */ getByValue(value) { const params = MethodParams.build().string(value); return this.getChild(Label, "GetByValue", params); } /** * Loads the data and merges with with the ILabel instances */ get() { return this.sendGetCollection((d) => { if (!stringIsNullOrEmpty(d.Value)) { return this.getByValue(d.Value); } throw Error("Could not find Value in Labels.get(). You must include at least one of these in your select fields."); }); } } /** * Represents a label instance */ class Label extends ClientSvcQueryable { /** * Gets the data for this Label */ get() { return this.sendGet(Label); } /** * Sets this label as the default */ setAsDefaultForLanguage() { return this.invokeNonQuery("SetAsDefaultForLanguage"); } /** * Deletes this label */ delete() { return this.invokeNonQuery("DeleteObject"); } } class Terms extends ClientSvcQueryable { /** * Gets the terms in this collection */ get() { return this.sendGetCollection((d) => { if (!stringIsNullOrEmpty(d.Name)) { return this.getByName(d.Name); } else if (!stringIsNullOrEmpty(d.Id)) { return this.getById(d.Id); } throw Error("Could not find Name or Id in Terms.get(). You must include at least one of these in your select fields."); }); } /** * Gets a term by id * * @param id The id of the term */ getById(id) { const params = MethodParams.build() .string(sanitizeGuid(id)); return this.getChild(Term, "GetById", params); } /** * Gets a term by name * * @param name Term name */ getByName(name) { const params = MethodParams.build() .string(name); return this.getChild(Term, "GetByName", params); } } /** * Represents the operations available on a given term */ class Term extends ClientSvcQueryable { get labels() { return new Labels(this); } get parent() { return this.getChildProperty(Term, "Parent"); } get pinSourceTermSet() { return this.getChildProperty(TermSet, "PinSourceTermSet"); } get reusedTerms() { return this.getChildProperty(Terms, "ReusedTerms"); } get sourceTerm() { return this.getChildProperty(Term, "SourceTerm"); } get termSet() { return this.getChildProperty(TermSet, "TermSet"); } get termSets() { return this.getChildProperty(TermSets, "TermSets"); } /** * Creates a new label for this Term * * @param name label value * @param lcid language code * @param isDefault Is the default label */ createLabel(name, lcid, isDefault = false) { const params = MethodParams.build() .string(name) .number(lcid) .boolean(isDefault); this._useCaching = false; return this.invokeMethod("CreateLabel", params) .then(r => extend(this.labels.getByValue(name), r)); } /** * Sets the deprecation flag on a term * * @param doDeprecate New value for the deprecation flag */ deprecate(doDeprecate) { const params = MethodParams.build().boolean(doDeprecate); return this.invokeNonQuery("Deprecate", params); } /** * Loads the term data */ get() { return this.sendGet(Term); } /** * Sets the description * * @param description Term description * @param lcid Language code */ setDescription(description, lcid) { const params = MethodParams.build().string(description).number(lcid); return this.invokeNonQuery("SetDescription", params); } /** * Sets a custom property on this term * * @param name Property name * @param value Property value */ setLocalCustomProperty(name, value) { const params = MethodParams.build().string(name).string(value); return this.invokeNonQuery("SetLocalCustomProperty", params); } /** * Updates the specified properties of this term, not all properties can be updated * * @param properties Plain object representing the properties and new values to update */ update(properties) { return this.invokeUpdate(properties, Term); } } class TermSets extends ClientSvcQueryable { /** * Gets the termsets in this collection */ get() { return this.sendGetCollection((d) => { if (!stringIsNullOrEmpty(d.Name)) { return this.getByName(d.Name); } else if (!stringIsNullOrEmpty(d.Id)) { return this.getById(d.Id); } throw Error("Could not find Value in Labels.get(). You must include at least one of these in your select fields."); }); } /** * Gets a TermSet from this collection by id * * @param id TermSet id */ getById(id) { const params = MethodParams.build() .string(sanitizeGuid(id)); return this.getChild(TermSet, "GetById", params); } /** * Gets a TermSet from this collection by name * * @param name TermSet name */ getByName(name) { const params = MethodParams.build() .string(name); return this.getChild(TermSet, "GetByName", params); } } class TermSet extends ClientSvcQueryable { /** * Gets the group containing this Term set */ get group() { return this.getChildProperty(TermGroup, "Group"); } /** * Access all the terms in this termset */ get terms() { return this.getChild(Terms, "GetAllTerms", null); } /** * Adds a stakeholder to the TermSet * * @param stakeholderName The login name of the user to be added as a stakeholder */ addStakeholder(stakeholderName) { const params = MethodParams.build() .string(stakeholderName); return this.invokeNonQuery("DeleteStakeholder", params); } /** * Deletes a stakeholder to the TermSet * * @param stakeholderName The login name of the user to be added as a stakeholder */ deleteStakeholder(stakeholderName) { const params = MethodParams.build() .string(stakeholderName); return this.invokeNonQuery("AddStakeholder", params); } /** * Gets the data for this TermSet */ get() { return this.sendGet(TermSet); } /** * Get a term by id * * @param id Term id */ getTermById(id) { const params = MethodParams.build() .string(sanitizeGuid(id)); return this.getChild(Term, "GetTerm", params); } /** * Adds a term to this term set * * @param name Name for the term * @param lcid Language code * @param isAvailableForTagging set tagging availability (default: true) * @param id GUID id for the term (optional) */ addTerm(name, lcid, isAvailableForTagging = true, id = getGUID()) { const params = MethodParams.build() .string(name) .number(lcid) .string(sanitizeGuid(id)); this._useCaching = false; return this.invokeMethod("CreateTerm", params, setProperty("IsAvailableForTagging", "Boolean", `${isAvailableForTagging}`)) .then(r => extend(this.getTermById(r.Id), r)); } /** * Copies this term set immediately */ copy() { return this.invokeMethod("Copy", null); } /** * Updates the specified properties of this term set, not all properties can be updated * * @param properties Plain object representing the properties and new values to update */ update(properties) { return this.invokeUpdate(properties, TermSet); } } /** * Represents a group in the taxonomy heirarchy */ class TermGroup extends ClientSvcQueryable { constructor(parent = "", _objectPaths) { super(parent, _objectPaths); // this should mostly be true this.store = parent instanceof TermStore ? parent : null; } /** * Gets the collection of term sets in this group */ get termSets() { return this.getChildProperty(TermSets, "TermSets"); } /** * Adds a contributor to the Group * * @param principalName The login name of the user to be added as a contributor */ addContributor(principalName) { const params = MethodParams.build().string(principalName); return this.invokeNonQuery("AddContributor", params); } /** * Adds a group manager to the Group * * @param principalName The login name of the user to be added as a group manager */ addGroupManager(principalName) { const params = MethodParams.build().string(principalName); return this.invokeNonQuery("AddGroupManager", params); } /** * Creates a new TermSet in this Group using the provided language and unique identifier * * @param name The name of the new TermSet being created * @param lcid The language that the new TermSet name is in * @param id The unique identifier of the new TermSet being created (optional) */ createTermSet(name, lcid, id = getGUID()) { const params = MethodParams.build() .string(name) .string(sanitizeGuid(id)) .number(lcid); this._useCaching = false; return this.invokeMethod("CreateTermSet", params) .then(r => extend(this.store.getTermSetById(r.Id), r)); } /** * Gets this term store's data */ get() { return this.sendGet(TermGroup); } /** * Updates the specified properties of this term set, not all properties can be updated * * @param properties Plain object representing the properties and new values to update */ update(properties) { return this.invokeUpdate(properties, TermGroup); } } /** * Represents the set of available term stores and the collection methods */ class TermStores extends ClientSvcQueryable { constructor(parent = "") { super(parent); this._objectPaths.add(property("TermStores", // actions objectPath())); } /** * Gets the term stores */ get() { return this.sendGetCollection((d) => { if (!stringIsNullOrEmpty(d.Name)) { return this.getByName(d.Name); } else if (!stringIsNullOrEmpty(d.Id)) { return this.getById(d.Id); } throw Error("Could not find Name or Id in TermStores.get(). You must include at least one of these in your select fields."); }); } /** * Returns the TermStore specified by its index name * * @param name The index name of the TermStore to be returned */ getByName(name) { return this.getChild(TermStore, "GetByName", MethodParams.build().string(name)); } /** * Returns the TermStore specified by its GUID index * * @param id The GUID index of the TermStore to be returned */ getById(id) { return this.getChild(TermStore, "GetById", MethodParams.build().string(sanitizeGuid(id))); } } class TermStore extends ClientSvcQueryable { constructor(parent = "", _objectPaths = null) { super(parent, _objectPaths); } get hashTagsTermSet() { return this.getChildProperty(TermSet, "HashTagsTermSet"); } get keywordsTermSet() { return this.getChildProperty(TermSet, "KeywordsTermSet"); } get orphanedTermsTermSet() { return this.getChildProperty(TermSet, "OrphanedTermsTermSet"); } get systemGroup() { return this.getChildProperty(TermGroup, "SystemGroup"); } /** * Gets the term store data */ get() { return this.sendGet(TermStore); } /** * Gets term sets * * @param name * @param lcid */ getTermSetsByName(name, lcid) { const params = MethodParams.build() .string(name) .number(lcid); return this.getChild(TermSets, "GetTermSetsByName", params); } /** * Provides access to an ITermSet by id * * @param id */ getTermSetById(id) { const params = MethodParams.build().string(sanitizeGuid(id)); return this.getChild(TermSet, "GetTermSet", params); } /** * Provides access to an ITermSet by id * * @param id */ getTermById(id) { const params = MethodParams.build().string(sanitizeGuid(id)); return this.getChild(Term, "GetTerm", params); } /** * Gets a term from a term set based on the supplied ids * * @param termId Term Id * @param termSetId Termset Id */ getTermInTermSet(termId, termSetId) { const params = MethodParams.build().string(sanitizeGuid(termId)).string(sanitizeGuid(termSetId)); return this.getChild(Term, "GetTermInTermSet", params); } /** * This method provides access to a ITermGroup by id * * @param id The group id */ getTermGroupById(id) { const params = MethodParams.build() .string(sanitizeGuid(id)); return this.getChild(TermGroup, "GetGroup", params); } /** * Gets the terms by the supplied information (see: https://msdn.microsoft.com/en-us/library/hh626704%28v=office.12%29.aspx) * * @param info */ getTerms(info) { const objectPaths = this._objectPaths.clone(); // this will be the parent of the GetTerms call, but we need to create the input param first const parentIndex = objectPaths.lastIndex; // this is our input object const input = objConstructor("{61a1d689-2744-4ea3-a88b-c95bee9803aa}", // actions objectPath(), ...objectProperties(info)); // add the input object path const inputIndex = objectPaths.add(input); // this sets up the GetTerms call const params = MethodParams.build().objectPath(inputIndex); // call the method const methodIndex = objectPaths.add(method("GetTerms", params, // actions objectPath())); // setup the parent relationship even though they are seperated in the collection objectPaths.addChildRelationship(parentIndex, methodIndex); return new Terms(this, objectPaths); } /** * Gets the site collection group associated with the current site * * @param createIfMissing If true the group will be created, otherwise null (default: false) */ getSiteCollectionGroup(createIfMissing = false) { const objectPaths = this._objectPaths.clone(); const methodParent = objectPaths.lastIndex; const siteIndex = objectPaths.siteIndex; const params = MethodParams.build().objectPath(siteIndex).boolean(createIfMissing); const methodIndex = objectPaths.add(method("GetSiteCollectionGroup", params, // actions objectPath())); // the parent of this method call is this instance, not the current/site objectPaths.addChildRelationship(methodParent, methodIndex); return new TermGroup(this, objectPaths); } /** * Adds a working language to the TermStore * * @param lcid The locale identifier of the working language to add */ addLanguage(lcid) { const params = MethodParams.build().number(lcid); return this.invokeNonQuery("AddLanguage", params); } /** * Creates a new Group in this TermStore * * @param name The name of the new Group being created * @param id The ID (Guid) that the new group should have */ addGroup(name, id = getGUID()) { const params = MethodParams.build() .string(name) .string(sanitizeGuid(id)); this._useCaching = false; return this.invokeMethod("CreateGroup", params) .then(r => extend(this.getTermGroupById(r.Id), r)); } /** * Commits all updates to the database that have occurred since the last commit or rollback */ commitAll() { return this.invokeNonQuery("CommitAll"); } /** * Delete a working language from the TermStore * * @param lcid locale ID for the language to be deleted */ deleteLanguage(lcid) { const params = MethodParams.build().number(lcid); return this.invokeNonQuery("DeleteLanguage", params); } /** * Discards all updates that have occurred since the last commit or rollback */ rollbackAll() { return this.invokeNonQuery("RollbackAll"); } /** * Updates the cache */ updateCache() { return this.invokeNonQuery("UpdateCache"); } /** * Updates the specified properties of this term set, not all properties can be updated * * @param properties Plain object representing the properties and new values to update */ update(properties) { return this.invokeUpdate(properties, TermStore); } /** * This method makes sure that this instance is aware of all child terms that are used in the current site collection */ updateUsedTermsOnSite() { const objectPaths = this._objectPaths.clone(); const methodParent = objectPaths.lastIndex; const siteIndex = objectPaths.siteIndex; const params = MethodParams.build().objectPath(siteIndex); const methodIndex = objectPaths.add(method("UpdateUsedTermsOnSite", params)); // the parent of this method call is this instance, not the current context/site objectPaths.addChildRelationship(methodParent, methodIndex); return this.send(objectPaths); } /** * Gets a list of changes * * @param info Lookup information */ getChanges(info) { const objectPaths = this._objectPaths.clone(); const methodParent = objectPaths.lastIndex; const inputIndex = objectPaths.add(objConstructor("{1f849fb0-4fcb-4a54-9b01-9152b9e482d3}", // actions objectPath(), ...objectProperties(info))); const params = MethodParams.build().objectPath(inputIndex); const methodIndex = objectPaths.add(method("GetChanges", params, // actions objectPath(), opQuery([], this.getSelects()))); objectPaths.addChildRelationship(methodParent, methodIndex); return this.send(objectPaths); } } /** * The root taxonomy object */ class Session extends ClientSvcQueryable { constructor(webUrl = "") { super(webUrl); // everything starts with the session this._objectPaths.add(staticMethod("GetTaxonomySession", "{981cbc68-9edc-4f8d-872f-71146fcbb84f}", // actions objectPath())); } /** * The collection of term stores */ get termStores() { return new TermStores(this); } /** * Provides access to sp.setup from @pnp/sp * * @param config Configuration */ setup(config) { sp.setup(config); } /** * Creates a new batch */ createBatch() { return new ObjectPathBatch(this.toUrl()); } /** * Gets the default keyword termstore for this session */ getDefaultKeywordTermStore() { return this.getChild(TermStore, "GetDefaultKeywordsTermStore", null); } /** * Gets the default site collection termstore for this session */ getDefaultSiteCollectionTermStore() { return this.getChild(TermStore, "GetDefaultSiteCollectionTermStore", null); } } var StringMatchOption; (function (StringMatchOption) { StringMatchOption[StringMatchOption["StartsWith"] = 0] = "StartsWith"; StringMatchOption[StringMatchOption["ExactMatch"] = 1] = "ExactMatch"; })(StringMatchOption || (StringMatchOption = {})); var ChangedItemType; (function (ChangedItemType) { ChangedItemType[ChangedItemType["Unknown"] = 0] = "Unknown"; ChangedItemType[ChangedItemType["Term"] = 1] = "Term"; ChangedItemType[ChangedItemType["TermSet"] = 2] = "TermSet"; ChangedItemType[ChangedItemType["Group"] = 3] = "Group"; ChangedItemType[ChangedItemType["TermStore"] = 4] = "TermStore"; ChangedItemType[ChangedItemType["Site"] = 5] = "Site"; })(ChangedItemType || (ChangedItemType = {})); var ChangedOperationType; (function (ChangedOperationType) { ChangedOperationType[ChangedOperationType["Unknown"] = 0] = "Unknown"; ChangedOperationType[ChangedOperationType["Add"] = 1] = "Add"; ChangedOperationType[ChangedOperationType["Edit"] = 2] = "Edit"; ChangedOperationType[ChangedOperationType["DeleteObject"] = 3] = "DeleteObject"; ChangedOperationType[ChangedOperationType["Move"] = 4] = "Move"; ChangedOperationType[ChangedOperationType["Copy"] = 5] = "Copy"; ChangedOperationType[ChangedOperationType["PathChange"] = 6] = "PathChange"; ChangedOperationType[ChangedOperationType["Merge"] = 7] = "Merge"; ChangedOperationType[ChangedOperationType["ImportObject"] = 8] = "ImportObject"; ChangedOperationType[ChangedOperationType["Restore"] = 9] = "Restore"; })(ChangedOperationType || (ChangedOperationType = {})); // export an existing session instance const taxonomy = new Session(); export { taxonomy, Labels, Label, Session, TermGroup, Terms, Term, TermSets, TermSet, TermStores, TermStore, StringMatchOption, ChangedItemType, ChangedOperationType }; //# sourceMappingURL=sp-taxonomy.js.map
{ "content_hash": "27433e41dde8a196ab88fcaad86ffe74", "timestamp": "", "source": "github", "line_count": 687, "max_line_length": 186, "avg_line_length": 33.68122270742358, "alnum_prop": 0.6016681792644453, "repo_name": "seogi1004/cdnjs", "id": "5446d6ab07ca79a748f8722cc57544bfe2fb25db", "size": "23456", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "ajax/libs/pnp-sp-taxonomy/1.2.2-1/sp-taxonomy.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
package com.gmail.jiangyang5157.sudoku.puzzle.render.cell; import android.graphics.Canvas; import android.graphics.Paint; import com.gmail.jiangyang5157.sudoku.puzzle.render.EditableComponent; public class Cell extends EditableComponent { private CellStateController stateControler = null; public Cell() { super(); stateControler = new CellStateController(); stateControler.setState(NormalCell.ID); } @Override public void update() { stateControler.getState().update(this); } @Override public void render(Canvas canvas, Paint paint) { stateControler.getState().render(this, canvas, paint); } public CellStateController getStateControler() { return stateControler; } }
{ "content_hash": "08f8940bc2422e5f540e5c6db75a92f9", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 70, "avg_line_length": 24.03125, "alnum_prop": 0.7022106631989596, "repo_name": "jiangyang5157/sudoku-endless", "id": "d41d0873de7d3c6a03a9413c12d6099f981ef7de", "size": "769", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/gmail/jiangyang5157/sudoku/puzzle/render/cell/Cell.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "236883" } ], "symlink_target": "" }
try: from django.conf.urls import patterns, include, url except ImportError: # django < 1.4 from django.conf.urls.defaults import patterns, include, url urlpatterns = patterns('reportengine.views', # Listing of reports url('^$', 'report_list', name='reports-list'), # view report redirected to current date format (requires date_field argument) url('^current/(?P<daterange>(day|week|month|year))/(?P<namespace>[-\w]+)/(?P<slug>[-\w]+)/$', 'current_redirect', name='reports-current'), # view report redirected to current date format with formatting specified url('^current/(?P<daterange>(day|week|month|year))/(?P<namespace>[-\w]+)/(?P<slug>[-\w]+)/(?P<output>[-\w]+)/$', 'current_redirect', name='reports-current-format'), # specify range of report per time (requires date_field) url('^date/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/(?P<namespace>[-\w]+)/(?P<slug>[-\w]+)/$', 'day_redirect', name='reports-date-range'), # specify range of report per time with formatting url('^date/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/(?P<namespace>[-\w]+)/(?P<slug>[-\w]+)/(?P<output>[-\w]+)/$', 'day_redirect', name='reports-date-range-format'), # Show latest calendar of all date accessible reports url('^calendar/$', 'calendar_current_redirect', name='reports-calendar-current'), # Show specific month's calendar of reports url('^calendar/(?P<year>\d+)/(?P<month>\d+)/$', 'calendar_month_view', name='reports-calendar-month'), # Show specifi day's calendar of reports url('^calendar/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/$', 'calendar_day_view', name='reports-calendar-day'), ) urlpatterns += patterns('reportengine.views', # View report in first output style url('^request/(?P<namespace>[-\w]+)/(?P<slug>[-\w]+)/$', 'request_report', name='reports-view'), # view report in specified output format #url('^request/(?P<namespace>[-\w]+)/(?P<slug>[-\w]+)/(?P<output>[-\w]+)/$', 'request_report', name='reports-view-format'), url('^view/(?P<token>[\w\d]+)/$', 'view_report', name='reports-request-view'), # view report in specified output format url('^view/(?P<token>[\w\d]+)/(?P<output>[-\w]+)/$', 'view_report_export', name='reports-request-view-format'), )
{ "content_hash": "3d0703fc5720f8081737f093bd967673", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 127, "avg_line_length": 55.90243902439025, "alnum_prop": 0.6226003490401396, "repo_name": "dmpayton/django-reportengine", "id": "d20829254a111c69e404e80a703ef1c74bd1a252", "size": "2292", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "reportengine/urls.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "10143" }, { "name": "Python", "bytes": "89815" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "eff304014a550a0e4806cb7807e0a174", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "69087460cb2df4a27bd1b199170f3784837d73c2", "size": "181", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Agoseris/Agoseris monticola/ Syn. Agoseris covillei/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package org.elasticsearch.index.query; import org.apache.lucene.search.*; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.hamcrest.Matchers; import java.io.IOException; import java.util.*; import static org.elasticsearch.index.query.QueryBuilders.*; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.instanceOf; public class BoolQueryBuilderTests extends AbstractQueryTestCase<BoolQueryBuilder> { @Override protected BoolQueryBuilder doCreateTestQueryBuilder() { BoolQueryBuilder query = new BoolQueryBuilder(); if (randomBoolean()) { query.adjustPureNegative(randomBoolean()); } if (randomBoolean()) { query.disableCoord(randomBoolean()); } if (randomBoolean()) { query.minimumNumberShouldMatch(randomMinimumShouldMatch()); } int mustClauses = randomIntBetween(0, 3); for (int i = 0; i < mustClauses; i++) { query.must(RandomQueryBuilder.createQuery(random())); } int mustNotClauses = randomIntBetween(0, 3); for (int i = 0; i < mustNotClauses; i++) { query.mustNot(RandomQueryBuilder.createQuery(random())); } int shouldClauses = randomIntBetween(0, 3); for (int i = 0; i < shouldClauses; i++) { query.should(RandomQueryBuilder.createQuery(random())); } int filterClauses = randomIntBetween(0, 3); for (int i = 0; i < filterClauses; i++) { query.filter(RandomQueryBuilder.createQuery(random())); } return query; } @Override protected void doAssertLuceneQuery(BoolQueryBuilder queryBuilder, Query query, QueryShardContext context) throws IOException { if (!queryBuilder.hasClauses()) { assertThat(query, instanceOf(MatchAllDocsQuery.class)); } else { List<BooleanClause> clauses = new ArrayList<>(); clauses.addAll(getBooleanClauses(queryBuilder.must(), BooleanClause.Occur.MUST, context)); clauses.addAll(getBooleanClauses(queryBuilder.mustNot(), BooleanClause.Occur.MUST_NOT, context)); clauses.addAll(getBooleanClauses(queryBuilder.should(), BooleanClause.Occur.SHOULD, context)); clauses.addAll(getBooleanClauses(queryBuilder.filter(), BooleanClause.Occur.FILTER, context)); if (clauses.isEmpty()) { assertThat(query, instanceOf(MatchAllDocsQuery.class)); } else { assertThat(query, instanceOf(BooleanQuery.class)); BooleanQuery booleanQuery = (BooleanQuery) query; assertThat(booleanQuery.isCoordDisabled(), equalTo(queryBuilder.disableCoord())); if (queryBuilder.adjustPureNegative()) { boolean isNegative = true; for (BooleanClause clause : clauses) { if (clause.isProhibited() == false) { isNegative = false; break; } } if (isNegative) { clauses.add(new BooleanClause(new MatchAllDocsQuery(), BooleanClause.Occur.MUST)); } } assertThat(booleanQuery.clauses().size(), equalTo(clauses.size())); Iterator<BooleanClause> clauseIterator = clauses.iterator(); for (BooleanClause booleanClause : booleanQuery.getClauses()) { assertThat(booleanClause, instanceOf(clauseIterator.next().getClass())); } } } } private static List<BooleanClause> getBooleanClauses(List<QueryBuilder> queryBuilders, BooleanClause.Occur occur, QueryShardContext context) throws IOException { List<BooleanClause> clauses = new ArrayList<>(); for (QueryBuilder query : queryBuilders) { Query innerQuery = query.toQuery(context); if (innerQuery != null) { clauses.add(new BooleanClause(innerQuery, occur)); } } return clauses; } @Override protected Map<String, BoolQueryBuilder> getAlternateVersions() { Map<String, BoolQueryBuilder> alternateVersions = new HashMap<>(); BoolQueryBuilder tempQueryBuilder = createTestQueryBuilder(); BoolQueryBuilder expectedQuery = new BoolQueryBuilder(); String contentString = "{\n" + " \"bool\" : {\n"; if (tempQueryBuilder.must().size() > 0) { QueryBuilder must = tempQueryBuilder.must().get(0); contentString += "must: " + must.toString() + ","; expectedQuery.must(must); } if (tempQueryBuilder.mustNot().size() > 0) { QueryBuilder mustNot = tempQueryBuilder.mustNot().get(0); contentString += (randomBoolean() ? "must_not: " : "mustNot: ") + mustNot.toString() + ","; expectedQuery.mustNot(mustNot); } if (tempQueryBuilder.should().size() > 0) { QueryBuilder should = tempQueryBuilder.should().get(0); contentString += "should: " + should.toString() + ","; expectedQuery.should(should); } if (tempQueryBuilder.filter().size() > 0) { QueryBuilder filter = tempQueryBuilder.filter().get(0); contentString += "filter: " + filter.toString() + ","; expectedQuery.filter(filter); } contentString = contentString.substring(0, contentString.length() - 1); contentString += " } \n" + "}"; alternateVersions.put(contentString, expectedQuery); return alternateVersions; } public void testIllegalArguments() { BoolQueryBuilder booleanQuery = new BoolQueryBuilder(); try { booleanQuery.must(null); fail("cannot be null"); } catch (IllegalArgumentException e) { } try { booleanQuery.mustNot(null); fail("cannot be null"); } catch (IllegalArgumentException e) { } try { booleanQuery.filter(null); fail("cannot be null"); } catch (IllegalArgumentException e) { } try { booleanQuery.should(null); fail("cannot be null"); } catch (IllegalArgumentException e) { } } // https://github.com/elasticsearch/elasticsearch/issues/7240 public void testEmptyBooleanQuery() throws Exception { XContentBuilder contentBuilder = XContentFactory.contentBuilder(randomFrom(XContentType.values())); BytesReference query = contentBuilder.startObject().startObject("bool").endObject().endObject().bytes(); Query parsedQuery = parseQuery(query).toQuery(createShardContext()); assertThat(parsedQuery, Matchers.instanceOf(MatchAllDocsQuery.class)); } public void testDefaultMinShouldMatch() throws Exception { // Queries have a minShouldMatch of 0 BooleanQuery bq = (BooleanQuery) parseQuery(boolQuery().must(termQuery("foo", "bar")).buildAsBytes()).toQuery(createShardContext()); assertEquals(0, bq.getMinimumNumberShouldMatch()); bq = (BooleanQuery) parseQuery(boolQuery().should(termQuery("foo", "bar")).buildAsBytes()).toQuery(createShardContext()); assertEquals(0, bq.getMinimumNumberShouldMatch()); // Filters have a minShouldMatch of 0/1 ConstantScoreQuery csq = (ConstantScoreQuery) parseQuery(constantScoreQuery(boolQuery().must(termQuery("foo", "bar"))).buildAsBytes()).toQuery(createShardContext()); bq = (BooleanQuery) csq.getQuery(); assertEquals(0, bq.getMinimumNumberShouldMatch()); csq = (ConstantScoreQuery) parseQuery(constantScoreQuery(boolQuery().should(termQuery("foo", "bar"))).buildAsBytes()).toQuery(createShardContext()); bq = (BooleanQuery) csq.getQuery(); assertEquals(1, bq.getMinimumNumberShouldMatch()); } public void testMinShouldMatchFilterWithoutShouldClauses() throws Exception { BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder(); boolQueryBuilder.filter(new BoolQueryBuilder().must(new MatchAllQueryBuilder())); Query query = boolQueryBuilder.toQuery(createShardContext()); assertThat(query, instanceOf(BooleanQuery.class)); BooleanQuery booleanQuery = (BooleanQuery) query; assertThat(booleanQuery.getMinimumNumberShouldMatch(), equalTo(0)); assertThat(booleanQuery.clauses().size(), equalTo(1)); BooleanClause booleanClause = booleanQuery.clauses().get(0); assertThat(booleanClause.getOccur(), equalTo(BooleanClause.Occur.FILTER)); assertThat(booleanClause.getQuery(), instanceOf(BooleanQuery.class)); BooleanQuery innerBooleanQuery = (BooleanQuery) booleanClause.getQuery(); //we didn't set minimum should match initially, there are no should clauses so it should be 0 assertThat(innerBooleanQuery.getMinimumNumberShouldMatch(), equalTo(0)); assertThat(innerBooleanQuery.clauses().size(), equalTo(1)); BooleanClause innerBooleanClause = innerBooleanQuery.clauses().get(0); assertThat(innerBooleanClause.getOccur(), equalTo(BooleanClause.Occur.MUST)); assertThat(innerBooleanClause.getQuery(), instanceOf(MatchAllDocsQuery.class)); } public void testMinShouldMatchFilterWithShouldClauses() throws Exception { BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder(); boolQueryBuilder.filter(new BoolQueryBuilder().must(new MatchAllQueryBuilder()).should(new MatchAllQueryBuilder())); Query query = boolQueryBuilder.toQuery(createShardContext()); assertThat(query, instanceOf(BooleanQuery.class)); BooleanQuery booleanQuery = (BooleanQuery) query; assertThat(booleanQuery.getMinimumNumberShouldMatch(), equalTo(0)); assertThat(booleanQuery.clauses().size(), equalTo(1)); BooleanClause booleanClause = booleanQuery.clauses().get(0); assertThat(booleanClause.getOccur(), equalTo(BooleanClause.Occur.FILTER)); assertThat(booleanClause.getQuery(), instanceOf(BooleanQuery.class)); BooleanQuery innerBooleanQuery = (BooleanQuery) booleanClause.getQuery(); //we didn't set minimum should match initially, but there are should clauses so it should be 1 assertThat(innerBooleanQuery.getMinimumNumberShouldMatch(), equalTo(1)); assertThat(innerBooleanQuery.clauses().size(), equalTo(2)); BooleanClause innerBooleanClause1 = innerBooleanQuery.clauses().get(0); assertThat(innerBooleanClause1.getOccur(), equalTo(BooleanClause.Occur.MUST)); assertThat(innerBooleanClause1.getQuery(), instanceOf(MatchAllDocsQuery.class)); BooleanClause innerBooleanClause2 = innerBooleanQuery.clauses().get(1); assertThat(innerBooleanClause2.getOccur(), equalTo(BooleanClause.Occur.SHOULD)); assertThat(innerBooleanClause2.getQuery(), instanceOf(MatchAllDocsQuery.class)); } }
{ "content_hash": "ae20cc6b7e2901d5bfee598f77971b50", "timestamp": "", "source": "github", "line_count": 229, "max_line_length": 173, "avg_line_length": 49.33187772925764, "alnum_prop": 0.6556607949013012, "repo_name": "wbowling/elasticsearch", "id": "7bd8ffeefd3a7ecfcd33a6480112c22473b5359d", "size": "12085", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "core/src/test/java/org/elasticsearch/index/query/BoolQueryBuilderTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "11703" }, { "name": "Emacs Lisp", "bytes": "3243" }, { "name": "Groovy", "bytes": "121090" }, { "name": "HTML", "bytes": "3624" }, { "name": "Java", "bytes": "30078058" }, { "name": "Perl", "bytes": "264378" }, { "name": "Perl6", "bytes": "103207" }, { "name": "Python", "bytes": "91088" }, { "name": "Ruby", "bytes": "17776" }, { "name": "Shell", "bytes": "93129" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.sxdsf.sample.lesson1.Lesson1Activity"> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="Button"/> </RelativeLayout>
{ "content_hash": "c12424ba0ec6ebb2fa89fb9b1cd95ca4", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 62, "avg_line_length": 34.0625, "alnum_prop": 0.6844036697247706, "repo_name": "SxdsF/Async", "id": "40ea9cd9cee4db6e6aeaee99448ffd1c79e85919", "size": "545", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sample/src/main/res/layout/activity_lesson1.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1132" } ], "symlink_target": "" }
package com.facebook.buck.slb; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import java.net.URI; import java.util.List; import java.util.ListIterator; public class ServerHealthState { private static final int MAX_STORED_SAMPLES = 100; private final int maxSamplesStored; private final URI server; private final List<LatencySample> pingLatencies; private final List<RequestSample> requests; public ServerHealthState(URI server) { this(server, MAX_STORED_SAMPLES); } public ServerHealthState(URI server, int maxSamplesStored) { Preconditions.checkArgument( maxSamplesStored > 0, "The maximum number of samples stored must be positive instead of [%d].", maxSamplesStored); this.maxSamplesStored = maxSamplesStored; this.server = server; this.pingLatencies = Lists.newLinkedList(); this.requests = Lists.newLinkedList(); } /** * NOTE: Assumes nowMillis is roughly non-decreasing in consecutive calls. * @param nowMillis * @param latencyMillis */ public void reportPingLatency(long nowMillis, long latencyMillis) { synchronized (pingLatencies) { pingLatencies.add(new LatencySample(nowMillis, latencyMillis)); keepWithinSizeLimit(pingLatencies); } } /** * NOTE: Assumes nowMillis is roughly non-decreasing in consecutive calls. * @param nowMillis */ public void reportRequestSuccess(long nowMillis) { reportRequest(nowMillis, true); } /** * NOTE: Assumes nowMillis is roughly non-decreasing in consecutive calls. * @param nowMillis */ public void reportRequestError(long nowMillis) { reportRequest(nowMillis, false); } private void reportRequest(long nowMillis, boolean wasSuccessful) { synchronized (requests) { requests.add(new RequestSample(nowMillis, wasSuccessful)); keepWithinSizeLimit(requests); } } public int getPingLatencySampleCount() { synchronized (pingLatencies) { return pingLatencies.size(); } } public int getRequestSampleCount() { synchronized (requests) { return requests.size(); } } private <T> void keepWithinSizeLimit(List<T> list) { while (list.size() > maxSamplesStored) { // Assume list is time sorted; always remove oldest sample. list.remove(0); } } /** * @param nowMillis Current timestamp. * @param timeRangeMillis Time range for 'nowMillis' to compute the errorPercentage for. * * @return Value in the interval [0.0, 1.0]. */ public float getErrorPercentage(long nowMillis, int timeRangeMillis) { int errorCount = 0; int requestCount = 0; long initialMillis = nowMillis - timeRangeMillis; synchronized (requests) { ListIterator<RequestSample> iterator = requests.listIterator(requests.size()); while (iterator.hasPrevious()) { RequestSample sample = iterator.previous(); long requestMillis = sample.getEpochMillis(); if (requestMillis >= initialMillis && requestMillis <= nowMillis) { if (!sample.wasSuccessful()) { ++errorCount; } ++requestCount; } } } if (requestCount == 0) { return 0; } else { return errorCount / ((float) requestCount); } } public URI getServer() { return server; } public long getPingLatencyMillis(long nowMillis, int timeRangeMillis) { int count = 0; int sum = 0; long initialMillis = nowMillis - timeRangeMillis; synchronized (pingLatencies) { ListIterator<LatencySample> iterator = pingLatencies.listIterator(pingLatencies.size()); while (iterator.hasPrevious()) { LatencySample sample = iterator.previous(); if (sample.getEpochMillis() >= initialMillis && sample.getEpochMillis() <= nowMillis) { sum += sample.getLatencyMillis(); ++count; } } } if (count > 0) { return sum / count; } else { return -1; } } public String toString(long nowMillis, int timeRangeMillis) { return "ServerHealthState{" + "server=" + server + ", latencyMillis=" + getPingLatencyMillis(nowMillis, timeRangeMillis) + ", errorCount=" + getErrorPercentage(nowMillis, timeRangeMillis) + '}'; } private static final class RequestSample { private final long epochMillis; private final boolean wasSuccessful; private RequestSample(long epochMillis, boolean wasSuccessful) { this.epochMillis = epochMillis; this.wasSuccessful = wasSuccessful; } public long getEpochMillis() { return epochMillis; } public boolean wasSuccessful() { return wasSuccessful; } } private static final class LatencySample { private final long latencyMillis; private final long epochMillis; public LatencySample(long epochMillis, long latencyMillis) { this.latencyMillis = latencyMillis; this.epochMillis = epochMillis; } public long getLatencyMillis() { return latencyMillis; } public long getEpochMillis() { return epochMillis; } } }
{ "content_hash": "eec7a501f9746116d2c3868ec139f845", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 94, "avg_line_length": 27.089005235602095, "alnum_prop": 0.6702744491689215, "repo_name": "bocon13/buck", "id": "056f2a60e9c100aff080339d382a5e588412b668", "size": "5779", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/com/facebook/buck/slb/ServerHealthState.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "579" }, { "name": "Batchfile", "bytes": "726" }, { "name": "C", "bytes": "247940" }, { "name": "C#", "bytes": "237" }, { "name": "C++", "bytes": "6441" }, { "name": "CSS", "bytes": "54863" }, { "name": "D", "bytes": "1017" }, { "name": "Go", "bytes": "14733" }, { "name": "Groovy", "bytes": "3362" }, { "name": "HTML", "bytes": "7935" }, { "name": "Haskell", "bytes": "590" }, { "name": "IDL", "bytes": "128" }, { "name": "Java", "bytes": "13964667" }, { "name": "JavaScript", "bytes": "931960" }, { "name": "Lex", "bytes": "2442" }, { "name": "Makefile", "bytes": "1791" }, { "name": "Matlab", "bytes": "47" }, { "name": "OCaml", "bytes": "3075" }, { "name": "Objective-C", "bytes": "123994" }, { "name": "Objective-C++", "bytes": "34" }, { "name": "PowerShell", "bytes": "244" }, { "name": "Python", "bytes": "376745" }, { "name": "Roff", "bytes": "440" }, { "name": "Rust", "bytes": "938" }, { "name": "Scala", "bytes": "898" }, { "name": "Shell", "bytes": "35301" }, { "name": "Smalltalk", "bytes": "608" }, { "name": "Swift", "bytes": "3735" }, { "name": "Thrift", "bytes": "2452" }, { "name": "Yacc", "bytes": "323" } ], "symlink_target": "" }
package com.google.appengine.datanucleus.test.jpa; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; /** * @author Max Ross <[email protected]> */ @Entity public class HasFloatJPA { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private float aFloat; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public double getAFloat() { return aFloat; } public void setAFloat(float aFloat) { this.aFloat = aFloat; } }
{ "content_hash": "956b868a8718858ced43f37fa07d8169", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 51, "avg_line_length": 18.314285714285713, "alnum_prop": 0.6692667706708268, "repo_name": "GoogleCloudPlatform/datanucleus-appengine", "id": "c736ee4005fa201d48dc785a219e9b28e7d03a6b", "size": "1350", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/com/google/appengine/datanucleus/test/jpa/HasFloatJPA.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "9071" }, { "name": "HTML", "bytes": "119265" }, { "name": "Java", "bytes": "4245207" }, { "name": "JavaScript", "bytes": "692658" }, { "name": "Python", "bytes": "4920" } ], "symlink_target": "" }
========= Changelog ========= 2.5.0 ===== * Adding ``this`` expressions * Restructuring the library * Adding Python 3 support * Killing ``construct.text`` (it's highly inefficient and it was a side-project anyway) * Adding Travis CI tests * Kill old site in favor of ``readthedocs`` 2.06 ==== Bugfixes -------- * Fix regression with Containers not being printable (#10) 2.05 ==== Bugfixes -------- * Add a license (#1) * Fix text parsing of hex and binary (#2) * Container fixups * Proper dictionary behavior in corner cases * Correct bool(), len(), and "in" operator Enhancements ------------ * Introduce strong unit tests * Container improvements * Fully implement dict interface * Speedups * Container creation is around 3.8x faster * Container attribute setting is around 4.1x faster * Container iteration is around 1.6x faster Removals -------- * Completely replace AttrDict with Container Other ----- * Too many whitespace cleanups to count * Lots of docstring cleanups * Lots of documentation * Documentation cleanups (#3, #8)
{ "content_hash": "1102f950b1d4dc658354fb631968f3d7", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 87, "avg_line_length": 19.410714285714285, "alnum_prop": 0.672493100275989, "repo_name": "0000-bigtree/construct", "id": "0e6fc5c5947fcb61c0df1668bae66140700de6bc", "size": "1087", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "CHANGELOG.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "4602" }, { "name": "Python", "bytes": "301889" }, { "name": "Shell", "bytes": "4758" } ], "symlink_target": "" }
<?php namespace SabreForRainLoop\CalDAV\Property; use SabreForRainLoop\CalDAV\SharingPlugin as SharingPlugin; use SabreForRainLoop\DAV; use SabreForRainLoop\CalDAV; class Invite extends DAV\Property { /** * The list of users a calendar has been shared to. * * @var array */ protected $users; /** * The organizer contains information about the person who shared the * object. * * @var array */ protected $organizer; /** * Creates the property. * * Users is an array. Each element of the array has the following * properties: * * * href - Often a mailto: address * * commonName - Optional, for example a first and lastname for a user. * * status - One of the SharingPlugin::STATUS_* constants. * * readOnly - true or false * * summary - Optional, description of the share * * The organizer key is optional to specify. It's only useful when a * 'sharee' requests the sharing information. * * The organizer may have the following properties: * * href - Often a mailto: address. * * commonName - Optional human-readable name. * * firstName - Optional first name. * * lastName - Optional last name. * * If you wonder why these two structures are so different, I guess a * valid answer is that the current spec is still a draft. * * @param array $users */ public function __construct(array $users, array $organizer = null) { $this->users = $users; $this->organizer = $organizer; } /** * Returns the list of users, as it was passed to the constructor. * * @return array */ public function getValue() { return $this->users; } /** * Serializes the property in a DOMDocument * * @param DAV\Server $server * @param \DOMElement $node * @return void */ public function serialize(DAV\Server $server,\DOMElement $node) { $doc = $node->ownerDocument; if (!is_null($this->organizer)) { $xorganizer = $doc->createElement('cs:organizer'); $href = $doc->createElement('d:href'); $href->appendChild($doc->createTextNode($this->organizer['href'])); $xorganizer->appendChild($href); if (isset($this->organizer['commonName']) && $this->organizer['commonName']) { $commonName = $doc->createElement('cs:common-name'); $commonName->appendChild($doc->createTextNode($this->organizer['commonName'])); $xorganizer->appendChild($commonName); } if (isset($this->organizer['firstName']) && $this->organizer['firstName']) { $firstName = $doc->createElement('cs:first-name'); $firstName->appendChild($doc->createTextNode($this->organizer['firstName'])); $xorganizer->appendChild($firstName); } if (isset($this->organizer['lastName']) && $this->organizer['lastName']) { $lastName = $doc->createElement('cs:last-name'); $lastName->appendChild($doc->createTextNode($this->organizer['lastName'])); $xorganizer->appendChild($lastName); } $node->appendChild($xorganizer); } foreach($this->users as $user) { $xuser = $doc->createElement('cs:user'); $href = $doc->createElement('d:href'); $href->appendChild($doc->createTextNode($user['href'])); $xuser->appendChild($href); if (isset($user['commonName']) && $user['commonName']) { $commonName = $doc->createElement('cs:common-name'); $commonName->appendChild($doc->createTextNode($user['commonName'])); $xuser->appendChild($commonName); } switch($user['status']) { case SharingPlugin::STATUS_ACCEPTED : $status = $doc->createElement('cs:invite-accepted'); $xuser->appendChild($status); break; case SharingPlugin::STATUS_DECLINED : $status = $doc->createElement('cs:invite-declined'); $xuser->appendChild($status); break; case SharingPlugin::STATUS_NORESPONSE : $status = $doc->createElement('cs:invite-noresponse'); $xuser->appendChild($status); break; case SharingPlugin::STATUS_INVALID : $status = $doc->createElement('cs:invite-invalid'); $xuser->appendChild($status); break; } $xaccess = $doc->createElement('cs:access'); if ($user['readOnly']) { $xaccess->appendChild( $doc->createElement('cs:read') ); } else { $xaccess->appendChild( $doc->createElement('cs:read-write') ); } $xuser->appendChild($xaccess); if (isset($user['summary']) && $user['summary']) { $summary = $doc->createElement('cs:summary'); $summary->appendChild($doc->createTextNode($user['summary'])); $xuser->appendChild($summary); } $node->appendChild($xuser); } } /** * Unserializes the property. * * This static method should return a an instance of this object. * * @param \DOMElement $prop * @return DAV\IProperty */ static function unserialize(\DOMElement $prop) { $xpath = new \DOMXPath($prop->ownerDocument); $xpath->registerNamespace('cs', CalDAV\Plugin::NS_CALENDARSERVER); $xpath->registerNamespace('d', 'urn:DAV'); $users = array(); foreach($xpath->query('cs:user', $prop) as $user) { $status = null; if ($xpath->evaluate('boolean(cs:invite-accepted)', $user)) { $status = SharingPlugin::STATUS_ACCEPTED; } elseif ($xpath->evaluate('boolean(cs:invite-declined)', $user)) { $status = SharingPlugin::STATUS_DECLINED; } elseif ($xpath->evaluate('boolean(cs:invite-noresponse)', $user)) { $status = SharingPlugin::STATUS_NORESPONSE; } elseif ($xpath->evaluate('boolean(cs:invite-invalid)', $user)) { $status = SharingPlugin::STATUS_INVALID; } else { throw new DAV\Exception('Every cs:user property must have one of cs:invite-accepted, cs:invite-declined, cs:invite-noresponse or cs:invite-invalid'); } $users[] = array( 'href' => $xpath->evaluate('string(d:href)', $user), 'commonName' => $xpath->evaluate('string(cs:common-name)', $user), 'readOnly' => $xpath->evaluate('boolean(cs:access/cs:read)', $user), 'summary' => $xpath->evaluate('string(cs:summary)', $user), 'status' => $status, ); } return new self($users); } }
{ "content_hash": "48914c295891246d88b3b03f8cf71645", "timestamp": "", "source": "github", "line_count": 216, "max_line_length": 165, "avg_line_length": 33.282407407407405, "alnum_prop": 0.5452775073028238, "repo_name": "RainLoop/rainloop-webmail", "id": "7a8683acb18d2ff4060e6dee702348f026f9ca13", "size": "7668", "binary": false, "copies": "21", "ref": "refs/heads/master", "path": "rainloop/v/0.0.0/app/libraries/SabreForRainLoop/CalDAV/Property/Invite.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4717" }, { "name": "Dockerfile", "bytes": "1199" }, { "name": "HTML", "bytes": "253438" }, { "name": "Hack", "bytes": "14" }, { "name": "JavaScript", "bytes": "770242" }, { "name": "Less", "bytes": "136308" }, { "name": "Makefile", "bytes": "1701" }, { "name": "PHP", "bytes": "4569318" }, { "name": "Shell", "bytes": "7471" } ], "symlink_target": "" }
package com.intellij.codeInsight.generation; import com.intellij.codeInsight.CodeInsightActionHandler; import com.intellij.codeInsight.CodeInsightUtilBase; import com.intellij.lang.CodeInsightActions; import com.intellij.lang.Language; import com.intellij.lang.LanguageCodeInsightActionHandler; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiUtilBase; import org.jetbrains.annotations.NotNull; public class OverrideMethodsHandler implements CodeInsightActionHandler{ @Override public final void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) { if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return; if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)){ return; } Language language = PsiUtilBase.getLanguageAtOffset(file, editor.getCaretModel().getOffset()); final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.OVERRIDE_METHOD.forLanguage(language); if (codeInsightActionHandler != null) { codeInsightActionHandler.invoke(project, editor, file); } } @Override public boolean startInWriteAction() { return false; } }
{ "content_hash": "98da2e722191f2da7ec5a79b5012d93a", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 127, "avg_line_length": 37.861111111111114, "alnum_prop": 0.8033749082905356, "repo_name": "lshain-android-source/tools-idea", "id": "ef1b513bed4f9bd3ade48d1a00451c5b7bf8a880", "size": "1963", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "platform/lang-impl/src/com/intellij/codeInsight/generation/OverrideMethodsHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "182" }, { "name": "C", "bytes": "172277" }, { "name": "C#", "bytes": "390" }, { "name": "C++", "bytes": "77776" }, { "name": "CSS", "bytes": "11575" }, { "name": "Erlang", "bytes": "10" }, { "name": "FLUX", "bytes": "57" }, { "name": "Groovy", "bytes": "1838147" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "117312672" }, { "name": "JavaScript", "bytes": "112" }, { "name": "Objective-C", "bytes": "19631" }, { "name": "Perl", "bytes": "6549" }, { "name": "Python", "bytes": "2787996" }, { "name": "Shell", "bytes": "68540" }, { "name": "XSLT", "bytes": "113531" } ], "symlink_target": "" }
RSpec.configure do |config| config.raise_errors_for_deprecations! end require 'codeclimate-test-reporter' CodeClimate::TestReporter.start # This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rspec/rails' require 'webmock/rspec' require 'database_cleaner' DatabaseCleaner.strategy = :truncation WebMock.disable_net_connect!(allow: 'codeclimate.com') # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # Checks for pending migrations before tests are run. # If you are not using ActiveRecord, you can remove this line. ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration) RSpec.configure do |config| # ## Mock Framework # # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: # # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rr # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. # config.use_transactional_fixtures = true # If true, the base class of anonymous controllers will be inferred # automatically. This will be the default behavior in future versions of # rspec-rails. config.infer_base_class_for_anonymous_controllers = true config.infer_spec_type_from_file_location! # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = 'random' # # Our tests won't work with the default localhost wildcard user record in mysql # We also need a few innodb settings in order for stats to update automatically. # config.before :suite do count_of_bad_users = ActiveRecord::Base.connection.select_value("select count(*) from mysql.user where Host='localhost' and User=''") if count_of_bad_users > 0 raise %Q{You must delete the Host='localhost' User='' record from the mysql.users table.\nRun this command:\nmysql -u root -e "DELETE FROM mysql.user WHERE Host='localhost' AND User=''"} end variable_records = ActiveRecord::Base.connection.select_rows("show variables like 'innodb_stats_%'") variables = Hash[ ActiveRecord::Base.connection.select_rows("show variables like 'innodb_stats_%'") ] raise <<-TEXT.strip_heredoc unless variables['innodb_stats_on_metadata'] == 'ON' innodb_stats_on_metadata must be ON Option 1 (permanent): set innodb_stats_on_metadata=ON in my.cnf Option 2 (temporary): `mysql -uroot -e "SET GLOBAL innodb_stats_on_metadata=ON"` TEXT raise <<-TEXT.strip_heredoc if variables['innodb_stats_persistent'] == 'ON' innodb_stats_persistent must be OFF Option 1 (permanent): set innodb_stats_persistent=OFF in my.cnf Option 2 (temporary): `mysql -uroot -e "SET GLOBAL innodb_stats_persistent=OFF"` TEXT end config.after do DatabaseCleaner.clean end end
{ "content_hash": "727c55a4f06556c038a1c9774cc8c637", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 192, "avg_line_length": 39.325581395348834, "alnum_prop": 0.7247191011235955, "repo_name": "cloudfoundry/cf-mysql-broker", "id": "e60ab12fdf24efc4a0a460e4488ba33f60cbedb8", "size": "3382", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/spec_helper.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "409188" }, { "name": "HTML", "bytes": "2576" }, { "name": "JavaScript", "bytes": "42" }, { "name": "Ruby", "bytes": "157582" } ], "symlink_target": "" }
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; import org.jspecify.annotations.NullnessUnspecified; @NullMarked class TypeVariableUnspecToObjectUnionNull< Never1T, ChildOfNever1T extends Never1T, UnspecChildOfNever1T extends @NullnessUnspecified Never1T, NullChildOfNever1T extends @Nullable Never1T, // Never2T extends Object, ChildOfNever2T extends Never2T, UnspecChildOfNever2T extends @NullnessUnspecified Never2T, NullChildOfNever2T extends @Nullable Never2T, // UnspecT extends @NullnessUnspecified Object, ChildOfUnspecT extends UnspecT, UnspecChildOfUnspecT extends @NullnessUnspecified UnspecT, NullChildOfUnspecT extends @Nullable UnspecT, // ParametricT extends @Nullable Object, ChildOfParametricT extends ParametricT, UnspecChildOfParametricT extends @NullnessUnspecified ParametricT, NullChildOfParametricT extends @Nullable ParametricT, // UnusedT> { @Nullable Object x0(@NullnessUnspecified Never1T x) { return x; } @Nullable Object x1(@NullnessUnspecified ChildOfNever1T x) { return x; } @Nullable Object x2(@NullnessUnspecified UnspecChildOfNever1T x) { return x; } @Nullable Object x3(@NullnessUnspecified NullChildOfNever1T x) { return x; } @Nullable Object x4(@NullnessUnspecified Never2T x) { return x; } @Nullable Object x5(@NullnessUnspecified ChildOfNever2T x) { return x; } @Nullable Object x6(@NullnessUnspecified UnspecChildOfNever2T x) { return x; } @Nullable Object x7(@NullnessUnspecified NullChildOfNever2T x) { return x; } @Nullable Object x8(@NullnessUnspecified UnspecT x) { return x; } @Nullable Object x9(@NullnessUnspecified ChildOfUnspecT x) { return x; } @Nullable Object x10(@NullnessUnspecified UnspecChildOfUnspecT x) { return x; } @Nullable Object x11(@NullnessUnspecified NullChildOfUnspecT x) { return x; } @Nullable Object x12(@NullnessUnspecified ParametricT x) { return x; } @Nullable Object x13(@NullnessUnspecified ChildOfParametricT x) { return x; } @Nullable Object x14(@NullnessUnspecified UnspecChildOfParametricT x) { return x; } @Nullable Object x15(@NullnessUnspecified NullChildOfParametricT x) { return x; } }
{ "content_hash": "41f010d84c043d54118f2be12bacb8d0", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 73, "avg_line_length": 25.150537634408604, "alnum_prop": 0.7396323215049166, "repo_name": "jspecify/jspecify", "id": "8b05a36f1a9246ad48b76c4bee1317952ebdf4be", "size": "2943", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "samples/TypeVariableUnspecToObjectUnionNull.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "62861" } ], "symlink_target": "" }
package at.ac.tuwien.dsg.mela.common.elasticityAnalysis.concepts.elasticityPathway; import at.ac.tuwien.dsg.mela.common.elasticityAnalysis.concepts.elasticityPathway.som.Neuron; import at.ac.tuwien.dsg.mela.common.elasticityAnalysis.concepts.elasticityPathway.som.SOM2; import at.ac.tuwien.dsg.mela.common.elasticityAnalysis.concepts.elasticityPathway.som.SimpleSOMStrategy; import at.ac.tuwien.dsg.mela.common.monitoringConcepts.Metric; import at.ac.tuwien.dsg.mela.common.monitoringConcepts.MetricValue; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Level; import org.apache.log4j.Logger; /** * Author: Daniel Moldovan E-Mail: [email protected] * * */ public class InMemoryEncounterRateElasticityPathway { int cellsSize = 10; int upperNormalizationValue = 100; public List<InMemoryEncounterRateElasticityPathway.SignatureEntry> getElasticitySignature(Map<Metric, List<MetricValue>> dataToClassify) { SOM2 som = new SOM2(cellsSize, dataToClassify.keySet().size(), 0, upperNormalizationValue, new SimpleSOMStrategy()); List<SignatureEntry> mapped = new ArrayList<SignatureEntry>(); //classify all monitoring data //need to go trough all monitoring data, and push the classified items, such that I respect the monitored sequence. if (dataToClassify.values().isEmpty()) { Logger.getLogger(this.getClass()).log(Level.ERROR, "Empty data to classify as elasticity pathway"); return null; } int maxIndex = dataToClassify.values().iterator().next().size(); for (int i = 0; i < maxIndex; i++) { SignatureEntry signatureEntry = new SignatureEntry(); for (Metric metric : dataToClassify.keySet()) { List<MetricValue> values = dataToClassify.get(metric); //maybe we have diff value count for different metrics. Not sure when his might happen though. if (values.size() <= i) { Logger.getLogger(this.getClass()).log(Level.ERROR, "Less values for metric " + mapped); break; } signatureEntry.addEntry(metric, values.get(i)); } mapped.add(signatureEntry); } //train map completely pathway entries for (SignatureEntry signatureEntry : mapped) { //build the mappedNeuron used to classify the situation ArrayList<Double> values = new ArrayList<Double>(); //for each metric column, get value from measurement row for (MetricValue value : signatureEntry.classifiedSituation.values()) { //avoid using non-numeric values. Although a non-numeric value should not happen if (value.getValueType() == MetricValue.ValueType.NUMERIC) { values.add(Double.parseDouble(value.getValueRepresentation())); } else { Logger.getLogger(this.getClass()).log(Level.ERROR, "Elasticity Pathway can't be applied on non-numeric metric value " + value); } } Neuron neuron = som.updateMap(new Neuron(values)); } //computes neuron usage statistics per entire map som.updateMapUsage(); //classify all entries for (SignatureEntry signatureEntry : mapped) { //build the mappedNeuron used to classify the situation ArrayList<Double> values = new ArrayList<Double>(); //for each metric column, get value from measurement row for (MetricValue value : signatureEntry.classifiedSituation.values()) { //avoid using non-numeric values. Although a non-numeric value should not happen if (value.getValueType() == MetricValue.ValueType.NUMERIC) { values.add(Double.parseDouble(value.getValueRepresentation())); } else { Logger.getLogger(this.getClass()).log(Level.ERROR, "Elasticity Pathway can;t be applied on non-numeric metric value " + value); } } Neuron neuron = som.classifySituation(new Neuron(values)); signatureEntry.mappedNeuron = neuron; } //classify entries by encounterRate? Nooo? Yes? Who Knows? I mean, we need to be carefull not to lose monitoring information //we might need two things to do: 1 to say in 1 chart this metric point is usual, this not //the second to say ok in usual case the metric value combinations are .. //currently we go with the second, for which we did not need storing the order of the monitoring data in the entries, but it might be useful later // Map<NeuronUsageLevel, List<SignatureEntry>> pathway = new LinkedHashMap<NeuronUsageLevel, List<SignatureEntry>>(); // List<SignatureEntry> rare = new ArrayList<SignatureEntry>(); // List<SignatureEntry> neutral = new ArrayList<SignatureEntry>(); // List<SignatureEntry> dominant = new ArrayList<SignatureEntry>(); // // pathway.put(NeuronUsageLevel.DOMINANT, rare); // pathway.put(NeuronUsageLevel.NEUTRAL, neutral); // pathway.put(NeuronUsageLevel.RARE, dominant); // // for (SignatureEntry signatureEntry : mapped) { // switch (signatureEntry.getMappedNeuron().getUsageLevel()) { // case RARE: // rare.add(signatureEntry); // break; // case NEUTRAL: // neutral.add(signatureEntry); // break; // case DOMINANT: // dominant.add(signatureEntry); // break; // } // } //returning all, such that I can sort them after occurrence and say this pair of values has been encountered 70% return mapped; } public List<Neuron> getSituationGroups(Map<Metric, List<MetricValue>> dataToClassify) { SOM2 som = new SOM2(cellsSize, dataToClassify.keySet().size(), 0, upperNormalizationValue, new SimpleSOMStrategy()); List<SignatureEntry> mapped = new ArrayList<SignatureEntry>(); //classify all monitoring data //need to go trough all monitoring data, and push the classified items, such that I respect the monitored sequence. if (dataToClassify.values().size() == 0) { Logger.getLogger(this.getClass()).log(Level.ERROR, "Empty data to classify as elasticity pathway"); return null; } int maxIndex = dataToClassify.values().iterator().next().size(); for (int i = 0; i < maxIndex; i++) { SignatureEntry signatureEntry = new SignatureEntry(); for (Metric metric : dataToClassify.keySet()) { List<MetricValue> values = dataToClassify.get(metric); //maybe we have diff value count for different metrics. Not sure when his might happen though. if (values.size() <= i) { Logger.getLogger(this.getClass()).log(Level.ERROR, "Less values for metric " + mapped); break; } signatureEntry.addEntry(metric, values.get(i)); } mapped.add(signatureEntry); } //train map completely pathway entries for (SignatureEntry signatureEntry : mapped) { //build the mappedNeuron used to classify the situation ArrayList<Double> values = new ArrayList<Double>(); //for each metric column, get value from measurement row for (MetricValue value : signatureEntry.classifiedSituation.values()) { //avoid using non-numeric values. Although a non-numeric value should not happen if (value.getValueType() == MetricValue.ValueType.NUMERIC) { values.add(Double.parseDouble(value.getValueRepresentation())); } else { Logger.getLogger(this.getClass()).log(Level.ERROR, "Elasticity Pathway can't be applied on non-numeric metric value " + value); } } Neuron neuron = som.updateMap(new Neuron(values)); } //computes neuron usage statistics per entire map som.updateMapUsage(); //classify all entries for (SignatureEntry signatureEntry : mapped) { //build the mappedNeuron used to classify the situation ArrayList<Double> values = new ArrayList<Double>(); //for each metric column, get value from measurement row for (MetricValue value : signatureEntry.classifiedSituation.values()) { //avoid using non-numeric values. Although a non-numeric value should not happen if (value.getValueType() == MetricValue.ValueType.NUMERIC) { values.add(Double.parseDouble(value.getValueRepresentation())); } else { Logger.getLogger(this.getClass()).log(Level.ERROR, "Elasticity Pathway can;t be applied on non-numeric metric value " + value); } } Neuron neuron = som.classifySituation(new Neuron(values)); signatureEntry.mappedNeuron = neuron; } //returning all, such that I can sort them after occurrence and say this pair of values has been encountered 70% List<Neuron> neurons = new ArrayList<Neuron>(); for (Neuron neuron : som) { if (neuron.getMappedWeights() > 0) { neurons.add(neuron); } } //sort the list by occurence Collections.sort(neurons, new Comparator<Neuron>() { public int compare(Neuron o1, Neuron o2) { return o1.getUsagePercentage().compareTo(o2.getUsagePercentage()); } }); return neurons; } public class SignatureEntry { private Neuron mappedNeuron; private Map<Metric, MetricValue> classifiedSituation; { classifiedSituation = new LinkedHashMap<Metric, MetricValue>(); } public Neuron getMappedNeuron() { return mappedNeuron; } public Map<Metric, MetricValue> getClassifiedSituation() { return classifiedSituation; } private void addEntry(Metric metric, MetricValue value) { classifiedSituation.put(metric, value.clone()); } } public InMemoryEncounterRateElasticityPathway withCellsSize(final int cellsSize) { this.cellsSize = cellsSize; return this; } public InMemoryEncounterRateElasticityPathway withUpperNormalizationValue(final int upperNormalizationValue) { this.upperNormalizationValue = upperNormalizationValue; return this; } }
{ "content_hash": "bbddb20e39ac5cf0b36ed90d12672db3", "timestamp": "", "source": "github", "line_count": 250, "max_line_length": 154, "avg_line_length": 43.832, "alnum_prop": 0.6294944332907465, "repo_name": "tuwiendsg/MELA", "id": "731b1e5efb61618db9cfaab23f52412663c26667", "size": "11736", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MELA-Core/MELA-Common/src/main/java/at/ac/tuwien/dsg/mela/common/elasticityAnalysis/concepts/elasticityPathway/InMemoryEncounterRateElasticityPathway.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "245937" }, { "name": "HTML", "bytes": "844879" }, { "name": "Java", "bytes": "2859855" }, { "name": "JavaScript", "bytes": "1208998" }, { "name": "Python", "bytes": "203971" }, { "name": "R", "bytes": "12601" }, { "name": "Shell", "bytes": "1906" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "cf4d8a93499d1485089ff00b6de0a1c7", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "26d78b71448faaf436a9cc73e389a2f2c2e0af01", "size": "175", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Caesalpiniaceae/Cuba/Cuba paniculata/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright and this notice and otherwise comply with the Use Terms. /** * @path ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-3-87-1.js * @description Object.defineProperty - 'Attributes' is an Array object that uses Object's [[Get]] method to access the 'configurable' property (8.10.5 step 4.a) */ function testcase() { var obj = {}; try { Array.prototype.configurable = true; var arrObj = [1, 2, 3]; Object.defineProperty(obj, "property", arrObj); var beforeDeleted = obj.hasOwnProperty("property"); delete obj.property; var afterDeleted = obj.hasOwnProperty("property"); return beforeDeleted === true && afterDeleted === false; } finally { delete Array.prototype.configurable; } } runTestCase(testcase);
{ "content_hash": "46d80aa6a1076b2b5cfd12d16691cc96", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 161, "avg_line_length": 37.96774193548387, "alnum_prop": 0.6236193712829227, "repo_name": "mbebenita/shumway.ts", "id": "d07f2529eecccee6d5cae3eb57569f8c55432a1a", "size": "1177", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "tests/Fidelity/test262/suite/ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-3-87-1.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Elixir", "bytes": "3294" }, { "name": "JavaScript", "bytes": "24658966" }, { "name": "Shell", "bytes": "386" }, { "name": "TypeScript", "bytes": "18287003" } ], "symlink_target": "" }
Copy files into your screeps directory. ### Dependencies The `cache` and `broadcaster` modules have the ability to compress data using [`lzstring`](https://github.com/pieroxy/lz-string) as long as the library is available. To install it simply copy [this file](https://raw.githubusercontent.com/pieroxy/lz-string/master/libs/lz-string.js) to your screeps directory as `lib_lzstring`. ## Usage ### Loading ```javascript // Initialize library into global for easy access. global.sos_lib = require('sos_lib') ``` ### Tick Start Some libraries require initialization each tick to run. For the `segments` library this is needed to ensure data split across multiple segments gets properly reconstructured, and for the `stormtracker` needs to run each tick to identify global reset storms. ```javascript sos_lib.segments.moveToGlobalCache() sos_lib.stormtracker.track() ``` ### Close Some of the libraries require some processing at the end of the tick. ```javascript // Flush dirty vram pages to segments. sos_lib.vram.saveDirty() // Update the public segment with the latest channel information if it is // out of date. sos_lib.broadcaster.saveIndexSegment() // Process segments- clean no longer used ones, flush memory buffer, set public // segments, set default public segment. sos_lib.segments.process() ```
{ "content_hash": "aeea979e38e81786dcefc092cecd7ef0", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 126, "avg_line_length": 26.979591836734695, "alnum_prop": 0.7609682299546142, "repo_name": "ScreepsOS/sos-library", "id": "73d386461215cd4ed9e67b3b0b71e5659515bb11", "size": "1349", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "52581" } ], "symlink_target": "" }
/* * 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. */ package com.facebook.presto.type; import com.facebook.presto.spi.ConnectorSession; import com.facebook.presto.spi.PrestoException; import com.facebook.presto.spi.block.Block; import com.facebook.presto.spi.block.BlockBuilder; import com.facebook.presto.spi.block.BlockBuilderStatus; import com.facebook.presto.spi.type.AbstractType; import org.joni.Regex; import static com.facebook.presto.spi.StandardErrorCode.INTERNAL_ERROR; import static com.facebook.presto.type.TypeUtils.parameterizedTypeName; public class LikePatternType extends AbstractType { public static final LikePatternType LIKE_PATTERN = new LikePatternType(); public static final String NAME = "LikePattern"; public LikePatternType() { super(parameterizedTypeName(NAME), Regex.class); } @Override public Object getObjectValue(ConnectorSession session, Block block, int position) { throw new UnsupportedOperationException(); } @Override public void appendTo(Block block, int position, BlockBuilder blockBuilder) { throw new UnsupportedOperationException(); } @Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry) { throw new PrestoException(INTERNAL_ERROR, "LikePattern type cannot be serialized"); } @Override public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries) { throw new PrestoException(INTERNAL_ERROR, "LikePattern type cannot be serialized"); } }
{ "content_hash": "8aa637b69f56216a1f0e00c1466d0364", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 129, "avg_line_length": 35.22950819672131, "alnum_prop": 0.7566309911586785, "repo_name": "denizdemir/presto", "id": "c149462109d5a1982543ec0efdd7f92d957fa939", "size": "2149", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "presto-main/src/main/java/com/facebook/presto/type/LikePatternType.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "16249" }, { "name": "HTML", "bytes": "37047" }, { "name": "Java", "bytes": "10645220" }, { "name": "JavaScript", "bytes": "1431" }, { "name": "Makefile", "bytes": "6819" }, { "name": "PLSQL", "bytes": "7343" }, { "name": "Python", "bytes": "4481" }, { "name": "SQLPL", "bytes": "9680" } ], "symlink_target": "" }
Author: Kegham Karsian This is a simple chat app using socket.io Install nodejs npm install to install dependencies node server.js and start listening to server on localhost:3000 Enter name & room name: Depending on the room you are in tell your friends to check in the same room too so you would chat together in group. If no room name was entered you will be in the main chat room. lastly i have added a alert sound feature using ion-sound to alert you even if you are not on the same website tab.
{ "content_hash": "a8c7b22ae6d18a5fcd1ed8d9f51db2c1", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 117, "avg_line_length": 31.75, "alnum_prop": 0.781496062992126, "repo_name": "keegho/socketsBasic", "id": "c6d7862314479012273cea5955be0b3fc2c2e214", "size": "532", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "297" }, { "name": "HTML", "bytes": "2618" }, { "name": "JavaScript", "bytes": "138876" } ], "symlink_target": "" }
package com.njackson.sensor; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.util.Log; import com.njackson.application.IInjectionContainer; import com.njackson.application.modules.ForApplication; import com.njackson.events.GPSServiceCommand.GPSStatus; import com.njackson.events.BleServiceCommand.BleStatus; import com.njackson.events.base.BaseStatus; import com.njackson.service.IServiceCommand; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import javax.inject.Inject; public class BLEServiceCommand implements IServiceCommand { private final String TAG = "PB-BleServiceCommand"; @Inject @ForApplication Context _applicationContext; @Inject Bus _bus; @Inject SharedPreferences _sharedPreferences; @Inject IBle _hrm; IInjectionContainer _container; private BaseStatus.Status _currentStatus= BaseStatus.Status.NOT_INITIALIZED; private boolean _registrered_bus = false; @Override public void execute(IInjectionContainer container) { container.inject(this); _registrered_bus = false; if (isHrmActivated()) { _bus.register(this); _registrered_bus = true; _container = container; _currentStatus = BaseStatus.Status.INITIALIZED; } } @Override public void dispose() { if (isHrmActivated() && _registrered_bus) { _bus.unregister(this); _registrered_bus = false; } } private boolean isHrmActivated() { return _applicationContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) // note: double check FEATURE_BLUETOOTH_LE + android version because the 1st test (hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) seems to return true on some 4.1 & 4.2 && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2 // BLE requires 4.3 (Api level 18) && (!_sharedPreferences.getString("hrm_address", "").equals("") || !_sharedPreferences.getString("hrm_address2", "").equals("") || !_sharedPreferences.getString("hrm_address3", "").equals("")); } @Override public BaseStatus.Status getStatus() { return null; } @Subscribe public void onGPSStatusEvent(GPSStatus event) { switch(event.getStatus()) { case STARTED: if(_currentStatus != BaseStatus.Status.STARTED) { start(); } break; case STOPPED: if(_currentStatus == BaseStatus.Status.STARTED) { stop(); } } } private void start() { Log.d(TAG, "start"); if (!_sharedPreferences.getString("hrm_address", "").equals("") || !_sharedPreferences.getString("hrm_address2", "").equals("") || !_sharedPreferences.getString("hrm_address3", "").equals("")) { _hrm.start(_sharedPreferences.getString("hrm_address", ""), _sharedPreferences.getString("hrm_address2", ""), _sharedPreferences.getString("hrm_address3", ""), _bus, _container); _currentStatus = BaseStatus.Status.STARTED; } else { _currentStatus = BaseStatus.Status.UNABLE_TO_START; } _bus.post(new BleStatus(_currentStatus)); } public void stop() { Log.d(TAG, "stop"); if(_currentStatus != BaseStatus.Status.STARTED) { Log.d(TAG, "not started, unable to stop"); return; } _hrm.stop(); _currentStatus = BaseStatus.Status.STOPPED; _bus.post(new BleStatus(_currentStatus)); } }
{ "content_hash": "12dc644e02dda8107fa1784a1d2c3511", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 209, "avg_line_length": 36.588235294117645, "alnum_prop": 0.6396034297963559, "repo_name": "pebble-bike/PebbleBike-AndroidApp", "id": "03559e5e6d746b64e3fe428a9b679ab52495b155", "size": "3732", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "app/src/main/java/com/njackson/sensor/BLEServiceCommand.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "537049" }, { "name": "Shell", "bytes": "369" } ], "symlink_target": "" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S15.2.1.1_A2_T4; * @section: 15.2.1.1; * @assertion: When the Object function is called with one argument value, * and the value neither is null nor undefined, and is supplied, return ToObject(value); * @description: Calling Object function with object argument value; */ obj = {flag:true}; //CHECK#1 if (typeof(obj) !== 'object') { $FAIL('#1: obj = {flag:true} should be an Object'); } n_obj = Object(obj); //CHECK#2 if ((n_obj !== obj)||(!(n_obj['flag']))) { $ERROR('#2: Object({flag:true}) returns ToObject({flag:true})'); }
{ "content_hash": "03c6e34fee20508c5f3a71f5d9bda72f", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 87, "avg_line_length": 27.32, "alnum_prop": 0.6632503660322109, "repo_name": "hnafar/IronJS", "id": "4ee745317a9051f7f4eee61591e4fcbf75038b3b", "size": "683", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "Src/Tests/Sputnik/sputnik-v1/tests/Conformance/15_Native_ECMA_Script_Objects/15.2_Object_Objects/15.2.1_The_Object_Constructor_Called_as_a_Function/S15.2.1.1_A2_T4.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "280" }, { "name": "C#", "bytes": "2984769" }, { "name": "CSS", "bytes": "1167" }, { "name": "F#", "bytes": "353515" }, { "name": "HTML", "bytes": "9405" }, { "name": "JavaScript", "bytes": "19853921" }, { "name": "Python", "bytes": "13630" }, { "name": "Shell", "bytes": "1454" } ], "symlink_target": "" }
<法規> <法規性質>法律</法規性質> <英文法規名稱>The Export-import Bank of the Republic of China Act Taiwan, Republic of China</英文法規名稱> <中文法規名稱>中國輸出入銀行條例</中文法規名稱> <法規網址>https://law.moj.gov.tw/Eng/LawClass/LawAll.aspx?pcode=G0380010</法規網址> <最新英文異動日期>20150701</最新英文異動日期> <廢止註記> </廢止註記> <附件 /> <沿革內容><![CDATA[1.Promulgated under Presidential Order No. Tai-Tung (1) I-Tzu 2547 dated July 21, 1978; and 2.Amended under Presidential Order No. Hua-Tsung (1) I-Tzu 1849 dated April 16, 1984. 3.Amended under Presidential Order No. Hua-Tsung (1) I-Tzu 10400077221 dated July 1, 2015.]]></沿革內容> <前言><![CDATA[]]></前言> <法規內容> <條文> <條號>Article 1</條號> <條文內容><![CDATA[The Export-Import Bank of the Republic of China (hereinafter the "Bank") is hereby established by the Government of the Republic of China for the purpose of promoting export trade and economic development, and shall be under the supervision of the Ministry of Finance. The Bank shall be a juristic person.]]></條文內容> </條文> <條文> <條號>Article 2</條號> <條文內容><![CDATA[The capital of the Bank shall be appropriated to it by the national treasury.]]></條文內容> </條文> <條文> <條號>Article 3</條號> <條文內容><![CDATA[The head office of the Bank shall be situated in the location where the R.O.C Central Government is seated. The Bank may establish branch offices whenever necessary.]]></條文內容> </條文> <條文> <條號>Article 4</條號> <條文內容><![CDATA[The Bank may engage in the following business: (1) To provide guarantee facilities and medium- or long-term financing facilities for payment of the export price of machinery, equipment, and other capital goods, or technical service fees in connection therewith; (2) To provide guarantee facilities and medium- or long-term financing facilities to exporters making investments in foreign countries to secure the supply of essential raw materials or to expand export trade, and to provide guarantee facilities called for by construction contracts or to provide medium- or long-term funding required by engineering firms in connection with construction projects abroad; (3) To provide guarantee and medium-term financing facilities to export firms for the price of imported raw materials, equipment, and parts related to their export business; (4) To provide guarantee facilities to export firms to facilitate their obtaining short-term financial facilities; (5) To conduct export insurance business as approved by the Financial Supervisory Commission; (6) To engage in market survey, credit investigation, consultation, and other services domestically or overseas; and (7) To engage in other businesses as authorized by the Financial Supervisory Commission.]]></條文內容> </條文> <條文> <條號>Article 5</條號> <條文內容><![CDATA[Subject to approval of the Ministry of Finance, the Bank may raise funds by borrowing from overseas or by issuing short-term notes or medium or long-term bonds in domestic or foreign capital markets.]]></條文內容> </條文> <條文> <條號>Article 6</條號> <條文內容><![CDATA[The Bank may assign to other financial institutions credits obtained from the Bank's extension of financial facilities. The Bank may also accept the assignment from other financial institutions of credits related to export and import financing.]]></條文內容> </條文> <條文> <條號>Article 7</條號> <條文內容><![CDATA[The Bank's Board of Directors shall act as its policy-making instrumentality. The Board of Directors shall be composed of five to seven Directors appointed by the Ministry of Finance. Three of the Directors shall be appointed as Managing Directors, and one of the Managing Directors shall be appointed as Chairman of the Board. The term of office of the Directors shall be three years. Upon expiration of the term of office, all Directors shall be eligible for reappointment.]]></條文內容> </條文> <條文> <條號>Article 8</條號> <條文內容><![CDATA[The authority of the Board of Directors shall be as follows: (1) To approve the business policies and business plans of the Bank; (2) To deal with matters in connection with the establishment, dissolution or change of status of branch offices; (3) To act upon budgets and fiscal accounts of the Bank; (4) To determine the maximum amounts of loans, guarantee facilities, export insurance and investment business which offices of the Bank are authorized to make, and to approve transactions exceeding such maximum authorized amounts; (5) To act upon the appointment and dismissal of senior officers; (6) To act upon important regulations and rules of the Bank and the execution of important contracts; and (7) To deal with other matters as specified in this Act or in the Articles of Association of the Bank. The Board of Directors may delegate all or part of its authority stated above to the Board of Managing Directors. Resolutions adopted by the Board of Managing Directors shall be reported to the Board of Directors for approval or notification.]]></條文內容> </條文> <條文> <條號>Article 9</條號> <條文內容><![CDATA[The Bank shall have a Board of Supervisors to act as its controlling instrumentality. The Board of Supervisors shall be composed of three Supervisors appointed by the Ministry of Finance, with one of them appointed as a Resident Supervisor. The term of office of the Supervisors shall be one year. Upon expiration of the term of office, all Supervisors shall be eligible for reappointment.]]></條文內容> </條文> <條文> <條號>Article 10</條號> <條文內容><![CDATA[The authority of the Board of Supervisors shall be as follows: (1) To audit all accounts and to conduct periodic examinations of the assets and liabilities of the Bank; (2) To audit the financial accounts of the Bank at the end of each fiscal year; (3) To report to appropriate authorities any violations of this Act and the Articles of Association, regulations or rules of the Bank; and (4) To exercise all other authority stipulated in law or in the Articles of Association of the Bank.]]></條文內容> </條文> <條文> <條號>Article 11</條號> <條文內容><![CDATA[The Bank shall have a President appointed by the Ministry of Finance. The President shall be generally in charge of the operations of the Bank under the direction of the Board of Directors. The Bank shall have not less than one nor more than two Executive Vice Presidents to assist the President in managing the operations of the Bank. The Executive Vice President(s) shall be nominated by the President and approved by the Board of Directors.]]></條文內容> </條文> <條文> <條號>Article 12</條號> <條文內容><![CDATA[In cases where there are bad loans resulting from business operations of the Bank, the write-off of such bad loans shall be handled by the Board of Directors in accordance with authorizations from the Ministry of Finance; the Ministry of Finance shall, in accordance with the Income Tax Law, determine the maximum amount(s) for such authorizations.]]></條文內容> </條文> <條文> <條號>Article 12-1</條號> <條文內容><![CDATA[The Bank shall set aside the first forty percent (40%) of its annual net profit as a legal reserve fund.]]></條文內容> </條文> <條文> <條號>Article 12-2</條號> <條文內容><![CDATA[In cases where the Bank suffers a loss, such loss shall first be made up by its reserve fund. In cases where the reserve fund is not sufficient to make up a loss, the balance shall be replenished by funds appropriated by the Government in accordance with applicable budget procedures.]]></條文內容> </條文> <條文> <條號>Article 13</條號> <條文內容><![CDATA[All matters not specifically provided for in this Act shall be dealt with in accordance with the Banking Act and other applicable laws.]]></條文內容> </條文> <條文> <條號>Article 14</條號> <條文內容><![CDATA[This Act shall become effective as of the date of promulgation.]]></條文內容> </條文> </法規內容> </法規>
{ "content_hash": "8e596f721eb07195d321756609c9f855", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 504, "avg_line_length": 76.53465346534654, "alnum_prop": 0.754333764553687, "repo_name": "kong0107/mojLawSplitXML", "id": "d053c84a0309322863440a011a8430e13a35d6d1", "size": "8444", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "Eng_FalVMingLing/G0380010.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "277" }, { "name": "JavaScript", "bytes": "9357" } ], "symlink_target": "" }
@echo off pushd %~dp0 "%VS120COMNTOOLS%..\IDE\mstest" /test:Microsoft.Protocols.TestSuites.MS_LISTSWS.S02_OperationOnContentType.MSLISTSWS_S02_TC09_CreateContentType_IncorrectDisplayName /testcontainer:..\..\MS-LISTSWS\TestSuite\bin\Debug\MS-LISTSWS_TestSuite.dll /runconfig:..\..\MS-LISTSWS\MS-LISTSWS.testsettings /unique pause
{ "content_hash": "16428b8369309369dff12fa7e7c72b90", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 301, "avg_line_length": 82.25, "alnum_prop": 0.8115501519756839, "repo_name": "XinwLi/Interop-TestSuites-1", "id": "706744efd5707162468dc53ca4ba22b9b5781308", "size": "329", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "SharePoint/Source/Scripts/MS-LISTSWS/RunMSLISTSWS_S02_TC09_CreateContentType_IncorrectDisplayName.cmd", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "1421" }, { "name": "Batchfile", "bytes": "1149773" }, { "name": "C", "bytes": "154398" }, { "name": "C#", "bytes": "160448942" }, { "name": "C++", "bytes": "26321" }, { "name": "PowerShell", "bytes": "1499733" } ], "symlink_target": "" }
import re from .mesonlib import MesonException class ParseException(MesonException): def __init__(self, text, lineno, colno): super().__init__(text) self.lineno = lineno self.colno = colno class Token: def __init__(self, tid, lineno, colno, value): self.tid = tid self.lineno = lineno self.colno = colno self.value = value def __eq__(self, other): if isinstance(other, str): return self.tid == other return self.tid == other.tid class Lexer: def __init__(self): self.keywords = {'true', 'false', 'if', 'else', 'elif', 'endif', 'and', 'or', 'not', 'foreach', 'endforeach'} self.token_specification = [ # Need to be sorted longest to shortest. ('ignore', re.compile(r'[ \t]')), ('id', re.compile('[_a-zA-Z][_0-9a-zA-Z]*')), ('number', re.compile(r'\d+')), ('eol_cont', re.compile(r'\\\n')), ('eol', re.compile(r'\n')), ('multiline_string', re.compile(r"'''(.|\n)*?'''", re.M)), ('comment', re.compile(r'\#.*')), ('lparen', re.compile(r'\(')), ('rparen', re.compile(r'\)')), ('lbracket', re.compile(r'\[')), ('rbracket', re.compile(r'\]')), ('dblquote', re.compile(r'"')), ('string', re.compile(r"'([^'\\]|(\\.))*'")), ('comma', re.compile(r',')), ('plusassign', re.compile(r'\+=')), ('dot', re.compile(r'\.')), ('plus', re.compile(r'\+')), ('dash', re.compile(r'-')), ('star', re.compile(r'\*')), ('percent', re.compile(r'\%')), ('fslash', re.compile(r'/')), ('colon', re.compile(r':')), ('equal', re.compile(r'==')), ('nequal', re.compile(r'\!=')), ('assign', re.compile(r'=')), ('le', re.compile(r'<=')), ('lt', re.compile(r'<')), ('ge', re.compile(r'>=')), ('gt', re.compile(r'>')), ('questionmark', re.compile(r'\?')), ] def lex(self, code): lineno = 1 line_start = 0 loc = 0; par_count = 0 bracket_count = 0 col = 0 while(loc < len(code)): matched = False value = None for (tid, reg) in self.token_specification: mo = reg.match(code, loc) if mo: curline = lineno col = mo.start()-line_start matched = True loc = mo.end() match_text = mo.group() if tid == 'ignore' or tid == 'comment': break elif tid == 'lparen': par_count += 1 elif tid == 'rparen': par_count -= 1 elif tid == 'lbracket': bracket_count += 1 elif tid == 'rbracket': bracket_count -= 1 elif tid == 'dblquote': raise ParseException('Double quotes are not supported. Use single quotes.', lineno, col) elif tid == 'string': value = match_text[1:-1].replace(r"\'", "'").replace(r" \\ ".strip(), r" \ ".strip())\ .replace("\\n", "\n") elif tid == 'multiline_string': tid = 'string' value = match_text[3:-3] lines = match_text.split('\n') if len(lines) > 1: lineno += len(lines) - 1 line_start = mo.end() - len(lines[-1]) elif tid == 'number': value = int(match_text) elif tid == 'eol' or tid == 'eol_cont': lineno += 1 line_start = loc if par_count > 0 or bracket_count > 0: break elif tid == 'id': if match_text in self.keywords: tid = match_text else: value = match_text yield Token(tid, curline, col, value) break if not matched: raise ParseException('lexer', lineno, col) class BooleanNode: def __init__(self, token, value): self.lineno = token.lineno self.colno = token.colno self.value = value assert(isinstance(self.value, bool)) class IdNode: def __init__(self, token): self.lineno = token.lineno self.colno = token.colno self.value = token.value assert(isinstance(self.value, str)) def __str__(self): return "Id node: '%s' (%d, %d)." % (self.value, self.lineno, self.colno) class NumberNode: def __init__(self, token): self.lineno = token.lineno self.colno = token.colno self.value = token.value assert(isinstance(self.value, int)) class StringNode: def __init__(self, token): self.lineno = token.lineno self.colno = token.colno self.value = token.value assert(isinstance(self.value, str)) def __str__(self): return "String node: '%s' (%d, %d)." % (self.value, self.lineno, self.colno) class ArrayNode: def __init__(self, args): self.lineno = args.lineno self.colno = args.colno self.args = args class EmptyNode: def __init__(self): self.lineno = 0 self.colno = 0 self.value = None class OrNode: def __init__(self, lineno, colno, left, right): self.lineno = lineno self.colno = colno self.left = left self.right = right class AndNode: def __init__(self, lineno, colno, left, right): self.lineno = lineno self.colno = colno self.left = left self.right = right class ComparisonNode: def __init__(self, lineno, colno, ctype, left, right): self.lineno = lineno self.colno = colno self.left = left self.right = right self.ctype = ctype class ArithmeticNode: def __init__(self, lineno, colno, operation, left, right): self.lineno = lineno self.colno = colno self.left = left self.right = right self.operation = operation class NotNode: def __init__(self, lineno, colno, value): self.lineno = lineno self.colno = colno self.value = value class CodeBlockNode: def __init__(self, lineno, colno): self.lineno = lineno self.colno = colno self.lines = [] class IndexNode: def __init__(self, iobject, index): self.iobject = iobject self.index = index self.lineno = iobject.lineno self.colno = iobject.colno class MethodNode: def __init__(self, lineno, colno, source_object, name, args): self.lineno = lineno self.colno = colno self.source_object = source_object self.name = name assert(isinstance(self.name, str)) self.args = args class FunctionNode: def __init__(self, lineno, colno, func_name, args): self.lineno = lineno self.colno = colno self.func_name = func_name assert(isinstance(func_name, str)) self.args = args class AssignmentNode: def __init__(self, lineno, colno, var_name, value): self.lineno = lineno self.colno = colno self.var_name = var_name assert(isinstance(var_name, str)) self.value = value class PlusAssignmentNode: def __init__(self, lineno, colno, var_name, value): self.lineno = lineno self.colno = colno self.var_name = var_name assert(isinstance(var_name, str)) self.value = value class ForeachClauseNode(): def __init__(self, lineno, colno, varname, items, block): self.lineno = lineno self.colno = colno self.varname = varname self.items = items self.block = block class IfClauseNode(): def __init__(self, lineno, colno): self.lineno = lineno self.colno = colno self.ifs = [] self.elseblock = EmptyNode() class UMinusNode(): def __init__(self, lineno, colno, value): self.lineno = lineno self.colno = colno self.value = value class IfNode(): def __init__(self, lineno, colno, condition, block): self.lineno = lineno self.colno = colno self.condition = condition self.block = block class TernaryNode(): def __init__(self, lineno, colno, condition, trueblock, falseblock): self.lineno = lineno self.colno = colno self.condition = condition self.trueblock = trueblock self.falseblock = falseblock class ArgumentNode(): def __init__(self, token): self.lineno = token.lineno self.colno = token.colno self.arguments = [] self.kwargs = {} self.order_error = False def prepend(self, statement): if self.num_kwargs() > 0: self.order_error = True if not isinstance(statement, EmptyNode): self.arguments = [statement] + self.arguments def append(self, statement): if self.num_kwargs() > 0: self.order_error = True if not isinstance(statement, EmptyNode): self.arguments = self.arguments + [statement] def set_kwarg(self, name, value): self.kwargs[name] = value def num_args(self): return len(self.arguments) def num_kwargs(self): return len(self.kwargs) def incorrect_order(self): return self.order_error def __len__(self): return self.num_args() # Fixme comparison_map = {'equal': '==', 'nequal': '!=', 'lt': '<', 'le': '<=', 'gt': '>', 'ge': '>=' } # Recursive descent parser for Meson's definition language. # Very basic apart from the fact that we have many precedence # levels so there are not enough words to describe them all. # Enter numbering: # # 1 assignment # 2 or # 3 and # 4 comparison # 5 arithmetic # 6 negation # 7 funcall, method call # 8 parentheses # 9 plain token class Parser: def __init__(self, code): self.stream = Lexer().lex(code) self.getsym() self.in_ternary = False def getsym(self): try: self.current = next(self.stream) except StopIteration: self.current = Token('eof', 0, 0, None) def accept(self, s): if self.current.tid == s: self.getsym() return True return False def expect(self, s): if self.accept(s): return True raise ParseException('Expecting %s got %s.' % (s, self.current.tid), self.current.lineno, self.current.colno) def parse(self): block = self.codeblock() self.expect('eof') return block def statement(self): return self.e1() def e1(self): left = self.e2() if self.accept('plusassign'): value = self.e1() if not isinstance(left, IdNode): raise ParseException('Plusassignment target must be an id.', left.lineno, left.colno) return PlusAssignmentNode(left.lineno, left.colno, left.value, value) elif self.accept('assign'): value = self.e1() if not isinstance(left, IdNode): raise ParseException('Assignment target must be an id.', left.lineno, left.colno) return AssignmentNode(left.lineno, left.colno, left.value, value) elif self.accept('questionmark'): if self.in_ternary: raise ParseException('Nested ternary operators are not allowed.', left.lineno, left.colno) self.in_ternary = True trueblock = self.e1() self.expect('colon') falseblock = self.e1() self.in_ternary = False return TernaryNode(left.lineno, left.colno, left, trueblock, falseblock) return left def e2(self): left = self.e3() while self.accept('or'): left = OrNode(left.lineno, left.colno, left, self.e3()) return left def e3(self): left = self.e4() while self.accept('and'): left = AndNode(left.lineno, left.colno, left, self.e4()) return left def e4(self): left = self.e5() for nodename, operator_type in comparison_map.items(): if self.accept(nodename): return ComparisonNode(left.lineno, left.colno, operator_type, left, self.e5()) return left def e5(self): return self.e5add() def e5add(self): left = self.e5sub() if self.accept('plus'): return ArithmeticNode(left.lineno, left.colno, 'add', left, self.e5add()) return left def e5sub(self): left = self.e5mod() if self.accept('dash'): return ArithmeticNode(left.lineno, left.colno, 'sub', left, self.e5sub()) return left def e5mod(self): left = self.e5mul() if self.accept('percent'): return ArithmeticNode(left.lineno, left.colno, 'mod', left, self.e5mod()) return left def e5mul(self): left = self.e5div() if self.accept('star'): return ArithmeticNode(left.lineno, left.colno, 'mul', left, self.e5mul()) return left def e5div(self): left = self.e6() if self.accept('fslash'): return ArithmeticNode(left.lineno, left.colno, 'div', left, self.e5div()) return left def e6(self): if self.accept('not'): return NotNode(self.current.lineno, self.current.colno, self.e7()) if self.accept('dash'): return UMinusNode(self.current.lineno, self.current.colno, self.e7()) return self.e7() def e7(self): left = self.e8() if self.accept('lparen'): args = self.args() self.expect('rparen') if not isinstance(left, IdNode): raise ParseException('Function call must be applied to plain id', left.lineno, left.colno) left = FunctionNode(left.lineno, left.colno, left.value, args) go_again = True while go_again: go_again = False if self.accept('dot'): go_again = True left = self.method_call(left) if self.accept('lbracket'): go_again = True left = self.index_call(left) return left def e8(self): if self.accept('lparen'): e = self.statement() self.expect('rparen') return e elif self.accept('lbracket'): args = self.args() self.expect('rbracket') return ArrayNode(args) else: return self.e9() def e9(self): t = self.current if self.accept('true'): return BooleanNode(t, True); if self.accept('false'): return BooleanNode(t, False) if self.accept('id'): return IdNode(t) if self.accept('number'): return NumberNode(t) if self.accept('string'): return StringNode(t) return EmptyNode() def args(self): s = self.statement() a = ArgumentNode(s) while not isinstance(s, EmptyNode): if self.accept('comma'): a.append(s) elif self.accept('colon'): if not isinstance(s, IdNode): raise ParseException('Keyword argument must be a plain identifier.', s.lineno, s.colno) a.set_kwarg(s.value, self.statement()) if not self.accept('comma'): return a else: a.append(s) return a s = self.statement() return a def method_call(self, source_object): methodname = self.e9() if not(isinstance(methodname, IdNode)): raise ParseException('Method name must be plain id', self.current.lineno, self.current.colno) self.expect('lparen') args = self.args() self.expect('rparen') method = MethodNode(methodname.lineno, methodname.colno, source_object, methodname.value, args) if self.accept('dot'): return self.method_call(method) return method def index_call(self, source_object): index_statement = self.statement() self.expect('rbracket') return IndexNode(source_object, index_statement) def foreachblock(self): t = self.current self.expect('id') varname = t self.expect('colon') items = self.statement() block = self.codeblock() return ForeachClauseNode(varname.lineno, varname.colno, varname, items, block) def ifblock(self): condition = self.statement() clause = IfClauseNode(condition.lineno, condition.colno) block = self.codeblock() clause.ifs.append(IfNode(clause.lineno, clause.colno, condition, block)) self.elseifblock(clause) clause.elseblock = self.elseblock() return clause def elseifblock(self, clause): while self.accept('elif'): s = self.statement() self.expect('eol') b = self.codeblock() clause.ifs.append(IfNode(s.lineno, s.colno, s, b)) def elseblock(self): if self.accept('else'): self.expect('eol') return self.codeblock() def line(self): if self.current == 'eol': return EmptyNode() if self.accept('if'): block = self.ifblock() self.expect('endif') return block if self.accept('foreach'): block = self.foreachblock() self.expect('endforeach') return block return self.statement() def codeblock(self): block = CodeBlockNode(self.current.lineno, self.current.colno) cond = True while cond: curline = self.line() if not isinstance(curline, EmptyNode): block.lines.append(curline) cond = self.accept('eol') return block
{ "content_hash": "85840020ea520e00a9a628602e83ba3c", "timestamp": "", "source": "github", "line_count": 589, "max_line_length": 117, "avg_line_length": 32.083191850594226, "alnum_prop": 0.5164840980049743, "repo_name": "centricular/meson", "id": "f593c8e3111101011c9de85e256e614162bd9609", "size": "19490", "binary": false, "copies": "1", "ref": "refs/heads/gst-msvc", "path": "mesonbuild/mparser.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "90" }, { "name": "Batchfile", "bytes": "131" }, { "name": "C", "bytes": "69252" }, { "name": "C#", "bytes": "631" }, { "name": "C++", "bytes": "11881" }, { "name": "D", "bytes": "1605" }, { "name": "Emacs Lisp", "bytes": "1226" }, { "name": "Fortran", "bytes": "1359" }, { "name": "Groff", "bytes": "232" }, { "name": "Inno Setup", "bytes": "372" }, { "name": "Java", "bytes": "519" }, { "name": "Lex", "bytes": "110" }, { "name": "Objective-C", "bytes": "462" }, { "name": "Objective-C++", "bytes": "87" }, { "name": "Protocol Buffer", "bytes": "46" }, { "name": "Python", "bytes": "906381" }, { "name": "Rust", "bytes": "372" }, { "name": "Shell", "bytes": "1978" }, { "name": "Swift", "bytes": "972" }, { "name": "Vala", "bytes": "4083" }, { "name": "Yacc", "bytes": "50" } ], "symlink_target": "" }
require('talents/modifier_overhead') if not IsServer() then desiredModifierName = CustomNetTables:GetTableValue("talent_manager", "last_learned_talent_15")["v"] modifierTable = CustomNetTables:GetTableValue("talent_manager", "server_to_lua_talent_properties_" .. desiredModifierName) end _G[desiredModifierName] = GenericModifier( { IsDebuff = false, IsPermanent = true, IsPurgable = false, DestroyOnExpire = false, IsHidden = true, }, { }, modifierTable )
{ "content_hash": "657b8e05a5c89b346d34cac243ded974", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 127, "avg_line_length": 27.736842105263158, "alnum_prop": 0.6698292220113852, "repo_name": "Arhowk/TalentManager", "id": "268108dd3de687fe7422cdedc704088b0b17367e", "size": "527", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "game/scripts/vscripts/talents/modifier_queue/modifier_talents_15.lua", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "16924" }, { "name": "Lua", "bytes": "31800" } ], "symlink_target": "" }
/*! \file ored/configuration/yieldcurveconfig.hpp \brief Yield curve configuration classes \ingroup configuration */ #pragma once #include <set> #include <map> #include <boost/optional.hpp> #include <boost/none.hpp> #include <boost/shared_ptr.hpp> #include <ql/patterns/visitor.hpp> #include <ql/types.hpp> #include <ored/utilities/xmlutils.hpp> using std::string; using std::vector; using std::set; using std::pair; using std::map; using boost::optional; using ore::data::XMLSerializable; using ore::data::XMLNode; using ore::data::XMLDocument; using QuantLib::AcyclicVisitor; using QuantLib::Real; namespace ore { namespace data { //! Base class for yield curve segments. /*! \ingroup configuration */ class YieldCurveSegment : public XMLSerializable { public: //! supported segment types enum class Type { Zero, ZeroSpread, Discount, Deposit, FRA, Future, OIS, Swap, AverageOIS, TenorBasis, TenorBasisTwo, FXForward, CrossCcyBasis }; //! Default destructor virtual ~YieldCurveSegment() {} //! \name Serialisation //@{ virtual void fromXML(XMLNode* node) = 0; virtual XMLNode* toXML(XMLDocument& doc) = 0; //@} //! \name Inspectors //@{ Type type() const { return type_; } // TODO: why typeID? const string& typeID() const { return typeID_; } const string& conventionsID() const { return conventionsID_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} protected: //! \name Constructors //@{ //! Default constructor YieldCurveSegment() {} //! Detailed constructor YieldCurveSegment(const string& typeID, const string& conventionsID); //@} private: // TODO: why type and typeID? Type type_; string typeID_; string conventionsID_; }; //! Direct yield curve segment /*! A direct yield curve segment is used when the segments is entirely defined by a set of quotes that are passed to the constructor. \ingroup configuration */ class DirectYieldCurveSegment : public YieldCurveSegment { public: //! \name Constructors/Destructors //@{ //! Default constructor DirectYieldCurveSegment() {} //! Detailed constructor DirectYieldCurveSegment(const string& typeID, const string& conventionsID, const vector<string>& quotes); //! Default destructor virtual ~DirectYieldCurveSegment() {} //@} //! \name Serialisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const vector<string>& quotes() const { return quotes_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} private: vector<string> quotes_; }; //! Simple yield curve segment /*! A simple yield curve segment is used when the curve segment is determined by a set of quotes and a projection curve. \ingroup configuration */ class SimpleYieldCurveSegment : public YieldCurveSegment { public: //! \name Constructors/Destructors //@{ //! Default constructor SimpleYieldCurveSegment() {} //! Detailed constructor SimpleYieldCurveSegment(const string& typeID, const string& conventionsID, const vector<string>& quotes, const string& projectionCurveID = string()); //! Default destructor virtual ~SimpleYieldCurveSegment() {} //@} //! \name Serialisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const vector<string>& quotes() const { return quotes_; } const string& projectionCurveID() const { return projectionCurveID_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} private: vector<string> quotes_; string projectionCurveID_; }; //! Avergae OIS yield curve segment /*! The average OIS yield curve segment is used e.g. for USD OIS curve building where the curve segment is determined by a set of composite quotes and a projection curve. The composite quote is represented here as a pair of quote strings, a tenor basis spread and an interest rate swap quote. \ingroup configuration */ class AverageOISYieldCurveSegment : public YieldCurveSegment { public: //! \name Constructors/Destructors //@{ //! Default constructor AverageOISYieldCurveSegment() {} //! Detailec constructor AverageOISYieldCurveSegment(const string& typeID, const string& conventionsID, const vector<pair<string, string>>& quotes, const string& projectionCurveID); //! Default destructor virtual ~AverageOISYieldCurveSegment() {} //@} //! \name Serialisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const vector<pair<string, string>>& quotes() const { return quotes_; } const string& projectionCurveID() const { return projectionCurveID_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} private: vector<pair<string, string>> quotes_; string projectionCurveID_; }; //! Tenor Basis yield curve segment /*! Yield curve building from tenor basis swap quotes requires a set of tenor basis spread quotes and the projection curve for either the shorter or the longer tenor which acts as the reference curve. \ingroup configuration */ class TenorBasisYieldCurveSegment : public YieldCurveSegment { public: //! \name Constructors/Destructors //@{ //! Default constructor TenorBasisYieldCurveSegment() {} //! Detailed constructor TenorBasisYieldCurveSegment(const string& typeID, const string& conventionsID, const vector<string>& quotes, const string& shortProjectionCurveID, const string& longProjectionCurveID); //! Default destructor virtual ~TenorBasisYieldCurveSegment() {} //@} //!\name Serialisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const vector<string>& quotes() const { return quotes_; } const string& shortProjectionCurveID() const { return shortProjectionCurveID_; } const string& longProjectionCurveID() const { return longProjectionCurveID_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} private: vector<string> quotes_; string shortProjectionCurveID_; string longProjectionCurveID_; }; //! Cross Currency yield curve segment /*! Cross currency basis spread adjusted discount curves for 'domestic' currency cash flows are built using this segment type which requires cross currency basis spreads quotes, the spot FX quote ID and at least the 'foreign' discount curve ID. Projection curves for both currencies can be provided as well for consistency with tenor basis in each currency. \ingroup configuration */ class CrossCcyYieldCurveSegment : public YieldCurveSegment { public: //! \name Constructors/Destructors //@{ //! Default constructor CrossCcyYieldCurveSegment() {} //! Detailed constructor CrossCcyYieldCurveSegment(const string& typeID, const string& conventionsID, const vector<string>& quotes, const string& spotRateID, const string& foreignDiscountCurveID, const string& domesticProjectionCurveID = string(), const string& foreignProjectionCurveID = string()); //! Default destructor virtual ~CrossCcyYieldCurveSegment() {} //@} //! \name Serialisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const vector<string>& quotes() const { return quotes_; } const string& spotRateID() const { return spotRateID_; } const string& foreignDiscountCurveID() const { return foreignDiscountCurveID_; } const string& domesticProjectionCurveID() const { return domesticProjectionCurveID_; } const string& foreignProjectionCurveID() const { return foreignProjectionCurveID_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} private: vector<string> quotes_; string spotRateID_; string foreignDiscountCurveID_; string domesticProjectionCurveID_; string foreignProjectionCurveID_; }; //! Zero Spreaded yield curve segment /*! A zero spreaded segment is used to build a yield curve from zero spread quotes and a reference yield curve. \ingroup configuration */ class ZeroSpreadedYieldCurveSegment : public YieldCurveSegment { public: //! \name COnstructors/Destructors //@{ //! Default constructor ZeroSpreadedYieldCurveSegment() {} //! Detailed constructor ZeroSpreadedYieldCurveSegment(const string& typeID, const string& conventionsID, const vector<string>& quotes, const string& referenceCurveID); //! Default destructor virtual ~ZeroSpreadedYieldCurveSegment() {} //@} //! \name Serialisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const vector<string>& quotes() const { return quotes_; } const string& referenceCurveID() const { return referenceCurveID_; } //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} private: vector<string> quotes_; string referenceCurveID_; }; //! Yield Curve configuration /*! Wrapper class containing all yield curve segments needed to build a yield curve. \ingroup configuration */ class YieldCurveConfig : public XMLSerializable { public: //! \name Constructors/Destructurs //@{ //! Default constructor YieldCurveConfig() {} //! Detailed constructor YieldCurveConfig(const string& curveID, const string& curveDescription, const string& currency, const string& discountCurveID, const vector<boost::shared_ptr<YieldCurveSegment>>& curveSegments, const string& interpolationVariable = "Discount", const string& interpolationMethod = "LogLinear", const string& zeroDayCounter = "A365", bool extrapolation = true, Real tolerance = 1.0e-12); //! Default destructor virtual ~YieldCurveConfig() {} //@} //! \name Serilalisation //@{ virtual void fromXML(XMLNode* node); virtual XMLNode* toXML(XMLDocument& doc); //@} //! \name Inspectors //@{ const string& curveID() const { return curveID_; } const string& curveDescription() const { return curveDescription_; } const string& currency() const { return currency_; } const string& discountCurveID() const { return discountCurveID_; } const vector<boost::shared_ptr<YieldCurveSegment>>& curveSegments() const { return curveSegments_; } const string& interpolationVariable() const { return interpolationVariable_; } const string& interpolationMethod() const { return interpolationMethod_; } const string& zeroDayCounter() const { return zeroDayCounter_; } bool extrapolation() const { return extrapolation_; } Real tolerance() const { return tolerance_; } const set<string>& requiredYieldCurveIDs() const { return requiredYieldCurveIDs_; } //@} //! \name Setters //@{ string& interpolationVariable() { return interpolationVariable_; } string& interpolationMethod() { return interpolationMethod_; } string& zeroDayCounter() { return zeroDayCounter_; } bool& extrapolation() { return extrapolation_; } Real& tolerance() { return tolerance_; } //@} private: void populateRequiredYieldCurveIDs(); // Mandatory members string curveID_; string curveDescription_; string currency_; string discountCurveID_; vector<boost::shared_ptr<YieldCurveSegment>> curveSegments_; set<string> requiredYieldCurveIDs_; // Optional members string interpolationVariable_; string interpolationMethod_; string zeroDayCounter_; bool extrapolation_; Real tolerance_; }; // Map form curveID to YieldCurveConfig using YieldCurveConfigMap = std::map<string, boost::shared_ptr<YieldCurveConfig>>; } }
{ "content_hash": "bff4b2abf1570359eb7ca1a467a7a650", "timestamp": "", "source": "github", "line_count": 432, "max_line_length": 119, "avg_line_length": 29.08564814814815, "alnum_prop": 0.670274572224433, "repo_name": "ChinaQuants/Engine", "id": "f7670a35d1dbb44e57bbaeeedc626c44a353e1a7", "size": "13313", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "OREData/ored/configuration/yieldcurveconfig.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C++", "bytes": "2623899" }, { "name": "CSS", "bytes": "5676" }, { "name": "HTML", "bytes": "119250" }, { "name": "Jupyter Notebook", "bytes": "28581" }, { "name": "M4", "bytes": "47747" }, { "name": "Makefile", "bytes": "42626" }, { "name": "Python", "bytes": "11416" }, { "name": "R", "bytes": "1657" }, { "name": "Shell", "bytes": "4265" }, { "name": "TeX", "bytes": "270547" } ], "symlink_target": "" }
/** * Bean Validation TCK * * License: Apache License, Version 2.0 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. */ package org.hibernate.beanvalidation.tck.tests.methodvalidation.parameternameprovider; import java.util.Date; import javax.validation.constraints.NotNull; /** * @author Gunnar Morling */ public class User { public User() { } public User(@NotNull String firstName, @NotNull String lastName, @NotNull Date dateOfBirth) { } public void setNames(@NotNull String firstName, @NotNull String lastName) { } }
{ "content_hash": "5722c344d3b639811b99bf3186cbc969", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 98, "avg_line_length": 22.615384615384617, "alnum_prop": 0.7380952380952381, "repo_name": "gunnarmorling/beanvalidation-tck", "id": "0a95e9300aab0ce76e2d80ebd89f64e9f7acb2ea", "size": "588", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/src/main/java/org/hibernate/beanvalidation/tck/tests/methodvalidation/parameternameprovider/User.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1895029" }, { "name": "Shell", "bytes": "3104" } ], "symlink_target": "" }
package org.apache.asterix.active; import org.apache.hyracks.util.IRetryPolicy; public class InfiniteRetryPolicy implements IRetryPolicy { private final IActiveEntityEventsListener listener; public InfiniteRetryPolicy(IActiveEntityEventsListener listener) { this.listener = listener; } @Override public boolean retry(Throwable failure) { synchronized (listener) { try { listener.wait(5000); //NOSONAR this method is being called in a while loop } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } return true; } }
{ "content_hash": "8c93d1ad5c41f8ad4412ff9587b87dec", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 90, "avg_line_length": 25.85185185185185, "alnum_prop": 0.6361031518624641, "repo_name": "ecarm002/incubator-asterixdb", "id": "6f43c64ab415b5b3f0df7964ed6a841ba6ab8b47", "size": "1505", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "asterixdb/asterix-active/src/main/java/org/apache/asterix/active/InfiniteRetryPolicy.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8721" }, { "name": "C", "bytes": "421" }, { "name": "CSS", "bytes": "8823" }, { "name": "Crystal", "bytes": "453" }, { "name": "Gnuplot", "bytes": "89" }, { "name": "HTML", "bytes": "126208" }, { "name": "Java", "bytes": "18965823" }, { "name": "JavaScript", "bytes": "274822" }, { "name": "Python", "bytes": "281315" }, { "name": "Ruby", "bytes": "3078" }, { "name": "Scheme", "bytes": "1105" }, { "name": "Shell", "bytes": "203955" }, { "name": "Smarty", "bytes": "31412" } ], "symlink_target": "" }
#include <CoreFoundation/CoreFoundation.h> #include <CoreServices/CoreServices.h> #include <QuickLook/QuickLook.h> #import <Foundation/Foundation.h> #import "LewFileAttributes.h" OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview); /* ----------------------------------------------------------------------------- Generate a preview for file This function's job is to create preview for designated file ----------------------------------------------------------------------------- */ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) { // To complete your generator please implement the function GeneratePreviewForURL in GeneratePreviewForURL.c @autoreleasepool{ if (QLPreviewRequestIsCancelled(preview)) return noErr; CFBundleRef bundle = QLPreviewRequestGetGeneratorBundle(preview); CFURLRef bundleURL = CFBundleCopyBundleURL(bundle); LewFileAttributes *file = [LewFileAttributes fileAttributesForItemAtURL:(__bridge NSURL *)(url) bundleURL:(__bridge NSURL *)(bundleURL)]; if (!file.isTextFile) { return noErr; } QLPreviewRequestSetURLRepresentation(preview, url, kUTTypePlainText, NULL); return noErr; } } void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview) { // Implement only if supported }
{ "content_hash": "a425f99e7d0cdf3e423782b2e320a0b9", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 148, "avg_line_length": 41.05, "alnum_prop": 0.6766138855054811, "repo_name": "pljhonglu/PlainTextQuickLook", "id": "dbff39c8f1c14ddfa6a6dbea8c2f0a2582d2d052", "size": "1642", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "PlainTextQuickLook/PlainTextQuickLook/GeneratePreviewForURL.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "9372" }, { "name": "Objective-C", "bytes": "8237" }, { "name": "Ruby", "bytes": "161" } ], "symlink_target": "" }
import {mount} from 'enzyme'; import * as Preact from '#preact'; import {createRef} from '#preact'; import {VideoIframeInternal} from '../video-iframe'; function dispatchMessage(window, opt_event) { const event = window.document.createEvent('Event'); event.initEvent('message', /* bubbles */ true, /* cancelable */ true); window.dispatchEvent(Object.assign(event, opt_event)); } describes.realWin('VideoIframeInternal Preact component', {}, (env) => { let window; let document; beforeEach(() => { window = env.win; document = window.document; }); it('calls `onIframeLoad` once loaded', async () => { const onIframeLoad = env.sandbox.spy(); const onCanPlay = env.sandbox.spy(); const makeMethodMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" makeMethodMessage={makeMethodMessage} onIframeLoad={onIframeLoad} onCanPlay={onCanPlay} />, {attachTo: document.body} ); await videoIframe.find('iframe').invoke('onCanPlay')(); expect(onCanPlay).to.be.calledOnce; expect(onIframeLoad).to.be.calledOnce; }); it('unmutes per lack of `muted` prop', async () => { const makeMethodMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" makeMethodMessage={makeMethodMessage} />, {attachTo: document.body} ); await videoIframe.find('iframe').invoke('onCanPlay')(); expect(makeMethodMessage.withArgs('unmute')).to.have.been.calledOnce; }); it('mutes per `muted` prop', async () => { const makeMethodMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" makeMethodMessage={makeMethodMessage} muted />, {attachTo: document.body} ); await videoIframe.find('iframe').invoke('onCanPlay')(); expect(makeMethodMessage.withArgs('mute')).to.have.been.calledOnce; }); it('hides controls per lack of `controls` prop', async () => { const makeMethodMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" makeMethodMessage={makeMethodMessage} />, {attachTo: document.body} ); await videoIframe.find('iframe').invoke('onCanPlay')(); expect(makeMethodMessage.withArgs('hideControls')).to.have.been.calledOnce; }); it('shows controls per `controls` prop', async () => { const makeMethodMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" makeMethodMessage={makeMethodMessage} controls />, {attachTo: document.body} ); await videoIframe.find('iframe').invoke('onCanPlay')(); expect(makeMethodMessage.withArgs('showControls')).to.have.been.calledOnce; }); it('passes messages to onMessage', async () => { const onMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" onMessage={onMessage} controls />, {attachTo: document.body} ); const iframe = videoIframe.getDOMNode(); const data = {foo: 'bar'}; dispatchMessage(window, {source: iframe.contentWindow, data}); expect( onMessage.withArgs( env.sandbox.match({ currentTarget: iframe, target: iframe, data, }) ) ).to.have.been.calledOnce; }); it("ignores messages if source doesn't match iframe", async () => { const onMessage = env.sandbox.spy(); mount( <VideoIframeInternal src="about:blank" onMessage={onMessage} controls />, { attachTo: document.body, } ); dispatchMessage(window, {source: null, data: 'whatever'}); expect(onMessage).to.not.have.been.called; }); it('stops listening to messages on unmount', async () => { const onMessage = env.sandbox.spy(); const videoIframe = mount( <VideoIframeInternal src="about:blank" onMessage={onMessage} />, {attachTo: document.body} ); const iframe = videoIframe.getDOMNode(); videoIframe.unmount(); dispatchMessage(window, {source: iframe.contentWindow, data: 'whatever'}); expect(onMessage).to.not.have.been.called; }); it('unlistens only when unmounted', async () => { const addEventListener = env.sandbox.stub(window, 'addEventListener'); const removeEventListener = env.sandbox.stub(window, 'removeEventListener'); const videoIframe = mount( <VideoIframeInternal src="about:blank" onMessage={() => {}} />, {attachTo: document.body} ); expect(addEventListener.withArgs('message')).to.have.been.calledOnce; expect(removeEventListener.withArgs('message')).to.not.have.been.called; videoIframe.setProps({ onMessage: () => { // An unstable onMessage prop should not cause unlisten }, }); videoIframe.update(); expect(removeEventListener.withArgs('message')).to.not.have.been.called; videoIframe.unmount(); expect(removeEventListener.withArgs('message')).to.have.been.calledOnce; }); it('should reset an unloadOnPause-iframe on pause', () => { const ref = createRef(); const makeMethodMessageStub = env.sandbox.stub(); const videoIframe = mount( <VideoIframeInternal ref={ref} src="about:blank" makeMethodMessage={makeMethodMessageStub} unloadOnPause={true} /> ); const iframe = videoIframe.getDOMNode(); let iframeSrc = iframe.src; const iframeSrcSetterSpy = env.sandbox.spy(); Object.defineProperty(iframe, 'src', { get() { return iframeSrc; }, set(value) { iframeSrc = value; iframeSrcSetterSpy(value); }, }); ref.current.pause(); expect(iframeSrcSetterSpy).to.be.calledOnce; expect(makeMethodMessageStub).to.not.be.calledWith('pause'); }); describe('uses playerStateRef to read the imperative state', () => { const makeMethodMessage = (method) => ({makeMethodMessageFor: method}); it('should NOT fail when player state is not available', () => { const ref = createRef(); // no value. mount( <VideoIframeInternal ref={ref} src="about:blank" makeMethodMessage={makeMethodMessage} /> ); expect(ref.current.currentTime).to.be.NaN; expect(ref.current.duration).to.be.NaN; // null value. const playerStateRef = createRef(); mount( <VideoIframeInternal ref={ref} src="about:blank" makeMethodMessage={makeMethodMessage} playerStateRef={playerStateRef} /> ); expect(ref.current.currentTime).to.be.NaN; expect(ref.current.duration).to.be.NaN; // empty value. playerStateRef.current = {}; mount( <VideoIframeInternal ref={ref} src="about:blank" makeMethodMessage={makeMethodMessage} playerStateRef={playerStateRef} /> ); expect(ref.current.currentTime).to.be.NaN; expect(ref.current.duration).to.be.NaN; }); it('should return the provided player state', () => { const ref = createRef(); const playerStateRef = createRef(); playerStateRef.current = {duration: 111, currentTime: 11}; mount( <VideoIframeInternal ref={ref} src="about:blank" makeMethodMessage={makeMethodMessage} playerStateRef={playerStateRef} /> ); expect(ref.current.currentTime).to.equal(11); expect(ref.current.duration).to.equal(111); // 0-values are ok. playerStateRef.current = {duration: 0, currentTime: 0}; expect(ref.current.currentTime).to.equal(0); expect(ref.current.duration).to.equal(0); }); }); describe('uses makeMethodMessage to post imperative handle methods', () => { ['play', 'pause'].forEach((method) => { it(`with \`${method}\``, async () => { let videoIframeRef; const makeMethodMessage = (method) => ({makeMethodMessageFor: method}); const makeMethodMessageSpy = env.sandbox.spy(makeMethodMessage); const videoIframe = mount( <VideoIframeInternal ref={(ref) => (videoIframeRef = ref)} src="about:blank" makeMethodMessage={makeMethodMessageSpy} />, {attachTo: document.body} ); const postMessage = env.sandbox.stub( videoIframe.getDOMNode().contentWindow, 'postMessage' ); videoIframeRef[method](); await videoIframe.find('iframe').invoke('onCanPlay')(); expect(makeMethodMessageSpy.withArgs(method)).to.have.been.calledOnce; expect( postMessage.withArgs( env.sandbox.match(makeMethodMessage(method)), '*' ) ).to.have.been.calledOnce; }); }); }); });
{ "content_hash": "254d225635669a3582a335532ef78d6c", "timestamp": "", "source": "github", "line_count": 310, "max_line_length": 80, "avg_line_length": 29.15806451612903, "alnum_prop": 0.6217501936054873, "repo_name": "alanorozco/amphtml", "id": "c66ddafebc336d18991c5dd7f48130920b090bbc", "size": "9039", "binary": false, "copies": "3", "ref": "refs/heads/main", "path": "extensions/amp-video/1.0/test/test-video-iframe.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "256" }, { "name": "C++", "bytes": "1602173" }, { "name": "CSS", "bytes": "478866" }, { "name": "Go", "bytes": "6528" }, { "name": "HTML", "bytes": "2077804" }, { "name": "JavaScript", "bytes": "18908816" }, { "name": "Python", "bytes": "64486" }, { "name": "Shell", "bytes": "20757" }, { "name": "Starlark", "bytes": "33981" }, { "name": "TypeScript", "bytes": "23157" }, { "name": "Yacc", "bytes": "28669" } ], "symlink_target": "" }
using FlaUI.Core; using FlaUI.Core.Identifiers; using FlaUI.Core.Patterns; using FlaUI.Core.Patterns.Infrastructure; using FlaUI.Core.Tools; using FlaUI.UIA3.Identifiers; using UIA = Interop.UIAutomationClient; namespace FlaUI.UIA3.Patterns { public class VirtualizedItemPattern : PatternBase<UIA.IUIAutomationVirtualizedItemPattern>, IVirtualizedItemPattern { public static readonly PatternId Pattern = PatternId.Register(AutomationType.UIA3, UIA.UIA_PatternIds.UIA_VirtualizedItemPatternId, "VirtualizedItem", AutomationObjectIds.IsVirtualizedItemPatternAvailableProperty); public VirtualizedItemPattern(BasicAutomationElementBase basicAutomationElement, UIA.IUIAutomationVirtualizedItemPattern nativePattern) : base(basicAutomationElement, nativePattern) { } public void Realize() { Com.Call(() => NativePattern.Realize()); } } }
{ "content_hash": "43e647af6161362b741214ad9f4a0b84", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 222, "avg_line_length": 38.208333333333336, "alnum_prop": 0.7677208287895311, "repo_name": "maxinfet/FlaUI", "id": "ab687d8643c2705fc0a4f38d0d5f2cc99d03b268", "size": "919", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/FlaUI.UIA3/Patterns/VirtualizedItemPattern.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1559" }, { "name": "C#", "bytes": "808744" }, { "name": "PowerShell", "bytes": "17247" } ], "symlink_target": "" }
from django.core.exceptions import PermissionDenied from django.http import HttpResponseRedirect from django.utils.translation import gettext_lazy as _ from django.views.generic import ListView from django_cradmin import javascriptregistry class RoleSelectView(javascriptregistry.viewmixin.WithinRoleViewMixin, ListView): """ The default view for listing and selecting roles within a cradmin instance. - If the user has a single role, we redirect to the role-frontpage for that role. This behavior can be overridden with :meth:`.get_autoredirect_if_single_role`. - If the user has multiple roles, we list the roles. - If the user has no roles, we call :meth:`.get_no_roles_response`. """ paginate_by = 30 #: Makes the roles queryset available as ``roles`` in the template. context_object_name = 'roles' #: The template used to render this view. template_name = 'django_cradmin/roleselect.django.html' #: The title of the page. See :meth:`.get_pagetitle`. pagetitle = _('What would you like to edit?') #: Redirect if we have a single role? See :meth:`.get_autoredirect_if_single_role`. autoredirect_if_single_role = True def get_queryset(self): return self.request.cradmin_instance.get_rolequeryset() def get(self, *args, **kwargs): rolecount = self.get_queryset().count() if rolecount == 0: return self.get_no_roles_response(*args, **kwargs) elif rolecount == 1: return self.get_single_role_response(*args, **kwargs) else: return self.get_multiple_roles_response(*args, **kwargs) def get_autoredirect_if_single_role(self): """ Enables/disables automatic redirect if single role. Returns the value of :obj:`.autoredirect_if_single_role` by default. Used by :meth:`.get_single_role_response`. """ return self.autoredirect_if_single_role def get_no_roles_response(self, *args, **kwargs): """ Get the response to return if the requesting user only have no roles. Raises :exc:`django.core.exceptions.PermissionDenied` by default. If you want to do something more eloborate, you can do one of the following: - Use a HttpResonseRedirect to redirect to some other view/url. - Call ``return self.get_multiple_roles_response(*args, **kwargs)``. The template for this view (``django_cradmin/roleselect.django.html``) has a ``no_roles_section`` block. You can extend this template and override this block to display a custom message. You must, of course, set this new template as the :obj:`~.RoleSelectView.template_name`. """ raise PermissionDenied() def get_single_role_response(self, *args, **kwargs): """ Get the response to return if the requesting user only have one role. If :meth:`.get_autoredirect_if_single_role` returns ``True``, we redirect to the rolefrontpage for the role. Otherwise, we return :meth:`.get_multiple_roles_response`. """ if self.get_autoredirect_if_single_role(): only_role = self.get_queryset().first() return HttpResponseRedirect(self.request.cradmin_instance.rolefrontpage_url( self.request.cradmin_instance.get_roleid(only_role))) else: return super(RoleSelectView, self).get(*args, **kwargs) def get_multiple_roles_response(self, *args, **kwargs): """ Get the response to return if the requesting user only has multiple roles. Just calls the ``get()``-method of the superclass by default. """ return super(RoleSelectView, self).get(*args, **kwargs) def get_pagetitle(self): """ Get the page title. Returns the value of :obj:`.pagetitle` by default. """ return self.pagetitle def get_context_data(self, **kwargs): context = super(RoleSelectView, self).get_context_data(**kwargs) context['pagetitle'] = self.get_pagetitle() context['rolecount'] = self.get_queryset().count() self.add_javascriptregistry_component_ids_to_context(context=context) return context
{ "content_hash": "344f3eb6b770e5729958e63be4c7cd06", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 88, "avg_line_length": 39.87850467289719, "alnum_prop": 0.657839231310054, "repo_name": "appressoas/django_cradmin", "id": "d544eacf3b60dcf35aa4fb1ee09d64de36b72728", "size": "4267", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "django_cradmin/views/roleselect.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "192105" }, { "name": "JavaScript", "bytes": "1951677" }, { "name": "Python", "bytes": "771868" }, { "name": "SCSS", "bytes": "679114" } ], "symlink_target": "" }
function WWHOutlineImagingFast_Object() { this.mIterator = new WWHOutlineIterator_Object(true); this.mImageSrcDir = WWHOutlineImaging_ImageSrcDir(); this.mEventString = WWHPopup_EventString(); this.mHTMLSegment = new WWHStringBuffer_Object(); this.mbUseList = true; this.fGetIconURL = WWHOutlineImaging_GetIconURL; this.fGetPopupAction = WWHOutlineImaging_GetPopupAction; this.fGetLink = WWHOutlineImaging_GetLink; this.fGetEntryHTML = WWHOutlineImaging_GetEntryHTML; this.fGenerateStyles = WWHOutlineImagingFast_GenerateStyles; this.fReset = WWHOutlineImagingFast_Reset; this.fAdvance = WWHOutlineImagingFast_Advance; this.fOpenLevel = WWHOutlineImagingFast_OpenLevel; this.fCloseLevel = WWHOutlineImagingFast_CloseLevel; this.fSameLevel = WWHOutlineImagingFast_SameLevel; this.fDisplayEntry = WWHOutlineImagingFast_DisplayEntry; this.fUpdateEntry = WWHOutlineImagingFast_UpdateEntry; this.fRevealEntry = WWHOutlineImagingFast_RevealEntry; // Workaround for Windows IE // if ((WWHFrame.WWHBrowser.mBrowser == 2) && // Shorthand for IE (WWHFrame.WWHBrowser.mPlatform == 1)) // Shorthand for Windows { this.mbUseList = false; } } function WWHOutlineImagingFast_GenerateStyles() { var StyleBuffer = new WWHStringBuffer_Object(); StyleBuffer.fAppend("<style type=\"text/css\">\n"); StyleBuffer.fAppend(" <!--\n"); StyleBuffer.fAppend(" a:active\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" text-decoration: none;\n"); StyleBuffer.fAppend(" background-color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mHighlightColor + ";\n"); StyleBuffer.fAppend(" " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n"); StyleBuffer.fAppend(" }\n"); StyleBuffer.fAppend(" a:hover\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" text-decoration: underline;\n"); StyleBuffer.fAppend(" color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + ";\n"); StyleBuffer.fAppend(" " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n"); StyleBuffer.fAppend(" }\n"); StyleBuffer.fAppend(" a\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" text-decoration: none;\n"); StyleBuffer.fAppend(" color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + ";\n"); StyleBuffer.fAppend(" " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n"); StyleBuffer.fAppend(" }\n"); StyleBuffer.fAppend(" td\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" margin-top: 0pt;\n"); StyleBuffer.fAppend(" margin-bottom: 0pt;\n"); StyleBuffer.fAppend(" margin-left: 0pt;\n"); StyleBuffer.fAppend(" text-align: left;\n"); StyleBuffer.fAppend(" vertical-align: middle;\n"); StyleBuffer.fAppend(" " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + ";\n"); StyleBuffer.fAppend(" }\n"); if (this.mbUseList) { StyleBuffer.fAppend(" ul\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" list-style-type: none;\n"); StyleBuffer.fAppend(" padding-left: 0pt;\n"); StyleBuffer.fAppend(" margin-top: 0pt;\n"); StyleBuffer.fAppend(" margin-bottom: 0pt;\n"); StyleBuffer.fAppend(" margin-left: 0pt;\n"); StyleBuffer.fAppend(" }\n"); StyleBuffer.fAppend(" li\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" margin-top: 0pt;\n"); StyleBuffer.fAppend(" margin-bottom: 0pt;\n"); StyleBuffer.fAppend(" margin-left: 0pt;\n"); StyleBuffer.fAppend(" }\n"); } else { StyleBuffer.fAppend(" div.list\n"); StyleBuffer.fAppend(" {\n"); StyleBuffer.fAppend(" margin-top: 0pt;\n"); StyleBuffer.fAppend(" margin-bottom: 0pt;\n"); StyleBuffer.fAppend(" margin-left: 0pt;\n"); StyleBuffer.fAppend(" }\n"); } StyleBuffer.fAppend(" -->\n"); StyleBuffer.fAppend("</style>\n"); return StyleBuffer.fGetBuffer(); } function WWHOutlineImagingFast_Reset() { this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry); } function WWHOutlineImagingFast_Advance(ParamMaxHTMLSegmentSize) { var Entry; this.mHTMLSegment.fReset(); while (((ParamMaxHTMLSegmentSize == -1) || (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) && (this.mIterator.fAdvance(this))) { Entry = this.mIterator.mEntry; // Process current entry // if (Entry.mbShow) { if (this.mbUseList) { this.mHTMLSegment.fAppend("<li id=i" + Entry.mID + ">"); this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry)); } else { if (Entry.mChildren != null) { this.mHTMLSegment.fAppend("<div class=\"list\" id=l" + Entry.mID + ">\n"); this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry)); if ( ! Entry.mbExpanded) { this.mHTMLSegment.fAppend("</div>\n"); } } else { this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry)); } } } } return (this.mHTMLSegment.fSize() > 0); // Return true if segment created } function WWHOutlineImagingFast_OpenLevel() { if (this.mbUseList) { this.mHTMLSegment.fAppend("<ul>\n"); } } function WWHOutlineImagingFast_CloseLevel(bParamScopeComplete) { if (this.mbUseList) { this.mHTMLSegment.fAppend("</li>\n"); this.mHTMLSegment.fAppend("</ul>\n"); if ( ! bParamScopeComplete) { this.mHTMLSegment.fAppend("</li>\n"); } } else { if ( ! bParamScopeComplete) { this.mHTMLSegment.fAppend("</div>\n"); } } } function WWHOutlineImagingFast_SameLevel() { if (this.mbUseList) { this.mHTMLSegment.fAppend("</li>\n"); } } function WWHOutlineImagingFast_DisplayEntry(ParamEntry) { var VarEntryHTML = ""; if (this.mbUseList) { VarEntryHTML += this.fGetEntryHTML(ParamEntry) + "\n"; } else { VarEntryHTML += "<div id=i" + ParamEntry.mID + ">" + this.fGetEntryHTML(ParamEntry) + "</div>\n"; } return VarEntryHTML; } function WWHOutlineImagingFast_UpdateEntry(ParamEntry) { var EntryHTML = ""; var ElementID; var VarPanelViewFrame; // Get entry display // EntryHTML = this.fDisplayEntry(ParamEntry); // Reset iterator to process current entry's children // this.mIterator.fReset(ParamEntry); // Process display of children // if (this.fAdvance(-1)) { // Result already stored in this.mHTMLSegment // } // Close down any popups we had going to prevent JavaScript errors // WWHFrame.WWHJavaScript.mPanels.mPopup.fHide(); // Update HTML // VarPanelViewFrame = eval(WWHFrame.WWHHelp.fGetFrameReference("WWHPanelViewFrame")); if (this.mbUseList) { ElementID = "i" + ParamEntry.mID; } else { ElementID = "l" + ParamEntry.mID; } if ((WWHFrame.WWHBrowser.mBrowser == 2) || // Shorthand for IE (WWHFrame.WWHBrowser.mBrowser == 3)) // Shorthand for iCab { VarPanelViewFrame.document.all[ElementID].innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer(); } else if ((WWHFrame.WWHBrowser.mBrowser == 4) || // Shorthand for Netscape 6.0 (WWHFrame.WWHBrowser.mBrowser == 5)) // Shorthand for Safari { VarPanelViewFrame.document.getElementById(ElementID).innerHTML = EntryHTML + this.mHTMLSegment.fGetBuffer(); } } function WWHOutlineImagingFast_RevealEntry(ParamEntry, bParamVisible) { var ParentEntry; var LastClosedParentEntry = null; // Expand out enclosing entries // ParentEntry = ParamEntry.mParent; while (ParentEntry != null) { if ( ! ParentEntry.mbExpanded) { ParentEntry.mbExpanded = true; LastClosedParentEntry = ParentEntry; } ParentEntry = ParentEntry.mParent; } // Set target entry // WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID; // Update display // if (bParamVisible) { // Expand parent entry to reveal target entry // if (LastClosedParentEntry != null) { this.fUpdateEntry(LastClosedParentEntry); } // Display target // WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor(); } }
{ "content_hash": "6772bf6f497d62dff3d8fe53862a33b4", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 112, "avg_line_length": 29.333333333333332, "alnum_prop": 0.6308575445173383, "repo_name": "NCIP/cabio", "id": "bba6e5e091739708c4294834ad56e177c906f0a0", "size": "8613", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "docs/portletOnlineHelp/wwhelp/wwhimpl/js/scripts/outlfast.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C++", "bytes": "58" }, { "name": "CSS", "bytes": "790679" }, { "name": "HTML", "bytes": "227415" }, { "name": "Java", "bytes": "1695785" }, { "name": "JavaScript", "bytes": "5101781" }, { "name": "PHP", "bytes": "14325" }, { "name": "PLSQL", "bytes": "319454" }, { "name": "Perl", "bytes": "201567" }, { "name": "SQLPL", "bytes": "17416" }, { "name": "Shell", "bytes": "106383" }, { "name": "SourcePawn", "bytes": "3477" }, { "name": "XSLT", "bytes": "19561" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <Container xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns="urn:schemas-cosylab-com:Container:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Timeout="20.0" UseIFR="1" ManagerRetry="10" ImplLang="cpp"> <Autoload> <cdb:_ string="baci"/> <cdb:_ string="senderPT"/> </Autoload> <LoggingConfig centralizedLogger="Log" minLogLevel="2" dispatchPacketSize="0" immediateDispatchLevel="99"> </LoggingConfig> </Container>
{ "content_hash": "2c0b2a6bbe6272414ad0055849f64168", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 65, "avg_line_length": 31.714285714285715, "alnum_prop": 0.5645645645645646, "repo_name": "csrg-utfsm/acscb", "id": "030cbe161424b060a3803c1f6d6fb2137711c594", "size": "666", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "Benchmark/bulkDataPerf/test/CDB.1flowESO/MACI/Containers/SenderContainer/SenderContainer.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Awk", "bytes": "633" }, { "name": "Batchfile", "bytes": "2346" }, { "name": "C", "bytes": "751150" }, { "name": "C++", "bytes": "7892598" }, { "name": "CSS", "bytes": "21364" }, { "name": "Elixir", "bytes": "906" }, { "name": "Emacs Lisp", "bytes": "1990066" }, { "name": "FreeMarker", "bytes": "7369" }, { "name": "GAP", "bytes": "14867" }, { "name": "Gnuplot", "bytes": "437" }, { "name": "HTML", "bytes": "1857062" }, { "name": "Haskell", "bytes": "764" }, { "name": "Java", "bytes": "13573740" }, { "name": "JavaScript", "bytes": "19058" }, { "name": "Lex", "bytes": "5101" }, { "name": "Makefile", "bytes": "1624406" }, { "name": "Module Management System", "bytes": "4925" }, { "name": "Objective-C", "bytes": "3223" }, { "name": "PLSQL", "bytes": "9496" }, { "name": "Perl", "bytes": "120411" }, { "name": "Python", "bytes": "4191000" }, { "name": "Roff", "bytes": "9920" }, { "name": "Shell", "bytes": "1198375" }, { "name": "Smarty", "bytes": "21615" }, { "name": "Tcl", "bytes": "227078" }, { "name": "XSLT", "bytes": "100454" }, { "name": "Yacc", "bytes": "5006" } ], "symlink_target": "" }
from behave import given, when, then from bass.hubkey import generate_hub_key, parse_hub_key, PARTS, is_hub_key import re @given(u'parameter "{param}" is "{value}"') def set_param(context, param, value): context.params[param] = value @given(u'parameter "ids" is array "{ids}"') def id_is_array(context, ids): context.params['ids'] = ids.split(',') @given(u'parameter "{param}" is overwritten to an empty string') def all_params_valid_except_one(context, param): context.params[param] = "" @when(u'I generate a hub key') def generate_a_hub_key(context): try: context.hub_key = generate_hub_key(**context.params) except AttributeError as context.exception: pass except TypeError as context.exception: pass except ValueError as context.exception: pass @then(u'no exception should be thrown') def no_exception_thrown(context): assert not context.exception, ( 'Exception not expected. Exception message = {}'.format(context.exception.message) ) @then(u'a "{exception_type}" for the "{param}" should be thrown') def value_error_exception(context, exception_type, param): exc_mapper = { 'value error': ValueError, 'attribute error': AttributeError, 'type error': TypeError } msg = '{} should match {}'.format(param, PARTS[param]) assert isinstance(context.exception, exc_mapper[exception_type]) assert context.exception.message == msg @then(u'the hub key should start with "{start}"') def entry_in_array_startswith(context, start): assert context.hub_key.startswith(start), ( 'Expected "{}" to start with "{}"'.format(context.hub_key, start) ) @then(u'the hub key should have a uuid as entity id') def check_entity_id(context): uuid_regex = re.compile('[0-9a-f]{32}\Z', re.I) parsed = parse_hub_key(context.hub_key) assert re.match(uuid_regex, parsed['entity_id']) @then(u'the hub key should have "{entity_type}" as entity type') def check_entity_type(context, entity_type): parsed = parse_hub_key(context.hub_key) assert parsed['entity_type'] == entity_type @then(u'a valid hub key should be returned') def check_entity_type(context): assert is_hub_key(context.hub_key)
{ "content_hash": "4701bfce09c6663064004f69086f4813", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 90, "avg_line_length": 30.324324324324323, "alnum_prop": 0.678698752228164, "repo_name": "openpermissions/bass", "id": "c338ac8350e36df03796ff4cdeacf9e80732a1c5", "size": "2853", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/behave/features/steps/hubkey.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Gherkin", "bytes": "1905" }, { "name": "Makefile", "bytes": "4401" }, { "name": "Python", "bytes": "24674" } ], "symlink_target": "" }
#include <cstdlib> #include <iostream> #include <boost/asio.hpp> using boost::asio::ip::udp; enum { max_length = 1024 }; void server(boost::asio::io_service& io_service, unsigned short port) { udp::socket sock(io_service, udp::endpoint(udp::v4(), port)); for (;;) { char data[max_length]; udp::endpoint sender_endpoint; size_t length = sock.receive_from( boost::asio::buffer(data, max_length), sender_endpoint); sock.send_to(boost::asio::buffer(data, length), sender_endpoint); } } int main(int argc, char* argv[]) { try { if (argc != 2) { std::cerr << "Usage: blocking_udp_echo_server <port>\n"; return 1; } boost::asio::io_service io_service; using namespace std; // For atoi. server(io_service, atoi(argv[1])); } catch (std::exception& e) { std::cerr << "Exception: " << e.what() << "\n"; } return 0; }
{ "content_hash": "1391a79baeda537efa883b0a50aec31b", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 69, "avg_line_length": 21.454545454545453, "alnum_prop": 0.573093220338983, "repo_name": "zjutjsj1004/third", "id": "63749b37230428ae4448be978c75904e9436e546", "size": "1261", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "boost/libs/asio/example/cpp03/echo/blocking_udp_echo_server.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "224158" }, { "name": "Batchfile", "bytes": "33175" }, { "name": "C", "bytes": "5576593" }, { "name": "C#", "bytes": "41850" }, { "name": "C++", "bytes": "179595990" }, { "name": "CMake", "bytes": "28348" }, { "name": "CSS", "bytes": "331303" }, { "name": "Cuda", "bytes": "26521" }, { "name": "FORTRAN", "bytes": "1856" }, { "name": "Groff", "bytes": "1305458" }, { "name": "HTML", "bytes": "159660377" }, { "name": "IDL", "bytes": "15" }, { "name": "JavaScript", "bytes": "285786" }, { "name": "Lex", "bytes": "1290" }, { "name": "Makefile", "bytes": "1202020" }, { "name": "Max", "bytes": "37424" }, { "name": "Objective-C", "bytes": "3674" }, { "name": "Objective-C++", "bytes": "651" }, { "name": "PHP", "bytes": "60249" }, { "name": "Perl", "bytes": "37297" }, { "name": "Perl6", "bytes": "2130" }, { "name": "Python", "bytes": "1833677" }, { "name": "QML", "bytes": "613" }, { "name": "QMake", "bytes": "17385" }, { "name": "Rebol", "bytes": "372" }, { "name": "Shell", "bytes": "1144162" }, { "name": "Tcl", "bytes": "1205" }, { "name": "TeX", "bytes": "38313" }, { "name": "XSLT", "bytes": "564356" }, { "name": "Yacc", "bytes": "20341" } ], "symlink_target": "" }
FROM gcr.io/oss-fuzz-base/base-builder MAINTAINER [email protected] RUN apt-get update && apt-get install -y make autoconf automake libtool g++ # libpng12-dev libjpeg-dev libgif-dev liblzma-dev libgeos-dev libcurl4-gnutls-dev libproj-dev libxml2-dev libexpat-dev libxerces-c-dev libnetcdf-dev netcdf-bin libpoppler-dev libspatialite-dev libhdf4-alt-dev libhdf5-serial-dev poppler-utils libfreexl-dev unixodbc-dev libwebp-dev libepsilon-dev libpcre3-dev # libpodofo-dev libcrypto++-dev RUN git clone --depth 1 https://github.com/OSGeo/gdal gdal WORKDIR gdal COPY build.sh $SRC/
{ "content_hash": "d991973ea859ccc9b605dc74007b8544", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 309, "avg_line_length": 73.5, "alnum_prop": 0.8044217687074829, "repo_name": "kcc/oss-fuzz", "id": "12ac3f4779967d2d3eadc953e3b45b7c99064a7b", "size": "1248", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "projects/gdal/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7113" }, { "name": "C++", "bytes": "37050" }, { "name": "Groovy", "bytes": "1288" }, { "name": "HTML", "bytes": "6154" }, { "name": "Makefile", "bytes": "1782" }, { "name": "Python", "bytes": "39967" }, { "name": "Shell", "bytes": "91967" } ], "symlink_target": "" }
''' JSON related utilities. This module provides a few things: 1) A handy function for getting an object down to something that can be JSON serialized. See to_primitive(). 2) Wrappers around loads() and dumps(). The dumps() wrapper will automatically use to_primitive() for you if needed. 3) This sets up anyjson to use the loads() and dumps() wrappers if anyjson is available. ''' import datetime import functools import inspect import itertools import json try: import xmlrpclib except ImportError: # NOTE(jd): xmlrpclib is not shipped with Python 3 xmlrpclib = None import six from ironic.openstack.common import gettextutils from ironic.openstack.common import importutils from ironic.openstack.common import timeutils netaddr = importutils.try_import("netaddr") _nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, inspect.isfunction, inspect.isgeneratorfunction, inspect.isgenerator, inspect.istraceback, inspect.isframe, inspect.iscode, inspect.isbuiltin, inspect.isroutine, inspect.isabstract] _simple_types = (six.string_types + six.integer_types + (type(None), bool, float)) def to_primitive(value, convert_instances=False, convert_datetime=True, level=0, max_depth=3): """Convert a complex object into primitives. Handy for JSON serialization. We can optionally handle instances, but since this is a recursive function, we could have cyclical data structures. To handle cyclical data structures we could track the actual objects visited in a set, but not all objects are hashable. Instead we just track the depth of the object inspections and don't go too deep. Therefore, convert_instances=True is lossy ... be aware. """ # handle obvious types first - order of basic types determined by running # full tests on nova project, resulting in the following counts: # 572754 <type 'NoneType'> # 460353 <type 'int'> # 379632 <type 'unicode'> # 274610 <type 'str'> # 199918 <type 'dict'> # 114200 <type 'datetime.datetime'> # 51817 <type 'bool'> # 26164 <type 'list'> # 6491 <type 'float'> # 283 <type 'tuple'> # 19 <type 'long'> if isinstance(value, _simple_types): return value if isinstance(value, datetime.datetime): if convert_datetime: return timeutils.strtime(value) else: return value # value of itertools.count doesn't get caught by nasty_type_tests # and results in infinite loop when list(value) is called. if type(value) == itertools.count: return six.text_type(value) # FIXME(vish): Workaround for LP bug 852095. Without this workaround, # tests that raise an exception in a mocked method that # has a @wrap_exception with a notifier will fail. If # we up the dependency to 0.5.4 (when it is released) we # can remove this workaround. if getattr(value, '__module__', None) == 'mox': return 'mock' if level > max_depth: return '?' # The try block may not be necessary after the class check above, # but just in case ... try: recursive = functools.partial(to_primitive, convert_instances=convert_instances, convert_datetime=convert_datetime, level=level, max_depth=max_depth) if isinstance(value, dict): return dict((k, recursive(v)) for k, v in value.iteritems()) elif isinstance(value, (list, tuple)): return [recursive(lv) for lv in value] # It's not clear why xmlrpclib created their own DateTime type, but # for our purposes, make it a datetime type which is explicitly # handled if xmlrpclib and isinstance(value, xmlrpclib.DateTime): value = datetime.datetime(*tuple(value.timetuple())[:6]) if convert_datetime and isinstance(value, datetime.datetime): return timeutils.strtime(value) elif isinstance(value, gettextutils.Message): return value.data elif hasattr(value, 'iteritems'): return recursive(dict(value.iteritems()), level=level + 1) elif hasattr(value, '__iter__'): return recursive(list(value)) elif convert_instances and hasattr(value, '__dict__'): # Likely an instance of something. Watch for cycles. # Ignore class member vars. return recursive(value.__dict__, level=level + 1) elif netaddr and isinstance(value, netaddr.IPAddress): return six.text_type(value) else: if any(test(value) for test in _nasty_type_tests): return six.text_type(value) return value except TypeError: # Class objects are tricky since they may define something like # __iter__ defined but it isn't callable as list(). return six.text_type(value) def dumps(value, default=to_primitive, **kwargs): return json.dumps(value, default=default, **kwargs) def loads(s): return json.loads(s) def load(s): return json.load(s) try: import anyjson except ImportError: pass else: anyjson._modules.append((__name__, 'dumps', TypeError, 'loads', ValueError, 'load')) anyjson.force_implementation(__name__)
{ "content_hash": "1c74b95e5d0e12c482eabebf56976c3a", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 79, "avg_line_length": 34.93788819875776, "alnum_prop": 0.6264888888888889, "repo_name": "JioCloud/ironic", "id": "74db2e90b7e10651358e7f28d95e875971f53c23", "size": "6440", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ironic/openstack/common/jsonutils.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Mako", "bytes": "412" }, { "name": "Python", "bytes": "1640165" } ], "symlink_target": "" }
<html> <head> <title>Event Information</title> <link rel="stylesheet" type="text/css" href="pythia.css"/> <link rel="shortcut icon" href="pythia32.gif"/> </head> <body> <h2>Event Information</h2> The <code>Info</code> class collects various one-of-a-kind information, some relevant for all events and others for the current event. An object <code>info</code> is a public member of the <code>Pythia</code> class, so if you e.g. have declared <code>Pythia pythia</code>, the <code>Info</code> methods can be accessed by <code>pythia.info.method()</code>. Most of this is information that could also be obtained e.g. from the event record, but is here more directly available. It is primarily intended for processes generated internally in PYTHIA, but many of the methods would work also for events fed in via the Les Houches Accord. <h3>List information</h3> <a name="method1"></a> <p/><strong>void Info::list() &nbsp;</strong> <br/> a listing of most of the information set for the current event. <h3>The beams</h3> <a name="method2"></a> <p/><strong>int Info::idA() &nbsp;</strong> <br/> <strong>int Info::idB() &nbsp;</strong> <br/> the identities of the two beam particles. <a name="method3"></a> <p/><strong>double Info::pzA() &nbsp;</strong> <br/> <strong>double Info::pzB() &nbsp;</strong> <br/> the longitudinal momenta of the two beam particles. <a name="method4"></a> <p/><strong>double Info::eA() &nbsp;</strong> <br/> <strong>double Info::eB() &nbsp;</strong> <br/> the energies of the two beam particles. <a name="method5"></a> <p/><strong>double Info::mA() &nbsp;</strong> <br/> <strong>double Info::mB() &nbsp;</strong> <br/> the masses of the two beam particles. <a name="method6"></a> <p/><strong>double Info::eCM() &nbsp;</strong> <br/> <strong>double Info::s() &nbsp;</strong> <br/> the CM energy and its square for the two beams. <h3>Initialization</h3> <a name="method7"></a> <p/><strong>bool Info::tooLowPTmin() &nbsp;</strong> <br/> normally false, but true if the proposed <i>pTmin</i> scale was too low in timelike or spacelike showers, or in multiparton interactions. In the former case the <i>pTmin</i> is raised to some minimal value, in the latter the initialization fails (it is impossible to obtain a minijet cross section bigger than the nondiffractive one by reducing <i>pTmin</i>). <h3>The event type</h3> <a name="method8"></a> <p/><strong>string Info::name() &nbsp;</strong> <br/> <strong>int Info::code() &nbsp;</strong> <br/> the name and code of the process that occurred. <a name="method9"></a> <p/><strong>int Info::nFinal() &nbsp;</strong> <br/> the number of final-state partons in the hard process. <a name="method10"></a> <p/><strong>bool Info::isResolved() &nbsp;</strong> <br/> are beam particles resolved, i.e. were PDF's used for the process? <a name="method11"></a> <p/><strong>bool Info::isDiffractiveA() &nbsp;</strong> <br/> <strong>bool Info::isDiffractiveB() &nbsp;</strong> <br/> is either beam diffractively excited? <a name="method12"></a> <p/><strong>bool Info::isDiffractiveC() &nbsp;</strong> <br/> is there central diffraction (a.k.a. double Pomeron exchange)? <a name="method13"></a> <p/><strong>bool Info::isMinBias() &nbsp;</strong> <br/> is the process a minimum-bias one? <a name="method14"></a> <p/><strong>bool Info::isLHA() &nbsp;</strong> <br/> has the process been generated from external Les Houches Accord information? <a name="method15"></a> <p/><strong>bool Info::atEndOfFile() &nbsp;</strong> <br/> true if a linked Les Houches class refuses to return any further events, presumably because it has reached the end of the file from which events have been read in. <a name="method16"></a> <p/><strong>bool Info::hasSub() &nbsp;</strong> <br/> does the process have a subprocess classification? Currently only true for minbias and Les Houches events, where it allows the hardest collision to be identified. <a name="method17"></a> <p/><strong>string Info::nameSub() &nbsp;</strong> <br/> <strong>int Info::codeSub() &nbsp;</strong> <br/> <strong>int Info::nFinalSub() &nbsp;</strong> <br/> the name, code and number of final-state partons in the subprocess that occurred when <code>hasSub()</code> is true. For a minimum-bias event the <code>code</code> would always be 101, while <code>codeSub()</code> would vary depending on the actual hardest interaction, e.g. 111 for <i>g g -> g g</i>. For a Les Houches event the <code>code</code> would always be 9999, while <code>codeSub()</code> would be the external user-defined classification code. The methods below would also provide information for such particular subcollisions. <h3>Hard process initiators</h3> The methods in this sections refer to the two initial partons of the hard <i>2 -> n</i> process (diffraction excluded; see below). <a name="method18"></a> <p/><strong>int Info::id1() &nbsp;</strong> <br/> <strong>int Info::id2() &nbsp;</strong> <br/> the identities of the two partons coming in to the hard process. <a name="method19"></a> <p/><strong>double Info::x1() &nbsp;</strong> <br/> <strong>double Info::x2() &nbsp;</strong> <br/> <i>x</i> fractions of the two partons coming in to the hard process. <a name="method20"></a> <p/><strong>double Info::y() &nbsp;</strong> <br/> <strong>double Info::tau() &nbsp;</strong> <br/> rapidity and scaled mass-squared of the hard-process subsystem, as defined by the above <i>x</i> values. <a name="method21"></a> <p/><strong>bool Info::isValence1() &nbsp;</strong> <br/> <strong>bool Info::isValence2() &nbsp;</strong> <br/> <code>true</code> if the two hard incoming partons have been picked to belong to the valence piece of the parton-density distribution, else <code>false</code>. Should be interpreted with caution. Information is not set if you switch off parton-level processing. <h3>Hard process parton densities and scales</h3> The methods in this section refer to the partons for which parton densities have been defined, in order to calculate the cross section of the hard process (diffraction excluded; see below). <p/> These partons would normally agree with the ones above, the initiators of the <i>2 -> n</i> process, but it does not have to be so. Currently the one counterexample is POWHEG events [<a href="Bibliography.html" target="page">Ali10</a>]. Here the original hard process could be <i>2 -> (n-1)</i>. The NLO machinery at times would add an initial-state branching to give a <i>2 -> n</i> process with a changed initial state. In that case the values in this section refer to the original <i>2 -> (n-1)</i> state and the initiator ones above to the complete<i>2 -> n</i> process. The <code>Info::list()</code> printout will contain a warning in such cases. <p/> For external events in the Les Houches format, the pdf information is obtained from the optional <code>#pdf</code> line. When this information is absent, the parton identities and <i>x</i> values agree with the initiator ones above, while the pdf values are unknown and therefore set to vanish. The <i>alpha_s</i> and <i>alpha_em</i> values are part of the compulsory information. The factorization and renormalization scales are both equated with the one compulsory scale value in the Les Houches standard, except when a <code>#pdf</code> line provides the factorization scale separately. If <i>alpha_s</i>, <i>alpha_em</i> or the compulsory scale value are negative at input then new values are defined as for internal processes. <a name="method22"></a> <p/><strong>int Info::id1pdf() &nbsp;</strong> <br/> <strong>int Info::id2pdf() &nbsp;</strong> <br/> the identities of the two partons for which parton density values are defined. <a name="method23"></a> <p/><strong>double Info::x1pdf() &nbsp;</strong> <br/> <strong>double Info::x2pdf() &nbsp;</strong> <br/> <i>x</i> fractions of the two partons for which parton density values are defined. <a name="method24"></a> <p/><strong>double Info::pdf1() &nbsp;</strong> <br/> <strong>double Info::pdf2() &nbsp;</strong> <br/> parton densities <i>x*f(x,Q^2)</i> evaluated for the two incoming partons; could be used e.g. for reweighting purposes in conjunction with the <code>idpdf</code>, <code>xpdf</code> and <code>QFac</code> methods. Events obtained from external programs or files may not contain this information and, if so, 0 is returned. <a name="method25"></a> <p/><strong>double Info::QFac() &nbsp;</strong> <br/> <strong>double Info::Q2Fac() &nbsp;</strong> <br/> the <i>Q</i> or <i>Q^2</i> factorization scale at which the densities were evaluated. <a name="method26"></a> <p/><strong>double Info::alphaS() &nbsp;</strong> <br/> <strong>double Info::alphaEM() &nbsp;</strong> <br/> the <i>alpha_strong</i> and <i>alpha_electromagnetic</i> values used for the hard process. <a name="method27"></a> <p/><strong>double Info::QRen() &nbsp;</strong> <br/> <strong>double Info::Q2Ren() &nbsp;</strong> <br/> the <i>Q</i> or <i>Q^2</i> renormalization scale at which <i>alpha_strong</i> and <i>alpha_electromagnetic</i> were evaluated. <h3>Hard process kinematics</h3> The methods in this section provide info on the kinematics of the hard processes, with special emphasis on <i>2 -> 2</i> (diffraction excluded; see below). <a name="method28"></a> <p/><strong>double Info::mHat() &nbsp;</strong> <br/> <strong>double Info::sHat() &nbsp;</strong> <br/> the invariant mass and its square for the hard process. <a name="method29"></a> <p/><strong>double Info::tHat() &nbsp;</strong> <br/> <strong>double Info::uHat() &nbsp;</strong> <br/> the remaining two Mandelstam variables; only defined for <i>2 -> 2</i> processes. <a name="method30"></a> <p/><strong>double Info::pTHat() &nbsp;</strong> <br/> <strong>double Info::pT2Hat() &nbsp;</strong> <br/> transverse momentum and its square in the rest frame of a <i>2 -> 2</i> processes. <a name="method31"></a> <p/><strong>double Info::m3Hat() &nbsp;</strong> <br/> <strong>double Info::m4Hat() &nbsp;</strong> <br/> the masses of the two outgoing particles in a <i>2 -> 2</i> processes. <a name="method32"></a> <p/><strong>double Info::thetaHat() &nbsp;</strong> <br/> <strong>double Info::phiHat() &nbsp;</strong> <br/> the polar and azimuthal scattering angles in the rest frame of a <i>2 -> 2</i> process. <h3>Diffraction</h3> Information on the primary elastic or <a href="Diffraction.html" target="page">diffractive</a> process (<i>A B -> A B, X1 B, A X2, X1 X2, A X B</i>) can be obtained with the methods in the "Hard process kinematics" section above. The variables here obviously are <i>s, t, u, ...</i> rather than <i>sHat, tHat, uHat, ...</i>, but the method names remain to avoid unnecessary duplication. Most other methods are irrelevant for a primary elastic/diffractive process. <p/>Central diffraction <i>A B -> A X B</i> is a <i>2 -> 3</i> process, and therefore most of the <i>2 -> 2</i> variables are no longer relevant. The <code>tHat()</code> and <code>uHat()</code> methods instead return the two <i>t</i> values at the <i>A -> A</i> and <i>B -> B</i> vertices, and <code>pTHat()</code> the average transverse momentum of the three outgoing "particles", while <code>thetaHat()</code> and <code>phiHat()</code> are undefined. <p/> While the primary interaction does not contain a hard process, the diffractive subsystems can contain them, but need not. Specifically, double diffraction can contain two separate hard subprocesses, which breaks the methods above. Most of them have been expanded with an optional argument to address properties of diffractive subsystems. This argument can take four values: <ul> <li>0 : default argument, used for normal nondiffractive events or the primary elastic/diffractive process (see above); <li>1 : the <i>X1</i> system in single diffraction <i>A B -> X1 B</i> or double diffraction <i>A B -> X1 X2</i>; <li>2 : the <i>X2</i> system in single diffraction <i>A B -> A X2</i> or double diffraction <i>A B -> X1 X2</i>; <li>3 : the <i>X</i> system in central diffraction <i>A B -> A X B</i>. </ul> The argument is defined for all of the methods in the three sections above, "Hard process initiators", "Hard process parton densities and scales" and "Hard process kinematics", with the exception of the <code>isValence</code> methods. Also the four final methods of "The event type" section, the <code>...Sub()</code> methods, take this argument. But recall that they will only provide meaningful answers, firstly if there is a system of the requested type, and secondly if there is a hard subprocess in this system. A simple check for this is that <code>id1()</code> has to be nonvanishing. The methods below this section do not currently provide information specific to diffractive subsystems, e.g. the MPI information is not bookkept in such cases. <h3>Event weight and activity</h3> <a name="method33"></a> <p/><strong>double Info::weight() &nbsp;</strong> <br/> weight assigned to the current event. Is normally 1 and thus uninteresting. However, there are several cases where one may have nontrivial event weights. These weights must the be used e.g. when filling histograms. <br/>(i) In the <code><a href="PhaseSpaceCuts.html" target="page"> PhaseSpace:increaseMaximum = off</a></code> default strategy, an event with a differential cross-section above the assumed one (in a given phase-space point) is assigned a weight correspondingly above unity. This should happen only very rarely, if at all, and so could normally be disregarded. <br/>(ii) The <a href="UserHooks.html" target="page">User Hooks</a> class offers the possibility to bias the selection of phase space points, which means that events come with a compensating weight, stored here. <br/>(iii) For Les Houches events some strategies allow negative weights, which then after unweighting lead to events with weight -1. There are also Les Houches strategies where no unweighting is done, so events come with a weight. Specifically, for strategies <i>+4</i> and <i>-4</i>, the event weight is in units of pb. (Internally in mb, but converted at output.) <a name="method34"></a> <p/><strong>double Info::weightSum() &nbsp;</strong> <br/> Sum of weights accumulated during the run. For unweighted events this agrees with the number of generated events. In order to obtain histograms normalized "per event", at the end of a run, histogram contents should be divided by this weight. (And additionally divided by the bin width.) Normalization to cross section also required multiplication by <code>sigmaGen()</code> below. <a name="method35"></a> <p/><strong>int Info::lhaStrategy() &nbsp;</strong> <br/> normally 0, but if Les Houches events are input then it gives the event weighting strategy, see <a href="LesHouchesAccord.html" target="page">Les Houches Accord</a>. <a name="method36"></a> <p/><strong>int Info::nISR() &nbsp;</strong> <br/> <strong>int Info::nFSRinProc() &nbsp;</strong> <br/> <strong>int Info::nFSRinRes() &nbsp;</strong> <br/> the number of emissions in the initial-state showering, in the final-state showering excluding resonance decays, and in the final-state showering inside resonance decays, respectively. <a name="method37"></a> <p/><strong>double Info::pTmaxMPI() &nbsp;</strong> <br/> <strong>double Info::pTmaxISR() &nbsp;</strong> <br/> <strong>double Info::pTmaxFSR() &nbsp;</strong> <br/> Maximum <i>pT</i> scales set for MPI, ISR and FSR, given the process type and scale choice for the hard interactions. The actual evolution will run down from these scales. <a name="method38"></a> <p/><strong>double Info::pTnow() &nbsp;</strong> <br/> The current <i>pT</i> scale in the combined MPI, ISR and FSR evolution. Useful for classification in <a href="UserHooks.html" target="page">user hooks</a>, but not once the event has been evolved. <a name="method39"></a> <p/><strong>double Info::mergingWeight() &nbsp;</strong> <br/> combined leading-order merging weight assigned to the current event, if tree-level multi-jet merging (i.e. <a href="CKKWLMerging.html" target="page"> CKKW-L</a> or <a href="UMEPSMerging.html" target="page"> UMEPS</a> merging) is attempted. If tree-level multi-jet merging is performed, all histograms should be filled with this weight, as discussed in <a href="CKKWLMerging.html" target="page"> CKKW-L Merging</a> and <a href="UMEPSMerging.html" target="page"> UMEPS Merging</a>. <a name="method40"></a> <p/><strong>double Info::mergingWeightNLO() &nbsp;</strong> <br/> combined NLO merging weight assigned to the current event, if NLO multi-jet merging (i.e. <a href="NLOMerging.html" target="page"> NL<sup>3</sup></a> or <a href="NLOMerging.html" target="page"> UNLOPS</a> merging) is attempted. If NLO multi-jet merging is performed, all histograms should be filled with this weight, as discussed in <a href="NLOMerging.html" target="page"> NLO Merging</a> . <h3>Multiparton interactions</h3> <a name="method41"></a> <p/><strong>double Info::a0MPI() &nbsp;</strong> <br/> The value of a0 when an x-dependent matter profile is used, <code>MultipartonInteractions:bProfile = 4</code>. <a name="method42"></a> <p/><strong>double Info::bMPI() &nbsp;</strong> <br/> The impact parameter <i>b</i> assumed for the current collision when multiparton interactions are simulated. Is not expressed in any physical size (like fm), but only rescaled so that the average should be unity for minimum-bias events (meaning less than that for events with hard processes). <a name="method43"></a> <p/><strong>double Info::enhanceMPI() &nbsp;</strong> <br/> The choice of impact parameter implies an enhancement or depletion of the rate of subsequent interactions, as given by this number. Again the average is normalized be unity for minimum-bias events (meaning more than that for events with hard processes). <a name="method44"></a> <p/><strong>int Info::nMPI() &nbsp;</strong> <br/> The number of hard interactions in the current event. Is 0 for elastic and diffractive events, and else at least 1, with more possible from multiparton interactions. <a name="method45"></a> <p/><strong>int Info::codeMPI(int i) &nbsp;</strong> <br/> <strong>double Info::pTMPI(int i) &nbsp;</strong> <br/> the process code and transverse momentum of the <code>i</code>'th subprocess, with <code>i</code> in the range from 0 to <code>nMPI() - 1</code>. The values for subprocess 0 is redundant with information already provided above. <a name="method46"></a> <p/><strong>int Info::iAMPI(int i) &nbsp;</strong> <br/> <strong>int Info::iBMPI(int i) &nbsp;</strong> <br/> are normally zero. However, if the <code>i</code>'th subprocess is a rescattering, i.e. either or both incoming partons come from the outgoing state of previous scatterings, they give the position in the event record of the outgoing-state parton that rescatters. <code>iAMPI</code> and <code>iBMPI</code> then denote partons coming from the first or second beam, respectively. <a name="method47"></a> <p/><strong>double Info::eMPI(int i) &nbsp;</strong> <br/> The enhancement or depletion of the rate of the <code>i</code>'th subprocess. Is primarily of interest for the <code>MultipartonInteractions:bProfile = 4</code> option, where the size of the proton depends on the <i>x</i> values of the colliding partons. Note that <code>eMPI(0) = enhanceMPI()</code>. <h3>Cross sections</h3> Here are the currently available methods related to the event sample as a whole, for the default value <code>i = 0</code>, and otherwise for the specific process code provided as argument. This is the number obtained with <code>Info::code()</code>, while the further subdivision given by <code>Info::codeSub()</code> is not bookkept. While continuously updated during the run, it is recommended only to study these properties at the end of the event generation, when the full statistics is available. The individual process results are not available if <a href="ASecondHardProcess.html" target="page">a second hard process</a> has been chosen, but can be gleaned from the <code>pythia.stat()</code> output. <a name="method48"></a> <p/><strong>long Info::nTried(int i = 0) &nbsp;</strong> <br/> <strong>long Info::nSelected(int i = 0) &nbsp;</strong> <br/> <strong>long Info::nAccepted(int i = 0) &nbsp;</strong> <br/> the total number of tried phase-space points, selected hard processes and finally accepted events, summed over all allowed processes (<code>i = 0</code>) or for the given process. The first number is only intended for a study of the phase-space selection efficiency. The last two numbers usually only disagree if the user introduces some veto during the event-generation process; then the former is the number of acceptable events found by PYTHIA and the latter the number that also were approved by the user. If you set <a href="ASecondHardProcess.html" target="page">a second hard process</a> there may also be a mismatch. <a name="method49"></a> <p/><strong>double Info::sigmaGen(int i = 0) &nbsp;</strong> <br/> <strong>double Info::sigmaErr(int i = 0) &nbsp;</strong> <br/> the estimated cross section and its estimated error, summed over all allowed processes (<code>i = 0</code>) or for the given process, in units of mb. The numbers refer to the accepted event sample above, i.e. after any user veto. <h3>Loop counters</h3> Mainly for internal/debug purposes, a number of loop counters from various parts of the program are stored in the <code>Info</code> class, so that one can keep track of how the event generation is progressing. This may be especially useful in the context of the <code><a href="UserHooks.html" target="page">User Hooks</a></code> facility. <a name="method50"></a> <p/><strong>int Info::getCounter(int i) &nbsp;</strong> <br/> the method that gives you access to the value of the various loop counters. <br/><code>argument</code><strong> i </strong> : the counter number you want to access: <br/><code>argumentoption </code><strong> 0 - 9</strong> : counters that refer to the run as a whole, i.e. are set 0 at the beginning of the run and then only can increase. <br/><code>argumentoption </code><strong> 0</strong> : the number of successful constructor calls for the <code>Pythia</code> class (can only be 0 or 1). <br/><code>argumentoption </code><strong> 1</strong> : the number of times a <code>Pythia::init(...)</code> call has been begun. <br/><code>argumentoption </code><strong> 2</strong> : the number of times a <code>Pythia::init(...)</code> call has been completed successfully. <br/><code>argumentoption </code><strong> 3</strong> : the number of times a <code>Pythia::next()</code> call has been begun. <br/><code>argumentoption </code><strong> 4</strong> : the number of times a <code>Pythia::next()</code> call has been completed successfully. <br/><code>argumentoption </code><strong> 10 - 19</strong> : counters that refer to each individual event, and are reset and updated in the top-level <code>Pythia::next()</code> method. <br/><code>argumentoption </code><strong> 10</strong> : the number of times the selection of a new hard process has been begun. Normally this should only happen once, unless a user veto is set to abort the current process and try a new one. <br/><code>argumentoption </code><strong> 11</strong> : the number of times the selection of a new hard process has been completed successfully. <br/><code>argumentoption </code><strong> 12</strong> : as 11, but additionally the process should survive any user veto and go on to the parton- and hadron-level stages. <br/><code>argumentoption </code><strong> 13</strong> : as 11, but additionally the process should survive the parton- and hadron-level stage and any user cuts. <br/><code>argumentoption </code><strong> 14</strong> : the number of times the loop over parton- and hadron-level processing has begun for a hard process. Is reset each time counter 12 above is reached. <br/><code>argumentoption </code><strong> 15</strong> : the number of times the above loop has successfully completed the parton-level step. <br/><code>argumentoption </code><strong> 16</strong> : the number of times the above loop has successfully completed the checks and user vetoes after the parton-level step. <br/><code>argumentoption </code><strong> 17</strong> : the number of times the above loop has successfully completed the hadron-level step. <br/><code>argumentoption </code><strong> 18</strong> : the number of times the above loop has successfully completed the checks and user vetoes after the hadron-level step. <br/><code>argumentoption </code><strong> 20 - 39</strong> : counters that refer to a local part of the individual event, and are reset at the beginning of this part. <br/><code>argumentoption </code><strong> 20</strong> : the current system being processed in <code>PartonLevel::next()</code>. Is almost always 1, but for double diffraction the two diffractive systems are 1 and 2, respectively. <br/><code>argumentoption </code><strong> 21</strong> : the number of times the processing of the current system (see above) has begun. <br/><code>argumentoption </code><strong> 22</strong> : the number of times a step has begun in the combined MPI/ISR/FSR evolution downwards in <i>pT</i> for the current system. <br/><code>argumentoption </code><strong> 23</strong> : the number of times MPI has been selected for the downwards step above. <br/><code>argumentoption </code><strong> 24</strong> : the number of times ISR has been selected for the downwards step above. <br/><code>argumentoption </code><strong> 25</strong> : the number of times FSR has been selected for the downwards step above. <br/><code>argumentoption </code><strong> 26</strong> : the number of times MPI has been accepted as the downwards step above, after the vetoes. <br/><code>argumentoption </code><strong> 27</strong> : the number of times ISR has been accepted as the downwards step above, after the vetoes. <br/><code>argumentoption </code><strong> 28</strong> : the number of times FSR has been accepted as the downwards step above, after the vetoes. <br/><code>argumentoption </code><strong> 29</strong> : the number of times a step has begun in the separate (optional) FSR evolution downwards in <i>pT</i> for the current system. <br/><code>argumentoption </code><strong> 30</strong> : the number of times FSR has been selected for the downwards step above. <br/><code>argumentoption </code><strong> 31</strong> : the number of times FSR has been accepted as the downwards step above, after the vetoes. <br/><code>argumentoption </code><strong> 40 - 49</strong> : counters that are unused (currently), and that therefore are free to use, with the help of the two methods below. <a name="method51"></a> <p/><strong>void Info::setCounter(int i, int value = 0) &nbsp;</strong> <br/> set the above counters to a given value. Only to be used by you for the unassigned counters 40 - 49. <br/><code>argument</code><strong> i </strong> : the counter number, see above. <br/><code>argument</code><strong> value </strong> (<code>default = <strong>0</strong></code>) : set the counter to this number; normally the default value is what you want. <a name="method52"></a> <p/><strong>void Info::addCounter(int i, int value = 0) &nbsp;</strong> <br/> increase the above counters by a given amount. Only to be used by you for the unassigned counters 40 - 49. <br/><code>argument</code><strong> i </strong> : the counter number, see above. <br/><code>argument</code><strong> value </strong> (<code>default = <strong>1</strong></code>) : increase the counter by this amount; normally the default value is what you want. <h3>Parton shower history</h3> The following methods are mainly intended for internal use, e.g. for matrix-element matching. <a name="method53"></a> <p/><strong>void Info::hasHistory(bool hasHistoryIn) &nbsp;</strong> <br/> <strong>bool Info::hasHistory() &nbsp;</strong> <br/> set/get knowledge whether the likely shower history of an event has been traced. <a name="method54"></a> <p/><strong>void Info::zNowISR(bool zNowIn) &nbsp;</strong> <br/> <strong>double Info::zNowISR() &nbsp;</strong> <br/> set/get value of <i>z</i> in latest ISR branching. <a name="method55"></a> <p/><strong>void Info::pT2NowISR(bool pT2NowIn) &nbsp;</strong> <br/> <strong>double Info::pT2NowISR() &nbsp;</strong> <br/> set/get value of <i>pT^2</i> in latest ISR branching. <h3>Header information</h3> A simple string key/value store, mainly intended for accessing information that is stored in the header block of Les Houches Event (LHE) files. In principle, any <code>LHAup</code> derived class can set this header information, which can then be read out later. Although the naming convention is arbitrary, in practice, it is dictated by the XML-like format of LHE files, see <a href="LesHouchesAccord.html" target="page"> Les Houches Accord</a> for more details. <a name="method56"></a> <p/><strong>string Info::header(string key) &nbsp;</strong> <br/> return the header named <code>key</code> <a name="method57"></a> <p/><strong>vector &lt;string&gt; Info::headerKeys() &nbsp;</strong> <br/> return a vector of all header key names <a name="method58"></a> <p/><strong>void Info::setHeader(string key, string val) &nbsp;</strong> <br/> set the header named <code>key</code> with the contents of <code>val</code> </body> </html> <!-- Copyright (C) 2013 Torbjorn Sjostrand -->
{ "content_hash": "8a332edf1577c5e8ba98ade2fde37d56", "timestamp": "", "source": "github", "line_count": 746, "max_line_length": 134, "avg_line_length": 40.0455764075067, "alnum_prop": 0.713161946843409, "repo_name": "mkrzewic/AliRoot", "id": "4a0f5a3568c4b308ca94836fb74a155168296bcd", "size": "29874", "binary": false, "copies": "10", "ref": "refs/heads/dev", "path": "PYTHIA8/pythia8175/htmldoc/EventInformation.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "4478" }, { "name": "Batchfile", "bytes": "701" }, { "name": "C", "bytes": "14439474" }, { "name": "C++", "bytes": "92441913" }, { "name": "CMake", "bytes": "1182874" }, { "name": "CSS", "bytes": "9136" }, { "name": "Cuda", "bytes": "51450" }, { "name": "Fortran", "bytes": "33166465" }, { "name": "HTML", "bytes": "9522910" }, { "name": "M4", "bytes": "77872" }, { "name": "Makefile", "bytes": "868205" }, { "name": "Objective-C", "bytes": "287693" }, { "name": "PHP", "bytes": "10833197" }, { "name": "PLSQL", "bytes": "701975" }, { "name": "Pascal", "bytes": "2295" }, { "name": "Perl", "bytes": "12019" }, { "name": "PostScript", "bytes": "1946897" }, { "name": "Python", "bytes": "58967" }, { "name": "Shell", "bytes": "303176" }, { "name": "SourcePawn", "bytes": "7668" }, { "name": "TeX", "bytes": "936449" } ], "symlink_target": "" }
<!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></title> {common_head} <script type="text/javascript"> function sub() { var productParamTypeClassName= $('#f_ProductParamTypeClassName').val(); if(productParamTypeClassName == ''){ alert('请输入产品参数类别名称!'); } else if(productParamTypeClassName.length>100){ alert('产品参数类别名称不能超过100个字节!'); } else {$('#mainForm').submit();} } </script> </head> <body> <form id="mainForm" action="/default.php?secu=manage&mod=product_param_type_class&m={method}&product_param_type_class_id={ProductParamTypeClassId}&p={PageIndex}" method="post"> <table width="99%" align="center" border="0" cellspacing="0" cellpadding="0"> <tr style="display: none"> <td class="spe_line" height="30" align="right"></td> <td class="spe_line"> <input type="hidden" id="f_ManageUserId" name="f_ManageUserId" value="{ManageUserId}" /> <input type="hidden" id="f_SiteId" name="f_SiteId" value="{SiteId}" /> <input type="hidden" id="f_ChannelId" name="f_ChannelId" value="{ChannelId}" /> <input type="hidden" id="f_CreateDate" name="f_CreateDate" value="{CreateDate}" /> </td> </tr> <tr> <td class="spe_line" height="30" align="right"><label for="f_ProductParamTypeClassName">名称:</label></td> <td class="spe_line" title="{ProductParamTypeClassName}"><input name="f_ProductParamTypeClassName" id="f_ProductParamTypeClassName" value="{ProductParamTypeClassName}" type="text" class="input_box" style=" width: 300px;" /></td> </tr> <tr> <td class="spe_line" height="30" align="right"><label for="f_Sort">排序:</label></td> <td class="spe_line"><input name="f_Sort" id="f_Sort" value="{Sort}" type="text" class="input_number" style=" width: 60px;" />(注:输入数字,数值越大越靠前)</td> </tr> <tr> <td class="spe_line" height="30" align="right"><label for="f_State">状态:</label></td> <td class="spe_line"> <select id="f_State" name="f_State"> <option value="0">启用</option> <option value="100">停用</option> </select> {s_State} </td> </tr> <tr> <td colspan="2" height="30" align="center"> <input class="btn" value="确 认" type="button" onclick="sub()" /> </td> </tr> </table> </form> </body> </html>
{ "content_hash": "d7437a1b92c86bf6e4782017add550fc", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 249, "avg_line_length": 53.21666666666667, "alnum_prop": 0.4882555590353899, "repo_name": "Daisukydayo/icms2", "id": "5b72047a7ff2ee408430425eca80ffdeb7b5aa54", "size": "3303", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "system_template/common/product/product_param_type_class_deal.html.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1613178" }, { "name": "HTML", "bytes": "7017824" }, { "name": "JavaScript", "bytes": "3697686" }, { "name": "PHP", "bytes": "10418175" }, { "name": "Smarty", "bytes": "33117" } ], "symlink_target": "" }
{% extends "proposals/base.html" %} {% load i18n markup %} {% block bodyclass %}{{ block.super }} details{% endblock %} {% block title %}{% trans "Proposal" %}: {{ proposal.title }}{% endblock %} {% block body %} <article class="proposal"> <div class="meta"> {% if current_conference.anonymize_proposal_author %} {% blocktrans with submission_date=proposal.submission_date|date:"DATE_FORMAT" %} This proposal was submitted on <span class="submission-date">{{ submission_date }}</span>. {% endblocktrans %} {% else %} {% blocktrans with speaker_url=proposal.speaker.get_absolute_url speaker=proposal.speaker submission_date=proposal.submission_date|date:"DATE_FORMAT" %} <a class="speaker user" href="{{ speaker_url }}">{{ speaker }}</a> submitted this proposal on <span class="submission-date">{{ submission_date }}</span>. {% endblocktrans %} {% endif %} {% if tags %} <dl class="tags"><dt>{% trans "Tags" %}:</dt><dd> {% for tag in tags %} <span class="tag">{{ tag.name }}</span>{% if not forloop.last %}, {% endif %} {% endfor %} </dd></dl> {% endif %} </div> {% if proposal.kind.slug == 'training' %} <div class="description"> <h2>{% trans "Description" %}</h2> {{ proposal.description|markdown:"safe" }} </div> <div class="abstract"> <h2>{% trans "Structure" %}</h2> {{ proposal.abstract|markdown:"safe" }} </div> {% else %} <div class="abstract"> <h2>{% trans "Abstract" %}</h2> {{ proposal.abstract|markdown:"safe" }} </div> <div class="description"> <h2>{% trans "Description" %}</h2> {{ proposal.description|markdown:"safe" }} </div> {% endif %} {% if proposal.notes %} <div class="notes"> <h2>{% trans "Notes" %}</h2> {{ proposal.notes|markdown:"safe" }} </div> {% endif %} <div class="actions"> {% if proposal.kind.accepts_proposals %} {% if can_leave %} <a class="btn" href="{% url 'leave_proposal' pk=proposal.pk %}"><i class="icon-remove"></i> {% trans "Leave" %}</a> {% endif %} {% if can_edit %} <a class="btn" href="{% url 'edit_proposal' pk=proposal.pk %}"><i class="icon-edit"></i> {% trans "Edit" %}</a> {% endif %} {% if can_delete %} <a class="btn" href="{% url 'cancel_proposal' pk=proposal.pk %}"><i class="icon-remove"></i> {% trans "Delete" %}</a> {% endif %} {% endif %} </div> </article> {% endblock %}
{ "content_hash": "a68b2a791d53136b81caedd5ce8a38c2", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 153, "avg_line_length": 34.333333333333336, "alnum_prop": 0.5939214858590123, "repo_name": "EuroPython/djep", "id": "2911e85a87f188eedbaab4ded27644ad7ce36382", "size": "2369", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "pyconde/proposals/templates/proposals/proposal_detail.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "246835" }, { "name": "JavaScript", "bytes": "112740" }, { "name": "Puppet", "bytes": "2679" }, { "name": "Python", "bytes": "1927106" }, { "name": "Ruby", "bytes": "181" }, { "name": "Shell", "bytes": "6515" } ], "symlink_target": "" }
<?php /** * @file views-views-rdf-style-sioc.tpl.php * Default template for the Views RDF style plugin using the SIOC vocabulary * * Variables: * - $view: The View object. * - $rows: Array of row objects as rendered by _views_xml_render_fields * - $nodes, $users Array of user and node objects created by template_preprocess_views_views_rdf_style_sioc * * @ingroup views_templates */ global $base_url; $content_type = ($options['content_type'] == 'default') ? 'application/rdf+xml' : $options['content_type']; if (!$header) { //build our own header $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $xml .= '<!-- generator="Drupal Views Datasource Module" -->'."\n"; $xml .= "<rdf:RDF\r\n"; $xml .= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\r\n"; $xml .= " xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\r\n"; $xml .= " xmlns:sioc=\"http://rdfs.org/sioc/ns#\"\r\n"; $xml .= " xmlns:sioct=\"http://rdfs.org/sioc/terms#\"\r\n"; $xml .= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\r\n"; $xml .= " xmlns:dcterms=\"http://purl.org/dc/terms/\"\r\n"; $xml .= " xmlns:admin=\"http://webns.net/mvcb/\"\r\n"; $xml .= " xmlns:foaf=\"http://xmlns.com/foaf/0.1/\">\r\n"; } if ($users) { if (!$nodes) { //Document is about users $xml .= "<foaf:Document rdf:about=\"". url($view->name, array('absolute' => TRUE)) ."\">\n"; $xml .= " <dc:title>SIOC user profiles for: ". variable_get('site_name', 'drupal') ."</dc:title>\n"; $xml .= " <dc:description>\n"; $xml .= " A User is an online account of a member of an online community. "; $xml .= "It is connected to Items and Posts that a User creates or edits, "; $xml .= "to Containers and Forums that it is subscribed to or moderates and "; $xml .= "to Sites that it administers. Users can be grouped for purposes of "; $xml .= "allowing access to certain Forums or enhanced community site features (weblogs, webmail, etc.)."; $xml .= "A foaf:Person will normally hold a registered User account on a Site "; $xml .= "(through the property foaf:holdsAccount), and will use this account "; $xml .= "to create content and interact with the community. sioc:User describes "; $xml .= "properties of an online account, and is used in combination with a "; $xml .= "foaf:Person (using the property sioc:account_of) which describes "; $xml .= "information about the individual itself.\n"; $xml .= " </dc:description>\n"; $xml .= "####foaf_topics####\n"; $xml .= " <admin:generatorAgent rdf:resource=\"http://drupal.org/project/views_datasource\"/>\n"; $xml .= "</foaf:Document>\n"; foreach($users as $user) { $uid = $user["uid"]; $user_name = $user["name"]; $email = $user["mail"]; $xml .="<foaf:Person rdf:about=\"". url('user/'. $uid, array('absolute' => TRUE)) ."\">\n"; $xml .=" <foaf:name>$user_name</foaf:name>\n"; $xml .=" <foaf:mbox_sha1sum>". md5('mailto:'. $email) ."</foaf:mbox_sha1sum>\n"; $xml .=" <foaf:holdsAccount>\n"; $xml .=" <sioc:User rdf:nodeID=\"$uid\">\n"; $xml .=" <sioc:name>$user_name</sioc:name>\n"; $xml .=" <sioc:email rdf:resource=\"mailto:$email\"/>\n"; $xml .=" <sioc:email_sha1>". md5('mailto:'. $email) ."</sioc:email_sha1>\n"; $xml .=" <sioc:link rdf:resource=\"". url('user/'. $uid, array('absolute' => TRUE)) ."\" rdfs:label=\"$user_name\"/>\n"; $roles = array(); $roles_query = db_query("SELECT r.name AS name, r.rid AS rid FROM {users_roles} ur, {role} r WHERE ur.uid = %d AND ur.rid = r.rid", $uid); while ($role = db_fetch_object($roles_query)) $roles[$role->rid] = $role->name; if (count($roles) > 0) { $xml .=" <sioc:has_function>\n"; foreach ($roles as $rid => $name) $xml .=" <sioc:Role><rdfs:label><![CDATA[$name]]></rdfs:label></sioc:Role>\n"; $xml .=" </sioc:has_function>\n"; } $xml .=" </sioc:User>\n"; $xml .=" </foaf:holdsAccount>\n"; $xml .="</foaf:Person>\n"; } } } if ($nodes) { $users_xml = ""; $nodes_xml = ""; $users_done = array(); $count = 0; foreach($nodes as $node) { if ((array_key_exists("id", $node)) && (array_key_exists("title", $node)) && (array_key_exists("type", $node)) && (array_key_exists("created", $node)) && (array_key_exists("changed", $node)) && (array_key_exists("last_updated", $node)) && (array_key_exists("uid", $node)) && (array_key_exists("body", $node))) { if (array_key_exists($node["id"], $users) && (!array_key_exists($node["uid"], $users_done))) { $user = $users[$node["id"]]; $users_done[$node["uid"]] = $user; $users_xml .= _views_rdf_sioc_xml_user_render($user); } $nodes_xml .= _views_rdf_sioc_xml_story_render($node["id"], $node["title"], $node["type"], $node["created"], $node["changed"], $node["last_updated"], $node["uid"], $node["body"]); } else { $nid = $node["id"]; $nodes_xml .= "<missing> node $nid is missing one or more of the id, title, type, created, changed, last_updated, uid, or body attributes.</missing>"; // if ($view->override_path) // print '<b style="color:red">One of the id, title, type, created, changed, lasty_updated, uid, and body attributes is missing.</b>'; // elseif ($options['using_views_api_mode']) // print "One of the id, title, type, created, changed, lasty_updated, uid, and body attributes is missing."; // else drupal_set_message(t('One of the id, title, type, created, changed, lasty_updated, uid, and body attributes is missing.'), 'error'); // return; } }//for }//if $xml .= $users_xml.$nodes_xml; $xml .= "</rdf:RDF>\n"; if ($view->override_path) { // inside live preview print htmlspecialchars($xml); } elseif ($options['using_views_api_mode']) { // We're in Views API mode. print $xml; } else { drupal_add_http_header("Content-Type", "$content_type; charset=utf-8"); print $xml; drupal_page_footer(); exit; }
{ "content_hash": "fc27e4a4ff2e9f39f616c0777411d69b", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 185, "avg_line_length": 50.458333333333336, "alnum_prop": 0.5866226259289843, "repo_name": "shridharsahil/libraryweb-site", "id": "868a7d10a765844eff046cd3d56ec98215170a54", "size": "6055", "binary": false, "copies": "58", "ref": "refs/heads/master", "path": "www/sites/all/modules/contrib/views_datasource/views/theme/views-views-rdf-style-sioc.tpl.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "48011" }, { "name": "ApacheConf", "bytes": "5969" }, { "name": "Batchfile", "bytes": "270" }, { "name": "CSS", "bytes": "1363366" }, { "name": "CoffeeScript", "bytes": "872" }, { "name": "HTML", "bytes": "1452712" }, { "name": "JavaScript", "bytes": "5866919" }, { "name": "Makefile", "bytes": "5304" }, { "name": "PHP", "bytes": "19298555" }, { "name": "Ruby", "bytes": "23554" }, { "name": "Shell", "bytes": "29089" }, { "name": "SourcePawn", "bytes": "143" }, { "name": "XSLT", "bytes": "5014" } ], "symlink_target": "" }
inline OverLapped::OverLapped() { ZeroMemory(&sysOverLapped, sizeof(sysOverLapped)); sysBuffer.buf = dataBuffer; } struct ThreadInfo { HANDLE hIOCP; //LPFN_ACCEPTEX lpfAccepEx; SOCKET Conn; NetMsg* ReadMsg; NetMsg* WriteMsg; }; char* GetSendMsg(char* pBuff, unsigned long& iSize) { char pBuf[OverLappedBufferLen]; ZeroMemory(pBuf, OverLappedBufferLen); //MsgInfo pMsgInfo; //pMsgInfo.Clear(); //pMsgInfo.set_time(GetTickCount()); //pMsgInfo.set_name("new send time"); //pMsgInfo.set_from("Server"); //pMsgInfo.SerializeToArray(pBuff, OverLappedBufferLen); //iSize = pMsgInfo.ByteSize(); return pBuff; } DWORD ThreadProcess(LPVOID pParam) { ThreadInfo* pThreadInfo = (ThreadInfo*)pParam; HANDLE hIOCP = pThreadInfo->hIOCP; SOCKET sListenConn = pThreadInfo->Conn; NetMsg* pReadMsg = pThreadInfo->ReadMsg; NetMsg* pWriteMsg = pThreadInfo->WriteMsg; OverLapped* pOver = NULL; SOCKET* pConn = NULL; DWORD dwBytes; DWORD dwFlag; for (;;) { GetQueuedCompletionStatus(hIOCP, &dwBytes, (PULONG_PTR)&pConn, (LPOVERLAPPED*)&pOver, INFINITE); if (!pConn && !pOver) return 0; if ((dwBytes == 0 && (pOver->opType == OverLapped::OLOpType::EOLOT_Send || pOver->opType == OverLapped::OLOpType::EOLOT_Recv)) || (pOver->opType == OverLapped::OLOpType::EOLOT_Accept && WSAGetLastError() == WSA_OPERATION_ABORTED)) { closesocket((SOCKET)pOver->sysBuffer.len); delete pOver; } else { switch (pOver->opType) { case OverLapped::OLOpType::EOLOT_Accept: { SOCKET sAcceptConn = (SOCKET)pOver->sysBuffer.len; int iLocalAddr, iRemoteAddr, iError; LPSOCKADDR pLocalAddr; sockaddr_in* pRemoteAddr = NULL; GetAcceptExSockaddrs(pOver->sysBuffer.buf, 0, AcceptExSockAddrInLen, AcceptExSockAddrInLen, (PSOCKADDR*)&pLocalAddr, &iLocalAddr, (PSOCKADDR*)&pRemoteAddr, &iRemoteAddr); printf("new connect: %d.%d.%d.%d\n", pRemoteAddr->sin_addr.s_net, pRemoteAddr->sin_addr.s_host, pRemoteAddr->sin_addr.s_lh, pRemoteAddr->sin_addr.s_impno); // ¸üÐÂÁ¬½Ó½øÀ´µÄSocket£¬Ï£ÍûClientSocket¾ßÓкÍListenSocketÏàͬµÄÊôÐÔ£¬¶ÔClientSocketµ÷ÓÃSO_UPDATE_ACCEPT_CONTEXT // git snap (00e097d): WSAEFAULT ²ÎÊý4Ó¦¸ÃÖ¸Õë if (setsockopt(sAcceptConn, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char*)&sListenConn, sizeof(sListenConn)) == SOCKET_ERROR) { Log("EOLOT_Accept [%d] setsockopt Error[%d].\n", sAcceptConn, WSAGetLastError()); closesocket(sAcceptConn); delete pOver; break; } // IOCP¹ÜÀíÁ¬½Ó // ²ÎÊý4£ºÖ¸Õë if (!CreateIoCompletionPort((HANDLE)sAcceptConn, hIOCP, (DWORD_PTR)&sAcceptConn, 0)) { Log("EOLOT_Accept [%d] CreateIoCompletionPort Error [%d].\n", sAcceptConn, WSAGetLastError()); closesocket(sAcceptConn); delete pOver; break; } delete pOver; OverLapped* pRecvOver = new OverLapped; pRecvOver->opType = OverLapped::EOLOT_Recv; pRecvOver->sysBuffer.len = OverLappedBufferLen; ZeroMemory(pRecvOver->dataBuffer, OverLappedBufferLen); // µÈ´ý½ÓÊÜÊý¾Ý // git snap(6fa835e): Error = WSAEOPNOTSUPP(10045 Operation not supported), ²ÎÊý5£ºflag´íÎó DWORD dwTemp[2] = {0, 0}; int nResult = WSARecv(sAcceptConn, &pRecvOver->sysBuffer, 1, &dwTemp[0], &dwTemp[1], &pRecvOver->sysOverLapped, NULL); if (nResult == SOCKET_ERROR && ((iError = WSAGetLastError()) != ERROR_IO_PENDING)) { Log("EOLOT_Accept [%d] WSARecv Error[%d].\n", sAcceptConn, iError); closesocket(sAcceptConn); delete pRecvOver; break; } Log("EOLOT_Accept [%d] WSARecv OK.\n", sAcceptConn); // ·¢Ë͵ÚÒ»¸öÊý¾Ý // git snap(): Erro = OverLapped* pSendOver = new OverLapped; pSendOver->opType = OverLapped::OLOpType::EOLOT_Send; ZeroMemory(pSendOver->dataBuffer, OverLappedBufferLen); GetSendMsg(pSendOver->dataBuffer, pSendOver->sysBuffer.len); //sprintf_s(pSendOver->dataBuffer, "server new send time %d", GetTickCount()); //pSendOver->sysBuffer.len = strlen(pSendOver->dataBuffer); int nResult2 = WSASend(sAcceptConn, &pSendOver->sysBuffer, 1, &dwBytes, 0, &pSendOver->sysOverLapped, 0); if (nResult2 == SOCKET_ERROR && ((iError = WSAGetLastError()) != ERROR_IO_PENDING)) { Log("EOLOT_Accept [%d] WSASend Error[%d].\n", sAcceptConn, iError); closesocket(sAcceptConn); delete pSendOver; break; } Log("EOLOT_Accept WSASend OK"); }break; // OverLapped::OLOpType::EOLOT_Accept case OverLapped::OLOpType::EOLOT_Send: { delete pOver; }break; // OverLapped::OLOpType::EOLOT_Send case OverLapped::OLOpType::EOLOT_Recv: { Log("EOLOT_Recv New Msg"); char* pData = pOver->dataBuffer; SOCKET sAcceptConn = *pConn; pReadMsg->AddNewMsg((void*)pData, (size_t)dwBytes, sAcceptConn); // µÈ´ý½ÓÊÜÏÂÒ»×éÊý¾Ý ZeroMemory(pOver->dataBuffer, OverLappedBufferLen); DWORD dwTemp[2] = { 0, 0 }; int nResult = WSARecv(sAcceptConn, &pOver->sysBuffer, 1, &dwTemp[0], &dwTemp[1], &pOver->sysOverLapped, 0); if (nResult == SOCKET_ERROR && WSAGetLastError() != ERROR_IO_PENDING) { closesocket(sAcceptConn); delete pOver; break; } //// Ä£Äâ·¢ËͲâÊÔÊý¾Ý //OverLapped* pSendOver = new OverLapped; //pSendOver->opType = OverLapped::OLOpType::EOLOT_Send; //ZeroMemory(pSendOver->dataBuffer, OverLappedBufferLen); //sprintf_s(pSendOver->dataBuffer, "server new send time %d", GetTickCount()); //pSendOver->sysBuffer.len = strlen(pSendOver->dataBuffer); //int nResult2 = WSASend(sAcceptConn, &pSendOver->sysBuffer, 1, &dwBytes, 0, &pSendOver->sysOverLapped, 0); //if (nResult2 == SOCKET_ERROR && WSAGetLastError() != ERROR_IO_PENDING) //{ // closesocket(sAcceptConn); // delete pOver; // break; //} }break; // OverLapped::OLOpType::EOLOT_Recv } } } } void AddWaitingAcceptConn(SOCKET sListenConn, LPFN_ACCEPTEX lpfnAcceptEx) { for (int a = 0; a < WaitingAcceptCon; a++) { SOCKET sAcceptConn = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0, 0, WSA_FLAG_OVERLAPPED); //SOCKET sAcceptConn = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0, 0, WSA_FLAG_OVERLAPPED); if (sAcceptConn == INVALID_SOCKET) return; Log("WSASocket new AccepteConn [%d].", sAcceptConn); OverLapped* pAcceptExOverLapped = new OverLapped; pAcceptExOverLapped->opType = OverLapped::OLOpType::EOLOT_Accept; pAcceptExOverLapped->sysBuffer.len = (DWORD)sAcceptConn; // git snap(0342d1d): µ÷Óà AcceptEx ·µ»Ø´íÎó (WSA_IO_PENDING) // git snap(6234b13): Ôö¼Ó²âÊÔ´úÂë(BOOL bRet = AcceptEx, ²¢´òÓ¡´íÎóÂë), ·µ»Ø´íÎó(WSAEINVAL), ÒòΪsAcceptConn±»AcceptExÁ½´Î DWORD dwBytes; BOOL bRet = AcceptEx(sListenConn, sAcceptConn, pAcceptExOverLapped->sysBuffer.buf, 0, AcceptExSockAddrInLen, AcceptExSockAddrInLen, &dwBytes, &pAcceptExOverLapped->sysOverLapped); if (!bRet && WSAGetLastError() != WSA_IO_PENDING) { printf("WSAGetLastError = [%d].\n", WSAGetLastError()); delete pAcceptExOverLapped; return; } } MustPrint("AddWaitingAcceptConn OK.\n"); } void Flush(SOCKET sListenConn, HANDLE hAcceptExEvent, LPFN_ACCEPTEX lpfnAcceptEx) { DWORD dwResult = WaitForSingleObject(hAcceptExEvent, 0); if (dwResult == WAIT_FAILED) { IOCP_ASSERT(false, "WaitForSingleObject return WAIT_FAILED.\n"); } else if (dwResult != WAIT_TIMEOUT) { AddWaitingAcceptConn(sListenConn, lpfnAcceptEx); } } int main() { //WSADATA wsData; //IOCP_ASSERT(WSAStartup(MAKEWORD(2, 2), &wsData) == 0, "WSAStartup Failed.\n"); //HANDLE hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, 2); //IOCP_ASSERT(hIOCP != NULL, "CreateIoCompletionPort Failed.\n"); //SOCKET sLinstenConn = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_IP, 0, 0, WSA_FLAG_OVERLAPPED); //IOCP_ASSERT(sLinstenConn != INVALID_SOCKET, "WSASocket Failed.\n"); //MustPrint("Socket Create Ok.\n"); ////int nReuseAddr = 1; ////setsockopt(Conn, SOL_SOCKET, SO_REUSEADDR, (const char*)&nReuseAddr, sizeof(int)); //SOCKADDR_IN addr; //addr.sin_family = AF_INET; //addr.sin_port = htons(6666); //addr.sin_addr.s_addr = inet_addr(TestIPAddr); // inet_addr("127.0.0.1"); // htonl(INADDR_ANY); //if (bind(sLinstenConn, (PSOCKADDR)&addr, sizeof(addr)) == SOCKET_ERROR) // IOCP_ASSERT(false, "bind Failed.\n"); // //// ²ÎÊý2£º The maximum length of the queue of pending connections. //// If set to SOMAXCONN, the underlying service provider responsible for socket s will set the backlog to a maximum reasonable value. //// There is no standard provision to obtain the actual backlog value //// µÈ´ý¶ÓÁеÄ×î´ó³¤¶È¡£ //if (listen(sLinstenConn, SOMAXCONN) == SOCKET_ERROR) // IOCP_ASSERT(false, "listen Failed.\n"); //MustPrint("Listen OK.\n"); //// ¹ØÁª¼àÌýÁ¬½ÓºÍÍê³É¶Ë¿Ú //if (!CreateIoCompletionPort((HANDLE)sLinstenConn, hIOCP, (DWORD_PTR)&sLinstenConn, 0)) // IOCP_ASSERT(false, "CreateIoCompletionPort Associate IOCP with Conn Failed.\n"); //MustPrint("Create IOCP OK.\n"); //// Load the AcceptEx function into memory using WSAIoctl. The WSAIoctl function is an extension of the ioctlsocket() //// function that can use overlapped I/O. The function's 3rd through 6th parameters are input and output buffers where //// we pass the pointer to our AcceptEx function. This is used so that we can call the AcceptEx function directly, rather //// than refer to the Mswsock.lib library. //GUID GuidAcceptEx = WSAID_ACCEPTEX; // WSAID_GETACCEPTEXSOCKADDRS //LPFN_ACCEPTEX lpfnAcceptEx = NULL; //DWORD dwBytes; //int iResult = WSAIoctl(sLinstenConn, SIO_GET_EXTENSION_FUNCTION_POINTER, // &GuidAcceptEx, sizeof (GuidAcceptEx), // &lpfnAcceptEx, sizeof (lpfnAcceptEx), // &dwBytes, NULL, NULL); NetMsg* ReadMsg = new NetMsg; NetMsg* WriteMsg = new NetMsg; //// ´´½¨¹¤×÷Ïß³Ì, Ï̹߳ØÁªÊý¾Ý //ThreadInfo tThreadInfo; //tThreadInfo.hIOCP = hIOCP; //tThreadInfo.Conn = sLinstenConn; //tThreadInfo.ReadMsg = ReadMsg; //tThreadInfo.WriteMsg = WriteMsg; ////tThreadInfo.lpfAccepEx = lpfnAcceptEx; //HANDLE hWorkThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ThreadProcess, &tThreadInfo, 0, 0); //IOCP_ASSERT(hWorkThread, "CreateThread Failed.\n"); //MustPrint("CreateThread OK.\n"); //// ´´½¨Ê¼þ£¬ÔÚAcceptExÖеÄÔ¤·ÖÅäµÄÁ¬½ÓʹÓÃÍêʱ£¬Ôٴδ´½¨ //HANDLE hAcceptExEvent = CreateEvent(0, false, false, 0); //IOCP_ASSERT(hAcceptExEvent, "CreateEvent Failed.\n"); //iResult = WSAEventSelect(sLinstenConn, hAcceptExEvent, FD_ACCEPT); //IOCP_ASSERT(iResult != SOCKET_ERROR, "WSAEventSelect Failed.\n"); //MustPrint("Event Select OK.\n"); //// Ìí¼ÓµÚÒ»ÅúµÄÔ¤´´½¨Á¬½Ó //AddWaitingAcceptConn(sLinstenConn, lpfnAcceptEx); // ´´½¨luainterface LuaInterface luaInterface; luaInterface.Init(); luaInterface.SetMsgBuffer(ReadMsg, WriteMsg); while (true) { // Flush(sLinstenConn, hAcceptExEvent, lpfnAcceptEx); // TODO: Ïà¹Ø´úÂëID:201508042055 // LogPrint("ReadMsg[0x%08x] Size = [%d].", &ReadMsg, ReadMsg.GetSize()); luaInterface.Run(); // µÈ´ý200ms Sleep(1000); } return 1; }
{ "content_hash": "273ea32555c4a0bc008133845a796e35", "timestamp": "", "source": "github", "line_count": 311, "max_line_length": 232, "avg_line_length": 35.643086816720256, "alnum_prop": 0.6870545782589085, "repo_name": "Eric-Dang/pbc_test", "id": "4ecb446c9a4811a2834572dc2cf5d61835dda6f5", "size": "12093", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Server.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "683375" }, { "name": "C++", "bytes": "746138" }, { "name": "Lua", "bytes": "29572" }, { "name": "Makefile", "bytes": "9759" }, { "name": "Protocol Buffer", "bytes": "1028" }, { "name": "PureBasic", "bytes": "77" } ], "symlink_target": "" }
Project and environment manager for MarkLogic. All details on: http://mlproj.org/. ## Install Use the following: ``` npm install mlproj -g ``` This needs Node to be installed on your system. Package managers for all systems include it. Look at [Node](http://nodejs.org/) website for details and install options. ## Features `mlproj` let you manage, deploy and configure MarkLogic projects. In order to achieve this, it also let you describe your environments and automatically set them up. Use `mlproj help` for an overview. Go to http://mlproj.org/ for all details. ## TODO **SOURCES** - support sources as is (only includes/excludes), in new and load - wrap file path list generation (filtering, all that) - add support for garbage (w/ default value) - add support for @defaults - test @defaults in xproject/mlproj.json and ~/.mlproj.json - link sources to databases and servers - add support for filter - add support for feeder - add URI calculation support (decl. (root, prefix...) + function) - add way to link to a JS file + function name (for filter, feeder, and uri) In commands.js: // ************ // - Move these NEW_*() to files in a sub-dir, and load them. // - Transform them to give them a chance to inject some data, // asked for on the command line. // - Use different sub-dirs for different scaffoldings. // ************ - maintain the file extensions (and their types) in the project file - allow command `new` to create projects with different scaffoldings - using "embedded" scaffoldings (empty, plain, complete, annotated, web, rest...) - using "remotes" ones (on Git repos?) - `new` can even create such scaffolding templates - and they can be `publish`ed in a gallery - complete examples for outreach, or real operational scaffoldings - new command `add` to add components, indexes, etc. by answering few questions - new command `mlcp` to invoke MLCP with info from the environment files - new command `test` to run tests from command line - new command to install a XAR/XAW file - new command to install a XAR/XAW from CXAN - new command to publish to CXAN - edit environment files from the Console - word lexicons - add support for triggers in environs Support the following scenario (e.g. for the EXPath ML Console): ``` # check values are correct (supported) mlproj -e dev -h myvm -u admin -z -p port:8010 show # setup the environment (supported) mlproj -e dev -h myvm -u admin -z -p port:8010 setup # deploy modules (supported) mlproj -e dev -h myvm -u admin -z -p port:8010 deploy # initialize the app (to support) mlproj -e dev -h myvm -u admin -z -p port:8010 init ``` which could/should be made easier: ``` # install everything (setup + deploy + init) (to support) mlproj -e dev -h myvm -u admin -z -p port:8010 install ```
{ "content_hash": "f4f63d972fa430f86dea26fc3334566d", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 83, "avg_line_length": 32.46511627906977, "alnum_prop": 0.7234957020057307, "repo_name": "fgeorges/mlproj", "id": "c5fd1189e7ff74c2bf3268f95c8088b8ddc7e54d", "size": "2802", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "94415" } ], "symlink_target": "" }
<div> <tabset> <tab heading="Form"><br> <form role="form"> <div class="form-group"> <label for="exampleInputEmail1">Email address</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email"> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password"> </div> <div class="form-group"> <label for="exampleInputFile">File input</label> <input type="file" id="exampleInputFile"> <p class="help-block">Example block-level help text here.</p> </div> <div class="checkbox"> <label> <input type="checkbox"> Check me out </label> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </tab> <tab heading="Context"> <br/> <h5>Milestones</h5> <progress><bar ng-repeat="bar in task.process.milestones" value="bar.value" type="{{bar.type}}">{{bar.title}}</bar></progress> <div ng-click="task.isCollapsed = !task.isCollapsed"> <h5>Current Tasks <span ng-if='!task.isCollapsed' class='glyphicon glyphicon-chevron-up pull-right'></span></h5> <span ng-if='task.isCollapsed' class='glyphicon glyphicon-chevron-down pull-right'> </span></h5> </div> <ul class='list-group' collapse="task.isCollapsed"> <li class='list-group-item'>Name : {{task.name}}</li> <li class='list-group-item'>Due Date : {{task.dueDate}}</li> <li class='list-group-item'>Priority : {{task.priority}}</li> <li class='list-group-item'>Actors : <div class="btn-group"> <button ng-repeat='actor in task.actors' type="button" class="btn btn-primary">{{actor}}</button> </div> </li> </ul> <div ng-click="case.isCollapsed = !case.isCollapsed"> <h5>Case Info <span ng-if='!case.isCollapsed' class='glyphicon glyphicon-chevron-up pull-right'></span> <span ng-if='case.isCollapsed' class='glyphicon glyphicon-chevron-down pull-right'> </span></h5> </div> <ul class='list-group' collapse="case.isCollapsed"> <li class='list-group-item'>Case's Name : {{task.process.name}}</li> <li class='list-group-item'>Started by : {{task.process.startedBy}} on the {{task.process.startDate}}</li> <li class='list-group-item'><a href='mailto:{{task.manager.email}}'><span class='glyphicon glyphicon-envelope'></span> {{task.process.manager.firstname}} {{task.process.manager.lastname}}</a></li> <li class='list-group-item'>DeadLine : {{task.process.dueDate}}</li> </ul> <div ng-click="previousTask.isCollapsed = !previousTask.isCollapsed"> <h5>Previous Tasks <span ng-if='!previousTask.isCollapsed' class='glyphicon glyphicon-chevron-up pull-right'></span> <span ng-if='previousTask.isCollapsed' class='glyphicon glyphicon-chevron-down pull-right'> </span></h5> </div> <ul class='list-group' collapse="previousTask.isCollapsed"> <li class='list-group-item'>Name : {{task.previous.name}}</li> <li class='list-group-item'>Done on : {{task.previous.executionDate}}</li> <li class='list-group-item'>Done by : {{task.previous.executedBy}}</li> </ul> </tab> <tab heading="Subtask">Subtask</tab> </tabset> </div>
{ "content_hash": "82b469ec93a91e73ae73f2cab80aa750", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 204, "avg_line_length": 50.52857142857143, "alnum_prop": 0.6089906700593724, "repo_name": "redboul/webNodeApp", "id": "84a8994801cd5141608de991b97b601193500678", "size": "3537", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/views/tasks/details.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "979" }, { "name": "CoffeeScript", "bytes": "1428" }, { "name": "JavaScript", "bytes": "29091" } ], "symlink_target": "" }
'use strict'; const util = require('util'); const moment = require('abacus-moment'); const _ = require('underscore'); const extend = _.extend; // Configure API and COLLECTOR URLs process.env.API = 'http://api'; process.env.COLLECTOR = 'http://collector'; const tests = (secured) => { let dbEnv; let reqmock; let bridge; let clock; const cfToken = () => 'token'; const abacusToken = () => 'token'; const deleteModules = () => { // Delete cached modules exports delete require.cache[require.resolve('abacus-batch')]; delete require.cache[require.resolve('abacus-breaker')]; delete require.cache[require.resolve('abacus-carryover')]; delete require.cache[require.resolve('abacus-dbclient')]; delete require.cache[require.resolve('abacus-couchclient')]; delete require.cache[require.resolve('abacus-mongoclient')]; delete require.cache[require.resolve('abacus-paging')]; delete require.cache[require.resolve('abacus-client')]; delete require.cache[require.resolve('abacus-request')]; delete require.cache[require.resolve('abacus-retry')]; delete require.cache[require.resolve('abacus-throttle')]; delete require.cache[require.resolve('abacus-yieldable')]; delete require.cache[require.resolve('..')]; }; before((done) => { dbEnv = process.env.DB; // Configure test db URL prefix process.env.DB = process.env.DB || 'test'; // Delete test dbs on the configured db server const dbclient = require('abacus-dbclient'); dbclient.drop(process.env.DB, /^abacus-cf-bridge-/, () => { dbclient.drop(process.env.DB, /^abacus-carry-over-/, done); }); }); after(() => { process.env.DB = dbEnv; }); beforeEach(() => { deleteModules(); process.env.SECURED = secured ? 'true' : 'false'; // Mock the cluster module const cluster = require('abacus-cluster'); require.cache[require.resolve('abacus-cluster')].exports = extend((app) => app, cluster); // Disable the batch, retry, breaker and throttle modules require('abacus-batch'); require.cache[require.resolve('abacus-batch')].exports = (fn) => fn; require('abacus-retry'); require.cache[require.resolve('abacus-retry')].exports = (fn) => fn; require('abacus-breaker'); require.cache[require.resolve('abacus-breaker')].exports = (fn) => fn; require('abacus-throttle'); require.cache[require.resolve('abacus-throttle')].exports = (fn) => fn; }); afterEach(() => { if (bridge) bridge.stopReporting(); if (clock) clock.restore(); bridge = undefined; deleteModules(); // Unset the SECURED variable delete process.env.SECURED; }); const generateUsageReport = (appId, currentInstanceMemory, currentInstances, previousInstanceMemory, previousInstances) => { return { start: 1439897300000, end: 1439897300000, organization_id: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', space_id: 'f057fe03-0713-4896-94c7-24b71c6882c2', consumer_id: 'app:' + appId, resource_id: 'linux-container', plan_id: 'standard', resource_instance_id: 'memory:' + appId, measured_usage: [ { measure: 'current_instance_memory', quantity: currentInstanceMemory }, { measure: 'current_running_instances', quantity: currentInstances }, { measure: 'previous_instance_memory', quantity: previousInstanceMemory }, { measure: 'previous_running_instances', quantity: previousInstances } ] }; }; const checkUsageReport = (done, appId, currentInstanceMemory, currentInstances, previousInstanceMemory, previousInstances) => { const args = reqmock.post.args; expect(args.length).to.equal(1); expect(args[0][0]).to.equal(':collector/v1/metering/collected/usage'); expect(args[0][1]).to.contain.all.keys('collector', 'body'); expect(args[0][1].collector).to.equal('http://collector'); expect(args[0][1].body).to.deep.equal( generateUsageReport(appId, currentInstanceMemory, currentInstances, previousInstanceMemory, previousInstances)); done(); }; const expectError = (bridge, expectedError, expectedResponse, done) => { return { failure: (error, response) => { if (bridge) bridge.stopReporting(); if (error instanceof Error) expect(error.message).to.equal(expectedError); else expect(error).to.equal(expectedError); expect(response).to.deep.equal(expectedResponse); done(); }, success: () => { done(new Error('Unexpected call of success')); } }; }; const appUsagePageOne = { total_results: 4, total_pages: 2, prev_url: null, next_url: '/page2', resources: [ { metadata: { guid: '1', url: '/v2/app_usage_events/1', created_at: '2015-08-18T11:28:20Z' }, entity: { state: 'STARTED', previous_state: 'STOPPED', memory_in_mb_per_instance: 1024, previous_memory_in_mb_per_instance: 1024, instance_count: 2, previous_instance_count: 2, app_guid: 'f3a07a06', app_name: 'abacus-eureka-plugin', space_guid: 'f057fe03-0713-4896-94c7-24b71c6882c2', space_name: 'abacus', org_guid: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', buildpack_guid: null, buildpack_name: null, package_state: 'PENDING', previous_package_state: 'PENDING', parent_app_guid: 'f3a07a06-fe7c-49ef-bcf5-b830eb3b21b3', parent_app_name: 'abacus-eureka-plugin', process_type: 'web' } }, { metadata: { guid: '2', url: '/v2/app_usage_events/2', created_at: '2015-08-18T11:28:20Z' }, entity: { state: 'STAGING_STARTED', previous_state: 'STAGING', memory_in_mb_per_instance: 1024, previous_memory_in_mb_per_instance: 1024, instance_count: 1, previous_instance_count: 1, app_guid: '', app_name: '', space_guid: 'f057fe03-0713-4896-94c7-24b71c6882c2', space_name: 'abacus', org_guid: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', buildpack_guid: null, buildpack_name: null, package_state: 'READY', previous_package_state: 'READY', parent_app_guid: 'f3a07a06', parent_app_name: 'abacus-eureka-plugin', process_type: null, task_name: null, task_guid: null } }, { metadata: { guid: '3', url: '/v2/app_usage_events/3', created_at: '2015-08-18T11:28:20Z' }, entity: { state: 'STAGING_STOPPED', previous_state: 'STAGING', memory_in_mb_per_instance: 1024, previous_memory_in_mb_per_instance: 1024, instance_count: 1, previous_instance_count: 1, app_guid: '', app_name: '', space_guid: 'f057fe03-0713-4896-94c7-24b71c6882c2', space_name: 'abacus', org_guid: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', buildpack_guid: null, buildpack_name: 'https://hub.com/cloudfoundry/nodejs-buildpack.git', package_state: 'READY', previous_package_state: 'READY', parent_app_guid: 'f3a07a06', parent_app_name: 'abacus-eureka-plugin', process_type: null, task_name: null, task_guid: null } }, { metadata: { guid: '4', url: '/v2/app_usage_events/4', created_at: '2015-08-18T11:28:20Z' }, entity: { state: 'BUILDPACK_SET', previous_state: 'STARTED', memory_in_mb_per_instance: 1024, previous_memory_in_mb_per_instance: 1024, instance_count: 2, previous_instance_count: 2, app_guid: 'f3a07a06', app_name: 'abacus-eureka-plugin', space_guid: 'f057fe03-0713-4896-94c7-24b71c6882c2', space_name: 'abacus', org_guid: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', buildpack_guid: '30429b05-745e-4474-a39f-267afa365d69', buildpack_name: 'https://hub.com/cloudfoundry/nodejs-buildpack.git', package_state: 'STAGED', previous_package_state: 'UNKNOWN', parent_app_guid: 'f3a07a06-fe7c-49ef-bcf5-b830eb3b21b3', parent_app_name: 'abacus-eureka-plugin', process_type: 'web' } } ] }; const appUsagePageTwo = { total_results: 1, total_pages: 1, prev_url: null, next_url: null, resources: [ { metadata: { guid: '904419c6', url: '/v2/app_usage_events/904419c4', created_at: '2015-08-18T11:28:20Z' }, entity: { state: 'STARTED', previous_state: 'STARTED', memory_in_mb_per_instance: 512, previous_memory_in_mb_per_instance: 256, instance_count: 1, previous_instance_count: 2, app_guid: '35c4ff2f', app_name: 'app', space_guid: 'f057fe03-0713-4896-94c7-24b71c6882c2', space_name: 'abacus', org_guid: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', buildpack_guid: null, buildpack_name: null, package_state: 'PENDING', previous_package_state: 'PENDING', parent_app_guid: null, parent_app_name: null, process_type: 'web' } } ] }; context('on non-empty usage event stream', () => { context('with multiple pages', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { if (opts.page.indexOf('page2') > -1) cb(null, { statusCode: 200, body: appUsagePageTwo }); else cb(null, { statusCode: 200, body: appUsagePageOne }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); const checkGetRequest = (expectedAPIOption, expectedURL, req) => { expect(req[1]).to.contain.all.keys('api', 'page', 'headers'); expect(req[1].api).to.equal(expectedAPIOption); expect(req[1].page).to.equal(expectedURL); }; it('gets app usage events from API', () => { const args = reqmock.get.args; expect(args.length).to.equal(2); checkGetRequest('http://api', '/v2/app_usage_events?' + 'order-direction=asc&results-per-page=50', args[0]); checkGetRequest('http://api', '/page2', args[1]); }); const checkPostRequest = (req, appId, currentMemory, currentInstances, previousMemory, previousInstances) => { expect(req[0]).to.equal(':collector/v1/metering/collected/usage'); expect(req[1]).to.contain.all.keys('collector', 'body'); expect(req[1].collector).to.equal('http://collector'); expect(req[1].body).to.deep.equal( generateUsageReport(appId, currentMemory, currentInstances, previousMemory, previousInstances)); }; it('reports resource usage to COLLECTOR', () => { const args = reqmock.post.args; expect(args.length).to.equal(2); checkPostRequest(args[0], 'f3a07a06', 1073741824, 2, 0, 0); checkPostRequest(args[1], '35c4ff2f', 536870912, 1, 268435456, 2); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 1, pageReadFailures: 0, pageProcessSuccess: 5, pageProcessFailures: 0, pageProcessEnd: 2, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 2, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 2, loopConflict: 0, loopSkip: 3, missingToken: 0 }); }); it('populates carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 2, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 2, upsertFailure: 0 }); }); }); context('with single page', () => { context('for starting app', () => { beforeEach((done) => { // Deep-clone page two const appUsagePage = JSON.parse(JSON.stringify(appUsagePageTwo)); const resourceEntity = appUsagePage.resources[0].entity; resourceEntity.previous_state = 'STOPPED'; resourceEntity.previous_instance_count = 0; resourceEntity.previous_memory_in_mb_per_instance = 0; // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePage }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); it('reports app usage event', (done) => { checkUsageReport(done, '35c4ff2f', 536870912, 1, 0, 0); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 1, pageReadFailures: 0, pageProcessSuccess: 1, pageProcessFailures: 0, pageProcessEnd: 1, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 1, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 1, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('populates carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 1, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 1, upsertFailure: 0 }); }); }); context('for scaling app', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); it('reports app usage event', (done) => { checkUsageReport(done, '35c4ff2f', 536870912, 1, 268435456, 2); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 1, pageReadFailures: 0, pageProcessSuccess: 1, pageProcessFailures: 0, pageProcessEnd: 1, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 1, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 1, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('populates carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 1, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 1, upsertFailure: 0 }); }); }); context('for stopping app', () => { beforeEach((done) => { // Deep-clone page two const appUsagePage = JSON.parse(JSON.stringify(appUsagePageTwo)); const resourceEntity = appUsagePage.resources[0].entity; resourceEntity.state = 'STOPPED'; // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePage }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); it('reports app usage event', (done) => { checkUsageReport(done, '35c4ff2f', 0, 0, 268435456, 2); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 1, pageReadFailures: 0, pageProcessSuccess: 1, pageProcessFailures: 0, pageProcessEnd: 1, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 1, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 1, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('populates carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 1, getFailure: 0, removeSuccess: 1, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); }); }); context('on empty usage event stream', () => { const appUsage = { total_results: 0, total_pages: 1, prev_url: null, next_url: null, resources: [] }; let bridge; let returnEmptyPage; beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { if (returnEmptyPage) cb(null, { statusCode: 200, body: appUsage }); else if (opts.page.indexOf('page2') > -1) cb(null, { statusCode: 200, body: appUsagePageTwo }); else cb(null, { statusCode: 200, body: appUsagePageOne }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; // Mock the dbclient module const dbclient = require('abacus-dbclient'); const dbclientModule = require.cache[require.resolve('abacus-dbclient')]; dbclientModule.exports = extend(() => { return { fname: 'test-mock', get: (key, cb) => { cb(undefined, {}); }, put: (doc, cb) => { cb(undefined, {}); }, remove: (doc, cb) => { cb(undefined, {}); } }; }, dbclient); bridge = require('..'); returnEmptyPage = true; // Fake timer clock = sinon.useFakeTimers(moment.utc().valueOf()); }); it('does not report app usage', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); expect(reqmock.post.args.length).to.equal(0); done(); } }); }); it('continues reporting on new app usage', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { if (returnEmptyPage) { returnEmptyPage = false; expect(reqmock.post.args.length).to.equal(0); // Run pending timers - force retry to trigger clock.tick(bridge.compensationConfig.minInterval); } else { bridge.stopReporting(); expect(reqmock.post.args.length).to.equal(2); done(); } } }); }); }); context('on failure', () => { let bridge; afterEach(() => { bridge = undefined; }); context('getting usage from CF, errors', () => { context('on fetching usage', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb('error', {}); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, expectError(bridge, 'error', {}, done)); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 1, pageProcessSuccess: 0, pageProcessFailures: 0, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 0, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 1, pageProcessSuccess: 0, pageProcessFailures: 0, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 0, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('when unauthorized', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 401 }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, expectError(bridge, null, { statusCode: 401 }, done)); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 1, pageProcessSuccess: 0, pageProcessFailures: 0, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 0, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('with missing CF oAuth Token', () => { beforeEach((done) => { bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(() => undefined, abacusToken, expectError(bridge, 'Missing CF token', undefined, done)); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 0, pageProcessSuccess: 0, pageProcessFailures: 0, pageProcessEnd: 0, missingToken: 1 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 0, reportBusinessError: 0, reportConflict: 0, loopFailures: 0, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); }); context('posting usage to Abacus', () => { context('on bad response code', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 500, body: {} }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, expectError(bridge, 'Failed reporting usage. Consecutive failures: 1', { statusCode: 500, body: {} }, done)); }); it('increases the retry count', () => { expect(bridge.reportingConfig.currentRetries).to.equal(1); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 0, pageProcessSuccess: 0, pageProcessFailures: 1, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 1, reportSuccess: 0, reportBusinessError: 0, reportConflict: 0, loopFailures: 1, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('on business error', () => { context('on 409 response code', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 409, body: { error: 'conflict', reason: 'Conflict? Please retry' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 1, pageReadFailures: 0, pageProcessSuccess: 1, pageProcessFailures: 0, pageProcessEnd: 1, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 0, reportBusinessError: 1, reportConflict: 1, loopFailures: 0, loopSuccess: 0, loopConflict: 1, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('on 409 response code with noretry', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 409, body: { error: 'conflict', reason: 'Conflict! Do not retry', noretry: true } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 1, pageReadFailures: 0, pageProcessSuccess: 1, pageProcessFailures: 0, pageProcessEnd: 1, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 0, reportSuccess: 0, reportBusinessError: 1, reportConflict: 1, loopFailures: 0, loopSuccess: 0, loopConflict: 1, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('on 201 response code', () => { beforeEach((done) => { const errorBody = { error: 'emplannotfound', reason: 'Metering plan for the metering plan id ' + 'complex-object-storage is not found', cause: { statusCode: 404 } }; // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, headers: { location: 'some location' }, body: errorBody }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { expect(error).to.deep.equal(errorBody); expect(response.statusCode).to.equal(201); bridge.stopReporting(); done(); }, success: () => { done(new Error('Unexpected call of success')); } }); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 0, pageProcessSuccess: 0, pageProcessFailures: 1, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 1, reportSuccess: 0, reportBusinessError: 1, reportConflict: 0, loopFailures: 1, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('on 500 response code with noretry', () => { beforeEach((done) => { const errorBody = { error: 'internal', reason: 'Network connectivity problem' }; // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 500, headers: { location: 'some location' }, body: errorBody }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { expect(error).to.deep.equal(errorBody); expect(response.statusCode).to.equal(500); bridge.stopReporting(); done(); }, success: () => { done(new Error('Unexpected call of success')); } }); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 0, pageProcessSuccess: 0, pageProcessFailures: 1, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 1, reportSuccess: 0, reportBusinessError: 1, reportConflict: 0, loopFailures: 1, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); }); context('on error', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb('error', {}); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, expectError(bridge, 'error', {}, done)); }); it('increases the retry count', () => { expect(bridge.reportingConfig.currentRetries).to.equal(1); }); it('populates paging statistics', () => { expect(bridge.statistics.paging).to.deep.equal({ pageReadSuccess: 0, pageReadFailures: 0, pageProcessSuccess: 0, pageProcessFailures: 1, pageProcessEnd: 0, missingToken: 0 }); }); it('populates usage statistics', () => { expect(bridge.statistics.usage).to.deep.equal({ reportFailures: 1, reportSuccess: 0, reportBusinessError: 0, reportConflict: 0, loopFailures: 1, loopSuccess: 0, loopConflict: 0, loopSkip: 0, missingToken: 0 }); }); it('does not change carry-over statistics', () => { expect(bridge.statistics.carryOver).to.deep.equal({ getSuccess: 0, getFailure: 0, removeSuccess: 0, removeFailure: 0, upsertSuccess: 0, upsertFailure: 0 }); }); }); context('when there are several failed requests', () => { beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { if (opts.page.indexOf('page2') > -1) cb(null, { statusCode: 200, body: appUsagePageTwo }); else cb(null, { statusCode: 200, body: appUsagePageOne }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportingConfig.currentRetries = 1; }); it('resets the retry count on successful request', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { success: () => { bridge.stopReporting(); expect(bridge.reportingConfig.currentRetries).to.equal(0); done(); }, failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); } }); }); }); context('when after_guid is not recognized', () => { let returnError = false; beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { if (returnError) cb(null, { statusCode: 400, body: { code: 10005, description: 'The query parameter is invalid' } }); else cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; bridge.reportAppUsage(cfToken, abacusToken, { success: () => { bridge.stopReporting(); // Make spy return an invalid query error returnError = true; done(); }, failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); } }); }); it('resets the last processed data', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); expect(error).to.equal(null); expect(response).to.deep.equal({ statusCode: 400, body: { code: 10005, description: 'The query parameter is invalid' } }); expect(bridge.cache.lastRecordedGUID).to.equal(undefined); expect(bridge.cache.lastRecordedTimestamp).to.equal(undefined); done(); }, success: () => { done(new Error('Unexpected call of success')); } }); }); }); context('with missing oAuth resource token', () => { beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; }); it('errors if token needed ', (done) => { if (secured) bridge.reportAppUsage(cfToken, () => undefined, expectError(bridge, 'Missing resource provider token', null, done)); else bridge.reportAppUsage(cfToken, () => undefined, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); }); }); context('with missing Location header', () => { const resource = appUsagePageTwo.resources[0].entity; const expectedErrorMessage = util.format('No Location header found' + ' in response %j for usage %j', { statusCode: 201, body: {} }, generateUsageReport(resource.app_guid, resource.memory_in_mb_per_instance * 1024 * 1024, resource.instance_count, resource.previous_memory_in_mb_per_instance * 1024 * 1024, resource.previous_instance_count)); beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {} }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; }); it('throws error', (done) => { expect(() => { bridge.reportAppUsage(cfToken, abacusToken, { success: () => { bridge.stopReporting(); done(new Error('Unexpected call of success')); }, failure: () => { bridge.stopReporting(); done(new Error('Unexpected call of failure')); } }); }).to.throw(Error, expectedErrorMessage); done(); }); it('does not increase the retry count', (done) => { expect(() => { bridge.reportAppUsage(cfToken, abacusToken, { success: () => { bridge.stopReporting(); done(new Error('Unexpected call of success')); }, failure: () => { bridge.stopReporting(); done(new Error('Unexpected call of failure')); } }); }).to.throw(Error); expect(bridge.reportingConfig.currentRetries).to.equal(0); done(); }); }); }); }); context('usage event listing', () => { const appUsage = { total_results: 1, total_pages: 1, prev_url: null, next_url: null, resources: [ { metadata: { guid: '904419c6ddba', url: '/v2/app_usage_events/904419c4', created_at: '0' }, entity: { state: 'STARTED', memory_in_mb_per_instance: 512, instance_count: 1, app_guid: '35c4ff0f', app_name: 'app', space_guid: 'f057fe03-0713-4896-94c7-24b71c6882c2', space_name: 'abacus', org_guid: '640257fa-d7aa-4aa4-9a77-08ec60aae4f5', buildpack_guid: null, buildpack_name: null, package_state: 'PENDING', parent_app_guid: null, parent_app_name: null, process_type: 'web' } } ] }; let bridge; context('when we just recorded guid', () => { const date = moment.utc(moment.now() - 5000).toISOString(); beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { appUsage.resources[0].metadata.created_at = date; cb(null, { statusCode: 200, body: appUsage }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; }); it('does not update last recorded data', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); expect(bridge.cache.lastRecordedGUID).to.equal(undefined); expect(bridge.cache.lastRecordedTimestamp).to.equal(undefined); expect(bridge.statistics.usage.loopSkip).to.equal(1); done(); } }); }); }); context('when we recorded the guid far back in time', () => { const date = moment.utc(moment.now() - 600000).toISOString(); beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { appUsage.resources[0].metadata.created_at = date; cb(null, { statusCode: 200, body: appUsage }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5000; }); it('updates last recorded data', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); expect(bridge.cache.lastRecordedGUID).to.equal('904419c6ddba'); expect(bridge.cache.lastRecordedTimestamp).to.equal(date); expect(bridge.statistics.usage.loopSkip).to.equal(0); done(); } }); }); }); context('when report usage is called again', () => { beforeEach((done) => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { appUsage.resources[0].metadata.created_at = moment.utc(moment.now() - 600000).toISOString(); cb(null, { statusCode: 200, body: appUsage }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.reportingConfig.minInterval = 5; bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); // Call reporting second time bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { bridge.stopReporting(); done(); } }); } }); }); it('uses the last recorded GUID', () => { const args = reqmock.get.args; expect(args.length).to.equal(2); expect(args[1][1]).to.contain.key('page'); expect(args[1][1].page).to.contain('after_guid=904419c6ddba'); }); }); }); context('when bridge is restarted', () => { const bulkDocsMock = spy((docs, opt, cb) => { cb(undefined, docs); }); beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { if (opts.page.indexOf('page2') > -1) cb(null, { statusCode: 200, body: appUsagePageTwo }); else cb(null, { statusCode: 200, body: appUsagePageOne }); }), post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; // Mock the dbclient module const dbclient = require('abacus-dbclient'); const dbclientModule = require.cache[require.resolve('abacus-dbclient')]; dbclientModule.exports = extend(() => { return { fname: 'test-mock', get: (doc, cb) => { cb(undefined, doc); }, put: (doc, cb) => { cb(undefined, doc); }, remove: (doc, cb) => { cb(undefined, doc); }, bulkDocs: bulkDocsMock }; }, dbclient); }); it('uses the last recorded GUID and timestamp', (done) => { // Store GUID in DB bridge = require('..'); bridge.reportingConfig.minInterval = 5; bridge.initCache(() => { bridge.reportAppUsage(cfToken, abacusToken, { failure: (error, response) => { bridge.stopReporting(); done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', error, response))); }, success: () => { deleteModules(); } }); }); // Wait for the cache timer to kick in setTimeout(() => { const args = bulkDocsMock.args; expect(args.length).to.equal(1); expect(args[0][0][0]).to.deep.equal({ id: 'abacus-cf-bridge-cache', lastRecordedGUID: '904419c6', lastRecordedTimestamp: '2015-08-18T11:28:20Z', lastCompensatedGUID: undefined, lastCompensatedTimestamp: undefined, _rev: undefined }); done(); }, 500); }); }); context('when token is missing', () => { let setReportingTimeout = null; beforeEach(() =>{ bridge = require('..'); setReportingTimeout = bridge.setReportingTimeout; bridge.setReportingTimeout = () => {}; }); afterEach(() => { bridge.setReportingTimeout = setReportingTimeout; }); it('should update missing token status', function(done) { if(!secured) this.skip(); const startTime = moment.now(); bridge.reportAppUsage(null, () => null, { success: () => { done(new Error(util.format('Unexpected call of success'))); }, failure: (err, resp) => { expect(err).to.equal('Missing resource provider token'); expect(resp).to.equal(null); expect(bridge.errors.missingToken).to.equal(true); expect(bridge.errors.lastError) .to.equal('Missing resource provider token'); let errorTime = moment.utc(bridge.errors.lastErrorTimestamp) .valueOf(); expect(errorTime).to.be.at.least(startTime); done(); } }); }); }); context('when token is no more missing', () => { beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: {}, headers: { location: 'some location' } }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.errors.missingToken = true; }); it('should update missing token status', (done) => { bridge.reportAppUsage(cfToken, abacusToken, { success: () => { expect(bridge.errors.missingToken).to.equal(false); done(); }, failure: (err, resp) => { done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', err, resp))); } }); }); }); context('when reporting error conditions', () => { context('and no report ever happened', () => { beforeEach(() => { bridge = require('..'); }); it('noReportEverHappened should be true', (done) => { expect(bridge.errors.noReportEverHappened).to.equal(true); expect(bridge.errors.lastError).to.equal(''); expect(bridge.errors.lastErrorTimestamp).to.equal(''); done(); }); }); context('and there are successful reports', () => { beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { post: spy((uri, opts, cb) => { cb(null, { statusCode: 201, body: {}, headers: { location: 'some location' } }); }), get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); bridge.errors.consecutiveReportFailures = 5; }); it('noReportEverHappened should be false', (done) => { expect(bridge.errors.noReportEverHappened).to.equal(true); bridge.reportAppUsage(cfToken, abacusToken, { success: () => { expect(bridge.errors.noReportEverHappened).to.equal(false); expect(bridge.errors.lastError).to.equal(''); expect(bridge.errors.lastErrorTimestamp).to.equal(''); done(); }, failure: (err, resp) => { done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', err, resp))); } }); }); it('consecutiveFailures should be 0', (done) => { expect(bridge.errors.consecutiveReportFailures).to.equal(5); bridge.reportAppUsage(cfToken, abacusToken, { success: () => { expect(bridge.errors.consecutiveReportFailures).to.equal(0); expect(bridge.errors.lastError).to.equal(''); expect(bridge.errors.lastErrorTimestamp).to.equal(''); done(); }, failure: (err, resp) => { done(new Error(util.format('Unexpected call of failure with ' + 'error %j and response %j', err, resp))); } }); }); }); context('and there are consecutive failures', () => { beforeEach(() => { // Mock the request module const request = require('abacus-request'); reqmock = extend({}, request, { post: spy((uri, opts, cb) => { cb('Failed to post report', {}); }), get: spy((uri, opts, cb) => { cb(null, { statusCode: 200, body: appUsagePageTwo }); }) }); require.cache[require.resolve('abacus-request')].exports = reqmock; bridge = require('..'); }); it('should increment consecutiveFailures', (done) => { const currentFailures = bridge.errors.consecutiveReportFailures; const startTime = moment.now(); bridge.reportAppUsage(cfToken, abacusToken, { success: () => { done(new Error(util.format('Unexpected call of success'))); }, failure: () => { expect(bridge.errors.consecutiveReportFailures) .to.equal(currentFailures + 1); expect(bridge.errors.lastError).to.equal('Error reporting usage; ' + 'error: Failed to post report; response: {}'); let errorTime = moment.utc(bridge.errors.lastErrorTimestamp) .valueOf(); expect(errorTime).to.be.at.least(startTime); done(); } }); }); }); }); }; describe('Report app usage without security', () => tests(false)); describe('Report app usage with security', () => tests(true));
{ "content_hash": "17bb18b5f40940151328a43e90d439d3", "timestamp": "", "source": "github", "line_count": 2045, "max_line_length": 80, "avg_line_length": 32.380929095354524, "alnum_prop": 0.49686645826726467, "repo_name": "rajkiranrbala/cf-abacus", "id": "d9675b6edee910cc67e4231412717291d8af9cc4", "size": "66219", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/cf/bridge/src/test/report-usage-test.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "6015" }, { "name": "JavaScript", "bytes": "1932262" }, { "name": "Ruby", "bytes": "3026" }, { "name": "Shell", "bytes": "39467" } ], "symlink_target": "" }
@import Foundation; //! Project version number for KGNColor. FOUNDATION_EXPORT double KGNColorVersionNumber; //! Project version string for KGNColor. FOUNDATION_EXPORT const unsigned char KGNColorVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <KGNColor/PublicHeader.h>
{ "content_hash": "423f2807f43cd99ebce893a71dc2ccac", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 133, "avg_line_length": 32, "alnum_prop": 0.8011363636363636, "repo_name": "kgn/KGNColor", "id": "d5fd56a2957ddfaa7719e4a0444c59a6d4442d37", "size": "488", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Source/KGNColor.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "488" }, { "name": "Ruby", "bytes": "552" }, { "name": "Swift", "bytes": "6810" } ], "symlink_target": "" }
<?php namespace Chamilo\Core\Repository\Implementation\Scribd\Integration\Chamilo\Core\Menu\Package; class Installer extends \Chamilo\Configuration\Package\Action\Installer { }
{ "content_hash": "20280ce8e561ec4a0d24c672669301c7", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 94, "avg_line_length": 29.666666666666668, "alnum_prop": 0.8370786516853933, "repo_name": "cosnicsTHLU/cosnics", "id": "8f226fee194434195d1e66a69bf7067f9c7efb9d", "size": "178", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/Chamilo/Core/Repository/Implementation/Scribd/Integration/Chamilo/Core/Menu/Package/Installer.php", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "86189" }, { "name": "C#", "bytes": "23363" }, { "name": "CSS", "bytes": "1135928" }, { "name": "CoffeeScript", "bytes": "17503" }, { "name": "Gherkin", "bytes": "24033" }, { "name": "HTML", "bytes": "542339" }, { "name": "JavaScript", "bytes": "5296016" }, { "name": "Makefile", "bytes": "3221" }, { "name": "PHP", "bytes": "21903304" }, { "name": "Ruby", "bytes": "618" }, { "name": "Shell", "bytes": "6385" }, { "name": "Smarty", "bytes": "15750" }, { "name": "XSLT", "bytes": "44115" } ], "symlink_target": "" }
{% if page.image.feature %} {% include head.html %} <section class="article"> <div class="overlay"></div> <div class="featured-image" style="background-image: url({{ site.url }}/images/{{ page.image.feature }})"></div> {% else %} {% include head-dark.html %} <section class="article pad-top"> {% endif %} <article class="wrap post"> <header class="post-header"> <hgroup> <h1>{{page.title}}</h1> <p class="date">{{page.date | date: "%b %d, %Y" }}</p> <p class="intro">{% if page.description %}{{ page.description }}{% else %}{{ page.tagline }}{% endif %}</p> </hgroup> </header> {{ content }} <a href="https://twitter.com/share" class="twitter-share-button" data-via="davejachimiak" data-size="large">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> {% if page.comments %} <aside class="disqus"> <div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = '{{ site.owner.disqus }}'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> </aside> {% endif %} </article> </section> </div> {% include footer.html %}
{ "content_hash": "651393a1e2bc6ad442a2135c6fb094c6", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 303, "avg_line_length": 40.836363636363636, "alnum_prop": 0.5841495992876224, "repo_name": "davejachimiak/davejachimiak.github.io", "id": "f4d46314a7a070fad3894516669c734dc7af4266", "size": "2246", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_layouts/post-no-feature.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "20741" }, { "name": "JavaScript", "bytes": "29503" }, { "name": "Ruby", "bytes": "50" }, { "name": "SCSS", "bytes": "30222" } ], "symlink_target": "" }
package li.strolch.service; import li.strolch.model.ModelStatistics; import li.strolch.service.api.ServiceResult; import li.strolch.service.api.ServiceResultState; public class XmlImportModelResult extends ServiceResult { private ModelStatistics statistics; public XmlImportModelResult(ModelStatistics statistics) { super(ServiceResultState.SUCCESS); this.statistics = statistics; } public XmlImportModelResult() { // no arg constructor } public XmlImportModelResult(ServiceResultState state, String message, Throwable throwable) { super(state, message, throwable); } public XmlImportModelResult(ServiceResultState state, String message) { super(state, message); } public XmlImportModelResult(ServiceResultState state) { super(state); } public ModelStatistics getStatistics() { return statistics; } }
{ "content_hash": "24260a43be5d5a78db06776a847341ca", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 93, "avg_line_length": 23.27777777777778, "alnum_prop": 0.7911694510739857, "repo_name": "4treesCH/strolch", "id": "2e83b42be5c391fb15f42750941b64a029e999c2", "size": "1456", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "li.strolch.service/src/main/java/li/strolch/service/XmlImportModelResult.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "2003" }, { "name": "CSS", "bytes": "2486" }, { "name": "HTML", "bytes": "383752" }, { "name": "Java", "bytes": "4122045" }, { "name": "JavaScript", "bytes": "2831" }, { "name": "PLSQL", "bytes": "3323" }, { "name": "Shell", "bytes": "14167" }, { "name": "Smarty", "bytes": "878" }, { "name": "TSQL", "bytes": "29111" } ], "symlink_target": "" }
'use strict'; var React = require('react'); var accounting = require('accounting'); /** * ProductRow * * @type ReactComponent * @description * A table row representing a single product. */ var ProductRow = React.createClass({ /** @return {object} */ render: function () { return <tr> <td>{this.props.product.id}</td> <td>{this.props.product.face}</td> <td style={{ fontSize: this.props.product.size }}>{this.props.product.size}</td> <td>{accounting.formatMoney(this.props.product.price)}</td> </tr>; } }); module.exports = ProductRow;
{ "content_hash": "6e8f19e8ae86ddba46b08c3ed146cbe8", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 83, "avg_line_length": 21.692307692307693, "alnum_prop": 0.6560283687943262, "repo_name": "jonathanconway/discount-ascii-warehouse-react-jest", "id": "716f43221521f131e04900a22cef0db0efc407e8", "size": "564", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/scripts/components/productRow.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "301" }, { "name": "HTML", "bytes": "189" }, { "name": "JavaScript", "bytes": "22133" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>ergo: 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.9.0 / ergo - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> ergo <small> 8.6.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-03-19 08:58:06 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-19 08:58:06 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.9.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic 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.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;[email protected]&quot; homepage: &quot;https://github.com/coq-contribs/ergo&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Ergo&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} &quot;coq-counting&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} &quot;coq-nfix&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} &quot;coq-containers&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: reflexive decision procedure&quot; &quot;keyword: satisfiability modulo theories&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures&quot; ] authors: [ &quot;Stéphane Lescuyer&quot; ] bug-reports: &quot;https://github.com/coq-contribs/ergo/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/ergo.git&quot; synopsis: &quot;Ergo: a Coq plugin for reification of term with arbitrary signature&quot; description: &quot;This library provides a tactic that performs SMT solving (SAT + congruence closure + arithmetic).&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/ergo/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=5995e362eac7d51d1d6339ab417d518e&quot; } </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-ergo.8.6.0 coq.8.9.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.9.0). The following dependencies couldn&#39;t be met: - coq-ergo -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) 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-ergo.8.6.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>
{ "content_hash": "054a9f2d3e69d44ffa75a9828fb5fd7b", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 215, "avg_line_length": 42.6144578313253, "alnum_prop": 0.5405711054566016, "repo_name": "coq-bench/coq-bench.github.io", "id": "03c1483273f0687bdb319305eecde29f8ec258a1", "size": "7100", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.08.1-2.0.5/released/8.9.0/ergo/8.6.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }